@onerjs/core 8.33.5 → 8.33.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/Engines/WebGPU/Extensions/engine.multiRender.js +5 -10
  2. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  3. package/Engines/WebGPU/Extensions/engine.renderTarget.js +4 -2
  4. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  5. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +4 -3
  6. package/Engines/WebGPU/webgpuHardwareTexture.js +27 -21
  7. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  8. package/Engines/WebGPU/webgpuTextureManager.d.ts +5 -4
  9. package/Engines/WebGPU/webgpuTextureManager.js +20 -30
  10. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  11. package/Engines/engine.d.ts +1 -0
  12. package/Engines/thinEngine.js +9 -1
  13. package/Engines/thinEngine.js.map +1 -1
  14. package/Engines/thinWebGPUEngine.js +2 -3
  15. package/Engines/thinWebGPUEngine.js.map +1 -1
  16. package/Engines/webgpuEngine.js +28 -13
  17. package/Engines/webgpuEngine.js.map +1 -1
  18. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +2 -2
  19. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  20. package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +1 -1
  21. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +2 -2
  22. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
  23. package/FrameGraph/Node/Blocks/inputBlock.js +4 -0
  24. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  25. package/FrameGraph/Node/nodeRenderGraphBlock.d.ts +1 -0
  26. package/FrameGraph/Node/nodeRenderGraphBlock.js +19 -0
  27. package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
  28. package/FrameGraph/Passes/renderPass.d.ts +16 -0
  29. package/FrameGraph/Passes/renderPass.js +12 -0
  30. package/FrameGraph/Passes/renderPass.js.map +1 -1
  31. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +3 -3
  32. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +3 -2
  33. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  34. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +2 -2
  35. package/FrameGraph/Tasks/Texture/clearTextureTask.js +3 -2
  36. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  37. package/FrameGraph/frameGraphRenderContext.js +4 -15
  38. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  39. package/FrameGraph/frameGraphTask.d.ts +2 -2
  40. package/FrameGraph/frameGraphTask.js +6 -6
  41. package/FrameGraph/frameGraphTask.js.map +1 -1
  42. package/FrameGraph/frameGraphTaskMultiRenderTarget.d.ts +15 -0
  43. package/FrameGraph/frameGraphTaskMultiRenderTarget.js +25 -0
  44. package/FrameGraph/frameGraphTaskMultiRenderTarget.js.map +1 -0
  45. package/FrameGraph/frameGraphTextureManager.js +13 -2
  46. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  47. package/FrameGraph/frameGraphTypes.d.ts +9 -1
  48. package/FrameGraph/frameGraphTypes.js.map +1 -1
  49. package/Loading/Plugins/babylonFileLoader.js +13 -0
  50. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  51. package/Materials/Textures/baseTexture.d.ts +4 -0
  52. package/Materials/Textures/baseTexture.js +4 -0
  53. package/Materials/Textures/baseTexture.js.map +1 -1
  54. package/Materials/Textures/textureCreationOptions.d.ts +2 -0
  55. package/Materials/Textures/textureCreationOptions.js +0 -1
  56. package/Materials/Textures/textureCreationOptions.js.map +1 -1
  57. package/Meshes/abstractMesh.js +1 -1
  58. package/Meshes/abstractMesh.js.map +1 -1
  59. package/Meshes/geometry.js +1 -0
  60. package/Meshes/geometry.js.map +1 -1
  61. package/Misc/decorators.serialization.js +1 -1
  62. package/Misc/decorators.serialization.js.map +1 -1
  63. package/Particles/solidParticleSystem.d.ts +2 -1
  64. package/Particles/solidParticleSystem.js.map +1 -1
  65. package/Shaders/ShadersInclude/shadowsFragmentFunctions.js +4 -12
  66. package/Shaders/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
  67. package/Shaders/picking.vertex.js +2 -2
  68. package/Shaders/picking.vertex.js.map +1 -1
  69. package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js +8 -14
  70. package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
  71. package/ShadersWGSL/picking.vertex.js +2 -2
  72. package/ShadersWGSL/picking.vertex.js.map +1 -1
  73. package/package.json +1 -1
@@ -890,6 +890,7 @@ export class Geometry {
890
890
  * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)
891
891
  */
892
892
  clearCachedData() {
893
+ this._totalIndices = this._indices.length; // save the current value so that getTotalIndices can still work
893
894
  this._indices = [];
894
895
  this._resetPointsArrayCache();
895
896
  for (const vbName in this._vertexBuffers) {
@@ -1 +1 @@
1
- {"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/geometry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MA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,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YACnD,CAAC;YAED,IAAI,gBAAgB,CAAC,SAAS,EAAE,CAAC;gBAC7B,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;YACrD,CAAC;YAED,IAAI,gBAAgB,CAAC,kBAAkB,EAAE,CAAC;gBACtC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;YAC/D,CAAC;YAED,IAAI,gBAAgB,CAAC,kBAAkB,EAAE,CAAC;gBACtC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;YAC/D,CAAC;YAED,QAAQ,CAAC,qBAAqB,GAAG,UAAU,CAAC,gBAAgB,CAAC;QACjE,CAAC;aAAM,CAAC;YACJ,UAAU,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAC5D,CAAC;QAED,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAEnC,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ","sourcesContent":["import type { Nullable, FloatArray, DataArray, IndicesArray } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Vector2 } from \"../Maths/math.vector\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { IGetSetVerticesData } from \"../Meshes/mesh.vertexData\";\r\nimport { VertexData } from \"../Meshes/mesh.vertexData\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { SceneLoaderFlags } from \"../Loading/sceneLoaderFlags\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Tags } from \"../Misc/tags\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { extractMinAndMax } from \"../Maths/math.functions\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { useOpenGLOrientationForUV } from \"../Compat/compatibilityOptions\";\r\n\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { Buffer } from \"../Buffers/buffer\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport { CopyFloatData, GetTypedArrayData } from \"../Buffers/bufferUtils\";\r\nimport type { IAssetContainer } from \"core/IAssetContainer\";\r\n\r\n/**\r\n * Class used to store geometry data (vertex buffers + index buffer)\r\n */\r\nexport class Geometry implements IGetSetVerticesData {\r\n // Members\r\n /**\r\n * Gets or sets the ID of the geometry\r\n */\r\n public id: string;\r\n /**\r\n * Gets or sets the unique ID of the geometry\r\n */\r\n public uniqueId: number;\r\n /**\r\n * Gets the delay loading state of the geometry (none by default which means not delayed)\r\n */\r\n public delayLoadState = Constants.DELAYLOADSTATE_NONE;\r\n /**\r\n * Gets the file containing the data to load when running in delay load state\r\n */\r\n public delayLoadingFile: Nullable<string>;\r\n /**\r\n * Callback called when the geometry is updated\r\n */\r\n public onGeometryUpdated: (geometry: Geometry, kind?: string) => void;\r\n\r\n // Private\r\n private _scene: Scene;\r\n private _engine: AbstractEngine;\r\n private _meshes: Mesh[];\r\n private _totalVertices = 0;\r\n private _totalIndices?: number;\r\n /** @internal */\r\n public _loadedUniqueId: string;\r\n /** @internal */\r\n public _indices: IndicesArray;\r\n /** @internal */\r\n public _vertexBuffers: { [key: string]: VertexBuffer };\r\n private _isDisposed = false;\r\n private _extend: { minimum: Vector3; maximum: Vector3 } = {\r\n minimum: new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE),\r\n maximum: new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE),\r\n };\r\n private _boundingBias: Vector2;\r\n /** @internal */\r\n public _delayInfo: Array<string>;\r\n private _indexBuffer: Nullable<DataBuffer>;\r\n private _indexBufferIsUpdatable = false;\r\n /** @internal */\r\n public _boundingInfo: Nullable<BoundingInfo>;\r\n /** @internal */\r\n public _delayLoadingFunction: Nullable<(any: any, geometry: Geometry) => void>;\r\n /** @internal */\r\n public _softwareSkinningFrameId: number;\r\n private _vertexArrayObjects: { [key: string]: WebGLVertexArrayObject };\r\n private _updatable: boolean;\r\n\r\n // Cache\r\n /** @internal */\r\n public _positions: Nullable<Vector3[]>;\r\n private _positionsCache: Vector3[] = [];\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<IAssetContainer> = null;\r\n\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n public get boundingBias(): Vector2 {\r\n return this._boundingBias;\r\n }\r\n\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n public set boundingBias(value: Vector2) {\r\n if (this._boundingBias) {\r\n this._boundingBias.copyFrom(value);\r\n } else {\r\n this._boundingBias = value.clone();\r\n }\r\n\r\n this._updateBoundingInfo(true, null);\r\n }\r\n\r\n /**\r\n * Static function used to attach a new empty geometry to a mesh\r\n * @param mesh defines the mesh to attach the geometry to\r\n * @returns the new Geometry\r\n */\r\n public static CreateGeometryForMesh(mesh: Mesh): Geometry {\r\n const geometry = new Geometry(Geometry.RandomId(), mesh.getScene());\r\n\r\n geometry.applyToMesh(mesh);\r\n\r\n return geometry;\r\n }\r\n\r\n /** Get the list of meshes using this geometry */\r\n public get meshes(): Mesh[] {\r\n return this._meshes;\r\n }\r\n\r\n /**\r\n * If set to true (false by default), the bounding info applied to the meshes sharing this geometry will be the bounding info defined at the class level\r\n * and won't be computed based on the vertex positions (which is what we get when useBoundingInfoFromGeometry = false)\r\n */\r\n public useBoundingInfoFromGeometry = false;\r\n\r\n /**\r\n * Creates a new geometry\r\n * @param id defines the unique ID\r\n * @param scene defines the hosting scene\r\n * @param vertexData defines the VertexData used to get geometry data\r\n * @param updatable defines if geometry must be updatable (false by default)\r\n * @param mesh defines the mesh that will be associated with the geometry\r\n * @param totalVertices defines the total number of vertices (optional)\r\n */\r\n constructor(id: string, scene?: Scene, vertexData?: VertexData, updatable: boolean = false, mesh: Nullable<Mesh> = null, totalVertices: Nullable<number> = null) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this._scene) {\r\n return;\r\n }\r\n this.id = id;\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._engine = this._scene.getEngine();\r\n this._meshes = [];\r\n //Init vertex buffer cache\r\n this._vertexBuffers = {};\r\n this._indices = [];\r\n this._updatable = updatable;\r\n\r\n if (totalVertices !== null) {\r\n this._totalVertices = totalVertices;\r\n }\r\n\r\n // vertexData\r\n if (vertexData) {\r\n this.setAllVerticesData(vertexData, updatable);\r\n } else if (totalVertices === null) {\r\n this._totalVertices = 0;\r\n }\r\n\r\n if (this._engine.getCaps().vertexArrayObject) {\r\n this._vertexArrayObjects = {};\r\n }\r\n\r\n // applyToMesh\r\n if (mesh) {\r\n this.applyToMesh(mesh);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current extend of the geometry\r\n */\r\n public get extend(): { minimum: Vector3; maximum: Vector3 } {\r\n return this._extend;\r\n }\r\n\r\n /**\r\n * Gets the hosting scene\r\n * @returns the hosting Scene\r\n */\r\n public getScene(): Scene {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the hosting engine\r\n * @returns the hosting Engine\r\n */\r\n public getEngine(): AbstractEngine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Defines if the geometry is ready to use\r\n * @returns true if the geometry is ready to be used\r\n */\r\n public isReady(): boolean {\r\n return this.delayLoadState === Constants.DELAYLOADSTATE_LOADED || this.delayLoadState === Constants.DELAYLOADSTATE_NONE;\r\n }\r\n\r\n /**\r\n * Gets a value indicating that the geometry should not be serialized\r\n */\r\n public get doNotSerialize(): boolean {\r\n for (let index = 0; index < this._meshes.length; index++) {\r\n if (!this._meshes[index].doNotSerialize) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n if (this._vertexArrayObjects) {\r\n this._vertexArrayObjects = {};\r\n }\r\n\r\n // Index buffer\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, this._updatable, \"Geometry_\" + this.id + \"_IndexBuffer\");\r\n }\r\n\r\n // Vertex buffers\r\n const buffers = new Set<Buffer>();\r\n for (const key in this._vertexBuffers) {\r\n buffers.add(this._vertexBuffers[key].getWrapperBuffer());\r\n }\r\n\r\n buffers.forEach((buffer) => {\r\n buffer._rebuild();\r\n });\r\n }\r\n\r\n /**\r\n * Affects all geometry data in one call\r\n * @param vertexData defines the geometry data\r\n * @param updatable defines if the geometry must be flagged as updatable (false as default)\r\n */\r\n public setAllVerticesData(vertexData: VertexData, updatable?: boolean): void {\r\n vertexData.applyToGeometry(this, updatable);\r\n this._notifyUpdate();\r\n }\r\n\r\n /**\r\n * Set specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the vertex data to use\r\n * @param updatable defines if the vertex must be flagged as updatable (false as default)\r\n * @param stride defines the stride to use (0 by default). This value is deduced from the kind value if not specified\r\n */\r\n public setVerticesData(kind: string, data: FloatArray, updatable: boolean = false, stride?: number): void {\r\n if (updatable && Array.isArray(data)) {\r\n // to avoid converting to Float32Array at each draw call in engine.updateDynamicVertexBuffer, we make the conversion a single time here\r\n data = new Float32Array(data);\r\n }\r\n const buffer = new VertexBuffer(this._engine, data, kind, {\r\n updatable,\r\n postponeInternalCreation: this._meshes.length === 0,\r\n stride,\r\n label: \"Geometry_\" + this.id + \"_\" + kind,\r\n });\r\n this.setVerticesBuffer(buffer);\r\n }\r\n\r\n /**\r\n * Removes a specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n */\r\n public removeVerticesData(kind: string) {\r\n if (this._vertexBuffers[kind]) {\r\n this._vertexBuffers[kind].dispose();\r\n delete this._vertexBuffers[kind];\r\n }\r\n\r\n if (this._vertexArrayObjects) {\r\n this._disposeVertexArrayObjects();\r\n }\r\n }\r\n\r\n /**\r\n * Affect a vertex buffer to the geometry. the vertexBuffer.getKind() function is used to determine where to store the data\r\n * @param buffer defines the vertex buffer to use\r\n * @param totalVertices defines the total number of vertices for position kind (could be null)\r\n * @param disposeExistingBuffer disposes the existing buffer, if any (default: true)\r\n */\r\n public setVerticesBuffer(buffer: VertexBuffer, totalVertices: Nullable<number> = null, disposeExistingBuffer = true): void {\r\n const kind = buffer.getKind();\r\n if (this._vertexBuffers[kind] && disposeExistingBuffer) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n\r\n if (buffer._buffer && buffer._ownsBuffer) {\r\n buffer._buffer._increaseReferences();\r\n }\r\n\r\n this._vertexBuffers[kind] = buffer;\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n\r\n if (kind === VertexBuffer.PositionKind) {\r\n this._totalVertices = totalVertices ?? buffer._maxVerticesCount;\r\n\r\n this._updateExtend(this.useBoundingInfoFromGeometry && this._boundingInfo ? null : buffer.getFloatData(this._totalVertices));\r\n this._resetPointsArrayCache();\r\n\r\n // this._extend can be empty if buffer.getFloatData(this._totalVertices) returned null\r\n const minimum = (this._extend && this._extend.minimum) || new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n const maximum = (this._extend && this._extend.maximum) || new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n\r\n for (let index = 0; index < numOfMeshes; index++) {\r\n const mesh = meshes[index];\r\n mesh.buildBoundingInfo(minimum, maximum);\r\n mesh._createGlobalSubMesh(mesh.isUnIndexed);\r\n mesh.computeWorldMatrix(true);\r\n mesh.synchronizeInstances();\r\n }\r\n }\r\n\r\n this._notifyUpdate(kind);\r\n }\r\n\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will directly update the underlying DataBuffer according to the passed numeric array or Float32Array\r\n * It will do nothing if the buffer is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n public updateVerticesDataDirectly(kind: string, data: DataArray, offset: number, useBytes: boolean = false): void {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n\r\n vertexBuffer.updateDirectly(data, offset, useBytes);\r\n this._notifyUpdate(kind);\r\n }\r\n\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param updateExtends defines if the geometry extends must be recomputed (false by default)\r\n */\r\n public updateVerticesData(kind: string, data: FloatArray, updateExtends: boolean = false): void {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n\r\n vertexBuffer.update(data);\r\n\r\n if (kind === VertexBuffer.PositionKind) {\r\n this._updateBoundingInfo(updateExtends, data);\r\n }\r\n this._notifyUpdate(kind);\r\n }\r\n\r\n private _updateBoundingInfo(updateExtends: boolean, data: Nullable<FloatArray>) {\r\n if (updateExtends) {\r\n this._updateExtend(data);\r\n }\r\n\r\n this._resetPointsArrayCache();\r\n\r\n if (updateExtends) {\r\n const meshes = this._meshes;\r\n for (const mesh of meshes) {\r\n if (mesh.hasBoundingInfo) {\r\n mesh.getBoundingInfo().reConstruct(this._extend.minimum, this._extend.maximum);\r\n } else {\r\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\r\n }\r\n\r\n const subMeshes = mesh.subMeshes;\r\n for (const subMesh of subMeshes) {\r\n subMesh.refreshBoundingInfo();\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _bind(\r\n effect: Nullable<Effect>,\r\n indexToBind?: Nullable<DataBuffer>,\r\n overrideVertexBuffers?: { [kind: string]: Nullable<VertexBuffer> },\r\n overrideVertexArrayObjects?: { [key: string]: WebGLVertexArrayObject }\r\n ): void {\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n if (indexToBind === undefined) {\r\n indexToBind = this._indexBuffer;\r\n }\r\n const vbs = this.getVertexBuffers();\r\n\r\n if (!vbs) {\r\n return;\r\n }\r\n\r\n if (indexToBind != this._indexBuffer || (!this._vertexArrayObjects && !overrideVertexArrayObjects)) {\r\n this._engine.bindBuffers(vbs, indexToBind, effect, overrideVertexBuffers);\r\n return;\r\n }\r\n\r\n const vaos = overrideVertexArrayObjects ? overrideVertexArrayObjects : this._vertexArrayObjects;\r\n const engine = this._engine as ThinEngine;\r\n\r\n // Using VAO\r\n if (!vaos[effect.key]) {\r\n vaos[effect.key] = engine.recordVertexArrayObject(vbs, indexToBind, effect, overrideVertexBuffers);\r\n }\r\n\r\n engine.bindVertexArrayObject(vaos[effect.key], indexToBind);\r\n }\r\n\r\n /**\r\n * Gets total number of vertices\r\n * @returns the total number of vertices\r\n */\r\n public getTotalVertices(): number {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n\r\n return this._totalVertices;\r\n }\r\n\r\n /**\r\n * Gets a specific vertex data attached to this geometry. Float data is constructed if the vertex buffer data cannot be returned directly.\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns a float array containing vertex data\r\n */\r\n public getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<FloatArray> {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return null;\r\n }\r\n\r\n return vertexBuffer.getFloatData(this._totalVertices, forceCopy || (copyWhenShared && this._meshes.length !== 1));\r\n }\r\n\r\n /**\r\n * Copies the requested vertex data kind into the given vertex data map. Float data is constructed if the map doesn't have the data.\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param vertexData defines the map that stores the resulting data\r\n */\r\n public copyVerticesData(kind: string, vertexData: { [kind: string]: Float32Array }): void {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n\r\n vertexData[kind] ||= new Float32Array(this._totalVertices * vertexBuffer.getSize());\r\n const data = vertexBuffer.getData();\r\n if (data) {\r\n CopyFloatData(\r\n data,\r\n vertexBuffer.getSize(),\r\n vertexBuffer.type,\r\n vertexBuffer.byteOffset,\r\n vertexBuffer.byteStride,\r\n vertexBuffer.normalized,\r\n this._totalVertices,\r\n vertexData[kind]\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if the vertex buffer with the specified kind is updatable\r\n */\r\n public isVertexBufferUpdatable(kind: string): boolean {\r\n const vb = this._vertexBuffers[kind];\r\n\r\n if (!vb) {\r\n return false;\r\n }\r\n\r\n return vb.isUpdatable();\r\n }\r\n\r\n /**\r\n * Gets a specific vertex buffer\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns a VertexBuffer\r\n */\r\n public getVertexBuffer(kind: string): Nullable<VertexBuffer> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers[kind];\r\n }\r\n\r\n /**\r\n * Returns all vertex buffers\r\n * @returns an object holding all vertex buffers indexed by kind\r\n */\r\n public getVertexBuffers(): Nullable<{ [key: string]: VertexBuffer }> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if specific vertex buffer is present\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if data is present\r\n */\r\n public isVerticesDataPresent(kind: string): boolean {\r\n if (!this._vertexBuffers) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._vertexBuffers[kind] !== undefined;\r\n }\r\n\r\n /**\r\n * Gets a list of all attached data kinds (Position, normal, etc...)\r\n * @returns a list of string containing all kinds\r\n */\r\n public getVerticesDataKinds(): string[] {\r\n const result = [];\r\n let kind;\r\n if (!this._vertexBuffers && this._delayInfo) {\r\n for (kind in this._delayInfo) {\r\n result.push(kind);\r\n }\r\n } else {\r\n for (kind in this._vertexBuffers) {\r\n result.push(kind);\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Update index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n */\r\n public updateIndices(indices: IndicesArray, offset?: number, gpuMemoryOnly = false): void {\r\n if (!this._indexBuffer) {\r\n return;\r\n }\r\n\r\n if (!this._indexBufferIsUpdatable) {\r\n this.setIndices(indices, null, true);\r\n } else {\r\n const needToUpdateSubMeshes = indices.length !== this._indices.length;\r\n\r\n if (!gpuMemoryOnly) {\r\n this._indices = indices.slice();\r\n }\r\n this._engine.updateDynamicIndexBuffer(this._indexBuffer, indices, offset);\r\n if (needToUpdateSubMeshes) {\r\n for (const mesh of this._meshes) {\r\n mesh._createGlobalSubMesh(true);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets the index buffer for this geometry.\r\n * @param indexBuffer Defines the index buffer to use for this geometry\r\n * @param totalVertices Defines the total number of vertices used by the buffer\r\n * @param totalIndices Defines the total number of indices in the index buffer\r\n * @param is32Bits Defines if the indices are 32 bits. If null (default), the value is guessed from the number of vertices\r\n */\r\n public setIndexBuffer(indexBuffer: DataBuffer, totalVertices: number, totalIndices: number, is32Bits: Nullable<boolean> = null): void {\r\n this._indices = [];\r\n this._indexBufferIsUpdatable = false;\r\n this._indexBuffer = indexBuffer;\r\n this._totalVertices = totalVertices;\r\n this._totalIndices = totalIndices;\r\n\r\n if (is32Bits === null) {\r\n indexBuffer.is32Bits = totalVertices > 65535;\r\n } else {\r\n indexBuffer.is32Bits = is32Bits;\r\n }\r\n\r\n for (const mesh of this._meshes) {\r\n mesh._createGlobalSubMesh(true);\r\n mesh.synchronizeInstances();\r\n }\r\n\r\n this._notifyUpdate();\r\n }\r\n\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param totalVertices defines the total number of vertices (could be null)\r\n * @param updatable defines if the index buffer must be flagged as updatable (false by default)\r\n * @param dontForceSubMeshRecreation defines a boolean indicating that we don't want to force the recreation of sub-meshes if we don't have to (false by default)\r\n */\r\n public setIndices(indices: IndicesArray, totalVertices: Nullable<number> = null, updatable: boolean = false, dontForceSubMeshRecreation = false): void {\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n\r\n this._indices = indices;\r\n this._indexBufferIsUpdatable = updatable;\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, updatable, \"Geometry_\" + this.id + \"_IndexBuffer\");\r\n }\r\n\r\n if (totalVertices != undefined) {\r\n // including null and undefined\r\n this._totalVertices = totalVertices;\r\n }\r\n\r\n for (const mesh of this._meshes) {\r\n mesh._createGlobalSubMesh(!dontForceSubMeshRecreation);\r\n mesh.synchronizeInstances();\r\n }\r\n\r\n this._notifyUpdate();\r\n }\r\n\r\n /**\r\n * Return the total number of indices\r\n * @returns the total number of indices\r\n */\r\n public getTotalIndices(): number {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n return this._totalIndices !== undefined ? this._totalIndices : this._indices.length;\r\n }\r\n\r\n /**\r\n * Gets the index buffer array\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns the index buffer array\r\n */\r\n public getIndices(copyWhenShared?: boolean, forceCopy?: boolean): Nullable<IndicesArray> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n const orig = this._indices;\r\n if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {\r\n return orig;\r\n } else {\r\n return orig.slice();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the index buffer\r\n * @returns the index buffer\r\n */\r\n public getIndexBuffer(): Nullable<DataBuffer> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._indexBuffer;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _releaseVertexArrayObject(effect: Nullable<Effect> = null) {\r\n if (!effect || !this._vertexArrayObjects) {\r\n return;\r\n }\r\n\r\n if (this._vertexArrayObjects[effect.key]) {\r\n (this._engine as ThinEngine).releaseVertexArrayObject(this._vertexArrayObjects[effect.key]);\r\n delete this._vertexArrayObjects[effect.key];\r\n }\r\n }\r\n\r\n /**\r\n * Release the associated resources for a specific mesh\r\n * @param mesh defines the source mesh\r\n * @param shouldDispose defines if the geometry must be disposed if there is no more mesh pointing to it\r\n */\r\n public releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void {\r\n const meshes = this._meshes;\r\n const index = meshes.indexOf(mesh);\r\n\r\n if (index === -1) {\r\n return;\r\n }\r\n\r\n meshes.splice(index, 1);\r\n\r\n if (this._vertexArrayObjects) {\r\n mesh._invalidateInstanceVertexArrayObject();\r\n }\r\n\r\n mesh._geometry = null;\r\n\r\n if (meshes.length === 0 && shouldDispose) {\r\n this.dispose();\r\n }\r\n }\r\n\r\n /**\r\n * Apply current geometry to a given mesh\r\n * @param mesh defines the mesh to apply geometry to\r\n */\r\n public applyToMesh(mesh: Mesh): void {\r\n if (mesh._geometry === this) {\r\n return;\r\n }\r\n\r\n const previousGeometry = mesh._geometry;\r\n if (previousGeometry) {\r\n previousGeometry.releaseForMesh(mesh);\r\n }\r\n\r\n if (this._vertexArrayObjects) {\r\n mesh._invalidateInstanceVertexArrayObject();\r\n }\r\n\r\n const meshes = this._meshes;\r\n\r\n // must be done before setting vertexBuffers because of mesh._createGlobalSubMesh()\r\n mesh._geometry = this;\r\n mesh._internalAbstractMeshDataInfo._positions = null;\r\n\r\n this._scene.pushGeometry(this);\r\n\r\n meshes.push(mesh);\r\n\r\n if (this.isReady()) {\r\n this._applyToMesh(mesh);\r\n } else if (this._boundingInfo) {\r\n mesh.setBoundingInfo(this._boundingInfo);\r\n }\r\n }\r\n\r\n private _updateExtend(data: Nullable<FloatArray> = null) {\r\n if (this.useBoundingInfoFromGeometry && this._boundingInfo) {\r\n this._extend = {\r\n minimum: this._boundingInfo.minimum.clone(),\r\n maximum: this._boundingInfo.maximum.clone(),\r\n };\r\n } else {\r\n if (!data) {\r\n data = this.getVerticesData(VertexBuffer.PositionKind)!;\r\n // This can happen if the buffer comes from a Hardware Buffer where\r\n // The data have not been uploaded by Babylon. (ex: Compute Shaders and Storage Buffers)\r\n if (!data) {\r\n return;\r\n }\r\n }\r\n\r\n this._extend = extractMinAndMax(data, 0, this._totalVertices, this.boundingBias, 3);\r\n }\r\n }\r\n\r\n private _applyToMesh(mesh: Mesh): void {\r\n // vertexBuffers\r\n for (const kind in this._vertexBuffers) {\r\n const vertexBuffer = this._vertexBuffers[kind];\r\n if (!vertexBuffer._buffer.getBuffer()) {\r\n vertexBuffer.create();\r\n }\r\n\r\n if (kind === VertexBuffer.PositionKind) {\r\n if (!this._extend) {\r\n this._updateExtend();\r\n }\r\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\r\n\r\n mesh._createGlobalSubMesh(mesh.isUnIndexed);\r\n\r\n //bounding info was just created again, world matrix should be applied again.\r\n mesh._updateBoundingInfo();\r\n }\r\n }\r\n\r\n // indexBuffer\r\n if (!this._indexBuffer && this._indices && this._indices.length > 0) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, this._updatable, \"Geometry_\" + this.id + \"_IndexBuffer\");\r\n }\r\n\r\n // morphTargets\r\n mesh._syncGeometryWithMorphTargetManager();\r\n\r\n // instances\r\n mesh.synchronizeInstances();\r\n }\r\n\r\n private _notifyUpdate(kind?: string) {\r\n if (this.onGeometryUpdated) {\r\n this.onGeometryUpdated(this, kind);\r\n }\r\n\r\n if (this._vertexArrayObjects) {\r\n this._disposeVertexArrayObjects();\r\n }\r\n\r\n for (const mesh of this._meshes) {\r\n mesh._markSubMeshesAsAttributesDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Load the geometry if it was flagged as delay loaded\r\n * @param scene defines the hosting scene\r\n * @param onLoaded defines a callback called when the geometry is loaded\r\n */\r\n public load(scene: Scene, onLoaded?: () => void): void {\r\n if (this.delayLoadState === Constants.DELAYLOADSTATE_LOADING) {\r\n return;\r\n }\r\n\r\n if (this.isReady()) {\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n return;\r\n }\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADING;\r\n\r\n this._queueLoad(scene, onLoaded);\r\n }\r\n\r\n private _queueLoad(scene: Scene, onLoaded?: () => void): void {\r\n if (!this.delayLoadingFile) {\r\n return;\r\n }\r\n\r\n scene.addPendingData(this);\r\n scene._loadFile(\r\n this.delayLoadingFile,\r\n (data) => {\r\n if (!this._delayLoadingFunction) {\r\n return;\r\n }\r\n\r\n this._delayLoadingFunction(JSON.parse(data as string), this);\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._delayInfo = [];\r\n\r\n scene.removePendingData(this);\r\n\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n for (let index = 0; index < numOfMeshes; index++) {\r\n this._applyToMesh(meshes[index]);\r\n }\r\n\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n },\r\n undefined,\r\n true\r\n );\r\n }\r\n\r\n /**\r\n * Invert the geometry to move from a right handed system to a left handed one.\r\n */\r\n public toLeftHanded(): void {\r\n // Flip faces\r\n const tIndices = this.getIndices(false);\r\n if (tIndices != null && tIndices.length > 0) {\r\n for (let i = 0; i < tIndices.length; i += 3) {\r\n const tTemp = tIndices[i + 0];\r\n tIndices[i + 0] = tIndices[i + 2];\r\n tIndices[i + 2] = tTemp;\r\n }\r\n this.setIndices(tIndices);\r\n }\r\n\r\n // Negate position.z\r\n const tPositions = this.getVerticesData(VertexBuffer.PositionKind, false);\r\n if (tPositions != null && tPositions.length > 0) {\r\n for (let i = 0; i < tPositions.length; i += 3) {\r\n tPositions[i + 2] = -tPositions[i + 2];\r\n }\r\n this.setVerticesData(VertexBuffer.PositionKind, tPositions, false);\r\n }\r\n\r\n // Negate normal.z\r\n const tNormals = this.getVerticesData(VertexBuffer.NormalKind, false);\r\n if (tNormals != null && tNormals.length > 0) {\r\n for (let i = 0; i < tNormals.length; i += 3) {\r\n tNormals[i + 2] = -tNormals[i + 2];\r\n }\r\n this.setVerticesData(VertexBuffer.NormalKind, tNormals, false);\r\n }\r\n }\r\n\r\n // Cache\r\n /** @internal */\r\n public _resetPointsArrayCache(): void {\r\n this._positions = null;\r\n }\r\n\r\n /** @internal */\r\n public _generatePointsArray(): boolean {\r\n if (this._positions) {\r\n return true;\r\n }\r\n\r\n const data = this.getVerticesData(VertexBuffer.PositionKind);\r\n\r\n if (!data || data.length === 0) {\r\n return false;\r\n }\r\n\r\n for (let index = this._positionsCache.length * 3, arrayIdx = this._positionsCache.length; index < data.length; index += 3, ++arrayIdx) {\r\n this._positionsCache[arrayIdx] = Vector3.FromArray(data, index);\r\n }\r\n\r\n for (let index = 0, arrayIdx = 0; index < data.length; index += 3, ++arrayIdx) {\r\n this._positionsCache[arrayIdx].set(data[0 + index], data[1 + index], data[2 + index]);\r\n }\r\n\r\n // just in case the number of positions was reduced, splice the array\r\n this._positionsCache.length = data.length / 3;\r\n\r\n this._positions = this._positionsCache;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Gets a value indicating if the geometry is disposed\r\n * @returns true if the geometry was disposed\r\n */\r\n public isDisposed(): boolean {\r\n return this._isDisposed;\r\n }\r\n\r\n private _disposeVertexArrayObjects(): void {\r\n if (this._vertexArrayObjects) {\r\n for (const kind in this._vertexArrayObjects) {\r\n (this._engine as ThinEngine).releaseVertexArrayObject(this._vertexArrayObjects[kind]);\r\n }\r\n this._vertexArrayObjects = {}; // Will trigger a rebuild of the VAO if supported\r\n\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n for (let index = 0; index < numOfMeshes; index++) {\r\n meshes[index]._invalidateInstanceVertexArrayObject();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Free all associated resources\r\n */\r\n public dispose(): void {\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n let index: number;\r\n for (index = 0; index < numOfMeshes; index++) {\r\n this.releaseForMesh(meshes[index]);\r\n }\r\n this._meshes.length = 0;\r\n\r\n this._disposeVertexArrayObjects();\r\n\r\n for (const kind in this._vertexBuffers) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n this._vertexBuffers = {};\r\n this._totalVertices = 0;\r\n\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n this._indexBuffer = null;\r\n this._indices = [];\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NONE;\r\n this.delayLoadingFile = null;\r\n this._delayLoadingFunction = null;\r\n this._delayInfo = [];\r\n\r\n this._boundingInfo = null;\r\n\r\n this._scene.removeGeometry(this);\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.geometries.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.geometries.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /**\r\n * Clone the current geometry into a new geometry\r\n * @param id defines the unique ID of the new geometry\r\n * @returns a new geometry object\r\n */\r\n public copy(id: string): Geometry {\r\n const geometry = new Geometry(id, this._scene);\r\n\r\n const indices = this.getIndices(undefined, true);\r\n if (indices) {\r\n geometry.setIndices(indices);\r\n }\r\n\r\n let updatable = false;\r\n let kind;\r\n for (kind in this._vertexBuffers) {\r\n const vb = this.getVertexBuffer(kind)!;\r\n const bufferData = vb.getData();\r\n if (!bufferData) {\r\n continue;\r\n }\r\n\r\n const isUpdatable = vb.isUpdatable();\r\n const size = vb.getSize();\r\n const { type, byteOffset, byteStride, normalized } = vb;\r\n updatable = updatable || isUpdatable;\r\n\r\n const copy = GetTypedArrayData(bufferData, size, type, byteOffset, byteStride, this._totalVertices, true);\r\n const newVb = new VertexBuffer(this._engine, copy, kind, {\r\n updatable: isUpdatable,\r\n useBytes: false,\r\n stride: size, // Copy is tightly-packed, so stride = size\r\n size: size, // Component size stays the same\r\n offset: 0, // Copy starts at beginning of its own buffer\r\n type: type,\r\n normalized: normalized,\r\n takeBufferOwnership: true,\r\n });\r\n\r\n geometry.setVerticesBuffer(newVb, this._totalVertices);\r\n }\r\n\r\n geometry._updatable = updatable;\r\n\r\n geometry.delayLoadState = this.delayLoadState;\r\n geometry.delayLoadingFile = this.delayLoadingFile;\r\n geometry._delayLoadingFunction = this._delayLoadingFunction;\r\n\r\n for (kind in this._delayInfo) {\r\n geometry._delayInfo = geometry._delayInfo || [];\r\n geometry._delayInfo.push(kind);\r\n }\r\n\r\n // Bounding info\r\n geometry._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\r\n\r\n return geometry;\r\n }\r\n\r\n /**\r\n * Serialize the current geometry info (and not the vertices data) into a JSON object\r\n * @returns a JSON representation of the current geometry data (without the vertices data)\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.id = this.id;\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.updatable = this._updatable;\r\n\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n private _toNumberArray(origin: Nullable<Float32Array | IndicesArray>): number[] {\r\n if (Array.isArray(origin)) {\r\n return origin;\r\n } else {\r\n return Array.prototype.slice.call(origin);\r\n }\r\n }\r\n\r\n /**\r\n * Release any memory retained by the cached data on the Geometry.\r\n *\r\n * Call this function to reduce memory footprint of the mesh.\r\n * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)\r\n */\r\n public clearCachedData(): void {\r\n this._indices = [];\r\n this._resetPointsArrayCache();\r\n\r\n for (const vbName in this._vertexBuffers) {\r\n if (!Object.prototype.hasOwnProperty.call(this._vertexBuffers, vbName)) {\r\n continue;\r\n }\r\n this._vertexBuffers[vbName]._buffer._data = null;\r\n }\r\n }\r\n\r\n /**\r\n * Serialize all vertices data into a JSON object\r\n * @returns a JSON representation of the current geometry data\r\n */\r\n public serializeVerticeData(): any {\r\n const serializationObject = this.serialize();\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\r\n serializationObject.positions = this._toNumberArray(this.getVerticesData(VertexBuffer.PositionKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.PositionKind)) {\r\n serializationObject.positionsUpdatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n serializationObject.normals = this._toNumberArray(this.getVerticesData(VertexBuffer.NormalKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.NormalKind)) {\r\n serializationObject.normalsUpdatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n serializationObject.tangents = this._toNumberArray(this.getVerticesData(VertexBuffer.TangentKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.TangentKind)) {\r\n serializationObject.tangentsUpdatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n serializationObject.uvs = this._toNumberArray(this.getVerticesData(VertexBuffer.UVKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UVKind)) {\r\n serializationObject.uvsUpdatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\r\n serializationObject.uvs2 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV2Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV2Kind)) {\r\n serializationObject.uvs2Updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV3Kind)) {\r\n serializationObject.uvs3 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV3Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV3Kind)) {\r\n serializationObject.uvs3Updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV4Kind)) {\r\n serializationObject.uvs4 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV4Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV4Kind)) {\r\n serializationObject.uvs4Updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV5Kind)) {\r\n serializationObject.uvs5 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV5Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV5Kind)) {\r\n serializationObject.uvs5Updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV6Kind)) {\r\n serializationObject.uvs6 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV6Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV6Kind)) {\r\n serializationObject.uvs6Updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.ColorKind)) {\r\n serializationObject.colors = this._toNumberArray(this.getVerticesData(VertexBuffer.ColorKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.ColorKind)) {\r\n serializationObject.colorsUpdatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\r\n serializationObject.matricesIndices = this._toNumberArray(this.getVerticesData(VertexBuffer.MatricesIndicesKind));\r\n serializationObject.matricesIndicesExpanded = true;\r\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesIndicesKind)) {\r\n serializationObject.matricesIndicesUpdatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\r\n serializationObject.matricesWeights = this._toNumberArray(this.getVerticesData(VertexBuffer.MatricesWeightsKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesWeightsKind)) {\r\n serializationObject.matricesWeightsUpdatable = true;\r\n }\r\n }\r\n\r\n serializationObject.indices = this._toNumberArray(this.getIndices());\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n\r\n /**\r\n * Extracts a clone of a mesh geometry\r\n * @param mesh defines the source mesh\r\n * @param id defines the unique ID of the new geometry object\r\n * @returns the new geometry object\r\n */\r\n public static ExtractFromMesh(mesh: Mesh, id: string): Nullable<Geometry> {\r\n const geometry = mesh._geometry;\r\n\r\n if (!geometry) {\r\n return null;\r\n }\r\n\r\n return geometry.copy(id);\r\n }\r\n\r\n /**\r\n * You should now use Tools.RandomId(), this method is still here for legacy reasons.\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a string containing a new GUID\r\n */\r\n public static RandomId(): string {\r\n return Tools.RandomId();\r\n }\r\n\r\n private static _GetGeometryByLoadedUniqueId(uniqueId: string, scene: Scene) {\r\n for (let index = 0; index < scene.geometries.length; index++) {\r\n if (scene.geometries[index]._loadedUniqueId === uniqueId) {\r\n return scene.geometries[index];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _ImportGeometry(parsedGeometry: any, mesh: Mesh): void {\r\n const scene = mesh.getScene();\r\n\r\n // Geometry\r\n const geometryUniqueId = parsedGeometry.geometryUniqueId;\r\n const geometryId = parsedGeometry.geometryId;\r\n if (geometryUniqueId || geometryId) {\r\n const geometry = geometryUniqueId ? this._GetGeometryByLoadedUniqueId(geometryUniqueId, scene) : scene.getGeometryById(geometryId);\r\n if (geometry) {\r\n geometry.applyToMesh(mesh);\r\n }\r\n } else if (parsedGeometry instanceof ArrayBuffer) {\r\n const binaryInfo = mesh._binaryInfo;\r\n\r\n if (binaryInfo.positionsAttrDesc && binaryInfo.positionsAttrDesc.count > 0) {\r\n const positionsData = new Float32Array(parsedGeometry, binaryInfo.positionsAttrDesc.offset, binaryInfo.positionsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.PositionKind, positionsData, false);\r\n }\r\n\r\n if (binaryInfo.normalsAttrDesc && binaryInfo.normalsAttrDesc.count > 0) {\r\n const normalsData = new Float32Array(parsedGeometry, binaryInfo.normalsAttrDesc.offset, binaryInfo.normalsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.NormalKind, normalsData, false);\r\n }\r\n\r\n if (binaryInfo.tangetsAttrDesc && binaryInfo.tangetsAttrDesc.count > 0) {\r\n const tangentsData = new Float32Array(parsedGeometry, binaryInfo.tangetsAttrDesc.offset, binaryInfo.tangetsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.TangentKind, tangentsData, false);\r\n }\r\n\r\n if (binaryInfo.uvsAttrDesc && binaryInfo.uvsAttrDesc.count > 0) {\r\n const uvsData = new Float32Array(parsedGeometry, binaryInfo.uvsAttrDesc.offset, binaryInfo.uvsAttrDesc.count);\r\n if (useOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvsData.length; index += 2) {\r\n uvsData[index] = 1 - uvsData[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UVKind, uvsData, false);\r\n }\r\n\r\n if (binaryInfo.uvs2AttrDesc && binaryInfo.uvs2AttrDesc.count > 0) {\r\n const uvs2Data = new Float32Array(parsedGeometry, binaryInfo.uvs2AttrDesc.offset, binaryInfo.uvs2AttrDesc.count);\r\n if (useOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs2Data.length; index += 2) {\r\n uvs2Data[index] = 1 - uvs2Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV2Kind, uvs2Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs3AttrDesc && binaryInfo.uvs3AttrDesc.count > 0) {\r\n const uvs3Data = new Float32Array(parsedGeometry, binaryInfo.uvs3AttrDesc.offset, binaryInfo.uvs3AttrDesc.count);\r\n if (useOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs3Data.length; index += 2) {\r\n uvs3Data[index] = 1 - uvs3Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV3Kind, uvs3Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs4AttrDesc && binaryInfo.uvs4AttrDesc.count > 0) {\r\n const uvs4Data = new Float32Array(parsedGeometry, binaryInfo.uvs4AttrDesc.offset, binaryInfo.uvs4AttrDesc.count);\r\n if (useOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs4Data.length; index += 2) {\r\n uvs4Data[index] = 1 - uvs4Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV4Kind, uvs4Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs5AttrDesc && binaryInfo.uvs5AttrDesc.count > 0) {\r\n const uvs5Data = new Float32Array(parsedGeometry, binaryInfo.uvs5AttrDesc.offset, binaryInfo.uvs5AttrDesc.count);\r\n if (useOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs5Data.length; index += 2) {\r\n uvs5Data[index] = 1 - uvs5Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV5Kind, uvs5Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs6AttrDesc && binaryInfo.uvs6AttrDesc.count > 0) {\r\n const uvs6Data = new Float32Array(parsedGeometry, binaryInfo.uvs6AttrDesc.offset, binaryInfo.uvs6AttrDesc.count);\r\n if (useOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs6Data.length; index += 2) {\r\n uvs6Data[index] = 1 - uvs6Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV6Kind, uvs6Data, false);\r\n }\r\n\r\n if (binaryInfo.colorsAttrDesc && binaryInfo.colorsAttrDesc.count > 0) {\r\n const colorsData = new Float32Array(parsedGeometry, binaryInfo.colorsAttrDesc.offset, binaryInfo.colorsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.ColorKind, colorsData, false, binaryInfo.colorsAttrDesc.stride);\r\n }\r\n\r\n if (binaryInfo.matricesIndicesAttrDesc && binaryInfo.matricesIndicesAttrDesc.count > 0) {\r\n const matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesAttrDesc.offset, binaryInfo.matricesIndicesAttrDesc.count);\r\n const floatIndices = [];\r\n for (let i = 0; i < matricesIndicesData.length; i++) {\r\n const index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000ff);\r\n floatIndices.push((index & 0x0000ff00) >> 8);\r\n floatIndices.push((index & 0x00ff0000) >> 16);\r\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, false);\r\n }\r\n\r\n if (binaryInfo.matricesIndicesExtraAttrDesc && binaryInfo.matricesIndicesExtraAttrDesc.count > 0) {\r\n const matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesExtraAttrDesc.offset, binaryInfo.matricesIndicesExtraAttrDesc.count);\r\n const floatIndices = [];\r\n for (let i = 0; i < matricesIndicesData.length; i++) {\r\n const index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000ff);\r\n floatIndices.push((index & 0x0000ff00) >> 8);\r\n floatIndices.push((index & 0x00ff0000) >> 16);\r\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, false);\r\n }\r\n\r\n if (binaryInfo.matricesWeightsAttrDesc && binaryInfo.matricesWeightsAttrDesc.count > 0) {\r\n const matricesWeightsData = new Float32Array(parsedGeometry, binaryInfo.matricesWeightsAttrDesc.offset, binaryInfo.matricesWeightsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsData, false);\r\n }\r\n\r\n if (binaryInfo.indicesAttrDesc && binaryInfo.indicesAttrDesc.count > 0) {\r\n const indicesData = new Int32Array(parsedGeometry, binaryInfo.indicesAttrDesc.offset, binaryInfo.indicesAttrDesc.count);\r\n mesh.setIndices(indicesData, null);\r\n }\r\n\r\n if (binaryInfo.subMeshesAttrDesc && binaryInfo.subMeshesAttrDesc.count > 0) {\r\n const subMeshesData = new Int32Array(parsedGeometry, binaryInfo.subMeshesAttrDesc.offset, binaryInfo.subMeshesAttrDesc.count * 5);\r\n\r\n mesh.subMeshes = [];\r\n for (let i = 0; i < binaryInfo.subMeshesAttrDesc.count; i++) {\r\n const materialIndex = subMeshesData[i * 5 + 0];\r\n const verticesStart = subMeshesData[i * 5 + 1];\r\n const verticesCount = subMeshesData[i * 5 + 2];\r\n const indexStart = subMeshesData[i * 5 + 3];\r\n const indexCount = subMeshesData[i * 5 + 4];\r\n\r\n SubMesh.AddToMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, <AbstractMesh>mesh);\r\n }\r\n }\r\n } else if (parsedGeometry.positions && parsedGeometry.normals && parsedGeometry.indices) {\r\n mesh.setVerticesData(VertexBuffer.PositionKind, parsedGeometry.positions, parsedGeometry.positions._updatable || parsedGeometry.positionsUpdatable);\r\n\r\n mesh.setVerticesData(VertexBuffer.NormalKind, parsedGeometry.normals, parsedGeometry.normals._updatable || parsedGeometry.normalsUpdatable);\r\n\r\n if (parsedGeometry.tangents) {\r\n mesh.setVerticesData(VertexBuffer.TangentKind, parsedGeometry.tangents, parsedGeometry.tangents._updatable || parsedGeometry.tangentsUpdatable);\r\n }\r\n\r\n if (parsedGeometry.uvs) {\r\n mesh.setVerticesData(VertexBuffer.UVKind, parsedGeometry.uvs, parsedGeometry.uvs._updatable || parsedGeometry.uvsUpdatable);\r\n }\r\n\r\n if (parsedGeometry.uvs2) {\r\n mesh.setVerticesData(VertexBuffer.UV2Kind, parsedGeometry.uvs2, parsedGeometry.uvs2._updatable || parsedGeometry.uvs2Updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs3) {\r\n mesh.setVerticesData(VertexBuffer.UV3Kind, parsedGeometry.uvs3, parsedGeometry.uvs3._updatable || parsedGeometry.uvs3Updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs4) {\r\n mesh.setVerticesData(VertexBuffer.UV4Kind, parsedGeometry.uvs4, parsedGeometry.uvs4._updatable || parsedGeometry.uvs4Updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs5) {\r\n mesh.setVerticesData(VertexBuffer.UV5Kind, parsedGeometry.uvs5, parsedGeometry.uvs5._updatable || parsedGeometry.uvs5Updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs6) {\r\n mesh.setVerticesData(VertexBuffer.UV6Kind, parsedGeometry.uvs6, parsedGeometry.uvs6._updatable || parsedGeometry.uvs6Updatable);\r\n }\r\n\r\n if (parsedGeometry.colors) {\r\n mesh.setVerticesData(VertexBuffer.ColorKind, Color4.CheckColors4(parsedGeometry.colors, parsedGeometry.positions.length / 3), parsedGeometry.colors._updatable);\r\n }\r\n\r\n if (parsedGeometry.matricesIndices) {\r\n if (!parsedGeometry.matricesIndices._isExpanded && !parsedGeometry.matricesIndicesExpanded) {\r\n const floatIndices = [];\r\n\r\n for (let i = 0; i < parsedGeometry.matricesIndices.length; i++) {\r\n const matricesIndex = parsedGeometry.matricesIndices[i];\r\n\r\n floatIndices.push(matricesIndex & 0x000000ff);\r\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\r\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, parsedGeometry.matricesIndices._updatable || parsedGeometry.matricesIndicesUpdatable);\r\n } else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n delete parsedGeometry.matricesIndicesExpanded;\r\n mesh.setVerticesData(\r\n VertexBuffer.MatricesIndicesKind,\r\n parsedGeometry.matricesIndices,\r\n parsedGeometry.matricesIndices._updatable || parsedGeometry.matricesIndicesUpdatable\r\n );\r\n }\r\n }\r\n\r\n if (parsedGeometry.matricesIndicesExtra) {\r\n if (!(parsedGeometry.matricesIndicesExtraExpanded || parsedGeometry.matricesIndicesExtra._isExpanded)) {\r\n const floatIndices = [];\r\n\r\n for (let i = 0; i < parsedGeometry.matricesIndicesExtra.length; i++) {\r\n const matricesIndex = parsedGeometry.matricesIndicesExtra[i];\r\n\r\n floatIndices.push(matricesIndex & 0x000000ff);\r\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\r\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n\r\n mesh.setVerticesData(\r\n VertexBuffer.MatricesIndicesExtraKind,\r\n floatIndices,\r\n parsedGeometry.matricesIndicesExtra._updatable || parsedGeometry.matricesIndicesExtraUpdatable\r\n );\r\n } else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n delete parsedGeometry.matricesIndicesExtraExpanded;\r\n mesh.setVerticesData(\r\n VertexBuffer.MatricesIndicesExtraKind,\r\n parsedGeometry.matricesIndicesExtra,\r\n parsedGeometry.matricesIndicesExtra._updatable || parsedGeometry.matricesIndicesExtraUpdatable\r\n );\r\n }\r\n }\r\n\r\n if (parsedGeometry.matricesWeights) {\r\n Geometry._CleanMatricesWeights(parsedGeometry, mesh);\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, parsedGeometry.matricesWeights, parsedGeometry.matricesWeights._updatable);\r\n }\r\n\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsExtraKind, parsedGeometry.matricesWeightsExtra, parsedGeometry.matricesWeights._updatable);\r\n }\r\n\r\n mesh.setIndices(parsedGeometry.indices, null);\r\n }\r\n\r\n // SubMeshes\r\n if (parsedGeometry.subMeshes) {\r\n mesh.subMeshes = [];\r\n for (let subIndex = 0; subIndex < parsedGeometry.subMeshes.length; subIndex++) {\r\n const parsedSubMesh = parsedGeometry.subMeshes[subIndex];\r\n\r\n SubMesh.AddToMesh(\r\n parsedSubMesh.materialIndex,\r\n parsedSubMesh.verticesStart,\r\n parsedSubMesh.verticesCount,\r\n parsedSubMesh.indexStart,\r\n parsedSubMesh.indexCount,\r\n <AbstractMesh>mesh\r\n );\r\n }\r\n }\r\n\r\n // Flat shading\r\n if (mesh._shouldGenerateFlatShading) {\r\n mesh.convertToFlatShadedMesh();\r\n mesh._shouldGenerateFlatShading = false;\r\n }\r\n\r\n // Update\r\n mesh.computeWorldMatrix(true);\r\n\r\n scene.onMeshImportedObservable.notifyObservers(<AbstractMesh>mesh);\r\n }\r\n\r\n private static _CleanMatricesWeights(parsedGeometry: any, mesh: Mesh): void {\r\n const epsilon: number = 1e-3;\r\n if (!SceneLoaderFlags.CleanBoneMatrixWeights) {\r\n return;\r\n }\r\n let noInfluenceBoneIndex = 0.0;\r\n if (parsedGeometry.skeletonId > -1) {\r\n const skeleton = mesh.getScene().getLastSkeletonById(parsedGeometry.skeletonId);\r\n\r\n if (!skeleton) {\r\n return;\r\n }\r\n noInfluenceBoneIndex = skeleton.bones.length;\r\n } else {\r\n return;\r\n }\r\n const matricesIndices = <FloatArray>mesh.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n const matricesIndicesExtra = <FloatArray>mesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind);\r\n const matricesWeights = parsedGeometry.matricesWeights;\r\n const matricesWeightsExtra = parsedGeometry.matricesWeightsExtra;\r\n const influencers = parsedGeometry.numBoneInfluencer;\r\n const size = matricesWeights.length;\r\n\r\n for (let i = 0; i < size; i += 4) {\r\n let weight = 0.0;\r\n let firstZeroWeight = -1;\r\n for (let j = 0; j < 4; j++) {\r\n const w = matricesWeights[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j;\r\n }\r\n }\r\n if (matricesWeightsExtra) {\r\n for (let j = 0; j < 4; j++) {\r\n const w = matricesWeightsExtra[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j + 4;\r\n }\r\n }\r\n }\r\n if (firstZeroWeight < 0 || firstZeroWeight > influencers - 1) {\r\n firstZeroWeight = influencers - 1;\r\n }\r\n if (weight > epsilon) {\r\n const mweight = 1.0 / weight;\r\n for (let j = 0; j < 4; j++) {\r\n matricesWeights[i + j] *= mweight;\r\n }\r\n if (matricesWeightsExtra) {\r\n for (let j = 0; j < 4; j++) {\r\n matricesWeightsExtra[i + j] *= mweight;\r\n }\r\n }\r\n } else {\r\n if (firstZeroWeight >= 4) {\r\n matricesWeightsExtra[i + firstZeroWeight - 4] = 1.0 - weight;\r\n matricesIndicesExtra[i + firstZeroWeight - 4] = noInfluenceBoneIndex;\r\n } else {\r\n matricesWeights[i + firstZeroWeight] = 1.0 - weight;\r\n matricesIndices[i + firstZeroWeight] = noInfluenceBoneIndex;\r\n }\r\n }\r\n }\r\n\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, matricesIndices);\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, matricesIndicesExtra);\r\n }\r\n }\r\n\r\n /**\r\n * Create a new geometry from persisted data (Using .babylon file format)\r\n * @param parsedVertexData defines the persisted data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url to use to load assets (like delayed data)\r\n * @returns the new geometry object\r\n */\r\n public static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Nullable<Geometry> {\r\n const geometry = new Geometry(parsedVertexData.id, scene, undefined, parsedVertexData.updatable);\r\n geometry._loadedUniqueId = parsedVertexData.uniqueId;\r\n\r\n if (Tags) {\r\n Tags.AddTagsTo(geometry, parsedVertexData.tags);\r\n }\r\n\r\n if (parsedVertexData.delayLoadingFile) {\r\n geometry.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n geometry.delayLoadingFile = rootUrl + parsedVertexData.delayLoadingFile;\r\n geometry._boundingInfo = new BoundingInfo(Vector3.FromArray(parsedVertexData.boundingBoxMinimum), Vector3.FromArray(parsedVertexData.boundingBoxMaximum));\r\n\r\n geometry._delayInfo = [];\r\n if (parsedVertexData.hasUVs) {\r\n geometry._delayInfo.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs2) {\r\n geometry._delayInfo.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs3) {\r\n geometry._delayInfo.push(VertexBuffer.UV3Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs4) {\r\n geometry._delayInfo.push(VertexBuffer.UV4Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs5) {\r\n geometry._delayInfo.push(VertexBuffer.UV5Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs6) {\r\n geometry._delayInfo.push(VertexBuffer.UV6Kind);\r\n }\r\n\r\n if (parsedVertexData.hasColors) {\r\n geometry._delayInfo.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n if (parsedVertexData.hasMatricesIndices) {\r\n geometry._delayInfo.push(VertexBuffer.MatricesIndicesKind);\r\n }\r\n\r\n if (parsedVertexData.hasMatricesWeights) {\r\n geometry._delayInfo.push(VertexBuffer.MatricesWeightsKind);\r\n }\r\n\r\n geometry._delayLoadingFunction = VertexData.ImportVertexData;\r\n } else {\r\n VertexData.ImportVertexData(parsedVertexData, geometry);\r\n }\r\n\r\n scene.pushGeometry(geometry, true);\r\n\r\n return geometry;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/geometry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAM3E,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG1E;;GAEG;AACH,MAAM,OAAO,QAAQ;IA8DjB;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,YAAY,CAAC,KAAc;QAClC,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,IAAI,CAAC,aAAa,C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Y,CAAC,mBAAmB,CAAC,CAAC;YAC/D,CAAC;YAED,QAAQ,CAAC,qBAAqB,GAAG,UAAU,CAAC,gBAAgB,CAAC;QACjE,CAAC;aAAM,CAAC;YACJ,UAAU,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAC5D,CAAC;QAED,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAEnC,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ","sourcesContent":["import type { Nullable, FloatArray, DataArray, IndicesArray } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Vector2 } from \"../Maths/math.vector\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { IGetSetVerticesData } from \"../Meshes/mesh.vertexData\";\r\nimport { VertexData } from \"../Meshes/mesh.vertexData\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { SceneLoaderFlags } from \"../Loading/sceneLoaderFlags\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Tags } from \"../Misc/tags\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { extractMinAndMax } from \"../Maths/math.functions\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { useOpenGLOrientationForUV } from \"../Compat/compatibilityOptions\";\r\n\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { Buffer } from \"../Buffers/buffer\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { ThinEngine } from \"../Engines/thinEngine\";\r\nimport { CopyFloatData, GetTypedArrayData } from \"../Buffers/bufferUtils\";\r\nimport type { IAssetContainer } from \"core/IAssetContainer\";\r\n\r\n/**\r\n * Class used to store geometry data (vertex buffers + index buffer)\r\n */\r\nexport class Geometry implements IGetSetVerticesData {\r\n // Members\r\n /**\r\n * Gets or sets the ID of the geometry\r\n */\r\n public id: string;\r\n /**\r\n * Gets or sets the unique ID of the geometry\r\n */\r\n public uniqueId: number;\r\n /**\r\n * Gets the delay loading state of the geometry (none by default which means not delayed)\r\n */\r\n public delayLoadState = Constants.DELAYLOADSTATE_NONE;\r\n /**\r\n * Gets the file containing the data to load when running in delay load state\r\n */\r\n public delayLoadingFile: Nullable<string>;\r\n /**\r\n * Callback called when the geometry is updated\r\n */\r\n public onGeometryUpdated: (geometry: Geometry, kind?: string) => void;\r\n\r\n // Private\r\n private _scene: Scene;\r\n private _engine: AbstractEngine;\r\n private _meshes: Mesh[];\r\n private _totalVertices = 0;\r\n private _totalIndices?: number;\r\n /** @internal */\r\n public _loadedUniqueId: string;\r\n /** @internal */\r\n public _indices: IndicesArray;\r\n /** @internal */\r\n public _vertexBuffers: { [key: string]: VertexBuffer };\r\n private _isDisposed = false;\r\n private _extend: { minimum: Vector3; maximum: Vector3 } = {\r\n minimum: new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE),\r\n maximum: new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE),\r\n };\r\n private _boundingBias: Vector2;\r\n /** @internal */\r\n public _delayInfo: Array<string>;\r\n private _indexBuffer: Nullable<DataBuffer>;\r\n private _indexBufferIsUpdatable = false;\r\n /** @internal */\r\n public _boundingInfo: Nullable<BoundingInfo>;\r\n /** @internal */\r\n public _delayLoadingFunction: Nullable<(any: any, geometry: Geometry) => void>;\r\n /** @internal */\r\n public _softwareSkinningFrameId: number;\r\n private _vertexArrayObjects: { [key: string]: WebGLVertexArrayObject };\r\n private _updatable: boolean;\r\n\r\n // Cache\r\n /** @internal */\r\n public _positions: Nullable<Vector3[]>;\r\n private _positionsCache: Vector3[] = [];\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<IAssetContainer> = null;\r\n\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n public get boundingBias(): Vector2 {\r\n return this._boundingBias;\r\n }\r\n\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n public set boundingBias(value: Vector2) {\r\n if (this._boundingBias) {\r\n this._boundingBias.copyFrom(value);\r\n } else {\r\n this._boundingBias = value.clone();\r\n }\r\n\r\n this._updateBoundingInfo(true, null);\r\n }\r\n\r\n /**\r\n * Static function used to attach a new empty geometry to a mesh\r\n * @param mesh defines the mesh to attach the geometry to\r\n * @returns the new Geometry\r\n */\r\n public static CreateGeometryForMesh(mesh: Mesh): Geometry {\r\n const geometry = new Geometry(Geometry.RandomId(), mesh.getScene());\r\n\r\n geometry.applyToMesh(mesh);\r\n\r\n return geometry;\r\n }\r\n\r\n /** Get the list of meshes using this geometry */\r\n public get meshes(): Mesh[] {\r\n return this._meshes;\r\n }\r\n\r\n /**\r\n * If set to true (false by default), the bounding info applied to the meshes sharing this geometry will be the bounding info defined at the class level\r\n * and won't be computed based on the vertex positions (which is what we get when useBoundingInfoFromGeometry = false)\r\n */\r\n public useBoundingInfoFromGeometry = false;\r\n\r\n /**\r\n * Creates a new geometry\r\n * @param id defines the unique ID\r\n * @param scene defines the hosting scene\r\n * @param vertexData defines the VertexData used to get geometry data\r\n * @param updatable defines if geometry must be updatable (false by default)\r\n * @param mesh defines the mesh that will be associated with the geometry\r\n * @param totalVertices defines the total number of vertices (optional)\r\n */\r\n constructor(id: string, scene?: Scene, vertexData?: VertexData, updatable: boolean = false, mesh: Nullable<Mesh> = null, totalVertices: Nullable<number> = null) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this._scene) {\r\n return;\r\n }\r\n this.id = id;\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._engine = this._scene.getEngine();\r\n this._meshes = [];\r\n //Init vertex buffer cache\r\n this._vertexBuffers = {};\r\n this._indices = [];\r\n this._updatable = updatable;\r\n\r\n if (totalVertices !== null) {\r\n this._totalVertices = totalVertices;\r\n }\r\n\r\n // vertexData\r\n if (vertexData) {\r\n this.setAllVerticesData(vertexData, updatable);\r\n } else if (totalVertices === null) {\r\n this._totalVertices = 0;\r\n }\r\n\r\n if (this._engine.getCaps().vertexArrayObject) {\r\n this._vertexArrayObjects = {};\r\n }\r\n\r\n // applyToMesh\r\n if (mesh) {\r\n this.applyToMesh(mesh);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current extend of the geometry\r\n */\r\n public get extend(): { minimum: Vector3; maximum: Vector3 } {\r\n return this._extend;\r\n }\r\n\r\n /**\r\n * Gets the hosting scene\r\n * @returns the hosting Scene\r\n */\r\n public getScene(): Scene {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the hosting engine\r\n * @returns the hosting Engine\r\n */\r\n public getEngine(): AbstractEngine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Defines if the geometry is ready to use\r\n * @returns true if the geometry is ready to be used\r\n */\r\n public isReady(): boolean {\r\n return this.delayLoadState === Constants.DELAYLOADSTATE_LOADED || this.delayLoadState === Constants.DELAYLOADSTATE_NONE;\r\n }\r\n\r\n /**\r\n * Gets a value indicating that the geometry should not be serialized\r\n */\r\n public get doNotSerialize(): boolean {\r\n for (let index = 0; index < this._meshes.length; index++) {\r\n if (!this._meshes[index].doNotSerialize) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n if (this._vertexArrayObjects) {\r\n this._vertexArrayObjects = {};\r\n }\r\n\r\n // Index buffer\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, this._updatable, \"Geometry_\" + this.id + \"_IndexBuffer\");\r\n }\r\n\r\n // Vertex buffers\r\n const buffers = new Set<Buffer>();\r\n for (const key in this._vertexBuffers) {\r\n buffers.add(this._vertexBuffers[key].getWrapperBuffer());\r\n }\r\n\r\n buffers.forEach((buffer) => {\r\n buffer._rebuild();\r\n });\r\n }\r\n\r\n /**\r\n * Affects all geometry data in one call\r\n * @param vertexData defines the geometry data\r\n * @param updatable defines if the geometry must be flagged as updatable (false as default)\r\n */\r\n public setAllVerticesData(vertexData: VertexData, updatable?: boolean): void {\r\n vertexData.applyToGeometry(this, updatable);\r\n this._notifyUpdate();\r\n }\r\n\r\n /**\r\n * Set specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the vertex data to use\r\n * @param updatable defines if the vertex must be flagged as updatable (false as default)\r\n * @param stride defines the stride to use (0 by default). This value is deduced from the kind value if not specified\r\n */\r\n public setVerticesData(kind: string, data: FloatArray, updatable: boolean = false, stride?: number): void {\r\n if (updatable && Array.isArray(data)) {\r\n // to avoid converting to Float32Array at each draw call in engine.updateDynamicVertexBuffer, we make the conversion a single time here\r\n data = new Float32Array(data);\r\n }\r\n const buffer = new VertexBuffer(this._engine, data, kind, {\r\n updatable,\r\n postponeInternalCreation: this._meshes.length === 0,\r\n stride,\r\n label: \"Geometry_\" + this.id + \"_\" + kind,\r\n });\r\n this.setVerticesBuffer(buffer);\r\n }\r\n\r\n /**\r\n * Removes a specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n */\r\n public removeVerticesData(kind: string) {\r\n if (this._vertexBuffers[kind]) {\r\n this._vertexBuffers[kind].dispose();\r\n delete this._vertexBuffers[kind];\r\n }\r\n\r\n if (this._vertexArrayObjects) {\r\n this._disposeVertexArrayObjects();\r\n }\r\n }\r\n\r\n /**\r\n * Affect a vertex buffer to the geometry. the vertexBuffer.getKind() function is used to determine where to store the data\r\n * @param buffer defines the vertex buffer to use\r\n * @param totalVertices defines the total number of vertices for position kind (could be null)\r\n * @param disposeExistingBuffer disposes the existing buffer, if any (default: true)\r\n */\r\n public setVerticesBuffer(buffer: VertexBuffer, totalVertices: Nullable<number> = null, disposeExistingBuffer = true): void {\r\n const kind = buffer.getKind();\r\n if (this._vertexBuffers[kind] && disposeExistingBuffer) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n\r\n if (buffer._buffer && buffer._ownsBuffer) {\r\n buffer._buffer._increaseReferences();\r\n }\r\n\r\n this._vertexBuffers[kind] = buffer;\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n\r\n if (kind === VertexBuffer.PositionKind) {\r\n this._totalVertices = totalVertices ?? buffer._maxVerticesCount;\r\n\r\n this._updateExtend(this.useBoundingInfoFromGeometry && this._boundingInfo ? null : buffer.getFloatData(this._totalVertices));\r\n this._resetPointsArrayCache();\r\n\r\n // this._extend can be empty if buffer.getFloatData(this._totalVertices) returned null\r\n const minimum = (this._extend && this._extend.minimum) || new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n const maximum = (this._extend && this._extend.maximum) || new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n\r\n for (let index = 0; index < numOfMeshes; index++) {\r\n const mesh = meshes[index];\r\n mesh.buildBoundingInfo(minimum, maximum);\r\n mesh._createGlobalSubMesh(mesh.isUnIndexed);\r\n mesh.computeWorldMatrix(true);\r\n mesh.synchronizeInstances();\r\n }\r\n }\r\n\r\n this._notifyUpdate(kind);\r\n }\r\n\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will directly update the underlying DataBuffer according to the passed numeric array or Float32Array\r\n * It will do nothing if the buffer is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n public updateVerticesDataDirectly(kind: string, data: DataArray, offset: number, useBytes: boolean = false): void {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n\r\n vertexBuffer.updateDirectly(data, offset, useBytes);\r\n this._notifyUpdate(kind);\r\n }\r\n\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param updateExtends defines if the geometry extends must be recomputed (false by default)\r\n */\r\n public updateVerticesData(kind: string, data: FloatArray, updateExtends: boolean = false): void {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n\r\n vertexBuffer.update(data);\r\n\r\n if (kind === VertexBuffer.PositionKind) {\r\n this._updateBoundingInfo(updateExtends, data);\r\n }\r\n this._notifyUpdate(kind);\r\n }\r\n\r\n private _updateBoundingInfo(updateExtends: boolean, data: Nullable<FloatArray>) {\r\n if (updateExtends) {\r\n this._updateExtend(data);\r\n }\r\n\r\n this._resetPointsArrayCache();\r\n\r\n if (updateExtends) {\r\n const meshes = this._meshes;\r\n for (const mesh of meshes) {\r\n if (mesh.hasBoundingInfo) {\r\n mesh.getBoundingInfo().reConstruct(this._extend.minimum, this._extend.maximum);\r\n } else {\r\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\r\n }\r\n\r\n const subMeshes = mesh.subMeshes;\r\n for (const subMesh of subMeshes) {\r\n subMesh.refreshBoundingInfo();\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _bind(\r\n effect: Nullable<Effect>,\r\n indexToBind?: Nullable<DataBuffer>,\r\n overrideVertexBuffers?: { [kind: string]: Nullable<VertexBuffer> },\r\n overrideVertexArrayObjects?: { [key: string]: WebGLVertexArrayObject }\r\n ): void {\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n if (indexToBind === undefined) {\r\n indexToBind = this._indexBuffer;\r\n }\r\n const vbs = this.getVertexBuffers();\r\n\r\n if (!vbs) {\r\n return;\r\n }\r\n\r\n if (indexToBind != this._indexBuffer || (!this._vertexArrayObjects && !overrideVertexArrayObjects)) {\r\n this._engine.bindBuffers(vbs, indexToBind, effect, overrideVertexBuffers);\r\n return;\r\n }\r\n\r\n const vaos = overrideVertexArrayObjects ? overrideVertexArrayObjects : this._vertexArrayObjects;\r\n const engine = this._engine as ThinEngine;\r\n\r\n // Using VAO\r\n if (!vaos[effect.key]) {\r\n vaos[effect.key] = engine.recordVertexArrayObject(vbs, indexToBind, effect, overrideVertexBuffers);\r\n }\r\n\r\n engine.bindVertexArrayObject(vaos[effect.key], indexToBind);\r\n }\r\n\r\n /**\r\n * Gets total number of vertices\r\n * @returns the total number of vertices\r\n */\r\n public getTotalVertices(): number {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n\r\n return this._totalVertices;\r\n }\r\n\r\n /**\r\n * Gets a specific vertex data attached to this geometry. Float data is constructed if the vertex buffer data cannot be returned directly.\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns a float array containing vertex data\r\n */\r\n public getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<FloatArray> {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return null;\r\n }\r\n\r\n return vertexBuffer.getFloatData(this._totalVertices, forceCopy || (copyWhenShared && this._meshes.length !== 1));\r\n }\r\n\r\n /**\r\n * Copies the requested vertex data kind into the given vertex data map. Float data is constructed if the map doesn't have the data.\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param vertexData defines the map that stores the resulting data\r\n */\r\n public copyVerticesData(kind: string, vertexData: { [kind: string]: Float32Array }): void {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n\r\n vertexData[kind] ||= new Float32Array(this._totalVertices * vertexBuffer.getSize());\r\n const data = vertexBuffer.getData();\r\n if (data) {\r\n CopyFloatData(\r\n data,\r\n vertexBuffer.getSize(),\r\n vertexBuffer.type,\r\n vertexBuffer.byteOffset,\r\n vertexBuffer.byteStride,\r\n vertexBuffer.normalized,\r\n this._totalVertices,\r\n vertexData[kind]\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if the vertex buffer with the specified kind is updatable\r\n */\r\n public isVertexBufferUpdatable(kind: string): boolean {\r\n const vb = this._vertexBuffers[kind];\r\n\r\n if (!vb) {\r\n return false;\r\n }\r\n\r\n return vb.isUpdatable();\r\n }\r\n\r\n /**\r\n * Gets a specific vertex buffer\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns a VertexBuffer\r\n */\r\n public getVertexBuffer(kind: string): Nullable<VertexBuffer> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers[kind];\r\n }\r\n\r\n /**\r\n * Returns all vertex buffers\r\n * @returns an object holding all vertex buffers indexed by kind\r\n */\r\n public getVertexBuffers(): Nullable<{ [key: string]: VertexBuffer }> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if specific vertex buffer is present\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if data is present\r\n */\r\n public isVerticesDataPresent(kind: string): boolean {\r\n if (!this._vertexBuffers) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._vertexBuffers[kind] !== undefined;\r\n }\r\n\r\n /**\r\n * Gets a list of all attached data kinds (Position, normal, etc...)\r\n * @returns a list of string containing all kinds\r\n */\r\n public getVerticesDataKinds(): string[] {\r\n const result = [];\r\n let kind;\r\n if (!this._vertexBuffers && this._delayInfo) {\r\n for (kind in this._delayInfo) {\r\n result.push(kind);\r\n }\r\n } else {\r\n for (kind in this._vertexBuffers) {\r\n result.push(kind);\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Update index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n */\r\n public updateIndices(indices: IndicesArray, offset?: number, gpuMemoryOnly = false): void {\r\n if (!this._indexBuffer) {\r\n return;\r\n }\r\n\r\n if (!this._indexBufferIsUpdatable) {\r\n this.setIndices(indices, null, true);\r\n } else {\r\n const needToUpdateSubMeshes = indices.length !== this._indices.length;\r\n\r\n if (!gpuMemoryOnly) {\r\n this._indices = indices.slice();\r\n }\r\n this._engine.updateDynamicIndexBuffer(this._indexBuffer, indices, offset);\r\n if (needToUpdateSubMeshes) {\r\n for (const mesh of this._meshes) {\r\n mesh._createGlobalSubMesh(true);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets the index buffer for this geometry.\r\n * @param indexBuffer Defines the index buffer to use for this geometry\r\n * @param totalVertices Defines the total number of vertices used by the buffer\r\n * @param totalIndices Defines the total number of indices in the index buffer\r\n * @param is32Bits Defines if the indices are 32 bits. If null (default), the value is guessed from the number of vertices\r\n */\r\n public setIndexBuffer(indexBuffer: DataBuffer, totalVertices: number, totalIndices: number, is32Bits: Nullable<boolean> = null): void {\r\n this._indices = [];\r\n this._indexBufferIsUpdatable = false;\r\n this._indexBuffer = indexBuffer;\r\n this._totalVertices = totalVertices;\r\n this._totalIndices = totalIndices;\r\n\r\n if (is32Bits === null) {\r\n indexBuffer.is32Bits = totalVertices > 65535;\r\n } else {\r\n indexBuffer.is32Bits = is32Bits;\r\n }\r\n\r\n for (const mesh of this._meshes) {\r\n mesh._createGlobalSubMesh(true);\r\n mesh.synchronizeInstances();\r\n }\r\n\r\n this._notifyUpdate();\r\n }\r\n\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param totalVertices defines the total number of vertices (could be null)\r\n * @param updatable defines if the index buffer must be flagged as updatable (false by default)\r\n * @param dontForceSubMeshRecreation defines a boolean indicating that we don't want to force the recreation of sub-meshes if we don't have to (false by default)\r\n */\r\n public setIndices(indices: IndicesArray, totalVertices: Nullable<number> = null, updatable: boolean = false, dontForceSubMeshRecreation = false): void {\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n\r\n this._indices = indices;\r\n this._indexBufferIsUpdatable = updatable;\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, updatable, \"Geometry_\" + this.id + \"_IndexBuffer\");\r\n }\r\n\r\n if (totalVertices != undefined) {\r\n // including null and undefined\r\n this._totalVertices = totalVertices;\r\n }\r\n\r\n for (const mesh of this._meshes) {\r\n mesh._createGlobalSubMesh(!dontForceSubMeshRecreation);\r\n mesh.synchronizeInstances();\r\n }\r\n\r\n this._notifyUpdate();\r\n }\r\n\r\n /**\r\n * Return the total number of indices\r\n * @returns the total number of indices\r\n */\r\n public getTotalIndices(): number {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n return this._totalIndices !== undefined ? this._totalIndices : this._indices.length;\r\n }\r\n\r\n /**\r\n * Gets the index buffer array\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns the index buffer array\r\n */\r\n public getIndices(copyWhenShared?: boolean, forceCopy?: boolean): Nullable<IndicesArray> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n const orig = this._indices;\r\n if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {\r\n return orig;\r\n } else {\r\n return orig.slice();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the index buffer\r\n * @returns the index buffer\r\n */\r\n public getIndexBuffer(): Nullable<DataBuffer> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._indexBuffer;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _releaseVertexArrayObject(effect: Nullable<Effect> = null) {\r\n if (!effect || !this._vertexArrayObjects) {\r\n return;\r\n }\r\n\r\n if (this._vertexArrayObjects[effect.key]) {\r\n (this._engine as ThinEngine).releaseVertexArrayObject(this._vertexArrayObjects[effect.key]);\r\n delete this._vertexArrayObjects[effect.key];\r\n }\r\n }\r\n\r\n /**\r\n * Release the associated resources for a specific mesh\r\n * @param mesh defines the source mesh\r\n * @param shouldDispose defines if the geometry must be disposed if there is no more mesh pointing to it\r\n */\r\n public releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void {\r\n const meshes = this._meshes;\r\n const index = meshes.indexOf(mesh);\r\n\r\n if (index === -1) {\r\n return;\r\n }\r\n\r\n meshes.splice(index, 1);\r\n\r\n if (this._vertexArrayObjects) {\r\n mesh._invalidateInstanceVertexArrayObject();\r\n }\r\n\r\n mesh._geometry = null;\r\n\r\n if (meshes.length === 0 && shouldDispose) {\r\n this.dispose();\r\n }\r\n }\r\n\r\n /**\r\n * Apply current geometry to a given mesh\r\n * @param mesh defines the mesh to apply geometry to\r\n */\r\n public applyToMesh(mesh: Mesh): void {\r\n if (mesh._geometry === this) {\r\n return;\r\n }\r\n\r\n const previousGeometry = mesh._geometry;\r\n if (previousGeometry) {\r\n previousGeometry.releaseForMesh(mesh);\r\n }\r\n\r\n if (this._vertexArrayObjects) {\r\n mesh._invalidateInstanceVertexArrayObject();\r\n }\r\n\r\n const meshes = this._meshes;\r\n\r\n // must be done before setting vertexBuffers because of mesh._createGlobalSubMesh()\r\n mesh._geometry = this;\r\n mesh._internalAbstractMeshDataInfo._positions = null;\r\n\r\n this._scene.pushGeometry(this);\r\n\r\n meshes.push(mesh);\r\n\r\n if (this.isReady()) {\r\n this._applyToMesh(mesh);\r\n } else if (this._boundingInfo) {\r\n mesh.setBoundingInfo(this._boundingInfo);\r\n }\r\n }\r\n\r\n private _updateExtend(data: Nullable<FloatArray> = null) {\r\n if (this.useBoundingInfoFromGeometry && this._boundingInfo) {\r\n this._extend = {\r\n minimum: this._boundingInfo.minimum.clone(),\r\n maximum: this._boundingInfo.maximum.clone(),\r\n };\r\n } else {\r\n if (!data) {\r\n data = this.getVerticesData(VertexBuffer.PositionKind)!;\r\n // This can happen if the buffer comes from a Hardware Buffer where\r\n // The data have not been uploaded by Babylon. (ex: Compute Shaders and Storage Buffers)\r\n if (!data) {\r\n return;\r\n }\r\n }\r\n\r\n this._extend = extractMinAndMax(data, 0, this._totalVertices, this.boundingBias, 3);\r\n }\r\n }\r\n\r\n private _applyToMesh(mesh: Mesh): void {\r\n // vertexBuffers\r\n for (const kind in this._vertexBuffers) {\r\n const vertexBuffer = this._vertexBuffers[kind];\r\n if (!vertexBuffer._buffer.getBuffer()) {\r\n vertexBuffer.create();\r\n }\r\n\r\n if (kind === VertexBuffer.PositionKind) {\r\n if (!this._extend) {\r\n this._updateExtend();\r\n }\r\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\r\n\r\n mesh._createGlobalSubMesh(mesh.isUnIndexed);\r\n\r\n //bounding info was just created again, world matrix should be applied again.\r\n mesh._updateBoundingInfo();\r\n }\r\n }\r\n\r\n // indexBuffer\r\n if (!this._indexBuffer && this._indices && this._indices.length > 0) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, this._updatable, \"Geometry_\" + this.id + \"_IndexBuffer\");\r\n }\r\n\r\n // morphTargets\r\n mesh._syncGeometryWithMorphTargetManager();\r\n\r\n // instances\r\n mesh.synchronizeInstances();\r\n }\r\n\r\n private _notifyUpdate(kind?: string) {\r\n if (this.onGeometryUpdated) {\r\n this.onGeometryUpdated(this, kind);\r\n }\r\n\r\n if (this._vertexArrayObjects) {\r\n this._disposeVertexArrayObjects();\r\n }\r\n\r\n for (const mesh of this._meshes) {\r\n mesh._markSubMeshesAsAttributesDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Load the geometry if it was flagged as delay loaded\r\n * @param scene defines the hosting scene\r\n * @param onLoaded defines a callback called when the geometry is loaded\r\n */\r\n public load(scene: Scene, onLoaded?: () => void): void {\r\n if (this.delayLoadState === Constants.DELAYLOADSTATE_LOADING) {\r\n return;\r\n }\r\n\r\n if (this.isReady()) {\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n return;\r\n }\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADING;\r\n\r\n this._queueLoad(scene, onLoaded);\r\n }\r\n\r\n private _queueLoad(scene: Scene, onLoaded?: () => void): void {\r\n if (!this.delayLoadingFile) {\r\n return;\r\n }\r\n\r\n scene.addPendingData(this);\r\n scene._loadFile(\r\n this.delayLoadingFile,\r\n (data) => {\r\n if (!this._delayLoadingFunction) {\r\n return;\r\n }\r\n\r\n this._delayLoadingFunction(JSON.parse(data as string), this);\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._delayInfo = [];\r\n\r\n scene.removePendingData(this);\r\n\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n for (let index = 0; index < numOfMeshes; index++) {\r\n this._applyToMesh(meshes[index]);\r\n }\r\n\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n },\r\n undefined,\r\n true\r\n );\r\n }\r\n\r\n /**\r\n * Invert the geometry to move from a right handed system to a left handed one.\r\n */\r\n public toLeftHanded(): void {\r\n // Flip faces\r\n const tIndices = this.getIndices(false);\r\n if (tIndices != null && tIndices.length > 0) {\r\n for (let i = 0; i < tIndices.length; i += 3) {\r\n const tTemp = tIndices[i + 0];\r\n tIndices[i + 0] = tIndices[i + 2];\r\n tIndices[i + 2] = tTemp;\r\n }\r\n this.setIndices(tIndices);\r\n }\r\n\r\n // Negate position.z\r\n const tPositions = this.getVerticesData(VertexBuffer.PositionKind, false);\r\n if (tPositions != null && tPositions.length > 0) {\r\n for (let i = 0; i < tPositions.length; i += 3) {\r\n tPositions[i + 2] = -tPositions[i + 2];\r\n }\r\n this.setVerticesData(VertexBuffer.PositionKind, tPositions, false);\r\n }\r\n\r\n // Negate normal.z\r\n const tNormals = this.getVerticesData(VertexBuffer.NormalKind, false);\r\n if (tNormals != null && tNormals.length > 0) {\r\n for (let i = 0; i < tNormals.length; i += 3) {\r\n tNormals[i + 2] = -tNormals[i + 2];\r\n }\r\n this.setVerticesData(VertexBuffer.NormalKind, tNormals, false);\r\n }\r\n }\r\n\r\n // Cache\r\n /** @internal */\r\n public _resetPointsArrayCache(): void {\r\n this._positions = null;\r\n }\r\n\r\n /** @internal */\r\n public _generatePointsArray(): boolean {\r\n if (this._positions) {\r\n return true;\r\n }\r\n\r\n const data = this.getVerticesData(VertexBuffer.PositionKind);\r\n\r\n if (!data || data.length === 0) {\r\n return false;\r\n }\r\n\r\n for (let index = this._positionsCache.length * 3, arrayIdx = this._positionsCache.length; index < data.length; index += 3, ++arrayIdx) {\r\n this._positionsCache[arrayIdx] = Vector3.FromArray(data, index);\r\n }\r\n\r\n for (let index = 0, arrayIdx = 0; index < data.length; index += 3, ++arrayIdx) {\r\n this._positionsCache[arrayIdx].set(data[0 + index], data[1 + index], data[2 + index]);\r\n }\r\n\r\n // just in case the number of positions was reduced, splice the array\r\n this._positionsCache.length = data.length / 3;\r\n\r\n this._positions = this._positionsCache;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Gets a value indicating if the geometry is disposed\r\n * @returns true if the geometry was disposed\r\n */\r\n public isDisposed(): boolean {\r\n return this._isDisposed;\r\n }\r\n\r\n private _disposeVertexArrayObjects(): void {\r\n if (this._vertexArrayObjects) {\r\n for (const kind in this._vertexArrayObjects) {\r\n (this._engine as ThinEngine).releaseVertexArrayObject(this._vertexArrayObjects[kind]);\r\n }\r\n this._vertexArrayObjects = {}; // Will trigger a rebuild of the VAO if supported\r\n\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n for (let index = 0; index < numOfMeshes; index++) {\r\n meshes[index]._invalidateInstanceVertexArrayObject();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Free all associated resources\r\n */\r\n public dispose(): void {\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n let index: number;\r\n for (index = 0; index < numOfMeshes; index++) {\r\n this.releaseForMesh(meshes[index]);\r\n }\r\n this._meshes.length = 0;\r\n\r\n this._disposeVertexArrayObjects();\r\n\r\n for (const kind in this._vertexBuffers) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n this._vertexBuffers = {};\r\n this._totalVertices = 0;\r\n\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n this._indexBuffer = null;\r\n this._indices = [];\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NONE;\r\n this.delayLoadingFile = null;\r\n this._delayLoadingFunction = null;\r\n this._delayInfo = [];\r\n\r\n this._boundingInfo = null;\r\n\r\n this._scene.removeGeometry(this);\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.geometries.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.geometries.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /**\r\n * Clone the current geometry into a new geometry\r\n * @param id defines the unique ID of the new geometry\r\n * @returns a new geometry object\r\n */\r\n public copy(id: string): Geometry {\r\n const geometry = new Geometry(id, this._scene);\r\n\r\n const indices = this.getIndices(undefined, true);\r\n if (indices) {\r\n geometry.setIndices(indices);\r\n }\r\n\r\n let updatable = false;\r\n let kind;\r\n for (kind in this._vertexBuffers) {\r\n const vb = this.getVertexBuffer(kind)!;\r\n const bufferData = vb.getData();\r\n if (!bufferData) {\r\n continue;\r\n }\r\n\r\n const isUpdatable = vb.isUpdatable();\r\n const size = vb.getSize();\r\n const { type, byteOffset, byteStride, normalized } = vb;\r\n updatable = updatable || isUpdatable;\r\n\r\n const copy = GetTypedArrayData(bufferData, size, type, byteOffset, byteStride, this._totalVertices, true);\r\n const newVb = new VertexBuffer(this._engine, copy, kind, {\r\n updatable: isUpdatable,\r\n useBytes: false,\r\n stride: size, // Copy is tightly-packed, so stride = size\r\n size: size, // Component size stays the same\r\n offset: 0, // Copy starts at beginning of its own buffer\r\n type: type,\r\n normalized: normalized,\r\n takeBufferOwnership: true,\r\n });\r\n\r\n geometry.setVerticesBuffer(newVb, this._totalVertices);\r\n }\r\n\r\n geometry._updatable = updatable;\r\n\r\n geometry.delayLoadState = this.delayLoadState;\r\n geometry.delayLoadingFile = this.delayLoadingFile;\r\n geometry._delayLoadingFunction = this._delayLoadingFunction;\r\n\r\n for (kind in this._delayInfo) {\r\n geometry._delayInfo = geometry._delayInfo || [];\r\n geometry._delayInfo.push(kind);\r\n }\r\n\r\n // Bounding info\r\n geometry._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\r\n\r\n return geometry;\r\n }\r\n\r\n /**\r\n * Serialize the current geometry info (and not the vertices data) into a JSON object\r\n * @returns a JSON representation of the current geometry data (without the vertices data)\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.id = this.id;\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.updatable = this._updatable;\r\n\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n private _toNumberArray(origin: Nullable<Float32Array | IndicesArray>): number[] {\r\n if (Array.isArray(origin)) {\r\n return origin;\r\n } else {\r\n return Array.prototype.slice.call(origin);\r\n }\r\n }\r\n\r\n /**\r\n * Release any memory retained by the cached data on the Geometry.\r\n *\r\n * Call this function to reduce memory footprint of the mesh.\r\n * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)\r\n */\r\n public clearCachedData(): void {\r\n this._totalIndices = this._indices.length; // save the current value so that getTotalIndices can still work\r\n this._indices = [];\r\n this._resetPointsArrayCache();\r\n\r\n for (const vbName in this._vertexBuffers) {\r\n if (!Object.prototype.hasOwnProperty.call(this._vertexBuffers, vbName)) {\r\n continue;\r\n }\r\n this._vertexBuffers[vbName]._buffer._data = null;\r\n }\r\n }\r\n\r\n /**\r\n * Serialize all vertices data into a JSON object\r\n * @returns a JSON representation of the current geometry data\r\n */\r\n public serializeVerticeData(): any {\r\n const serializationObject = this.serialize();\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\r\n serializationObject.positions = this._toNumberArray(this.getVerticesData(VertexBuffer.PositionKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.PositionKind)) {\r\n serializationObject.positionsUpdatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n serializationObject.normals = this._toNumberArray(this.getVerticesData(VertexBuffer.NormalKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.NormalKind)) {\r\n serializationObject.normalsUpdatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n serializationObject.tangents = this._toNumberArray(this.getVerticesData(VertexBuffer.TangentKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.TangentKind)) {\r\n serializationObject.tangentsUpdatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n serializationObject.uvs = this._toNumberArray(this.getVerticesData(VertexBuffer.UVKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UVKind)) {\r\n serializationObject.uvsUpdatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\r\n serializationObject.uvs2 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV2Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV2Kind)) {\r\n serializationObject.uvs2Updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV3Kind)) {\r\n serializationObject.uvs3 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV3Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV3Kind)) {\r\n serializationObject.uvs3Updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV4Kind)) {\r\n serializationObject.uvs4 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV4Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV4Kind)) {\r\n serializationObject.uvs4Updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV5Kind)) {\r\n serializationObject.uvs5 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV5Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV5Kind)) {\r\n serializationObject.uvs5Updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV6Kind)) {\r\n serializationObject.uvs6 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV6Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV6Kind)) {\r\n serializationObject.uvs6Updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.ColorKind)) {\r\n serializationObject.colors = this._toNumberArray(this.getVerticesData(VertexBuffer.ColorKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.ColorKind)) {\r\n serializationObject.colorsUpdatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\r\n serializationObject.matricesIndices = this._toNumberArray(this.getVerticesData(VertexBuffer.MatricesIndicesKind));\r\n serializationObject.matricesIndicesExpanded = true;\r\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesIndicesKind)) {\r\n serializationObject.matricesIndicesUpdatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\r\n serializationObject.matricesWeights = this._toNumberArray(this.getVerticesData(VertexBuffer.MatricesWeightsKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesWeightsKind)) {\r\n serializationObject.matricesWeightsUpdatable = true;\r\n }\r\n }\r\n\r\n serializationObject.indices = this._toNumberArray(this.getIndices());\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n\r\n /**\r\n * Extracts a clone of a mesh geometry\r\n * @param mesh defines the source mesh\r\n * @param id defines the unique ID of the new geometry object\r\n * @returns the new geometry object\r\n */\r\n public static ExtractFromMesh(mesh: Mesh, id: string): Nullable<Geometry> {\r\n const geometry = mesh._geometry;\r\n\r\n if (!geometry) {\r\n return null;\r\n }\r\n\r\n return geometry.copy(id);\r\n }\r\n\r\n /**\r\n * You should now use Tools.RandomId(), this method is still here for legacy reasons.\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a string containing a new GUID\r\n */\r\n public static RandomId(): string {\r\n return Tools.RandomId();\r\n }\r\n\r\n private static _GetGeometryByLoadedUniqueId(uniqueId: string, scene: Scene) {\r\n for (let index = 0; index < scene.geometries.length; index++) {\r\n if (scene.geometries[index]._loadedUniqueId === uniqueId) {\r\n return scene.geometries[index];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _ImportGeometry(parsedGeometry: any, mesh: Mesh): void {\r\n const scene = mesh.getScene();\r\n\r\n // Geometry\r\n const geometryUniqueId = parsedGeometry.geometryUniqueId;\r\n const geometryId = parsedGeometry.geometryId;\r\n if (geometryUniqueId || geometryId) {\r\n const geometry = geometryUniqueId ? this._GetGeometryByLoadedUniqueId(geometryUniqueId, scene) : scene.getGeometryById(geometryId);\r\n if (geometry) {\r\n geometry.applyToMesh(mesh);\r\n }\r\n } else if (parsedGeometry instanceof ArrayBuffer) {\r\n const binaryInfo = mesh._binaryInfo;\r\n\r\n if (binaryInfo.positionsAttrDesc && binaryInfo.positionsAttrDesc.count > 0) {\r\n const positionsData = new Float32Array(parsedGeometry, binaryInfo.positionsAttrDesc.offset, binaryInfo.positionsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.PositionKind, positionsData, false);\r\n }\r\n\r\n if (binaryInfo.normalsAttrDesc && binaryInfo.normalsAttrDesc.count > 0) {\r\n const normalsData = new Float32Array(parsedGeometry, binaryInfo.normalsAttrDesc.offset, binaryInfo.normalsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.NormalKind, normalsData, false);\r\n }\r\n\r\n if (binaryInfo.tangetsAttrDesc && binaryInfo.tangetsAttrDesc.count > 0) {\r\n const tangentsData = new Float32Array(parsedGeometry, binaryInfo.tangetsAttrDesc.offset, binaryInfo.tangetsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.TangentKind, tangentsData, false);\r\n }\r\n\r\n if (binaryInfo.uvsAttrDesc && binaryInfo.uvsAttrDesc.count > 0) {\r\n const uvsData = new Float32Array(parsedGeometry, binaryInfo.uvsAttrDesc.offset, binaryInfo.uvsAttrDesc.count);\r\n if (useOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvsData.length; index += 2) {\r\n uvsData[index] = 1 - uvsData[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UVKind, uvsData, false);\r\n }\r\n\r\n if (binaryInfo.uvs2AttrDesc && binaryInfo.uvs2AttrDesc.count > 0) {\r\n const uvs2Data = new Float32Array(parsedGeometry, binaryInfo.uvs2AttrDesc.offset, binaryInfo.uvs2AttrDesc.count);\r\n if (useOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs2Data.length; index += 2) {\r\n uvs2Data[index] = 1 - uvs2Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV2Kind, uvs2Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs3AttrDesc && binaryInfo.uvs3AttrDesc.count > 0) {\r\n const uvs3Data = new Float32Array(parsedGeometry, binaryInfo.uvs3AttrDesc.offset, binaryInfo.uvs3AttrDesc.count);\r\n if (useOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs3Data.length; index += 2) {\r\n uvs3Data[index] = 1 - uvs3Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV3Kind, uvs3Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs4AttrDesc && binaryInfo.uvs4AttrDesc.count > 0) {\r\n const uvs4Data = new Float32Array(parsedGeometry, binaryInfo.uvs4AttrDesc.offset, binaryInfo.uvs4AttrDesc.count);\r\n if (useOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs4Data.length; index += 2) {\r\n uvs4Data[index] = 1 - uvs4Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV4Kind, uvs4Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs5AttrDesc && binaryInfo.uvs5AttrDesc.count > 0) {\r\n const uvs5Data = new Float32Array(parsedGeometry, binaryInfo.uvs5AttrDesc.offset, binaryInfo.uvs5AttrDesc.count);\r\n if (useOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs5Data.length; index += 2) {\r\n uvs5Data[index] = 1 - uvs5Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV5Kind, uvs5Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs6AttrDesc && binaryInfo.uvs6AttrDesc.count > 0) {\r\n const uvs6Data = new Float32Array(parsedGeometry, binaryInfo.uvs6AttrDesc.offset, binaryInfo.uvs6AttrDesc.count);\r\n if (useOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs6Data.length; index += 2) {\r\n uvs6Data[index] = 1 - uvs6Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV6Kind, uvs6Data, false);\r\n }\r\n\r\n if (binaryInfo.colorsAttrDesc && binaryInfo.colorsAttrDesc.count > 0) {\r\n const colorsData = new Float32Array(parsedGeometry, binaryInfo.colorsAttrDesc.offset, binaryInfo.colorsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.ColorKind, colorsData, false, binaryInfo.colorsAttrDesc.stride);\r\n }\r\n\r\n if (binaryInfo.matricesIndicesAttrDesc && binaryInfo.matricesIndicesAttrDesc.count > 0) {\r\n const matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesAttrDesc.offset, binaryInfo.matricesIndicesAttrDesc.count);\r\n const floatIndices = [];\r\n for (let i = 0; i < matricesIndicesData.length; i++) {\r\n const index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000ff);\r\n floatIndices.push((index & 0x0000ff00) >> 8);\r\n floatIndices.push((index & 0x00ff0000) >> 16);\r\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, false);\r\n }\r\n\r\n if (binaryInfo.matricesIndicesExtraAttrDesc && binaryInfo.matricesIndicesExtraAttrDesc.count > 0) {\r\n const matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesExtraAttrDesc.offset, binaryInfo.matricesIndicesExtraAttrDesc.count);\r\n const floatIndices = [];\r\n for (let i = 0; i < matricesIndicesData.length; i++) {\r\n const index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000ff);\r\n floatIndices.push((index & 0x0000ff00) >> 8);\r\n floatIndices.push((index & 0x00ff0000) >> 16);\r\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, false);\r\n }\r\n\r\n if (binaryInfo.matricesWeightsAttrDesc && binaryInfo.matricesWeightsAttrDesc.count > 0) {\r\n const matricesWeightsData = new Float32Array(parsedGeometry, binaryInfo.matricesWeightsAttrDesc.offset, binaryInfo.matricesWeightsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsData, false);\r\n }\r\n\r\n if (binaryInfo.indicesAttrDesc && binaryInfo.indicesAttrDesc.count > 0) {\r\n const indicesData = new Int32Array(parsedGeometry, binaryInfo.indicesAttrDesc.offset, binaryInfo.indicesAttrDesc.count);\r\n mesh.setIndices(indicesData, null);\r\n }\r\n\r\n if (binaryInfo.subMeshesAttrDesc && binaryInfo.subMeshesAttrDesc.count > 0) {\r\n const subMeshesData = new Int32Array(parsedGeometry, binaryInfo.subMeshesAttrDesc.offset, binaryInfo.subMeshesAttrDesc.count * 5);\r\n\r\n mesh.subMeshes = [];\r\n for (let i = 0; i < binaryInfo.subMeshesAttrDesc.count; i++) {\r\n const materialIndex = subMeshesData[i * 5 + 0];\r\n const verticesStart = subMeshesData[i * 5 + 1];\r\n const verticesCount = subMeshesData[i * 5 + 2];\r\n const indexStart = subMeshesData[i * 5 + 3];\r\n const indexCount = subMeshesData[i * 5 + 4];\r\n\r\n SubMesh.AddToMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, <AbstractMesh>mesh);\r\n }\r\n }\r\n } else if (parsedGeometry.positions && parsedGeometry.normals && parsedGeometry.indices) {\r\n mesh.setVerticesData(VertexBuffer.PositionKind, parsedGeometry.positions, parsedGeometry.positions._updatable || parsedGeometry.positionsUpdatable);\r\n\r\n mesh.setVerticesData(VertexBuffer.NormalKind, parsedGeometry.normals, parsedGeometry.normals._updatable || parsedGeometry.normalsUpdatable);\r\n\r\n if (parsedGeometry.tangents) {\r\n mesh.setVerticesData(VertexBuffer.TangentKind, parsedGeometry.tangents, parsedGeometry.tangents._updatable || parsedGeometry.tangentsUpdatable);\r\n }\r\n\r\n if (parsedGeometry.uvs) {\r\n mesh.setVerticesData(VertexBuffer.UVKind, parsedGeometry.uvs, parsedGeometry.uvs._updatable || parsedGeometry.uvsUpdatable);\r\n }\r\n\r\n if (parsedGeometry.uvs2) {\r\n mesh.setVerticesData(VertexBuffer.UV2Kind, parsedGeometry.uvs2, parsedGeometry.uvs2._updatable || parsedGeometry.uvs2Updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs3) {\r\n mesh.setVerticesData(VertexBuffer.UV3Kind, parsedGeometry.uvs3, parsedGeometry.uvs3._updatable || parsedGeometry.uvs3Updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs4) {\r\n mesh.setVerticesData(VertexBuffer.UV4Kind, parsedGeometry.uvs4, parsedGeometry.uvs4._updatable || parsedGeometry.uvs4Updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs5) {\r\n mesh.setVerticesData(VertexBuffer.UV5Kind, parsedGeometry.uvs5, parsedGeometry.uvs5._updatable || parsedGeometry.uvs5Updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs6) {\r\n mesh.setVerticesData(VertexBuffer.UV6Kind, parsedGeometry.uvs6, parsedGeometry.uvs6._updatable || parsedGeometry.uvs6Updatable);\r\n }\r\n\r\n if (parsedGeometry.colors) {\r\n mesh.setVerticesData(VertexBuffer.ColorKind, Color4.CheckColors4(parsedGeometry.colors, parsedGeometry.positions.length / 3), parsedGeometry.colors._updatable);\r\n }\r\n\r\n if (parsedGeometry.matricesIndices) {\r\n if (!parsedGeometry.matricesIndices._isExpanded && !parsedGeometry.matricesIndicesExpanded) {\r\n const floatIndices = [];\r\n\r\n for (let i = 0; i < parsedGeometry.matricesIndices.length; i++) {\r\n const matricesIndex = parsedGeometry.matricesIndices[i];\r\n\r\n floatIndices.push(matricesIndex & 0x000000ff);\r\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\r\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, parsedGeometry.matricesIndices._updatable || parsedGeometry.matricesIndicesUpdatable);\r\n } else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n delete parsedGeometry.matricesIndicesExpanded;\r\n mesh.setVerticesData(\r\n VertexBuffer.MatricesIndicesKind,\r\n parsedGeometry.matricesIndices,\r\n parsedGeometry.matricesIndices._updatable || parsedGeometry.matricesIndicesUpdatable\r\n );\r\n }\r\n }\r\n\r\n if (parsedGeometry.matricesIndicesExtra) {\r\n if (!(parsedGeometry.matricesIndicesExtraExpanded || parsedGeometry.matricesIndicesExtra._isExpanded)) {\r\n const floatIndices = [];\r\n\r\n for (let i = 0; i < parsedGeometry.matricesIndicesExtra.length; i++) {\r\n const matricesIndex = parsedGeometry.matricesIndicesExtra[i];\r\n\r\n floatIndices.push(matricesIndex & 0x000000ff);\r\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\r\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n\r\n mesh.setVerticesData(\r\n VertexBuffer.MatricesIndicesExtraKind,\r\n floatIndices,\r\n parsedGeometry.matricesIndicesExtra._updatable || parsedGeometry.matricesIndicesExtraUpdatable\r\n );\r\n } else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n delete parsedGeometry.matricesIndicesExtraExpanded;\r\n mesh.setVerticesData(\r\n VertexBuffer.MatricesIndicesExtraKind,\r\n parsedGeometry.matricesIndicesExtra,\r\n parsedGeometry.matricesIndicesExtra._updatable || parsedGeometry.matricesIndicesExtraUpdatable\r\n );\r\n }\r\n }\r\n\r\n if (parsedGeometry.matricesWeights) {\r\n Geometry._CleanMatricesWeights(parsedGeometry, mesh);\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, parsedGeometry.matricesWeights, parsedGeometry.matricesWeights._updatable);\r\n }\r\n\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsExtraKind, parsedGeometry.matricesWeightsExtra, parsedGeometry.matricesWeights._updatable);\r\n }\r\n\r\n mesh.setIndices(parsedGeometry.indices, null);\r\n }\r\n\r\n // SubMeshes\r\n if (parsedGeometry.subMeshes) {\r\n mesh.subMeshes = [];\r\n for (let subIndex = 0; subIndex < parsedGeometry.subMeshes.length; subIndex++) {\r\n const parsedSubMesh = parsedGeometry.subMeshes[subIndex];\r\n\r\n SubMesh.AddToMesh(\r\n parsedSubMesh.materialIndex,\r\n parsedSubMesh.verticesStart,\r\n parsedSubMesh.verticesCount,\r\n parsedSubMesh.indexStart,\r\n parsedSubMesh.indexCount,\r\n <AbstractMesh>mesh\r\n );\r\n }\r\n }\r\n\r\n // Flat shading\r\n if (mesh._shouldGenerateFlatShading) {\r\n mesh.convertToFlatShadedMesh();\r\n mesh._shouldGenerateFlatShading = false;\r\n }\r\n\r\n // Update\r\n mesh.computeWorldMatrix(true);\r\n\r\n scene.onMeshImportedObservable.notifyObservers(<AbstractMesh>mesh);\r\n }\r\n\r\n private static _CleanMatricesWeights(parsedGeometry: any, mesh: Mesh): void {\r\n const epsilon: number = 1e-3;\r\n if (!SceneLoaderFlags.CleanBoneMatrixWeights) {\r\n return;\r\n }\r\n let noInfluenceBoneIndex = 0.0;\r\n if (parsedGeometry.skeletonId > -1) {\r\n const skeleton = mesh.getScene().getLastSkeletonById(parsedGeometry.skeletonId);\r\n\r\n if (!skeleton) {\r\n return;\r\n }\r\n noInfluenceBoneIndex = skeleton.bones.length;\r\n } else {\r\n return;\r\n }\r\n const matricesIndices = <FloatArray>mesh.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n const matricesIndicesExtra = <FloatArray>mesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind);\r\n const matricesWeights = parsedGeometry.matricesWeights;\r\n const matricesWeightsExtra = parsedGeometry.matricesWeightsExtra;\r\n const influencers = parsedGeometry.numBoneInfluencer;\r\n const size = matricesWeights.length;\r\n\r\n for (let i = 0; i < size; i += 4) {\r\n let weight = 0.0;\r\n let firstZeroWeight = -1;\r\n for (let j = 0; j < 4; j++) {\r\n const w = matricesWeights[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j;\r\n }\r\n }\r\n if (matricesWeightsExtra) {\r\n for (let j = 0; j < 4; j++) {\r\n const w = matricesWeightsExtra[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j + 4;\r\n }\r\n }\r\n }\r\n if (firstZeroWeight < 0 || firstZeroWeight > influencers - 1) {\r\n firstZeroWeight = influencers - 1;\r\n }\r\n if (weight > epsilon) {\r\n const mweight = 1.0 / weight;\r\n for (let j = 0; j < 4; j++) {\r\n matricesWeights[i + j] *= mweight;\r\n }\r\n if (matricesWeightsExtra) {\r\n for (let j = 0; j < 4; j++) {\r\n matricesWeightsExtra[i + j] *= mweight;\r\n }\r\n }\r\n } else {\r\n if (firstZeroWeight >= 4) {\r\n matricesWeightsExtra[i + firstZeroWeight - 4] = 1.0 - weight;\r\n matricesIndicesExtra[i + firstZeroWeight - 4] = noInfluenceBoneIndex;\r\n } else {\r\n matricesWeights[i + firstZeroWeight] = 1.0 - weight;\r\n matricesIndices[i + firstZeroWeight] = noInfluenceBoneIndex;\r\n }\r\n }\r\n }\r\n\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, matricesIndices);\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, matricesIndicesExtra);\r\n }\r\n }\r\n\r\n /**\r\n * Create a new geometry from persisted data (Using .babylon file format)\r\n * @param parsedVertexData defines the persisted data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url to use to load assets (like delayed data)\r\n * @returns the new geometry object\r\n */\r\n public static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Nullable<Geometry> {\r\n const geometry = new Geometry(parsedVertexData.id, scene, undefined, parsedVertexData.updatable);\r\n geometry._loadedUniqueId = parsedVertexData.uniqueId;\r\n\r\n if (Tags) {\r\n Tags.AddTagsTo(geometry, parsedVertexData.tags);\r\n }\r\n\r\n if (parsedVertexData.delayLoadingFile) {\r\n geometry.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n geometry.delayLoadingFile = rootUrl + parsedVertexData.delayLoadingFile;\r\n geometry._boundingInfo = new BoundingInfo(Vector3.FromArray(parsedVertexData.boundingBoxMinimum), Vector3.FromArray(parsedVertexData.boundingBoxMaximum));\r\n\r\n geometry._delayInfo = [];\r\n if (parsedVertexData.hasUVs) {\r\n geometry._delayInfo.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs2) {\r\n geometry._delayInfo.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs3) {\r\n geometry._delayInfo.push(VertexBuffer.UV3Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs4) {\r\n geometry._delayInfo.push(VertexBuffer.UV4Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs5) {\r\n geometry._delayInfo.push(VertexBuffer.UV5Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs6) {\r\n geometry._delayInfo.push(VertexBuffer.UV6Kind);\r\n }\r\n\r\n if (parsedVertexData.hasColors) {\r\n geometry._delayInfo.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n if (parsedVertexData.hasMatricesIndices) {\r\n geometry._delayInfo.push(VertexBuffer.MatricesIndicesKind);\r\n }\r\n\r\n if (parsedVertexData.hasMatricesWeights) {\r\n geometry._delayInfo.push(VertexBuffer.MatricesWeightsKind);\r\n }\r\n\r\n geometry._delayLoadingFunction = VertexData.ImportVertexData;\r\n } else {\r\n VertexData.ImportVertexData(parsedVertexData, geometry);\r\n }\r\n\r\n scene.pushGeometry(geometry, true);\r\n\r\n return geometry;\r\n }\r\n}\r\n"]}
@@ -101,7 +101,7 @@ export class SerializationHelper {
101
101
  }
102
102
  break;
103
103
  case 1: // Texture
104
- serializationObject[targetPropertyName] = sourceProperty.serialize();
104
+ serializationObject[targetPropertyName] = sourceProperty.doNotSerialize ? null : sourceProperty.serialize();
105
105
  break;
106
106
  case 2: // Color3
107
107
  serializationObject[targetPropertyName] = sourceProperty.asArray();