pioneerspacesim/pioneer — pull request #744 by robn (2011-10-28 11:16:01+00:00)
Title: Camera refactor

This makes a self-contained `Camera` class. The idea is that you create one, place it in space, point it at something, and then tell it to draw what it sees.

The main draw loop has been moved into this class from `Space.cpp`, but has not fundamentally changed. `WorldView.cpp` now carries three camera objects, one for the front, rear and external cameras, and simply tells the correct one to draw based on the currently selected mode. No more setting up the camera state for each draw.

Each camera contains a `Render::Frustum` object, which represents the current view volume, and is used for doing culling and projections. This is a separate class so that other areas of the code can do culls against the current GL frustum without requiring a camera (eg `GeoSphere`).

Finally, the per-body "on screen" and "projected position" attributes are gone, as with multiple cameras in play they'd only be valid for the last camera update, which is confusing. `WorldView` now does its own projections for body labels and HUD elements. We may want to generalise this in the future if we decide that labels and/or HUD elements are needed elsewhere, but I couldn't see a clear case for that right now.