#include <shape.h>
Public Member Functions | |
PrimitiveSet (boost::shared_ptr< Aggregate > a) | |
PrimitiveSet (const vector< boost::shared_ptr< Primitive > > &p) | |
virtual | ~PrimitiveSet () |
virtual BBox | WorldBound () const |
virtual bool | CanIntersect () const |
virtual bool | Intersect (const Ray &r, Intersection *in) const |
virtual bool | IntersectP (const Ray &r) const |
virtual bool | CanSample () const |
virtual void | Sample (float u1, float u2, float u3, DifferentialGeometry *dg) const |
virtual float | Area () const |
Private Member Functions | |
void | initAreas () |
Private Attributes | |
float | area |
vector< float > | areaCDF |
vector< boost::shared_ptr < Primitive > > | primitives |
BBox | worldbound |
boost::shared_ptr< Primitive > | accelerator |
Definition at line 125 of file shape.h.
PrimitiveSet::PrimitiveSet | ( | boost::shared_ptr< Aggregate > | a | ) |
Definition at line 49 of file shape.cpp.
References accelerator, initAreas(), and primitives.
PrimitiveSet::PrimitiveSet | ( | const vector< boost::shared_ptr< Primitive > > & | p | ) |
Definition at line 56 of file shape.cpp.
References accelerator, initAreas(), LUX_BUG, LUX_SEVERE, luxError, lux::MakeAccelerator(), p, lux::BBox::pMax, lux::BBox::pMin, primitives, lux::Union(), WorldBound(), and worldbound.
virtual lux::PrimitiveSet::~PrimitiveSet | ( | ) | [inline, virtual] |
virtual float lux::PrimitiveSet::Area | ( | ) | const [inline, virtual] |
Returns the area of this primitive.
Reimplemented from lux::Primitive.
Definition at line 159 of file shape.h.
References area.
virtual bool lux::PrimitiveSet::CanIntersect | ( | ) | const [inline, virtual] |
Returns whether this primitive can be intersected.
Implements lux::Primitive.
Definition at line 133 of file shape.h.
References primitives.
virtual bool lux::PrimitiveSet::CanSample | ( | ) | const [inline, virtual] |
Returns whether this primitive can be sampled.
Implements lux::Primitive.
Definition at line 141 of file shape.h.
References primitives.
void PrimitiveSet::initAreas | ( | ) | [private] |
Definition at line 106 of file shape.cpp.
References area, areaCDF, and primitives.
Referenced by PrimitiveSet().
bool PrimitiveSet::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 77 of file shape.cpp.
References accelerator, lux::BBox::IntersectP(), primitives, and worldbound.
bool PrimitiveSet::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 93 of file shape.cpp.
References accelerator, lux::BBox::IntersectP(), primitives, and worldbound.
virtual void lux::PrimitiveSet::Sample | ( | float | u1, | |
float | u2, | |||
float | u3, | |||
DifferentialGeometry * | dg | |||
) | const [inline, virtual] |
Samples a point on this primitive. Only the p, nn, dpdu, dpdv, u and v need to be calculated.
u1 | The point coordinate in the first dimension. | |
u2 | The point coordinate in the second dimension. | |
u3 | The subprimitive to sample. | |
dg | The destination to store the sampled point in. |
Reimplemented from lux::Primitive.
Definition at line 146 of file shape.h.
References areaCDF, Clamp(), and primitives.
virtual BBox lux::PrimitiveSet::WorldBound | ( | ) | const [inline, virtual] |
Returns the world bounds of this primitive.
Implements lux::Primitive.
Definition at line 132 of file shape.h.
References worldbound.
Referenced by PrimitiveSet().
boost::shared_ptr<Primitive> lux::PrimitiveSet::accelerator [private] |
Definition at line 168 of file shape.h.
Referenced by Intersect(), IntersectP(), and PrimitiveSet().
float lux::PrimitiveSet::area [private] |
Definition at line 164 of file shape.h.
Referenced by Area(), and initAreas().
vector<float> lux::PrimitiveSet::areaCDF [private] |
Definition at line 165 of file shape.h.
Referenced by initAreas(), and Sample().
vector<boost::shared_ptr<Primitive> > lux::PrimitiveSet::primitives [private] |
Definition at line 166 of file shape.h.
Referenced by CanIntersect(), CanSample(), initAreas(), Intersect(), IntersectP(), PrimitiveSet(), and Sample().
BBox lux::PrimitiveSet::worldbound [private] |
Definition at line 167 of file shape.h.
Referenced by Intersect(), IntersectP(), PrimitiveSet(), and WorldBound().