Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: 38990d5a7a35c6ac8a36957fef1cb08edc990a4f (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
/*
   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
{

Fragment::Fragment(Type type, unsigned int material)
{
	fragment_type = type;
	fragment_start = VertexArray::instance()->index();
	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 (detail)
		fragment_detail_size += n;
	else
		fragment_structural_size += n;
	return n;
}

}