Corrected various bug, involving spurious commas, and pervertex color saved as per wedge color.
This commit is contained in:
parent
e4c62fec6d
commit
130442663c
|
@ -23,6 +23,9 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
History
|
History
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.6 2007/06/12 10:15:35 cignoni
|
||||||
|
Very important change. No more scaling and translation in the saved file!
|
||||||
|
|
||||||
Revision 1.5 2007/03/20 16:47:49 cignoni
|
Revision 1.5 2007/03/20 16:47:49 cignoni
|
||||||
Update to the new texture syntax
|
Update to the new texture syntax
|
||||||
|
|
||||||
|
@ -110,27 +113,20 @@ namespace vcg {
|
||||||
|
|
||||||
// Vertici
|
// Vertici
|
||||||
for(ind=0,vi=m.vert.begin(); vi!=m.vert.end(); ++vi, ++ind)
|
for(ind=0,vi=m.vert.begin(); vi!=m.vert.end(); ++vi, ++ind)
|
||||||
{
|
if(!(*vi).IsD())
|
||||||
if(ind%4==0)
|
{
|
||||||
fprintf(fp,
|
if(vi!=m.vert.begin()) fprintf(fp,", ");
|
||||||
"\n "
|
if(ind%4==0) fprintf(fp, "\n " );
|
||||||
);
|
fprintf(fp, "%g %g %g" ,(*vi).P()[0] ,(*vi).P()[1] ,(*vi).P()[2] );
|
||||||
fprintf(fp,
|
index[&*vi] = ind;
|
||||||
"%g %g %g, "
|
}
|
||||||
,(*vi).P()[0]
|
|
||||||
,(*vi).P()[1]
|
|
||||||
,(*vi).P()[2]
|
|
||||||
);
|
|
||||||
index[&*vi] = ind;
|
|
||||||
|
|
||||||
}
|
|
||||||
fprintf(fp,"\n"
|
fprintf(fp,"\n"
|
||||||
" ]\n"
|
" ]\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if( m.HasPerVertexColor() && (mask & vcg::tri::io::Mask::IOM_VERTCOLOR))
|
if( HasPerVertexColor(m) && (mask & vcg::tri::io::Mask::IOM_VERTCOLOR))
|
||||||
{
|
{
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
" color Color\n"
|
" color Color\n"
|
||||||
|
@ -139,37 +135,24 @@ namespace vcg {
|
||||||
" ["
|
" ["
|
||||||
);
|
);
|
||||||
for(ind=0,vi=m.vert.begin();vi!=m.vert.end();++vi,++ind)
|
for(ind=0,vi=m.vert.begin();vi!=m.vert.end();++vi,++ind)
|
||||||
|
if(!(*vi).IsD())
|
||||||
{
|
{
|
||||||
|
if(vi!=m.vert.begin()) fprintf(fp,", ");
|
||||||
float r = float(vi->C()[0])/255;
|
float r = float(vi->C()[0])/255;
|
||||||
float g = float(vi->C()[1])/255;
|
float g = float(vi->C()[1])/255;
|
||||||
float b = float(vi->C()[2])/255;
|
float b = float(vi->C()[2])/255;
|
||||||
|
|
||||||
if(ind%4==0)
|
if(ind%4==0)
|
||||||
fprintf(fp,"\n ");
|
fprintf(fp,"\n ");
|
||||||
fprintf(fp,"%g %g %g,",r,g,b);
|
fprintf(fp,"%g %g %g",r,g,b);
|
||||||
}
|
}
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"\n"
|
"\n"
|
||||||
" ]\n"
|
" ]\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" colorIndex\n"
|
|
||||||
" ["
|
|
||||||
);
|
|
||||||
|
|
||||||
for(ind=0,fi=m.face.begin(); fi!=m.face.end(); ++fi,++ind)
|
|
||||||
{
|
|
||||||
if(ind%4==0)
|
|
||||||
fprintf(fp,"\n ");
|
|
||||||
for (int j = 0; j < 3; j++)
|
|
||||||
fprintf(fp,"%i,",index[(*fi).V(j)]);
|
|
||||||
fprintf(fp,"-1,");
|
|
||||||
}
|
|
||||||
fprintf(fp,
|
|
||||||
"\n"
|
|
||||||
" ]\n"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if( m.HasPerWedgeColor() && (mask & vcg::tri::io::Mask::IOM_WEDGCOLOR ))
|
else if( HasPerWedgeColor(m) && (mask & vcg::tri::io::Mask::IOM_WEDGCOLOR ))
|
||||||
{
|
{
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
" color Color\n"
|
" color Color\n"
|
||||||
|
@ -177,16 +160,18 @@ namespace vcg {
|
||||||
" color\n"
|
" color\n"
|
||||||
" [" );
|
" [" );
|
||||||
for(ind=0,fi=m.face.begin();fi!=m.face.end();++fi,++ind)
|
for(ind=0,fi=m.face.begin();fi!=m.face.end();++fi,++ind)
|
||||||
{
|
if(!(*fi).IsD())
|
||||||
for(int z=0;z<3;++z)
|
{
|
||||||
{
|
if(fi!=m.face.begin()) fprintf(fp,", ");
|
||||||
float r = float(fi->WC(z)[0])/255;
|
if(ind%4==0) fprintf(fp,"\n ");
|
||||||
float g = float(fi->WC(z)[1])/255;
|
for(int z=0;z<3;++z)
|
||||||
float b = float(fi->WC(z)[2])/255;
|
{
|
||||||
if(ind%4==0)
|
if(z!=0) fprintf(fp,", ");
|
||||||
fprintf(fp,"\n ");
|
float r = float(fi->WC(z)[0])/255;
|
||||||
fprintf(fp,"%g %g %g,",r,g,b);
|
float g = float(fi->WC(z)[1])/255;
|
||||||
}
|
float b = float(fi->WC(z)[2])/255;
|
||||||
|
fprintf(fp,"%g %g %g",r,g,b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -196,15 +181,14 @@ namespace vcg {
|
||||||
" [" );
|
" [" );
|
||||||
int nn = 0;
|
int nn = 0;
|
||||||
for(ind=0,fi=m.face.begin(); fi!=m.face.end(); ++fi,++ind)
|
for(ind=0,fi=m.face.begin(); fi!=m.face.end(); ++fi,++ind)
|
||||||
{
|
if(!(*fi).IsD())
|
||||||
if(ind%4==0)
|
{
|
||||||
fprintf(fp,"\n ");
|
//if(fi!=m.face.begin()) fprintf(fp,", ");
|
||||||
for (int j = 0; j < 3; j++)
|
if(ind%4==0) fprintf(fp,"\n ");
|
||||||
{
|
fprintf(fp,"%i",nn++);
|
||||||
fprintf(fp,"%i,",nn);
|
fprintf(fp,"%i",nn++);
|
||||||
++nn;
|
fprintf(fp,"%i",nn++);
|
||||||
}
|
fprintf(fp,"-1");
|
||||||
fprintf(fp,"-1,");
|
|
||||||
}
|
}
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -221,14 +205,13 @@ namespace vcg {
|
||||||
" [\n"
|
" [\n"
|
||||||
);
|
);
|
||||||
for(ind=0,fi=m.face.begin(); fi!=m.face.end(); ++fi,++ind)
|
for(ind=0,fi=m.face.begin(); fi!=m.face.end(); ++fi,++ind)
|
||||||
{
|
if(!(*fi).IsD())
|
||||||
if(ind%4==0)
|
|
||||||
fprintf(fp,"\n ");
|
|
||||||
for (int j = 0; j < 3; j++)
|
|
||||||
{
|
{
|
||||||
fprintf(fp,"%g %g, ",fi->WT(j).u(),fi->WT(j).v());
|
if(fi!=m.face.begin()) fprintf(fp,", ");
|
||||||
|
if(ind%4==0) fprintf(fp,"\n ");
|
||||||
|
for (int j = 0; j < 3; j++)
|
||||||
|
fprintf(fp,"%g %g ",fi->WT(j).u(),fi->WT(j).v());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"\n"
|
"\n"
|
||||||
" ]\n"
|
" ]\n"
|
||||||
|
@ -238,16 +221,14 @@ namespace vcg {
|
||||||
);
|
);
|
||||||
int nn = 0;
|
int nn = 0;
|
||||||
for(ind=0,fi=m.face.begin(); fi!=m.face.end(); ++fi,++ind)
|
for(ind=0,fi=m.face.begin(); fi!=m.face.end(); ++fi,++ind)
|
||||||
{
|
if(!(*fi).IsD())
|
||||||
if(ind%4==0)
|
|
||||||
fprintf(fp,"\n ");
|
|
||||||
for (int j = 0; j < 3; j++)
|
|
||||||
{
|
{
|
||||||
fprintf(fp,"%d,",nn);
|
if(fi!=m.face.begin()) fprintf(fp,", ");
|
||||||
++nn;
|
if(ind%4==0) fprintf(fp,"\n ");
|
||||||
|
for (int j = 0; j < 3; j++)
|
||||||
|
fprintf(fp,"%d,",nn++);
|
||||||
|
fprintf(fp,"-1,");
|
||||||
}
|
}
|
||||||
fprintf(fp,"-1,");
|
|
||||||
}
|
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"\n"
|
"\n"
|
||||||
" ]\n"
|
" ]\n"
|
||||||
|
@ -259,14 +240,14 @@ namespace vcg {
|
||||||
);
|
);
|
||||||
// Facce
|
// Facce
|
||||||
for(ind=0,fi=m.face.begin(); fi!=m.face.end(); ++fi,++ind)
|
for(ind=0,fi=m.face.begin(); fi!=m.face.end(); ++fi,++ind)
|
||||||
|
if(!(*fi).IsD())
|
||||||
{
|
{
|
||||||
if(ind%6==0)
|
if(fi!=m.face.begin()) fprintf(fp,", ");
|
||||||
{
|
if(ind%6==0) fprintf(fp,"\n ");
|
||||||
fprintf(fp,"\n ");
|
|
||||||
}
|
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
fprintf(fp,"%i,",index[(*fi).V(j)]);
|
fprintf(fp,"%i,",index[(*fi).V(j)]);
|
||||||
fprintf(fp,"-1,");
|
|
||||||
|
fprintf(fp,"-1");
|
||||||
}
|
}
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"\n"
|
"\n"
|
||||||
|
|
Loading…
Reference in New Issue