System.register(["cc"], function (_export, _context) {
  "use strict";

  var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, rendering, Material, Vec4, gfx, postProcess, CustomPass, _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _crd, ccclass, property, menu, SettingPass, PostProcessSetting, BlitScreenPass, ForwardPass, custom_postprocess, builder;

  function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }

  function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }

  function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }

  _export("CustomPass", void 0);

  return {
    setters: [function (_cc) {
      _cclegacy = _cc.cclegacy;
      __checkObsolete__ = _cc.__checkObsolete__;
      __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
      _decorator = _cc._decorator;
      rendering = _cc.rendering;
      Material = _cc.Material;
      Vec4 = _cc.Vec4;
      gfx = _cc.gfx;
      postProcess = _cc.postProcess;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "796dbV4XbJJqLqTawjV6vp7", "custom_postprocess", undefined);

      __checkObsolete__(['_decorator', 'Component', 'Node', 'rendering', 'Material', 'renderer', 'Vec4', 'gfx', 'input', 'postProcess']);

      ({
        ccclass,
        property,
        menu
      } = _decorator);
      ({
        SettingPass,
        PostProcessSetting,
        BlitScreenPass,
        ForwardPass
      } = postProcess);

      _export("custom_postprocess", custom_postprocess = (_dec = ccclass('custom_postprocess'), _dec2 = menu('PostProcess/custom_postprocess'), _dec3 = property(Material), _dec4 = property(Material), _dec(_class = _dec2(_class = (_class2 = class custom_postprocess extends PostProcessSetting {
        constructor(...args) {
          super(...args);

          _initializerDefineProperty(this, "blueIntensity", _descriptor, this);

          _initializerDefineProperty(this, "showDepth", _descriptor2, this);

          _initializerDefineProperty(this, "depthRange", _descriptor3, this);

          _initializerDefineProperty(this, "_material", _descriptor4, this);
        }

        get material() {
          return this._material;
        }

        set material(v) {
          this._material = v;
        }

      }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "blueIntensity", [property], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: function () {
          return 1;
        }
      }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "showDepth", [property], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: function () {
          return false;
        }
      }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "depthRange", [property], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: function () {
          return 30;
        }
      }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "_material", [_dec3], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: null
      }), _applyDecoratedDescriptor(_class2.prototype, "material", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "material"), _class2.prototype)), _class2)) || _class) || _class));

      _export("CustomPass", CustomPass = class CustomPass extends SettingPass {
        constructor(...args) {
          super(...args);
          this.name = 'CustomPass';
          this.outputNames = ['CustomPassColor'];
          this.params = new Vec4();
        }

        get setting() {
          return this.getSetting(CustomPostProcess);
        }

        checkEnable(camera) {
          let setting = this.setting;
          return setting.material && super.checkEnable(camera);
        }

        render(camera, ppl) {
          const cameraID = this.getCameraUniqueID(camera);
          let context = this.context;
          context.clearBlack();
          let input0 = this.lastPass.slotName(camera, 0);
          let output = this.slotName(camera);
          let setting = this.setting;
          let forwardPass = builder.getPass(ForwardPass);
          let depth = forwardPass.slotName(camera, 1);
          this.params.x = setting.blueIntensity;
          this.params.y = setting.showDepth ? 1 : 0;
          this.params.z = setting.depthRange;
          setting.material.setProperty('params', this.params); // if (setting.showDepth) {
          //     input0 = depth;
          // }

          context.material = setting.material;
          context.updatePassViewPort().addRenderPass('post-process', `${this.name}${cameraID}`).setPassInput(input0, 'inputTexture').setPassInput(depth, 'depthTexture').addRasterView(output, gfx.Format.RGBA8).blitScreen(0).version();
        }

      });

      builder = rendering.getCustomPipeline('Custom');

      if (builder) {
        builder.insertPass(new CustomPass(), BlitScreenPass);
      }

      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=39deaf084dcfe887b0aabb135bcb865e10f09e27.js.map