Im working on a map editor (Well remaking one which i never finished), so it will have more usage than a game which just loads X amount of textures once per level but at the same time for most of its "Life" it won't be doing much at all. It will only rearly be used to keep a global list of textures (So they can be free'd when the texture system is destroyed if they weren't already destroyed) and to keep the current count of how meny times a texture has been used(So that the system knows when its safe to free the texture). What is the benefit of hashes? Looks simmiler to number 3 on my list except that it also seems to have an array....
Registriert: Do Aug 25, 2005 16:00 Beiträge: 189
Programmiersprache: Java, C#
Stucuk hat geschrieben:
Im working on a map editor (Well remaking one which i never finished), so it will have more usage than a game which just loads X amount of textures once per level but at the same time for most of its "Life" it won't be doing much at all. It will only rearly be used to keep a global list of textures (So they can be free'd when the texture system is destroyed if they weren't already destroyed) and to keep the current count of how meny times a texture has been used(So that the system knows when its safe to free the texture). What is the benefit of hashes? Looks simmiler to number 3 on my list except that it also seems to have an array....
@hashes:
You have an array and an hash function. Every object has an key (i normally use texture name or something like that). The hash function takes the key and returns the index, where the object is located in the array.
So, the advantage is that you can find an entry very fast. You can also find out if an object is already in the data structure or not. You're also able to iterate over the whole set of entries.
It's my favourite data structure for texture managers and stuff like that, but i'm not sure if that structure is what you're looking for.
Registriert: Do Sep 02, 2004 19:42 Beiträge: 4158
Programmiersprache: FreePascal, C++
I think, an array (or better, TList) is normaly a fine structure for textures. You load the textures only once and you delete them all at one time, so you do not need the performance bonus you get for deletion and addition when you use linked lists. Accessing could be done either by direct pointers or by indicies. For the first access you could use a "find by name" function, which returns a pointer to the texture object which may be stored for later usage.
greetings Lord Horazont
_________________ If you find any deadlinks, please send me a notification – Wenn du tote Links findest, sende mir eine Benachrichtigung. current projects: ManiacLab; aioxmpp zombofant network • my photostream „Writing code is like writing poetry“ - source unknown
„Give a man a fish, and you feed him for a day. Teach a man to fish and you feed him for a lifetime. “ ~ A Chinese Proverb
Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast
Du darfst keine neuen Themen in diesem Forum erstellen. Du darfst keine Antworten zu Themen in diesem Forum erstellen. Du darfst deine Beiträge in diesem Forum nicht ändern. Du darfst deine Beiträge in diesem Forum nicht löschen. Du darfst keine Dateianhänge in diesem Forum erstellen.