I have many objects in my game world that all derive from one base class.
Each object will have different materials and will therefore be required to be drawn using various rendering techniques.
I currently use the following order for rendering my objects.
- Transparent (order independent)
Each object has a rendering flag that denotes which one of the above methods should be used.
The list of base objects in the scene are then iterated through and added to separate lists of deferred, forward or transparent objects based on their rendering flag value.
The individual lists are then iterated through and drawn using the order above. Each list is cleared at the end of the frame.
This methods works fairly well but it requires different draw methods for each material type.
For example each object will require the following methods in order to be compatible with the possible flag settings.
object.DrawDeferred() object.DrawForward() object.DrawTransparent()
It is also hard to see where methods outside of materials, such as rendering shadow maps, would fit using this "flag & method" design.
I was hoping that someone may have some suggestions for improving this rendering process, possibly making it more generic and less verbose?