@onerjs/core 8.46.1 → 8.46.2

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 (38) hide show
  1. package/Collisions/gpuPicker.js +9 -1
  2. package/Collisions/gpuPicker.js.map +1 -1
  3. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +20 -0
  4. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +58 -13
  5. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  6. package/Engines/WebGPU/webgpuConstants.d.ts +5 -2
  7. package/Engines/WebGPU/webgpuConstants.js +3 -0
  8. package/Engines/WebGPU/webgpuConstants.js.map +1 -1
  9. package/Engines/engine.d.ts +45 -41
  10. package/Engines/webgpuEngine.d.ts +84 -0
  11. package/Engines/webgpuEngine.js +80 -1
  12. package/Engines/webgpuEngine.js.map +1 -1
  13. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.d.ts +7 -0
  14. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js +22 -0
  15. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js.map +1 -1
  16. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -28
  17. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  18. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.d.ts +46 -0
  19. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js +56 -0
  20. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js.map +1 -0
  21. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +104 -463
  22. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +553 -2018
  23. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  24. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.d.ts +554 -0
  25. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +2017 -0
  26. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -0
  27. package/Meshes/index.d.ts +2 -0
  28. package/Meshes/index.js +2 -0
  29. package/Meshes/index.js.map +1 -1
  30. package/Rendering/depthRenderer.js +2 -1
  31. package/Rendering/depthRenderer.js.map +1 -1
  32. package/package.json +1 -1
  33. package/Shaders/ShadersInclude/openpbrBlockAmbientOcclusion.d.ts +0 -5
  34. package/Shaders/ShadersInclude/openpbrBlockAmbientOcclusion.js +0 -35
  35. package/Shaders/ShadersInclude/openpbrBlockAmbientOcclusion.js.map +0 -1
  36. package/ShadersWGSL/ShadersInclude/openpbrBlockAmbientOcclusion.d.ts +0 -5
  37. package/ShadersWGSL/ShadersInclude/openpbrBlockAmbientOcclusion.js +0 -36
  38. package/ShadersWGSL/ShadersInclude/openpbrBlockAmbientOcclusion.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"gaussianSplattingMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GaussianSplatting/gaussianSplattingMesh.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,gCAAgC,EAAE,MAAM,4DAA4D,CAAC;AACzI,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,MAAM,EAA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AAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC7C,CAAC;YACL,CAAC;iBAAM,CAAC;gBACJ,sDAAsD;gBACtD,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;gBAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,EAAE,CAAC,EAAE,EAAE,CAAC;oBACzC,QAAQ,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;oBACzG,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC7C,CAAC;YACL,CAAC;YAED,QAAQ,CAAC,IAAI,EAAE,CAAC;YAEhB,IAAI,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QAChE,CAAC;IACL,CAAC,CAAC;AACN,CAAC,AApF2B,CAoF1B","sourcesContent":["import { type Scene } from \"core/scene\";\r\nimport { type DeepImmutable, type Nullable } from \"core/types\";\r\nimport { type BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { SubMesh } from \"../subMesh\";\r\nimport { type AbstractMesh } from \"../abstractMesh\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { VertexData } from \"../mesh.vertexData\";\r\nimport { Matrix, TmpVectors, Vector2, Vector3, Quaternion } from \"core/Maths/math.vector\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { GaussianSplattingMaterial, GetGaussianSplattingMaxPartCount } from \"core/Materials/GaussianSplatting/gaussianSplattingMaterial\";\r\nimport { RawTexture } from \"core/Materials/Textures/rawTexture\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport \"core/Meshes/thinInstanceMesh\";\r\nimport { type ThinEngine } from \"core/Engines/thinEngine\";\r\nimport { ToHalfFloat } from \"core/Misc/textureTools\";\r\nimport { type Material } from \"core/Materials/material\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\nimport { runCoroutineSync, runCoroutineAsync, createYieldingScheduler, type Coroutine } from \"core/Misc/coroutine\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\nimport { type Camera } from \"core/Cameras/camera\";\r\nimport { ImportMeshAsync } from \"core/Loading/sceneLoader\";\r\nimport { type INative } from \"core/Engines/Native/nativeInterfaces\";\r\nimport { GaussianSplattingPartProxyMesh } from \"./gaussianSplattingPartProxyMesh\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare const _native: INative;\r\n\r\nconst IsNative = typeof _native !== \"undefined\";\r\nconst Native = IsNative ? _native : null;\r\ninterface IDelayedTextureUpdate {\r\n covA: Uint16Array;\r\n covB: Uint16Array;\r\n colors: Uint8Array;\r\n centers: Float32Array;\r\n sh?: Uint8Array[];\r\n partIndices?: Uint8Array;\r\n}\r\ninterface IUpdateOptions {\r\n flipY?: boolean;\r\n}\r\n\r\n// @internal\r\nconst UnpackUnorm = (value: number, bits: number) => {\r\n const t = (1 << bits) - 1;\r\n return (value & t) / t;\r\n};\r\n\r\n// @internal\r\nconst Unpack111011 = (value: number, result: Vector3) => {\r\n result.x = UnpackUnorm(value >>> 21, 11);\r\n result.y = UnpackUnorm(value >>> 11, 10);\r\n result.z = UnpackUnorm(value, 11);\r\n};\r\n\r\n// @internal\r\nconst Unpack8888 = (value: number, result: Uint8ClampedArray) => {\r\n result[0] = UnpackUnorm(value >>> 24, 8) * 255;\r\n result[1] = UnpackUnorm(value >>> 16, 8) * 255;\r\n result[2] = UnpackUnorm(value >>> 8, 8) * 255;\r\n result[3] = UnpackUnorm(value, 8) * 255;\r\n};\r\n\r\n// @internal\r\n// unpack quaternion with 2,10,10,10 format (largest element, 3x10bit element)\r\nconst UnpackRot = (value: number, result: Quaternion) => {\r\n const norm = 1.0 / (Math.sqrt(2) * 0.5);\r\n const a = (UnpackUnorm(value >>> 20, 10) - 0.5) * norm;\r\n const b = (UnpackUnorm(value >>> 10, 10) - 0.5) * norm;\r\n const c = (UnpackUnorm(value, 10) - 0.5) * norm;\r\n const m = Math.sqrt(1.0 - (a * a + b * b + c * c));\r\n\r\n switch (value >>> 30) {\r\n case 0:\r\n result.set(m, a, b, c);\r\n break;\r\n case 1:\r\n result.set(a, m, b, c);\r\n break;\r\n case 2:\r\n result.set(a, b, m, c);\r\n break;\r\n case 3:\r\n result.set(a, b, c, m);\r\n break;\r\n }\r\n};\r\n\r\ninterface ICompressedPLYChunk {\r\n min: Vector3;\r\n max: Vector3;\r\n minScale: Vector3;\r\n maxScale: Vector3;\r\n minColor: Vector3;\r\n maxColor: Vector3;\r\n}\r\n\r\n/**\r\n * To support multiple camera rendering, rendered mesh is separated from the GaussianSplattingMesh itself.\r\n * The GS mesh serves as a proxy and a different mesh is rendered for each camera. This hot switch is done\r\n * in the render() function. Each camera has a corresponding ICameraViewInfo object. The key is the camera unique id.\r\n * ICameraViewInfo and the rendered mesh are created in method `_postToWorker`\r\n * Mesh are disabled to not let the scene render them directly.\r\n * ICameraViewInfo are sorted per last frame id update to prioritize the less recently updated ones.\r\n * There is 1 web worker per GaussianSplattingMesh to avoid too many copies between main thread and workers.\r\n * So, only one sort is being done at a time per GaussianSplattingMesh. If multiple cameras need an update,\r\n * they will be processed one by one in subsequent frames.\r\n */\r\ninterface ICameraViewInfo {\r\n camera: Camera;\r\n cameraDirection: Vector3;\r\n mesh: Mesh;\r\n frameIdLastUpdate: number;\r\n splatIndexBufferSet: boolean;\r\n}\r\n/**\r\n * Representation of the types\r\n */\r\nconst enum PLYType {\r\n FLOAT,\r\n INT,\r\n UINT,\r\n DOUBLE,\r\n UCHAR,\r\n UNDEFINED,\r\n}\r\n\r\n/**\r\n * Usage types of the PLY values\r\n */\r\nconst enum PLYValue {\r\n MIN_X,\r\n MIN_Y,\r\n MIN_Z,\r\n MAX_X,\r\n MAX_Y,\r\n MAX_Z,\r\n\r\n MIN_SCALE_X,\r\n MIN_SCALE_Y,\r\n MIN_SCALE_Z,\r\n\r\n MAX_SCALE_X,\r\n MAX_SCALE_Y,\r\n MAX_SCALE_Z,\r\n\r\n PACKED_POSITION,\r\n PACKED_ROTATION,\r\n PACKED_SCALE,\r\n PACKED_COLOR,\r\n X,\r\n Y,\r\n Z,\r\n SCALE_0,\r\n SCALE_1,\r\n SCALE_2,\r\n\r\n DIFFUSE_RED,\r\n DIFFUSE_GREEN,\r\n DIFFUSE_BLUE,\r\n OPACITY,\r\n\r\n F_DC_0,\r\n F_DC_1,\r\n F_DC_2,\r\n F_DC_3,\r\n\r\n ROT_0,\r\n ROT_1,\r\n ROT_2,\r\n ROT_3,\r\n\r\n MIN_COLOR_R,\r\n MIN_COLOR_G,\r\n MIN_COLOR_B,\r\n\r\n MAX_COLOR_R,\r\n MAX_COLOR_G,\r\n MAX_COLOR_B,\r\n\r\n SH_0,\r\n SH_1,\r\n SH_2,\r\n SH_3,\r\n SH_4,\r\n SH_5,\r\n SH_6,\r\n SH_7,\r\n SH_8,\r\n SH_9,\r\n SH_10,\r\n SH_11,\r\n SH_12,\r\n SH_13,\r\n SH_14,\r\n SH_15,\r\n SH_16,\r\n SH_17,\r\n SH_18,\r\n SH_19,\r\n SH_20,\r\n SH_21,\r\n SH_22,\r\n SH_23,\r\n SH_24,\r\n SH_25,\r\n SH_26,\r\n SH_27,\r\n SH_28,\r\n SH_29,\r\n SH_30,\r\n SH_31,\r\n SH_32,\r\n SH_33,\r\n SH_34,\r\n SH_35,\r\n SH_36,\r\n SH_37,\r\n SH_38,\r\n SH_39,\r\n SH_40,\r\n SH_41,\r\n SH_42,\r\n SH_43,\r\n SH_44,\r\n\r\n UNDEFINED,\r\n}\r\n\r\n/**\r\n * Property field found in PLY header\r\n */\r\nexport type PlyProperty = {\r\n /**\r\n * Value usage\r\n */\r\n value: PLYValue;\r\n /**\r\n * Value type\r\n */\r\n type: PLYType;\r\n /**\r\n * offset in byte from te beginning of the splat\r\n */\r\n offset: number;\r\n};\r\n\r\n/**\r\n * meta info on Splat file\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PLYHeader {\r\n /**\r\n * number of splats\r\n */\r\n vertexCount: number;\r\n /**\r\n * number of spatial chunks for compressed ply\r\n */\r\n chunkCount: number;\r\n /**\r\n * length in bytes of the vertex info\r\n */\r\n rowVertexLength: number;\r\n /**\r\n * length in bytes of the chunk\r\n */\r\n rowChunkLength: number;\r\n /**\r\n * array listing properties per vertex\r\n */\r\n vertexProperties: PlyProperty[];\r\n /**\r\n * array listing properties per chunk\r\n */\r\n chunkProperties: PlyProperty[];\r\n /**\r\n * data view for parsing chunks and vertices\r\n */\r\n dataView: DataView;\r\n /**\r\n * buffer for the data view\r\n */\r\n buffer: ArrayBuffer;\r\n /**\r\n * degree of SH coefficients\r\n */\r\n shDegree: number;\r\n /**\r\n * number of coefficient per splat\r\n */\r\n shCoefficientCount: number;\r\n /**\r\n * buffer for SH coefficients\r\n */\r\n shBuffer: ArrayBuffer | null;\r\n}\r\n\r\n/**\r\n * Class used to render a gaussian splatting mesh\r\n */\r\nexport class GaussianSplattingMesh extends Mesh {\r\n private _vertexCount = 0;\r\n private _worker: Nullable<Worker> = null;\r\n private _modelViewProjectionMatrix = Matrix.Identity();\r\n private _depthMix: BigInt64Array;\r\n private _canPostToWorker = true;\r\n private _readyToDisplay = false;\r\n private _covariancesATexture: Nullable<BaseTexture> = null;\r\n private _covariancesBTexture: Nullable<BaseTexture> = null;\r\n private _centersTexture: Nullable<BaseTexture> = null;\r\n private _colorsTexture: Nullable<BaseTexture> = null;\r\n private _splatPositions: Nullable<Float32Array> = null;\r\n private _splatIndex: Nullable<Float32Array> = null;\r\n private _shTextures: Nullable<BaseTexture[]> = null;\r\n private _splatsData: Nullable<ArrayBuffer> = null;\r\n private _shData: Nullable<Uint8Array[]> = null;\r\n private _partIndicesTexture: Nullable<BaseTexture> = null;\r\n private _partIndices: Nullable<Uint8Array> = null;\r\n private _partMatrices: Matrix[] = [];\r\n private _partVisibility: number[] = [];\r\n private _partProxies: Map<number, GaussianSplattingPartProxyMesh> = new Map();\r\n private _textureSize: Vector2 = new Vector2(0, 0);\r\n private readonly _keepInRam: boolean = false;\r\n\r\n private _delayedTextureUpdate: Nullable<IDelayedTextureUpdate> = null;\r\n private _useRGBACovariants = false;\r\n private _material: Nullable<Material> = null;\r\n\r\n private _tmpCovariances = [0, 0, 0, 0, 0, 0];\r\n private _sortIsDirty = false;\r\n\r\n private static _RowOutputLength = 3 * 4 + 3 * 4 + 4 + 4; // Vector3 position, Vector3 scale, 1 u8 quaternion, 1 color with alpha\r\n private static _SH_C0 = 0.28209479177387814;\r\n // batch size between 2 yield calls. This value is a tradeoff between updates overhead and framerate hiccups\r\n // This step is faster the PLY conversion. So batch size can be bigger\r\n private static _SplatBatchSize = 327680;\r\n // batch size between 2 yield calls during the PLY to splat conversion.\r\n private static _PlyConversionBatchSize = 32768;\r\n private _shDegree = 0;\r\n\r\n private static readonly _BatchSize = 16; // 16 splats per instance\r\n private _cameraViewInfos = new Map<number, ICameraViewInfo>();\r\n\r\n private static readonly _DefaultViewUpdateThreshold = 1e-4;\r\n\r\n /**\r\n * Cosine value of the angle threshold to update view dependent splat sorting. Default is 0.0001.\r\n */\r\n public viewUpdateThreshold: number = GaussianSplattingMesh._DefaultViewUpdateThreshold;\r\n\r\n protected _disableDepthSort = false;\r\n /**\r\n * If true, disables depth sorting of the splats (default: false)\r\n */\r\n public get disableDepthSort() {\r\n return this._disableDepthSort;\r\n }\r\n public set disableDepthSort(value: boolean) {\r\n if (!this._disableDepthSort && value) {\r\n this._worker?.terminate();\r\n this._worker = null;\r\n this._disableDepthSort = true;\r\n } else if (this._disableDepthSort && !value) {\r\n this._disableDepthSort = false;\r\n this._sortIsDirty = true;\r\n this._instanciateWorker();\r\n }\r\n }\r\n\r\n /**\r\n * View direction factor used to compute the SH view direction in the shader.\r\n * @deprecated Not used anymore for SH rendering\r\n */\r\n public get viewDirectionFactor() {\r\n return Vector3.OneReadOnly;\r\n }\r\n\r\n /**\r\n * SH degree. 0 = no sh (default). 1 = 3 parameters. 2 = 8 parameters. 3 = 15 parameters.\r\n * Value is clamped between 0 and the maximum degree available from loaded data.\r\n */\r\n public get shDegree() {\r\n return this._shDegree;\r\n }\r\n\r\n public set shDegree(value: number) {\r\n const maxDegree = this._shTextures?.length ?? 0;\r\n const clamped = Math.max(0, Math.min(Math.round(value), maxDegree));\r\n if (this._shDegree === clamped) {\r\n return;\r\n }\r\n this._shDegree = clamped;\r\n this.material?.resetDrawCache();\r\n }\r\n\r\n /**\r\n * Maximum SH degree available from the loaded data.\r\n */\r\n public get maxShDegree() {\r\n return this._shTextures?.length ?? 0;\r\n }\r\n\r\n /**\r\n * Number of splats in the mesh\r\n */\r\n public get splatCount() {\r\n return this._splatIndex?.length;\r\n }\r\n\r\n /**\r\n * returns the splats data array buffer that contains in order : postions (3 floats), size (3 floats), color (4 bytes), orientation quaternion (4 bytes)\r\n */\r\n public get splatsData() {\r\n return this._splatsData;\r\n }\r\n\r\n /**\r\n * returns the SH data arrays\r\n */\r\n public get shData() {\r\n return this._shData;\r\n }\r\n\r\n /**\r\n * True when this mesh is a compound that regroups multiple Gaussian splatting parts.\r\n */\r\n public get isCompound() {\r\n return this._partMatrices.length > 0;\r\n }\r\n\r\n /**\r\n * returns the part indices array\r\n */\r\n public get partIndices() {\r\n return this._partIndices;\r\n }\r\n\r\n /**\r\n * Gets the part indices texture, if the mesh is a compound\r\n */\r\n public get partIndicesTexture() {\r\n return this._partIndicesTexture;\r\n }\r\n\r\n /**\r\n * Gets the part visibility array, if the mesh is a compound\r\n */\r\n public get partVisibility() {\r\n return this._partVisibility;\r\n }\r\n\r\n /**\r\n * Set the number of batch (a batch is 16384 splats) after which a display update is performed\r\n * A value of 0 (default) means display update will not happens before splat is ready.\r\n */\r\n public static ProgressiveUpdateAmount = 0;\r\n\r\n /**\r\n * Gets the covariancesA texture\r\n */\r\n public get covariancesATexture() {\r\n return this._covariancesATexture;\r\n }\r\n\r\n /**\r\n * Gets the covariancesB texture\r\n */\r\n public get covariancesBTexture() {\r\n return this._covariancesBTexture;\r\n }\r\n\r\n /**\r\n * Gets the centers texture\r\n */\r\n public get centersTexture() {\r\n return this._centersTexture;\r\n }\r\n\r\n /**\r\n * Gets the colors texture\r\n */\r\n public get colorsTexture() {\r\n return this._colorsTexture;\r\n }\r\n\r\n /**\r\n * Gets the SH textures\r\n */\r\n public get shTextures() {\r\n return this._shTextures;\r\n }\r\n\r\n /**\r\n * Gets the kernel size\r\n * Documentation and mathematical explanations here:\r\n * https://github.com/graphdeco-inria/gaussian-splatting/issues/294#issuecomment-1772688093\r\n * https://github.com/autonomousvision/mip-splatting/issues/18#issuecomment-1929388931\r\n */\r\n public get kernelSize() {\r\n return this._material instanceof GaussianSplattingMaterial ? this._material.kernelSize : 0;\r\n }\r\n\r\n /**\r\n * Get the compensation state\r\n */\r\n public get compensation() {\r\n return this._material instanceof GaussianSplattingMaterial ? this._material.compensation : false;\r\n }\r\n\r\n private _loadingPromise: Promise<void> | null = null;\r\n\r\n /**\r\n * set rendering material\r\n */\r\n public override set material(value: Material) {\r\n this._material = value;\r\n this._material.backFaceCulling = false;\r\n this._material.cullBackFaces = false;\r\n value.resetDrawCache();\r\n }\r\n\r\n /**\r\n * get rendering material\r\n */\r\n public override get material(): Nullable<Material> {\r\n return this._material;\r\n }\r\n\r\n private static _MakeSplatGeometryForMesh(mesh: Mesh): void {\r\n const vertexData = new VertexData();\r\n const originPositions = [-2, -2, 0, 2, -2, 0, 2, 2, 0, -2, 2, 0];\r\n const originIndices = [0, 1, 2, 0, 2, 3];\r\n const positions = [];\r\n const indices = [];\r\n for (let i = 0; i < GaussianSplattingMesh._BatchSize; i++) {\r\n for (let j = 0; j < 12; j++) {\r\n if (j == 2 || j == 5 || j == 8 || j == 11) {\r\n positions.push(i); // local splat index\r\n } else {\r\n positions.push(originPositions[j]);\r\n }\r\n }\r\n indices.push(originIndices.map((v) => v + i * 4));\r\n }\r\n\r\n vertexData.positions = positions;\r\n vertexData.indices = indices.flat();\r\n\r\n vertexData.applyToMesh(mesh);\r\n }\r\n\r\n /**\r\n * Creates a new gaussian splatting mesh\r\n * @param name defines the name of the mesh\r\n * @param url defines the url to load from (optional)\r\n * @param scene defines the hosting scene (optional)\r\n * @param keepInRam keep datas in ram for editing purpose\r\n */\r\n constructor(name: string, url: Nullable<string> = null, scene: Nullable<Scene> = null, keepInRam: boolean = false) {\r\n super(name, scene);\r\n\r\n this.subMeshes = [];\r\n new SubMesh(0, 0, 4 * GaussianSplattingMesh._BatchSize, 0, 6 * GaussianSplattingMesh._BatchSize, this);\r\n\r\n this.setEnabled(false);\r\n // webGL2 and webGPU support for RG texture with float16 is fine. not webGL1\r\n this._useRGBACovariants = !this.getEngine().isWebGPU && this.getEngine().version === 1.0;\r\n\r\n this._keepInRam = keepInRam;\r\n if (url) {\r\n this._loadingPromise = this.loadFileAsync(url);\r\n }\r\n const gaussianSplattingMaterial = new GaussianSplattingMaterial(this.name + \"_material\", this._scene);\r\n gaussianSplattingMaterial.setSourceMesh(this);\r\n this._material = gaussianSplattingMaterial;\r\n\r\n // delete meshes created for cameras on camera removal\r\n this._scene.onCameraRemovedObservable.add((camera: Camera) => {\r\n const cameraId = camera.uniqueId;\r\n // delete mesh for this camera\r\n if (this._cameraViewInfos.has(cameraId)) {\r\n const cameraViewInfos = this._cameraViewInfos.get(cameraId);\r\n cameraViewInfos?.mesh.dispose();\r\n this._cameraViewInfos.delete(cameraId);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Get the loading promise when loading the mesh from a URL in the constructor\r\n * @returns constructor loading promise or null if no URL was provided\r\n */\r\n public getLoadingPromise(): Promise<void> | null {\r\n return this._loadingPromise;\r\n }\r\n\r\n /**\r\n * Returns the class name\r\n * @returns \"GaussianSplattingMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingMesh\";\r\n }\r\n\r\n /**\r\n * Returns the total number of vertices (splats) within the mesh\r\n * @returns the total number of vertices\r\n */\r\n public override getTotalVertices(): number {\r\n return this._vertexCount;\r\n }\r\n\r\n /**\r\n * Is this node ready to be used/rendered\r\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\r\n * @returns true when ready\r\n */\r\n public override isReady(completeCheck = false): boolean {\r\n if (!super.isReady(completeCheck, true)) {\r\n return false;\r\n }\r\n\r\n if (!this._readyToDisplay) {\r\n // mesh is ready when worker has done at least 1 sorting\r\n this._postToWorker(true);\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n public _getCameraDirection(camera: Camera): Vector3 {\r\n const cameraViewMatrix = camera.getViewMatrix();\r\n const cameraProjectionMatrix = camera.getProjectionMatrix();\r\n const cameraViewProjectionMatrix = TmpVectors.Matrix[0];\r\n cameraViewMatrix.multiplyToRef(cameraProjectionMatrix, cameraViewProjectionMatrix);\r\n\r\n const modelMatrix = this.getWorldMatrix();\r\n const modelViewMatrix = TmpVectors.Matrix[1];\r\n modelMatrix.multiplyToRef(cameraViewMatrix, modelViewMatrix);\r\n modelMatrix.multiplyToRef(cameraViewProjectionMatrix, this._modelViewProjectionMatrix);\r\n\r\n // return vector used to compute distance to camera\r\n const localDirection = TmpVectors.Vector3[1];\r\n localDirection.set(modelViewMatrix.m[2], modelViewMatrix.m[6], modelViewMatrix.m[10]);\r\n localDirection.normalize();\r\n\r\n return localDirection;\r\n }\r\n\r\n /** @internal */\r\n public _postToWorker(forced = false): void {\r\n const scene = this._scene;\r\n const frameId = scene.getFrameId();\r\n // force update or at least frame update for camera is outdated\r\n let outdated = false;\r\n this._cameraViewInfos.forEach((cameraViewInfos) => {\r\n if (cameraViewInfos.frameIdLastUpdate !== frameId) {\r\n outdated = true;\r\n }\r\n });\r\n\r\n // array of cameras used for rendering\r\n const cameras = this._scene.activeCameras?.length ? this._scene.activeCameras : [this._scene.activeCamera!];\r\n // list view infos for active cameras\r\n const activeViewInfos: ICameraViewInfo[] = [];\r\n cameras.forEach((camera) => {\r\n if (!camera) {\r\n return;\r\n }\r\n const cameraId = camera.uniqueId;\r\n\r\n const cameraViewInfos = this._cameraViewInfos.get(cameraId);\r\n if (cameraViewInfos) {\r\n activeViewInfos.push(cameraViewInfos);\r\n } else {\r\n // mesh doesn't exist yet for this camera\r\n const cameraMesh = new Mesh(this.name + \"_cameraMesh_\" + cameraId, this._scene);\r\n // not visible with inspector or the scene graph\r\n cameraMesh.reservedDataStore = { hidden: true };\r\n cameraMesh.setEnabled(false);\r\n cameraMesh.material = this.material;\r\n if (cameraMesh.material && cameraMesh.material instanceof GaussianSplattingMaterial) {\r\n const gsMaterial = cameraMesh.material as GaussianSplattingMaterial;\r\n // GaussianSplattingMaterial source mesh may not have been set yet.\r\n // This happens for cloned resources from asset containers for instance,\r\n // where material is cloned before mesh.\r\n if (!gsMaterial.getSourceMesh()) {\r\n gsMaterial.setSourceMesh(this);\r\n }\r\n }\r\n GaussianSplattingMesh._MakeSplatGeometryForMesh(cameraMesh);\r\n\r\n const newViewInfos: ICameraViewInfo = {\r\n camera: camera,\r\n cameraDirection: new Vector3(0, 0, 0),\r\n mesh: cameraMesh,\r\n frameIdLastUpdate: frameId,\r\n splatIndexBufferSet: false,\r\n };\r\n activeViewInfos.push(newViewInfos);\r\n this._cameraViewInfos.set(cameraId, newViewInfos);\r\n }\r\n });\r\n // sort view infos by last updated frame id: first item is the least recently updated\r\n activeViewInfos.sort((a, b) => a.frameIdLastUpdate - b.frameIdLastUpdate);\r\n\r\n const hasSortFunction = this._worker || Native?.sortSplats || this._disableDepthSort;\r\n if ((forced || outdated) && hasSortFunction && (this._scene.activeCameras?.length || this._scene.activeCamera) && this._canPostToWorker) {\r\n // view infos sorted by least recent updated frame id\r\n activeViewInfos.forEach((cameraViewInfos) => {\r\n const camera = cameraViewInfos.camera;\r\n const cameraDirection = this._getCameraDirection(camera);\r\n\r\n const previousCameraDirection = cameraViewInfos.cameraDirection;\r\n const dot = Vector3.Dot(cameraDirection, previousCameraDirection);\r\n if ((forced || Math.abs(dot - 1) >= this.viewUpdateThreshold) && this._canPostToWorker) {\r\n cameraViewInfos.cameraDirection.copyFrom(cameraDirection);\r\n cameraViewInfos.frameIdLastUpdate = frameId;\r\n this._canPostToWorker = false;\r\n if (this._worker) {\r\n const cameraViewMatrix = camera.getViewMatrix();\r\n this._worker.postMessage(\r\n {\r\n worldMatrix: this.getWorldMatrix().m,\r\n cameraForward: [cameraViewMatrix.m[2], cameraViewMatrix.m[6], cameraViewMatrix.m[10]],\r\n cameraPosition: [camera.globalPosition.x, camera.globalPosition.y, camera.globalPosition.z],\r\n depthMix: this._depthMix,\r\n cameraId: camera.uniqueId,\r\n },\r\n [this._depthMix.buffer]\r\n );\r\n } else if (Native?.sortSplats) {\r\n Native.sortSplats(this._modelViewProjectionMatrix, this._splatPositions!, this._splatIndex!, this._scene.useRightHandedSystem);\r\n if (cameraViewInfos.splatIndexBufferSet) {\r\n cameraViewInfos.mesh.thinInstanceBufferUpdated(\"splatIndex\");\r\n } else {\r\n cameraViewInfos.mesh.thinInstanceSetBuffer(\"splatIndex\", this._splatIndex, 16, false);\r\n cameraViewInfos.splatIndexBufferSet = true;\r\n }\r\n this._canPostToWorker = true;\r\n this._readyToDisplay = true;\r\n }\r\n }\r\n });\r\n } else if (this._disableDepthSort) {\r\n activeViewInfos.forEach((cameraViewInfos) => {\r\n if (!cameraViewInfos.splatIndexBufferSet) {\r\n cameraViewInfos.mesh.thinInstanceSetBuffer(\"splatIndex\", this._splatIndex, 16, false);\r\n cameraViewInfos.splatIndexBufferSet = true;\r\n }\r\n });\r\n this._canPostToWorker = true;\r\n this._readyToDisplay = true;\r\n }\r\n }\r\n /**\r\n * Triggers the draw call for the mesh. Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager\r\n * @param subMesh defines the subMesh to render\r\n * @param enableAlphaMode defines if alpha mode can be changed\r\n * @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering\r\n * @returns the current mesh\r\n */\r\n public override render(subMesh: SubMesh, enableAlphaMode: boolean, effectiveMeshReplacement?: AbstractMesh): Mesh {\r\n this._postToWorker();\r\n\r\n // geometry used for shadows, bind the first found in the camera view infos\r\n if (!this._geometry && this._cameraViewInfos.size) {\r\n this._geometry = this._cameraViewInfos.values().next().value!.mesh.geometry;\r\n }\r\n\r\n const cameraId = this._scene.activeCamera!.uniqueId;\r\n const cameraViewInfos = this._cameraViewInfos.get(cameraId);\r\n if (!cameraViewInfos || !cameraViewInfos.splatIndexBufferSet) {\r\n return this;\r\n }\r\n\r\n if (this.onBeforeRenderObservable) {\r\n this.onBeforeRenderObservable.notifyObservers(this);\r\n }\r\n const mesh = cameraViewInfos.mesh;\r\n mesh.getWorldMatrix().copyFrom(this.getWorldMatrix());\r\n\r\n // Propagate render pass material overrides (e.g., GPU picking) to the inner camera mesh.\r\n // When this mesh is rendered into a RenderTargetTexture with a material override (via setMaterialForRendering),\r\n // the override is set on this proxy mesh but needs to be applied to the actual camera mesh that does the rendering.\r\n const engine = this._scene.getEngine();\r\n const renderPassId = engine.currentRenderPassId;\r\n const renderPassMaterial = this.getMaterialForRenderPass(renderPassId);\r\n if (renderPassMaterial) {\r\n mesh.setMaterialForRenderPass(renderPassId, renderPassMaterial);\r\n }\r\n\r\n const ret = mesh.render(subMesh, enableAlphaMode, effectiveMeshReplacement);\r\n\r\n // Clean up the temporary override to avoid affecting other render passes\r\n if (renderPassMaterial) {\r\n mesh.setMaterialForRenderPass(renderPassId, undefined);\r\n }\r\n\r\n if (this.onAfterRenderObservable) {\r\n this.onAfterRenderObservable.notifyObservers(this);\r\n }\r\n return ret;\r\n }\r\n\r\n private static _TypeNameToEnum(name: string): PLYType {\r\n switch (name) {\r\n case \"float\":\r\n return PLYType.FLOAT;\r\n case \"int\":\r\n return PLYType.INT;\r\n case \"uint\":\r\n return PLYType.UINT;\r\n case \"double\":\r\n return PLYType.DOUBLE;\r\n case \"uchar\":\r\n return PLYType.UCHAR;\r\n }\r\n return PLYType.UNDEFINED;\r\n }\r\n\r\n private static _ValueNameToEnum(name: string): PLYValue {\r\n switch (name) {\r\n case \"min_x\":\r\n return PLYValue.MIN_X;\r\n case \"min_y\":\r\n return PLYValue.MIN_Y;\r\n case \"min_z\":\r\n return PLYValue.MIN_Z;\r\n case \"max_x\":\r\n return PLYValue.MAX_X;\r\n case \"max_y\":\r\n return PLYValue.MAX_Y;\r\n case \"max_z\":\r\n return PLYValue.MAX_Z;\r\n case \"min_scale_x\":\r\n return PLYValue.MIN_SCALE_X;\r\n case \"min_scale_y\":\r\n return PLYValue.MIN_SCALE_Y;\r\n case \"min_scale_z\":\r\n return PLYValue.MIN_SCALE_Z;\r\n case \"max_scale_x\":\r\n return PLYValue.MAX_SCALE_X;\r\n case \"max_scale_y\":\r\n return PLYValue.MAX_SCALE_Y;\r\n case \"max_scale_z\":\r\n return PLYValue.MAX_SCALE_Z;\r\n case \"packed_position\":\r\n return PLYValue.PACKED_POSITION;\r\n case \"packed_rotation\":\r\n return PLYValue.PACKED_ROTATION;\r\n case \"packed_scale\":\r\n return PLYValue.PACKED_SCALE;\r\n case \"packed_color\":\r\n return PLYValue.PACKED_COLOR;\r\n case \"x\":\r\n return PLYValue.X;\r\n case \"y\":\r\n return PLYValue.Y;\r\n case \"z\":\r\n return PLYValue.Z;\r\n case \"scale_0\":\r\n return PLYValue.SCALE_0;\r\n case \"scale_1\":\r\n return PLYValue.SCALE_1;\r\n case \"scale_2\":\r\n return PLYValue.SCALE_2;\r\n case \"diffuse_red\":\r\n case \"red\":\r\n return PLYValue.DIFFUSE_RED;\r\n case \"diffuse_green\":\r\n case \"green\":\r\n return PLYValue.DIFFUSE_GREEN;\r\n case \"diffuse_blue\":\r\n case \"blue\":\r\n return PLYValue.DIFFUSE_BLUE;\r\n case \"f_dc_0\":\r\n return PLYValue.F_DC_0;\r\n case \"f_dc_1\":\r\n return PLYValue.F_DC_1;\r\n case \"f_dc_2\":\r\n return PLYValue.F_DC_2;\r\n case \"f_dc_3\":\r\n return PLYValue.F_DC_3;\r\n case \"opacity\":\r\n return PLYValue.OPACITY;\r\n case \"rot_0\":\r\n return PLYValue.ROT_0;\r\n case \"rot_1\":\r\n return PLYValue.ROT_1;\r\n case \"rot_2\":\r\n return PLYValue.ROT_2;\r\n case \"rot_3\":\r\n return PLYValue.ROT_3;\r\n case \"min_r\":\r\n return PLYValue.MIN_COLOR_R;\r\n case \"min_g\":\r\n return PLYValue.MIN_COLOR_G;\r\n case \"min_b\":\r\n return PLYValue.MIN_COLOR_B;\r\n case \"max_r\":\r\n return PLYValue.MAX_COLOR_R;\r\n case \"max_g\":\r\n return PLYValue.MAX_COLOR_G;\r\n case \"max_b\":\r\n return PLYValue.MAX_COLOR_B;\r\n case \"f_rest_0\":\r\n return PLYValue.SH_0;\r\n case \"f_rest_1\":\r\n return PLYValue.SH_1;\r\n case \"f_rest_2\":\r\n return PLYValue.SH_2;\r\n case \"f_rest_3\":\r\n return PLYValue.SH_3;\r\n case \"f_rest_4\":\r\n return PLYValue.SH_4;\r\n case \"f_rest_5\":\r\n return PLYValue.SH_5;\r\n case \"f_rest_6\":\r\n return PLYValue.SH_6;\r\n case \"f_rest_7\":\r\n return PLYValue.SH_7;\r\n case \"f_rest_8\":\r\n return PLYValue.SH_8;\r\n case \"f_rest_9\":\r\n return PLYValue.SH_9;\r\n case \"f_rest_10\":\r\n return PLYValue.SH_10;\r\n case \"f_rest_11\":\r\n return PLYValue.SH_11;\r\n case \"f_rest_12\":\r\n return PLYValue.SH_12;\r\n case \"f_rest_13\":\r\n return PLYValue.SH_13;\r\n case \"f_rest_14\":\r\n return PLYValue.SH_14;\r\n case \"f_rest_15\":\r\n return PLYValue.SH_15;\r\n case \"f_rest_16\":\r\n return PLYValue.SH_16;\r\n case \"f_rest_17\":\r\n return PLYValue.SH_17;\r\n case \"f_rest_18\":\r\n return PLYValue.SH_18;\r\n case \"f_rest_19\":\r\n return PLYValue.SH_19;\r\n case \"f_rest_20\":\r\n return PLYValue.SH_20;\r\n case \"f_rest_21\":\r\n return PLYValue.SH_21;\r\n case \"f_rest_22\":\r\n return PLYValue.SH_22;\r\n case \"f_rest_23\":\r\n return PLYValue.SH_23;\r\n case \"f_rest_24\":\r\n return PLYValue.SH_24;\r\n case \"f_rest_25\":\r\n return PLYValue.SH_25;\r\n case \"f_rest_26\":\r\n return PLYValue.SH_26;\r\n case \"f_rest_27\":\r\n return PLYValue.SH_27;\r\n case \"f_rest_28\":\r\n return PLYValue.SH_28;\r\n case \"f_rest_29\":\r\n return PLYValue.SH_29;\r\n case \"f_rest_30\":\r\n return PLYValue.SH_30;\r\n case \"f_rest_31\":\r\n return PLYValue.SH_31;\r\n case \"f_rest_32\":\r\n return PLYValue.SH_32;\r\n case \"f_rest_33\":\r\n return PLYValue.SH_33;\r\n case \"f_rest_34\":\r\n return PLYValue.SH_34;\r\n case \"f_rest_35\":\r\n return PLYValue.SH_35;\r\n case \"f_rest_36\":\r\n return PLYValue.SH_36;\r\n case \"f_rest_37\":\r\n return PLYValue.SH_37;\r\n case \"f_rest_38\":\r\n return PLYValue.SH_38;\r\n case \"f_rest_39\":\r\n return PLYValue.SH_39;\r\n case \"f_rest_40\":\r\n return PLYValue.SH_40;\r\n case \"f_rest_41\":\r\n return PLYValue.SH_41;\r\n case \"f_rest_42\":\r\n return PLYValue.SH_42;\r\n case \"f_rest_43\":\r\n return PLYValue.SH_43;\r\n case \"f_rest_44\":\r\n return PLYValue.SH_44;\r\n }\r\n\r\n return PLYValue.UNDEFINED;\r\n }\r\n /**\r\n * Parse a PLY file header and returns metas infos on splats and chunks\r\n * @param data the loaded buffer\r\n * @returns a PLYHeader\r\n */\r\n static ParseHeader(data: ArrayBuffer): PLYHeader | null {\r\n const ubuf = new Uint8Array(data);\r\n const header = new TextDecoder().decode(ubuf.slice(0, 1024 * 10));\r\n const headerEnd = \"end_header\\n\";\r\n const headerEndIndex = header.indexOf(headerEnd);\r\n if (headerEndIndex < 0 || !header) {\r\n // standard splat\r\n return null;\r\n }\r\n const vertexCount = parseInt(/element vertex (\\d+)\\n/.exec(header)![1]);\r\n const chunkElement = /element chunk (\\d+)\\n/.exec(header);\r\n let chunkCount = 0;\r\n if (chunkElement) {\r\n chunkCount = parseInt(chunkElement[1]);\r\n }\r\n let rowVertexOffset = 0;\r\n let rowChunkOffset = 0;\r\n const offsets: Record<string, number> = {\r\n double: 8,\r\n int: 4,\r\n uint: 4,\r\n float: 4,\r\n short: 2,\r\n ushort: 2,\r\n uchar: 1,\r\n list: 0,\r\n };\r\n\r\n const enum ElementMode {\r\n Vertex = 0,\r\n Chunk = 1,\r\n SH = 2,\r\n Unused = 3,\r\n }\r\n let chunkMode = ElementMode.Chunk;\r\n const vertexProperties: PlyProperty[] = [];\r\n const chunkProperties: PlyProperty[] = [];\r\n const filtered = header.slice(0, headerEndIndex).split(\"\\n\");\r\n let shDegree = 0;\r\n for (const prop of filtered) {\r\n if (prop.startsWith(\"property \")) {\r\n const [, typeName, name] = prop.split(\" \");\r\n\r\n const value = GaussianSplattingMesh._ValueNameToEnum(name);\r\n if (value != PLYValue.UNDEFINED) {\r\n // SH degree 1,2 or 3 for 9, 24 or 45 values\r\n if (value >= PLYValue.SH_44) {\r\n shDegree = 3;\r\n } else if (value >= PLYValue.SH_24) {\r\n shDegree = Math.max(shDegree, 2);\r\n } else if (value >= PLYValue.SH_8) {\r\n shDegree = Math.max(shDegree, 1);\r\n }\r\n }\r\n const type = GaussianSplattingMesh._TypeNameToEnum(typeName);\r\n if (chunkMode == ElementMode.Chunk) {\r\n chunkProperties.push({ value, type, offset: rowChunkOffset });\r\n rowChunkOffset += offsets[typeName];\r\n } else if (chunkMode == ElementMode.Vertex) {\r\n vertexProperties.push({ value, type, offset: rowVertexOffset });\r\n rowVertexOffset += offsets[typeName];\r\n } else if (chunkMode == ElementMode.SH) {\r\n // SH doesn't count for vertex row size but its properties are used to retrieve SH\r\n vertexProperties.push({ value, type, offset: rowVertexOffset });\r\n }\r\n\r\n if (!offsets[typeName]) {\r\n Logger.Warn(`Unsupported property type: ${typeName}.`);\r\n }\r\n } else if (prop.startsWith(\"element \")) {\r\n const [, type] = prop.split(\" \");\r\n if (type == \"chunk\") {\r\n chunkMode = ElementMode.Chunk;\r\n } else if (type == \"vertex\") {\r\n chunkMode = ElementMode.Vertex;\r\n } else if (type == \"sh\") {\r\n chunkMode = ElementMode.SH;\r\n } else {\r\n chunkMode = ElementMode.Unused;\r\n }\r\n }\r\n }\r\n\r\n const dataView = new DataView(data, headerEndIndex + headerEnd.length);\r\n const buffer = new ArrayBuffer(GaussianSplattingMesh._RowOutputLength * vertexCount);\r\n\r\n let shBuffer = null;\r\n let shCoefficientCount = 0;\r\n if (shDegree) {\r\n const shVectorCount = (shDegree + 1) * (shDegree + 1) - 1;\r\n shCoefficientCount = shVectorCount * 3;\r\n shBuffer = new ArrayBuffer(shCoefficientCount * vertexCount);\r\n }\r\n\r\n return {\r\n vertexCount: vertexCount,\r\n chunkCount: chunkCount,\r\n rowVertexLength: rowVertexOffset,\r\n rowChunkLength: rowChunkOffset,\r\n vertexProperties: vertexProperties,\r\n chunkProperties: chunkProperties,\r\n dataView: dataView,\r\n buffer: buffer,\r\n shDegree: shDegree,\r\n shCoefficientCount: shCoefficientCount,\r\n shBuffer: shBuffer,\r\n };\r\n }\r\n private static _GetCompressedChunks(header: PLYHeader, offset: { value: number }): Array<ICompressedPLYChunk> | null {\r\n if (!header.chunkCount) {\r\n return null;\r\n }\r\n const dataView = header.dataView;\r\n const compressedChunks = new Array<ICompressedPLYChunk>(header.chunkCount);\r\n for (let i = 0; i < header.chunkCount; i++) {\r\n const currentChunk = {\r\n min: new Vector3(),\r\n max: new Vector3(),\r\n minScale: new Vector3(),\r\n maxScale: new Vector3(),\r\n minColor: new Vector3(0, 0, 0),\r\n maxColor: new Vector3(1, 1, 1),\r\n };\r\n compressedChunks[i] = currentChunk;\r\n for (let propertyIndex = 0; propertyIndex < header.chunkProperties.length; propertyIndex++) {\r\n const property = header.chunkProperties[propertyIndex];\r\n let value;\r\n switch (property.type) {\r\n case PLYType.FLOAT:\r\n value = dataView.getFloat32(property.offset + offset.value, true);\r\n break;\r\n default:\r\n continue;\r\n }\r\n\r\n switch (property.value) {\r\n case PLYValue.MIN_X:\r\n currentChunk.min.x = value;\r\n break;\r\n case PLYValue.MIN_Y:\r\n currentChunk.min.y = value;\r\n break;\r\n case PLYValue.MIN_Z:\r\n currentChunk.min.z = value;\r\n break;\r\n case PLYValue.MAX_X:\r\n currentChunk.max.x = value;\r\n break;\r\n case PLYValue.MAX_Y:\r\n currentChunk.max.y = value;\r\n break;\r\n case PLYValue.MAX_Z:\r\n currentChunk.max.z = value;\r\n break;\r\n case PLYValue.MIN_SCALE_X:\r\n currentChunk.minScale.x = value;\r\n break;\r\n case PLYValue.MIN_SCALE_Y:\r\n currentChunk.minScale.y = value;\r\n break;\r\n case PLYValue.MIN_SCALE_Z:\r\n currentChunk.minScale.z = value;\r\n break;\r\n case PLYValue.MAX_SCALE_X:\r\n currentChunk.maxScale.x = value;\r\n break;\r\n case PLYValue.MAX_SCALE_Y:\r\n currentChunk.maxScale.y = value;\r\n break;\r\n case PLYValue.MAX_SCALE_Z:\r\n currentChunk.maxScale.z = value;\r\n break;\r\n case PLYValue.MIN_COLOR_R:\r\n currentChunk.minColor.x = value;\r\n break;\r\n case PLYValue.MIN_COLOR_G:\r\n currentChunk.minColor.y = value;\r\n break;\r\n case PLYValue.MIN_COLOR_B:\r\n currentChunk.minColor.z = value;\r\n break;\r\n case PLYValue.MAX_COLOR_R:\r\n currentChunk.maxColor.x = value;\r\n break;\r\n case PLYValue.MAX_COLOR_G:\r\n currentChunk.maxColor.y = value;\r\n break;\r\n case PLYValue.MAX_COLOR_B:\r\n currentChunk.maxColor.z = value;\r\n break;\r\n }\r\n }\r\n offset.value += header.rowChunkLength;\r\n }\r\n return compressedChunks;\r\n }\r\n\r\n private static _GetSplat(header: PLYHeader, index: number, compressedChunks: Array<ICompressedPLYChunk> | null, offset: { value: number }): void {\r\n const q = TmpVectors.Quaternion[0];\r\n const temp3 = TmpVectors.Vector3[0];\r\n\r\n const rowOutputLength = GaussianSplattingMesh._RowOutputLength;\r\n const buffer = header.buffer;\r\n const dataView = header.dataView;\r\n const position = new Float32Array(buffer, index * rowOutputLength, 3);\r\n const scale = new Float32Array(buffer, index * rowOutputLength + 12, 3);\r\n const rgba = new Uint8ClampedArray(buffer, index * rowOutputLength + 24, 4);\r\n const rot = new Uint8ClampedArray(buffer, index * rowOutputLength + 28, 4);\r\n let sh = null;\r\n if (header.shBuffer) {\r\n sh = new Uint8ClampedArray(header.shBuffer, index * header.shCoefficientCount, header.shCoefficientCount);\r\n }\r\n const chunkIndex = index >> 8;\r\n let r0: number = 255;\r\n let r1: number = 0;\r\n let r2: number = 0;\r\n let r3: number = 0;\r\n\r\n const plySH = [];\r\n\r\n for (let propertyIndex = 0; propertyIndex < header.vertexProperties.length; propertyIndex++) {\r\n const property = header.vertexProperties[propertyIndex];\r\n let value;\r\n switch (property.type) {\r\n case PLYType.FLOAT:\r\n value = dataView.getFloat32(offset.value + property.offset, true);\r\n break;\r\n case PLYType.INT:\r\n value = dataView.getInt32(offset.value + property.offset, true);\r\n break;\r\n case PLYType.UINT:\r\n value = dataView.getUint32(offset.value + property.offset, true);\r\n break;\r\n case PLYType.DOUBLE:\r\n value = dataView.getFloat64(offset.value + property.offset, true);\r\n break;\r\n case PLYType.UCHAR:\r\n value = dataView.getUint8(offset.value + property.offset);\r\n break;\r\n default:\r\n continue;\r\n }\r\n\r\n switch (property.value) {\r\n case PLYValue.PACKED_POSITION:\r\n {\r\n const compressedChunk = compressedChunks![chunkIndex];\r\n Unpack111011(value, temp3);\r\n position[0] = Scalar.Lerp(compressedChunk.min.x, compressedChunk.max.x, temp3.x);\r\n position[1] = Scalar.Lerp(compressedChunk.min.y, compressedChunk.max.y, temp3.y);\r\n position[2] = Scalar.Lerp(compressedChunk.min.z, compressedChunk.max.z, temp3.z);\r\n }\r\n break;\r\n case PLYValue.PACKED_ROTATION:\r\n {\r\n UnpackRot(value, q);\r\n\r\n r0 = q.x;\r\n r1 = q.y;\r\n r2 = q.z;\r\n r3 = q.w;\r\n }\r\n break;\r\n case PLYValue.PACKED_SCALE:\r\n {\r\n const compressedChunk = compressedChunks![chunkIndex];\r\n Unpack111011(value, temp3);\r\n scale[0] = Math.exp(Scalar.Lerp(compressedChunk.minScale.x, compressedChunk.maxScale.x, temp3.x));\r\n scale[1] = Math.exp(Scalar.Lerp(compressedChunk.minScale.y, compressedChunk.maxScale.y, temp3.y));\r\n scale[2] = Math.exp(Scalar.Lerp(compressedChunk.minScale.z, compressedChunk.maxScale.z, temp3.z));\r\n }\r\n break;\r\n case PLYValue.PACKED_COLOR:\r\n {\r\n const compressedChunk = compressedChunks![chunkIndex];\r\n Unpack8888(value, rgba);\r\n rgba[0] = Scalar.Lerp(compressedChunk.minColor.x, compressedChunk.maxColor.x, rgba[0] / 255) * 255;\r\n rgba[1] = Scalar.Lerp(compressedChunk.minColor.y, compressedChunk.maxColor.y, rgba[1] / 255) * 255;\r\n rgba[2] = Scalar.Lerp(compressedChunk.minColor.z, compressedChunk.maxColor.z, rgba[2] / 255) * 255;\r\n }\r\n break;\r\n case PLYValue.X:\r\n position[0] = value;\r\n break;\r\n case PLYValue.Y:\r\n position[1] = value;\r\n break;\r\n case PLYValue.Z:\r\n position[2] = value;\r\n break;\r\n case PLYValue.SCALE_0:\r\n scale[0] = Math.exp(value);\r\n break;\r\n case PLYValue.SCALE_1:\r\n scale[1] = Math.exp(value);\r\n break;\r\n case PLYValue.SCALE_2:\r\n scale[2] = Math.exp(value);\r\n break;\r\n case PLYValue.DIFFUSE_RED:\r\n rgba[0] = value;\r\n break;\r\n case PLYValue.DIFFUSE_GREEN:\r\n rgba[1] = value;\r\n break;\r\n case PLYValue.DIFFUSE_BLUE:\r\n rgba[2] = value;\r\n break;\r\n case PLYValue.F_DC_0:\r\n rgba[0] = (0.5 + GaussianSplattingMesh._SH_C0 * value) * 255;\r\n break;\r\n case PLYValue.F_DC_1:\r\n rgba[1] = (0.5 + GaussianSplattingMesh._SH_C0 * value) * 255;\r\n break;\r\n case PLYValue.F_DC_2:\r\n rgba[2] = (0.5 + GaussianSplattingMesh._SH_C0 * value) * 255;\r\n break;\r\n case PLYValue.F_DC_3:\r\n rgba[3] = (0.5 + GaussianSplattingMesh._SH_C0 * value) * 255;\r\n break;\r\n case PLYValue.OPACITY:\r\n rgba[3] = (1 / (1 + Math.exp(-value))) * 255;\r\n break;\r\n case PLYValue.ROT_0:\r\n r0 = value;\r\n break;\r\n case PLYValue.ROT_1:\r\n r1 = value;\r\n break;\r\n case PLYValue.ROT_2:\r\n r2 = value;\r\n break;\r\n case PLYValue.ROT_3:\r\n r3 = value;\r\n break;\r\n }\r\n if (sh && property.value >= PLYValue.SH_0 && property.value <= PLYValue.SH_44) {\r\n const shIndex = property.value - PLYValue.SH_0;\r\n if (property.type == PLYType.UCHAR && header.chunkCount) {\r\n // compressed ply. dataView points to beginning of vertex\r\n // could be improved with a direct copy instead of a per SH index computation + copy\r\n const compressedValue = dataView.getUint8(\r\n header.rowChunkLength * header.chunkCount + header.vertexCount * header.rowVertexLength + index * header.shCoefficientCount + shIndex\r\n );\r\n // compressed .ply SH import : https://github.com/playcanvas/engine/blob/fda3f0368b45d7381f0b5a1722bd2056128eaebe/src/scene/gsplat/gsplat-compressed-data.js#L88C81-L88C98\r\n plySH[shIndex] = (compressedValue * (8 / 255) - 4) * 127.5 + 127.5;\r\n } else {\r\n const clampedValue = Scalar.Clamp(value * 127.5 + 127.5, 0, 255);\r\n plySH[shIndex] = clampedValue;\r\n }\r\n }\r\n }\r\n\r\n if (sh) {\r\n const shDim = header.shDegree == 1 ? 3 : header.shDegree == 2 ? 8 : 15;\r\n for (let j = 0; j < shDim; j++) {\r\n sh[j * 3 + 0] = plySH[j];\r\n sh[j * 3 + 1] = plySH[j + shDim];\r\n sh[j * 3 + 2] = plySH[j + shDim * 2];\r\n }\r\n }\r\n\r\n q.set(r1, r2, r3, r0);\r\n q.normalize();\r\n rot[0] = q.w * 127.5 + 127.5;\r\n rot[1] = q.x * 127.5 + 127.5;\r\n rot[2] = q.y * 127.5 + 127.5;\r\n rot[3] = q.z * 127.5 + 127.5;\r\n offset.value += header.rowVertexLength;\r\n }\r\n\r\n /**\r\n * Converts a .ply data with SH coefficients splat\r\n * if data array buffer is not ply, returns the original buffer\r\n * @param data the .ply data to load\r\n * @param useCoroutine use coroutine and yield\r\n * @returns the loaded splat buffer and optional array of sh coefficients\r\n */\r\n public static *ConvertPLYWithSHToSplat(data: ArrayBuffer, useCoroutine = false) {\r\n const header = GaussianSplattingMesh.ParseHeader(data);\r\n if (!header) {\r\n return { buffer: data };\r\n }\r\n\r\n const offset = { value: 0 };\r\n const compressedChunks = GaussianSplattingMesh._GetCompressedChunks(header, offset);\r\n\r\n for (let i = 0; i < header.vertexCount; i++) {\r\n GaussianSplattingMesh._GetSplat(header, i, compressedChunks, offset);\r\n if (i % GaussianSplattingMesh._PlyConversionBatchSize === 0 && useCoroutine) {\r\n yield;\r\n }\r\n }\r\n\r\n let sh = null;\r\n // make SH texture buffers\r\n if (header.shDegree && header.shBuffer) {\r\n const textureCount = Math.ceil(header.shCoefficientCount / 16); // 4 components can be stored per texture, 4 sh per component\r\n let shIndexRead = 0;\r\n const ubuf = new Uint8Array(header.shBuffer);\r\n\r\n // sh is an array of uint8array that will be used to create sh textures\r\n sh = [];\r\n\r\n const splatCount = header.vertexCount;\r\n const engine = EngineStore.LastCreatedEngine;\r\n if (engine) {\r\n const width = engine.getCaps().maxTextureSize;\r\n const height = Math.ceil(splatCount / width);\r\n // create array for the number of textures needed.\r\n for (let textureIndex = 0; textureIndex < textureCount; textureIndex++) {\r\n const texture = new Uint8Array(height * width * 4 * 4); // 4 components per texture, 4 sh per component\r\n sh.push(texture);\r\n }\r\n\r\n for (let i = 0; i < splatCount; i++) {\r\n for (let shIndexWrite = 0; shIndexWrite < header.shCoefficientCount; shIndexWrite++) {\r\n const shValue = ubuf[shIndexRead++];\r\n\r\n const textureIndex = Math.floor(shIndexWrite / 16);\r\n const shArray = sh[textureIndex];\r\n\r\n const byteIndexInTexture = shIndexWrite % 16; // [0..15]\r\n const offsetPerSplat = i * 16; // 16 sh values per texture per splat.\r\n shArray[byteIndexInTexture + offsetPerSplat] = shValue;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return { buffer: header.buffer, sh: sh };\r\n }\r\n\r\n /**\r\n * Converts a .ply data array buffer to splat\r\n * if data array buffer is not ply, returns the original buffer\r\n * @param data the .ply data to load\r\n * @param useCoroutine use coroutine and yield\r\n * @returns the loaded splat buffer without SH coefficient, whether ply contains or not SH.\r\n */\r\n public static *ConvertPLYToSplat(data: ArrayBuffer, useCoroutine = false) {\r\n const header = GaussianSplattingMesh.ParseHeader(data);\r\n if (!header) {\r\n return data;\r\n }\r\n\r\n const offset = { value: 0 };\r\n const compressedChunks = GaussianSplattingMesh._GetCompressedChunks(header, offset);\r\n\r\n for (let i = 0; i < header.vertexCount; i++) {\r\n GaussianSplattingMesh._GetSplat(header, i, compressedChunks, offset);\r\n if (i % GaussianSplattingMesh._PlyConversionBatchSize === 0 && useCoroutine) {\r\n yield;\r\n }\r\n }\r\n\r\n return header.buffer;\r\n }\r\n\r\n /**\r\n * Converts a .ply data array buffer to splat\r\n * if data array buffer is not ply, returns the original buffer\r\n * @param data the .ply data to load\r\n * @returns the loaded splat buffer\r\n */\r\n public static async ConvertPLYToSplatAsync(data: ArrayBuffer) {\r\n return await runCoroutineAsync(GaussianSplattingMesh.ConvertPLYToSplat(data, true), createYieldingScheduler());\r\n }\r\n\r\n /**\r\n * Converts a .ply with SH data array buffer to splat\r\n * if data array buffer is not ply, returns the original buffer\r\n * @param data the .ply data to load\r\n * @returns the loaded splat buffer with SH\r\n */\r\n public static async ConvertPLYWithSHToSplatAsync(data: ArrayBuffer) {\r\n return await runCoroutineAsync(GaussianSplattingMesh.ConvertPLYWithSHToSplat(data, true), createYieldingScheduler());\r\n }\r\n /**\r\n * Loads a .splat Gaussian Splatting array buffer asynchronously\r\n * @param data arraybuffer containing splat file\r\n * @returns a promise that resolves when the operation is complete\r\n */\r\n\r\n public async loadDataAsync(data: ArrayBuffer): Promise<void> {\r\n return await this.updateDataAsync(data);\r\n }\r\n\r\n /**\r\n * Loads a Gaussian or Splatting file asynchronously\r\n * @param url path to the splat file to load\r\n * @param scene optional scene it belongs to\r\n * @returns a promise that resolves when the operation is complete\r\n * @deprecated Please use SceneLoader.ImportMeshAsync instead\r\n */\r\n public async loadFileAsync(url: string, scene?: Scene): Promise<void> {\r\n await ImportMeshAsync(url, (scene || EngineStore.LastCreatedScene)!, { pluginOptions: { splat: { gaussianSplattingMesh: this } } });\r\n }\r\n\r\n /**\r\n * Releases resources associated with this mesh.\r\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\r\n */\r\n public override dispose(doNotRecurse?: boolean): void {\r\n this._covariancesATexture?.dispose();\r\n this._covariancesBTexture?.dispose();\r\n this._centersTexture?.dispose();\r\n this._colorsTexture?.dispose();\r\n if (this._shTextures) {\r\n for (const shTexture of this._shTextures) {\r\n shTexture.dispose();\r\n }\r\n }\r\n if (this._partIndicesTexture) {\r\n this._partIndicesTexture.dispose();\r\n }\r\n\r\n this._covariancesATexture = null;\r\n this._covariancesBTexture = null;\r\n this._centersTexture = null;\r\n this._colorsTexture = null;\r\n this._shTextures = null;\r\n this._partIndicesTexture = null;\r\n this._partMatrices = [];\r\n\r\n this._worker?.terminate();\r\n this._worker = null;\r\n\r\n // delete meshes created for each camera\r\n this._cameraViewInfos.forEach((cameraViewInfo) => {\r\n cameraViewInfo.mesh.dispose();\r\n });\r\n\r\n // dispose all proxy meshes\r\n this._partProxies.forEach((proxy) => {\r\n proxy.dispose();\r\n });\r\n this._partProxies.clear();\r\n\r\n super.dispose(doNotRecurse, true);\r\n }\r\n\r\n private _copyTextures(source: GaussianSplattingMesh): void {\r\n this._covariancesATexture = source.covariancesATexture?.clone()!;\r\n this._covariancesBTexture = source.covariancesBTexture?.clone()!;\r\n this._centersTexture = source.centersTexture?.clone()!;\r\n this._colorsTexture = source.colorsTexture?.clone()!;\r\n this._partIndicesTexture = source._partIndicesTexture?.clone()!;\r\n if (source._shTextures) {\r\n this._shTextures = [];\r\n for (const shTexture of source._shTextures) {\r\n this._shTextures?.push(shTexture.clone()!);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns a new Mesh object generated from the current mesh properties.\r\n * @param name is a string, the name given to the new mesh\r\n * @returns a new Gaussian Splatting Mesh\r\n */\r\n public override clone(name: string = \"\"): GaussianSplattingMesh {\r\n const newGS = new GaussianSplattingMesh(name, undefined, this.getScene());\r\n newGS._copySource(this);\r\n newGS.makeGeometryUnique();\r\n newGS._vertexCount = this._vertexCount;\r\n newGS._copyTextures(this);\r\n newGS._modelViewProjectionMatrix = Matrix.Identity();\r\n newGS._splatPositions = this._splatPositions;\r\n newGS._readyToDisplay = false;\r\n newGS._disableDepthSort = this._disableDepthSort;\r\n newGS._partMatrices = this._partMatrices.map((m) => m.clone());\r\n newGS._instanciateWorker();\r\n\r\n const binfo = this.getBoundingInfo();\r\n newGS.getBoundingInfo().reConstruct(binfo.minimum, binfo.maximum, this.getWorldMatrix());\r\n\r\n newGS.forcedInstanceCount = this.forcedInstanceCount;\r\n newGS.setEnabled(true);\r\n return newGS;\r\n }\r\n\r\n private static _CreateWorker = function (self: Worker) {\r\n let positions: Float32Array;\r\n let depthMix: BigInt64Array;\r\n let indices: Uint32Array;\r\n let floatMix: Float32Array;\r\n let partIndices: Uint8Array;\r\n let partMatrices: Float32Array[];\r\n\r\n self.onmessage = (e: any) => {\r\n // updated on init\r\n if (e.data.positions) {\r\n positions = e.data.positions;\r\n }\r\n // update on rig node changed\r\n else if (e.data.partMatrices) {\r\n partMatrices = e.data.partMatrices;\r\n }\r\n // update on rig node indices changed\r\n else if (e.data.partIndices !== undefined) {\r\n partIndices = e.data.partIndices;\r\n }\r\n // update on view changed\r\n else {\r\n const cameraId = e.data.cameraId;\r\n const globalWorldMatrix = e.data.worldMatrix;\r\n const cameraForward = e.data.cameraForward;\r\n const cameraPosition = e.data.cameraPosition;\r\n\r\n const vertexCountPadded = (positions.length / 4 + 15) & ~0xf;\r\n if (!positions || !cameraForward) {\r\n // Sanity check, it shouldn't happen!\r\n throw new Error(\"positions or camera info is not defined!\");\r\n }\r\n\r\n depthMix = e.data.depthMix;\r\n indices = new Uint32Array(depthMix.buffer);\r\n floatMix = new Float32Array(depthMix.buffer);\r\n\r\n // Sort\r\n for (let j = 0; j < vertexCountPadded; j++) {\r\n indices[2 * j] = j;\r\n }\r\n\r\n // depth = dot(cameraForward, worldPos - cameraPos)\r\n const camDot = cameraForward[0] * cameraPosition[0] + cameraForward[1] * cameraPosition[1] + cameraForward[2] * cameraPosition[2];\r\n\r\n const computeDepthCoeffs = (m: Float32Array): number[] => {\r\n return [\r\n cameraForward[0] * m[0] + cameraForward[1] * m[1] + cameraForward[2] * m[2],\r\n cameraForward[0] * m[4] + cameraForward[1] * m[5] + cameraForward[2] * m[6],\r\n cameraForward[0] * m[8] + cameraForward[1] * m[9] + cameraForward[2] * m[10],\r\n cameraForward[0] * m[12] + cameraForward[1] * m[13] + cameraForward[2] * m[14] - camDot,\r\n ];\r\n };\r\n\r\n if (partMatrices && partIndices) {\r\n // Precompute depth coefficients for each rig node\r\n const depthCoeffs = partMatrices.map((m) => computeDepthCoeffs(m));\r\n\r\n // NB: For performance reasons, we assume that part indices are valid\r\n const length = partIndices.length;\r\n for (let j = 0; j < vertexCountPadded; j++) {\r\n // NB: We need this 'min' because vertex array is padded, not partIndices\r\n const partIndex = partIndices[Math.min(j, length - 1)];\r\n const coeff = depthCoeffs[partIndex];\r\n floatMix[2 * j + 1] = coeff[0] * positions[4 * j + 0] + coeff[1] * positions[4 * j + 1] + coeff[2] * positions[4 * j + 2] + coeff[3];\r\n // instead of using minus to sort back to front, we use bitwise not operator to invert the order of indices\r\n // might not be faster but a minus sign implies a reference value that may not be enough and will decrease floatting precision\r\n indices[2 * j + 1] = ~indices[2 * j + 1];\r\n }\r\n } else {\r\n // Compute depth coefficients from global world matrix\r\n const [a, b, c, d] = computeDepthCoeffs(globalWorldMatrix);\r\n for (let j = 0; j < vertexCountPadded; j++) {\r\n floatMix[2 * j + 1] = a * positions[4 * j + 0] + b * positions[4 * j + 1] + c * positions[4 * j + 2] + d;\r\n indices[2 * j + 1] = ~indices[2 * j + 1];\r\n }\r\n }\r\n\r\n depthMix.sort();\r\n\r\n self.postMessage({ depthMix, cameraId }, [depthMix.buffer]);\r\n }\r\n };\r\n };\r\n\r\n private _makeEmptySplat(index: number, covA: Uint16Array, covB: Uint16Array, colorArray: Uint8Array): void {\r\n const covBSItemSize = this._useRGBACovariants ? 4 : 2;\r\n this._splatPositions![4 * index + 0] = 0;\r\n this._splatPositions![4 * index + 1] = 0;\r\n this._splatPositions![4 * index + 2] = 0;\r\n\r\n covA[index * 4 + 0] = ToHalfFloat(0);\r\n covA[index * 4 + 1] = ToHalfFloat(0);\r\n covA[index * 4 + 2] = ToHalfFloat(0);\r\n covA[index * 4 + 3] = ToHalfFloat(0);\r\n covB[index * covBSItemSize + 0] = ToHalfFloat(0);\r\n covB[index * covBSItemSize + 1] = ToHalfFloat(0);\r\n colorArray[index * 4 + 3] = 0;\r\n }\r\n\r\n private _makeSplat(\r\n index: number,\r\n fBuffer: Float32Array,\r\n uBuffer: Uint8Array,\r\n covA: Uint16Array,\r\n covB: Uint16Array,\r\n colorArray: Uint8Array,\r\n minimum: Vector3,\r\n maximum: Vector3,\r\n options: IUpdateOptions\r\n ): void {\r\n const matrixRotation = TmpVectors.Matrix[0];\r\n const matrixScale = TmpVectors.Matrix[1];\r\n const quaternion = TmpVectors.Quaternion[0];\r\n const covBSItemSize = this._useRGBACovariants ? 4 : 2;\r\n\r\n const x = fBuffer[8 * index + 0];\r\n const y = fBuffer[8 * index + 1] * (options.flipY ? -1 : 1);\r\n const z = fBuffer[8 * index + 2];\r\n\r\n this._splatPositions![4 * index + 0] = x;\r\n this._splatPositions![4 * index + 1] = y;\r\n this._splatPositions![4 * index + 2] = z;\r\n\r\n minimum.minimizeInPlaceFromFloats(x, y, z);\r\n maximum.maximizeInPlaceFromFloats(x, y, z);\r\n\r\n quaternion.set(\r\n (uBuffer[32 * index + 28 + 1] - 127.5) / 127.5,\r\n (uBuffer[32 * index + 28 + 2] - 127.5) / 127.5,\r\n (uBuffer[32 * index + 28 + 3] - 127.5) / 127.5,\r\n -(uBuffer[32 * index + 28 + 0] - 127.5) / 127.5\r\n );\r\n quaternion.normalize();\r\n quaternion.toRotationMatrix(matrixRotation);\r\n\r\n Matrix.ScalingToRef(fBuffer[8 * index + 3 + 0] * 2, fBuffer[8 * index + 3 + 1] * 2, fBuffer[8 * index + 3 + 2] * 2, matrixScale);\r\n\r\n const m = matrixRotation.multiplyToRef(matrixScale, TmpVectors.Matrix[0]).m;\r\n\r\n const covariances = this._tmpCovariances;\r\n covariances[0] = m[0] * m[0] + m[1] * m[1] + m[2] * m[2];\r\n covariances[1] = m[0] * m[4] + m[1] * m[5] + m[2] * m[6];\r\n covariances[2] = m[0] * m[8] + m[1] * m[9] + m[2] * m[10];\r\n covariances[3] = m[4] * m[4] + m[5] * m[5] + m[6] * m[6];\r\n covariances[4] = m[4] * m[8] + m[5] * m[9] + m[6] * m[10];\r\n covariances[5] = m[8] * m[8] + m[9] * m[9] + m[10] * m[10];\r\n\r\n // normalize covA, covB\r\n let factor = -10000;\r\n for (let covIndex = 0; covIndex < 6; covIndex++) {\r\n factor = Math.max(factor, Math.abs(covariances[covIndex]));\r\n }\r\n\r\n this._splatPositions![4 * index + 3] = factor;\r\n const transform = factor;\r\n\r\n covA[index * 4 + 0] = ToHalfFloat(covariances[0] / transform);\r\n covA[index * 4 + 1] = ToHalfFloat(covariances[1] / transform);\r\n covA[index * 4 + 2] = ToHalfFloat(covariances[2] / transform);\r\n covA[index * 4 + 3] = ToHalfFloat(covariances[3] / transform);\r\n covB[index * covBSItemSize + 0] = ToHalfFloat(covariances[4] / transform);\r\n covB[index * covBSItemSize + 1] = ToHalfFloat(covariances[5] / transform);\r\n\r\n // colors\r\n colorArray[index * 4 + 0] = uBuffer[32 * index + 24 + 0];\r\n colorArray[index * 4 + 1] = uBuffer[32 * index + 24 + 1];\r\n colorArray[index * 4 + 2] = uBuffer[32 * index + 24 + 2];\r\n colorArray[index * 4 + 3] = uBuffer[32 * index + 24 + 3];\r\n }\r\n\r\n // NB: partIndices is assumed to be padded to a round texture size\r\n private _updateTextures(covA: Uint16Array, covB: Uint16Array, colorArray: Uint8Array, sh?: Uint8Array[], partIndices?: Uint8Array): void {\r\n const textureSize = this._getTextureSize(this._vertexCount);\r\n // Update the textures\r\n const createTextureFromData = (data: Float32Array, width: number, height: number, format: number) => {\r\n return new RawTexture(data, width, height, format, this._scene, false, false, Constants.TEXTURE_BILINEAR_SAMPLINGMODE, Constants.TEXTURETYPE_FLOAT);\r\n };\r\n\r\n const createTextureFromDataU8 = (data: Uint8Array, width: number, height: number, format: number) => {\r\n return new RawTexture(data, width, height, format, this._scene, false, false, Constants.TEXTURE_BILINEAR_SAMPLINGMODE, Constants.TEXTURETYPE_UNSIGNED_BYTE);\r\n };\r\n\r\n const createTextureFromDataU32 = (data: Uint32Array, width: number, height: number, format: number) => {\r\n return new RawTexture(data, width, height, format, this._scene, false, false, Constants.TEXTURE_NEAREST_SAMPLINGMODE, Constants.TEXTURETYPE_UNSIGNED_INTEGER);\r\n };\r\n\r\n const createTextureFromDataF16 = (data: Uint16Array, width: number, height: number, format: number) => {\r\n return new RawTexture(data, width, height, format, this._scene, false, false, Constants.TEXTURE_BILINEAR_SAMPLINGMODE, Constants.TEXTURETYPE_HALF_FLOAT);\r\n };\r\n\r\n const firstTime = this._covariancesATexture === null;\r\n const textureSizeChanged = this._textureSize.y != textureSize.y;\r\n\r\n if (!firstTime && !textureSizeChanged) {\r\n this._delayedTextureUpdate = { covA, covB, colors: colorArray, centers: this._splatPositions!, sh, partIndices };\r\n const positions = Float32Array.from(this._splatPositions!);\r\n const vertexCount = this._vertexCount;\r\n if (this._worker) {\r\n this._worker.postMessage({ positions, vertexCount }, [positions.buffer]);\r\n }\r\n\r\n // Handle SH textures in update path - create if they don't exist\r\n if (sh && !this._shTextures) {\r\n this._shTextures = [];\r\n for (const shData of sh) {\r\n const buffer = new Uint32Array(shData.buffer);\r\n const shTexture = createTextureFromDataU32(buffer, textureSize.x, textureSize.y, Constants.TEXTUREFORMAT_RGBA_INTEGER);\r\n shTexture.wrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n shTexture.wrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n this._shTextures!.push(shTexture);\r\n }\r\n }\r\n\r\n // Handle compound data, if any\r\n if (partIndices && !this._partIndicesTexture) {\r\n const buffer = new Uint8Array(partIndices);\r\n this._partIndicesTexture = createTextureFromDataU8(buffer, textureSize.x, textureSize.y, Constants.TEXTUREFORMAT_RED);\r\n this._partIndicesTexture.wrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n this._partIndicesTexture.wrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n }\r\n if (this._worker) {\r\n this._worker.postMessage({ partIndices: partIndices ?? null });\r\n }\r\n\r\n this._postToWorker(true);\r\n } else {\r\n this._textureSize = textureSize;\r\n this._covariancesATexture = createTextureFromDataF16(covA, textureSize.x, textureSize.y, Constants.TEXTUREFORMAT_RGBA);\r\n this._covariancesBTexture = createTextureFromDataF16(\r\n covB,\r\n textureSize.x,\r\n textureSize.y,\r\n this._useRGBACovariants ? Constants.TEXTUREFORMAT_RGBA : Constants.TEXTUREFORMAT_RG\r\n );\r\n this._centersTexture = createTextureFromData(this._splatPositions!, textureSize.x, textureSize.y, Constants.TEXTUREFORMAT_RGBA);\r\n this._colorsTexture = createTextureFromDataU8(colorArray, textureSize.x, textureSize.y, Constants.TEXTUREFORMAT_RGBA);\r\n\r\n if (sh) {\r\n this._shTextures = [];\r\n for (const shData of sh) {\r\n const buffer = new Uint32Array(shData.buffer);\r\n const shTexture = createTextureFromDataU32(buffer, textureSize.x, textureSize.y, Constants.TEXTUREFORMAT_RGBA_INTEGER);\r\n shTexture.wrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n shTexture.wrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n this._shTextures!.push(shTexture);\r\n }\r\n }\r\n\r\n if (partIndices) {\r\n const buffer = new Uint8Array(partIndices);\r\n this._partIndicesTexture = createTextureFromDataU8(buffer, textureSize.x, textureSize.y, Constants.TEXTUREFORMAT_RED);\r\n this._partIndicesTexture.wrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n this._partIndicesTexture.wrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n }\r\n\r\n if (firstTime) {\r\n this._instanciateWorker();\r\n } else {\r\n if (this._worker) {\r\n const positions = Float32Array.from(this._splatPositions!);\r\n const vertexCount = this._vertexCount;\r\n this._worker.postMessage({ positions, vertexCount }, [positions.buffer]);\r\n this._worker.postMessage({ partIndices: partIndices ?? null });\r\n }\r\n this._postToWorker(true);\r\n }\r\n }\r\n }\r\n\r\n private *_updateData(data: ArrayBuffer, isAsync: boolean, sh?: Uint8Array[], partIndices?: Uint8Array, options: IUpdateOptions = { flipY: false }): Coroutine<void> {\r\n // if a covariance texture is present, then it's not a creation but an update\r\n if (!this._covariancesATexture) {\r\n this._readyToDisplay = false;\r\n }\r\n\r\n // Parse the data\r\n const uBuffer = new Uint8Array(data);\r\n const fBuffer = new Float32Array(uBuffer.buffer);\r\n\r\n if (this._keepInRam) {\r\n this._splatsData = data;\r\n this._shData = sh ? sh.map((arr) => new Uint8Array(arr)) : null;\r\n }\r\n\r\n const vertexCount = uBuffer.length / GaussianSplattingMesh._RowOutputLength;\r\n if (vertexCount != this._vertexCount) {\r\n this._updateSplatIndexBuffer(vertexCount);\r\n }\r\n this._vertexCount = vertexCount;\r\n // degree == 1 for 1 texture (3 terms), 2 for 2 textures(8 terms) and 3 for 3 textures (15 terms)\r\n this._shDegree = sh ? sh.length : 0;\r\n\r\n const textureSize = this._getTextureSize(vertexCount);\r\n const textureLength = textureSize.x * textureSize.y;\r\n const lineCountUpdate = GaussianSplattingMesh.ProgressiveUpdateAmount ?? textureSize.y;\r\n const textureLengthPerUpdate = textureSize.x * lineCountUpdate;\r\n\r\n this._splatPositions = new Float32Array(4 * textureLength);\r\n const covA = new Uint16Array(textureLength * 4);\r\n const covB = new Uint16Array((this._useRGBACovariants ? 4 : 2) * textureLength);\r\n const colorArray = new Uint8Array(textureLength * 4);\r\n\r\n // Ensure that partMatrices.length is at least the maximum part index + 1\r\n if (partIndices) {\r\n // We always keep part indices in RAM because they are needed for sorting\r\n this._partIndices = new Uint8Array(textureLength);\r\n this._partIndices.set(partIndices);\r\n\r\n let maxPartIndex = -1;\r\n for (let i = 0; i < partIndices.length; i++) {\r\n maxPartIndex = Math.max(maxPartIndex, partIndices[i]);\r\n }\r\n this._ensureMinimumPartMatricesLength(maxPartIndex + 1);\r\n }\r\n\r\n const minimum = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n const maximum = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n\r\n if (GaussianSplattingMesh.ProgressiveUpdateAmount) {\r\n // create textures with not filled-yet array, then update directly portions of it\r\n this._updateTextures(covA, covB, colorArray, sh, this._partIndices ? this._partIndices : undefined);\r\n this.setEnabled(true);\r\n\r\n const partCount = Math.ceil(textureSize.y / lineCountUpdate);\r\n for (let partIndex = 0; partIndex < partCount; partIndex++) {\r\n const updateLine = partIndex * lineCountUpdate;\r\n const splatIndexBase = updateLine * textureSize.x;\r\n for (let i = 0; i < textureLengthPerUpdate; i++) {\r\n this._makeSplat(splatIndexBase + i, fBuffer, uBuffer, covA, covB, colorArray, minimum, maximum, options);\r\n }\r\n this._updateSubTextures(this._splatPositions, covA, covB, colorArray, updateLine, Math.min(lineCountUpdate, textureSize.y - updateLine));\r\n // Update the binfo\r\n this.getBoundingInfo().reConstruct(minimum, maximum, this.getWorldMatrix());\r\n if (isAsync) {\r\n yield;\r\n }\r\n }\r\n\r\n // sort will be dirty here as just finished filled positions will not be sorted\r\n const positions = Float32Array.from(this._splatPositions);\r\n const vertexCount = this._vertexCount;\r\n if (this._worker) {\r\n this._worker.postMessage({ positions, vertexCount }, [positions.buffer]);\r\n this._worker.postMessage({ partIndices });\r\n }\r\n this._sortIsDirty = true;\r\n } else {\r\n const paddedVertexCount = (vertexCount + 15) & ~0xf;\r\n for (let i = 0; i < vertexCount; i++) {\r\n this._makeSplat(i, fBuffer, uBuffer, covA, covB, colorArray, minimum, maximum, options);\r\n if (isAsync && i % GaussianSplattingMesh._SplatBatchSize === 0) {\r\n yield;\r\n }\r\n }\r\n // pad the rest\r\n for (let i = vertexCount; i < paddedVertexCount; i++) {\r\n this._makeEmptySplat(i, covA, covB, colorArray);\r\n }\r\n // textures\r\n this._updateTextures(covA, covB, colorArray, sh, this._partIndices ? this._partIndices : undefined);\r\n // Update the binfo\r\n this.getBoundingInfo().reConstruct(minimum, maximum, this.getWorldMatrix());\r\n this.setEnabled(true);\r\n this._sortIsDirty = true;\r\n }\r\n this._postToWorker(true);\r\n }\r\n\r\n /**\r\n * Update asynchronously the buffer\r\n * @param data array buffer containing center, color, orientation and scale of splats\r\n * @param sh optional array of uint8 array for SH data\r\n * @param partIndices optional array of uint8 for rig node indices\r\n * @returns a promise\r\n */\r\n public async updateDataAsync(data: ArrayBuffer, sh?: Uint8Array[], partIndices?: Uint8Array): Promise<void> {\r\n return await runCoroutineAsync(this._updateData(data, true, sh, partIndices), createYieldingScheduler());\r\n }\r\n\r\n /**\r\n * @experimental\r\n * Update data from GS (position, orientation, color, scaling)\r\n * @param data array that contain all the datas\r\n * @param sh optional array of uint8 array for SH data\r\n * @param options optional informations on how to treat data (needs to be 3rd for backward compatibility)\r\n * @param partIndices optional array of uint8 for rig node indices\r\n */\r\n public updateData(data: ArrayBuffer, sh?: Uint8Array[], options: IUpdateOptions = { flipY: true }, partIndices?: Uint8Array): void {\r\n runCoroutineSync(this._updateData(data, false, sh, partIndices, options));\r\n }\r\n\r\n /**\r\n * Refreshes the bounding info, taking into account all the thin instances defined\r\n * @returns the current Gaussian Splatting\r\n */\r\n public override refreshBoundingInfo(): Mesh {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n return this;\r\n }\r\n\r\n // in case size is different\r\n private _updateSplatIndexBuffer(vertexCount: number): void {\r\n const paddedVertexCount = (vertexCount + 15) & ~0xf;\r\n if (!this._splatIndex || vertexCount != this._splatIndex.length) {\r\n this._splatIndex = new Float32Array(paddedVertexCount);\r\n for (let i = 0; i < paddedVertexCount; i++) {\r\n this._splatIndex[i] = i;\r\n }\r\n\r\n // update meshes for knowns cameras\r\n this._cameraViewInfos.forEach((cameraViewInfos) => {\r\n cameraViewInfos.mesh.thinInstanceSetBuffer(\"splatIndex\", this._splatIndex, 16, false);\r\n });\r\n }\r\n\r\n // Update depthMix\r\n if ((!this._depthMix || vertexCount != this._depthMix.length) && !IsNative) {\r\n this._depthMix = new BigInt64Array(paddedVertexCount);\r\n }\r\n\r\n this.forcedInstanceCount = Math.max(paddedVertexCount >> 4, 1);\r\n }\r\n\r\n private _updateSubTextures(\r\n centers: Float32Array,\r\n covA: Uint16Array,\r\n covB: Uint16Array,\r\n colors: Uint8Array,\r\n lineStart: number,\r\n lineCount: number,\r\n sh?: Uint8Array[],\r\n partIndices?: Uint8Array\r\n ): void {\r\n const updateTextureFromData = (texture: BaseTexture, data: ArrayBufferView, width: number, lineStart: number, lineCount: number) => {\r\n (this.getEngine() as ThinEngine).updateTextureData(texture.getInternalTexture()!, data, 0, lineStart, width, lineCount, 0, 0, false);\r\n };\r\n\r\n const textureSize = this._getTextureSize(this._vertexCount);\r\n const covBSItemSize = this._useRGBACovariants ? 4 : 2;\r\n const texelStart = lineStart * textureSize.x;\r\n const texelCount = lineCount * textureSize.x;\r\n const covAView = new Uint16Array(covA.buffer, texelStart * 4 * Uint16Array.BYTES_PER_ELEMENT, texelCount * 4);\r\n const covBView = new Uint16Array(covB.buffer, texelStart * covBSItemSize * Uint16Array.BYTES_PER_ELEMENT, texelCount * covBSItemSize);\r\n const colorsView = new Uint8Array(colors.buffer, texelStart * 4, texelCount * 4);\r\n const centersView = new Float32Array(centers.buffer, texelStart * 4 * Float32Array.BYTES_PER_ELEMENT, texelCount * 4);\r\n updateTextureFromData(this._covariancesATexture!, covAView, textureSize.x, lineStart, lineCount);\r\n updateTextureFromData(this._covariancesBTexture!, covBView, textureSize.x, lineStart, lineCount);\r\n updateTextureFromData(this._centersTexture!, centersView, textureSize.x, lineStart, lineCount);\r\n updateTextureFromData(this._colorsTexture!, colorsView, textureSize.x, lineStart, lineCount);\r\n if (sh) {\r\n for (let i = 0; i < sh.length; i++) {\r\n const componentCount = 4;\r\n const shView = new Uint32Array(sh[i].buffer, texelStart * componentCount * 4, texelCount * componentCount);\r\n updateTextureFromData(this._shTextures![i], shView, textureSize.x, lineStart, lineCount);\r\n }\r\n }\r\n if (partIndices && this._partIndicesTexture) {\r\n const partIndicesView = new Uint8Array(partIndices.buffer, texelStart, texelCount);\r\n updateTextureFromData(this._partIndicesTexture, partIndicesView, textureSize.x, lineStart, lineCount);\r\n }\r\n }\r\n private _instanciateWorker(): void {\r\n if (!this._vertexCount) {\r\n return;\r\n }\r\n if (this._disableDepthSort) {\r\n return;\r\n }\r\n this._updateSplatIndexBuffer(this._vertexCount);\r\n\r\n // no worker in native\r\n if (IsNative) {\r\n return;\r\n }\r\n\r\n // Start the worker thread\r\n this._worker?.terminate();\r\n this._worker = new Worker(\r\n URL.createObjectURL(\r\n new Blob([\"(\", GaussianSplattingMesh._CreateWorker.toString(), \")(self)\"], {\r\n type: \"application/javascript\",\r\n })\r\n )\r\n );\r\n\r\n const positions = Float32Array.from(this._splatPositions!);\r\n const partIndices = this._partIndices ? new Uint8Array(this._partIndices) : null;\r\n const partMatrices = this._partMatrices.map((matrix) => new Float32Array(matrix.m));\r\n\r\n this._worker.postMessage({ positions }, [positions.buffer]);\r\n this._worker.postMessage({ partIndices });\r\n this._worker.postMessage({ partMatrices });\r\n\r\n this._worker.onmessage = (e) => {\r\n // Recompute vertexCountPadded in case _vertexCount has changed since the last update\r\n const vertexCountPadded = (this._vertexCount + 15) & ~0xf;\r\n\r\n // If the vertex count changed, we discard this result and trigger a new sort\r\n if (e.data.depthMix.length != vertexCountPadded) {\r\n this._canPostToWorker = true;\r\n this._postToWorker(true);\r\n this._sortIsDirty = false;\r\n return;\r\n }\r\n\r\n this._depthMix = e.data.depthMix;\r\n const cameraId = e.data.cameraId;\r\n\r\n const indexMix = new Uint32Array(e.data.depthMix.buffer);\r\n if (this._splatIndex) {\r\n for (let j = 0; j < vertexCountPadded; j++) {\r\n this._splatIndex[j] = indexMix[2 * j];\r\n }\r\n }\r\n if (this._delayedTextureUpdate) {\r\n const textureSize = this._getTextureSize(vertexCountPadded);\r\n this._updateSubTextures(\r\n this._delayedTextureUpdate.centers,\r\n this._delayedTextureUpdate.covA,\r\n this._delayedTextureUpdate.covB,\r\n this._delayedTextureUpdate.colors,\r\n 0,\r\n textureSize.y,\r\n this._delayedTextureUpdate.sh,\r\n this._delayedTextureUpdate.partIndices\r\n );\r\n this._delayedTextureUpdate = null;\r\n }\r\n\r\n // get mesh for camera and update its instance buffer\r\n const cameraViewInfos = this._cameraViewInfos.get(cameraId);\r\n if (cameraViewInfos) {\r\n if (cameraViewInfos.splatIndexBufferSet) {\r\n cameraViewInfos.mesh.thinInstanceBufferUpdated(\"splatIndex\");\r\n } else {\r\n cameraViewInfos.mesh.thinInstanceSetBuffer(\"splatIndex\", this._splatIndex, 16, false);\r\n cameraViewInfos.splatIndexBufferSet = true;\r\n }\r\n }\r\n this._canPostToWorker = true;\r\n this._readyToDisplay = true;\r\n // sort is dirty when GS is visible for progressive update with a this message arriving but positions were partially filled\r\n // another update needs to be kicked. The kick can't happen just when the position buffer is ready because _canPostToWorker might be false.\r\n if (this._sortIsDirty) {\r\n this._postToWorker(true);\r\n this._sortIsDirty = false;\r\n }\r\n };\r\n }\r\n\r\n private _getTextureSize(length: number): Vector2 {\r\n const engine = this._scene.getEngine();\r\n const width = engine.getCaps().maxTextureSize;\r\n\r\n let height = 1;\r\n\r\n if (engine.version === 1 && !engine.isWebGPU) {\r\n while (width * height < length) {\r\n height *= 2;\r\n }\r\n } else {\r\n height = Math.ceil(length / width);\r\n }\r\n\r\n if (height > width) {\r\n Logger.Error(\"GaussianSplatting texture size: (\" + width + \", \" + height + \"), maxTextureSize: \" + width);\r\n height = width;\r\n }\r\n\r\n return new Vector2(width, height);\r\n }\r\n\r\n /**\r\n * Gets the number of parts in the compound\r\n * @returns the number of parts in the compound, or 0 if the mesh is not a compound\r\n */\r\n public get partCount(): number {\r\n return this._partMatrices.length;\r\n }\r\n\r\n /**\r\n * Sets the world matrix for a specific part of the compound (if this mesh is a compound).\r\n * This will trigger a re-sort of the mesh.\r\n * @param partIndex index of the part, that must be between 0 and partCount - 1\r\n * @param worldMatrix the world matrix to set\r\n */\r\n public setWorldMatrixForPart(partIndex: number, worldMatrix: Matrix): void {\r\n this._partMatrices[partIndex].copyFrom(worldMatrix);\r\n if (this._worker) {\r\n this._worker.postMessage({ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)) });\r\n }\r\n this._postToWorker(true);\r\n }\r\n\r\n /**\r\n * Gets the world matrix for a specific part of the compound (if this mesh is a compound).\r\n * @param partIndex index of the part, that must be between 0 and partCount - 1\r\n * @returns the world matrix for the part, or the current world matrix of the mesh if the mesh is not a compound\r\n */\r\n public getWorldMatrixForPart(partIndex: number): Matrix {\r\n return this._partMatrices[partIndex] ?? this.getWorldMatrix();\r\n }\r\n\r\n /**\r\n * Gets the visibility for a specific part of the compound (if this mesh is a compound).\r\n * @param partIndex index of the part, that must be between 0 and partCount - 1\r\n * @returns the visibility value (0.0 to 1.0) for the part\r\n */\r\n public getPartVisibility(partIndex: number): number {\r\n return this._partVisibility[partIndex] ?? 1.0;\r\n }\r\n\r\n /**\r\n * Sets the visibility for a specific part of the compound (if this mesh is a compound).\r\n * @param partIndex index of the part, that must be between 0 and partCount - 1\r\n * @param value the visibility value (0.0 to 1.0) to set\r\n */\r\n public setPartVisibility(partIndex: number, value: number): void {\r\n this._partVisibility[partIndex] = Math.max(0.0, Math.min(1.0, value));\r\n }\r\n\r\n /**\r\n * Ensure that the part world matrix array is at least the given length.\r\n * NB: This length is used as reference for the number of parts in the compound.\r\n * Newly inserted parts are initialized with the current world matrix of the mesh.\r\n * @param length - The minimum length to ensure\r\n */\r\n private _ensureMinimumPartMatricesLength(length: number): void {\r\n if (this._partMatrices.length < length) {\r\n this._resizePartMatrices(length);\r\n }\r\n }\r\n\r\n /**\r\n * This sets the number of parts in the compound.\r\n * Warning: This must be consistent with the indices used in the partIndices texture.\r\n * Newly inserted parts are initialized with the current world matrix of the mesh.\r\n * @param length - The length to resize to\r\n */\r\n private _resizePartMatrices(length: number): void {\r\n if (this._partMatrices.length == length) {\r\n return;\r\n } else if (this._partMatrices.length > length) {\r\n this._partMatrices = this._partMatrices.slice(0, length);\r\n this._partVisibility = this._partVisibility.slice(0, length);\r\n } else {\r\n this.computeWorldMatrix(true);\r\n const defaultMatrix = this.getWorldMatrix();\r\n while (this._partMatrices.length < length) {\r\n this._partMatrices.push(defaultMatrix.clone());\r\n this._partVisibility.push(1.0);\r\n }\r\n }\r\n\r\n if (this._worker) {\r\n this._worker.postMessage({ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)) });\r\n }\r\n this._postToWorker(true);\r\n }\r\n\r\n /**\r\n * Add another mesh to this mesh, as a new part. This makes the current mesh a compound, if not already.\r\n * NB: The current mesh needs to be loaded with keepInRam: true.\r\n * @param other - The other mesh to add. This must be loaded with keepInRam: true.\r\n * @param disposeOther - Whether to dispose the other mesh after adding it to the current mesh.\r\n * @returns a placeholder mesh that can be used to manipulate the part transform\r\n */\r\n public addPart(other: GaussianSplattingMesh, disposeOther: boolean = true): Mesh {\r\n const maxPartCount = GetGaussianSplattingMaxPartCount(this._scene.getEngine());\r\n if (this.partCount >= maxPartCount) {\r\n throw new Error(`Cannot add part, as the maximum part count (${maxPartCount}) has been reached`);\r\n }\r\n\r\n const splatCountA = this._vertexCount;\r\n const splatsDataA = splatCountA == 0 ? new ArrayBuffer(0) : this.splatsData;\r\n const shDataA = this.shData;\r\n\r\n const splatCountB = other._vertexCount;\r\n const splatsDataB = other.splatsData;\r\n const shDataB = other.shData;\r\n\r\n const mergedShDataLength = Math.max(shDataA?.length || 0, shDataB?.length || 0);\r\n const hasMergedShData = shDataA !== null && shDataB !== null;\r\n\r\n // Sanity checks\r\n if (!splatsDataA) {\r\n throw new Error(`To call addPart(), the current mesh must be loaded with keepInRam: true`);\r\n }\r\n const expectedSplatsDataSizeA = splatCountA * GaussianSplattingMesh._RowOutputLength;\r\n if (splatsDataA.byteLength !== expectedSplatsDataSizeA) {\r\n throw new Error(`splatsDataA size (${splatsDataA.byteLength}) does not match expected size (${expectedSplatsDataSizeA})`);\r\n }\r\n if (!splatsDataB) {\r\n throw new Error(`To call addPart(), the other mesh must be loaded with keepInRam: true`);\r\n }\r\n const expectedSplatsDataSizeB = splatCountB * GaussianSplattingMesh._RowOutputLength;\r\n if (splatsDataB.byteLength !== expectedSplatsDataSizeB) {\r\n throw new Error(`splatsDataB size (${splatsDataB.byteLength}) does not match expected size (${expectedSplatsDataSizeB})`);\r\n }\r\n if (other.partIndices) {\r\n throw new Error(`To call addPart(), the other mesh must not be a compound`);\r\n }\r\n\r\n // Concatenate splatsData (ArrayBuffer)\r\n const mergedSplatsData = new Uint8Array(splatsDataA.byteLength + splatsDataB.byteLength);\r\n mergedSplatsData.set(new Uint8Array(splatsDataA), 0);\r\n mergedSplatsData.set(new Uint8Array(splatsDataB), splatsDataA.byteLength);\r\n\r\n let mergedShData: Uint8Array[] | undefined = undefined;\r\n if (hasMergedShData) {\r\n // Note: We need to calculate the texture size and pad accordingly\r\n // Each SH texture texel stores 16 bytes (4 RGBA uint32 components)\r\n const bytesPerTexel = 16;\r\n const totalSplatCount = splatCountA + splatCountB;\r\n\r\n mergedShData = [];\r\n for (let i = 0; i < mergedShDataLength; i++) {\r\n const mergedShDataItem = new Uint8Array(totalSplatCount * bytesPerTexel);\r\n if (i < (shDataA?.length ?? 0)) {\r\n mergedShDataItem.set(shDataA![i], 0);\r\n }\r\n if (i < (shDataB?.length ?? 0)) {\r\n const byteOffset = bytesPerTexel * splatCountA;\r\n mergedShDataItem.set(shDataB![i], byteOffset);\r\n }\r\n mergedShData.push(mergedShDataItem);\r\n }\r\n }\r\n\r\n // Concatenate partIndices (Uint8Array)\r\n let newPartIndex = this.partCount;\r\n let partIndicesA = this.partIndices;\r\n if (!partIndicesA) {\r\n partIndicesA = new Uint8Array(splatCountA);\r\n newPartIndex = splatCountA > 0 ? 1 : 0;\r\n //newPartIndex = 1;\r\n }\r\n if (partIndicesA.length < splatCountA) {\r\n throw new Error(`partIndices length (${partIndicesA.length}) should be at least vertexCount (${splatCountA}) in the current mesh`);\r\n }\r\n const partIndicesB = new Uint8Array(splatCountB).fill(newPartIndex);\r\n const mergedPartIndices = new Uint8Array(splatCountA + splatCountB);\r\n mergedPartIndices.set(partIndicesA.slice(0, splatCountA), 0);\r\n mergedPartIndices.set(partIndicesB, splatCountA);\r\n\r\n this.updateData(mergedSplatsData.buffer, mergedShData, { flipY: false }, mergedPartIndices);\r\n\r\n // Merge part matrices (TODO)\r\n const partWorldMatrix = other.getWorldMatrix();\r\n this.setWorldMatrixForPart(newPartIndex, partWorldMatrix);\r\n\r\n // Create a proxy mesh to manipulate the part transform\r\n const proxyMesh = new GaussianSplattingPartProxyMesh(other.name, this.getScene(), this, other, newPartIndex);\r\n\r\n if (disposeOther) {\r\n other.dispose();\r\n }\r\n\r\n // Set the initial world matrix\r\n const quaternion = new Quaternion();\r\n partWorldMatrix.decompose(proxyMesh.scaling, quaternion, proxyMesh.position);\r\n proxyMesh.rotationQuaternion = quaternion;\r\n proxyMesh.computeWorldMatrix(true);\r\n\r\n // Store the proxy in the map\r\n this._partProxies.set(newPartIndex, proxyMesh);\r\n\r\n return proxyMesh;\r\n }\r\n\r\n /**\r\n * Remove a part from this compound mesh.\r\n * @param index - The index of the part to remove\r\n */\r\n public removePart(index: number): void {\r\n if (index < 0 || index >= this.partCount) {\r\n throw new Error(`Part index ${index} is out of range [0, ${this.partCount})`);\r\n }\r\n\r\n // Get the current data\r\n const splatsData = this.splatsData;\r\n const shData = this.shData;\r\n const partIndices = this.partIndices;\r\n\r\n if (!splatsData || !partIndices) {\r\n throw new Error(\"Cannot remove part from a non-compound mesh or mesh without keepInRam\");\r\n }\r\n\r\n const splatCount = this._vertexCount;\r\n const rowLength = GaussianSplattingMesh._RowOutputLength;\r\n\r\n // Count splats that will remain (not in the removed part)\r\n let newSplatCount = 0;\r\n for (let i = 0; i < splatCount; i++) {\r\n if (partIndices[i] !== index) {\r\n newSplatCount++;\r\n }\r\n }\r\n\r\n // Build new splats data excluding the removed part\r\n const newSplatsData = new Uint8Array(newSplatCount * rowLength);\r\n const newPartIndices = new Uint8Array(newSplatCount);\r\n let newShData: Uint8Array[] | undefined = undefined;\r\n\r\n if (shData) {\r\n const bytesPerTexel = 16;\r\n newShData = [];\r\n for (let i = 0; i < shData.length; i++) {\r\n newShData.push(new Uint8Array(newSplatCount * bytesPerTexel));\r\n }\r\n }\r\n\r\n let writeIndex = 0;\r\n for (let readIndex = 0; readIndex < splatCount; readIndex++) {\r\n const currentPartIndex = partIndices[readIndex];\r\n if (currentPartIndex === index) {\r\n // Skip splats from the removed part\r\n continue;\r\n }\r\n\r\n // Copy splat data\r\n const srcOffset = readIndex * rowLength;\r\n const dstOffset = writeIndex * rowLength;\r\n newSplatsData.set(new Uint8Array(splatsData, srcOffset, rowLength), dstOffset);\r\n\r\n // Renumber part indices: indices > removed index get decremented\r\n newPartIndices[writeIndex] = currentPartIndex > index ? currentPartIndex - 1 : currentPartIndex;\r\n\r\n // Copy SH data if present\r\n if (shData && newShData) {\r\n const bytesPerTexel = 16;\r\n for (let shIndex = 0; shIndex < shData.length; shIndex++) {\r\n const srcShOffset = readIndex * bytesPerTexel;\r\n const dstShOffset = writeIndex * bytesPerTexel;\r\n newShData[shIndex].set(new Uint8Array(shData[shIndex].buffer, srcShOffset, bytesPerTexel), dstShOffset);\r\n }\r\n }\r\n\r\n writeIndex++;\r\n }\r\n\r\n // Remove the part matrix and visibility\r\n this._partMatrices.splice(index, 1);\r\n this._partVisibility.splice(index, 1);\r\n\r\n // Update worker with new part matrices\r\n if (this._worker) {\r\n this._worker.postMessage({ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)) });\r\n }\r\n\r\n // Update the mesh with the new data\r\n this.updateData(newSplatsData.buffer, newShData, { flipY: false }, newPartIndices);\r\n\r\n // Dispose and remove the proxy for the removed part\r\n const proxyToRemove = this._partProxies.get(index);\r\n if (proxyToRemove) {\r\n proxyToRemove.dispose();\r\n this._partProxies.delete(index);\r\n }\r\n\r\n // Update the proxy map: renumber proxies with index > removed index\r\n const proxiesToUpdate: Array<[number, GaussianSplattingPartProxyMesh]> = [];\r\n this._partProxies.forEach((proxy, proxyIndex) => {\r\n if (proxyIndex > index) {\r\n proxiesToUpdate.push([proxyIndex, proxy]);\r\n }\r\n });\r\n\r\n // Remove and re-add with updated indices\r\n for (const [oldIndex, proxy] of proxiesToUpdate) {\r\n this._partProxies.delete(oldIndex);\r\n // Update the proxy's internal partIndex\r\n proxy.updatePartIndex(oldIndex - 1);\r\n this._partProxies.set(oldIndex - 1, proxy);\r\n }\r\n }\r\n\r\n /**\r\n * Modifies the splats according to the passed transformation matrix.\r\n * @param transform defines the transform matrix to use\r\n * @returns the current mesh\r\n */\r\n public override bakeTransformIntoVertices(transform: DeepImmutable<Matrix>): Mesh {\r\n const arrayBuffer = this.splatsData;\r\n if (!arrayBuffer) {\r\n Logger.Error(\"Cannot bake transform into vertices if splatsData is not kept in RAM\");\r\n return this;\r\n }\r\n\r\n // Check for uniform scaling\r\n const m = transform.m;\r\n const scaleX = Math.sqrt(m[0] * m[0] + m[1] * m[1] + m[2] * m[2]);\r\n const scaleY = Math.sqrt(m[4] * m[4] + m[5] * m[5] + m[6] * m[6]);\r\n const scaleZ = Math.sqrt(m[8] * m[8] + m[9] * m[9] + m[10] * m[10]);\r\n const epsilon = 0.001;\r\n if (Math.abs(scaleX - scaleY) > epsilon || Math.abs(scaleX - scaleZ) > epsilon) {\r\n Logger.Error(\"Gaussian Splatting bakeTransformIntoVertices does not support non-uniform scaling\");\r\n return this;\r\n }\r\n\r\n const uBuffer = new Uint8Array(arrayBuffer);\r\n const fBuffer = new Float32Array(arrayBuffer);\r\n\r\n const temp = TmpVectors.Vector3[0];\r\n let index: number;\r\n const quaternion = TmpVectors.Quaternion[0];\r\n const transformedQuaternion = TmpVectors.Quaternion[1];\r\n transform.decompose(temp, transformedQuaternion, temp);\r\n for (index = 0; index < this._vertexCount; index++) {\r\n const floatIndex = index * 8; // 8 floats per splat (center.x, center.y, center.z, scale.x, scale.y, scale.z, ...)\r\n Vector3.TransformCoordinatesFromFloatsToRef(fBuffer[floatIndex], fBuffer[floatIndex + 1], fBuffer[floatIndex + 2], transform, temp);\r\n fBuffer[floatIndex] = temp.x;\r\n fBuffer[floatIndex + 1] = temp.y;\r\n fBuffer[floatIndex + 2] = temp.z;\r\n\r\n // Apply uniform scaling to splat scales\r\n fBuffer[floatIndex + 3] *= scaleX;\r\n fBuffer[floatIndex + 4] *= scaleX;\r\n fBuffer[floatIndex + 5] *= scaleX;\r\n\r\n // Unpack quaternion from uint8array (matching _GetSplat packing convention)\r\n quaternion.set(\r\n (uBuffer[32 * index + 28 + 1] - 127.5) / 127.5,\r\n (uBuffer[32 * index + 28 + 2] - 127.5) / 127.5,\r\n (uBuffer[32 * index + 28 + 3] - 127.5) / 127.5,\r\n (uBuffer[32 * index + 28 + 0] - 127.5) / 127.5\r\n );\r\n quaternion.normalize();\r\n\r\n // If there is a negative scaling, we need to flip the quaternion to keep the correct handedness\r\n if (this.scaling.x < 0) {\r\n quaternion.x = -quaternion.x;\r\n quaternion.w = -quaternion.w;\r\n }\r\n if (this.scaling.y < 0) {\r\n quaternion.y = -quaternion.y;\r\n quaternion.w = -quaternion.w;\r\n }\r\n if (this.scaling.z < 0) {\r\n quaternion.z = -quaternion.z;\r\n quaternion.w = -quaternion.w;\r\n }\r\n\r\n // Transform the quaternion\r\n transformedQuaternion.multiplyToRef(quaternion, quaternion);\r\n quaternion.normalize();\r\n\r\n // Pack quaternion back to uint8array (matching _GetSplat packing convention)\r\n uBuffer[32 * index + 28 + 0] = Math.round(quaternion.w * 127.5 + 127.5);\r\n uBuffer[32 * index + 28 + 1] = Math.round(quaternion.x * 127.5 + 127.5);\r\n uBuffer[32 * index + 28 + 2] = Math.round(quaternion.y * 127.5 + 127.5);\r\n uBuffer[32 * index + 28 + 3] = Math.round(quaternion.z * 127.5 + 127.5);\r\n }\r\n\r\n this.updateData(arrayBuffer, this.shData ?? undefined, { flipY: false });\r\n\r\n return this;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"gaussianSplattingMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GaussianSplatting/gaussianSplattingMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAA6B,UAAU,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGxF,OAAO,EAAE,gCAAgC,EAAE,MAAM,4DAA4D,CAAC;AAC9G,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6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AAY,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;YACnE,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;YAC9D,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;YACpC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACpF,QAAQ,CAAC,kBAAkB,GAAG,UAAU,CAAC;YACzC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;YAElC,0EAA0E;YAC1E,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;YACvC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC;YAE3C,8EAA8E;YAC9E,QAAQ,CAAC,OAAO,EAAE,CAAC;QACvB,CAAC;QAED,+DAA+D;QAC/D,iDAAiD;QACjD,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,yFAAyF;QACzF,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAwB,CAAC;QACzD,kBAAkB,EAAE,WAAW,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAClH,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import { type Nullable } from \"core/types\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { type Matrix, type Vector2, Quaternion, Vector3 } from \"core/Maths/math.vector\";\r\nimport { type Effect } from \"core/Materials/effect\";\r\n\r\nimport { GetGaussianSplattingMaxPartCount } from \"core/Materials/GaussianSplatting/gaussianSplattingMaterial\";\r\nimport { GaussianSplattingMeshBase } from \"./gaussianSplattingMeshBase\";\r\n\r\nimport { RawTexture } from \"core/Materials/Textures/rawTexture\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport \"core/Meshes/thinInstanceMesh\";\r\nimport { GaussianSplattingPartProxyMesh } from \"./gaussianSplattingPartProxyMesh\";\r\nimport { type BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\n\r\n/**\r\n * Class used to render a Gaussian Splatting mesh. Supports both single-cloud and compound\r\n * (multi-part) rendering. In compound mode, multiple Gaussian Splatting source meshes are\r\n * merged into one draw call while retaining per-part world-matrix control via\r\n * addPart/addParts and removePart.\r\n */\r\nexport class GaussianSplattingMesh extends GaussianSplattingMeshBase {\r\n /**\r\n * Proxy meshes indexed by part index. Maintained in sync with _partMatrices.\r\n */\r\n private _partProxies: GaussianSplattingPartProxyMesh[] = [];\r\n\r\n /**\r\n * World matrices for each part, indexed by part index.\r\n */\r\n protected _partMatrices: Matrix[] = [];\r\n\r\n /** When true, suppresses the sort trigger inside setWorldMatrixForPart during batch rebuilds. */\r\n private _rebuilding: boolean = false;\r\n\r\n /**\r\n * Visibility values for each part (0.0 to 1.0), indexed by part index.\r\n */\r\n protected _partVisibility: number[] = [];\r\n\r\n private _partIndicesTexture: Nullable<BaseTexture> = null;\r\n private _partIndices: Nullable<Uint8Array> = null;\r\n\r\n /**\r\n * Creates a new GaussianSplattingMesh\r\n * @param name the name of the mesh\r\n * @param url optional URL to load a Gaussian Splatting file from\r\n * @param scene the hosting scene\r\n * @param keepInRam whether to keep the raw splat data in RAM after uploading to GPU\r\n */\r\n constructor(name: string, url: Nullable<string> = null, scene: Nullable<Scene> = null, keepInRam: boolean = false) {\r\n super(name, url, scene, keepInRam);\r\n // Ensure _splatsData is retained once compound mode is entered — addPart/addParts need\r\n // the source data for full-texture rebuilds. Set after super() so it is visible to\r\n // _updateData when the async load completes.\r\n this._alwaysRetainSplatsData = true;\r\n }\r\n\r\n /**\r\n * Returns the class name\r\n * @returns \"GaussianSplattingMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingMesh\";\r\n }\r\n\r\n /**\r\n * Disposes proxy meshes and clears part data in addition to the base class GPU resources.\r\n * @param doNotRecurse Set to true to not recurse into each children\r\n */\r\n public override dispose(doNotRecurse?: boolean): void {\r\n for (const proxy of this._partProxies) {\r\n proxy.dispose();\r\n }\r\n if (this._partIndicesTexture) {\r\n this._partIndicesTexture.dispose();\r\n }\r\n this._partProxies = [];\r\n this._partMatrices = [];\r\n this._partVisibility = [];\r\n this._partIndicesTexture = null;\r\n super.dispose(doNotRecurse);\r\n }\r\n\r\n // ---------------------------------------------------------------------------\r\n // Worker and material hooks\r\n // ---------------------------------------------------------------------------\r\n\r\n /**\r\n * Posts the initial per-part data to the sort worker after it has been created.\r\n * Sends the current part matrices and group index array so the worker can correctly\r\n * weight depth values per part.\r\n * @param worker the newly created sort worker\r\n */\r\n protected override _onWorkerCreated(worker: Worker): void {\r\n worker.postMessage({ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)) });\r\n worker.postMessage({ partIndices: this._partIndices ? new Uint8Array(this._partIndices) : null });\r\n }\r\n\r\n /**\r\n * Stores the raw part index array, padded to texture length, so the worker and GPU texture\r\n * creation step have access to it.\r\n * @param partIndices - the raw part indices array received during a data load\r\n * @param textureLength - the padded texture length to allocate into\r\n */\r\n protected override _onIndexDataReceived(partIndices: Uint8Array, textureLength: number): void {\r\n this._partIndices = new Uint8Array(textureLength);\r\n this._partIndices.set(partIndices);\r\n }\r\n\r\n /**\r\n * Returns `true` when at least one part has been added to this compound mesh.\r\n * Returns `false` before any parts are added, so the mesh renders in normal\r\n * (non-compound) mode until the first addPart/addParts call. This matches the\r\n * old base-class behavior of `this._partMatrices.length > 0` and avoids\r\n * binding unset partWorld uniforms (which would cause division-by-zero in the\r\n * Gaussian projection Jacobian and produce huge distorted splats).\r\n * @internal\r\n */\r\n public override get isCompound(): boolean {\r\n return this._partMatrices.length > 0;\r\n }\r\n\r\n /**\r\n * During a removePart rebuild, keep the existing sort worker alive rather than\r\n * tearing it down and spinning up a new one. This avoids startup latency and the\r\n * transient state window where a stale sort could fire against an incomplete\r\n * partMatrices array.\r\n * Outside of a rebuild the base-class behaviour is used unchanged.\r\n */\r\n protected override _instantiateWorker(): void {\r\n if (this._rebuilding && this._worker) {\r\n // Worker already exists and is kept alive; just resize the splat-index buffer.\r\n this._updateSplatIndexBuffer(this._vertexCount);\r\n return;\r\n }\r\n super._instantiateWorker();\r\n }\r\n\r\n /**\r\n * Ensures the part-index GPU texture exists at the start of an incremental update.\r\n * Called before the sub-texture upload so the correct texture is available for the first batch.\r\n * @param textureSize - current texture dimensions\r\n */\r\n protected override _onIncrementalUpdateStart(textureSize: Vector2): void {\r\n this._ensurePartIndicesTexture(textureSize, this._partIndices ?? undefined);\r\n }\r\n\r\n /**\r\n * Posts positions (via super) and then additionally posts the current part-index array\r\n * to the sort worker so it can associate each splat with its part.\r\n */\r\n protected override _notifyWorkerNewData(): void {\r\n super._notifyWorkerNewData();\r\n if (this._worker) {\r\n this._worker.postMessage({ partIndices: this._partIndices ?? null });\r\n }\r\n }\r\n\r\n /**\r\n * Binds all compound-specific shader uniforms: the group index texture, per-part world\r\n * matrices, and per-part visibility values.\r\n * @param effect the shader effect that is being bound\r\n * @internal\r\n */\r\n public override bindExtraEffectUniforms(effect: Effect): void {\r\n if (!this._partIndicesTexture) {\r\n return;\r\n }\r\n effect.setTexture(\"partIndicesTexture\", this._partIndicesTexture);\r\n const partWorldData = new Float32Array(this.partCount * 16);\r\n for (let i = 0; i < this.partCount; i++) {\r\n this._partMatrices[i].toArray(partWorldData, i * 16);\r\n }\r\n effect.setMatrices(\"partWorld\", partWorldData);\r\n const partVisibilityData: number[] = [];\r\n for (let i = 0; i < this.partCount; i++) {\r\n partVisibilityData.push(this._partVisibility[i] ?? 1.0);\r\n }\r\n effect.setArray(\"partVisibility\", partVisibilityData);\r\n }\r\n\r\n // ---------------------------------------------------------------------------\r\n // Part matrix / visibility management\r\n // ---------------------------------------------------------------------------\r\n\r\n /**\r\n * Gets the number of parts in the compound.\r\n */\r\n public get partCount(): number {\r\n return this._partMatrices.length;\r\n }\r\n\r\n /**\r\n * Gets the part visibility array.\r\n */\r\n public get partVisibility(): number[] {\r\n return this._partVisibility;\r\n }\r\n\r\n /**\r\n * Sets the world matrix for a specific part of the compound.\r\n * This will trigger a re-sort of the mesh.\r\n * The `_partMatrices` array is automatically extended when `partIndex >= partCount`.\r\n * @param partIndex index of the part\r\n * @param worldMatrix the world matrix to set\r\n */\r\n public setWorldMatrixForPart(partIndex: number, worldMatrix: Matrix): void {\r\n if (this._partMatrices.length <= partIndex) {\r\n this.computeWorldMatrix(true);\r\n const defaultMatrix = this.getWorldMatrix();\r\n while (this._partMatrices.length <= partIndex) {\r\n this._partMatrices.push(defaultMatrix.clone());\r\n this._partVisibility.push(1.0);\r\n }\r\n }\r\n this._partMatrices[partIndex].copyFrom(worldMatrix);\r\n // During a batch rebuild suppress intermediate posts — the final correct set is posted\r\n // once the full rebuild completes (at the end of removePart).\r\n if (!this._rebuilding) {\r\n if (this._worker) {\r\n this._worker.postMessage({ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)) });\r\n }\r\n this._postToWorker(true);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the world matrix for a specific part of the compound.\r\n * @param partIndex index of the part, that must be between 0 and partCount - 1\r\n * @returns the world matrix for the part, or the current world matrix of the mesh if the part is not found\r\n */\r\n public getWorldMatrixForPart(partIndex: number): Matrix {\r\n return this._partMatrices[partIndex] ?? this.getWorldMatrix();\r\n }\r\n\r\n /**\r\n * Gets the visibility for a specific part of the compound.\r\n * @param partIndex index of the part, that must be between 0 and partCount - 1\r\n * @returns the visibility value (0.0 to 1.0) for the part\r\n */\r\n public getPartVisibility(partIndex: number): number {\r\n return this._partVisibility[partIndex] ?? 1.0;\r\n }\r\n\r\n /**\r\n * Sets the visibility for a specific part of the compound.\r\n * @param partIndex index of the part, that must be between 0 and partCount - 1\r\n * @param value the visibility value (0.0 to 1.0) to set\r\n */\r\n public setPartVisibility(partIndex: number, value: number): void {\r\n this._partVisibility[partIndex] = Math.max(0.0, Math.min(1.0, value));\r\n }\r\n\r\n protected override _copyTextures(source: GaussianSplattingMeshBase): void {\r\n super._copyTextures(source);\r\n this._partIndicesTexture = (source as GaussianSplattingMesh)._partIndicesTexture?.clone()!;\r\n }\r\n\r\n protected override _onUpdateTextures(textureSize: Vector2) {\r\n const createTextureFromDataU8 = (data: Uint8Array, width: number, height: number, format: number) => {\r\n return new RawTexture(data, width, height, format, this._scene, false, false, Constants.TEXTURE_BILINEAR_SAMPLINGMODE, Constants.TEXTURETYPE_UNSIGNED_BYTE);\r\n };\r\n\r\n // Keep the part indices texture in sync with _partIndices whenever textures are rebuilt.\r\n // The old \"only create if absent\" logic left the texture stale after a second addPart/addParts\r\n // call that doesn't change the texture dimensions: all new splats kept reading partIndex=0\r\n // (the first part), causing wrong positions, broken GPU picking, and shared movement.\r\n if (this._partIndices) {\r\n const buffer = new Uint8Array(this._partIndices);\r\n if (!this._partIndicesTexture) {\r\n this._partIndicesTexture = createTextureFromDataU8(buffer, textureSize.x, textureSize.y, Constants.TEXTUREFORMAT_RED);\r\n this._partIndicesTexture.wrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n this._partIndicesTexture.wrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n } else {\r\n const existingSize = this._partIndicesTexture.getSize();\r\n if (existingSize.width !== textureSize.x || existingSize.height !== textureSize.y) {\r\n // Dimensions changed — dispose and recreate at the new size.\r\n this._partIndicesTexture.dispose();\r\n this._partIndicesTexture = createTextureFromDataU8(buffer, textureSize.x, textureSize.y, Constants.TEXTUREFORMAT_RED);\r\n this._partIndicesTexture.wrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n this._partIndicesTexture.wrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n } else {\r\n // Same size — update data in-place (e.g. second addParts fitting in existing dims).\r\n this._updateTextureFromData(this._partIndicesTexture, buffer, textureSize.x, 0, textureSize.y);\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected override _updateSubTextures(\r\n splatPositions: Float32Array,\r\n covA: Uint16Array,\r\n covB: Uint16Array,\r\n colorArray: Uint8Array,\r\n lineStart: number,\r\n lineCount: number,\r\n sh?: Uint8Array[],\r\n partIndices?: Uint8Array\r\n ): void {\r\n super._updateSubTextures(splatPositions, covA, covB, colorArray, lineStart, lineCount, sh);\r\n if (partIndices && this._partIndicesTexture) {\r\n const textureSize = this._getTextureSize(this._vertexCount);\r\n const texelStart = lineStart * textureSize.x;\r\n const texelCount = lineCount * textureSize.x;\r\n const partIndicesView = new Uint8Array(partIndices.buffer, texelStart, texelCount);\r\n this._updateTextureFromData(this._partIndicesTexture, partIndicesView, textureSize.x, lineStart, lineCount);\r\n\r\n if (this._worker) {\r\n this._worker.postMessage({ partIndices: partIndices });\r\n }\r\n }\r\n }\r\n\r\n // ---------------------------------------------------------------------------\r\n // Private helpers\r\n // ---------------------------------------------------------------------------\r\n\r\n /**\r\n * Creates the part indices GPU texture the first time an incremental addPart introduces\r\n * compound data. Has no effect if the texture already exists or no partIndices are provided.\r\n * @param textureSize - Current texture dimensions\r\n * @param partIndices - Part index data; if undefined the method is a no-op\r\n */\r\n protected _ensurePartIndicesTexture(textureSize: Vector2, partIndices: Uint8Array | undefined): void {\r\n if (!partIndices || this._partIndicesTexture) {\r\n return;\r\n }\r\n const buffer = new Uint8Array(this._partIndices!);\r\n this._partIndicesTexture = new RawTexture(\r\n buffer,\r\n textureSize.x,\r\n textureSize.y,\r\n Constants.TEXTUREFORMAT_RED,\r\n this._scene,\r\n false,\r\n false,\r\n Constants.TEXTURE_BILINEAR_SAMPLINGMODE,\r\n Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n );\r\n this._partIndicesTexture.wrapU = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n this._partIndicesTexture.wrapV = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n if (this._worker) {\r\n this._worker.postMessage({ partIndices: partIndices ?? null });\r\n }\r\n }\r\n\r\n /**\r\n * Core implementation for adding one or more external GaussianSplattingMesh objects as new\r\n * parts. Writes directly into texture-sized CPU arrays and uploads in one pass — no merged\r\n * CPU splat buffer is ever constructed.\r\n *\r\n * @param others - Source meshes to append (must each be non-compound and fully loaded)\r\n * @param disposeOthers - Dispose source meshes after appending\r\n * @returns Proxy meshes and their assigned part indices\r\n */\r\n protected _addPartsInternal(others: GaussianSplattingMesh[], disposeOthers: boolean): { proxyMeshes: GaussianSplattingPartProxyMesh[]; assignedPartIndices: number[] } {\r\n if (others.length === 0) {\r\n return { proxyMeshes: [], assignedPartIndices: [] };\r\n }\r\n\r\n // Validate\r\n for (const other of others) {\r\n if (!other._splatsData) {\r\n throw new Error(`To call addPart()/addParts(), each source mesh must be fully loaded`);\r\n }\r\n if (other.isCompound) {\r\n throw new Error(`To call addPart()/addParts(), each source mesh must not be a compound`);\r\n }\r\n }\r\n\r\n const splatCountA = this._vertexCount;\r\n const totalOtherCount = others.reduce((s, o) => s + o._vertexCount, 0);\r\n const totalCount = splatCountA + totalOtherCount;\r\n\r\n const textureSize = this._getTextureSize(totalCount);\r\n const textureLength = textureSize.x * textureSize.y;\r\n const covBSItemSize = this._useRGBACovariants ? 4 : 2;\r\n\r\n // Allocate destination arrays for the full new texture\r\n const covA = new Uint16Array(textureLength * 4);\r\n const covB = new Uint16Array(covBSItemSize * textureLength);\r\n const colorArray = new Uint8Array(textureLength * 4);\r\n\r\n // Determine merged SH degree\r\n const hasSH = this._shData !== null && others.every((o) => o._shData !== null);\r\n const shDegreeNew = hasSH ? Math.max(this._shDegree, ...others.map((o) => o._shDegree)) : 0;\r\n let sh: Uint8Array[] | undefined = undefined;\r\n if (hasSH && shDegreeNew > 0) {\r\n const bytesPerTexel = 16;\r\n sh = [];\r\n for (let i = 0; i < shDegreeNew; i++) {\r\n sh.push(new Uint8Array(textureLength * bytesPerTexel));\r\n }\r\n }\r\n\r\n // --- Incremental path: can we reuse the already-committed GPU region? ---\r\n const incremental = this._canReuseCachedData(splatCountA, totalCount);\r\n const firstNewLine = incremental ? Math.floor(splatCountA / textureSize.x) : 0;\r\n\r\n const minimum = incremental ? this._cachedBoundingMin!.clone() : new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\r\n const maximum = incremental ? this._cachedBoundingMax!.clone() : new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\r\n\r\n // Preserve existing processed positions in the new array\r\n const oldPositions = this._splatPositions;\r\n this._splatPositions = new Float32Array(4 * textureLength);\r\n if (incremental && oldPositions) {\r\n this._splatPositions.set(oldPositions.subarray(0, splatCountA * 4));\r\n }\r\n\r\n // --- Build part indices ---\r\n let nextPartIndex = this.partCount;\r\n let partIndicesA = this._partIndices;\r\n if (!partIndicesA) {\r\n // First addPart on a plain mesh: assign its splats to part 0\r\n partIndicesA = new Uint8Array(splatCountA);\r\n nextPartIndex = splatCountA > 0 ? 1 : 0;\r\n }\r\n\r\n this._partIndices = new Uint8Array(textureLength);\r\n this._partIndices.set(partIndicesA.subarray(0, splatCountA));\r\n\r\n const assignedPartIndices: number[] = [];\r\n let dstOffset = splatCountA;\r\n const maxPartCount = GetGaussianSplattingMaxPartCount(this._scene.getEngine());\r\n for (const other of others) {\r\n if (nextPartIndex >= maxPartCount) {\r\n throw new Error(`Cannot add part, as the maximum part count (${maxPartCount}) has been reached`);\r\n }\r\n const newPartIndex = nextPartIndex++;\r\n assignedPartIndices.push(newPartIndex);\r\n this._partIndices.fill(newPartIndex, dstOffset, dstOffset + other._vertexCount);\r\n dstOffset += other._vertexCount;\r\n }\r\n\r\n // --- Process source data ---\r\n if (!incremental) {\r\n // Full rebuild path — only reached when the GPU texture must be reallocated\r\n // (either the texture height needs to grow to fit the new total, or this is\r\n // the very first addPart onto a mesh with no GPU textures yet). In the common\r\n // case where the texture height is unchanged, `incremental` is true and this\r\n // entire block is skipped. The `splatCountA > 0` guard avoids redundant work\r\n // on the first-ever addPart when the compound mesh starts empty.\r\n if (splatCountA > 0) {\r\n if (this._partProxies.length > 0) {\r\n // Already compound: rebuild every existing part from its stored source data.\r\n //\r\n // DESIGN NOTE: The intended use of GaussianSplattingMesh / GaussianSplattingCompoundMesh\r\n // in compound mode is to start EMPTY and compose parts exclusively via addPart/addParts.\r\n // In a future major version this will be the only supported path and the \"own data\"\r\n // legacy branch below will be removed.\r\n //\r\n // Until then, two layouts are possible:\r\n // A) LEGACY — compound loaded its own splat data (via URL or updateData) before\r\n // any addPart call. _partProxies[0] is undefined; the mesh's own splat data\r\n // is treated as an implicit \"part 0\" in this._splatsData. Proxied parts occupy\r\n // indices 1+. This layout will be deprecated in the next major version.\r\n // B) PREFERRED — compound started empty; first addPart assigned partIndex=0.\r\n // _partProxies[0] is set; this._splatsData is null; all parts are proxied.\r\n let rebuildOffset = 0;\r\n\r\n // Rebuild the compound's legacy \"own\" data at part 0 (scenario A only).\r\n // Skipped in the preferred empty-composer path (scenario B).\r\n if (!this._partProxies[0] && this._splatsData) {\r\n const proxyVertexCount = this._partProxies.reduce((sum, proxy) => sum + (proxy ? proxy.proxiedMesh._vertexCount : 0), 0);\r\n const part0Count = splatCountA - proxyVertexCount;\r\n if (part0Count > 0) {\r\n const uBufA = new Uint8Array(this._splatsData);\r\n const fBufA = new Float32Array(this._splatsData);\r\n for (let i = 0; i < part0Count; i++) {\r\n this._makeSplat(i, fBufA, uBufA, covA, covB, colorArray, minimum, maximum, false);\r\n }\r\n if (sh && this._shData) {\r\n const bytesPerTexel = 16;\r\n for (let texIdx = 0; texIdx < sh.length; texIdx++) {\r\n if (texIdx < this._shData.length) {\r\n sh[texIdx].set(this._shData[texIdx].subarray(0, part0Count * bytesPerTexel), 0);\r\n }\r\n }\r\n }\r\n rebuildOffset += part0Count;\r\n }\r\n }\r\n\r\n // Rebuild all proxied parts. Loop from index 0 because in the preferred\r\n // scenario B, part 0 is itself a proxied part with no implicit \"own\" data.\r\n for (let partIndex = 0; partIndex < this._partProxies.length; partIndex++) {\r\n const proxy = this._partProxies[partIndex];\r\n if (!proxy || !proxy.proxiedMesh) {\r\n continue;\r\n }\r\n this._appendSourceToArrays(proxy.proxiedMesh, rebuildOffset, covA, covB, colorArray, sh, minimum, maximum);\r\n rebuildOffset += proxy.proxiedMesh._vertexCount;\r\n }\r\n } else {\r\n // No proxies yet: this is the very first addPart call on a mesh that loaded\r\n // its own splat data (scenario A legacy path). Re-process that own data so\r\n // it occupies the start of the new texture before the incoming part is appended.\r\n // In the preferred scenario B (empty composer) splatCountA is 0 and this\r\n // entire branch is skipped by the outer `if (splatCountA > 0)` guard.\r\n if (this._splatsData) {\r\n const uBufA = new Uint8Array(this._splatsData);\r\n const fBufA = new Float32Array(this._splatsData);\r\n for (let i = 0; i < splatCountA; i++) {\r\n this._makeSplat(i, fBufA, uBufA, covA, covB, colorArray, minimum, maximum, false);\r\n }\r\n if (sh && this._shData) {\r\n const bytesPerTexel = 16;\r\n for (let texIdx = 0; texIdx < sh.length; texIdx++) {\r\n if (texIdx < this._shData.length) {\r\n sh[texIdx].set(this._shData[texIdx].subarray(0, splatCountA * bytesPerTexel), 0);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Incremental path: rebuild the partial first row (indices firstNewTexel to splatCountA-1)\r\n // so _updateSubTextures does not upload stale zeros over those already-committed texels.\r\n // The base-class _updateData always re-processes from firstNewTexel for the same reason;\r\n // the compound path must do the same.\r\n if (incremental) {\r\n const firstNewTexel = firstNewLine * textureSize.x;\r\n if (firstNewTexel < splatCountA) {\r\n if (this._partProxies.length === 0) {\r\n // No proxies: the mesh loaded its own splat data and this is the first\r\n // addPart call (scenario A legacy path). Re-process the partial boundary\r\n // row so it is not clobbered by stale zeros during the sub-texture upload.\r\n if (this._splatsData) {\r\n const uBufA = new Uint8Array(this._splatsData);\r\n const fBufA = new Float32Array(this._splatsData);\r\n for (let i = firstNewTexel; i < splatCountA; i++) {\r\n this._makeSplat(i, fBufA, uBufA, covA, covB, colorArray, minimum, maximum, false, i);\r\n }\r\n }\r\n } else {\r\n // Already compound: build a per-partIndex source lookup so each splat in the\r\n // partial boundary row can be re-processed from its original source buffer.\r\n //\r\n // Handles both layouts (see full-rebuild comment above):\r\n // A) LEGACY: _partProxies[0] absent → seed lookup[0] with this._splatsData\r\n // B) PREFERRED: _partProxies[0] present → all entries filled from proxies\r\n const proxyTotal = this._partProxies.reduce((s, p) => s + (p ? p.proxiedMesh._vertexCount : 0), 0);\r\n const part0Count = splatCountA - proxyTotal; // > 0 only in legacy scenario A\r\n const srcUBufs: (Uint8Array | null)[] = new Array(this._partProxies.length).fill(null);\r\n const srcFBufs: (Float32Array | null)[] = new Array(this._partProxies.length).fill(null);\r\n const partStarts: number[] = new Array(this._partProxies.length).fill(0);\r\n // Legacy scenario A: part 0 is the mesh's own loaded data.\r\n if (!this._partProxies[0] && this._splatsData && part0Count > 0) {\r\n srcUBufs[0] = new Uint8Array(this._splatsData);\r\n srcFBufs[0] = new Float32Array(this._splatsData);\r\n partStarts[0] = 0;\r\n }\r\n // All proxied parts — start from pi=0 to cover preferred scenario B.\r\n let cumOffset = part0Count;\r\n for (let pi = 0; pi < this._partProxies.length; pi++) {\r\n const proxy = this._partProxies[pi];\r\n if (!proxy?.proxiedMesh) {\r\n continue;\r\n }\r\n const srcData = proxy.proxiedMesh._splatsData ?? null;\r\n srcUBufs[pi] = srcData ? new Uint8Array(srcData) : null;\r\n srcFBufs[pi] = srcData ? new Float32Array(srcData) : null;\r\n partStarts[pi] = cumOffset;\r\n cumOffset += proxy.proxiedMesh._vertexCount;\r\n }\r\n for (let splatIdx = firstNewTexel; splatIdx < splatCountA; splatIdx++) {\r\n const partIdx = this._partIndices ? this._partIndices[splatIdx] : 0;\r\n const uBuf = partIdx < srcUBufs.length ? srcUBufs[partIdx] : null;\r\n const fBuf = partIdx < srcFBufs.length ? srcFBufs[partIdx] : null;\r\n if (uBuf && fBuf) {\r\n this._makeSplat(splatIdx, fBuf, uBuf, covA, covB, colorArray, minimum, maximum, false, splatIdx - (partStarts[partIdx] ?? 0));\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Append each new source\r\n dstOffset = splatCountA;\r\n for (const other of others) {\r\n this._appendSourceToArrays(other, dstOffset, covA, covB, colorArray, sh, minimum, maximum);\r\n dstOffset += other._vertexCount;\r\n }\r\n\r\n // Pad empty splats to texture boundary\r\n const paddedEnd = (totalCount + 15) & ~0xf;\r\n for (let i = totalCount; i < paddedEnd; i++) {\r\n this._makeEmptySplat(i, covA, covB, colorArray);\r\n }\r\n\r\n // --- Update vertex count / index buffer ---\r\n if (totalCount !== this._vertexCount) {\r\n this._updateSplatIndexBuffer(totalCount);\r\n }\r\n this._vertexCount = totalCount;\r\n this._shDegree = shDegreeNew;\r\n\r\n // --- Upload to GPU ---\r\n if (incremental) {\r\n // Update the part-indices texture (handles both create and update-in-place).\r\n // _ensurePartIndicesTexture is a no-op when the texture already exists, so on the\r\n // second+ addPart the partIndices would be stale without this call.\r\n this._onUpdateTextures(textureSize);\r\n this._updateSubTextures(this._splatPositions, covA, covB, colorArray, firstNewLine, textureSize.y - firstNewLine, sh);\r\n } else {\r\n this._updateTextures(covA, covB, colorArray, sh);\r\n }\r\n\r\n this.getBoundingInfo().reConstruct(minimum, maximum, this.getWorldMatrix());\r\n this.setEnabled(true);\r\n this._cachedBoundingMin = minimum.clone();\r\n this._cachedBoundingMax = maximum.clone();\r\n this._notifyWorkerNewData();\r\n\r\n // --- Create proxy meshes ---\r\n const proxyMeshes: GaussianSplattingPartProxyMesh[] = [];\r\n for (let i = 0; i < others.length; i++) {\r\n const other = others[i];\r\n const newPartIndex = assignedPartIndices[i];\r\n\r\n const partWorldMatrix = other.getWorldMatrix();\r\n this.setWorldMatrixForPart(newPartIndex, partWorldMatrix);\r\n\r\n const proxyMesh = new GaussianSplattingPartProxyMesh(other.name, this.getScene(), this, other, newPartIndex);\r\n\r\n if (disposeOthers) {\r\n other.dispose();\r\n }\r\n\r\n const quaternion = new Quaternion();\r\n partWorldMatrix.decompose(proxyMesh.scaling, quaternion, proxyMesh.position);\r\n proxyMesh.rotationQuaternion = quaternion;\r\n proxyMesh.computeWorldMatrix(true);\r\n\r\n this._partProxies[newPartIndex] = proxyMesh;\r\n proxyMeshes.push(proxyMesh);\r\n }\r\n\r\n return { proxyMeshes, assignedPartIndices };\r\n }\r\n\r\n // ---------------------------------------------------------------------------\r\n // Public compound API\r\n // ---------------------------------------------------------------------------\r\n\r\n /**\r\n * Add another mesh to this mesh, as a new part. This makes the current mesh a compound, if not already.\r\n * The source mesh's splat data is read directly — no merged CPU buffer is constructed.\r\n * @param other - The other mesh to add. Must be fully loaded before calling this method.\r\n * @param disposeOther - Whether to dispose the other mesh after adding it to the current mesh.\r\n * @returns a placeholder mesh that can be used to manipulate the part transform\r\n * @deprecated Use {@link GaussianSplattingCompoundMesh.addPart} instead.\r\n */\r\n public addPart(other: GaussianSplattingMesh, disposeOther: boolean = true): GaussianSplattingPartProxyMesh {\r\n const { proxyMeshes } = this._addPartsInternal([other], disposeOther);\r\n return proxyMeshes[0];\r\n }\r\n\r\n /**\r\n * Remove a part from this compound mesh.\r\n * The remaining parts are rebuilt directly from their stored source mesh references —\r\n * no merged CPU splat buffer is read back. The current mesh is reset to a plain (single-part)\r\n * state and then each remaining source is re-added via addParts.\r\n * @param index - The index of the part to remove\r\n * @deprecated Use {@link GaussianSplattingCompoundMesh.removePart} instead.\r\n */\r\n public removePart(index: number): void {\r\n if (index < 0 || index >= this.partCount) {\r\n throw new Error(`Part index ${index} is out of range [0, ${this.partCount})`);\r\n }\r\n\r\n // Collect surviving proxy objects (sorted by current part index so part 0 is added first)\r\n const survivors: Array<{ proxyMesh: GaussianSplattingPartProxyMesh; oldIndex: number; worldMatrix: Matrix; visibility: number }> = [];\r\n for (let proxyIndex = 0; proxyIndex < this._partProxies.length; proxyIndex++) {\r\n const proxy = this._partProxies[proxyIndex];\r\n if (proxy && proxyIndex !== index) {\r\n survivors.push({ proxyMesh: proxy, oldIndex: proxyIndex, worldMatrix: proxy.getWorldMatrix().clone(), visibility: this._partVisibility[proxyIndex] ?? 1.0 });\r\n }\r\n }\r\n survivors.sort((a, b) => a.oldIndex - b.oldIndex);\r\n\r\n // Validate every survivor still has its source data. If even one is missing we cannot rebuild.\r\n for (const { proxyMesh } of survivors) {\r\n if (!proxyMesh.proxiedMesh._splatsData) {\r\n throw new Error(`Cannot remove part: the source mesh for part \"${proxyMesh.name}\" no longer has its splat data available.`);\r\n }\r\n }\r\n\r\n // --- Reset this mesh to an empty state ---\r\n // Terminate the sort worker before zeroing _vertexCount. The worker's onmessage handler\r\n // compares depthMix.length against (_vertexCount + 15) & ~0xf; with _vertexCount = 0 that\r\n // becomes 16, which causes a forced re-sort loop on stale data and resets _canPostToWorker\r\n // to true, defeating the gate below. The worker will be re-instantiated naturally after\r\n // the rebuild via the first _postToWorker call.\r\n if (this._worker) {\r\n this._worker.terminate();\r\n this._worker = null;\r\n }\r\n // Dispose and null GPU textures so _updateTextures sees firstTime=true and creates\r\n // fresh GPU textures.\r\n this._covariancesATexture?.dispose();\r\n this._covariancesBTexture?.dispose();\r\n this._centersTexture?.dispose();\r\n this._colorsTexture?.dispose();\r\n this._covariancesATexture = null;\r\n this._covariancesBTexture = null;\r\n this._centersTexture = null;\r\n this._colorsTexture = null;\r\n if (this._shTextures) {\r\n for (const t of this._shTextures) {\r\n t.dispose();\r\n }\r\n this._shTextures = null;\r\n }\r\n if (this._partIndicesTexture) {\r\n this._partIndicesTexture.dispose();\r\n this._partIndicesTexture = null;\r\n }\r\n this._vertexCount = 0;\r\n this._splatPositions = null;\r\n this._partIndices = null;\r\n this._partMatrices = [];\r\n this._partVisibility = [];\r\n this._cachedBoundingMin = null;\r\n this._cachedBoundingMax = null;\r\n\r\n // Remove the proxy for the removed part and dispose it\r\n const proxyToRemove = this._partProxies[index];\r\n if (proxyToRemove) {\r\n proxyToRemove.dispose();\r\n }\r\n this._partProxies = [];\r\n\r\n // Rebuild from surviving sources. _addPartsInternal assigns part indices in order 0, 1, 2, …\r\n // so the new index for each survivor is simply its position in the survivors array.\r\n if (survivors.length === 0) {\r\n // Nothing left — leave the mesh empty.\r\n this.setEnabled(false);\r\n return;\r\n }\r\n\r\n // Gate the sort worker: suppress any sort request until the full rebuild is committed.\r\n this._rebuilding = true;\r\n this._canPostToWorker = false;\r\n const sources = survivors.map((s) => s.proxyMesh.proxiedMesh);\r\n const { proxyMeshes: newProxies } = this._addPartsInternal(sources, false);\r\n\r\n // Restore world matrices and re-map proxies\r\n for (let i = 0; i < survivors.length; i++) {\r\n const oldProxy = survivors[i].proxyMesh;\r\n const newProxy = newProxies[i];\r\n const newPartIndex = newProxy.partIndex;\r\n\r\n // Restore the world matrix and visibility the user had set on the old proxy\r\n this.setWorldMatrixForPart(newPartIndex, survivors[i].worldMatrix);\r\n this.setPartVisibility(newPartIndex, survivors[i].visibility);\r\n const quaternion = new Quaternion();\r\n survivors[i].worldMatrix.decompose(newProxy.scaling, quaternion, newProxy.position);\r\n newProxy.rotationQuaternion = quaternion;\r\n newProxy.computeWorldMatrix(true);\r\n\r\n // Update the old proxy's index so any existing user references still work\r\n oldProxy.updatePartIndex(newPartIndex);\r\n this._partProxies[newPartIndex] = oldProxy;\r\n\r\n // newProxy is redundant — it was created inside _addPartsInternal; dispose it\r\n newProxy.dispose();\r\n }\r\n\r\n // Rebuild is complete: all partMatrices are now set correctly.\r\n // Post the final complete set and fire one sort.\r\n this._rebuilding = false;\r\n // Break TypeScript's flow narrowing — _addPartsInternal may have reinstantiated _worker.\r\n const workerAfterRebuild = this._worker as Worker | null;\r\n workerAfterRebuild?.postMessage({ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)) });\r\n this._canPostToWorker = true;\r\n this._postToWorker(true);\r\n }\r\n}\r\n"]}