diff options
author | Stijn Buys <ingar@osirion.org> | 2010-10-25 12:39:40 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-10-25 12:39:40 +0000 |
commit | 6a86e7f0f9e021498c1df44653a42643bd79dfbf (patch) | |
tree | f7921b43c16fd6228f94a0a06c5e325713fa6cce /src/model | |
parent | fa852cfee26d3bdff0e18589ffb00851b0c25775 (diff) |
corrects model triangle and quad count
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/asefile.cc | 2 | ||||
-rw-r--r-- | src/model/mapfile.cc | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/model/asefile.cc b/src/model/asefile.cc index afe74ea..c9dfe1c 100644 --- a/src/model/asefile.cc +++ b/src/model/asefile.cc @@ -694,7 +694,7 @@ Model *ASEFile::load(const std::string &name) for (FragmentGroup::Fragments::const_iterator fit = asefile.fragmentgroup()->fragments().begin(); fit != asefile.fragmentgroup()->fragments().end(); fit++) { const Fragment *fragment = (*fit); - model->model_tris_count += fragment->structural_size() + fragment->detail_size(); + model->model_tris_count += (fragment->structural_size() + fragment->detail_size()) / 3; } model->add_group(asefile.fragmentgroup()); diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index 32eee8a..47ea354 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -908,8 +908,9 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t count += fragment->add_vertex(quad->v1() - translation, quad->normal(), quad->t1(), false); count += fragment->add_vertex(quad->v2() - translation, quad->normal(), quad->t2(), false); count += fragment->add_vertex(quad->v3() - translation, quad->normal(), quad->t3(), false); - if (count == 4) + if (count == 4) { model->model_quad_count++; + } } } @@ -1427,8 +1428,20 @@ Model * MapFile::load(std::string const &name) // copy fragments, this only copies the original fragment's pointer into the vertex array for (FragmentGroup::Fragments::const_iterator fit = groupsrc->fragments().begin(); fit != groupsrc->fragments().end(); fit++) { + Fragment *fragmentdst = new Fragment(*(*fit)); groupdst->add_fragment(fragmentdst); + + switch (fragmentdst->type()) { + case Fragment::Triangles: + model->model_tris_count += (fragmentdst->structural_size() + fragmentdst->detail_size()) / 3; + model->model_tris_detail_count += fragmentdst->detail_size() / 3; + break; + case Fragment::Quads: + model->model_quad_count += (fragmentdst->structural_size() + fragmentdst->detail_size()) / 4; + model->model_quad_detail_count += fragmentdst->detail_size() / 4; + break; + } } if (groupdst->size()) { |