The existence of the property that is used for <table> independent vars is now checked during execution rather than when the XML definition is parsed. This relaxes the order in which filters, table and more generally flight controls need to be declared in the XML definition files.
E.g. fgaddon/Aircraft/Icaro_MRX13/Icaro_Laminar_13_MRX-set.xml sets
/sim/current-view/view-number to 9.
It seems that recent View changes broke this, but this fix is in unchanged
code.
Prior to the recent multiplayer view changes, /sim/current-view/?-offset-m
contained the current view's offsets from /sim/view[]/config/?-offset-m. The
multiplayer view changes modified things to set /sim/current-view/?-offset-m
to zeros, and instead use /sim/view[]/config/?-offset-m. This was so
that multiplayer views could be implemented simply by prefixing with
/ai/models/multiplayer[]/set/ to get the right offsets.
We still added in /sim/current-view/?-offset-m, but these were usually zero.
However some aircraft write to /sim/current-view/?-offset-m, and assume that
values must include the /sim/view[]/config/?-offset-m. E.g. the spaceshuttle
does this in order to simulate SRB shaking. This results in the offset being
included twice, which breaks things.
So this commit restores the original handling of /sim/current-view/?-offset-m
by doing an additional subtraction of /sim/view[]/config/?-offset-m. It also
avoids resetting /sim/current-view/?-offset-m to zeros when the view changes.
This results in views working for user aircraft, user aircraft that do custom
view handling, and multiplayer aircraft.
- [Backward compatibility breakage] Gyros are now measuring rotation rates instead of rotational accelerations. Gyros that measure rotational accelerations do not exist in the real world.
- Output properties of flight control elements are no longer tied. This saves a lot of spurious warning messages and allows direct references of the same properties among several flight controls.
- Water vapor in the atmosphere is now managed through its mass fraction rather than its partial pressure. The former being the physical quantity that is conserved when pressure and temperature vary.
- Check that there are at least 3 contacts before trying to trim on ground.
- ECEF to ECI frame conversion has been moved from FGLocation to FGPropagate and FGInitialConditions since not all FGLocation need to manage that.
- Gravity computations have been moved to FGInertial because it is where all the constants to compute gravity are stored. This reduces the amount of data transmitted between FGInertial and FGAccelerations.
- Added optional transmission of the simulation time for FG UDP interface
- Code cleanup and use more C++11 idioms (override, constexpr, range-based for loop, etc.)
We now keep the aircraft in view when zooming, sacrificing the view of the
ground. I.e. we move the bottom of the view upwards, while keeping the top of
the view unchanged.
Recent changes to ViewPropertyEvaluator mean that
ViewPropertyEvaluator::getDoubleValue() doesn't handle default values very
well, so we were ending up with chase-distance of zero, not the default -25,
leading to over-zooming.
Un-caching of scenery appears to happen fairly often, and means that we fail
to find height of ground under aircraft, so we now go back to the last found
value instead of using zero.
This allows Tower View etc to use nearest tower when vewing remote multiplayer
aircraft.
Also force an update of nearest airport whenever multiplayer view changes, to
reduce delay before Tower View works.
SGVec3d's default constructor leaves the fields uninitialised, which seems to
sometimes break fg with lots of NaN-related diagnostics.
The fix is to use SGVec3d::zeros() instead.
Also call resetOffsetsAndFOV() from the View::View() constructor, to ensure
that things are set up consistently.
View 8 used to be new Tower View AGL view, but this interfered with hard-coded
aircraft view numbers. So fgdata now has removed Model View, meaning Tower
View AGL uses Model View's old number (7), which keeps sequential view numbers
unchanged.
src/MultiPlayer/multiplaymgr.cxx
src/MultiPlayer/multiplaymgr.hxx
removed starts_with() and ends_with() - already provided in simgear::.
removed output() fn for SGPropertyNode, as unused.
added makeStringPropertyNameSafe().
FGMultiplayMgr::addMultiplayer(): use std::find_if() to find model file.
added FGMultiplayMgr::subsystemName().
src/Viewer/view.cxx
src/Viewer/view.hxx
removed getDoubleValue() as not required.
moved agl code into new View::handleAGL() fn.
renamed View::Damping::setGet() => View::Damping::updateTarget().
Currently this works for all the default views except for Tower Look From (for
which it doesn't really make sense) and Fly-by View.
We now search for and load a -set.xml that matches the model .xml,
when new multiplayer aircraft is set up. This allows us to find view
offsets etc, e.g. allowing cockpit and helicopter views to work with
multiplayer aircraft. Properties from the -set.xml are placed into
/ai/models/multiplayer[]/set, so for example viewing offsets are in
/ai/models/multiplayer[]/set/sim/view[]/config/target-{x,y,z}-offset-m. We also
copy the aircraft's chase-distance into the view config params, similar to how
fgdata:defaults.xml does for the user's aircraft. And we also fill in views'
missing offsets from the Helicopter View config; e.g. this enables the new
Tower View AGL to show aircraft correctly centred, despite aircraft currently
not having this view defined in their -set.xml. [We don't currently attempt to
cache or reuse -set.xml data.]
Have ensured that view position responds to mouse movement in the same way for
viewing the user's aircraft as for multiplayer aircraft (previously, Model View
reversed the affect of vertical mouse movements).
Added new Tower AGL view. Behaves similarly to Tower view, but automatically
scales and pans vertically in order to always show the vertical range
extending from just above the aircraft down to the ground immediately below
the aircraft. We use aircrafts chase-distance as an indication of size. We
damp the ground level value to reduce the viewing jumping around too much
e.g. if the aircraft flies over buildings. The amount of damping is set by
fgdata:defaults.xml's lookat-agl-damping value.
Fixed problem where Tower View eye position moves slightly as target
aircraft heading changes. This was caused by us unnecessarily applying the
aircraft-centre correction to the eye position.
src/FDM/flight.cxx: also make /orientation/true-heading-deg. This allows
local orientation to be used like multiplayer orientation, which only
has /ai/models/multiplayer[]/orientation/true-heading-deg. [A better fix
might be to replace all occurrencies of /orientation/true-heading-deg with
/orientation/heading-deg, but this would be a rather large commit.]
Details:
src/Viewer/view.*: removed View::updateData() as is no longer required.
src/MultiPlayer/multiplaymgr.cxx: use helicopter view target offsets as
defaults. E.g. in tower view agl, aircraft won't currently be defining these
offsets. More generally, this allows aircraft to define target offsets only in
helicoter view.
src/FDM/flight.cxx
FGMultiplayMgr::FillMsgHdr(): Added tie of /orientation/true-heading-deg to
get_Psi_deg, so it duplictes the existing /orientation/heading-deg.
src/MultiPlayer/multiplaymgr.cxx
src/MultiPlayer/multiplaymgr.hxx
FGMultiplayMgr::addMultiplayer(): look for and load -set.xml that matches
the model. Patch various view-related things up in similar way to what we
do for the user's aircraft, so that multiplayer views work.
Made FGMultiplayMgr::getMultiplayer() public, so it can be used by
src/Viewer/view.cxx.
src/Viewer/view.cxx
src/Viewer/view.hxx
View::View(): Added lookat_agl, lookat_agl_damping params for new Tower
View AGL. Preserve user's field-of-view in separate variable so that Tower
View AGL can modify the actual field of view independently.
Added view_index param so that we can find multiplayer view[]/config/
properties.
getViewOffsets(): new fn that finds view offsets for user aircraft or
multiplayer aircraft.
View::recalcLookFrom() View::recalcLookAt: Lots of changes to allow things
to work with multiplayer aircraft. View::recalcLookAt() can now do Tower
View AGL.
View::Damping: support for damping, used by Tower View AGL. Might be good
to use this for other damping.
View::updateData(): removed, as calculations are now all done inside
View::recalc*().
put properties {x,y,z}-offset-m into new View::_adjust_offset_m member
instead of _offset_m. This avoids confusion between a view's offsets and
the offsets added in by the user via the 'Adjust View Position' dialogue.
src/Viewer/viewmgr.cxx
FGViewMgr::init(): pass view number to
flightgear::View::createFromProperties().