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
Classes | Public Member Functions | Private Attributes | Friends | List of all members
Scene Class Reference

#include <Scene.hpp>

Classes

class  Material
 
class  Mesh
 
class  Node
 
class  NodeAnimation
 

Public Member Functions

 Scene (Application *app, string const &name)
 
 ~Scene ()
 
void updateInstance (SceneInstance *instance, float const time)
 
void updateAllInstances (float const time)
 
void drawAllInstances (DrawArgs &args, Shader *shader)
 
void updateNdraw (DrawArgs &args, Shader *shader)
 
SceneInstancecreateInstance (bool pickable=true)
 
void unregisterInstance (SceneInstance *obj)
 

Private Attributes

auto_reset_event m_parallelEvent
 
string m_name
 
vector< unique_ptr< Material > > m_materials
 
vector< unique_ptr< Mesh > > m_meshes
 
unique_ptr< Nodem_root
 
set< SceneInstance * > m_instances
 
Applicationm_app
 
map< string, int > m_animationsByName
 
vector< float > m_animationsDuration
 
size_t m_boneCount
 
size_t m_drawNodeCount
 
vector< mat4 > m_boneOffsets
 
mat4 m_inverseRootTransform
 
size_t m_instancesInBuffer
 
bool m_needToUpdateIdBuffer
 
GLuint m_positionsBuffer
 
GLuint m_uvBuffer
 
GLuint m_normalsBuffer
 
GLuint m_boneIdBuffer
 
GLuint m_boneWeightBuffer
 
GLuint m_indicesBuffer
 
GLuint m_vao
 
GLuint m_stateTBO
 
GLuint m_stateBuffer
 
GLuint m_idTBO
 
GLuint m_idBuffer
 

Friends

class SceneInstance
 

Detailed Description

A Scene represents a hierachical scene that can be animated using keyframes. It is loaded from a file using Assimp.

Definition at line 86 of file Scene.hpp.

Constructor & Destructor Documentation

Scene ( Application app,
string const &  name 
)

Constructs a Scene-object. Loads the necessary data from the file.

Parameters
appThe global application
nameThe (file-)name

Definition at line 45 of file Scene.cpp.

~Scene ( )

Destructs a Scene-object.

Definition at line 544 of file Scene.cpp.

Member Function Documentation

SceneInstance * createInstance ( bool  pickable = true)

Creates an instance of this scene.

Parameters
pickableIf pickable is true this object will be drawn into the id-buffer to make it visible to the picker.
Returns
The created instance.

Definition at line 666 of file Scene.cpp.

void drawAllInstances ( DrawArgs args,
Shader shader 
)

Draws all instances.

Parameters
argsThe DrawArgs that should be used for this rendering
shaderThe shader that should be used for this rendering

Definition at line 585 of file Scene.cpp.

void unregisterInstance ( SceneInstance obj)

Unregisteres an instance. This is usually called by the instances destructor. To destruct an instance just call delete on it.

Parameters
objThe instance which should no longer be managed

Definition at line 677 of file Scene.cpp.

void updateAllInstances ( float const  time)

Updates all skinning-matrices for all instances. Can work parallel or serial (depending on number of instances and config-file)

Parameters
timeThe absolute frame-time

Definition at line 557 of file Scene.cpp.

void updateInstance ( SceneInstance instance,
float const  time 
)

Updates all skinning-matrices for an instance.

Parameters
instanceThe instance to be updated
timeThe absolute frame-time

Definition at line 577 of file Scene.cpp.

void updateNdraw ( DrawArgs args,
Shader shader 
)

Updates all hierachical information for all instances and renders them.

Parameters
argsThe DrawArgs that should be used for this rendering
shaderThe shader that should be used for this rendering

Definition at line 660 of file Scene.cpp.

Friends And Related Function Documentation

friend class SceneInstance
friend

Definition at line 334 of file Scene.hpp.

Member Data Documentation

map<string,int> m_animationsByName
private

All available animation-ids by their name

Definition at line 312 of file Scene.hpp.

vector<float> m_animationsDuration
private

The duration of each animation by their id

Definition at line 313 of file Scene.hpp.

Application* m_app
private

The global application

Definition at line 311 of file Scene.hpp.

size_t m_boneCount
private

The amount of bones in the scene

Definition at line 314 of file Scene.hpp.

GLuint m_boneIdBuffer
private

VBO for bone-ids

Definition at line 325 of file Scene.hpp.

vector<mat4> m_boneOffsets
private

All bone-offset-matrices in the scene by the bone-id/node-id

Definition at line 316 of file Scene.hpp.

GLuint m_boneWeightBuffer
private

VBO for bone-weights

Definition at line 326 of file Scene.hpp.

size_t m_drawNodeCount
private

The amount of nodes to be drawn

Definition at line 315 of file Scene.hpp.

GLuint m_idBuffer
private

id-buffer (VBO)

Definition at line 332 of file Scene.hpp.

GLuint m_idTBO
private

id-buffer (TBO)

Definition at line 331 of file Scene.hpp.

GLuint m_indicesBuffer
private

VBO for indices

Definition at line 327 of file Scene.hpp.

set<SceneInstance*> m_instances
private

All instances of this scene

Definition at line 310 of file Scene.hpp.

size_t m_instancesInBuffer
private

How many instances are currently stored in the buffer

Definition at line 319 of file Scene.hpp.

mat4 m_inverseRootTransform
private

The inverse-root-transform

Definition at line 317 of file Scene.hpp.

vector<unique_ptr<Material> > m_materials
private

All materials in this scene

Definition at line 307 of file Scene.hpp.

vector<unique_ptr<Mesh> > m_meshes
private

All meshes in this scene

Definition at line 308 of file Scene.hpp.

string m_name
private

The scene-name

Definition at line 306 of file Scene.hpp.

bool m_needToUpdateIdBuffer
private

Does the buffer need to be updated

Definition at line 320 of file Scene.hpp.

GLuint m_normalsBuffer
private

VBO for normals

Definition at line 324 of file Scene.hpp.

auto_reset_event m_parallelEvent
private

A synchronization structure for multithreaded-hierachical-update

Definition at line 305 of file Scene.hpp.

GLuint m_positionsBuffer
private

VBO for positions

Definition at line 322 of file Scene.hpp.

unique_ptr<Node> m_root
private

The root-node of the scene

Definition at line 309 of file Scene.hpp.

GLuint m_stateBuffer
private

instance-buffer (VBO)

Definition at line 330 of file Scene.hpp.

GLuint m_stateTBO
private

instance-buffer (TBO)

Definition at line 329 of file Scene.hpp.

GLuint m_uvBuffer
private

VBO for uvs

Definition at line 323 of file Scene.hpp.

GLuint m_vao
private

scene-VAO

Definition at line 328 of file Scene.hpp.


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