Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Loading...
Searching...
No Matches
SceneSerializer.hpp
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include <vector>
4#include "ecs/Entity.hpp"
5#include "ecs/Registry.hpp"
6
8
14public:
21
28 bool serialize(const std::string& path, const std::vector<Entity>& entities);
35 bool deserialize(const std::string& path, std::vector<Entity>& outEntities);
43 bool deserializeFromString(const std::string& jsonContent, std::vector<Entity>& outEntities);
44
51 bool serializePrefab(const std::string& path, Entity rootEntity);
52
60 Entity deserializePrefab(const std::string& path, std::vector<Entity>& loadedEntities, Entity parentEntity = Entity());
61
62private:
67};
Lightweight identifier representing a game object in the Entity Component System.
Definition Entity.hpp:11
Coordinates entities and components, providing creation, removal, lookup, and views.
Definition Registry.hpp:30
bool serialize(const std::string &path, const std::vector< Entity > &entities)
Serializes a list of entities and their components to a JSON file.
Definition SceneSerializer.cpp:1119
Registry & registry
Reference to registry.
Definition SceneSerializer.hpp:64
VulkanRenderer & renderer
Reference to Vulkan renderer.
Definition SceneSerializer.hpp:66
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 t...
Definition SceneSerializer.cpp:1209
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.
Definition SceneSerializer.cpp:1426
bool serializePrefab(const std::string &path, Entity rootEntity)
Serializes a single entity and all its hierarchy children to a JSON prefab file.
Definition SceneSerializer.cpp:1343
SceneSerializer(Registry &registry, VulkanRenderer &renderer)
Construct a new Scene Serializer object.
Definition SceneSerializer.cpp:1106
bool deserialize(const std::string &path, std::vector< Entity > &outEntities)
Deserializes entities and components from a JSON file.
Definition SceneSerializer.cpp:1224
Manages core Vulkan pipeline states, device interaction, frames, buffers, and command submissions.
Definition VulkanRenderer.hpp:127