Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Teddy::Scenes::Scene Class Reference

Collections of Models, Lights and Cameras. More...

#include <Scene.h>

Inheritance diagram for Teddy::Scenes::Scene:

Inheritance graph
[legend]
Collaboration diagram for Teddy::Scenes::Scene:

Collaboration graph
[legend]
List of all members.

Public Methods

 Scene (const std::string &name)
 Constructor. More...

void add (Teddy::Materials::Light *l)
 Add new Light to Scene. More...

void add (Teddy::Scenes::PostElement *p)
void add (Teddy::Models::Model *i)
 Add new ModelInstance to Scene. More...

void remove (Teddy::Materials::Light *l)
void remove (Teddy::Scenes::PostElement *p)
void remove (Teddy::Models::Model *i)
void setAmbientColor (Teddy::Graphics::Color ambient_color)
int getCullCount ()
int getDrawCount ()
float getMaxObSize ()
float getMaxObDistance ()
void draw (Camera *c, Teddy::PhysicalComponents::Projection *p)
 Draw scene to OpenGL viewport. More...

void drawPostElements (Camera *c, Teddy::PhysicalComponents::Projection *p)
 Draw scene to OpenGL viewport. More...

Teddy::Models::Modelpick (Camera *c, Teddy::PhysicalComponents::Projection *p)
 Return Modele close to given view coordinates 3. More...

void update (Teddy::PhysicalComponents::Projection *p)
list< Teddy::Models::Model * > & getModels ()
 Return instance list. More...


Protected Attributes

list< Teddy::Materials::Light * > lights
list< Teddy::Models::Model * > models
list< Teddy::Scenes::PostElement * > post_elements
Teddy::Graphics::Color ambient_color
int cull_count
int draw_count
int last_draw_count

Detailed Description

Collections of Models, Lights and Cameras.

Bug:
Destructors missing?
Todo:
Group instances by material

Improve light management

Improved sorting, especially for transluent surface support

Scene contains Lights and ModelInstances. Scene is responsible of rendering the scene according to Camera / Projection Area / (Transform)View settings, and each individual ModelInstance settings.

At the moment rendering the Scene is a very unoptimized process. Later on things to be drawn should be arranged by material etc.

Because light management is currently very simple, all lights are applied before instances are drawn.

At the moment the scene is drawn in a single pass. This pass asks camera to cull instance and then the instance to draw itself if it was not culled.

Rendering transluent instances and elements is not yet implemented.

Definition at line 69 of file Scene.h.


Constructor & Destructor Documentation

Teddy::Scenes::Scene::Scene const std::string &    name
 

Constructor.

Definition at line 52 of file Scene.cpp.

References ambient_color, cull_count, draw_count, and last_draw_count.


Member Function Documentation

void Teddy::Scenes::Scene::add Teddy::Models::Model   i
 

Add new ModelInstance to Scene.

Definition at line 81 of file Scene.cpp.

References models.

void Teddy::Scenes::Scene::add Teddy::Scenes::PostElement   p
 

void Teddy::Scenes::Scene::add Teddy::Materials::Light   l
 

Add new Light to Scene.

Definition at line 69 of file Scene.cpp.

References lights.

Referenced by Teddy::Imports::LWSceneParser::postProcess.

void Teddy::Scenes::Scene::draw Camera   c,
Teddy::PhysicalComponents::Projection   p
 

Draw scene to OpenGL viewport.

Definition at line 125 of file Scene.cpp.

References ambient_color, cull_count, drawPostElements, last_draw_count, lights, models, and Teddy::Graphics::Color::rgba.

Referenced by Teddy::Scenes::Camera::projectScene.

void Teddy::Scenes::Scene::drawPostElements Camera   c,
Teddy::PhysicalComponents::Projection   p
 

Draw scene to OpenGL viewport.

Definition at line 190 of file Scene.cpp.

References post_elements.

Referenced by draw.

int Teddy::Scenes::Scene::getCullCount  
 

Definition at line 184 of file Scene.cpp.

References cull_count.

int Teddy::Scenes::Scene::getDrawCount  
 

Definition at line 63 of file Scene.cpp.

References last_draw_count.

float Teddy::Scenes::Scene::getMaxObDistance  
 

Definition at line 310 of file Scene.cpp.

References DoubleVector, MAX, and models.

float Teddy::Scenes::Scene::getMaxObSize  
 

Definition at line 294 of file Scene.cpp.

References MAX, and models.

list< Model * > & Teddy::Scenes::Scene::getModels  
 

Return instance list.

Definition at line 114 of file Scene.cpp.

References models.

Model * Teddy::Scenes::Scene::pick Camera   c,
Teddy::PhysicalComponents::Projection   p
 

Return Modele close to given view coordinates 3.

Definition at line 218 of file Scene.cpp.

References models, Teddy::MixIn::Named::name, and pick.

Referenced by pick.

void Teddy::Scenes::Scene::remove Teddy::Models::Model   i
 

Definition at line 94 of file Scene.cpp.

References models.

void Teddy::Scenes::Scene::remove Teddy::Scenes::PostElement   p
 

void Teddy::Scenes::Scene::remove Teddy::Materials::Light   l
 

Definition at line 86 of file Scene.cpp.

References lights.

void Teddy::Scenes::Scene::setAmbientColor Teddy::Graphics::Color    ambient_color
 

Definition at line 119 of file Scene.cpp.

Referenced by Teddy::Imports::LWSceneParser::postProcess.

void Teddy::Scenes::Scene::update Teddy::PhysicalComponents::Projection   p
 

Update Modelss in scene This is required when any Material control property of Projection is changed.

Definition at line 103 of file Scene.cpp.


Member Data Documentation

Teddy::Graphics::Color Teddy::Scenes::Scene::ambient_color [protected]
 

Definition at line 97 of file Scene.h.

Referenced by draw, and Scene.

int Teddy::Scenes::Scene::cull_count [protected]
 

Definition at line 98 of file Scene.h.

Referenced by draw, getCullCount, and Scene.

int Teddy::Scenes::Scene::draw_count [protected]
 

Definition at line 99 of file Scene.h.

Referenced by Scene.

int Teddy::Scenes::Scene::last_draw_count [protected]
 

Definition at line 100 of file Scene.h.

Referenced by draw, getDrawCount, and Scene.

list<Teddy::Materials::Light *> Teddy::Scenes::Scene::lights [protected]
 

Definition at line 94 of file Scene.h.

Referenced by add, draw, and remove.

list<Teddy::Models ::Model *> Teddy::Scenes::Scene::models [protected]
 

Definition at line 95 of file Scene.h.

Referenced by add, draw, getMaxObDistance, getMaxObSize, getModels, pick, and remove.

list<Teddy::Scenes ::PostElement*> Teddy::Scenes::Scene::post_elements [protected]
 

Definition at line 96 of file Scene.h.

Referenced by drawPostElements.


The documentation for this class was generated from the following files: