1d912f3e57261bfd46bb0346616974cf9d3672abedf80717910d7e8fa70c524d.json 53 KB

1
  1. {"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { __decorate } from \"../../../../tslib.es6.js\";\nimport { NodeMaterialBlock } from \"../../nodeMaterialBlock.js\";\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialSystemValues } from \"../../Enums/nodeMaterialSystemValues.js\";\nimport { InputBlock } from \"../Input/inputBlock.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\nimport { Logger } from \"../../../../Misc/logger.js\";\nimport { BindLight, BindLights, PrepareDefinesForLight, PrepareDefinesForLights, PrepareUniformsAndSamplersForLight } from \"../../../materialHelper.functions.js\";\n/**\n * Block used to add light in the fragment shader\n */\nexport class LightBlock extends NodeMaterialBlock {\n static _OnGenerateOnlyFragmentCodeChanged(block, _propertyName) {\n const that = block;\n if (that.worldPosition.isConnected) {\n that.generateOnlyFragmentCode = !that.generateOnlyFragmentCode;\n Logger.Error(\"The worldPosition input must not be connected to be able to switch!\");\n return false;\n }\n that._setTarget();\n return true;\n }\n _setTarget() {\n this._setInitialTarget(this.generateOnlyFragmentCode ? NodeMaterialBlockTargets.Fragment : NodeMaterialBlockTargets.VertexAndFragment);\n this.getInputByName(\"worldPosition\").target = this.generateOnlyFragmentCode ? NodeMaterialBlockTargets.Fragment : NodeMaterialBlockTargets.Vertex;\n }\n /**\n * Create a new LightBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.VertexAndFragment);\n this._lightId = 0;\n /** Indicates that no code should be generated in the vertex shader. Can be useful in some specific circumstances (like when doing ray marching for eg) */\n this.generateOnlyFragmentCode = false;\n this._isUnique = true;\n this.registerInput(\"worldPosition\", NodeMaterialBlockConnectionPointTypes.Vector4, false, NodeMaterialBlockTargets.Vertex);\n this.registerInput(\"worldNormal\", NodeMaterialBlockConnectionPointTypes.Vector4, false, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"cameraPosition\", NodeMaterialBlockConnectionPointTypes.Vector3, false, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"glossiness\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"glossPower\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"diffuseColor\", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"specularColor\", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"view\", NodeMaterialBlockConnectionPointTypes.Matrix, true);\n this.registerOutput(\"diffuseOutput\", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"specularOutput\", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"shadow\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"LightBlock\";\n }\n /**\n * Gets the world position input component\n */\n get worldPosition() {\n return this._inputs[0];\n }\n /**\n * Gets the world normal input component\n */\n get worldNormal() {\n return this._inputs[1];\n }\n /**\n * Gets the camera (or eye) position component\n */\n get cameraPosition() {\n return this._inputs[2];\n }\n /**\n * Gets the glossiness component\n */\n get glossiness() {\n return this._inputs[3];\n }\n /**\n * Gets the glossiness power component\n */\n get glossPower() {\n return this._inputs[4];\n }\n /**\n * Gets the diffuse color component\n */\n get diffuseColor() {\n return this._inputs[5];\n }\n /**\n * Gets the specular color component\n */\n get specularColor() {\n return this._inputs[6];\n }\n /**\n * Gets the view matrix component\n */\n get view() {\n return this._inputs[7];\n }\n /**\n * Gets the diffuse output component\n */\n get diffuseOutput() {\n return this._outputs[0];\n }\n /**\n * Gets the specular output component\n */\n get specularOutput() {\n return this._outputs[1];\n }\n /**\n * Gets the shadow output component\n */\n get shadow() {\n return this._outputs[2];\n }\n initialize(state) {\n this._initShaderSourceAsync(state.shaderLanguage);\n }\n _initShaderSourceAsync(shaderLanguage) {\n var _this = this;\n return _asyncToGenerator(function* () {\n _this._codeIsReady = false;\n if (shaderLanguage === 1 /* ShaderLanguage.WGSL */) {\n yield Promise.all([import(\"../../../../ShadersWGSL/ShadersInclude/lightFragment.js\"), import(\"../../../../ShadersWGSL/ShadersInclude/lightUboDeclaration.js\"), import(\"../../../../ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js\"), import(\"../../../../ShadersWGSL/ShadersInclude/helperFunctions.js\"), import(\"../../../../ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js\"), import(\"../../../../ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js\"), import(\"../../../../ShadersWGSL/ShadersInclude/shadowsVertex.js\")]);\n } else {\n yield Promise.all([import(\"../../../../Shaders/ShadersInclude/lightFragmentDeclaration.js\"), import(\"../../../../Shaders/ShadersInclude/lightFragment.js\"), import(\"../../../../Shaders/ShadersInclude/lightUboDeclaration.js\"), import(\"../../../../Shaders/ShadersInclude/lightVxUboDeclaration.js\"), import(\"../../../../Shaders/ShadersInclude/lightVxFragmentDeclaration.js\"), import(\"../../../../Shaders/ShadersInclude/helperFunctions.js\"), import(\"../../../../Shaders/ShadersInclude/lightsFragmentFunctions.js\"), import(\"../../../../Shaders/ShadersInclude/shadowsFragmentFunctions.js\"), import(\"../../../../Shaders/ShadersInclude/shadowsVertex.js\")]);\n }\n _this._codeIsReady = true;\n _this.onCodeIsReadyObservable.notifyObservers(_this);\n })();\n }\n autoConfigure(material, additionalFilteringInfo = () => true) {\n if (!this.cameraPosition.isConnected) {\n let cameraPositionInput = material.getInputBlockByPredicate(b => b.systemValue === NodeMaterialSystemValues.CameraPosition && additionalFilteringInfo(b));\n if (!cameraPositionInput) {\n cameraPositionInput = new InputBlock(\"cameraPosition\");\n cameraPositionInput.setAsSystemValue(NodeMaterialSystemValues.CameraPosition);\n }\n cameraPositionInput.output.connectTo(this.cameraPosition);\n }\n }\n prepareDefines(mesh, nodeMaterial, defines) {\n if (!defines._areLightsDirty) {\n return;\n }\n const scene = mesh.getScene();\n if (!this.light) {\n PrepareDefinesForLights(scene, mesh, defines, true, nodeMaterial.maxSimultaneousLights);\n } else {\n const state = {\n needNormals: false,\n needRebuild: false,\n lightmapMode: false,\n shadowEnabled: false,\n specularEnabled: false\n };\n PrepareDefinesForLight(scene, mesh, this.light, this._lightId, defines, true, state);\n if (state.needRebuild) {\n defines.rebuild();\n }\n }\n }\n updateUniformsAndSamples(state, nodeMaterial, defines, uniformBuffers) {\n for (let lightIndex = 0; lightIndex < nodeMaterial.maxSimultaneousLights; lightIndex++) {\n if (!defines[\"LIGHT\" + lightIndex]) {\n break;\n }\n const onlyUpdateBuffersList = state.uniforms.indexOf(\"vLightData\" + lightIndex) >= 0;\n PrepareUniformsAndSamplersForLight(lightIndex, state.uniforms, state.samplers, defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex], uniformBuffers, onlyUpdateBuffersList);\n }\n }\n bind(effect, nodeMaterial, mesh) {\n if (!mesh) {\n return;\n }\n const scene = mesh.getScene();\n if (!this.light) {\n BindLights(scene, mesh, effect, true, nodeMaterial.maxSimultaneousLights);\n } else {\n BindLight(this.light, this._lightId, scene, effect, true);\n }\n }\n _injectVertexCode(state) {\n const worldPos = this.worldPosition;\n const comments = `//${this.name}`;\n // Declaration\n if (!this.light) {\n // Emit for all lights\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightVxUboDeclaration\" : \"lightVxFragmentDeclaration\", comments, {\n repeatKey: \"maxSimultaneousLights\"\n });\n this._lightId = 0;\n state.sharedData.dynamicUniformBlocks.push(this);\n } else {\n this._lightId = (state.counters[\"lightCounter\"] !== undefined ? state.counters[\"lightCounter\"] : -1) + 1;\n state.counters[\"lightCounter\"] = this._lightId;\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightVxUboDeclaration\" : \"lightVxFragmentDeclaration\", comments, {\n replaceStrings: [{\n search: /{X}/g,\n replace: this._lightId.toString()\n }]\n }, this._lightId.toString());\n }\n // Inject code in vertex\n const worldPosVaryingName = \"v_\" + worldPos.associatedVariableName;\n if (state._emitVaryingFromString(worldPosVaryingName, NodeMaterialBlockConnectionPointTypes.Vector4)) {\n state.compilationString += (state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? \"vertexOutputs.\" : \"\") + `${worldPosVaryingName} = ${worldPos.associatedVariableName};\\n`;\n }\n if (this.light) {\n state.compilationString += state._emitCodeFromInclude(\"shadowsVertex\", comments, {\n replaceStrings: [{\n search: /{X}/g,\n replace: this._lightId.toString()\n }, {\n search: /worldPos/g,\n replace: worldPos.associatedVariableName\n }]\n });\n } else {\n state.compilationString += `${state._declareLocalVar(\"worldPos\", NodeMaterialBlockConnectionPointTypes.Vector4)} = ${worldPos.associatedVariableName};\\n`;\n if (this.view.isConnected) {\n state.compilationString += `${state._declareLocalVar(\"view\", NodeMaterialBlockConnectionPointTypes.Matrix)} = ${this.view.associatedVariableName};\\n`;\n }\n state.compilationString += state._emitCodeFromInclude(\"shadowsVertex\", comments, {\n repeatKey: \"maxSimultaneousLights\"\n });\n }\n }\n _injectUBODeclaration(state) {\n const comments = `//${this.name}`;\n if (!this.light) {\n // Emit for all lights\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightUboDeclaration\" : \"lightFragmentDeclaration\", comments, {\n repeatKey: \"maxSimultaneousLights\",\n substitutionVars: this.generateOnlyFragmentCode ? \"varying,\" : undefined\n });\n } else {\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightUboDeclaration\" : \"lightFragmentDeclaration\", comments, {\n replaceStrings: [{\n search: /{X}/g,\n replace: this._lightId.toString()\n }]\n }, this._lightId.toString());\n }\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const isWGSL = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;\n const addF = isWGSL ? \"f\" : \"\";\n const comments = `//${this.name}`;\n if (state.target !== NodeMaterialBlockTargets.Fragment) {\n // Vertex\n this._injectVertexCode(state);\n return;\n }\n if (this.generateOnlyFragmentCode) {\n state.sharedData.dynamicUniformBlocks.push(this);\n }\n // Fragment\n const accessor = isWGSL ? \"fragmentInputs.\" : \"\";\n state.sharedData.forcedBindableBlocks.push(this);\n state.sharedData.blocksWithDefines.push(this);\n const worldPos = this.worldPosition;\n let worldPosVariableName = worldPos.associatedVariableName;\n if (this.generateOnlyFragmentCode) {\n worldPosVariableName = state._getFreeVariableName(\"globalWorldPos\");\n state._emitFunction(\"light_globalworldpos\", `${state._declareLocalVar(worldPosVariableName, NodeMaterialBlockConnectionPointTypes.Vector3)};\\n`, comments);\n state.compilationString += `${worldPosVariableName} = ${worldPos.associatedVariableName}.xyz;\\n`;\n state.compilationString += state._emitCodeFromInclude(\"shadowsVertex\", comments, {\n repeatKey: \"maxSimultaneousLights\",\n substitutionVars: this.generateOnlyFragmentCode ? `worldPos,${worldPos.associatedVariableName}` : undefined\n });\n } else {\n worldPosVariableName = accessor + \"v_\" + worldPosVariableName + \".xyz\";\n }\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\n let replaceString = {\n search: /vPositionW/g,\n replace: worldPosVariableName\n };\n if (isWGSL) {\n replaceString = {\n search: /fragmentInputs\\.vPositionW/g,\n replace: worldPosVariableName\n };\n }\n state._emitFunctionFromInclude(\"lightsFragmentFunctions\", comments, {\n replaceStrings: [replaceString]\n });\n state._emitFunctionFromInclude(\"shadowsFragmentFunctions\", comments, {\n replaceStrings: [replaceString]\n });\n this._injectUBODeclaration(state);\n // Code\n if (this._lightId === 0) {\n if (state._registerTempVariable(\"viewDirectionW\")) {\n state.compilationString += `${state._declareLocalVar(\"viewDirectionW\", NodeMaterialBlockConnectionPointTypes.Vector3)} = normalize(${this.cameraPosition.associatedVariableName} - ${worldPosVariableName});\\n`;\n }\n state.compilationString += isWGSL ? `var info: lightingInfo;\\n` : `lightingInfo info;\\n`;\n state.compilationString += `${state._declareLocalVar(\"shadow\", NodeMaterialBlockConnectionPointTypes.Float)} = 1.;\\n`;\n state.compilationString += `${state._declareLocalVar(\"aggShadow\", NodeMaterialBlockConnectionPointTypes.Float)} = 0.;\\n`;\n state.compilationString += `${state._declareLocalVar(\"numLights\", NodeMaterialBlockConnectionPointTypes.Float)} = 0.;\\n`;\n state.compilationString += `${state._declareLocalVar(\"glossiness\", NodeMaterialBlockConnectionPointTypes.Float)} = ${this.glossiness.isConnected ? this.glossiness.associatedVariableName : \"1.0\"} * ${this.glossPower.isConnected ? this.glossPower.associatedVariableName : \"1024.0\"};\\n`;\n state.compilationString += `${state._declareLocalVar(\"diffuseBase\", NodeMaterialBlockConnectionPointTypes.Vector3)} = vec3${addF}(0., 0., 0.);\\n`;\n state.compilationString += `${state._declareLocalVar(\"specularBase\", NodeMaterialBlockConnectionPointTypes.Vector3)} = vec3${addF}(0., 0., 0.);\\n`;\n state.compilationString += `${state._declareLocalVar(\"normalW\", NodeMaterialBlockConnectionPointTypes.Vector3)} = ${this.worldNormal.associatedVariableName}.xyz;\\n`;\n }\n if (this.light) {\n let replaceString = {\n search: /vPositionW/g,\n replace: worldPosVariableName + \".xyz\"\n };\n if (isWGSL) {\n replaceString = {\n search: /fragmentInputs\\.vPositionW/g,\n replace: worldPosVariableName + \".xyz\"\n };\n }\n state.compilationString += state._emitCodeFromInclude(\"lightFragment\", comments, {\n replaceStrings: [{\n search: /{X}/g,\n replace: this._lightId.toString()\n }, replaceString]\n });\n } else {\n let substitutionVars = `vPositionW,${worldPosVariableName}.xyz`;\n if (isWGSL) {\n substitutionVars = `fragmentInputs.vPositionW,${worldPosVariableName}.xyz`;\n }\n state.compilationString += state._emitCodeFromInclude(\"lightFragment\", comments, {\n repeatKey: \"maxSimultaneousLights\",\n substitutionVars: substitutionVars\n });\n }\n if (this._lightId === 0) {\n state.compilationString += `aggShadow = aggShadow / numLights;\\n`;\n }\n const diffuseOutput = this.diffuseOutput;\n const specularOutput = this.specularOutput;\n state.compilationString += state._declareOutput(diffuseOutput) + ` = diffuseBase${this.diffuseColor.isConnected ? \" * \" + this.diffuseColor.associatedVariableName : \"\"};\\n`;\n if (specularOutput.hasEndpoints) {\n state.compilationString += state._declareOutput(specularOutput) + ` = specularBase${this.specularColor.isConnected ? \" * \" + this.specularColor.associatedVariableName : \"\"};\\n`;\n }\n if (this.shadow.hasEndpoints) {\n state.compilationString += state._declareOutput(this.shadow) + ` = aggShadow;\\n`;\n }\n return this;\n }\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.generateOnlyFragmentCode = this.generateOnlyFragmentCode;\n if (this.light) {\n serializationObject.lightId = this.light.id;\n }\n return serializationObject;\n }\n _deserialize(serializationObject, scene, rootUrl) {\n super._deserialize(serializationObject, scene, rootUrl);\n if (serializationObject.lightId) {\n this.light = scene.getLightById(serializationObject.lightId);\n }\n this.generateOnlyFragmentCode = serializationObject.generateOnlyFragmentCode;\n this._setTarget();\n }\n}\n__decorate([editableInPropertyPage(\"Generate only fragment code\", 0 /* PropertyTypeForEdition.Boolean */, \"ADVANCED\", {\n notifiers: {\n rebuild: true,\n update: true,\n onValidation: LightBlock._OnGenerateOnlyFragmentCodeChanged\n }\n})], LightBlock.prototype, \"generateOnlyFragmentCode\", void 0);\nRegisterClass(\"BABYLON.LightBlock\", LightBlock);","map":{"version":3,"names":["__decorate","NodeMaterialBlock","NodeMaterialBlockTargets","NodeMaterialBlockConnectionPointTypes","NodeMaterialSystemValues","InputBlock","RegisterClass","editableInPropertyPage","Logger","BindLight","BindLights","PrepareDefinesForLight","PrepareDefinesForLights","PrepareUniformsAndSamplersForLight","LightBlock","_OnGenerateOnlyFragmentCodeChanged","block","_propertyName","that","worldPosition","isConnected","generateOnlyFragmentCode","Error","_setTarget","_setInitialTarget","Fragment","VertexAndFragment","getInputByName","target","Vertex","constructor","name","_lightId","_isUnique","registerInput","Vector4","Vector3","Float","Color3","Matrix","registerOutput","getClassName","_inputs","worldNormal","cameraPosition","glossiness","glossPower","diffuseColor","specularColor","view","diffuseOutput","_outputs","specularOutput","shadow","initialize","state","_initShaderSourceAsync","shaderLanguage","_this","_asyncToGenerator","_codeIsReady","Promise","all","onCodeIsReadyObservable","notifyObservers","autoConfigure","material","additionalFilteringInfo","cameraPositionInput","getInputBlockByPredicate","b","systemValue","CameraPosition","setAsSystemValue","output","connectTo","prepareDefines","mesh","nodeMaterial","defines","_areLightsDirty","scene","getScene","light","maxSimultaneousLights","needNormals","needRebuild","lightmapMode","shadowEnabled","specularEnabled","rebuild","updateUniformsAndSamples","uniformBuffers","lightIndex","onlyUpdateBuffersList","uniforms","indexOf","samplers","bind","effect","_injectVertexCode","worldPos","comments","_emitFunctionFromInclude","supportUniformBuffers","repeatKey","sharedData","dynamicUniformBlocks","push","counters","undefined","replaceStrings","search","replace","toString","worldPosVaryingName","associatedVariableName","_emitVaryingFromString","compilationString","_emitCodeFromInclude","_declareLocalVar","_injectUBODeclaration","substitutionVars","_buildBlock","isWGSL","addF","accessor","forcedBindableBlocks","blocksWithDefines","worldPosVariableName","_getFreeVariableName","_emitFunction","replaceString","_registerTempVariable","_declareOutput","hasEndpoints","serialize","serializationObject","lightId","id","_deserialize","rootUrl","getLightById","notifiers","update","onValidation","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/Dual/lightBlock.js"],"sourcesContent":["import { __decorate } from \"../../../../tslib.es6.js\";\nimport { NodeMaterialBlock } from \"../../nodeMaterialBlock.js\";\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialSystemValues } from \"../../Enums/nodeMaterialSystemValues.js\";\nimport { InputBlock } from \"../Input/inputBlock.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\nimport { Logger } from \"../../../../Misc/logger.js\";\nimport { BindLight, BindLights, PrepareDefinesForLight, PrepareDefinesForLights, PrepareUniformsAndSamplersForLight } from \"../../../materialHelper.functions.js\";\n/**\n * Block used to add light in the fragment shader\n */\nexport class LightBlock extends NodeMaterialBlock {\n static _OnGenerateOnlyFragmentCodeChanged(block, _propertyName) {\n const that = block;\n if (that.worldPosition.isConnected) {\n that.generateOnlyFragmentCode = !that.generateOnlyFragmentCode;\n Logger.Error(\"The worldPosition input must not be connected to be able to switch!\");\n return false;\n }\n that._setTarget();\n return true;\n }\n _setTarget() {\n this._setInitialTarget(this.generateOnlyFragmentCode ? NodeMaterialBlockTargets.Fragment : NodeMaterialBlockTargets.VertexAndFragment);\n this.getInputByName(\"worldPosition\").target = this.generateOnlyFragmentCode ? NodeMaterialBlockTargets.Fragment : NodeMaterialBlockTargets.Vertex;\n }\n /**\n * Create a new LightBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.VertexAndFragment);\n this._lightId = 0;\n /** Indicates that no code should be generated in the vertex shader. Can be useful in some specific circumstances (like when doing ray marching for eg) */\n this.generateOnlyFragmentCode = false;\n this._isUnique = true;\n this.registerInput(\"worldPosition\", NodeMaterialBlockConnectionPointTypes.Vector4, false, NodeMaterialBlockTargets.Vertex);\n this.registerInput(\"worldNormal\", NodeMaterialBlockConnectionPointTypes.Vector4, false, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"cameraPosition\", NodeMaterialBlockConnectionPointTypes.Vector3, false, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"glossiness\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"glossPower\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"diffuseColor\", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"specularColor\", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"view\", NodeMaterialBlockConnectionPointTypes.Matrix, true);\n this.registerOutput(\"diffuseOutput\", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"specularOutput\", NodeMaterialBlockConnectionPointTypes.Color3, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"shadow\", NodeMaterialBlockConnectionPointTypes.Float, NodeMaterialBlockTargets.Fragment);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"LightBlock\";\n }\n /**\n * Gets the world position input component\n */\n get worldPosition() {\n return this._inputs[0];\n }\n /**\n * Gets the world normal input component\n */\n get worldNormal() {\n return this._inputs[1];\n }\n /**\n * Gets the camera (or eye) position component\n */\n get cameraPosition() {\n return this._inputs[2];\n }\n /**\n * Gets the glossiness component\n */\n get glossiness() {\n return this._inputs[3];\n }\n /**\n * Gets the glossiness power component\n */\n get glossPower() {\n return this._inputs[4];\n }\n /**\n * Gets the diffuse color component\n */\n get diffuseColor() {\n return this._inputs[5];\n }\n /**\n * Gets the specular color component\n */\n get specularColor() {\n return this._inputs[6];\n }\n /**\n * Gets the view matrix component\n */\n get view() {\n return this._inputs[7];\n }\n /**\n * Gets the diffuse output component\n */\n get diffuseOutput() {\n return this._outputs[0];\n }\n /**\n * Gets the specular output component\n */\n get specularOutput() {\n return this._outputs[1];\n }\n /**\n * Gets the shadow output component\n */\n get shadow() {\n return this._outputs[2];\n }\n initialize(state) {\n this._initShaderSourceAsync(state.shaderLanguage);\n }\n async _initShaderSourceAsync(shaderLanguage) {\n this._codeIsReady = false;\n if (shaderLanguage === 1 /* ShaderLanguage.WGSL */) {\n await Promise.all([\n import(\"../../../../ShadersWGSL/ShadersInclude/lightFragment.js\"),\n import(\"../../../../ShadersWGSL/ShadersInclude/lightUboDeclaration.js\"),\n import(\"../../../../ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js\"),\n import(\"../../../../ShadersWGSL/ShadersInclude/helperFunctions.js\"),\n import(\"../../../../ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js\"),\n import(\"../../../../ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js\"),\n import(\"../../../../ShadersWGSL/ShadersInclude/shadowsVertex.js\"),\n ]);\n }\n else {\n await Promise.all([\n import(\"../../../../Shaders/ShadersInclude/lightFragmentDeclaration.js\"),\n import(\"../../../../Shaders/ShadersInclude/lightFragment.js\"),\n import(\"../../../../Shaders/ShadersInclude/lightUboDeclaration.js\"),\n import(\"../../../../Shaders/ShadersInclude/lightVxUboDeclaration.js\"),\n import(\"../../../../Shaders/ShadersInclude/lightVxFragmentDeclaration.js\"),\n import(\"../../../../Shaders/ShadersInclude/helperFunctions.js\"),\n import(\"../../../../Shaders/ShadersInclude/lightsFragmentFunctions.js\"),\n import(\"../../../../Shaders/ShadersInclude/shadowsFragmentFunctions.js\"),\n import(\"../../../../Shaders/ShadersInclude/shadowsVertex.js\"),\n ]);\n }\n this._codeIsReady = true;\n this.onCodeIsReadyObservable.notifyObservers(this);\n }\n autoConfigure(material, additionalFilteringInfo = () => true) {\n if (!this.cameraPosition.isConnected) {\n let cameraPositionInput = material.getInputBlockByPredicate((b) => b.systemValue === NodeMaterialSystemValues.CameraPosition && additionalFilteringInfo(b));\n if (!cameraPositionInput) {\n cameraPositionInput = new InputBlock(\"cameraPosition\");\n cameraPositionInput.setAsSystemValue(NodeMaterialSystemValues.CameraPosition);\n }\n cameraPositionInput.output.connectTo(this.cameraPosition);\n }\n }\n prepareDefines(mesh, nodeMaterial, defines) {\n if (!defines._areLightsDirty) {\n return;\n }\n const scene = mesh.getScene();\n if (!this.light) {\n PrepareDefinesForLights(scene, mesh, defines, true, nodeMaterial.maxSimultaneousLights);\n }\n else {\n const state = {\n needNormals: false,\n needRebuild: false,\n lightmapMode: false,\n shadowEnabled: false,\n specularEnabled: false,\n };\n PrepareDefinesForLight(scene, mesh, this.light, this._lightId, defines, true, state);\n if (state.needRebuild) {\n defines.rebuild();\n }\n }\n }\n updateUniformsAndSamples(state, nodeMaterial, defines, uniformBuffers) {\n for (let lightIndex = 0; lightIndex < nodeMaterial.maxSimultaneousLights; lightIndex++) {\n if (!defines[\"LIGHT\" + lightIndex]) {\n break;\n }\n const onlyUpdateBuffersList = state.uniforms.indexOf(\"vLightData\" + lightIndex) >= 0;\n PrepareUniformsAndSamplersForLight(lightIndex, state.uniforms, state.samplers, defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex], uniformBuffers, onlyUpdateBuffersList);\n }\n }\n bind(effect, nodeMaterial, mesh) {\n if (!mesh) {\n return;\n }\n const scene = mesh.getScene();\n if (!this.light) {\n BindLights(scene, mesh, effect, true, nodeMaterial.maxSimultaneousLights);\n }\n else {\n BindLight(this.light, this._lightId, scene, effect, true);\n }\n }\n _injectVertexCode(state) {\n const worldPos = this.worldPosition;\n const comments = `//${this.name}`;\n // Declaration\n if (!this.light) {\n // Emit for all lights\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightVxUboDeclaration\" : \"lightVxFragmentDeclaration\", comments, {\n repeatKey: \"maxSimultaneousLights\",\n });\n this._lightId = 0;\n state.sharedData.dynamicUniformBlocks.push(this);\n }\n else {\n this._lightId = (state.counters[\"lightCounter\"] !== undefined ? state.counters[\"lightCounter\"] : -1) + 1;\n state.counters[\"lightCounter\"] = this._lightId;\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightVxUboDeclaration\" : \"lightVxFragmentDeclaration\", comments, {\n replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }],\n }, this._lightId.toString());\n }\n // Inject code in vertex\n const worldPosVaryingName = \"v_\" + worldPos.associatedVariableName;\n if (state._emitVaryingFromString(worldPosVaryingName, NodeMaterialBlockConnectionPointTypes.Vector4)) {\n state.compilationString += (state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? \"vertexOutputs.\" : \"\") + `${worldPosVaryingName} = ${worldPos.associatedVariableName};\\n`;\n }\n if (this.light) {\n state.compilationString += state._emitCodeFromInclude(\"shadowsVertex\", comments, {\n replaceStrings: [\n { search: /{X}/g, replace: this._lightId.toString() },\n { search: /worldPos/g, replace: worldPos.associatedVariableName },\n ],\n });\n }\n else {\n state.compilationString += `${state._declareLocalVar(\"worldPos\", NodeMaterialBlockConnectionPointTypes.Vector4)} = ${worldPos.associatedVariableName};\\n`;\n if (this.view.isConnected) {\n state.compilationString += `${state._declareLocalVar(\"view\", NodeMaterialBlockConnectionPointTypes.Matrix)} = ${this.view.associatedVariableName};\\n`;\n }\n state.compilationString += state._emitCodeFromInclude(\"shadowsVertex\", comments, {\n repeatKey: \"maxSimultaneousLights\",\n });\n }\n }\n _injectUBODeclaration(state) {\n const comments = `//${this.name}`;\n if (!this.light) {\n // Emit for all lights\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightUboDeclaration\" : \"lightFragmentDeclaration\", comments, {\n repeatKey: \"maxSimultaneousLights\",\n substitutionVars: this.generateOnlyFragmentCode ? \"varying,\" : undefined,\n });\n }\n else {\n state._emitFunctionFromInclude(state.supportUniformBuffers ? \"lightUboDeclaration\" : \"lightFragmentDeclaration\", comments, {\n replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }],\n }, this._lightId.toString());\n }\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const isWGSL = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */;\n const addF = isWGSL ? \"f\" : \"\";\n const comments = `//${this.name}`;\n if (state.target !== NodeMaterialBlockTargets.Fragment) {\n // Vertex\n this._injectVertexCode(state);\n return;\n }\n if (this.generateOnlyFragmentCode) {\n state.sharedData.dynamicUniformBlocks.push(this);\n }\n // Fragment\n const accessor = isWGSL ? \"fragmentInputs.\" : \"\";\n state.sharedData.forcedBindableBlocks.push(this);\n state.sharedData.blocksWithDefines.push(this);\n const worldPos = this.worldPosition;\n let worldPosVariableName = worldPos.associatedVariableName;\n if (this.generateOnlyFragmentCode) {\n worldPosVariableName = state._getFreeVariableName(\"globalWorldPos\");\n state._emitFunction(\"light_globalworldpos\", `${state._declareLocalVar(worldPosVariableName, NodeMaterialBlockConnectionPointTypes.Vector3)};\\n`, comments);\n state.compilationString += `${worldPosVariableName} = ${worldPos.associatedVariableName}.xyz;\\n`;\n state.compilationString += state._emitCodeFromInclude(\"shadowsVertex\", comments, {\n repeatKey: \"maxSimultaneousLights\",\n substitutionVars: this.generateOnlyFragmentCode ? `worldPos,${worldPos.associatedVariableName}` : undefined,\n });\n }\n else {\n worldPosVariableName = accessor + \"v_\" + worldPosVariableName + \".xyz\";\n }\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\n let replaceString = { search: /vPositionW/g, replace: worldPosVariableName };\n if (isWGSL) {\n replaceString = { search: /fragmentInputs\\.vPositionW/g, replace: worldPosVariableName };\n }\n state._emitFunctionFromInclude(\"lightsFragmentFunctions\", comments, {\n replaceStrings: [replaceString],\n });\n state._emitFunctionFromInclude(\"shadowsFragmentFunctions\", comments, {\n replaceStrings: [replaceString],\n });\n this._injectUBODeclaration(state);\n // Code\n if (this._lightId === 0) {\n if (state._registerTempVariable(\"viewDirectionW\")) {\n state.compilationString += `${state._declareLocalVar(\"viewDirectionW\", NodeMaterialBlockConnectionPointTypes.Vector3)} = normalize(${this.cameraPosition.associatedVariableName} - ${worldPosVariableName});\\n`;\n }\n state.compilationString += isWGSL ? `var info: lightingInfo;\\n` : `lightingInfo info;\\n`;\n state.compilationString += `${state._declareLocalVar(\"shadow\", NodeMaterialBlockConnectionPointTypes.Float)} = 1.;\\n`;\n state.compilationString += `${state._declareLocalVar(\"aggShadow\", NodeMaterialBlockConnectionPointTypes.Float)} = 0.;\\n`;\n state.compilationString += `${state._declareLocalVar(\"numLights\", NodeMaterialBlockConnectionPointTypes.Float)} = 0.;\\n`;\n state.compilationString += `${state._declareLocalVar(\"glossiness\", NodeMaterialBlockConnectionPointTypes.Float)} = ${this.glossiness.isConnected ? this.glossiness.associatedVariableName : \"1.0\"} * ${this.glossPower.isConnected ? this.glossPower.associatedVariableName : \"1024.0\"};\\n`;\n state.compilationString += `${state._declareLocalVar(\"diffuseBase\", NodeMaterialBlockConnectionPointTypes.Vector3)} = vec3${addF}(0., 0., 0.);\\n`;\n state.compilationString += `${state._declareLocalVar(\"specularBase\", NodeMaterialBlockConnectionPointTypes.Vector3)} = vec3${addF}(0., 0., 0.);\\n`;\n state.compilationString += `${state._declareLocalVar(\"normalW\", NodeMaterialBlockConnectionPointTypes.Vector3)} = ${this.worldNormal.associatedVariableName}.xyz;\\n`;\n }\n if (this.light) {\n let replaceString = { search: /vPositionW/g, replace: worldPosVariableName + \".xyz\" };\n if (isWGSL) {\n replaceString = { search: /fragmentInputs\\.vPositionW/g, replace: worldPosVariableName + \".xyz\" };\n }\n state.compilationString += state._emitCodeFromInclude(\"lightFragment\", comments, {\n replaceStrings: [{ search: /{X}/g, replace: this._lightId.toString() }, replaceString],\n });\n }\n else {\n let substitutionVars = `vPositionW,${worldPosVariableName}.xyz`;\n if (isWGSL) {\n substitutionVars = `fragmentInputs.vPositionW,${worldPosVariableName}.xyz`;\n }\n state.compilationString += state._emitCodeFromInclude(\"lightFragment\", comments, {\n repeatKey: \"maxSimultaneousLights\",\n substitutionVars: substitutionVars,\n });\n }\n if (this._lightId === 0) {\n state.compilationString += `aggShadow = aggShadow / numLights;\\n`;\n }\n const diffuseOutput = this.diffuseOutput;\n const specularOutput = this.specularOutput;\n state.compilationString +=\n state._declareOutput(diffuseOutput) + ` = diffuseBase${this.diffuseColor.isConnected ? \" * \" + this.diffuseColor.associatedVariableName : \"\"};\\n`;\n if (specularOutput.hasEndpoints) {\n state.compilationString +=\n state._declareOutput(specularOutput) + ` = specularBase${this.specularColor.isConnected ? \" * \" + this.specularColor.associatedVariableName : \"\"};\\n`;\n }\n if (this.shadow.hasEndpoints) {\n state.compilationString += state._declareOutput(this.shadow) + ` = aggShadow;\\n`;\n }\n return this;\n }\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.generateOnlyFragmentCode = this.generateOnlyFragmentCode;\n if (this.light) {\n serializationObject.lightId = this.light.id;\n }\n return serializationObject;\n }\n _deserialize(serializationObject, scene, rootUrl) {\n super._deserialize(serializationObject, scene, rootUrl);\n if (serializationObject.lightId) {\n this.light = scene.getLightById(serializationObject.lightId);\n }\n this.generateOnlyFragmentCode = serializationObject.generateOnlyFragmentCode;\n this._setTarget();\n }\n}\n__decorate([\n editableInPropertyPage(\"Generate only fragment code\", 0 /* PropertyTypeForEdition.Boolean */, \"ADVANCED\", {\n notifiers: { rebuild: true, update: true, onValidation: LightBlock._OnGenerateOnlyFragmentCodeChanged },\n })\n], LightBlock.prototype, \"generateOnlyFragmentCode\", void 0);\nRegisterClass(\"BABYLON.LightBlock\", LightBlock);\n"],"mappings":";AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,wBAAwB,QAAQ,yCAAyC;AAClF,SAASC,qCAAqC,QAAQ,sDAAsD;AAC5G,SAASC,wBAAwB,QAAQ,yCAAyC;AAClF,SAASC,UAAU,QAAQ,wBAAwB;AACnD,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,sBAAsB,QAAQ,yCAAyC;AAChF,SAASC,MAAM,QAAQ,4BAA4B;AACnD,SAASC,SAAS,EAAEC,UAAU,EAAEC,sBAAsB,EAAEC,uBAAuB,EAAEC,kCAAkC,QAAQ,sCAAsC;AACjK;AACA;AACA;AACA,OAAO,MAAMC,UAAU,SAASb,iBAAiB,CAAC;EAC9C,OAAOc,kCAAkCA,CAACC,KAAK,EAAEC,aAAa,EAAE;IAC5D,MAAMC,IAAI,GAAGF,KAAK;IAClB,IAAIE,IAAI,CAACC,aAAa,CAACC,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