From 3be87402d2a63bf536bd712e0575b4f559af579a Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 15 Oct 2010 22:39:43 +0000 Subject: have the ASE reader respect the Material::Ignore flag --- src/model/asefile.cc | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/model') 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; - } } } -- cgit v1.2.3