to_float_rgba Subroutine

private pure subroutine to_float_rgba(rgba, color)

rgba from [r, g, b] (alpha 1) or [r, g, b, a].

Arguments

Type IntentOptional Attributes Name
real(kind=c_float), intent(out) :: rgba(4)

[r, g, b, a]

real(kind=wp), intent(in) :: color(:)

[r, g, b] or [r, g, b, a] (0 to 1)


Called by

proc~~to_float_rgba~~CalledByGraph proc~to_float_rgba to_float_rgba proc~add_color Trajectory%add_color proc~add_color->proc~to_float_rgba proc~add_point Trajectory%add_point proc~add_point->proc~add_color

Source Code

    pure subroutine to_float_rgba(rgba, color)
        real(c_float), intent(out) :: rgba(4)   !! [r, g, b, a]
        real(wp), intent(in) :: color(:)        !! [r, g, b] or [r, g, b, a] (0 to 1)
        integer :: n
        n = min(4, size(color))
        rgba = 1.0_c_float
        rgba(1:n) = real(color(1:n), c_float)
    end subroutine to_float_rgba