#include <primitive.h>
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 |
Definition at line 37 of file primitive.h.
Primitive::~Primitive | ( | ) | [virtual] |
Definition at line 32 of file primitive.cpp.
float Primitive::Area | ( | ) | const [virtual] |
Returns the area of this primitive.
Reimplemented in lux::AreaLightPrimitive, lux::InstancePrimitive, lux::MotionPrimitive, lux::PrimitiveSet, lux::Cone, lux::Cylinder, lux::Disk, lux::Hyperboloid, lux::LensComponent, lux::MeshBaryTriangle, lux::MeshQuadrilateral, lux::Paraboloid, lux::Quad, lux::Quadrilateral, lux::Sphere, and lux::Torus.
Definition at line 58 of file primitive.cpp.
References LUX_BUG, LUX_SEVERE, and luxError.
Referenced by Pdf().
virtual bool lux::Primitive::CanIntersect | ( | ) | const [pure virtual] |
Returns whether this primitive can be intersected.
Implemented in lux::BruteForceAccel, lux::BVHAccel, lux::GridAccel, lux::TaBRecKdTreeAccel, lux::UnsafeKdTreeAccel, lux::AreaLightPrimitive, lux::InstancePrimitive, lux::Aggregate, lux::MotionPrimitive, lux::Shape, lux::PrimitiveSet, lux::Heightfield, lux::LoopSubdiv, lux::Mesh, lux::MeshBaryTriangle, lux::MeshQuadrilateral, and lux::NURBS.
virtual bool lux::Primitive::CanSample | ( | ) | const [pure virtual] |
Returns whether this primitive can be sampled.
Implemented in lux::AreaLightPrimitive, lux::InstancePrimitive, lux::Aggregate, lux::MotionPrimitive, lux::Shape, lux::PrimitiveSet, lux::Mesh, lux::MeshBaryTriangle, and lux::MeshQuadrilateral.
void Primitive::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 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.
r | The ray to intersect with this primitive. | |
in | The destination of the intersection information. |
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] |
Tests for intersection of this primitive with the given ray.
r | The ray to intersect with this primitive. |
Reimplemented in lux::BruteForceAccel, lux::BVHAccel, lux::GridAccel, lux::QBVHAccel, lux::TaBRecKdTreeAccel, lux::UnsafeKdTreeAccel, lux::AreaLightPrimitive, lux::InstancePrimitive, lux::MotionPrimitive, lux::PrimitiveSet, lux::Cone, lux::Cylinder, lux::Disk, lux::Hyperboloid, lux::LensComponent, lux::MeshBaryTriangle, lux::MeshWaldTriangle, lux::MeshQuadrilateral, lux::Paraboloid, lux::Quad, lux::Quadrilateral, lux::Sphere, and lux::Torus.
Definition at line 45 of file primitive.cpp.
References LUX_BUG, LUX_SEVERE, and luxError.
Referenced by lux::TaBRecKdTreeAccel::IntersectP().
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 in lux::AreaLightPrimitive, lux::InstancePrimitive, lux::MotionPrimitive, and lux::Sphere.
Definition at line 84 of file primitive.cpp.
References Area().
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 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 (
p | The point that was sampled. |
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)
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.
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.
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] |
Returns the world bounds of this primitive.
Implemented in lux::BruteForceAccel, lux::BVHAccel, lux::GridAccel, lux::QBVHAccel, lux::TaBRecKdTreeAccel, lux::UnsafeKdTreeAccel, lux::AreaLightPrimitive, lux::InstancePrimitive, lux::MotionPrimitive, lux::Shape, lux::PrimitiveSet, lux::LoopSubdiv, lux::Mesh, lux::MeshBaryTriangle, lux::MeshQuadrilateral, lux::NURBS, lux::Quad, and lux::Quadrilateral.