From aeb15fe95165d80437f248ea99961706da09fe71 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 12 Nov 2023 14:26:05 +0900 Subject: [PATCH 1/2] Move optimize function to a TODO --- examples/jsm/objects/BatchedMesh.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/examples/jsm/objects/BatchedMesh.js b/examples/jsm/objects/BatchedMesh.js index b9362b197e03e7..58aceb622782c7 100644 --- a/examples/jsm/objects/BatchedMesh.js +++ b/examples/jsm/objects/BatchedMesh.js @@ -38,6 +38,7 @@ const _batchIntersects = []; // @TODO: geometry.drawRange support? // @TODO: geometry.morphAttributes support? // @TODO: Support uniform parameter per geometry +// @TODO: Add an "optimize" function to pack geometry and remove data gaps // copies data from attribute "src" into "target" starting at "targetOffset" function copyAttributeData( src, target, targetOffset = 0 ) { @@ -664,12 +665,6 @@ class BatchedMesh extends Mesh { } - optimize() { - - throw new Error( 'BatchedMesh: Optimize function not implemented.' ); - - } - setMatrixAt( geometryId, matrix ) { // @TODO: Map geometryId to index of the arrays because From 093626b2b367f2e8a506e01724312cf5e716a389 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Sun, 12 Nov 2023 14:27:58 +0900 Subject: [PATCH 2/2] Remove unused zero scale matrix --- examples/jsm/objects/BatchedMesh.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/examples/jsm/objects/BatchedMesh.js b/examples/jsm/objects/BatchedMesh.js index 58aceb622782c7..786e7e5d341c2f 100644 --- a/examples/jsm/objects/BatchedMesh.js +++ b/examples/jsm/objects/BatchedMesh.js @@ -18,12 +18,6 @@ import { const ID_ATTR_NAME = 'batchId'; const _matrix = new Matrix4(); const _identityMatrix = new Matrix4(); -const _zeroScaleMatrix = new Matrix4().set( - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 1, -); const _projScreenMatrix = new Matrix4(); const _frustum = new Frustum(); const _box = new Box3(); @@ -556,8 +550,6 @@ class BatchedMesh extends Mesh { // Note: User needs to call optimize() afterward to pack the data. const active = this._active; - const matricesArray = this._matricesTexture.image.data; - const matricesTexture = this._matricesTexture; if ( geometryId >= active.length || active[ geometryId ] === false ) { return this; @@ -565,8 +557,6 @@ class BatchedMesh extends Mesh { } active[ geometryId ] = false; - _zeroScaleMatrix.toArray( matricesArray, geometryId * 16 ); - matricesTexture.needsUpdate = true; return this;