TrinityCore
BIH Class Reference

#include <BoundingIntervalHierarchy.h>

Classes

struct  buildData
 
class  BuildStats
 
struct  StackNode
 

Public Member Functions

 BIH ()
 
template<class BoundsFunc , class PrimArray >
void build (PrimArray const &primitives, BoundsFunc &getBounds, uint32 leafSize=3, bool printStats=false)
 
uint32 primCount () const
 
template<typename RayCallback >
void intersectRay (const G3D::Ray &r, RayCallback &intersectCallback, float &maxDist, bool stopAtFirst=false) const
 
template<typename IsectCallback >
void intersectPoint (const G3D::Vector3 &p, IsectCallback &intersectCallback) const
 
bool writeToFile (FILE *wf) const
 
bool readFromFile (FILE *rf)
 

Protected Member Functions

void buildHierarchy (std::vector< uint32 > &tempTree, buildData &dat, BuildStats &stats)
 
void createNode (std::vector< uint32 > &tempTree, int nodeIndex, uint32 left, uint32 right) const
 
void subdivide (int left, int right, std::vector< uint32 > &tempTree, buildData &dat, AABound &gridBox, AABound &nodeBox, int nodeIndex, int depth, BuildStats &stats)
 

Protected Attributes

std::vector< uint32tree
 
std::vector< uint32objects
 
G3D::AABox bounds
 

Private Member Functions

void init_empty ()
 

Detailed Description

Bounding Interval Hierarchy Class. Building and Ray-Intersection functions based on BIH from Sunflow, a Java Raytracer, released under MIT/X11 License http://sunflow.sourceforge.net/ Copyright (c) 2003-2007 Christopher Kulla

Definition at line 65 of file BoundingIntervalHierarchy.h.

Constructor & Destructor Documentation

◆ BIH()

BIH::BIH ( )
inline

Definition at line 78 of file BoundingIntervalHierarchy.h.

Member Function Documentation

◆ build()

template<class BoundsFunc , class PrimArray >
void BIH::build ( PrimArray const &  primitives,
BoundsFunc &  getBounds,
uint32  leafSize = 3,
bool  printStats = false 
)
inline

Definition at line 80 of file BoundingIntervalHierarchy.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHierarchy()

void BIH::buildHierarchy ( std::vector< uint32 > &  tempTree,
buildData dat,
BuildStats stats 
)
protected

Definition at line 26 of file BoundingIntervalHierarchy.cpp.

+ Here is the call graph for this function:

◆ createNode()

void BIH::createNode ( std::vector< uint32 > &  tempTree,
int  nodeIndex,
uint32  left,
uint32  right 
) const
inlineprotected

Definition at line 385 of file BoundingIntervalHierarchy.h.

+ Here is the caller graph for this function:

◆ init_empty()

void BIH::init_empty ( )
inlineprivate

Definition at line 68 of file BoundingIntervalHierarchy.h.

◆ intersectPoint()

template<typename IsectCallback >
void BIH::intersectPoint ( const G3D::Vector3 &  p,
IsectCallback &  intersectCallback 
) const
inline

Definition at line 255 of file BoundingIntervalHierarchy.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ intersectRay()

template<typename RayCallback >
void BIH::intersectRay ( const G3D::Ray &  r,
RayCallback &  intersectCallback,
float &  maxDist,
bool  stopAtFirst = false 
) const
inline

Definition at line 117 of file BoundingIntervalHierarchy.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ primCount()

uint32 BIH::primCount ( ) const
inline

Definition at line 114 of file BoundingIntervalHierarchy.h.

+ Here is the caller graph for this function:

◆ readFromFile()

bool BIH::readFromFile ( FILE *  rf)

Definition at line 260 of file BoundingIntervalHierarchy.cpp.

+ Here is the caller graph for this function:

◆ subdivide()

void BIH::subdivide ( int  left,
int  right,
std::vector< uint32 > &  tempTree,
buildData dat,
AABound gridBox,
AABound nodeBox,
int  nodeIndex,
int  depth,
BuildStats stats 
)
protected

Definition at line 40 of file BoundingIntervalHierarchy.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeToFile()

bool BIH::writeToFile ( FILE *  wf) const

Definition at line 246 of file BoundingIntervalHierarchy.cpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ bounds

G3D::AABox BIH::bounds
protected

Definition at line 338 of file BoundingIntervalHierarchy.h.

◆ objects

std::vector<uint32> BIH::objects
protected

Definition at line 337 of file BoundingIntervalHierarchy.h.

◆ tree

std::vector<uint32> BIH::tree
protected

Definition at line 336 of file BoundingIntervalHierarchy.h.


The documentation for this class was generated from the following files: