-
Notifications
You must be signed in to change notification settings - Fork 0
/
mesh.hpp
68 lines (49 loc) · 1.1 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* @file mesh.hpp
* @brief Mesh class and OBJ loader.
*
* @author Eric Butler (edbutler)
* @author Zeyang Li (zeyangl)
*/
#ifndef _462_SCENE_MESH_HPP_
#define _462_SCENE_MESH_HPP_
#include "math/vector.hpp"
#include <vector>
#include <cassert>
namespace _462 {
struct MeshVertex
{
Vector3 position;
};
struct MeshTriangle
{
// index into the vertex list of the 3 vertices
unsigned int vertices[3];
};
/**
* A mesh of triangles.
*/
class Mesh
{
public:
Mesh();
virtual ~Mesh();
typedef std::vector< MeshTriangle > MeshTriangleList;
typedef std::vector< MeshVertex > MeshVertexList;
// The list of all triangles in this model.
MeshTriangleList triangles;
// The list of all vertices in this model.
MeshVertexList vertices;
// HACK scene loader stores the filename of the mesh here
std::string filename;
/**
* Loads the model into a list of triangles and vertices.
*/
bool load();
private:
// prevent copy/assignment
Mesh( const Mesh& );
Mesh& operator=( const Mesh& );
};
} /* _462 */
#endif /* _462_SCENE_MESH_HPP_ */