1
0
Fork 0
Commit graph

133 commits

Author SHA1 Message Date
gordonshamway23
d09046f9a2 Canvas placement on dynamic models
1. A canvas can be placed on dynamically created models. 
Implemented by adding a new placement factory.

2. Added a "loaded" property in every "models/model[...]" 
path to track when a model is finally loaded by OSG.

See https://forum.flightgear.org/viewtopic.php?f=30&t=38318
2021-03-18 08:39:56 +00:00
James Turner
cab0dc12a1 Remove a lingering Boost usage 2021-02-20 19:59:13 +00:00
Julian Smith
d04c1a00f2 src/Canvas/canvas_mgr.cxx: fix for segv in simgear unit tests.
Make CanvasMgr::init() not attempt to call flightgear::getGUICamera() if
there's no default camera set up yet.
2020-12-16 21:19:01 +00:00
Julian Smith
f62e5b9ce3 CompositeViewer: Support for multiple view windows using osgViewer::CompositeViewer.
Overview:

    Previously Flightgear always used a single osgViewer::Viewer(), which
    inherits from both osgViewer::ViewerBase and osgViewer::View, giving a
    single view window.

    If CompositeViewer is enabled, we instead use a osgViewer::CompositeViewer
    which contains a list of osgViewer::View's. Each of these View's can have
    its own eye position, so we can have multiple different views of the same
    scene.

    Enable at runtime with: --composite-viewer=1

Changes to allow use of osgViewer::CompositeViewer:

    Previously FGRenderer had this method:

        osgViewer::Viewer* getViewer();

    This has been replaced by these two new methods:

        osgViewer::ViewerBase* getViewerBase();
        osgViewer::View* getView();

    If CompositeViewer is not enabled (the default), the actual runtime state
    is unchanged, and getViewerBase() and getView() both return a pointer to
    the singleton osgViewer::Viewer() object.

    If CompositeViewer is enabled, getViewerBase() returns a pointer to a
    singleton osgViewer::CompositeViewer object, and getView() returns a
    pointer to the first osgViewer::View in the osgViewer::CompositeViewer's
    list.

    The other significant change to FGRenderer() is the new method:

        osg::FrameStamp* getFrameStamp()

    If CompositeViewer is not enabled, this simply returns
    getView()->getFrameStamp(). If CompositeViewer is enabled it returns
    getViewerBase()->getFrameStamp(). It is important that code that previously
    called getView()->getFrameStamp() is changed to use the new method, because
    when CompositeViewer is enabled individual osgViewer::View's appear to
    return an osg::FrameStamp with zero frame number).

    All code that uses FGRenderer has been patched up to use the new methods so
    that things work as before regardless of whether CompositeViewer is enabled
    or not.

    We make FGRenderer::update() call SviewUpdate() which updates any extra
    views.

Extra view windows:

    If CompositeViewer is enabled, one can create top-level extra view windows
    by calling SviewCreate(). See src/Viewer/sview.hxx for details.

    Each extra view window has its own simgear::compositor::Compositor
    instance.

    Currently SviewCreate() can create extra view windows that clone the
    current view, or view from one point to another (e.g. from one multiplayer
    aircraft to the user's aircradt) or keep two aircraft in view, one at a
    fixed distance in the foreground.

    SviewCreate() can be called from nasal via new nasal commands "view-clone",
    "view-last-pair", "view-last-pair-double" and "view-push". Associated
    changes to fgdata gives access to these via the View menu. The "view-push"
    command tags the current view for later use by "view-last-pair" and
    "view-last-pair-double".

    Extra view windows created by SviewCreate() use a new view system called
    Sview, which allows views to be constructed at runtime instead of being
    hard-coded in *-set.xml files. This is work in progress and views aren't
    all fully implemented. For example Pilot view gets things slightly wrong
    with large roll values, Tower View AGL is not implemented, and we don't
    implement damping. See top of src/Viewer/sview.cxx for an overview.

OpenSceneGraph-3.4 issues:

    OSG-3.4's event handling seems to be incorrect with CompositeViewer -
    events get sent for the wrong window which causes issues with resize and
    closing. It doesn't seem to be possible to work around this, so closing
    extra view windows can end up closing the main window for example.

    OSG-3.6 seems to fix the problems.

    We warn if CompositeViewer is enabled and OpenSceneGraph is 3.4.
2020-11-21 13:27:02 +00:00
Richard Harrison
b41bc317dd DDS-TC identify images coming from Canvas
This is to allow the DDS texture cache to take appropriate action (such as not compressing these images to ensure that the aspect ratio is good).
2020-11-17 19:09:06 +01:00
James Turner
bd666f952e Raise minimum OSG version to 3.4.1 2020-06-18 17:39:48 +01:00
gallaert
27ae79b5da Replace boost::bind by std::bind and lambda function 2020-04-22 14:06:13 +01:00
James Turner
27410761f3 Lots of UTF8 path correctness fixes 2020-03-12 14:23:44 +00:00
James Turner
c12824bc94 Basic Canvas tests, including image pixel ops 2020-03-11 17:14:38 +00:00
Edward d'Auvergne
34a6cb3c74 SGSubsystem classes: Registration of all subsystems. 2019-07-01 14:51:32 +02:00
Edward d'Auvergne
d259c70560 SGSubsystem classes: Addition of staticSubsystemClassId() to all subsystems. 2019-07-01 14:51:32 +02:00
Edward d'Auvergne
fb5c36fc82 SGSubsystem classes: Renaming of the subsystem ID variables and functions. 2019-07-01 14:27:30 +02:00
Edward d'Auvergne
7a6e63ddb9 SGSubsystem classes: Subsystem and subsystem group API declaration standardisation.
This is a cleanup commit.
2019-07-01 14:27:30 +02:00
Edward d'Auvergne
60a2444766 SGSubsystem classes: Whitespace standardisation of the declarations.
This is a clean up commit prior to the subsystem API standardisation to simplify
the diffs.  It includes all SGSubsystem and SGSubsystemGroup derived classes.
2019-07-01 14:27:28 +02:00
Scott Giese
edce380c7b Fix missing header for OSG macros.
Patch provided by Stewart Andreason.
2019-02-05 21:48:05 -06:00
James Turner
a9a49bc2e6 Unboosting files
Use simgear::strutils replacements in places, C++11 features in others
2019-02-04 15:20:22 +00:00
Richard Harrison
f05c0297c0 OSG < 3.4.x fixes
This will use the inherently unsafe versions of the load methods which can result in deleting an object (from the cache) that has just been loaded in the database thread.

Symptom OSG WARN deleting still referenced object.

branches next, origin/next
2019-01-26 18:20:52 +01:00
Richard Harrison
9639b63d44 Use readRef version of osgDB methods to give us thread safety 2019-01-20 23:26:58 +01:00
Thomas Geymayer
82078b632b canvas GUI: Cleanup and trigger dragstart/end events 2018-02-25 14:59:56 +01:00
Thomas Geymayer
193d7b1c6f canvas: Fix receiving keyboard events 2018-01-29 09:09:29 +01:00
Thomas Geymayer
39f7fbf9fc canvas: Refactor and protect against expired pointers 2018-01-28 19:25:03 +01:00
James Turner
2eab935dff Canvas proxy for QtQuick rendering
Has zero testing so far, still a work in progress.
2017-10-05 12:37:43 +01:00
Richard Harrison
0c4eaa8b29 Canvas exception during re-init.
Add defensive logic to ensure that a null pointer isn't dereferenced. This happened to me once or twice during a reinit (Location/Position In Air to the current position). It may be related to the model, but in any case the code needs to ensure that the static cast failure is handled correctly.
2017-05-20 13:40:02 +02:00
James Turner
df2ab15e6c Quiet Canvas font-loading. 2016-11-30 12:15:54 +00:00
James Turner
8e875b22f5 fgValidatePath uses SGPath 2016-07-03 23:59:40 +01:00
James Turner
6d0c2070fd Use future-proof SGPath APIs.
Remove uses of .str(), .c_str() and some other methods of SGPath.
Pass SGPath directly where possible, or explicitly convert to the
appropriate 8-bit encoding.
2016-06-28 10:08:38 +01:00
James Turner
03ecac9dbc Work with new SGPath API. 2016-06-22 17:36:05 +01:00
James Turner
c29fa35840 Updated Canvas adaptor getImage API
Return the Image by ref ptr instead of raw pointer.
2016-03-26 20:25:31 +00:00
James Turner
733e3b3f0c HTTP subsystem has a default name.
Switch to using type-safe accessors now.
2016-03-24 15:08:38 +00:00
Rebecca N. Palmer
9002696195 Make fgValidatePath always return std::string, not char * 2015-03-13 18:07:24 +00:00
Thomas Geymayer
45ab3a20a2 Canvas: generate keypress event for text input. 2014-08-11 00:30:55 +02:00
Thomas Geymayer
271cf1420d Canvas: support for pointer grab. 2014-08-11 00:25:26 +02:00
Thomas Geymayer
4f2032a9c2 Canvas: export preventDefault to Nasal and use to stop events on DesktopGroup. 2014-07-30 17:17:24 +02:00
Thomas Geymayer
49df413444 Canvas: Keyboard events and input focus.
Also allow events on desktop group if no window is receiving
events. Currently it is not possible to prevent events handled
by the desktop group to further propagate (eg. to normal
control input).
2014-07-30 00:00:03 +02:00
Thomas Geymayer
c13612b1fa GUIMgr: prevent double init/shutdown 2014-06-16 23:47:05 +02:00
Thomas Geymayer
bd29974683 Canvas: move Window class to simgear. 2014-05-09 16:42:54 +02:00
Thomas Geymayer
c6371c4152 Canvas: update for SimGear changes. 2014-05-06 18:15:29 +02:00
Thomas Geymayer
58c01b112e Canvas: update for 'file'->'src' rename 2014-03-20 11:43:12 +01:00
Thomas Geymayer
f0ef2b9576 Expose HTTP client to Canvas. 2014-03-18 18:35:35 +01:00
James Turner
86ba2a1628 Throw the reset switch.
- fix up CanvasMgr so canvas works after new reset.
2014-03-07 12:40:14 +00:00
Thomas Geymayer
5fb7b2e12c Canvas: Now only one global SystemAdapter is used... 2013-12-09 23:13:45 +01:00
Thomas Geymayer
e8f4e25c8c CanvasWidget: get new GUI camera on reset. 2013-12-01 12:58:17 +01:00
Thomas Geymayer
bf477ba678 Canvas GUI: completely reset on reinit 2013-12-01 01:35:30 +01:00
Thomas Geymayer
42ab4fd222 Canvas/GUI: add/remove placement factories on init/shutdown. 2013-11-24 15:50:44 +01:00
Thomas Geymayer
26a3573aea Update/simplify for SimGear changes. 2013-10-15 17:48:13 +02:00
Thomas Geymayer
5c42071fbb Scripting: get rid of gcHash and use new SimGear/Nasal functions. 2013-10-15 00:58:21 +02:00
Thomas Geymayer
5b17a6c33f Canvas GUI: don't crash if enable decoration on window without content canvas 2013-07-27 22:16:00 +02:00
Thomas Geymayer
d2524d8fe6 Canvas window: separate handling of content-size and overall size. 2013-07-27 00:01:50 +02:00
Thomas Geymayer
e79e70062e Canvas window: increase drag accuracy. 2013-07-27 00:01:44 +02:00
Thomas Geymayer
02e66fd034 Canvas GUI: fix updating canvas on window with decoration. 2013-07-27 00:00:33 +02:00