1210302a5ccd5da4171fbf87d0e3708e7ce516f038303b7ee5fd312c67188e9d.json 10 KB

1
  1. {"ast":null,"code":"import { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\n/**\n * Defines a block used to move a value from a range to another\n */\nexport class MapRangeBlock extends NodeGeometryBlock {\n /**\n * Create a new MapRangeBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"fromMin\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"fromMax\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\n this.registerInput(\"toMin\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"toMax\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector2);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector3);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector4);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\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 \"MapRangeBlock\";\n }\n /**\n * Gets the value input component\n */\n get value() {\n return this._inputs[0];\n }\n /**\n * Gets the fromMin input component\n */\n get fromMin() {\n return this._inputs[1];\n }\n /**\n * Gets the fromMax input component\n */\n get fromMax() {\n return this._inputs[2];\n }\n /**\n * Gets the toMin input component\n */\n get toMin() {\n return this._inputs[3];\n }\n /**\n * Gets the toMax input component\n */\n get toMax() {\n return this._inputs[4];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock() {\n if (!this.value.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n this.output._storedFunction = state => {\n const value = this.value.getConnectedValue(state);\n const fromMin = this.fromMin.getConnectedValue(state);\n const fromMax = this.fromMax.getConnectedValue(state);\n const toMin = this.toMin.getConnectedValue(state);\n const toMax = this.toMax.getConnectedValue(state);\n const result = (value - fromMin) / (fromMax - fromMin) * (toMax - toMin) + toMin;\n if (this.output.type === NodeGeometryBlockConnectionPointTypes.Int) {\n return Math.floor(result);\n }\n return result;\n };\n }\n}\nRegisterClass(\"BABYLON.MapRangeBlock\", MapRangeBlock);","map":{"version":3,"names":["RegisterClass","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","MapRangeBlock","constructor","name","registerInput","AutoDetect","Float","registerOutput","BasedOnInput","_inputs","excludedConnectionPointTypes","push","Vector2","Vector3","Vector4","Matrix","Geometry","Texture","_outputs","_typeConnectionSource","getClassName","value","fromMin","fromMax","toMin","toMax","output","_buildBlock","isConnected","_storedFunction","_storedValue","state","getConnectedValue","result","type","Int","Math","floor"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/mapRangeBlock.js"],"sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\n/**\n * Defines a block used to move a value from a range to another\n */\nexport class MapRangeBlock extends NodeGeometryBlock {\n /**\n * Create a new MapRangeBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"fromMin\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"fromMax\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\n this.registerInput(\"toMin\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"toMax\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector2);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector3);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Vector4);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Matrix);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Geometry);\n this._inputs[0].excludedConnectionPointTypes.push(NodeGeometryBlockConnectionPointTypes.Texture);\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 \"MapRangeBlock\";\n }\n /**\n * Gets the value input component\n */\n get value() {\n return this._inputs[0];\n }\n /**\n * Gets the fromMin input component\n */\n get fromMin() {\n return this._inputs[1];\n }\n /**\n * Gets the fromMax input component\n */\n get fromMax() {\n return this._inputs[2];\n }\n /**\n * Gets the toMin input component\n */\n get toMin() {\n return this._inputs[3];\n }\n /**\n * Gets the toMax input component\n */\n get toMax() {\n return this._inputs[4];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock() {\n if (!this.value.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n this.output._storedFunction = (state) => {\n const value = this.value.getConnectedValue(state);\n const fromMin = this.fromMin.getConnectedValue(state);\n const fromMax = this.fromMax.getConnectedValue(state);\n const toMin = this.toMin.getConnectedValue(state);\n const toMax = this.toMax.getConnectedValue(state);\n const result = ((value - fromMin) / (fromMax - fromMin)) * (toMax - toMin) + toMin;\n if (this.output.type === NodeGeometryBlockConnectionPointTypes.Int) {\n return Math.floor(result);\n }\n return result;\n };\n }\n}\nRegisterClass(\"BABYLON.MapRangeBlock\", MapRangeBlock);\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,qCAAqC,QAAQ,8CAA8C;AACpG,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D;AACA;AACA;AACA,OAAO,MAAMC,aAAa,SAASD,iBAAiB,CAAC;EACjD;AACJ;AACA;AACA;EACIE,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,CAAC;IACX,IAAI,CAACC,aAAa,CAAC,OAAO,EAAEL,qCAAqC,CAACM,UAAU,CAAC;IAC7E,IAAI,CAACD,aAAa,CAAC,SAAS,EAAEL,qCAAqC,CAACO,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACnF,IAAI,CAACF,aAAa,CAAC,SAAS,EAAEL,qCAAqC,CAACO,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACnF,IAAI,CAACF,aAAa,CAAC,OAAO,EAAEL,qCAAqC,CAACO,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjF,IAAI,CAACF,aAAa,CAAC,OAAO,EAAEL,qCAAqC,CAACO,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjF,IAAI,CAACC,cAAc,CAAC,QAAQ,EAAER,qCAAqC,CAACS,YAAY,CAAC;IACjF,IAAI,CAACC,OAAO,CAAC,CAAC,CAAC,CAACC,4BAA4B,CAACC,IAAI,CAACZ,qCAAqC,CAACa,OAAO,CAAC;IAChG,IAAI,CAACH,OAAO,CAAC,CAAC,CAAC,CAACC,4BAA4B,CAACC,IAAI,CAACZ,qCAAqC,CAACc,OAAO,CAAC;IAChG,IAAI,CAACJ,OAAO,CAAC,CAAC,CAAC,CAACC,4BAA4B,CAAC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