Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::KDTreeBase< AABBType >::KDNode Struct Reference

KD-tree node in 8 bytes. More...

#include <mitsuba/render/gkdtree.h>

Public Types

enum  EMask {
  ETypeMask = 1 << 31, EIndirectionMask = 1 << 30, ELeafOffsetMask = ~ETypeMask, EInnerAxisMask = 0x3,
  EInnerOffsetMask = ~(EInnerAxisMask + EIndirectionMask), ERelOffsetLimit = (1<<28) - 1
}
 

Public Member Functions

void initLeafNode (unsigned int offset, unsigned int numPrims)
 Initialize a leaf kd-Tree node. More...
 
bool initInnerNode (int axis, float split, ptrdiff_t relOffset)
 
void initIndirectionNode (int axis, float split, uint32_t indirectionEntry)
 Initialize an interior indirection node. More...
 
FINLINE bool isLeaf () const
 Is this a leaf node? More...
 
FINLINE bool isIndirection () const
 Is this an indirection node? More...
 
FINLINE IndexType getPrimStart () const
 Assuming this is a leaf node, return the first primitive index. More...
 
FINLINE IndexType getPrimEnd () const
 Assuming this is a leaf node, return the last primitive index. More...
 
FINLINE IndexType getIndirectionIndex () const
 Return the index of an indirection node. More...
 
FINLINE const KDNode *__restrict getLeft () const
 Return the left child (assuming that this is an interior node) More...
 
FINLINE const KDNode *__restrict getSibling () const
 Return the sibling of the current node. More...
 
FINLINE KDNode *__restrict getLeft ()
 Return the left child (assuming that this is an interior node) More...
 
FINLINE const KDNode *__restrict getRight () const
 Return the left child (assuming that this is an interior node) More...
 
FINLINE float getSplit () const
 Return the split plane location (assuming that this is an interior node) More...
 
FINLINE int getAxis () const
 Return the split axis (assuming that this is an interior node) More...
 
std::string toString () const
 Return a string representation. More...
 

Public Attributes

union {
   struct {
      uint32_t   combined
 
      float   split
 Split plane coordinate. More...
 
   }   inner
 
   struct {
      uint32_t   combined
 
      uint32_t   end
 End offset of the primitive list. More...
 
   }   leaf
 
}; 
 

Detailed Description

template<typename AABBType>
struct mitsuba::KDTreeBase< AABBType >::KDNode

KD-tree node in 8 bytes.

Member Enumeration Documentation

template<typename AABBType>
enum mitsuba::KDTreeBase::KDNode::EMask
Enumerator
ETypeMask 
EIndirectionMask 
ELeafOffsetMask 
EInnerAxisMask 
EInnerOffsetMask 
ERelOffsetLimit 

Member Function Documentation

template<typename AABBType>
FINLINE int mitsuba::KDTreeBase< AABBType >::KDNode::getAxis ( ) const
inline

Return the split axis (assuming that this is an interior node)

template<typename AABBType>
FINLINE IndexType mitsuba::KDTreeBase< AABBType >::KDNode::getIndirectionIndex ( ) const
inline

Return the index of an indirection node.

template<typename AABBType>
FINLINE const KDNode* __restrict mitsuba::KDTreeBase< AABBType >::KDNode::getLeft ( ) const
inline

Return the left child (assuming that this is an interior node)

template<typename AABBType>
FINLINE KDNode* __restrict mitsuba::KDTreeBase< AABBType >::KDNode::getLeft ( )
inline

Return the left child (assuming that this is an interior node)

template<typename AABBType>
FINLINE IndexType mitsuba::KDTreeBase< AABBType >::KDNode::getPrimEnd ( ) const
inline

Assuming this is a leaf node, return the last primitive index.

template<typename AABBType>
FINLINE IndexType mitsuba::KDTreeBase< AABBType >::KDNode::getPrimStart ( ) const
inline

Assuming this is a leaf node, return the first primitive index.

template<typename AABBType>
FINLINE const KDNode* __restrict mitsuba::KDTreeBase< AABBType >::KDNode::getRight ( ) const
inline

Return the left child (assuming that this is an interior node)

template<typename AABBType>
FINLINE const KDNode* __restrict mitsuba::KDTreeBase< AABBType >::KDNode::getSibling ( ) const
inline

Return the sibling of the current node.

template<typename AABBType>
FINLINE float mitsuba::KDTreeBase< AABBType >::KDNode::getSplit ( ) const
inline

Return the split plane location (assuming that this is an interior node)

template<typename AABBType>
void mitsuba::KDTreeBase< AABBType >::KDNode::initIndirectionNode ( int  axis,
float  split,
uint32_t  indirectionEntry 
)
inline

Initialize an interior indirection node.

Indirections are necessary whenever the children cannot be referenced using a relative pointer, which can happen when they lie in different memory chunks. In this case, the node stores an index into a globally shared pointer list.

template<typename AABBType>
bool mitsuba::KDTreeBase< AABBType >::KDNode::initInnerNode ( int  axis,
float  split,
ptrdiff_t  relOffset 
)
inline

Initialize an interior kd-Tree node. Reports a failure if the relative offset to the left child node is too large.

template<typename AABBType>
void mitsuba::KDTreeBase< AABBType >::KDNode::initLeafNode ( unsigned int  offset,
unsigned int  numPrims 
)
inline

Initialize a leaf kd-Tree node.

template<typename AABBType>
FINLINE bool mitsuba::KDTreeBase< AABBType >::KDNode::isIndirection ( ) const
inline

Is this an indirection node?

template<typename AABBType>
FINLINE bool mitsuba::KDTreeBase< AABBType >::KDNode::isLeaf ( ) const
inline

Is this a leaf node?

template<typename AABBType>
std::string mitsuba::KDTreeBase< AABBType >::KDNode::toString ( ) const
inline

Return a string representation.

Member Data Documentation

union { ... }
template<typename AABBType>
uint32_t mitsuba::KDTreeBase< AABBType >::KDNode::combined
template<typename AABBType>
uint32_t mitsuba::KDTreeBase< AABBType >::KDNode::end

End offset of the primitive list.

struct { ... } mitsuba::KDTreeBase< AABBType >::KDNode::inner
struct { ... } mitsuba::KDTreeBase< AABBType >::KDNode::leaf
template<typename AABBType>
float mitsuba::KDTreeBase< AABBType >::KDNode::split

Split plane coordinate.


The documentation for this struct was generated from the following file: