Commit Graph

5524 Commits

Author SHA1 Message Date
James Turner
209b60504d Particles: rewrite global manager for thread-safety
Avoid re-registering the global node callback each time a new particle
animation is loaded, and use mutexes to protected all shared data.
2020-08-16 19:49:26 +01:00
James Turner
08bbe08205 Missed include for Linux 2020-08-14 21:16:37 +01:00
James Turner
297e509576 Avoid a race in MatModels loading
Add a mutex to ensure an SGMatModels only loads its models once. Caught
be ASan, hurrah.
2020-08-14 16:48:51 +01:00
James Turner
b874201806 API to reset the shared tree geometry 2020-08-14 15:40:47 +01:00
James Turner
e659ad3872 Destructor tweaks from some animation nodes 2020-08-14 11:12:51 +01:00
legoboyvdlp R
7b4c50fd7e Add METAR test for drizzle. These should be moved to the test suite but we'll add coverage here meantime. 2020-08-14 09:59:16 +01:00
James Turner
b8182a4d29 Fix for sprintf of nil numeric in Nasal
Spotted by valgrind, w00t. If you used a numerical formatter, such
as f,d or g, with. a nil value, we would read uninitialised data, and
generally get confused.
2020-08-14 09:42:14 +01:00
James Turner
7234b57288 Set OSG Object names on SGSky stuff
This is to help with debugging when nodes/effects dangle.
2020-08-11 17:19:01 +01:00
James Turner
bf7b064bbe Ensure SGTerraSync::unbind drops all properties
Avoid some noise on reset, by dropping /all/ our SGPropertyNodes
2020-08-11 17:17:58 +01:00
Hans Kunkell
5f1ca6b556 new method: makeStringSafeForPropertyName, replaces invalid chars 2020-08-10 10:23:38 +01:00
legoboyvdlp R
888a0a8ed5 Drizzle is considered to be light rain. Backportable to 2020.2. Fixes ticket 1792 2020-08-10 10:19:56 +01:00
Scott Giese
a93629a127 Revert "Memory Leak: 95 MB"
This reverts commit cb54815cfc.
2020-08-09 09:39:04 -05:00
Scott Giese
cb54815cfc Memory Leak: 95 MB
99,418,032 bytes in 654,066 blocks are still reachable in loss record 15,500 of 15,501
2020-08-08 20:34:59 -05:00
Scott Giese
f76c640b69 Memory Leak: fix low-hanging fruit 2020-08-08 00:23:39 -05:00
James Turner
abb1cd02cd SGBuildingBin: avoid read of un-inited memory
Where the building line is not as long as expected, ensure we read
valid memory.
2020-08-07 17:48:21 +01:00
James Turner
57c7d58f79 HTTP: Use curl_multi_wait everywhere
Also check the result of the curl methods, in case they fail
2020-08-07 17:47:34 +01:00
Richard Harrison
998f92592a Directional lighting fix
getLights modified to use points rather than triangles based on the configuration.

This fixes point lights (with directional disabled) on AMD
2020-08-07 12:04:21 +02:00
Scott Giese
084e2502ab Memory Leak: 4.3 MB
4,518,880 bytes in 141,215 blocks are still reachable in loss record 15,491 of 15,501
2020-08-06 22:15:43 -05:00
Scott Giese
da384d6f49 Logic error fix 2020-08-06 18:50:31 -05:00
James Turner
7943353a2a Terraysnc: fix incorrect handling of ‘entirely ocean’ tiles
We had some confusion between two error codes, meaning we would log an
error (and treat as a failure) a pure ocean 1x1 area, even though this
was entirely correct and expected behaviour.

Terrasync.cxx expected REPO_ERROR_NOT_FOUND, we need to convert the
file-level error to that, and avoid logging a warning.
2020-08-05 15:20:55 +01:00
James Turner
f72e2ae644 TerraSync: restart after max-errors is exceeded.
When we trip the max-error count for a session, back off for a period
of time and then retry (selecting a new TerraSync server).
2020-08-05 15:18:30 +01:00
James Turner
ece7dab47c TerraSync: handle reinit better
Fix various cases where re-init could get things blocked. Remove the
duplicate storage of the active paths; now we always check the primary
data, and hence it can’t be out of sync.

Also remove the obsolete persistent cache code.

Fixes some of the issues discussed in:
https://sourceforge.net/p/flightgear/codetickets/2308/

Further improvements still to come, especially to retry on a better
schedule for intermittent connections.
2020-08-03 18:01:34 +01:00
Richard Harrison
3643f1c064 XMLSound bugfixes
- using expressions for pitch and volume didn't work
- multiple volume elements not computed properly

Discussion here: https://web.archive.org/web/20200730232940/http://fguk.me/forum/development-hangar/8360-supersonic-audio?start=40#46287

          <volume>
                <property>/a/v1</property>
                <factor>0.1</factor>
            </volume>
            <volume>
                <property>/a/v2</property>
                <offset>1</offset>
                <factor>-3</factor>
            </volume>
            <volume>
                <property>/a/v3</property>
                <offset>1</offset>
                <factor>-1</factor>
            </volume>

evaluates as follows:

update(): Have 3 volume entries
 --> 0:prop /a[0]/v1[0] => 0.110000 factor = 0.100000 v=0.011000 offset 0.000000, now 0.000000, v=0.011000 vol=0.011000 ==> 0.011000
 --> 1:prop /a[0]/v2[0] => 0.120000 factor = 3.000000 v=0.360000 -ve offset 1.000000 1.360000 = 0.014960  ==> 0.014960
 --> 2:prop /a[0]/v3[0] => 0.130000 factor = 1.000000 v=0.130000 -ve offset 1.000000 1.130000 = 0.016905  ==> 0.016905
2020-07-31 01:31:27 +02:00
Richard Harrison
59da504cde Exclude images with less than 16 bits per pixel from the DDS Texture Cache 2020-07-31 01:18:33 +02:00
James Turner
2622004af4 Logging: add log overload which copies filename
This is needed to fix a Valgrind error in the test-cases, due to logging
Nasal filenames which are GCed.
2020-07-17 11:54:50 +01:00
James Turner
ec36ca8e71 Nasal CppBind: restrict which exceptions are caught
The previous catch policy breaks unit-testing, since CppUnit relies
on a special Exception type.

This could be made conditional based on testing or not, but trying the
simple way initially.
2020-07-08 15:16:27 +01:00
James Turner
286e2967fd Fix compilation for some MSVC versions 2020-07-04 14:43:44 +01:00
Julian Smith
fcc5e055ef Renamed version -> simgear-version to avoid breaking clang++ on OpenBSD.
It seems that clang++ headers #include <version>, which found simgear/version
because we need to put singear/ in include path for some code to compile.
2020-07-04 09:04:04 +01:00
Scott Giese
a3ffc77a9d Bug fix: Check for a valid effect before dereference
Reported on the dev list as...
Crash with custom scenery
2020-07-03 13:23:23 -05:00
Scott Giese
6d8e9e5bbc VPB: Initial commit
Not for LTS
2020-06-28 11:30:33 -05:00
James Turner
3fccee6e38 HTTP: allow CAINFO to be set
Env var is SIMGEAR_TLS_CERT_PATH
2020-06-25 16:13:09 +01:00
James Turner
7fc82a26bf Helper to map string to log priority 2020-06-25 11:00:27 +01:00
James Turner
a128272816 Fix CMake include paths 2020-06-24 13:57:27 +01:00
James Turner
2b391ef671 Bundle Cmake FindCURL, for imported target support
This is the one from CMake 3.17, it should work fine with 3.10 but
let’s see.
2020-06-24 11:12:01 +01:00
James Turner
abb73c566e Update to C++17.
This can be reverted easily, but let’s see if it goes.
2020-06-22 20:39:45 +01:00
James Turner
346344ee09 C++17: use an OBJECT_LIBRARY to build HLA
This allows us to easily have different CXX version for the HLA code,
to the rest of the project.
2020-06-21 19:31:35 +01:00
Julian Smith
26b207f20c Auto-tooltips: also show object name and multiple properties for same object.
E.g. tooltip for joystick might show elevator and aileron properties.
2020-06-21 10:58:41 +01:00
Julian Smith
d9470c1407 simgear/scene/model/SGReaderWriterXML.cxx: Added optional auto-generated tooltips for moving objects.
This allows one to see what properties are being used to control moving objects
such as needles and dials in the cockpit, or external moving objects such as
bomb doors.

The system works by optionally creating new animations with type=pick for all
animated objects. A side affect of this is that yellow highlighting of controls
from Ctrl-C will also highlight instrument needles in the cockpit and external
animations such as flaps, rudder, gear etc.

src/Model/acmodel.cxx:simgear::SGModelLib::loadModel() takes new param bool
autoTooltipsMaster and int autoTooltipsMasterMax, which is added into the
SGReaderWriterOptions that is passed to loadFile(). autoTooltipsMasterMax
limits the maximum number of tooltips, which appears to be necessary on 777 -
more than 45 can cause fg to fail to make progress.

The auto-generated tooltips show the name of the object and also the names and
values of the properties that control the animation. For example the tooltip
for a fuel gauge might say 'consumables/fuel/tank[1]/level-gal_imp=0.23456789'.
2020-06-20 11:09:35 +01:00
James Turner
9ccbf539c1 Raise minimum OSG version to 3.4.1 2020-06-18 17:22:55 +01:00
James Turner
720f681e0f Raise Cmake/Compiler versions for Next 2020-06-18 12:58:47 +01:00
James.Hester
259c1314de Allow OSG to recalculate terrain normals. 2020-06-18 09:11:52 +01:00
Julian Smith
27907c5e6f Avoid various gcc warnings. 2020-06-17 22:56:33 +01:00
James Turner
aa0f02706f API to reset the resource manager, and remove
providers.

Needed to fix a bug with parsing -set.xml files in the launcher;
correctly loading XML needs the resource paths to be defined.
2020-06-17 11:48:59 +01:00
Lars Toenning
b4d5374fb7 Fix compiler warning of different signedness 2020-06-16 12:11:24 +01:00
James Turner
60dcf00f2b Fix zero-interval repeat on pick/knob animation
See:
https://sourceforge.net/p/flightgear/codetickets/2241/

Note did not adjust bug in knob-animation ignoring repeatable flag
(always marked repeatable) since this might break some aircraft.
2020-06-15 16:11:18 +01:00
James Turner
3075b8bcc4 new version: 2020.3.0 2020-06-15 12:33:50 +01:00
James Turner
751cdc32a8 new version: 2020.2.1 2020-06-15 12:33:50 +01:00
Julian Smith
1d978429f5 simgear/props/props.cxx: Avoid possible SEGV e.g. if listener removes itself.
simgear/props/props_test.cxx: test for self-unregister.

SGPropertyNode::removeChangeListener() used to modify the _listeners vector or
even delete it and set _listeners to NULL, if a listener was removed.

This could cause a SEGV if removeChangeListener() was called from
a listener, because listeners are called from methods such as
SGPropertyNode::fireValueChanged() which iterate through _listeners and don't
expect it to be changed to NULL.

The fix here is to keep a track of whether we are iterating through the
_listeners vector; if we are, SGPropertyNode::removeChangeListener() sets the
entry to NULL, instead of removing it.

We have a new internal function forEachListener() which takes
care of the iterating details - incrementing/decrementing the new
_listeners->_num_iterators count and skipping NULL entries. Before returning,
if _num_iterators is now zero it removes any NULL entries in the vector of
listeners.

The nListeners() member is no longer inline, because it needs to ignore NULL
entries in the vector. And _listeners now points to an internally-defined
struct which contains a new _num_iterators as well as the vector of listeners.

Added self-unregister test to simgear/props/props_test.cxx.
2020-06-13 18:11:49 +01:00
James Turner
2b2e3ae5c4 Fix CMake value 2020-06-05 13:53:54 +01:00
James Turner
0e3ac7e078 Set CMake OpenGL VND policy 2020-06-05 13:32:43 +01:00