Generate Ocean tiles where no scenery is available.
As a side-effect, this also fixes bug which caused
sim to hang if unable to find WS3.0 scenery at
starting location.
Previously WS30 data from STG files - in particular road/rail/river
data - was kept permanently.
This change unloads it with the STG-level tile. This is the right
level to do so, as it will be reloaded from tile when the STG file
is loaded again.
Previously any missing WS30 tiles created multiple OSG WARN
messages from the file not being found. This change does a check
to ensure the file actually exists before put it on the queue for
loading.
Previously VPB tiles were loaded by the STG file loader.
This was not ideal as the VPB tile granularity is 1x1 degree
while the STG file loader is 20x20km.
This change makes the tile manager load VPB tiles explicitly
on range, and allows better prioritization of the underlying
terrain.
Configure the VPB elevation mesh via properties:
/scenery/elevation-mesh/sample-ratio controls the elevation
mesh sampling, allowing reduction in mesh size
/scenery/elevation-mesh/vertical-scale is just for fun and
scales the mesh vertically making mountains taller.
/scenery/elevation-mesh/constraint-gap-m controls how much below
airports etc. elevation vertices are forced to be.
Overview:
Previously Flightgear always used a single osgViewer::Viewer(), which
inherits from both osgViewer::ViewerBase and osgViewer::View, giving a
single view window.
If CompositeViewer is enabled, we instead use a osgViewer::CompositeViewer
which contains a list of osgViewer::View's. Each of these View's can have
its own eye position, so we can have multiple different views of the same
scene.
Enable at runtime with: --composite-viewer=1
Changes to allow use of osgViewer::CompositeViewer:
Previously FGRenderer had this method:
osgViewer::Viewer* getViewer();
This has been replaced by these two new methods:
osgViewer::ViewerBase* getViewerBase();
osgViewer::View* getView();
If CompositeViewer is not enabled (the default), the actual runtime state
is unchanged, and getViewerBase() and getView() both return a pointer to
the singleton osgViewer::Viewer() object.
If CompositeViewer is enabled, getViewerBase() returns a pointer to a
singleton osgViewer::CompositeViewer object, and getView() returns a
pointer to the first osgViewer::View in the osgViewer::CompositeViewer's
list.
The other significant change to FGRenderer() is the new method:
osg::FrameStamp* getFrameStamp()
If CompositeViewer is not enabled, this simply returns
getView()->getFrameStamp(). If CompositeViewer is enabled it returns
getViewerBase()->getFrameStamp(). It is important that code that previously
called getView()->getFrameStamp() is changed to use the new method, because
when CompositeViewer is enabled individual osgViewer::View's appear to
return an osg::FrameStamp with zero frame number).
All code that uses FGRenderer has been patched up to use the new methods so
that things work as before regardless of whether CompositeViewer is enabled
or not.
We make FGRenderer::update() call SviewUpdate() which updates any extra
views.
Extra view windows:
If CompositeViewer is enabled, one can create top-level extra view windows
by calling SviewCreate(). See src/Viewer/sview.hxx for details.
Each extra view window has its own simgear::compositor::Compositor
instance.
Currently SviewCreate() can create extra view windows that clone the
current view, or view from one point to another (e.g. from one multiplayer
aircraft to the user's aircradt) or keep two aircraft in view, one at a
fixed distance in the foreground.
SviewCreate() can be called from nasal via new nasal commands "view-clone",
"view-last-pair", "view-last-pair-double" and "view-push". Associated
changes to fgdata gives access to these via the View menu. The "view-push"
command tags the current view for later use by "view-last-pair" and
"view-last-pair-double".
Extra view windows created by SviewCreate() use a new view system called
Sview, which allows views to be constructed at runtime instead of being
hard-coded in *-set.xml files. This is work in progress and views aren't
all fully implemented. For example Pilot view gets things slightly wrong
with large roll values, Tower View AGL is not implemented, and we don't
implement damping. See top of src/Viewer/sview.cxx for an overview.
OpenSceneGraph-3.4 issues:
OSG-3.4's event handling seems to be incorrect with CompositeViewer -
events get sent for the wrong window which causes issues with resize and
closing. It doesn't seem to be possible to work around this, so closing
extra view windows can end up closing the main window for example.
OSG-3.6 seems to fix the problems.
We warn if CompositeViewer is enabled and OpenSceneGraph is 3.4.
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.