Commit Graph

5979 Commits

Author SHA1 Message Date
Stuart Buchanan
7916dfb61d WS30 Move VPB tile loading to the tile manager
Previously VPB tiles were loaded by the STG file handler.
Now they are loaded directly by the tile manager, allowing
better management of tile loading.
2021-10-20 23:37:59 +01:00
b'Fernando Garc\xc3\xada Li\xc3\xb1\xc3\xa1n
fc1d02110c Merge /u/amalon/simgear/ branch vr_5 into next
https://sourceforge.net/p/flightgear/simgear/merge-requests/100/
2021-10-20 22:21:01 +00:00
Fahim Imaduddin Dalvi
6e7fa6b139 WS30: Generic Materials handler and Random tile lights
This commit implements a generic materials handler providing an easy way to
extend the efficient landclass scanning code for new material-specific
processing like trees, random lights, random buildings etc. The existing
vegetation code has been ported to make use of this generic interface,
and random tile lights have been added as well. Detailed commit log can
be found at [1], discussions can be found at [2] and [3].

[1] https://sourceforge.net/u/fahimdalvi/simgear/ci/feat/ws30_random_lights/~/tree/
[2] https://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/AC818EC5-84A3-425B-98CB-352CCB0B8910%40gmail.com/#msg37356997
[3] https://sourceforge.net/p/flightgear/simgear/merge-requests/99/
2021-10-21 00:34:32 +03:00
James Turner
6d71ab75b2 METAR: Remove duplicate lines from manual merge
Thanks to Tobias Dammers for pointing this out.
2021-10-20 13:16:31 +01:00
Richard Harrison
148ba367ee Material animation include model directory
Include model directory in the texture path - to allows short paths relative to model root when set via a texture-prop
2021-10-18 11:40:25 +02:00
Richard Harrison
7ac90850d3 Fix axis object in translate animation
This will allow an object to be moved using a line (with 2d points).

Use the factor to switch direction (direction will depend on the order of definition of the end points of the vertex and) together with a (usually normalised property to define how much of the translation to apply).

<animation>
    <type>translate</type>
    <object-name>mm_radios-display</object-name>
    <property>/sim/model/f-14/radio-position-norm</property>
    <factor>-1</factor>
    <axis>
        <object-name>mm_radios-display-alt-position-axis</object-name>
    </axis>
</animation>
2021-10-18 11:40:25 +02:00
James Turner
bf1db210d7 SGMetar: avoid raw char pointers in the public API
Ideally would refactor to remove the raw pointers internally, but this
is a good first step.
2021-10-15 15:31:06 +01:00
James Turner
6fe7c307b2 SGmetar: catch bad temp/pressure data and throw
Also replace raw pointer with managed storage for the raw data, to
avoid manual clean-up on exception-throw paths.
2021-10-15 12:12:51 +01:00
Stuart Buchanan
119f3d9814 WS30: Remove VPB Max range and LoD scaling
Better to scale from the camera than mess with the LoD itself.
2021-10-12 21:40:09 +01:00
James Hogan
0c4c092b9f
Sky dome: Enable depth test but mask depth changes
On VR with visibility masking the depth buffer is first set to the
nearest possible value in parts of the frame that won't be visible
through the VR headset's lenses. This is meant to reduce GPU fragment
load.

The sky dome however is rendered with depth testing disabled which
bypasses the visibility masking. To allow invisible parts of the sky
dome to be culled, enable depth testing but set the depth mask to false
to prevent modification of the depth buffer.
2021-10-08 23:36:15 +01:00
Stuart Buchanan
a760730285 WS30: +50% fps by not loading tiles every loader
Previously the STG Loader had a class member keeping track
of each WS30 tile that had been loaded, to ensure the terrain
was only loaded once.

However, this was a class member on a loader, and we have multiple
OSG loading threads.  So the WS30 terrain was loaded ~6 times.

Change to a static, protected with a mutex so we only load the tile
once.

50% improvement in fps from the reduction in vertices, and an
improvement in loading.
2021-10-08 20:55:06 +01:00
b'Fernando Garc\xc3\xada Li\xc3\xb1\xc3\xa1n
f7e378a05a Merge /u/amalon/simgear/ branch vr_3 into next
https://sourceforge.net/p/flightgear/simgear/merge-requests/98/
2021-10-08 14:16:34 +00:00
Julian Smith
50170da13d simgear/scene/model: expose some animation info for use by Highlight system.
simgear/scene/model/animation.*: added TransformExpression() - returns SGExpressiond
if given a SGRotAnimTransform or SGTranslateTransform.

simgear/scene/model/SGTranslateTransform.hxx:SGTranslateTransform: added copy
of SGExpressiond for use by TransformExpression().
2021-10-05 22:54:52 +01:00
Stuart Buchanan
e7cca0c407 WS30 - Line feature texturing 2021-10-01 22:03:47 +01:00
Stuart Buchanan
0f946abc36 WS30: Correct texture coords for roads 2021-09-28 21:38:16 +01:00
James Hogan
1d0a99a077
Add LEFT & RIGHT nodemask bits
Add LEFT_BIT and RIGHT_BIT node masks, which are only shown on the left
or right viewports. These will be used for eye specific visibility masks
with VR.
2021-09-18 08:27:24 +01:00
James Hogan
d4496d3b2c
Compositor: Add resetOrderOffset()
To allow for custom compositors and passes created by C++ code alongside
those created by Compositor::create(), add a resetOrderOffset() function
which resets _order_offset back to zero. This will allow FlightGear to
prevent repeated compositor reloads from increasing _order_offset
indefinitely, which soon results in render orders beyond those set
statically for the GUI and upcoming VR mirror compositors.
2021-09-11 16:32:18 +01:00
Julian Smith
a68a0b1ccb simgear/props/props.cxx: fixed deadlock in SGPropertyNode::addChildren().
Was causing fatal "Resource deadlock avoided" error with crj700.
2021-09-05 15:55:37 +01:00
Fernando García Liñán
876e5534fd Fix precision issues on shadow mapping 2021-09-02 02:23:05 +02:00
Fernando García Liñán
0ee08cfa06 Compositor: fg_Viewport now contains the viewport properties of the specific pass it's being used on 2021-08-31 18:09:36 +02:00
Fernando García Liñán
da750c5995 Canvas: Set pointers to NULL instead of calling .release()
The Canvas camera and texture get recreated in several circumstances.
Calling .release() on a ref_ptr will just return the raw pointer and
'delete' won't be called. The proper way to explicitly delete an object
managed by a ref_ptr is to set the ref_ptr to NULL. This will delete it
as long as it's not referenced by any other ref_ptr.
2021-08-31 18:09:36 +02:00
Fernando García Liñán
2371065375 Canvas: Image depth refers to the amount of depth slices, not the bit depth 2021-08-31 18:09:36 +02:00
Stuart Buchanan
5c4bbc7552 WS30: Improved streetlights
- Use a single LightBin per tile, rather than per road
- Support lights offset on either side of the road.
2021-08-29 18:27:18 +01:00
Fernando García Liñán
a97e148a94 Canvas: Change the node mask of the ODGauge camera
Since the Canvas cameras are no longer in the scene graph, we no longer
need to explicitly make them render only in the Classic pipeline's far
camera.
2021-08-27 21:21:28 +02:00
James Turner
e76b684c20 Attempt to deal with the XML -> AC model rename
Add a fallback when a .xml model is not found, and see if we can load
a .ac instead. This logs a dev warning since dependant uses should
be updated.
2021-08-27 15:33:33 +01:00
Julian Smith
629b681a29 simgear/nasal/code.c:setupFuncall(): improve diagnostic if not callable.
If we have an uncallable object error, also show the type and value of the
uncallable object.

To make this work, have upgraded simgear/nasal/lib.c:dosprintf() to be globally
available. Could perhaps rename it and declare in a different header. But it's
C so we don't want to make it part of simgear's general utility functions.
2021-08-26 23:24:39 +01:00
Julian Smith
624581f470 simgear/nasal/code.c:logError(): simplified the code. 2021-08-26 23:24:39 +01:00
Julian Smith
d4701c309b simgear/nasal/code.c: naRuntimeError(): added disabled code to show info. 2021-08-26 23:24:39 +01:00
Fernando García Liñán
2c82cd4475 glTF: Remove separate occlusion texture 2021-08-27 00:06:47 +02:00
Julian Smith
d7dd7e2c6e 3rdparty/tiny_gltf/tiny_gltf.h: fix for OpenBSD - no wordexp.h. 2021-08-25 23:10:03 +01:00
Fernando García Liñán
6d891eae7e Compositor: Add missing #define for buffer format 2021-08-23 22:29:24 +02:00
Fernando García Liñán
81fb4e7dfd Compositor: Add extra buffer formats
These formats are not defined by OSG, so we manually define them. Some GPUs might not support them as we are using a GL compatibility context, but it shouldn't matter for now as they are only being used by the HDR pipeline.
2021-08-23 12:45:55 +02:00
Stuart Buchanan
fafa259c1d WS30: Lighting for roads
Using attributes on the LINE_FEATURE_LIST we now generate
lighting for roads.
2021-08-21 17:18:18 +01:00
Erik Hofman
1174124144 Michael Danilov: Fix issue #2169 Sound with condition=false will play when moving into its max-dist (patch available) 2021-08-20 11:47:03 +02:00
Stuart Buchanan
e7659941ef WS30: Better landclass cache for tree generation 2021-08-19 19:57:09 +01:00
Fernando García Liñán
b5d78f7c1d Fix typo 2021-08-19 14:04:25 +02:00
Fernando García Liñán
ab1d7792bd Compositor: Add another precomputed uniform for the skydome shader 2021-08-19 13:08:14 +02:00
Fernando García Liñán
6cea6b7fdf Add support for glTF transparent objects
Also added some Compositor uniforms.
2021-08-19 01:40:24 +02:00
Fernando García Liñán
2b9933c0b5 Remove explicit LINKER_LANGUAGE when compiling TinyGLTF 2021-08-17 12:01:54 +02:00
Fernando García Liñán
6d3089ad6b Compositor: Add the LOD scale parameter to scene passes
This should allow us to change the LOD level for WS 3.0 on a per-pass basis.
2021-08-16 17:02:21 +02:00
Fernando García Liñán
910225532e Initial support for glTF models 2021-08-16 17:00:57 +02:00
Fahim Imaduddin Dalvi
65483a373f Shader-based scenery lights.
This commit implements shader-based scenery lights with support for
efficient rendering of a large number of lights, animations and
directionality. Detailed commit log can be found at [1]. Detailed
discussions can be found on the mailing list [2][3][4].

[1] https://sourceforge.net/u/fahimdalvi/fgdata/ci/feat/scenery-shader-lights/~/tree/
[2] (Timed animation stops working in certain configurations) https://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/4A7AC359-63B3-4D8A-815B-09823BCEFF27%40gmail.com/#msg37095923
[3] (Shader-based scenery lights) https://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/63E3C131-7662-4F59-B2E6-03208C78EF96%40gmail.com/#msg37190517
[4] (Shader-based scenery lights Part 2) https://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/74F18179-CA34-4901-A44E-15498ECC230A%40gmail.com/#msg37331695
2021-08-07 21:47:56 +03:00
James Turner
67806a59b0 Fix a dumb crash I introduced. 2021-08-04 09:08:16 +01:00
Stuart Buchanan
578a8acff4 WS30: Improve tile loading times by ~50%
Previously on my system, generating vegetation for a given tile
took 0.15-0.2s (for ~ 56k positions), of ~0.4s.  While this is done in a
separate loading thread, the sheer number of tiles being loaded
caused noticeable delays and popping of higher LoD tiles.

As a tile at the highest LoD is typically 6x6km, and vegetation
is generated on a scanline of individual triangles, there is a _lot_
of temporal locality on the landclass of a series of points.

By caching the material information required from the landclass lookup
we can avoid a whole much of material lookups for each successive
vegetation point.

On my system this reduced the time to generate vegetation down to
0.02s per tile, and total tile generation time down to ~0.2s.
2021-08-03 20:56:56 +01:00
Julian Smith
e93839a9c5 simgear/environment/visual_enviro.cxx: fixed include of simgear/math/sg_random.hxx. 2021-08-03 09:20:35 +01:00
Julian Smith
ded91614ab simgear/debug/logstream.cxx: enable file:line on startup if SG_LOG_FILE_LINE is 1.
E.g. allows file:line in diagnostics when running test-suite.
2021-08-02 21:04:29 +01:00
Stuart Buchanan
d1e9134a89 WS30: Improved vegetation constraints
Unlike the elevation constraints, the vegetation constraints
don't need to be global.  So no need for mutexes.  Big speed up.
2021-08-02 17:47:48 +01:00
Stuart Buchanan
8cc3c15712 WS30: Stop trees from growing on roads, rivers. 2021-08-02 17:10:49 +01:00
Stuart Buchanan
dc1d6284fd WS30: Fix crash on reset caused by VPBTechnique 2021-08-01 20:48:27 +01:00
Stuart Buchanan
4f01f758ae WS30: Fix deadlock introduced by fb436be8f1 2021-08-01 20:47:38 +01:00