![]() |
Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
|
Manages scenes, resource caches, and scene transitions within the rendering engine. More...
#include <scene_manager.hpp>
Public Types | |
| using | Factory = std::function<std::unique_ptr<Scene>(SceneManager&)> |
Public Member Functions | |
| SceneManager (IRenderer *renderer, IApplication *app) | |
| Constructs a SceneManager instance. | |
| ~SceneManager () | |
| Destructor. Cleans up resources and active scenes. | |
| virtual void | Initialize () |
| Initializes the current scene and related caches. | |
| virtual void | Update (float deltaTime) |
| Updates the currently active scene. | |
| virtual void | Draw () |
| Draws the active scene using the associated renderer. | |
| virtual void | Shutdown () |
| Releases all scene-related resources and shuts down the manager. | |
| IApplication * | GetApplication () |
| Returns the application associated with this SceneManager. | |
| void | LoadScene (std::string sceneName) |
| Loads a new scene by name. | |
| RenderResourceContext | GetRenderResourceContext () const |
| Retrieves the current RenderResourceContext. | |
Static Public Member Functions | |
| static std::vector< std::pair< std::string, Factory > > & | GetPendingRegistrations () |
| Type alias for the factory used to create scenes. | |
| static bool | RegisterScene (const std::string &name, Factory factory) |
| Registers a scene type with a name string. | |
| static std::unique_ptr< Scene > | CreateScene (const std::string &name, SceneManager &sm) |
| Creates a scene instance by its registered name. | |
Static Public Attributes | |
| static std::string | sStartSceneName |
Manages scenes, resource caches, and scene transitions within the rendering engine.
SceneManager handles the creation, updating, and rendering of scenes. It maintains ownership of core caches (TextureCache, ModelCache, MaterialCache), and provides the RenderResourceContext that allows drawable objects to access shared rendering resources.
The class also supports dynamic scene registration through factories, enabling runtime creation of scenes by name.
Definition at line 41 of file scene_manager.hpp.
| using rendering_engine::SceneManager::Factory = std::function<std::unique_ptr<Scene>(SceneManager&)> |
Definition at line 44 of file scene_manager.hpp.
| rendering_engine::SceneManager::SceneManager | ( | IRenderer * | renderer, |
| IApplication * | app ) |
Constructs a SceneManager instance.
| renderer | Pointer to the active renderer instance. |
| app | Pointer to the owning application instance. |
Definition at line 13 of file scene_manager.cpp.
| rendering_engine::SceneManager::~SceneManager | ( | ) |
Destructor. Cleans up resources and active scenes.
Definition at line 21 of file scene_manager.cpp.
|
static |
Creates a scene instance by its registered name.
| name | The name of the registered scene type. |
| sm | Reference to the SceneManager creating the scene. |
Definition at line 145 of file scene_manager.cpp.
|
virtual |
Draws the active scene using the associated renderer.
Definition at line 93 of file scene_manager.cpp.
| IApplication * rendering_engine::SceneManager::GetApplication | ( | ) |
Returns the application associated with this SceneManager.
Definition at line 112 of file scene_manager.cpp.
|
static |
Type alias for the factory used to create scenes.
Definition at line 117 of file scene_manager.cpp.
| RenderResourceContext rendering_engine::SceneManager::GetRenderResourceContext | ( | ) | const |
Retrieves the current RenderResourceContext.
The RenderResourceContext provides references to shared caches (material, model, texture) and allows drawable objects to access resources during initialization and rendering.
Definition at line 128 of file scene_manager.cpp.
|
virtual |
Initializes the current scene and related caches.
Definition at line 25 of file scene_manager.cpp.
| void rendering_engine::SceneManager::LoadScene | ( | std::string | sceneName | ) |
Loads a new scene by name.
| sceneName | The name of the registered scene to load. |
If the scene has been registered via SceneAutoRegistrar, it will be instantiated and prepared for initialization on the next update.
Definition at line 123 of file scene_manager.cpp.
|
static |
Registers a scene type with a name string.
| name | Unique string identifier for the scene. |
| factory | Function that constructs the scene when requested. |
Definition at line 139 of file scene_manager.cpp.
|
virtual |
Releases all scene-related resources and shuts down the manager.
Definition at line 101 of file scene_manager.cpp.
|
virtual |
Updates the currently active scene.
| deltaTime | Time elapsed since the previous frame, in milliseconds. |
Definition at line 73 of file scene_manager.cpp.
|
inlinestatic |
Definition at line 126 of file scene_manager.hpp.