1 |
- {"ast":null,"code":"import { __decorate } from \"../../../../tslib.es6.js\";\nimport { NodeMaterialBlock } from \"../../nodeMaterialBlock.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { InputBlock } from \"../Input/inputBlock.js\";\nimport { NodeMaterialConnectionPointCustomObject } from \"../../nodeMaterialConnectionPointCustomObject.js\";\nimport { PBRClearCoatConfiguration } from \"../../../PBR/pbrClearCoatConfiguration.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\nimport { TBNBlock } from \"../Fragment/TBNBlock.js\";\n/**\n * Block used to implement the clear coat module of the PBR material\n */\nexport class ClearCoatBlock extends NodeMaterialBlock {\n /**\n * Create a new ClearCoatBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Fragment);\n this._tangentCorrectionFactorName = \"\";\n /**\n * Defines if the F0 value should be remapped to account for the interface change in the material.\n */\n this.remapF0OnInterfaceChange = true;\n this._isUnique = true;\n this.registerInput(\"intensity\", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"roughness\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"indexOfRefraction\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"normalMapColor\", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"uv\", NodeMaterialBlockConnectionPointTypes.Vector2, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"tintColor\", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"tintAtDistance\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"tintThickness\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"worldTangent\", NodeMaterialBlockConnectionPointTypes.Vector4, true);\n this.registerInput(\"worldNormal\", NodeMaterialBlockConnectionPointTypes.AutoDetect, true);\n this.worldNormal.addExcludedConnectionPointFromAllowedTypes(NodeMaterialBlockConnectionPointTypes.Color4 | NodeMaterialBlockConnectionPointTypes.Vector4 | NodeMaterialBlockConnectionPointTypes.Vector3);\n this.registerInput(\"TBN\", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.VertexAndFragment, new NodeMaterialConnectionPointCustomObject(\"TBN\", this, 0 /* NodeMaterialConnectionPointDirection.Input */, TBNBlock, \"TBNBlock\"));\n this.registerOutput(\"clearcoat\", NodeMaterialBlockConnectionPointTypes.Object, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject(\"clearcoat\", this, 1 /* NodeMaterialConnectionPointDirection.Output */, ClearCoatBlock, \"ClearCoatBlock\"));\n }\n /**\n * Initialize the block and prepare the context for build\n * @param state defines the state that will be used for the build\n */\n initialize(state) {\n state._excludeVariableName(\"clearcoatOut\");\n state._excludeVariableName(\"vClearCoatParams\");\n state._excludeVariableName(\"vClearCoatTintParams\");\n state._excludeVariableName(\"vClearCoatRefractionParams\");\n state._excludeVariableName(\"vClearCoatTangentSpaceParams\");\n state._excludeVariableName(\"vGeometricNormaClearCoatW\");\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ClearCoatBlock\";\n }\n /**\n * Gets the intensity input component\n */\n get intensity() {\n return this._inputs[0];\n }\n /**\n * Gets the roughness input component\n */\n get roughness() {\n return this._inputs[1];\n }\n /**\n * Gets the ior input component\n */\n get indexOfRefraction() {\n return this._inputs[2];\n }\n /**\n * Gets the bump texture input component\n */\n get normalMapColor() {\n return this._inputs[3];\n }\n /**\n * Gets the uv input component\n */\n get uv() {\n return this._inputs[4];\n }\n /**\n * Gets the tint color input component\n */\n get tintColor() {\n return this._inputs[5];\n }\n /**\n * Gets the tint \"at distance\" input component\n */\n get tintAtDistance() {\n return this._inputs[6];\n }\n /**\n * Gets the tint thickness input component\n */\n get tintThickness() {\n return this._inputs[7];\n }\n /**\n * Gets the world tangent input component\n */\n get worldTangent() {\n return this._inputs[8];\n }\n /**\n * Gets the world normal input component\n */\n get worldNormal() {\n return this._inputs[9];\n }\n /**\n * Gets the TBN input component\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n get TBN() {\n return this._inputs[10];\n }\n /**\n * Gets the clear coat object output component\n */\n get clearcoat() {\n return this._outputs[0];\n }\n autoConfigure() {\n if (!this.intensity.isConnected) {\n const intensityInput = new InputBlock(\"ClearCoat intensity\", NodeMaterialBlockTargets.Fragment, NodeMaterialBlockConnectionPointTypes.Float);\n intensityInput.value = 1;\n intensityInput.output.connectTo(this.intensity);\n }\n }\n prepareDefines(mesh, nodeMaterial, defines) {\n super.prepareDefines(mesh, nodeMaterial, defines);\n defines.setValue(\"CLEARCOAT\", true);\n defines.setValue(\"CLEARCOAT_TEXTURE\", false, true);\n defines.setValue(\"CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE\", true, true);\n defines.setValue(\"CLEARCOAT_TINT\", this.tintColor.isConnected || this.tintThickness.isConnected || this.tintAtDistance.isConnected, true);\n defines.setValue(\"CLEARCOAT_BUMP\", this.normalMapColor.isConnected, true);\n defines.setValue(\"CLEARCOAT_DEFAULTIOR\", this.indexOfRefraction.isConnected ? this.indexOfRefraction.connectInputBlock.value === PBRClearCoatConfiguration._DefaultIndexOfRefraction : true, true);\n defines.setValue(\"CLEARCOAT_REMAP_F0\", this.remapF0OnInterfaceChange, true);\n }\n bind(effect, nodeMaterial, mesh) {\n var _this$indexOfRefracti, _this$indexOfRefracti2;\n super.bind(effect, nodeMaterial, mesh);\n // Clear Coat Refraction params\n const indexOfRefraction = (_this$indexOfRefracti = (_this$indexOfRefracti2 = this.indexOfRefraction.connectInputBlock) === null || _this$indexOfRefracti2 === void 0 ? void 0 : _this$indexOfRefracti2.value) !== null && _this$indexOfRefracti !== void 0 ? _this$indexOfRefracti : PBRClearCoatConfiguration._DefaultIndexOfRefraction;\n const a = 1 - indexOfRefraction;\n const b = 1 + indexOfRefraction;\n const f0 = Math.pow(-a / b, 2); // Schlicks approx: (ior1 - ior2) / (ior1 + ior2) where ior2 for air is close to vacuum = 1.\n const eta = 1 / indexOfRefraction;\n effect.setFloat4(\"vClearCoatRefractionParams\", f0, eta, a, b);\n // Clear Coat tangent space params\n const mainPBRBlock = this.clearcoat.hasEndpoints ? this.clearcoat.endpoints[0].ownerBlock : null;\n const perturbedNormalBlock = mainPBRBlock !== null && mainPBRBlock !== void 0 && mainPBRBlock.perturbedNormal.isConnected ? mainPBRBlock.perturbedNormal.connectedPoint.ownerBlock : null;\n if (this._scene._mirroredCameraPosition) {\n effect.setFloat2(\"vClearCoatTangentSpaceParams\", perturbedNormalBlock !== null && perturbedNormalBlock !== void 0 && perturbedNormalBlock.invertX ? 1.0 : -1.0, perturbedNormalBlock !== null && perturbedNormalBlock !== void 0 && perturbedNormalBlock.invertY ? 1.0 : -1.0);\n } else {\n effect.setFloat2(\"vClearCoatTangentSpaceParams\", perturbedNormalBlock !== null && perturbedNormalBlock !== void 0 && perturbedNormalBlock.invertX ? -1.0 : 1.0, perturbedNormalBlock !== null && perturbedNormalBlock !== void 0 && perturbedNormalBlock.invertY ? -1.0 : 1.0);\n }\n if (mesh) {\n effect.setFloat(this._tangentCorrectionFactorName, mesh.getWorldMatrix().determinant() < 0 ? -1 : 1);\n }\n }\n _generateTBNSpace(state, worldPositionVarName, worldNormalVarName) {\n let code = \"\";\n const comments = `//${this.name}`;\n const worldTangent = this.worldTangent;\n const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;\n if (!isWebGPU) {\n state._emitExtension(\"derivatives\", \"#extension GL_OES_standard_derivatives : enable\");\n }\n const tangentReplaceString = {\n search: /defined\\(TANGENT\\)/g,\n replace: worldTangent.isConnected ? \"defined(TANGENT)\" : \"defined(IGNORE)\"\n };\n const TBN = this.TBN;\n if (TBN.isConnected) {\n state.compilationString += `\n #ifdef TBNBLOCK\n ${isWebGPU ? \"var TBN\" : \"mat3 TBN\"} = ${TBN.associatedVariableName};\n #endif\n `;\n } else if (worldTangent.isConnected) {\n code += `${state._declareLocalVar(\"tbnNormal\", NodeMaterialBlockConnectionPointTypes.Vector3)} = normalize(${worldNormalVarName}.xyz);\\n`;\n code += `${state._declareLocalVar(\"tbnTangent\", NodeMaterialBlockConnectionPointTypes.Vector3)} = normalize(${worldTangent.associatedVariableName}.xyz);\\n`;\n code += `${state._declareLocalVar(\"tbnBitangent\", NodeMaterialBlockConnectionPointTypes.Vector3)} = cross(tbnNormal, tbnTangent) * ${this._tangentCorrectionFactorName};\\n`;\n code += `${isWebGPU ? \"var vTBN\" : \"mat3 vTBN\"} = ${isWebGPU ? \"mat3x3f\" : \"mat3\"}(tbnTangent, tbnBitangent, tbnNormal);\\n`;\n }\n state._emitFunctionFromInclude(\"bumpFragmentMainFunctions\", comments, {\n replaceStrings: [tangentReplaceString]\n });\n return code;\n }\n /**\n * Gets the main code of the block (fragment side)\n * @param state current state of the node material building\n * @param ccBlock instance of a ClearCoatBlock or null if the code must be generated without an active clear coat module\n * @param reflectionBlock instance of a ReflectionBlock null if the code must be generated without an active reflection module\n * @param worldPosVarName name of the variable holding the world position\n * @param generateTBNSpace if true, the code needed to create the TBN coordinate space is generated\n * @param vTBNAvailable indicate that the vTBN variable is already existing because it has already been generated by another block (PerturbNormal or Anisotropy)\n * @param worldNormalVarName name of the variable holding the world normal\n * @returns the shader code\n */\n static GetCode(state, ccBlock, reflectionBlock, worldPosVarName, generateTBNSpace, vTBNAvailable, worldNormalVarName) {\n let code = \"\";\n const intensity = ccBlock !== null && ccBlock !== void 0 && ccBlock.intensity.isConnected ? ccBlock.intensity.associatedVariableName : \"1.\";\n const roughness = ccBlock !== null && ccBlock !== void 0 && ccBlock.roughness.isConnected ? ccBlock.roughness.associatedVariableName : \"0.\";\n const normalMapColor = ccBlock !== null && ccBlock !== void 0 && ccBlock.normalMapColor.isConnected ? ccBlock.normalMapColor.associatedVariableName : `vec3${state.fSuffix}(0.)`;\n const uv = ccBlock !== null && ccBlock !== void 0 && ccBlock.uv.isConnected ? ccBlock.uv.associatedVariableName : `vec2${state.fSuffix}(0.)`;\n const tintColor = ccBlock !== null && ccBlock !== void 0 && ccBlock.tintColor.isConnected ? ccBlock.tintColor.associatedVariableName : `vec3${state.fSuffix}(1.)`;\n const tintThickness = ccBlock !== null && ccBlock !== void 0 && ccBlock.tintThickness.isConnected ? ccBlock.tintThickness.associatedVariableName : \"1.\";\n const tintAtDistance = ccBlock !== null && ccBlock !== void 0 && ccBlock.tintAtDistance.isConnected ? ccBlock.tintAtDistance.associatedVariableName : \"1.\";\n const tintTexture = `vec4${state.fSuffix}(0.)`;\n if (ccBlock) {\n state._emitUniformFromString(\"vClearCoatRefractionParams\", NodeMaterialBlockConnectionPointTypes.Vector4);\n state._emitUniformFromString(\"vClearCoatTangentSpaceParams\", NodeMaterialBlockConnectionPointTypes.Vector2);\n const normalShading = ccBlock.worldNormal;\n code += `${state._declareLocalVar(\"vGeometricNormaClearCoatW\", NodeMaterialBlockConnectionPointTypes.Vector3)} = ${normalShading.isConnected ? \"normalize(\" + normalShading.associatedVariableName + \".xyz)\" : \"geometricNormalW\"};\\n`;\n } else {\n code += `${state._declareLocalVar(\"vGeometricNormaClearCoatW\", NodeMaterialBlockConnectionPointTypes.Vector3)} = geometricNormalW;\\n`;\n }\n if (generateTBNSpace && ccBlock) {\n code += ccBlock._generateTBNSpace(state, worldPosVarName, worldNormalVarName);\n vTBNAvailable = ccBlock.worldTangent.isConnected;\n }\n const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;\n code += `${isWebGPU ? \"var clearcoatOut: clearcoatOutParams\" : \"clearcoatOutParams clearcoatOut\"};\n\n #ifdef CLEARCOAT\n ${state._declareLocalVar(\"vClearCoatParams\", NodeMaterialBlockConnectionPointTypes.Vector2)} = vec2${state.fSuffix}(${intensity}, ${roughness});\n ${state._declareLocalVar(\"vClearCoatTintParams\", NodeMaterialBlockConnectionPointTypes.Vector4)} = vec4${state.fSuffix}(${tintColor}, ${tintThickness});\n\n clearcoatOut = clearcoatBlock(\n ${worldPosVarName}.xyz\n , vGeometricNormaClearCoatW\n , viewDirectionW\n , vClearCoatParams\n , specularEnvironmentR0\n #ifdef CLEARCOAT_TEXTURE\n , vec2${state.fSuffix}(0.)\n #endif\n #ifdef CLEARCOAT_TINT\n , vClearCoatTintParams\n , ${tintAtDistance}\n , ${isWebGPU ? \"uniforms.\" : \"\"}vClearCoatRefractionParams\n #ifdef CLEARCOAT_TINT_TEXTURE\n , ${tintTexture}\n #endif\n #endif\n #ifdef CLEARCOAT_BUMP\n , vec2${state.fSuffix}(0., 1.)\n , vec4${state.fSuffix}(${normalMapColor}, 0.)\n , ${uv}\n #if defined(${vTBNAvailable ? \"TANGENT\" : \"IGNORE\"}) && defined(NORMAL)\n , vTBN\n #else\n , ${isWebGPU ? \"uniforms.\" : \"\"}vClearCoatTangentSpaceParams\n #endif\n #ifdef OBJECTSPACE_NORMALMAP\n , normalMatrix\n #endif\n #endif\n #if defined(FORCENORMALFORWARD) && defined(NORMAL)\n , faceNormal\n #endif\n #ifdef REFLECTION\n , ${isWebGPU ? \"uniforms.\" : \"\"}${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._vReflectionMicrosurfaceInfosName}\n , ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._vReflectionInfosName}\n , ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock.reflectionColor}\n , ${isWebGPU ? \"uniforms.\" : \"\"}vLightingIntensity\n #ifdef ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._define3DName}\n , ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._cubeSamplerName} \n ${isWebGPU ? `, ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._cubeSamplerName}Sampler` : \"\"}\n #else\n , ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._2DSamplerName} \n ${isWebGPU ? `, ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._2DSamplerName}Sampler` : \"\"}\n #endif\n #ifndef LODBASEDMICROSFURACE\n #ifdef ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._define3DName}\n , ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._cubeSamplerName} \n ${isWebGPU ? `, ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._cubeSamplerName}Sampler` : \"\"}\n , ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._cubeSamplerName}\n ${isWebGPU ? `, ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._cubeSamplerName}Sampler` : \"\"}\n #else\n , ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._2DSamplerName}\n ${isWebGPU ? `, ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._2DSamplerName}Sampler` : \"\"}\n , ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._2DSamplerName}\n ${isWebGPU ? `, ${reflectionBlock === null || reflectionBlock === void 0 ? void 0 : reflectionBlock._2DSamplerName}Sampler` : \"\"} \n #endif\n #endif\n #endif\n #if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\n , (${state._generateTernary(\"1.\", \"-1.\", isWebGPU ? \"fragmentInputs.frontFacing\" : \"gl_FrontFacing\")})\n #endif\n );\n #else\n clearcoatOut.specularEnvironmentR0 = specularEnvironmentR0;\n #endif\\n`;\n return code;\n }\n _buildBlock(state) {\n this._scene = state.sharedData.scene;\n if (state.target === NodeMaterialBlockTargets.Fragment) {\n state.sharedData.bindableBlocks.push(this);\n state.sharedData.blocksWithDefines.push(this);\n this._tangentCorrectionFactorName = state._getFreeDefineName(\"tangentCorrectionFactor\");\n state._emitUniformFromString(this._tangentCorrectionFactorName, NodeMaterialBlockConnectionPointTypes.Float);\n }\n return this;\n }\n _dumpPropertiesCode() {\n let codeString = super._dumpPropertiesCode();\n codeString += `${this._codeVariableName}.remapF0OnInterfaceChange = ${this.remapF0OnInterfaceChange};\\n`;\n return codeString;\n }\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.remapF0OnInterfaceChange = this.remapF0OnInterfaceChange;\n return serializationObject;\n }\n _deserialize(serializationObject, scene, rootUrl) {\n var _serializationObject$;\n super._deserialize(serializationObject, scene, rootUrl);\n this.remapF0OnInterfaceChange = (_serializationObject$ = serializationObject.remapF0OnInterfaceChange) !== null && _serializationObject$ !== void 0 ? _serializationObject$ : true;\n }\n}\n__decorate([editableInPropertyPage(\"Remap F0 on interface change\", 0 /* PropertyTypeForEdition.Boolean */, \"ADVANCED\", {\n embedded: true\n})], ClearCoatBlock.prototype, \"remapF0OnInterfaceChange\", void 0);\nRegisterClass(\"BABYLON.ClearCoatBlock\", ClearCoatBlock);","map":{"version":3,"names":["__decorate","NodeMaterialBlock","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","RegisterClass","InputBlock","NodeMaterialConnectionPointCustomObject","PBRClearCoatConfiguration","editableInPropertyPage","TBNBlock","ClearCoatBlock","constructor","name","Fragment","_tangentCorrectionFactorName","remapF0OnInterfaceChange","_isUnique","registerInput","Float","Color3","Vector2","Vector4","AutoDetect","worldNormal","addExcludedConnectionPointFromAllowedTypes","Color4","Vector3","Object","VertexAndFragment","registerOutput","initialize","state","_excludeVariableName","getClassName","intensity","_inputs","roughness","indexOfRefraction","normalMapColor","uv","tintColor","tintAtDistance","tintThickness","worldTangent","TBN","clearcoat","_outputs","autoConfigure","isConnected","intensityInput","value","output","connectTo","prepareDefines","mesh","nodeMaterial","defines","setValue","connectInputBlock","_DefaultIndexOfRefraction","bind","effect","_this$indexOfRefracti","_this$indexOfRefracti2","a","b","f0","Math","pow","eta","setFloat4","mainPBRBlock","hasEndpoints","endpoints","ownerBlock","perturbedNormalBlock","perturbedNormal","connectedPoint","_scene","_mirroredCameraPosition","setFloat2","invertX","invertY","setFloat","getWorldMatrix","determinant","_generateTBNSpace","worldPositionVarName","worldNormalVarName","code","comments","isWebGPU","shaderLanguage","_emitExtension","tangentReplaceString","search","replace","compilationString","associatedVariableName","_declareLocalVar","_emitFunctionFromInclude","replaceStrings","GetCode","ccBlock","reflectionBlock","worldPosVarName","generateTBNSpace","vTBNAvailable","fSuffix","tintTexture","_emitUniformFromString","normalShading","_vReflectionMicrosurfaceInfosName","_vReflectionInfosName","reflectionColor","_define3DName","_cubeSamplerName","_2DSamplerName","_generateTernary","_buildBlock","sharedData","scene","target","bindableBlocks","push","blocksWithDefines","_getFreeDefineName","_dumpPropertiesCode","codeString","_codeVariableName","serialize","serializationObject","_deserialize","rootUrl","_serializationObject$","embedded","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/PBR/clearCoatBlock.js"],"sourcesContent":["import { __decorate } from \"../../../../tslib.es6.js\";\nimport { NodeMaterialBlock } from \"../../nodeMaterialBlock.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { InputBlock } from \"../Input/inputBlock.js\";\nimport { NodeMaterialConnectionPointCustomObject } from \"../../nodeMaterialConnectionPointCustomObject.js\";\nimport { PBRClearCoatConfiguration } from \"../../../PBR/pbrClearCoatConfiguration.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\nimport { TBNBlock } from \"../Fragment/TBNBlock.js\";\n/**\n * Block used to implement the clear coat module of the PBR material\n */\nexport class ClearCoatBlock extends NodeMaterialBlock {\n /**\n * Create a new ClearCoatBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Fragment);\n this._tangentCorrectionFactorName = \"\";\n /**\n * Defines if the F0 value should be remapped to account for the interface change in the material.\n */\n this.remapF0OnInterfaceChange = true;\n this._isUnique = true;\n this.registerInput(\"intensity\", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"roughness\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"indexOfRefraction\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"normalMapColor\", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"uv\", NodeMaterialBlockConnectionPointTypes.Vector2, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"tintColor\", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"tintAtDistance\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"tintThickness\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"worldTangent\", NodeMaterialBlockConnectionPointTypes.Vector4, true);\n this.registerInput(\"worldNormal\", NodeMaterialBlockConnectionPointTypes.AutoDetect, true);\n this.worldNormal.addExcludedConnectionPointFromAllowedTypes(NodeMaterialBlockConnectionPointTypes.Color4 | NodeMaterialBlockConnectionPointTypes.Vector4 | NodeMaterialBlockConnectionPointTypes.Vector3);\n this.registerInput(\"TBN\", NodeMaterialBlockConnectionPointTypes.Object, true, NodeMaterialBlockTargets.VertexAndFragment, new NodeMaterialConnectionPointCustomObject(\"TBN\", this, 0 /* NodeMaterialConnectionPointDirection.Input */, TBNBlock, \"TBNBlock\"));\n this.registerOutput(\"clearcoat\", NodeMaterialBlockConnectionPointTypes.Object, NodeMaterialBlockTargets.Fragment, new NodeMaterialConnectionPointCustomObject(\"clearcoat\", this, 1 /* NodeMaterialConnectionPointDirection.Output */, ClearCoatBlock, \"ClearCoatBlock\"));\n }\n /**\n * Initialize the block and prepare the context for build\n * @param state defines the state that will be used for the build\n */\n initialize(state) {\n state._excludeVariableName(\"clearcoatOut\");\n state._excludeVariableName(\"vClearCoatParams\");\n state._excludeVariableName(\"vClearCoatTintParams\");\n state._excludeVariableName(\"vClearCoatRefractionParams\");\n state._excludeVariableName(\"vClearCoatTangentSpaceParams\");\n state._excludeVariableName(\"vGeometricNormaClearCoatW\");\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ClearCoatBlock\";\n }\n /**\n * Gets the intensity input component\n */\n get intensity() {\n return this._inputs[0];\n }\n /**\n * Gets the roughness input component\n */\n get roughness() {\n return this._inputs[1];\n }\n /**\n * Gets the ior input component\n */\n get indexOfRefraction() {\n return this._inputs[2];\n }\n /**\n * Gets the bump texture input component\n */\n get normalMapColor() {\n return this._inputs[3];\n }\n /**\n * Gets the uv input component\n */\n get uv() {\n return this._inputs[4];\n }\n /**\n * Gets the tint color input component\n */\n get tintColor() {\n return this._inputs[5];\n }\n /**\n * Gets the tint \"at distance\" input component\n */\n get tintAtDistance() {\n return this._inputs[6];\n }\n /**\n * Gets the tint thickness input component\n */\n get tintThickness() {\n return this._inputs[7];\n }\n /**\n * Gets the world tangent input component\n */\n get worldTangent() {\n return this._inputs[8];\n }\n /**\n * Gets the world normal input component\n */\n get worldNormal() {\n return this._inputs[9];\n }\n /**\n * Gets the TBN input component\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n get TBN() {\n return this._inputs[10];\n }\n /**\n * Gets the clear coat object output component\n */\n get clearcoat() {\n return this._outputs[0];\n }\n autoConfigure() {\n if (!this.intensity.isConnected) {\n const intensityInput = new InputBlock(\"ClearCoat intensity\", NodeMaterialBlockTargets.Fragment, NodeMaterialBlockConnectionPointTypes.Float);\n intensityInput.value = 1;\n intensityInput.output.connectTo(this.intensity);\n }\n }\n prepareDefines(mesh, nodeMaterial, defines) {\n super.prepareDefines(mesh, nodeMaterial, defines);\n defines.setValue(\"CLEARCOAT\", true);\n defines.setValue(\"CLEARCOAT_TEXTURE\", false, true);\n defines.setValue(\"CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE\", true, true);\n defines.setValue(\"CLEARCOAT_TINT\", this.tintColor.isConnected || this.tintThickness.isConnected || this.tintAtDistance.isConnected, true);\n defines.setValue(\"CLEARCOAT_BUMP\", this.normalMapColor.isConnected, true);\n defines.setValue(\"CLEARCOAT_DEFAULTIOR\", this.indexOfRefraction.isConnected ? this.indexOfRefraction.connectInputBlock.value === PBRClearCoatConfiguration._DefaultIndexOfRefraction : true, true);\n defines.setValue(\"CLEARCOAT_REMAP_F0\", this.remapF0OnInterfaceChange, true);\n }\n bind(effect, nodeMaterial, mesh) {\n super.bind(effect, nodeMaterial, mesh);\n // Clear Coat Refraction params\n const indexOfRefraction = this.indexOfRefraction.connectInputBlock?.value ?? PBRClearCoatConfiguration._DefaultIndexOfRefraction;\n const a = 1 - indexOfRefraction;\n const b = 1 + indexOfRefraction;\n const f0 = Math.pow(-a / b, 2); // Schlicks approx: (ior1 - ior2) / (ior1 + ior2) where ior2 for air is close to vacuum = 1.\n const eta = 1 / indexOfRefraction;\n effect.setFloat4(\"vClearCoatRefractionParams\", f0, eta, a, b);\n // Clear Coat tangent space params\n const mainPBRBlock = this.clearcoat.hasEndpoints ? this.clearcoat.endpoints[0].ownerBlock : null;\n const perturbedNormalBlock = mainPBRBlock?.perturbedNormal.isConnected ? mainPBRBlock.perturbedNormal.connectedPoint.ownerBlock : null;\n if (this._scene._mirroredCameraPosition) {\n effect.setFloat2(\"vClearCoatTangentSpaceParams\", perturbedNormalBlock?.invertX ? 1.0 : -1.0, perturbedNormalBlock?.invertY ? 1.0 : -1.0);\n }\n else {\n effect.setFloat2(\"vClearCoatTangentSpaceParams\", perturbedNormalBlock?.invertX ? -1.0 : 1.0, perturbedNormalBlock?.invertY ? -1.0 : 1.0);\n }\n if (mesh) {\n effect.setFloat(this._tangentCorrectionFactorName, mesh.getWorldMatrix().determinant() < 0 ? -1 : 1);\n }\n }\n _generateTBNSpace(state, worldPositionVarName, worldNormalVarName) {\n let code = \"\";\n const comments = `//${this.name}`;\n const worldTangent = this.worldTangent;\n const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;\n if (!isWebGPU) {\n state._emitExtension(\"derivatives\", \"#extension GL_OES_standard_derivatives : enable\");\n }\n const tangentReplaceString = { search: /defined\\(TANGENT\\)/g, replace: worldTangent.isConnected ? \"defined(TANGENT)\" : \"defined(IGNORE)\" };\n const TBN = this.TBN;\n if (TBN.isConnected) {\n state.compilationString += `\r\n #ifdef TBNBLOCK\r\n ${isWebGPU ? \"var TBN\" : \"mat3 TBN\"} = ${TBN.associatedVariableName};\r\n #endif\r\n `;\n }\n else if (worldTangent.isConnected) {\n code += `${state._declareLocalVar(\"tbnNormal\", NodeMaterialBlockConnectionPointTypes.Vector3)} = normalize(${worldNormalVarName}.xyz);\\n`;\n code += `${state._declareLocalVar(\"tbnTangent\", NodeMaterialBlockConnectionPointTypes.Vector3)} = normalize(${worldTangent.associatedVariableName}.xyz);\\n`;\n code += `${state._declareLocalVar(\"tbnBitangent\", NodeMaterialBlockConnectionPointTypes.Vector3)} = cross(tbnNormal, tbnTangent) * ${this._tangentCorrectionFactorName};\\n`;\n code += `${isWebGPU ? \"var vTBN\" : \"mat3 vTBN\"} = ${isWebGPU ? \"mat3x3f\" : \"mat3\"}(tbnTangent, tbnBitangent, tbnNormal);\\n`;\n }\n state._emitFunctionFromInclude(\"bumpFragmentMainFunctions\", comments, {\n replaceStrings: [tangentReplaceString],\n });\n return code;\n }\n /**\n * Gets the main code of the block (fragment side)\n * @param state current state of the node material building\n * @param ccBlock instance of a ClearCoatBlock or null if the code must be generated without an active clear coat module\n * @param reflectionBlock instance of a ReflectionBlock null if the code must be generated without an active reflection module\n * @param worldPosVarName name of the variable holding the world position\n * @param generateTBNSpace if true, the code needed to create the TBN coordinate space is generated\n * @param vTBNAvailable indicate that the vTBN variable is already existing because it has already been generated by another block (PerturbNormal or Anisotropy)\n * @param worldNormalVarName name of the variable holding the world normal\n * @returns the shader code\n */\n static GetCode(state, ccBlock, reflectionBlock, worldPosVarName, generateTBNSpace, vTBNAvailable, worldNormalVarName) {\n let code = \"\";\n const intensity = ccBlock?.intensity.isConnected ? ccBlock.intensity.associatedVariableName : \"1.\";\n const roughness = ccBlock?.roughness.isConnected ? ccBlock.roughness.associatedVariableName : \"0.\";\n const normalMapColor = ccBlock?.normalMapColor.isConnected ? ccBlock.normalMapColor.associatedVariableName : `vec3${state.fSuffix}(0.)`;\n const uv = ccBlock?.uv.isConnected ? ccBlock.uv.associatedVariableName : `vec2${state.fSuffix}(0.)`;\n const tintColor = ccBlock?.tintColor.isConnected ? ccBlock.tintColor.associatedVariableName : `vec3${state.fSuffix}(1.)`;\n const tintThickness = ccBlock?.tintThickness.isConnected ? ccBlock.tintThickness.associatedVariableName : \"1.\";\n const tintAtDistance = ccBlock?.tintAtDistance.isConnected ? ccBlock.tintAtDistance.associatedVariableName : \"1.\";\n const tintTexture = `vec4${state.fSuffix}(0.)`;\n if (ccBlock) {\n state._emitUniformFromString(\"vClearCoatRefractionParams\", NodeMaterialBlockConnectionPointTypes.Vector4);\n state._emitUniformFromString(\"vClearCoatTangentSpaceParams\", NodeMaterialBlockConnectionPointTypes.Vector2);\n const normalShading = ccBlock.worldNormal;\n code += `${state._declareLocalVar(\"vGeometricNormaClearCoatW\", NodeMaterialBlockConnectionPointTypes.Vector3)} = ${normalShading.isConnected ? \"normalize(\" + normalShading.associatedVariableName + \".xyz)\" : \"geometricNormalW\"};\\n`;\n }\n else {\n code += `${state._declareLocalVar(\"vGeometricNormaClearCoatW\", NodeMaterialBlockConnectionPointTypes.Vector3)} = geometricNormalW;\\n`;\n }\n if (generateTBNSpace && ccBlock) {\n code += ccBlock._generateTBNSpace(state, worldPosVarName, worldNormalVarName);\n vTBNAvailable = ccBlock.worldTangent.isConnected;\n }\n const isWebGPU = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;\n code += `${isWebGPU ? \"var clearcoatOut: clearcoatOutParams\" : \"clearcoatOutParams clearcoatOut\"};\r\n\r\n #ifdef CLEARCOAT\r\n ${state._declareLocalVar(\"vClearCoatParams\", NodeMaterialBlockConnectionPointTypes.Vector2)} = vec2${state.fSuffix}(${intensity}, ${roughness});\r\n ${state._declareLocalVar(\"vClearCoatTintParams\", NodeMaterialBlockConnectionPointTypes.Vector4)} = vec4${state.fSuffix}(${tintColor}, ${tintThickness});\r\n\r\n clearcoatOut = clearcoatBlock(\r\n ${worldPosVarName}.xyz\r\n , vGeometricNormaClearCoatW\r\n , viewDirectionW\r\n , vClearCoatParams\r\n , specularEnvironmentR0\r\n #ifdef CLEARCOAT_TEXTURE\r\n , vec2${state.fSuffix}(0.)\r\n #endif\r\n #ifdef CLEARCOAT_TINT\r\n , vClearCoatTintParams\r\n , ${tintAtDistance}\r\n , ${isWebGPU ? \"uniforms.\" : \"\"}vClearCoatRefractionParams\r\n #ifdef CLEARCOAT_TINT_TEXTURE\r\n , ${tintTexture}\r\n #endif\r\n #endif\r\n #ifdef CLEARCOAT_BUMP\r\n , vec2${state.fSuffix}(0., 1.)\r\n , vec4${state.fSuffix}(${normalMapColor}, 0.)\r\n , ${uv}\r\n #if defined(${vTBNAvailable ? \"TANGENT\" : \"IGNORE\"}) && defined(NORMAL)\r\n , vTBN\r\n #else\r\n , ${isWebGPU ? \"uniforms.\" : \"\"}vClearCoatTangentSpaceParams\r\n #endif\r\n #ifdef OBJECTSPACE_NORMALMAP\r\n , normalMatrix\r\n #endif\r\n #endif\r\n #if defined(FORCENORMALFORWARD) && defined(NORMAL)\r\n , faceNormal\r\n #endif\r\n #ifdef REFLECTION\r\n , ${isWebGPU ? \"uniforms.\" : \"\"}${reflectionBlock?._vReflectionMicrosurfaceInfosName}\r\n , ${reflectionBlock?._vReflectionInfosName}\r\n , ${reflectionBlock?.reflectionColor}\r\n , ${isWebGPU ? \"uniforms.\" : \"\"}vLightingIntensity\r\n #ifdef ${reflectionBlock?._define3DName}\r\n , ${reflectionBlock?._cubeSamplerName} \r\n ${isWebGPU ? `, ${reflectionBlock?._cubeSamplerName}Sampler` : \"\"}\r\n #else\r\n , ${reflectionBlock?._2DSamplerName} \r\n ${isWebGPU ? `, ${reflectionBlock?._2DSamplerName}Sampler` : \"\"}\r\n #endif\r\n #ifndef LODBASEDMICROSFURACE\r\n #ifdef ${reflectionBlock?._define3DName}\r\n , ${reflectionBlock?._cubeSamplerName} \r\n ${isWebGPU ? `, ${reflectionBlock?._cubeSamplerName}Sampler` : \"\"}\r\n , ${reflectionBlock?._cubeSamplerName}\r\n ${isWebGPU ? `, ${reflectionBlock?._cubeSamplerName}Sampler` : \"\"}\r\n #else\r\n , ${reflectionBlock?._2DSamplerName}\r\n ${isWebGPU ? `, ${reflectionBlock?._2DSamplerName}Sampler` : \"\"}\r\n , ${reflectionBlock?._2DSamplerName}\r\n ${isWebGPU ? `, ${reflectionBlock?._2DSamplerName}Sampler` : \"\"} \r\n #endif\r\n #endif\r\n #endif\r\n #if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\r\n , (${state._generateTernary(\"1.\", \"-1.\", isWebGPU ? \"fragmentInputs.frontFacing\" : \"gl_FrontFacing\")})\r\n #endif\r\n );\r\n #else\r\n clearcoatOut.specularEnvironmentR0 = specularEnvironmentR0;\r\n #endif\\n`;\n return code;\n }\n _buildBlock(state) {\n this._scene = state.sharedData.scene;\n if (state.target === NodeMaterialBlockTargets.Fragment) {\n state.sharedData.bindableBlocks.push(this);\n state.sharedData.blocksWithDefines.push(this);\n this._tangentCorrectionFactorName = state._getFreeDefineName(\"tangentCorrectionFactor\");\n state._emitUniformFromString(this._tangentCorrectionFactorName, NodeMaterialBlockConnectionPointTypes.Float);\n }\n return this;\n }\n _dumpPropertiesCode() {\n let codeString = super._dumpPropertiesCode();\n codeString += `${this._codeVariableName}.remapF0OnInterfaceChange = ${this.remapF0OnInterfaceChange};\\n`;\n return codeString;\n }\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.remapF0OnInterfaceChange = this.remapF0OnInterfaceChange;\n return serializationObject;\n }\n _deserialize(serializationObject, scene, rootUrl) {\n super._deserialize(serializationObject, scene, rootUrl);\n this.remapF0OnInterfaceChange = serializationObject.remapF0OnInterfaceChange ?? true;\n }\n}\n__decorate([\n editableInPropertyPage(\"Remap F0 on interface change\", 0 /* PropertyTypeForEdition.Boolean */, \"ADVANCED\", { embedded: true })\n], ClearCoatBlock.prototype, \"remapF0OnInterfaceChange\", void 0);\nRegisterClass(\"BABYLON.ClearCoatBlock\", ClearCoatBlock);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,qCAAqC,QAAQ,sDAAsD;AAC5G,SAASC,wBAAwB,QAAQ,yCAAyC;AAClF,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,UAAU,QAAQ,wBAAwB;AACnD,SAASC,uCAAuC,QAAQ,kDAAkD;AAC1G,SAASC,yBAAyB,QAAQ,2CAA2C;AACrF,SAASC,sBAAsB,QAAQ,yCAAyC;AAChF,SAASC,QAAQ,QAAQ,yBAAyB;AAClD;AACA;AACA;AACA,OAAO,MAAMC,cAAc,SAAST,iBAAiB,CAAC;EAClD;AACJ;AACA;AACA;EACIU,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,EAAET,wBAAwB,CAACU,QAAQ,CAAC;IAC9C,IAAI,CAACC,4BAA4B,GAAG,EAAE;IACtC;AACR;AACA;IACQ,IAAI,CAACC,wBAAwB,GAAG,IAAI;IACpC,IAAI,CA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