First really working version. Previous code saved a wrong off....
This commit is contained in:
parent
a927c50c8d
commit
5652756eaf
|
@ -62,56 +62,51 @@ namespace vcg {
|
||||||
if( m.HasPerVertexColor() && (mask & io::Mask::IOM_VERTCOLOR)) fprintf(fpout,"C");
|
if( m.HasPerVertexColor() && (mask & io::Mask::IOM_VERTCOLOR)) fprintf(fpout,"C");
|
||||||
if( m.HasPerVertexTexture() && (mask & io::Mask::IOM_VERTTEXCOORD)) fprintf(fpout,"ST");
|
if( m.HasPerVertexTexture() && (mask & io::Mask::IOM_VERTTEXCOORD)) fprintf(fpout,"ST");
|
||||||
fprintf(fpout,"OFF\n");
|
fprintf(fpout,"OFF\n");
|
||||||
fprintf(fpout,"%d %d ", m.vn, m.fn);
|
fprintf(fpout,"%d %d 0", m.vn, m.fn);
|
||||||
|
typename SaveMeshType::FaceIterator fi;
|
||||||
|
|
||||||
typename SaveMeshType::FaceIterator fi;
|
// USeless portio of code that try tocomput the exact number of edges.
|
||||||
int count_e = 0;
|
// OFF usually has a 0 as edge number.
|
||||||
int boundary_e = 0;
|
//
|
||||||
bool counted=false;
|
//int count_e = 0;
|
||||||
for(fi=m.face.begin();fi!=m.face.end();++fi)
|
//int boundary_e = 0;
|
||||||
(*fi).ClearS();
|
//bool counted=false;
|
||||||
|
//for(fi=m.face.begin();fi!=m.face.end();++fi)
|
||||||
|
// (*fi).ClearS();
|
||||||
|
|
||||||
|
//for(fi=m.face.begin();fi!=m.face.end();fi++)
|
||||||
|
//{
|
||||||
for(fi=m.face.begin();fi!=m.face.end();fi++)
|
// (*fi).SetS();
|
||||||
{
|
// count_e +=3; //assume that we have to increase the number of edges with three
|
||||||
(*fi).SetS();
|
// for(int j=0; j<3; j++)
|
||||||
count_e +=3; //assume that we have to increase the number of edges with three
|
// {
|
||||||
for(int j=0; j<3; j++)
|
// if (face::IsBorder(*fi,j)) //If this edge is a border edge
|
||||||
{
|
// boundary_e++; // then increase the number of boundary edges
|
||||||
if (face::IsBorder(*fi,j)) //If this edge is a border edge
|
// else if (face::IsManifold(*fi,j)) //If this edge is manifold
|
||||||
boundary_e++; // then increase the number of boundary edges
|
// {
|
||||||
else if (face::IsManifold(*fi,j)) //If this edge is manifold
|
// if((*fi).FFp(j)->IsS()) //If the face on the other side of the edge is already selected
|
||||||
{
|
// count_e--; // we counted one edge twice
|
||||||
if((*fi).FFp(j)->IsS()) //If the face on the other side of the edge is already selected
|
// }
|
||||||
count_e--; // we counted one edge twice
|
// else //We have a non-manifold edge
|
||||||
}
|
// {
|
||||||
else //We have a non-manifold edge
|
// hei.Set(&(*fi), j , fi->V(j));
|
||||||
{
|
// he=hei;
|
||||||
hei.Set(&(*fi), j , fi->V(j));
|
// he.NextF();
|
||||||
he=hei;
|
// while (he.f!=hei.f) // so we have to iterated all faces that are connected to this edge
|
||||||
he.NextF();
|
// {
|
||||||
while (he.f!=hei.f) // so we have to iterated all faces that are connected to this edge
|
// if (he.f->IsS()){ // if one of the other faces was already visited than this edge was counted already.
|
||||||
{
|
// counted=true;
|
||||||
if (he.f->IsS()) // if one of the other faces was already visited than this edge was counted already.
|
// break;
|
||||||
{
|
// } else { he.NextF(); }
|
||||||
counted=true;
|
// }
|
||||||
break;
|
// if (counted) {
|
||||||
}
|
// count_e--;
|
||||||
else
|
// counted=false;
|
||||||
{
|
// }
|
||||||
he.NextF();
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
if (counted)
|
//fprintf(fpout,"%d\n", count_e);
|
||||||
{
|
|
||||||
count_e--;
|
|
||||||
counted=false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fprintf(fpout,"%d\n", count_e);
|
|
||||||
|
|
||||||
//vertices
|
//vertices
|
||||||
int j;
|
int j;
|
||||||
|
@ -125,14 +120,14 @@ namespace vcg {
|
||||||
if( ! vp->IsD() )
|
if( ! vp->IsD() )
|
||||||
{ // ***** ASCII *****
|
{ // ***** ASCII *****
|
||||||
|
|
||||||
fprintf(fpout,"Vertex: %g %g %g\n" ,vp->P()[0],vp->P()[1],vp->P()[2]);
|
fprintf(fpout,"%g %g %g\n" ,vp->P()[0],vp->P()[1],vp->P()[2]);
|
||||||
if( m.HasPerVertexColor() )
|
if( m.HasPerVertexColor() && (mask & io::Mask::IOM_VERTCOLOR) )
|
||||||
fprintf(fpout,"%d %d %d %d\n",vp->C()[0],vp->C()[1],vp->C()[2],vp->C()[3] );
|
fprintf(fpout,"%d %d %d %d\n",vp->C()[0],vp->C()[1],vp->C()[2],vp->C()[3] );
|
||||||
|
|
||||||
if( m.HasPerVertexNormal())
|
if( m.HasPerVertexNormal() && (mask & io::Mask::IOM_VERTNORMAL) )
|
||||||
fprintf(fpout,"%g %g %g\n", vp->N()[0],vp->N()[1],vp->N()[2]);
|
fprintf(fpout,"%g %g %g\n", vp->N()[0],vp->N()[1],vp->N()[2]);
|
||||||
|
|
||||||
if( m.HasPerVertexTexture())
|
if( m.HasPerVertexTexture() && (mask & io::Mask::IOM_VERTTEXCOORD) )
|
||||||
fprintf(fpout,"%g %g\n",vp->T().u(),vp->T().v());
|
fprintf(fpout,"%g %g\n",vp->T().u(),vp->T().v());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue