diff options
-rw-r--r-- | src/model/asefile.cc | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/model/asefile.cc b/src/model/asefile.cc index d94f103..f02c450 100644 --- a/src/model/asefile.cc +++ b/src/model/asefile.cc @@ -593,24 +593,27 @@ bool ASEFile::read_geom(std::istream &is) for (SubMaterialList::iterator smit = submateriallist->begin(); smit != submateriallist->end(); smit++) { size_t submaterial_index = (*smit).first; Material *material = (*smit).second; - - // load GEOMOBJECT triangles with matching material into the fragment - Fragment *fragment = new Fragment(Fragment::Triangles, material); - for (FaceList::iterator it = ase_facelist.begin(); it != ase_facelist.end(); it++) { + + if ((material->flags() & Material::Ignore) != Material::Ignore ) { + + // load GEOMOBJECT triangles with matching material into the fragment + Fragment *fragment = new Fragment(Fragment::Triangles, material); + for (FaceList::iterator it = ase_facelist.begin(); it != ase_facelist.end(); it++) { + + Triangle *triangle = (*it).second; + if (triangle->material_index() == submaterial_index) { + fragment->add_vertex((triangle->v0() * SCALE) , triangle->n0(), triangle->t0(), false); + fragment->add_vertex((triangle->v1() * SCALE) , triangle->n1(), triangle->t1(), false); + fragment->add_vertex((triangle->v2() * SCALE) , triangle->n2(), triangle->t2(), false); + } + } - Triangle *triangle = (*it).second; - if (triangle->material_index() == submaterial_index) { - fragment->add_vertex((triangle->v0() * SCALE) , triangle->n0(), triangle->t0(), false); - fragment->add_vertex((triangle->v1() * SCALE) , triangle->n1(), triangle->t1(), false); - fragment->add_vertex((triangle->v2() * SCALE) , triangle->n2(), triangle->t2(), false); + if (fragment->structural_size() + fragment->detail_size() > 0) { + ase_fragmentgroup->add_fragment(fragment); + } else { + delete fragment; } } - - if (fragment->structural_size() + fragment->detail_size() > 0) { - ase_fragmentgroup->add_fragment(fragment); - } else { - delete fragment; - } } } |