-
Notifications
You must be signed in to change notification settings - Fork 0
/
mesh.hpp
49 lines (39 loc) · 962 Bytes
/
mesh.hpp
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
#ifndef MESH_HPP
#define MESH_HPP
#include <string>
#include <vector>
#include <utility>
#include <glm/glm.hpp>
#include "gl_core_3_3.h"
class Mesh {
public:
Mesh(std::string filename);
~Mesh() { release(); }
// Return the bounding box of this object
std::pair<glm::vec3, glm::vec3> boundingBox() const
{ return std::make_pair(minBB, maxBB); }
void load(std::string filename);
void draw();
// Mesh vertex format
struct Vtx {
glm::vec3 pos; // Position
glm::vec3 norm; // Normal
};
protected:
void release(); // Release OpenGL resources
// Bounding box
glm::vec3 minBB;
glm::vec3 maxBB;
// OpenGL resources
GLuint vao; // Vertex array object
GLuint vbuf; // Vertex buffer
public:
GLsizei vcount; // Number of vertices
private:
// Disallow copy and move
Mesh(const Mesh& other);
Mesh(Mesh&& other);
Mesh& operator=(const Mesh& other);
Mesh& operator=(Mesh&& other);
};
#endif