exposed binary/ascii support and added progress bar support in the save

This commit is contained in:
Paolo Cignoni 2008-07-02 13:30:21 +00:00
parent 0a712cbbcb
commit 9135ed578c
1 changed files with 6 additions and 2 deletions

View File

@ -179,11 +179,11 @@ static int Save(SaveMeshType &m, const char * filename, bool binary=true)
return Save(m,filename,binary,pi); return Save(m,filename,binary,pi);
} }
static int Save(SaveMeshType &m, const char * filename, int savemask, CallBackPos *cb=0 ) static int Save(SaveMeshType &m, const char * filename, int savemask, bool binary = true, CallBackPos *cb=0 )
{ {
PlyInfo pi; PlyInfo pi;
pi.mask=savemask; pi.mask=savemask;
return Save(m,filename,true,pi,cb); return Save(m,filename,binary,pi,cb);
} }
static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &pi, CallBackPos *cb=0) // V1.0 static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &pi, CallBackPos *cb=0) // V1.0
@ -427,6 +427,8 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
vp=&(*vi); vp=&(*vi);
indices[vi] = j; indices[vi] = j;
if(cb && ((j%1000)==0))(*cb)( (100*j)/(m.vn+m.fn), "Saving Vertices");
if( !m.HasPerVertexFlags() || !vp->IsD() ) if( !m.HasPerVertexFlags() || !vp->IsD() )
{ {
if(binary) if(binary)
@ -517,6 +519,8 @@ static int Save(SaveMeshType &m, const char * filename, bool binary, PlyInfo &p
int fcnt=0; int fcnt=0;
for(j=0,fi=m.face.begin();fi!=m.face.end();++fi) for(j=0,fi=m.face.begin();fi!=m.face.end();++fi)
{ {
if(cb && ((j%1000)==0) ) (*cb)( 100*(m.vn+j)/(m.vn+m.fn), "Saving Vertices");
fp=&(*fi); fp=&(*fi);
if( ! fp->IsD() ) if( ! fp->IsD() )
{ fcnt++; { fcnt++;