I have done multi pass rendering before and understand how it works. I did a simple example which rendered a basic scene with shadows. This was all done in one file. Now I am trying to figure out is how to put it into my game engine.
Currently my game engine is single pass. It is in a hierarchical structure and uses Direct3D9. I have a graphics component which will load and draw a 3d model. In my game loop I update all the entities in the world then I call the draw function for each one. This draw function gets the vertex buffer, index buffer and texture/ material and draws the 3d model using a shader. This is fine.
To do multi pass rendering to allow for shadows say I will need to draw each model multiple times. It doesn't seem right to me that in each models draw function I should put the 2nd pass code as this will then be completed before the next models 1st pass. Does anyone know of any design solutions or places where I can find some more information about this?
I hope this question isn't too confusing, I have tried to explain what I currently have and what I would like to achieve to the best of my ability.
Regards,
MD.