-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathD_Object.hpp
More file actions
82 lines (55 loc) · 1.33 KB
/
D_Object.hpp
File metadata and controls
82 lines (55 loc) · 1.33 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
#include <string>
#include <glm/glm.hpp>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <vector>
using namespace glm;
using std::string;
using std::vector;
struct Model {
// model files
string objFilename;
string textureFilename;
string materialTag;
int shader;
// model transformation
// float scale[3];
// float axisAngleRot[4];
// float translation[3];
float sx,sy,sz, rx,ry,rz,ra, tx,ty,tz;
// material properties
// float ambient[3];
// float diffuse[3];
// float specular[3];
// float shininess;
float ar,ag,ab, dr,dg,db, sr,sg,sb,ss;
};
struct Mesh {
vector<vec3> vertices;
vector<vec3> normals;
vector<vec2> uvs;
vector<unsigned short> indices;
};
class D_Object{
public:
D_Object(Mesh meh, GLuint tex);
D_Object(const char* object_path, const char* tex_path);
Mesh GetMesh();
GLuint**GetBuffers();
GLuint *getTexture();
void setShaderIdx(int idx);
int getShaderIdx();
mat4 getModelMatrix();
void set_translation(vec3 trans);
void set_rotation(float rot, vec3 rot_axis);
void set_scale(vec3 factor);
protected:
private:
vec3 translation, rotation_axis, scale_factor;
float rotation;
int shader_idx;
Mesh *mesh;
GLuint texture;
GLuint vbo, uvb, nb, ib;
GLuint **buffers;
};