24ce23b3682628a20744f06b17d6b11bccbd64d796662a86dd4735f5982d51f8.json 12 KB

1
  1. {"ast":null,"code":"import { __decorate } from \"../../../../tslib.es6.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { VertexData } from \"../../../../Meshes/mesh.vertexData.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\n/**\n * Defines a block used to generate a user defined mesh geometry data\n */\nexport class MeshBlock extends NodeGeometryBlock {\n /**\n * Gets or sets the mesh to use to get vertex data\n */\n get mesh() {\n return this._mesh;\n }\n set mesh(value) {\n this._mesh = value;\n }\n /**\n * Create a new MeshBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this._cachedVertexData = null;\n /**\n * Gets or sets a boolean indicating that winding order needs to be reserved\n */\n this.reverseWindingOrder = false;\n /**\n * Gets or sets a boolean indicating that this block should serialize its cached data\n */\n this.serializedCachedData = false;\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"MeshBlock\";\n }\n /**\n * Gets a boolean indicating if the block is using cached data\n */\n get isUsingCachedData() {\n return !this.mesh && !!this._cachedVertexData;\n }\n /**\n * Gets the geometry output component\n */\n get geometry() {\n return this._outputs[0];\n }\n /**\n * Remove stored data\n */\n cleanData() {\n this._mesh = null;\n this._cachedVertexData = null;\n }\n _buildBlock() {\n if (!this._mesh) {\n if (this._cachedVertexData) {\n this.geometry._storedValue = this._cachedVertexData.clone();\n } else {\n this.geometry._storedValue = null;\n }\n return;\n }\n const vertexData = VertexData.ExtractFromMesh(this._mesh, false, true);\n this._cachedVertexData = null;\n if (this.reverseWindingOrder && vertexData.indices) {\n for (let index = 0; index < vertexData.indices.length; index += 3) {\n const tmp = vertexData.indices[index];\n vertexData.indices[index] = vertexData.indices[index + 2];\n vertexData.indices[index + 2] = tmp;\n }\n }\n this.geometry._storedFunction = () => {\n return vertexData.clone();\n };\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.serializedCachedData = this.serializedCachedData;\n if (this.serializedCachedData) {\n if (this._mesh) {\n serializationObject.cachedVertexData = VertexData.ExtractFromMesh(this._mesh, false, true).serialize();\n } else if (this._cachedVertexData) {\n serializationObject.cachedVertexData = this._cachedVertexData.serialize();\n }\n }\n serializationObject.reverseWindingOrder = this.reverseWindingOrder;\n return serializationObject;\n }\n _deserialize(serializationObject) {\n super._deserialize(serializationObject);\n if (serializationObject.cachedVertexData) {\n this._cachedVertexData = VertexData.Parse(serializationObject.cachedVertexData);\n }\n this.serializedCachedData = !!serializationObject.serializedCachedData;\n this.reverseWindingOrder = serializationObject.reverseWindingOrder;\n }\n}\n__decorate([editableInPropertyPage(\"Serialize cached data\", 0 /* PropertyTypeForEdition.Boolean */, \"ADVANCED\", {\n embedded: true,\n notifiers: {\n rebuild: true\n }\n})], MeshBlock.prototype, \"serializedCachedData\", void 0);\nRegisterClass(\"BABYLON.MeshBlock\", MeshBlock);","map":{"version":3,"names":["__decorate","NodeGeometryBlockConnectionPointTypes","NodeGeometryBlock","RegisterClass","VertexData","editableInPropertyPage","MeshBlock","mesh","_mesh","value","constructor","name","_cachedVertexData","reverseWindingOrder","serializedCachedData","registerOutput","Geometry","getClassName","isUsingCachedData","geometry","_outputs","cleanData","_buildBlock","_storedValue","clone","vertexData","ExtractFromMesh","indices","index","length","tmp","_storedFunction","serialize","serializationObject","cachedVertexData","_deserialize","Parse","embedded","notifiers","rebuild","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Meshes/Node/Blocks/Sources/meshBlock.js"],"sourcesContent":["import { __decorate } from \"../../../../tslib.es6.js\";\nimport { NodeGeometryBlockConnectionPointTypes } from \"../../Enums/nodeGeometryConnectionPointTypes.js\";\nimport { NodeGeometryBlock } from \"../../nodeGeometryBlock.js\";\nimport { RegisterClass } from \"../../../../Misc/typeStore.js\";\nimport { VertexData } from \"../../../../Meshes/mesh.vertexData.js\";\nimport { editableInPropertyPage } from \"../../../../Decorators/nodeDecorator.js\";\n/**\n * Defines a block used to generate a user defined mesh geometry data\n */\nexport class MeshBlock extends NodeGeometryBlock {\n /**\n * Gets or sets the mesh to use to get vertex data\n */\n get mesh() {\n return this._mesh;\n }\n set mesh(value) {\n this._mesh = value;\n }\n /**\n * Create a new MeshBlock\n * @param name defines the block name\n */\n constructor(name) {\n super(name);\n this._cachedVertexData = null;\n /**\n * Gets or sets a boolean indicating that winding order needs to be reserved\n */\n this.reverseWindingOrder = false;\n /**\n * Gets or sets a boolean indicating that this block should serialize its cached data\n */\n this.serializedCachedData = false;\n this.registerOutput(\"geometry\", NodeGeometryBlockConnectionPointTypes.Geometry);\n }\n /**\n * Gets the current class name\n * @returns the class name\n */\n getClassName() {\n return \"MeshBlock\";\n }\n /**\n * Gets a boolean indicating if the block is using cached data\n */\n get isUsingCachedData() {\n return !this.mesh && !!this._cachedVertexData;\n }\n /**\n * Gets the geometry output component\n */\n get geometry() {\n return this._outputs[0];\n }\n /**\n * Remove stored data\n */\n cleanData() {\n this._mesh = null;\n this._cachedVertexData = null;\n }\n _buildBlock() {\n if (!this._mesh) {\n if (this._cachedVertexData) {\n this.geometry._storedValue = this._cachedVertexData.clone();\n }\n else {\n this.geometry._storedValue = null;\n }\n return;\n }\n const vertexData = VertexData.ExtractFromMesh(this._mesh, false, true);\n this._cachedVertexData = null;\n if (this.reverseWindingOrder && vertexData.indices) {\n for (let index = 0; index < vertexData.indices.length; index += 3) {\n const tmp = vertexData.indices[index];\n vertexData.indices[index] = vertexData.indices[index + 2];\n vertexData.indices[index + 2] = tmp;\n }\n }\n this.geometry._storedFunction = () => {\n return vertexData.clone();\n };\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.serializedCachedData = this.serializedCachedData;\n if (this.serializedCachedData) {\n if (this._mesh) {\n serializationObject.cachedVertexData = VertexData.ExtractFromMesh(this._mesh, false, true).serialize();\n }\n else if (this._cachedVertexData) {\n serializationObject.cachedVertexData = this._cachedVertexData.serialize();\n }\n }\n serializationObject.reverseWindingOrder = this.reverseWindingOrder;\n return serializationObject;\n }\n _deserialize(serializationObject) {\n super._deserialize(serializationObject);\n if (serializationObject.cachedVertexData) {\n this._cachedVertexData = VertexData.Parse(serializationObject.cachedVertexData);\n }\n this.serializedCachedData = !!serializationObject.serializedCachedData;\n this.reverseWindingOrder = serializationObject.reverseWindingOrder;\n }\n}\n__decorate([\n editableInPropertyPage(\"Serialize cached data\", 0 /* PropertyTypeForEdition.Boolean */, \"ADVANCED\", { embedded: true, notifiers: { rebuild: true } })\n], MeshBlock.prototype, \"serializedCachedData\", void 0);\nRegisterClass(\"BABYLON.MeshBlock\", MeshBlock);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,qCAAqC,QAAQ,iDAAiD;AACvG,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,UAAU,QAAQ,uCAAuC;AAClE,SAASC,sBAAsB,QAAQ,yCAAyC;AAChF;AACA;AACA;AACA,OAAO,MAAMC,SAAS,SAASJ,iBAAiB,CAAC;EAC7C;AACJ;AACA;EACI,IAAIK,IAAIA,CAAA,EAAG;IACP,OAAO,IAAI,CAACC,KAAK;EACrB;EACA,IAAID,IAAIA,CAACE,KAAK,EAAE;IACZ,IAAI,CAACD,KAAK,GAAGC,KAAK;EACtB;EACA;AACJ;AACA;AACA;EACIC,WAAWA,CAACC,IAAI,EAAE;IACd,KAAK,CAACA,IAAI,CAAC;IACX,IAAI,CAACC,iBAAiB,GAAG,IAAI;IAC7B;AACR;AACA;IACQ,IAAI,CAACC,mBAAm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