librtl

rtl_voxel Class Reference

Adaptive voxel subdivision. More...

#include <voxel.h>

Inherited by rtl_lclvoxel.

List of all members.

Public Members

Static Public Members

Protected Members

Static Protected Members


Detailed Description

Adaptive voxel subdivision.

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.


Member Function Documentation

rtl_voxel::rtl_voxel()

Constructs a new voxel as a leaf with no children.

rtl_voxel::~rtl_voxel()

jFlt rtl_voxel::trace( rtl_ray& ray )

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.

bool rtl_voxel::empty() const

Returns true if this voxel is a leaf which contains no objects.

const jBBox& rtl_voxel::volume() const

Returns the bounding box that encloses the volume of this voxel.

bool rtl_voxel::naive() [static]

Returns true if the system is set up for naive ray tracing.

jFlt rtl_voxel::trace( rtl_ray&, const jVec3& ) [protected]

jFlt rtl_voxel::naiveTrace( rtl_ray& ray ) [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.

void rtl_voxel::subdivide() [protected]

jFlt rtl_voxel::traverse( rtl_ray&, const jVec3& ) [protected]

bool rtl_voxel::intersection( rtl_ray&, rtl_voxel&, jFlt&, const jVec3& ) [protected]

void rtl_voxel::add( rtl_object* ) [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.

void rtl_voxel::add( rtl_subobject*, bool ) [protected]


Member Data Documentation

jUInt rtl_voxel::MaxObjects [static]

Max number of objects before subdivision.

jUInt rtl_voxel::MaxDepth [static]

Max subdivision depth.

union { ... } rtl_voxel::data [protected]

jUInt rtl_voxel::dep [protected]

jBBox rtl_voxel::box [protected]

rtl_flags rtl_voxel::flags [protected]

const jULng rtl_voxel::Subdivided [static, protected]

On if the voxel is not a leaf and has been subdivided

const jULng rtl_voxel::Leaf [static, protected]

On if the voxel is a leaf


The documentation for this class was generated from the following file:
JSP / librtl v0.2 mtigges@cpsc.ucalgary.ca