fix off polygon export
This commit is contained in:
parent
094918662b
commit
0f320aa671
|
@ -24,6 +24,9 @@
|
|||
#ifndef __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/space/planar_polygon_tessellation.h>
|
||||
|
||||
|
@ -141,8 +144,8 @@ namespace tri {
|
|||
{
|
||||
std::vector<typename TriMeshType::VertexPointer> vs;// vertices of the polygon
|
||||
ExtractPolygon(&*tfi,vs);
|
||||
if (vs.size() > 3)
|
||||
std::reverse(vs.begin(), vs.end());
|
||||
if (vs.size() > 3)
|
||||
std::reverse(vs.begin(), vs.end());
|
||||
//now vs contains all the vertices of the polygon (still in the trimesh)
|
||||
if (vs.size()==0)continue;
|
||||
typename PolyMeshType::FaceIterator pfi = tri::Allocator<PolyMeshType>::AddFaces(pm,1);
|
||||
|
|
|
@ -104,10 +104,17 @@ public:
|
|||
tri::UpdateFlags<SaveMeshType>::FaceClearV(m);
|
||||
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);
|
||||
//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())
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue