#include <qbvhaccel.h>
Public Member Functions | |
QBVHNode () | |
bool | ChildIsLeaf (int i) const |
bool | LeafIsEmpty (int i) const |
u_int | NbQuadsInLeaf (int i) const |
u_int | NbPrimitivesInLeaf (int i) const |
u_int | FirstQuadIndexForLeaf (int i) const |
void | InitializeLeaf (int i, u_int nbQuads, u_int firstQuadIndex) |
void | SetBBox (int i, const BBox &bbox) |
int32_t | BBoxIntersect (__m128 sseOrig[3], __m128 sseInvDir[3], const __m128 &sseTMin, const __m128 &sseTMax, const int sign[3]) const |
Static Public Member Functions | |
static bool | IsLeaf (int32_t index) |
static bool | IsEmpty (int32_t index) |
static u_int | NbQuadPrimitives (int32_t index) |
static u_int | FirstQuadIndex (int32_t index) |
Public Attributes | |
__m128 | bboxes [2][3] |
int32_t | children [4] |
int32_t | axisMain |
int32_t | axisSubLeft |
int32_t | axisSubRight |
int32_t | parentNodeIndex |
Static Public Attributes | |
static const int32_t | emptyLeafNode = 0xffffffff |
The QBVH node structure, 128 bytes long (perfect for cache)
Definition at line 50 of file qbvhaccel.h.
lux::QBVHNode::QBVHNode | ( | ) | [inline] |
Base constructor, init correct bounding boxes and a "root" node (parentNodeIndex == -1)
Definition at line 88 of file qbvhaccel.h.
References bboxes, children, and emptyLeafNode.
int32_t lux::QBVHNode::BBoxIntersect | ( | __m128 | sseOrig[3], | |
__m128 | sseInvDir[3], | |||
const __m128 & | sseTMin, | |||
const __m128 & | sseTMax, | |||
const int | sign[3] | |||
) | const |
Intersect a ray described by sse variables with the 4 bounding boxes of the node.
sseOrig | the 3 coordinates replicated on a SSE register | |
sseInvDir | the 3 coordinates of the inverse of the direction | |
sseTMin | ||
sseTMax | ||
sign | ||
bboxOrder | will contain the order in which the childrn have to be intersected after |
Definition at line 412 of file qbvhaccel.cpp.
bool lux::QBVHNode::ChildIsLeaf | ( | int | i | ) | const [inline] |
Indicate whether the ith child is a leaf.
i |
Definition at line 105 of file qbvhaccel.h.
References children.
static u_int lux::QBVHNode::FirstQuadIndex | ( | int32_t | index | ) | [inline, static] |
Indicate the index in the quads array of the first quad contained by the the ith child, which must be a leaf.
i |
Definition at line 167 of file qbvhaccel.h.
References children.
Initialize the ith child as a leaf
i | ||
nbQuads | ||
firstQuadIndex |
Definition at line 185 of file qbvhaccel.h.
References children, and emptyLeafNode.
static bool lux::QBVHNode::IsEmpty | ( | int32_t | index | ) | [inline, static] |
Same thing, directly from the index.
index |
Definition at line 129 of file qbvhaccel.h.
References emptyLeafNode.
static bool lux::QBVHNode::IsLeaf | ( | int32_t | index | ) | [inline, static] |
bool lux::QBVHNode::LeafIsEmpty | ( | int | i | ) | const [inline] |
Indicates whether the ith child is an empty leaf.
i |
Definition at line 121 of file qbvhaccel.h.
References children, and emptyLeafNode.
Indicate the number of primitives in the ith child, which must be a leaf.
i |
Definition at line 157 of file qbvhaccel.h.
References NbQuadsInLeaf().
static u_int lux::QBVHNode::NbQuadPrimitives | ( | int32_t | index | ) | [inline, static] |
Return the number of group of 4 primitives, directly from the index.
index |
Definition at line 147 of file qbvhaccel.h.
Indicate the number of quads in the ith child, which must be a leaf.
i |
Definition at line 139 of file qbvhaccel.h.
References children.
Referenced by NbPrimitivesInLeaf().
Set the bounding box for the ith child.
i | ||
bbox |
Definition at line 204 of file qbvhaccel.h.
References bboxes, lux::BBox::pMax, and lux::BBox::pMin.
Referenced by lux::QBVHAccel::CreateIntermediateNode().
int32_t lux::QBVHNode::axisMain |
The 3 axis of split (main, sub-left, sub-right). 0 = x, 1 = y, 2 = z
Definition at line 79 of file qbvhaccel.h.
int32_t lux::QBVHNode::axisSubLeft |
Definition at line 79 of file qbvhaccel.h.
int32_t lux::QBVHNode::axisSubRight |
Definition at line 79 of file qbvhaccel.h.
__m128 lux::QBVHNode::bboxes[2][3] |
The 4 bounding boxes, in SoA form, for direct SIMD use (one __m128 for each coordinate)
Definition at line 65 of file qbvhaccel.h.
Referenced by QBVHNode(), and SetBBox().
int32_t lux::QBVHNode::children[4] |
The 4 children. If a child is a leaf, its index will be negative, the 4 next bits will code the number of primitives in the leaf (more exactly, nbPrimitives = 4 * (p + 1), where p is the integer interpretation of the 4 bits), and the 27 remaining bits the index of the first quad of the node
Definition at line 74 of file qbvhaccel.h.
Referenced by ChildIsLeaf(), lux::QBVHAccel::CreateIntermediateNode(), FirstQuadIndexForLeaf(), InitializeLeaf(), LeafIsEmpty(), NbQuadsInLeaf(), and QBVHNode().
const int32_t lux::QBVHNode::emptyLeafNode = 0xffffffff [static] |
Definition at line 59 of file qbvhaccel.h.
Referenced by InitializeLeaf(), IsEmpty(), LeafIsEmpty(), and QBVHNode().
int32_t lux::QBVHNode::parentNodeIndex |
Optimisation for shadow rays : keep the parent node index
Definition at line 82 of file qbvhaccel.h.
Referenced by lux::QBVHAccel::CreateIntermediateNode().