import { ExtensionType } from '../../extensions/Extensions.mjs';
import { executeInstructions } from './utils/executeInstructions.mjs';

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(layerGroup, this._renderer.renderPipes);
    this._renderer.globalUniforms.pop();
  }
  destroy() {
    this._renderer = null;
  }
}
LayerPipe.extension = {
  type: [
    ExtensionType.WebGLPipes,
    ExtensionType.WebGPUPipes,
    ExtensionType.CanvasPipes
  ],
  name: "layer"
};

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