I'm messing around with making my engine work with multiple cameras (for multi-player and/or rendering to a texture), and am trying to figure out the best/cleanest way to do it.
Any thoughts regarding which of the following approaches would be preferable? Is there a third alternative that is better?
Scenario 1. Loop through the scene once, passing the list of cameras to the drawable objects
foreach drawable object in scene
foreach camera
apply camera settings (view, projection, etc.)
draw it
Pros: Textures/Vertices/etc. for a given object only need to be set once
Cons: Drawable objects need to be aware of cameras, camera settings applied repetively
Scenario 2. Loop through the scene once for each camera
foreach camera
apply camera settings (view, projection, etc.)
foreach drawable object in scene
draw it
Pros: Cleaner code. Camera settings only need to be applied once per camera
Cons: Textures/Vertices/etc. on a given object may need to be set once per camera
Thanks!