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>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python3
|
||||
"""debug_view.py -- numeric check of vrview transforms against a capture replay."""
|
||||
import os, sys, struct
|
||||
import numpy as np
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
os.environ.setdefault('SDL_VIDEODRIVER', 'dummy')
|
||||
from vrboard import VirtualBoard, Assembler
|
||||
from decode_anim import find_framed_start
|
||||
from vrview import Renderer, _mat_from_dcs
|
||||
|
||||
path = sys.argv[1] if len(sys.argv) > 1 else 'cap5.raw.bin'
|
||||
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: pass
|
||||
if board.frames >= 600: break
|
||||
|
||||
r = Renderer(); r.cache.maybe_rebuild(board)
|
||||
c = r.cache
|
||||
print('cam chain', [hex(h) for h in c.cam_chain])
|
||||
for h in (0x1, 0x2, 0x3):
|
||||
b = board.nodes.get(h, {}).get('body') or b''
|
||||
if len(b) >= 76:
|
||||
M = _mat_from_dcs(b)
|
||||
print(f'dcs {h:#x} diag={np.diag(M)[:3]} row3={M[3,:3]} anim={h in board.anim}')
|
||||
V = np.linalg.inv(r.chain_matrix(board, c.cam_chain))
|
||||
print('V row3 (eye offset):', V[3, :3])
|
||||
|
||||
for inst in c.instances:
|
||||
M = r.chain_matrix(board, inst['chain'])
|
||||
for gh in inst['geoms']:
|
||||
mesh = c.meshes[gh]
|
||||
pw = mesh['pos'] @ M[:3, :3] + M[3, :3]
|
||||
pe = pw @ V[:3, :3] + V[3, :3]
|
||||
z = -pe[:, 2]
|
||||
vis = z > 8
|
||||
if vis.any():
|
||||
xp = pe[vis, 0] * 1.3 / z[vis]; yp = pe[vis, 1] * 1.3 / z[vis]
|
||||
scr = f"proj x[{xp.min():7.2f},{xp.max():7.2f}] y[{yp.min():7.2f},{yp.max():7.2f}]"
|
||||
else:
|
||||
scr = "behind camera"
|
||||
print(f"dcs={inst['chain'][0]:#04x} geom={gh:#04x} v={len(pw):4d} "
|
||||
f"world y[{pw[:,1].min():8.1f},{pw[:,1].max():8.1f}] "
|
||||
f"size={np.ptp(pw,0).round(0)} {scr}")
|
||||
Reference in New Issue
Block a user