Commit Graph

4445 Commits

Author SHA1 Message Date
James Turner
8b0c246a7b Avoid a divide-by-zero on malformed BTG files.
Encountered while testing v850 airports; some airports
generate materials with no tris, and hence no indices.
This causes a divide-by-zero when computing the index stride.

Detect this, and convert the BTG reader to throw exceptions
in error conditions, and to catch this and report the
appropriate result code.
2013-10-17 20:13:50 +01:00
James Turner
9c4face1ae Fix float-int conversion bug caught by Clang 2013-10-17 20:13:49 +01:00
James Turner
952e2e6631 Fix unused-var warnings from Clang. 2013-10-17 20:13:49 +01:00
James Turner
4766910413 Terraysnc: don't block requests when inactive.
Add the same check for data files so we don't block when terrasync is
disabled.
2013-10-17 17:29:06 +01:00
James Turner
3c2f97a8d2 Re-order install(EXPORT ) lines.
Certain cmake builds/versions complain when a dependent target is
exported but dependencies are not. Export SimGearCore before
SimGearScene.
2013-10-17 17:12:02 +01:00
James Turner
f75730f165 Initial work on syncing non-scenery data.
This is some initial pieces to synchronise other pieces of base
data than scenery via the sync mechanism. An additional sync slot is
added to avoid scenery or other data blocking each other.
2013-10-17 16:39:29 +01:00
James Turner
b596e62a61 Remove some iostream debugging.
Accidentally committed this debug stuff, remove it.
2013-10-17 16:35:36 +01:00
James Turner
1349d48339 Export SimGear config to cmake.
Experimenting with this, should make FindSimGear module unecessary,
and avoid mis-matched SG/FG cmake settings in the future.
2013-10-17 16:10:18 +01:00
James Turner
d69ea5fda6 Kill off EMBEDDED_SIMGEAR 2013-10-17 16:09:39 +01:00
Thomas Geymayer
9b68062ba7 Add helper to get osg::Node path as string. 2013-10-17 13:28:54 +02:00
Thomas Geymayer
b217019723 Nasal: do not print invalid elements for error backtraces. 2013-10-16 23:33:06 +02:00
Thomas Geymayer
a37a254a68 Canvas: simplify code by using new nasal function conversion. 2013-10-15 17:46:42 +02:00
Thomas Geymayer
5258699f20 cppbind: convert Nasal functions to C++ boost::function. 2013-10-15 17:46:31 +02:00
Thomas Geymayer
483bebb003 cppbind: fix bad class hierarchy for bad_nasal_cast. 2013-10-15 16:38:38 +02:00
Thomas Geymayer
8ca8052a8d Nasal: use correct function pointer in naCall (with user data) 2013-10-15 14:21:45 +02:00
Thomas Geymayer
d68b1144b8 Nasal: recursive method calling.
New functions naCallMethodCtx and naCallMethod to replace
NasalSystem::callMethod from FlightGear. This has just added an
unneeded level of indirection and fits better directly into Nasal.
naSetErrorHandler can be used to register an error handler/logging
function.
2013-10-15 12:08:42 +02:00
Thomas Geymayer
42c39b6be3 Canvas: use new naGCSave/naGCRelease functions. 2013-10-15 00:49:13 +02:00
Thomas Geymayer
bb82b9d168 Nasal: add naGCSave/naGCRelease for preventing objects being garbage collected.
These new functions are meant to replace the gcSave/gcRelease
methods of the NasalSystem class in FlightGear, as passing an
adapter to SimGear from FlightGear is quite a lot of useless work
just for being able to save objects.
2013-10-15 00:19:32 +02:00
Thomas Geymayer
b1f865d461 cppbind: add to_nasal_helper for enums. 2013-10-14 23:03:36 +02:00
Thomas Geymayer
8e75c6be50 HTTP: check url for scheme and report instead of failing with assert. 2013-10-13 12:06:17 +02:00
Thomas Geymayer
06a5f9188d Don't let exceptions escape from commands. 2013-10-13 12:00:52 +02:00
Thomas Geymayer
370a991208 cppbind: Catch exceptions before reaching C code. 2013-10-13 11:40:27 +02:00
Thomas Geymayer
6deb77dd4d Canvas: allow also C++ callable entities as event callbacks. 2013-10-12 00:29:37 +02:00
James Turner
9e3172cb04 Another attempt to make MSVC happy!
C89 requires variable declarations upfront.
2013-10-09 12:26:29 +02:00
James Turner
426c6b9a72 Linux needs <cstring> 2013-10-09 11:58:51 +02:00
James Turner
d148bdedcd Fix MSVC build, no C99 so no round().
(Doesn't use SGMisc<T>::round, since Nasal is pure C)
2013-10-09 11:52:54 +02:00
James Turner
23140e3bf7 Avoid a data copy decoding base64 data.
Use an out parameter to avoid a buffer alloc/copy/free cycle
when returning base64-decoded data.
2013-10-09 10:03:30 +02:00
James Turner
2f023803e7 Refactor HTTP content-encoding support.
Move content-encoding handler into its own file, which 
simplifies the main code. As part of this, fix a bug where we
didn't flush the ZLIB buffers on response completion.
2013-10-09 10:03:28 +02:00
James Turner
d658b5fc38 Use std::string.append, avoid string copying.
Removes a hot-spot on the SVN update path.
2013-10-09 10:03:27 +02:00
James Turner
68cd84c330 Make base64 decode significantly faster.
Use a reverse lookup table instead of a call to string.find for
each input byte, much speedier.
2013-10-09 10:03:27 +02:00
James Turner
0bd82a43d3 Check for DAV status parse failures. 2013-10-09 10:03:26 +02:00
James Turner
7fdf42b699 Reset: Nasal additions to force GC, clear saved refs. 2013-10-09 09:59:50 +02:00
James Turner
aeb0e9aac3 Reset: event manager can be unbound. 2013-10-09 09:59:40 +02:00
James Turner
1099a3bdf0 Reset: model placement can drop OSG nodes. 2013-10-09 09:59:33 +02:00
James Turner
aa3458f69c Reset: model lib can drop static root. 2013-10-09 09:59:21 +02:00
Stanislaw Halik
0186cbb7b7 cmake: prevent Boost barfing out too many warns 2013-10-03 21:49:38 +01:00
Stanislaw Halik
fa36e94c4b fix static build with recent GNU binutils
Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
2013-10-03 21:49:38 +01:00
James Turner
ad83e70cf5 Extend built-in Nasal math.
- rename mod() to fmod() to prevent collisions with the
version in math.nas (which has different handling of negatives)
- implement pow, tan, acos and asin natively
- add round(x, [p]), which rounds away from 0.0, and takes an
option precision. I.e you can round(479, 50) and get '500'; useful
in many digital cockpit displays.
2013-10-03 17:40:17 +01:00
James Turner
4a0377c0a1 Rename WaitingSyncItem -> SyncItem.
More accurate name (we have these for items which are not waiting),
and also shorter.
2013-09-30 21:59:18 +01:00
James Turner
83a3241830 Fix a signed/unsigned compare warning 2013-09-30 16:44:04 +01:00
James Turner
f299b351e3 Expose active tiles via API, sync by SGBucket.
Provide an API to query which tiles are currently being synced. This
allows the higher levels (TileManager in FlightGear) to safely wait on
TerraSync before loading tiles.

Doing this exposed some bugs in scheduling tiles to sync by integer
lat/lon, related to round-towards-zero with -ve values (western /
souther hemispheres). To resolve these, and also reduce spurious
syncs, switch to an explicit API for requesting tiles by SGBucket.
This keeps TerraSync fully aligned with the TileManager queue, which
has many benefits for both high and low visibility situations.
2013-09-30 16:35:45 +01:00
James Turner
3880e4ef47 Say which ocean tile we generated. 2013-09-30 12:08:10 +01:00
James Turner
f205e918d9 sprintf -> snprintf in bucket code. 2013-09-30 12:07:57 +01:00
James Turner
42b0b9306b Make code quieter at log-level=DEBUG. 2013-09-28 14:45:30 +01:00
James Turner
483659c319 HTTP: adjust request-connection assignment.
Prefer existing, idle connections to creating new connections,
even when below the max-connection limit. Gives much better re-use
and pipeline-ing, and hence reduced setup time/trips.
2013-09-28 14:03:39 +01:00
James Turner
add14dd27c Reposition hook for terrasync.
When re-init-ing the sim, tell TerraSync what's going on (we don't want
to actually reset it, since that would disturb in-flight downloads).
Add an explicit method so it can reset its last lon/lat, and hence do
the initial sync at the new location correctly.
2013-09-27 20:28:43 +01:00
James Turner
61516a5e97 Terrasync: Expose transfer rate as a property. 2013-09-27 18:23:51 +01:00
James Turner
17418039e1 HTTP bugfix + enhancement.
Track 'waiting for response' state explicitly, so we don't
falsely report IDLE when waiting for a response.

Expose bytes-per-second download rate as metric.
2013-09-27 18:20:03 +01:00
James Turner
25cae61211 Allow TerraSync to be inited early.
Add explicit subsystem state tracking so we can safely init()
terrasync very early during startup, and hence overlap lengthy operations
(Shared Models sync and initial NavCache build)
2013-09-26 12:11:48 +01:00
James Turner
db98c7440e Parallel sync of items.
When using built-in sync code, separate items into distinct slots.
Slots process items sequentially, but each slot works in parallel (using 
a single shared HTTP engine). This allows tiles to be synced in parallel
with airports/shared models data, greatly increasing responsiveness
to get tiles synced on initial launch.
2013-09-25 16:31:10 +01:00