'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var Extensions = require('../../extensions/Extensions.js');
var executeInstructions = require('./utils/executeInstructions.js');

class LayerPipe {
  constructor(renderer) {
    this._renderer = renderer;
  }
  addLayerGroup(layerGroup, instructionSet) {
    this._renderer.renderPipes.batch.break(instructionSet);
    instructionSet.add(layerGroup);
  }
  execute(layerGroup) {
    if (!layerGroup.isRenderable)
      return;
    this._renderer.globalUniforms.push({
      projectionMatrix: this._renderer.renderTarget.renderTarget.projectionMatrix,
      worldTransformMatrix: layerGroup.worldTransform,
      worldColor: layerGroup.worldColor
    });
    executeInstructions.executeInstructions(layerGroup, this._renderer.renderPipes);
    this._renderer.globalUniforms.pop();
  }
  destroy() {
    this._renderer = null;
  }
}
LayerPipe.extension = {
  type: [
    Extensions.ExtensionType.WebGLPipes,
    Extensions.ExtensionType.WebGPUPipes,
    Extensions.ExtensionType.CanvasPipes
  ],
  name: "layer"
};

exports.LayerPipe = LayerPipe;
//# sourceMappingURL=LayerPipe.js.map
