#include <Scene.h>
Collaboration diagram for Scene:

Public Member Functions | |
| Scene () | |
| ~Scene () | |
| bool | castShadows () const |
| void | setCastShadows (bool cs) |
| const Object * | getObject (int i) const |
| void | addObject (Object *obj) |
| void | removeObject (Object *obj) |
| const Light * | getLight (int i) const |
| void | addLight (Light *light) |
| void | removeLight (Light *light) |
| unsigned int | lightsCount () const |
| void | addTexture (Texture *tex) |
| const Texture * | getTexture (int i) const |
| void | addShader (Shader *sh) |
| const Shader * | getShader (int i) const |
| void | setBgColor (const RGBAColor &c) |
| const RGBAColor & | bgColor () 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. | |
Definition at line 24 of file Scene.h.
| 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] |
| void Scene::addObject | ( | Object * | obj | ) | [inline] |
Add a new object to the scene (Note: Scene will be the new owner!)
| 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 | ) |
| 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] |
| 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] |
| 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] |
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.
| 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 | ( | ) |
| 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
| 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
| file | File to read from |
Definition at line 225 of file Scene.h.
References BilliardPhysics::loadFromFile(), and mPhysics.
Referenced by Renderer::physicsLoad().
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] |
1.5.1