ExtraViewWindows

From FlightGear wiki
Jump to navigation Jump to search

Overview

On next, there's support for Extra View windows. These are top-level windows that show views independently from the main window's view. These use a new view system called Sview (short for "Step View") along with CompositeViewer Support.

The simplest way to create an extra view window is from menu View/Add Clone View which, as the name implies, will create a new window that is a clone of the current view. Changing the main window's view will leave the new window's view unchanged.

Viewing pairs of aircraft

There is a slightly crude mechanism for creating views that work on pairs of aircraft: one uses menu View/Push Pair View to push the current main-window view onto a stack of views.

Once this has been done at two or more times, menu View/Add Pair View will open a new top-level window showing a view derived from the last two remembered viewpoints. So for example it can show the view of your aircraft from a particular multiplayer aircraft, or a view of the nearest tower from your aircraft.

Menu View/Add Pair Foreground View is similar but it keeps the first viewpoint at a fixed distance in the foreground and the second viewpoint in the background. This works well when flying in formation.

Limitations

As of 2021-10-25:

  • Extra View windows can be panned like the main window by dragging with the left mouse button.
  • Other UI interations is not supported:
    • Mouse clicks are ignord.
    • Key presses are ignored.

Specifying views in more detail

One can specify views explicitly with the view-new command, which accepts an Sview specification in the form of an accompanying XML tree.

For details of the XML format, see the comments in: flightgear/src/Viewer/sview.hxx

How Sview works

Sview works by constructing camera's eye and target positions/directions using an arbitrary number of individual configurable steps. There are various step types defined which allow for various transformations such as moving to a particular user/multiplayer aircraft or nearest tower, move relative to the current position+direction, modify heading, pitch and roll according to particular property values, rotate view direction to point at a particular target etc.

These basic steps are enough to allow Sview to copy what conventional views do, allowing the View/Add clone view menu item to work.

It's also easy enough to add (C++) code to implement new steps to achieve more sophisticated behaviour. An example of this is the view step called double that keeps two aircraft visible at all times, with one in the foreground; this is used for View/Add Pair Foreground View.

For more details, see the C++ Sview code itself: flightgear/src/Viewer/sview.cxx