Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
scene.cpp
Go to the documentation of this file.
1#include "scene.hpp"
2#include "scene_manager.hpp"
3#include "camera_2d.hpp"
4#include "camera.hpp"
5#include "drawable_2d.hpp"
6#include "drawable_3d.hpp"
7
8namespace rendering_engine
9{
10
12 :
13 mSceneManager(sceneManager)
14{}
15
17{
18}
19
20void Scene::Update(float deltaTime)
21{
23 {
24 mActiveCamera2D->Update(deltaTime);
25 }
27 {
28 //mActiveCamera3D->Update(deltaTime);
29 }
30
31 for (auto& drawable2D : mDrawables2D)
32 {
33 drawable2D->Update(deltaTime);
34 }
35 for (auto& drawable3D : mDrawables3D)
36 {
37 //drawable3D->Update(deltaTime);
38 }
39}
40
42{
44 {
45 for (auto& drawable2D : mDrawables2D)
46 {
47 drawable2D->Draw(*mActiveCamera2D);
48 }
49 }
51 {
52 for (auto& drawable3D : mDrawables3D)
53 {
54 drawable3D->Draw(*mActiveCamera3D);
55 }
56 }
57}
58
60{
61 for (auto& drawable2D : mDrawables2D)
62 {
63 drawable2D->Shutdown();
64 }
65 for (auto& drawable3D : mDrawables3D)
66 {
67 drawable3D->Shutdown();
68 }
69}
70
75
76void Scene::LoadScene(std::string newSceneName)
77{
78 mSceneManager.LoadScene(newSceneName);
79}
80
81
82
83} // namespace rendering_engine
std::shared_ptr< Camera > mActiveCamera3D
Definition scene.hpp:91
virtual void Shutdown()
Releases scene-specific resources and prepares for shutdown.
Definition scene.cpp:59
std::vector< Drawable3D * > mDrawables3D
Definition scene.hpp:94
virtual void Update(float deltaTime)
Updates all objects within the scene.
Definition scene.cpp:20
void LoadScene(std::string newSceneName)
Requests to load another scene.
Definition scene.cpp:76
SceneManager & GetSceneManager()
Gets a reference to the SceneManager that owns this scene.
Definition scene.cpp:71
std::vector< Drawable2D * > mDrawables2D
Definition scene.hpp:95
virtual void Initialize()
Initializes scene resources and drawables.
Definition scene.cpp:16
SceneManager & mSceneManager
Definition scene.hpp:89
Scene(SceneManager &sceneManager)
Constructs a Scene instance associated with a SceneManager.
Definition scene.cpp:11
std::shared_ptr< Camera2D > mActiveCamera2D
Definition scene.hpp:92
virtual void Draw()
Renders all 3D and 2D drawables in the scene.
Definition scene.cpp:41
Manages scenes, resource caches, and scene transitions within the rendering engine.