Adaptive voxel subdivision. More...
#include <voxel.h>
Inherited by rtl_lclvoxel.
This class implements a world space subdivision scheme for accelerating ray tracing of complex scenes. If you have a non-complex scene then you should set SubN to 0 and MaxDepth to 0. This causes one large voxel encompassing the entire scene and forces naive ray tracing. Naive ray tracing is on by default (by setting the two afore mentioned statics to 0).
The algorithm is as described in "Adaptive Voxel Subdivision for rtl_ray Tracing" the MSc thesis by David Jevans. This implementation uses lazy subdivision. Voxels are subdivided according to the heuristic determined in Cleary and Wyvill.
Constructs a new voxel as a leaf with no children.
Trace a ray through this voxel. This function either performs a modified DDA across the subvoxels or intersects with each of the children if it is a leaf voxel. The float parameter is used for specifying how far along the ray we have traced.
Returns true if this voxel is a leaf which contains no objects.
Returns the bounding box that encloses the volume of this voxel.
[static]Returns true if the system is set up for naive ray tracing.
[protected]
[protected]Performs a naive trace on the rtl_object's contained in this voxel. This function will assume that this voxel is a leaf, if in fact it is a subdivided voxel which doesn't contain objects, this function will cause execution to die producing a crimson stain on your console.
[protected]
[protected]
[protected]
[protected]Add an object to this voxel. This function should only be called by rtl_world::add(). The objects are continually appended on to the object member of data, if during a call to trace there are more than MaxObjects in this list, then it is subdivided.
[protected]
[static]Max number of objects before subdivision.
[static]Max subdivision depth.
[protected]
[protected]
[protected]
[protected]
[static, protected]On if the voxel is not a leaf and has been subdivided
[static, protected]On if the voxel is a leaf