Commit Graph

5887 Commits

Author SHA1 Message Date
James Turner
40ead1f71a Add osg::Program wrapper for error-reporting 2021-03-01 11:57:30 +00:00
James Turner
802ce5ad23 ErrorReporting: set context for STG loading
Ensure the STG absolute path can be propagated to all files triggered
by STG loading, including the delayed files and proxied files. This
allows us to attribute errors to the correct scenery path.
2021-03-01 09:42:04 +00:00
Stuart Buchanan
f4dfa854ec WS30 Fix invalid search-and-replace 2021-02-27 16:17:25 +00:00
James Turner
7352e992e6 Allow delayed setup of ErrorContext data
Permit no model data to be provided, when loading a model via the
modelLib API (d’oh)
2021-02-25 12:24:43 +00:00
Stuart Buchanan
1bc0f86cc0 WS30 Line Features - fix build
Add missing files.
2021-02-25 10:54:05 +00:00
James Turner
cb15502b41 Error reporting: add SGModelData context support
Allow us to pass the current error-context from the main thread
into the osgDB loader thread. This is necessary so we can attribute
AIModel (etc) load problems to the correct source.
2021-02-25 09:04:45 +00:00
James Turner
a402eda151 Error-reporting: add some errors for Effect shaders 2021-02-25 09:04:45 +00:00
Stuart Buchanan
716835c7ad WS30 Line Features
Adds a LINE_FEATURES STG Verb of the form

LINE_FEATURES <file.txt> <Material>

Where <file.txt> is a text file consisting of line features to be
rendered with the appropriate <Material> definition.

Each line of <file.txt> has the form
<w> <attr> <a> <b> <c> <d> <lon1> <lat1> <lon2> <lat2> ...

Where
<w> is the line feature width in m
<attr> is an integer for attributes - likely a bitmask*
<a> <b> <c> <d> are floats*
<lonN> <latN> are the lon/lat of point N on the line feature

* denotes values that may be feature-dependent.  For example to indicate
street lighting, kerbing etc.

There must be at least two points on the line feature.
2021-02-24 21:49:42 +00:00
James Turner
93e2bccb0e Error reporting for submodels
Also add some error codes I forgot for AI and traffic.
2021-02-21 19:16:53 +00:00
James Turner
b8b88995cf Add failure reporting / context to various places.
Not total coverage by far, but working through the list of common
failure points as seen on Sentry
2021-02-20 19:57:29 +00:00
James Turner
041c247c0f Suppress reports on some common exception throws 2021-02-20 19:57:29 +00:00
James Turner
e3f4c44685 Add sg_location to all exceptions, add report flag
Move sg_location member up to the base clase, since it’s potentially
useful in more types.

Allow suppression of the report callback when the exception is thrown
2021-02-20 19:57:29 +00:00
James Turner
7b4dc51f93 Add new error reporting function / callback 2021-02-20 19:57:29 +00:00
James Turner
368cbcb377 Remove stray include of std::filesystem 2021-02-20 19:57:29 +00:00
Julian Smith
3521ed44e4 simgear/io/HTTPFileRequest.cxx: Reinstated std::function callback.
Also fixed setCallback() to call the supplied function immediately if transfer
has already finished.
2021-02-20 13:30:13 +00:00
Julian Smith
97828a8e4e simgear/io/HTTPFileRequest.*: Use fnptr rather than std::function to avoid SEGVs with g++ on Linux.
Previous code sometimes gave a SEGV in _callback's destructor when
setCallback() was called; this is on Linux with g++-8.3.0. Have tried various
alternative ways to initialise _callback but the problem persistend.

So have switched to an old-style function-pointer plus void* approach.
2021-02-18 23:20:46 +00:00
Julian Smith
f9ecf455ba simgear/io/: exteded http client support to allow replaying of recordings from a URL.
simgear/io/HTTPClient.cxx
    Support range in HTTPRequest's. Set CURLOPT_MAX_RECV_SPEED_LARGE if request's
    getMaxBytesPerSec() is non-zero.
simgear/io/HTTPFileRequest.cxx
simgear/io/HTTPFileRequest.hxx
    Added 'bool append' to constructor args; if specified we assume that, if
    the output file already exists, it is from an interrupted download, and we
    use an http Range header to append any remaining data.
    Support a std::function callback when new data is available.
    Added setMaxBytesPerSec() to limit download bandwidth; useful for testing.
simgear/io/HTTPRequest.cxx
simgear/io/HTTPRequest.hxx
   Added support for setting Range header.

In both simgear/io/HTTPClient.cxx and simgear/io/HTTPRequest.cxx, if
a range is specified, we treat http results 206 'Partial Content' and
416 'Range Not Satisfiable' as success.
2021-02-18 09:30:56 +00:00
legoboyvdlp R
7f83686853 TerraSync: counter to fetch number of bytes which have been extracted from a tarball file 2021-02-14 17:08:00 +00:00
Scott Giese
d1509d6096 NULL check after malloc 2021-02-13 22:25:31 -06:00
Scott Giese
469a28c49a Remove obsolete, unused variable 2021-02-13 21:44:25 -06:00
Scott Giese
a1f83542cb Remove unncessary cmake policy definitions 2021-02-13 21:43:48 -06:00
James Turner
6319254d71 Fix ownership of SGLight::appendLight, using a ref_ptr
Fix some other C++11-isms as well.
2021-02-11 11:23:38 +00:00
James Turner
1ad7161465 SGLight: use copyProperties 2021-02-10 14:51:18 +00:00
James Turner
6a78bc2cdb Fix VPB compilation with OSG 3.4.x 2021-02-10 14:51:02 +00:00
Stuart Buchanan
6fb47e8e68 WS30: Random vegetation from Marc EBERHARD
Generate random vegetation of VPB tiles.  Currently
prototype that generates same vegetation for all landclass types.

Needs additional work to
a) make the scenegraph more efficient
b) support different material definitions of vegetation.
2021-02-09 17:52:52 +00:00
Stuart Buchanan
bf62554da9 WS30: Apply correct technique to top-leve tile. 2021-02-09 11:20:53 +00:00
Henning Stahlke
fd0e7ac2d8 Make SGLight configurable at runtime. 2021-02-08 12:43:10 +01:00
James Turner
9561895335 Text-animation: fix missing encoding specification
Ensure we can pass full UTF-8 strings into text animations. Will consider
for back-port after discussion on the devel list.

Ticket-Id: https://sourceforge.net/p/flightgear/codetickets/2512/
2021-02-07 13:02:31 +00:00
James Turner
b6c0f5ba00 Particles: fix handling of world-attached particles
Fix the cull callback to continue with normal culling. Also move
where the particle frame is added to the scene graph, to be sure
we don’t modify the scene during OSG traversals.
2021-02-07 11:38:04 +00:00
Stuart Buchanan
95b7e84d9e WS30: Improve MaterialTextureAtlas
- Set Anisotropic from properties
- Only generate the TextureAtlas for VPB (not used in WS2.0)
- Only resize textures if required
2021-02-06 12:53:12 +00:00
James Turner
be49f880b8 Fix HTTPClient reset() behaviour
Ensure all data members are correctly re-initialzied when doing a reset.

This shoed up as negative ‘bytes downloaded’ counts after a TerraSync
abandon and retry.
2021-02-05 10:37:23 +00:00
James Turner
059285ed6f Particles: replace use of ParticleSystemUpdater
Extend our own particle manager to replace the OSG particle system
updater. This fixes thread-safety and also timing (better match to
simulation dt values). We also use weak pointers (observer_ptr in
OSG terminology) to ensure particle systems are released once their
frame is gone.
2021-02-03 21:47:51 +00:00
Stuart Buchanan
bbef23deae WS30: Terrasync compatible files, LoD control
Change WS30 file format to match standard scenery directory
structure, add controls for LOD ranges.
2021-02-02 19:08:23 +00:00
Fernando García Liñán
23a4fb1429 Add missing null check to SGLight's dim-factor expression 2021-02-02 18:40:54 +01:00
Julian Smith
a7a53921e4 simgear/misc/sg_path.*: added SGPath::makeLink(), for making softlinks.
Note that on Windows there is no implementation yet and it always returns
false.
2021-01-30 13:27:55 +00:00
Julian Smith
b888a46e67 simgear/scene/model/SGReaderWriterXML.cxx: removed unused static variable. 2021-01-30 13:27:55 +00:00
Julian Smith
edb1f8b9f8 Improved diagnostics if terrasync fails.
Increased some diagnostics to SG_ALERT if terrasync checksums fail.

Show failed URLs; show SyncItem::Type enum names; show SyncItem::Status enum
names.
2021-01-30 13:25:29 +00:00
Julian Smith
a72941fdb7 simgear/props/props.cxx: Improved diagnostics for illegal property names. 2021-01-30 13:23:26 +00:00
Stuart Buchanan
d695d37563 WS30: Property configuration VPB
Configure the VPB elevation mesh via properties:
/scenery/elevation-mesh/sample-ratio controls the elevation
mesh sampling, allowing reduction in mesh size

/scenery/elevation-mesh/vertical-scale is just for fun and
scales the mesh vertically making mountains taller.

/scenery/elevation-mesh/constraint-gap-m controls how much below
airports etc. elevation vertices are forced to be.
2021-01-27 20:00:39 +00:00
Fernando García Liñán
b04cdbc491 Add a priority parameter to SGLight
In the future this will help choose which lights should be displayed if
the user sets the maximum number of lights to a low enough value.
2021-01-26 13:41:51 +01:00
Stuart Buchanan
3b1eb4a7f7 Remove Terrain simplifier - now redundant 2021-01-17 14:26:35 +00:00
Stuart Buchanan
b8ddf517f4 WS3.0 Add OBJECT STG entries as elevation constraints
Note this is for OBJECT only (e.g. airports), not
OBJECT_STATIC or OBJECT_SHARED
2021-01-14 11:32:07 +00:00
Stuart Buchanan
0a59de8c46 WS3.0: Add elevation constraints for airports
Previously if the elevation of the terrain vertices was higher
than the airport, the terrain pushed through the airport, looking
ugly.

This adds the concept of elevation constraint models, which the
VPBTechnique applies when generating terrain vertices.

Simply add a scenery model to the contraints on the technique,
and terrain won't poke through it.
2021-01-13 20:26:28 +00:00
Colin Geniet
d54e9b7675 Animations: Fix spin for Compositor lights
The 'spin' animation has a strange behaviour:
it pushes a temporary rotation matrix on the transformation stack during
cull traversal, and removes it thereafter.
Thus, the rotation matrix is missing outside of cull traversal, e.g.
when the position of Compositor lights is computed.

The same issue was fixed for the 'rotate' animation by commit
e202d4e4a5
(this mentions broken 'picking' animations as a different manifestation
of the same issue).

Fix this by setting the angle of the persistent SGRotateTransform,
instead of creating a temporary rotation matrix.
2021-01-13 12:18:22 +01:00
James Turner
0b9849d232 CMake: remove .cmake extensions
These seem to break include()’s regular path searching, which is odd.
2021-01-10 13:32:59 +00:00
James Turner
fa1f13cbe2 CMake: add upstream FindLibLZMA.cmake
Required since older CMake versions of this don't define an imported target
2021-01-10 11:56:22 +00:00
James Turner
d4a7cb1ee2 ArchiveExtractor .Xz compression of tar-balls
Allow use of LibZLMA / XZ compressed tarballs, which are significantly
smaller. Extend unit-tests to cover this.
2021-01-09 16:30:50 +00:00
James Turner
14494afd2f Tolerate blank lines in buildings lists 2021-01-08 19:39:37 +00:00
James Turner
9fbf56004b HTTPRepository: improving handling of archives
Avoid hard-coding the archive extension, and ensure the extracted
archive directory is not orphaned on update. Finally, use the
literal filename in the .dirindex when computing the hash, rather
than adding a .tgz extension.
2021-01-08 19:39:14 +00:00
James Turner
161f76508d TerraSync: allow separate OSM2City server
Lookup OSM2City using a separate service profile, and use this server
for requests for OSM2City suffix dirs.
2021-01-08 19:38:02 +00:00