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 expand a Color3/4 into 4 outputs (one for each component)\n */\nexport class ColorSplitterBlock extends NodeMaterialBlock {\n /**\n * Create a new ColorSplitterBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n this.registerInput(\"rgba\", NodeMaterialBlockConnectionPointTypes.Color4, true);\n this.registerInput(\"rgb \", NodeMaterialBlockConnectionPointTypes.Color3, true);\n this.registerOutput(\"rgb\", NodeMaterialBlockConnectionPointTypes.Color3);\n this.registerOutput(\"r\", NodeMaterialBlockConnectionPointTypes.Float);\n this.registerOutput(\"g\", NodeMaterialBlockConnectionPointTypes.Float);\n this.registerOutput(\"b\", NodeMaterialBlockConnectionPointTypes.Float);\n this.registerOutput(\"a\", NodeMaterialBlockConnectionPointTypes.Float);\n this.inputsAreExclusive = true;\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ColorSplitterBlock\";\n }\n /**\n * Gets the rgba component (input)\n */\n get rgba() {\n return this._inputs[0];\n }\n /**\n * Gets the rgb component (input)\n */\n get rgbIn() {\n return this._inputs[1];\n }\n /**\n * Gets the rgb component (output)\n */\n get rgbOut() {\n return this._outputs[0];\n }\n /**\n * Gets the r component (output)\n */\n get r() {\n return this._outputs[1];\n }\n /**\n * Gets the g component (output)\n */\n get g() {\n return this._outputs[2];\n }\n /**\n * Gets the b component (output)\n */\n get b() {\n return this._outputs[3];\n }\n /**\n * Gets the a component (output)\n */\n get a() {\n return this._outputs[4];\n }\n _inputRename(name) {\n if (name === \"rgb \") {\n return \"rgbIn\";\n }\n return name;\n }\n _outputRename(name) {\n if (name === \"rgb\") {\n return \"rgbOut\";\n }\n return name;\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const input = this.rgba.isConnected ? this.rgba : this.rgbIn;\n if (!input.isConnected) {\n return;\n }\n const rgbOutput = this._outputs[0];\n const rOutput = this._outputs[1];\n const gOutput = this._outputs[2];\n const bOutput = this._outputs[3];\n const aOutput = this._outputs[4];\n if (rgbOutput.hasEndpoints) {\n state.compilationString += state._declareOutput(rgbOutput) + ` = ${input.associatedVariableName}.rgb;\\n`;\n }\n if (rOutput.hasEndpoints) {\n state.compilationString += state._declareOutput(rOutput) + ` = ${input.associatedVariableName}.r;\\n`;\n }\n if (gOutput.hasEndpoints) {\n state.compilationString += state._declareOutput(gOutput) + ` = ${input.associatedVariableName}.g;\\n`;\n }\n if (bOutput.hasEndpoints) {\n state.compilationString += state._declareOutput(bOutput) + ` = ${input.associatedVariableName}.b;\\n`;\n }\n if (aOutput.hasEndpoints) {\n state.compilationString += state._declareOutput(aOutput) + ` = ${input.associatedVariableName}.a;\\n`;\n }\n return this;\n }\n}\nRegisterClass(\"BABYLON.ColorSplitterBlock\", ColorSplitterBlock);","map":{"version":3,"names":["NodeMaterialBlock","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","RegisterClass","ColorSplitterBlock","constructor","name","Neutral","registerInput","Color4","Color3","registerOutput","Float","inputsAreExclusive","getClassName","rgba","_inputs","rgbIn","rgbOut","_outputs","r","g","b","a","_inputRename","_outputRename","_buildBlock","state","input","isConnected","rgbOutput","rOutput","gOutput","bOutput","aOutput","hasEndpoints","compilationString","_declareOutput","associatedVariableName"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/colorSplitterBlock.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 expand a Color3/4 into 4 outputs (one for each component)\n */\nexport class ColorSplitterBlock extends NodeMaterialBlock {\n /**\n * Create a new ColorSplitterBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n this.registerInput(\"rgba\", NodeMaterialBlockConnectionPointTypes.Color4, true);\n this.registerInput(\"rgb \", NodeMaterialBlockConnectionPointTypes.Color3, true);\n this.registerOutput(\"rgb\", NodeMaterialBlockConnectionPointTypes.Color3);\n this.registerOutput(\"r\", NodeMaterialBlockConnectionPointTypes.Float);\n this.registerOutput(\"g\", NodeMaterialBlockConnectionPointTypes.Float);\n this.registerOutput(\"b\", NodeMaterialBlockConnectionPointTypes.Float);\n this.registerOutput(\"a\", NodeMaterialBlockConnectionPointTypes.Float);\n this.inputsAreExclusive = true;\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ColorSplitterBlock\";\n }\n /**\n * Gets the rgba component (input)\n */\n get rgba() {\n return this._inputs[0];\n }\n /**\n * Gets the rgb component (input)\n */\n get rgbIn() {\n return this._inputs[1];\n }\n /**\n * Gets the rgb component (output)\n */\n get rgbOut() {\n return this._outputs[0];\n }\n /**\n * Gets the r component (output)\n */\n get r() {\n return this._outputs[1];\n }\n /**\n * Gets the g component (output)\n */\n get g() {\n return this._outputs[2];\n }\n /**\n * Gets the b component (output)\n */\n get b() {\n return this._outputs[3];\n }\n /**\n * Gets the a component (output)\n */\n get a() {\n return this._outputs[4];\n }\n _inputRename(name) {\n if (name === \"rgb \") {\n return \"rgbIn\";\n }\n return name;\n }\n _outputRename(name) {\n if (name === \"rgb\") {\n return \"rgbOut\";\n }\n return name;\n }\n _buildBlock(state) {\n super._buildBlock(state);\n const input = this.rgba.isConnected ? this.rgba : this.rgbIn;\n if (!input.isConnected) {\n return;\n }\n const rgbOutput = this._outputs[0];\n const rOutput = this._outputs[1];\n const gOutput = this._outputs[2];\n const bOutput = this._outputs[3];\n const aOutput = this._outputs[4];\n if (rgbOutput.hasEndpoints) {\n state.compilationString += state._declareOutput(rgbOutput) + ` = ${input.associatedVariableName}.rgb;\\n`;\n }\n if (rOutput.hasEndpoints) {\n state.compilationString += state._declareOutput(rOutput) + ` = ${input.associatedVariableName}.r;\\n`;\n }\n if (gOutput.hasEndpoints) {\n state.compilationString += state._declareOutput(gOutput) + ` = ${input.associatedVariableName}.g;\\n`;\n }\n if (bOutput.hasEndpoints) {\n state.compilationString += state._declareOutput(bOutput) + ` = ${input.associatedVariableName}.b;\\n`;\n }\n if (aOutput.hasEndpoints) {\n state.compilationString += state._declareOutput(aOutput) + ` = ${input.associatedVariableName}.a;\\n`;\n }\n return this;\n }\n}\nRegisterClass(\"BABYLON.ColorSplitterBlock\", ColorSplitterBlock);\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,kBAAkB,SAASJ,iBAAiB,CAAC;EACtD;AACJ;AACA;AACA;EACIK,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,EAAEJ,wBAAwB,CAACK,OAAO,CAAC;IAC7C,IAAI,CAACC,aAAa,CAAC,MAAM,EAAEP,qCAAqC,CAACQ,MAAM,EAAE,IAAI,CAAC;IAC9E,IAAI,CAACD,aAAa,CAAC,MAAM,EAAEP,qCAAqC,CAACS,MAAM,EAAE,IAAI,CAAC;IAC9E,IAAI,CAACC,cAAc,CAAC,KAAK,EAAEV,qCAAqC,CAACS,MAAM,CAAC;IACxE,IAAI,CAACC,cAAc,CAAC,GAAG,EAAEV,qCAAqC,CAACW,KAAK,CAAC;IACrE,IAAI,CAACD,cAAc,CAAC,GAAG,EAAEV,qCAAqC,CAACW,KAAK,CAAC;IACrE,IAAI,CAACD,cAAc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