A switch with a mesh for each region (vertices written at each change
of shape), under group.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ShadowCones), | 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 |
subroutine shadow_build_contents(self, viewer, group) class(ShadowCones), 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 real(c_float), dimension(:,:), pointer :: v, normals, uv integer(c_int32_t), dimension(:), pointer :: indices integer :: k, i, j, n n = n_around do k = 1, n_regions associate (g => self%region(k)) g%mesh = vkf_mesh_create(int(2 * n, c_int), int(6 * n, c_int), [1.0_c_float, 1.0_c_float, 1.0_c_float, & 1.0_c_float], c_null_ptr, c_null_ptr, 5_c_int) ! unlit, transparent; vertices change if (.not. c_associated(g%mesh)) cycle call mesh_arrays(g%mesh, 2 * n, 6 * n, v, normals, uv, indices) v = 0.0_c_float normals = 0.0_c_float normals(3, :) = 1.0_c_float uv = 0.0_c_float do i = 1, n ! ring 0: vertices 0..n-1; ring 1: n..2n-1 j = modulo(i, n) indices(6*i-5:6*i) = int([i - 1, j, n + i - 1, j, n + j, n + i - 1], c_int32_t) end do call apply_color(g) g%switch = vkf_switch_create() call check_status(vkf_node_add_child(g%switch, g%mesh), 'shadow') call check_status(vkf_switch_set(g%switch, 0_c_int), 'shadow') ! (until shaped) call check_status(vkf_node_add_child(group, g%switch), 'shadow') end associate end do self%shaped = -1.0_wp ! (shaped at the next update) end subroutine shadow_build_contents