-
Notifications
You must be signed in to change notification settings - Fork 0
/
Model.h
71 lines (45 loc) · 1.14 KB
/
Model.h
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
/*
* Model.h
*
* Created on: 2011-11-12
* Author: zapo
*/
#ifndef MODEL_H_
#define MODEL_H_
#include "Shader.h"
#include "VertexBuffer.h"
#include <boost/unordered_map.hpp>
#include <string>
#include <map>
namespace Bomber {
class Model {
public:
Model();
virtual ~Model();
void SetTextureRepeat(bool repeat) {
textureRepeat = repeat;
}
virtual void Render();
virtual void Update() {
update_time.Reset();
}
static const unsigned int ordering[24];
inline GLuint GetIndexAt(Vertex3D & vertex) {
return vertices_indexes[&vertex];
}
protected:
std::string LoadSource(std::string filename);
GLuint LoadShader(GLenum type, std::string filename);
boost::unordered_map<unsigned int, Shader *> shaders;
boost::unordered_map<unsigned int, Shader *>::iterator shaders_it;
sf::Image mainTexture;
sf::Clock update_time;
bool textureRepeat;
boost::unordered_map<unsigned int, VertexBuffer *> buffers;
boost::unordered_map<unsigned int, VertexBuffer *>::iterator buffers_it;
std::vector<Vertex3D*> vertices;
std::vector<GLuint> indexes;
boost::unordered_map<Vertex3D*, GLuint> vertices_indexes;
};
}
#endif /* MODEL_H_ */