Files
TeslaRel410/emulator/render-bridge/playback.py
T
CydandClaude Fable 5 0f5b2e28da Renderer: vendor live-bridge scripts; GPU backend unblocked (60fps)
- emulator/render-bridge/: the pod->Dave's-renderer live bridge (rescued
  from session scratchpad): live_bridge.py (first-person cam from the 0x1f
  pose, arrow-key eye-height trim), fp/chase offline renders, fifobridge,
  diagnostics, gauge_arena[_sound].conf, and launch_pod.ps1 (one-command
  pod+bridge restart: pentapus VPX_EXPLODE + AWE32 sound + GL bridge).
- _backend.py: renderer selection -- vrview_gl.GLRenderer (moderngl) by
  default, VRVIEW_SOFT=1 for the software reference; backend-agnostic
  frame save via last_frame.
- GPU backend runs on side-by-side CPython 3.13 (moderngl/glcontext cp313
  wheels; no MSVC needed): 63fps headless / 60.7 windowed vs 21fps software
  on the same scene, and the GL path also draws the vertex-alpha cloud dome.
- vrview.py: VRVIEW_GAMMA env selects DAC gamma (1.25 live-renderer legacy
  vs 1.7 per the original GAMMA.C) for A/B against the real pod.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 13:34:02 -05:00

44 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""Play a captured BTL4OPT VelociRender stream back through the friend's board
+ software renderer in a REAL on-screen window (chase cam follows a mech).
Loops forever; close the window to stop.
py playback.py [capture.raw.bin] [WxH] [chase]
"""
import os, sys, time
sys.path.insert(0, r'C:\VWE\TeslaRel410\dpl3-revive\patha')
# real window: do NOT set SDL_VIDEODRIVER=dummy
cap = sys.argv[1] if len(sys.argv) > 1 else r'C:\VWE\TeslaRel410\dpl3-revive\patha\bt8.raw.bin'
size = sys.argv[2] if len(sys.argv) > 2 else '640x400'
os.environ['VRVIEW_CHASE'] = sys.argv[3] if len(sys.argv) > 3 else '2'
W, H = (int(x) for x in size.lower().split('x'))
import numpy as np
from vrboard import VirtualBoard, Assembler, A
from decode_anim import find_framed_start
from vrview import Renderer
data = open(cap, 'rb').read()
start = find_framed_start(data)
r = Renderer(w=W, h=H,
title='VWE pod - Division render (dpl3-revive board) - our BTL4OPT arena')
r.fps = 30
print(f'playing {cap} ({len(data)} bytes) in a {W}x{H} window; close it to stop')
try:
while True: # loop the capture
board = VirtualBoard(); board._view = r
asm = Assembler(); asm.feed(data[start:])
drew = 0
for m in asm:
try:
board.handle(m)
except Exception:
pass
if (not m.iserver) and m.action == A.draw_scene:
r.draw(board) # renders (chase cam) + paces to fps
drew += 1
print(f' looped: {drew} frames drawn, restarting')
except KeyboardInterrupt:
print('window closed')