#include <qbvhaccel.h>
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 Aggregate * | CreateAccelerator (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 ¢roidsBbox, 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 |
| QBVHNode * | nodes |
| 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] |
Definition at line 234 of file qbvhaccel.h.
| lux::QBVHAccel::QBVHAccel | ( | const vector< boost::shared_ptr< Primitive > > & | p, | |
| int | mp, | |||
| float | fst, | |||
| int | sf | |||
| ) |
Normal constructor.
| 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.
| 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.
| 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
| 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
| 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
| 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
| 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
| 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.
| ray | in world space | |
| isect | pointer to the intersection object to fill. |
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.
| ray | in world space |
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.
| nodeIndex | ||
| primsIndexes | ||
| vPrims |
Definition at line 378 of file qbvhaccel.cpp.
| BBox lux::QBVHAccel::WorldBound | ( | ) | const [virtual] |
to get the world bbox.
Implements lux::Primitive.
Definition at line 648 of file qbvhaccel.cpp.
u_int lux::QBVHAccel::fullSweepThreshold [private] |
The number of primitives in the node that makes switch to full sweep for binning
Definition at line 403 of file qbvhaccel.h.
u_int lux::QBVHAccel::maxNodes [private] |
Definition at line 392 of file qbvhaccel.h.
Referenced by CreateIntermediateNode().
u_int lux::QBVHAccel::maxPrimsPerLeaf [private] |
The maximum number of primitives per leaf
Definition at line 413 of file qbvhaccel.h.
u_int lux::QBVHAccel::nNodes [private] |
The number of nodes really used.
Definition at line 392 of file qbvhaccel.h.
Referenced by CreateIntermediateNode().
QBVHNode* lux::QBVHAccel::nodes [private] |
The nodes of the QBVH.
Definition at line 387 of file qbvhaccel.h.
Referenced by CreateIntermediateNode().
u_int lux::QBVHAccel::nPrims [private] |
The number of primitives
Definition at line 382 of file qbvhaccel.h.
u_int lux::QBVHAccel::nQuads [private] |
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.
u_int lux::QBVHAccel::skipFactor [private] |
The skip factor for binning
Definition at line 408 of file qbvhaccel.h.
BBox lux::QBVHAccel::worldBound [private] |
The world bounding box of the QBVH.
Definition at line 397 of file qbvhaccel.h.
Referenced by GetPrimitives().
1.6.2-20100208