Serializes and deserializes ECS entities and their registered components to/from JSON files.
More...
#include <SceneSerializer.hpp>
|
| | SceneSerializer (Registry ®istry, VulkanRenderer &renderer) |
| | Construct a new Scene Serializer object.
|
| bool | serialize (const std::string &path, const std::vector< Entity > &entities) |
| | Serializes a list of entities and their components to a JSON file.
|
| bool | deserialize (const std::string &path, std::vector< Entity > &outEntities) |
| | Deserializes entities and components from a JSON file.
|
| bool | deserializeFromString (const std::string &jsonContent, std::vector< Entity > &outEntities) |
| | Deserializes entities from a pre-loaded JSON string. Used by async loading: background thread reads the file, main thread calls this.
|
| bool | serializePrefab (const std::string &path, Entity rootEntity) |
| | Serializes a single entity and all its hierarchy children to a JSON prefab file.
|
| Entity | deserializePrefab (const std::string &path, std::vector< Entity > &loadedEntities, Entity parentEntity=Entity()) |
| | Deserializes a prefab file, instantiates entities, and remaps hierarchical parent-child references.
|
Serializes and deserializes ECS entities and their registered components to/from JSON files.
◆ SceneSerializer()
Construct a new Scene Serializer object.
Construct a new Scene Serializer:: Scene Serializer object.
- Parameters
-
| registry | Reference to the ECS Registry. |
| renderer | Reference to the Vulkan Renderer. |
| registry | Reference to ECS registry. |
| renderer | Reference to Vulkan renderer. |
◆ deserialize()
| bool SceneSerializer::deserialize |
( |
const std::string & | path, |
|
|
std::vector< Entity > & | outEntities ) |
Deserializes entities and components from a JSON file.
- Parameters
-
| path | Source filepath. |
| outEntities | Target list to fill with loaded entities. |
- Returns
- True if loading was successful, false otherwise.
◆ deserializeFromString()
| bool SceneSerializer::deserializeFromString |
( |
const std::string & | jsonContent, |
|
|
std::vector< Entity > & | outEntities ) |
Deserializes entities from a pre-loaded JSON string. Used by async loading: background thread reads the file, main thread calls this.
Deserializes scene entities from a JSON file.
- Parameters
-
| jsonContent | Raw JSON content string. |
| outEntities | Target list to fill with loaded entities. |
- Returns
- True if loading was successful, false otherwise.
- Parameters
-
| path | Source file path. |
| outEntities | Vector to store deserialized entities. |
- Returns
- True if successful, false otherwise.
Deserializes entities from a pre-loaded JSON string (no file I/O). Used by the async load pipeline: background thread pre-reads the file, main thread calls this to spawn entities and upload Vulkan resources.
◆ deserializePrefab()
| Entity SceneSerializer::deserializePrefab |
( |
const std::string & | path, |
|
|
std::vector< Entity > & | loadedEntities, |
|
|
Entity | parentEntity = Entity() ) |
Deserializes a prefab file, instantiates entities, and remaps hierarchical parent-child references.
- Parameters
-
| path | Source prefab filepath. |
| loadedEntities | Target list to fill with the newly spawned entities. |
| parentEntity | Optional parent entity to attach the newly created root under. |
- Returns
- The newly spawned root entity, or invalid entity if failed.
◆ serialize()
| bool SceneSerializer::serialize |
( |
const std::string & | path, |
|
|
const std::vector< Entity > & | entities ) |
Serializes a list of entities and their components to a JSON file.
Serializes a list of entities to a JSON file.
- Parameters
-
| path | Target filepath. |
| entities | List of entities to save. |
- Returns
- True if saving was successful, false otherwise.
- Parameters
-
| path | Target file path. |
| entities | List of entities to save. |
- Returns
- True if successful, false otherwise.
◆ serializePrefab()
| bool SceneSerializer::serializePrefab |
( |
const std::string & | path, |
|
|
Entity | rootEntity ) |
Serializes a single entity and all its hierarchy children to a JSON prefab file.
- Parameters
-
| path | Target filepath. |
| rootEntity | The root entity of the prefab hierarchy. |
- Returns
- True if successful, false otherwise.
◆ registry
◆ renderer
Reference to Vulkan renderer.
The documentation for this class was generated from the following files: