InstancedShape Class Reference

Acts as a proxy for a shape which has been instanced. More...

#include <InstancedShape.h>

Inheritance diagram for InstancedShape:

Transformable Shape Intersectable SSEAligned

List of all members.

Lazy evaluation of SurfacePoint information

virtual void initSurfacePoint (SurfacePoint &pt) const
 Initializes the given SurfacePoint which is assumed to lie on the surface of this Shape; fills in the point's UV coords, normal, and Material properties (.
virtual void _getUV (SurfacePoint &pt) const
virtual void _getGeometricNormal (SurfacePoint &pt) const
virtual real_t _getSurfaceArea ()

Public Member Functions

Constructors
 InstancedShape (Shape *instancee=NULL)
virtual ~InstancedShape ()
Initialization
virtual void init ()
 Initializes this InstancedShape, assuming the underlying instancee has already been initialized.
Main usage interface
virtual real_t getIntersection (const Ray &ray, SurfacePoint &pt)
 Tests the given ray with this object for intersection. If a valid intersection exists, its "t" value will be returned and the given SurfacePoint will be initialized with enough data for this object to later fill in all relevant information lazily (world space normal at intersection point, uv coordinates, etc.).
virtual bool intersects (const Ray &ray, real_t tMax=INFINITY)
 Used for occlusion/visibility testing where you don't necessarily care about anything other than whether or not an intersection exists. (generally faster than getIntersection).
virtual bool hasNormal () const
virtual void preview ()
 Displays a crude OpenGL preview of this shape.
Sampling functionality
virtual void getRandomPoint (SurfacePoint &pt)
virtual Point3 getPosition (const UV &uv)

Protected Attributes

Shapem_instancee


Detailed Description

Acts as a proxy for a shape which has been instanced.

Author:
Travis Fischer (fisch0920@gmail.com)

Matthew Jacobs (jacobs.mh@gmail.com)

Date:
Fall 2008

Definition at line 16 of file InstancedShape.h.


Constructor & Destructor Documentation

InstancedShape::InstancedShape ( Shape instancee = NULL  )  [inline]

Definition at line 21 of file InstancedShape.h.

virtual InstancedShape::~InstancedShape (  )  [inline, virtual]

Definition at line 25 of file InstancedShape.h.


Member Function Documentation

void InstancedShape::init (  )  [virtual]

Initializes this InstancedShape, assuming the underlying instancee has already been initialized.

Reimplemented from Transformable.

Definition at line 15 of file InstancedShape.cpp.

real_t InstancedShape::getIntersection ( const Ray ray,
SurfacePoint pt 
) [virtual]

Tests the given ray with this object for intersection. If a valid intersection exists, its "t" value will be returned and the given SurfacePoint will be initialized with enough data for this object to later fill in all relevant information lazily (world space normal at intersection point, uv coordinates, etc.).

Note:
if you only care about whether or not an intersection exists and don't actually need to know the exact intersection point, see the intersects method instead.
Returns:
the smallest positive "t" value of any intersections found, or INFINITY if no valid intersection exists

Implements Intersectable.

Definition at line 41 of file InstancedShape.cpp.

bool InstancedShape::intersects ( const Ray ray,
real_t  tMax = INFINITY 
) [virtual]

Used for occlusion/visibility testing where you don't necessarily care about anything other than whether or not an intersection exists. (generally faster than getIntersection).

Note:
default implementation defers to getIntersection
Returns:
whether or not the given ray intersects this object with a positive "t" value greater than EPSILON and less than the given tMax

Reimplemented from Intersectable.

Definition at line 54 of file InstancedShape.cpp.

bool InstancedShape::hasNormal (  )  const [virtual]

Returns:
whether or not this Shape supports the concept of a geometric surface normal defined over its surface
Note:
default implementation returns true

Reimplemented from Shape.

Definition at line 62 of file InstancedShape.cpp.

void InstancedShape::preview (  )  [virtual]

Displays a crude OpenGL preview of this shape.

Note:
default implementation calls preview on this shape's material

Reimplemented from Transformable.

Definition at line 66 of file InstancedShape.cpp.

void InstancedShape::getRandomPoint ( SurfacePoint pt  )  [virtual]

Returns:
a point chosen uniformly random over the surface of this shape in 'pt'
Note:
the probability density of selecting this point is assumed to be (1.0 / getSurfaceArea())

Reimplemented from Shape.

Definition at line 72 of file InstancedShape.cpp.

Point3 InstancedShape::getPosition ( const UV uv  )  [virtual]

Returns:
the point on the surface of this shape corresponding to the given UV coordinates

Reimplemented from Transformable.

Definition at line 78 of file InstancedShape.cpp.

void InstancedShape::initSurfacePoint ( SurfacePoint pt  )  const [virtual]

Initializes the given SurfacePoint which is assumed to lie on the surface of this Shape; fills in the point's UV coords, normal, and Material properties (.

See also:
Material::initSurfacePoint)

Reimplemented from Shape.

Definition at line 90 of file InstancedShape.cpp.

void InstancedShape::_getUV ( SurfacePoint pt  )  const [protected, virtual]

Implements Shape.

Definition at line 102 of file InstancedShape.cpp.

void InstancedShape::_getGeometricNormal ( SurfacePoint pt  )  const [protected, virtual]

Implements Shape.

Definition at line 110 of file InstancedShape.cpp.

real_t InstancedShape::_getSurfaceArea (  )  [protected, virtual]

Returns:
the total surface area of this shape
Note:
default implementation returns 0 because not all shapes support this calculation (some are especially hard to compute in world space)

Reimplemented from Shape.

Definition at line 84 of file InstancedShape.cpp.


Member Data Documentation

Definition at line 125 of file InstancedShape.h.


The documentation for this class was generated from the following files:

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6