1 |
- {"ast":null,"code":"import { __decorate } from \"../../../tslib.es6.js\";\nimport { NodeMaterialBlock } from \"../nodeMaterialBlock.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialBlockTargets } from \"../Enums/nodeMaterialBlockTargets.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { editableInPropertyPage } from \"../../../Decorators/nodeDecorator.js\";\n/**\n * Block used to clamp a float\n */\nexport class ClampBlock extends NodeMaterialBlock {\n /**\n * Creates a new ClampBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n /** Gets or sets the minimum range */\n this.minimum = 0.0;\n /** Gets or sets the maximum range */\n this.maximum = 1.0;\n this.registerInput(\"value\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.BasedOnInput);\n this._outputs[0]._typeConnectionSource = this._inputs[0];\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ClampBlock\";\n }\n /**\n * Gets the value input component\n */\n get value() {\n return this._inputs[0];\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 cast = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? state._getShaderType(this.value.type) : \"\";\n state.compilationString += state._declareOutput(output) + ` = clamp(${this.value.associatedVariableName}, ${cast}(${this._writeFloat(this.minimum)}), ${cast}(${this._writeFloat(this.maximum)}));\\n`;\n return this;\n }\n _dumpPropertiesCode() {\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.minimum = ${this.minimum};\\n`;\n codeString += `${this._codeVariableName}.maximum = ${this.maximum};\\n`;\n return codeString;\n }\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.minimum = this.minimum;\n serializationObject.maximum = this.maximum;\n return serializationObject;\n }\n _deserialize(serializationObject, scene, rootUrl) {\n super._deserialize(serializationObject, scene, rootUrl);\n this.minimum = serializationObject.minimum;\n this.maximum = serializationObject.maximum;\n }\n}\n__decorate([editableInPropertyPage(\"Minimum\", 1 /* PropertyTypeForEdition.Float */, undefined, {\n embedded: true\n})], ClampBlock.prototype, \"minimum\", void 0);\n__decorate([editableInPropertyPage(\"Maximum\", 1 /* PropertyTypeForEdition.Float */, undefined, {\n embedded: true\n})], ClampBlock.prototype, \"maximum\", void 0);\nRegisterClass(\"BABYLON.ClampBlock\", ClampBlock);","map":{"version":3,"names":["__decorate","NodeMaterialBlock","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","RegisterClass","editableInPropertyPage","ClampBlock","constructor","name","Neutral","minimum","maximum","registerInput","AutoDetect","registerOutput","BasedOnInput","_outputs","_typeConnectionSource","_inputs","getClassName","value","output","_buildBlock","state","cast","shaderLanguage","_getShaderType","type","compilationString","_declareOutput","associatedVariableName","_writeFloat","_dumpPropertiesCode","codeString","_codeVariableName","serialize","serializationObject","_deserialize","scene","rootUrl","undefined","embedded","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/clampBlock.js"],"sourcesContent":["import { __decorate } from \"../../../tslib.es6.js\";\nimport { NodeMaterialBlock } from \"../nodeMaterialBlock.js\";\nimport { NodeMaterialBlockConnectionPointTypes } from \"../Enums/nodeMaterialBlockConnectionPointTypes.js\";\nimport { NodeMaterialBlockTargets } from \"../Enums/nodeMaterialBlockTargets.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { editableInPropertyPage } from \"../../../Decorators/nodeDecorator.js\";\n/**\n * Block used to clamp a float\n */\nexport class ClampBlock extends NodeMaterialBlock {\n /**\n * Creates a new ClampBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n /** Gets or sets the minimum range */\n this.minimum = 0.0;\n /** Gets or sets the maximum range */\n this.maximum = 1.0;\n this.registerInput(\"value\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerOutput(\"output\", NodeMaterialBlockConnectionPointTypes.BasedOnInput);\n this._outputs[0]._typeConnectionSource = this._inputs[0];\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"ClampBlock\";\n }\n /**\n * Gets the value input component\n */\n get value() {\n return this._inputs[0];\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 cast = state.shaderLanguage === 1 /* ShaderLanguage.WGSL */ ? state._getShaderType(this.value.type) : \"\";\n state.compilationString +=\n state._declareOutput(output) +\n ` = clamp(${this.value.associatedVariableName}, ${cast}(${this._writeFloat(this.minimum)}), ${cast}(${this._writeFloat(this.maximum)}));\\n`;\n return this;\n }\n _dumpPropertiesCode() {\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.minimum = ${this.minimum};\\n`;\n codeString += `${this._codeVariableName}.maximum = ${this.maximum};\\n`;\n return codeString;\n }\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.minimum = this.minimum;\n serializationObject.maximum = this.maximum;\n return serializationObject;\n }\n _deserialize(serializationObject, scene, rootUrl) {\n super._deserialize(serializationObject, scene, rootUrl);\n this.minimum = serializationObject.minimum;\n this.maximum = serializationObject.maximum;\n }\n}\n__decorate([\n editableInPropertyPage(\"Minimum\", 1 /* PropertyTypeForEdition.Float */, undefined, { embedded: true })\n], ClampBlock.prototype, \"minimum\", void 0);\n__decorate([\n editableInPropertyPage(\"Maximum\", 1 /* PropertyTypeForEdition.Float */, undefined, { embedded: true })\n], ClampBlock.prototype, \"maximum\", void 0);\nRegisterClass(\"BABYLON.ClampBlock\", ClampBlock);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,uBAAuB;AAClD,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,qCAAqC,QAAQ,mDAAmD;AACzG,SAASC,wBAAwB,Q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