From 7e9d50694e4f1ac3fecc4c93bb544bce23d41f9e Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 3 May 2006 21:19:34 +0000 Subject: [PATCH] Added support for progress callback --- wrap/io_trimesh/import_stl.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wrap/io_trimesh/import_stl.h b/wrap/io_trimesh/import_stl.h index a9a52ea0..fcb7cc17 100644 --- a/wrap/io_trimesh/import_stl.h +++ b/wrap/io_trimesh/import_stl.h @@ -25,6 +25,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.11 2006/01/30 15:02:50 cignoni +Added mask filling in open + Revision 1.10 2006/01/04 16:14:43 cignoni Added callback managment on loading of binary stl @@ -55,6 +58,7 @@ First working version! #ifndef __VCGLIB_IMPORT_STL #define __VCGLIB_IMPORT_STL +#include #include #include #include @@ -207,9 +211,13 @@ static int OpenBinary( OpenMeshType &m, const char * filename, CallBackPos *cb=0 while(getc(fp) != '\n'); STLFacet f; + int cnt=0; + int fileLen=_filelength(_fileno(fp)); /* Read a single facet from an ASCII .STL file */ while(!feof(fp)) { + if((++cnt)%1000) cb( (ftell(fp)*100)/fileLen, "STL Mesh Loading"); + fscanf(fp, "%*s %*s %f %f %f\n", &f.n.X(), &f.n.Y(), &f.n.Z()); fscanf(fp, "%*s %*s"); fscanf(fp, "%*s %f %f %f\n", &f.v[0].X(), &f.v[0].Y(), &f.v[0].Z());