-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathModel.cpp
More file actions
81 lines (59 loc) · 1.71 KB
/
Model.cpp
File metadata and controls
81 lines (59 loc) · 1.71 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
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <cpp3ds/Graphics/Model.hpp>
namespace cpp3ds
{
////////////////////////////////////////////////////////////
Model::~Model()
{
}
////////////////////////////////////////////////////////////
unsigned int Model::getFaceCount() const
{
return m_faces.size();
}
////////////////////////////////////////////////////////////
Polyhedron::Face Model::getFace(unsigned int index) const
{
Face face = {m_vertices[m_faces[index].index0],
m_vertices[m_faces[index].index1],
m_vertices[m_faces[index].index2]};
return face;
}
////////////////////////////////////////////////////////////
Model::Model()
{
}
////////////////////////////////////////////////////////////
void Model::addVertex(const Vertex& vertex)
{
m_vertices.push_back(vertex);
}
////////////////////////////////////////////////////////////
void Model::setVertex(unsigned int index, const Vertex& vertex)
{
m_vertices[index] = vertex;
}
////////////////////////////////////////////////////////////
const Vertex& Model::getVertex(unsigned int index) const
{
return m_vertices[index];
}
////////////////////////////////////////////////////////////
unsigned int Model::getVertexCount() const
{
return m_vertices.size();
}
////////////////////////////////////////////////////////////
void Model::addFace(unsigned int index0, unsigned int index1, unsigned int index2)
{
FaceIndices face = {index0, index1, index2};
m_faces.push_back(face);
}
////////////////////////////////////////////////////////////
void Model::clearFaces()
{
m_faces.clear();
}
} // namespace cpp3ds