Skip to content

Commit

Permalink
BatchedMesh: Clean up unused internals (#27176)
Browse files Browse the repository at this point in the history
* Move optimize function to a TODO

* Remove unused zero scale matrix
  • Loading branch information
gkjohnson authored Nov 12, 2023
1 parent 2308451 commit d5678cd
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions examples/jsm/objects/BatchedMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -38,6 +32,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 ) {
Expand Down Expand Up @@ -555,17 +550,13 @@ 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;

}

active[ geometryId ] = false;
_zeroScaleMatrix.toArray( matricesArray, geometryId * 16 );
matricesTexture.needsUpdate = true;

return this;

Expand Down Expand Up @@ -664,12 +655,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
Expand Down

0 comments on commit d5678cd

Please sign in to comment.