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
SceneGraph.cpp
Go to the documentation of this file.
1 #include "Application.hpp"
2 
3 
5  : m_app(app)
6  , m_hasSceneChanged(true)
7 {
8 }
10 {
11 }
12 
14 {
15  m_hasSceneChanged = true;
16 
17  m_objects.erase(m_objects.find(object));
18  delete object;
19  object = nullptr;
20 }
21 
22 SceneGraph::object_list::iterator SceneGraph::begin()
23 {
24  return m_objects.begin();
25 }
26 SceneGraph::object_list::iterator SceneGraph::end()
27 {
28  return m_objects.end();
29 }
30 
31 void SceneGraph::update(double time, double timeDelta)
32 {
33  m_hasSceneChanged = false;
34 
35  for (auto& obj : m_objects)
36  {
37  auto hasObjChanged = obj->update(time, timeDelta);
38  m_hasSceneChanged = m_hasSceneChanged || hasObjChanged;
39  }
40 }
42 {
43  m_app->getSimpleMeshes().drawAll(args);
44  m_app->getScenes().drawAll(args);
45 }
Scenes & getScenes()
Definition: Application.hpp:71
void drawAll(DrawArgs &args)
Definition: Scene.cpp:842
Application * m_app
Definition: SceneGraph.hpp:14
void update(double time, double timeDelta)
Definition: SceneGraph.cpp:31
SimpleMeshes & getSimpleMeshes()
Definition: Application.hpp:66
object_list::iterator begin()
Definition: SceneGraph.cpp:22
void remove(ISceneObject *&object)
Definition: SceneGraph.cpp:13
object_list m_objects
Definition: SceneGraph.hpp:13
object_list::iterator end()
Definition: SceneGraph.cpp:26
bool m_hasSceneChanged
Definition: SceneGraph.hpp:15
void draw(DrawArgs &args)
Definition: SceneGraph.cpp:41
SceneGraph(Application *app)
Definition: SceneGraph.cpp:4
void drawAll(DrawArgs &args)
Definition: SimpleMesh.cpp:186