Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

bsp.h

Go to the documentation of this file.
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 // Enumerated constants for the bsp and portal functions
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;             //unique identification number given to the node
00025     bool visible;           //flag used as part of the pvs
00026     POLYGON partition;      //we'll use this to store the partitioning plane that divides our nodes up
00027     BSP_node* backnode;     //pointer to the node that is on the back side of our partitioning plane
00028     BSP_node* frontnode;    //pointer to the node that is on the front side of our partitioning plane
00029     bool leaf;              //true or false value for a node saying that this node has no children and only contains triangles
00030     int numpolys;           //number of triangles in the node, this will be 0 if the node is not a leaf
00031     POLYGON* nodepolylist;  //pointer to the list of triangles in the leaf node, again this list will be empty if the node is not a leaf
00032     Lightmap* nodelightmaplist; //pointer to a list of lightmaps or NULL if this node isn't a leaf
00033     int numportals;             //the number of portals in the leaf node
00034     LinkedList<PORTAL> portallist; //list of portals in the leaf node
00035     int numdecals;
00036     LinkedList<DECAL> decallist; //list of decals in the leaf node
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

Generated on Fri Dec 23 05:15:46 2005 for Constructive Solid Geometry by doxygen1.2.15