bd2e42c5c04076987e41278bab5dc75b18ef7b201237954ef6c7f3c4fdad1645.json 5.8 KB

1
  1. {"ast":null,"code":"import { Vector2 } 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 rotate a 2d vector by a given angle\n */\nexport class GeometryRotate2dBlock extends NodeGeometryBlock {\n /**\n * Creates a new GeometryRotate2dBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.Vector2);\n this.registerInput(\"angle\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Vector2);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"GeometryRotate2dBlock\";\n }\n /**\n * Gets the input vector\n */\n get input() {\n return this._inputs[0];\n }\n /**\n * Gets the input angle\n */\n get angle() {\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.input.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n this.output._storedFunction = state => {\n const input = this.input.getConnectedValue(state);\n const angle = this.angle.getConnectedValue(state);\n return new Vector2(Math.cos(angle) * input.x - Math.sin(angle) * input.y, Math.sin(angle) * input.x + Math.cos(angle) * input.y);\n };\n return this;\n }\n}\nRegisterClass(\"BABYLON.GeometryRotate2dBlock\", GeometryRotate2dBlock);","map":{"version":3,"names":["Vector2","RegisterClass","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","GeometryRotate2dBlock","constructor","name","registerInput","Float","registerOutput","getClassName","input","_inputs","angle","output","_outputs","_buildBlock","isConnected","_storedFunction","_storedValue","state","getConnectedValue","Math","cos","x","sin","y"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/geometryRotate2dBlock.js"],"sourcesContent":["import { Vector2 } 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 rotate a 2d vector by a given angle\n */\nexport class GeometryRotate2dBlock extends NodeGeometryBlock {\n /**\n * Creates a new GeometryRotate2dBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"input\", NodeGeometryBlockConnectionPointTypes.Vector2);\n this.registerInput(\"angle\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Vector2);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"GeometryRotate2dBlock\";\n }\n /**\n * Gets the input vector\n */\n get input() {\n return this._inputs[0];\n }\n /**\n * Gets the input angle\n */\n get angle() {\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.input.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n this.output._storedFunction = (state) => {\n const input = this.input.getConnectedValue(state);\n const angle = this.angle.getConnectedValue(state);\n return new Vector2(Math.cos(angle) * input.x - Math.sin(angle) * input.y, Math.sin(angle) * input.x + Math.cos(angle) * input.y);\n };\n return this;\n }\n}\nRegisterClass(\"BABYLON.GeometryRotate2dBlock\", GeometryRotate2dBlock);\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,+BAA+B;AACvD,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,qCAAqC,QAAQ,8CAA8C;AACpG,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,SAASD,iBAAiB,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