1 |
- {"ast":null,"code":"import { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector.js\";\n/**\n * Block used to clamp a float\n */\nexport class GeometryClampBlock extends NodeGeometryBlock {\n /** Gets or sets the minimum range */\n get minimum() {\n return this.min.value;\n }\n set minimum(value) {\n this.min.value = value;\n }\n /** Gets or sets the maximum range */\n get maximum() {\n return this.max.value;\n }\n set maximum(value) {\n this.max.value = value;\n }\n /**\n * Creates a new GeometryClampBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"min\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"max\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\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 \"GeometryClampBlock\";\n }\n /**\n * Gets the value input component\n */\n get value() {\n return this._inputs[0];\n }\n /**\n * Gets the min input component\n */\n get min() {\n return this._inputs[1];\n }\n /**\n * Gets the max input component\n */\n get max() {\n return this._inputs[2];\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, min, max) => {\n return Math.max(min, Math.min(value, max));\n };\n this.output._storedFunction = state => {\n const value = this.value.getConnectedValue(state);\n const min = this.min.isConnected ? this.min.getConnectedValue(state) : this.minimum;\n const max = this.max.isConnected ? this.max.getConnectedValue(state) : this.maximum;\n switch (this.value.type) {\n case NodeGeometryBlockConnectionPointTypes.Int:\n case NodeGeometryBlockConnectionPointTypes.Float:\n {\n return func(value, min, max);\n }\n case NodeGeometryBlockConnectionPointTypes.Vector2:\n {\n return new Vector2(func(value.x, min, max), func(value.y, min, max));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector3:\n {\n return new Vector3(func(value.x, min, max), func(value.y, min, max), func(value.z, min, max));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector4:\n {\n return new Vector4(func(value.x, min, max), func(value.y, min, max), func(value.z, min, max), func(value.w, min, max));\n }\n }\n return 0;\n };\n return this;\n }\n _deserialize(serializationObject) {\n super._deserialize(serializationObject);\n this.minimum = serializationObject.minimum;\n this.maximum = serializationObject.maximum;\n }\n}\nRegisterClass(\"BABYLON.GeometryClampBlock\", GeometryClampBlock);","map":{"version":3,"names":["RegisterClass","NodeGeometryBlock","NodeGeometryBlockConnectionPointTypes","Vector2","Vector3","Vector4","GeometryClampBlock","minimum","min","value","maximum","max","constructor","name","registerInput","AutoDetect","Float","registerOutput","BasedOnInput","_outputs","_typeConnectionSource","_inputs","excludedConnectionPointTypes","push","Matrix","Geometry","Texture","getClassName","output","_buildBlock","isConnected","_storedFunction","_storedValue","func","Math","state","getConnectedValue","type","Int","x","y","z","w","_deserialize","serializationObject"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/geometryClampBlock.js"],"sourcesContent":["import { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { Vector2, Vector3, Vector4 } from \"../../../Maths/math.vector.js\";\n/**\n * Block used to clamp a float\n */\nexport class GeometryClampBlock extends NodeGeometryBlock {\n /** Gets or sets the minimum range */\n get minimum() {\n return this.min.value;\n }\n set minimum(value) {\n this.min.value = value;\n }\n /** Gets or sets the maximum range */\n get maximum() {\n return this.max.value;\n }\n set maximum(value) {\n this.max.value = value;\n }\n /**\n * Creates a new GeometryClampBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this.registerInput(\"value\", NodeGeometryBlockConnectionPointTypes.AutoDetect);\n this.registerInput(\"min\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"max\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\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 \"GeometryClampBlock\";\n }\n /**\n * Gets the value input component\n */\n get value() {\n return this._inputs[0];\n }\n /**\n * Gets the min input component\n */\n get min() {\n return this._inputs[1];\n }\n /**\n * Gets the max input component\n */\n get max() {\n return this._inputs[2];\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, min, max) => {\n return Math.max(min, Math.min(value, max));\n };\n this.output._storedFunction = (state) => {\n const value = this.value.getConnectedValue(state);\n const min = this.min.isConnected ? this.min.getConnectedValue(state) : this.minimum;\n const max = this.max.isConnected ? this.max.getConnectedValue(state) : this.maximum;\n switch (this.value.type) {\n case NodeGeometryBlockConnectionPointTypes.Int:\n case NodeGeometryBlockConnectionPointTypes.Float: {\n return func(value, min, max);\n }\n case NodeGeometryBlockConnectionPointTypes.Vector2: {\n return new Vector2(func(value.x, min, max), func(value.y, min, max));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector3: {\n return new Vector3(func(value.x, min, max), func(value.y, min, max), func(value.z, min, max));\n }\n case NodeGeometryBlockConnectionPointTypes.Vector4: {\n return new Vector4(func(value.x, min, max), func(value.y, min, max), func(value.z, min, max), func(value.w, min, max));\n }\n }\n return 0;\n };\n return this;\n }\n _deserialize(serializationObject) {\n super._deserialize(serializationObject);\n this.minimum = serializationObject.minimum;\n this.maximum = serializationObject.maximum;\n }\n}\nRegisterClass(\"BABYLON.GeometryClampBlock\", GeometryClampBlock);\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,qCAAqC,QAAQ,8CAA8C;AACpG,SAASC,OAAO,EAAEC,OAAO,EAAEC,OAAO,QAAQ,+BAA+B;AACzE;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,SAASL,iBAAiB,CAAC;EACtD;EACA,IAAIM,OAAOA,CAAA,EAAG;IACV,OAAO,IAAI,CAACC,GAAG,CAACC,KAAK;EACzB;EACA,IAAIF,OAAOA,CAACE,KAAK,EAAE;IACf,IAAI,CAACD,GAAG,CAACC,KAAK,GAAGA,KAAK;EAC1B;EACA;EACA,IAAIC,OAAOA,CAAA,EAAG;IACV,OAAO,IAAI,CAACC,GAAG,CAACF,KAAK;EACzB;EACA,IAAIC,OAAOA,CAACD,KAAK,EAAE;IACf,IAAI,CAACE,GAAG,CAACF,KAAK,GAAGA,KAAK;EAC1B;EACA;AACJ;AACA;AACA;EACIG,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,CAAC;IACX,IAAI,CAACC,aAAa,CAAC,OAAO,EAAEZ,qCAAqC,CAACa,UAAU,CAAC;IAC7E,IAAI,CAACD,aAAa,CAAC,KAAK,EAAEZ,qCAAqC,CAACc,KAAK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