Camera views: where the camera looks from, as OpenFrames' View.
A view follows a frame: the camera's trackball (eye, center, up, which the mouse moves) is kept in the view frame's coordinates, so the camera moves with the frame. The view frame is * RELATIVE_FRAME (the default): the viewed frame itself (a body-fixed view); * ABSOLUTE_FRAME: the root frame's axes, at the viewed frame's origin (an inertial view that follows the frame as it moves). A view between frames (set_view_between_frames) looks from one frame at another: the view frame is turned so that its +y axis (the trackball's initial viewing direction) points at the second frame, in one direct rotation (VIEW_DIRECT) or first in azimuth, then elevation (VIEW_AZEL, the default, which keeps z up).
The default camera (reset_view) looks along +y at the frame's bound from the distance at which it fills the field of view (or from default_view_distance, or from set_default_view_parameters). Views are not owned by windows: a view, and the frames it refers to, must stay alive while used.
The camera (OpenFrames' trackball get/setTransformation): a window's get_camera / set_camera for the view it shows (and smooth transitions, see vkf_window), or set_camera for a view's camera when it is next shown. camera_between interpolates between two cameras (each eye, center, up): the center along a straight line, the distance geometrically, the orientation by the shortest rotation.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | ABSOLUTE_FRAME | = | 0 |
the base frame of the trackball (OpenFrames' ViewFrameType) the root frame's axes, at the viewed frame's origin |
| integer, | public, | parameter | :: | ORTHOGRAPHIC | = | 0 |
projections (OpenFrames' ProjectionType) orthographic projection |
| integer, | public, | parameter | :: | PERSPECTIVE | = | 1 |
perspective projection |
| integer, | public, | parameter | :: | RELATIVE_FRAME | = | 1 |
the viewed frame itself |
| integer, | public, | parameter | :: | VIEW_AZEL | = | 1 |
azimuth, then elevation (keeps z up) |
| integer, | public, | parameter | :: | VIEW_DIRECT | = | 0 |
how a view between frames turns toward the look-at frame (OpenFrames' ViewRotationType) one direct rotation |
The View constructor: View(...) makes one (see new_view for its
arguments).
A view of frame (in the tree of root), with base frame_type
(default RELATIVE_FRAME); with lookat, a view from frame at lookat,
turned by rotation_type (default VIEW_AZEL). Without frames, the view
looks at the root frame's origin. The frames must stay alive while the
view is used.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ReferenceFrame), | intent(in), | optional, | target | :: | root |
the tree's root, viewed and looked-at frames |
| class(ReferenceFrame), | intent(in), | optional, | target | :: | frame |
the tree's root, viewed and looked-at frames |
| class(ReferenceFrame), | intent(in), | optional, | target | :: | lookat |
the tree's root, viewed and looked-at frames |
| integer, | intent(in), | optional | :: | frame_type |
ABSOLUTE_FRAME or RELATIVE_FRAME |
|
| integer, | intent(in), | optional | :: | rotation_type |
VIEW_DIRECT or VIEW_AZEL |
A view (see the module documentation).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | private | :: | camera_pending | = | .false. |
true if |
|
| real(kind=wp), | private | :: | center(3) | = | 0.0_wp |
kept center |
|
| real(kind=wp), | private | :: | default_center(3) | = | 0.0_wp |
camera center after a reset (view-frame coordinates) |
|
| real(kind=wp), | private | :: | default_distance | = | 0.0_wp |
radius framed on reset (<= 0: the frame's bound) |
|
| real(kind=wp), | private | :: | default_eye(3) | = | 0.0_wp |
camera eye after a reset (view-frame coordinates) |
|
| real(kind=wp), | private | :: | default_up(3) | = | 0.0_wp |
camera up after a reset (zero: no default camera) |
|
| real(kind=wp), | private | :: | eye(3) | = | 0.0_wp |
kept eye |
|
| real(kind=wp), | private | :: | fovy | = | 45.0_wp |
vertical field of view (degrees) |
|
| class(ReferenceFrame), | private, | pointer | :: | frame | => | null() |
the viewed frame (not owned) |
| integer, | private | :: | frame_type | = | RELATIVE_FRAME |
ABSOLUTE_FRAME or RELATIVE_FRAME |
|
| logical, | private | :: | has_state | = | .false. |
true if eye, center, up are kept |
|
| class(ReferenceFrame), | private, | pointer | :: | lookat | => | null() |
the frame looked at (view between frames; not owned) |
| real(kind=wp), | private | :: | ortho(4) | = | [-1.0_wp, 1.0_wp, -1.0_wp, 1.0_wp] |
left, right, bottom, top |
|
| real(kind=wp), | private | :: | pending(3,3) | = | 0.0_wp |
a camera set (eye, center, up), for when it is shown |
|
| integer, | private | :: | projection | = | PERSPECTIVE |
ORTHOGRAPHIC or PERSPECTIVE |
|
| logical, | private | :: | reset_pending | = | .true. |
true if the camera is to be reset when shown |
|
| class(ReferenceFrame), | private, | pointer | :: | root | => | null() |
the root of the frames' tree (not owned) |
| integer, | private | :: | rotation_type | = | VIEW_AZEL |
VIEW_DIRECT or VIEW_AZEL |
|
| real(kind=wp), | private | :: | up(3) | = | 0.0_wp |
kept up direction |
The View constructor: View(...) makes one (see new_view for its
arguments).
| private function new_view (root, frame, lookat, frame_type, rotation_type) | A view of |
| procedure, public :: clear_default_view_parameters | |
| procedure, public :: default_view_distance | |
| procedure, public :: default_view_parameters | |
| procedure, public :: field_of_view | |
| procedure, public :: home | |
| procedure, public :: is_valid | |
| procedure, public :: lookat_frame | |
| procedure, public :: orthographic_bounds | |
| procedure, public :: projection_type | |
| procedure, public :: reset_view | |
| procedure, public :: save_state | |
| procedure, public :: saved_state | |
| procedure, public :: set_camera => view_set_camera | |
| procedure, public :: set_default_view_distance | |
| procedure, public :: set_default_view_parameters | |
| procedure, public :: set_orthographic | |
| procedure, public :: set_perspective | |
| procedure, public :: set_view_between_frames | |
| procedure, public :: set_view_frame | |
| procedure, public :: take_camera | |
| procedure, public :: take_reset | |
| procedure, public :: view_frame | |
| procedure, public :: view_frame_type | |
| procedure, public :: view_root | |
| procedure, public :: view_rotation_type | |
| procedure, public :: world_to_view |
The camera a fraction s (0 to 1) of the way from camera from to
camera to (columns: eye, center, up; in one frame's coordinates): the
center moved along a straight line, the distance to it changed by the
same factor at each step (so far-to-near flights don't rush the near
part), and the orientation turned by the shortest rotation.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | s |
fraction of the way (0: |
||
| real(kind=wp), | intent(in) | :: | from(3,3) |
(columns: eye, center, up) |
||
| real(kind=wp), | intent(in) | :: | to(3,3) |
(columns: eye, center, up) |
The radius framed when the view is reset (<= 0: the viewed frame's bound).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self |
The vertical field of view (degrees) of the perspective projection.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self |
The transform from f to the view's root frame (the tree root if none).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(View), | intent(in) | :: | self | |||
| class(ReferenceFrame), | intent(in) | :: | f |
a frame of the view's tree |
True if the view has a frame to view.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self |
The frame looked at, for a view between frames (null if none).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self |
A view of frame (in the tree of root), with base frame_type
(default RELATIVE_FRAME); with lookat, a view from frame at lookat,
turned by rotation_type (default VIEW_AZEL). Without frames, the view
looks at the root frame's origin. The frames must stay alive while the
view is used.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ReferenceFrame), | intent(in), | optional, | target | :: | root |
the tree's root, viewed and looked-at frames |
| class(ReferenceFrame), | intent(in), | optional, | target | :: | frame |
the tree's root, viewed and looked-at frames |
| class(ReferenceFrame), | intent(in), | optional, | target | :: | lookat |
the tree's root, viewed and looked-at frames |
| integer, | intent(in), | optional | :: | frame_type |
ABSOLUTE_FRAME or RELATIVE_FRAME |
|
| integer, | intent(in), | optional | :: | rotation_type |
VIEW_DIRECT or VIEW_AZEL |
The bounds [left, right, bottom, top] of the orthographic projection.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self |
The projection: ORTHOGRAPHIC or PERSPECTIVE.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self |
rotate(r) * m, for a rotation r (3x3).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | r(3,3) |
rotation (3x3); transform (4x4) |
||
| real(kind=wp), | intent(in) | :: | m(4,4) |
rotation (3x3); transform (4x4) |
The kept trackball state; false if there is none.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self | |||
| real(kind=wp), | intent(out) | :: | eye(3) |
the kept trackball state (view-frame coordinates) |
||
| real(kind=wp), | intent(out) | :: | center(3) |
the kept trackball state (view-frame coordinates) |
||
| real(kind=wp), | intent(out) | :: | up(3) |
the kept trackball state (view-frame coordinates) |
True (once) if a camera was set (set_camera), and that camera.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(out) | :: | cam(3,3) |
(columns: eye, center, up (view-frame coordinates)) |
True (once) if a reset is pending.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(inout) | :: | self |
A camera (columns: eye, center, up) in the coordinates a rigid
transform m (4x4) takes it to: the points moved, the up direction turned.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | m(4,4) |
rigid transform |
||
| real(kind=wp), | intent(in) | :: | cam(3,3) |
(columns: eye, center, up) |
The viewed frame (null if none).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self |
The base of the trackball: ABSOLUTE_FRAME or RELATIVE_FRAME.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self |
The root of the viewed frames' tree (null if none).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self |
How a view between frames turns: VIEW_DIRECT or VIEW_AZEL.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self |
The transform from the root frame to the view frame (4x4), from the frames' current positions and attitudes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self |
A camera's orientation (columns: right, up, back, as a quaternion) and its distance from eye to center (at least a tiny one).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | cam(3,3) |
(columns: eye, center, up) |
||
| real(kind=wp), | intent(out) | :: | q(4) |
orientation quaternion [x, y, z, w] |
||
| real(kind=wp), | intent(out) | :: | d |
distance from eye to center |
Forget the camera set by set_default_view_parameters (back to the default view distance).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(inout) | :: | self |
The camera after a reset (view-frame coordinates; all zero if none is set).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self | |||
| real(kind=wp), | intent(out) | :: | eye(3) |
the camera (view-frame coordinates; zero if not set) |
||
| real(kind=wp), | intent(out) | :: | center(3) |
the camera (view-frame coordinates; zero if not set) |
||
| real(kind=wp), | intent(out) | :: | up(3) |
the camera (view-frame coordinates; zero if not set) |
The default camera (eye, center, up in view-frame coordinates) for a
viewport of aspect ratio aspect (width / height): OpenFrames' resetView.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(in) | :: | self | |||
| real(kind=wp), | intent(in) | :: | aspect |
viewport width / height |
||
| real(kind=wp), | intent(out) | :: | eye(3) |
the default camera (view-frame coordinates) |
||
| real(kind=wp), | intent(out) | :: | center(3) |
the default camera (view-frame coordinates) |
||
| real(kind=wp), | intent(out) | :: | up(3) |
the default camera (view-frame coordinates) |
Put the camera back at the default position (applied at the next frame in which the view is shown).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(inout) | :: | self |
Keep the trackball state while another view is shown.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | eye(3) |
the trackball state (view-frame coordinates) |
||
| real(kind=wp), | intent(in) | :: | center(3) |
the trackball state (view-frame coordinates) |
||
| real(kind=wp), | intent(in) | :: | up(3) |
the trackball state (view-frame coordinates) |
The radius to frame when the view is reset (<= 0: the viewed frame's bound, the default), as OpenFrames' default view distance.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | distance |
radius (<= 0: the frame's bound) |
The camera after a reset, in view-frame coordinates (overrides the default view distance).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | eye(3) |
the camera (view-frame coordinates) |
||
| real(kind=wp), | intent(in) | :: | center(3) |
the camera (view-frame coordinates) |
||
| real(kind=wp), | intent(in) | :: | up(3) |
the camera (view-frame coordinates) |
An orthographic projection with the given bounds (in view units).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | left |
bounds (view units) |
||
| real(kind=wp), | intent(in) | :: | right |
bounds (view units) |
||
| real(kind=wp), | intent(in) | :: | bottom |
bounds (view units) |
||
| real(kind=wp), | intent(in) | :: | top |
bounds (view units) |
A perspective projection with vertical field of view fovy (degrees; default 45).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | fovy |
vertical field of view (degrees) |
Look from frame at lookat (both in the tree of root).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(inout) | :: | self | |||
| class(ReferenceFrame), | intent(in), | target | :: | root |
the tree's root, viewed and looked-at frames |
|
| class(ReferenceFrame), | intent(in), | target | :: | frame |
the tree's root, viewed and looked-at frames |
|
| class(ReferenceFrame), | intent(in), | target | :: | lookat |
the tree's root, viewed and looked-at frames |
|
| integer, | intent(in), | optional | :: | frame_type |
ABSOLUTE_FRAME or RELATIVE_FRAME (default) |
|
| integer, | intent(in), | optional | :: | rotation_type |
VIEW_DIRECT or VIEW_AZEL (default) |
View frame (in the tree of root) with base frame_type (default RELATIVE_FRAME).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(inout) | :: | self | |||
| class(ReferenceFrame), | intent(in), | target | :: | root |
the tree's root; the viewed frame (not owned) |
|
| class(ReferenceFrame), | intent(in), | target | :: | frame |
the tree's root; the viewed frame (not owned) |
|
| integer, | intent(in), | optional | :: | frame_type |
ABSOLUTE_FRAME or RELATIVE_FRAME |
The camera (view-frame coordinates) to show the next time the view is drawn (at once if it is shown: the window's set_camera can also fly there). It replaces a pending reset.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(View), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | eye(3) |
the camera (view-frame coordinates) |
||
| real(kind=wp), | intent(in) | :: | center(3) |
the camera (view-frame coordinates) |
||
| real(kind=wp), | intent(in) | :: | up(3) |
the camera (view-frame coordinates) |