The sky behind a scene (OpenFrames' SkySphere; see the module documentation).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private | :: | attitude_(4) | = | [0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp] |
in the root frame (quaternion [x, y, z, w]) |
|
| character(len=:), | private, | allocatable | :: | catalog |
star catalog file (unallocated or '': none) |
||
| character(len=:), | private, | allocatable | :: | constellation_file |
the file read (unallocated: none yet) |
||
| type(Constellation), | private, | allocatable | :: | groups(:) |
the constellations read (n_groups of them) |
||
| type(c_ptr), | private | :: | image | = | c_null_ptr |
the texture image (null: none) |
|
| type(c_ptr), | private | :: | line_node | = | c_null_ptr |
the constellations drawing (null: none) |
|
| type(c_ptr), | private | :: | line_switch | = | c_null_ptr |
shows or hides the constellations (draw mode) |
|
| real(kind=c_float), | private, | allocatable | :: | lines(:,:) |
(8, n): the lines' ends, directions (x, y, z, -) |
||
| real(kind=wp), | private | :: | lines_rgba(4) | = | [0.35_wp, 0.5_wp, 0.8_wp, 0.45_wp] |
their color (faint) |
|
| logical, | private | :: | lines_shown | = | .false. |
the constellations are drawn |
|
| real(kind=wp), | private | :: | lines_width | = | 1.0_wp |
window units |
|
| real(kind=wp), | private | :: | mag_range(2) | = | 0.0_wp |
of the stars read |
|
| real(kind=wp), | private | :: | max_mag | = | 8.0_wp |
OpenFrames' SkySphere defaults |
|
| real(kind=wp), | private | :: | max_size | = | 10.0_wp |
window units |
|
| integer, | private | :: | max_stars | = | 10000 |
the most stars drawn |
|
| real(kind=wp), | private | :: | min_dim | = | 0.5_wp |
the smallest stars' color scale (0 to 1) |
|
| real(kind=wp), | private | :: | min_mag | = | -2.0_wp |
OpenFrames' SkySphere defaults |
|
| real(kind=wp), | private | :: | min_size | = | 1.0_wp |
window units |
|
| integer, | private | :: | mode | = | SKY_TEXTURE+SKY_STARS |
SKY_NONE, or a sum of SKY_TEXTURE and SKY_STARS |
|
| integer, | private | :: | n_groups | = | 0 |
constellations read |
|
| integer, | private | :: | n_labels | = | 0 |
names drawn |
|
| integer, | private | :: | n_lines | = | 0 |
lines read: columns of lines used |
|
| integer, | private | :: | n_names | = | 0 |
named stars read |
|
| integer, | private | :: | n_stars | = | 0 |
stars read: columns of stars used |
|
| type(c_ptr), | private | :: | name_node | = | c_null_ptr |
the star names, a transform: the attitude (null: none) |
|
| type(StarName), | private, | allocatable | :: | names(:) |
the named stars read (n_names of them) |
||
| character(len=:), | private, | allocatable | :: | names_font |
font ('' or unallocated: the default) |
||
| real(kind=wp), | private | :: | names_max_mag | = | huge(1.0_wp) |
names of stars up to this magnitude |
|
| real(kind=wp), | private | :: | names_rgba(4) | = | [0.6_wp, 0.7_wp, 0.9_wp, 1.0_wp] |
color |
|
| logical, | private | :: | names_shown | = | .false. |
the names are drawn |
|
| real(kind=wp), | private | :: | names_size | = | 12.0_wp |
window units |
|
| type(c_ptr), | private | :: | root | = | c_null_ptr |
the sky's node, a transform (null until made) |
|
| logical, | private | :: | shown | = | .false. |
made for a window: nodes made later are compiled |
|
| type(c_ptr), | private | :: | star_node | = | c_null_ptr |
the stars drawing (null: none) |
|
| type(c_ptr), | private | :: | star_switch | = | c_null_ptr |
shows or hides the stars (draw mode) |
|
| real(kind=c_float), | private, | allocatable | :: | stars(:,:) |
(8, n): direction, size, rgb, - |
||
| character(len=:), | private, | allocatable | :: | texture_file |
texture image file (unallocated or '': none) |
||
| type(c_ptr), | private | :: | texture_node | = | c_null_ptr |
the texture drawing (null: none) |
|
| type(c_ptr), | private | :: | texture_switch | = | c_null_ptr |
shows or hides the texture (draw mode) |
The constellation file read ('' for none).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self |
Constellation line i (1 to num_constellation_lines): its ends' directions (unit vectors, sky frame).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self | |||
| integer, | intent(in) | :: | i |
1 to num_constellation_lines |
||
| real(kind=wp), | intent(out) | :: | a(3) |
unit vectors, sky frame |
||
| real(kind=wp), | intent(out) | :: | b(3) |
unit vectors, sky frame |
Constellation i's lines (1 to num_constellations): first .. last (see constellation_line; none if last < first).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self | |||
| integer, | intent(in) | :: | i |
1 to num_constellations |
||
| integer, | intent(out) | :: | first |
its lines |
||
| integer, | intent(out) | :: | last |
its lines |
Constellation i's name (1 to num_constellations).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self | |||
| integer, | intent(in) | :: | i |
1 to num_constellations |
Whether the constellations are drawn (as set).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self |
The sky's node, made on first use, for a window (set_sky).
For a window's viewer (null: headless), nodes made later (a new texture
or catalog) are compiled for the windows running.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(inout) | :: | self | |||
| type(c_ptr), | intent(in) | :: | viewer |
a window's viewer (null: headless) |
Number of constellation lines read (of all of them).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self |
Number of constellations read.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self |
Number of named stars read (of the stars read).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self |
Number of star names drawn now (0 until the sky is shown, or if the names aren't).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self |
The sky's attitude in the root frame (quaternion [x, y, z, w]): e.g. to turn an equatorial catalog into an ecliptic root frame.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | q(4) |
quaternion [x, y, z, w] (any length > 0) |
Draw the constellations: faint lines between their stars, from
constellation file file (found with find_data_file; read when given,
or when first shown without one: default_constellations), shown
(default false), in color rgba (default a faint blue, alpha 0.45) and
width window units wide (default 1). Also while shown; the settings
not given are kept. Returns false if the file can't be read (the
constellations read before are kept) or width isn't > 0 (nothing
changed).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(inout) | :: | self | |||
| logical, | intent(in) | :: | shown |
draw the constellations |
||
| character(len=*), | intent(in), | optional | :: | file |
constellation file |
|
| real(kind=wp), | intent(in), | optional | :: | rgba(4) |
color [r, g, b, a] (0 to 1) |
|
| real(kind=wp), | intent(in), | optional | :: | width |
window units (> 0) |
What to draw: SKY_NONE, or SKY_TEXTURE + SKY_STARS (default; each only if given).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | mode |
SKY_NONE, or a sum of SKY_TEXTURE and SKY_STARS |
Draw the stars of catalog (found with find_data_file; '' for none)
with magnitudes from min_mag to max_mag (default -2 to 8), at most
max_stars (default 10000), sized from min_size to max_size window
units (default 1 to 10) by brightness, the smallest dimmed to
min_dim_ratio (0 to 1, default 0.5) of their color (OpenFrames'
setSkySphereStarData). Returns false if the catalog cannot be read or the
limits are invalid (min_mag > max_mag, max_stars < 1, min_size >
max_size, a ratio outside 0 to 1).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | catalog |
star catalog file; '' for none |
||
| real(kind=wp), | intent(in), | optional | :: | min_mag |
apparent magnitudes |
|
| real(kind=wp), | intent(in), | optional | :: | max_mag |
apparent magnitudes |
|
| integer, | intent(in), | optional | :: | max_stars |
the most stars drawn (default 10000; >= 1) |
|
| real(kind=wp), | intent(in), | optional | :: | min_size |
window units |
|
| real(kind=wp), | intent(in), | optional | :: | max_size |
window units |
|
| real(kind=wp), | intent(in), | optional | :: | min_dim_ratio |
0 to 1 |
Draw the names of the named stars drawn (those of the catalog's last
field), beside them: shown (default false), of the stars up to
magnitude max_mag (default all of them), size window units tall
(default 12), in color rgba (default a pale blue) and font font
('' or default: vkframes' default font). Also while shown; the
settings not given are kept. Returns false (nothing changed) if size
isn't > 0.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(inout) | :: | self | |||
| logical, | intent(in) | :: | shown |
draw the names |
||
| real(kind=wp), | intent(in), | optional | :: | max_mag |
the dimmest named (apparent magnitude) |
|
| real(kind=wp), | intent(in), | optional | :: | size |
height in window units (> 0) |
|
| real(kind=wp), | intent(in), | optional | :: | rgba(4) |
color [r, g, b, a] (0 to 1) |
|
| character(len=*), | intent(in), | optional | :: | font |
font file ('' for the default) |
Draw an image file as the sky (found with find_data_file); '' for none. Returns false if it cannot be read (the sky is then unchanged).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | file |
image file; '' for none |
Star i (1 to num_stars): its direction (unit vector, sky frame), color (rgb, dimmed) and size (window units).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self | |||
| integer, | intent(in) | :: | i |
1 to num_stars |
||
| real(kind=wp), | intent(out) | :: | direction(3) |
unit vector, sky frame |
||
| real(kind=wp), | intent(out) | :: | rgb(3) |
color, dimmed (0 to 1) |
||
| real(kind=wp), | intent(out) | :: | size |
window units |
The star catalog file ('' for none).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self |
The range of magnitudes of the stars read.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self |
The magnitude range drawn (as set).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self |
Named star i (1 to num_star_names): its name, apparent magnitude and star (1 to num_stars: see star).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self | |||
| integer, | intent(in) | :: | i |
1 to num_star_names |
||
| character(len=:), | intent(out), | allocatable | :: | name |
the catalog's name |
|
| real(kind=wp), | intent(out) | :: | mag |
apparent magnitude |
||
| integer, | intent(out) | :: | which |
the star (1 to num_stars) |
Whether the star names are drawn (as set).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self |
The size range of the stars (window units).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self |
The texture file ('' for none).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SkySphere), | intent(in) | :: | self |
type, public :: SkySphere private character(len=:), allocatable :: texture_file !! texture image file (unallocated or '': none) character(len=:), allocatable :: catalog !! star catalog file (unallocated or '': none) real(wp) :: min_mag = -2.0_wp, max_mag = 8.0_wp !! OpenFrames' SkySphere defaults integer :: max_stars = 10000 !! the most stars drawn real(wp) :: min_size = 1.0_wp, max_size = 10.0_wp !! window units real(wp) :: min_dim = 0.5_wp !! the smallest stars' color scale (0 to 1) integer :: mode = SKY_TEXTURE + SKY_STARS !! SKY_NONE, or a sum of SKY_TEXTURE and SKY_STARS real(wp) :: attitude_(4) = [0.0_wp, 0.0_wp, 0.0_wp, 1.0_wp] !! in the root frame (quaternion [x, y, z, w]) real(c_float), allocatable :: stars(:,:) !! (8, n): direction, size, rgb, - integer :: n_stars = 0 !! stars read: columns of stars used real(wp) :: mag_range(2) = 0.0_wp !! of the stars read type(StarName), allocatable :: names(:) !! the named stars read (n_names of them) integer :: n_names = 0 !! named stars read ! star names logical :: names_shown = .false. !! the names are drawn real(wp) :: names_max_mag = huge(1.0_wp) !! names of stars up to this magnitude real(wp) :: names_size = 12.0_wp !! window units real(wp) :: names_rgba(4) = [0.6_wp, 0.7_wp, 0.9_wp, 1.0_wp] !! color character(len=:), allocatable :: names_font !! font ('' or unallocated: the default) integer :: n_labels = 0 !! names drawn ! constellations character(len=:), allocatable :: constellation_file !! the file read (unallocated: none yet) real(c_float), allocatable :: lines(:,:) !! (8, n): the lines' ends, directions (x, y, z, -) integer :: n_lines = 0 !! lines read: columns of lines used type(Constellation), allocatable :: groups(:) !! the constellations read (n_groups of them) integer :: n_groups = 0 !! constellations read logical :: lines_shown = .false. !! the constellations are drawn real(wp) :: lines_rgba(4) = [0.35_wp, 0.5_wp, 0.8_wp, 0.45_wp] !! their color (faint) real(wp) :: lines_width = 1.0_wp !! window units ! rendering type(c_ptr) :: image = c_null_ptr !! the texture image (null: none) type(c_ptr) :: root = c_null_ptr !! the sky's node, a transform (null until made) type(c_ptr) :: texture_switch = c_null_ptr !! shows or hides the texture (draw mode) type(c_ptr) :: star_switch = c_null_ptr !! shows or hides the stars (draw mode) type(c_ptr) :: texture_node = c_null_ptr !! the texture drawing (null: none) type(c_ptr) :: star_node = c_null_ptr !! the stars drawing (null: none) type(c_ptr) :: name_node = c_null_ptr !! the star names, a transform: the attitude (null: none) type(c_ptr) :: line_switch = c_null_ptr !! shows or hides the constellations (draw mode) type(c_ptr) :: line_node = c_null_ptr !! the constellations drawing (null: none) logical :: shown = .false. !! made for a window: nodes made later are compiled contains procedure :: set_texture_map, texture_map procedure :: set_star_data, star_catalog, star_magnitudes, star_sizes procedure :: num_stars, star_magnitude_range, star procedure :: set_star_names, star_names, num_star_names, num_star_names_drawn, star_name procedure :: set_constellations, constellations, constellation_file_read, num_constellations procedure :: num_constellation_lines, constellation_name, constellation_lines, constellation_line procedure :: set_draw_mode, draw_mode procedure :: set_attitude, attitude procedure :: node end type SkySphere