Advertisement

Texture Manager

Started by May 28, 2002 03:14 AM
0 comments, last by Vendayan 22 years, 3 months ago
Can anyone tell me some of the faster and more popular ways of setting up a texture system? I''m talking mostly for storage purposes. I''m prett sure I''ll go with a modulated linked list to store the textures in my ''cTextureManager'' but I want to know what the best way to get those textures in there would be? I am more or less wondering how the function TextureManager->LoadTexture() should end up working. By the way by modulated linked list, I mean a linked list with a list[10] variable and then it would somehow do a fileID % 10 to figure out which real list the texture is in thereby cutting the time to traverse the list by 1/10. Any suggestions would be very helpfull ~Vendayan
"Never have a battle of wits with an unarmed man. He will surely attempt to disarm you as well"~Vendayan
dont use a linked list. use a binary tree. log n time searches. much faster. to get a binary tree with no work use a from stl.

this is a case where a linked list is not best.

the solution you gave was called hashing. popularized in hash tables. i really am not a fan of hash tables or any incarnation of them. you have to sit down and prove to me for some reason log n is to slow cause there are real headaches with hashing. not to mention you need real testing to get all the numbers perfectly tuned otherwise you typically get more head ache and less performance. also if your going to % like that % by a prime number.

i mean in this case since textures only get added at startup we have a completely balanced binary tree at work time. its pure log n look ups. its fast enough.



This topic is closed to new replies.

Advertisement