09dd504c2ecaa06b7bda0895c9b1a1c5fe0e98708dacbf9da6db378030376e00.json 9.6 KB

1
  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 get the value of the first parameter raised to the power of the second\n */\nexport class GeometryPowBlock extends NodeGeometryBlock {\n /**\n * Creates a new GeometryPowBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"power\", 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 \"GeometryPowBlock\";\n }\n /**\n * Gets the value operand input component\n */\n get value() {\n return this._inputs[0];\n }\n /**\n * Gets the power operand input component\n */\n get power() {\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.value.isConnected || !this.power.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n const func = (value, power) => {\n return Math.pow(value, power);\n };\n this.output._storedFunction = state => {\n const source = this.value.getConnectedValue(state);\n const power = this.power.getConnectedValue(state);\n switch (this.value.type) {\n case NodeGeometryBlockConnectionPointTypes.Int:\n case NodeGeometryBlockConnectionPointTypes.Float:\n {\n return func(source, power);\n }\n case NodeGeometryBlockConnectionPointTypes.Vector2:\n {\n return new Vector2(func(source.x, power), func(source.y, power));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector3:\n {\n return new Vector3(func(source.x, power), func(source.y, power), func(source.z, power));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector4:\n {\n return new Vector4(func(source.x, power), func(source.y, power), func(source.z, power), func(source.w, power));\n }\n }\n return 0;\n };\n return this;\n }\n}\nRegisterClass(\"BABYLON.GeometryPowBlock\", GeometryPowBlock);","map":{"version":3,"names":["Vector2","Vector3","Vector4","RegisterClass","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","GeometryPowBlock","constructor","name","registerInput","AutoDetect","registerOutput","BasedOnInput","_outputs","_typeConnectionSource","_inputs","_linkConnectionTypes","excludedConnectionPointTypes","push","Matrix","Geometry","Texture","getClassName","value","power","output","_buildBlock","isConnected","_storedFunction","_storedValue","func","Math","pow","state","source","getConnectedValue","type","Int","Float","x","y","z","w"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/geometryPowBlock.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 get the value of the first parameter raised to the power of the second\n */\nexport class GeometryPowBlock extends NodeGeometryBlock {\n /**\n * Creates a new GeometryPowBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"power\", 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 \"GeometryPowBlock\";\n }\n /**\n * Gets the value operand input component\n */\n get value() {\n return this._inputs[0];\n }\n /**\n * Gets the power operand input component\n */\n get power() {\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.value.isConnected || !this.power.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n const func = (value, power) => {\n return Math.pow(value, power);\n };\n this.output._storedFunction = (state) => {\n const source = this.value.getConnectedValue(state);\n const power = this.power.getConnectedValue(state);\n switch (this.value.type) {\n case NodeGeometryBlockConnectionPointTypes.Int:\n case NodeGeometryBlockConnectionPointTypes.Float: {\n return func(source, power);\n }\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\n return new Vector2(func(source.x, power), func(source.y, power));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\n return new Vector3(func(source.x, power), func(source.y, power), func(source.z, power));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\n return new Vector4(func(source.x, power), func(source.y, power), func(source.z, power), func(source.w, power));\n }\n }\n return 0;\n };\n return this;\n }\n}\nRegisterClass(\"BABYLON.GeometryPowBlock\", GeometryPowBlock);\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,gBAAgB,SAASD,iBAAiB,CAAC;EACpD;A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