Original Post
I guess I should describe my current plana and then the problem I am having with it. I have no guidance and no resources to go by. I am getting confused everytime I sit down to work! This is DX10 in C++ btw. 1) I basically want to contain all my resources in a render queue So, my render queue will contain collections of cameras, light sets, shaders, materials, and meshes. 2) In the render queue, when it comes time to render: I iterate through my mesh collections query each mesh for the material and shader it is using by name I then go to my shader and material collections and get those So my render queue now has the current mesh, camera, light set, material and shader. 3) I query the mesh for its vertices and indices and give those along with the material, light set, and camera to the shader. The shader then syncs the material attributes to the HLSL variables, and renders. 4) Later my render queue may be renamed, and it could become some sort of scene hierarchy, sorting things when they need to be sorted, performing occlusion, space partitioning, and the like, but for now just simple queue with everything in it. -------------------------------- I was thinking that every shader has a specific material that it accepts parameters from. So, an my "emmisive shader" will only accept a "emmisive material", A "car metal" shader will only accept a "car metal" material. I do not see any common attributes or interfaces for materials. Every material is different. So, the problem is: If I am going to store a collection of materials, I need some Base Interface, so I can have some base class pointer. If I am going to store a collection of shaders, I also need some Base Interface, so I can have some base class pointer. Then, I can make a std::vector or linked list or map of the materials. I can do the same with the shaders. Right now, there is no inheritance for shaders or materials, I do not see anything in common from one to the other. All have differant attributes and methods with different parameters! So how then do I create the collection? ------------------------------------------------ I certainly do not want to hardcode a map for every type. I also want the flexibilty for the user to create thier own material and shaders. Any ideas? Should my shader class be responsible for doing the rendering or did I decide to put it in the wrong place? Does my design just suck? How do people do this? ------------------------------------------------ I am basically lost when trying to design the "what lives where" and "what is associated with what" I know every mesh (mesh subset later) is going to be associated with a material and a shader. I do now know how I am going to code that relationship.