Allow other code to map property values to an naRef, without exposing
the generic property node on their API. This avoids creating a wrapper
props.Node frequently for simple value access.
(Disabled by a CMake option)
This builds equivalent C++ objects to what the PUI dialogs build, with
properties exposed to Nasal. Peer objects are created by Nasal callbacks,
which can implement the various dialog functions needed to keep
compatibility, especially the ‘update’ and ‘apply’ hooks.
Create lag/foo properties used by the Pilot-list UI in bind(). This avoids
a race condition where motion info was not yet updated, but Nasal tries
to retrieve the lag properties and errors out.
Flightgear 2020.3 releases use a different encoding for multiplayer information
in Normal recordings (these are saved from in-memory recording data), which
we failed to parse. This commit restores handling of this encoding, enabling
replay of older recordings.
Also when replaying in-memory recording, don't do background in-memory record
of multiplayer information, because this gradually prunes the information that
is being replayed.
from Chris RINGEVAL
https://sourceforge.net/p/flightgear/flightgear/merge-requests/273/
Squashed commit of the following:
commit ea6e808e418533db1a41671c67a7873ddbfcc858
Author: Gonzalo Pesquero <gpesquero@yahoo.es>
Date: Sun Nov 21 17:44:44 2021 +0100
Add translations on splash screen
commit 3c47d771877743692f5d0d63e980d6694a549405
Author: Chris Ringeval <eatdirt@protonmail.com>
Date: Sat Nov 27 16:37:31 2021 +0100
Moon direction vector in the eye frame available to shaders
commit 70728f7ea29dad75c34cad69745021ee927bea31
Author: Chris Ringeval <eatdirt@protonmail.com>
Date: Sun Nov 21 22:18:38 2021 +0100
Add altitude to scolor object as needed by Milky Way texturing
FIx some bugs in computing turnExitPos for fly-over waypoints,
and computing leg course when preceeeding leg is a runway.
In both cass we had an incorrect turnExitPos, so points along
the leg were incorreclty positioned.
Extend the test cases to cover this further.
Make the max-flyBy angle configuable, since for exmaple AIrbus uses 90
degrees. Expose this via a new gps/config property, and extend the tests
to verify that angles greater than the fly-by angle behav as fly-over
waypoints.
Extend the RoutePath code to share this configuration, so that route
visualisations match the configured angle.
SF-ID: https://sourceforge.net/p/flightgear/codetickets/2694/
When we don't build any wapy controller, also bail out, rather than
crashing. Jonathan could trigger this with an empty route on the A320,
although no stand-alone test-case so far.
SF-ID: https://sourceforge.net/p/flightgear/codetickets/2695/
Previosu parse had embedded whitespace which is annoying
to parse in other places, switch to using backslash to
seperate terms, similar to how navdaid offsets are defined.
Add a bool flag isRoute to flight-plan, and use it to model
routes (which contain VIAs) from plans/legs, which do not.
Default isRoute to false, so most users only see expanded
Vias, and hence something that can be flown directly.
Allow making the AP source indirect (via a string property),
so that the actual source property can be configured or
adjusted from a -set.xml, or at runtime.
virtual dtor
initialize members before the ctor
config.h is not used
YawTo() is unused
assertSpeed() is unused
initializeFlightPlan() is unused
getTimeString() is unused
get/set is old school
default dtor
YawTo() seems to be unused
ensure all members are initialized
_path and _elevation_m were hiding parent members
config.h is not used
TODO: string compare not via strcmp()
TODO: remove magic number
Handle removal of SGPropertyNode::getValue<const char *>() in
VRManager::Listener<const char *>::valueChanged() by switching the
string listeners and VRManager setter handlers to std::string.
This fixes the following link error when VR is enabled:
ld: VRManager.cxx.o: in function `flightgear::VRManager::Listener<char const*>::valueChanged(SGPropertyNode*)':
src/Viewer/VRManager.hxx:147: undefined reference to `char const* SGPropertyNode::getValue<char const*>(std::enable_if<simgear::props::PropertyTraits<char const*>::Internal, void>::type*) const'
If continuous compression is enabled, we used to compress recovery recording's
data, without setting continuous-compression to true in recording header, so it
would fail to load.
The fix is to compress recording data only if we are making a continuous
recording.
Two affected places:
- the built-in launcher (command line options link);
- package/org.flightgear.FlightGear.metainfo.in.
The previous link points to an old version of the manual.
It doesn't look like menubar items can be enabled/disabled using <property>
or <expression>, so instead we write to the File menu's items tree
/sim/menubar/default/menu[]/name[]/enabled.
We also set /sim/video/encoding-path to '' or path of video file that we are
encoding to.
Improve argument parsing for createViaTo, createViaFromTo to
handle Airway ghosts as well as strings. As part of this, allow
specification of the airway level explicitly when looking
up an airway.
SF-ID: https://sourceforge.net/p/flightgear/codetickets/2686/
geodFromHash() will now respect the _pdirty and _cdirty flags. This
ensres that FGPositioned functions are protected from invalid or
outdated coordinates, and therefore from erroneous results.
This is by Lars Toenning <dev@ltoenning.de>, Roman Ludwicki <romek21@op.pl> and
SDeAstis <salvatore.deastis@gmail.com>, in 2021 Hackathon.
Also cope with removal of SGPropertyNode::getName() - use getNameString()
instead.
Make --view-offset set /sim/view[0]/config/heading-offset-deg instead of
/sim/current-view/heading-offset-deg. Setting the latter has no effect
because of what flightgear::View::createFromProperties() does when it
initializes flightgear::View::View. This was discussed at [1].
[1] https://sourceforge.net/p/flightgear/mailman/message/37406317/
_simple_time_fdm was not being initialised, which was causing occasional hangs
on startup. So set to zero in constructor and TimeManager::init().
For simplicity, we also initialise all other basic type state in the
TimeManager class.
If _simple_time_fdm's starting value happens to be very large (e.g. 1e228),
_simple_time_fdm + fixed_dt would result in _simple_time_fdm, so we would end
up always setting simDt and realDt to zero.
This stops SGEventMgr from processing any events, which means that
initPosition()'s event to call finalizePosition() is never processed so
/sim/position-finalized is stuck on false, which results in the FDM never
setting /sim/fdm-initialized.
This will fix other uses of the APi blocking because the backend
failed to start. Enable debug logging in non-release builds so
it's obvious when the deploymenty is not configured right.
If specified we start video encoding when replay starts, and stop video
encoding when we reach recording end.
This is supported with --load-tape on the command line and from the 'Load tape'
dialogue.
src/Aircraft/continuous.cxx
src/Aircraft/continuous.hxx
If stopping replay with auto create video, then stop video encoding and
restore original /sim/time/fixed-dt if we changed it.
src/Aircraft/replay-internal.cxx
src/Aircraft/replay-internal.hxx
When starting replay, call view_mgr->video_start() and set
/sim/time/fixed-dt if specified.
src/Aircraft/replay.cxx
src/Aircraft/replay.hxx
loadTape(): added bool create_video and double fixed_dt args.
src/Main/options.cxx
Added new command-line options --load-tape-create-video and
--load-tape-fixed-dt=<double> to allow auto create video and fixed-dt when
replaying.
The main FGReplay subsystem class now contains just the public API for
record/replay, plus a pointer to instance of new ReplayInternal implementation
class. Also moved some Continuous-specific code into new source file.
src/Aircraft/CMakeLists.txt
Updated for new files.
src/Aircraft/continuous.cxx
src/Aircraft/continuous.hxx
New, code specific to Continuous record/replay.
src/Aircraft/flightrecorder.hxx
Minor changes.
src/Aircraft/replay-internal.cxx
src/Aircraft/replay-internal.hxx
New, contains implementation of record/replay.
src/Aircraft/replay.cxx
src/Aircraft/replay.hxx
Modified to be just concerned with public record/replay API. The
implementation now defers to the ReplayInternal instance. Added support for
auto create-video when loading Continuous recording.
src/Main/fg_init.cxx
resetStatisticsProperties() is now in FGReplay, not FGReplayData - the
latter is not in the replay.hxx header any more.
Uses simgear::VideoEncoder().
Added video-start and video-stop commands. We allow specification of container,
codec, quality, speed and bitrate.
src/Main/fg_commands.cxx
Added video-start and video-stop commands.
src/Viewer/viewmgr.cxx
src/Viewer/viewmgr.hxx
Added video_start() and video_stop().
If in simple-time mode and /sim/time/fixed-dt is non-zero, we always increment
FDM time by fixed amount each frame, regardless of frame rate. Allows creation
of high quality videos even on slow hardware.
src/AIModel/AICarrier.cxx
Avoid warning about unused angle_tdp variable.
src/AIModel/AIFlightPlanCreate.cxx
Increased a buffer size that was giving warning with snprintf(). Also
always use sizeof(buffer) instead of duplicating the explicit size.
- Fixed an error which prevented the equatorial and polar radii from <planet> to be propagated to the initial conditions.
- The planet radii in <planet> can now be specified by the tags <equatorial_radius> and <polar_radius> which are more self explanatory than <semimajor_axis> and <semiminor_axis> (which are still valid).
- Improved the error messages returned by FGTable: the file name and line number where the error occurred are now printed.
- Check the number of <input> tags for flight controls such as <pure_gain> (GitHub issue #497). This avoids a crash when some or all <input> elements are missing.
- JSBSim now accepts 2 sign conventions for the cross product inertia (xy, xz, yz) in <mass_balance> (GitHub Pull Request #502). The sign convention is specified by the parameter negated_crossproduct_inertia which defaults to true for backward compatibility.
- Turbine engines can now windmill even before they start (GitHub issue #494 and Pull Request #509).
- Fixed a sign error in the computation of aero/h_b-mac-ft (GitHub Pull Request #508 )
- Fixed a bug where FGTable instances were not untied from the property manager during their destruction. This could lead to segmentation faults when the property manager was later destroyed.
- Exceptions raised by FGTable are now instances of the TableException class.
src/AIModel/AIFlightPlan.cxx:
Clarify expression with extra round brackets.
src/AIModel/AIFlightPlanCreate.cxx:
Increased buffer size to match longest possible string.
src/FDM/JSBSim/input_output/FGOutputFG.cpp:
Use cast to avoid comparison of int with enum.
scripts/python/performance_replay.py
New, script for replaying a recording in Flightgear and gathering
statistics.
scripts/python/recordreplay.py
Minor change.
src/Aircraft/replay.cxx
src/Aircraft/replay.hxx
If /sim/replay/log-frame-times is true, populate
/sim/replay/log-frame-times/dt[] with frame times while replaying.
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.
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/
Reversed the affect of mouse in some legacy views, e.g. Helicopter and Pilot
views now move in expected direction for mouse drags. Also increased scale
of movement to make things similar to the default view system.
In chase view etc, apply mouse movements after damping of aircraft orientation,
previously mouse movements were getting damped.
Removed SviewStepFinalToTarget. SviewStepFinal now automatically aims at target
if new posdir.target_is_set flag is true.
Improved double views: Avoid duplicate SviewStepCopyToTarget step. Disabled
mouse drag handling - was gives weird results and is not required or
helpful. Be more consistent in using target position if available, otherwise
eye position; for example using a Helicopter view to create a double view now
uses the target of the helicopter view, not the eye point, which works much
better.
Removed internal use of SviewStepFinal from SviewStepDouble - used to be
special case.
Split mouse drag handling out of SviewStepRotate into new SviewStepMouseDrag.
Simplified last-pair code - both last-pair and last-pair double find position
and target in the same way.
Added <startup-current> param. Default is false which preserves previous
behaviour where internal state is initialised to zero. Otherwise we initialise
internal state using the current error value, which can reduce oscillations.
Added <startup-its> param, default is zero. For the first <startup-its>
iterations we don't update the output, which can be used to cope with initial
bad data from earlier controllers.
Also refactored the code to hopefully make it clearer and modified debug
logging to output all info in a single statement and on a single line for
clarity.
For example avoid initial oscillations with:
<pid-controller>
..
<startup-current>true</startup-current>
...
</pid-controller>
Ever since support for CompositeViewer was added in f62e5b9ce3,
FGEventHandler::eventToViewport() has been always calling
window_builder->getDefaultWindow() so it could decide whether an event was for
the main window or not. But if a custom camera-group was specified, there would
be no existing window called 'FlightGear' so getDefaultWindow() would create
one, which then interfered with event handling.
The fix is to change the global WindowBuilder::defaultWindowName to match
sim/rendering/camera-group/gui/window/name when we are handling a custom
camera-group, which ensures that when FGEventHandler::eventToViewport() calls
window_builder->getDefaultWindow(), it gets the main window, not a new window
called 'FlightGear'.