#include <shape.h>
Public Member Functions | |
Shape (const Transform &o2w, bool ro) | |
Shape (const Transform &o2w, bool ro, boost::shared_ptr< Material > material) | |
virtual | ~Shape () |
void | SetMaterial (boost::shared_ptr< Material > mat) |
boost::shared_ptr< Material > | GetMaterial () const |
virtual BBox | WorldBound () const |
virtual void | Refine (vector< boost::shared_ptr< Primitive > > &refined, const PrimitiveRefinementHints &refineHints, boost::shared_ptr< Primitive > thisPtr) |
virtual bool | CanIntersect () const |
virtual bool | Intersect (const Ray &r, Intersection *isect) const |
virtual void | GetShadingGeometry (const Transform &obj2world, const DifferentialGeometry &dg, DifferentialGeometry *dgShading) const |
virtual bool | CanSample () const |
virtual void | Sample (float u1, float u2, float u3, DifferentialGeometry *dg) const |
virtual void | Sample (const Point &p, float u1, float u2, float u3, DifferentialGeometry *dg) const |
virtual BBox | ObjectBound () const |
virtual void | Refine (vector< boost::shared_ptr< Shape > > &refined) const |
virtual bool | Intersect (const Ray &ray, float *t_hitp, DifferentialGeometry *dg) const |
virtual Point | Sample (float u1, float u2, float u3, Normal *Ns) const |
virtual Point | Sample (const Point &p, float u1, float u2, float u3, Normal *Ns) const |
Public Attributes | |
const Transform | ObjectToWorld |
const Transform | WorldToObject |
const bool | reverseOrientation |
const bool | transformSwapsHandedness |
Protected Attributes | |
boost::shared_ptr< Material > | material |
Definition at line 35 of file shape.h.
virtual bool lux::Shape::CanIntersect | ( | ) | const [inline, virtual] |
Returns whether this primitive can be intersected.
Implements lux::Primitive.
Reimplemented in lux::Heightfield, lux::LoopSubdiv, lux::Mesh, and lux::NURBS.
virtual bool lux::Shape::CanSample | ( | ) | const [inline, virtual] |
Returns whether this primitive can be sampled.
Implements lux::Primitive.
Reimplemented in lux::Mesh.
boost::shared_ptr<Material> lux::Shape::GetMaterial | ( | ) | const [inline] |
Definition at line 43 of file shape.h.
Referenced by lux::MeshWaldTriangle::Intersect(), lux::MeshQuadrilateral::Intersect(), and lux::MeshBaryTriangle::Intersect().
virtual void lux::Shape::GetShadingGeometry | ( | const Transform & | obj2world, | |
const DifferentialGeometry & | dg, | |||
DifferentialGeometry * | dgShading | |||
) | const [inline, 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.
virtual bool lux::Shape::Intersect | ( | const Ray & | ray, | |
float * | t_hitp, | |||
DifferentialGeometry * | dg | |||
) | const [inline, virtual] |
Reimplemented in lux::Cone, lux::Cylinder, lux::Disk, lux::Hyperboloid, lux::LensComponent, lux::Paraboloid, lux::Quad, lux::Quadrilateral, lux::Sphere, and lux::Torus.
Definition at line 105 of file shape.h.
References LUX_BUG, LUX_SEVERE, and luxError.
virtual bool lux::Shape::Intersect | ( | const Ray & | r, | |
Intersection * | in | |||
) | const [inline, 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 66 of file shape.h.
References lux::DifferentialGeometry::AdjustNormal(), lux::Intersection::dg, lux::Ray::maxt, reverseOrientation, lux::Intersection::Set(), transformSwapsHandedness, and WorldToObject.
virtual BBox lux::Shape::ObjectBound | ( | ) | const [inline, virtual] |
Reimplemented in lux::Cone, lux::Cylinder, lux::Disk, lux::Heightfield, lux::Hyperboloid, lux::LensComponent, lux::LoopSubdiv, lux::Mesh, lux::NURBS, lux::Paraboloid, lux::Quad, lux::QuadMesh, lux::Quadrilateral, lux::Sphere, and lux::Torus.
Definition at line 98 of file shape.h.
References LUX_BUG, LUX_SEVERE, and luxError.
Referenced by WorldBound().
virtual void lux::Shape::Refine | ( | vector< boost::shared_ptr< Shape > > & | refined | ) | const [inline, virtual] |
Reimplemented in lux::Heightfield, lux::LoopSubdiv, and lux::NURBS.
Definition at line 102 of file shape.h.
References LUX_BUG, LUX_SEVERE, and luxError.
virtual void lux::Shape::Refine | ( | vector< boost::shared_ptr< Primitive > > & | refined, | |
const PrimitiveRefinementHints & | refineHints, | |||
boost::shared_ptr< Primitive > | thisPtr | |||
) | [inline, 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 from lux::Primitive.
Reimplemented in lux::Mesh.
virtual Point lux::Shape::Sample | ( | float | u1, | |
float | u2, | |||
float | u3, | |||
Normal * | Ns | |||
) | const [inline, virtual] |
Reimplemented in lux::Cone, lux::Cylinder, lux::Disk, lux::LensComponent, lux::Quad, lux::Quadrilateral, lux::Sphere, and lux::Torus.
Definition at line 111 of file shape.h.
References LUX_BUG, LUX_SEVERE, and luxError.
virtual void lux::Shape::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 90 of file shape.h.
References lux::CoordinateSystem(), lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, lux::DifferentialGeometry::nn, lux::DifferentialGeometry::p, Sample(), lux::DifferentialGeometry::u, and lux::DifferentialGeometry::v.
virtual void lux::Shape::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 84 of file shape.h.
References lux::CoordinateSystem(), lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, lux::DifferentialGeometry::nn, lux::DifferentialGeometry::p, lux::DifferentialGeometry::u, and lux::DifferentialGeometry::v.
Referenced by Sample().
void lux::Shape::SetMaterial | ( | boost::shared_ptr< Material > | mat | ) | [inline] |
virtual BBox lux::Shape::WorldBound | ( | ) | const [inline, virtual] |
Returns the world bounds of this primitive.
Implements lux::Primitive.
Reimplemented in lux::LoopSubdiv, lux::Mesh, lux::NURBS, lux::Quad, and lux::Quadrilateral.
Definition at line 45 of file shape.h.
References ObjectBound(), and ObjectToWorld.
boost::shared_ptr<Material> lux::Shape::material [protected] |
Definition at line 119 of file shape.h.
Referenced by lux::LoopSubdiv::ApplyDisplacementMap(), lux::Torus::Intersect(), lux::Sphere::Intersect(), lux::Paraboloid::Intersect(), lux::MeshQuadrilateral::Intersect(), lux::LensComponent::Intersect(), lux::Hyperboloid::Intersect(), lux::Disk::Intersect(), lux::Cylinder::Intersect(), lux::Cone::Intersect(), lux::Mesh::Mesh(), lux::Sphere::Pdf(), lux::QuadMesh::QuadMesh(), lux::NURBS::Refine(), lux::Mesh::Refine(), lux::LoopSubdiv::Refine(), lux::Heightfield::Refine(), lux::Torus::Sample(), lux::Sphere::Sample(), lux::LensComponent::Sample(), lux::Disk::Sample(), lux::Cylinder::Sample(), lux::Cone::Sample(), WorldBound(), lux::NURBS::WorldBound(), and lux::LoopSubdiv::WorldBound().
const bool lux::Shape::reverseOrientation |
Definition at line 120 of file shape.h.
Referenced by Intersect(), lux::MeshQuadrilateral::Intersect(), lux::MeshBaryTriangle::MeshBaryTriangle(), lux::NURBS::Refine(), lux::Mesh::Refine(), lux::LoopSubdiv::Refine(), lux::Heightfield::Refine(), lux::Torus::Sample(), lux::Sphere::Sample(), lux::Quadrilateral::Sample(), lux::MeshQuadrilateral::Sample(), lux::Disk::Sample(), lux::Cylinder::Sample(), and lux::Cone::Sample().
const bool lux::Shape::transformSwapsHandedness |
Definition at line 120 of file shape.h.
Referenced by Intersect(), lux::MeshQuadrilateral::Intersect(), lux::MeshBaryTriangle::MeshBaryTriangle(), and lux::MeshQuadrilateral::Sample().
Definition at line 119 of file shape.h.
Referenced by lux::Torus::Intersect(), lux::Sphere::Intersect(), Intersect(), lux::Paraboloid::Intersect(), lux::MeshWaldTriangle::Intersect(), lux::MeshQuadrilateral::Intersect(), lux::MeshBaryTriangle::Intersect(), lux::LensComponent::Intersect(), lux::Hyperboloid::Intersect(), lux::Disk::Intersect(), lux::Cylinder::Intersect(), lux::Cone::Intersect(), lux::Torus::IntersectP(), lux::Sphere::IntersectP(), lux::Paraboloid::IntersectP(), lux::LensComponent::IntersectP(), lux::Hyperboloid::IntersectP(), lux::Disk::IntersectP(), lux::Cylinder::IntersectP(), lux::Cone::IntersectP(), lux::MeshQuadrilateral::MeshQuadrilateral(), lux::Quadrilateral::ObjectBound(), lux::MeshQuadrilateral::ObjectBound(), lux::MeshBaryTriangle::ObjectBound(), and lux::Mesh::ObjectBound().