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 replace a color by another one\n */\nexport class ReplaceColorBlock extends NodeMaterialBlock {\n /**\n * Creates a new ReplaceColorBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n this.registerInput(\"value\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"reference\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"distance\", NodeMaterialBlockConnectionPointTypes.Float);\n this.registerInput(\"replacement\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.BasedOnInput);\n this._outputs[0]._typeConnectionSource = this._inputs[0];\n this._linkConnectionTypes(0, 1);\n this._linkConnectionTypes(0, 3);\n this._inputs[0].excludedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\n this._inputs[0].excludedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Matrix);\n this._inputs[1].excludedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\n this._inputs[1].excludedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Matrix);\n this._inputs[3].excludedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\n this._inputs[3].excludedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Matrix);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ReplaceColorBlock\";\n }\n /**\n * Gets the value input component\n */\n get value() {\n return this._inputs[0];\n }\n /**\n * Gets the reference input component\n */\n get reference() {\n return this._inputs[1];\n }\n /**\n * Gets the distance input component\n */\n get distance() {\n return this._inputs[2];\n }\n /**\n * Gets the replacement input component\n */\n get replacement() {\n return this._inputs[3];\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 state.compilationString += state._declareOutput(output) + `;\\n`;\n state.compilationString += `if (length(${this.value.associatedVariableName} - ${this.reference.associatedVariableName}) < ${this.distance.associatedVariableName}) {\\n`;\n state.compilationString += `${output.associatedVariableName} = ${this.replacement.associatedVariableName};\\n`;\n state.compilationString += `} else {\\n`;\n state.compilationString += `${output.associatedVariableName} = ${this.value.associatedVariableName};\\n`;\n state.compilationString += `}\\n`;\n return this;\n }\n}\nRegisterClass(\"BABYLON.ReplaceColorBlock\", ReplaceColorBlock);","map":{"version":3,"names":["NodeMaterialBlock","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","RegisterClass","ReplaceColorBlock","constructor","name","Neutral","registerInput","AutoDetect","Float","registerOutput","BasedOnInput","_outputs","_typeConnectionSource","_inputs","_linkConnectionTypes","excludedConnectionPointTypes","push","Matrix","getClassName","value","reference","distance","replacement","output","_buildBlock","state","compilationString","_declareOutput","associatedVariableName"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/replaceColorBlock.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 replace a color by another one\n */\nexport class ReplaceColorBlock extends NodeMaterialBlock {\n /**\n * Creates a new ReplaceColorBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n this.registerInput(\"value\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"reference\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"distance\", NodeMaterialBlockConnectionPointTypes.Float);\n this.registerInput(\"replacement\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.BasedOnInput);\n this._outputs[0]._typeConnectionSource = this._inputs[0];\n this._linkConnectionTypes(0, 1);\n this._linkConnectionTypes(0, 3);\n this._inputs[0].excludedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\n this._inputs[0].excludedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Matrix);\n this._inputs[1].excludedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\n this._inputs[1].excludedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Matrix);\n this._inputs[3].excludedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Float);\n this._inputs[3].excludedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Matrix);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ReplaceColorBlock\";\n }\n /**\n * Gets the value input component\n */\n get value() {\n return this._inputs[0];\n }\n /**\n * Gets the reference input component\n */\n get reference() {\n return this._inputs[1];\n }\n /**\n * Gets the distance input component\n */\n get distance() {\n return this._inputs[2];\n }\n /**\n * Gets the replacement input component\n */\n get replacement() {\n return this._inputs[3];\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 state.compilationString += state._declareOutput(output) + `;\\n`;\n state.compilationString += `if (length(${this.value.associatedVariableName} - ${this.reference.associatedVariableName}) < ${this.distance.associatedVariableName}) {\\n`;\n state.compilationString += `${output.associatedVariableName} = ${this.replacement.associatedVariableName};\\n`;\n state.compilationString += `} else {\\n`;\n state.compilationString += `${output.associatedVariableName} = ${this.value.associatedVariableName};\\n`;\n state.compilationString += `}\\n`;\n return this;\n }\n}\nRegisterClass(\"BABYLON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