source: trunk/VUT/GtpVisibilityPreprocessor/include/ViewCellBSP.h @ 196

Revision 196, 1.7 KB checked in by mattausch, 19 years ago (diff)

added bsp tree stuff

  • Property svn:executable set to *
Line 
1#ifndef _ViewCellBsp_H__
2#define _ViewCellBsp_H__
3
4#include "Containers.h"
5
6class ViewCell;
7class Plane3;
8
9namespace 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.