Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OPC_AABBTree.h File Reference

Go to the source code of this file.

Classes

class  AABBTreeNode
 
class  AABBTree
 

Macros

#define IMPLEMENT_TREE(base_class, volume)
 TO BE DOCUMENTED. More...
 
#define __OPC_AABBTREE_H__
 
#define IMPLEMENT_TREE(base_class, volume)
 

Typedefs

typedef void(* CullingCallback )(udword nb_primitives, udword *node_primitives, BOOL need_clipping, void *user_data)
 
typedef bool(* WalkingCallback )(const AABBTreeNode *current, udword depth, void *user_data)
 

Functions

inline_ const volume *Get
inline_ const base_class * 
GetPos () const
 
inline_ const base_class * GetNeg () const
 
inline_ bool IsLeaf () const
 
inline_ udword GetNodeSize () const
 

Variables

volume mBV
 
uintptr_t mPos
 
uintptr_t mNeg
 

Detailed Description

Contains code for a versatile AABB tree.

Author
Pierre Terdiman
Date
March, 20, 2001

Definition in file OPC_AABBTree.h.

Macro Definition Documentation

#define __OPC_AABBTREE_H__

Definition at line 22 of file Opcode.h.

#define IMPLEMENT_TREE (   base_class,
  volume 
)
Value:
public: \
/* Constructor / Destructor */ \
base_class(); \
~base_class(); \
/* Data access */ \
inline_ const volume* Get##volume() const { return &mBV; } \
/* Clear the last bit */ \
inline_ const base_class* GetPos() const { return (const base_class*)(mPos&~1); } \
inline_ const base_class* GetNeg() const { const base_class* P = GetPos(); return P ? P+1 : null;} \
\
/* We don't need to test both nodes since we can't have one without the other */ \
inline_ bool IsLeaf() const { return !GetPos(); } \
\
/* Stats */ \
inline_ udword GetNodeSize() const { return SIZEOFOBJECT; } \
protected: \
/* Tree-independent data */ \
/* Following data always belong to the BV-tree, regardless of what the tree actually contains.*/ \
/* Whatever happens we need the two children and the enclosing volume.*/ \
volume mBV; /* Global bounding-volume enclosing all the node-related primitives */ \
uintptr_t mPos; /* "Positive" & "Negative" children */
#define IMPLEMENT_TREE (   base_class,
  volume 
)
Value:
public: \
/* Constructor / Destructor */ \
base_class(); \
~base_class(); \

TO BE DOCUMENTED.

Definition at line 26 of file Opcode.h.

Typedef Documentation

typedef void(* CullingCallback)(udword nb_primitives, udword *node_primitives, BOOL need_clipping, void *user_data)

Definition at line 76 of file OPC_AABBTree.h.

typedef bool(* WalkingCallback)(const AABBTreeNode *current, udword depth, void *user_data)

User-callback, called for each node by the walking code.

Parameters
current[in] current node
depth[in] current node's depth
user_data[in] user-defined data
Returns
true to recurse through children, else false to bypass them

Definition at line 106 of file OPC_AABBTree.h.

Function Documentation

inline_ const base_class* GetNeg ( ) const

Definition at line 59 of file OPC_AABBTree.h.

References mNeg.

59 { return (const base_class*)(mNeg&~1); } \
inline_ udword GetNodeSize ( ) const

Definition at line 66 of file OPC_AABBTree.h.

References SIZEOFOBJECT.

66 { return SIZEOFOBJECT; } \
inline_ const volume* Get inline_ const base_class* GetPos ( ) const

Definition at line 58 of file OPC_AABBTree.h.

References mPos.

Referenced by IsLeaf().

58 { return (const base_class*)(mPos&~1); } \
inline_ bool IsLeaf ( ) const

Definition at line 63 of file OPC_AABBTree.h.

References GetPos().

63 { return !GetPos(); } \

Variable Documentation

volume mBV

Definition at line 71 of file OPC_AABBTree.h.

uintptr_t mNeg

Definition at line 73 of file OPC_AABBTree.h.

Referenced by GetNeg().

uintptr_t mPos

Definition at line 72 of file OPC_AABBTree.h.

Referenced by GetPos().