@onerjs/loaders 8.23.1

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 (280) hide show
  1. package/OBJ/index.d.ts +4 -0
  2. package/OBJ/index.js +5 -0
  3. package/OBJ/index.js.map +1 -0
  4. package/OBJ/mtlFileLoader.d.ts +41 -0
  5. package/OBJ/mtlFileLoader.js +231 -0
  6. package/OBJ/mtlFileLoader.js.map +1 -0
  7. package/OBJ/objFileLoader.d.ts +136 -0
  8. package/OBJ/objFileLoader.js +318 -0
  9. package/OBJ/objFileLoader.js.map +1 -0
  10. package/OBJ/objFileLoader.metadata.d.ts +4 -0
  11. package/OBJ/objFileLoader.metadata.js +5 -0
  12. package/OBJ/objFileLoader.metadata.js.map +1 -0
  13. package/OBJ/objLoadingOptions.d.ts +47 -0
  14. package/OBJ/objLoadingOptions.js +2 -0
  15. package/OBJ/objLoadingOptions.js.map +1 -0
  16. package/OBJ/solidParser.d.ts +174 -0
  17. package/OBJ/solidParser.js +862 -0
  18. package/OBJ/solidParser.js.map +1 -0
  19. package/SPLAT/index.d.ts +2 -0
  20. package/SPLAT/index.js +4 -0
  21. package/SPLAT/index.js.map +1 -0
  22. package/SPLAT/splatFileLoader.d.ts +88 -0
  23. package/SPLAT/splatFileLoader.js +562 -0
  24. package/SPLAT/splatFileLoader.js.map +1 -0
  25. package/SPLAT/splatFileLoader.metadata.d.ts +14 -0
  26. package/SPLAT/splatFileLoader.metadata.js +12 -0
  27. package/SPLAT/splatFileLoader.metadata.js.map +1 -0
  28. package/SPLAT/splatLoadingOptions.d.ts +13 -0
  29. package/SPLAT/splatLoadingOptions.js +2 -0
  30. package/SPLAT/splatLoadingOptions.js.map +1 -0
  31. package/STL/index.d.ts +1 -0
  32. package/STL/index.js +2 -0
  33. package/STL/index.js.map +1 -0
  34. package/STL/stlFileLoader.d.ts +78 -0
  35. package/STL/stlFileLoader.js +239 -0
  36. package/STL/stlFileLoader.js.map +1 -0
  37. package/STL/stlFileLoader.metadata.d.ts +8 -0
  38. package/STL/stlFileLoader.metadata.js +8 -0
  39. package/STL/stlFileLoader.metadata.js.map +1 -0
  40. package/bvh/bvhFileLoader.d.ts +69 -0
  41. package/bvh/bvhFileLoader.js +133 -0
  42. package/bvh/bvhFileLoader.js.map +1 -0
  43. package/bvh/bvhFileLoader.metadata.d.ts +8 -0
  44. package/bvh/bvhFileLoader.metadata.js +8 -0
  45. package/bvh/bvhFileLoader.metadata.js.map +1 -0
  46. package/bvh/bvhLoader.d.ts +14 -0
  47. package/bvh/bvhLoader.js +329 -0
  48. package/bvh/bvhLoader.js.map +1 -0
  49. package/bvh/bvhLoadingOptions.d.ts +9 -0
  50. package/bvh/bvhLoadingOptions.js +2 -0
  51. package/bvh/bvhLoadingOptions.js.map +1 -0
  52. package/bvh/index.d.ts +2 -0
  53. package/bvh/index.js +4 -0
  54. package/bvh/index.js.map +1 -0
  55. package/bvh/license.md +21 -0
  56. package/dynamic.d.ts +5 -0
  57. package/dynamic.js +57 -0
  58. package/dynamic.js.map +1 -0
  59. package/glTF/1.0/glTFBinaryExtension.d.ts +16 -0
  60. package/glTF/1.0/glTFBinaryExtension.js +65 -0
  61. package/glTF/1.0/glTFBinaryExtension.js.map +1 -0
  62. package/glTF/1.0/glTFLoader.d.ts +144 -0
  63. package/glTF/1.0/glTFLoader.js +1841 -0
  64. package/glTF/1.0/glTFLoader.js.map +1 -0
  65. package/glTF/1.0/glTFLoaderInterfaces.d.ts +412 -0
  66. package/glTF/1.0/glTFLoaderInterfaces.js +96 -0
  67. package/glTF/1.0/glTFLoaderInterfaces.js.map +1 -0
  68. package/glTF/1.0/glTFLoaderUtils.d.ts +71 -0
  69. package/glTF/1.0/glTFLoaderUtils.js +255 -0
  70. package/glTF/1.0/glTFLoaderUtils.js.map +1 -0
  71. package/glTF/1.0/glTFMaterialsCommonExtension.d.ts +13 -0
  72. package/glTF/1.0/glTFMaterialsCommonExtension.js +131 -0
  73. package/glTF/1.0/glTFMaterialsCommonExtension.js.map +1 -0
  74. package/glTF/1.0/index.d.ts +5 -0
  75. package/glTF/1.0/index.js +6 -0
  76. package/glTF/1.0/index.js.map +1 -0
  77. package/glTF/2.0/Extensions/EXT_lights_ies.d.ts +41 -0
  78. package/glTF/2.0/Extensions/EXT_lights_ies.js +84 -0
  79. package/glTF/2.0/Extensions/EXT_lights_ies.js.map +1 -0
  80. package/glTF/2.0/Extensions/EXT_lights_image_based.d.ts +48 -0
  81. package/glTF/2.0/Extensions/EXT_lights_image_based.js +116 -0
  82. package/glTF/2.0/Extensions/EXT_lights_image_based.js.map +1 -0
  83. package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.d.ts +43 -0
  84. package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.js +69 -0
  85. package/glTF/2.0/Extensions/EXT_materials_diffuse_roughness.js.map +1 -0
  86. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.d.ts +39 -0
  87. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js +82 -0
  88. package/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js.map +1 -0
  89. package/glTF/2.0/Extensions/EXT_meshopt_compression.d.ts +39 -0
  90. package/glTF/2.0/Extensions/EXT_meshopt_compression.js +51 -0
  91. package/glTF/2.0/Extensions/EXT_meshopt_compression.js.map +1 -0
  92. package/glTF/2.0/Extensions/EXT_texture_avif.d.ts +34 -0
  93. package/glTF/2.0/Extensions/EXT_texture_avif.js +39 -0
  94. package/glTF/2.0/Extensions/EXT_texture_avif.js.map +1 -0
  95. package/glTF/2.0/Extensions/EXT_texture_webp.d.ts +33 -0
  96. package/glTF/2.0/Extensions/EXT_texture_webp.js +38 -0
  97. package/glTF/2.0/Extensions/EXT_texture_webp.js.map +1 -0
  98. package/glTF/2.0/Extensions/ExtrasAsMetadata.d.ts +48 -0
  99. package/glTF/2.0/Extensions/ExtrasAsMetadata.js +63 -0
  100. package/glTF/2.0/Extensions/ExtrasAsMetadata.js.map +1 -0
  101. package/glTF/2.0/Extensions/KHR_animation_pointer.d.ts +47 -0
  102. package/glTF/2.0/Extensions/KHR_animation_pointer.data.d.ts +1 -0
  103. package/glTF/2.0/Extensions/KHR_animation_pointer.data.js +239 -0
  104. package/glTF/2.0/Extensions/KHR_animation_pointer.data.js.map +1 -0
  105. package/glTF/2.0/Extensions/KHR_animation_pointer.js +78 -0
  106. package/glTF/2.0/Extensions/KHR_animation_pointer.js.map +1 -0
  107. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.d.ts +47 -0
  108. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js +93 -0
  109. package/glTF/2.0/Extensions/KHR_draco_mesh_compression.js.map +1 -0
  110. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.d.ts +352 -0
  111. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js +1700 -0
  112. package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js.map +1 -0
  113. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.d.ts +33 -0
  114. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js +20 -0
  115. package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js.map +1 -0
  116. package/glTF/2.0/Extensions/KHR_interactivity/index.d.ts +3 -0
  117. package/glTF/2.0/Extensions/KHR_interactivity/index.js +4 -0
  118. package/glTF/2.0/Extensions/KHR_interactivity/index.js.map +1 -0
  119. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.d.ts +70 -0
  120. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js +450 -0
  121. package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js.map +1 -0
  122. package/glTF/2.0/Extensions/KHR_interactivity.d.ts +38 -0
  123. package/glTF/2.0/Extensions/KHR_interactivity.js +151 -0
  124. package/glTF/2.0/Extensions/KHR_interactivity.js.map +1 -0
  125. package/glTF/2.0/Extensions/KHR_lights_punctual.d.ts +41 -0
  126. package/glTF/2.0/Extensions/KHR_lights_punctual.js +92 -0
  127. package/glTF/2.0/Extensions/KHR_lights_punctual.js.map +1 -0
  128. package/glTF/2.0/Extensions/KHR_materials_anisotropy.d.ts +42 -0
  129. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js +61 -0
  130. package/glTF/2.0/Extensions/KHR_materials_anisotropy.js.map +1 -0
  131. package/glTF/2.0/Extensions/KHR_materials_clearcoat.d.ts +43 -0
  132. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js +94 -0
  133. package/glTF/2.0/Extensions/KHR_materials_clearcoat.js.map +1 -0
  134. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.d.ts +43 -0
  135. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js +95 -0
  136. package/glTF/2.0/Extensions/KHR_materials_diffuse_transmission.js.map +1 -0
  137. package/glTF/2.0/Extensions/KHR_materials_dispersion.d.ts +43 -0
  138. package/glTF/2.0/Extensions/KHR_materials_dispersion.js +60 -0
  139. package/glTF/2.0/Extensions/KHR_materials_dispersion.js.map +1 -0
  140. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.d.ts +42 -0
  141. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js +52 -0
  142. package/glTF/2.0/Extensions/KHR_materials_emissive_strength.js.map +1 -0
  143. package/glTF/2.0/Extensions/KHR_materials_ior.d.ts +46 -0
  144. package/glTF/2.0/Extensions/KHR_materials_ior.js +62 -0
  145. package/glTF/2.0/Extensions/KHR_materials_ior.js.map +1 -0
  146. package/glTF/2.0/Extensions/KHR_materials_iridescence.d.ts +42 -0
  147. package/glTF/2.0/Extensions/KHR_materials_iridescence.js +71 -0
  148. package/glTF/2.0/Extensions/KHR_materials_iridescence.js.map +1 -0
  149. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.d.ts +42 -0
  150. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js +81 -0
  151. package/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js.map +1 -0
  152. package/glTF/2.0/Extensions/KHR_materials_sheen.d.ts +43 -0
  153. package/glTF/2.0/Extensions/KHR_materials_sheen.js +85 -0
  154. package/glTF/2.0/Extensions/KHR_materials_sheen.js.map +1 -0
  155. package/glTF/2.0/Extensions/KHR_materials_specular.d.ts +42 -0
  156. package/glTF/2.0/Extensions/KHR_materials_specular.js +85 -0
  157. package/glTF/2.0/Extensions/KHR_materials_specular.js.map +1 -0
  158. package/glTF/2.0/Extensions/KHR_materials_transmission.d.ts +42 -0
  159. package/glTF/2.0/Extensions/KHR_materials_transmission.js +306 -0
  160. package/glTF/2.0/Extensions/KHR_materials_transmission.js.map +1 -0
  161. package/glTF/2.0/Extensions/KHR_materials_unlit.d.ts +42 -0
  162. package/glTF/2.0/Extensions/KHR_materials_unlit.js +73 -0
  163. package/glTF/2.0/Extensions/KHR_materials_unlit.js.map +1 -0
  164. package/glTF/2.0/Extensions/KHR_materials_variants.d.ts +112 -0
  165. package/glTF/2.0/Extensions/KHR_materials_variants.js +263 -0
  166. package/glTF/2.0/Extensions/KHR_materials_variants.js.map +1 -0
  167. package/glTF/2.0/Extensions/KHR_materials_volume.d.ts +43 -0
  168. package/glTF/2.0/Extensions/KHR_materials_volume.js +86 -0
  169. package/glTF/2.0/Extensions/KHR_materials_volume.js.map +1 -0
  170. package/glTF/2.0/Extensions/KHR_mesh_quantization.d.ts +29 -0
  171. package/glTF/2.0/Extensions/KHR_mesh_quantization.js +23 -0
  172. package/glTF/2.0/Extensions/KHR_mesh_quantization.js.map +1 -0
  173. package/glTF/2.0/Extensions/KHR_node_hoverability.d.ts +31 -0
  174. package/glTF/2.0/Extensions/KHR_node_hoverability.js +190 -0
  175. package/glTF/2.0/Extensions/KHR_node_hoverability.js.map +1 -0
  176. package/glTF/2.0/Extensions/KHR_node_selectability.d.ts +30 -0
  177. package/glTF/2.0/Extensions/KHR_node_selectability.js +124 -0
  178. package/glTF/2.0/Extensions/KHR_node_selectability.js.map +1 -0
  179. package/glTF/2.0/Extensions/KHR_node_visibility.d.ts +30 -0
  180. package/glTF/2.0/Extensions/KHR_node_visibility.js +69 -0
  181. package/glTF/2.0/Extensions/KHR_node_visibility.js.map +1 -0
  182. package/glTF/2.0/Extensions/KHR_texture_basisu.d.ts +33 -0
  183. package/glTF/2.0/Extensions/KHR_texture_basisu.js +38 -0
  184. package/glTF/2.0/Extensions/KHR_texture_basisu.js.map +1 -0
  185. package/glTF/2.0/Extensions/KHR_texture_transform.d.ts +37 -0
  186. package/glTF/2.0/Extensions/KHR_texture_transform.js +59 -0
  187. package/glTF/2.0/Extensions/KHR_texture_transform.js.map +1 -0
  188. package/glTF/2.0/Extensions/KHR_xmp_json_ld.d.ts +39 -0
  189. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js +48 -0
  190. package/glTF/2.0/Extensions/KHR_xmp_json_ld.js.map +1 -0
  191. package/glTF/2.0/Extensions/MSFT_audio_emitter.d.ts +56 -0
  192. package/glTF/2.0/Extensions/MSFT_audio_emitter.js +227 -0
  193. package/glTF/2.0/Extensions/MSFT_audio_emitter.js.map +1 -0
  194. package/glTF/2.0/Extensions/MSFT_lod.d.ts +104 -0
  195. package/glTF/2.0/Extensions/MSFT_lod.js +338 -0
  196. package/glTF/2.0/Extensions/MSFT_lod.js.map +1 -0
  197. package/glTF/2.0/Extensions/MSFT_minecraftMesh.d.ts +27 -0
  198. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js +41 -0
  199. package/glTF/2.0/Extensions/MSFT_minecraftMesh.js.map +1 -0
  200. package/glTF/2.0/Extensions/MSFT_sRGBFactors.d.ts +27 -0
  201. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js +42 -0
  202. package/glTF/2.0/Extensions/MSFT_sRGBFactors.js.map +1 -0
  203. package/glTF/2.0/Extensions/dynamic.d.ts +4 -0
  204. package/glTF/2.0/Extensions/dynamic.js +156 -0
  205. package/glTF/2.0/Extensions/dynamic.js.map +1 -0
  206. package/glTF/2.0/Extensions/gltfPathToObjectConverter.d.ts +45 -0
  207. package/glTF/2.0/Extensions/gltfPathToObjectConverter.js +101 -0
  208. package/glTF/2.0/Extensions/gltfPathToObjectConverter.js.map +1 -0
  209. package/glTF/2.0/Extensions/index.d.ts +39 -0
  210. package/glTF/2.0/Extensions/index.js +41 -0
  211. package/glTF/2.0/Extensions/index.js.map +1 -0
  212. package/glTF/2.0/Extensions/objectModelMapping.d.ts +289 -0
  213. package/glTF/2.0/Extensions/objectModelMapping.js +828 -0
  214. package/glTF/2.0/Extensions/objectModelMapping.js.map +1 -0
  215. package/glTF/2.0/glTFLoader.d.ts +429 -0
  216. package/glTF/2.0/glTFLoader.js +2408 -0
  217. package/glTF/2.0/glTFLoader.js.map +1 -0
  218. package/glTF/2.0/glTFLoaderAnimation.d.ts +42 -0
  219. package/glTF/2.0/glTFLoaderAnimation.js +80 -0
  220. package/glTF/2.0/glTFLoaderAnimation.js.map +1 -0
  221. package/glTF/2.0/glTFLoaderExtension.d.ts +165 -0
  222. package/glTF/2.0/glTFLoaderExtension.js +2 -0
  223. package/glTF/2.0/glTFLoaderExtension.js.map +1 -0
  224. package/glTF/2.0/glTFLoaderExtensionRegistry.d.ts +25 -0
  225. package/glTF/2.0/glTFLoaderExtensionRegistry.js +33 -0
  226. package/glTF/2.0/glTFLoaderExtensionRegistry.js.map +1 -0
  227. package/glTF/2.0/glTFLoaderInterfaces.d.ts +257 -0
  228. package/glTF/2.0/glTFLoaderInterfaces.js +2 -0
  229. package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -0
  230. package/glTF/2.0/index.d.ts +6 -0
  231. package/glTF/2.0/index.js +8 -0
  232. package/glTF/2.0/index.js.map +1 -0
  233. package/glTF/glTFFileLoader.d.ts +516 -0
  234. package/glTF/glTFFileLoader.js +968 -0
  235. package/glTF/glTFFileLoader.js.map +1 -0
  236. package/glTF/glTFFileLoader.metadata.d.ts +15 -0
  237. package/glTF/glTFFileLoader.metadata.js +18 -0
  238. package/glTF/glTFFileLoader.metadata.js.map +1 -0
  239. package/glTF/glTFValidation.d.ts +29 -0
  240. package/glTF/glTFValidation.js +126 -0
  241. package/glTF/glTFValidation.js.map +1 -0
  242. package/glTF/index.d.ts +5 -0
  243. package/glTF/index.js +7 -0
  244. package/glTF/index.js.map +1 -0
  245. package/index.d.ts +5 -0
  246. package/index.js +7 -0
  247. package/index.js.map +1 -0
  248. package/legacy/legacy-bvhFileLoader.d.ts +1 -0
  249. package/legacy/legacy-bvhFileLoader.js +16 -0
  250. package/legacy/legacy-bvhFileLoader.js.map +1 -0
  251. package/legacy/legacy-glTF.d.ts +2 -0
  252. package/legacy/legacy-glTF.js +19 -0
  253. package/legacy/legacy-glTF.js.map +1 -0
  254. package/legacy/legacy-glTF1.d.ts +2 -0
  255. package/legacy/legacy-glTF1.js +16 -0
  256. package/legacy/legacy-glTF1.js.map +1 -0
  257. package/legacy/legacy-glTF1FileLoader.d.ts +2 -0
  258. package/legacy/legacy-glTF1FileLoader.js +4 -0
  259. package/legacy/legacy-glTF1FileLoader.js.map +1 -0
  260. package/legacy/legacy-glTF2.d.ts +2 -0
  261. package/legacy/legacy-glTF2.js +35 -0
  262. package/legacy/legacy-glTF2.js.map +1 -0
  263. package/legacy/legacy-glTF2FileLoader.d.ts +2 -0
  264. package/legacy/legacy-glTF2FileLoader.js +4 -0
  265. package/legacy/legacy-glTF2FileLoader.js.map +1 -0
  266. package/legacy/legacy-glTFFileLoader.d.ts +3 -0
  267. package/legacy/legacy-glTFFileLoader.js +5 -0
  268. package/legacy/legacy-glTFFileLoader.js.map +1 -0
  269. package/legacy/legacy-objFileLoader.d.ts +1 -0
  270. package/legacy/legacy-objFileLoader.js +16 -0
  271. package/legacy/legacy-objFileLoader.js.map +1 -0
  272. package/legacy/legacy-stlFileLoader.d.ts +1 -0
  273. package/legacy/legacy-stlFileLoader.js +16 -0
  274. package/legacy/legacy-stlFileLoader.js.map +1 -0
  275. package/legacy/legacy.d.ts +7 -0
  276. package/legacy/legacy.js +10 -0
  277. package/legacy/legacy.js.map +1 -0
  278. package/license.md +71 -0
  279. package/package.json +49 -0
  280. package/readme.md +23 -0
@@ -0,0 +1,562 @@
1
+ import { RegisterSceneLoaderPlugin } from "@babylonjs/core/Loading/sceneLoader.js";
2
+ import { SPLATFileLoaderMetadata } from "./splatFileLoader.metadata.js";
3
+ import { GaussianSplattingMesh } from "@babylonjs/core/Meshes/GaussianSplatting/gaussianSplattingMesh.js";
4
+ import { AssetContainer } from "@babylonjs/core/assetContainer.js";
5
+ import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
6
+ import { Logger } from "@babylonjs/core/Misc/logger.js";
7
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
8
+ import { PointsCloudSystem } from "@babylonjs/core/Particles/pointsCloudSystem.js";
9
+ import { Color4 } from "@babylonjs/core/Maths/math.color.js";
10
+ import { VertexData } from "@babylonjs/core/Meshes/mesh.vertexData.js";
11
+ import { Scalar } from "@babylonjs/core/Maths/math.scalar.js";
12
+ /**
13
+ * Indicator of the parsed ply buffer. A standard ready to use splat or an array of positions for a point cloud
14
+ */
15
+ var Mode;
16
+ (function (Mode) {
17
+ Mode[Mode["Splat"] = 0] = "Splat";
18
+ Mode[Mode["PointCloud"] = 1] = "PointCloud";
19
+ Mode[Mode["Mesh"] = 2] = "Mesh";
20
+ Mode[Mode["Reject"] = 3] = "Reject";
21
+ })(Mode || (Mode = {}));
22
+ /**
23
+ * @experimental
24
+ * SPLAT file type loader.
25
+ * This is a babylon scene loader plugin.
26
+ */
27
+ export class SPLATFileLoader {
28
+ /**
29
+ * Creates loader for gaussian splatting files
30
+ * @param loadingOptions options for loading and parsing splat and PLY files.
31
+ */
32
+ constructor(loadingOptions = SPLATFileLoader._DefaultLoadingOptions) {
33
+ /**
34
+ * Defines the name of the plugin.
35
+ */
36
+ this.name = SPLATFileLoaderMetadata.name;
37
+ this._assetContainer = null;
38
+ /**
39
+ * Defines the extensions the splat loader is able to load.
40
+ * force data to come in as an ArrayBuffer
41
+ */
42
+ this.extensions = SPLATFileLoaderMetadata.extensions;
43
+ this._loadingOptions = loadingOptions;
44
+ }
45
+ /** @internal */
46
+ createPlugin(options) {
47
+ return new SPLATFileLoader(options[SPLATFileLoaderMetadata.name]);
48
+ }
49
+ /**
50
+ * Imports from the loaded gaussian splatting data and adds them to the scene
51
+ * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
52
+ * @param scene the scene the meshes should be added to
53
+ * @param data the gaussian splatting data to load
54
+ * @param rootUrl root url to load from
55
+ * @param _onProgress callback called while file is loading
56
+ * @param _fileName Defines the name of the file to load
57
+ * @returns a promise containing the loaded meshes, particles, skeletons and animations
58
+ */
59
+ async importMeshAsync(meshesNames, scene, data, rootUrl, _onProgress, _fileName) {
60
+ // eslint-disable-next-line github/no-then
61
+ return await this._parseAsync(meshesNames, scene, data, rootUrl).then((meshes) => {
62
+ return {
63
+ meshes: meshes,
64
+ particleSystems: [],
65
+ skeletons: [],
66
+ animationGroups: [],
67
+ transformNodes: [],
68
+ geometries: [],
69
+ lights: [],
70
+ spriteManagers: [],
71
+ };
72
+ });
73
+ }
74
+ static _BuildPointCloud(pointcloud, data) {
75
+ if (!data.byteLength) {
76
+ return false;
77
+ }
78
+ const uBuffer = new Uint8Array(data);
79
+ const fBuffer = new Float32Array(data);
80
+ // parsed array contains room for position(3floats), normal(3floats), color (4b), quantized quaternion (4b)
81
+ const rowLength = 3 * 4 + 3 * 4 + 4 + 4;
82
+ const vertexCount = uBuffer.length / rowLength;
83
+ const pointcloudfunc = function (particle, i) {
84
+ const x = fBuffer[8 * i + 0];
85
+ const y = fBuffer[8 * i + 1];
86
+ const z = fBuffer[8 * i + 2];
87
+ particle.position = new Vector3(x, y, z);
88
+ const r = uBuffer[rowLength * i + 24 + 0] / 255;
89
+ const g = uBuffer[rowLength * i + 24 + 1] / 255;
90
+ const b = uBuffer[rowLength * i + 24 + 2] / 255;
91
+ particle.color = new Color4(r, g, b, 1);
92
+ };
93
+ pointcloud.addPoints(vertexCount, pointcloudfunc);
94
+ return true;
95
+ }
96
+ static _BuildMesh(scene, parsedPLY) {
97
+ const mesh = new Mesh("PLYMesh", scene);
98
+ const uBuffer = new Uint8Array(parsedPLY.data);
99
+ const fBuffer = new Float32Array(parsedPLY.data);
100
+ const rowLength = 3 * 4 + 3 * 4 + 4 + 4;
101
+ const vertexCount = uBuffer.length / rowLength;
102
+ const positions = [];
103
+ const vertexData = new VertexData();
104
+ for (let i = 0; i < vertexCount; i++) {
105
+ const x = fBuffer[8 * i + 0];
106
+ const y = fBuffer[8 * i + 1];
107
+ const z = fBuffer[8 * i + 2];
108
+ positions.push(x, y, z);
109
+ }
110
+ if (parsedPLY.hasVertexColors) {
111
+ const colors = new Float32Array(vertexCount * 4);
112
+ for (let i = 0; i < vertexCount; i++) {
113
+ const r = uBuffer[rowLength * i + 24 + 0] / 255;
114
+ const g = uBuffer[rowLength * i + 24 + 1] / 255;
115
+ const b = uBuffer[rowLength * i + 24 + 2] / 255;
116
+ colors[i * 4 + 0] = r;
117
+ colors[i * 4 + 1] = g;
118
+ colors[i * 4 + 2] = b;
119
+ colors[i * 4 + 3] = 1;
120
+ }
121
+ vertexData.colors = colors;
122
+ }
123
+ vertexData.positions = positions;
124
+ vertexData.indices = parsedPLY.faces;
125
+ vertexData.applyToMesh(mesh);
126
+ return mesh;
127
+ }
128
+ // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax
129
+ _parseSPZAsync(data, scene) {
130
+ const ubuf = new Uint8Array(data);
131
+ const ubufu32 = new Uint32Array(data.slice(0, 12)); // Only need ubufu32[0] to [2]
132
+ // debug infos
133
+ const splatCount = ubufu32[2];
134
+ const shDegree = ubuf[12];
135
+ const fractionalBits = ubuf[13];
136
+ const flags = ubuf[14];
137
+ const reserved = ubuf[15];
138
+ const version = ubufu32[1];
139
+ // check magic and version
140
+ if (reserved || ubufu32[0] != 0x5053474e || (version != 2 && version != 3)) {
141
+ // reserved must be 0
142
+ return new Promise((resolve) => {
143
+ resolve({ mode: 3 /* Mode.Reject */, data: buffer, hasVertexColors: false });
144
+ });
145
+ }
146
+ const rowOutputLength = 3 * 4 + 3 * 4 + 4 + 4; // 32
147
+ const buffer = new ArrayBuffer(rowOutputLength * splatCount);
148
+ const positionScale = 1.0 / (1 << fractionalBits);
149
+ const int32View = new Int32Array(1);
150
+ const uint8View = new Uint8Array(int32View.buffer);
151
+ const read24bComponent = function (u8, offset) {
152
+ uint8View[0] = u8[offset + 0];
153
+ uint8View[1] = u8[offset + 1];
154
+ uint8View[2] = u8[offset + 2];
155
+ uint8View[3] = u8[offset + 2] & 0x80 ? 0xff : 0x00;
156
+ return int32View[0] * positionScale;
157
+ };
158
+ let byteOffset = 16;
159
+ const position = new Float32Array(buffer);
160
+ const scale = new Float32Array(buffer);
161
+ const rgba = new Uint8ClampedArray(buffer);
162
+ const rot = new Uint8ClampedArray(buffer);
163
+ let coordinateSign = 1;
164
+ let quaternionOffset = 0;
165
+ if (!this._loadingOptions.flipY) {
166
+ coordinateSign = -1;
167
+ quaternionOffset = 255;
168
+ }
169
+ // positions
170
+ for (let i = 0; i < splatCount; i++) {
171
+ position[i * 8 + 0] = read24bComponent(ubuf, byteOffset + 0);
172
+ position[i * 8 + 1] = coordinateSign * read24bComponent(ubuf, byteOffset + 3);
173
+ position[i * 8 + 2] = coordinateSign * read24bComponent(ubuf, byteOffset + 6);
174
+ byteOffset += 9;
175
+ }
176
+ // colors
177
+ const shC0 = 0.282;
178
+ for (let i = 0; i < splatCount; i++) {
179
+ for (let component = 0; component < 3; component++) {
180
+ const byteValue = ubuf[byteOffset + splatCount + i * 3 + component];
181
+ // 0.15 is hard coded value from spz
182
+ // Scale factor for DC color components. To convert to RGB, we should multiply by 0.282, but it can
183
+ // be useful to represent base colors that are out of range if the higher spherical harmonics bands
184
+ // bring them back into range so we multiply by a smaller value.
185
+ const value = (byteValue - 127.5) / (0.15 * 255);
186
+ rgba[i * 32 + 24 + component] = Scalar.Clamp((0.5 + shC0 * value) * 255, 0, 255);
187
+ }
188
+ rgba[i * 32 + 24 + 3] = ubuf[byteOffset + i];
189
+ }
190
+ byteOffset += splatCount * 4;
191
+ // scales
192
+ for (let i = 0; i < splatCount; i++) {
193
+ scale[i * 8 + 3 + 0] = Math.exp(ubuf[byteOffset + 0] / 16.0 - 10.0);
194
+ scale[i * 8 + 3 + 1] = Math.exp(ubuf[byteOffset + 1] / 16.0 - 10.0);
195
+ scale[i * 8 + 3 + 2] = Math.exp(ubuf[byteOffset + 2] / 16.0 - 10.0);
196
+ byteOffset += 3;
197
+ }
198
+ // convert quaternion
199
+ if (version >= 3) {
200
+ /*
201
+ In version 3, rotations are represented as the smallest three components of the normalized rotation quaternion, for optimal rotation accuracy.
202
+ The largest component can be derived from the others and is not stored. Its index is stored on 2 bits
203
+ and each of the smallest three components is encoded as a 10-bit signed integer.
204
+ */
205
+ const sqrt12 = Math.SQRT1_2;
206
+ for (let i = 0; i < splatCount; i++) {
207
+ const r = [ubuf[byteOffset + 0], ubuf[byteOffset + 1], ubuf[byteOffset + 2], ubuf[byteOffset + 3]];
208
+ const comp = r[0] + (r[1] << 8) + (r[2] << 16) + (r[3] << 24);
209
+ const cmask = (1 << 9) - 1;
210
+ const rotation = [];
211
+ const iLargest = comp >>> 30;
212
+ let remaining = comp;
213
+ let sumSquares = 0;
214
+ for (let i = 3; i >= 0; --i) {
215
+ if (i !== iLargest) {
216
+ const mag = remaining & cmask;
217
+ const negbit = (remaining >>> 9) & 0x1;
218
+ remaining = remaining >>> 10;
219
+ rotation[i] = sqrt12 * (mag / cmask);
220
+ if (negbit === 1) {
221
+ rotation[i] = -rotation[i];
222
+ }
223
+ // accumulate the sum of squares
224
+ sumSquares += rotation[i] * rotation[i];
225
+ }
226
+ }
227
+ const square = 1 - sumSquares;
228
+ rotation[iLargest] = Math.sqrt(Math.max(square, 0));
229
+ rotation[1] *= coordinateSign;
230
+ rotation[2] *= coordinateSign;
231
+ const shuffle = [3, 0, 1, 2]; // shuffle to match the order of the quaternion components in the splat file
232
+ for (let j = 0; j < 4; j++) {
233
+ rot[i * 32 + 28 + j] = Math.round(127.5 + rotation[shuffle[j]] * 127.5);
234
+ }
235
+ byteOffset += 4;
236
+ }
237
+ }
238
+ else {
239
+ /*
240
+ In version 2, rotations are represented as the `(x, y, z)` components of the normalized rotation quaternion. The
241
+ `w` component can be derived from the others and is not stored. Each component is encoded as an
242
+ 8-bit signed integer.
243
+ */
244
+ for (let i = 0; i < splatCount; i++) {
245
+ const x = ubuf[byteOffset + 0];
246
+ const y = ubuf[byteOffset + 1] * coordinateSign + quaternionOffset;
247
+ const z = ubuf[byteOffset + 2] * coordinateSign + quaternionOffset;
248
+ const nx = x / 127.5 - 1;
249
+ const ny = y / 127.5 - 1;
250
+ const nz = z / 127.5 - 1;
251
+ rot[i * 32 + 28 + 1] = x;
252
+ rot[i * 32 + 28 + 2] = y;
253
+ rot[i * 32 + 28 + 3] = z;
254
+ const v = 1 - (nx * nx + ny * ny + nz * nz);
255
+ rot[i * 32 + 28 + 0] = 127.5 + Math.sqrt(v < 0 ? 0 : v) * 127.5;
256
+ byteOffset += 3;
257
+ }
258
+ }
259
+ //SH
260
+ if (shDegree) {
261
+ // shVectorCount is : 3 for dim = 1, 8 for dim = 2 and 15 for dim = 3
262
+ // number of vec3 vector needed per splat
263
+ const shVectorCount = (shDegree + 1) * (shDegree + 1) - 1; // minus 1 because sh0 is color
264
+ // number of component values : 3 per vector3 (45)
265
+ const shComponentCount = shVectorCount * 3;
266
+ const textureCount = Math.ceil(shComponentCount / 16); // 4 components can be stored per texture, 4 sh per component
267
+ let shIndexRead = byteOffset;
268
+ // sh is an array of uint8array that will be used to create sh textures
269
+ const sh = [];
270
+ const engine = scene.getEngine();
271
+ const width = engine.getCaps().maxTextureSize;
272
+ const height = Math.ceil(splatCount / width);
273
+ // create array for the number of textures needed.
274
+ for (let textureIndex = 0; textureIndex < textureCount; textureIndex++) {
275
+ const texture = new Uint8Array(height * width * 4 * 4); // 4 components per texture, 4 sh per component
276
+ sh.push(texture);
277
+ }
278
+ for (let i = 0; i < splatCount; i++) {
279
+ for (let shIndexWrite = 0; shIndexWrite < shComponentCount; shIndexWrite++) {
280
+ const shValue = ubuf[shIndexRead++];
281
+ const textureIndex = Math.floor(shIndexWrite / 16);
282
+ const shArray = sh[textureIndex];
283
+ const byteIndexInTexture = shIndexWrite % 16; // [0..15]
284
+ const offsetPerSplat = i * 16; // 16 sh values per texture per splat.
285
+ shArray[byteIndexInTexture + offsetPerSplat] = shValue;
286
+ }
287
+ }
288
+ return new Promise((resolve) => {
289
+ resolve({ mode: 0 /* Mode.Splat */, data: buffer, hasVertexColors: false, sh: sh, trainedWithAntialiasing: !!flags });
290
+ });
291
+ }
292
+ return new Promise((resolve) => {
293
+ resolve({ mode: 0 /* Mode.Splat */, data: buffer, hasVertexColors: false, trainedWithAntialiasing: !!flags });
294
+ });
295
+ }
296
+ // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax
297
+ _parseAsync(meshesNames, scene, data, _rootUrl) {
298
+ const babylonMeshesArray = []; //The mesh for babylon
299
+ const readableStream = new ReadableStream({
300
+ start(controller) {
301
+ controller.enqueue(new Uint8Array(data)); // Enqueue the ArrayBuffer as a Uint8Array
302
+ controller.close();
303
+ },
304
+ });
305
+ // Use GZip DecompressionStream
306
+ const decompressionStream = new DecompressionStream("gzip");
307
+ const decompressedStream = readableStream.pipeThrough(decompressionStream);
308
+ return new Promise((resolve) => {
309
+ new Response(decompressedStream)
310
+ .arrayBuffer()
311
+ // eslint-disable-next-line github/no-then
312
+ .then((buffer) => {
313
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then
314
+ this._parseSPZAsync(buffer, scene).then((parsedSPZ) => {
315
+ scene._blockEntityCollection = !!this._assetContainer;
316
+ const gaussianSplatting = new GaussianSplattingMesh("GaussianSplatting", null, scene, this._loadingOptions.keepInRam);
317
+ if (parsedSPZ.trainedWithAntialiasing) {
318
+ const gsMaterial = gaussianSplatting.material;
319
+ gsMaterial.kernelSize = 0.1;
320
+ gsMaterial.compensation = true;
321
+ }
322
+ gaussianSplatting._parentContainer = this._assetContainer;
323
+ babylonMeshesArray.push(gaussianSplatting);
324
+ gaussianSplatting.updateData(parsedSPZ.data, parsedSPZ.sh);
325
+ scene._blockEntityCollection = false;
326
+ resolve(babylonMeshesArray);
327
+ });
328
+ })
329
+ // eslint-disable-next-line github/no-then
330
+ .catch(() => {
331
+ // Catch any decompression errors
332
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then
333
+ SPLATFileLoader._ConvertPLYToSplat(data).then(async (parsedPLY) => {
334
+ scene._blockEntityCollection = !!this._assetContainer;
335
+ switch (parsedPLY.mode) {
336
+ case 0 /* Mode.Splat */:
337
+ {
338
+ const gaussianSplatting = new GaussianSplattingMesh("GaussianSplatting", null, scene, this._loadingOptions.keepInRam);
339
+ gaussianSplatting._parentContainer = this._assetContainer;
340
+ babylonMeshesArray.push(gaussianSplatting);
341
+ gaussianSplatting.updateData(parsedPLY.data, parsedPLY.sh);
342
+ if (parsedPLY.compressed || !parsedPLY.rawSplat) {
343
+ gaussianSplatting.viewDirectionFactor.set(-1, -1, 1);
344
+ }
345
+ }
346
+ break;
347
+ case 1 /* Mode.PointCloud */:
348
+ {
349
+ const pointcloud = new PointsCloudSystem("PointCloud", 1, scene);
350
+ if (SPLATFileLoader._BuildPointCloud(pointcloud, parsedPLY.data)) {
351
+ // eslint-disable-next-line github/no-then
352
+ await pointcloud.buildMeshAsync().then((mesh) => {
353
+ babylonMeshesArray.push(mesh);
354
+ });
355
+ }
356
+ else {
357
+ pointcloud.dispose();
358
+ }
359
+ }
360
+ break;
361
+ case 2 /* Mode.Mesh */:
362
+ {
363
+ if (parsedPLY.faces) {
364
+ babylonMeshesArray.push(SPLATFileLoader._BuildMesh(scene, parsedPLY));
365
+ }
366
+ else {
367
+ throw new Error("PLY mesh doesn't contain face informations.");
368
+ }
369
+ }
370
+ break;
371
+ default:
372
+ throw new Error("Unsupported Splat mode");
373
+ }
374
+ scene._blockEntityCollection = false;
375
+ resolve(babylonMeshesArray);
376
+ });
377
+ });
378
+ });
379
+ }
380
+ /**
381
+ * Load into an asset container.
382
+ * @param scene The scene to load into
383
+ * @param data The data to import
384
+ * @param rootUrl The root url for scene and resources
385
+ * @returns The loaded asset container
386
+ */
387
+ // eslint-disable-next-line no-restricted-syntax
388
+ loadAssetContainerAsync(scene, data, rootUrl) {
389
+ const container = new AssetContainer(scene);
390
+ this._assetContainer = container;
391
+ return (this.importMeshAsync(null, scene, data, rootUrl)
392
+ // eslint-disable-next-line github/no-then
393
+ .then((result) => {
394
+ for (const mesh of result.meshes) {
395
+ container.meshes.push(mesh);
396
+ }
397
+ // mesh material will be null before 1st rendered frame.
398
+ this._assetContainer = null;
399
+ return container;
400
+ })
401
+ // eslint-disable-next-line github/no-then
402
+ .catch((ex) => {
403
+ this._assetContainer = null;
404
+ throw ex;
405
+ }));
406
+ }
407
+ /**
408
+ * Imports all objects from the loaded OBJ data and adds them to the scene
409
+ * @param scene the scene the objects should be added to
410
+ * @param data the OBJ data to load
411
+ * @param rootUrl root url to load from
412
+ * @returns a promise which completes when objects have been loaded to the scene
413
+ */
414
+ // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax
415
+ loadAsync(scene, data, rootUrl) {
416
+ //Get the 3D model
417
+ // eslint-disable-next-line github/no-then
418
+ return this.importMeshAsync(null, scene, data, rootUrl).then(() => {
419
+ // return void
420
+ });
421
+ }
422
+ /**
423
+ * Code from https://github.com/dylanebert/gsplat.js/blob/main/src/loaders/PLYLoader.ts Under MIT license
424
+ * Converts a .ply data array buffer to splat
425
+ * if data array buffer is not ply, returns the original buffer
426
+ * @param data the .ply data to load
427
+ * @returns the loaded splat buffer
428
+ */
429
+ static _ConvertPLYToSplat(data) {
430
+ const ubuf = new Uint8Array(data);
431
+ const header = new TextDecoder().decode(ubuf.slice(0, 1024 * 10));
432
+ const headerEnd = "end_header\n";
433
+ const headerEndIndex = header.indexOf(headerEnd);
434
+ if (headerEndIndex < 0 || !header) {
435
+ // standard splat
436
+ return new Promise((resolve) => {
437
+ resolve({ mode: 0 /* Mode.Splat */, data: data, rawSplat: true });
438
+ });
439
+ }
440
+ const vertexCount = parseInt(/element vertex (\d+)\n/.exec(header)[1]);
441
+ const faceElement = /element face (\d+)\n/.exec(header);
442
+ let faceCount = 0;
443
+ if (faceElement) {
444
+ faceCount = parseInt(faceElement[1]);
445
+ }
446
+ const chunkElement = /element chunk (\d+)\n/.exec(header);
447
+ let chunkCount = 0;
448
+ if (chunkElement) {
449
+ chunkCount = parseInt(chunkElement[1]);
450
+ }
451
+ let rowVertexOffset = 0;
452
+ let rowChunkOffset = 0;
453
+ const offsets = {
454
+ double: 8,
455
+ int: 4,
456
+ uint: 4,
457
+ float: 4,
458
+ short: 2,
459
+ ushort: 2,
460
+ uchar: 1,
461
+ list: 0,
462
+ };
463
+ let ElementMode;
464
+ (function (ElementMode) {
465
+ ElementMode[ElementMode["Vertex"] = 0] = "Vertex";
466
+ ElementMode[ElementMode["Chunk"] = 1] = "Chunk";
467
+ ElementMode[ElementMode["SH"] = 2] = "SH";
468
+ })(ElementMode || (ElementMode = {}));
469
+ let chunkMode = 1 /* ElementMode.Chunk */;
470
+ const vertexProperties = [];
471
+ const chunkProperties = [];
472
+ const filtered = header.slice(0, headerEndIndex).split("\n");
473
+ for (const prop of filtered) {
474
+ if (prop.startsWith("property ")) {
475
+ const [, type, name] = prop.split(" ");
476
+ if (chunkMode == 1 /* ElementMode.Chunk */) {
477
+ chunkProperties.push({ name, type, offset: rowChunkOffset });
478
+ rowChunkOffset += offsets[type];
479
+ }
480
+ else if (chunkMode == 0 /* ElementMode.Vertex */) {
481
+ vertexProperties.push({ name, type, offset: rowVertexOffset });
482
+ rowVertexOffset += offsets[type];
483
+ }
484
+ else if (chunkMode == 2 /* ElementMode.SH */) {
485
+ vertexProperties.push({ name, type, offset: rowVertexOffset });
486
+ }
487
+ if (!offsets[type]) {
488
+ Logger.Warn(`Unsupported property type: ${type}.`);
489
+ }
490
+ }
491
+ else if (prop.startsWith("element ")) {
492
+ const [, type] = prop.split(" ");
493
+ if (type == "chunk") {
494
+ chunkMode = 1 /* ElementMode.Chunk */;
495
+ }
496
+ else if (type == "vertex") {
497
+ chunkMode = 0 /* ElementMode.Vertex */;
498
+ }
499
+ else if (type == "sh") {
500
+ chunkMode = 2 /* ElementMode.SH */;
501
+ }
502
+ }
503
+ }
504
+ const rowVertexLength = rowVertexOffset;
505
+ const rowChunkLength = rowChunkOffset;
506
+ // eslint-disable-next-line github/no-then
507
+ return GaussianSplattingMesh.ConvertPLYWithSHToSplatAsync(data).then(async (splatsData) => {
508
+ const dataView = new DataView(data, headerEndIndex + headerEnd.length);
509
+ let offset = rowChunkLength * chunkCount + rowVertexLength * vertexCount;
510
+ // faces
511
+ const faces = [];
512
+ if (faceCount) {
513
+ for (let i = 0; i < faceCount; i++) {
514
+ const faceVertexCount = dataView.getUint8(offset);
515
+ if (faceVertexCount != 3) {
516
+ continue; // only support triangles
517
+ }
518
+ offset += 1;
519
+ for (let j = 0; j < faceVertexCount; j++) {
520
+ const vertexIndex = dataView.getUint32(offset + (2 - j) * 4, true); // change face winding
521
+ faces.push(vertexIndex);
522
+ }
523
+ offset += 12;
524
+ }
525
+ }
526
+ // early exit for chunked/quantized ply
527
+ if (chunkCount) {
528
+ return await new Promise((resolve) => {
529
+ resolve({ mode: 0 /* Mode.Splat */, data: splatsData.buffer, sh: splatsData.sh, faces: faces, hasVertexColors: false, compressed: true, rawSplat: false });
530
+ });
531
+ }
532
+ // count available properties. if all necessary are present then it's a splat. Otherwise, it's a point cloud
533
+ // if faces are found, then it's a standard mesh
534
+ let propertyCount = 0;
535
+ let propertyColorCount = 0;
536
+ const splatProperties = ["x", "y", "z", "scale_0", "scale_1", "scale_2", "opacity", "rot_0", "rot_1", "rot_2", "rot_3"];
537
+ const splatColorProperties = ["red", "green", "blue", "f_dc_0", "f_dc_1", "f_dc_2"];
538
+ for (let propertyIndex = 0; propertyIndex < vertexProperties.length; propertyIndex++) {
539
+ const property = vertexProperties[propertyIndex];
540
+ if (splatProperties.includes(property.name)) {
541
+ propertyCount++;
542
+ }
543
+ if (splatColorProperties.includes(property.name)) {
544
+ propertyColorCount++;
545
+ }
546
+ }
547
+ const hasMandatoryProperties = propertyCount == splatProperties.length && propertyColorCount == 3;
548
+ const currentMode = faceCount ? 2 /* Mode.Mesh */ : hasMandatoryProperties ? 0 /* Mode.Splat */ : 1 /* Mode.PointCloud */;
549
+ // parsed ready ready to be used as a splat
550
+ return await new Promise((resolve) => {
551
+ resolve({ mode: currentMode, data: splatsData.buffer, sh: splatsData.sh, faces: faces, hasVertexColors: !!propertyColorCount, compressed: false, rawSplat: false });
552
+ });
553
+ });
554
+ }
555
+ }
556
+ SPLATFileLoader._DefaultLoadingOptions = {
557
+ keepInRam: false,
558
+ flipY: false,
559
+ };
560
+ // Add this loader into the register plugin
561
+ RegisterSceneLoaderPlugin(new SPLATFileLoader());
562
+ //# sourceMappingURL=splatFileLoader.js.map