blob: b655807565db4f5fda25ffe70982369e9d7c7b98 (
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
|
/*
model/fragment.cc
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2
*/
#include "model/fragment.h"
#include "model/vertexarray.h"
namespace model
{
/*
Triangles: the number of triangles is size/3
Quads: the number of Quads is size/4
*/
Fragment::Fragment(Type type, unsigned int material)
{
fragment_type = type;
fragment_index = VertexArray::instance()->index() / 3;
fragment_material = material;
fragment_structural_size = 0;
fragment_detail_size = 0;
}
size_t Fragment::add_vertex(math::Vector3f const & vertex, math::Vector3f const &normal, math::Color const & color, bool detail)
{
size_t n = VertexArray::instance()->add_vertex(vertex, normal, color);
if (n) {
if (detail)
fragment_detail_size += n;
else
fragment_structural_size += n;
}
return n;
}
}
|