Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Types | Private Attributes | List of all members
SceneGraph Class Reference

#include <SceneGraph.hpp>

Inheritance diagram for SceneGraph:
IdCache< id_t >

Public Member Functions

bool const hasSceneChanged ()
 
 SceneGraph (Application *app)
 
 ~SceneGraph ()
 
template<typename t_obj >
t_obj & add (t_obj *object)
 
void remove (ISceneObject *&object)
 
object_list::iterator begin ()
 
object_list::iterator end ()
 
void draw (DrawArgs &args)
 
void update (double time, double timeDelta)
 
id_t createId ()
 
void deleteId (id_tid)
 
void reset ()
 

Private Types

typedef set< ISceneObject * > object_list
 

Private Attributes

object_list m_objects
 
Applicationm_app
 
bool m_hasSceneChanged
 

Detailed Description

SceneGraph manages the applications scene-graph. Objects that are registered will be hosted by this object (i.e. delteted on removal).

Definition at line 9 of file SceneGraph.hpp.

Member Typedef Documentation

typedef set<ISceneObject*> object_list
private

Definition at line 11 of file SceneGraph.hpp.

Constructor & Destructor Documentation

SceneGraph ( Application app)

Constructs an empty scene-graph.

Parameters
appThe global application

Definition at line 4 of file SceneGraph.cpp.

~SceneGraph ( )

Destructs the scene-graph and deletes all hostes objects

Definition at line 9 of file SceneGraph.cpp.

Member Function Documentation

t_obj& add ( t_obj *  object)
inline

Registeres an objects to the scene-graph. From now on this object is hosted by the scene-graph.

Parameters
objectThe object to be registered
Returns
The registered object

Definition at line 42 of file SceneGraph.hpp.

SceneGraph::object_list::iterator begin ( )

Accessor to the scene-graphs begin-iterator

Returns
the scene-graphs begin-iterator

Definition at line 22 of file SceneGraph.cpp.

id_t createId ( )
inlineinherited

Creates a new id (or pops an unused one) and returns it.

Returns
The new id.

Definition at line 28 of file IdCache.hpp.

void deleteId ( id_t  id)
inlineinherited

Gives back the passed id.

Returns
id The from now on unused id.

Definition at line 41 of file IdCache.hpp.

void draw ( DrawArgs args)

Draws all objects

Parameters
argsThe DrawArgs that should be used for this rendering

Definition at line 41 of file SceneGraph.cpp.

SceneGraph::object_list::iterator end ( )

Accessor to the scene-graphs end-iterator

Returns
the scene-graphs end-iterator

Definition at line 26 of file SceneGraph.cpp.

bool const hasSceneChanged ( )
inline

Accessor to a bool indicating wheter the scene-graph has changed since the last frame

Returns
A bool indicating wheter the scene-graph has changed since the last frame

Definition at line 22 of file SceneGraph.hpp.

void remove ( ISceneObject *&  object)

Removes an object from the scene-graph and deletes it. The passed pointer is set to nullptr.

Parameters
objectThe object to be removed

Definition at line 13 of file SceneGraph.cpp.

void reset ( )
inlineinherited

Resets its state to default. All used/unused ids will be forgotten.

Definition at line 50 of file IdCache.hpp.

void update ( double  time,
double  timeDelta 
)

Updates every object in the scene-graph (calls its update-member). Detects wheter the scene-graph has changed.

Parameters
timeThe absolute frame-time
timeDeltaThe time since the last frame

Definition at line 31 of file SceneGraph.cpp.

Member Data Documentation

Application* m_app
private

The global application

Definition at line 14 of file SceneGraph.hpp.

bool m_hasSceneChanged
private

A bool indicating wheter the scene-graph has changed since the last frame

Definition at line 15 of file SceneGraph.hpp.

object_list m_objects
private

List of objects in the scene-graph

Definition at line 13 of file SceneGraph.hpp.


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