Game Development Community

Simple speedup for TextureManager::loadBitmapInstance ?

by Alex Rice · in Torque Game Engine · 06/29/2005 (11:17 pm) · 3 replies

If you are using PNG mostly in your game, you could do this in gTexmanager.cc. because everytime you get a "miss" in TextureManager::loadBitmapInstance, it's working through various methods and walking a hashtable, search the filesystem, etc. so I figure this might speed things up at least when game is loading at first, and again assuming you are using mostly PNGs:

// move .png extension ahead of other bitmap extensions
static const char* extArray[EXT_ARRAY_SIZE] = { "",  ".png", ".jpg", ".gif", ".bmp", "" };
static const char* extArray_8[EXT_ARRAY_SIZE] = { "", ".png", ".bm8", ".bmp",   ".jpg", ".gif" };

#1
06/30/2005 (12:11 am)
Interesting, thanks for letting us know!
#2
06/30/2005 (3:59 am)
Any speed is worth it... Thank you.
#3
07/02/2005 (1:15 pm)
Or, better yet:
static const char* extArray[EXT_ARRAY_SIZE] = { ".png", ".jpg", ".gif", ".bmp", "", ""};
static const char* extArray_8[EXT_ARRAY_SIZE] = { ".png", ".jpg", ".bm8", ".bmp", ".gif", ""};

Not sure what the purpose of the empty extension is, other than to pad the array to EXT_ARRAY_SIZE items?