Abstract base class representing a game scene, managing entity lifecycle and persistence.
More...
#include <Scene.hpp>
|
| | Scene (Registry ®istry, VulkanRenderer &renderer) |
| | Construct a new Scene object.
|
| virtual | ~Scene () |
| | Destroy the Scene object, unloading remaining entities.
|
| virtual void | load ()=0 |
| | Pure virtual method called to load scene assets and entities.
|
| virtual void | update (float dt)=0 |
| | Pure virtual method called every frame to update scene logic.
|
| virtual void | unload () |
| | Method called to clean up scene state and entities.
|
| virtual bool | saveToFile (const std::string &path) |
| | Serializes scene entities to a JSON file.
|
| virtual bool | loadFromFile (const std::string &path) |
| | Deserializes scene entities from a JSON file.
|
| virtual Entity | createPrimitiveEntity (const std::string &primitiveType) |
| | Helper to spawn primitive geometric entities.
|
| virtual Entity | createEntityOfType (const std::string &entityType) |
| | Helper to spawn complex predefined entities (Camera, Grid).
|
| virtual Entity | duplicateEntity (Entity entity) |
| | Duplicates an existing entity.
|
| virtual bool | deleteEntity (Entity entity) |
| | Destroys an entity and removes it from scene tracking.
|
| Entity | trackEntity (Entity entity) |
| | Tracks an entity under scene ownership.
|
| void | untrackEntity (Entity entity) |
| | Stops tracking an entity.
|
| std::string | makeUniqueEntityName (const std::string &baseName) const |
| | Generates a unique name for an entity by appending indices if duplicate.
|
Abstract base class representing a game scene, managing entity lifecycle and persistence.
◆ Scene()
Construct a new Scene object.
Construct a new Scene:: Scene object.
- Parameters
-
| registry | Reference to the ECS Registry. |
| renderer | Reference to the Vulkan Renderer. |
| registry | Reference to ECS registry. |
| renderer | Reference to renderer. |
◆ ~Scene()
Destroy the Scene object, unloading remaining entities.
Destroy the Scene:: Scene object.
◆ createEntityOfType()
| Entity Scene::createEntityOfType |
( |
const std::string & | entityType | ) |
|
|
virtual |
Helper to spawn complex predefined entities (Camera, Grid).
Spawns a component helper entity ("Camera", "Grid").
- Parameters
-
| entityType | Kind of entity. |
- Returns
- The spawned Entity.
- Parameters
-
- Returns
- Spawned entity handle.
◆ createPrimitiveEntity()
| Entity Scene::createPrimitiveEntity |
( |
const std::string & | primitiveType | ) |
|
|
virtual |
Helper to spawn primitive geometric entities.
Spawns a primitive shape entity.
- Parameters
-
| primitiveType | Kind of primitive (Triangle, Cube, Quad). |
- Returns
- The spawned Entity.
- Parameters
-
| primitiveType | Shape type string ("Triangle", "Cube", "Quad"). |
- Returns
- Spawned entity handle.
◆ deleteEntity()
| bool Scene::deleteEntity |
( |
Entity | entity | ) |
|
|
virtual |
Destroys an entity and removes it from scene tracking.
Deletes and destroys the target entity.
- Parameters
-
- Returns
- True if successfully deleted.
- Parameters
-
- Returns
- True if successful, false otherwise.
◆ duplicateEntity()
Duplicates an existing entity.
Clones the target entity.
- Parameters
-
- Returns
- Cloned Entity.
- Parameters
-
- Returns
- Duplicated entity handle.
◆ findEntityByName()
| Entity Scene::findEntityByName |
( |
const std::string & | name | ) |
const |
|
protected |
Locates an entity by its Name component.
Resolves active entity matching name property.
- Parameters
-
- Returns
- Entity handle if found, invalid Entity otherwise.
- Parameters
-
- Returns
- Entity handle.
◆ load()
| virtual void Scene::load |
( |
| ) |
|
|
pure virtual |
◆ loadFromFile()
| bool Scene::loadFromFile |
( |
const std::string & | path | ) |
|
|
virtual |
Deserializes scene entities from a JSON file.
Deserializes and loads scene entities from file.
- Parameters
-
- Returns
- True if load was successful.
- Parameters
-
- Returns
- True if successful, false otherwise.
◆ makeUniqueEntityName()
| std::string Scene::makeUniqueEntityName |
( |
const std::string & | baseName | ) |
const |
Generates a unique name for an entity by appending indices if duplicate.
Creates unique suffix indices if name conflicts.
- Parameters
-
- Returns
- Unique name.
- Parameters
-
- Returns
- Unique name.
◆ saveToFile()
| bool Scene::saveToFile |
( |
const std::string & | path | ) |
|
|
virtual |
Serializes scene entities to a JSON file.
Serializes scene entities to file.
- Parameters
-
- Returns
- True if save was successful.
- Parameters
-
- Returns
- True if successful, false otherwise.
◆ trackEntity()
Tracks an entity under scene ownership.
Registers entity under scene tracking list.
- Parameters
-
- Returns
- Tracked entity.
- Parameters
-
- Returns
- Tracked entity.
◆ unload()
Method called to clean up scene state and entities.
Destroys all entities tracked by this scene.
◆ untrackEntity()
| void Scene::untrackEntity |
( |
Entity | entity | ) |
|
Stops tracking an entity.
Removes entity from scene tracking list.
- Parameters
-
| entity | Entity to untrack. |
| entity | Target entity. |
◆ update()
| virtual void Scene::update |
( |
float | dt | ) |
|
|
pure virtual |
Pure virtual method called every frame to update scene logic.
- Parameters
-
Implemented in Engine::DefaultScene.
◆ ownedEntities
| std::vector<Entity> Scene::ownedEntities |
|
private |
List of entities owned by this scene.
◆ registry
◆ renderer
Reference to Vulkan renderer.
The documentation for this class was generated from the following files: