Generic BSPTree Class. More...
#include <decBSPTree.h>
Public Types | |
| enum | eSideness { esFront, esBack, esOverlaping, esCoplanar } |
Sideness. More... | |
Public Member Functions | |
Constructors and Destructors | |
| decBSPTree (const decVector &normal, float distance) | |
| Creates a new generic bsp tree object. | |
| virtual | ~decBSPTree () |
| Cleans up the generic bsp tree object. | |
Management | |
| decBSPTree * | GetParent () const |
| Retrieves the parent of the bsp tree or NULL if a root bsp tree. | |
| void | SetParent (decBSPTree *parent) |
| Sets the parent of the bsp tree or NULL if a root bsp tree. | |
| const decVector & | GetNormal () const |
| Retrieves the normal. | |
| float | GetDistance () const |
| Retrieves the distance. | |
| decBSPTree * | GetFrontNode () const |
| Retrieves the front node or NULL if not existing. | |
| void | SetFrontNode (decBSPTree *bsptree) |
| Sets the front node or NULL if not existing. | |
| decBSPTree * | GetBackNode () const |
| Retrieves the back node or NULL if not existing. | |
| void | SetBackNode (decBSPTree *bsptree) |
| Sets the back node or NULL if not existing. | |
| void | ClearTree (bool clearNodes) |
| Clears the bsp tree. | |
| virtual decBSPTree * | CreateBSPTree (const decVector &normal, float distance) const |
| Creates new bsp tree for the specified octant. | |
| virtual void | ClearNodeContent () |
| Clears the content of this node. | |
| virtual void | AddCoplanarFace (const decBSPTreeFace &face) |
| Add face as a coplanar face for this node. | |
| int | TestFaceAgainstNode (const decBSPTreeFace &face) const |
| Tests the face against this node. | |
| bool | IsFaceInsideTree (const decBSPTreeFace &face) const |
| Tests if a face is inside the bsp tree. | |
| void | SplitFace (const decBSPTreeFace &face, decBSPTreeFace &front, decBSPTreeFace &back) const |
| Splits a face against this node. | |
| void | InsertFaceIntoTree (const decBSPTreeFace &face) |
| Adds a new face into bsp tree splitting it if required. | |
Generic BSPTree Class.
Provides the generic implementation of an bsp tree algorithm. For real usage subclass this class and implement the required functions. Every BSPTree object is the root of a bsp tree. The top most bsp tree object with no parent is the real bsp tree root and all children virtual octree roots. The subclass overwrites the node creation function to create nodes of its own class. Furthermore the subclass has to implement the management of the node content. This bsp tree class only provides the skeleton required for a bsp tree algorithm and does not implement any node content logic.
| decBSPTree::decBSPTree | ( | const decVector & | normal, |
| float | distance | ||
| ) |
Creates a new generic bsp tree object.
| virtual decBSPTree::~decBSPTree | ( | ) | [virtual] |
Cleans up the generic bsp tree object.
| virtual void decBSPTree::AddCoplanarFace | ( | const decBSPTreeFace & | face ) | [virtual] |
Add face as a coplanar face for this node.
Reimplemented in decDefaultBSPTree.
| virtual void decBSPTree::ClearNodeContent | ( | ) | [virtual] |
Clears the content of this node.
Reimplemented in decDefaultBSPTree.
| void decBSPTree::ClearTree | ( | bool | clearNodes ) |
Clears the bsp tree.
If clearNodes is set to true all elements are cleared and nodes are reset to NULL. Otherwise only all elements are removed but the nodes stay intact.
| virtual decBSPTree* decBSPTree::CreateBSPTree | ( | const decVector & | normal, |
| float | distance | ||
| ) | const [virtual] |
Creates new bsp tree for the specified octant.
Implement this function to create a new bsp tree of your own type. Do not set the parent of bsp tree. The caller is responsible for this action if applicable.
Reimplemented in decDefaultBSPTree.
| decBSPTree* decBSPTree::GetBackNode | ( | ) | const [inline] |
Retrieves the back node or NULL if not existing.
| float decBSPTree::GetDistance | ( | ) | const [inline] |
Retrieves the distance.
| decBSPTree* decBSPTree::GetFrontNode | ( | ) | const [inline] |
Retrieves the front node or NULL if not existing.
| const decVector& decBSPTree::GetNormal | ( | ) | const [inline] |
Retrieves the normal.
| decBSPTree* decBSPTree::GetParent | ( | ) | const [inline] |
Retrieves the parent of the bsp tree or NULL if a root bsp tree.
| void decBSPTree::InsertFaceIntoTree | ( | const decBSPTreeFace & | face ) |
Adds a new face into bsp tree splitting it if required.
| bool decBSPTree::IsFaceInsideTree | ( | const decBSPTreeFace & | face ) | const |
Tests if a face is inside the bsp tree.
The face is send down the bsp tree like during an insert action but instead of inserting the last state is returned. If the face is in front of the last split plane it is considered inside returning 1 as result. If the face is on the back side it is considered outside and -1 is returned as the result. if the face crosses the last split plane 0 is returned as result.
| void decBSPTree::SetBackNode | ( | decBSPTree * | bsptree ) |
Sets the back node or NULL if not existing.
| void decBSPTree::SetFrontNode | ( | decBSPTree * | bsptree ) |
Sets the front node or NULL if not existing.
| void decBSPTree::SetParent | ( | decBSPTree * | parent ) |
Sets the parent of the bsp tree or NULL if a root bsp tree.
| void decBSPTree::SplitFace | ( | const decBSPTreeFace & | face, |
| decBSPTreeFace & | front, | ||
| decBSPTreeFace & | back | ||
| ) | const |
Splits a face against this node.
| int decBSPTree::TestFaceAgainstNode | ( | const decBSPTreeFace & | face ) | const |
Tests the face against this node.
Returns 1 if the face is fully on the front side or -1 if fully on the back side. If the face crosses the plane 0 is returned.
1.7.2