feat: synthesize default graph attachments

Amp-Thread-ID: https://ampcode.com/threads/T-019f9d91-77c1-7206-a60f-ed6554ce92ab

Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
Amp
2026-07-28 23:08:26 +00:00
co-authored by heaust
parent f6d6af7a17
commit eb640f0183
10 changed files with 1363 additions and 196 deletions
+13 -1
View File
@@ -25,7 +25,7 @@ test("presets classify visibility and material through type.words[0] predicates"
assert.deepEqual(byId.pbr_double.inputs.predicate, { node: name === "culling" ? "pbr_double_final" : "double_class", socket: "value" }, name);
for (const pipeline of [byId.ground, byId.pbr, byId.pbr_double]) {
assert.deepEqual(pipeline.inputs.mesh, { node: "mesh", socket: "mesh" });
assert.equal(pipeline.executor.version, 2);
assert.equal(pipeline.executor.version, 3);
}
}
});
@@ -39,3 +39,15 @@ test("culling adds a local-AABB expression to each material predicate", () => {
for (const id of ["ground", "pbr", "pbr_double"])
assert.equal(byId[id].inputs.predicate.node.endsWith("_final"), true);
});
test("implicit presets start disconnected and then chain both attachments", () => {
for (const name of ["hdr", "culling", "grading"]) {
const byId = Object.fromEntries(presets[name].nodes.map((node) => [node.id, node]));
assert.equal("colorTarget" in byId.ground.inputs, false, name);
assert.equal("depthTarget" in byId.ground.inputs, false, name);
assert.deepEqual(byId.pbr.inputs.colorTarget, { node: "ground", socket: "color" }, name);
assert.deepEqual(byId.pbr.inputs.depthTarget, { node: "ground", socket: "depth" }, name);
}
const midnight = Object.fromEntries(presets.midnight.nodes.map((node) => [node.id, node]));
assert.deepEqual(midnight.ground.inputs.colorTarget, { node: "ldr", socket: "texture" });
});