-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathWorldLoader.h
More file actions
99 lines (84 loc) · 4.59 KB
/
Copy pathWorldLoader.h
File metadata and controls
99 lines (84 loc) · 4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//
// Created by engin on 10.03.2018.
//
#ifndef LIMONENGINE_WORLDLOADER_H
#define LIMONENGINE_WORLDLOADER_H
#include <Material.h>
#include <string>
#include <vector>
#include <tinyxml2.h>
#include "ALHelper.h"
#include "InputHandler.h"
#include "limonAPI/LimonAPI.h"
#include "GameObjects/Sound.h"
#include "limonAPI/ActorInterface.h"
#include "Profiler/ProfilerSystem.h"
class World;
class GraphicsInterface;
class AssetManager;
class GraphicsInterface;
class ALHelper;
class InputHandler;
class Model;
class Attachable;
class FrameTimeTracker;
class TransformTextureRing;
class WorldLoader {
public:
struct ObjectInformation {
Model* model = nullptr;
ActorInterface* modelActor = nullptr;
bool isAIGridStartPointSet = false;
glm::vec3 aiGridStartPoint = glm::vec3(0,0,0);
};
struct PendingAttachment {
Attachable* child;
uint32_t parentID;
int32_t parentBoneID;
const char* childTypeName; // just for the "not found" log line
};
private:
// bone parent goes through setParentObject/addChild/setParentTransform (bone transforms are
// identity at load, attachTo's world->local math would be wrong), everything else uses attachTo.
// no ModelGroup branch here, only loadObjectsFromXMLV2 needs that.
static void resolvePendingAttachments(World *world, const std::vector<PendingAttachment> &pending);
OptionsUtil::Options *options;
GraphicsInterface* graphicsWrapper;
ALHelper *alHelper;
std::shared_ptr<AssetManager> assetManager;
InputHandler* inputHandler;
ProfilerSystem* profilerSystem;
FrameTimeTracker* frameTimeTracker;
TransformTextureRing* modelTransformRing;
TransformTextureRing* boneTransformRing;
World *loadMapFromXML(const std::string &worldFileName, LimonAPI *limonAPI) const;
bool loadObjectGroupsFromXMLV1(tinyxml2::XMLNode *worldNode, World *world, LimonAPI *limonAPI,
std::vector<Model*> ¬StaticObjects, bool &isAIGridStartPointSet, glm::vec3 &aiGridStartPoint) const;
bool loadObjectGroupsFromXMLV2(tinyxml2::XMLNode *worldNode, World *world) const;
bool loadObjectsFromXML(tinyxml2::XMLNode *objectsNode, World *world, LimonAPI *limonAPI, int saveVersion) const;
bool loadObjectsFromXMLV2(tinyxml2::XMLNode *objectsNode, World *world, LimonAPI *limonAPI) const;
void loadPlayerAttachmentV1(tinyxml2::XMLElement* attachmentNode, World* world, LimonAPI* limonAPI) const;
bool loadSkymap(tinyxml2::XMLNode *skymapNode, World* world) const;
bool loadLights(tinyxml2::XMLNode *lightsNode, World* world) const;
bool loadSounds(tinyxml2::XMLNode *worldNode, World* world) const;
bool loadCameraRigs(tinyxml2::XMLNode *worldNode, World* world) const;
bool loadParticleEmitters(tinyxml2::XMLNode *EmittersNode, World* world) const;
bool loadGPUParticleEmitters(tinyxml2::XMLNode *GPUEmittersNode, World* world) const;
bool loadAnimations(tinyxml2::XMLNode *worldNode, World *world) const;
bool loadTriggers(tinyxml2::XMLNode *worldNode, World *world) const;
bool loadOnLoadActions(tinyxml2::XMLNode *worldNode, World *world) const;
bool loadOnLoadAnimations(tinyxml2::XMLNode *worldNode, World *world) const;
bool loadGUILayersAndElements(tinyxml2::XMLNode *worldNode, World *world) const;
bool loadMaterials(tinyxml2::XMLNode *worldNode, World *world) const;
public:
WorldLoader(std::shared_ptr<AssetManager> assetManager, InputHandler *inputHandler, OptionsUtil::Options *options, ProfilerSystem* profilerSystem, FrameTimeTracker* frameTimeTracker, TransformTextureRing* modelTransformRing, TransformTextureRing* boneTransformRing);
std::unique_ptr<std::string> getLoadingImage(const std::string &worldFile) const;
World *loadWorld(const std::string &worldFile, LimonAPI *limonAPI) const;
static std::vector<std::unique_ptr<ObjectInformation>> loadObject( std::shared_ptr<AssetManager> assetManager, tinyxml2::XMLElement *objectNode,
std::unordered_map<std::string, std::shared_ptr<Sound>> &requiredSounds, LimonAPI *limonAPI,
PhysicalRenderable *parentObject);
static std::vector<std::unique_ptr<ObjectInformation>> loadObjectV2(std::shared_ptr<AssetManager> assetManager, tinyxml2::XMLElement *objectNode,
std::unordered_map<std::string, std::shared_ptr<Sound>> &requiredSounds, LimonAPI *limonAPI);
static void loadObjectTags(tinyxml2::XMLElement *objectNode, Model *model);
};
#endif //LIMONENGINE_WORLDLOADER_H