QuadTreeTracer Class Reference#include <quadTreeTracer.h>
Detailed Description
Helper class to perform a fast, recursive ray cast against a set of hierarchical bounding boxes.
This class assumes that it is working on a unit quadtree (ie, one that extends from 0..1 in the XY dimensions. Z scale is unaffected).
Node indexing is done TGE Terrain style - 0 is the largest level of the quadtree, while coordinates are always in the full range of the quadtree (in a 6 deep tree, 0..63, for instance). This allows the quadtree descent to be very fast!
|
Public Member Functions |
bool | castRay (const Point3F &start, const Point3F &end, RayInfo *info) |
| Cast a ray against a quadtree of hierarchical bounding boxes.
|
Static Public Member Functions |
static const U32 | getNodeCount (const U32 depth) |
| Size of a quadtree of depth.
|
static const U32 | getNodeIndex (const U32 level, const Point2I pos) |
| Index of a node at given position in a quadtree.
|
Protected Member Functions |
| QuadTreeTracer (U32 treeDepth) |
virtual const F32 | getSquareMin (const U32 &level, const Point2I &pos) const =0 |
| Children better implement these! They return min/max height bounds of the specified square.
|
virtual const F32 | getSquareMax (const U32 &level, const Point2I &pos) const =0 |
virtual bool | castLeafRay (const Point2I pos, const Point3F &start, const Point3F &end, const F32 &startT, const F32 &endT, RayInfo *info)=0 |
| And this does checks on leaf nodes.
|
const F32 | calcIntercept (const F32 vStart, const F32 invDeltaV, const F32 intercept) const |
| Helper function to calculate intercepts.
|
Protected Attributes |
U32 | mTreeDepth |
Data Structures |
struct | RayStackNode |
struct | StackNode |
Constructor & Destructor Documentation
QuadTreeTracer::QuadTreeTracer |
( |
U32 |
treeDepth |
) |
[inline, protected] |
Member Function Documentation
virtual const F32 QuadTreeTracer::getSquareMin |
( |
const U32 & |
level, |
|
|
const Point2I & |
pos | |
|
) |
| | const [protected, pure virtual] |
Children better implement these! They return min/max height bounds of the specified square.
virtual const F32 QuadTreeTracer::getSquareMax |
( |
const U32 & |
level, |
|
|
const Point2I & |
pos | |
|
) |
| | const [protected, pure virtual] |
virtual bool QuadTreeTracer::castLeafRay |
( |
const Point2I |
pos, |
|
|
const Point3F & |
start, |
|
|
const Point3F & |
end, |
|
|
const F32 & |
startT, |
|
|
const F32 & |
endT, |
|
|
RayInfo * |
info | |
|
) |
| | [protected, pure virtual] |
And this does checks on leaf nodes.
const F32 QuadTreeTracer::calcIntercept |
( |
const F32 |
vStart, |
|
|
const F32 |
invDeltaV, |
|
|
const F32 |
intercept | |
|
) |
| | const [inline, protected] |
Helper function to calculate intercepts.
static const U32 QuadTreeTracer::getNodeCount |
( |
const U32 |
depth |
) |
[inline, static] |
Size of a quadtree of depth.
static const U32 QuadTreeTracer::getNodeIndex |
( |
const U32 |
level, |
|
|
const Point2I |
pos | |
|
) |
| | [inline, static] |
Index of a node at given position in a quadtree.
Cast a ray against a quadtree of hierarchical bounding boxes.
This method assumes the quadtree extends from (0..1) along the X and Y axes. Z is unscaled. You may need to adjust the points you pass into this method to get the proper results.
Field Documentation
|