1 |
- {"ast":null,"code":"import { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\n/**\n * Block used to compute arc tangent of 2 values\n */\nexport class GeometryArcTan2Block extends NodeGeometryBlock {\n /**\n * Creates a new GeometryArcTan2Block\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"x\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"y\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\n this._outputs[0]._typeConnectionSource = this._inputs[0];\n this._linkConnectionTypes(0, 1);\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 }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"GeometryArcTan2Block\";\n }\n /**\n * Gets the x operand input component\n */\n get x() {\n return this._inputs[0];\n }\n /**\n * Gets the y operand input component\n */\n get y() {\n return this._inputs[1];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock() {\n if (!this.x.isConnected || !this.y.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n const func = (x, y) => {\n return Math.atan2(x, y);\n };\n this.output._storedFunction = state => {\n const x = this.x.getConnectedValue(state);\n const y = this.y.getConnectedValue(state);\n switch (this.x.type) {\n case NodeGeometryBlockConnectionPointTypes.Int:\n case NodeGeometryBlockConnectionPointTypes.Float:\n {\n return func(x, y);\n }\n case NodeGeometryBlockConnectionPointTypes.Vector2:\n {\n return new Vector2(func(x.x, y.x), func(x.y, y.y));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector3:\n {\n return new Vector3(func(x.x, y.x), func(x.y, y.y), func(x.z, y.z));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector4:\n {\n return new Vector4(func(x.x, y.x), func(x.y, y.y), func(x.z, y.z), func(x.w, y.w));\n }\n }\n return 0;\n };\n }\n}\nRegisterClass(\"BABYLON.GeometryArcTan2Block\", GeometryArcTan2Block);","map":{"version":3,"names":["Vector2","Vector3","Vector4","RegisterClass","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","GeometryArcTan2Block","constructor","name","registerInput","AutoDetect","registerOutput","BasedOnInput","_outputs","_typeConnectionSource","_inputs","_linkConnectionTypes","excludedConnectionPointTypes","push","Matrix","Geometry","Texture","getClassName","x","y","output","_buildBlock","isConnected","_storedFunction","_storedValue","func","Math","atan2","state","getConnectedValue","type","Int","Float","z","w"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/geometryArcTan2Block.js"],"sourcesContent":["import { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\n/**\n * Block used to compute arc tangent of 2 values\n */\nexport class GeometryArcTan2Block extends NodeGeometryBlock {\n /**\n * Creates a new GeometryArcTan2Block\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"x\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"y\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\n this._outputs[0]._typeConnectionSource = this._inputs[0];\n this._linkConnectionTypes(0, 1);\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 }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"GeometryArcTan2Block\";\n }\n /**\n * Gets the x operand input component\n */\n get x() {\n return this._inputs[0];\n }\n /**\n * Gets the y operand input component\n */\n get y() {\n return this._inputs[1];\n }\n /**\n * Gets the output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock() {\n if (!this.x.isConnected || !this.y.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n const func = (x, y) => {\n return Math.atan2(x, y);\n };\n this.output._storedFunction = (state) => {\n const x = this.x.getConnectedValue(state);\n const y = this.y.getConnectedValue(state);\n switch (this.x.type) {\n case NodeGeometryBlockConnectionPointTypes.Int:\n case NodeGeometryBlockConnectionPointTypes.Float: {\n return func(x, y);\n }\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\n return new Vector2(func(x.x, y.x), func(x.y, y.y));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\n return new Vector3(func(x.x, y.x), func(x.y, y.y), func(x.z, y.z));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\n return new Vector4(func(x.x, y.x), func(x.y, y.y), func(x.z, y.z), func(x.w, y.w));\n }\n }\n return 0;\n };\n }\n}\nRegisterClass(\"BABYLON.GeometryArcTan2Block\", GeometryArcTan2Block);\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,OAAO,EAAEC,OAAO,QAAQ,+BAA+B;AACzE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,qCAAqC,QAAQ,8CAA8C;AACpG,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,SAASD,iBAAiB,CAAC;EACxD;AACJ;AACA;AACA;EACIE,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