read_texture Function

private function read_texture(self, file) result(image)

An image handle for texture file file (null if none or unreadable).

Arguments

Type IntentOptional Attributes Name
type(Sphere), intent(in) :: self
character(len=:), intent(in), allocatable :: file

found with find_data_file (unallocated or '': none)

Return Value type(c_ptr)


Calls

proc~~read_texture~~CallsGraph proc~read_texture read_texture 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~name ReferenceFrame%name proc~read_texture->proc~name proc~find_in_dirs find_in_dirs proc~find_data_file->proc~find_in_dirs

Called by

proc~~read_texture~~CalledByGraph proc~read_texture read_texture proc~sphere_build_contents Sphere%sphere_build_contents proc~sphere_build_contents->proc~read_texture

Source Code

    function read_texture(self, file) result(image)
        type(Sphere), intent(in) :: self
        character(len=:), allocatable, intent(in) :: file   !! found with find_data_file (unallocated or '': none)
        type(c_ptr) :: image
        character(len=:), allocatable :: path
        image = c_null_ptr
        if (.not. allocated(file)) return
        if (len(file) == 0) return
        path = find_data_file(file)
        if (len(path) > 0) image = vkf_image_read(path, len(path, kind=c_int))
        if (.not. c_associated(image)) write(*, '(a)') 'vkframes: Sphere '//self%name()//': could not read texture '//file
    end function read_texture