1 |
- {"ast":null,"code":"import { DeepCopier } from \"../Misc/deepCopier.js\";\nimport { Color3 } from \"../Maths/math.color.js\";\nimport { SerializationHelper } from \"../Misc/decorators.serialization.js\";\nimport { AbstractEngine } from \"../Engines/abstractEngine.js\";\n/**\n * This represents all the required information to add a fresnel effect on a material:\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters\n */\nexport class FresnelParameters {\n /**\n * Define if the fresnel effect is enable or not.\n */\n get isEnabled() {\n return this._isEnabled;\n }\n set isEnabled(value) {\n if (this._isEnabled === value) {\n return;\n }\n this._isEnabled = value;\n AbstractEngine.MarkAllMaterialsAsDirty(4 | 16);\n }\n /**\n * Creates a new FresnelParameters object.\n *\n * @param options provide your own settings to optionally to override defaults\n */\n constructor(options = {}) {\n this._isEnabled = true;\n this.bias = options.bias === undefined ? 0 : options.bias;\n this.power = options.power === undefined ? 1 : options.power;\n this.leftColor = options.leftColor || Color3.White();\n this.rightColor = options.rightColor || Color3.Black();\n if (options.isEnabled === false) {\n this.isEnabled = false;\n }\n }\n /**\n * Clones the current fresnel and its values\n * @returns a clone fresnel configuration\n */\n clone() {\n const newFresnelParameters = new FresnelParameters();\n DeepCopier.DeepCopy(this, newFresnelParameters);\n return newFresnelParameters;\n }\n /**\n * Determines equality between FresnelParameters objects\n * @param otherFresnelParameters defines the second operand\n * @returns true if the power, bias, leftColor, rightColor and isEnabled values are equal to the given ones\n */\n equals(otherFresnelParameters) {\n return otherFresnelParameters && this.bias === otherFresnelParameters.bias && this.power === otherFresnelParameters.power && this.leftColor.equals(otherFresnelParameters.leftColor) && this.rightColor.equals(otherFresnelParameters.rightColor) && this.isEnabled === otherFresnelParameters.isEnabled;\n }\n /**\n * Serializes the current fresnel parameters to a JSON representation.\n * @returns the JSON serialization\n */\n serialize() {\n return {\n isEnabled: this.isEnabled,\n leftColor: this.leftColor.asArray(),\n rightColor: this.rightColor.asArray(),\n bias: this.bias,\n power: this.power\n };\n }\n /**\n * Parse a JSON object and deserialize it to a new Fresnel parameter object.\n * @param parsedFresnelParameters Define the JSON representation\n * @returns the parsed parameters\n */\n static Parse(parsedFresnelParameters) {\n return new FresnelParameters({\n isEnabled: parsedFresnelParameters.isEnabled,\n leftColor: Color3.FromArray(parsedFresnelParameters.leftColor),\n rightColor: Color3.FromArray(parsedFresnelParameters.rightColor),\n bias: parsedFresnelParameters.bias,\n power: parsedFresnelParameters.power || 1.0\n });\n }\n}\n// References the dependencies.\nSerializationHelper._FresnelParametersParser = FresnelParameters.Parse;","map":{"version":3,"names":["DeepCopier","Color3","SerializationHelper","AbstractEngine","FresnelParameters","isEnabled","_isEnabled","value","MarkAllMaterialsAsDirty","constructor","options","bias","undefined","power","leftColor","White","rightColor","Black","clone","newFresnelParameters","DeepCopy","equals","otherFresnelParameters","serialize","asArray","Parse","parsedFresnelParameters","FromArray","_FresnelParametersParser"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/fresnelParameters.js"],"sourcesContent":["import { DeepCopier } from \"../Misc/deepCopier.js\";\nimport { Color3 } from \"../Maths/math.color.js\";\nimport { SerializationHelper } from \"../Misc/decorators.serialization.js\";\n\nimport { AbstractEngine } from \"../Engines/abstractEngine.js\";\n/**\n * This represents all the required information to add a fresnel effect on a material:\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters\n */\nexport class FresnelParameters {\n /**\n * Define if the fresnel effect is enable or not.\n */\n get isEnabled() {\n return this._isEnabled;\n }\n set isEnabled(value) {\n if (this._isEnabled === value) {\n return;\n }\n this._isEnabled = value;\n AbstractEngine.MarkAllMaterialsAsDirty(4 | 16);\n }\n /**\n * Creates a new FresnelParameters object.\n *\n * @param options provide your own settings to optionally to override defaults\n */\n constructor(options = {}) {\n this._isEnabled = true;\n this.bias = options.bias === undefined ? 0 : options.bias;\n this.power = options.power === undefined ? 1 : options.power;\n this.leftColor = options.leftColor || Color3.White();\n this.rightColor = options.rightColor || Color3.Black();\n if (options.isEnabled === false) {\n this.isEnabled = false;\n }\n }\n /**\n * Clones the current fresnel and its values\n * @returns a clone fresnel configuration\n */\n clone() {\n const newFresnelParameters = new FresnelParameters();\n DeepCopier.DeepCopy(this, newFresnelParameters);\n return newFresnelParameters;\n }\n /**\n * Determines equality between FresnelParameters objects\n * @param otherFresnelParameters defines the second operand\n * @returns true if the power, bias, leftColor, rightColor and isEnabled values are equal to the given ones\n */\n equals(otherFresnelParameters) {\n return (otherFresnelParameters &&\n this.bias === otherFresnelParameters.bias &&\n this.power === otherFresnelParameters.power &&\n this.leftColor.equals(otherFresnelParameters.leftColor) &&\n this.rightColor.equals(otherFresnelParameters.rightColor) &&\n this.isEnabled === otherFresnelParameters.isEnabled);\n }\n /**\n * Serializes the current fresnel parameters to a JSON representation.\n * @returns the JSON serialization\n */\n serialize() {\n return {\n isEnabled: this.isEnabled,\n leftColor: this.leftColor.asArray(),\n rightColor: this.rightColor.asArray(),\n bias: this.bias,\n power: this.power,\n };\n }\n /**\n * Parse a JSON object and deserialize it to a new Fresnel parameter object.\n * @param parsedFresnelParameters Define the JSON representation\n * @returns the parsed parameters\n */\n static Parse(parsedFresnelParameters) {\n return new FresnelParameters({\n isEnabled: parsedFresnelParameters.isEnabled,\n leftColor: Color3.FromArray(parsedFresnelParameters.leftColor),\n rightColor: Color3.FromArray(parsedFresnelParameters.rightColor),\n bias: parsedFresnelParameters.bias,\n power: parsedFresnelParameters.power || 1.0,\n });\n }\n}\n// References the dependencies.\nSerializationHelper._FresnelParametersParser = FresnelParameters.Parse;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,uBAAuB;AAClD,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,mBAAmB,QAAQ,qCAAqC;AAEzE,SAASC,cAAc,QAAQ,8BAA8B;AAC7D;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,CAAC;EAC3B;AACJ;AACA;EACI,IAAIC,SAASA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACC,UAAU;EAC1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CAAC,IACvD,IAAI,CAACE,UAAU,CAACK,MAAM,CAACC,sBAAsB,CAACN,UAAU,CAAC,IACzD,IAAI,CAACX,SAAS,KAAKiB,sBAAsB,CAACjB,SAAS;EAC3D;EACA;AACJ;AACA;AACA;EACIkB,SAASA,CAAA,EAAG;IACR,OAAO;MACHlB,SAAS,EAAE,IAAI,CAACA,SAAS;MACzBS,SAAS,EAAE,IAAI,CAACA,SAAS,CAACU,OAAO,CAAC,CAAC;MACnCR,UAAU,EAAE,IAAI,CAACA,UAAU,CAACQ,OAAO,CAAC,CAAC;MACrCb,IAAI,EAAE,IAAI,CAACA,IAAI;MACfE,KAAK,EAAE,IAAI,CAACA;IAChB,CAAC;EACL;EACA;AACJ;AACA;AACA;AACA;EACI,OAAOY,KAAKA,CAACC,uBAAuB,EAAE;IAClC,OAAO,IAAItB,iBAAiB,CAAC;MACzBC,SAAS,EAAEqB,uBAAuB,CAACrB,SAAS;MAC5CS,SAAS,EAAEb,MAAM,CAAC0B,SAAS,CAACD,uBAAuB,CAACZ,SAAS,CAAC;MAC9DE,UAAU,EAAEf,MAAM,CAAC0B,SAAS,CAACD,uBAAuB,CAACV,UAAU,CAAC;MAChEL,IAAI,EAAEe,uBAAuB,CAACf,IAAI;MAClCE,KAAK,EAAEa,uBAAuB,CAACb,KAAK,IAAI;IAC5C,CAAC,CAAC;EACN;AACJ;AACA;AACAX,mBAAmB,CAAC0B,wBAAwB,GAAGxB,iBAAiB,CAACqB,KAAK","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|