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 step a value\n */\nexport class GeometryStepBlock extends NodeGeometryBlock {\n /**\n * Creates a new GeometryStepBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"edge\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\n this._outputs[0]._typeConnectionSource = this._inputs[0];\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 \"GeometryStepBlock\";\n }\n /**\n * Gets the value operand input component\n */\n get value() {\n return this._inputs[0];\n }\n /**\n * Gets the edge operand input component\n */\n get edge() {\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) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n const func = (value, edge) => {\n if (value < edge) {\n return 0;\n }\n return 1;\n };\n this.output._storedFunction = state => {\n const source = this.value.getConnectedValue(state);\n const edge = this.edge.getConnectedValue(state);\n switch (this.value.type) {\n case NodeGeometryBlockConnectionPointTypes.Int:\n case NodeGeometryBlockConnectionPointTypes.Float:\n {\n return func(source, edge);\n }\n case NodeGeometryBlockConnectionPointTypes.Vector2:\n {\n return new Vector2(func(source.x, edge), func(source.y, edge));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector3:\n {\n return new Vector3(func(source.x, edge), func(source.y, edge), func(source.z, edge));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector4:\n {\n return new Vector4(func(source.x, edge), func(source.y, edge), func(source.z, edge), func(source.w, edge));\n }\n }\n return 0;\n };\n return this;\n }\n}\nRegisterClass(\"BABYLON.GeometryStepBlock\", GeometryStepBlock);","map":{"version":3,"names":["Vector2","Vector3","Vector4","RegisterClass","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","GeometryStepBlock","constructor","name","registerInput","AutoDetect","Float","registerOutput","BasedOnInput","_outputs","_typeConnectionSource","_inputs","excludedConnectionPointTypes","push","Matrix","Geometry","Texture","getClassName","value","edge","output","_buildBlock","isConnected","_storedFunction","_storedValue","func","state","source","getConnectedValue","type","Int","x","y","z","w"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/geometryStepBlock.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 step a value\n */\nexport class GeometryStepBlock extends NodeGeometryBlock {\n /**\n * Creates a new GeometryStepBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"edge\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.BasedOnInput);\n this._outputs[0]._typeConnectionSource = this._inputs[0];\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 \"GeometryStepBlock\";\n }\n /**\n * Gets the value operand input component\n */\n get value() {\n return this._inputs[0];\n }\n /**\n * Gets the edge operand input component\n */\n get edge() {\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) {\n this.output._storedFunction = null;\n this.output._storedValue = null;\n return;\n }\n const func = (value, edge) => {\n if (value < edge) {\n return 0;\n }\n return 1;\n };\n this.output._storedFunction = (state) => {\n const source = this.value.getConnectedValue(state);\n const edge = this.edge.getConnectedValue(state);\n switch (this.value.type) {\n case NodeGeometryBlockConnectionPointTypes.Int:\n case NodeGeometryBlockConnectionPointTypes.Float: {\n return func(source, edge);\n }\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\n return new Vector2(func(source.x, edge), func(source.y, edge));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\n return new Vector3(func(source.x, edge), func(source.y, edge), func(source.z, edge));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\n return new Vector4(func(source.x, edge), func(source.y, edge), func(source.z, edge), func(source.w, edge));\n }\n }\n return 0;\n };\n return this;\n }\n}\nRegisterClass(\"BABYLON.GeometryStepBlock\", GeometryStepBlock);\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,iBAAiB,SAASD,iBAAiB,CAAC;EACrD;AACJ;AACA;AACA;EACIE,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,CAAC;IACX,IAAI,CAACC,aAAa,CAAC,OAAO,EAAEL,q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