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 value of one parameter modulo another\n */\nexport class GeometryModBlock extends NodeGeometryBlock {\n /**\n * Creates a new GeometryModBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"right\", 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 \"GeometryModBlock\";\n }\n /**\n * Gets the left operand input component\n */\n get left() {\n return this._inputs[0];\n }\n /**\n * Gets the right operand input component\n */\n get right() {\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.left.isConnected || !this.right.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n const func = (left, right) => {\n return left - Math.floor(left / right) * right;\n };\n this.output._storedFunction = state => {\n const left = this.left.getConnectedValue(state);\n const right = this.right.getConnectedValue(state);\n switch (this.left.type) {\n case NodeGeometryBlockConnectionPointTypes.Int:\n case NodeGeometryBlockConnectionPointTypes.Float:\n {\n return func(left, right);\n }\n case NodeGeometryBlockConnectionPointTypes.Vector2:\n {\n return new Vector2(func(left.x, right.x), func(left.y, right.y));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector3:\n {\n return new Vector3(func(left.x, right.x), func(left.y, right.y), func(left.z, right.z));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector4:\n {\n return new Vector4(func(left.x, right.x), func(left.y, right.y), func(left.z, right.z), func(left.w, right.w));\n }\n }\n return 0;\n };\n return this;\n }\n}\nRegisterClass(\"BABYLON.GeometryModBlock\", GeometryModBlock);","map":{"version":3,"names":["Vector2","Vector3","Vector4","RegisterClass","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","GeometryModBlock","constructor","name","registerInput","AutoDetect","registerOutput","BasedOnInput","_outputs","_typeConnectionSource","_inputs","_linkConnectionTypes","excludedConnectionPointTypes","push","Matrix","Geometry","Texture","getClassName","left","right","output","_buildBlock","isConnected","_storedFunction","_storedValue","func","Math","floor","state","getConnectedValue","type","Int","Float","x","y","z","w"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/geometryModBlock.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 value of one parameter modulo another\n */\nexport class GeometryModBlock extends NodeGeometryBlock {\n /**\n * Creates a new GeometryModBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"left\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"right\", 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 \"GeometryModBlock\";\n }\n /**\n * Gets the left operand input component\n */\n get left() {\n return this._inputs[0];\n }\n /**\n * Gets the right operand input component\n */\n get right() {\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.left.isConnected || !this.right.isConnected) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n const func = (left, right) => {\n return left - Math.floor(left / right) * right;\n };\n this.output._storedFunction = (state) => {\n const left = this.left.getConnectedValue(state);\n const right = this.right.getConnectedValue(state);\n switch (this.left.type) {\n case NodeGeometryBlockConnectionPointTypes.Int:\n case NodeGeometryBlockConnectionPointTypes.Float: {\n return func(left, right);\n }\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\n return new Vector2(func(left.x, right.x), func(left.y, right.y));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\n return new Vector3(func(left.x, right.x), func(left.y, right.y), func(left.z, right.z));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\n return new Vector4(func(left.x, right.x), func(left.y, right.y), func(left.z, right.z), func(left.w, right.w));\n }\n }\n return 0;\n };\n return this;\n }\n}\nRegisterClass(\"BABYLON.GeometryModBlock\", GeometryModBlock);\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;AACJ;AACA;AACA;EACIE,WAAWA,CAACC,IAAI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