Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
scene_manager.h
1 #pragma once
2 
3 #include "util/shared_ptr.h"
4 #include "util/vector.h"
5 #include "util/queue.h"
6 #include "core/scene/entity.h"
7 #include "renderer/cameras/camera.h"
8 
9 namespace blowbox
10 {
20  {
21  friend class BlowboxCore;
22  friend class EntityFactory;
23  friend class Entity;
24  public:
29  SceneManager();
30 
32  ~SceneManager();
33 
34  protected:
36  void Startup();
37 
39  void Update();
40 
42  void PostUpdate();
43 
45  void Shutdown();
46 
51  void AddEntity(SharedPtr<Entity> entity);
52 
57  void RemoveEntity(SharedPtr<Entity> entity);
58 
59  public:
65 
71 
76  const Vector<SharedPtr<Entity>>& GetEntities() const;
77 
82  void SetMainCamera(SharedPtr<Camera> camera);
83 
86 
87  private:
90 
93 
95  };
96 }
void Update()
Updates the entire scene.
Definition: scene_manager.cc:30
SharedPtr< Entity > GetRootEntity()
Returns the root Entity.
Definition: scene_manager.cc:109
The Blowbox equivalent of a game object.
Definition: entity.h:26
eastl::vector< T > Vector
Typedef for wrapping the EASTL vector.
Definition: vector.h:14
Manages the entire scene.
Definition: scene_manager.h:19
SharedPtr< Entity > root_entity_
The root Entity in the scene.
Definition: scene_manager.h:88
void AddEntity(SharedPtr< Entity > entity)
Adds an Entity and all of its children to the scene.
Definition: scene_manager.cc:75
Factory for creating Entity instances and managing Entity children.
Definition: entity_factory.h:16
Queue< SharedPtr< Entity > > entities_to_be_added_
Queue for Entity instances that need to be added to the scene.
Definition: scene_manager.h:91
void Startup()
Starts up the entire scene.
Definition: scene_manager.cc:22
The core of Blowbox.
Definition: blowbox_core.h:53
void RemoveEntity(SharedPtr< Entity > entity)
Removes an Entity and all of its children from the scene.
Definition: scene_manager.cc:86
eastl::queue< T > Queue
Typedef for wrapping the EASTL queue.
Definition: queue.h:14
void Shutdown()
Shuts down the entire scene.
Definition: scene_manager.cc:69
SharedPtr< Camera > GetMainCamera()
Definition: scene_manager.cc:103
The main Blowbox namespace.
Definition: image.cc:8
Queue< SharedPtr< Entity > > entities_to_be_removed_
Queue for Entity instances that need to be removed from the scene.
Definition: scene_manager.h:92
SharedPtr< Camera > main_camera_
Stores the main camera for the scene.
Definition: scene_manager.h:94
~SceneManager()
Destructs the SceneManager.
Definition: scene_manager.cc:16
eastl::shared_ptr< T > SharedPtr
Typedef for wrapping the EASTL shared_ptr.
Definition: shared_ptr.h:14
SceneManager()
Constructs the SceneManager.
Definition: scene_manager.cc:10
Vector< SharedPtr< Entity > > all_entities_
All Entity instances in the scene.
Definition: scene_manager.h:89
Vector< SharedPtr< Entity > > & GetEntities()
Returns all the Entity instances in the scene.
Definition: scene_manager.cc:115
void SetMainCamera(SharedPtr< Camera > camera)
Sets the main Camera of this scene, i.e. the camera from where the scene is rendered.
Definition: scene_manager.cc:97
void PostUpdate()
PostUpdates the entire scene.
Definition: scene_manager.cc:40