Primitive Class Reference

#include <Primitive.h>

Inherited by InfinitePlane, Sphere, and Triangle.

Inheritance diagram for Primitive:

Inheritance graph
[legend]
Collaboration diagram for Primitive:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Primitive ()
virtual ~Primitive ()
virtual bool intersect (Ray &ray) const=0
virtual Vec3f normal (const Ray &ray) const=0
virtual TexCoordinate texCoord (const Ray &) const
const Shadershader () const
void setShader (Shader *sh)
const Boxbounds () const
virtual RGBAColor shade (const Ray &ray) const
bool castShadows () const
void setCastShadows (bool cs)
virtual void axes (const Ray &ray, Vec3f &x, Vec3f &y) const=0

Protected Member Functions

virtual void calcBounds ()=0

Protected Attributes

Box mBounds
 Bounding box.
ShadermShader
 Associated shader.
bool mCastShadows
 If this primitive casts shadows.

Detailed Description

Abstract base class for all primitives

Author:
Alex Busenius

Christian Engels

Definition at line 21 of file Primitive.h.


Constructor & Destructor Documentation

Primitive::Primitive (  )  [inline]

Constructor. Every subclass should call calcBounds() in there

Definition at line 26 of file Primitive.h.

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

Destructor

Definition at line 35 of file Primitive.h.


Member Function Documentation

virtual bool Primitive::intersect ( Ray ray  )  const [pure virtual]

Intersection test with this primitive

Implemented in InfinitePlane, Sphere, and Triangle.

virtual Vec3f Primitive::normal ( const Ray ray  )  const [pure virtual]

Calculate a normal in global coordinates given barycentric coordinates of the hitpoint

Returns:
the normal of the ray with the apropiate position

Implemented in InfinitePlane, Sphere, TexturedSmoothTriangle, and Triangle.

Referenced by Shader::normal(), and DebugShader::shade().

virtual TexCoordinate Primitive::texCoord ( const Ray  )  const [inline, virtual]

Returns:
the Texture Coordinate

Reimplemented in Sphere, and TexturedSmoothTriangle.

Definition at line 51 of file Primitive.h.

Referenced by Shader::normal(), WoodShader::shade(), PhongShader::shade(), DebugShader::shade(), CookTorranceShader::shade(), CombineShader::shade(), and CloudShader::shade().

const Shader* Primitive::shader (  )  const [inline]

Returns:
the shader

Definition at line 58 of file Primitive.h.

References mShader.

Referenced by Scene::rayTrace().

void Primitive::setShader ( Shader sh  )  [inline]

sets the shader

Definition at line 66 of file Primitive.h.

References mShader.

Referenced by SphereObject::setShader().

const Box& Primitive::bounds (  )  const [inline]

Get bounds of this box

Returns:
the bounding box

Definition at line 76 of file Primitive.h.

References mBounds.

Referenced by SimpleKDTree::buildTree(), SphereObject::calcBounds(), SAHKDTree::generateEvents(), and SimpleKDTree::setBestSplit().

virtual RGBAColor Primitive::shade ( const Ray ray  )  const [inline, virtual]

Returns:
The color the shader shades

Definition at line 83 of file Primitive.h.

References mShader, and Shader::shade().

Referenced by Scene::rayTrace().

bool Primitive::castShadows (  )  const [inline]

Do we cast shadows?

Definition at line 91 of file Primitive.h.

References mCastShadows.

Referenced by QuadAreaLight::illuminate(), and PointLight::illuminate().

void Primitive::setCastShadows ( bool  cs  )  [inline]

Set cast shadows property

Definition at line 98 of file Primitive.h.

References mCastShadows.

Referenced by SphereObject::setCastShadows().

virtual void Primitive::axes ( const Ray ray,
Vec3f x,
Vec3f y 
) const [pure virtual]

gives axis of the triangle (perpenticular to the normal) this is used in bump mapping

See also:
Shader::normal()

Implemented in InfinitePlane, Sphere, and Triangle.

Referenced by Shader::normal().

virtual void Primitive::calcBounds (  )  [protected, pure virtual]

Calculate primitive bounds

Implemented in InfinitePlane, Sphere, and Triangle.


Member Data Documentation

Box Primitive::mBounds [protected]

Bounding box.

Definition at line 111 of file Primitive.h.

Referenced by bounds(), Triangle::calcBounds(), Sphere::calcBounds(), and InfinitePlane::calcBounds().

Shader* Primitive::mShader [protected]

Associated shader.

Definition at line 114 of file Primitive.h.

Referenced by setShader(), shade(), and shader().

bool Primitive::mCastShadows [protected]

If this primitive casts shadows.

Definition at line 117 of file Primitive.h.

Referenced by castShadows(), and setCastShadows().


The documentation for this class was generated from the following file:
Generated on Fri Feb 1 00:02:24 2008 for Grayfall by  doxygen 1.5.1