pioneerspacesim/pioneer — pull request #2341 by fluffyfreak (2013-06-22 12:03:39+00:00)
Title: Update city rendering.

# Description:
City rendering and updating is very slow, this PR attempts to improve it in numerous areas.

1. Previously it would iterate over all buildings and test if each one was "enabled". All enabled buildings are now simply stored in an "m_enabledBuildings" vectors.
2. A single frustum test is also done for the entire city, a per-building basis test is still done but only of visible cities.
3. Cities are discarded before all of the above once they are greater than 100km instead of 1000km as even at the highest detail settings they are already very small onscreen and simply render as "sparklies" even at fullscreen & high resolution (1920x1200).
4. Rendering StaticGeometry and others now cache the end iterator.
5. Numerous changes to const-ness of passed RenderParam - mostly cosmetic change but helped me understand system, avoids potential pitfall where RenderParam could be changed during rendering and has no foreseeable drawbacks (discuss).

# Future work:
Sort the m_enabledBuildings vector and use it for controlling instanced rendering, not available in OpenGL 2.1 but in later versions, from OpenGL 3.3 especially.
Alternatively, create a single super-mesh from all of the similar sub-meshes that use one set of textures and draw in a single drawcall.

Andy