#include <Primitive.h>
Inherited by InfinitePlane, Sphere, and Triangle.
Inheritance diagram for Primitive:
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 Shader * | shader () const |
void | setShader (Shader *sh) |
const Box & | bounds () 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. | |
Shader * | mShader |
Associated shader. | |
bool | mCastShadows |
If this primitive casts shadows. |
Definition at line 21 of file Primitive.h.
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.
virtual bool Primitive::intersect | ( | Ray & | ray | ) | const [pure virtual] |
Intersection test with this primitive
Implemented in InfinitePlane, Sphere, and Triangle.
Calculate a normal in global coordinates given barycentric coordinates of the hitpoint
Implemented in InfinitePlane, Sphere, TexturedSmoothTriangle, and Triangle.
Referenced by Shader::normal(), and DebugShader::shade().
virtual TexCoordinate Primitive::texCoord | ( | const Ray & | ) | const [inline, virtual] |
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] |
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
Definition at line 76 of file Primitive.h.
References mBounds.
Referenced by SimpleKDTree::buildTree(), SphereObject::calcBounds(), SAHKDTree::generateEvents(), and SimpleKDTree::setBestSplit().
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().
gives axis of the triangle (perpenticular to the normal) this is used in bump mapping
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.
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().