Where point p (root frame) is in the window, as HUD text positions:
(x, y) from 0 to 1, left to right and bottom to top (as at the last
frame). False if it is behind the eye (or before the first frame).
E.g. to keep HUD text next to a moving object, each frame: a callout.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(WindowProxy), | intent(in) | :: | self | |||
| real(kind=wp), | intent(in) | :: | p(3) |
root frame |
||
| real(kind=wp), | intent(out) | :: | position(2) |
(x, y), 0 to 1 from the bottom left |
logical function screen_position(self, p, position) result(visible) class(WindowProxy), intent(in) :: self real(wp), intent(in) :: p(3) !! root frame real(wp), intent(out) :: position(2) !! (x, y), 0 to 1 from the bottom left type(PickCamera) :: cam real(wp) :: sx, sy, depth visible = .false. position = 0.0_wp if (.not. view_camera(self, 0.0_wp, 0.0_wp, cam)) return if (.not. project(cam, p, sx, sy, depth)) return ! (offsets from the center, in pixels) position = 0.5_wp * ([sx / cam%half_w, sy / cam%half_h] + 1.0_wp) visible = .true. end function screen_position