fix off polygon export
This commit is contained in:
parent
094918662b
commit
0f320aa671
|
@ -24,6 +24,9 @@
|
||||||
#ifndef __VCGLIB_POLYGON_SUPPORT
|
#ifndef __VCGLIB_POLYGON_SUPPORT
|
||||||
#define __VCGLIB_POLYGON_SUPPORT
|
#define __VCGLIB_POLYGON_SUPPORT
|
||||||
|
|
||||||
|
#include <vcg/complex/allocate.h>
|
||||||
|
#include <vcg/complex/base.h>
|
||||||
|
#include <vcg/complex/algorithms/update/flag.h>
|
||||||
#include <vcg/simplex/face/jumping_pos.h>
|
#include <vcg/simplex/face/jumping_pos.h>
|
||||||
#include <vcg/space/planar_polygon_tessellation.h>
|
#include <vcg/space/planar_polygon_tessellation.h>
|
||||||
|
|
||||||
|
|
|
@ -104,10 +104,17 @@ public:
|
||||||
tri::UpdateFlags<SaveMeshType>::FaceClearV(m);
|
tri::UpdateFlags<SaveMeshType>::FaceClearV(m);
|
||||||
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) if (!fi->IsD()) if (!fi->IsV()) {
|
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) if (!fi->IsD()) if (!fi->IsV()) {
|
||||||
vcg::tri::PolygonSupport<SaveMeshType,SaveMeshType>::ExtractPolygon(&*fi,polygon);
|
vcg::tri::PolygonSupport<SaveMeshType,SaveMeshType>::ExtractPolygon(&*fi,polygon);
|
||||||
|
//not sure why this std::reverse is needed. ExtractPolygon is used in
|
||||||
|
//many other functions, and nobody complained. however, this list is
|
||||||
|
//clockwise wrt fi normal.
|
||||||
|
std::reverse(polygon.begin(), polygon.end());
|
||||||
if(!polygon.empty())
|
if(!polygon.empty())
|
||||||
{
|
{
|
||||||
fprintf(fpout,"%d ", int(polygon.size()) );
|
fprintf(fpout,"%d ", int(polygon.size()) );
|
||||||
for (size_t i=0; i<polygon.size(); i++) fprintf(fpout,"%d ", polygon[i]->Flags() );
|
for (size_t i=0; i<polygon.size(); i++)
|
||||||
|
fprintf(fpout,"%lu ", tri::Index(m,polygon[i]));
|
||||||
|
if( tri::HasPerFaceColor(m) && (mask & io::Mask::IOM_FACECOLOR) )
|
||||||
|
fprintf(fpout,"%i %i %i", fi->C()[0],fi->C()[1],fi->C()[2] );
|
||||||
fprintf(fpout,"\n");
|
fprintf(fpout,"\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue