Archived

This topic is now archived and is closed to further replies.

thekid

Image Indexing HOW?

Recommended Posts

I have all the image loading functions in my engine now. Now I am needing a way to index my images in some type of Image Manager. I need an easy way for my Actors,Textures,and Entitites to get a pointer to an image easely. I saw a previous post were someone suggested indexing then and getting them through a filename but I am lost with that. If anyone has done this before or knows how to do it. Please Help!! Thanks

Share this post


Link to post
Share on other sites
I made an index-class for textures in one of my applications that was based on a hash table with separate chaining. I then associated each texture with a unique number through the use of global #define (or enum{}). The combination of unique numbers and hash-table made the insertion, deletion and most important the lookup very fast and easy.

You could also make your indexing based on the filename of each image. The penalty you then have to pay on each operation is the calculation of the hash-key. If you use a relatively easy hash-key such as adding the characters together and then using it as a hash-value it will be quite fast anyway but perhaps does not give the best possible hashing.

Edited by - Kjell Andersson on 3/29/00 3:17:12 PM

Share this post


Link to post
Share on other sites