made more robust the case of saving polygonal meshes
This commit is contained in:
parent
e8908f7742
commit
d05cc1a41e
|
|
@ -31,8 +31,8 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <wrap/io_trimesh/io_mask.h>
|
#include <wrap/io_trimesh/io_mask.h>
|
||||||
#include <vcg/complex/trimesh/polygon_support.h>
|
|
||||||
#include <vcg/complex/trimesh/clean.h>
|
#include <vcg/complex/trimesh/clean.h>
|
||||||
|
#include <vcg/complex/trimesh/polygon_support.h>
|
||||||
|
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
|
|
@ -66,9 +66,9 @@ namespace vcg {
|
||||||
fprintf(fpout,"OFF\n");
|
fprintf(fpout,"OFF\n");
|
||||||
|
|
||||||
int polynumber;
|
int polynumber;
|
||||||
if (mask &io::Mask::IOM_BITPOLYGONAL) polynumber = vcg::tri::Clean<SaveMeshType>::CountBitPolygons(m);
|
if (mask &io::Mask::IOM_BITPOLYGONAL)
|
||||||
else
|
polynumber = tri::Clean<SaveMeshType>::CountBitLargePolygons(m);
|
||||||
polynumber = m.fn;
|
else polynumber = m.fn;
|
||||||
|
|
||||||
fprintf(fpout,"%d %d 0\n", m.vn, polynumber); // note that as edge number we simply write zero
|
fprintf(fpout,"%d %d 0\n", m.vn, polynumber); // note that as edge number we simply write zero
|
||||||
typename SaveMeshType::FaceIterator fi;
|
typename SaveMeshType::FaceIterator fi;
|
||||||
|
|
@ -108,12 +108,13 @@ namespace vcg {
|
||||||
|
|
||||||
if (mask &io::Mask::IOM_BITPOLYGONAL) {
|
if (mask &io::Mask::IOM_BITPOLYGONAL) {
|
||||||
|
|
||||||
std::vector<VertexPointer> polygon;
|
std::vector<VertexPointer> 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()) fi->ClearV();
|
||||||
for(fi=m.face.begin();fi!=m.face.end();++fi) if (!fi->IsD()) if (!fi->IsV()) {
|
for(fi=m.face.begin();fi!=m.face.end();++fi) if (!fi->IsD()) if (!fi->IsV()) {
|
||||||
|
assert(tri::HasFFAdjacency(m));
|
||||||
vcg::tri::PolygonSupport<SaveMeshType,SaveMeshType>::ExtractPolygon(&*fi,polygon);
|
vcg::tri::PolygonSupport<SaveMeshType,SaveMeshType>::ExtractPolygon(&*fi,polygon);
|
||||||
fprintf(fpout,"%d ", polygon.size() );
|
fprintf(fpout,"%d ", int(polygon.size()) );
|
||||||
for (size_t i=0; i<polygon.size(); i++) fprintf(fpout,"%d ", polygon[i]->UberFlags() );
|
for (size_t i=0; i<polygon.size(); i++) fprintf(fpout,"%d ", polygon[i]->UberFlags() );
|
||||||
fprintf(fpout,"\n");
|
fprintf(fpout,"\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -159,6 +160,7 @@ namespace vcg {
|
||||||
capability |= vcg::tri::io::Mask::IOM_VERTCOORD;
|
capability |= vcg::tri::io::Mask::IOM_VERTCOORD;
|
||||||
capability |= vcg::tri::io::Mask::IOM_VERTCOLOR;
|
capability |= vcg::tri::io::Mask::IOM_VERTCOLOR;
|
||||||
capability |= vcg::tri::io::Mask::IOM_FACEINDEX;
|
capability |= vcg::tri::io::Mask::IOM_FACEINDEX;
|
||||||
|
capability |= vcg::tri::io::Mask::IOM_BITPOLYGONAL;
|
||||||
return capability;
|
return capability;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue