#include <bvh.h>
Public Member Functions | |
BVHAccel (const vector< Reference< Primitive > > &p, uint32_t maxPrims=1, const string &sm="sah") | |
BBox | WorldBound () const |
bool | CanIntersect () const |
~BVHAccel () | |
bool | Intersect (const Ray &ray, Intersection *isect) const |
bool | IntersectP (const Ray &ray) const |
Private Types | |
enum | SplitMethod { SPLIT_MIDDLE, SPLIT_EQUAL_COUNTS, SPLIT_SAH } |
Private Member Functions | |
BVHBuildNode * | recursiveBuild (MemoryArena &buildArena, vector< BVHPrimitiveInfo > &buildData, uint32_t start, uint32_t end, uint32_t *totalNodes, vector< Reference< Primitive > > &orderedPrims) |
uint32_t | flattenBVHTree (BVHBuildNode *node, uint32_t *offset) |
Private Attributes | |
uint32_t | maxPrimsInNode |
SplitMethod | splitMethod |
vector< Reference< Primitive > > | primitives |
LinearBVHNode * | nodes |
Definition at line 41 of file bvh.h.
enum BVHAccel::SplitMethod [private] |
BVHAccel::BVHAccel | ( | const vector< Reference< Primitive > > & | p, | |
uint32_t | maxPrims = 1 , |
|||
const string & | sm = "sah" | |||
) |
Definition at line 145 of file bvh.cpp.
References Assert, flattenBVHTree(), Primitive::FullyRefine(), Info(), maxPrimsInNode, nodes, primitives, recursiveBuild(), SPLIT_EQUAL_COUNTS, SPLIT_MIDDLE, SPLIT_SAH, splitMethod, and Warning().
BVHAccel::~BVHAccel | ( | ) |
Definition at line 370 of file bvh.cpp.
References FreeAligned(), and nodes.
bool BVHAccel::CanIntersect | ( | ) | const [inline, virtual] |
uint32_t BVHAccel::flattenBVHTree | ( | BVHBuildNode * | node, | |
uint32_t * | offset | |||
) | [private] |
Definition at line 349 of file bvh.cpp.
References Assert, LinearBVHNode::axis, BVHBuildNode::bounds, LinearBVHNode::bounds, BVHBuildNode::children, BVHBuildNode::firstPrimOffset, nodes, LinearBVHNode::nPrimitives, BVHBuildNode::nPrimitives, LinearBVHNode::primitivesOffset, LinearBVHNode::secondChildOffset, and BVHBuildNode::splitAxis.
Referenced by BVHAccel().
bool BVHAccel::Intersect | ( | const Ray & | ray, | |
Intersection * | isect | |||
) | const [virtual] |
Implements Primitive.
Definition at line 375 of file bvh.cpp.
References LinearBVHNode::axis, LinearBVHNode::bounds, Ray::d, IntersectP(), Ray::mint, nodes, LinearBVHNode::nPrimitives, primitives, LinearBVHNode::primitivesOffset, LinearBVHNode::secondChildOffset, Vector::x, Vector::y, and Vector::z.
bool BVHAccel::IntersectP | ( | const Ray & | ray | ) | const [virtual] |
second child first
Implements Primitive.
Definition at line 430 of file bvh.cpp.
References LinearBVHNode::axis, LinearBVHNode::bounds, Ray::d, nodes, LinearBVHNode::nPrimitives, primitives, LinearBVHNode::primitivesOffset, LinearBVHNode::secondChildOffset, Vector::x, Vector::y, and Vector::z.
Referenced by Intersect().
BVHBuildNode * BVHAccel::recursiveBuild | ( | MemoryArena & | buildArena, | |
vector< BVHPrimitiveInfo > & | buildData, | |||
uint32_t | start, | |||
uint32_t | end, | |||
uint32_t * | totalNodes, | |||
vector< Reference< Primitive > > & | orderedPrims | |||
) | [private] |
Definition at line 202 of file bvh.cpp.
References MemoryArena::Alloc(), Assert, BVHBuildNode::InitInterior(), BVHBuildNode::InitLeaf(), BBox::MaximumExtent(), maxPrimsInNode, BBox::pMax, BBox::pMin, BVHPrimitiveInfo::primitiveNumber, primitives, SPLIT_EQUAL_COUNTS, SPLIT_MIDDLE, SPLIT_SAH, splitMethod, BBox::SurfaceArea(), and Union().
Referenced by BVHAccel().
BBox BVHAccel::WorldBound | ( | ) | const [virtual] |
Implements Primitive.
Definition at line 197 of file bvh.cpp.
References LinearBVHNode::bounds, and nodes.
uint32_t BVHAccel::maxPrimsInNode [private] |
Definition at line 59 of file bvh.h.
Referenced by BVHAccel(), and recursiveBuild().
LinearBVHNode* BVHAccel::nodes [private] |
Definition at line 63 of file bvh.h.
Referenced by BVHAccel(), flattenBVHTree(), Intersect(), IntersectP(), WorldBound(), and ~BVHAccel().
vector<Reference<Primitive> > BVHAccel::primitives [private] |
Definition at line 62 of file bvh.h.
Referenced by BVHAccel(), Intersect(), IntersectP(), and recursiveBuild().
SplitMethod BVHAccel::splitMethod [private] |
Definition at line 61 of file bvh.h.
Referenced by BVHAccel(), and recursiveBuild().