#include <primitive.h>
Public Member Functions | |
MotionPrimitive (boost::shared_ptr< Primitive > i, const Transform &i2ws, const Transform &i2we, float s, float e) | |
virtual | ~MotionPrimitive () |
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 |
MotionSystem * | motionSystem |
A decorator for instances of primitives with interpolated matrices for motion blur. This is achieved by changing the Object-to-World transformation in the result and other transforming all intersection info that was calculated, by interpolating between 2 matrices using the ray time.
Definition at line 326 of file primitive.h.
lux::MotionPrimitive::MotionPrimitive | ( | boost::shared_ptr< Primitive > | i, | |
const Transform & | i2ws, | |||
const Transform & | i2we, | |||
float | s, | |||
float | e | |||
) | [inline] |
Creates a new instance from the given primitive.
i | The primitive to instance. | |
i2ws | The instance to world transformation at start time. | |
i2we | The instance to world transformation at end time. | |
s | The time at start. | |
e | The time at end. |
Definition at line 338 of file primitive.h.
References instance, and motionSystem.
virtual lux::MotionPrimitive::~MotionPrimitive | ( | ) | [inline, virtual] |
Definition at line 346 of file primitive.h.
References motionSystem.
virtual float lux::MotionPrimitive::Area | ( | ) | const [inline, virtual] |
Returns the area of this primitive.
Reimplemented from lux::Primitive.
Definition at line 357 of file primitive.h.
References instance.
virtual bool lux::MotionPrimitive::CanIntersect | ( | ) | const [inline, virtual] |
Returns whether this primitive can be intersected.
Implements lux::Primitive.
Definition at line 350 of file primitive.h.
References instance.
virtual bool lux::MotionPrimitive::CanSample | ( | ) | const [inline, virtual] |
Returns whether this primitive can be sampled.
Implements lux::Primitive.
Definition at line 356 of file primitive.h.
References instance.
void MotionPrimitive::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 214 of file primitive.cpp.
References lux::DifferentialGeometry::dndu, lux::DifferentialGeometry::dndv, lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, lux::DifferentialGeometry::dpdx, lux::DifferentialGeometry::dpdy, lux::Transform::GetInverse(), lux::DifferentialGeometry::handle, memcpy(), motionSystem, lux::DifferentialGeometry::nn, lux::Normalize(), lux::DifferentialGeometry::p, lux::MotionSystem::Sample(), lux::DifferentialGeometry::time, lux::DifferentialGeometry::triangleBaryCoords, lux::DifferentialGeometry::u, and lux::DifferentialGeometry::v.
bool MotionPrimitive::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 184 of file primitive.cpp.
References lux::Intersection::dg, lux::DifferentialGeometry::dndu, lux::DifferentialGeometry::dndv, lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, lux::Transform::GetInverse(), lux::DifferentialGeometry::handle, instance, lux::Ray::maxt, motionSystem, lux::DifferentialGeometry::nn, lux::Normalize(), lux::DifferentialGeometry::p, lux::Intersection::primitive, lux::MotionSystem::Sample(), lux::DifferentialGeometry::time, lux::Ray::time, and lux::Intersection::WorldToObject.
bool MotionPrimitive::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 208 of file primitive.cpp.
References lux::Transform::GetInverse(), instance, motionSystem, lux::MotionSystem::Sample(), and lux::Ray::time.
virtual float lux::MotionPrimitive::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 382 of file primitive.h.
References instance.
virtual float lux::MotionPrimitive::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 379 of file primitive.h.
References instance.
virtual float lux::MotionPrimitive::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 368 of file primitive.h.
References instance.
virtual void lux::MotionPrimitive::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 369 of file primitive.h.
References lux::DifferentialGeometry::dndu, lux::DifferentialGeometry::dndv, lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, lux::Transform::GetInverse(), instance, motionSystem, lux::DifferentialGeometry::nn, lux::Normalize(), lux::DifferentialGeometry::p, lux::MotionSystem::Sample(), and lux::DifferentialGeometry::time.
virtual void lux::MotionPrimitive::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 358 of file primitive.h.
References lux::DifferentialGeometry::dndu, lux::DifferentialGeometry::dndv, lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, instance, motionSystem, lux::DifferentialGeometry::nn, lux::Normalize(), lux::DifferentialGeometry::p, lux::MotionSystem::Sample(), and lux::DifferentialGeometry::time.
BBox MotionPrimitive::WorldBound | ( | ) | const [virtual] |
Returns the world bounds of this primitive.
Implements lux::Primitive.
Definition at line 238 of file primitive.cpp.
References lux::MotionSystem::Bound(), instance, and motionSystem.
boost::shared_ptr<Primitive> lux::MotionPrimitive::instance [private] |
Definition at line 387 of file primitive.h.
Referenced by Area(), CanIntersect(), CanSample(), Intersect(), IntersectP(), MotionPrimitive(), Pdf(), Sample(), and WorldBound().
MotionSystem* lux::MotionPrimitive::motionSystem [private] |
Definition at line 388 of file primitive.h.
Referenced by GetShadingGeometry(), Intersect(), IntersectP(), MotionPrimitive(), Sample(), WorldBound(), and ~MotionPrimitive().