Reinstate lod/rough and lod/bare and therefore fix the use of range animations that implement hardwired LOD.
Initially I was reluctant to do this - but after a lot more research I'm no longer convinced that range animations cause a huge performance hit and so we can keep this fix until either the scenery is fixed or the situation becomes clear.
Ideally this fix should be reviewed prior to the next LTS release; or maybe after the next LTS release - but in future reviewed it must be
Rework the LOD ranges.
1. The scenery ranges are now deltas (avoids overlapping values)
2. The AI/MP pixel mode now has a default radius that is 20 for Aircraft, 200 for ships, 350 for carriers. This is a simple constant in a virtual function.
3. Added the ability to set the AI/MP ranges equal which means use the low detail model.
4. Changed high detail only to be indicated by a -ve number in maxRangeDetail
5. Re-ordered the range list to go from lowest detail at [0] to highest detail at the end. This is because OSG always loads the models starting from zero on the assumption that the detail increases with the index.
This fixes the pixel mode, which previously would use the radius of the parent which would be confusingly large, and unrelated to the actual size of the model. With the simple defaults that we have the pixel values set in the ranges won't exactly match the rendered size of the model on screen, but it will be a lot closer and more importantly meaningful.
- remove some global headers from AI headers, to avoid pollution
- change how ATC owns the ‘player’ FGAIAircraft so reset works
- ensure AIAircraft controllers are cleared on unbind for reset
- check for invalid tiles / buckets, which occurs at the poles
- use .sibling() method to offset
- no longer need to store view lat/lon in the manager.
Adapt to corresponding SG change to make SGMaterialLib be ref-counted,
and have the 'reload-materials' command notify the tile-manager of this,
so it can update the options struct it passes to new tiles.
When tiles are being loaded, re-evaluate the materials cache once
per update cycle. (This is probably too often, but no worse than the
previous approach).
Using a new TerraSync API, make the tile manager wait on actively
syncing tiles before sending them to the SceneryPager. This resolves numerous
issues with missing tiles, including at startup.
Make position finalisation happen in the same phase as scenery load, i.e as a task during the main loop, instead of during the init loop. This is compatible with the existing reset logic. Unfortunately more work is needed; the environment code doesn't update the local station quickly enough on reset. (Fixing that is next!)
SceneryPager singleton must not be removed while FGScenery is still alive,
so hold a reference to it in FGScenery, saving the pager from being
deleted first.
Aircraft could fall through the ground on scenery reload. Properly reset
the "sceneryloaded" flag to pause FDM processing while scenery is being
reloaded. Also stop processing some instruments while scenery is reloaded.
This way of scenery paging is really application code.
Now that the simgear stg loader is seperated from the paging
code, this appication specific paging can reside here.
May be at some time also use the spt stuff here.