3D models: a model file (3ds, obj, glTF, ... through vsgXchange) in a frame, as OpenFrames' Model.
The model is placed in its frame by its own transform: translate(model_position) * rotate(model_attitude) * scale(model_scale) * translate(-model_pivot), so e.g. the pivot can be the model's center (model_bound) and the scale can size it.
The Model constructor: Model(...) makes one (see new_model for its
arguments).
A model frame named name (decorations of color color), with the
model file file if given (see set_model).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | name |
the frame's name |
||
| character(len=*), | intent(in), | optional | :: | file |
model file (3ds, obj, glTF, ...) |
|
| real(kind=wp), | intent(in), | optional | :: | color(:) |
[r, g, b] or [r, g, b, a] (0 to 1) |
A model (see the module documentation).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private | :: | bound_center(3) | = | 0.0_wp |
the model's bounding sphere: center (model coordinates) |
|
| real(kind=wp), | private | :: | bound_radius | = | 0.0_wp |
the model's bounding sphere: radius (0: unknown) |
|
| character(len=:), | private, | allocatable | :: | file |
the model file (unallocated: none) |
||
| type(c_ptr), | private | :: | model_ | = | c_null_ptr |
the loaded model's node |
|
| real(kind=wp), | private | :: | model_attitude_(4) | = | quat_identity |
attitude in the frame (quaternion [x, y, z, w]) |
|
| type(c_ptr), | private | :: | model_node | = | c_null_ptr |
transform of the model within the frame |
|
| real(kind=wp), | private | :: | model_position_(3) | = | 0.0_wp |
where the pivot is in the frame |
|
| real(kind=wp), | private | :: | pivot_(3) | = | 0.0_wp |
the model's point at model_position_ (model coordinates) |
|
| real(kind=wp), | private | :: | scale_(3) | = | 1.0_wp |
scale along the model's x, y, z |
The Model constructor: Model(...) makes one (see new_model for its
arguments).
| private function new_model (name, file, color) | A model frame named |
| procedure, public :: add_child | |
| procedure, public :: attitude | |
| procedure, public :: axes_labels_shown | |
| procedure, public :: axes_shown | |
| procedure, public :: axis_label | |
| procedure, public :: bound => model_frame_bound | |
| procedure, public :: build_contents => model_build_contents | |
| procedure, public :: child | |
| procedure, public :: child_index | |
| procedure, public :: color | |
| procedure, public :: contents_shown | |
| procedure, public :: detach | |
| procedure, public :: follow | |
| procedure, public :: follow_frame | |
| procedure, public :: follower | |
| procedure, public :: frame_info => model_frame_info | |
| procedure, public :: frame_string | |
| procedure, public :: has_light_source | |
| procedure, public :: has_model | |
| procedure, public :: is_following | |
| procedure, public :: label_alignment | |
| procedure, public :: label_font | |
| procedure, public :: label_size | |
| procedure, public :: late_update | |
| procedure, public :: light_ambient | |
| procedure, public :: light_diffuse | |
| procedure, public :: light_source_enabled | |
| procedure, public :: light_specular | |
| procedure, public :: local_matrix | |
| procedure, public :: local_matrix_at | |
| procedure, public :: model_attitude | |
| procedure, public :: model_bound | |
| procedure, public :: model_file | |
| procedure, public :: model_pivot | |
| procedure, public :: model_position | |
| procedure, public :: model_scale | |
| procedure, public :: motion_key | |
| procedure, public :: move_x_axis | |
| procedure, public :: move_y_axis | |
| procedure, public :: move_z_axis | |
| procedure, public :: name | |
| procedure, public :: name_label_on_top | |
| procedure, public :: name_label_shown | |
| procedure, public :: node | |
| procedure, public :: num_children | |
| procedure, public :: num_parents | |
| procedure, public :: parent | |
| procedure, public :: parent_index | |
| procedure, public :: pick => model_pick | |
| procedure, public :: pickable | |
| procedure, public :: position | |
| procedure, public :: position_of | |
| procedure, public :: realize | |
| procedure, public :: remove_child | |
| procedure, public :: reposition_axes | |
| procedure, public :: set_attitude | |
| procedure, public :: set_color | |
| procedure, public :: set_label_alignment | |
| procedure, public :: set_label_font | |
| procedure, public :: set_label_size | |
| procedure, public :: set_light_ambient | |
| procedure, public :: set_light_diffuse | |
| procedure, public :: set_light_source_enabled | |
| procedure, public :: set_light_specular | |
| procedure, public :: set_model | |
| procedure, public :: set_model_attitude | |
| procedure, public :: set_model_pivot | |
| procedure, public :: set_model_position | |
| procedure, public :: set_model_scale | |
| procedure, public :: set_name | |
| procedure, public :: set_name_label_on_top | |
| procedure, public :: set_pickable | |
| procedure, public :: set_position | |
| procedure, public :: set_x_label | |
| procedure, public :: set_y_label | |
| procedure, public :: set_z_label | |
| procedure, public :: share_model | |
| procedure, public :: show_axes | |
| procedure, public :: show_axes_labels | |
| procedure, public :: show_contents | |
| procedure, public :: show_decorations | |
| procedure, public :: show_name_label | |
| procedure, public :: sync | |
| procedure, public :: unfollow | |
| procedure, public :: update | |
| procedure, public :: world_matrix | |
| procedure, public :: world_matrix_at |
True if a model was read (or shared).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(in) | :: | self |
Attitude of the model in its frame (quaternion [x, y, z, w]).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(in) | :: | self |
The model file ('' if none).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(in) | :: | self |
The kind of frame: 'Model'.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(in) | :: | self |
The model's pivot, in its own coordinates (see set_model_pivot).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(in) | :: | self |
Where the model's pivot is placed in its frame (frame coordinates).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(in) | :: | self |
Scale along the model's x, y and z axes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(in) | :: | self |
A model frame named name (decorations of color color), with the
model file file if given (see set_model).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | name |
the frame's name |
||
| character(len=*), | intent(in), | optional | :: | file |
model file (3ds, obj, glTF, ...) |
|
| real(kind=wp), | intent(in), | optional | :: | color(:) |
[r, g, b] or [r, g, b, a] (0 to 1) |
Read the model file (now, so its bound is known). Returns false if it could not be read. Set it before a window first shows the model.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | file |
model file (3ds, obj, glTF, ...) |
The model's bounding sphere, in the model's own coordinates (before its transform).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(in) | :: | self | |||
| real(kind=wp), | intent(out) | :: | center(3) |
the bounding sphere, model coordinates |
||
| real(kind=wp), | intent(out) | :: | radius |
the bounding sphere, model coordinates |
The model under the model transform.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(inout) | :: | self | |||
| type(c_ptr), | intent(in) | :: | viewer |
a window's viewer handle (null: headless) |
||
| type(c_ptr), | intent(in) | :: | group |
the group node to build under |
The model's bounding sphere in the frame (through the model transform).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(in) | :: | self | |||
| real(kind=wp), | intent(out) | :: | center(3) |
the bounding sphere, frame coordinates (scene units) |
||
| real(kind=wp), | intent(out) | :: | radius |
the bounding sphere, frame coordinates (scene units) |
Picked on the model's bounding sphere (not its triangles); else at the frame's origin.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(in), | target | :: | self | ||
| type(PickCamera), | intent(in) | :: | cam |
the cursor's ray and the pick's settings |
||
| real(kind=wp), | intent(in) | :: | to_root(4,4) |
the frame's transform to the root frame |
||
| type(PickHit), | intent(inout), | allocatable | :: | hits(:) |
hits so far (grown as needed) |
|
| integer, | intent(inout) | :: | n |
number of hits in hits |
Attitude of the model in its frame (quaternion [x, y, z, w]).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | q(4) |
quaternion [x, y, z, w] (normalized here) |
The point of the model (in its own coordinates) placed at model_position, about which it is rotated and scaled.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | pivot(3) |
(model coordinates) |
Where the model's pivot is placed in its frame (frame coordinates).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | position(3) |
frame coordinates |
Scale along the model's x, y and z axes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Model), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | scale(3) |
along the model's x, y and z |
Give the model transform to its node (once built).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(Model), | intent(inout) | :: | self |