lux::QBVHNode Class Reference

#include <qbvhaccel.h>

Collaboration diagram for lux::QBVHNode:
[legend]

List of all members.

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

Detailed Description

The QBVH node structure, 128 bytes long (perfect for cache)

Definition at line 50 of file qbvhaccel.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Parameters:
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
Returns:
an int used to index the array of paths in the bboxes (the visit array)

Definition at line 412 of file qbvhaccel.cpp.

bool lux::QBVHNode::ChildIsLeaf ( int  i  )  const [inline]

Indicate whether the ith child is a leaf.

Parameters:
i 
Returns:

Definition at line 105 of file qbvhaccel.h.

References children.

static u_int lux::QBVHNode::FirstQuadIndex ( int32_t  index  )  [inline, static]

Same thing, directly from the index.

Parameters:
index 

Definition at line 175 of file qbvhaccel.h.

u_int lux::QBVHNode::FirstQuadIndexForLeaf ( int  i  )  const [inline]

Indicate the index in the quads array of the first quad contained by the the ith child, which must be a leaf.

Parameters:
i 
Returns:

Definition at line 167 of file qbvhaccel.h.

References children.

void lux::QBVHNode::InitializeLeaf ( int  i,
u_int  nbQuads,
u_int  firstQuadIndex 
) [inline]

Initialize the ith child as a leaf

Parameters:
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.

Parameters:
index 

Definition at line 129 of file qbvhaccel.h.

References emptyLeafNode.

static bool lux::QBVHNode::IsLeaf ( int32_t  index  )  [inline, static]

Same thing, directly from the index.

Parameters:
index 

Definition at line 113 of file qbvhaccel.h.

bool lux::QBVHNode::LeafIsEmpty ( int  i  )  const [inline]

Indicates whether the ith child is an empty leaf.

Parameters:
i 

Definition at line 121 of file qbvhaccel.h.

References children, and emptyLeafNode.

u_int lux::QBVHNode::NbPrimitivesInLeaf ( int  i  )  const [inline]

Indicate the number of primitives in the ith child, which must be a leaf.

Parameters:
i 
Returns:

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.

Parameters:
index 

Definition at line 147 of file qbvhaccel.h.

u_int lux::QBVHNode::NbQuadsInLeaf ( int  i  )  const [inline]

Indicate the number of quads in the ith child, which must be a leaf.

Parameters:
i 
Returns:

Definition at line 139 of file qbvhaccel.h.

References children.

Referenced by NbPrimitivesInLeaf().

void lux::QBVHNode::SetBBox ( int  i,
const BBox bbox 
) [inline]

Set the bounding box for the ith child.

Parameters:
i 
bbox 

Definition at line 204 of file qbvhaccel.h.

References bboxes, lux::BBox::pMax, and lux::BBox::pMin.

Referenced by lux::QBVHAccel::CreateIntermediateNode().


Member Data Documentation

The 3 axis of split (main, sub-left, sub-right). 0 = x, 1 = y, 2 = z

Definition at line 79 of file qbvhaccel.h.

Definition at line 79 of file qbvhaccel.h.

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().

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().

Optimisation for shadow rays : keep the parent node index

Definition at line 82 of file qbvhaccel.h.

Referenced by lux::QBVHAccel::CreateIntermediateNode().


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208