From d05cc1a41e0f5caa941f014bab3e4dc80d566c5c Mon Sep 17 00:00:00 2001 From: cignoni Date: Fri, 26 Jun 2009 23:19:52 +0000 Subject: [PATCH] made more robust the case of saving polygonal meshes --- wrap/io_trimesh/export_off.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/wrap/io_trimesh/export_off.h b/wrap/io_trimesh/export_off.h index 0b702ca6..15ecd556 100644 --- a/wrap/io_trimesh/export_off.h +++ b/wrap/io_trimesh/export_off.h @@ -31,8 +31,8 @@ #include #include -#include #include +#include namespace vcg { @@ -66,9 +66,9 @@ namespace vcg { fprintf(fpout,"OFF\n"); int polynumber; - if (mask &io::Mask::IOM_BITPOLYGONAL) polynumber = vcg::tri::Clean::CountBitPolygons(m); - else - polynumber = m.fn; + if (mask &io::Mask::IOM_BITPOLYGONAL) + polynumber = tri::Clean::CountBitLargePolygons(m); + else polynumber = m.fn; fprintf(fpout,"%d %d 0\n", m.vn, polynumber); // note that as edge number we simply write zero typename SaveMeshType::FaceIterator fi; @@ -108,12 +108,13 @@ namespace vcg { if (mask &io::Mask::IOM_BITPOLYGONAL) { - std::vector polygon; + std::vector polygon; for(fi=m.face.begin();fi!=m.face.end();++fi) if (!fi->IsD()) fi->ClearV(); for(fi=m.face.begin();fi!=m.face.end();++fi) if (!fi->IsD()) if (!fi->IsV()) { + assert(tri::HasFFAdjacency(m)); vcg::tri::PolygonSupport::ExtractPolygon(&*fi,polygon); - fprintf(fpout,"%d ", polygon.size() ); - for (size_t i=0; iUberFlags() ); + fprintf(fpout,"%d ", int(polygon.size()) ); + for (size_t i=0; iUberFlags() ); fprintf(fpout,"\n"); } } @@ -159,6 +160,7 @@ namespace vcg { capability |= vcg::tri::io::Mask::IOM_VERTCOORD; capability |= vcg::tri::io::Mask::IOM_VERTCOLOR; capability |= vcg::tri::io::Mask::IOM_FACEINDEX; + capability |= vcg::tri::io::Mask::IOM_BITPOLYGONAL; return capability; }