Files
metin2-SDK/speedtree/tools/compare_generation_baselines.py
T
shenandshen 66992b3024 Implement cross-platform SpeedTree runtime and recovery tests
Add bounded SPT parsing, authored branch frames and foliage generation, independent LOD meshes, billboards, collision metadata, and legacy CPU/shader wind support. Restore seeded sampling and special leaf selection with generation diagnostics and reproducible baseline tools.

Include regression coverage and static recovery documentation describing remaining differences from the original runtime. SDK tests pass (4/4); full corpus and client validation are recorded in the recovery notes.
2026-10-12 18:52:02 -07:00

42 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""Compare generation_baseline JSONL snapshots by relative asset path."""
import argparse
import json
from pathlib import Path
def read(path):
rows = [json.loads(line) for line in Path(path).read_text().splitlines()]
result = {row["path"]: row for row in rows}
if len(rows) != len(result):
raise ValueError(f"duplicate paths in {path}")
return result
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("before")
parser.add_argument("after")
args = parser.parse_args()
before, after = read(args.before), read(args.after)
if before.keys() != after.keys():
raise ValueError("sample inventories differ; compare the same corpus root")
report = {
"samples": len(before),
"truncated_before": sum(row["truncated"] for row in before.values()),
"truncated_after": sum(row["truncated"] for row in after.values()),
"remaining_truncated": [path for path, row in after.items() if row["truncated"]],
"new_truncation": [path for path, row in after.items()
if row["truncated"] and not before[path]["truncated"]],
"geometry_changed": [path for path, row in after.items()
if any(row[key] != before[path][key]
for key in ("branch_lods", "leaf_lods", "frond_lods"))],
"bounds_changed": [path for path, row in after.items()
if row["bounds"] != before[path]["bounds"]],
}
print(json.dumps(report, indent=2, ensure_ascii=False))
if __name__ == "__main__":
main()