Original Post
Hi all, It's been a while since i posted anything so i thought i'd make it a good'un. I have been working on a rendering engine which to begin with is just going to render quads. The details of the quads are stored in a script file and that is parsed. I have a Primitive Manager which through a polymorphic collection stores a collection of primitives. Quad derives from Primitive and so will other primitives when i get it working as is. So far it is a bit more flexible than just rendering quads as you can see. Now my rendering is done like so. I have a renderer that simply recieves calls and gets passed a vertexbuffer, indexbuffer, appearance details and renders what it is told to. I have a dx_scene class and this retrieves a pointer to the collection of primitives in the Primitive Manager. The scene class firstly sorts all the primtives by material. Then it fills a batch vector with information about how to render batches of vertices, batched by material. Then these batches are rendered using separate DIP calls. Now i have a few things, concepts, that im not entirely sure about, so here goes: 1) I wrote a simple class called maptable. This is a std::map holding vectors of pointers to primitives, by material name. The definition looks like this: std::map< std::string, vector< primitive* >* >; When the primitives are sorted they are organised in this map table. If a primitive is being added that has a different material to any others in the table then a new 'row' is added and a new vector for the primitives is allocated, simple. I am sure that this is not how it is done in commercial engines, but at the same i can't think of a better way of sorting the scene. I can't think of the second one this second, but i will post it when i remember... So can u critique my engine concepts and throw any useful advice my way? Thanks, ace