Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: a53ebcdf70d898bd4a200c30559c028122863a40 (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
44
/*
   model/primitives.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/primitives.h"

namespace model
{

Primitives::Primitives(Material *material)
{
	primitives_material = material;
}

Primitives::~Primitives()
{
	// clear list of triangles
	for (std::list<Triangle *>::iterator tris_it = primitives_triangles.begin(); tris_it != primitives_triangles.end(); tris_it++)
		delete(*tris_it);
	primitives_triangles.clear();
	
	// clear list of quads
	for (std::list<Quad *>::iterator quad_it = primitives_quads.begin(); quad_it != primitives_quads.end(); quad_it++)
		delete(*quad_it);
	primitives_quads.clear();
}

void Primitives::add_triangle(math::Vector3f const &v0, math::Vector3f const &v1, math::Vector3f const &v2,
			      math::Vector3f const &normal, math::Color const &color, bool detail)
{
	Triangle *triangle = new Triangle(v0, v1, v2, normal, color, detail);
	primitives_triangles.push_back(triangle);
}

void Primitives::add_quad(math::Vector3f const &v0, math::Vector3f const &v1, math::Vector3f const &v2, math::Vector3f const &v3,
			  math::Vector3f const &normal, math::Color const &color, bool detail)
{
	Quad *quad = new Quad(v0, v1, v2, v3, normal, color, detail);
	primitives_quads.push_back(quad);
}

}