1 |
- {"ast":null,"code":"import { __decorate } from \"../../../tslib.es6.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { editableInPropertyPage } from \"../../../Decorators/nodeDecorator.js\";\n/**\n * Block used to merge several geometries\n */\nexport class MergeGeometryBlock extends NodeGeometryBlock {\n /**\n * Create a new MergeGeometryBlock\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(\"geometry0\", NodeGeometryBlockConnectionPointTypes.Geometry);\n this.registerInput(\"geometry1\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\n this.registerInput(\"geometry2\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\n this.registerInput(\"geometry3\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\n this.registerInput(\"geometry4\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"MergeGeometryBlock\";\n }\n /**\n * Gets the geometry0 input component\n */\n get geometry0() {\n return this._inputs[0];\n }\n /**\n * Gets the geometry1 input component\n */\n get geometry1() {\n return this._inputs[1];\n }\n /**\n * Gets the geometry2 input component\n */\n get geometry2() {\n return this._inputs[2];\n }\n /**\n * Gets the geometry3 input component\n */\n get geometry3() {\n return this._inputs[3];\n }\n /**\n * Gets the geometry4 input component\n */\n get geometry4() {\n return this._inputs[4];\n }\n /**\n * Gets the geometry output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock(state) {\n const func = state => {\n const vertexDataSource = [];\n if (this.geometry0.isConnected) {\n const data = this.geometry0.getConnectedValue(state);\n if (data) {\n vertexDataSource.push(data);\n }\n }\n if (this.geometry1.isConnected) {\n const data = this.geometry1.getConnectedValue(state);\n if (data) {\n vertexDataSource.push(data);\n }\n }\n if (this.geometry2.isConnected) {\n const data = this.geometry2.getConnectedValue(state);\n if (data) {\n vertexDataSource.push(data);\n }\n }\n if (this.geometry3.isConnected) {\n const data = this.geometry3.getConnectedValue(state);\n if (data) {\n vertexDataSource.push(data);\n }\n }\n if (this.geometry4.isConnected) {\n const data = this.geometry4.getConnectedValue(state);\n if (data) {\n vertexDataSource.push(data);\n }\n }\n if (vertexDataSource.length === 0) {\n return null;\n }\n let vertexData = vertexDataSource[0].clone(); // Preserve source data\n const additionalVertexData = vertexDataSource.slice(1);\n if (additionalVertexData.length && vertexData) {\n vertexData = vertexData.merge(additionalVertexData, true, false, true, true);\n }\n return vertexData;\n };\n if (this.evaluateContext) {\n this.output._storedFunction = func;\n } else {\n this.output._storedFunction = null;\n this.output._storedValue = func(state);\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})], MergeGeometryBlock.prototype, \"evaluateContext\", void 0);\nRegisterClass(\"BABYLON.MergeGeometryBlock\", MergeGeometryBlock);","map":{"version":3,"names":["__decorate","NodeGeometryBlock","RegisterClass","NodeGeometryBlockConnectionPointTypes","editableInPropertyPage","MergeGeometryBlock","constructor","name","evaluateContext","registerInput","Geometry","registerOutput","getClassName","geometry0","_inputs","geometry1","geometry2","geometry3","geometry4","output","_outputs","_buildBlock","state","func","vertexDataSource","isConnected","data","getConnectedValue","push","length","vertexData","clone","additionalVertexData","slice","merge","_storedFunction","_storedValue","_dumpPropertiesCode","codeString","_codeVariableName","serialize","serializationObject","_deserialize","embedded","notifiers","rebuild","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/mergeGeometryBlock.js"],"sourcesContent":["import { __decorate } from \"../../../tslib.es6.js\";\nimport { NodeGeometryBlock } from \"../nodeGeometryBlock.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { editableInPropertyPage } from \"../../../Decorators/nodeDecorator.js\";\n/**\n * Block used to merge several geometries\n */\nexport class MergeGeometryBlock extends NodeGeometryBlock {\n /**\n * Create a new MergeGeometryBlock\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(\"geometry0\", NodeGeometryBlockConnectionPointTypes.Geometry);\n this.registerInput(\"geometry1\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\n this.registerInput(\"geometry2\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\n this.registerInput(\"geometry3\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\n this.registerInput(\"geometry4\", NodeGeometryBlockConnectionPointTypes.Geometry, true);\n this.registerOutput(\"output\", NodeGeometryBlockConnectionPointTypes.Geometry);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"MergeGeometryBlock\";\n }\n /**\n * Gets the geometry0 input component\n */\n get geometry0() {\n return this._inputs[0];\n }\n /**\n * Gets the geometry1 input component\n */\n get geometry1() {\n return this._inputs[1];\n }\n /**\n * Gets the geometry2 input component\n */\n get geometry2() {\n return this._inputs[2];\n }\n /**\n * Gets the geometry3 input component\n */\n get geometry3() {\n return this._inputs[3];\n }\n /**\n * Gets the geometry4 input component\n */\n get geometry4() {\n return this._inputs[4];\n }\n /**\n * Gets the geometry output component\n */\n get output() {\n return this._outputs[0];\n }\n _buildBlock(state) {\n const func = (state) => {\n const vertexDataSource = [];\n if (this.geometry0.isConnected) {\n const data = this.geometry0.getConnectedValue(state);\n if (data) {\n vertexDataSource.push(data);\n }\n }\n if (this.geometry1.isConnected) {\n const data = this.geometry1.getConnectedValue(state);\n if (data) {\n vertexDataSource.push(data);\n }\n }\n if (this.geometry2.isConnected) {\n const data = this.geometry2.getConnectedValue(state);\n if (data) {\n vertexDataSource.push(data);\n }\n }\n if (this.geometry3.isConnected) {\n const data = this.geometry3.getConnectedValue(state);\n if (data) {\n vertexDataSource.push(data);\n }\n }\n if (this.geometry4.isConnected) {\n const data = this.geometry4.getConnectedValue(state);\n if (data) {\n vertexDataSource.push(data);\n }\n }\n if (vertexDataSource.length === 0) {\n return null;\n }\n let vertexData = vertexDataSource[0].clone(); // Preserve source data\n const additionalVertexData = vertexDataSource.slice(1);\n if (additionalVertexData.length && vertexData) {\n vertexData = vertexData.merge(additionalVertexData, true, false, true, true);\n }\n return vertexData;\n };\n if (this.evaluateContext) {\n this.output._storedFunction = func;\n }\n else {\n this.output._storedFunction = null;\n this.output._storedValue = func(state);\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], MergeGeometryBlock.prototype, \"evaluateContext\", void 0);\nRegisterClass(\"BABYLON.MergeGeometryBlock\", MergeGeometryBlock);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,uBAAuB;AAClD,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,qCAAqC,QAAQ,8CAA8C;AACpG,SAASC,sBAAsB,QAAQ,sCAAsC;AAC7E;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,SAASJ,iBAAiB,CAAC;EACtD;AACJ;AACA;AACA;EACIK,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,CAAC;IACX;AACR;AACA;AACA;IACQ,IAAI,CAACC,eAAe,GAAG,KAAK;IAC5B,IAAI,CAACC,aAAa,CAAC,WAAW,EAAEN,qCAAqC,CAACO,QAAQ,CAAC;IAC/E,IAAI,CAACD,aAAa,CAAC,WAAW,EAAEN,qCAAqC,CAACO,QAAQ,EAAE,IAAI,CAAC;IACrF,IAAI,CAACD,aAAa,CAAC,WAAW,EAAEN,qCAAqC,CAACO,QAAQ,EAAE,IAAI,CAAC;IACrF,IAAI,CAACD,aAAa,CAAC,WAAW,EAAEN,qCAAqC,CAACO,QAAQ,EAAE,IAAI,CAAC;IACrF,IAAI,CAACD,aAAa,CAAC,WAAW,EAAEN,qCAAqC,CAACO,QAAQ,EAAE,IAAI,CAAC;IACrF,IAAI,CAACC,cAAc,CAAC,QAAQ,EAAER,qCAAqC,CAACO,QAAQ,CAAC;EACjF;EACA;AACJ;AACA;AACA;EACIE,YAAYA,CAAA,EAAG;IACX,OAAO,oBAAoB;EAC/B;EACA;AACJ;AACA;EACI,IAAIC,SAASA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACC,OAAO,CAAC,CAAC,CAAC;EAC1B;EACA;AACJ;AACA;EACI,IAAIC,SAASA,CAAA,EAAG;IACZ,OAAO,IAAI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