set_texture_map Function

private function set_texture_map(self, file) result(ok)

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 Bound

SkySphere

Arguments

Type IntentOptional Attributes Name
class(SkySphere), intent(inout) :: self
character(len=*), intent(in) :: file

image file; '' for none

Return Value logical


Calls

proc~~set_texture_map~2~~CallsGraph proc~set_texture_map~2 SkySphere%set_texture_map interface~vkf_image_delete vkf_image_delete proc~set_texture_map~2->interface~vkf_image_delete interface~vkf_image_read vkf_image_read proc~set_texture_map~2->interface~vkf_image_read proc~find_data_file find_data_file proc~set_texture_map~2->proc~find_data_file proc~make_texture_node make_texture_node proc~set_texture_map~2->proc~make_texture_node proc~find_in_dirs find_in_dirs proc~find_data_file->proc~find_in_dirs interface~vkf_compile_node vkf_compile_node proc~make_texture_node->interface~vkf_compile_node interface~vkf_node_add_child vkf_node_add_child proc~make_texture_node->interface~vkf_node_add_child interface~vkf_node_delete vkf_node_delete proc~make_texture_node->interface~vkf_node_delete interface~vkf_node_remove_child vkf_node_remove_child proc~make_texture_node->interface~vkf_node_remove_child interface~vkf_sky_texture_create vkf_sky_texture_create proc~make_texture_node->interface~vkf_sky_texture_create proc~apply_attitude apply_attitude proc~make_texture_node->proc~apply_attitude proc~apply_mode apply_mode proc~make_texture_node->proc~apply_mode proc~check_status check_status proc~make_texture_node->proc~check_status proc~apply_attitude->proc~check_status interface~vkf_sky_style vkf_sky_style proc~apply_attitude->interface~vkf_sky_style interface~vkf_sky_style_changed vkf_sky_style_changed proc~apply_attitude->interface~vkf_sky_style_changed proc~quat_to_matrix quat_to_matrix proc~apply_attitude->proc~quat_to_matrix proc~apply_mode->proc~check_status interface~vkf_switch_set vkf_switch_set proc~apply_mode->interface~vkf_switch_set

Source Code

    logical function set_texture_map(self, file) result(ok)
        class(SkySphere), intent(inout) :: self
        character(len=*), intent(in) :: file                !! image file; '' for none
        type(c_ptr) :: image
        character(len=:), allocatable :: path
        ok = .true.
        image = c_null_ptr
        if (len_trim(file) > 0) then
            path = find_data_file(file)
            ok = len(path) > 0
            if (ok) image = vkf_image_read(path, len(path, kind=c_int))
            ok = c_associated(image)
            if (.not. ok) then
                write(*, '(a)') 'vkframes: could not read the sky texture '//trim(file)
                return
            end if
        end if
        if (c_associated(self%image)) call vkf_image_delete(self%image)
        self%image = image
        self%texture_file = trim(file)
        if (c_associated(self%root)) call make_texture_node(self)
    end function set_texture_map