luxrays::QBVHAccel Class Reference

#include <qbvhaccel.h>

Inheritance diagram for luxrays::QBVHAccel:
luxrays::Accelerator

List of all members.

Public Member Functions

 QBVHAccel (const Context *context, u_int mp, u_int fst, u_int sf)
 ~QBVHAccel ()
BBox WorldBound () const
AcceleratorType GetType () const
void Init (const std::deque< Mesh * > &meshes, const unsigned int totalVertexCount, const unsigned int totalTriangleCount)
const TriangleMeshID GetMeshID (const unsigned int index) const
const TriangleMeshIDGetMeshIDTable () const
const TriangleID GetMeshTriangleID (const unsigned int index) const
const TriangleIDGetMeshTriangleIDTable () const
bool Intersect (const Ray *ray, RayHit *hit) const
const TriangleMeshGetPreprocessedMesh () const

Private Member Functions

void Init (const Mesh *m)
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)
void CreateSwizzledLeaf (int32_t parentIndex, int32_t childIndex, u_int *primsIndexes)

Private Attributes

u_int nQuads
QuadTriangleprims
QBVHNodenodes
u_int nNodes
u_int maxNodes
BBox worldBound
u_int fullSweepThreshold
u_int skipFactor
u_int maxPrimsPerLeaf
const Contextctx
TriangleMeshpreprocessedMesh
const Meshmesh
TriangleMeshIDmeshIDs
TriangleIDmeshTriangleIDs
bool initialized

Friends

class MQBVHAccel
class OpenCLIntersectionDevice

Detailed Description

Definition at line 379 of file qbvhaccel.h.


Constructor & Destructor Documentation

QBVHAccel::QBVHAccel ( const Context context,
u_int  mp,
u_int  fst,
u_int  sf 
)

Normal constructor.

Definition at line 30 of file qbvhaccel.cpp.

References initialized, mesh, meshIDs, meshTriangleIDs, and preprocessedMesh.

QBVHAccel::~QBVHAccel (  ) 

Member Function Documentation

void 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.

Definition at line 147 of file qbvhaccel.cpp.

References CreateIntermediateNode(), CreateTempLeaf(), ctx, luxrays::Floor2Int(), fullSweepThreshold, INFINITY, LR_LOG, luxrays::BBox::MaximumExtent(), maxPrimsPerLeaf, luxrays::Min(), NB_BINS, luxrays::BBox::pMax, luxrays::BBox::pMin, skipFactor, luxrays::BBox::SurfaceArea(), and luxrays::Union().

Referenced by Init().

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

Create an intermediate node

Definition at line 440 of file qbvhaccel.h.

References luxrays::QBVHNode::children, luxrays::FreeAligned(), maxNodes, nNodes, nodes, and luxrays::QBVHNode::SetBBox().

Referenced by BuildTree().

void QBVHAccel::CreateSwizzledLeaf ( int32_t  parentIndex,
int32_t  childIndex,
u_int *  primsIndexes 
) [private]

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

Definition at line 357 of file qbvhaccel.cpp.

References luxrays::QBVHNode::FirstQuadIndexForLeaf(), luxrays::Mesh::GetTriangles(), luxrays::Mesh::GetVertices(), luxrays::QBVHNode::InitializeLeaf(), luxrays::QBVHNode::LeafIsEmpty(), mesh, luxrays::QBVHNode::NbQuadsInLeaf(), nodes, nQuads, and prims.

Referenced by PreSwizzle().

void 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

Definition at line 320 of file qbvhaccel.cpp.

References luxrays::QBVHNode::InitializeLeaf(), nNodes, nodes, nQuads, and luxrays::QBVHNode::SetBBox().

Referenced by BuildTree().

const TriangleMeshID luxrays::QBVHAccel::GetMeshID ( const unsigned int  index  )  const [inline, virtual]

Implements luxrays::Accelerator.

Definition at line 401 of file qbvhaccel.h.

References meshIDs.

const TriangleMeshID* luxrays::QBVHAccel::GetMeshIDTable (  )  const [inline, virtual]

Implements luxrays::Accelerator.

Definition at line 402 of file qbvhaccel.h.

References meshIDs.

const TriangleID luxrays::QBVHAccel::GetMeshTriangleID ( const unsigned int  index  )  const [inline, virtual]

Implements luxrays::Accelerator.

Definition at line 403 of file qbvhaccel.h.

References meshTriangleIDs.

const TriangleID* luxrays::QBVHAccel::GetMeshTriangleIDTable (  )  const [inline, virtual]

Implements luxrays::Accelerator.

Definition at line 404 of file qbvhaccel.h.

References meshTriangleIDs.

const TriangleMesh* luxrays::QBVHAccel::GetPreprocessedMesh (  )  const [inline]

Definition at line 413 of file qbvhaccel.h.

References preprocessedMesh.

AcceleratorType luxrays::QBVHAccel::GetType (  )  const [inline, virtual]

Implements luxrays::Accelerator.

Definition at line 397 of file qbvhaccel.h.

References luxrays::ACCEL_QBVH.

void QBVHAccel::Init ( const Mesh m  )  [private]
void QBVHAccel::Init ( const std::deque< Mesh * > &  meshes,
const unsigned int  totalVertexCount,
const unsigned int  totalTriangleCount 
) [virtual]
bool QBVHAccel::Intersect ( const Ray ray,
RayHit hit 
) const [virtual]
void QBVHAccel::PreSwizzle ( int32_t  nodeIndex,
u_int *  primsIndexes 
) [private]

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

Definition at line 348 of file qbvhaccel.cpp.

References CreateSwizzledLeaf(), and nodes.

Referenced by Init().

BBox luxrays::QBVHAccel::WorldBound (  )  const [inline]

to get the world bbox.

Returns:

Definition at line 395 of file qbvhaccel.h.

References worldBound.


Friends And Related Function Documentation

friend class MQBVHAccel [friend]

Definition at line 415 of file qbvhaccel.h.

friend class OpenCLIntersectionDevice [friend]

Definition at line 416 of file qbvhaccel.h.


Member Data Documentation

const Context* luxrays::QBVHAccel::ctx [private]

Definition at line 519 of file qbvhaccel.h.

Referenced by BuildTree(), and Init().

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

Definition at line 507 of file qbvhaccel.h.

Referenced by BuildTree().

Definition at line 525 of file qbvhaccel.h.

Referenced by Init(), QBVHAccel(), and ~QBVHAccel().

Definition at line 496 of file qbvhaccel.h.

Referenced by CreateIntermediateNode(), and Init().

The maximum number of primitives per leaf

Definition at line 517 of file qbvhaccel.h.

Referenced by BuildTree(), and Init().

const Mesh* luxrays::QBVHAccel::mesh [private]

Definition at line 521 of file qbvhaccel.h.

Referenced by CreateSwizzledLeaf(), Init(), and QBVHAccel().

Definition at line 522 of file qbvhaccel.h.

Referenced by GetMeshID(), GetMeshIDTable(), Init(), QBVHAccel(), and ~QBVHAccel().

Definition at line 523 of file qbvhaccel.h.

Referenced by GetMeshTriangleID(), GetMeshTriangleIDTable(), Init(), QBVHAccel(), and ~QBVHAccel().

u_int luxrays::QBVHAccel::nNodes [private]

The number of nodes really used.

Definition at line 496 of file qbvhaccel.h.

Referenced by CreateIntermediateNode(), CreateTempLeaf(), Init(), and luxrays::OpenCLIntersectionDevice::SetDataSet().

u_int luxrays::QBVHAccel::nQuads [private]

the actual number of quads

Definition at line 477 of file qbvhaccel.h.

Referenced by CreateSwizzledLeaf(), CreateTempLeaf(), Init(), and luxrays::OpenCLIntersectionDevice::SetDataSet().

Definition at line 520 of file qbvhaccel.h.

Referenced by GetPreprocessedMesh(), Init(), QBVHAccel(), and ~QBVHAccel().

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 486 of file qbvhaccel.h.

Referenced by CreateSwizzledLeaf(), Init(), Intersect(), luxrays::OpenCLIntersectionDevice::SetDataSet(), and ~QBVHAccel().

The skip factor for binning

Definition at line 512 of file qbvhaccel.h.

Referenced by BuildTree().

The world bounding box of the QBVH.

Definition at line 501 of file qbvhaccel.h.

Referenced by Init(), and WorldBound().


The documentation for this class was generated from the following files:
Generated on Sat Aug 21 14:06:20 2010 for LuxRays by  doxygen 1.6.3