Added index offset to allow mesh batching

This commit is contained in:
Felipe Alfonso 2017-05-18 16:44:00 -04:00
parent 49bcb5829b
commit 7b0370c57b

View file

@ -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;