Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Forward the batch through every material bind wrapper and stub the snippet capabilities in the runtime test

Nguyen Xuan Anbce938ca5916
diff --git a/src/material-layer-shaders.js b/src/material-layer-shaders.js
index 95f3540e..6b4909e1 100644
--- a/src/material-layer-shaders.js
+++ b/src/material-layer-shaders.js
@@ -321,8 +321,8 @@ const MAP_STATE_LAYER_MAPS = 18;
// Other optional features (reflection probes) also bind per batch, so this keeps whatever was registered first.
const previousBind = layerTextureSupport.bind;
-layerTextureSupport.bind = (renderer, mapState, layerState) => {
- previousBind?.(renderer, mapState, layerState);
+layerTextureSupport.bind = (renderer, mapState, layerState, batch) => {
+ previousBind?.(renderer, mapState, layerState, batch);
if (!renderer.shaderFeatures) return;
const context = renderer.context;
const layerMaps = mapState[MAP_STATE_LAYER_MAPS];
diff --git a/src/reflection-probes.js b/src/reflection-probes.js
index 47dac48f..e3266f78 100644
--- a/src/reflection-probes.js
+++ b/src/reflection-probes.js
@@ -167,7 +167,7 @@ function bindProbe(renderer, mapState) {
}
const previousBind = layerTextureSupport.bind;
-layerTextureSupport.bind = (renderer, mapState, layerState) => {
- previousBind?.(renderer, mapState, layerState);
+layerTextureSupport.bind = (renderer, mapState, layerState, batch) => {
+ previousBind?.(renderer, mapState, layerState, batch);
bindProbe(renderer, mapState);
};
diff --git a/src/subsurface-shader.js b/src/subsurface-shader.js
index b590c447..3d288b90 100644
--- a/src/subsurface-shader.js
+++ b/src/subsurface-shader.js
@@ -86,8 +86,8 @@ function uniformOf(renderer, name) {
// Other optional features also bind per batch, so this keeps whatever was registered first.
const previousBind = layerTextureSupport.bind;
-layerTextureSupport.bind = (renderer, mapState, layerState) => {
- previousBind?.(renderer, mapState, layerState);
+layerTextureSupport.bind = (renderer, mapState, layerState, batch) => {
+ previousBind?.(renderer, mapState, layerState, batch);
if (!renderer.shaderFeatures?.has('subsurface')) return;
const context = renderer.context;
const state = layerState[LAYER_STATE_SUBSURFACE];
diff --git a/src/water-reflection.js b/src/water-reflection.js
index d9f3644b..c90bf05c 100644
--- a/src/water-reflection.js
+++ b/src/water-reflection.js
@@ -317,8 +317,8 @@ function bindWater(renderer, mapState) {
}
const previousBind = layerTextureSupport.bind;
-layerTextureSupport.bind = (renderer, mapState, layerState) => {
- previousBind?.(renderer, mapState, layerState);
+layerTextureSupport.bind = (renderer, mapState, layerState, batch) => {
+ previousBind?.(renderer, mapState, layerState, batch);
bindWater(renderer, mapState);
};
diff --git a/src/world-material-shader.js b/src/world-material-shader.js
index 91c98012..64527367 100644
--- a/src/world-material-shader.js
+++ b/src/world-material-shader.js
@@ -147,8 +147,8 @@ function bindWaterBody(renderer) {
}
const previousBind = layerTextureSupport.bind;
-layerTextureSupport.bind = (renderer, mapState) => {
- previousBind?.(renderer, mapState);
+layerTextureSupport.bind = (renderer, mapState, layerState, batch) => {
+ previousBind?.(renderer, mapState, layerState, batch);
bindWaterBody(renderer);
};
diff --git a/tests/agent-runtime.test.js b/tests/agent-runtime.test.js
index af61daaf..ba3d7ef3 100644
--- a/tests/agent-runtime.test.js
+++ b/tests/agent-runtime.test.js
@@ -9,6 +9,7 @@ import { createContext, Script } from 'node:vm';
import { VEGETATION_CAPABILITY_NOTE } from '../src/agent-vegetation-notes.js';
import { CROWD_CAPABILITY_NOTE } from '../src/agent-crowd-notes.js';
import { USER_PASS_CAPABILITIES } from '../src/user-pass.js';
+import { MATERIAL_SNIPPET_CAPABILITIES } from '../src/material-snippet.js';
import { AGENT_SCENE_CAPABILITIES, AGENT_SCENE_DEFAULT_LIMITS, RENDER_PASS_NAMES, RENDER_PASS_DEPTH_RANGE, VIDEO_ENCODERS, MAXIMUM_VIDEO_SECONDS, MAXIMUM_JOB_SIDE, MAXIMUM_JOB_PIXELS, MAXIMUM_MEMORY_MIB, BAKE_WORKER_MAXIMUM_SECONDS } from '../src/agent-scene-capabilities.js';
import { recipeAssetNeeds } from '../src/agent-scene-assets.js';
import { sequenceFrameIds } from '../src/agent-texture-sequence.js';
@@ -107,7 +108,7 @@ async function reviewRuntimeHarness({ failShot, blockShot = false, oversize = fa
const context = createContext({ createServer, randomUUID, existsSync: () => true,
readFile: async () => '', packageMetadata: { version: 'test' },
createRequire: () => ({ resolve: () => { throw new Error('no peer in tests'); } }),
- VEGETATION_CAPABILITY_NOTE, CROWD_CAPABILITY_NOTE, USER_PASS_CAPABILITIES, AGENT_SCENE_CAPABILITIES, AGENT_SCENE_DEFAULT_LIMITS, RENDER_PASS_NAMES, RENDER_PASS_DEPTH_RANGE, VIDEO_ENCODERS, MAXIMUM_VIDEO_SECONDS, MAXIMUM_JOB_SIDE, MAXIMUM_JOB_PIXELS, MAXIMUM_MEMORY_MIB, BAKE_WORKER_MAXIMUM_SECONDS, PATH_TRACER_CAPABILITIES,
+ VEGETATION_CAPABILITY_NOTE, CROWD_CAPABILITY_NOTE, USER_PASS_CAPABILITIES, MATERIAL_SNIPPET_CAPABILITIES, AGENT_SCENE_CAPABILITIES, AGENT_SCENE_DEFAULT_LIMITS, RENDER_PASS_NAMES, RENDER_PASS_DEPTH_RANGE, VIDEO_ENCODERS, MAXIMUM_VIDEO_SECONDS, MAXIMUM_JOB_SIDE, MAXIMUM_JOB_PIXELS, MAXIMUM_MEMORY_MIB, BAKE_WORKER_MAXIMUM_SECONDS, PATH_TRACER_CAPABILITIES,
recipeAssetNeeds, sequenceFrameIds, TEXTURE_SEQUENCE_CAPABILITIES,
audioInputArguments, createAudioLibrary, measureStreamSeconds, filmTimelineDuration, filmTimelineShotStarts, sampleFilmTimeline, normalizeReview, REVIEW_LIMITS, isPreviewHost, BRANCH_LIMITS, validateBranchName,
chromium: { launch: async () => browser }, URL, Buffer, process, performance, clearTimeout,