Minor - Implements scene saving and loading - V12.10.0
Adds scene saving and loading functionality, using a component factory for dynamic component creation and serialization. This allows users to save and load the state of entities, including their components and textures. A new component factory is introduced to register and create different component types. Each component implements serialization and deserialization methods, which are used to store and restore the component's state. A new .ker scene file format is introduced to serialize entity data and to load it back into memory to restore the scene. Also adds a DemoScene_V12.9.0.ker file to showcase the engine.
This commit is contained in:
@@ -186,6 +186,28 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
std::string Serialize() const override {
|
||||
if (!m_model) return "RenderComponent:NoModel";
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "RenderComponent:HasModel";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
bool Deserialize(const std::string& data) override {
|
||||
std::stringstream ss(data);
|
||||
std::string type;
|
||||
std::getline(ss, type, ':');
|
||||
|
||||
if (type != "RenderComponent") return false;
|
||||
|
||||
std::string hasModel;
|
||||
std::getline(ss, hasModel);
|
||||
|
||||
// Le mod<6F>le sera charg<72> s<>par<61>ment
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<model_class> m_model;
|
||||
std::string m_modelFilePath;
|
||||
|
||||
Reference in New Issue
Block a user