Changeset 195 for trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBSP.h
- Timestamp:
- 08/04/05 19:53:48 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBSP.h
r194 r195 2 2 #define _ViewCellBsp_H__ 3 3 4 #include "Mesh.h" 4 5 class ViewCell; 5 6 class Plane3; 6 class Mesh;7 //class Mesh; 7 8 8 9 //namespace GtpVisibilityPreprocessor { … … 10 11 class BSPInterior; 11 12 12 /** 13 BSPNode abstract class serving for interior and leaf node implementation 14 */ 15 class BSPNode 16 { 17 public: 18 /** Determines whether this node is a leaf or not 19 @return true if leaf 20 */ 21 virtual bool IsLeaf() const = 0; 13 14 /** 15 BSPNode abstract class serving for interior and leaf node implementation 16 */ 17 class BSPNode 18 { 19 public: 20 /** Determines whether this node is a leaf or not 21 @return true if leaf 22 */ 23 virtual bool IsLeaf() const = 0; 22 24 23 24 @return true if root25 26 25 /** Determines whether this node is a root 26 @return true if root 27 */ 28 virtual bool IsRoot() const; 27 29 28 30 protected: 29 31 30 void SplitPoly(Plane3 *plane, Mesh *viewcell); 31 32 /// parent of this node 33 BSPInterior *mParent; 32 /// parent of this node 33 BSPInterior *mParent; 34 34 }; 35 35 36 36 /** BSP interior node implementation */ 37 37 class BSPInterior : public BSPNode 38 { 39 /** @return false since it is an interior node */ 40 bool IsLeaf() const; 38 { 39 public: 40 /** @return false since it is an interior node */ 41 bool IsLeaf() const; 42 43 BSPNode *GetBack() {return mBack;} 44 BSPNode *GetFront() {return mFront;} 45 46 void ReplaceChildLink(BSPNode *oldChild, BSPNode *newChild); 47 void SetupChildLinks(BSPNode *b, BSPNode *f); 41 48 42 49 protected: 43 /// Splitting plane corresponding to this node 44 Plane3 mPlane; 45 /// back node 46 BSPNode *mBack; 47 /// front node 48 BSPNode *mFront; 50 51 /// Splitting plane corresponding to this node 52 Plane3 mPlane; 53 /// back node 54 BSPNode *mBack; 55 /// front node 56 BSPNode *mFront; 49 57 }; 50 58 … … 54 62 { 55 63 public: 56 BSPLeaf(ViewCell *viewCell = NULL);64 BSPLeaf(ViewCell *viewCell = NULL); 57 65 58 /** @return true since it is an interior node */59 66 /** @return true since it is an interior node */ 67 bool IsLeaf() const; 60 68 61 69 protected: 62 /// polygonal representation of this viewcell 63 /// if NULL this note does not correspond to feasible viewcell 64 ViewCell *mViewCell; 70 71 /// polygonal representation of this viewcell 72 /// if NULL this note does not correspond to feasible viewcell 73 ViewCell *mViewCell; 65 74 }; 66 75 … … 69 78 { 70 79 public: 71 /** Constructor takes a pointer to the cell corresponding to the whole 72 viewspace */ 73 BSPTree(ViewCell *cell); 80 struct BSPTraversalData 81 { 82 BSPNode *mNode; 83 BSPInterior *mParent; 84 85 Mesh mViewCell; 86 int mDepth; 87 88 BSPTraversalData() {} 89 BSPTraversalData(BSPNode *n, BSPInterior *p, const Mesh &m, const int d): 90 mNode(n), mParent(p), mViewCell(m), mDepth(d) {} 91 }; 92 93 /** Constructor takes a pointer to the cell corresponding to the whole 94 viewspace */ 95 BSPTree(ViewCell *cell); 74 96 75 97 protected: 76 /// Pointer to the root of the tree 77 BSPNode *mRoot; 78 /// Pointer to the root cell of the viewspace */ 79 ViewCell *mRootCell; 98 99 Plane3 *SelectPlane(Mesh *viewcell); 100 void Subdivide(); 101 102 BSPNode *SubdivideNode(BSPLeaf *leaf, BSPInterior *parent, 103 Mesh *viewCell, const int depth, 104 Mesh &frontPolys, Mesh &backPolys); 105 106 /// Pointer to the root of the tree 107 BSPNode *mRoot; 108 /// Pointer to the root cell of the viewspace 109 ViewCell *mRootCell; 80 110 }; 81 111
Note: See TracChangeset
for help on using the changeset viewer.