HUD: dpl2d Y grows down -- unflip the whole 2D layer
Period VHS footage of a 4.10 game (operator's capture) shows the twist dial UNDER the reticle and the range bar filling top-to-bottom; our mapping of dpl2d Y straight onto GL's Y-up NDC (and the software path's "y up" projection) rendered the entire HUD vertically flipped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1008,8 +1008,10 @@ class Renderer:
|
|||||||
g = 1.0 / self.gamma
|
g = 1.0 / self.gamma
|
||||||
|
|
||||||
def P(pt):
|
def P(pt):
|
||||||
|
# dpl2d Y grows DOWN (screen convention; period VHS footage:
|
||||||
|
# twist dial UNDER the reticle, range bar filling top-to-bottom)
|
||||||
return (int((pt[0] - x0) * sx + 0.5),
|
return (int((pt[0] - x0) * sx + 0.5),
|
||||||
int((y1 - pt[1]) * sy + 0.5)) # y up
|
int((pt[1] - y0) * sy + 0.5))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
prims = hud2d_prims(board.dl2d, root)
|
prims = hud2d_prims(board.dl2d, root)
|
||||||
|
|||||||
@@ -196,6 +196,10 @@ in vec2 in_pos;
|
|||||||
void main() {
|
void main() {
|
||||||
vec2 p = vec2((in_pos.x - u_rect.x) / (u_rect.z - u_rect.x),
|
vec2 p = vec2((in_pos.x - u_rect.x) / (u_rect.z - u_rect.x),
|
||||||
(in_pos.y - u_rect.y) / (u_rect.w - u_rect.y)) * 2.0 - 1.0;
|
(in_pos.y - u_rect.y) / (u_rect.w - u_rect.y)) * 2.0 - 1.0;
|
||||||
|
// dpl2d Y grows DOWN (screen convention): period VHS footage shows the
|
||||||
|
// twist dial UNDER the reticle and the range bar filling top-to-bottom;
|
||||||
|
// mapping straight onto GL's Y-up NDC rendered the whole HUD flipped.
|
||||||
|
p.y = -p.y;
|
||||||
gl_Position = vec4(p, 0.0, 1.0);
|
gl_Position = vec4(p, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user