00001 #ifndef BSP_H
00002 #define BSP_H
00003
00004 #include "polygon.h"
00005 #include "lightmap.h"
00006 #include "portal.h"
00007 #include "tll.h"
00008
00009
00010 enum {Front, Back, TwoFrontOneBack, OneFrontTwoBack, OneFrontOneBack, PortalWasSplit, OnPartition};
00011
00012 typedef struct BSP_node
00013 {
00014 int nodeid;
00015 bool visible;
00016 POLYGON partition;
00017 BSP_node* backnode;
00018 BSP_node* frontnode;
00019 bool leaf;
00020 int numpolys;
00021 POLYGON* nodepolylist;
00022 Lightmap* nodelightmaplist;
00023 int numportals;
00024 LinkedList<PORTAL> portallist;
00025 } BSP_node;
00026
00027 int FindCurrentLeaf(VECTOR Position, BSP_node* node);
00028 int SplitPolygon(POLYGON, POLYGON, POLYGON*);
00029 int SelectPartitionfromList(POLYGON* nodepolylist, int numpolys, int* bestfront, int* bestback);
00030 void BuildBSP(BSP_node *node);
00031 int RenderBSP(BSP_node *node);
00032 void DeleteBSP(BSP_node *node);
00033 void DrawIntersectionSphere(VECTOR coordinates);
00034
00035 #endif