Hello. I'm using Maya to export all the materials from the scene (most of them have textures) and put them in one single file. I've separated the materials from the mesh so I can assign one material to multiple meshed or to change the material of a mesh when I want to while rendering.
I have a class for Materials that keeps pointers to the resource view after I load and Create the textures from the file.
I name the materials so I can assign them to the meshes when I want to. Like Mesh1->materialpointer = Materials("chest_material");
The thing is that I don't know how to store the material information so I can aces it faster when I iterate in the materials to search for that name string ("chest_material") or even a number;
My first idea was to create an Binary Search Tree (with AVL insertion) but I don't like the idea of data being spread all over the ram when I create the nodes so the next idea was to create a simple vector and make a binary search in it to lookup for the material data.
The problem is if I want to destroy a material and a resource view (in case I don't need that material anymore and release the data from ram) or I need to load a new one (ex: new level needs 3 new materials that are not loaded initially for performance issues) I always have to sort the vector and maybe re-size it or reuse its components.
Any suggestion? I really don't want to use any library.