Canvas view camera element
|Description||Rendering arbitrary views to a texture/Canvas|
- Tail Cams
- Dynamic in-sim view configuration
- On demand creation of views and windows (e.g. FGCamera previews)
- Prototyping/testing HUDs or PFDs requiring synthetic terrain to work properly (will require support for effects/shaders)
Currently FlightGear uses only one instance of osg::Viewer, which is used by CameraGroup to manage the slave cameras. Supporting CompositeViewer would require modifying flightgear/src/Viewer/fg_os_osgviewer.cxx and creating some kind of wrapper class that manages the CompositeViewer instance and assigns a CameraGroup to each osg::View. It's also important to note that currently all FG subsystems assume there is a single instance of CameraGroup.
Standardize the View manager Pending
The first step would be to port the view code to SimGear so it can be used and known by the Compositor and Canvas. The view manager (flightgear/src/Viewer/viewmgr.cxx) currently has some hardcoded assumptions, so it would either need to be rewritten to remove them or a new interface for the Views could be created specifically for the Canvas Camera View.
Instead of using tied properties, the adapted view manager code would either used propertyObject<> or the propertyBasedMgr abstraction, so that the corresponding canvas element can continue to use well-known conventions to manipulate views.
This derived class would require the following configuration:
- Compositor to use.
- View to use. This could be one of the "main" ones (i.e. the ones on the main property tree), or a locally-defined one that is only known to this Canvas Element (think FLIR).
- Scene graph to use. By default the main scene graph would be used, but an arbitrary XML file can be loaded to render a custom model (for which we have working code, too)
- Several optimization/miscellaneous parameters like framerate cap, etc.
Simplifying a lot, this Canvas Element would be an aggregation of a Compositor instance, a View and a pointer to a osg::Group representing the scene graph to render. This setup could be replicated in flightgear/src/Viewer/fg_os_osgviewer.cxx, with the difference of ignoring Canvas and using native windowing features from OSG.