#include <tabreckdtreeaccel.h>
Public Member Functions | |
TaBRecKdTreeAccel (const vector< boost::shared_ptr< Primitive > > &p, int icost, int scost, float ebonus, int maxp, int maxDepth) | |
virtual BBox | WorldBound () const |
virtual bool | CanIntersect () const |
virtual | ~TaBRecKdTreeAccel () |
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 (int nodeNum, const BBox &bounds, const vector< BBox > &primBounds, int *primNums, int nprims, int depth, TaBRecBoundEdge *edges[3], int *prims0, int *prims1, int badRefines=0) |
Private Attributes | |
BBox | bounds |
int | isectCost |
int | traversalCost |
int | maxPrims |
float | emptyBonus |
u_int | nPrims |
boost::shared_ptr< Primitive > * | prims |
TaBRecKdAccelNode * | nodes |
int | nAllocedNodes |
int | nextFreeNode |
MemoryArena | arena |
Definition at line 141 of file tabreckdtreeaccel.h.
TaBRecKdTreeAccel::TaBRecKdTreeAccel | ( | const vector< boost::shared_ptr< Primitive > > & | p, | |
int | icost, | |||
int | scost, | |||
float | ebonus, | |||
int | maxp, | |||
int | maxDepth | |||
) |
Definition at line 33 of file tabreckdtree.cpp.
References b, bounds, buildTree(), CanIntersect(), lux::BBox::Expand(), KDTREE_EPSILON, Log2Int(), LUX_DEBUG, LUX_NOERROR, luxError, nAllocedNodes, nextFreeNode, nPrims, p, prims, Round2Int(), and lux::Union().
Referenced by CreateAccelerator().
TaBRecKdTreeAccel::~TaBRecKdTreeAccel | ( | ) | [virtual] |
Definition at line 99 of file tabreckdtree.cpp.
References lux::FreeAligned(), nodes, nPrims, and prims.
void TaBRecKdTreeAccel::buildTree | ( | int | nodeNum, | |
const BBox & | bounds, | |||
const vector< BBox > & | primBounds, | |||
int * | primNums, | |||
int | nprims, | |||
int | depth, | |||
TaBRecBoundEdge * | edges[3], | |||
int * | prims0, | |||
int * | prims1, | |||
int | badRefines = 0 | |||
) | [private] |
Definition at line 106 of file tabreckdtree.cpp.
References lux::TaBRecKdAccelNode::aboveChild, arena, emptyBonus, lux::TaBRecBoundEdge::END, lux::FreeAligned(), lux::TaBRecKdAccelNode::initInterior(), lux::TaBRecKdAccelNode::initLeaf(), isectCost, cimg_library::cimg::max(), maxPrims, memcpy(), nAllocedNodes, nextFreeNode, nodes, lux::BBox::pMax, lux::BBox::pMin, lux::TaBRecBoundEdge::primNum, prims, cimg_library::sort(), lux::TaBRecBoundEdge::START, lux::TaBRecBoundEdge::t, traversalCost, lux::Vector::x, lux::Vector::y, and lux::Vector::z.
Referenced by TaBRecKdTreeAccel().
virtual bool lux::TaBRecKdTreeAccel::CanIntersect | ( | ) | const [inline, virtual] |
Returns whether this primitive can be intersected.
Reimplemented from lux::Aggregate.
Definition at line 148 of file tabreckdtreeaccel.h.
Referenced by TaBRecKdTreeAccel().
Aggregate * TaBRecKdTreeAccel::CreateAccelerator | ( | const vector< boost::shared_ptr< Primitive > > & | prims, | |
const ParamSet & | ps | |||
) | [static] |
Definition at line 493 of file tabreckdtree.cpp.
References emptyBonus, lux::ParamSet::FindOneFloat(), lux::ParamSet::FindOneInt(), isectCost, maxPrims, prims, and TaBRecKdTreeAccel().
void TaBRecKdTreeAccel::GetPrimitives | ( | vector< boost::shared_ptr< Primitive > > & | prims | ) | [virtual] |
Gives all primitives in this aggregate.
prims | The destination list for the primitives. |
Implements lux::Aggregate.
Definition at line 486 of file tabreckdtree.cpp.
bool TaBRecKdTreeAccel::Intersect | ( | const Ray & | r, | |
Intersection * | in | |||
) | const [virtual] |
Intersects this primitive with the given ray. If an intersection is found, the ray will (i.e. r.tmax) and all fields in the intersection info will be updated.
r | The ray to intersect with this primitive. | |
in | The destination of the intersection information. |
Reimplemented from lux::Primitive.
Definition at line 224 of file tabreckdtree.cpp.
References lux::TaBRecKdAccelNode::aboveChild, bounds, lux::Ray::d, lux::Primitive::Intersect(), lux::BBox::IntersectP(), lux::TaBRecKdAccelNode::IsLeaf(), KDTREE_EPSILON, cimg_library::cimg::max(), MAX_TODO, lux::Ray::maxt, cimg_library::cimg::min(), lux::Ray::mint, lux::TaBRecKdNodeStack::node, nodes, lux::TaBRecKdAccelNode::nPrimitives(), lux::Ray::o, lux::TaBRecKdAccelNode::onePrimitive, lux::TaBRecKdNodeStack::pb, lux::TaBRecKdNodeStack::prev, lux::TaBRecKdAccelNode::primitives, lux::TaBRecKdAccelNode::SplitAxis(), lux::TaBRecKdAccelNode::SplitPos(), lux::TaBRecKdNodeStack::t, lux::Vector::x, lux::Vector::y, and lux::Vector::z.
bool TaBRecKdTreeAccel::IntersectP | ( | const Ray & | r | ) | const [virtual] |
Tests for intersection of this primitive with the given ray.
r | The ray to intersect with this primitive. |
Reimplemented from lux::Primitive.
Definition at line 353 of file tabreckdtree.cpp.
References lux::TaBRecKdAccelNode::aboveChild, lux::TaBRecInverseMailboxes::addChecked(), lux::TaBRecInverseMailboxes::alreadyChecked(), bounds, lux::Ray::d, lux::Primitive::IntersectP(), lux::BBox::IntersectP(), lux::TaBRecKdAccelNode::IsLeaf(), MAX_TODO, lux::TaBRecKdNodeStack::node, nodes, lux::TaBRecKdAccelNode::nPrimitives(), lux::Ray::o, lux::TaBRecKdAccelNode::onePrimitive, lux::TaBRecKdNodeStack::pb, lux::TaBRecKdNodeStack::prev, lux::TaBRecKdAccelNode::primitives, lux::TaBRecKdAccelNode::SplitAxis(), lux::TaBRecKdAccelNode::SplitPos(), lux::TaBRecKdNodeStack::t, lux::Vector::x, lux::Vector::y, and lux::Vector::z.
virtual BBox lux::TaBRecKdTreeAccel::WorldBound | ( | ) | const [inline, virtual] |
Returns the world bounds of this primitive.
Implements lux::Primitive.
Definition at line 147 of file tabreckdtreeaccel.h.
References bounds.
MemoryArena lux::TaBRecKdTreeAccel::arena [private] |
Definition at line 173 of file tabreckdtreeaccel.h.
Referenced by buildTree().
BBox lux::TaBRecKdTreeAccel::bounds [private] |
Definition at line 164 of file tabreckdtreeaccel.h.
Referenced by Intersect(), IntersectP(), TaBRecKdTreeAccel(), and WorldBound().
float lux::TaBRecKdTreeAccel::emptyBonus [private] |
Definition at line 166 of file tabreckdtreeaccel.h.
Referenced by buildTree(), and CreateAccelerator().
int lux::TaBRecKdTreeAccel::isectCost [private] |
Definition at line 165 of file tabreckdtreeaccel.h.
Referenced by buildTree(), and CreateAccelerator().
int lux::TaBRecKdTreeAccel::maxPrims [private] |
Definition at line 165 of file tabreckdtreeaccel.h.
Referenced by buildTree(), and CreateAccelerator().
int lux::TaBRecKdTreeAccel::nAllocedNodes [private] |
Definition at line 171 of file tabreckdtreeaccel.h.
Referenced by buildTree(), and TaBRecKdTreeAccel().
int lux::TaBRecKdTreeAccel::nextFreeNode [private] |
Definition at line 171 of file tabreckdtreeaccel.h.
Referenced by buildTree(), and TaBRecKdTreeAccel().
TaBRecKdAccelNode* lux::TaBRecKdTreeAccel::nodes [private] |
Definition at line 170 of file tabreckdtreeaccel.h.
Referenced by buildTree(), Intersect(), IntersectP(), and ~TaBRecKdTreeAccel().
u_int lux::TaBRecKdTreeAccel::nPrims [private] |
Definition at line 168 of file tabreckdtreeaccel.h.
Referenced by GetPrimitives(), TaBRecKdTreeAccel(), and ~TaBRecKdTreeAccel().
boost::shared_ptr<Primitive>* lux::TaBRecKdTreeAccel::prims [private] |
Definition at line 169 of file tabreckdtreeaccel.h.
Referenced by buildTree(), CreateAccelerator(), GetPrimitives(), TaBRecKdTreeAccel(), and ~TaBRecKdTreeAccel().
int lux::TaBRecKdTreeAccel::traversalCost [private] |
Definition at line 165 of file tabreckdtreeaccel.h.
Referenced by buildTree().