pioneerspacesim/pioneer — pull request #1556 by fluffyfreak (2012-09-28 14:49:26+00:00)
Title: *DO NOT MERGE* Experimental terrain futzing - aka Issue #1550

This started out as issue #1550 and so i'll copy n' waste that text first:

# Description
I kept noticing various bits and pieces that I've wanted to change, namely; const issues, __restrict keyword on methods taking more than one pointer to the same types, passing by value instead of by reference inconsistencies, const data members and a few other bits.

Those are just little bits and pieces.

Then I also decided to try and reduce the amount of geometry that is generated for a terrain. I started by taking the existing culling test from the Render method but this clips far too aggresively. Multiplying the clipRadius by 2.0 forces it to accept a lot more of the patches but is a bit hacky.

Still this does reduce the number of patches generated substantially, with all of the detail set to maximum sat on the launchpad on the Earth start point it reduces the memory footprint from ~860MB to ~550MB saving ~310MB.

Since the noise functions used to generate the terrain are amongst the most expensive calls in the game this means it generates the terrain a lot faster and I can't see any visual differences.

I don't think this is the correct way of doing this but as quick hack it's very effective and I wondered if anyone had any other bright ideas?

# Since then...
I've determined that the frustum is just a hack but it does reduce the number of patches created from 3306 to 2026 so might be worthwhile for the current system if people want to include it.

I've also been playing around with:
* given a unique uint64_t identifier to each GeoPatch - unique across side of the cube too,
* above unique ID can be used to retrieve patch child index too,
* added a count and maximum count of the number of GeoPatches created,
* added a DEBUG only assert test for expensive debug sanity checking.

More to come. **DISCUSS**