pioneerspacesim/pioneer — pull request #905 by Ae-2222 (2012-01-21 10:50:43+00:00)
Title: Use floats for terrain data (halves terrain memory usage)

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

Normals/colours:

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

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).