source: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBSP.h @ 194

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

started with bsp viewcells

Line 
1#ifndef _ViewCellBsp_H__
2#define _ViewCellBsp_H__
3
4class ViewCell;
5class Plane3;
6class Mesh;
7
8//namespace GtpVisibilityPreprocessor {
9 
10class BSPInterior;
11
12/**
13        BSPNode abstract class serving for interior and leaf node implementation
14*/
15class BSPNode
16{
17public:
18        /** Determines whether this node is a leaf or not
19        @return true if leaf
20    */
21    virtual bool IsLeaf() const = 0;
22   
23    /** Determines whether this node is a root
24        @return true if root
25    */
26    virtual bool IsRoot() const;
27
28        protected:
29
30                void SplitPoly(Plane3 *plane, Mesh *viewcell);
31
32    /// parent of this node
33    BSPInterior *mParent;
34  };
35
36  /** BSP interior node implementation */
37  class BSPInterior : public BSPNode
38  {   
39    /** @return false since it is an interior node */
40    bool IsLeaf() const;
41
42  protected:
43    /// Splitting plane corresponding to this node
44    Plane3 mPlane;
45    /// back node
46    BSPNode *mBack;
47    /// front node
48    BSPNode *mFront;
49  };
50 
51 
52  /** BSP leaf node implementation */
53  class BSPLeaf : public BSPNode
54  {
55  public:
56        BSPLeaf(ViewCell *viewCell = NULL);
57   
58        /** @return true since it is an interior node */
59    bool IsLeaf() const;
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.