UNPKG

@pixi/utils

Version:

Collection of utilities used by PixiJS

20 lines (18 loc) 657 B
function createIndicesForQuads(size, outBuffer = null) { const totalIndices = size * 6; outBuffer = outBuffer || new Uint16Array(totalIndices); if (outBuffer.length !== totalIndices) { throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`); } for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4) { outBuffer[i + 0] = j + 0; outBuffer[i + 1] = j + 1; outBuffer[i + 2] = j + 2; outBuffer[i + 3] = j + 0; outBuffer[i + 4] = j + 2; outBuffer[i + 5] = j + 3; } return outBuffer; } export { createIndicesForQuads }; //# sourceMappingURL=createIndicesForQuads.mjs.map