class BatchableSprite {
  constructor() {
    // batch specific..
    this.vertexSize = 4;
    this.indexSize = 6;
    this.location = 0;
    // location in the buffer
    this.batcher = null;
    this.batch = null;
  }
  get blendMode() {
    return this.sprite.layerBlendMode;
  }
  packAttributes(float32View, uint32View, index, textureId) {
    const sprite = this.sprite;
    const texture = this.texture;
    const wt = sprite.layerTransform;
    const a = wt.a;
    const b = wt.b;
    const c = wt.c;
    const d = wt.d;
    const tx = wt.tx;
    const ty = wt.ty;
    const bounds = this.bounds;
    const w0 = bounds[1];
    const w1 = bounds[0];
    const h0 = bounds[3];
    const h1 = bounds[2];
    const uvs = texture._layout.uvs;
    const argb = sprite.layerColor;
    float32View[index + 0] = a * w1 + c * h1 + tx;
    float32View[index + 1] = d * h1 + b * w1 + ty;
    float32View[index + 2] = uvs.x0;
    float32View[index + 3] = uvs.y0;
    uint32View[index + 4] = argb;
    float32View[index + 5] = textureId;
    float32View[index + 6] = a * w0 + c * h1 + tx;
    float32View[index + 7] = d * h1 + b * w0 + ty;
    float32View[index + 8] = uvs.x1;
    float32View[index + 9] = uvs.y1;
    uint32View[index + 10] = argb;
    float32View[index + 11] = textureId;
    float32View[index + 12] = a * w0 + c * h0 + tx;
    float32View[index + 13] = d * h0 + b * w0 + ty;
    float32View[index + 14] = uvs.x2;
    float32View[index + 15] = uvs.y2;
    uint32View[index + 16] = argb;
    float32View[index + 17] = textureId;
    float32View[index + 18] = a * w1 + c * h0 + tx;
    float32View[index + 19] = d * h0 + b * w1 + ty;
    float32View[index + 20] = uvs.x3;
    float32View[index + 21] = uvs.y3;
    uint32View[index + 22] = argb;
    float32View[index + 23] = textureId;
  }
  packIndex(indexBuffer, index, indicesOffset) {
    indexBuffer[index] = indicesOffset + 0;
    indexBuffer[index + 1] = indicesOffset + 1;
    indexBuffer[index + 2] = indicesOffset + 2;
    indexBuffer[index + 3] = indicesOffset + 0;
    indexBuffer[index + 4] = indicesOffset + 2;
    indexBuffer[index + 5] = indicesOffset + 3;
  }
  reset() {
    this.sprite = null;
    this.texture = null;
    this.batcher = null;
    this.batch = null;
    this.bounds = null;
  }
}

export { BatchableSprite };
//# sourceMappingURL=BatchableSprite.mjs.map
