lux::QBVHAccel Class Reference

#include <qbvhaccel.h>

Inheritance diagram for lux::QBVHAccel:
[legend]
Collaboration diagram for lux::QBVHAccel:
[legend]

List of all members.

Public Member Functions

 QBVHAccel (const vector< boost::shared_ptr< Primitive > > &p, int mp, float fst, int sf)
virtual ~QBVHAccel ()
virtual BBox WorldBound () const
virtual bool Intersect (const Ray &ray, Intersection *isect) const
virtual bool IntersectP (const Ray &ray) const
virtual void GetPrimitives (vector< boost::shared_ptr< Primitive > > &prims)

Static Public Member Functions

static AggregateCreateAccelerator (const vector< boost::shared_ptr< Primitive > > &prims, const ParamSet &ps)

Private Member Functions

void BuildTree (u_int start, u_int end, u_int *primsIndexes, BBox *primsBboxes, Point *primsCentroids, const BBox &nodeBbox, const BBox &centroidsBbox, int32_t parentIndex, int32_t childIndex, int depth)
void CreateTempLeaf (int32_t parentIndex, int32_t childIndex, u_int start, u_int end, const BBox &nodeBbox)
int32_t CreateIntermediateNode (int32_t parentIndex, int32_t childIndex, const BBox &nodeBbox)
void PreSwizzle (int32_t nodeIndex, u_int *primsIndexes, const vector< boost::shared_ptr< Primitive > > &vPrims)
void CreateSwizzledLeaf (int32_t parentIndex, int32_t childIndex, u_int *primsIndexes, const vector< boost::shared_ptr< Primitive > > &vPrims)

Private Attributes

u_int nQuads
boost::shared_ptr< Primitive > * prims
u_int nPrims
QBVHNodenodes
u_int nNodes
u_int maxNodes
BBox worldBound
u_int fullSweepThreshold
u_int skipFactor
u_int maxPrimsPerLeaf

Static Private Attributes

static const boost::int16_t pathTable [128]

Detailed Description

Definition at line 234 of file qbvhaccel.h.


Constructor & Destructor Documentation

lux::QBVHAccel::QBVHAccel ( const vector< boost::shared_ptr< Primitive > > &  p,
int  mp,
float  fst,
int  sf 
)

Normal constructor.

Parameters:
p the vector of shared primitives to put in the QBVH
mp the maximum number of primitives per leaf
fst the threshold before switching to full sweep for split
sf the skip factor during split determination

Definition at line 81 of file qbvhaccel.cpp.

lux::QBVHAccel::~QBVHAccel (  )  [virtual]

to free the memory.

Definition at line 639 of file qbvhaccel.cpp.


Member Function Documentation

void lux::QBVHAccel::BuildTree ( u_int  start,
u_int  end,
u_int primsIndexes,
BBox primsBboxes,
Point primsCentroids,
const BBox nodeBbox,
const BBox centroidsBbox,
int32_t  parentIndex,
int32_t  childIndex,
int  depth 
) [private]

Build the tree that will contain the primitives indexed from start to end in the primsIndexes array.

Parameters:
start 
end 
primsBboxes the bounding boxes for all the primitives
primsbboxes the centroids of all the primitives
nodeBbox the bounding box of the node.
centroidsBbox the bounding box of the centroids of the primitives in the node.
parentIndex the index of the parent node
childIndex the index of the node in the parent node (its child number)
depth the current depth.

Definition at line 164 of file qbvhaccel.cpp.

Aggregate * lux::QBVHAccel::CreateAccelerator ( const vector< boost::shared_ptr< Primitive > > &  prims,
const ParamSet ps 
) [static]

Read configuration parameters and create a new QBVH accelerator

Parameters:
prims vector of primitives to store into the QBVH
ps configuration parameters

Definition at line 660 of file qbvhaccel.cpp.

int32_t lux::QBVHAccel::CreateIntermediateNode ( int32_t  parentIndex,
int32_t  childIndex,
const BBox nodeBbox 
) [inline, private]

Create an intermediate node

Parameters:
parentIndex 
childIndex 
nodeBbox 

Definition at line 323 of file qbvhaccel.h.

References lux::QBVHNode::children, lux::FreeAligned(), maxNodes, memcpy(), nNodes, nodes, lux::QBVHNode::parentNodeIndex, and lux::QBVHNode::SetBBox().

void lux::QBVHAccel::CreateSwizzledLeaf ( int32_t  parentIndex,
int32_t  childIndex,
u_int primsIndexes,
const vector< boost::shared_ptr< Primitive > > &  vPrims 
) [private]

Create a leaf using the pre-swizzled layout, using the informations stored in the node that are organized following the traditional layout

Parameters:
parentIndex 
childIndex 
primsIndexes 
vPrims 

Definition at line 389 of file qbvhaccel.cpp.

void lux::QBVHAccel::CreateTempLeaf ( int32_t  parentIndex,
int32_t  childIndex,
u_int  start,
u_int  end,
const BBox nodeBbox 
) [private]

Create a leaf using the traditional QBVH layout

Parameters:
parentIndex 
childIndex 
start 
end 
nodeBbox 

Definition at line 345 of file qbvhaccel.cpp.

void lux::QBVHAccel::GetPrimitives ( vector< boost::shared_ptr< Primitive > > &  prims  )  [virtual]

Fills an array with the primitives

Parameters:
prims vector to be filled

Implements lux::Aggregate.

Definition at line 653 of file qbvhaccel.cpp.

References worldBound.

bool lux::QBVHAccel::Intersect ( const Ray ray,
Intersection isect 
) const [virtual]

Intersect a ray in world space against the primitive and fills in an Intersection object.

Parameters:
ray in world space
isect pointer to the intersection object to fill.
Returns:
true if there is an intersection.

Reimplemented from lux::Primitive.

Definition at line 486 of file qbvhaccel.cpp.

bool lux::QBVHAccel::IntersectP ( const Ray ray  )  const [virtual]

Predicate version, only tests if there is intersection.

Parameters:
ray in world space
Returns:
true if there is intersection.

Reimplemented from lux::Primitive.

Definition at line 564 of file qbvhaccel.cpp.

void lux::QBVHAccel::PreSwizzle ( int32_t  nodeIndex,
u_int primsIndexes,
const vector< boost::shared_ptr< Primitive > > &  vPrims 
) [private]

switch a node and its subnodes from the traditional form of QBVH to the pre-swizzled one.

Parameters:
nodeIndex 
primsIndexes 
vPrims 

Definition at line 378 of file qbvhaccel.cpp.

BBox lux::QBVHAccel::WorldBound (  )  const [virtual]

to get the world bbox.

Returns:

Implements lux::Primitive.

Definition at line 648 of file qbvhaccel.cpp.


Member Data Documentation

The number of primitives in the node that makes switch to full sweep for binning

Definition at line 403 of file qbvhaccel.h.

Definition at line 392 of file qbvhaccel.h.

Referenced by CreateIntermediateNode().

The maximum number of primitives per leaf

Definition at line 413 of file qbvhaccel.h.

The number of nodes really used.

Definition at line 392 of file qbvhaccel.h.

Referenced by CreateIntermediateNode().

The nodes of the QBVH.

Definition at line 387 of file qbvhaccel.h.

Referenced by CreateIntermediateNode().

The number of primitives

Definition at line 382 of file qbvhaccel.h.

the actual number of quads

Definition at line 368 of file qbvhaccel.h.

const boost::int16_t lux::QBVHAccel::pathTable [static, private]

Definition at line 432 of file qbvhaccel.h.

boost::shared_ptr<Primitive>* lux::QBVHAccel::prims [private]

The primitive associated with each triangle. indexed by the number of quad and the number of triangle in the quad (thus, there might be holes). no need to be a tesselated primitive, the intersection test will be redone for the nearest triangle found, to fill the Intersection structure.

Definition at line 377 of file qbvhaccel.h.

The skip factor for binning

Definition at line 408 of file qbvhaccel.h.

The world bounding box of the QBVH.

Definition at line 397 of file qbvhaccel.h.

Referenced by GetPrimitives().


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208