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