pioneerspacesim/pioneer — pull request #907 by Ae-2222 (2012-01-21 11:57:57+00:00)
Title: Use floats instead of doubles for terrain data (halves terrain memory usage)

The GPU uses floats while pioneer quad-tree stores normals, colours and vertices as doubles.

Normals/colours:

Do not require double precision, as eyes cannot detect it. Terrain algorithms expect very large normal/colour variations generally so a minute change in precision will not be amplified so much it is detectable..

Vertices:

Pioneer sends GPU vertices relative to clip-centroid of the patch in order to preserve minute changes (relative to the clip centroid) as floats can represent very low numbers ~e-38.

The vertices stored in the patch tree are stored in the format the GPU receives: vector3f(vertex_vector3d-clipCentroid). When vertex data is needed not relative to the clip centroid (edge handling, position values, etc.) the operation is reversed.

vector3d(vertex_vector3f)+clipCentroid.

It might benefit from @s20dan stress testing (looking at saves relative to master).

To see the effect of the patch increase 'Terrain Detail Distance' and note memory usage relative to master.