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 #include "decal.h"
00009
00010
00011 enum {Front, Back, TwoFrontOneBack, OneFrontTwoBack, OneFrontOneBack, PortalWasSplit, OnPartition};
00012
00013 typedef struct BSP_node
00014 {
00015 int nodeid;
00016 bool visible;
00017 POLYGON partition;
00018 BSP_node* backnode;
00019 BSP_node* frontnode;
00020 bool leaf;
00021 int numpolys;
00022 POLYGON* nodepolylist;
00023 Lightmap* nodelightmaplist;
00024 int numportals;
00025 LinkedList<PORTAL> portallist;
00026 int numdecals;
00027 LinkedList<DECAL> decallist;
00028 } BSP_node;
00029
00030 int FindCurrentLeaf(VECTOR Position, BSP_node* node);
00031 int SplitPolygon(POLYGON, POLYGON, POLYGON*);
00032 int SelectPartitionfromList(POLYGON* nodepolylist, int numpolys, int* bestfront, int* bestback);
00033 void BuildBSP(BSP_node *node);
00034 int RenderBSP(BSP_node *node);
00035 void DeleteBSP(BSP_node *node);
00036 void DrawIntersectionSphere(VECTOR coordinates);
00037
00038 #endif