3D engine that AI agents drive
Merge origin/main into feat/material-snippet
Nguyen Xuan Ane23391441f09
diff --cc scripts/agent-preview-browser.jsindex 3db15695,3b7a029b..423a36ff--- a/scripts/agent-preview-browser.js+++ b/scripts/agent-preview-browser.js@@@ -149,22 -150,11 +150,18 @@@ function syncSequenceTextures(record)}function sceneIsTextured(scene) {- return hasPatternTextures(scene.parts) || (scene.sequenceTextures?.().length ?? 0) > 0;+ // A material snippet adds code to the colour and shadow programs, which only a new renderer compiles.+ return hasPatternTextures(scene.parts) || (scene.sequenceTextures?.().length ?? 0) > 0 || scene.parts.some(part => part.material.snippet);}- function hasPatternTextures(parts) {- return parts.some(part => part.material.boxMapScale || part.material.emissiveMap);- }-// replaceParts streams only untextured parts, so a topology change around pattern textures takes a new renderer.+// A material snippet is compiled alone first, so a compile error names the snippet's own lines and the running renderer stays.+function probeSnippets(scene) {+ if (agentSceneModuleLoaded('materialSnippet')) agentSceneModule('materialSnippet').probeMaterialSnippets(scene.parts);+}+function rebuildRenderer(record) {+ probeSnippets(record.scene);record.renderer.dispose();record.renderer = null;resetCanvas();