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

  var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Component, Node, DirectionalLight, director, Color, Vec3, Enum, CCFloat, renderer, MeshRenderer, EDITOR, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _dec21, _dec22, _dec23, _dec24, _dec25, _dec26, _dec27, _class, _class2, _descriptor, _descriptor2, _descriptor3, _crd, ccclass, property, executeInEditMode, presetEnvs, envSettings, preConfigs, v1, QuickEnv;

  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 _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); }

  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; }

  return {
    setters: [function (_cc) {
      _cclegacy = _cc.cclegacy;
      __checkObsolete__ = _cc.__checkObsolete__;
      __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
      _decorator = _cc._decorator;
      Component = _cc.Component;
      Node = _cc.Node;
      DirectionalLight = _cc.DirectionalLight;
      director = _cc.director;
      Color = _cc.Color;
      Vec3 = _cc.Vec3;
      Enum = _cc.Enum;
      CCFloat = _cc.CCFloat;
      renderer = _cc.renderer;
      MeshRenderer = _cc.MeshRenderer;
    }, function (_ccEnv) {
      EDITOR = _ccEnv.EDITOR;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "229fdvzLfJB5pSNtdAZ5Zig", "QuickEnv", undefined);

      __checkObsolete__(['_decorator', 'Component', 'Node', 'DirectionalLight', 'director', 'Color', 'Vec3', 'Enum', 'CCFloat', 'renderer', 'TextureCube', 'assetManager', 'MeshRenderer', 'CCBoolean', 'CCInteger']);

      ({
        ccclass,
        property,
        executeInEditMode
      } = _decorator);

      (function (presetEnvs) {
        presetEnvs[presetEnvs["none"] = 0] = "none";
        presetEnvs[presetEnvs["cool"] = 1] = "cool";
        presetEnvs[presetEnvs["warm"] = 2] = "warm";
      })(presetEnvs || (presetEnvs = {}));

      (function (envSettings) {
        envSettings[envSettings["OFF"] = 0] = "OFF";
        envSettings[envSettings["ON"] = 1] = "ON";
      })(envSettings || (envSettings = {}));

      preConfigs = [{
        skyIllu: 22000,
        lightIllu: 100000,
        lightDirection: new Vec3(-120, -120, 0),
        lightColor: new Color(255, 255, 255),
        skyColor: new Color(101, 121, 160),
        groundColor: new Color(63, 55, 40)
      }, {
        skyIllu: 20000,
        lightIllu: 120000,
        lightColor: new Color(255, 255, 255),
        lightDirection: new Vec3(-150, -148, 0),
        skyColor: new Color(77, 236, 89),
        groundColor: new Color(116, 116, 116)
      }];
      v1 = new Vec3();

      _export("QuickEnv", QuickEnv = (_dec = ccclass('QuickEnv'), _dec2 = executeInEditMode(true), _dec3 = property({
        group: "shadow"
      }), _dec4 = property({
        type: Enum(renderer.scene.ShadowType),
        group: "shadow",

        visible() {
          return this.shadow;
        }

      }), _dec5 = property({
        group: "shadow",

        visible() {
          return this.shadow && this.shadowType == renderer.scene.ShadowType.ShadowMap;
        }

      }), _dec6 = property({
        type: Enum(renderer.scene.ShadowSize),
        group: "shadow",

        visible() {
          return this.shadow && this.shadowType == renderer.scene.ShadowType.ShadowMap;
        }

      }), _dec7 = property({
        type: CCFloat,
        min: 1,
        max: 200,
        slide: true,
        group: "shadow",

        visible() {
          return this.shadow && this.shadowType == renderer.scene.ShadowType.ShadowMap;
        }

      }), _dec8 = property({
        type: CCFloat,
        min: 0,
        max: 1,
        slide: true,
        step: 0.01,
        group: "shadow",

        visible() {
          return this.shadow && this.shadowType == renderer.scene.ShadowType.ShadowMap;
        }

      }), _dec9 = property({
        type: Enum(renderer.scene.PCFType),
        group: "shadow",

        visible() {
          return this.shadow && this.shadowType == renderer.scene.ShadowType.ShadowMap;
        }

      }), _dec10 = property({
        group: "shadow",

        visible() {
          return this.shadow && this.shadowType == renderer.scene.ShadowType.ShadowMap;
        }

      }), _dec11 = property({
        group: "skybox"
      }), _dec12 = property({
        group: "skybox",

        visible() {
          return this.skybox;
        }

      }), _dec13 = property({
        type: Enum(renderer.scene.EnvironmentLightingType),
        group: "skybox",

        visible() {
          return this.skybox;
        }

      }), _dec14 = property({
        min: 0,
        max: 360,
        slide: true,
        group: "skybox",

        visible() {
          return this.skybox;
        }

      }), _dec15 = property({
        group: "fog"
      }), _dec16 = property({
        type: Enum(renderer.scene.FogType),
        group: "fog",

        visible() {
          return this.fog;
        }

      }), _dec17 = property({
        type: Enum(envSettings),
        group: "model"
      }), _dec18 = property({
        visible: false
      }), _dec19 = property({
        type: Enum(envSettings),
        group: "model"
      }), _dec20 = property({
        visible: false
      }), _dec21 = property({
        type: CCFloat,
        min: 0,
        max: 160000,
        slide: true,
        step: 10
      }), _dec22 = property({
        type: CCFloat,
        min: 0,
        max: 160000,
        slide: true,
        step: 10
      }), _dec23 = property({
        type: CCFloat,
        min: -360,
        max: 360,
        slide: true
      }), _dec24 = property({
        type: CCFloat,
        min: -360,
        max: 360,
        slide: true
      }), _dec25 = property({
        type: CCFloat,
        min: -360,
        max: 360,
        slide: true
      }), _dec26 = property({
        type: Enum(presetEnvs)
      }), _dec27 = property({
        type: Enum(presetEnvs),
        visible: false
      }), _dec(_class = _dec2(_class = (_class2 = class QuickEnv extends Component {
        constructor(...args) {
          super(...args);

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

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

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

          this.directLight = null;
        }

        get shadow() {
          return director.getScene().globals.shadows.enabled;
        }

        set shadow(v) {
          director.getScene().globals.shadows.enabled = v;
        }

        get shadowType() {
          return director.getScene().globals.shadows.type;
        }

        set shadowType(v) {
          director.getScene().globals.shadows.type = v;

          if (v == renderer.scene.ShadowType.ShadowMap) {
            this.directLight.shadowEnabled = true;
          }
        }

        get shadowCSM() {
          return this.directLight.enableCSM;
        }

        set shadowCSM(v) {
          this.directLight.enableCSM = v;
        }

        get ShadowSize() {
          return director.getScene().globals.shadows.shadowMapSize;
        }

        set ShadowSize(v) {
          director.getScene().globals.shadows.shadowMapSize = v;
        }

        get shadwoDistance() {
          return this.directLight.shadowDistance;
        }

        set shadwoDistance(v) {
          this.directLight.shadowDistance = v;
        }

        get shadowSaturation() {
          return this.directLight.shadowSaturation;
        }

        set shadowSaturation(v) {
          this.directLight.shadowSaturation = v;
        }

        get shadowPcf() {
          return this.directLight.shadowPcf;
        }

        set shadowPcf(v) {
          this.directLight.shadowPcf = v;
        }

        get shadowBias() {
          return this.directLight.shadowBias;
        }

        set shadowBias(v) {
          this.directLight.shadowBias = v;
        }

        get skybox() {
          return director.getScene().globals.skybox.enabled;
        }

        set skybox(v) {
          director.getScene().globals.skybox.enabled = v;
        }

        get skyboxTexture() {
          return director.getScene().globals.skybox.envmap;
        }

        set skyboxTexture(v) {
          director.getScene().globals.skybox.envmap = v;
        }

        get skyBoxType() {
          return director.getScene().globals.skybox.envLightingType;
        }

        set skyBoxType(v) {
          director.getScene().globals.skybox.envLightingType = v;
        }

        get skyboxRotation() {
          return director.getScene().globals.skybox.rotationAngle;
        }

        set skyboxRotation(v) {
          director.getScene().globals.skybox.rotationAngle = v;
        }

        get fog() {
          return director.getScene().globals.fog.enabled;
        }

        set fog(v) {
          director.getScene().globals.fog.enabled = v;
        }

        get fogType() {
          return director.getScene().globals.fog.type;
        }

        set fogType(v) {
          director.getScene().globals.fog.type = v;
        } // @property({
        //     type: CCInteger,
        //     group: "model",
        //     readonly: true
        // })
        // get MeshesAmount() {
        //     const meshes = director.getScene().getComponentsInChildren(MeshRenderer);
        //     let L = meshes.length;
        //     // if (EDITOR) {
        //     //     /* gizmos meshes in editor */
        //     //     L -= 56;
        //     // }
        //     return L;
        // }
        // set MeshesAmount(v: number) { }


        get ModelsCastShadows() {
          return this.castShadows;
        }

        set ModelsCastShadows(v) {
          this.castShadows = v;
          const meshes = director.getScene().getComponentsInChildren(MeshRenderer);
          const L = meshes.length;

          if (L > 0) {
            for (var i = 0; i < L; i++) {
              meshes[i].shadowCastingMode = v;
            }
          }
        }

        get ModelsReceiveShadows() {
          return this.receive;
        }

        set ModelsReceiveShadows(v) {
          this.receive = v;
          const meshes = director.getScene().getComponentsInChildren(MeshRenderer);
          const L = meshes.length;

          if (L > 0) {
            for (var i = 0; i < L; i++) {
              meshes[i].receiveShadow = v;
            }
          }
        }

        get skyIllu() {
          return director.getScene().globals.ambient.skyIllum;
        }

        set skyIllu(v) {
          director.getScene().globals.ambient.skyIllum = v;
        }

        get skyColor() {
          return director.getScene().globals.ambient.skyLightingColor;
        }

        set skyColor(v) {
          director.getScene().globals.ambient.skyLightingColor = v;
        }

        get groundColor() {
          return director.getScene().globals.ambient.groundLightingColor;
        }

        set groundColor(v) {
          director.getScene().globals.ambient.groundLightingColor = v;
        }

        get directLightColor() {
          return this.directLight.color;
        }

        set directLightColor(v) {
          this.directLight.color = v;
        }

        get directLightIllu() {
          return this.directLight.illuminance;
        }

        set directLightIllu(v) {
          this.directLight.illuminance = v;
        }

        get directLightDirection() {
          return this.light.eulerAngles;
        }

        set directLightDirection(v) {
          this.light.eulerAngles = v;
        }

        get directLightDirectX() {
          return this.light.eulerAngles.x;
        }

        set directLightDirectX(v) {
          v1.set(this.light.eulerAngles);
          v1.x = v;
          this.light.eulerAngles = v1;
        }

        get directLightDirectY() {
          return this.light.eulerAngles.y;
        }

        set directLightDirectY(v) {
          v1.set(this.light.eulerAngles);
          v1.y = v;
          this.light.eulerAngles = v1;
        }

        get directLightDirectZ() {
          if (!this.directLight) {
            this.directLight = director.getScene().getComponentInChildren(DirectionalLight);
          }

          return this.light.eulerAngles.z;
        }

        set directLightDirectZ(v) {
          v1.set(this.light.eulerAngles);
          v1.z = v;
          this.light.eulerAngles = v1;
        }

        get light() {
          if (!this.directLight) {
            this.directLight = director.getScene().getComponentInChildren(DirectionalLight);
          }

          return this.directLight.node;
        }

        get preEnvs() {
          return this.currentSet;
        }

        set preEnvs(v) {
          this.currentSet = v;

          if (v > 0) {
            const config = preConfigs[v - 1];
            this.directLightDirection = config.lightDirection;
            this.directLightColor = config.lightColor;
            this.directLightIllu = config.lightIllu;
            this.skyColor = config.skyColor;
            this.skyIllu = config.skyIllu;
            this.groundColor = config.groundColor;
          }
        }

        onEnable() {
          if (EDITOR) {
            const scene = director.getScene();
            scene.on(Node.EventType.CHILD_ADDED, () => {
              const meshes = scene.getComponentsInChildren(MeshRenderer);
              const L = meshes.length;

              if (L > 0) {
                for (var i = 0; i < L; i++) {
                  meshes[i].receiveShadow = this.receive;
                }

                for (var i = 0; i < L; i++) {
                  meshes[i].shadowCastingMode = this.castShadows;
                }
              }
            }, this);
            this.directLight = scene.getComponentInChildren(DirectionalLight);
          }
        }

      }, (_applyDecoratedDescriptor(_class2.prototype, "shadow", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "shadow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "shadowType", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "shadowType"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "shadowCSM", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "shadowCSM"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "ShadowSize", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "ShadowSize"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "shadwoDistance", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "shadwoDistance"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "shadowSaturation", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "shadowSaturation"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "shadowPcf", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "shadowPcf"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "shadowBias", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "shadowBias"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "skybox", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "skybox"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "skyboxTexture", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "skyboxTexture"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "skyBoxType", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "skyBoxType"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "skyboxRotation", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "skyboxRotation"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fog", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "fog"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fogType", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "fogType"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "ModelsCastShadows", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "ModelsCastShadows"), _class2.prototype), _descriptor = _applyDecoratedDescriptor(_class2.prototype, "castShadows", [_dec18], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: function () {
          return envSettings.OFF;
        }
      }), _applyDecoratedDescriptor(_class2.prototype, "ModelsReceiveShadows", [_dec19], Object.getOwnPropertyDescriptor(_class2.prototype, "ModelsReceiveShadows"), _class2.prototype), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "receive", [_dec20], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: function () {
          return envSettings.OFF;
        }
      }), _applyDecoratedDescriptor(_class2.prototype, "skyIllu", [_dec21], Object.getOwnPropertyDescriptor(_class2.prototype, "skyIllu"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "skyColor", [property], Object.getOwnPropertyDescriptor(_class2.prototype, "skyColor"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "groundColor", [property], Object.getOwnPropertyDescriptor(_class2.prototype, "groundColor"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "directLightColor", [property], Object.getOwnPropertyDescriptor(_class2.prototype, "directLightColor"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "directLightIllu", [_dec22], Object.getOwnPropertyDescriptor(_class2.prototype, "directLightIllu"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "directLightDirection", [property], Object.getOwnPropertyDescriptor(_class2.prototype, "directLightDirection"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "directLightDirectX", [_dec23], Object.getOwnPropertyDescriptor(_class2.prototype, "directLightDirectX"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "directLightDirectY", [_dec24], Object.getOwnPropertyDescriptor(_class2.prototype, "directLightDirectY"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "directLightDirectZ", [_dec25], Object.getOwnPropertyDescriptor(_class2.prototype, "directLightDirectZ"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "preEnvs", [_dec26], Object.getOwnPropertyDescriptor(_class2.prototype, "preEnvs"), _class2.prototype), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "currentSet", [_dec27], {
        configurable: true,
        enumerable: true,
        writable: true,
        initializer: function () {
          return presetEnvs.none;
        }
      })), _class2)) || _class) || _class));

      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=064e6d8d1dfc0d6285ef3d92e1f0f211d32197af.js.map