1 #ifndef SCENEOBJECT_HPP
2 #define SCENEOBJECT_HPP
8 #include <glm/vec3.hpp>
9 #include <glm/mat4x4.hpp>
30 class SceneObject :
public std::enable_shared_from_this<SceneObject> {
32 typedef std::vector<std::pair<double, glm::mat4> >
Animation;
49 bool getChild(
size_t idx, std::shared_ptr<SceneObject>& child)
const;
50 bool addChild(std::shared_ptr<SceneObject>& child);
54 bool addEffect(
const std::string& name, std::unique_ptr<SceneObject>& effect);
61 virtual void draw()
const;
62 virtual bool animate(
double time);
63 virtual void update(
double deltaT);
75 std::vector<std::shared_ptr<SceneObject> >
childs;
87 std::shared_ptr<SceneObject> node =
getParent();
89 M = node->getModelMatrix() * M;
90 node = node->getParent();
95 #endif //SCENEOBJECT_HPP
GLuint vao
Definition: sceneObject.hpp:67
SceneObject(std::shared_ptr< SceneObject > &effectParent, const glm::mat4 &modelMatrix=glm::mat4(1))
Definition: sceneObject.cpp:15
bool addChild(std::shared_ptr< SceneObject > &child)
Definition: sceneObject.cpp:193
virtual void update(double deltaT)
Definition: sceneObject.cpp:113
virtual void setShader(Shader *val)
Definition: sceneObject.cpp:128
Encapsulates a graphical object model in the GPU.
Definition: model.hpp:14
void setAnimationTime(double time)
Definition: sceneObject.cpp:211
glm::mat4 getModelMatrix() const
Definition: sceneObject.hpp:40
SceneObject * getEffect(const std::string &name) const
Definition: sceneObject.cpp:227
Model * model
Definition: sceneObject.hpp:69
std::vector< std::pair< double, glm::mat4 > > Animation
Definition: sceneObject.hpp:32
bool getIsVolSun()
Definition: sceneObject.hpp:58
std::map< std::string, std::unique_ptr< SceneObject > > effectChilds
Definition: sceneObject.hpp:76
size_t animIDX
Definition: sceneObject.hpp:78
Model * getModel() const
Definition: sceneObject.hpp:38
virtual ~SceneObject()
Definition: sceneObject.cpp:41
std::weak_ptr< SceneObject > parent
Definition: sceneObject.hpp:74
bool doNotRender()
Definition: sceneObject.hpp:57
virtual void reset()
Definition: sceneObject.cpp:108
Shader * getShader() const
Definition: sceneObject.hpp:39
virtual bool animate(double time)
Definition: sceneObject.cpp:118
std::string getName() const
Definition: sceneObject.hpp:42
bool addEffect(const std::string &name, std::unique_ptr< SceneObject > &effect)
Definition: sceneObject.cpp:235
Encapsulates the Rendering Engine, holds a complete scene and it's assets.
Definition: scene.hpp:71
Scene * scene
Definition: sceneObject.hpp:68
bool getChild(size_t idx, std::shared_ptr< SceneObject > &child) const
Definition: sceneObject.cpp:168
std::shared_ptr< SceneObject > getParent() const
Definition: sceneObject.hpp:43
std::string name
Definition: sceneObject.hpp:73
glm::mat4 modelMatrix
Definition: sceneObject.hpp:71
Encapsulates a shader program.
Definition: shader.hpp:9
bool norender
Definition: sceneObject.hpp:81
bool delChild(size_t idx)
Definition: sceneObject.cpp:179
bool remEffect(const std::string &name)
Definition: sceneObject.cpp:218
Animation animation
Definition: sceneObject.hpp:79
The base class of the objects which are rendered.
Definition: sceneObject.hpp:30
virtual void draw() const
Definition: sceneObject.cpp:46
Shader * shader
Definition: sceneObject.hpp:70
bool setAnimation(const Animation &anim)
Definition: sceneObject.cpp:203
glm::mat4 getGlobalModelMatrix() const
Definition: sceneObject.hpp:85
std::vector< std::shared_ptr< SceneObject > > childs
Definition: sceneObject.hpp:75
bool isVolSun
Definition: sceneObject.hpp:82