Skip to content

Commit c01ab58

Browse files
authored
Fix index and attribute updates in BatchedMesh.prototype.optimize for proper rendering (#32185)
1 parent a0de70a commit c01ab58

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/objects/BatchedMesh.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,7 @@ class BatchedMesh extends Mesh {
925925

926926
index.array.copyWithin( nextIndexStart, indexStart, indexStart + reservedIndexCount );
927927
index.addUpdateRange( nextIndexStart, reservedIndexCount );
928+
index.needsUpdate = true;
928929

929930
geometryInfo.indexStart = nextIndexStart;
930931

@@ -945,6 +946,7 @@ class BatchedMesh extends Mesh {
945946
const { array, itemSize } = attribute;
946947
array.copyWithin( nextVertexStart * itemSize, vertexStart * itemSize, ( vertexStart + reservedVertexCount ) * itemSize );
947948
attribute.addUpdateRange( nextVertexStart * itemSize, reservedVertexCount * itemSize );
949+
attribute.needsUpdate = true;
948950

949951
}
950952

@@ -961,6 +963,8 @@ class BatchedMesh extends Mesh {
961963

962964
}
963965

966+
this._visibilityChanged = true;
967+
964968
return this;
965969

966970
}

0 commit comments

Comments
 (0)