Blender V2.61 - r43446
Public Member Functions | Protected Member Functions | Protected Attributes

ntlTree Class Reference

Class for a bsp tree for triangles. More...

#include <ntl_bsptree.h>

List of all members.

Public Member Functions

 ntlTree ()
 Default constructor.
 ntlTree (int depth, int objnum, ntlScene *scene, int triFlagMask)
 Constructor with init.
 ~ntlTree ()
 Destructor.
void subdivide (BSPNode *node, int depth, int axis)
 subdivide tree
void intersect (const ntlRay &ray, gfxReal &distance, ntlVec3Gfx &normal, ntlTriangle *&tri, int flags, bool forceNonsmooth) const
 intersect ray with BSPtree
void intersectX (const ntlRay &ray, gfxReal &distance, ntlVec3Gfx &normal, ntlTriangle *&tri, int flags, bool forceNonsmooth) const
 intersect along +X ray
int getCurrentNodes (void)
 Returns number of nodes.

Protected Member Functions

bool checkAABBTriangle (ntlVec3Gfx &min, ntlVec3Gfx &max, ntlTriangle *tri)
gfxReal distanceToPlane (BSPNode *curr, ntlVec3Gfx plane, ntlRay ray) const
 distance to plane function for nodes
void getChildren (BSPNode *curr, ntlVec3Gfx origin, BSPNode *&node_near, BSPNode *&node_far) const
 return ordering of children nodes relatice to origin point
void deleteNode (BSPNode *curr)
 delete a node of the tree with all sub nodes, dont delete root members

Protected Attributes

ntlVec3Gfx mStart
 AABB for tree.
ntlVec3Gfx mEnd
int mMaxDepth
 maximum depth of tree
int mMaxListLength
 maximum number of objects in one node
BSPNodempRoot
 root node pointer
int mNumNodes
 count no. of node
int mAbortSubdiv
BSPStackmpNodeStack
 stack for the node pointers
vector< ntlVec3Gfx > * mpVertices
 pointer to vertex array
vector< ntlVec3Gfx > * mpVertNormals
 pointer to vertex array
vector< ntlTriangle > * mpTriangles
 vector for all the triangles
vector< ntlTriangle * > * mppTriangles
char * mpTriDist
 temporary array for triangle distribution to nodes
TriangleBBoxmpTBB
 temporary array for triangle bounding boxes
int mTriangleMask
 triangle mask - include only triangles that match mask
int mCurrentDepth
 Status vars (max depth, # of current nodes)
int mCurrentNodes
int mTriDoubles
 duplicated triangles, inited during subdivide

Detailed Description

Class for a bsp tree for triangles.

Definition at line 37 of file ntl_bsptree.h.


Constructor & Destructor Documentation

ntlTree::ntlTree ( )

Default constructor.

Definition at line 133 of file ntl_bsptree.cpp.

References errFatal, and SIMWORLD_INITERROR.

ntlTree::ntlTree ( int  depth,
int  objnum,
ntlScene scene,
int  triFlagMask 
)
ntlTree::~ntlTree ( )

Destructor.

Definition at line 290 of file ntl_bsptree.cpp.

References deleteNode(), mpNodeStack, and mpRoot.


Member Function Documentation

bool ntlTree::checkAABBTriangle ( ntlVec3Gfx min,
ntlVec3Gfx max,
ntlTriangle tri 
) [protected]
void ntlTree::deleteNode ( BSPNode curr) [protected]

delete a node of the tree with all sub nodes, dont delete root members

Definition at line 880 of file ntl_bsptree.cpp.

References BSPNode::child, BSPNode::members, and NULL.

Referenced by ntlTree(), and ~ntlTree().

gfxReal ntlTree::distanceToPlane ( BSPNode curr,
ntlVec3Gfx  plane,
ntlRay  ray 
) const [protected]

distance to plane function for nodes

Definition at line 855 of file ntl_bsptree.cpp.

References BSPNode::axis, ntlRay::getDirection(), and ntlRay::getOrigin().

Referenced by intersect(), and intersectX().

void ntlTree::getChildren ( BSPNode curr,
ntlVec3Gfx  origin,
BSPNode *&  node_near,
BSPNode *&  node_far 
) const [protected]

return ordering of children nodes relatice to origin point

Definition at line 864 of file ntl_bsptree.cpp.

References BSPNode::axis, BSPNode::child, and BSPNode::max.

Referenced by intersect(), and intersectX().

int ntlTree::getCurrentNodes ( void  ) [inline]

Returns number of nodes.

Definition at line 57 of file ntl_bsptree.h.

References mCurrentNodes.

void ntlTree::intersect ( const ntlRay ray,
gfxReal distance,
ntlVec3Gfx normal,
ntlTriangle *&  tri,
int  flags,
bool  forceNonsmooth 
) const
void ntlTree::intersectX ( const ntlRay ray,
gfxReal distance,
ntlVec3Gfx normal,
ntlTriangle *&  tri,
int  flags,
bool  forceNonsmooth 
) const
void ntlTree::subdivide ( BSPNode node,
int  depth,
int  axis 
)

Member Data Documentation

int ntlTree::mAbortSubdiv [protected]

Definition at line 92 of file ntl_bsptree.h.

Referenced by ntlTree(), and subdivide().

int ntlTree::mCurrentDepth [protected]

Status vars (max depth, # of current nodes)

Definition at line 118 of file ntl_bsptree.h.

Referenced by ntlTree(), and subdivide().

int ntlTree::mCurrentNodes [protected]

Definition at line 118 of file ntl_bsptree.h.

Referenced by getCurrentNodes(), ntlTree(), and subdivide().

Definition at line 80 of file ntl_bsptree.h.

Referenced by intersect(), intersectX(), and ntlTree().

int ntlTree::mMaxDepth [protected]

maximum depth of tree

Definition at line 83 of file ntl_bsptree.h.

Referenced by ntlTree(), and subdivide().

int ntlTree::mMaxListLength [protected]

maximum number of objects in one node

Definition at line 86 of file ntl_bsptree.h.

Referenced by subdivide().

int ntlTree::mNumNodes [protected]

count no. of node

Definition at line 91 of file ntl_bsptree.h.

Referenced by ntlTree(), and subdivide().

stack for the node pointers

Definition at line 95 of file ntl_bsptree.h.

Referenced by intersect(), intersectX(), ntlTree(), and ~ntlTree().

vector<ntlTriangle *>* ntlTree::mppTriangles [protected]

Definition at line 106 of file ntl_bsptree.h.

Referenced by ntlTree().

BSPNode* ntlTree::mpRoot [protected]

root node pointer

Definition at line 89 of file ntl_bsptree.h.

Referenced by intersect(), intersectX(), ntlTree(), and ~ntlTree().

temporary array for triangle bounding boxes

Definition at line 112 of file ntl_bsptree.h.

Referenced by checkAABBTriangle(), ntlTree(), and subdivide().

vector<ntlTriangle>* ntlTree::mpTriangles [protected]

vector for all the triangles

Definition at line 105 of file ntl_bsptree.h.

Referenced by ntlTree().

char* ntlTree::mpTriDist [protected]

temporary array for triangle distribution to nodes

Definition at line 109 of file ntl_bsptree.h.

Referenced by ntlTree(), and subdivide().

vector<ntlVec3Gfx>* ntlTree::mpVertices [protected]

pointer to vertex array

Definition at line 99 of file ntl_bsptree.h.

Referenced by intersect(), intersectX(), and ntlTree().

vector<ntlVec3Gfx>* ntlTree::mpVertNormals [protected]

pointer to vertex array

Definition at line 102 of file ntl_bsptree.h.

Referenced by intersect(), intersectX(), and ntlTree().

AABB for tree.

Definition at line 80 of file ntl_bsptree.h.

Referenced by intersect(), intersectX(), and ntlTree().

int ntlTree::mTriangleMask [protected]

triangle mask - include only triangles that match mask

Definition at line 115 of file ntl_bsptree.h.

Referenced by ntlTree().

int ntlTree::mTriDoubles [protected]

duplicated triangles, inited during subdivide

Definition at line 121 of file ntl_bsptree.h.

Referenced by ntlTree(), and subdivide().


The documentation for this class was generated from the following files: