-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodelLoader.h
More file actions
38 lines (34 loc) · 932 Bytes
/
Copy pathmodelLoader.h
File metadata and controls
38 lines (34 loc) · 932 Bytes
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
#ifndef MODEL_LOADER_H
#define MODEL_LOADER_H
#include <string>
#include <vector>
#include <glm/glm.hpp>
#include "Model.h"
#include <tinyxml2.h>
struct ModelData {
std::string name;
std::string path;
glm::vec3 position;
glm::vec3 rotation;
glm::vec3 scale;
Model* model;
};
class ModelLoader {
public:
ModelLoader();
~ModelLoader();
bool loadFromXML(const std::string& xmlPath);
bool saveToXML(const std::string& xmlPath);
void drawModels(Shader& shader);
size_t getModelCount() const;
const ModelData* getModelData(size_t index) const;
ModelData* getModelData(size_t index);
void addModel(const std::string& name);
bool alreadyExist(const std::string& name) const;
void loadModelForIndex(size_t index);
private:
std::vector<ModelData> models;
glm::vec3 parseVectorElement(tinyxml2::XMLElement* element);
void cleanup();
};
#endif // MODEL_LOADER_H