Original Post
With resource or asset management, what is the best way to store, say, textures as they are loaded in (syncronously or asynchronously)? My current idea is that as a level loads and a texture is requested (by filename as that's what will be stored with each mesh or mesh subset), it is loaded and added to a map which is keyed on an unsigned integer ID. The ID is then stored with each object or mesh (subset) that uses it for fast lookups. When I come to draw a model that uses that texture, I just look up the texture in the map using the id (which should be way faster than using the filename string) and away we go. The filename of the texture is stored with my texture instance. One thing I'm a bit unsure of is that if I have two seperate models that use the same texture, the first model loaded to use the texture will load it, and when loading the second model, we'd have to check every texture instance in the map comparing the filename to see if it has already been loaded. Something doesn't smell quite right with this approach, can anyone suggest a better one?