blob: cd69b4e09a2b2b9329e7d5bce0c3b09d3f742231 (
plain)
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
|
/*
render/face.cc
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
#include "render/face.h"
#include "render/gl.h"
namespace render {
Face::Face(math::Vector3f const & normal) :
face_normal(normal)
{
face_normal.normalize();
}
Face::~Face()
{
for (std::vector<math::Vector3f *>::iterator it = face_vertex.begin(); it != face_vertex.end(); it++) {
delete (*it);
}
face_vertex.clear();
}
void Face::add_vertex(math::Vector3f const & vertex)
{
math::Vector3f *v = new math::Vector3f(vertex);
face_vertex.push_back(v);
}
void Face::draw()
{
gl::begin(gl::LineLoop);
for (std::vector<math::Vector3f *>::iterator it = face_vertex.begin(); it != face_vertex.end(); it++) {
gl::vertex(*(*it));
}
gl::end();
}
}
|