Add FxNode render graph playground

Add persistent render graph loadouts, grouped node authoring, code-appending apply behavior, explicit playground lighting, and resilient worker startup.

Amp-Thread-ID: https://ampcode.com/threads/T-01a033d4-0e44-708e-af0e-6166283416ff
Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
Amp
2026-08-24 17:45:48 +00:00
co-authored by heaust
parent 951449db0b
commit 6153223fd5
27 changed files with 4672 additions and 207 deletions
+31 -10
View File
@@ -1,6 +1,7 @@
import {
AmbientLight,
ArcRotateCamera,
PointLight,
Scene,
importGltf,
} from "@yawn/handles";
@@ -223,24 +224,47 @@ async function openFile(file) {
scene = new Scene(canvas, {
arenaBytes: 384 * 1024 * 1024,
hdr: true,
clearColor: [0.025, 0.035, 0.045, 1],
});
await scene.ready;
scene.array("sceneAccent").row(0).set([1, 1, 1, 1]);
const meshes = await importGltf(scene, url);
if (!meshes.length)
throw new Error("The file does not contain any triangle meshes.");
const bounds = findBounds(scene, meshes);
const light = new AmbientLight(scene, {
color: [1, 0.94, 0.86],
intensity: 0.28,
});
const radius = Math.max(bounds.radius, 0.001);
const lights = [
new AmbientLight(scene, {
color: [0.82, 0.9, 1],
intensity: 0.22,
}),
new PointLight(scene, {
position: [
bounds.center[0] + radius * 2.4,
bounds.center[1] + radius * 3.1,
bounds.center[2] + radius * 2.2,
],
color: [1, 0.78, 0.56],
intensity: 300,
range: radius * 8,
}),
new PointLight(scene, {
position: [
bounds.center[0] - radius * 2.1,
bounds.center[1] + radius * 0.8,
bounds.center[2] - radius * 1.8,
],
color: [0.45, 0.72, 1],
intensity: 120,
range: radius * 7,
}),
];
const camera = new ArcRotateCamera(
scene,
cameraOptions(scene, meshes, canvas, bounds),
);
await Promise.all([light.ready, camera.ready]);
await Promise.all([...lights.map((light) => light.ready), camera.ready]);
elements.renderValue.textContent = "— ms";
elements.renderTime.hidden = false;
@@ -251,10 +275,7 @@ async function openFile(file) {
if (!profiling)
elements.renderTime.title =
"GPU timestamp queries are not supported by this adapter.";
else {
elements.renderTime.removeAttribute("title");
scene.array("sceneAccent").row(0)[3] = 1;
}
else elements.renderTime.removeAttribute("title");
activeViewer = {
camera,