Scene Class Reference

#include <Scene.h>

Collaboration diagram for Scene:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Scene ()
 ~Scene ()
bool castShadows () const
void setCastShadows (bool cs)
const ObjectgetObject (int i) const
void addObject (Object *obj)
void removeObject (Object *obj)
const LightgetLight (int i) const
void addLight (Light *light)
void removeLight (Light *light)
unsigned int lightsCount () const
void addTexture (Texture *tex)
const TexturegetTexture (int i) const
void addShader (Shader *sh)
const ShadergetShader (int i) const
void setBgColor (const RGBAColor &c)
const RGBAColorbgColor () const
RGBAColor rayTrace (Ray &ray) const
bool intersect (Ray &ray) const
void clear ()
void addAnimator (Animator *ani)
void step ()
void physicsDump (const std::string &file)
void physicsLoad (const std::string &file)

Private Attributes

std::vector< Object * > mObjects
 List of objects in the scene.
std::vector< Light * > mLights
 List of all lights in the scene.
std::vector< Texture * > mTextures
 List of all textures in the scene.
std::vector< Shader * > mShaders
 List of all shaders in the scene.
std::vector< Animator * > mAnimators
 List of all animators.
RGBAColor mBgColor
 Background color.
bool mCastShadows
 Shall the scene cast the shadows.
BilliardPhysics mPhysics
 Billiard physics engine.
int mFrameNr
 Current frame.

Detailed Description

Class to encapsulate the whole scene (lights, objects, ...)

Author:
Alex Busenius

Christian Engels

Definition at line 24 of file Scene.h.


Constructor & Destructor Documentation

Scene::Scene (  ) 

Constructor

Definition at line 12 of file Scene.cpp.

Scene::~Scene (  ) 

Destructor

Definition at line 31 of file Scene.cpp.

References clear(), and LOG.


Member Function Documentation

bool Scene::castShadows (  )  const [inline]

If shadow casting is on

Definition at line 37 of file Scene.h.

References mCastShadows.

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

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

Set shadow casting

Definition at line 44 of file Scene.h.

References mCastShadows.

Referenced by SceneBuilder::makeScene().

const Object* Scene::getObject ( int  i  )  const [inline]

Get object by index

Definition at line 51 of file Scene.h.

References mObjects.

void Scene::addObject ( Object obj  )  [inline]

Add a new object to the scene (Note: Scene will be the new owner!)

Parameters:
obj Object to add

Definition at line 61 of file Scene.h.

References BilliardPhysics::add(), PhysicalObject::applyPhysics(), mObjects, and mPhysics.

Referenced by SceneBuilder::addObject().

void Scene::removeObject ( Object obj  ) 

Remove object

Definition at line 41 of file Scene.cpp.

References mObjects, mPhysics, and BilliardPhysics::remove().

const Light* Scene::getLight ( int  i  )  const [inline]

Get light by index

Definition at line 75 of file Scene.h.

References mLights.

Referenced by PhongShader::shade(), and CookTorranceShader::shade().

void Scene::addLight ( Light light  )  [inline]

Add a new light to the scene (Note: Scene will be the owner)

Definition at line 83 of file Scene.h.

References mLights, and Light::setScene().

Referenced by SceneBuilder::addLight().

void Scene::removeLight ( Light light  ) 

Remove light

Definition at line 57 of file Scene.cpp.

References mLights.

unsigned int Scene::lightsCount (  )  const [inline]

Get number of lights

Definition at line 96 of file Scene.h.

References mLights.

Referenced by PhongShader::shade(), and CookTorranceShader::shade().

void Scene::addTexture ( Texture tex  )  [inline]

add a Texture

Definition at line 103 of file Scene.h.

References mTextures.

Referenced by SceneBuilder::addTexture().

const Texture* Scene::getTexture ( int  i  )  const [inline]

return a Texture

Definition at line 111 of file Scene.h.

References mTextures.

void Scene::addShader ( Shader sh  )  [inline]

add a shader

Definition at line 119 of file Scene.h.

References mShaders.

Referenced by SceneBuilder::addShader().

const Shader* Scene::getShader ( int  i  )  const [inline]

return a Shader

Definition at line 127 of file Scene.h.

References mShaders.

void Scene::setBgColor ( const RGBAColor c  )  [inline]

Set new background color

Definition at line 135 of file Scene.h.

References mBgColor, and RGBAColor::setA().

Referenced by SceneBuilder::makeScene().

const RGBAColor& Scene::bgColor (  )  const [inline]

Get bg color

Definition at line 143 of file Scene.h.

References mBgColor.

RGBAColor Scene::rayTrace ( Ray ray  )  const [inline]

Ray trace the scene. Return the shaded color of the ray (pixel) or the mBgColor if ray do not intersect any object in the scene.

Parameters:
ray Ray to trace through the scene

Definition at line 153 of file Scene.h.

References Ray::hit(), intersect(), MAX_RECURSION_DEEP, mBgColor, Ray::recDeep(), Primitive::shade(), and Primitive::shader().

Referenced by Renderer::renderFromTo(), TransparentShader::shade(), RefractiveShader::shade(), and MirrorShader::shade().

bool Scene::intersect ( Ray ray  )  const [inline]

intersect the ray within each object in the scene

Definition at line 186 of file Scene.h.

References mObjects.

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

void Scene::clear (  ) 

Delete all assigned objects, lights, textures and shaders

Definition at line 73 of file Scene.cpp.

References mAnimators, mFrameNr, mLights, mObjects, mShaders, and mTextures.

Referenced by ~Scene().

void Scene::addAnimator ( Animator ani  )  [inline]

Add a new animator to the list of animations. (Note: Scene will be the new owner!)

Definition at line 202 of file Scene.h.

References mAnimators.

Referenced by SceneBuilder::addPhysicsStep().

void Scene::step (  ) 

Perform all needed animations and calculate physics for the next frame

Definition at line 104 of file Scene.cpp.

References mAnimators, mFrameNr, mPhysics, and BilliardPhysics::step().

Referenced by Renderer::renderAnimated().

void Scene::physicsDump ( const std::string &  file  )  [inline]

Dump physics to file

Parameters:
file File to write to

Definition at line 216 of file Scene.h.

References BilliardPhysics::dumpToFile(), and mPhysics.

Referenced by Renderer::physicsSave().

void Scene::physicsLoad ( const std::string &  file  )  [inline]

Load physics from file

Parameters:
file File to read from

Definition at line 225 of file Scene.h.

References BilliardPhysics::loadFromFile(), and mPhysics.

Referenced by Renderer::physicsLoad().


Member Data Documentation

std::vector<Object *> Scene::mObjects [private]

List of objects in the scene.

Definition at line 232 of file Scene.h.

Referenced by addObject(), clear(), getObject(), intersect(), and removeObject().

std::vector<Light *> Scene::mLights [private]

List of all lights in the scene.

Definition at line 235 of file Scene.h.

Referenced by addLight(), clear(), getLight(), lightsCount(), and removeLight().

std::vector<Texture *> Scene::mTextures [private]

List of all textures in the scene.

Definition at line 238 of file Scene.h.

Referenced by addTexture(), clear(), and getTexture().

std::vector<Shader *> Scene::mShaders [private]

List of all shaders in the scene.

Definition at line 241 of file Scene.h.

Referenced by addShader(), clear(), and getShader().

std::vector<Animator *> Scene::mAnimators [private]

List of all animators.

Definition at line 244 of file Scene.h.

Referenced by addAnimator(), clear(), and step().

RGBAColor Scene::mBgColor [private]

Background color.

Definition at line 247 of file Scene.h.

Referenced by bgColor(), rayTrace(), and setBgColor().

bool Scene::mCastShadows [private]

Shall the scene cast the shadows.

Definition at line 250 of file Scene.h.

Referenced by castShadows(), and setCastShadows().

BilliardPhysics Scene::mPhysics [private]

Billiard physics engine.

Definition at line 253 of file Scene.h.

Referenced by addObject(), physicsDump(), physicsLoad(), removeObject(), and step().

int Scene::mFrameNr [private]

Current frame.

Definition at line 256 of file Scene.h.

Referenced by clear(), and step().


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