Re: R: [Plib-devel] Update on 3ds loader
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2000-04-08 03:04:59
|
Christian Mayer wrote: > > Paolo Leoncini wrote: > > > > This group of code lines avoid loading twice (or more times!) the same texture. As far as I understood, 3DS stores texture file names as uppercase strings, so a possible problem of this mechanism could be on non-PC systems that are instead case-sensitive. On such a platform a texture stored as "IMAGE.BMP"could erroneously refer to an image file "Image.bmp". > > Should it be the problem, let's remember that 3DS (and Max too) is not supposed to run on platforms with a case-sensitive file system, so to read such a file on UNIX a manual renaming of texture files is necessary. > > Couldn't the loader convert each filename to (say) uppercase internally? I think the best policy is: 1) Test the filename as given in the file to see if it exists in that case. If there are multiple files in various cases, then the exact match should be the one to work reliably. 2) If you can't get an exact match, THEN you'll have to search the current directory looking for files whose names (when converted to uppercase) match the given filename (when converted to uppercase). Whether you pick the first match or flag an error if there are multiple possible matches is an interesting question. Since searching the directory that way is painful to do in a portable manner, this isn't going to be very nice to code, however, you don't know whether IMAGE.BMP is really stored as IMAGE.BMP, image.bmp, Image.bmp or iMaGe.Bmp - so there is no way to find the right filename to 'fopen' without doing a search. -- Steve Baker http://web2.airmail.net/sjbaker1 sjb...@ai... (home) http://www.woodsoup.org/~sbaker sj...@ht... (work) |