-
Notifications
You must be signed in to change notification settings - Fork 1
/
Mesh.h
51 lines (43 loc) · 967 Bytes
/
Mesh.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
#ifndef MESH_H
#define MESH_H
#include <stdlib.h>
#include <string>
#include <GL/glew.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
#include "glm/glm.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtc/type_ptr.hpp"
#include <vector>
class Mesh {
public:
std::vector<glm::vec4> vertices;
std::vector<glm::vec3> normals;
std::vector<glm::vec2> texcoords;
std::vector<glm::vec3> tangents;
std::vector<GLushort> elements;
glm::mat4 object2world;
Mesh();
~Mesh();
/**
* Express surface tangent in object space
* http://www.terathon.com/code/tangent.html
* http://www.3dkingdoms.com/weekly/weekly.php?a=37
*/
void compute_tangents();
/**
* Store object vertices, normals and/or elements in graphic card
* buffers
*/
void upload();
/**
* Draw the object
*/
void draw();
private:
GLuint vbo_vertices, vbo_normals, vbo_texcoords, vbo_tangents, ibo_elements;
};
#endif