Implement playable Mac client and rendering validation
This commit is contained in:
@@ -63,6 +63,10 @@ func _arg(name: String, dflt := "") -> String:
|
||||
func run() -> void:
|
||||
root.size = Vector2i(SIZE, SIZE)
|
||||
_bless = "--bless" in OS.get_cmdline_user_args()
|
||||
if _bless and ("--legacy-winding" in OS.get_cmdline_user_args() or not _arg("race").is_empty()):
|
||||
printerr("Baseline updates require all eight production races; remove diagnostic/race filters.")
|
||||
quit(1)
|
||||
return
|
||||
_out = OS.get_environment("MT_RENDER_OUTPUT")
|
||||
if _out.is_empty():
|
||||
_out = ProjectSettings.globalize_path("res://../build/rendering/modeltest-%d"
|
||||
@@ -116,7 +120,7 @@ func run() -> void:
|
||||
var f := FileAccess.open(_out.path_join("report.json"), FileAccess.WRITE)
|
||||
f.store_string(JSON.stringify(report, "\t"))
|
||||
f.close()
|
||||
if _bless:
|
||||
if _bless and _fail.is_empty():
|
||||
_write_baseline(results)
|
||||
print("MODELRENDER: baseline written -> ", ProjectSettings.globalize_path(BASELINE))
|
||||
print("MODELRENDER: ", _out)
|
||||
@@ -135,9 +139,13 @@ func _measure(race: int, cam: Camera3D) -> Dictionary:
|
||||
pv.queue_free()
|
||||
return {}
|
||||
pv.set_anim_state("wait")
|
||||
# Reproduce the pre-merge CPU index order to audit historical baselines.
|
||||
if "--legacy-winding" in OS.get_cmdline_user_args():
|
||||
pv.model.set("flip_winding", false)
|
||||
await process_frame
|
||||
await process_frame
|
||||
if pv.anim:
|
||||
pv.anim.set("blend_time", 0.0)
|
||||
pv.anim.call("set_time", 0.5)
|
||||
pv.anim.set_process(false)
|
||||
pv.rotation = Vector3.ZERO
|
||||
@@ -163,6 +171,8 @@ func _measure(race: int, cam: Camera3D) -> Dictionary:
|
||||
feet_y = minf(feet_y, (mi.global_transform * mi.get_aabb()).position.y)
|
||||
|
||||
var m := {
|
||||
"body_sha256": FileAccess.get_sha256(String(pv.model.get("gr2_path"))),
|
||||
"hair_sha256": FileAccess.get_sha256(String(pv.model.get("hair_gr2"))),
|
||||
"body_gr2": String(pv.model.get("gr2_path")),
|
||||
"hair_gr2": String(pv.model.get("hair_gr2")),
|
||||
"surfaces": total, "hair_surface_first": hair_first,
|
||||
@@ -237,6 +247,9 @@ func _check_baseline(race: int, m: Dictionary, baseline: Dictionary) -> void:
|
||||
_fail.append("race %d: no baseline entry (run with --bless after reviewing the render)" % race)
|
||||
return
|
||||
var b: Dictionary = baseline[key]
|
||||
for field in ["body_sha256", "hair_sha256"]:
|
||||
if b.has(field) and b[field] != m[field]:
|
||||
_fail.append("race %d: %s differs from reviewed asset baseline" % [race, field])
|
||||
var cover_delta: float = absf(float(m["head_cover"]) - float(b.get("head_cover", 0.0)))
|
||||
if cover_delta > TOL_HEAD_COVER:
|
||||
_fail.append("race %d: head_cover %.4f vs baseline %.4f (delta %.4f > %.3f)"
|
||||
@@ -408,7 +421,8 @@ func _write_baseline(results: Dictionary) -> void:
|
||||
var slim := {}
|
||||
for k in results:
|
||||
var m: Dictionary = results[k]
|
||||
slim[k] = {"body_gr2": String(m["body_gr2"]).get_file(),
|
||||
slim[k] = {"body_sha256": m["body_sha256"], "hair_sha256": m["hair_sha256"],
|
||||
"body_gr2": String(m["body_gr2"]).get_file(),
|
||||
"hair_gr2": String(m["hair_gr2"]).get_file(),
|
||||
"head_cover": m["head_cover"], "silhouette_px": m["silhouette_px"],
|
||||
"head_px": m["head_px"], "hair_mean_lum": m["hair_mean_lum"],
|
||||
|
||||
Reference in New Issue
Block a user