#include <tabreckdtreeaccel.h>
Public Member Functions | |
TaBRecKdTreeAccel (const vector< Primitive * > &p, int icost, int scost, float ebonus, int maxp, int maxDepth) | |
BBox | WorldBound () const |
bool | CanIntersect () const |
~TaBRecKdTreeAccel () | |
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) |
bool | Intersect (const Ray &ray, Intersection *isect) const |
bool | IntersectP (const Ray &ray) const |
Static Public Member Functions | |
static Primitive * | CreateAccelerator (const vector< Primitive * > &prims, const ParamSet &ps) |
Private Attributes | |
BBox | bounds |
int | isectCost |
int | traversalCost |
int | maxPrims |
float | emptyBonus |
u_int | nPrims |
Primitive ** | prims |
TaBRecKdAccelNode * | nodes |
int | nAllocedNodes |
int | nextFreeNode |
MemoryArena | arena |
Definition at line 164 of file tabreckdtreeaccel.h.
TaBRecKdTreeAccel::TaBRecKdTreeAccel | ( | const vector< Primitive * > & | p, | |
int | icost, | |||
int | scost, | |||
float | ebonus, | |||
int | maxp, | |||
int | maxDepth | |||
) |
Definition at line 31 of file tabreckdtree.cpp.
References lux::AllocAligned(), bounds, buildTree(), lux::Primitive::FullyRefine(), Log2Int(), LUX_INFO, LUX_NOERROR, luxError, nAllocedNodes, nextFreeNode, nPrims, lux::BBox::pMax, lux::BBox::pMin, prims, RAY_EPSILON, Round2Int(), lux::Union(), lux::Primitive::WorldBound(), lux::Point::x, lux::Vector::x, lux::Point::y, lux::Vector::y, lux::Point::z, and lux::Vector::z.
Referenced by CreateAccelerator().
TaBRecKdTreeAccel::~TaBRecKdTreeAccel | ( | ) |
Definition at line 104 of file tabreckdtree.cpp.
References lux::FreeAligned(), nodes, 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 | |||
) |
Definition at line 109 of file tabreckdtree.cpp.
References lux::TaBRecKdAccelNode::aboveChild, lux::AllocAligned(), arena, emptyBonus, lux::TaBRecBoundEdge::END, lux::FreeAligned(), INFINITY, 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().
bool lux::TaBRecKdTreeAccel::CanIntersect | ( | ) | const [inline, virtual] |
Reimplemented from lux::Primitive.
Definition at line 171 of file tabreckdtreeaccel.h.
Primitive * TaBRecKdTreeAccel::CreateAccelerator | ( | const vector< Primitive * > & | prims, | |
const ParamSet & | ps | |||
) | [static] |
Definition at line 517 of file tabreckdtree.cpp.
References emptyBonus, lux::ParamSet::FindOneFloat(), lux::ParamSet::FindOneInt(), isectCost, maxPrims, and TaBRecKdTreeAccel().
bool TaBRecKdTreeAccel::Intersect | ( | const Ray & | ray, | |
Intersection * | isect | |||
) | const [virtual] |
Implements lux::Primitive.
Definition at line 228 of file tabreckdtree.cpp.
References lux::TaBRecKdAccelNode::aboveChild, bounds, lux::Ray::d, lux::Primitive::Intersect(), lux::BBox::IntersectP(), lux::TaBRecKdAccelNode::IsLeaf(), 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, prims, lux::TaBRecKdAccelNode::SplitAxis(), lux::TaBRecKdAccelNode::SplitPos(), lux::TaBRecKdNodeStack::t, lux::Vector::x, lux::Vector::y, and lux::Vector::z.
bool TaBRecKdTreeAccel::IntersectP | ( | const Ray & | ray | ) | const [virtual] |
Implements lux::Primitive.
Definition at line 374 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, prims, lux::TaBRecKdAccelNode::SplitAxis(), lux::TaBRecKdAccelNode::SplitPos(), lux::TaBRecKdNodeStack::t, lux::Vector::x, lux::Vector::y, and lux::Vector::z.
BBox lux::TaBRecKdTreeAccel::WorldBound | ( | ) | const [inline, virtual] |
MemoryArena lux::TaBRecKdTreeAccel::arena [private] |
Definition at line 194 of file tabreckdtreeaccel.h.
Referenced by buildTree().
BBox lux::TaBRecKdTreeAccel::bounds [private] |
Definition at line 185 of file tabreckdtreeaccel.h.
Referenced by Intersect(), IntersectP(), TaBRecKdTreeAccel(), and WorldBound().
float lux::TaBRecKdTreeAccel::emptyBonus [private] |
Definition at line 187 of file tabreckdtreeaccel.h.
Referenced by buildTree(), and CreateAccelerator().
int lux::TaBRecKdTreeAccel::isectCost [private] |
Definition at line 186 of file tabreckdtreeaccel.h.
Referenced by buildTree(), and CreateAccelerator().
int lux::TaBRecKdTreeAccel::maxPrims [private] |
Definition at line 186 of file tabreckdtreeaccel.h.
Referenced by buildTree(), and CreateAccelerator().
int lux::TaBRecKdTreeAccel::nAllocedNodes [private] |
Definition at line 192 of file tabreckdtreeaccel.h.
Referenced by buildTree(), and TaBRecKdTreeAccel().
int lux::TaBRecKdTreeAccel::nextFreeNode [private] |
Definition at line 192 of file tabreckdtreeaccel.h.
Referenced by buildTree(), and TaBRecKdTreeAccel().
TaBRecKdAccelNode* lux::TaBRecKdTreeAccel::nodes [private] |
Definition at line 191 of file tabreckdtreeaccel.h.
Referenced by buildTree(), Intersect(), IntersectP(), and ~TaBRecKdTreeAccel().
u_int lux::TaBRecKdTreeAccel::nPrims [private] |
Definition at line 189 of file tabreckdtreeaccel.h.
Referenced by TaBRecKdTreeAccel().
Primitive** lux::TaBRecKdTreeAccel::prims [private] |
Definition at line 190 of file tabreckdtreeaccel.h.
Referenced by buildTree(), Intersect(), IntersectP(), TaBRecKdTreeAccel(), and ~TaBRecKdTreeAccel().
int lux::TaBRecKdTreeAccel::traversalCost [private] |
Definition at line 186 of file tabreckdtreeaccel.h.
Referenced by buildTree().