diff --git a/emulator/firmware-decomp/emu860c/hud2d_overlay.py b/emulator/firmware-decomp/emu860c/hud2d_overlay.py index 5c96bbe6..871318b3 100644 --- a/emulator/firmware-decomp/emu860c/hud2d_overlay.py +++ b/emulator/firmware-decomp/emu860c/hud2d_overlay.py @@ -28,7 +28,8 @@ _EDGE_OP = {6: 'nest', 7: 'link', 8: 'prune', 11: 'list_add', 12: 'list_remove'} class HudTracker: """Incremental wire-record feed -> the view's live dpl2d overlay - primitives, in view-rect space (x0..x1, y0..y1, y up). + primitives, in view-rect space (x0..x1, y0..y1, y grows DOWN -- + y0 is the top of screen, y1 the bottom; see composite_hud's to_px). Only tracks what hud2d_root/hud2d_prims need: node type+body (create/ flush), the dcs->view list_add edge, and the dl2d display-list words @@ -101,8 +102,9 @@ class HudTracker: def composite_hud(img, tracker, W, H): """Draw the tracker's current HUD primitives onto img (HxWx3 uint8, - modified in place). view-rect (x0..x1, y0..y1, y UP) -> pixel space - (0..W, 0..H, y DOWN): px = (x-x0)/(x1-x0)*W, py = (1-(y-y0)/(y1-y0))*H. + modified in place). view-rect (x0..x1, y0..y1, y grows DOWN -- confirmed + live, see to_px) -> pixel space (0..W, 0..H, y down, same direction): + px = (x-x0)/(x1-x0)*W, py = (y-y0)/(y1-y0)*H, no inversion. No-op (returns False) if the view rect or display list isn't resolved yet -- callers should keep showing the last good frame, same as the 3D render's own "skip if not ready" convention.""" @@ -121,7 +123,13 @@ def composite_hud(img, tracker, W, H): def to_px(pt): x, y = pt - return ((x - x0) / dx * W, (1.0 - (y - y0) / dy) * H) + # dpl2d Y grows DOWN (screen convention), confirmed both by the user + # (live: horizontal/twist tape appeared at top instead of bottom, the + # range ladder filled the wrong direction) and by vrview_gl.py's own + # comment/fix for the identical symptom ("mapping straight onto GL's + # Y-up NDC rendered the whole HUD flipped") -- y0 (the smaller raw + # value) is the TOP of screen, y1 the bottom. No inversion needed. + return ((x - x0) / dx * W, (y - y0) / dy * H) for kind, col, width, pts in prims: if len(pts) < 1: