Shaft mode reuses PlanResolvedCavernNetworkV1 with a capped full-height cylinder primitive (shapeKind=1), ledges, access bores and cross links; 11 VerticalShaftParams fields mapped. Basal law: arrival 2-3 to a walkable terminal landing; drops/climbs stay reporting tiers. Seed 2 fails shell/seams at the 2-3 arrival mouth (3 variants tried, stopped per AGENTS.md). Whole view faster than assembler/world in 8/8 cells; near-ready slower in 7/8. Source/: VoxelForgeCoreAdapter.cpp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
111 lines
5.9 KiB
Python
111 lines
5.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Render a coarse whole-strate cutaway from the L139 density mesh."""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
import time
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[4]
|
|
DATA = ROOT / "Standalone/data/owner_world.json"
|
|
BIN = ROOT / "Saved/Linux/l139/bin/VoxelForgeCoreHeadless-l139-clang"
|
|
RENDERER = ROOT / "Saved/Linux/l139/bin/VoxelForgeOffscreenCapture-l139-clang"
|
|
OUT = ROOT / "Saved/Linux/l139/captures"
|
|
ARTIFACTS = ROOT / "Standalone/Research/WorldAssemblerM3/Linux139/captures"
|
|
STAMP = "b8603b6cb3975ca0f9669759e4e2464561c557fdb7aa6836acef123ecf0b99d1"
|
|
STAMP_RE = re.compile(r"^\[VoxelForgeSourceStamp\] sha256=([0-9a-f]{64})$", re.M)
|
|
LIMIT = ["taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--"]
|
|
SLICE_Y = -5.0
|
|
CAMERA = (-450.0, SLICE_Y - 100.0, -950.0)
|
|
YAW, PITCH, FOV = 0.0, 0.0, 70.0
|
|
|
|
|
|
def stamped_run(label: str, command: list[str], log: Path, env: dict[str, str]) -> str:
|
|
probe = subprocess.run([*LIMIT, "timeout", "15s", str(command[0]), "--print-source-stamp"],
|
|
cwd=ROOT, env=env, text=True, stdout=subprocess.PIPE,
|
|
stderr=subprocess.STDOUT, check=False, timeout=20)
|
|
match = STAMP_RE.search(probe.stdout or "")
|
|
if probe.returncode != 0 or not match or match.group(1) != STAMP:
|
|
raise RuntimeError(f"{label}: source stamp mismatch")
|
|
log.parent.mkdir(parents=True, exist_ok=True)
|
|
started = time.monotonic()
|
|
with log.open("w", encoding="utf-8") as stream:
|
|
result = subprocess.run([*LIMIT, "timeout", "1740s", *map(str, command)],
|
|
cwd=ROOT, env=env, stdout=stream, stderr=subprocess.STDOUT,
|
|
timeout=1745, check=False)
|
|
content = log.read_text(encoding="utf-8", errors="replace")
|
|
emitted = STAMP_RE.search(content)
|
|
if result.returncode != 0 or not emitted or emitted.group(1) != STAMP:
|
|
raise RuntimeError(f"{label}: process failed or source changed; see {log}")
|
|
print(f"[L139WholeLayerCapture] step={label} elapsed_s={time.monotonic()-started:.1f} "
|
|
f"log={log.relative_to(ROOT)}", flush=True)
|
|
return content
|
|
|
|
|
|
def main() -> int:
|
|
if not DATA.is_file() or not BIN.is_file() or not RENDERER.is_file():
|
|
raise SystemExit("missing owner fixture or final L139 capture binaries")
|
|
OUT.mkdir(parents=True, exist_ok=True)
|
|
ARTIFACTS.mkdir(parents=True, exist_ok=True)
|
|
env = os.environ.copy()
|
|
env["LP_NUM_THREADS"] = "12"
|
|
env["XDG_CACHE_HOME"] = str(OUT / "xdg-cache")
|
|
stem = "whole-layer-density-cutaway"
|
|
mesh = OUT / f"{stem}.vfmesh"
|
|
layout = OUT / f"{stem}-layout.json"
|
|
camera_text = ",".join(f"{value:.6f}" for value in (*CAMERA, YAW, PITCH))
|
|
export = [BIN, DATA, "--world-assembler-prototype", "--stream-benchmark",
|
|
"--stream-pipeline", "--workers=12", "--clip-radius=3", "--max-clip-level=8",
|
|
"--max-level=8", "--force-generate", "--seed=0", "--recipe=surface-world",
|
|
"--render-distance-chunks=0", "--capture-skip-walkability", "--density-dispatch-report",
|
|
f"--camera={camera_text}", f"--resolved-layout-output={layout}", f"--mesh-export={mesh}"]
|
|
content = stamped_run("export", export, OUT / f"{stem}-export.log", env)
|
|
dispatch = re.search(
|
|
r"^\[DensityDispatch\] strate=3 generator=VerticalShafts "
|
|
r"recipe=Core\.Caves\.PrimitiveField version=1 "
|
|
r"bound_path=Caves-native adapter=FCavesFieldAdapter$", content, re.M)
|
|
if not dispatch or not mesh.is_file() or mesh.stat().st_size == 0:
|
|
raise RuntimeError("coarse density export is empty or lacks native shaft dispatch")
|
|
png = OUT / f"{stem}.png"
|
|
jpg = ARTIFACTS / "after-whole-layer-density-cutaway.jpg"
|
|
render = [RENDERER, mesh, png, "--size=2200x320", f"--fov-deg={FOV:.1f}",
|
|
"--camera-m=" + ",".join(f"{value:.6f}" for value in CAMERA),
|
|
f"--yaw-deg={YAW:.6f}", f"--pitch-deg={PITCH:.6f}",
|
|
f"--clip-plane=0,-1,0,{SLICE_Y:.6f}", "--tile-skirts=off", "--shade=readable",
|
|
"--headlamp=on", "--height-tint=off", "--height-center-m=-950",
|
|
"--height-range-m=80", "--tile-edges=off"]
|
|
stamped_run("render", render, OUT / f"{stem}-render.log", env)
|
|
subprocess.run([*LIMIT, "timeout", "120s", "ffmpeg", "-nostdin", "-hide_banner",
|
|
"-loglevel", "error", "-y", "-i", png, "-frames:v", "1", "-q:v", "3", jpg],
|
|
cwd=ROOT, env=env, check=True, stdout=subprocess.DEVNULL,
|
|
stderr=subprocess.STDOUT, timeout=125)
|
|
quality = subprocess.run([*LIMIT, "timeout", "120s", sys.executable,
|
|
ROOT / "Standalone/Tools/verify/capture_quality.py", jpg], cwd=ROOT, env=env,
|
|
text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
|
check=False, timeout=125)
|
|
quality_line = quality.stdout.strip().splitlines()[-1] if quality.stdout.strip() else ""
|
|
ok = quality.returncode == 0 and "status=PASS" in quality_line
|
|
manifest_path = ARTIFACTS / "manifest.json"
|
|
manifest = json.loads(manifest_path.read_text(encoding="utf-8")) if manifest_path.is_file() else []
|
|
manifest = [row for row in manifest if row.get("view") != "whole-layer-density-cutaway"]
|
|
manifest.append({"phase": "after", "view": "whole-layer-density-cutaway",
|
|
"file": str(jpg.relative_to(ROOT)), "bytes": jpg.stat().st_size,
|
|
"camera_m": CAMERA, "target_m": (-450.0, SLICE_Y, -950.0),
|
|
"yaw_deg": YAW, "pitch_deg": PITCH, "fov_deg": FOV,
|
|
"clip_plane": [0.0, -1.0, 0.0, SLICE_Y],
|
|
"note": "outside side cutaway through the coarse LOD density mesh across the whole Vertical Shafts strate at y=-5 m",
|
|
"quality_status": "PASS" if ok else "FAIL", "quality": quality_line})
|
|
manifest_path.write_text(json.dumps(manifest, indent=2) + "\n", encoding="utf-8")
|
|
print(f"[L139WholeLayerCaptureSummary] file={jpg.relative_to(ROOT)} "
|
|
f"quality={'PASS' if ok else 'FAIL'} {quality_line}", flush=True)
|
|
return 0 if ok else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|