1 |
- {"ast":null,"code":"import { __decorate } from \"../../../../tslib.es6.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock.js\";\nimport { GeometryInputBlock } from \"../geometryInputBlock.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { CreateIcoSphereVertexData } from \"../../../Builders/icoSphereBuilder.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\n/**\n * Defines a block used to generate icosphere geometry data\n */\nexport class IcoSphereBlock extends NodeGeometryBlock {\n /**\n * Create a new IcoSphereBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n /**\n * Gets or sets a boolean indicating that this block can evaluate context\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\n */\n this.evaluateContext = false;\n this.registerInput(\"radius\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\n this.registerInput(\"radiusX\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"radiusY\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"radiusZ\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"subdivisions\", NodeGeometryBlockConnectionPointTypes.Int, true, 4);\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"IcoSphereBlock\";\n }\n /**\n * Gets the radius input component\n */\n get radius() {\n return this._inputs[0];\n }\n /**\n * Gets the radiusX input component\n */\n get radiusX() {\n return this._inputs[1];\n }\n /**\n * Gets the radiusY input component\n */\n get radiusY() {\n return this._inputs[2];\n }\n /**\n * Gets the radiusZ input component\n */\n get radiusZ() {\n return this._inputs[3];\n }\n /**\n * Gets the subdivisions input component\n */\n get subdivisions() {\n return this._inputs[4];\n }\n /**\n * Gets the geometry output component\n */\n get geometry() {\n return this._outputs[0];\n }\n autoConfigure() {\n if (!this.radius.isConnected) {\n const radiusInput = new GeometryInputBlock(\"Radius\");\n radiusInput.value = 0.2;\n radiusInput.output.connectTo(this.radius);\n }\n }\n _buildBlock(state) {\n const options = {};\n const func = state => {\n options.radius = this.radius.getConnectedValue(state);\n options.subdivisions = this.subdivisions.getConnectedValue(state);\n options.radiusX = this.radiusX.getConnectedValue(state);\n options.radiusY = this.radiusY.getConnectedValue(state);\n options.radiusZ = this.radiusZ.getConnectedValue(state);\n // Append vertex data from the plane builder\n return CreateIcoSphereVertexData(options);\n };\n if (this.evaluateContext) {\n this.geometry._storedFunction = func;\n } else {\n const value = func(state);\n this.geometry._storedFunction = () => {\n this.geometry._executionCount = 1;\n return value.clone();\n };\n }\n }\n _dumpPropertiesCode() {\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\n return codeString;\n }\n /**\n * Serializes this block in a JSON representation\n * @returns the serialized block object\n */\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.evaluateContext = this.evaluateContext;\n return serializationObject;\n }\n _deserialize(serializationObject) {\n super._deserialize(serializationObject);\n this.evaluateContext = serializationObject.evaluateContext;\n }\n}\n__decorate([editableInPropertyPage(\"Evaluate context\", 0 /* PropertyTypeForEdition.Boolean */, \"ADVANCED\", {\n embedded: true,\n notifiers: {\n rebuild: true\n }\n})], IcoSphereBlock.prototype, \"evaluateContext\", void 0);\nRegisterClass(\"BABYLON.IcoSphereBlock\", IcoSphereBlock);","map":{"version":3,"names":["__decorate","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","GeometryInputBlock","RegisterClass","CreateIcoSphereVertexData","editableInPropertyPage","IcoSphereBlock","constructor","name","evaluateContext","registerInput","Float","Int","registerOutput","Geometry","getClassName","radius","_inputs","radiusX","radiusY","radiusZ","subdivisions","geometry","_outputs","autoConfigure","isConnected","radiusInput","value","output","connectTo","_buildBlock","state","options","func","getConnectedValue","_storedFunction","_executionCount","clone","_dumpPropertiesCode","codeString","_codeVariableName","serialize","serializationObject","_deserialize","embedded","notifiers","rebuild","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/Sources/icoSphereBlock.js"],"sourcesContent":["import { __decorate } from \"../../../../tslib.es6.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock.js\";\nimport { GeometryInputBlock } from \"../geometryInputBlock.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { CreateIcoSphereVertexData } from \"../../../Builders/icoSphereBuilder.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\n/**\n * Defines a block used to generate icosphere geometry data\n */\nexport class IcoSphereBlock extends NodeGeometryBlock {\n /**\n * Create a new IcoSphereBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n /**\n * Gets or sets a boolean indicating that this block can evaluate context\n * Build performance is improved when this value is set to false as the system will cache values instead of reevaluating everything per context change\n */\n this.evaluateContext = false;\n this.registerInput(\"radius\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\n this.registerInput(\"radiusX\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"radiusY\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"radiusZ\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"subdivisions\", NodeGeometryBlockConnectionPointTypes.Int, true, 4);\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"IcoSphereBlock\";\n }\n /**\n * Gets the radius input component\n */\n get radius() {\n return this._inputs[0];\n }\n /**\n * Gets the radiusX input component\n */\n get radiusX() {\n return this._inputs[1];\n }\n /**\n * Gets the radiusY input component\n */\n get radiusY() {\n return this._inputs[2];\n }\n /**\n * Gets the radiusZ input component\n */\n get radiusZ() {\n return this._inputs[3];\n }\n /**\n * Gets the subdivisions input component\n */\n get subdivisions() {\n return this._inputs[4];\n }\n /**\n * Gets the geometry output component\n */\n get geometry() {\n return this._outputs[0];\n }\n autoConfigure() {\n if (!this.radius.isConnected) {\n const radiusInput = new GeometryInputBlock(\"Radius\");\n radiusInput.value = 0.2;\n radiusInput.output.connectTo(this.radius);\n }\n }\n _buildBlock(state) {\n const options = {};\n const func = (state) => {\n options.radius = this.radius.getConnectedValue(state);\n options.subdivisions = this.subdivisions.getConnectedValue(state);\n options.radiusX = this.radiusX.getConnectedValue(state);\n options.radiusY = this.radiusY.getConnectedValue(state);\n options.radiusZ = this.radiusZ.getConnectedValue(state);\n // Append vertex data from the plane builder\n return CreateIcoSphereVertexData(options);\n };\n if (this.evaluateContext) {\n this.geometry._storedFunction = func;\n }\n else {\n const value = func(state);\n this.geometry._storedFunction = () => {\n this.geometry._executionCount = 1;\n return value.clone();\n };\n }\n }\n _dumpPropertiesCode() {\n const codeString = super._dumpPropertiesCode() + `${this._codeVariableName}.evaluateContext = ${this.evaluateContext ? \"true\" : \"false\"};\\n`;\n return codeString;\n }\n /**\n * Serializes this block in a JSON representation\n * @returns the serialized block object\n */\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.evaluateContext = this.evaluateContext;\n return serializationObject;\n }\n _deserialize(serializationObject) {\n super._deserialize(serializationObject);\n this.evaluateContext = serializationObject.evaluateContext;\n }\n}\n__decorate([\n editableInPropertyPage(\"Evaluate context\", 0 /* PropertyTypeForEdition.Boolean */, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\n], IcoSphereBlock.prototype, \"evaluateContext\", void 0);\nRegisterClass(\"BABYLON.IcoSphereBlock\", IcoSphereBlock);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,qCAAqC,QAAQ,iDAAiD;AACvG,SAASC,iBAAiB,QAAQ,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