#include <primitive.h>
Public Member Functions | |
AreaLightPrimitive (boost::shared_ptr< Primitive > prim, AreaLight *arealight) | |
virtual | ~AreaLightPrimitive () |
virtual BBox | WorldBound () const |
virtual void | Refine (vector< boost::shared_ptr< Primitive > > &refined, const PrimitiveRefinementHints &refineHints, boost::shared_ptr< Primitive > thisPtr) |
virtual bool | CanIntersect () const |
virtual bool | Intersect (const Ray &r, Intersection *in) const |
virtual bool | IntersectP (const Ray &r) const |
virtual void | GetShadingGeometry (const Transform &obj2world, const DifferentialGeometry &dg, DifferentialGeometry *dgShading) const |
virtual bool | CanSample () const |
virtual float | Area () const |
virtual void | Sample (float u1, float u2, float u3, DifferentialGeometry *dg) const |
virtual float | Pdf (const Point &p) const |
virtual void | Sample (const Point &P, float u1, float u2, float u3, DifferentialGeometry *dg) const |
virtual float | Pdf (const Point &p, const Vector &wi) const |
virtual float | Pdf (const Point &p, const Point &po) const |
Private Attributes | |
boost::shared_ptr< Primitive > | prim |
AreaLight * | areaLight |
A decorator for primitives that are light sources. This is achieved by setting the arealight field in the intersection info.
Definition at line 191 of file primitive.h.
AreaLightPrimitive::AreaLightPrimitive | ( | boost::shared_ptr< Primitive > | prim, | |
AreaLight * | arealight | |||
) |
Definition at line 111 of file primitive.cpp.
References areaLight, and prim.
Referenced by Refine().
virtual lux::AreaLightPrimitive::~AreaLightPrimitive | ( | ) | [inline, virtual] |
Definition at line 195 of file primitive.h.
virtual float lux::AreaLightPrimitive::Area | ( | ) | const [inline, virtual] |
Returns the area of this primitive.
Reimplemented from lux::Primitive.
Definition at line 212 of file primitive.h.
virtual bool lux::AreaLightPrimitive::CanIntersect | ( | ) | const [inline, virtual] |
Returns whether this primitive can be intersected.
Implements lux::Primitive.
Definition at line 202 of file primitive.h.
virtual bool lux::AreaLightPrimitive::CanSample | ( | ) | const [inline, virtual] |
Returns whether this primitive can be sampled.
Implements lux::Primitive.
Definition at line 211 of file primitive.h.
virtual void lux::AreaLightPrimitive::GetShadingGeometry | ( | const Transform & | obj2world, | |
const DifferentialGeometry & | dg, | |||
DifferentialGeometry * | dgShading | |||
) | const [inline, virtual] |
Calculates the shading geometry from the given intersection geometry.
obj2world | The object to world transformation to use. | |
dg | The intersection geometry. | |
dgShading | The destination for the shading geometry. |
Reimplemented from lux::Primitive.
Definition at line 206 of file primitive.h.
bool AreaLightPrimitive::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 130 of file primitive.cpp.
References areaLight, lux::Intersection::arealight, and prim.
virtual bool lux::AreaLightPrimitive::IntersectP | ( | const Ray & | r | ) | const [inline, 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 204 of file primitive.h.
virtual float lux::AreaLightPrimitive::Pdf | ( | const Point & | p, | |
const Point & | po | |||
) | const [inline, virtual] |
Returns the probability density for sampling the given point. (
p | The point that was to be tested for visibility with the result. | |
po | The point that was sampled. |
Reimplemented from lux::Primitive.
Definition at line 224 of file primitive.h.
virtual float lux::AreaLightPrimitive::Pdf | ( | const Point & | p, | |
const Vector & | wi | |||
) | const [inline, virtual] |
Returns the probability density for sampling the given point. (
p | The point that was to be tested for visibility with the result. | |
wi | The direction from the above point to the sampled point. |
Reimplemented from lux::Primitive.
Definition at line 221 of file primitive.h.
virtual float lux::AreaLightPrimitive::Pdf | ( | const Point & | p | ) | const [inline, virtual] |
Returns the probablity density for sampling the given point (
p | The point that was sampled. |
Reimplemented from lux::Primitive.
Definition at line 216 of file primitive.h.
void AreaLightPrimitive::Refine | ( | vector< boost::shared_ptr< Primitive > > & | refined, | |
const PrimitiveRefinementHints & | refineHints, | |||
boost::shared_ptr< Primitive > | thisPtr | |||
) | [virtual] |
Refines this primitive to a number of primitives that are intersectable and satisfy all the given hints if possible. If this primitive should not be deallocated after refinement, it must make sure that one of the refined primitives has a shared pointer to this primitive (i.e. a copy of thisPtr)
refined | The destenation list for the result. | |
refineHints | The hints for the refinement. | |
thisPtr | The shared pointer to this primitive. |
Reimplemented from lux::Primitive.
Definition at line 117 of file primitive.cpp.
References areaLight, AreaLightPrimitive(), and prim.
virtual void lux::AreaLightPrimitive::Sample | ( | const Point & | p, | |
float | u1, | |||
float | u2, | |||
float | u3, | |||
DifferentialGeometry * | dg | |||
) | const [inline, virtual] |
Samples a point on this primitive that will be tested for visibility from a given point. Only the p, nn, dpdu, dpdv, u and v need to be calculated.
p | The point that will be tested for visibility with the result. | |
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 217 of file primitive.h.
virtual void lux::AreaLightPrimitive::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 213 of file primitive.h.
virtual BBox lux::AreaLightPrimitive::WorldBound | ( | ) | const [inline, virtual] |
Returns the world bounds of this primitive.
Implements lux::Primitive.
Definition at line 197 of file primitive.h.
AreaLight* lux::AreaLightPrimitive::areaLight [private] |
Definition at line 230 of file primitive.h.
Referenced by AreaLightPrimitive(), Intersect(), and Refine().
boost::shared_ptr<Primitive> lux::AreaLightPrimitive::prim [private] |
Definition at line 229 of file primitive.h.
Referenced by AreaLightPrimitive(), Intersect(), and Refine().