From 7b0370c57b6534bc9ed3f7a711b78504160893f4 Mon Sep 17 00:00:00 2001 From: Felipe Alfonso Date: Thu, 18 May 2017 16:44:00 -0400 Subject: [PATCH] Added index offset to allow mesh batching --- v3/src/renderer/webgl/renderers/spritebatch/SpriteBatch.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/v3/src/renderer/webgl/renderers/spritebatch/SpriteBatch.js b/v3/src/renderer/webgl/renderers/spritebatch/SpriteBatch.js index a4f8690c0..3893f1bc8 100644 --- a/v3/src/renderer/webgl/renderers/spritebatch/SpriteBatch.js +++ b/v3/src/renderer/webgl/renderers/spritebatch/SpriteBatch.js @@ -232,6 +232,7 @@ SpriteBatch.prototype = { var indexBuffer = this.indexDataBuffer.uintView; var indices = gameObject.indices; var indexLength = indices.length; + var indexOffset = this.vertexCount; tempMatrix.applyITRS(translateX, translateY, rotation, scaleX, scaleY); @@ -279,7 +280,7 @@ SpriteBatch.prototype = { var elementCount = this.elementCount; for (var index = 0; index < indexLength; ++index) { - indexBuffer[elementCount + index] = indices[index]; + indexBuffer[elementCount + index] = indexOffset + indices[index]; } this.elementCount += indexLength;