Files
TeslaRel410/dpl3-revive/patha/test_view.py
T
CydandClaude Fable 5 afc3fd839e Vendor dpl3-revive: the Division/DPL3 renderer, now ours
Bring the graphics-dev collaborator's dpl3-revive into the repo as first-class
project code (they've handed it off; it's ours now). This is the proven
Division renderer that our in-process rt_draw has been trying to be.

What's here:
- parser/  B2Z/V2Z/SVT/SCN/SPL/BGF/BMF/BSL decoders (pure Python).
- spec/    reverse-engineered format + the definitive VelociRender wire
           protocol (from the original DIVISION source, matches our live
           VPX node/action tables exactly).
- source-ref/  read-only copies of the original DIVISION C (BIZREAD.C,
           DPLTYPES.H, DPL.H) that define the formats.
- patha/   the "virtual VelociRender board": vrboard.py (24-action protocol
           server), vrview.py (numpy software rasterizer, the reference),
           vrview_gl.py (moderngl GPU backend, 832x512@60Hz), plus the
           run/replay/regress tooling and evidence renders. Drives FLYK/BLADE/
           Star Trek demos AND our btl4opt/rpl4opt game binaries.
- viewer/  WebGL archive generators (.py); prebuilt HTML/data regeneratable.
- samples/ small test models/textures.
- bt*.raw.bin  real BTL4OPT arena wire captures (kept for offline renderer
           testing/regression against OUR game).

.gitignore keeps the multi-hundred-MB demo capture dumps + debug logs +
regeneratable viewer bundles out of history (they stay on disk).

Phase 0 of the integration is validated: their board decodes our bt8 capture
with zero errors (3748 nodes, 507 instances, 4 mechs) and renders our arena
(terrain/dome/sky, correct Division DAC gamma). Plan + status in memory;
integration continues in emulator/RENDERER-COLLAB.md.

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

48 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""
test_view.py -- offline smoke test: replay a captured FLYK run through the
virtual board, then render one frame with vrview and save it as a PNG.
python test_view.py [cap5.raw.bin] [frames_into_run] [out.png]
`frames_into_run` picks how many 0x1d/draw messages to replay before rendering
(the shark swims, so later = different pose).
"""
import os, sys, struct
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
os.environ.setdefault('SDL_VIDEODRIVER', 'dummy') # offscreen pygame
from vrboard import VirtualBoard, Assembler
from decode_anim import find_framed_start
def main():
path = sys.argv[1] if len(sys.argv) > 1 else 'cap5.raw.bin'
upto = int(sys.argv[2]) if len(sys.argv) > 2 else 600
out = sys.argv[3] if len(sys.argv) > 3 else 'flyk_live_render.png'
data = open(path, 'rb').read()
board = VirtualBoard()
asm = Assembler(); asm.feed(data[find_framed_start(data):])
for m in asm:
try:
board.handle(m)
except Exception as e:
print('board error:', e)
if board.frames >= upto:
break
print(f'replayed to frame {board.frames}: nodes={len(board.nodes)} '
f'uploads={len(board.uploads)} conns={len(board.conns)} anim={len(board.anim)}')
from vrview import Renderer
r = Renderer()
r.draw(board)
r.cache.maybe_rebuild(board)
print(f'instances renderable: {len(r.cache.instances)}')
print('cam chain:', [hex(h) for h in r.cache.cam_chain])
r.pygame.image.save(r.screen, out)
print('wrote', out)
if __name__ == '__main__':
main()