-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMesh.h
50 lines (36 loc) · 839 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
#pragma once
#include <fstream>
#include <vector>
using namespace std;
#include "SDL.h"
#include "Vector3.h"
#include "Math.h"
#include "Core.h"
#include "Log.h"
//triangle hold the 3 vert indexes that is in the meshes vert array
struct Tri {
int v1, v2, v3;
};
//mesh that can be loaded from triangle based Wavefront OBJ files that do not have materials or predefined normals
//need to modify obj files heavily to use it
class Mesh {
public:
//constructor
Mesh();
//load the mesh from a file
void Load(string fileName);
//get all the triangles
vector<Tri> GetTris();
//get all the vertices
vector<Vector3> GetVerts();
//get the center
Vector3 GetCenter();
protected:
//not translated verts
vector<Vector3> Vertices;
//tris
vector<Tri> Triangles;
//calculated center of the mesh
Vector3 Center;
private:
};