#include <OPC_AABBTree.h>
Public Member Functions | |
AABBTree () | |
bool | Build (AABBTreeBuilder *builder) |
udword | ComputeDepth () const |
udword | GetUsedBytes () const |
bool | IsComplete () const |
bool | Refit (AABBTreeBuilder *builder) |
bool | Refit2 (AABBTreeBuilder *builder) |
void | Release () |
udword | Walk (WalkingCallback callback, void *user_data) const |
~AABBTree () | |
Public Member Functions inherited from AABBTreeNode | |
inline_ udword | GetNbPrimitives () const |
const inline_ udword * | GetPrimitives () const |
Private Attributes | |
udword * | mIndices |
Indices in the app list. Indices are reorganized during build (permutation). More... | |
AABBTreeNode * | mPool |
Linear pool of nodes for complete trees. Null otherwise. [Opcode 1.3]. More... | |
udword | mTotalNbNodes |
Number of nodes in the tree. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from AABBTreeNode | |
void | _BuildHierarchy (AABBTreeBuilder *builder) |
void | _Refit (AABBTreeBuilder *builder) |
udword | Split (udword axis, AABBTreeBuilder *builder) |
bool | Subdivide (AABBTreeBuilder *builder) |
Protected Attributes inherited from AABBTreeNode | |
udword | mNbPrimitives |
Number of primitives for this node. More... | |
udword * | mNodePrimitives |
Node-related primitives (shortcut to a position in mIndices below) More... | |
Contains a generic AABB tree. This is a vanilla AABB tree, without any particular optimization. It contains anonymous references to user-provided primitives, which can theoretically be anything - triangles, boxes, etc. Each primitive is surrounded by an AABB, regardless of the primitive's nature. When the primitive is a triangle, the resulting tree can be converted into an optimized tree. If the primitive is a box, the resulting tree can be used for culling - VFC or occlusion -, assuming you cull on a mesh-by-mesh basis (modern way).
Definition at line 113 of file OPC_AABBTree.h.
AABBTree::AABBTree | ( | ) |
Constructor.
Definition at line 373 of file OPC_AABBTree.cpp.
AABBTree::~AABBTree | ( | ) |
Destructor.
Definition at line 382 of file OPC_AABBTree.cpp.
bool AABBTree::Build | ( | AABBTreeBuilder * | builder | ) |
Builds a generic AABB tree from a tree builder.
builder | [in] the tree builder |
Definition at line 405 of file OPC_AABBTree.cpp.
udword AABBTree::ComputeDepth | ( | ) | const |
Computes the depth of the tree. A well-balanced tree should have a log(n) depth. A degenerate tree O(n) depth.
Definition at line 456 of file OPC_AABBTree.cpp.
udword AABBTree::GetUsedBytes | ( | ) | const |
Computes the number of bytes used by the tree.
Definition at line 556 of file OPC_AABBTree.cpp.
bool AABBTree::IsComplete | ( | ) | const |
Checks the tree is a complete tree or not. A complete tree is made of 2*N-1 nodes, where N is the number of primitives in the tree.
Definition at line 570 of file OPC_AABBTree.cpp.
bool AABBTree::Refit | ( | AABBTreeBuilder * | builder | ) |
Refits the tree in a top-down way.
builder | [in] the tree builder |
Definition at line 501 of file OPC_AABBTree.cpp.
bool AABBTree::Refit2 | ( | AABBTreeBuilder * | builder | ) |
Refits the tree in a bottom-up way.
builder | [in] the tree builder |
Definition at line 514 of file OPC_AABBTree.cpp.
void AABBTree::Release | ( | ) |
Releases the tree.
Definition at line 392 of file OPC_AABBTree.cpp.
udword AABBTree::Walk | ( | WalkingCallback | callback, |
void * | user_data | ||
) | const |
Walks the tree, calling the user back for each node.
Definition at line 466 of file OPC_AABBTree.cpp.
|
private |
Indices in the app list. Indices are reorganized during build (permutation).
Definition at line 137 of file OPC_AABBTree.h.
|
private |
Linear pool of nodes for complete trees. Null otherwise. [Opcode 1.3].
Definition at line 138 of file OPC_AABBTree.h.
|
private |
Number of nodes in the tree.
Definition at line 140 of file OPC_AABBTree.h.