SO3Engine
ALScene.h
Go to the documentation of this file.
1#ifndef ALSCENE_H
2#define ALSCENE_H
3
4#include <vector>
5
9
10#include "ALObject.h"
11#include "ALMaterial.h"
12#include "ALNode.h"
13#include "ALStringCleaner.h"
14
15// boost
16#include <boost/filesystem.hpp>
17
18// Tinyxml2
20
21namespace SO3
22{
23 //pre declaration
24 class ALSceneLoader;
25
26
30 class ALScene
31 {
32 public:
33 typedef std::unordered_map<std::string, std::string> AlTexturesMap;
35 ALScene();
36
37 ALScene(ALSceneLoader* alSceneLoader, SScene* scene, std::string ressourceGroup, const aiScene* loadedScene, SNode* parent, const std::string &sceneName, bool isLoaderMode = false);
38
40 ~ALScene();
41
42 aiMatrix4x4 getFullTransform(aiNode* toThis);
43
49 bool load(std::vector<SNode*> &scolNodes, std::vector<SMaterial*> &scolMats);
50
51
57 void convert(boost::filesystem::path exportFolder);
58
63 bool isEmpty();
64
69 bool addTextureRef(std::string name, std::string path);
70
75 std::string getTextureRef(std::string path);
76
78
79 const aiScene* getAiScene();
80
81 std::string getRessourceGroup();
82
83 std::string getRessourcePath();
84
85 std::string getSceneName();
86
87 std::set<std::string> getBonesNames();
88
90 bool isBone(aiNode* node);
91
92 bool haveMeshInHierarchy(aiNode* node);
93
94 bool isSceneDependent(aiNode* node);
95
96 const std::vector<std::string> getMaterialNames();
97
98 ALSceneLoader* GetSceneLoader(){ return mSceneLoader; }
99
100 bool IsLoaderModeEnable();
101
102 private:
103 bool loadNodes(aiNode* rootNode, std::vector<aiCamera*> cameras, std::vector<aiLight*> lights, std::vector<SNode*>& outNodes);
104
105 void convertNodes(aiNode* rootNode, std::vector<aiCamera*> cameras, std::vector<aiLight*> lights, boost::filesystem::path expPath, tinyxml2::XMLElement* document);
106
107 void setBones(aiNode* bone);
108
112 void loadMaterials(std::vector<bool> &vertexColorList, std::vector<SMaterial*> &matsList);
113
119 void convertMaterials(boost::filesystem::path expPath, std::vector<bool> &vertexColorList, std::vector<std::string> &matNames);
120
121 // Variables.
122 const aiScene* mScene;
123 ALSceneLoader* mSceneLoader;
124 SScene* scolScene;
125 bool isConverted;
126 bool mIsLoaderMode;
127 std::string resGroup;
128 std::string resPath;
129 std::string mSceneName;
130 std::vector<std::string> mMaterialNames;
131 std::set<std::string> mBonesNames;
132 SNode* parentNode;
133 AlTexturesMap mTextureMap;
134 };
135};
136
137#endif // ALSCENE_H
std::string getRessourceGroup()
Definition ALScene.cpp:497
bool load(std::vector< SNode * > &scolNodes, std::vector< SMaterial * > &scolMats)
Definition ALScene.cpp:73
const std::vector< std::string > getMaterialNames()
Definition ALScene.cpp:50
aiMatrix4x4 getFullTransform(aiNode *toThis)
Definition ALScene.cpp:60
bool haveMeshInHierarchy(aiNode *node)
Definition ALScene.cpp:525
SScene * getSScene()
Definition ALScene.cpp:487
ALScene()
Empty constructor. Can be used when you can't directly use the full constructor.
Definition ALScene.cpp:14
ALSceneLoader * GetSceneLoader()
Definition ALScene.h:98
bool isEmpty()
Definition ALScene.cpp:45
bool isSceneDependent(aiNode *node)
Definition ALScene.cpp:545
const aiScene * getAiScene()
Definition ALScene.cpp:492
bool addTextureRef(std::string name, std::string path)
Definition ALScene.cpp:468
void convert(boost::filesystem::path exportFolder)
Definition ALScene.cpp:195
std::string getSceneName()
Definition ALScene.cpp:507
std::string getTextureRef(std::string path)
Definition ALScene.cpp:478
std::set< std::string > getBonesNames()
Definition ALScene.cpp:512
bool isBone(aiNode *node)
Check if a node is a bone.
Definition ALScene.cpp:517
std::unordered_map< std::string, std::string > AlTexturesMap
Definition ALScene.h:33
bool IsLoaderModeEnable()
Definition ALScene.cpp:55
~ALScene()
Destructor.
Definition ALScene.cpp:41
std::string getRessourcePath()
Definition ALScene.cpp:502