Moved and corrected interpret_texture_name from plystuff.h to plylib.cpp

This commit is contained in:
Paolo Cignoni 2005-12-02 00:00:53 +00:00
parent 2d7b7a4532
commit 7bd3c4601a
3 changed files with 15 additions and 50 deletions

View File

@ -31,6 +31,9 @@ of Greg Turk and on the work of Claudio Rocchini
History
$Log: not supported by cvs2svn $
Revision 1.10 2005/11/26 00:22:46 cignoni
added untested code of interpret_texture
Revision 1.9 2005/11/12 07:07:47 cignoni
Changed Offset types to remove warnings
@ -3612,7 +3615,7 @@ int PlyFile::Read( void * mem )
return 0;
}
void __interpret_texture_name(const char*a, const char*fn, char*output){
void interpret_texture_name(const char*a, const char*fn, char*output){
int ia=0,io=0;
output[0]=0;
while (a[ia]!=0){

View File

@ -30,6 +30,9 @@ of Greg Turk and on the work of Claudio Rocchini
History
$Log: not supported by cvs2svn $
Revision 1.5 2005/11/26 00:12:25 cignoni
added prototype of interpret_texture_name
Revision 1.4 2005/11/12 07:07:47 cignoni
Changed Offset types to remove warnings
@ -321,8 +324,8 @@ protected:
PlyElement * FindElement( const char * name );
};
void __interpret_texture_name(const char*a, const char*fn, char*output);
void interpret_texture_name(const char*a, const char*fn, char*output);
}
}
} // end namespace ply
} // end namespace vcg
#endif

View File

@ -31,6 +31,9 @@ of Greg Turk and on the work of Claudio Rocchini
History
$Log: not supported by cvs2svn $
Revision 1.3 2005/03/18 00:14:40 cignoni
removed small gcc compiling issues
Revision 1.2 2005/03/15 11:46:52 cignoni
Cleaning of the automatic bbox caching support for ply files. First working version.
@ -370,51 +373,7 @@ bool ScanBBox( const char * fname, Box3d & box, const Matrix44d & m, bool use_ca
return true;
}
void __interpret_texture_name(const char*a, const char*fn, char*output){
int ia=0,io=0;
output[0]=0;
while (a[ia]!=0){
if (a[ia]=='<') {
if (strlen(a)>ia+5) {
if ( ( (a[ia+1]=='t') || (a[ia+1]=='T') ) &&
( (a[ia+2]=='h') || (a[ia+2]=='H') ) &&
( (a[ia+3]=='i') || (a[ia+3]=='I') ) &&
( (a[ia+4]=='s') || (a[ia+4]=='S') ) &&
( a[ia+5]=='>' ) )
{
// substitute "<this>" with filename:
// 1) remove path from filename
int lastbar=0;
int ifn=0;
while (fn[ifn]!=0) { if ((fn[ifn]=='/') || (fn[ifn]=='\\')) lastbar=ifn+1; ifn++;}
ifn=lastbar;
char fn2[255];
while (fn[ifn]!=0) { fn2[ifn-lastbar]=fn[ifn]; ifn++;}
fn2[ifn-lastbar]=0;
// 2) remove ".ply" extention from filename
int l=ifn-lastbar;
if ((fn2[l-4]=='.')
&& ((fn2[l-3]=='P') || (fn2[l-3]=='p'))
&& ((fn2[l-2]=='L') || (fn2[l-2]=='l'))
&& ((fn2[l-1]=='Y') || (fn2[l-1]=='y')) )
fn2[l-4]=0;
// 3) append
output[io]=0;
sprintf(output,"%s%s",output,fn2);
io=strlen(output);
ia+=6; //skip the "<this>"
continue;
};
}
}
output[io++]=a[ia++];
};
output[io]=0;
};
}
}
} // end namespace ply
} // end namespace vcg
#endif