#include <primitive.h>
Public Member Functions | |
InstancePrimitive (boost::shared_ptr< Primitive > i, const Transform &i2w, boost::shared_ptr< Material > mat) | |
virtual | ~InstancePrimitive () |
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 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 > | instance |
Transform | InstanceToWorld |
Transform | WorldToInstance |
boost::shared_ptr< Material > | material |
A decorator for instances of primitives. This is achieved by changing the Object-to-World transformation in the result and other transforming all intersection info that was calculated. Optionally the material can be changed too.
Definition at line 239 of file primitive.h.
lux::InstancePrimitive::InstancePrimitive | ( | boost::shared_ptr< Primitive > | i, | |
const Transform & | i2w, | |||
boost::shared_ptr< Material > | mat | |||
) | [inline] |
Creates a new instance from the given primitive.
i | The primitive to instance. | |
i2w | The instance to world transformation. | |
mat | The material this instance or NULL to use the instanced primitive's material. |
Definition at line 250 of file primitive.h.
References lux::Transform::GetInverse(), instance, InstanceToWorld, material, and WorldToInstance.
virtual lux::InstancePrimitive::~InstancePrimitive | ( | ) | [inline, virtual] |
Definition at line 258 of file primitive.h.
virtual float lux::InstancePrimitive::Area | ( | ) | const [inline, virtual] |
Returns the area of this primitive.
Reimplemented from lux::Primitive.
Definition at line 271 of file primitive.h.
References instance.
virtual bool lux::InstancePrimitive::CanIntersect | ( | ) | const [inline, virtual] |
Returns whether this primitive can be intersected.
Implements lux::Primitive.
Definition at line 264 of file primitive.h.
References instance.
virtual bool lux::InstancePrimitive::CanSample | ( | ) | const [inline, virtual] |
Returns whether this primitive can be sampled.
Implements lux::Primitive.
Definition at line 270 of file primitive.h.
References instance.
void InstancePrimitive::GetShadingGeometry | ( | const Transform & | obj2world, | |
const DifferentialGeometry & | dg, | |||
DifferentialGeometry * | dgShading | |||
) | const [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 161 of file primitive.cpp.
References lux::DifferentialGeometry::dndu, lux::DifferentialGeometry::dndv, lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, lux::DifferentialGeometry::dpdx, lux::DifferentialGeometry::dpdy, lux::DifferentialGeometry::handle, InstanceToWorld, memcpy(), lux::DifferentialGeometry::nn, lux::Normalize(), lux::DifferentialGeometry::p, lux::DifferentialGeometry::triangleBaryCoords, lux::DifferentialGeometry::u, lux::DifferentialGeometry::v, and WorldToInstance.
bool InstancePrimitive::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 138 of file primitive.cpp.
References lux::Intersection::dg, lux::DifferentialGeometry::dndu, lux::DifferentialGeometry::dndv, lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, lux::DifferentialGeometry::handle, instance, InstanceToWorld, lux::Intersection::material, material, lux::Ray::maxt, lux::DifferentialGeometry::nn, lux::Normalize(), lux::DifferentialGeometry::p, lux::Intersection::primitive, WorldToInstance, and lux::Intersection::WorldToObject.
bool InstancePrimitive::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 158 of file primitive.cpp.
References instance, and WorldToInstance.
virtual float lux::InstancePrimitive::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 295 of file primitive.h.
References instance.
virtual float lux::InstancePrimitive::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 292 of file primitive.h.
References instance.
virtual float lux::InstancePrimitive::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 281 of file primitive.h.
References instance.
virtual void lux::InstancePrimitive::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 282 of file primitive.h.
References lux::DifferentialGeometry::dndu, lux::DifferentialGeometry::dndv, lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, instance, InstanceToWorld, lux::DifferentialGeometry::nn, lux::Normalize(), lux::DifferentialGeometry::p, and WorldToInstance.
virtual void lux::InstancePrimitive::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 272 of file primitive.h.
References lux::DifferentialGeometry::dndu, lux::DifferentialGeometry::dndv, lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, instance, InstanceToWorld, lux::DifferentialGeometry::nn, lux::Normalize(), and lux::DifferentialGeometry::p.
virtual BBox lux::InstancePrimitive::WorldBound | ( | ) | const [inline, virtual] |
Returns the world bounds of this primitive.
Implements lux::Primitive.
Definition at line 260 of file primitive.h.
References instance, and InstanceToWorld.
boost::shared_ptr<Primitive> lux::InstancePrimitive::instance [private] |
Definition at line 300 of file primitive.h.
Referenced by Area(), CanIntersect(), CanSample(), InstancePrimitive(), Intersect(), IntersectP(), Pdf(), Sample(), and WorldBound().
Definition at line 301 of file primitive.h.
Referenced by GetShadingGeometry(), InstancePrimitive(), Intersect(), Sample(), and WorldBound().
boost::shared_ptr<Material> lux::InstancePrimitive::material [private] |
Definition at line 302 of file primitive.h.
Referenced by InstancePrimitive(), and Intersect().
Definition at line 301 of file primitive.h.
Referenced by GetShadingGeometry(), InstancePrimitive(), Intersect(), IntersectP(), and Sample().