1 |
- {"ast":null,"code":"import { NodeMaterialBlock } from \"../nodeMaterialBlock.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialBlockTargets } from \"../Enums/nodeMaterialBlockTargets.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\n/**\n * Block used to blend normals\n */\nexport class NormalBlendBlock extends NodeMaterialBlock {\n /**\n * Creates a new NormalBlendBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n this.registerInput(\"normalMap0\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"normalMap1\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.Vector3);\n this._inputs[0].addExcludedConnectionPointFromAllowedTypes(NodeMaterialBlockConnectionPointTypes.Color3 | NodeMaterialBlockConnectionPointTypes.Color4 | NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Vector4);\n this._inputs[1].addExcludedConnectionPointFromAllowedTypes(NodeMaterialBlockConnectionPointTypes.Color3 | NodeMaterialBlockConnectionPointTypes.Color4 | NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Vector4);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"NormalBlendBlock\";\n }\n /**\n * Gets the first input component\n */\n get normalMap0() {\n return this._inputs[0];\n }\n /**\n * Gets the second input component\n */\n get normalMap1() {\n return this._inputs[1];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const output = this._outputs[0];\n const input0 = this._inputs[0];\n const input1 = this._inputs[1];\n const stepR = state._getFreeVariableName(\"stepR\");\n const stepG = state._getFreeVariableName(\"stepG\");\n state.compilationString += `${state._declareLocalVar(stepR, NodeMaterialBlockConnectionPointTypes.Float)} = step(0.5, ${input0.associatedVariableName}.r);\\n`;\n state.compilationString += `${state._declareLocalVar(stepG, NodeMaterialBlockConnectionPointTypes.Float)} = step(0.5, ${input0.associatedVariableName}.g);\\n`;\n state.compilationString += state._declareOutput(output) + `;\\n`;\n state.compilationString += `${output.associatedVariableName}.r = (1.0 - ${stepR}) * ${input0.associatedVariableName}.r * ${input1.associatedVariableName}.r * 2.0 + ${stepR} * (1.0 - (1.0 - ${input0.associatedVariableName}.r) * (1.0 - ${input1.associatedVariableName}.r) * 2.0);\\n`;\n state.compilationString += `${output.associatedVariableName}.g = (1.0 - ${stepG}) * ${input0.associatedVariableName}.g * ${input1.associatedVariableName}.g * 2.0 + ${stepG} * (1.0 - (1.0 - ${input0.associatedVariableName}.g) * (1.0 - ${input1.associatedVariableName}.g) * 2.0);\\n`;\n state.compilationString += `${output.associatedVariableName}.b = ${input0.associatedVariableName}.b * ${input1.associatedVariableName}.b;\\n`;\n return this;\n }\n}\nRegisterClass(\"BABYLON.NormalBlendBlock\", NormalBlendBlock);","map":{"version":3,"names":["NodeMaterialBlock","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","RegisterClass","NormalBlendBlock","constructor","name","Neutral","registerInput","AutoDetect","registerOutput","Vector3","_inputs","addExcludedConnectionPointFromAllowedTypes","Color3","Color4","Vector4","getClassName","normalMap0","normalMap1","output","_outputs","_buildBlock","state","input0","input1","stepR","_getFreeVariableName","stepG","compilationString","_declareLocalVar","Float","associatedVariableName","_declareOutput"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/normalBlendBlock.js"],"sourcesContent":["import { NodeMaterialBlock } from \"../nodeMaterialBlock.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialBlockTargets } from \"../Enums/nodeMaterialBlockTargets.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\n/**\n * Block used to blend normals\n */\nexport class NormalBlendBlock extends NodeMaterialBlock {\n /**\n * Creates a new NormalBlendBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n this.registerInput(\"normalMap0\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"normalMap1\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.Vector3);\n this._inputs[0].addExcludedConnectionPointFromAllowedTypes(NodeMaterialBlockConnectionPointTypes.Color3 |\n NodeMaterialBlockConnectionPointTypes.Color4 |\n NodeMaterialBlockConnectionPointTypes.Vector3 |\n NodeMaterialBlockConnectionPointTypes.Vector4);\n this._inputs[1].addExcludedConnectionPointFromAllowedTypes(NodeMaterialBlockConnectionPointTypes.Color3 |\n NodeMaterialBlockConnectionPointTypes.Color4 |\n NodeMaterialBlockConnectionPointTypes.Vector3 |\n NodeMaterialBlockConnectionPointTypes.Vector4);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"NormalBlendBlock\";\n }\n /**\n * Gets the first input component\n */\n get normalMap0() {\n return this._inputs[0];\n }\n /**\n * Gets the second input component\n */\n get normalMap1() {\n return this._inputs[1];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const output = this._outputs[0];\n const input0 = this._inputs[0];\n const input1 = this._inputs[1];\n const stepR = state._getFreeVariableName(\"stepR\");\n const stepG = state._getFreeVariableName(\"stepG\");\n state.compilationString += `${state._declareLocalVar(stepR, NodeMaterialBlockConnectionPointTypes.Float)} = step(0.5, ${input0.associatedVariableName}.r);\\n`;\n state.compilationString += `${state._declareLocalVar(stepG, NodeMaterialBlockConnectionPointTypes.Float)} = step(0.5, ${input0.associatedVariableName}.g);\\n`;\n state.compilationString += state._declareOutput(output) + `;\\n`;\n state.compilationString += `${output.associatedVariableName}.r = (1.0 - ${stepR}) * ${input0.associatedVariableName}.r * ${input1.associatedVariableName}.r * 2.0 + ${stepR} * (1.0 - (1.0 - ${input0.associatedVariableName}.r) * (1.0 - ${input1.associatedVariableName}.r) * 2.0);\\n`;\n state.compilationString += `${output.associatedVariableName}.g = (1.0 - ${stepG}) * ${input0.associatedVariableName}.g * ${input1.associatedVariableName}.g * 2.0 + ${stepG} * (1.0 - (1.0 - ${input0.associatedVariableName}.g) * (1.0 - ${input1.associatedVariableName}.g) * 2.0);\\n`;\n state.compilationString += `${output.associatedVariableName}.b = ${input0.associatedVariableName}.b * ${input1.associatedVariableName}.b;\\n`;\n return this;\n }\n}\nRegisterClass(\"BABYLON.NormalBlendBlock\", NormalBlendBlock);\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,qCAAqC,QAAQ,mDAAmD;AACzG,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,aAAa,QAAQ,4BAA4B;AAC1D;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,SAASJ,iBAAiB,CAAC;EACpD;AACJ;AACA;AACA;EACIK,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,EAAEJ,wBAAwB,CAACK,OAAO,CAAC;IAC7C,IAAI,CAACC,aAAa,CAAC,YAAY,EAAEP,qCAAqC,CAACQ,UAAU,CAAC;IAClF,IAAI,CAACD,aAAa,CAAC,YAAY,EAAEP,qCAAqC,CAACQ,UAAU,CAAC;IAClF,IAAI,CAACC,cAAc,CAAC,QAAQ,EAAET,qCAAqC,CAACU,OAAO,CAAC;IAC5E,IAAI,CAACC,OAAO,CAAC,CAAC,CAAC,CAACC,0CAA0C,CAACZ,qCAAqC,CAACa,MAAM,GACnGb,qCAAqC,CAACc,MAAM,GAC5Cd,qCAAqC,CAACU,OAAO,GAC7CV,qCAAqC,CAACe,OAAO,CAAC;IAClD,IAAI,CAACJ,OAAO,CAAC,CAAC,CAAC,CAACC,0CAA0C,CAACZ,qCAAqC,CAACa,MAAM,GACnG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