Public Member Functions | |
KdTreeAccel (const vector< Reference< Primitive > > &p, int icost, int scost, float ebonus, int maxp, int maxDepth) | |
BBox | WorldBound () const |
bool | CanIntersect () const |
~KdTreeAccel () | |
void | buildTree (int nodeNum, const BBox &bounds, const vector< BBox > &primBounds, int *primNums, int nprims, int depth, BoundEdge *edges[3], int *prims0, int *prims1, int badRefines=0) |
bool | Intersect (const Ray &ray, Intersection *isect) const |
bool | IntersectP (const Ray &ray) const |
Private Attributes | |
int | isectCost |
int | traversalCost |
int | maxPrims |
float | emptyBonus |
u_int | nMailboxes |
MailboxPrim * | mailboxPrims |
int | curMailboxId |
KdAccelNode * | nodes |
int | nAllocedNodes |
int | nextFreeNode |
BBox | bounds |
MemoryArena | arena |
Definition at line 108 of file kdtree.cpp.
KdTreeAccel::KdTreeAccel | ( | const vector< Reference< Primitive > > & | p, | |
int | icost, | |||
int | scost, | |||
float | ebonus, | |||
int | maxp, | |||
int | maxDepth | |||
) |
Definition at line 142 of file kdtree.cpp.
References AllocAligned(), bounds, buildTree(), curMailboxId, Primitive::FullyRefine(), Log2Int(), mailboxPrims, nAllocedNodes, nextFreeNode, nMailboxes, Round2Int(), and Union().
Referenced by CreateAccelerator().
KdTreeAccel::~KdTreeAccel | ( | ) |
Definition at line 191 of file kdtree.cpp.
References FreeAligned(), mailboxPrims, nMailboxes, and nodes.
BBox KdTreeAccel::WorldBound | ( | ) | const [inline, virtual] |
bool KdTreeAccel::CanIntersect | ( | ) | const [inline, virtual] |
void KdTreeAccel::buildTree | ( | int | nodeNum, | |
const BBox & | bounds, | |||
const vector< BBox > & | primBounds, | |||
int * | primNums, | |||
int | nprims, | |||
int | depth, | |||
BoundEdge * | edges[3], | |||
int * | prims0, | |||
int * | prims1, | |||
int | badRefines = 0 | |||
) |
Definition at line 197 of file kdtree.cpp.
References KdAccelNode::aboveChild, AllocAligned(), arena, Assert, emptyBonus, BoundEdge::END, FreeAligned(), INFINITY, KdAccelNode::initInterior(), KdAccelNode::initLeaf(), isectCost, mailboxPrims, maxPrims, memcpy(), nAllocedNodes, nextFreeNode, nodes, BBox::pMax, BBox::pMin, BoundEdge::primNum, BoundEdge::START, BoundEdge::t, traversalCost, Vector::x, Vector::y, and Vector::z.
Referenced by KdTreeAccel().
bool KdTreeAccel::Intersect | ( | const Ray & | ray, | |
Intersection * | isect | |||
) | const [virtual] |
Implements Primitive.
Definition at line 313 of file kdtree.cpp.
References KdAccelNode::aboveChild, bounds, curMailboxId, Ray::d, BBox::IntersectP(), KdAccelNode::IsLeaf(), MailboxPrim::lastMailboxId, MAX_TODO, Ray::maxt, KdToDo::node, nodes, KdAccelNode::nPrimitives(), Ray::o, KdAccelNode::onePrimitive, MailboxPrim::primitive, KdAccelNode::primitives, KdAccelNode::SplitAxis(), KdAccelNode::SplitPos(), KdToDo::tmax, KdToDo::tmin, Vector::x, Vector::y, and Vector::z.
bool KdTreeAccel::IntersectP | ( | const Ray & | ray | ) | const [virtual] |
Implements Primitive.
Definition at line 404 of file kdtree.cpp.
References KdAccelNode::aboveChild, bounds, curMailboxId, Ray::d, BBox::IntersectP(), KdAccelNode::IsLeaf(), MailboxPrim::lastMailboxId, MAX_TODO, KdToDo::node, nodes, KdAccelNode::nPrimitives(), Ray::o, KdAccelNode::onePrimitive, MailboxPrim::primitive, KdAccelNode::primitives, KdAccelNode::SplitAxis(), KdAccelNode::SplitPos(), KdToDo::tmax, KdToDo::tmin, Vector::x, Vector::y, and Vector::z.
int KdTreeAccel::isectCost [private] |
int KdTreeAccel::traversalCost [private] |
int KdTreeAccel::maxPrims [private] |
float KdTreeAccel::emptyBonus [private] |
u_int KdTreeAccel::nMailboxes [private] |
MailboxPrim* KdTreeAccel::mailboxPrims [private] |
Definition at line 129 of file kdtree.cpp.
Referenced by buildTree(), KdTreeAccel(), and ~KdTreeAccel().
int KdTreeAccel::curMailboxId [mutable, private] |
Definition at line 130 of file kdtree.cpp.
Referenced by Intersect(), IntersectP(), and KdTreeAccel().
KdAccelNode* KdTreeAccel::nodes [private] |
Definition at line 131 of file kdtree.cpp.
Referenced by buildTree(), Intersect(), IntersectP(), and ~KdTreeAccel().
int KdTreeAccel::nAllocedNodes [private] |
int KdTreeAccel::nextFreeNode [private] |
BBox KdTreeAccel::bounds [private] |
Definition at line 133 of file kdtree.cpp.
Referenced by Intersect(), IntersectP(), KdTreeAccel(), and WorldBound().
MemoryArena KdTreeAccel::arena [private] |