- 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>
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
"""Renderer backend selection for the render-bridge scripts.
|
|
|
|
Default = the dpl3-revive GPU backend (vrview_gl.GLRenderer, moderngl);
|
|
VRVIEW_SOFT=1 forces the software rasterizer (vrview.Renderer), which stays
|
|
the debugging reference. Both share SceneCache/cam_matrix/draw/last_frame,
|
|
so scripts only swap the class.
|
|
|
|
Run under the Windows CPython with the wheels installed (py -3.13):
|
|
numpy pygame-ce moderngl pillow
|
|
(the MSYS2 python has no pip; 3.14 has no moderngl/glcontext wheel yet).
|
|
"""
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
|
'..', '..', 'dpl3-revive', 'patha'))
|
|
|
|
|
|
def pick_renderer():
|
|
"""Return (RendererClass, backend_name)."""
|
|
if os.environ.get('VRVIEW_SOFT') == '1':
|
|
from vrview import Renderer
|
|
return Renderer, 'software'
|
|
try:
|
|
from vrview_gl import GLRenderer
|
|
return GLRenderer, 'GL'
|
|
except Exception as e:
|
|
print(f"GL backend unavailable ({e}); using software rasterizer",
|
|
file=sys.stderr)
|
|
from vrview import Renderer
|
|
return Renderer, 'software'
|
|
|
|
|
|
def save_frame(r, out):
|
|
"""Save the last rendered frame. Works headless on both backends
|
|
(GL has no screen surface -- read the FBO via last_frame)."""
|
|
arr = r.last_frame
|
|
if arr is None:
|
|
raise RuntimeError('no frame rendered yet')
|
|
from PIL import Image
|
|
Image.fromarray(arr).save(out)
|