sphere_build_contents Subroutine

private subroutine sphere_build_contents(self, viewer, group)

The body: an ellipsoid mesh under the sphere's transform.

Type Bound

Sphere

Arguments

Type IntentOptional Attributes Name
class(Sphere), intent(inout) :: self
type(c_ptr), intent(in) :: viewer

a window's viewer (null: headless)

type(c_ptr), intent(in) :: group

the frame's contents group


Calls

proc~~sphere_build_contents~~CallsGraph proc~sphere_build_contents Sphere%sphere_build_contents interface~vkf_image_delete vkf_image_delete proc~sphere_build_contents->interface~vkf_image_delete interface~vkf_node_add_child vkf_node_add_child proc~sphere_build_contents->interface~vkf_node_add_child interface~vkf_sphere_lod_create vkf_sphere_lod_create proc~sphere_build_contents->interface~vkf_sphere_lod_create interface~vkf_transform_create vkf_transform_create proc~sphere_build_contents->interface~vkf_transform_create proc~apply_material apply_material proc~sphere_build_contents->proc~apply_material proc~build_lod_mesh build_lod_mesh proc~sphere_build_contents->proc~build_lod_mesh proc~ellipsoid_create ellipsoid_create proc~sphere_build_contents->proc~ellipsoid_create proc~name ReferenceFrame%name proc~sphere_build_contents->proc~name proc~radii Sphere%radii proc~sphere_build_contents->proc~radii proc~read_texture read_texture proc~sphere_build_contents->proc~read_texture proc~update_sphere_transform update_sphere_transform proc~sphere_build_contents->proc~update_sphere_transform proc~apply_material_to apply_material_to proc~apply_material->proc~apply_material_to proc~build_lod_mesh->proc~ellipsoid_create proc~build_lod_mesh->proc~name interface~vkf_compile_node vkf_compile_node proc~build_lod_mesh->interface~vkf_compile_node interface~vkf_sphere_lod_add vkf_sphere_lod_add proc~build_lod_mesh->interface~vkf_sphere_lod_add proc~build_lod_mesh->proc~apply_material_to interface~vkf_mesh_create vkf_mesh_create proc~ellipsoid_create->interface~vkf_mesh_create interface~vkf_mesh_set_bound vkf_mesh_set_bound proc~ellipsoid_create->interface~vkf_mesh_set_bound proc~ellipsoid ellipsoid proc~ellipsoid_create->proc~ellipsoid proc~ellipsoid_size ellipsoid_size proc~ellipsoid_create->proc~ellipsoid_size proc~mesh_arrays mesh_arrays proc~ellipsoid_create->proc~mesh_arrays proc~read_texture->proc~name interface~vkf_image_read vkf_image_read proc~read_texture->interface~vkf_image_read proc~find_data_file find_data_file proc~read_texture->proc~find_data_file proc~update_sphere_transform->proc~name proc~update_sphere_transform->proc~radii interface~vkf_transform_set_matrix vkf_transform_set_matrix proc~update_sphere_transform->interface~vkf_transform_set_matrix proc~frame_matrix frame_matrix proc~update_sphere_transform->proc~frame_matrix proc~apply_material_to->proc~name interface~vkf_mesh_set_twilight vkf_mesh_set_twilight proc~apply_material_to->interface~vkf_mesh_set_twilight proc~color~2 ReferenceFrame%color proc~apply_material_to->proc~color~2 proc~mesh_set_material mesh_set_material proc~apply_material_to->proc~mesh_set_material proc~find_in_dirs find_in_dirs proc~find_data_file->proc~find_in_dirs proc~quat_to_matrix quat_to_matrix proc~frame_matrix->proc~quat_to_matrix interface~vkf_mesh_array vkf_mesh_array proc~mesh_arrays->interface~vkf_mesh_array interface~vkf_mesh_material vkf_mesh_material proc~mesh_set_material->interface~vkf_mesh_material interface~vkf_mesh_material_changed vkf_mesh_material_changed proc~mesh_set_material->interface~vkf_mesh_material_changed

Source Code

    subroutine sphere_build_contents(self, viewer, group)
        class(Sphere), intent(inout) :: self
        type(c_ptr), intent(in) :: viewer                   !! a window's viewer (null: headless)
        type(c_ptr), intent(in) :: group                    !! the frame's contents group
        type(c_ptr) :: image, night, body
        image = read_texture(self, self%texture)
        night = read_texture(self, self%night_texture)
        self%textured = c_associated(image)
        self%built_radii = self%radii()
        self%translucent = self%opacity_ < 1.0_wp
        if (self%auto_lod_) then                           ! meshes chosen per view, built when wanted
            self%image = image                              ! (kept for those built later)
            self%night = night
            self%shown = c_associated(viewer)
            self%lod_node = vkf_sphere_lod_create(maxval(self%built_radii))
            call build_lod_mesh(self, lod_first, compile=.false.)    ! (compiled with the scene)
            if (.not. c_associated(self%lod_mesh(lod_first))) return
            body = self%lod_node
        else
            self%mesh = ellipsoid_create(self%built_radii, [1.0_c_float, 1.0_c_float, 1.0_c_float, 1.0_c_float], image, &
                                         self%n_lon, self%n_lat, night, translucent=self%translucent)
            if (c_associated(image)) call vkf_image_delete(image)
            if (c_associated(night)) call vkf_image_delete(night)
            if (.not. c_associated(self%mesh)) return
            body = self%mesh
        end if
        call apply_material(self)
        self%sphere_node = vkf_transform_create()
        call update_sphere_transform(self)
        if (vkf_node_add_child(self%sphere_node, body) /= 0 .or. vkf_node_add_child(group, self%sphere_node) /= 0) &
            write(*, '(a)') 'vkframes: Sphere '//self%name()//': could not build the scene'
    end subroutine sphere_build_contents