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 for the particle blend multiply section\n */\nexport class ParticleBlendMultiplyBlock extends NodeMaterialBlock {\n /**\n * Create a new ParticleBlendMultiplyBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Fragment);\n this._isUnique = true;\n this.registerInput(\"color\", NodeMaterialBlockConnectionPointTypes.Color4, false, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"alphaTexture\", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"alphaColor\", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"blendColor\", NodeMaterialBlockConnectionPointTypes.Color4, NodeMaterialBlockTargets.Fragment);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ParticleBlendMultiplyBlock\";\n }\n /**\n * Gets the color input component\n */\n get color() {\n return this._inputs[0];\n }\n /**\n * Gets the alphaTexture input component\n */\n get alphaTexture() {\n return this._inputs[1];\n }\n /**\n * Gets the alphaColor input component\n */\n get alphaColor() {\n return this._inputs[2];\n }\n /**\n * Gets the blendColor output component\n */\n get blendColor() {\n return this._outputs[0];\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(\"sourceAlpha\");\n }\n _buildBlock(state) {\n super._buildBlock(state);\n if (state.target === NodeMaterialBlockTargets.Vertex) {\n return;\n }\n state.compilationString += `\n #ifdef BLENDMULTIPLYMODE\n ${state._declareOutput(this.blendColor)};\n ${state._declareLocalVar(\"sourceAlpha\", NodeMaterialBlockConnectionPointTypes.Float)} = ${this.alphaColor.associatedVariableName} * ${this.alphaTexture.associatedVariableName};\n ${this.blendColor.associatedVariableName} = vec4${state.fSuffix}(${this.color.associatedVariableName}.rgb * sourceAlpha + vec3(1.0) * (1.0 - sourceAlpha), ${this.color.associatedVariableName}.a);\n #else\n ${state._declareOutput(this.blendColor)} = ${this.color.associatedVariableName};\n #endif\n `;\n return this;\n }\n}\nRegisterClass(\"BABYLON.ParticleBlendMultiplyBlock\", ParticleBlendMultiplyBlock);","map":{"version":3,"names":["NodeMaterialBlock","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","RegisterClass","ParticleBlendMultiplyBlock","constructor","name","Fragment","_isUnique","registerInput","Color4","Float","registerOutput","getClassName","color","_inputs","alphaTexture","alphaColor","blendColor","_outputs","initialize","state","_excludeVariableName","_buildBlock","target","Vertex","compilationString","_declareOutput","_declareLocalVar","associatedVariableName","fSuffix"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/Particle/particleBlendMultiplyBlock.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 for the particle blend multiply section\n */\nexport class ParticleBlendMultiplyBlock extends NodeMaterialBlock {\n /**\n * Create a new ParticleBlendMultiplyBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Fragment);\n this._isUnique = true;\n this.registerInput(\"color\", NodeMaterialBlockConnectionPointTypes.Color4, false, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"alphaTexture\", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);\n this.registerInput(\"alphaColor\", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);\n this.registerOutput(\"blendColor\", NodeMaterialBlockConnectionPointTypes.Color4, NodeMaterialBlockTargets.Fragment);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ParticleBlendMultiplyBlock\";\n }\n /**\n * Gets the color input component\n */\n get color() {\n return this._inputs[0];\n }\n /**\n * Gets the alphaTexture input component\n */\n get alphaTexture() {\n return this._inputs[1];\n }\n /**\n * Gets the alphaColor input component\n */\n get alphaColor() {\n return this._inputs[2];\n }\n /**\n * Gets the blendColor output component\n */\n get blendColor() {\n return this._outputs[0];\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(\"sourceAlpha\");\n }\n _buildBlock(state) {\n super._buildBlock(state);\n if (state.target === NodeMaterialBlockTargets.Vertex) {\n return;\n }\n state.compilationString += `\r\n #ifdef BLENDMULTIPLYMODE\r\n ${state._declareOutput(this.blendColor)};\r\n ${state._declareLocalVar(\"sourceAlpha\", NodeMaterialBlockConnectionPointTypes.Float)} = ${this.alphaColor.associatedVariableName} * ${this.alphaTexture.associatedVariableName};\r\n ${this.blendColor.associatedVariableName} = vec4${state.fSuffix}(${this.color.associatedVariableName}.rgb * sourceAlpha + vec3(1.0) * (1.0 - sourceAlpha), ${this.color.associatedVariableName}.a);\r\n #else\r\n ${state._declareOutput(this.blendColor)} = ${this.color.associatedVariableName};\r\n #endif\r\n `;\n return this;\n }\n}\nRegisterClass(\"BABYLON.ParticleBlendMultiplyBlock\", ParticleBlendMultiplyBlock);\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,qCAAqC,QAAQ,sDAAsD;AAC5G,SAASC,wBAAwB,QAAQ,yCAAyC;AAClF,SAASC,aAAa,QAAQ,+BAA+B;AAC7D;AACA;AACA;AACA,OAAO,MAAMC,0BAA0B,SAASJ,iBAAiB,CAAC;EAC9D;AACJ;AACA;AACA;EACIK,W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