lux::Primitive Class Reference

#include <primitive.h>

Inheritance diagram for lux::Primitive:
[legend]

List of all members.

Public Member Functions

virtual ~Primitive ()
virtual BBox WorldBound () const =0
virtual void Refine (vector< boost::shared_ptr< Primitive > > &refined, const PrimitiveRefinementHints &refineHints, boost::shared_ptr< Primitive > thisPtr)
virtual bool CanIntersect () const =0
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 =0
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

Detailed Description

Definition at line 37 of file primitive.h.


Constructor & Destructor Documentation

Primitive::~Primitive (  )  [virtual]

Definition at line 32 of file primitive.cpp.


Member Function Documentation

float Primitive::Area (  )  const [virtual]
virtual bool lux::Primitive::CanIntersect (  )  const [pure virtual]
virtual bool lux::Primitive::CanSample (  )  const [pure virtual]
void Primitive::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 in lux::AreaLightPrimitive, lux::InstancePrimitive, lux::MotionPrimitive, lux::Shape, lux::MeshBaryTriangle, and lux::MeshQuadrilateral.

Definition at line 51 of file primitive.cpp.

References LUX_BUG, LUX_SEVERE, and luxError.

Referenced by lux::Intersection::GetBSDF().

bool Primitive::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 in lux::BruteForceAccel, lux::BVHAccel, lux::GridAccel, lux::QBVHAccel, lux::TaBRecKdTreeAccel, lux::UnsafeKdTreeAccel, lux::AreaLightPrimitive, lux::InstancePrimitive, lux::MotionPrimitive, lux::Shape, lux::PrimitiveSet, lux::MeshBaryTriangle, lux::MeshWaldTriangle, and lux::MeshQuadrilateral.

Definition at line 41 of file primitive.cpp.

References LUX_BUG, LUX_SEVERE, and luxError.

Referenced by lux::TaBRecKdTreeAccel::Intersect(), and Pdf().

bool Primitive::IntersectP ( const Ray r  )  const [virtual]
float Primitive::Pdf ( const Point p,
const Point po 
) const [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 in lux::AreaLightPrimitive, lux::InstancePrimitive, lux::MotionPrimitive, and lux::Sphere.

Definition at line 84 of file primitive.cpp.

References Area().

float Primitive::Pdf ( const Point p,
const Vector wi 
) const [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 in lux::AreaLightPrimitive, lux::InstancePrimitive, lux::MotionPrimitive, and lux::Sphere.

Definition at line 73 of file primitive.cpp.

References lux::AbsDot(), Area(), lux::Intersection::dg, lux::DistanceSquared(), Intersect(), lux::Ray::maxt, and lux::DifferentialGeometry::nn.

float Primitive::Pdf ( const Point p  )  const [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 in lux::AreaLightPrimitive, lux::InstancePrimitive, and lux::MotionPrimitive.

Definition at line 65 of file primitive.cpp.

References Area().

void Primitive::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)

Parameters:
refined The destenation list for the result.
refineHints The hints for the refinement.
thisPtr The shared pointer to this primitive.

Reimplemented in lux::AreaLightPrimitive, lux::Shape, and lux::Mesh.

Definition at line 34 of file primitive.cpp.

References LUX_BUG, LUX_SEVERE, and luxError.

void Primitive::Sample ( const Point p,
float  u1,
float  u2,
float  u3,
DifferentialGeometry dg 
) const [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 in lux::AreaLightPrimitive, lux::InstancePrimitive, lux::MotionPrimitive, and lux::Shape.

Definition at line 68 of file primitive.cpp.

References Sample().

void Primitive::Sample ( float  u1,
float  u2,
float  u3,
DifferentialGeometry dg 
) const [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 in lux::AreaLightPrimitive, lux::InstancePrimitive, lux::MotionPrimitive, lux::Shape, lux::PrimitiveSet, lux::MeshBaryTriangle, lux::MeshWaldTriangle, and lux::MeshQuadrilateral.

Definition at line 62 of file primitive.cpp.

References LUX_BUG, LUX_SEVERE, and luxError.

Referenced by Sample().

virtual BBox lux::Primitive::WorldBound (  )  const [pure virtual]

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