#include <grid.h>
Public Member Functions | |
GridAccel (const vector< Reference< Primitive > > &p, bool refineImmediately) | |
BBox | WorldBound () const |
bool | CanIntersect () const |
~GridAccel () | |
bool | Intersect (const Ray &ray, Intersection *isect) const |
bool | IntersectP (const Ray &ray) const |
Private Member Functions | |
int | posToVoxel (const Point &P, int axis) const |
float | voxelToPos (int p, int axis) const |
int | offset (int x, int y, int z) const |
Private Attributes | |
vector< Reference< Primitive > > | primitives |
int | nVoxels [3] |
BBox | bounds |
Vector | width |
Vector | invWidth |
Voxel ** | voxels |
MemoryArena | voxelArena |
RWMutex * | rwMutex |
Definition at line 60 of file grid.h.
Definition at line 32 of file grid.cpp.
References Voxel::AddPrimitive(), MemoryArena::Alloc(), Assert, bounds, Clamp(), RWMutex::Create(), Primitive::FullyRefine(), invWidth, BBox::MaximumExtent(), nVoxels, offset(), BBox::pMax, BBox::pMin, posToVoxel(), primitives, Round2Int(), rwMutex, Union(), voxelArena, voxels, width, and WorldBound().
GridAccel::~GridAccel | ( | ) |
Definition at line 107 of file grid.cpp.
References RWMutex::Destroy(), FreeAligned(), nVoxels, rwMutex, and voxels.
bool GridAccel::CanIntersect | ( | ) | const [inline, virtual] |
bool GridAccel::Intersect | ( | const Ray & | ray, | |
Intersection * | isect | |||
) | const [virtual] |
Implements Primitive.
Definition at line 115 of file grid.cpp.
References bounds, Ray::d, BBox::Inside(), Voxel::Intersect(), BBox::IntersectP(), Ray::maxt, Ray::mint, nVoxels, offset(), posToVoxel(), READ, rwMutex, Voxel::size(), voxels, voxelToPos(), and width.
bool GridAccel::IntersectP | ( | const Ray & | ray | ) | const [virtual] |
Implements Primitive.
Definition at line 218 of file grid.cpp.
References bounds, Ray::d, BBox::Inside(), Voxel::IntersectP(), BBox::IntersectP(), Ray::maxt, Ray::mint, nVoxels, offset(), posToVoxel(), READ, rwMutex, Voxel::size(), voxels, voxelToPos(), and width.
int GridAccel::offset | ( | int | x, | |
int | y, | |||
int | z | |||
) | const [inline, private] |
Definition at line 79 of file grid.h.
References nVoxels.
Referenced by GridAccel(), Intersect(), and IntersectP().
int GridAccel::posToVoxel | ( | const Point & | P, | |
int | axis | |||
) | const [inline, private] |
Definition at line 71 of file grid.h.
References bounds, Clamp(), Float2Int(), invWidth, nVoxels, and BBox::pMin.
Referenced by GridAccel(), Intersect(), and IntersectP().
float GridAccel::voxelToPos | ( | int | p, | |
int | axis | |||
) | const [inline, private] |
Definition at line 76 of file grid.h.
References bounds, BBox::pMin, and width.
Referenced by Intersect(), and IntersectP().
BBox GridAccel::WorldBound | ( | ) | const [virtual] |
Implements Primitive.
Definition at line 102 of file grid.cpp.
References bounds.
Referenced by GridAccel().
BBox GridAccel::bounds [private] |
Definition at line 86 of file grid.h.
Referenced by GridAccel(), Intersect(), IntersectP(), posToVoxel(), voxelToPos(), and WorldBound().
Vector GridAccel::invWidth [private] |
Definition at line 87 of file grid.h.
Referenced by GridAccel(), and posToVoxel().
int GridAccel::nVoxels[3] [private] |
Definition at line 85 of file grid.h.
Referenced by GridAccel(), Intersect(), IntersectP(), offset(), posToVoxel(), and ~GridAccel().
vector<Reference<Primitive> > GridAccel::primitives [private] |
Definition at line 84 of file grid.h.
Referenced by GridAccel().
RWMutex* GridAccel::rwMutex [mutable, private] |
Definition at line 90 of file grid.h.
Referenced by GridAccel(), Intersect(), IntersectP(), and ~GridAccel().
MemoryArena GridAccel::voxelArena [private] |
Definition at line 89 of file grid.h.
Referenced by GridAccel().
Voxel** GridAccel::voxels [private] |
Definition at line 88 of file grid.h.
Referenced by GridAccel(), Intersect(), IntersectP(), and ~GridAccel().
Vector GridAccel::width [private] |
Definition at line 87 of file grid.h.
Referenced by GridAccel(), Intersect(), IntersectP(), and voxelToPos().