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
AABBTreeBuilder Class Referenceabstract

#include <OPC_TreeBuilders.h>

Inheritance diagram for AABBTreeBuilder:
AABBTreeOfAABBsBuilder AABBTreeOfTrianglesBuilder AABBTreeOfVerticesBuilder

Public Member Functions

 AABBTreeBuilder ()
 Constructor. More...
 
virtual ~AABBTreeBuilder ()
 Destructor. More...
 
virtual bool ComputeGlobalBox (const udword *primitives, udword nb_prims, AABB &global_box) const =0
 
virtual float GetSplittingValue (udword index, udword axis) const =0
 
virtual float GetSplittingValue (const udword *, udword, const AABB &global_box, udword axis) const
 
virtual BOOL ValidateSubdivision (const udword *, udword nb_prims, const AABB &)
 
inline_ void SetCount (udword nb)
 
inline_ void IncreaseCount (udword nb)
 
inline_ udword GetCount () const
 
inline_ void SetNbInvalidSplits (udword nb)
 
inline_ void IncreaseNbInvalidSplits ()
 
inline_ udword GetNbInvalidSplits () const
 

Public Attributes

BuildSettings mSettings
 Splitting rules & split limit [Opcode 1.3]. More...
 
udword mNbPrimitives
 Total number of primitives. More...
 
void * mNodeBase
 Address of node pool [Opcode 1.3]. More...
 

Detailed Description

Definition at line 47 of file OPC_TreeBuilders.h.

Constructor & Destructor Documentation

AABBTreeBuilder::AABBTreeBuilder ( )
inline

Constructor.

Definition at line 51 of file OPC_TreeBuilders.h.

51  :
52  mNbPrimitives(0),
53  mNodeBase(null),
54  mCount(0),
55  mNbInvalidSplits(0) {}
virtual AABBTreeBuilder::~AABBTreeBuilder ( )
inlinevirtual

Destructor.

Definition at line 57 of file OPC_TreeBuilders.h.

57 {}

Member Function Documentation

virtual bool AABBTreeBuilder::ComputeGlobalBox ( const udword primitives,
udword  nb_prims,
AABB global_box 
) const
pure virtual

Computes the AABB of a set of primitives.

Parameters
primitives[in] list of indices of primitives
nb_prims[in] number of indices
global_box[out] global AABB enclosing the set of input primitives
Returns
true if success
inline_ udword AABBTreeBuilder::GetCount ( ) const
inline

Definition at line 119 of file OPC_TreeBuilders.h.

119 { return mCount; }
inline_ udword AABBTreeBuilder::GetNbInvalidSplits ( ) const
inline

Definition at line 122 of file OPC_TreeBuilders.h.

122 { return mNbInvalidSplits; }
virtual float AABBTreeBuilder::GetSplittingValue ( udword  index,
udword  axis 
) const
pure virtual

Computes the splitting value along a given axis for a given primitive.

Parameters
index[in] index of the primitive to split
axis[in] axis index (0,1,2)
Returns
splitting value
virtual float AABBTreeBuilder::GetSplittingValue ( const udword ,
udword  ,
const AABB global_box,
udword  axis 
) const
inlinevirtual

Computes the splitting value along a given axis for a given node.

Parameters
primitives[in] list of indices of primitives
nb_prims[in] number of indices
global_box[in] global AABB enclosing the set of input primitives
axis[in] axis index (0,1,2)
Returns
splitting value

Definition at line 90 of file OPC_TreeBuilders.h.

91  {
92  // Default split value = middle of the axis (using only the box)
93  return global_box.GetCenter(axis);
94  }
inline_ void AABBTreeBuilder::IncreaseCount ( udword  nb)
inline

Definition at line 118 of file OPC_TreeBuilders.h.

118 { mCount+=nb; }
inline_ void AABBTreeBuilder::IncreaseNbInvalidSplits ( )
inline

Definition at line 121 of file OPC_TreeBuilders.h.

121 { mNbInvalidSplits++; }
inline_ void AABBTreeBuilder::SetCount ( udword  nb)
inline

Definition at line 117 of file OPC_TreeBuilders.h.

117 { mCount=nb; }
inline_ void AABBTreeBuilder::SetNbInvalidSplits ( udword  nb)
inline

Definition at line 120 of file OPC_TreeBuilders.h.

120 { mNbInvalidSplits=nb; }
virtual BOOL AABBTreeBuilder::ValidateSubdivision ( const udword ,
udword  nb_prims,
const AABB  
)
inlinevirtual

Validates node subdivision. This is called each time a node is considered for subdivision, during tree building.

Parameters
primitives[in] list of indices of primitives
nb_prims[in] number of indices
global_box[in] global AABB enclosing the set of input primitives
Returns
TRUE if the node should be subdivised

Definition at line 105 of file OPC_TreeBuilders.h.

106  {
107  // Check the user-defined limit
108  if(nb_prims<=mSettings.mLimit) return FALSE;
109 
110  return TRUE;
111  }

Member Data Documentation

udword AABBTreeBuilder::mNbPrimitives

Total number of primitives.

Definition at line 114 of file OPC_TreeBuilders.h.

void* AABBTreeBuilder::mNodeBase

Address of node pool [Opcode 1.3].

Definition at line 115 of file OPC_TreeBuilders.h.

BuildSettings AABBTreeBuilder::mSettings

Splitting rules & split limit [Opcode 1.3].

Definition at line 113 of file OPC_TreeBuilders.h.


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