3D engine that AI agents drive
Keep the anisotropy lookup as it was; accept the worldBounds size (part of #406)
Nguyen Xuan An11e0cb3beb73
diff --git a/changes/406-raster.md b/changes/406-raster.mdindex 7f8a4085..1bf40693 100644--- a/changes/406-raster.md+++ b/changes/406-raster.md@@ -1 +1 @@-- `worldBounds` (used by `applyWaterReflection`, `findWaterSurface` and the probe code) keeps its minimum and maximum in scalars instead of arrays indexed by axis, and the renderer reads the anisotropy limit once instead of once per texture (issue #406). On the AIS port film, `applyWaterReflection` falls from about 160 ms to 80 ms and a 24-megapixel texture upload from about 340 ms to 300 ms in total; the bounds are bit-equal and the frame is pixel-identical.+- `worldBounds` (used by `applyWaterReflection`, `findWaterSurface` and the probe code) keeps its minimum and maximum in scalars instead of arrays indexed by axis (issue #406). On the AIS port film, `applyWaterReflection` falls from about 160 ms to 80 ms; the bounds are bit-equal and the frame is pixel-identical.diff --git a/changes/406-raster.size.md b/changes/406-raster.size.mdnew file mode 100644index 00000000..3f1b50d5--- /dev/null+++ b/changes/406-raster.size.md@@ -0,0 +1 @@+- scene:agent-scene+lazy: 83 bytes gzip for scalar bounds in `worldBounds`, which halves `applyWaterReflection` on a scene with millions of vertices (160 ms to 80 ms on the AIS port)diff --git a/src/renderer.js b/src/renderer.jsindex 2dcc6218..84f04b88 100644--- a/src/renderer.js+++ b/src/renderer.js@@ -739,14 +739,10 @@ export class Renderer67 {// blurred level long before its detail is gone. Applies to the texture bound to `target`.applyAnisotropy(target) {const context = this.context;- // Asked once: reading the limit makes the browser wait for the GPU process, which would stall behind every texture upload before it.- if (!this.anisotropyExtension) {- const extension = context.getExtension('EXT_texture_filter_anisotropic');- if (!extension) return;- this.anisotropyExtension = extension;- this.anisotropyLevel = Math.min(MAX_TEXTURE_ANISOTROPY, context.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT));- }- context.texParameterf(target, this.anisotropyExtension.TEXTURE_MAX_ANISOTROPY_EXT, this.anisotropyLevel);+ const extension = context.getExtension('EXT_texture_filter_anisotropic');+ if (!extension) return;+ const supported = context.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT);+ context.texParameterf(target, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(MAX_TEXTURE_ANISOTROPY, supported));}createTexture(map) {