Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
BIH Class Reference

#include <BoundingIntervalHierarchy.h>

Classes

struct  buildData
class  BuildStats
struct  StackNode

Public Member Functions

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

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

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

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 57 of file BoundingIntervalHierarchy.h.

Constructor & Destructor Documentation

◆ BIH()

BIH::BIH ( )
inline

Definition at line 69 of file BoundingIntervalHierarchy.h.

References init_empty().

Member Function Documentation

◆ build()

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

◆ buildHierarchy()

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

Definition at line 14 of file BoundingIntervalHierarchy.cpp.

References bounds, BIH::buildData::numPrims, and subdivide().

Referenced by build().

◆ createNode()

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

Definition at line 377 of file BoundingIntervalHierarchy.h.

Referenced by subdivide().

◆ init_empty()

void BIH::init_empty ( )
inlineprivate

Definition at line 60 of file BoundingIntervalHierarchy.h.

References objects, and tree.

Referenced by BIH(), and build().

◆ intersectPoint()

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

◆ intersectRay()

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

◆ primCount()

uint32 BIH::primCount ( ) const
inline

Definition at line 105 of file BoundingIntervalHierarchy.h.

References objects.

◆ readFromFile()

bool BIH::readFromFile ( FILE * rf)

Definition at line 248 of file BoundingIntervalHierarchy.cpp.

References bounds, objects, and tree.

◆ 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

◆ writeToFile()

bool BIH::writeToFile ( FILE * wf) const

Definition at line 234 of file BoundingIntervalHierarchy.cpp.

References bounds, objects, and tree.

Referenced by VMAP::TileAssembler::convertWorld2().

Member Data Documentation

◆ bounds

G3D::AABox BIH::bounds
protected

◆ objects

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

◆ tree

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

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