{"version":3,"file":"createIndicesForQuads.mjs","sources":["../../src/data/createIndicesForQuads.ts"],"sourcesContent":["/**\n * Generic Mask Stack data structure\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @returns {Uint16Array|Uint32Array} - Resulting index buffer\n */\nexport function createIndicesForQuads(\n    size: number,\n    outBuffer: Uint16Array | Uint32Array | null = null\n): Uint16Array | Uint32Array\n{\n    // the total number of indices in our array, there are 6 points per quad.\n    const totalIndices = size * 6;\n\n    outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n    if (outBuffer.length !== totalIndices)\n    {\n        throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`);\n    }\n\n    // fill the indices with the quads to draw\n    for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n    {\n        outBuffer[i + 0] = j + 0;\n        outBuffer[i + 1] = j + 1;\n        outBuffer[i + 2] = j + 2;\n        outBuffer[i + 3] = j + 0;\n        outBuffer[i + 4] = j + 2;\n        outBuffer[i + 5] = j + 3;\n    }\n\n    return outBuffer;\n}\n"],"names":[],"mappings":"AAQgB,SAAA,sBACZ,MACA,YAA8C,MAElD;AAEI,QAAM,eAAe,OAAO;AAI5B,MAFA,YAAY,aAAa,IAAI,YAAY,YAAY,GAEjD,UAAU,WAAW;AAErB,UAAM,IAAI,MAAM,uCAAuC,UAAU,MAAM,iBAAiB,YAAY,EAAE;AAIjG,WAAA,IAAI,GAAG,IAAI,GAAG,IAAI,cAAc,KAAK,GAAG,KAAK;AAElD,cAAU,IAAI,CAAC,IAAI,IAAI,GACvB,UAAU,IAAI,CAAC,IAAI,IAAI,GACvB,UAAU,IAAI,CAAC,IAAI,IAAI,GACvB,UAAU,IAAI,CAAC,IAAI,IAAI,GACvB,UAAU,IAAI,CAAC,IAAI,IAAI,GACvB,UAAU,IAAI,CAAC,IAAI,IAAI;AAGpB,SAAA;AACX;"}