14#include <unordered_map>
63 virtual void Update(
float deltaTime);
120 static std::unordered_map<std::string, Factory>& GetMap()
122 static std::unordered_map<std::string, Factory> map;
132 std::unique_ptr<Scene> mCurrentScene;
133 std::unique_ptr<Scene> mNextScene;
135 std::shared_ptr<TextureCache> mTextureCache;
136 std::shared_ptr<ModelCache> mModelCache;
137 std::shared_ptr<MaterialCache> mMaterialCache;
145template <
class TScene>
154 return std::make_unique<TScene>(sm);
163#define REG_SCENE(Type, NameStr) \
164 static rendering_engine::SceneAutoRegistrar<Type> \
165 _auto_registrar_##Type##__{NameStr}
177#define RE_CAT_INNER(a,b) a##b
178#define RE_CAT(a,b) RE_CAT_INNER(a,b)
188#define START_SCENE(NameStr) \
189 static StartSceneAutoSetter RE_CAT(_start_scene_, __COUNTER__){NameStr}
Defines a generic application interface for rendering-based programs.
Defines an abstract interface for rendering backends.
Manages creation, storage, and lifecycle of Material objects within the rendering engine.
Manages loading, caching, and GPU residency of all model/mesh resources.
Base class representing a renderable scene.
Manages scenes, resource caches, and scene transitions within the rendering engine.
virtual void Draw()
Draws the active scene using the associated renderer.
IApplication * GetApplication()
Returns the application associated with this SceneManager.
static std::string sStartSceneName
static bool RegisterScene(const std::string &name, Factory factory)
Registers a scene type with a name string.
virtual void Update(float deltaTime)
Updates the currently active scene.
static std::vector< std::pair< std::string, Factory > > & GetPendingRegistrations()
Type alias for the factory used to create scenes.
virtual void Shutdown()
Releases all scene-related resources and shuts down the manager.
void LoadScene(std::string sceneName)
Loads a new scene by name.
std::function< std::unique_ptr< Scene >(SceneManager &)> Factory
virtual void Initialize()
Initializes the current scene and related caches.
static std::unique_ptr< Scene > CreateScene(const std::string &name, SceneManager &sm)
Creates a scene instance by its registered name.
SceneManager(IRenderer *renderer, IApplication *app)
Constructs a SceneManager instance.
RenderResourceContext GetRenderResourceContext() const
Retrieves the current RenderResourceContext.
Manages texture loading, GPU uploading, and caching for reuse.
Aggregates pointers to global rendering resource managers.
SceneAutoRegistrar(const char *name)
StartSceneAutoSetter(const char *n)