6ff7593bff14ff662adcbe203cd6ba05eeff7a61561ba4088bd5d476f8679bf5.json 7.0 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 convert from int to float\n */\nexport class IntFloatConverterBlock extends NodeGeometryBlock {\n /**\n * Create a new IntFloatConverterBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"float \", NodeGeometryBlockConnectionPointTypes.Float, true);\n this.registerInput(\"int \", NodeGeometryBlockConnectionPointTypes.Int, true);\n this.registerOutput(\"float\", NodeGeometryBlockConnectionPointTypes.Float);\n this.registerOutput(\"int\", NodeGeometryBlockConnectionPointTypes.Int);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"IntFloatConverterBlock\";\n }\n /**\n * Gets the float input component\n */\n get floatIn() {\n return this._inputs[0];\n }\n /**\n * Gets the int input component\n */\n get intIn() {\n return this._inputs[1];\n }\n /**\n * Gets the float output component\n */\n get floatOut() {\n return this._outputs[0];\n }\n /**\n * Gets the int output component\n */\n get intOut() {\n return this._outputs[1];\n }\n _inputRename(name) {\n if (name === \"float \") {\n return \"floatIn\";\n }\n if (name === \"int \") {\n return \"intIn\";\n }\n return name;\n }\n _buildBlock() {\n this.floatOut._storedFunction = state => {\n if (this.floatIn.isConnected) {\n return this.floatIn.getConnectedValue(state);\n }\n if (this.intIn.isConnected) {\n return this.intIn.getConnectedValue(state);\n }\n return 0;\n };\n this.intOut._storedFunction = state => {\n if (this.floatIn.isConnected) {\n return Math.floor(this.floatIn.getConnectedValue(state));\n }\n if (this.intIn.isConnected) {\n return Math.floor(this.intIn.getConnectedValue(state));\n }\n return 0;\n };\n }\n}\nRegisterClass(\"BABYLON.IntFloatConverterBlock\", IntFloatConverterBlock);","map":{"version":3,"names":["RegisterClass","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","IntFloatConverterBlock","constructor","name","registerInput","Float","Int","registerOutput","getClassName","floatIn","_inputs","intIn","floatOut","_outputs","intOut","_inputRename","_buildBlock","_storedFunction","state","isConnected","getConnectedValue","Math","floor"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/intFloatConverterBlock.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 convert from int to float\n */\nexport class IntFloatConverterBlock extends NodeGeometryBlock {\n /**\n * Create a new IntFloatConverterBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"float \", NodeGeometryBlockConnectionPointTypes.Float, true);\n this.registerInput(\"int \", NodeGeometryBlockConnectionPointTypes.Int, true);\n this.registerOutput(\"float\", NodeGeometryBlockConnectionPointTypes.Float);\n this.registerOutput(\"int\", NodeGeometryBlockConnectionPointTypes.Int);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"IntFloatConverterBlock\";\n }\n /**\n * Gets the float input component\n */\n get floatIn() {\n return this._inputs[0];\n }\n /**\n * Gets the int input component\n */\n get intIn() {\n return this._inputs[1];\n }\n /**\n * Gets the float output component\n */\n get floatOut() {\n return this._outputs[0];\n }\n /**\n * Gets the int output component\n */\n get intOut() {\n return this._outputs[1];\n }\n _inputRename(name) {\n if (name === \"float \") {\n return \"floatIn\";\n }\n if (name === \"int \") {\n return \"intIn\";\n }\n return name;\n }\n _buildBlock() {\n this.floatOut._storedFunction = (state) => {\n if (this.floatIn.isConnected) {\n return this.floatIn.getConnectedValue(state);\n }\n if (this.intIn.isConnected) {\n return this.intIn.getConnectedValue(state);\n }\n return 0;\n };\n this.intOut._storedFunction = (state) => {\n if (this.floatIn.isConnected) {\n return Math.floor(this.floatIn.getConnectedValue(state));\n }\n if (this.intIn.isConnected) {\n return Math.floor(this.intIn.getConnectedValue(state));\n }\n return 0;\n };\n }\n}\nRegisterClass(\"BABYLON.IntFloatConverterBlock\", IntFloatConverterBlock);\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,qCAAqC,QAAQ,8CAA8C;AACpG,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASD,iBAAiB,CAAC;EAC1D;AACJ;AACA;AACA;EACIE,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,CAAC;IACX,IAAI,CAACC,aAAa,CAAC,QAAQ,EAAEL,qCAAqC,CAACM,KAAK,EAAE,IAAI,CAAC;IAC/E,IAAI,CAACD,aAAa,CAAC,MAAM,EAAEL,qCAAqC,CAACO,GAAG,EAAE,IAAI,CAAC;IAC3E,IAAI,CAACC,cAAc,CAAC,OAAO,EAAER,qCAAqC,CAACM,KAAK,CAAC;IACzE,IAAI,CAACE,cAAc,CAAC,KAAK,EAAER,qCAAqC,CAACO,GAAG,CAAC;EACzE;EACA;AACJ;AACA;AACA;EACIE,YAAYA,CAAA,EAAG;IACX,OAAO,wBAAwB;EACnC;EACA;AACJ;AACA;EACI,IAAIC,OAAOA,CAAA,EAAG;IACV,OAAO,IAAI,CAACC,OAAO,CAAC,CAAC,CAAC;EAC1B;EACA;AACJ;AACA;EACI,IAAIC,KAAKA,CAAA,EAAG;IACR,OAAO,IAAI,CAACD,OAAO,CAAC,CAAC,CAAC;EAC1B;EACA;AACJ;AACA;EACI,IAAIE,QAAQA,CAAA,EAAG;IACX,OAAO,IAAI,CAACC,QAAQ,CAAC,CAAC,CAAC;EAC3B;EACA;AACJ;AACA;EACI,IAAIC,MAAMA,CAAA,EAAG;IACT,OAAO,IAAI,CAACD,QAAQ,CAAC,CAAC,CAAC;EAC3B;EACAE,YAAYA,CAACZ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