QuadTreeTracer

Engine/source/util/quadTreeTracer.h

Helper class to perform a fast, recursive ray cast against a set of hierarchical bounding boxes.

More...

Classes:

Protected Attributes

Protected Functions

QuadTreeTracer(U32 treeDepth)
calcIntercept(const F32 vStart, const F32 invDeltaV, const F32 intercept)

Helper function to calculate intercepts.

bool
castLeafRay(const Point2I pos, const Point3F & start, const Point3F & end, const F32 & startT, const F32 & endT, RayInfo * info)

And this does checks on leaf nodes.

Children better implement these! They return min/max height bounds of the specified square.

Public Static Functions

Size of a quadtree of depth.

Index of a node at given position in a quadtree.

Public Functions

bool
castRay(const Point3F & start, const Point3F & end, RayInfo * info)

Cast a ray against a quadtree of hierarchical bounding boxes.

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!

Protected Attributes

U32 mTreeDepth 

Protected Functions

QuadTreeTracer(U32 treeDepth)

calcIntercept(const F32 vStart, const F32 invDeltaV, const F32 intercept)

Helper function to calculate intercepts.

castLeafRay(const Point2I pos, const Point3F & start, const Point3F & end, const F32 & startT, const F32 & endT, RayInfo * info)

And this does checks on leaf nodes.

getSquareMax(const U32 & level, const Point2I & pos)

getSquareMin(const U32 & level, const Point2I & pos)

Children better implement these! They return min/max height bounds of the specified square.

Public Static Functions

getNodeCount(const U32 depth)

Size of a quadtree of depth.

getNodeIndex(const U32 level, const Point2I pos)

Index of a node at given position in a quadtree.

Public Functions

castRay(const Point3F & start, const Point3F & end, RayInfo * info)

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.