Revision 221,
1.7 KB
checked in by mattausch, 19 years ago
(diff) |
changed notation for bsp trees
|
Rev | Line | |
---|
[221] | 1 | #ifndef _ViewCellBsp_H__ |
---|
| 2 | #define _ViewCellBsp_H__ |
---|
| 3 | |
---|
| 4 | #include "Containers.h" |
---|
| 5 | |
---|
| 6 | class ViewCell; |
---|
| 7 | class Plane3; |
---|
| 8 | |
---|
| 9 | namespace GtpVisibilityPreprocessor { |
---|
| 10 | |
---|
| 11 | class BspInterior; |
---|
| 12 | |
---|
| 13 | /** |
---|
| 14 | BspNode abstract class serving for interior and leaf node implementation |
---|
| 15 | */ |
---|
| 16 | class BspNode |
---|
| 17 | { |
---|
| 18 | public: |
---|
| 19 | /** Determines whether this node is a leaf or not |
---|
| 20 | @return true if leaf |
---|
| 21 | */ |
---|
| 22 | virtual bool IsLeaf() const = 0; |
---|
| 23 | |
---|
| 24 | /** Determines whether this node is a root |
---|
| 25 | @return true if root |
---|
| 26 | */ |
---|
| 27 | virtual bool IsRoot() const; |
---|
| 28 | |
---|
| 29 | protected: |
---|
| 30 | |
---|
| 31 | void SplitPoly(Plane3 *plane, Mesh *viewcell); |
---|
| 32 | |
---|
| 33 | /// parent of this node |
---|
| 34 | BspInterior *mParent; |
---|
| 35 | }; |
---|
| 36 | |
---|
| 37 | /** BSP interior node implementation */ |
---|
| 38 | class BspInterior : public BspNode |
---|
| 39 | { |
---|
| 40 | /** @return false since it is an interior node */ |
---|
| 41 | bool IsLeaf() const; |
---|
| 42 | |
---|
| 43 | protected: |
---|
| 44 | /// Splitting plane corresponding to this node |
---|
| 45 | Plane3 mPlane; |
---|
| 46 | /// back node |
---|
| 47 | BspNode *mBack; |
---|
| 48 | /// front node |
---|
| 49 | BspNode *mFront; |
---|
| 50 | }; |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | /** BSP leaf node implementation */ |
---|
| 54 | class BspLeaf : public BspNode |
---|
| 55 | { |
---|
| 56 | public: |
---|
| 57 | BspLeaf(ViewCell *viewCell = NULL); |
---|
| 58 | /** @return true since it is an interior node */ |
---|
| 59 | virtual bool IsLeaf(); |
---|
| 60 | |
---|
| 61 | protected: |
---|
| 62 | /// polygonal representation of this viewcell |
---|
| 63 | /// if NULL this note does not correspond to feasible viewcell |
---|
| 64 | ViewCell *mViewCell; |
---|
| 65 | }; |
---|
| 66 | |
---|
| 67 | /** Implementation of the ViewCell BSP tree */ |
---|
| 68 | class BspTree |
---|
| 69 | { |
---|
| 70 | public: |
---|
| 71 | /** Constructor takes a pointer to the cell corresponding to the whole |
---|
| 72 | viewspace */ |
---|
| 73 | BspTree(ViewCell *cell); |
---|
| 74 | |
---|
| 75 | protected: |
---|
| 76 | /// Pointer to the root of the tree |
---|
| 77 | BspNode *mRoot; |
---|
| 78 | /// Pointer to the root cell of the viewspace */ |
---|
| 79 | ViewCell *mRootCell; |
---|
| 80 | }; |
---|
| 81 | |
---|
| 82 | }; // GtpVisibilityPreprocessor |
---|
| 83 | |
---|
| 84 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.