Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
scene_loading.hpp
Go to the documentation of this file.
1
10
11#ifndef FOOLSENGINE_SCENELOADING_H
12#define FOOLSENGINE_SCENELOADING_H
13
15
16#include "sim_system.hpp"
17#include "scene_system.hpp"
18
19namespace ToyMaker {
24
47 class SceneFromFile: public ResourceConstructor<SimObject, SceneFromFile> {
48 public:
49 SceneFromFile():
51 {}
52
58 static std::string getResourceConstructorName() { return "fromSceneFile"; }
59 private:
66 std::shared_ptr<IResource> createResource(const nlohmann::json& methodParams);
67 };
68
158 class SceneFromDescription: public ResourceConstructor<SimObject, SceneFromDescription> {
159 public:
160 SceneFromDescription():
162 {}
163
169 static std::string getResourceConstructorName() { return "fromSceneDescription"; }
170
171 private:
179 void loadResources(const nlohmann::json& resourceList);
180
187 std::shared_ptr<SimObject> loadSceneNodes(const nlohmann::json& nodeList);
188
195 void loadConnections(const nlohmann::json& connectionList, std::shared_ptr<SceneNodeCore> localRoot);
196
203 void overrideComponents(std::shared_ptr<SimObject> node, const nlohmann::json& componentList);
204
211 void overrideAspects(std::shared_ptr<SimObject> node, const nlohmann::json& aspectList);
212
219 std::shared_ptr<IResource> createResource(const nlohmann::json& methodParams) override;
220 };
221
229 class SceneNodeFromDescription: public ResourceConstructor<SceneNode, SceneNodeFromDescription> {
230 public:
231 SceneNodeFromDescription():
233 {}
234
235 static std::string getResourceConstructorName() { return "fromNodeDescription"; }
236 private:
237
238 std::shared_ptr<IResource> createResource(const nlohmann::json& methodParams) override;
239 };
240
248 class SimObjectFromDescription: public ResourceConstructor<SimObject, SimObjectFromDescription> {
249 public:
250 SimObjectFromDescription():
252 {}
253
254 static std::string getResourceConstructorName() { return "fromDescription"; }
255 private:
256 std::shared_ptr<IResource> createResource(const nlohmann::json& methodParameters);
257 };
258
302 class ViewportNodeFromDescription: public ResourceConstructor<ViewportNode, ViewportNodeFromDescription> {
303 public:
304 ViewportNodeFromDescription():
306 {}
307
308 static std::string getResourceConstructorName() { return "fromDescription"; }
309
310 private:
311 std::shared_ptr<IResource> createResource(const nlohmann::json& methodParameters);
312 };
313
314}
315
316#endif
ResourceConstructor(int explicitlyInitializeMe)
Definition resource_database.hpp:491
Constructs a scene tree (separate from the scene tree) based on its description in JSON.
Definition scene_loading.hpp:158
static std::string getResourceConstructorName()
Gets this constructor's resource constructor type string.
Definition scene_loading.hpp:169
std::shared_ptr< SimObject > loadSceneNodes(const nlohmann::json &nodeList)
Loads the scene nodes listed in the "nodes" section of the scene description.
Definition scene_loading.cpp:52
void loadResources(const nlohmann::json &resourceList)
Loads the resources listed in the resource section of this scene description.
Definition scene_loading.cpp:35
void overrideAspects(std::shared_ptr< SimObject > node, const nlohmann::json &aspectList)
(When used as a node in another scene) a list of overrides to SimObjectAspects to be applied to the r...
Definition scene_loading.cpp:156
std::shared_ptr< IResource > createResource(const nlohmann::json &methodParams) override
Actually creates a scene tree out of its JSON description.
Definition scene_loading.cpp:26
void loadConnections(const nlohmann::json &connectionList, std::shared_ptr< SceneNodeCore > localRoot)
Loads connections between nodes (functioning as SignalTrackers) within a scene.
Definition scene_loading.cpp:140
void overrideComponents(std::shared_ptr< SimObject > node, const nlohmann::json &componentList)
(When used as a node in another scene) a list of overrides to ECSWorld components to be applied to th...
Definition scene_loading.cpp:151
static std::string getResourceConstructorName()
The resource constructor type string associated with this constructor.
Definition scene_loading.hpp:58
std::shared_ptr< IResource > createResource(const nlohmann::json &methodParams)
Creates a resource from its JSON description stored in a file at the path specified.
Definition scene_loading.cpp:9
Constructs a scene node based on its description in JSON.
Definition scene_loading.hpp:229
std::shared_ptr< IResource > createResource(const nlohmann::json &methodParams) override
Creates a resource object using the parameters specified in methodParameters.
Definition scene_loading.cpp:162
Constructs a SimObject from its description in JSON.
Definition scene_loading.hpp:248
std::shared_ptr< IResource > createResource(const nlohmann::json &methodParameters)
Creates a resource object using the parameters specified in methodParameters.
Definition scene_loading.cpp:166
Constructs a ViewportNode from its description in JSON.
Definition scene_loading.hpp:302
std::shared_ptr< IResource > createResource(const nlohmann::json &methodParameters)
Creates a resource object using the parameters specified in methodParameters.
Definition scene_loading.cpp:170
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition camera_system.hpp:20
Headers relating to resources and their management for a given project.
System classes relating to the SceneSystem, which in some ways lies at the heart of the engine.
Classes and structs relating to the SimSystem, the system responsible for providing some level of gen...