lux::InstancePrimitive Class Reference

#include <primitive.h>

Inheritance diagram for lux::InstancePrimitive:
[legend]
Collaboration diagram for lux::InstancePrimitive:
[legend]

List of all members.

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< Primitiveinstance
Transform InstanceToWorld
Transform WorldToInstance
boost::shared_ptr< Materialmaterial

Detailed Description

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.


Constructor & Destructor Documentation

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.

Parameters:
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.


Member Function Documentation

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.

Parameters:
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.

Parameters:
r The ray to intersect with this primitive.
in The destination of the intersection information.
Returns:
Whether an intersection was found.

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.

Parameters:
r The ray to intersect with this primitive.
Returns:
Whether an intersection was found.

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. (

See also:
Primitive::Sample(Point&,float,float,float,Normal*) const). No visibility test is done here.
Parameters:
p The point that was to be tested for visibility with the result.
po The point that was sampled.
Returns:
The pdf value (w.r.t. surface area) for the given point.

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. (

See also:
Primitive::Sample(Point&,float,float,float,Normal*) const).
Parameters:
p The point that was to be tested for visibility with the result.
wi The direction from the above point to the sampled point.
Returns:
The pdf value (w.r.t. solid angle) for the given 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 (

See also:
Primitive::Sample(float,float,float,Normal*) const).
Parameters:
p The point that was sampled.
Returns:
The pdf value (w.r.t. surface area) for the given point.

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.

Parameters:
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.

Parameters:
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.


Member Data Documentation

boost::shared_ptr<Primitive> lux::InstancePrimitive::instance [private]

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().


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208