ComputerGraphik TU WIEN
Public Types | Public Member Functions | Protected Attributes | List of all members
SceneObject Class Reference

The base class of the objects which are rendered. More...

#include <sceneObject.hpp>

Inheritance diagram for SceneObject:
BubbleCursor Camera CubeMapObject CubeMapObject::EffectObject GameLogic GameLogic::Bullet GameLogic::Terrain Legend LegendBackground Light LightCamera::EffectObjectLightCamShadow MouseSemantics ParticleSystemCPU Selector SelectorBase SelectorBase::EffectObject ShadowMap::EffectObject Sun::EffectObjectAmbientPass Sun::EffectObjectCube Sun::EffectObjectCubeInstanced Sun::EffectObjectSVPass SunVolumetric SunVolumetric::EffectObjectVolumetric SunVolumetric::EffectObjectVolumetricPost Tank Tank::Gun Tank::Turret Tessellation

Public Types

typedef std::vector< std::pair< double, glm::mat4 > > Animation
 

Public Member Functions

 SceneObject (std::shared_ptr< SceneObject > &effectParent, const glm::mat4 &modelMatrix=glm::mat4(1))
 
 SceneObject (const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1))
 
virtual ~SceneObject ()
 
ModelgetModel () const
 
ShadergetShader () const
 
glm::mat4 getModelMatrix () const
 
glm::mat4 getGlobalModelMatrix () const
 
std::string getName () const
 
std::shared_ptr< SceneObjectgetParent () const
 
void setAnimationTime (double time)
 
bool setAnimation (const Animation &anim)
 
bool delChild (size_t idx)
 
bool getChild (size_t idx, std::shared_ptr< SceneObject > &child) const
 
bool addChild (std::shared_ptr< SceneObject > &child)
 
bool remEffect (const std::string &name)
 
SceneObjectgetEffect (const std::string &name) const
 
bool addEffect (const std::string &name, std::unique_ptr< SceneObject > &effect)
 
bool doNotRender ()
 
bool getIsVolSun ()
 
virtual void reset ()
 
virtual void draw () const
 
virtual bool animate (double time)
 
virtual void update (double deltaT)
 
virtual void setShader (Shader *val)
 

Protected Attributes

GLuint vao
 
Scenescene
 
Modelmodel
 
Shadershader
 
glm::mat4 modelMatrix
 
std::string name
 
std::weak_ptr< SceneObjectparent
 
std::vector< std::shared_ptr< SceneObject > > childs
 
std::map< std::string, std::unique_ptr< SceneObject > > effectChilds
 
size_t animIDX
 
Animation animation
 
bool norender
 
bool isVolSun
 

Detailed Description

The base class of the objects which are rendered.

SceneObject implementation
It has a pointer to a shader, a model, a scene, holds the model matrix and a handle to a vertex array object. A generic drawing function is written here. It holds the parent child hierarchy. Childs are stored in std::shared_ptr. The parent is stored in a std::weak_ptr. This solution is questionable, since this implies an atomic increment and decrement on each parent access, which happens frequently. Another problem might be if an implementation bug causes, that the parent has been deleted but the child still lives, then the std::weak_ptr will return NULL, the program won't crash because this means that the root has been reached, but the object has not reached the root, so it won't be in global model space.
Author
Adam

Member Typedef Documentation

typedef std::vector<std::pair<double, glm::mat4> > SceneObject::Animation

Constructor & Destructor Documentation

SceneObject::SceneObject ( std::shared_ptr< SceneObject > &  effectParent,
const glm::mat4 &  modelMatrix = glm::mat4(1) 
)
SceneObject::SceneObject ( const std::string &  name,
Scene scene = 0,
Model model = 0,
const glm::mat4 &  modelMatrix = glm::mat4(1) 
)
SceneObject::~SceneObject ( )
virtual

Member Function Documentation

bool SceneObject::addChild ( std::shared_ptr< SceneObject > &  child)
bool SceneObject::addEffect ( const std::string &  name,
std::unique_ptr< SceneObject > &  effect 
)
bool SceneObject::animate ( double  time)
virtual
bool SceneObject::delChild ( size_t  idx)
bool SceneObject::doNotRender ( )
inline
void SceneObject::draw ( ) const
virtual
bool SceneObject::getChild ( size_t  idx,
std::shared_ptr< SceneObject > &  child 
) const
SceneObject * SceneObject::getEffect ( const std::string &  name) const
glm::mat4 SceneObject::getGlobalModelMatrix ( ) const
inline
bool SceneObject::getIsVolSun ( )
inline
Model* SceneObject::getModel ( ) const
inline
glm::mat4 SceneObject::getModelMatrix ( ) const
inline
std::string SceneObject::getName ( ) const
inline
std::shared_ptr<SceneObject> SceneObject::getParent ( ) const
inline
Shader* SceneObject::getShader ( ) const
inline
bool SceneObject::remEffect ( const std::string &  name)
void SceneObject::reset ( )
virtual
bool SceneObject::setAnimation ( const Animation anim)
void SceneObject::setAnimationTime ( double  time)
void SceneObject::setShader ( Shader val)
virtual
void SceneObject::update ( double  deltaT)
virtual

Member Data Documentation

Animation SceneObject::animation
protected
size_t SceneObject::animIDX
protected
std::vector<std::shared_ptr<SceneObject> > SceneObject::childs
protected
std::map<std::string, std::unique_ptr<SceneObject> > SceneObject::effectChilds
protected
bool SceneObject::isVolSun
protected
Model* SceneObject::model
protected
glm::mat4 SceneObject::modelMatrix
protected
std::string SceneObject::name
protected
bool SceneObject::norender
protected
std::weak_ptr<SceneObject> SceneObject::parent
protected
Scene* SceneObject::scene
protected
Shader* SceneObject::shader
protected
GLuint SceneObject::vao
protected

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