diff options
author | Stijn Buys <ingar@osirion.org> | 2008-07-23 19:51:06 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-07-23 19:51:06 +0000 |
commit | 5c96b74c76b881b1533432a75d1a8cc42ecc5bda (patch) | |
tree | a1500e0149ba03d017dd5fdb169a6538a7a06a61 /src/model/primitives.cc | |
parent | 1cf82068a2adff7c401fe0aba73466f045e460d3 (diff) |
fragment renderer
Diffstat (limited to 'src/model/primitives.cc')
-rw-r--r-- | src/model/primitives.cc | 44 |
1 files changed, 44 insertions, 0 deletions
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<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); +} + +} |