Added support for saving polygonal meshes in ascii ply

This commit is contained in:
Paolo Cignoni 2014-05-30 08:42:55 +00:00
parent 6ac9919471
commit 5e579abc59
1 changed files with 487 additions and 584 deletions

View File

@ -19,104 +19,6 @@
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
/****************************************************************************
History
$Log: not supported by cvs2svn $
Revision 1.30 2008/04/29 11:51:28 corsini
set defaut callback (in save) to null
Revision 1.29 2008/01/24 11:54:23 cignoni
passed the callback in the save
Revision 1.28 2007/12/13 00:20:34 cignoni
removed harmless printf cast warnings
Revision 1.27 2007/11/06 10:59:41 ponchio
Typo
Revision 1.26 2007/11/06 10:51:55 ponchio
Fixed wrong 'return false' in Save.
Revision 1.25 2007/10/22 14:47:19 cignoni
Added saving of per vertex normals
Revision 1.24 2007/07/23 13:27:50 tarini
fixed bug on saving flags-per-face
Revision 1.23 2007/03/12 16:40:17 tarini
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
Revision 1.22 2007/02/18 08:01:07 cignoni
Added missing typename
Revision 1.21 2007/02/14 16:07:41 ganovelli
added HasPerFaceFlag
Revision 1.20 2007/02/14 15:40:20 ganovelli
a wrong "!" corrected
Revision 1.19 2007/02/14 15:30:13 ganovelli
added treatment of HasPerVertexFlags absent
Revision 1.18 2006/12/18 09:46:39 callieri
camera+shot revamp: changed field names to something with more sense, cleaning of various functions, correction of minor bugs/incongruences, removal of the infamous reference in shot.
Revision 1.17 2006/11/30 22:49:32 cignoni
Added save with (unused) callback
Revision 1.16 2006/10/14 00:39:22 cignoni
Added a comment on an assert
Revision 1.15 2006/01/30 13:43:59 cignoni
Added GetExportMaskCapability
Revision 1.14 2006/01/27 09:11:48 corsini
fix signed/unsigned mismatch
Revision 1.13 2006/01/13 15:47:43 cignoni
Uniformed return type to the style of Open. Now every export function returns 0 in case of success.
Revision 1.12 2006/01/10 13:20:42 cignoni
Changed ply::PlyMask to io::Mask
Revision 1.11 2005/11/23 15:48:25 pietroni
changed shot::similarity to shot::Similarity() and shot::camera to shot::Camera()
Revision 1.10 2004/10/28 00:52:45 cignoni
Better Doxygen documentation
Revision 1.9 2004/10/27 09:33:10 ganovelli
cast from scalar type to float added
Revision 1.8 2004/10/07 14:19:06 ganovelli
shot/camera io added
Revision 1.7 2004/07/15 10:54:48 ganovelli
std added
Revision 1.6 2004/05/28 14:11:13 ganovelli
changes to comply io_mask moving in vcg::ply namesp
Revision 1.5 2004/05/12 14:43:36 cignoni
removed warning of unused variables
Revision 1.4 2004/05/12 10:19:30 ganovelli
new line added at the end of file
Revision 1.3 2004/03/18 15:30:46 cignoni
Removed float/double warning
Revision 1.2 2004/03/09 21:26:47 cignoni
cr lf mismatch
Revision 1.1 2004/03/08 09:21:33 cignoni
Initial commit
Revision 1.1 2004/03/03 15:00:51 cignoni
Initial commit
****************************************************************************/
/**
@ -638,16 +540,17 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
}
else // ***** ASCII *****
{
fprintf(fpout,"3 %d %d %d ",
indices[fp->cV(0)], indices[fp->cV(1)], indices[fp->cV(2)] );
fprintf(fpout,"%d " ,fp->VN());
for(int k=0;k<fp->VN();++k)
fprintf(fpout,"%d ",indices[fp->cV(k)]);
if(HasPerFaceFlags(m)&&( pi.mask & Mask::IOM_FACEFLAGS ))
fprintf(fpout,"%d ",fp->Flags());
if( HasPerVertexTexCoord(m) && (pi.mask & Mask::IOM_WEDGTEXCOORD) ) // you can save VT as WT if you really want it...
{
fprintf(fpout,"6 ");
for(int k=0;k<3;++k)
fprintf(fpout,"%d ",fp->VN()*2);
for(int k=0;k<fp->VN();++k)
fprintf(fpout,"%g %g "
,fp->V(k)->T().u()
,fp->V(k)->T().v()
@ -655,8 +558,8 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
}
else if( HasPerWedgeTexCoord(m) && (pi.mask & Mask::IOM_WEDGTEXCOORD) )
{
fprintf(fpout,"6 ");
for(int k=0;k<3;++k)
fprintf(fpout,"%d ",fp->VN()*2);
for(int k=0;k<fp->VN()*2;++k)
fprintf(fpout,"%g %g "
,fp->WT(k).u()
,fp->WT(k).v()