The segments into the chain: segment i as points 2i-1 (a) and 2i (b), with their colors; uploaded, and drawn.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(CustomLineSegments), | intent(inout) | :: | self |
subroutine write_segments(self) type(CustomLineSegments), intent(inout) :: self real(c_float), dimension(:,:,:), pointer :: p real(c_float), dimension(:,:), pointer :: c real(wp), allocatable :: x(:,:) real(c_float), allocatable :: colors(:,:) integer :: n, j, lo, hi n = 2 * self%n self%changed = .false. self%n_drawn = self%n if (n == 0) then call self%chain%draw(0) return end if allocate(x(3, n), colors(4, n)) x(:, 1:n:2) = self%a x(:, 2:n:2) = self%b if (allocated(self%color_a)) then colors(:, 1:n:2) = self%color_a colors(:, 2:n:2) = self%color_b else colors = spread(real(self%color(), c_float), 2, n) end if call self%chain%reserve(n) do j = 1, self%chain%num_chunks() call self%chain%slice(j, 1, n, lo, hi, p) if (.not. associated(p)) cycle call split_points(x(:, lo:hi), p) call self%chain%color_slice(j, 1, n, lo, hi, c) if (associated(c)) c = colors(:, lo:hi) end do call self%chain%written(1, n) call self%chain%draw(n) end subroutine write_segments