5807a2043cdcb3b33ef6721ec99b4e731a17ce70683764258b29286557f0ab4c.json 6.0 KB

1
  1. {"ast":null,"code":"import { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { extractMinAndMax } from \"../../../Maths/math.functions.js\";\n/**\n * Block used to get the bounding info of a geometry\n */\nexport class BoundingBlock extends NodeGeometryBlock {\n /**\n * Create a new BoundingBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\n this.registerOutput(\"min\", NodeGeometryBlockConnectionPointTypes.Vector3);\n this.registerOutput(\"max\", NodeGeometryBlockConnectionPointTypes.Vector3);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"BoundingBlock\";\n }\n /**\n * Gets the geometry input component\n */\n get geometry() {\n return this._inputs[0];\n }\n /**\n * Gets the min output component\n */\n get min() {\n return this._outputs[0];\n }\n /**\n * Gets the max output component\n */\n get max() {\n return this._outputs[1];\n }\n _buildBlock() {\n this.min._storedFunction = state => {\n const geometry = this.geometry.getConnectedValue(state);\n if (!geometry) {\n return null;\n }\n const boundingInfo = extractMinAndMax(geometry.positions, 0, geometry.positions.length / 3);\n return boundingInfo.minimum;\n };\n this.max._storedFunction = state => {\n const geometry = this.geometry.getConnectedValue(state);\n if (!geometry) {\n return null;\n }\n const boundingInfo = extractMinAndMax(geometry.positions, 0, geometry.positions.length / 3);\n return boundingInfo.maximum;\n };\n }\n}\nRegisterClass(\"BABYLON.BoundingBlock\", BoundingBlock);","map":{"version":3,"names":["NodeGeometryBlock","RegisterClass","NodeGeometryBlockConnectionPointTypes","extractMinAndMax","BoundingBlock","constructor","name","registerInput","Geometry","registerOutput","Vector3","getClassName","geometry","_inputs","min","_outputs","max","_buildBlock","_storedFunction","state","getConnectedValue","boundingInfo","positions","length","minimum","maximum"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/boundingBlock.js"],"sourcesContent":["import { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { extractMinAndMax } from \"../../../Maths/math.functions.js\";\n/**\n * Block used to get the bounding info of a geometry\n */\nexport class BoundingBlock extends NodeGeometryBlock {\n /**\n * Create a new BoundingBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\n this.registerOutput(\"min\", NodeGeometryBlockConnectionPointTypes.Vector3);\n this.registerOutput(\"max\", NodeGeometryBlockConnectionPointTypes.Vector3);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"BoundingBlock\";\n }\n /**\n * Gets the geometry input component\n */\n get geometry() {\n return this._inputs[0];\n }\n /**\n * Gets the min output component\n */\n get min() {\n return this._outputs[0];\n }\n /**\n * Gets the max output component\n */\n get max() {\n return this._outputs[1];\n }\n _buildBlock() {\n this.min._storedFunction = (state) => {\n const geometry = this.geometry.getConnectedValue(state);\n if (!geometry) {\n return null;\n }\n const boundingInfo = extractMinAndMax(geometry.positions, 0, geometry.positions.length / 3);\n return boundingInfo.minimum;\n };\n this.max._storedFunction = (state) => {\n const geometry = this.geometry.getConnectedValue(state);\n if (!geometry) {\n return null;\n }\n const boundingInfo = extractMinAndMax(geometry.positions, 0, geometry.positions.length / 3);\n return boundingInfo.maximum;\n };\n }\n}\nRegisterClass(\"BABYLON.BoundingBlock\", BoundingBlock);\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,qCAAqC,QAAQ,8CAA8C;AACpG,SAASC,gBAAgB,QAAQ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