#include <grid.h>
Public Member Functions | |
GridAccel (const vector< boost::shared_ptr< Primitive > > &p, bool forRefined, bool refineImmediately) | |
virtual BBox | WorldBound () const |
virtual bool | CanIntersect () const |
virtual | ~GridAccel () |
virtual bool | Intersect (const Ray &ray, Intersection *isect) const |
virtual bool | IntersectP (const Ray &ray) const |
virtual void | GetPrimitives (vector< boost::shared_ptr< Primitive > > &prims) |
Static Public Member Functions | |
static Aggregate * | CreateAccelerator (const vector< boost::shared_ptr< Primitive > > &prims, const ParamSet &ps) |
Private Member Functions | |
int | PosToVoxel (const Point &P, int axis) const |
float | VoxelToPos (int p, int axis) const |
Point | VoxelToPos (int x, int y, int z) const |
int | Offset (int x, int y, int z) const |
Private Attributes | |
bool | gridForRefined |
u_int | nMailboxes |
GMailboxPrim * | mailboxes |
int | NVoxels [3] |
BBox | bounds |
Vector | Width |
Vector | InvWidth |
Voxel ** | voxels |
boost::object_pool< Voxel > | voxelArena |
Static Private Attributes | |
static int | curMailboxId = 0 |
Definition at line 89 of file grid.h.
GridAccel::GridAccel | ( | const vector< boost::shared_ptr< Primitive > > & | p, | |
bool | forRefined, | |||
bool | refineImmediately | |||
) |
Definition at line 36 of file grid.cpp.
References StatsPercentage::Add(), StatsRatio::Add(), lux::Voxel::AddPrimitive(), bounds, CanIntersect(), Clamp(), InvWidth, mailboxes, StatsCounter::Max(), lux::BBox::MaximumExtent(), nMailboxes, lux::Voxel::nPrimitives, NVoxels, Offset(), p, lux::BBox::pMax, lux::BBox::pMin, PosToVoxel(), Round2Int(), lux::Union(), voxelArena, voxels, Width, and WorldBound().
Referenced by CreateAccelerator().
GridAccel::~GridAccel | ( | ) | [virtual] |
Definition at line 129 of file grid.cpp.
References lux::FreeAligned(), mailboxes, nMailboxes, NVoxels, voxels, and lux::Voxel::~Voxel().
virtual bool lux::GridAccel::CanIntersect | ( | ) | const [inline, virtual] |
Returns whether this primitive can be intersected.
Reimplemented from lux::Aggregate.
Definition at line 95 of file grid.h.
Referenced by GridAccel().
Aggregate * GridAccel::CreateAccelerator | ( | const vector< boost::shared_ptr< Primitive > > & | prims, | |
const ParamSet & | ps | |||
) | [static] |
Definition at line 357 of file grid.cpp.
References lux::ParamSet::FindOneBool(), and GridAccel().
void GridAccel::GetPrimitives | ( | vector< boost::shared_ptr< Primitive > > & | prims | ) | [virtual] |
Gives all primitives in this aggregate.
prims | The destination list for the primitives. |
Implements lux::Aggregate.
Definition at line 351 of file grid.cpp.
References mailboxes, and nMailboxes.
bool GridAccel::Intersect | ( | const Ray & | r, | |
Intersection * | in | |||
) | const [virtual] |
Intersects this primitive with the given ray. If an intersection is found, the ray will (i.e. r.tmax) and all fields in the intersection info will be updated.
r | The ray to intersect with this primitive. | |
in | The destination of the intersection information. |
Reimplemented from lux::Primitive.
Definition at line 139 of file grid.cpp.
References bounds, curMailboxId, lux::Ray::d, gridForRefined, if(), lux::BBox::Inside(), lux::Voxel::Intersect(), lux::BBox::IntersectP(), lux::Ray::maxt, lux::Ray::mint, NVoxels, Offset(), PosToVoxel(), voxels, VoxelToPos(), and Width.
bool GridAccel::IntersectP | ( | const Ray & | r | ) | const [virtual] |
Tests for intersection of this primitive with the given ray.
r | The ray to intersect with this primitive. |
Reimplemented from lux::Primitive.
Definition at line 249 of file grid.cpp.
References bounds, curMailboxId, lux::Ray::d, if(), lux::BBox::Inside(), lux::Voxel::IntersectP(), lux::BBox::IntersectP(), lux::Ray::maxt, lux::Ray::mint, NVoxels, Offset(), PosToVoxel(), voxels, VoxelToPos(), and Width.
Definition at line 117 of file grid.h.
References NVoxels.
Referenced by GridAccel(), Intersect(), and IntersectP().
Definition at line 105 of file grid.h.
References bounds, Clamp(), Float2Int(), InvWidth, NVoxels, and lux::BBox::pMin.
Referenced by GridAccel(), Intersect(), and IntersectP().
Definition at line 113 of file grid.h.
References bounds, lux::BBox::pMin, and Width.
Definition at line 110 of file grid.h.
References bounds, lux::BBox::pMin, and Width.
Referenced by Intersect(), and IntersectP().
BBox GridAccel::WorldBound | ( | ) | const [virtual] |
Returns the world bounds of this primitive.
Implements lux::Primitive.
Definition at line 126 of file grid.cpp.
References bounds.
Referenced by GridAccel().
BBox lux::GridAccel::bounds [private] |
Definition at line 125 of file grid.h.
Referenced by GridAccel(), Intersect(), IntersectP(), PosToVoxel(), VoxelToPos(), and WorldBound().
int GridAccel::curMailboxId = 0 [static, private] |
Definition at line 131 of file grid.h.
Referenced by Intersect(), and IntersectP().
bool lux::GridAccel::gridForRefined [private] |
Definition at line 121 of file grid.h.
Referenced by Intersect().
Vector lux::GridAccel::InvWidth [private] |
Definition at line 126 of file grid.h.
Referenced by GridAccel(), and PosToVoxel().
GMailboxPrim* lux::GridAccel::mailboxes [private] |
Definition at line 123 of file grid.h.
Referenced by GetPrimitives(), GridAccel(), and ~GridAccel().
u_int lux::GridAccel::nMailboxes [private] |
Definition at line 122 of file grid.h.
Referenced by GetPrimitives(), GridAccel(), and ~GridAccel().
int lux::GridAccel::NVoxels[3] [private] |
Definition at line 124 of file grid.h.
Referenced by GridAccel(), Intersect(), IntersectP(), Offset(), PosToVoxel(), and ~GridAccel().
boost::object_pool<Voxel> lux::GridAccel::voxelArena [private] |
Definition at line 130 of file grid.h.
Referenced by GridAccel().
Voxel** lux::GridAccel::voxels [private] |
Definition at line 127 of file grid.h.
Referenced by GridAccel(), Intersect(), IntersectP(), and ~GridAccel().
Vector lux::GridAccel::Width [private] |
Definition at line 126 of file grid.h.
Referenced by GridAccel(), Intersect(), IntersectP(), and VoxelToPos().