Scene Class Reference

#include <Scene.h>


Detailed Description

This class is used to encapsulate the whole scene (lights, objects, ...).

Definition at line 18 of file Scene.h.


Public Member Functions

 Scene ()
 The constructor.
 ~Scene ()
 Destructor.
void AddObject (Object *obj)
 Adds a new object to the scene.
void RemoveObject (Object *obj)
 Removes an object from the scene.
void AddLight (Light *light)
 Adds a new light to the scene.
void RemoveLight (Light *light)
 Removes a light to the scene.
void setBgColor (const ColorRGBA &c)
 Setter of the background color.
const ColorRGBAgetBgColor () const
 Getter of the background color.
ColorRGBA RayTrace (Ray &ray)
 Raytrace the scene.
bool Intersect (Ray &ray)
 Intersects the ray within each object in the scene.

Data Fields

Timer timer
 Global scene timer.
std::vector< Object * > mObjects
 List of all objects in the scene.
std::vector< Light * > mLights
 List of all lights in the scene.
ColorRGBA bgColor
 The backgroundColor.
bool castShadows
 Does the scene cast shadows?

Constructor & Destructor Documentation

Scene::Scene (  )  [inline]

The constructor.

Definition at line 55 of file Scene.h.

Scene::~Scene (  )  [inline]

Destructor.

Definition at line 61 of file Scene.h.

References mLights, and mObjects.


Member Function Documentation

Scene::AddObject ( Object obj  )  [inline]

Adds a new object to the scene.

Parameters:
obj The object to be added.
NOTE: The scene will be the new owner of this object.

Definition at line 79 of file Scene.h.

References mObjects.

Referenced by AddObject(), and AddSphere().

Scene::RemoveObject ( Object obj  )  [inline]

Removes an object from the scene.

Parameters:
obj The object to be removed.

Definition at line 89 of file Scene.h.

References mObjects.

Scene::AddLight ( Light light  )  [inline]

Adds a new light to the scene.

Parameters:
light The light to be added.
NOTE: The scene will be the new owner of this light.

Definition at line 106 of file Scene.h.

References mLights, and Light::mScene.

Referenced by main().

Scene::RemoveLight ( Light light  )  [inline]

Removes a light to the scene.

Parameters:
light The light to be removed.

Definition at line 117 of file Scene.h.

References mLights.

Scene::setBgColor ( const ColorRGBA c  )  [inline]

Setter of the background color.

Parameters:
c The new background color.

Definition at line 132 of file Scene.h.

References bgColor.

Referenced by main().

ColorRGBA & Scene::getBgColor (  )  const [inline]

Getter of the background color.

Returns:
The background color.

Definition at line 139 of file Scene.h.

References bgColor.

ColorRGBA Scene::RayTrace ( Ray ray  )  [inline]

Raytrace the scene.

Parameters:
ray Ray to trace through the scene
Returns:
The shaded color of the ray (pixel) or the bgColor if ray do not intersect any object in the scene.

Definition at line 147 of file Scene.h.

References bgColor, Ray::bounces, Primitive::getShader(), Ray::hit, Intersect(), and Shader::Shade().

Referenced by RenderDepthOfFieldFrame(), RenderFrame(), RenderLinearFramePath(), RenderStereoFrame(), RenderSupersampledFrame(), UniAxialCrystalShader::Shade(), TransparentShader::Shade(), SteelShader::Shade(), SilverShader::Shade(), MirrorShader::Shade(), GoldShader::Shade(), FlatTransparentShader::Shade(), and CopperShader::Shade().

bool Scene::Intersect ( Ray ray  )  [inline]

Intersects the ray within each object in the scene.

Parameters:
ray The ray to intersect with.
Returns:
True iff an object is hit false otherwise.

Definition at line 173 of file Scene.h.

References mObjects.

Referenced by RayTrace(), PhongShader::Shade(), BumpMappedWoodPhongShader::Shade(), BumpMappedPhongShader::Shade(), and BumpMappedMarblePhongShader::Shade().


Field Documentation

Timer Scene::timer

Global scene timer.

Timer timer

Definition at line 25 of file Scene.h.

Referenced by main(), RenderDepthOfFieldFrame(), RenderFrame(), RenderLinearFramePath(), RenderStereoFrame(), RenderSupersampledFrame(), PlasmaShader::Shade(), MixShader::Shade(), and CloudShader::Shade().

std::vector<Object*> Scene::mObjects

List of all objects in the scene.

std::vector<Object*> mObjects

Definition at line 31 of file Scene.h.

Referenced by AddObject(), Intersect(), RemoveObject(), and ~Scene().

std::vector<Light*> Scene::mLights

List of all lights in the scene.

std::vector<Light*> mLights

Definition at line 37 of file Scene.h.

Referenced by AddLight(), RemoveLight(), PhongShader::Shade(), BumpMappedWoodPhongShader::Shade(), BumpMappedPhongShader::Shade(), BumpMappedMarblePhongShader::Shade(), and ~Scene().

ColorRGBA Scene::bgColor

The backgroundColor.

ColorRGBA bgColor

Definition at line 43 of file Scene.h.

Referenced by getBgColor(), RayTrace(), and setBgColor().

bool Scene::castShadows

Does the scene cast shadows?

bool castShadows

Definition at line 49 of file Scene.h.

Referenced by main(), PhongShader::Shade(), BumpMappedWoodPhongShader::Shade(), BumpMappedPhongShader::Shade(), and BumpMappedMarblePhongShader::Shade().


The documentation for this class was generated from the following file:
Generated on Thu Jan 31 21:48:58 2008 for RayTracer by  doxygen 1.5.4