Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-05-24 15:38:07 +0000
committerStijn Buys <ingar@osirion.org>2008-05-24 15:38:07 +0000
commit00464c237fbd3a01137099dedf23dc44569472fd (patch)
treecc6ccf2bc4f8279b240ae20d4d26c4572029e083 /src/model/map.cc
parent8017d60e4906a27c1dc82933593c3d5fd1c0bed4 (diff)
surface flags: light
Diffstat (limited to 'src/model/map.cc')
-rw-r--r--src/model/map.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/model/map.cc b/src/model/map.cc
index fea98e0..4b78f762 100644
--- a/src/model/map.cc
+++ b/src/model/map.cc
@@ -102,7 +102,7 @@ Model * Map::load(std::string const &name)
mapfile.close();
- if (VertexArray::instance() && ((mapfile.class_tris.size() + mapfile.class_etris.size()) > 0)) {
+ if (VertexArray::instance() && ((mapfile.class_tris.size() + mapfile.class_etris.size() + mapfile.class_ltris.size()) > 0)) {
math::Vector3f center = (mapfile.class_minbbox + mapfile.class_maxbbox) / 2;
@@ -161,6 +161,31 @@ Model * Map::load(std::string const &name)
}
mapfile.class_etris.clear();
+ // structural ltriangles
+ model->model_first_lvertex = VertexArray::instance()->index()/3;
+ for (std::list<Triangle *>::iterator it = mapfile.class_ltris.begin(); it != mapfile.class_ltris.end(); it++) {
+ Triangle *triangle = (*it);
+ if (!triangle->detail()) {
+ VertexArray::instance()->add_vertex(triangle->triangle_v0-center, triangle->normal(), triangle->color() );
+ VertexArray::instance()->add_vertex(triangle->triangle_v1-center, triangle->normal(), triangle->color() );
+ VertexArray::instance()->add_vertex(triangle->triangle_v2-center, triangle->normal(), triangle->color() );
+ model->model_lvertex_count += 3;
+ }
+ }
+
+ // detail ltriangles
+ for (std::list<Triangle *>::iterator it = mapfile.class_ltris.begin(); it != mapfile.class_ltris.end(); it++) {
+ Triangle *triangle = (*it);
+ if (triangle->detail()) {
+ VertexArray::instance()->add_vertex(triangle->triangle_v0-center, triangle->normal(), triangle->color() );
+ VertexArray::instance()->add_vertex(triangle->triangle_v1-center, triangle->normal(), triangle->color() );
+ VertexArray::instance()->add_vertex(triangle->triangle_v2-center, triangle->normal(), triangle->color() );
+ model->model_lvertex_countdetail += 3;
+ }
+ delete triangle;
+ }
+ mapfile.class_ltris.clear();
+
// reposition light and engines
for (std::list<Engine *>::iterator eit = model->model_engine.begin(); eit != model->model_engine.end(); eit++) {
(*eit)->engine_location -= center;