text: import { __decorate } from "tslib";
  import { SerializationHelper, serialize, expandToProperty } from "../../Misc/decorators";
  /**
   * Define the code related to the BRDF parameters of the pbr material.
   */
  var PBRBRDFConfiguration = /** @class */ (function () {
      /**
       * Instantiate a new istance of clear coat configuration.
       * @param markAllSubMeshesAsMiscDirty Callback to flag the material to dirty
       */
      function PBRBRDFConfiguration(markAllSubMeshesAsMiscDirty) {
          this._useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION;
          /**
           * Defines if the material uses energy conservation.
           */
          this.useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION;
          this._useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED;
          /**
           * LEGACY Mode set to false
           * Defines if the material uses height smith correlated visibility term.
           * If you intent to not use our default BRDF, you need to load a separate BRDF Texture for the PBR
           * You can either load https://assets.babylonjs.com/environments/uncorrelatedBRDF.png
           * or https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds to have more precision
           * Not relying on height correlated will also disable energy conservation.
           */
          this.useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED;
          this._useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS;
          /**
           * LEGACY Mode set to false
           * Defines if the material uses spherical harmonics vs spherical polynomials for the
           * diffuse part of the IBL.
           * The harmonics despite a tiny bigger cost has been proven to provide closer results
           * to the ground truth.
           */
          this.useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS;
          this._useSpecularGlossinessInputEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION;
          /**
           * Defines if the material uses energy conservation, when the specular workflow is active.
           * If activated, the albedo color is multiplied with (1. - maxChannel(specular color)).
           * If deactivated, a material is only physically plausible, when (albedo color + specular color) < 1.
           * In the deactivated case, the material author has to ensure energy conservation, for a physically plausible rendering.
           */
          this.useSpecularGlossinessInputEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION;
          this._internalMarkAllSubMeshesAsMiscDirty = markAllSubMeshesAsMiscDirty;
      }
      /** @hidden */
      PBRBRDFConfiguration.prototype._markAllSubMeshesAsMiscDirty = function () {
          this._internalMarkAllSubMeshesAsMiscDirty();
      };
      /**
       * Checks to see if a texture is used in the material.
       * @param defines the list of "defines" to update.
       */
      PBRBRDFConfiguration.prototype.prepareDefines = function (defines) {
          defines.BRDF_V_HEIGHT_CORRELATED = this._useSmithVisibilityHeightCorrelated;
          defines.MS_BRDF_ENERGY_CONSERVATION = this._useEnergyConservation && this._useSmithVisibilityHeightCorrelated;
          defines.SPHERICAL_HARMONICS = this._useSphericalHarmonics;
          defines.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION = this._useSpecularGlossinessInputEnergyConservation;
      };
      /**
      * Get the current class name of the texture useful for serialization or dynamic coding.
      * @returns "PBRClearCoatConfiguration"
      */
      PBRBRDFConfiguration.prototype.getClassName = function () {
          return "PBRBRDFConfiguration";
      };
      /**
       * Makes a duplicate of the current configuration into another one.
       * @param brdfConfiguration define the config where to copy the info
       */
      PBRBRDFConfiguration.prototype.copyTo = function (brdfConfiguration) {
          SerializationHelper.Clone(function () { return brdfConfiguration; }, this);
      };
      /**
       * Serializes this BRDF configuration.
       * @returns - An object with the serialized config.
       */
      PBRBRDFConfiguration.prototype.serialize = function () {
          return SerializationHelper.Serialize(this);
      };
      /**
       * Parses a anisotropy Configuration from a serialized object.
       * @param source - Serialized object.
       * @param scene Defines the scene we are parsing for
       * @param rootUrl Defines the rootUrl to load from
       */
      PBRBRDFConfiguration.prototype.parse = function (source, scene, rootUrl) {
          var _this = this;
          SerializationHelper.Parse(function () { return _this; }, source, scene, rootUrl);
      };
      /**
       * Default value used for the energy conservation.
       * This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.
       */
      PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION = true;
      /**
       * Default value used for the Smith Visibility Height Correlated mode.
       * This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.
       */
      PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED = true;
      /**
       * Default value used for the IBL diffuse part.
       * This can help switching back to the polynomials mode globally which is a tiny bit
       * less GPU intensive at the drawback of a lower quality.
       */
      PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS = true;
      /**
       * Default value used for activating energy conservation for the specular workflow.
       * If activated, the albedo color is multiplied with (1. - maxChannel(specular color)).
       * If deactivated, a material is only physically plausible, when (albedo color + specular color) < 1.
       */
      PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION = true;
      __decorate([
          serialize(),
          expandToProperty("_markAllSubMeshesAsMiscDirty")
      ], PBRBRDFConfiguration.prototype, "useEnergyConservation", void 0);
      __decorate([
          serialize(),
          expandToProperty("_markAllSubMeshesAsMiscDirty")
      ], PBRBRDFConfiguration.prototype, "useSmithVisibilityHeightCorrelated", void 0);
      __decorate([
          serialize(),
          expandToProperty("_markAllSubMeshesAsMiscDirty")
      ], PBRBRDFConfiguration.prototype, "useSphericalHarmonics", void 0);
      __decorate([
          serialize(),
          expandToProperty("_markAllSubMeshesAsMiscDirty")
      ], PBRBRDFConfiguration.prototype, "useSpecularGlossinessInputEnergyConservation", void 0);
      return PBRBRDFConfiguration;
  }());
  export { PBRBRDFConfiguration };
  //# sourceMappingURL=pbrBRDFConfiguration.js.map