{"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 { Vector2 } from \"../../../Maths/math.vector.js\";\nimport { editableInPropertyPage } from \"../../../Decorators/nodeDecorator.js\";\n/**\n * Block used to remap a float from a range to a new one\n */\nexport class RemapBlock extends NodeMaterialBlock {\n /**\n * Creates a new RemapBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n /**\n * Gets or sets the source range\n */\n this.sourceRange = new Vector2(-1, 1);\n /**\n * Gets or sets the target range\n */\n this.targetRange = new Vector2(0, 1);\n this.registerInput(\"input\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"sourceMin\", NodeMaterialBlockConnectionPointTypes.Float, true);\n this.registerInput(\"sourceMax\", NodeMaterialBlockConnectionPointTypes.Float, true);\n this.registerInput(\"targetMin\", NodeMaterialBlockConnectionPointTypes.Float, true);\n this.registerInput(\"targetMax\", NodeMaterialBlockConnectionPointTypes.Float, true);\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 \"RemapBlock\";\n }\n /**\n * Gets the input component\n */\n get input() {\n return this._inputs[0];\n }\n /**\n * Gets the source min input component\n */\n get sourceMin() {\n return this._inputs[1];\n }\n /**\n * Gets the source max input component\n */\n get sourceMax() {\n return this._inputs[2];\n }\n /**\n * Gets the target min input component\n */\n get targetMin() {\n return this._inputs[3];\n }\n /**\n * Gets the target max input component\n */\n get targetMax() {\n return this._inputs[4];\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 sourceMin = this.sourceMin.isConnected ? this.sourceMin.associatedVariableName : this._writeFloat(this.sourceRange.x);\n const sourceMax = this.sourceMax.isConnected ? this.sourceMax.associatedVariableName : this._writeFloat(this.sourceRange.y);\n const targetMin = this.targetMin.isConnected ? this.targetMin.associatedVariableName : this._writeFloat(this.targetRange.x);\n const targetMax = this.targetMax.isConnected ? this.targetMax.associatedVariableName : this._writeFloat(this.targetRange.y);\n state.compilationString += state._declareOutput(output) + ` = ${targetMin} + (${this._inputs[0].associatedVariableName} - ${sourceMin}) * (${targetMax} - ${targetMin}) / (${sourceMax} - ${sourceMin});\\n`;\n return this;\n }\n _dumpPropertiesCode() {\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.sourceRange = new BABYLON.Vector2(${this.sourceRange.x}, ${this.sourceRange.y});\\n`;\n codeString += `${this._codeVariableName}.targetRange = new BABYLON.Vector2(${this.targetRange.x}, ${this.targetRange.y});\\n`;\n return codeString;\n }\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.sourceRange = this.sourceRange.asArray();\n serializationObject.targetRange = this.targetRange.asArray();\n return serializationObject;\n }\n _deserialize(serializationObject, scene, rootUrl) {\n super._deserialize(serializationObject, scene, rootUrl);\n this.sourceRange = Vector2.FromArray(serializationObject.sourceRange);\n this.targetRange = Vector2.FromArray(serializationObject.targetRange);\n }\n}\n__decorate([editableInPropertyPage(\"From\", 3 /* PropertyTypeForEdition.Vector2 */)], RemapBlock.prototype, \"sourceRange\", void 0);\n__decorate([editableInPropertyPage(\"To\", 3 /* PropertyTypeForEdition.Vector2 */)], RemapBlock.prototype, \"targetRange\", void 0);\nRegisterClass(\"BABYLON.RemapBlock\", RemapBlock);","map":{"version":3,"names":["__decorate","NodeMaterialBlock","NodeMaterialBlockConnectionPointTypes","NodeMaterialBlockTargets","RegisterClass","Vector2","editableInPropertyPage","RemapBlock","constructor","name","Neutral","sourceRange","targetRange","registerInput","AutoDetect","Float","registerOutput","BasedOnInput","_outputs","_typeConnectionSource","_inputs","getClassName","input","sourceMin","sourceMax","targetMin","targetMax","output","_buildBlock","state","isConnected","associatedVariableName","_writeFloat","x","y","compilationString","_declareOutput","_dumpPropertiesCode","codeString","_codeVariableName","serialize","serializationObject","asArray","_deserialize","scene","rootUrl","FromArray","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Node/Blocks/remapBlock.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 { Vector2 } from \"../../../Maths/math.vector.js\";\nimport { editableInPropertyPage } from \"../../../Decorators/nodeDecorator.js\";\n/**\n * Block used to remap a float from a range to a new one\n */\nexport class RemapBlock extends NodeMaterialBlock {\n /**\n * Creates a new RemapBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name, NodeMaterialBlockTargets.Neutral);\n /**\n * Gets or sets the source range\n */\n this.sourceRange = new Vector2(-1, 1);\n /**\n * Gets or sets the target range\n */\n this.targetRange = new Vector2(0, 1);\n this.registerInput(\"input\", NodeMaterialBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"sourceMin\", NodeMaterialBlockConnectionPointTypes.Float, true);\n this.registerInput(\"sourceMax\", NodeMaterialBlockConnectionPointTypes.Float, true);\n this.registerInput(\"targetMin\", NodeMaterialBlockConnectionPointTypes.Float, true);\n this.registerInput(\"targetMax\", NodeMaterialBlockConnectionPointTypes.Float, true);\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 \"RemapBlock\";\n }\n /**\n * Gets the input component\n */\n get input() {\n return this._inputs[0];\n }\n /**\n * Gets the source min input component\n */\n get sourceMin() {\n return this._inputs[1];\n }\n /**\n * Gets the source max input component\n */\n get sourceMax() {\n return this._inputs[2];\n }\n /**\n * Gets the target min input component\n */\n get targetMin() {\n return this._inputs[3];\n }\n /**\n * Gets the target max input component\n */\n get targetMax() {\n return this._inputs[4];\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 sourceMin = this.sourceMin.isConnected ? this.sourceMin.associatedVariableName : this._writeFloat(this.sourceRange.x);\n const sourceMax = this.sourceMax.isConnected ? this.sourceMax.associatedVariableName : this._writeFloat(this.sourceRange.y);\n const targetMin = this.targetMin.isConnected ? this.targetMin.associatedVariableName : this._writeFloat(this.targetRange.x);\n const targetMax = this.targetMax.isConnected ? this.targetMax.associatedVariableName : this._writeFloat(this.targetRange.y);\n state.compilationString +=\n state._declareOutput(output) +\n ` = ${targetMin} + (${this._inputs[0].associatedVariableName} - ${sourceMin}) * (${targetMax} - ${targetMin}) / (${sourceMax} - ${sourceMin});\\n`;\n return this;\n }\n _dumpPropertiesCode() {\n let codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.sourceRange = new BABYLON.Vector2(${this.sourceRange.x}, ${this.sourceRange.y});\\n`;\n codeString += `${this._codeVariableName}.targetRange = new BABYLON.Vector2(${this.targetRange.x}, ${this.targetRange.y});\\n`;\n return codeString;\n }\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.sourceRange = this.sourceRange.asArray();\n serializationObject.targetRange = this.targetRange.asArray();\n return serializationObject;\n }\n _deserialize(serializationObject, scene, rootUrl) {\n super._deserialize(serializationObject, scene, rootUrl);\n this.sourceRange = Vector2.FromArray(serializationObject.sourceRange);\n this.targetRange = Vector2.FromArray(serializationObject.targetRange);\n }\n}\n__decorate([\n editableInPropertyPage(\"From\", 3 /* PropertyTypeForEdition.Vector2 */)\n], RemapBlock.prototype, \"sourceRange\", void 0);\n__decorate([\n editableInPropertyPage(\"To\", 3 /* PropertyTypeForEdition.Vector2 */)\n], RemapBlock.prototype, \"targetRange\", void 0);\nRegisterClass(\"BABYLON.RemapBlock\", RemapBlock);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,uBAAuB;AAClD,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,qCAAqC,QAAQ,mDAAmD;AACzG,SAASC,wBAAwB,QAAQ,sCAAsC;AAC/E,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,OAAO,QAAQ,+BAA+B;AACvD,SAASC,sBAAsB,QAAQ,sCAAsC;AAC7E;AACA;AACA;AACA,OAAO,MAAMC,UAAU,SAASN,iBAAiB,CAAC;EAC9C;AACJ;AACA;AACA;EACIO,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,EAAEN,wBAAwB,CAACO,OAAO,CAAC;IAC7C;AACR;AACA;IACQ,IAAI,CAACC,WAAW,GAAG,IAAIN,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACrC;AACR;AACA;IACQ,IAAI,CAACO,WAAW,GAAG,IAAIP,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACpC,IAAI,CAACQ,aAAa,CAAC,OAAO,EAAEX,qCAAqC,CAACY,UAAU,CAAC;IAC7E,IAAI,CAACD,aAAa,CAAC,WAAW,EAAEX,qCAAqC,CAACa,KAAK,EAAE,IAAI,CAAC;IAClF,IAAI,CAACF,aAAa,CAAC,WAAW,EAAEX,qCAAqC,CAACa,KAAK,EAAE,IAAI,CAAC;IAClF,IAAI,CAACF,aAAa,CAAC,WAAW,EAAEX,qCAAqC,CAACa,KAAK,EAAE,IAAI,CAAC;IAClF,IAAI,CAACF,aAAa,CAAC,WAAW,EAAEX,qCAAqC,CAACa,KAAK,EAAE,IAAI,CAAC;IAClF,IAAI,CAACC,cAAc,CAAC,QAAQ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