Skip to content

Commit 7b0370c

Browse files
committed
Added index offset to allow mesh batching
1 parent 49bcb58 commit 7b0370c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

v3/src/renderer/webgl/renderers/spritebatch/SpriteBatch.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ SpriteBatch.prototype = {
232232
var indexBuffer = this.indexDataBuffer.uintView;
233233
var indices = gameObject.indices;
234234
var indexLength = indices.length;
235+
var indexOffset = this.vertexCount;
235236

236237
tempMatrix.applyITRS(translateX, translateY, rotation, scaleX, scaleY);
237238

@@ -279,7 +280,7 @@ SpriteBatch.prototype = {
279280
var elementCount = this.elementCount;
280281
for (var index = 0; index < indexLength; ++index)
281282
{
282-
indexBuffer[elementCount + index] = indices[index];
283+
indexBuffer[elementCount + index] = indexOffset + indices[index];
283284
}
284285

285286
this.elementCount += indexLength;

0 commit comments

Comments
 (0)