Commit Graph

6058 Commits

Author SHA1 Message Date
Florent Rougon
3ae3a9fb72 SGSampleGroup::remove(): immediately remove from _samples by default
Code in AudioIdent::setIdent() expects that SGSampleGroup::remove() does
remove the corresponding item from _samples, however SG commit 47aae88ab
broke this assumption, which caused the bug reported at [1].

Restore the immediate removal from _samples by default. For the special
case where we do need delayed removal (i.e., while
SGSampleGroup::update() is iterating over _samples), the new optional
parameter is passed the value true. For a longer explanation, see [2].

This fixes a crash when swapping the selected and standby frequencies
for the NAV1 or NAV2 instrument (more precise description at [1]).

[1] https://forum.flightgear.org/viewtopic.php?f=25&t=40890
[2] https://sourceforge.net/p/flightgear/mailman/message/37721699/
2022-10-17 17:57:07 +02:00
Stuart Buchanan
96a9abfd7a WS30: Improved Atlas encapsulation 2022-10-14 21:36:25 +01:00
Scott Giese
2b9a319e76 portability: change uint to unsigned int 2022-10-11 10:14:49 -05:00
Scott Giese
eb5499fb10 maintenance: eliminated 19 compiler warnings 2022-10-09 18:36:37 -05:00
Stuart Buchanan
e50337e36a Ensure Build Bounding Box doesn't collapse
Previously the Bounding Box of a group of building was calculated
purely based on the position of each building.  Depending on the
geometry of the various buildings, this could result in a zero-volume
box, which would be culled away.

This change ensures that the BB is at least a 20x20x20 volume, by
increasing the convex hull size.

Fixes https://sourceforge.net/p/flightgear/codetickets/2542/
2022-10-08 22:41:48 +01:00
James Turner
836ee9a3f0 Accept old XML model paths for some models
Update my work-around for this from last year, and handle another
case (where models are loaded directly rather using the delayed
callback via the osgDB::Pager)

Where we replaced the XMl-wrapper with an AC model in FGData or
TerraSync, accept the old path ending in .xml, to avoid many errors
loading custom scenery.
2022-10-03 14:45:19 +01:00
James Turner
3ef521b53f Add parse test for CB with no coverage
Causes crashes but inside FlightGear
2022-10-03 14:36:20 +01:00
Erik Hofman
47aae88aba Revert a8d3397fb4 and arase entries from the _sample map after the loop 2022-10-03 13:53:24 +02:00
Richard Harrison
49dd3cad33 Change axis object animations to be compatible with <=2020.3 refs Ticket #2706
The changes to the sorting rules caused a breaking change that was incompatible.

The solution to this is to revert to being compatible with <=2020.3 but also to allow modellers to choose the new sorting rules.

I've added a new tag <defaults> which can contain either <axis-animation-vertex-order-xyz/> or <axis-animation-vertex-order-x/>. The defaults will affect all animations in the .xml and also any included models unless the included model also has a <defaults> section.

So for modelers that want to use the new definitive vertex sorting rules adding the following to the main model is sufficient.

    <defaults>
        <axis-animation-vertex-order-xyz/>
    </defaults>

There are also a couple of new tags that can be used in the <axis> section.

1. <order-by-xyz/> - use the new sorting rules
2. <order-by-x/> - use the 2020.3 sorting rules
3. <swap-axis-direction/> - when the animation goes the wrong way this is an elegant way to fix it.

See https://sourceforge.net/p/flightgear/codetickets/2706/
2022-09-30 19:04:11 +01:00
Scott Giese
0851dd5cf1 suppress warning: does not guard.
whitespace fix.
2022-09-24 22:02:07 -05:00
Erik Hofman
a8d3397fb4 std::map entries can not be removed when inside a for (auto current : _samples) loop. Rework the removal code to accept the iterator itself and move incrementing the iterator until after the erase action or let the erase action assign the new iterator. 2022-09-24 10:23:52 +02:00
Erik Hofman
9e20d853f7 Tie the SoundGroup to the listener (not really necessary in this case but it provides a good hint) and call the soundmanager update after setting the position and orientation to activate the repositioning. This wil make the first sample to be heard immidiately. 2022-09-23 11:53:01 +02:00
Erik Hofman
3ffbec41ee Prevent NaNs for orientation too 2022-09-23 11:24:50 +02:00
James Turner
c66a2bffe5 XML submodel: log the model name in the error.
Try to improve diagnosis of problems where overlay XML Nodes are used,
and the model path might be empty, as happened with the 737-800
2022-09-12 13:30:33 +01:00
James Turner
423fd4e842 Model XML: pass the model path to osgDB::Options
To allow giving better error feedback in the AC3D loader, pass the
file path explicitly as a plugin data string, so we can report it.
2022-09-09 12:17:11 +01:00
James Turner
272399e833 XMLSound: report failures via the new system
Ensure that misconfigured XML-sound files are traced to the aircraft
2022-09-09 12:04:45 +01:00
James Turner
b2666c40f7 DNSClient: reorder timeout check
Check completion before timeout, so that complete requests which have
also exceeded their timeout don’t crash
2022-09-09 12:03:43 +01:00
Florent Rougon
cc3fab04a3 ResourceManager::findPath(): remove the first validate() call and warning
- Remove the SGPath::validate() call added in commit
  22779ee2c4 (first part of findPath():
  when it is called with a non-null second argument).

- Remove the warning printed when the assembled path is absolute and
  fails the SGPath::validate() read permission test (this caused too
  much noise and confusion).

- Keep the behavior or accepting absolute, existing paths that pass the
  SGPath::validate() read permission test.

This way, the 'play-audio-sample' FGCommand will continue to work with
absolute paths. If/when the built-in launcher is updated to set up the
read-allowed paths early enough, maybe we can revert FG commits
3ee54cbd72bd8f and 896be707ae558 and re-add the SGPath::validate()
call in the first part of findPath()---assuming it is deemed useful.
2022-08-28 14:53:05 +02:00
Florent Rougon
f906d82213 embedded_resources_test.cxx: fix warnings 2022-08-27 11:08:21 +02:00
Florent Rougon
64c5ed2be1 ResourceManager::findPath(): adjust a comment
Based on a discussion on flightgear-devel (see in particular James
Turner's message at [1]).

[1] https://sourceforge.net/p/flightgear/mailman/message/37697739/
2022-08-24 15:03:44 +02:00
Florent Rougon
22779ee2c4 ResourceManager::findPath(): validate; accept absolute, read-allowed paths
- Perform the SGPath::validate() test for read access before returning a
  path obtained with a non-null second argument ("aContext").

- If SGPath(aContext, aResource) is an absolute path for which read
  access is authorized by SGPath::validate(), return it. This restores
  the possibility of using the 'play-audio-sample' FGCommand with an
  absolute, read-allowed path (was lost in FG commit 8853fded2953959).

- Because a fair number of the existing uses of
  ResourceManager::findPath() are not quite correct IMO, we execute the
  final part where all providers are tried in turn even if
  SGPath(aContext, aResource) is an absolute path (otherwise, the sim
  wouldn't start because it couldn't load materials.xml---see [1]).

- The SG_LOG call will spot a few errors in calling code/data, such as
  access tried for
  '/Aircraft/Generic/flightrecorder/generic-piston-propeller-4.xml' and
  '/Textures/Sky/cl_cumulus2.png'; since the function does not return at
  this point, these incorrect absolute paths which should be relative
  will still be given a chance with the BasePathProvider that has its
  base path set to $FG_ROOT; thus, they will be found as before this
  commit despite the new "access refused" warning (but please fix
  them!).

This commit requires FlightGear commit e7594f46876fc6b0b.

[1] https://sourceforge.net/p/flightgear/mailman/message/37697516/
2022-08-24 01:33:57 +02:00
Florent Rougon
9608072787 SGPath: make read_allowed_paths and write_allowed_paths static data members
No functional change, only a tidier organization.
2022-08-22 23:59:37 +02:00
Florent Rougon
e002a481f4 Import FlightGear's fgValidatePath() as SGPath::validate()
This will allow us to perform access control validation in SimGear. The
current implementation of SGPath::validate() is 99% Rebecca Palmer's
work (see fgValidatePath() in FlightGear commit
6a30e7086ea2f1a060dd77dab6e7e8a15b43e82d); only the coding style has
been slightly modernized here since we can now use, for instance,
C++11's range-based for loop.
2022-08-22 13:15:48 +02:00
Florent Rougon
1ef4a7eb9e SGPath: rename validate() to updateAttrsIfNull()
This is to avoid confusion because the following commit will make
SGPath::validate(bool) replace the fgValidatePath() function from the
FlightGear repository.
2022-08-22 12:58:11 +02:00
Florent Rougon
8febf6b9f5 SGSoundSample constructor changes
- Add an explicit constructor SGSoundSample(const SGPath& file) that
  directly uses the specified path instead of going through
  ResourceManager::findPath().

- Reimplement the existing constructor as
  SGSoundSample(const std::string& file, const SGPath& dir),
  delegating to the new one.

- The first argument of the delegating constructor is now a
  const std::string& instead of a const char*.

Among others, this will allow a better implementation of
FGSoundManager::playAudioSampleCommand(). More explanations can be found
here:

  https://sourceforge.net/p/flightgear/mailman/message/37695786/
2022-08-20 08:20:38 +02:00
James Hogan
8e43ccc87b
Compositor: Fix log message about shadow pass
Fix a slightly messy log message about a pass not being a shadow pass,
where there was no end quote or space after the pass name.
2022-07-30 23:56:57 +01:00
Erik Hofman
aead0a305f Jean-Paul Acneaux (www2):
Update the world magnetic model data set from WMM2015 to WMM2020.
2022-07-24 08:29:48 +02:00
James Turner
b1dbb9499c METAR parsing: parse more cloud covers
Parse cloud coverage with no coverage or height
SF-ID: https://sourceforge.net/p/flightgear/codetickets/2750/
2022-07-01 16:24:36 +02:00
James Turner
a74181ded9 Allow specifing TerraSync DNS nameserver 2022-06-07 23:15:29 +01:00
Lars Toenning
8f940ed4f2 Fix SPDX license identifier 2022-06-03 09:58:56 +01:00
James Turner
a47b214c18 Allow SGVec<> isNaN in release build 2022-06-01 14:57:37 +01:00
Lars Toenning
4259db0b8f Add unittest for SGTimer/SGTimerQueue 2022-05-29 19:12:06 +01:00
Stuart Buchanan
a8cb72d653 WS30: Improved coastlines
Build a high resolution texture containing coastline
data that will be mixed with the landclass texture
in the ws30 shader.

Replaces the previous approach of creating a separate
coastline mesh.
2022-05-28 21:03:48 +01:00
Lars Toenning
e04f89e8b2 Use std::function for callbacks
Reduce complexity by using std::function for callbacks instead of our own class.
2022-05-25 10:37:26 +01:00
James Turner
e1aba1364b Disable the 'no shaders defined' error for now
Until we have a way to mark techqniues as permanently disabled,
remove this check, since it generates false positives. Especially,
see model-combined technnique n=9.
2022-05-25 10:36:43 +01:00
James Turner
5afeb44cec Effects: pass model XML file path, not dir path
Pass the full path to the XML file, not is containg directory, through
effects, so that it's available for error reporting. Convert to an
actual directory when using the path to lookup other resources.
2022-05-25 10:35:31 +01:00
Lars Toenning
e0e3456a68 Refactor SGTimerQueue
Use std::unique_ptrs to handle SGTimer
Use std::vector as container together with STL heap functions
2022-05-16 09:50:54 +01:00
Julian Smith
13ca3cec56 simgear/screen/video-encoder*: build fixes for ffmpeg code on Windows.
simgear/screen/video-encoder-internal.hxx:
    Fixed initialisation of AVRational instance to work on Windows.
simgear/screen/video-encoder.cxx:
    av_log(): vasprintf() is not available on Windows so use fixed buffer on
    Windows.
2022-05-04 17:54:46 +01:00
Julian Smith
20898923e0 simgear/timing/rawprofile.hxx: minor update to docs. 2022-05-01 23:24:42 +01:00
Julian Smith
eb94d12c4f simgear/screen/video-encoder.cxx: fixed build failure when SG_FFMPEG undefined. 2022-05-01 23:24:42 +01:00
Julian Smith
ac37f734ba simgear/screen/video-encoder*: support for logging timing info for sws_scale(). 2022-05-01 15:18:58 +01:00
Julian Smith
8037a0eb20 simgear/timing/rawprofile.hxx: support for profiling single piece of code. 2022-05-01 15:18:54 +01:00
Julian Smith
294e0b0bb7 simgear/structure/commands.cxx: removed assert that fires if we don't use thread-cpu affinities. 2022-04-30 00:45:23 +01:00
Erik Hofman
12c0166f92 Calculate if the sound source is within the mach cone relateive the the listener and calculate the offset within the mach code for use by the sound configuration file. 2022-04-29 15:07:14 +02:00
Erik Hofman
6719a8e3d5 Add functions to return the squared length of a vector: Comparing two squared values prevents two computionally heavy sqrt calls. 2022-04-25 10:48:07 +02:00
Stuart Buchanan
fa2b5911b7 WS30: Add waterline-start and waterline-end params
Used for coastline mixing.
2022-04-09 16:24:51 +01:00
James Turner
363906828f Reduce log noise for a common message in input 2022-04-06 07:50:36 +01:00
Lars Toenning
b01e8f51f1 Add missing include 2022-03-27 20:07:27 +01:00
Erik Hofman
718b09d7c3 Do not use ShaderVG until it's ready for use 2022-03-25 07:40:51 +01:00
James Turner
2993671fa4 Subsystems: only record timings if enabled
Avoid some overhead in copying std::map<>, in the common case where
subsystem timing reporting is not enabled.
2022-03-24 16:06:09 +00:00