Main Page Class Hierarchy Compound List File List Compound Members File Members
RT_Grid Class Reference
#include <RT_Grid.h>
Collaboration diagram for RT_Grid:
List of all members.
Public Members |
 |  | Void | MasterInit () |
 |  | Void | Init () |
 |  | Void | Free () |
 |  | Void | AddObject (RT_Object *object) |
 |  | Void | RemoveObject (RT_Object *object) |
 |  | Void | PrepareGrid () |
 |  | Bool | IntersectionExists ( const Point& start, const Point& end, RT_Prim* origPrim = 0, RayStats* stats = 0 ) |
 |  | RT_Prim* | ClosestIntersection ( const Point& start, const Vector& direction, RT_Prim* origPrim = 0, RayStats* stats = 0 ) |
 |  | Void | HierPrint (ostream& s, Int index) |
 |  | Void | Draw (Renderer &r, Int level) |
 |  | Void | DumpMemoryUsage () |
 |  | GCLReal | GridMemoryUsage () |
 |  | GCLReal | MemoryUsage () |
 |  | Void | SetBounds (Point &bmin, Point &bmax) |
 |  | Void | SetupGrid () |
 |  | Void | AddTriangle (RT_Tri *tri) |
 |  | Void | AddGeneric (RT_Gen *gen) |
 |  | GCLReal | GetScale () |
 |  | RT_Prim* | hitPrim |
 |  | | Last primitive hit in this grid.
|
 |  | GCLReal | hitT |
 |  | | t param of hit.
|
 |  | Point | min |
 |  | Point | max |
 |  | | axis-aligned bounding box of grid.
|
Static Public Members |
 |  | Void | SetTag (Int tag) |
 |  | Void | SetMemLimit (Int maxKbs) |
 |  | GCLReal | sEpsilon = 1e-15 |
 |  | | for self-intersection tests.
|
 |  | Int | sMem = 0 |
 |  | | memory being used by grids.
|
 |  | Int | sMemLimit = 0 |
 |  | | memory limit.
|
 |  | Int | sTriMem = 0 |
 |  | | tri memory.
|
 |  | Int | sGenMem = 0 |
 |  | | gen memory.
|
 |  | Int | sPointMem = 0 |
 |  | | points memory.
|
 |  | Int | sMaxCells = 40 |
 |  | | See source.
|
 |  | Int | sMaxCellPrims = RT_Grid::sMaxCells |
 |  | GCLReal | sPushSizeLimit = 0.05 |
 |  | GCLReal | sMaxCellRatio = 0.20 |
 |  | GCLReal | sMinDensity = 0.05 |
 |  | GCLReal | sMaxExpand = 3.00 |
Protected Members |
 |  | Void | Stamp () |
 |  | Bool | IsStamped () |
 |  | Void | UpdateBounds (Point& cellMin, Point& cellMax) |
 |  | Void | UpdateBounds (RT_Object *object) |
 |  | Void | CreateNestedGrids () |
 |  | Void | CullSubGrids () |
 |  | Void | PushPrimitives () |
 |  | Int | CountPolys (PrimEntry *entry) |
 |  | Bool | FindGridStart ( const Point& start, const Vector& direction, Int cell[3], Int increment[3], Int limit[3], GCLReal& tRay, Vector& tDelta, Vector& tMax ) |
 |  | Void | RayClampEntryPoint (Int index, Bool backEntry[3], Vector& fujiPoint, Int cell[3]) |
 |  | ObjEntry* | addedObjs |
 |  | | list of objects currently in grid.
|
 |  | ObjEntry* | addObjs |
 |  | | list of objects to add to the grid.
|
 |  | GridStore | grid |
 |  | | the grid itself.
|
 |  | PrimListEntry* | addPrims |
 |  | | list of tri lists to add to a subgrid.
|
 |  | RT_Grid* | subGrids |
 |  | | subgrids.
|
 |  | RT_Grid* | next |
 |  | | next subgrid.
|
 |  | GCLReal | cellSize |
 |  | GCLReal | areaLimit |
 |  | Int | numCells [3] |
 |  | Int | xSpan |
 |  | Int | ySpan |
 |  | | byte-spans for grid array.
|
 |  | Int | totalCells |
 |  | Int | totalPrims |
 |  | Int | dirty |
 |  | | do we need to re-grid?
|
 |  | Int | level |
 |  | | level of the grid.
|
 |  | RT_Grid* | parent |
 |  | | parent grid.
|
 |  | Int | stamp |
 |  | | local time-stamp.
|
Static Protected Members |
 |  | Void | IncTime () |
 |  | Int | sStamp = 1 |
 |  | | global time-stamp.
|
 |  | Int | sTag = 0x00000001 |
 |  | | object groups enabled mask.
|
Detailed Description
A class that implements grid-traversal ray-tracing.
Usage: Call MasterInit(), AddObject() for each object,
PrepareGrid(), and then IntersectionExists()/ClosestIntersection()
as needed. Call Free() when no longer needed.
Notes:
Traditionally, of the ray-tracing optimising schemes,
grid-traversal (sometimes referred to as SEADS -- spatially
enumerated abstract data structures) is amongst the fastest, if
not the fastest. See for example the results from Haines' NFF
testbed, widely available on the web. This scheme was used in
R&H's first ray tracer. It works especially well when the
objects in the grid are reasonably homogeneous.
However, the grid scheme suffers from the teapot-in-a-stadium
problem, as described in ray-tracing news 8. Octrees suffer
somewhat less from this, especially if the appropriate
optimisations are made.
The drawback of Arvo's scheme is that it requires the
modeller/animator to place the grids by hand, which we'd
obviously like to avoid. I've had some ideas for automatic
placement of these grids floating around for a while, and this
code gave me a chance to play with them until they evolved
into something that did a reasonable job of engridding an
entire scene.
The major drawback of the HG scheme is that it uses more memory
than the previous single grid scheme. The memory is on the
order of the memory taken to store the object itself. The
memory overhead can be reduced by tweaking the constants to
reduce the number of extra grids created, and I've also left in
hooks so the total memory used can be limited to a specified
amount.
Many other, more standard optimisations were made, including
- triangle lists sorted by size
- triangle and grid hits are cached
- separate methods for finding closest intersection along a ray,
and testing for any intersection between two points.
...
Definition at line 69 of file RT_Grid.h.
Member Function Documentation
Void RT_Grid::AddGeneric (RT_Gen * gen)
|
Void RT_Grid::AddTriangle (RT_Tri * tri)
|
RT_Prim * RT_Grid::ClosestIntersection (const Point & start, const Vector & direction, RT_Prim * origPrim = 0, RayStats * stats = 0)
|
Int RT_Grid::CountPolys (PrimEntry * entry) [protected]
|
Void RT_Grid::CreateNestedGrids () [protected]
|
Void RT_Grid::CullSubGrids () [protected]
|
Void RT_Grid::Draw (Renderer & r, Int level)
|
Void RT_Grid::DumpMemoryUsage ()
|
Bool RT_Grid::FindGridStart (const Point & start, const Vector & direction, Int cell[3], Int increment[3], Int limit[3], GCLReal & tRay, Vector & tDelta, Vector & tMax) [protected]
|
GCLReal RT_Grid::GetScale () [inline]
|
GCLReal RT_Grid::GridMemoryUsage ()
|
Void RT_Grid::HierPrint (ostream & s, Int indent)
|
Void RT_Grid::IncTime () [inline, static, protected]
|
Bool RT_Grid::IntersectionExists (const Point & start, const Point & end, RT_Prim * origPrim = 0, RayStats * stats = 0)
|
Bool RT_Grid::IsStamped () [inline, protected]
|
Void RT_Grid::MasterInit ()
|
GCLReal RT_Grid::MemoryUsage ()
|
Void RT_Grid::PrepareGrid ()
|
Void RT_Grid::PushPrimitives () [protected]
|
Void RT_Grid::RayClampEntryPoint (Int index, Bool backEntry[3], Vector & gridPoint, Int cell[3]) [protected]
|
Void RT_Grid::RemoveObject (RT_Object * object)
|
Void RT_Grid::SetBounds (Point & bmin, Point & bmax) [inline]
|
Void RT_Grid::SetMemLimit (Int maxKbs) [static]
|
Void RT_Grid::SetTag (Int tag) [inline, static]
|
Void RT_Grid::SetupGrid ()
|
Void RT_Grid::Stamp () [inline, protected]
|
Void RT_Grid::UpdateBounds (RT_Object * object) [protected]
|
Void RT_Grid::UpdateBounds (Point & cellMin, Point & cellMax) [protected]
|
Member Data Documentation
list of objects to add to the grid.
Definition at line 126 of file RT_Grid.h.
list of tri lists to add to a subgrid.
Definition at line 129 of file RT_Grid.h.
ObjEntry * RT_Grid::addedObjs [protected]
|
list of objects currently in grid.
Definition at line 125 of file RT_Grid.h.
GCLReal RT_Grid::areaLimit [protected]
|
GCLReal RT_Grid::cellSize [protected]
|
Int RT_Grid::dirty [protected]
|
do we need to re-grid?
Definition at line 159 of file RT_Grid.h.
Last primitive hit in this grid.
Definition at line 118 of file RT_Grid.h.
Int RT_Grid::level [protected]
|
level of the grid.
Definition at line 160 of file RT_Grid.h.
axis-aligned bounding box of grid.
Definition at line 121 of file RT_Grid.h.
RT_Grid * RT_Grid::next [protected]
|
Int RT_Grid::numCells[3] [protected]
|
RT_Grid * RT_Grid::parent [protected]
|
GCLReal RT_Grid::sEpsilon = 1e-15 [static]
|
for self-intersection tests.
Definition at line 142 of file RT_Grid.h.
Int RT_Grid::sGenMem = 0 [static]
|
Int RT_Grid::sMaxCellPrims = RT_Grid::sMaxCells [static]
|
GCLReal RT_Grid::sMaxCellRatio = 0.20 [static]
|
Int RT_Grid::sMaxCells = 40 [static]
|
GCLReal RT_Grid::sMaxExpand = 3.00 [static]
|
Int RT_Grid::sMem = 0 [static]
|
memory being used by grids.
Definition at line 143 of file RT_Grid.h.
Int RT_Grid::sMemLimit = 0 [static]
|
GCLReal RT_Grid::sMinDensity = 0.05 [static]
|
Int RT_Grid::sPointMem = 0 [static]
|
GCLReal RT_Grid::sPushSizeLimit = 0.05 [static]
|
Int RT_Grid::sStamp = 1 [static, protected]
|
global time-stamp.
Definition at line 164 of file RT_Grid.h.
Int RT_Grid::sTag = 0x00000001 [static, protected]
|
object groups enabled mask.
Definition at line 165 of file RT_Grid.h.
Int RT_Grid::sTriMem = 0 [static]
|
Int RT_Grid::stamp [protected]
|
RT_Grid * RT_Grid::subGrids [protected]
|
Int RT_Grid::totalCells [protected]
|
Int RT_Grid::totalPrims [protected]
|
Int RT_Grid::xSpan [protected]
|
Int RT_Grid::ySpan [protected]
|
byte-spans for grid array.
Definition at line 136 of file RT_Grid.h.
The documentation for this class was generated from the following files:
Generated at Sat Aug 5 00:26:58 2000 for Radiator by
1.1.0 written by Dimitri van Heesch,
© 1997-2000