completed the templating of the stuff for fast loading of bbox of ply

This commit is contained in:
Paolo Cignoni 2009-10-28 08:24:56 +00:00
parent 7ef26b5a25
commit df6f5b98ec
1 changed files with 7 additions and 3 deletions

View File

@ -227,10 +227,13 @@ bool GetCacheName( const char * fname, const char * ext_name, char * cname )
} }
static bool SaveBBoxCache( const char * fname, const Box3d & box ) template <class ScalarType>
static bool SaveBBoxCache( const char * fname, const Box3<ScalarType> & boxOut )
{ {
char d[MAXBPATH]; char d[MAXBPATH];
Box3d box;
box.Import(boxOut);
if( !GetCacheName(fname,bboxcacheext,d) ) if( !GetCacheName(fname,bboxcacheext,d) )
return false; return false;
@ -327,7 +330,8 @@ bool ScanBBox( const char * fname, Box3<ScalarType> & box, bool use_cache=true )
// Come la precedente ma applica la matrice m ai punti prima di calcolare il bbox. // Come la precedente ma applica la matrice m ai punti prima di calcolare il bbox.
// Visto che la matrice di solito e' tenuta in un qualche file, se si vuole usare la cache // Visto che la matrice di solito e' tenuta in un qualche file, se si vuole usare la cache
// si puo' passare anche un'altro filename da controllare // si puo' passare anche un'altro filename da controllare
bool ScanBBox( const char * fname, Box3d & box, const Matrix44d & m, bool use_cache, const char *matrixfname) template <class ScalarType>
bool ScanBBox( const char * fname, Box3<ScalarType> & box, const Matrix44<ScalarType> & m, bool use_cache, const char *matrixfname)
{ {
if(use_cache) if(use_cache)
@ -370,7 +374,7 @@ bool ScanBBox( const char * fname, Box3d & box, const Matrix44d & m, bool use_ca
PlyPoint3d t; PlyPoint3d t;
pf.Read( (void *)(&t) ); pf.Read( (void *)(&t) );
box.Add( m*Point3d(t.x,t.y,t.z) ); box.Add( m*Point3<ScalarType>(t.x,t.y,t.z) );
} }
} }
else else