If /sim/highlighting/enabled is true, we highlight animated objects under the
pointer, and also highlight other objects that are animated by the same or
related properties.
The intent here is to be able to give a visual indication of what cockpit
controls do or what cockpit controls affect particular aircraft objects - for
example moving the pointer over the flaps will highlight the flaps and also
highlight any controls or rotary indicators in the cockpit that are associated
with the flaps.
To make this work, we have to discover associations between properties. This
is currently done for YASim (e.g. associations between /controls/flight/flaps
and /surface-positions/flap-pos-norm) and autopilot filters (e.g. with
the 777, digital filters associate /controls/flight/rudder-nul with
/fcs/fbw/yaw/rudder-ratio-out). We don't currently gather associations between
properties in JSBSim
We also detect associations between dialogs, menus and keypresses and
properties, which is used to populate /sim/highlighting/current with
information about dialogs, menus and keypresses that are associated with the
currently highlighted nodes' properties.
Details:
src/GUI/Highlight.cxx
src/GUI/Highlight.hxx
src/GUI/CMakeLists.txt
src/Main/fg_init.cxx
New subsystem called 'highlight', with support for registering and
recovering links between menus, dialogs, keypresses and OSG node
animations.
Provides a function Highlight::highlight_nodes() which highlights
related nodes using internal NodeHighlighting class, and populates
/sim/highlighting/current with information about related dialogs, menus and
keypresses.
The NodeHighlighting class works by making nodes use an alternative
StateSet which shows up as a distinct material on screen. We remember each
highlighted node's original StateSet so that we can un-highlight. We update
the material parameters using a listener for /sim/highlighting/material,
which allows some control over the appearence of highlighted nodes.
src/FDM/flight.cxx
src/FDM/flight.hxx
Added virtual method FGInterface::property_associations() which returns
property associations from the FDM. Default implementation returns empty
set. Implemented in YASim, but not (yet) in JSBSim. Uses a simple function
pointer at the moment to avoid requring FDMs to use recent C++ features.
src/FDM/YASim/FGFDM.cpp
src/FDM/YASim/FGFDM.hpp
src/FDM/YASim/YASim.cxx
src/FDM/YASim/YASim.hxx
Gathers information about property associations on startup such as
/controls/flight/flaps => /surface-positions/flap-pos-norm, then
YASim::property_associations() overrides default implementation to return
these associations.
src/Autopilot/analogcomponent.cxx
src/Autopilot/analogcomponent.hxx
src/Autopilot/digitalfilter.cxx
src/Autopilot/inputvalue.cxx
src/Autopilot/inputvalue.hxx
Filters now gather information about their input/output properties and
register with Highlight::add_property_property(). For example this makes
highlighting work on the 777, where pilot controls affect control surfaces
only via filters.
src/GUI/new_gui.cxx
Scan menus, keypresses and dialogs and register associations with
Highlight::add_*().
src/GUI/property_list.cxx
src/GUI/property_list.hxx
src/GUI/FGPUIDialog.cxx
Added <readonly> flag to property-list. If set, we don't show .. or . items
and don't respond to mouse/keyboard.
Used by fgdata's new Highlighting dialogue.
src/Model/acmodel.cxx
src/Model/acmodel.hxx
Visit the user aircraft's scene graph when it is loaded, gathering
information about osg::Node's that are animated by properties, and register
these associations with Highlight::add_property_node().
src/Viewer/renderer.cxx
When scanning for pick highlights, use Highlight::highlight_nodes() to
highlight animated objects under the pointer and related objects.
Update osgXR to 0.3.3 which provides support for visibility masks using
the depth buffer, and extend VRManager to support them.
The following properties are added:
- /sim/vr/openxr/extensions/visibility-mask: This exposes whether
visibility masks are supported by the current OpenXR runtime, and
maps to osgXR::Manager::hasVisibilityMaskExtension().
- /sim/vr/visibility-mask: This allows visibility masks to be enabled
and disabled, and maps to osgXR::Settings::setVisibilityMask() via a
listener.
Finally we inform osgXR that it should use SimGear's newly defined
LEFT_BIT and RIGHT_BIT NodeMask bits for the visibility masks using
osgXR::Manager::setVisibilityMaskNodeMasks(). This allows a single
stereo camera to have a visibility mask for each eye.
Transponder-checking code is now done in new static function
checkTransponderLocal() which also sets altitude via an out-param. This
avoids duplicate string comparisons in the previous checkTransponder() and
getAltitude() functions.
Also check for controls/invisible for all aircraft, which could allow ignoring
of AI and Swift aircraft in future.
TCAS::ThreatDetector::checkTransponder() now simply calls
checkTransponderLocal() with a dummy altitude out-param; it doesn't appear to
be used so could probably be removed.
Change the assumption that velocity < 40kt implies the transponder is off, to
only apply to AI aircraft, because exact information is available for other
(i.e. multiplayer and swift) aircraft.
Add new check for multiplayer/swift aircraft where if the altitude is -9999, we
treat the transponder as off.
With swift and multiplayer aircraft, use the transponder altitude information,
not the sim's internal altitude data for the aircraft.
Set up the default camera as a mirror of the VR view when needed, using
a new CameraInfo flag named VR_MIRROR based on a camera property
"vr-mirror" which is set on the default camera group. When set this flag
causes the compositor to be constructed (and reloaded) using
buildVRMirrorCompositor() and osgXR's mirror camera setup code, rather
than the usual Compositor::create().
Implement VR mirror properties and associated getUseMirror() accessor:
- /sim/vr/mirror-mode: This will allow the user to control the VR
mirror via a GUI.
- /sim/vr/mirror-enabled: This isn't written, but is used by
getUseMirror() in combination with isRunning() to determine whether
the mirror should be used.
Use the newly added simgear::Compositor::resetOrderOffset() to reset the
order offset counter with each compositor reload. This prevents the
counter increasing indefinitely, which soon results in render orders
beyond those set statically for the GUI and upcoming VR mirror.
Patch by Michael Danilov: allow an aircraft set XML to define the requied
directory name, and if one is provided, validate the actual name against
this. This catches common issues where a manually downloaded aircraft
has the wrong name and some assets will therefore not load.
SF-Ticket-ID: https://sourceforge.net/p/flightgear/codetickets/2647/
Implement support for virtual reality headsets via version 0.3 of the
osgXR[1] library I've been working on which uses OpenXR.
Add a new VRManager class based on osgXR::Manager to implement its
callbacks. When osgXR needs a new view created, we build a new camera in
the default camera group, and notify osgXR of each new "scene" typed
render pass. It also hooks into the CameraInfo's new compositor reload
callback to ensure osgXR is updated when the compositors are reloaded.
VR settings are controlled by properties, and new --enable-vr /
--disable-vr options are implemented to enable/disable VR at start.
This is enough to get basic VR for looking around the cockpit, but more
work will be required to support a desktop mirror of VR view, VR splash
screen, VR GUI, controller interaction, and correct positional sound.
[1] https://github.com/amalon/osgXR
* Relax runway exit route requirement to 80°
* Ensure parking is only reset if airport for AI aircraft has changed
* Heading Error signed and arrival lead distance
This was a long-standing issue where Canvas cameras were rendered
multiple times, once per slave camera. In the case of the Classic
pipeline they were being rendered twice.
Making them slave cameras has the issue of them not being shared
across GraphicsContexts anymore, so it's not possible to see Canvas
displays in extra CameraGroup windows. This is fixed by using OSG
context sharing feature and sharing the initial windows' context
with all subsequent windows.
Add a compositor reload callback object to CameraInfo, with callbacks
for just prior and after the CameraInfo's compositor is reloaded by
reloadCompositors().
This will allow VR cameras to be reconfigured after a reload.
Add removeCamera() method to CameraGroup to find and remove a single
CameraInfo.
This will allow cameras created for VR to be dynamically reconfigured.
Since 'center on aircraft' is now persistent, we need to expliictly init
this value when showing the map. Thanks to Michael Danilov and Colin
Geniet for the fix.
SF-Id: https://sourceforge.net/p/flightgear/codetickets/2637/