@babylonjs/core 7.43.0 → 7.44.0

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 (178) hide show
  1. package/Actions/actionEvent.d.ts +4 -4
  2. package/Buffers/bufferUtils.d.ts +8 -1
  3. package/Buffers/bufferUtils.js +15 -0
  4. package/Buffers/bufferUtils.js.map +1 -1
  5. package/Culling/Helper/boundingInfoHelper.d.ts +2 -9
  6. package/Culling/Helper/boundingInfoHelper.js +2 -9
  7. package/Culling/Helper/boundingInfoHelper.js.map +1 -1
  8. package/Engines/abstractEngine.js +2 -2
  9. package/Engines/abstractEngine.js.map +1 -1
  10. package/Engines/engine.d.ts +5 -2
  11. package/FlowGraph/flowGraphConnection.d.ts +1 -1
  12. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.d.ts +42 -0
  13. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +78 -0
  14. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -0
  15. package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.d.ts +3 -19
  16. package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js +3 -49
  17. package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js.map +1 -1
  18. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.d.ts +3 -19
  19. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +3 -49
  20. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
  21. package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.d.ts +3 -19
  22. package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js +3 -49
  23. package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js.map +1 -1
  24. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.d.ts +2 -17
  25. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js +3 -45
  26. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js.map +1 -1
  27. package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.d.ts +2 -17
  28. package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +3 -44
  29. package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js.map +1 -1
  30. package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.d.ts +3 -19
  31. package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js +3 -49
  32. package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js.map +1 -1
  33. package/FrameGraph/Node/Blocks/PostProcesses/passPostProcessBlock.d.ts +47 -0
  34. package/FrameGraph/Node/Blocks/PostProcesses/passPostProcessBlock.js +65 -0
  35. package/FrameGraph/Node/Blocks/PostProcesses/passPostProcessBlock.js.map +1 -0
  36. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  37. package/FrameGraph/Node/Blocks/index.js +1 -0
  38. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  39. package/FrameGraph/Tasks/PostProcesses/passTask.d.ts +29 -0
  40. package/FrameGraph/Tasks/PostProcesses/passTask.js +31 -0
  41. package/FrameGraph/Tasks/PostProcesses/passTask.js.map +1 -0
  42. package/FrameGraph/frameGraphTextureManager.d.ts +1 -1
  43. package/FrameGraph/index.d.ts +1 -0
  44. package/FrameGraph/index.js +1 -0
  45. package/FrameGraph/index.js.map +1 -1
  46. package/Gizmos/planeRotationGizmo.js +10 -0
  47. package/Gizmos/planeRotationGizmo.js.map +1 -1
  48. package/Inputs/scene.inputManager.js +2 -2
  49. package/Inputs/scene.inputManager.js.map +1 -1
  50. package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +6 -2
  51. package/Materials/GreasedLine/greasedLinePluginMaterial.js +8 -2
  52. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  53. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +11 -3
  54. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -1
  55. package/Materials/GreasedLine/greasedLineSimpleMaterial.d.ts +1 -0
  56. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +1 -0
  57. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  58. package/Materials/Node/Blocks/PBR/reflectionBlock.js +1 -3
  59. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  60. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +3 -3
  61. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  62. package/Materials/Node/nodeMaterial.d.ts +4 -2
  63. package/Materials/Node/nodeMaterial.js +7 -5
  64. package/Materials/Node/nodeMaterial.js.map +1 -1
  65. package/Materials/PBR/pbrBaseMaterial.js +1 -0
  66. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  67. package/Materials/Textures/Filtering/hdrFiltering.js +1 -0
  68. package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
  69. package/Materials/Textures/Filtering/hdrIrradianceFiltering.d.ts +69 -0
  70. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js +187 -0
  71. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js.map +1 -0
  72. package/Materials/Textures/hdrCubeTexture.d.ts +5 -1
  73. package/Materials/Textures/hdrCubeTexture.js +29 -3
  74. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  75. package/Materials/Textures/index.d.ts +4 -0
  76. package/Materials/Textures/index.js +4 -0
  77. package/Materials/Textures/index.js.map +1 -1
  78. package/Materials/standardMaterial.d.ts +1 -2
  79. package/Materials/standardMaterial.js +0 -2
  80. package/Materials/standardMaterial.js.map +1 -1
  81. package/Meshes/Builders/planeBuilder.js +2 -2
  82. package/Meshes/Builders/planeBuilder.js.map +1 -1
  83. package/Meshes/Compression/dracoCodec.d.ts +4 -4
  84. package/Meshes/Compression/dracoCodec.js.map +1 -1
  85. package/Meshes/Compression/dracoCompression.d.ts +1 -1
  86. package/Meshes/Compression/dracoCompression.js.map +1 -1
  87. package/Meshes/Compression/dracoCompressionWorker.d.ts +16 -30
  88. package/Meshes/Compression/dracoCompressionWorker.js +128 -22
  89. package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
  90. package/Meshes/Compression/dracoDecoder.d.ts +4 -9
  91. package/Meshes/Compression/dracoDecoder.js +5 -5
  92. package/Meshes/Compression/dracoDecoder.js.map +1 -1
  93. package/Meshes/Compression/dracoDecoder.types.d.ts +52 -0
  94. package/Meshes/Compression/dracoDecoder.types.js +2 -0
  95. package/Meshes/Compression/dracoDecoder.types.js.map +1 -0
  96. package/Meshes/Compression/dracoEncoder.d.ts +91 -0
  97. package/Meshes/Compression/dracoEncoder.js +239 -0
  98. package/Meshes/Compression/dracoEncoder.js.map +1 -0
  99. package/Meshes/Compression/dracoEncoder.types.d.ts +82 -0
  100. package/Meshes/Compression/dracoEncoder.types.js +2 -0
  101. package/Meshes/Compression/dracoEncoder.types.js.map +1 -0
  102. package/Meshes/Compression/index.d.ts +1 -0
  103. package/Meshes/Compression/index.js +1 -0
  104. package/Meshes/Compression/index.js.map +1 -1
  105. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +92 -2
  106. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +286 -10
  107. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  108. package/Meshes/GreasedLine/greasedLineBaseMesh.js +4 -2
  109. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  110. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +1 -1
  111. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  112. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +1 -1
  113. package/Meshes/mesh.d.ts +2 -2
  114. package/Meshes/transformNode.js +2 -0
  115. package/Meshes/transformNode.js.map +1 -1
  116. package/Misc/decorators.serialization.js +2 -0
  117. package/Misc/decorators.serialization.js.map +1 -1
  118. package/Misc/greasedLineTools.d.ts +1 -1
  119. package/Misc/logger.d.ts +2 -1
  120. package/Misc/logger.js +2 -1
  121. package/Misc/logger.js.map +1 -1
  122. package/Morph/morphTargetManager.d.ts +1 -0
  123. package/Morph/morphTargetManager.js +6 -1
  124. package/Morph/morphTargetManager.js.map +1 -1
  125. package/Particles/pointsCloudSystem.d.ts +3 -3
  126. package/Physics/v2/Plugins/havokPlugin.d.ts +2 -2
  127. package/PostProcesses/index.d.ts +1 -0
  128. package/PostProcesses/index.js +1 -0
  129. package/PostProcesses/index.js.map +1 -1
  130. package/PostProcesses/passPostProcess.d.ts +2 -3
  131. package/PostProcesses/passPostProcess.js +36 -48
  132. package/PostProcesses/passPostProcess.js.map +1 -1
  133. package/PostProcesses/thinPassPostProcess.d.ts +48 -0
  134. package/PostProcesses/thinPassPostProcess.js +113 -0
  135. package/PostProcesses/thinPassPostProcess.js.map +1 -0
  136. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +1 -1
  137. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
  138. package/Rendering/iblCdfGenerator.d.ts +13 -5
  139. package/Rendering/iblCdfGenerator.js +67 -10
  140. package/Rendering/iblCdfGenerator.js.map +1 -1
  141. package/Shaders/ShadersInclude/gaussianSplatting.js +6 -6
  142. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  143. package/Shaders/ShadersInclude/pbrBlockReflection.js +13 -8
  144. package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
  145. package/Shaders/gaussianSplatting.vertex.js +2 -1
  146. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  147. package/Shaders/hdrIrradianceFiltering.fragment.d.ts +9 -0
  148. package/Shaders/hdrIrradianceFiltering.fragment.js +25 -0
  149. package/Shaders/hdrIrradianceFiltering.fragment.js.map +1 -0
  150. package/Shaders/hdrIrradianceFiltering.vertex.d.ts +5 -0
  151. package/Shaders/hdrIrradianceFiltering.vertex.js +15 -0
  152. package/Shaders/hdrIrradianceFiltering.vertex.js.map +1 -0
  153. package/Shaders/pbr.fragment.js +1 -3
  154. package/Shaders/pbr.fragment.js.map +1 -1
  155. package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +13 -8
  156. package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
  157. package/ShadersWGSL/greasedLine.fragment.js +9 -3
  158. package/ShadersWGSL/greasedLine.fragment.js.map +1 -1
  159. package/ShadersWGSL/greasedLine.vertex.js +12 -2
  160. package/ShadersWGSL/greasedLine.vertex.js.map +1 -1
  161. package/ShadersWGSL/hdrIrradianceFiltering.fragment.d.ts +9 -0
  162. package/ShadersWGSL/hdrIrradianceFiltering.fragment.js +26 -0
  163. package/ShadersWGSL/hdrIrradianceFiltering.fragment.js.map +1 -0
  164. package/ShadersWGSL/hdrIrradianceFiltering.vertex.d.ts +5 -0
  165. package/ShadersWGSL/hdrIrradianceFiltering.vertex.js +16 -0
  166. package/ShadersWGSL/hdrIrradianceFiltering.vertex.js.map +1 -0
  167. package/ShadersWGSL/outline.fragment.js +1 -1
  168. package/ShadersWGSL/outline.fragment.js.map +1 -1
  169. package/ShadersWGSL/passCube.fragment.js +1 -1
  170. package/ShadersWGSL/passCube.fragment.js.map +1 -1
  171. package/ShadersWGSL/pbr.fragment.js +1 -3
  172. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  173. package/XR/features/WebXRDepthSensing.d.ts +24 -2
  174. package/XR/features/WebXRDepthSensing.js +320 -26
  175. package/XR/features/WebXRDepthSensing.js.map +1 -1
  176. package/package.json +1 -1
  177. package/scene.js +9 -5
  178. package/scene.js.map +1 -1
@@ -0,0 +1,82 @@
1
+ import type { Nullable } from "../../types.js";
2
+ /**
3
+ * The available Draco attribute names.
4
+ */
5
+ export type DracoAttributeName = "POSITION" | "NORMAL" | "COLOR" | "TEX_COORD" | "GENERIC";
6
+ /**
7
+ * Draco encoding method (from EncoderMethod enum in `draco_encoder.ts`).
8
+ */
9
+ export type DracoEncoderMethod = "MESH_SEQUENTIAL_ENCODING" | "MESH_EDGEBREAKER_ENCODING";
10
+ /**
11
+ * Options for a particular encoding.
12
+ */
13
+ export interface IDracoEncoderOptions {
14
+ /**
15
+ * Tune how fast decoding should be (0 = fastest but least compressed, 10 = slowest but most compressed).
16
+ */
17
+ decodeSpeed?: number;
18
+ /**
19
+ * Tune how fast encoding should be (0 = fastest but least compressed, 10 = slowest but most compressed).
20
+ */
21
+ encodeSpeed?: number;
22
+ /**
23
+ * The method to use for encoding the data (EDGEBREAKER or SEQUENTIAL). Defaults to EDGEBREAKER, if possible.
24
+ */
25
+ method?: DracoEncoderMethod;
26
+ /**
27
+ * The number of bits to use for each DRACO attribute kind.
28
+ */
29
+ quantizationBits?: Record<DracoAttributeName, number>;
30
+ /**
31
+ * The list of BABYLON attribute kinds to skip exporting, if present. Defaults to none.
32
+ */
33
+ excludedAttributes?: string[];
34
+ }
35
+ /**
36
+ * Encoder parameter carrying Babylon attribute data.
37
+ * @internal
38
+ */
39
+ export interface IDracoAttributeData {
40
+ /**
41
+ * The Babylon kind of the attribute.
42
+ */
43
+ babylonAttribute: string;
44
+ /**
45
+ * The Draco kind to use for the attribute.
46
+ */
47
+ dracoAttribute: DracoAttributeName;
48
+ /**
49
+ * The size of the attribute.
50
+ */
51
+ size: number;
52
+ /**
53
+ * The buffer view of the attribute.
54
+ */
55
+ data: Float32Array;
56
+ }
57
+ /**
58
+ * Encoded Draco mesh data.
59
+ * @internal
60
+ */
61
+ export interface IDracoEncodedMeshData {
62
+ /**
63
+ * The encoded data.
64
+ */
65
+ data: Int8Array;
66
+ /**
67
+ * A map of Babylon vertex attributes to their Draco unique ids in the encoded data.
68
+ */
69
+ attributeIDs: Record<string, number>;
70
+ }
71
+ /**
72
+ * @internal
73
+ */
74
+ interface EncodeDoneMessage {
75
+ id: "encodeMeshDone";
76
+ encodedMeshData: Nullable<IDracoEncodedMeshData>;
77
+ }
78
+ /**
79
+ * @internal
80
+ */
81
+ export type EncoderMessage = EncodeDoneMessage;
82
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dracoEncoder.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dracoEncoder.types.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Compression/dracoEncoder.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"core/types\";\n\n/**\n * The available Draco attribute names.\n */\nexport type DracoAttributeName = \"POSITION\" | \"NORMAL\" | \"COLOR\" | \"TEX_COORD\" | \"GENERIC\";\n\n/**\n * Draco encoding method (from EncoderMethod enum in `draco_encoder.ts`).\n */\nexport type DracoEncoderMethod = \"MESH_SEQUENTIAL_ENCODING\" | \"MESH_EDGEBREAKER_ENCODING\";\n\n/**\n * Options for a particular encoding.\n */\nexport interface IDracoEncoderOptions {\n /**\n * Tune how fast decoding should be (0 = fastest but least compressed, 10 = slowest but most compressed).\n */\n decodeSpeed?: number;\n /**\n * Tune how fast encoding should be (0 = fastest but least compressed, 10 = slowest but most compressed).\n */\n encodeSpeed?: number;\n /**\n * The method to use for encoding the data (EDGEBREAKER or SEQUENTIAL). Defaults to EDGEBREAKER, if possible.\n */\n method?: DracoEncoderMethod;\n /**\n * The number of bits to use for each DRACO attribute kind.\n */\n quantizationBits?: Record<DracoAttributeName, number>;\n /**\n * The list of BABYLON attribute kinds to skip exporting, if present. Defaults to none.\n */\n excludedAttributes?: string[];\n}\n\n/**\n * Encoder parameter carrying Babylon attribute data.\n * @internal\n */\nexport interface IDracoAttributeData {\n /**\n * The Babylon kind of the attribute.\n */\n babylonAttribute: string;\n /**\n * The Draco kind to use for the attribute.\n */\n dracoAttribute: DracoAttributeName;\n /**\n * The size of the attribute.\n */\n size: number;\n /**\n * The buffer view of the attribute.\n */\n data: Float32Array;\n}\n\n/**\n * Encoded Draco mesh data.\n * @internal\n */\nexport interface IDracoEncodedMeshData {\n /**\n * The encoded data.\n */\n data: Int8Array;\n /**\n * A map of Babylon vertex attributes to their Draco unique ids in the encoded data.\n */\n attributeIDs: Record<string, number>;\n}\n\n/**\n * @internal\n */\ninterface EncodeDoneMessage {\n id: \"encodeMeshDone\";\n encodedMeshData: Nullable<IDracoEncodedMeshData>;\n}\n\n/**\n * @internal\n */\nexport type EncoderMessage = EncodeDoneMessage;\n"]}
@@ -1,3 +1,4 @@
1
1
  export * from "./dracoCompression";
2
2
  export * from "./meshoptCompression";
3
3
  export * from "./dracoDecoder";
4
+ export * from "./dracoEncoder";
@@ -1,4 +1,5 @@
1
1
  export * from "./dracoCompression.js";
2
2
  export * from "./meshoptCompression.js";
3
3
  export * from "./dracoDecoder.js";
4
+ export * from "./dracoEncoder.js";
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Compression/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC","sourcesContent":["export * from \"./dracoCompression\";\r\nexport * from \"./meshoptCompression\";\r\nexport * from \"./dracoDecoder\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Compression/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC","sourcesContent":["export * from \"./dracoCompression\";\r\nexport * from \"./meshoptCompression\";\r\nexport * from \"./dracoDecoder\";\r\nexport * from \"./dracoEncoder\";\r\n"]}
@@ -55,7 +55,58 @@ declare enum PLYValue {
55
55
  ROT_1 = 31,
56
56
  ROT_2 = 32,
57
57
  ROT_3 = 33,
58
- UNDEFINED = 34
58
+ MIN_COLOR_R = 34,
59
+ MIN_COLOR_G = 35,
60
+ MIN_COLOR_B = 36,
61
+ MAX_COLOR_R = 37,
62
+ MAX_COLOR_G = 38,
63
+ MAX_COLOR_B = 39,
64
+ SH_0 = 40,
65
+ SH_1 = 41,
66
+ SH_2 = 42,
67
+ SH_3 = 43,
68
+ SH_4 = 44,
69
+ SH_5 = 45,
70
+ SH_6 = 46,
71
+ SH_7 = 47,
72
+ SH_8 = 48,
73
+ SH_9 = 49,
74
+ SH_10 = 50,
75
+ SH_11 = 51,
76
+ SH_12 = 52,
77
+ SH_13 = 53,
78
+ SH_14 = 54,
79
+ SH_15 = 55,
80
+ SH_16 = 56,
81
+ SH_17 = 57,
82
+ SH_18 = 58,
83
+ SH_19 = 59,
84
+ SH_20 = 60,
85
+ SH_21 = 61,
86
+ SH_22 = 62,
87
+ SH_23 = 63,
88
+ SH_24 = 64,
89
+ SH_25 = 65,
90
+ SH_26 = 66,
91
+ SH_27 = 67,
92
+ SH_28 = 68,
93
+ SH_29 = 69,
94
+ SH_30 = 70,
95
+ SH_31 = 71,
96
+ SH_32 = 72,
97
+ SH_33 = 73,
98
+ SH_34 = 74,
99
+ SH_35 = 75,
100
+ SH_36 = 76,
101
+ SH_37 = 77,
102
+ SH_38 = 78,
103
+ SH_39 = 79,
104
+ SH_40 = 80,
105
+ SH_41 = 81,
106
+ SH_42 = 82,
107
+ SH_43 = 83,
108
+ SH_44 = 84,
109
+ UNDEFINED = 85
59
110
  }
60
111
  /**
61
112
  * Property field found in PLY header
@@ -110,6 +161,18 @@ export interface PLYHeader {
110
161
  * buffer for the data view
111
162
  */
112
163
  buffer: ArrayBuffer;
164
+ /**
165
+ * degree of SH coefficients
166
+ */
167
+ shDegree: number;
168
+ /**
169
+ * number of coefficient per splat
170
+ */
171
+ shCoefficientCount: number;
172
+ /**
173
+ * buffer for SH coefficients
174
+ */
175
+ shBuffer: ArrayBuffer | null;
113
176
  }
114
177
  /**
115
178
  * Class used to render a gaussian splatting mesh
@@ -228,12 +291,26 @@ export declare class GaussianSplattingMesh extends Mesh {
228
291
  static ParseHeader(data: ArrayBuffer): PLYHeader | null;
229
292
  private static _GetCompressedChunks;
230
293
  private static _GetSplat;
294
+ /**
295
+ * Converts a .ply data with SH coefficients splat
296
+ * if data array buffer is not ply, returns the original buffer
297
+ * @param data the .ply data to load
298
+ * @param useCoroutine use coroutine and yield
299
+ * @returns the loaded splat buffer and optional array of sh coefficients
300
+ */
301
+ static ConvertPLYWithSHToSplat(data: ArrayBuffer, useCoroutine?: boolean): Generator<undefined, {
302
+ buffer: ArrayBuffer;
303
+ sh?: undefined;
304
+ } | {
305
+ buffer: ArrayBuffer;
306
+ sh: Uint8Array<ArrayBuffer>[] | null;
307
+ }, unknown>;
231
308
  /**
232
309
  * Converts a .ply data array buffer to splat
233
310
  * if data array buffer is not ply, returns the original buffer
234
311
  * @param data the .ply data to load
235
312
  * @param useCoroutine use coroutine and yield
236
- * @returns the loaded splat buffer
313
+ * @returns the loaded splat buffer without SH coefficient, whether ply contains or not SH.
237
314
  */
238
315
  static ConvertPLYToSplat(data: ArrayBuffer, useCoroutine?: boolean): Generator<undefined, ArrayBuffer, unknown>;
239
316
  /**
@@ -243,6 +320,19 @@ export declare class GaussianSplattingMesh extends Mesh {
243
320
  * @returns the loaded splat buffer
244
321
  */
245
322
  static ConvertPLYToSplatAsync(data: ArrayBuffer): Promise<ArrayBuffer>;
323
+ /**
324
+ * Converts a .ply with SH data array buffer to splat
325
+ * if data array buffer is not ply, returns the original buffer
326
+ * @param data the .ply data to load
327
+ * @returns the loaded splat buffer with SH
328
+ */
329
+ static ConvertPLYWithSHToSplatAsync(data: ArrayBuffer): Promise<{
330
+ buffer: ArrayBuffer;
331
+ sh?: undefined;
332
+ } | {
333
+ buffer: ArrayBuffer;
334
+ sh: Uint8Array<ArrayBuffer>[] | null;
335
+ }>;
246
336
  /**
247
337
  * Loads a .splat Gaussian Splatting array buffer asynchronously
248
338
  * @param data arraybuffer containing splat file
@@ -11,6 +11,7 @@ import "../thinInstanceMesh.js";
11
11
  import { ToHalfFloat } from "../../Misc/textureTools.js";
12
12
  import { Scalar } from "../../Maths/math.scalar.js";
13
13
  import { runCoroutineSync, runCoroutineAsync, createYieldingScheduler } from "../../Misc/coroutine.js";
14
+ import { EngineStore } from "../../Engines/engineStore.js";
14
15
  // @internal
15
16
  const unpackUnorm = (value, bits) => {
16
17
  const t = (1 << bits) - 1;
@@ -103,7 +104,58 @@ var PLYValue;
103
104
  PLYValue[PLYValue["ROT_1"] = 31] = "ROT_1";
104
105
  PLYValue[PLYValue["ROT_2"] = 32] = "ROT_2";
105
106
  PLYValue[PLYValue["ROT_3"] = 33] = "ROT_3";
106
- PLYValue[PLYValue["UNDEFINED"] = 34] = "UNDEFINED";
107
+ PLYValue[PLYValue["MIN_COLOR_R"] = 34] = "MIN_COLOR_R";
108
+ PLYValue[PLYValue["MIN_COLOR_G"] = 35] = "MIN_COLOR_G";
109
+ PLYValue[PLYValue["MIN_COLOR_B"] = 36] = "MIN_COLOR_B";
110
+ PLYValue[PLYValue["MAX_COLOR_R"] = 37] = "MAX_COLOR_R";
111
+ PLYValue[PLYValue["MAX_COLOR_G"] = 38] = "MAX_COLOR_G";
112
+ PLYValue[PLYValue["MAX_COLOR_B"] = 39] = "MAX_COLOR_B";
113
+ PLYValue[PLYValue["SH_0"] = 40] = "SH_0";
114
+ PLYValue[PLYValue["SH_1"] = 41] = "SH_1";
115
+ PLYValue[PLYValue["SH_2"] = 42] = "SH_2";
116
+ PLYValue[PLYValue["SH_3"] = 43] = "SH_3";
117
+ PLYValue[PLYValue["SH_4"] = 44] = "SH_4";
118
+ PLYValue[PLYValue["SH_5"] = 45] = "SH_5";
119
+ PLYValue[PLYValue["SH_6"] = 46] = "SH_6";
120
+ PLYValue[PLYValue["SH_7"] = 47] = "SH_7";
121
+ PLYValue[PLYValue["SH_8"] = 48] = "SH_8";
122
+ PLYValue[PLYValue["SH_9"] = 49] = "SH_9";
123
+ PLYValue[PLYValue["SH_10"] = 50] = "SH_10";
124
+ PLYValue[PLYValue["SH_11"] = 51] = "SH_11";
125
+ PLYValue[PLYValue["SH_12"] = 52] = "SH_12";
126
+ PLYValue[PLYValue["SH_13"] = 53] = "SH_13";
127
+ PLYValue[PLYValue["SH_14"] = 54] = "SH_14";
128
+ PLYValue[PLYValue["SH_15"] = 55] = "SH_15";
129
+ PLYValue[PLYValue["SH_16"] = 56] = "SH_16";
130
+ PLYValue[PLYValue["SH_17"] = 57] = "SH_17";
131
+ PLYValue[PLYValue["SH_18"] = 58] = "SH_18";
132
+ PLYValue[PLYValue["SH_19"] = 59] = "SH_19";
133
+ PLYValue[PLYValue["SH_20"] = 60] = "SH_20";
134
+ PLYValue[PLYValue["SH_21"] = 61] = "SH_21";
135
+ PLYValue[PLYValue["SH_22"] = 62] = "SH_22";
136
+ PLYValue[PLYValue["SH_23"] = 63] = "SH_23";
137
+ PLYValue[PLYValue["SH_24"] = 64] = "SH_24";
138
+ PLYValue[PLYValue["SH_25"] = 65] = "SH_25";
139
+ PLYValue[PLYValue["SH_26"] = 66] = "SH_26";
140
+ PLYValue[PLYValue["SH_27"] = 67] = "SH_27";
141
+ PLYValue[PLYValue["SH_28"] = 68] = "SH_28";
142
+ PLYValue[PLYValue["SH_29"] = 69] = "SH_29";
143
+ PLYValue[PLYValue["SH_30"] = 70] = "SH_30";
144
+ PLYValue[PLYValue["SH_31"] = 71] = "SH_31";
145
+ PLYValue[PLYValue["SH_32"] = 72] = "SH_32";
146
+ PLYValue[PLYValue["SH_33"] = 73] = "SH_33";
147
+ PLYValue[PLYValue["SH_34"] = 74] = "SH_34";
148
+ PLYValue[PLYValue["SH_35"] = 75] = "SH_35";
149
+ PLYValue[PLYValue["SH_36"] = 76] = "SH_36";
150
+ PLYValue[PLYValue["SH_37"] = 77] = "SH_37";
151
+ PLYValue[PLYValue["SH_38"] = 78] = "SH_38";
152
+ PLYValue[PLYValue["SH_39"] = 79] = "SH_39";
153
+ PLYValue[PLYValue["SH_40"] = 80] = "SH_40";
154
+ PLYValue[PLYValue["SH_41"] = 81] = "SH_41";
155
+ PLYValue[PLYValue["SH_42"] = 82] = "SH_42";
156
+ PLYValue[PLYValue["SH_43"] = 83] = "SH_43";
157
+ PLYValue[PLYValue["SH_44"] = 84] = "SH_44";
158
+ PLYValue[PLYValue["UNDEFINED"] = 85] = "UNDEFINED";
107
159
  })(PLYValue || (PLYValue = {}));
108
160
  /**
109
161
  * Class used to render a gaussian splatting mesh
@@ -371,8 +423,110 @@ export class GaussianSplattingMesh extends Mesh {
371
423
  return 32 /* PLYValue.ROT_2 */;
372
424
  case "rot_3":
373
425
  return 33 /* PLYValue.ROT_3 */;
426
+ case "min_r":
427
+ return 34 /* PLYValue.MIN_COLOR_R */;
428
+ case "min_g":
429
+ return 35 /* PLYValue.MIN_COLOR_G */;
430
+ case "min_b":
431
+ return 36 /* PLYValue.MIN_COLOR_B */;
432
+ case "max_r":
433
+ return 37 /* PLYValue.MAX_COLOR_R */;
434
+ case "max_g":
435
+ return 38 /* PLYValue.MAX_COLOR_G */;
436
+ case "max_b":
437
+ return 39 /* PLYValue.MAX_COLOR_B */;
438
+ case "f_rest_0":
439
+ return 40 /* PLYValue.SH_0 */;
440
+ case "f_rest_1":
441
+ return 41 /* PLYValue.SH_1 */;
442
+ case "f_rest_2":
443
+ return 42 /* PLYValue.SH_2 */;
444
+ case "f_rest_3":
445
+ return 43 /* PLYValue.SH_3 */;
446
+ case "f_rest_4":
447
+ return 44 /* PLYValue.SH_4 */;
448
+ case "f_rest_5":
449
+ return 45 /* PLYValue.SH_5 */;
450
+ case "f_rest_6":
451
+ return 46 /* PLYValue.SH_6 */;
452
+ case "f_rest_7":
453
+ return 47 /* PLYValue.SH_7 */;
454
+ case "f_rest_8":
455
+ return 48 /* PLYValue.SH_8 */;
456
+ case "f_rest_9":
457
+ return 49 /* PLYValue.SH_9 */;
458
+ case "f_rest_10":
459
+ return 50 /* PLYValue.SH_10 */;
460
+ case "f_rest_11":
461
+ return 51 /* PLYValue.SH_11 */;
462
+ case "f_rest_12":
463
+ return 52 /* PLYValue.SH_12 */;
464
+ case "f_rest_13":
465
+ return 53 /* PLYValue.SH_13 */;
466
+ case "f_rest_14":
467
+ return 54 /* PLYValue.SH_14 */;
468
+ case "f_rest_15":
469
+ return 55 /* PLYValue.SH_15 */;
470
+ case "f_rest_16":
471
+ return 56 /* PLYValue.SH_16 */;
472
+ case "f_rest_17":
473
+ return 57 /* PLYValue.SH_17 */;
474
+ case "f_rest_18":
475
+ return 58 /* PLYValue.SH_18 */;
476
+ case "f_rest_19":
477
+ return 59 /* PLYValue.SH_19 */;
478
+ case "f_rest_20":
479
+ return 60 /* PLYValue.SH_20 */;
480
+ case "f_rest_21":
481
+ return 61 /* PLYValue.SH_21 */;
482
+ case "f_rest_22":
483
+ return 62 /* PLYValue.SH_22 */;
484
+ case "f_rest_23":
485
+ return 63 /* PLYValue.SH_23 */;
486
+ case "f_rest_24":
487
+ return 64 /* PLYValue.SH_24 */;
488
+ case "f_rest_25":
489
+ return 65 /* PLYValue.SH_25 */;
490
+ case "f_rest_26":
491
+ return 66 /* PLYValue.SH_26 */;
492
+ case "f_rest_27":
493
+ return 67 /* PLYValue.SH_27 */;
494
+ case "f_rest_28":
495
+ return 68 /* PLYValue.SH_28 */;
496
+ case "f_rest_29":
497
+ return 69 /* PLYValue.SH_29 */;
498
+ case "f_rest_30":
499
+ return 70 /* PLYValue.SH_30 */;
500
+ case "f_rest_31":
501
+ return 71 /* PLYValue.SH_31 */;
502
+ case "f_rest_32":
503
+ return 72 /* PLYValue.SH_32 */;
504
+ case "f_rest_33":
505
+ return 73 /* PLYValue.SH_33 */;
506
+ case "f_rest_34":
507
+ return 74 /* PLYValue.SH_34 */;
508
+ case "f_rest_35":
509
+ return 75 /* PLYValue.SH_35 */;
510
+ case "f_rest_36":
511
+ return 76 /* PLYValue.SH_36 */;
512
+ case "f_rest_37":
513
+ return 77 /* PLYValue.SH_37 */;
514
+ case "f_rest_38":
515
+ return 78 /* PLYValue.SH_38 */;
516
+ case "f_rest_39":
517
+ return 79 /* PLYValue.SH_39 */;
518
+ case "f_rest_40":
519
+ return 80 /* PLYValue.SH_40 */;
520
+ case "f_rest_41":
521
+ return 81 /* PLYValue.SH_41 */;
522
+ case "f_rest_42":
523
+ return 82 /* PLYValue.SH_42 */;
524
+ case "f_rest_43":
525
+ return 83 /* PLYValue.SH_43 */;
526
+ case "f_rest_44":
527
+ return 84 /* PLYValue.SH_44 */;
374
528
  }
375
- return 34 /* PLYValue.UNDEFINED */;
529
+ return 85 /* PLYValue.UNDEFINED */;
376
530
  }
377
531
  /**
378
532
  * Parse a PLY file header and returns metas infos on splats and chunks
@@ -415,10 +569,21 @@ export class GaussianSplattingMesh extends Mesh {
415
569
  const vertexProperties = [];
416
570
  const chunkProperties = [];
417
571
  const filtered = header.slice(0, headerEndIndex).split("\n");
572
+ let shDegree = 0;
418
573
  for (const prop of filtered) {
419
574
  if (prop.startsWith("property ")) {
420
575
  const [, typeName, name] = prop.split(" ");
421
576
  const value = GaussianSplattingMesh._ValueNameToEnum(name);
577
+ // SH degree 1,2 or 3 for 9, 24 or 45 values
578
+ if (value >= 84 /* PLYValue.SH_44 */) {
579
+ shDegree = 3;
580
+ }
581
+ else if (value >= 64 /* PLYValue.SH_24 */) {
582
+ shDegree = 2;
583
+ }
584
+ else if (value >= 48 /* PLYValue.SH_8 */) {
585
+ shDegree = 1;
586
+ }
422
587
  const type = GaussianSplattingMesh._TypeNameToEnum(typeName);
423
588
  if (chunkMode == 1 /* ElementMode.Chunk */) {
424
589
  chunkProperties.push({ value, type, offset: rowChunkOffset });
@@ -444,6 +609,13 @@ export class GaussianSplattingMesh extends Mesh {
444
609
  }
445
610
  const dataView = new DataView(data, headerEndIndex + headerEnd.length);
446
611
  const buffer = new ArrayBuffer(GaussianSplattingMesh._RowOutputLength * vertexCount);
612
+ let shBuffer = null;
613
+ let shCoefficientCount = 0;
614
+ if (shDegree) {
615
+ const shVectorCount = (shDegree + 1) * (shDegree + 1) - 1;
616
+ shCoefficientCount = shVectorCount * 3;
617
+ shBuffer = new ArrayBuffer(shCoefficientCount * vertexCount);
618
+ }
447
619
  return {
448
620
  vertexCount: vertexCount,
449
621
  chunkCount: chunkCount,
@@ -453,6 +625,9 @@ export class GaussianSplattingMesh extends Mesh {
453
625
  chunkProperties: chunkProperties,
454
626
  dataView: dataView,
455
627
  buffer: buffer,
628
+ shDegree: shDegree,
629
+ shCoefficientCount: shCoefficientCount,
630
+ shBuffer: shBuffer,
456
631
  };
457
632
  }
458
633
  static _GetCompressedChunks(header, offset) {
@@ -462,7 +637,14 @@ export class GaussianSplattingMesh extends Mesh {
462
637
  const dataView = header.dataView;
463
638
  const compressedChunks = new Array(header.chunkCount);
464
639
  for (let i = 0; i < header.chunkCount; i++) {
465
- const currentChunk = { min: new Vector3(), max: new Vector3(), minScale: new Vector3(), maxScale: new Vector3() };
640
+ const currentChunk = {
641
+ min: new Vector3(),
642
+ max: new Vector3(),
643
+ minScale: new Vector3(),
644
+ maxScale: new Vector3(),
645
+ minColor: new Vector3(0, 0, 0),
646
+ maxColor: new Vector3(1, 1, 1),
647
+ };
466
648
  compressedChunks[i] = currentChunk;
467
649
  for (let propertyIndex = 0; propertyIndex < header.chunkProperties.length; propertyIndex++) {
468
650
  const property = header.chunkProperties[propertyIndex];
@@ -511,6 +693,24 @@ export class GaussianSplattingMesh extends Mesh {
511
693
  case 11 /* PLYValue.MAX_SCALE_Z */:
512
694
  currentChunk.maxScale.z = value;
513
695
  break;
696
+ case 34 /* PLYValue.MIN_COLOR_R */:
697
+ currentChunk.minColor.x = value;
698
+ break;
699
+ case 35 /* PLYValue.MIN_COLOR_G */:
700
+ currentChunk.minColor.y = value;
701
+ break;
702
+ case 36 /* PLYValue.MIN_COLOR_B */:
703
+ currentChunk.minColor.z = value;
704
+ break;
705
+ case 37 /* PLYValue.MAX_COLOR_R */:
706
+ currentChunk.maxColor.x = value;
707
+ break;
708
+ case 38 /* PLYValue.MAX_COLOR_G */:
709
+ currentChunk.maxColor.y = value;
710
+ break;
711
+ case 39 /* PLYValue.MAX_COLOR_B */:
712
+ currentChunk.maxColor.z = value;
713
+ break;
514
714
  }
515
715
  }
516
716
  offset.value += header.rowChunkLength;
@@ -527,6 +727,10 @@ export class GaussianSplattingMesh extends Mesh {
527
727
  const scale = new Float32Array(buffer, index * rowOutputLength + 12, 3);
528
728
  const rgba = new Uint8ClampedArray(buffer, index * rowOutputLength + 24, 4);
529
729
  const rot = new Uint8ClampedArray(buffer, index * rowOutputLength + 28, 4);
730
+ let sh = null;
731
+ if (header.shBuffer) {
732
+ sh = new Uint8ClampedArray(header.shBuffer, index * header.shCoefficientCount, header.shCoefficientCount);
733
+ }
530
734
  const chunkIndex = index >> 8;
531
735
  let r0 = 255;
532
736
  let r1 = 0;
@@ -560,7 +764,7 @@ export class GaussianSplattingMesh extends Mesh {
560
764
  const compressedChunk = compressedChunks[chunkIndex];
561
765
  unpack111011(value, temp3);
562
766
  position[0] = Scalar.Lerp(compressedChunk.min.x, compressedChunk.max.x, temp3.x);
563
- position[1] = -Scalar.Lerp(compressedChunk.min.y, compressedChunk.max.y, temp3.y);
767
+ position[1] = Scalar.Lerp(compressedChunk.min.y, compressedChunk.max.y, temp3.y);
564
768
  position[2] = Scalar.Lerp(compressedChunk.min.z, compressedChunk.max.z, temp3.z);
565
769
  }
566
770
  break;
@@ -568,9 +772,9 @@ export class GaussianSplattingMesh extends Mesh {
568
772
  {
569
773
  unpackRot(value, q);
570
774
  r0 = q.w;
571
- r1 = q.z;
775
+ r1 = -q.z;
572
776
  r2 = q.y;
573
- r3 = q.x;
777
+ r3 = -q.x;
574
778
  }
575
779
  break;
576
780
  case 14 /* PLYValue.PACKED_SCALE */:
@@ -583,7 +787,13 @@ export class GaussianSplattingMesh extends Mesh {
583
787
  }
584
788
  break;
585
789
  case 15 /* PLYValue.PACKED_COLOR */:
586
- unpack8888(value, rgba);
790
+ {
791
+ const compressedChunk = compressedChunks[chunkIndex];
792
+ unpack8888(value, rgba);
793
+ rgba[0] = Scalar.Lerp(compressedChunk.minColor.x, compressedChunk.maxColor.x, rgba[0] / 255) * 255;
794
+ rgba[1] = Scalar.Lerp(compressedChunk.minColor.y, compressedChunk.maxColor.y, rgba[1] / 255) * 255;
795
+ rgba[2] = Scalar.Lerp(compressedChunk.minColor.z, compressedChunk.maxColor.z, rgba[2] / 255) * 255;
796
+ }
587
797
  break;
588
798
  case 16 /* PLYValue.X */:
589
799
  position[0] = value;
@@ -640,6 +850,11 @@ export class GaussianSplattingMesh extends Mesh {
640
850
  r3 = value;
641
851
  break;
642
852
  }
853
+ if (sh && property.value >= 40 /* PLYValue.SH_0 */ && property.value <= 84 /* PLYValue.SH_44 */) {
854
+ const clampedValue = Scalar.Clamp(value * 127.5 + 127.5, 0, 255);
855
+ const shIndex = property.value - 40 /* PLYValue.SH_0 */;
856
+ sh[shIndex] = clampedValue;
857
+ }
643
858
  }
644
859
  q.set(r1, r2, r3, r0);
645
860
  q.normalize();
@@ -649,12 +864,64 @@ export class GaussianSplattingMesh extends Mesh {
649
864
  rot[3] = q.z * 128 + 128;
650
865
  offset.value += header.rowVertexLength;
651
866
  }
867
+ /**
868
+ * Converts a .ply data with SH coefficients splat
869
+ * if data array buffer is not ply, returns the original buffer
870
+ * @param data the .ply data to load
871
+ * @param useCoroutine use coroutine and yield
872
+ * @returns the loaded splat buffer and optional array of sh coefficients
873
+ */
874
+ static *ConvertPLYWithSHToSplat(data, useCoroutine = false) {
875
+ const header = GaussianSplattingMesh.ParseHeader(data);
876
+ if (!header) {
877
+ return { buffer: data };
878
+ }
879
+ const offset = { value: 0 };
880
+ const compressedChunks = GaussianSplattingMesh._GetCompressedChunks(header, offset);
881
+ for (let i = 0; i < header.vertexCount; i++) {
882
+ GaussianSplattingMesh._GetSplat(header, i, compressedChunks, offset);
883
+ if (i % GaussianSplattingMesh._PlyConversionBatchSize === 0 && useCoroutine) {
884
+ yield;
885
+ }
886
+ }
887
+ let sh = null;
888
+ // make SH texture buffers
889
+ if (header.shDegree && header.shBuffer) {
890
+ const textureCount = Math.ceil(header.shCoefficientCount / 16); // 4 components can be stored per texture, 4 sh per component
891
+ let shIndexRead = 0;
892
+ const ubuf = new Uint8Array(header.shBuffer);
893
+ // sh is an array of uint8array that will be used to create sh textures
894
+ sh = [];
895
+ const splatCount = header.vertexCount;
896
+ const engine = EngineStore.LastCreatedEngine;
897
+ if (engine) {
898
+ const width = engine.getCaps().maxTextureSize;
899
+ const height = Math.ceil(splatCount / width);
900
+ // create array for the number of textures needed.
901
+ for (let textureIndex = 0; textureIndex < textureCount; textureIndex++) {
902
+ const texture = new Uint8Array(height * width * 4 * 4); // 4 components per texture, 4 sh per component
903
+ sh.push(texture);
904
+ }
905
+ for (let i = 0; i < splatCount; i++) {
906
+ for (let shIndexWrite = 0; shIndexWrite < header.shCoefficientCount; shIndexWrite++) {
907
+ const shValue = ubuf[shIndexRead++];
908
+ const textureIndex = Math.floor(shIndexWrite / 16);
909
+ const shArray = sh[textureIndex];
910
+ const byteIndexInTexture = shIndexWrite % 16; // [0..15]
911
+ const offsetPerSplat = i * 16; // 16 sh values per texture per splat.
912
+ shArray[byteIndexInTexture + offsetPerSplat] = shValue;
913
+ }
914
+ }
915
+ }
916
+ }
917
+ return { buffer: header.buffer, sh: sh };
918
+ }
652
919
  /**
653
920
  * Converts a .ply data array buffer to splat
654
921
  * if data array buffer is not ply, returns the original buffer
655
922
  * @param data the .ply data to load
656
923
  * @param useCoroutine use coroutine and yield
657
- * @returns the loaded splat buffer
924
+ * @returns the loaded splat buffer without SH coefficient, whether ply contains or not SH.
658
925
  */
659
926
  static *ConvertPLYToSplat(data, useCoroutine = false) {
660
927
  const header = GaussianSplattingMesh.ParseHeader(data);
@@ -680,6 +947,15 @@ export class GaussianSplattingMesh extends Mesh {
680
947
  static async ConvertPLYToSplatAsync(data) {
681
948
  return runCoroutineAsync(GaussianSplattingMesh.ConvertPLYToSplat(data, true), createYieldingScheduler());
682
949
  }
950
+ /**
951
+ * Converts a .ply with SH data array buffer to splat
952
+ * if data array buffer is not ply, returns the original buffer
953
+ * @param data the .ply data to load
954
+ * @returns the loaded splat buffer with SH
955
+ */
956
+ static async ConvertPLYWithSHToSplatAsync(data) {
957
+ return runCoroutineAsync(GaussianSplattingMesh.ConvertPLYWithSHToSplat(data, true), createYieldingScheduler());
958
+ }
683
959
  /**
684
960
  * Loads a .splat Gaussian Splatting array buffer asynchronously
685
961
  * @param data arraybuffer containing splat file
@@ -696,8 +972,8 @@ export class GaussianSplattingMesh extends Mesh {
696
972
  */
697
973
  loadFileAsync(url) {
698
974
  return Tools.LoadFileAsync(url, true).then(async (plyBuffer) => {
699
- GaussianSplattingMesh.ConvertPLYToSplatAsync(plyBuffer).then((splatsData) => {
700
- this.updateDataAsync(splatsData);
975
+ GaussianSplattingMesh.ConvertPLYWithSHToSplatAsync(plyBuffer).then((splatsData) => {
976
+ this.updateDataAsync(splatsData.buffer, splatsData.sh);
701
977
  });
702
978
  });
703
979
  }