Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
textureCount++;
}
}
this.packInterleavedGeometry(sprite, attrBuffer,
indexBuffer, attrIndex, iIndex);
// push a graphics..
attrIndex += (sprite[primaryProperty].length / primaryAttributeSize) * vertexSize;
iIndex += sprite.indices.length;
}
BaseTexture._globalBatch = TICK;
currentGroup.size = iIndex - currentGroup.start;
if (!settings.CAN_UPLOAD_SAME_BUFFER)// we must use new buffers
{
if (this._packedGeometryPoolSize <= this._flushId)
{
this._packedGeometryPoolSize++;// expand geometry pool
this._packedGeometries[this._flushId]
= new (this.geometryClass)(false, this.attributeDefinitions);
}
packedGeometries[this._flushId]._buffer.update(
attrBuffer.rawBinaryData, 0);
packedGeometries[this._flushId]._indexBuffer.update(
indexBuffer, 0);
this.renderer.geometry.bind(packedGeometries[this._flushId]);
this.renderer.geometry.updateBuffers();
this._flushId++;
updateGeometry()
{
const {
_packedGeometries: packedGeometries,
_attributeBuffer: attributeBuffer,
_indexBuffer: indexBuffer,
} = this;
if (!settings.CAN_UPLOAD_SAME_BUFFER)
{ /* Usually on iOS devices, where the browser doesn't
like uploads to the same buffer in a single frame. */
if (this._packedGeometryPoolSize <= this._flushId)
{
this._packedGeometryPoolSize++;
packedGeometries[this._flushId] = new (this.geometryClass)();
}
packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);
packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);
this.renderer.geometry.bind(packedGeometries[this._flushId]);
this.renderer.geometry.updateBuffers();
this._flushId++;
}
else
/* eslint-disable max-len */
const alpha = Math.min(sprite.worldAlpha, 1.0);
const argb = alpha < 1.0 && nextTexture.premultiplyAlpha ? premultiplyTint(sprite._tintRGB, alpha)
: sprite._tintRGB + (alpha * 255 << 24);
uint32View[index + 3] = uint32View[index + 8] = uint32View[index + 13] = uint32View[index + 18] = argb;
float32View[index + 4] = float32View[index + 9] = float32View[index + 14] = float32View[index + 19] = textureId;
/* eslint-enable max-len */
index += 20;
}
currentGroup.size = i - currentGroup.start;
if (!settings.CAN_UPLOAD_SAME_BUFFER)
{
// this is still needed for IOS performance..
// it really does not like uploading to the same buffer in a single frame!
if (this.vaoMax <= this.vertexCount)
{
this.vaoMax++;
const buffer = new Buffer(null, false);
/* eslint-disable max-len */
this.vaos[this.vertexCount] = new Geometry()
.addAttribute('aVertexPosition', buffer, 2, false, gl.FLOAT)
.addAttribute('aTextureCoord', buffer, 2, true, gl.UNSIGNED_SHORT)
.addAttribute('aColor', buffer, 4, true, gl.UNSIGNED_BYTE)
.addAttribute('aTextureId', buffer, 1, true, gl.FLOAT)
.addIndex(this.indexBuffer);