Handling cameras in a large scale game engine
- by Hannesh
What is the correct, or most elegant, way to manage cameras in large game engines? Or should I ask, how does everybody else do it?
The methods I can think of are:
Binding cameras straight to the engine; if someone needs to render something, they bind their own camera to the graphics engine which is in use until another camera is bound.
A camera stack; a small task can push its own camera onto the stack, and pop it off at the end to return to the "main" camera.
Attaching a camera to a shader; Every shader has exactly one camera bound to it, and when the shader is used, that camera is set by the engine when the shader is in use. This allows me to implement a bunch of optimizations on the engine side.
Are there other ways to do it?