From 5c96b74c76b881b1533432a75d1a8cc42ecc5bda Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 23 Jul 2008 19:51:06 +0000 Subject: fragment renderer --- src/model/primitives.cc | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/model/primitives.cc (limited to 'src/model/primitives.cc') diff --git a/src/model/primitives.cc b/src/model/primitives.cc new file mode 100644 index 0000000..1b9d216 --- /dev/null +++ b/src/model/primitives.cc @@ -0,0 +1,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(unsigned int material) +{ + primitives_material = material; +} + +Primitives::~Primitives() +{ + // clear list of triangles + for (std::list::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::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); +} + +} -- cgit v1.2.3