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, PolygonWasSplit, CoplanarFront, CoplanarBack};
00012
00013 class BSP_node
00014 {
00015 public:
00016 BSP_node::BSP_node(){};
00017 BSP_node::~BSP_node(){};
00018
00019 int Compare(const BSP_node& Node);
00020 int GetMyPosition() const {return linkPosition;}
00021 void SetMyPosition(int newPosition) {linkPosition = newPosition;}
00022 int linkPosition;
00023
00024 int nodeid;
00025 bool visible;
00026 POLYGON partition;
00027 BSP_node* backnode;
00028 BSP_node* frontnode;
00029 bool leaf;
00030 int numpolys;
00031 POLYGON* nodepolylist;
00032 Lightmap* nodelightmaplist;
00033 int numportals;
00034 LinkedList<PORTAL> portallist;
00035 int numdecals;
00036 LinkedList<DECAL> decallist;
00037 };
00038
00039 void MakeNodeLists(BSP_node* node);
00040 int FindCurrentLeaf(VECTOR Position, BSP_node* node);
00041 int SplitPolygon(POLYGON, POLYGON, POLYGON*);
00042 int SelectPartitionfromList(POLYGON* nodepolylist, int numpolys, int* bestfront, int* bestback);
00043 void BuildBSP(BSP_node *node);
00044 int RenderBSP(BSP_node *node);
00045 void DeleteBSP(BSP_node *node);
00046 void DrawIntersectionSphere(VECTOR coordinates);
00047
00048 #endif