@babylonjs/core 9.2.0 → 9.2.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 (200) hide show
  1. package/Animations/animation.d.ts +9 -0
  2. package/Animations/animation.js +9 -0
  3. package/Animations/animation.js.map +1 -1
  4. package/Animations/runtimeAnimation.js +28 -0
  5. package/Animations/runtimeAnimation.js.map +1 -1
  6. package/Cameras/Inputs/geospatialCameraPointersInput.js +10 -8
  7. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  8. package/Cameras/geospatialCameraMovement.js +21 -21
  9. package/Cameras/geospatialCameraMovement.js.map +1 -1
  10. package/Debug/physicsViewer.js +2 -12
  11. package/Debug/physicsViewer.js.map +1 -1
  12. package/Engines/abstractEngine.js +2 -2
  13. package/Engines/abstractEngine.js.map +1 -1
  14. package/Engines/webgpuEngine.js +2 -0
  15. package/Engines/webgpuEngine.js.map +1 -1
  16. package/FlowGraph/Blocks/flowGraphBlockFactory.js +14 -1
  17. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  18. package/FlowGraph/flowGraph.js +6 -0
  19. package/FlowGraph/flowGraph.js.map +1 -1
  20. package/FlowGraph/flowGraphEventBlock.d.ts +10 -0
  21. package/FlowGraph/flowGraphEventBlock.js +24 -0
  22. package/FlowGraph/flowGraphEventBlock.js.map +1 -1
  23. package/FlowGraph/flowGraphParser.js +23 -4
  24. package/FlowGraph/flowGraphParser.js.map +1 -1
  25. package/FlowGraph/serialization.js +36 -14
  26. package/FlowGraph/serialization.js.map +1 -1
  27. package/FrameGraph/Node/Blocks/Rendering/iblShadowsRendererBlock.d.ts +105 -0
  28. package/FrameGraph/Node/Blocks/Rendering/iblShadowsRendererBlock.js +318 -0
  29. package/FrameGraph/Node/Blocks/Rendering/iblShadowsRendererBlock.js.map +1 -0
  30. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  31. package/FrameGraph/Node/Blocks/index.js +1 -0
  32. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  33. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.d.ts +34 -0
  34. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js +144 -0
  35. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js.map +1 -0
  36. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsSpatialBlurTask.d.ts +26 -0
  37. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsSpatialBlurTask.js +82 -0
  38. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsSpatialBlurTask.js.map +1 -0
  39. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsTracingTask.d.ts +61 -0
  40. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsTracingTask.js +207 -0
  41. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsTracingTask.js.map +1 -0
  42. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsVoxelizationTask.d.ts +104 -0
  43. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsVoxelizationTask.js +218 -0
  44. package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsVoxelizationTask.js.map +1 -0
  45. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.d.ts +217 -0
  46. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js +640 -0
  47. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js.map +1 -0
  48. package/FrameGraph/frameGraph.js +1 -0
  49. package/FrameGraph/frameGraph.js.map +1 -1
  50. package/FrameGraph/index.d.ts +1 -0
  51. package/FrameGraph/index.js +1 -0
  52. package/FrameGraph/index.js.map +1 -1
  53. package/Gizmos/boundingBoxGizmo.js +4 -0
  54. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  55. package/Layers/thinEffectLayer.js +8 -1
  56. package/Layers/thinEffectLayer.js.map +1 -1
  57. package/Lights/Clustered/clusteredLightContainer.js +8 -5
  58. package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
  59. package/Loading/Plugins/babylonFileLoader.js +26 -0
  60. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  61. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +15 -2
  62. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  63. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +3 -1
  64. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  65. package/Materials/PBR/openpbrMaterial.d.ts +13 -2
  66. package/Materials/PBR/openpbrMaterial.js +47 -16
  67. package/Materials/PBR/openpbrMaterial.js.map +1 -1
  68. package/Materials/PBR/pbrBRDFConfiguration.js +1 -1
  69. package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
  70. package/Materials/Textures/Filtering/hdrFiltering.js +6 -0
  71. package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
  72. package/Materials/Textures/envCubeTexture.js +13 -13
  73. package/Materials/Textures/envCubeTexture.js.map +1 -1
  74. package/Materials/materialHelper.functions.js +1 -1
  75. package/Materials/materialHelper.functions.js.map +1 -1
  76. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.d.ts +18 -4
  77. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js +29 -4
  78. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js.map +1 -1
  79. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +48 -8
  80. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +373 -84
  81. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  82. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.d.ts +39 -4
  83. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +152 -47
  84. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -1
  85. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.d.ts +61 -7
  86. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.js +94 -11
  87. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.js.map +1 -1
  88. package/Meshes/mesh.d.ts +15 -0
  89. package/Meshes/mesh.js +40 -1
  90. package/Meshes/mesh.js.map +1 -1
  91. package/Meshes/transformNode.js +2 -2
  92. package/Meshes/transformNode.js.map +1 -1
  93. package/Misc/sceneSerializer.js +2 -1
  94. package/Misc/sceneSerializer.js.map +1 -1
  95. package/Misc/textureTools.d.ts +3 -1
  96. package/Misc/textureTools.js +74 -13
  97. package/Misc/textureTools.js.map +1 -1
  98. package/Misc/tools.js +1 -1
  99. package/Misc/tools.js.map +1 -1
  100. package/Particles/baseParticleSystem.d.ts +47 -1
  101. package/Particles/baseParticleSystem.js +88 -0
  102. package/Particles/baseParticleSystem.js.map +1 -1
  103. package/Particles/computeShaderParticleSystem.js +12 -0
  104. package/Particles/computeShaderParticleSystem.js.map +1 -1
  105. package/Particles/gpuParticleSystem.d.ts +61 -25
  106. package/Particles/gpuParticleSystem.js +249 -75
  107. package/Particles/gpuParticleSystem.js.map +1 -1
  108. package/Particles/particleSystem.d.ts +0 -6
  109. package/Particles/particleSystem.js +3 -14
  110. package/Particles/particleSystem.js.map +1 -1
  111. package/Particles/thinParticleSystem.d.ts +1 -17
  112. package/Particles/thinParticleSystem.js +1 -50
  113. package/Particles/thinParticleSystem.js.map +1 -1
  114. package/Particles/webgl2ParticleSystem.d.ts +1 -0
  115. package/Particles/webgl2ParticleSystem.js +18 -2
  116. package/Particles/webgl2ParticleSystem.js.map +1 -1
  117. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js +1 -1
  118. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js.map +1 -1
  119. package/Rendering/IBLShadows/iblShadowsPluginMaterial.d.ts +3 -1
  120. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +11 -1
  121. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
  122. package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +0 -19
  123. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +21 -65
  124. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  125. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +15 -52
  126. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +129 -220
  127. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  128. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +3 -0
  129. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
  130. package/Rendering/depthRenderer.js +6 -0
  131. package/Rendering/depthRenderer.js.map +1 -1
  132. package/Rendering/geometryBufferRenderer.d.ts +14 -5
  133. package/Rendering/geometryBufferRenderer.js +6 -2
  134. package/Rendering/geometryBufferRenderer.js.map +1 -1
  135. package/Rendering/geometryBufferRendererSceneComponent.d.ts +4 -6
  136. package/Rendering/geometryBufferRendererSceneComponent.js.map +1 -1
  137. package/Rendering/iblCdfGenerator.d.ts +10 -0
  138. package/Rendering/iblCdfGenerator.js +52 -17
  139. package/Rendering/iblCdfGenerator.js.map +1 -1
  140. package/Rendering/index.d.ts +0 -6
  141. package/Rendering/index.js +0 -6
  142. package/Rendering/index.js.map +1 -1
  143. package/Shaders/ShadersInclude/gaussianSplatting.js +25 -4
  144. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  145. package/Shaders/ShadersInclude/openpbrDirectLighting.js +6 -1
  146. package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  147. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +1 -1
  148. package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  149. package/Shaders/gaussianSplatting.vertex.js +3 -0
  150. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  151. package/Shaders/gpuRenderParticles.vertex.js +14 -2
  152. package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
  153. package/Shaders/gpuUpdateParticles.vertex.js +24 -6
  154. package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
  155. package/Shaders/iblShadowVoxelTracing.fragment.js +5 -1
  156. package/Shaders/iblShadowVoxelTracing.fragment.js.map +1 -1
  157. package/Shaders/iblVoxelGrid.fragment.d.ts +1 -0
  158. package/Shaders/iblVoxelGrid.fragment.js +33 -5
  159. package/Shaders/iblVoxelGrid.fragment.js.map +1 -1
  160. package/Shaders/{iblVoxelSlabDebug.fragment.d.ts → lod3D.fragment.d.ts} +1 -1
  161. package/Shaders/lod3D.fragment.js +13 -0
  162. package/Shaders/lod3D.fragment.js.map +1 -0
  163. package/Shaders/openpbr.fragment.js +5 -0
  164. package/Shaders/openpbr.fragment.js.map +1 -1
  165. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +37 -5
  166. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  167. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +6 -1
  168. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  169. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +1 -1
  170. package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
  171. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -0
  172. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  173. package/ShadersWGSL/gpuUpdateParticles.compute.js +29 -8
  174. package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
  175. package/ShadersWGSL/iblShadowVoxelTracing.fragment.js +5 -1
  176. package/ShadersWGSL/iblShadowVoxelTracing.fragment.js.map +1 -1
  177. package/ShadersWGSL/iblVoxelGrid.fragment.js +1 -1
  178. package/ShadersWGSL/iblVoxelGrid.fragment.js.map +1 -1
  179. package/{Shaders/iblVoxelSlabDebug.vertex.d.ts → ShadersWGSL/lod3D.fragment.d.ts} +1 -1
  180. package/ShadersWGSL/lod3D.fragment.js +13 -0
  181. package/ShadersWGSL/lod3D.fragment.js.map +1 -0
  182. package/ShadersWGSL/openpbr.fragment.js +5 -0
  183. package/ShadersWGSL/openpbr.fragment.js.map +1 -1
  184. package/package.json +1 -1
  185. package/Shaders/iblVoxelGrid3dDebug.fragment.d.ts +0 -5
  186. package/Shaders/iblVoxelGrid3dDebug.fragment.js +0 -24
  187. package/Shaders/iblVoxelGrid3dDebug.fragment.js.map +0 -1
  188. package/Shaders/iblVoxelSlabDebug.fragment.js +0 -13
  189. package/Shaders/iblVoxelSlabDebug.fragment.js.map +0 -1
  190. package/Shaders/iblVoxelSlabDebug.vertex.js +0 -11
  191. package/Shaders/iblVoxelSlabDebug.vertex.js.map +0 -1
  192. package/ShadersWGSL/iblVoxelGrid3dDebug.fragment.d.ts +0 -5
  193. package/ShadersWGSL/iblVoxelGrid3dDebug.fragment.js +0 -23
  194. package/ShadersWGSL/iblVoxelGrid3dDebug.fragment.js.map +0 -1
  195. package/ShadersWGSL/iblVoxelSlabDebug.fragment.d.ts +0 -5
  196. package/ShadersWGSL/iblVoxelSlabDebug.fragment.js +0 -14
  197. package/ShadersWGSL/iblVoxelSlabDebug.fragment.js.map +0 -1
  198. package/ShadersWGSL/iblVoxelSlabDebug.vertex.d.ts +0 -5
  199. package/ShadersWGSL/iblVoxelSlabDebug.vertex.js +0 -12
  200. package/ShadersWGSL/iblVoxelSlabDebug.vertex.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import { GaussianSplattingMesh } from "./gaussianSplattingMesh.js";
2
+ import { Mesh } from "../mesh.js";
2
3
  /**
3
4
  * Class used to compose multiple Gaussian Splatting meshes into a single draw call,
4
5
  * with per-part world-matrix and visibility control via addPart/addParts/removePart.
@@ -21,7 +22,7 @@ export class GaussianSplattingCompoundMesh extends GaussianSplattingMesh {
21
22
  }
22
23
  /**
23
24
  * Add another mesh to this compound mesh as a new part.
24
- * The source mesh's splat data is read directly no merged CPU buffer is constructed.
25
+ * The source mesh's splat data is read directly and copied into the compound's retained source buffers.
25
26
  * @param other - The other mesh to add. Must be fully loaded before calling this method.
26
27
  * @param disposeOther - Whether to dispose the other mesh after adding it.
27
28
  * @returns a placeholder mesh that can be used to manipulate the part transform
@@ -31,7 +32,7 @@ export class GaussianSplattingCompoundMesh extends GaussianSplattingMesh {
31
32
  }
32
33
  /**
33
34
  * Add multiple meshes to this compound mesh as new parts in a single operation.
34
- * Splat data is written directly into texture arrays without constructing a merged CPU buffer.
35
+ * Splat data is written into texture arrays while the compound refreshes its retained merged source buffers.
35
36
  * @param others - The meshes to add. Each must be fully loaded and must not be a compound.
36
37
  * @param disposeOthers - Whether to dispose the other meshes after adding them.
37
38
  * @returns an array of placeholder meshes that can be used to manipulate the part transforms
@@ -45,12 +46,36 @@ export class GaussianSplattingCompoundMesh extends GaussianSplattingMesh {
45
46
  }
46
47
  /**
47
48
  * Remove a part from this compound mesh.
48
- * The remaining parts are rebuilt directly from their stored source mesh references
49
- * no merged CPU splat buffer is read back.
49
+ * The remaining parts are rebuilt directly from the compound mesh's retained source buffers.
50
50
  * @param index - The index of the part to remove
51
51
  */
52
52
  removePart(index) {
53
53
  super.removePart(index);
54
54
  }
55
+ /**
56
+ * Serialize current GaussianSplattingMesh
57
+ * @param serializationObject defines the object which will receive the serialization data
58
+ * @param encoding the encoding of binary data, defaults to base64 for json serialize,
59
+ * kept for future internal use like cloning where base64 encoding wastes cycles and memory
60
+ * @returns the serialized object
61
+ */
62
+ serialize(serializationObject = {}, encoding = "base64") {
63
+ serializationObject = super.serialize(serializationObject, encoding);
64
+ // Note here, the getClassName() is not overridden,
65
+ // as a lot of code currently depend on `getClassName() === "GaussianSplattingMesh"` check,
66
+ // to not break those code, serialization uses `_isCompound` to mark the type
67
+ serializationObject._isCompound = true;
68
+ return serializationObject;
69
+ }
70
+ /**
71
+ * Parses a serialized GaussianSplattingCompoundMesh
72
+ * @param parsedMesh the serialized mesh
73
+ * @param scene the scene to create the GaussianSplattingCompoundMesh in
74
+ * @returns the created GaussianSplattingCompoundMesh
75
+ */
76
+ static Parse(parsedMesh, scene) {
77
+ return GaussianSplattingMesh._ParseInternal(parsedMesh, scene, GaussianSplattingCompoundMesh);
78
+ }
55
79
  }
80
+ Mesh._GaussianSplattingCompoundMeshParser = GaussianSplattingCompoundMesh.Parse;
56
81
  //# sourceMappingURL=gaussianSplattingCompoundMesh.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gaussianSplattingCompoundMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE;;;;;;;;GAQG;AACH,MAAM,OAAO,6BAA8B,SAAQ,qBAAqB;IACpE;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,MAAwB,IAAI,EAAE,QAAyB,IAAI,EAAE,YAAqB,KAAK;QAC7G,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;OAMG;IACa,OAAO,CAAC,KAA4B,EAAE,eAAwB,IAAI;QAC9E,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;OAMG;IACI,QAAQ,CAAC,MAA+B,EAAE,gBAAyB,IAAI;QAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,EAAE,CAAC;QACd,CAAC;QACD,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QACtE,OAAO,WAAW,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACa,UAAU,CAAC,KAAa;QACpC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;CACJ","sourcesContent":["import { type Nullable } from \"core/types\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { GaussianSplattingMesh } from \"./gaussianSplattingMesh\";\r\nimport { type GaussianSplattingPartProxyMesh } from \"./gaussianSplattingPartProxyMesh\";\r\n\r\n/**\r\n * Class used to compose multiple Gaussian Splatting meshes into a single draw call,\r\n * with per-part world-matrix and visibility control via addPart/addParts/removePart.\r\n *\r\n * This is the recommended class for multi-part Gaussian Splatting use cases.\r\n *\r\n * Next major version: the compound mesh API (addPart/addParts/removePart) will\r\n * move exclusively to this class and will be removed from GaussianSplattingMesh.\r\n */\r\nexport class GaussianSplattingCompoundMesh extends GaussianSplattingMesh {\r\n /**\r\n * Creates a new GaussianSplattingCompoundMesh\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 }\r\n\r\n /**\r\n * Add another mesh to this compound mesh as a new part.\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.\r\n * @returns a placeholder mesh that can be used to manipulate the part transform\r\n */\r\n public override addPart(other: GaussianSplattingMesh, disposeOther: boolean = true): GaussianSplattingPartProxyMesh {\r\n return super.addPart(other, disposeOther);\r\n }\r\n\r\n /**\r\n * Add multiple meshes to this compound mesh as new parts in a single operation.\r\n * Splat data is written directly into texture arrays without constructing a merged CPU buffer.\r\n * @param others - The meshes to add. Each must be fully loaded and must not be a compound.\r\n * @param disposeOthers - Whether to dispose the other meshes after adding them.\r\n * @returns an array of placeholder meshes that can be used to manipulate the part transforms\r\n */\r\n public addParts(others: GaussianSplattingMesh[], disposeOthers: boolean = true): GaussianSplattingPartProxyMesh[] {\r\n if (others.length === 0) {\r\n return [];\r\n }\r\n const { proxyMeshes } = this._addPartsInternal(others, disposeOthers);\r\n return proxyMeshes;\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.\r\n * @param index - The index of the part to remove\r\n */\r\n public override removePart(index: number): void {\r\n super.removePart(index);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"gaussianSplattingCompoundMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B;;;;;;;;GAQG;AACH,MAAM,OAAO,6BAA8B,SAAQ,qBAAqB;IACpE;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,MAAwB,IAAI,EAAE,QAAyB,IAAI,EAAE,YAAqB,KAAK;QAC7G,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;OAMG;IACa,OAAO,CAAC,KAA4B,EAAE,eAAwB,IAAI;QAC9E,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;OAMG;IACI,QAAQ,CAAC,MAA+B,EAAE,gBAAyB,IAAI;QAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,EAAE,CAAC;QACd,CAAC;QACD,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QACtE,OAAO,WAAW,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACa,UAAU,CAAC,KAAa;QACpC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACa,SAAS,CAAC,sBAA2B,EAAE,EAAE,WAAmB,QAAQ;QAChF,mBAAmB,GAAG,KAAK,CAAC,SAAS,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QACrE,mDAAmD;QACnD,2FAA2F;QAC3F,6EAA6E;QAC7E,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC;QACvC,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAU,KAAK,CAAC,UAAe,EAAE,KAAY;QACtD,OAAO,qBAAqB,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,6BAA6B,CAAC,CAAC;IAClG,CAAC;CACJ;AAED,IAAI,CAAC,oCAAoC,GAAG,6BAA6B,CAAC,KAAK,CAAC","sourcesContent":["import { type Nullable } from \"core/types\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { GaussianSplattingMesh } from \"./gaussianSplattingMesh\";\r\nimport { type GaussianSplattingPartProxyMesh } from \"./gaussianSplattingPartProxyMesh\";\r\nimport { Mesh } from \"../mesh\";\r\n\r\n/**\r\n * Class used to compose multiple Gaussian Splatting meshes into a single draw call,\r\n * with per-part world-matrix and visibility control via addPart/addParts/removePart.\r\n *\r\n * This is the recommended class for multi-part Gaussian Splatting use cases.\r\n *\r\n * Next major version: the compound mesh API (addPart/addParts/removePart) will\r\n * move exclusively to this class and will be removed from GaussianSplattingMesh.\r\n */\r\nexport class GaussianSplattingCompoundMesh extends GaussianSplattingMesh {\r\n /**\r\n * Creates a new GaussianSplattingCompoundMesh\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 }\r\n\r\n /**\r\n * Add another mesh to this compound mesh as a new part.\r\n * The source mesh's splat data is read directly and copied into the compound's retained source buffers.\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.\r\n * @returns a placeholder mesh that can be used to manipulate the part transform\r\n */\r\n public override addPart(other: GaussianSplattingMesh, disposeOther: boolean = true): GaussianSplattingPartProxyMesh {\r\n return super.addPart(other, disposeOther);\r\n }\r\n\r\n /**\r\n * Add multiple meshes to this compound mesh as new parts in a single operation.\r\n * Splat data is written into texture arrays while the compound refreshes its retained merged source buffers.\r\n * @param others - The meshes to add. Each must be fully loaded and must not be a compound.\r\n * @param disposeOthers - Whether to dispose the other meshes after adding them.\r\n * @returns an array of placeholder meshes that can be used to manipulate the part transforms\r\n */\r\n public addParts(others: GaussianSplattingMesh[], disposeOthers: boolean = true): GaussianSplattingPartProxyMesh[] {\r\n if (others.length === 0) {\r\n return [];\r\n }\r\n const { proxyMeshes } = this._addPartsInternal(others, disposeOthers);\r\n return proxyMeshes;\r\n }\r\n\r\n /**\r\n * Remove a part from this compound mesh.\r\n * The remaining parts are rebuilt directly from the compound mesh's retained source buffers.\r\n * @param index - The index of the part to remove\r\n */\r\n public override removePart(index: number): void {\r\n super.removePart(index);\r\n }\r\n\r\n /**\r\n * Serialize current GaussianSplattingMesh\r\n * @param serializationObject defines the object which will receive the serialization data\r\n * @param encoding the encoding of binary data, defaults to base64 for json serialize,\r\n * kept for future internal use like cloning where base64 encoding wastes cycles and memory\r\n * @returns the serialized object\r\n */\r\n public override serialize(serializationObject: any = {}, encoding: string = \"base64\"): any {\r\n serializationObject = super.serialize(serializationObject, encoding);\r\n // Note here, the getClassName() is not overridden,\r\n // as a lot of code currently depend on `getClassName() === \"GaussianSplattingMesh\"` check,\r\n // to not break those code, serialization uses `_isCompound` to mark the type\r\n serializationObject._isCompound = true;\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized GaussianSplattingCompoundMesh\r\n * @param parsedMesh the serialized mesh\r\n * @param scene the scene to create the GaussianSplattingCompoundMesh in\r\n * @returns the created GaussianSplattingCompoundMesh\r\n */\r\n public static override Parse(parsedMesh: any, scene: Scene): GaussianSplattingCompoundMesh {\r\n return GaussianSplattingMesh._ParseInternal(parsedMesh, scene, GaussianSplattingCompoundMesh);\r\n }\r\n}\r\n\r\nMesh._GaussianSplattingCompoundMeshParser = GaussianSplattingCompoundMesh.Parse;\r\n"]}
@@ -5,6 +5,18 @@ import { type Effect } from "../../Materials/effect.js";
5
5
  import { GaussianSplattingMeshBase } from "./gaussianSplattingMeshBase.js";
6
6
  import "../thinInstanceMesh.js";
7
7
  import { GaussianSplattingPartProxyMesh } from "./gaussianSplattingPartProxyMesh.js";
8
+ import { type BoundingInfo } from "../../Culling/boundingInfo.js";
9
+ interface IGaussianSplattingPartSource {
10
+ name: string;
11
+ _vertexCount: number;
12
+ _splatsData: Nullable<ArrayBuffer>;
13
+ _shData: Nullable<Uint8Array[]>;
14
+ _shDegree: number;
15
+ isCompound: boolean;
16
+ getWorldMatrix(): Matrix;
17
+ getBoundingInfo(): BoundingInfo;
18
+ dispose(): void;
19
+ }
8
20
  /**
9
21
  * Class used to render a Gaussian Splatting mesh. Supports both single-cloud and compound
10
22
  * (multi-part) rendering. In compound mode, multiple Gaussian Splatting source meshes are
@@ -140,22 +152,25 @@ export declare class GaussianSplattingMesh extends GaussianSplattingMeshBase {
140
152
  * @param partIndices - Part index data; if undefined the method is a no-op
141
153
  */
142
154
  protected _ensurePartIndicesTexture(textureSize: Vector2, partIndices: Uint8Array | undefined): void;
155
+ private _appendPartSourceToArrays;
156
+ private _createRetainedPartSource;
157
+ private _retainMergedPartData;
143
158
  /**
144
- * Core implementation for adding one or more external GaussianSplattingMesh objects as new
145
- * parts. Writes directly into texture-sized CPU arrays and uploads in one pass — no merged
146
- * CPU splat buffer is ever constructed.
159
+ * Core implementation for adding one or more source parts as new
160
+ * parts. Writes directly into texture-sized CPU arrays, updates the retained merged source
161
+ * buffers, and uploads in one pass.
147
162
  *
148
163
  * @param others - Source meshes to append (must each be non-compound and fully loaded)
149
164
  * @param disposeOthers - Dispose source meshes after appending
150
165
  * @returns Proxy meshes and their assigned part indices
151
166
  */
152
- protected _addPartsInternal(others: GaussianSplattingMesh[], disposeOthers: boolean): {
167
+ protected _addPartsInternal(others: IGaussianSplattingPartSource[], disposeOthers: boolean): {
153
168
  proxyMeshes: GaussianSplattingPartProxyMesh[];
154
169
  assignedPartIndices: number[];
155
170
  };
156
171
  /**
157
172
  * Add another mesh to this mesh, as a new part. This makes the current mesh a compound, if not already.
158
- * The source mesh's splat data is read directly no merged CPU buffer is constructed.
173
+ * The source mesh's splat data is read directly and copied into the compound's retained source buffers.
159
174
  * @param other - The other mesh to add. Must be fully loaded before calling this method.
160
175
  * @param disposeOther - Whether to dispose the other mesh after adding it to the current mesh.
161
176
  * @returns a placeholder mesh that can be used to manipulate the part transform
@@ -164,11 +179,36 @@ export declare class GaussianSplattingMesh extends GaussianSplattingMeshBase {
164
179
  addPart(other: GaussianSplattingMesh, disposeOther?: boolean): GaussianSplattingPartProxyMesh;
165
180
  /**
166
181
  * Remove a part from this compound mesh.
167
- * The remaining parts are rebuilt directly from their stored source mesh references
168
- * no merged CPU splat buffer is read back. The current mesh is reset to a plain (single-part)
169
- * state and then each remaining source is re-added via addParts.
182
+ * The remaining parts are rebuilt directly from the compound mesh's retained source buffers.
183
+ * The current mesh is reset to a plain (single-part) state and then each remaining source is
184
+ * re-added via addParts.
170
185
  * @param index - The index of the part to remove
171
186
  * @deprecated Use {@link GaussianSplattingCompoundMesh.removePart} instead.
172
187
  */
173
188
  removePart(index: number): void;
189
+ /**
190
+ * Serialize current GaussianSplattingMesh
191
+ * @param serializationObject defines the object which will receive the serialization data
192
+ * @param encoding the encoding of binary data, defaults to base64 for json serialize,
193
+ * kept for future internal use like cloning where base64 encoding wastes cycles and memory
194
+ * @returns the serialized object
195
+ */
196
+ serialize(serializationObject?: any, encoding?: string): any;
197
+ /**
198
+ * Internal helper to parses a serialized GaussianSplattingMesh or GaussianSplattingCompoundMesh
199
+ * @param parsedMesh the serialized mesh
200
+ * @param scene the scene to create the GaussianSplattingMesh or GaussianSplattingCompoundMesh in
201
+ * @param ctor the constructor of the mesh to create
202
+ * @returns the created GaussianSplattingMesh
203
+ * @internal
204
+ */
205
+ static _ParseInternal<T extends GaussianSplattingMesh>(parsedMesh: any, scene: Scene, ctor: new (name: string, url: Nullable<string>, scene: Nullable<Scene>, keepInRam: boolean) => T): T;
206
+ /**
207
+ * Parses a serialized GaussianSplattingMesh
208
+ * @param parsedMesh the serialized mesh
209
+ * @param scene the scene to create the GaussianSplattingMesh in
210
+ * @returns the created GaussianSplattingMesh
211
+ */
212
+ static Parse(parsedMesh: any, scene: Scene): GaussianSplattingMesh;
174
213
  }
214
+ export {};