2edb1d49b16c73eb24bfbefe1354057ded5fcafb25c5a7fd15872837afbf7023.json 14 KB

1
  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 { CreateSphereVertexData } from \"../../../Builders/sphereBuilder.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\n/**\n * Defines a block used to generate sphere geometry data\n */\nexport class SphereBlock extends NodeGeometryBlock {\n /**\n * Create a new SphereBlock\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(\"segments\", NodeGeometryBlockConnectionPointTypes.Int, true, 32);\n this.registerInput(\"diameter\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\n this.registerInput(\"diameterX\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"diameterY\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"diameterZ\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"arc\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\n this.registerInput(\"slice\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"SphereBlock\";\n }\n /**\n * Gets the segments input component\n */\n get segments() {\n return this._inputs[0];\n }\n /**\n * Gets the diameter input component\n */\n get diameter() {\n return this._inputs[1];\n }\n /**\n * Gets the diameterX input component\n */\n get diameterX() {\n return this._inputs[2];\n }\n /**\n * Gets the diameterY input component\n */\n get diameterY() {\n return this._inputs[3];\n }\n /**\n * Gets the diameterZ input component\n */\n get diameterZ() {\n return this._inputs[4];\n }\n /**\n * Gets the arc input component\n */\n get arc() {\n return this._inputs[5];\n }\n /**\n * Gets the slice input component\n */\n get slice() {\n return this._inputs[6];\n }\n /**\n * Gets the geometry output component\n */\n get geometry() {\n return this._outputs[0];\n }\n autoConfigure() {\n if (!this.diameter.isConnected) {\n const diameterInput = new GeometryInputBlock(\"Diameter\");\n diameterInput.value = 1;\n diameterInput.output.connectTo(this.diameter);\n }\n }\n _buildBlock(state) {\n const options = {};\n const func = state => {\n options.segments = this.segments.getConnectedValue(state);\n options.diameter = this.diameter.getConnectedValue(state);\n options.diameterX = this.diameterX.getConnectedValue(state);\n options.diameterY = this.diameterY.getConnectedValue(state);\n options.diameterZ = this.diameterZ.getConnectedValue(state);\n options.arc = this.arc.getConnectedValue(state);\n options.slice = this.slice.getConnectedValue(state);\n // Append vertex data from the plane builder\n return CreateSphereVertexData(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})], SphereBlock.prototype, \"evaluateContext\", void 0);\nRegisterClass(\"BABYLON.SphereBlock\", SphereBlock);","map":{"version":3,"names":["__decorate","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","GeometryInputBlock","RegisterClass","CreateSphereVertexData","editableInPropertyPage","SphereBlock","constructor","name","evaluateContext","registerInput","Int","Float","registerOutput","Geometry","getClassName","segments","_inputs","diameter","diameterX","diameterY","diameterZ","arc","slice","geometry","_outputs","autoConfigure","isConnected","diameterInput","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/sphereBlock.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 { CreateSphereVertexData } from \"../../../Builders/sphereBuilder.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\n/**\n * Defines a block used to generate sphere geometry data\n */\nexport class SphereBlock extends NodeGeometryBlock {\n /**\n * Create a new SphereBlock\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(\"segments\", NodeGeometryBlockConnectionPointTypes.Int, true, 32);\n this.registerInput(\"diameter\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\n this.registerInput(\"diameterX\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"diameterY\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"diameterZ\", NodeGeometryBlockConnectionPointTypes.Float, true, 0);\n this.registerInput(\"arc\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\n this.registerInput(\"slice\", NodeGeometryBlockConnectionPointTypes.Float, true, 1);\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"SphereBlock\";\n }\n /**\n * Gets the segments input component\n */\n get segments() {\n return this._inputs[0];\n }\n /**\n * Gets the diameter input component\n */\n get diameter() {\n return this._inputs[1];\n }\n /**\n * Gets the diameterX input component\n */\n get diameterX() {\n return this._inputs[2];\n }\n /**\n * Gets the diameterY input component\n */\n get diameterY() {\n return this._inputs[3];\n }\n /**\n * Gets the diameterZ input component\n */\n get diameterZ() {\n return this._inputs[4];\n }\n /**\n * Gets the arc input component\n */\n get arc() {\n return this._inputs[5];\n }\n /**\n * Gets the slice input component\n */\n get slice() {\n return this._inputs[6];\n }\n /**\n * Gets the geometry output component\n */\n get geometry() {\n return this._outputs[0];\n }\n autoConfigure() {\n if (!this.diameter.isConnected) {\n const diameterInput = new GeometryInputBlock(\"Diameter\");\n diameterInput.value = 1;\n diameterInput.output.connectTo(this.diameter);\n }\n }\n _buildBlock(state) {\n const options = {};\n const func = (state) => {\n options.segments = this.segments.getConnectedValue(state);\n options.diameter = this.diameter.getConnectedValue(state);\n options.diameterX = this.diameterX.getConnectedValue(state);\n options.diameterY = this.diameterY.getConnectedValue(state);\n options.diameterZ = this.diameterZ.getConnectedValue(state);\n options.arc = this.arc.getConnectedValue(state);\n options.slice = this.slice.getConnectedValue(state);\n // Append vertex data from the plane builder\n return CreateSphereVertexData(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], SphereBlock.prototype, \"evaluateContext\", void 0);\nRegisterClass(\"BABYLON.SphereBlock\", SphereBlock);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,qCAAqC,QAAQ,iDAAiD;AACvG,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASC,sBAAsB,QAAQ,yCAAyC;AAChF;AACA;AACA;AACA,OAAO,MAAMC,WAAW,SAASL,iBAAiB,CAAC;EAC/C;AACJ;AACA;AACA;EACIM,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,CAAC;IACX;AACR;AACA;AACA;IACQ,IAAI,CAACC,eAAe,GAAG,KAAK;IAC5B,IAAI,CAACC,aAAa,CAAC,UAAU,EAAEV,qCAAqC,CAACW,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC;IACnF,IAAI,CAACD,aAAa,CAAC,UAAU,EAAEV,qCAAqC,CAACY,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpF,IAAI,CAACF,aAAa,CAAC,WAAW,EAAEV,qCAAqC,CAACY,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrF,IAAI,CAACF,aAAa,CAAC,WAAW,EAAEV,qCAAqC,CAACY,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrF,IAAI,CAACF,aAAa,CAAC,W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