@babylonjs/viewer 7.26.1-alpha → 7.26.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 (578) hide show
  1. package/configuration/configuration.d.ts +107 -0
  2. package/configuration/configuration.js +16 -0
  3. package/configuration/configuration.js.map +1 -0
  4. package/configuration/configurationCompatibility.d.ts +8 -0
  5. package/configuration/configurationCompatibility.js +66 -0
  6. package/configuration/configurationCompatibility.js.map +1 -0
  7. package/configuration/configurationContainer.d.ts +10 -0
  8. package/configuration/configurationContainer.js +10 -0
  9. package/configuration/configurationContainer.js.map +1 -0
  10. package/configuration/globals.d.ts +6 -0
  11. package/configuration/globals.js +18 -0
  12. package/configuration/globals.js.map +1 -0
  13. package/configuration/index.d.ts +2 -0
  14. package/configuration/index.js +4 -0
  15. package/configuration/index.js.map +1 -0
  16. package/configuration/interfaces/cameraConfiguration.d.ts +31 -0
  17. package/configuration/interfaces/cameraConfiguration.js +2 -0
  18. package/configuration/interfaces/cameraConfiguration.js.map +1 -0
  19. package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -0
  20. package/configuration/interfaces/colorGradingConfiguration.js +2 -0
  21. package/configuration/interfaces/colorGradingConfiguration.js.map +1 -0
  22. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -0
  23. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +2 -0
  24. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +1 -0
  25. package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -0
  26. package/configuration/interfaces/environmentMapConfiguration.js +2 -0
  27. package/configuration/interfaces/environmentMapConfiguration.js.map +1 -0
  28. package/configuration/interfaces/groundConfiguration.d.ts +24 -0
  29. package/configuration/interfaces/groundConfiguration.js +2 -0
  30. package/configuration/interfaces/groundConfiguration.js.map +1 -0
  31. package/configuration/interfaces/imageProcessingConfiguration.d.ts +45 -0
  32. package/configuration/interfaces/imageProcessingConfiguration.js +2 -0
  33. package/configuration/interfaces/imageProcessingConfiguration.js.map +1 -0
  34. package/configuration/interfaces/index.d.ts +15 -0
  35. package/configuration/interfaces/index.js +16 -0
  36. package/configuration/interfaces/index.js.map +1 -0
  37. package/configuration/interfaces/lightConfiguration.d.ts +60 -0
  38. package/configuration/interfaces/lightConfiguration.js +2 -0
  39. package/configuration/interfaces/lightConfiguration.js.map +1 -0
  40. package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -0
  41. package/configuration/interfaces/modelAnimationConfiguration.js +2 -0
  42. package/configuration/interfaces/modelAnimationConfiguration.js.map +1 -0
  43. package/configuration/interfaces/modelConfiguration.d.ts +65 -0
  44. package/configuration/interfaces/modelConfiguration.js +2 -0
  45. package/configuration/interfaces/modelConfiguration.js.map +1 -0
  46. package/configuration/interfaces/observersConfiguration.d.ts +5 -0
  47. package/configuration/interfaces/observersConfiguration.js +2 -0
  48. package/configuration/interfaces/observersConfiguration.js.map +1 -0
  49. package/configuration/interfaces/sceneConfiguration.d.ts +48 -0
  50. package/configuration/interfaces/sceneConfiguration.js +2 -0
  51. package/configuration/interfaces/sceneConfiguration.js.map +1 -0
  52. package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -0
  53. package/configuration/interfaces/sceneOptimizerConfiguration.js +2 -0
  54. package/configuration/interfaces/sceneOptimizerConfiguration.js.map +1 -0
  55. package/configuration/interfaces/skyboxConfiguration.d.ts +21 -0
  56. package/configuration/interfaces/skyboxConfiguration.js +2 -0
  57. package/configuration/interfaces/skyboxConfiguration.js.map +1 -0
  58. package/configuration/interfaces/templateConfiguration.d.ts +67 -0
  59. package/configuration/interfaces/templateConfiguration.js +2 -0
  60. package/configuration/interfaces/templateConfiguration.js.map +1 -0
  61. package/configuration/interfaces/vrConfiguration.d.ts +16 -0
  62. package/configuration/interfaces/vrConfiguration.js +2 -0
  63. package/configuration/interfaces/vrConfiguration.js.map +1 -0
  64. package/configuration/loader.d.ts +4 -0
  65. package/configuration/loader.js +17 -0
  66. package/configuration/loader.js.map +1 -0
  67. package/configuration/mappers.d.ts +43 -0
  68. package/configuration/mappers.js +192 -0
  69. package/configuration/mappers.js.map +1 -0
  70. package/configuration/renderOnlyLoader.d.ts +33 -0
  71. package/configuration/renderOnlyLoader.js +162 -0
  72. package/configuration/renderOnlyLoader.js.map +1 -0
  73. package/configuration/types/default.d.ts +6 -0
  74. package/configuration/types/default.js +121 -0
  75. package/configuration/types/default.js.map +1 -0
  76. package/configuration/types/environmentMap.d.ts +5 -0
  77. package/configuration/types/environmentMap.js +14 -0
  78. package/configuration/types/environmentMap.js.map +1 -0
  79. package/configuration/types/extended.d.ts +6 -0
  80. package/configuration/types/extended.js +317 -0
  81. package/configuration/types/extended.js.map +1 -0
  82. package/configuration/types/index.d.ts +14 -0
  83. package/configuration/types/index.js +51 -0
  84. package/configuration/types/index.js.map +1 -0
  85. package/configuration/types/minimal.d.ts +6 -0
  86. package/configuration/types/minimal.js +43 -0
  87. package/configuration/types/minimal.js.map +1 -0
  88. package/configuration/types/renderOnlyDefault.d.ts +30 -0
  89. package/configuration/types/renderOnlyDefault.js +31 -0
  90. package/configuration/types/renderOnlyDefault.js.map +1 -0
  91. package/configuration/types/shadowLight.d.ts +9 -0
  92. package/configuration/types/shadowLight.js +64 -0
  93. package/configuration/types/shadowLight.js.map +1 -0
  94. package/helper/index.d.ts +29 -0
  95. package/helper/index.js +66 -0
  96. package/helper/index.js.map +1 -0
  97. package/index.d.ts +30 -0
  98. package/index.js +46 -0
  99. package/index.js.map +1 -0
  100. package/initializer.d.ts +11 -0
  101. package/initializer.js +35 -0
  102. package/initializer.js.map +1 -0
  103. package/interfaces.d.ts +5 -0
  104. package/interfaces.js +7 -0
  105. package/interfaces.js.map +1 -0
  106. package/labs/environmentSerializer.d.ts +126 -0
  107. package/labs/environmentSerializer.js +191 -0
  108. package/labs/environmentSerializer.js.map +1 -0
  109. package/labs/texture.d.ts +183 -0
  110. package/labs/texture.js +350 -0
  111. package/labs/texture.js.map +1 -0
  112. package/labs/viewerLabs.d.ts +51 -0
  113. package/labs/viewerLabs.js +134 -0
  114. package/labs/viewerLabs.js.map +1 -0
  115. package/loader/modelLoader.d.ts +56 -0
  116. package/loader/modelLoader.js +199 -0
  117. package/loader/modelLoader.js.map +1 -0
  118. package/loader/plugins/applyMaterialConfig.d.ts +12 -0
  119. package/loader/plugins/applyMaterialConfig.js +16 -0
  120. package/loader/plugins/applyMaterialConfig.js.map +1 -0
  121. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -0
  122. package/loader/plugins/extendedMaterialLoaderPlugin.js +16 -0
  123. package/loader/plugins/extendedMaterialLoaderPlugin.js.map +1 -0
  124. package/loader/plugins/index.d.ts +19 -0
  125. package/loader/plugins/index.js +44 -0
  126. package/loader/plugins/index.js.map +1 -0
  127. package/loader/plugins/loaderPlugin.d.ts +24 -0
  128. package/loader/plugins/loaderPlugin.js +2 -0
  129. package/loader/plugins/loaderPlugin.js.map +1 -0
  130. package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -0
  131. package/loader/plugins/msftLodLoaderPlugin.js +21 -0
  132. package/loader/plugins/msftLodLoaderPlugin.js.map +1 -0
  133. package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -0
  134. package/loader/plugins/telemetryLoaderPlugin.js +36 -0
  135. package/loader/plugins/telemetryLoaderPlugin.js.map +1 -0
  136. package/managers/observablesManager.d.ts +66 -0
  137. package/managers/observablesManager.js +35 -0
  138. package/managers/observablesManager.js.map +1 -0
  139. package/managers/sceneManager.d.ts +245 -0
  140. package/managers/sceneManager.js +1375 -0
  141. package/managers/sceneManager.js.map +1 -0
  142. package/managers/telemetryManager.d.ts +78 -0
  143. package/managers/telemetryManager.js +117 -0
  144. package/managers/telemetryManager.js.map +1 -0
  145. package/model/modelAnimation.d.ts +215 -0
  146. package/model/modelAnimation.js +237 -0
  147. package/model/modelAnimation.js.map +1 -0
  148. package/model/viewerModel.d.ts +233 -0
  149. package/model/viewerModel.js +673 -0
  150. package/model/viewerModel.js.map +1 -0
  151. package/optimizer/custom/extended.d.ts +13 -0
  152. package/optimizer/custom/extended.js +101 -0
  153. package/optimizer/custom/extended.js.map +1 -0
  154. package/optimizer/custom/index.d.ts +9 -0
  155. package/optimizer/custom/index.js +26 -0
  156. package/optimizer/custom/index.js.map +1 -0
  157. package/package.json +27 -17
  158. package/readme.md +21 -35
  159. package/renderOnlyIndex.d.ts +11 -0
  160. package/renderOnlyIndex.js +18 -0
  161. package/renderOnlyIndex.js.map +1 -0
  162. package/templating/eventManager.d.ts +35 -0
  163. package/templating/eventManager.js +66 -0
  164. package/templating/eventManager.js.map +1 -0
  165. package/templating/plugins/hdButtonPlugin.d.ts +9 -0
  166. package/templating/plugins/hdButtonPlugin.js +21 -0
  167. package/templating/plugins/hdButtonPlugin.js.map +1 -0
  168. package/templating/plugins/printButton.d.ts +9 -0
  169. package/templating/plugins/printButton.js +40 -0
  170. package/templating/plugins/printButton.js.map +1 -0
  171. package/templating/templateManager.d.ts +197 -0
  172. package/templating/templateManager.js +561 -0
  173. package/templating/templateManager.js.map +1 -0
  174. package/templating/viewerTemplatePlugin.d.ts +21 -0
  175. package/templating/viewerTemplatePlugin.js +69 -0
  176. package/templating/viewerTemplatePlugin.js.map +1 -0
  177. package/viewer/defaultViewer.d.ts +130 -0
  178. package/viewer/defaultViewer.js +675 -0
  179. package/viewer/defaultViewer.js.map +1 -0
  180. package/viewer/renderOnlyViewer.d.ts +9 -0
  181. package/viewer/renderOnlyViewer.js +46 -0
  182. package/viewer/renderOnlyViewer.js.map +1 -0
  183. package/viewer/viewer.d.ts +258 -0
  184. package/viewer/viewer.js +783 -0
  185. package/viewer/viewer.js.map +1 -0
  186. package/viewer/viewerManager.d.ts +58 -0
  187. package/viewer/viewerManager.js +91 -0
  188. package/viewer/viewerManager.js.map +1 -0
  189. package/viewer/viewerWithTemplate.d.ts +9 -0
  190. package/viewer/viewerWithTemplate.js +20 -0
  191. package/viewer/viewerWithTemplate.js.map +1 -0
  192. package/dist/babylon-viewer.esm.js +0 -2
  193. package/dist/babylon-viewer.esm.js.map +0 -1
  194. package/dist/babylon-viewer.esm.min.js +0 -2
  195. package/dist/babylon-viewer.esm.min.js.map +0 -1
  196. package/dist/chunks/EXT_lights_image_based-DsDbqMm1.esm.js +0 -171
  197. package/dist/chunks/EXT_lights_image_based-DsDbqMm1.esm.js.map +0 -1
  198. package/dist/chunks/EXT_lights_image_based-mCTUYKVf.esm.min.js +0 -2
  199. package/dist/chunks/EXT_lights_image_based-mCTUYKVf.esm.min.js.map +0 -1
  200. package/dist/chunks/EXT_mesh_gpu_instancing-COmOwtlg.esm.js +0 -86
  201. package/dist/chunks/EXT_mesh_gpu_instancing-COmOwtlg.esm.js.map +0 -1
  202. package/dist/chunks/EXT_mesh_gpu_instancing-Du3oMoIS.esm.min.js +0 -2
  203. package/dist/chunks/EXT_mesh_gpu_instancing-Du3oMoIS.esm.min.js.map +0 -1
  204. package/dist/chunks/EXT_meshopt_compression-BxehqOGN.esm.min.js +0 -2
  205. package/dist/chunks/EXT_meshopt_compression-BxehqOGN.esm.min.js.map +0 -1
  206. package/dist/chunks/EXT_meshopt_compression-DlL8YShe.esm.js +0 -134
  207. package/dist/chunks/EXT_meshopt_compression-DlL8YShe.esm.js.map +0 -1
  208. package/dist/chunks/EXT_texture_avif-Cft8jneR.esm.js +0 -44
  209. package/dist/chunks/EXT_texture_avif-Cft8jneR.esm.js.map +0 -1
  210. package/dist/chunks/EXT_texture_avif-CyTz554x.esm.min.js +0 -2
  211. package/dist/chunks/EXT_texture_avif-CyTz554x.esm.min.js.map +0 -1
  212. package/dist/chunks/EXT_texture_webp-D08sV6Wn.esm.js +0 -43
  213. package/dist/chunks/EXT_texture_webp-D08sV6Wn.esm.js.map +0 -1
  214. package/dist/chunks/EXT_texture_webp-DfYkzbli.esm.min.js +0 -2
  215. package/dist/chunks/EXT_texture_webp-DfYkzbli.esm.min.js.map +0 -1
  216. package/dist/chunks/ExtrasAsMetadata-8gfk0rMO.esm.min.js +0 -2
  217. package/dist/chunks/ExtrasAsMetadata-8gfk0rMO.esm.min.js.map +0 -1
  218. package/dist/chunks/ExtrasAsMetadata-BtvGjhKc.esm.js +0 -64
  219. package/dist/chunks/ExtrasAsMetadata-BtvGjhKc.esm.js.map +0 -1
  220. package/dist/chunks/KHR_animation_pointer-DZI3JfUy.esm.min.js +0 -2
  221. package/dist/chunks/KHR_animation_pointer-DZI3JfUy.esm.min.js.map +0 -1
  222. package/dist/chunks/KHR_animation_pointer-DtYG96QU.esm.js +0 -343
  223. package/dist/chunks/KHR_animation_pointer-DtYG96QU.esm.js.map +0 -1
  224. package/dist/chunks/KHR_draco_mesh_compression-Bn9URV7I.esm.js +0 -610
  225. package/dist/chunks/KHR_draco_mesh_compression-Bn9URV7I.esm.js.map +0 -1
  226. package/dist/chunks/KHR_draco_mesh_compression-bpp5yoeu.esm.min.js +0 -2
  227. package/dist/chunks/KHR_draco_mesh_compression-bpp5yoeu.esm.min.js.map +0 -1
  228. package/dist/chunks/KHR_interactivity-CeqWHLyv.esm.min.js +0 -2
  229. package/dist/chunks/KHR_interactivity-CeqWHLyv.esm.min.js.map +0 -1
  230. package/dist/chunks/KHR_interactivity-DpPcii3I.esm.js +0 -4033
  231. package/dist/chunks/KHR_interactivity-DpPcii3I.esm.js.map +0 -1
  232. package/dist/chunks/KHR_lights_punctual-BK9cCrlz.esm.min.js +0 -2
  233. package/dist/chunks/KHR_lights_punctual-BK9cCrlz.esm.min.js.map +0 -1
  234. package/dist/chunks/KHR_lights_punctual-BqCsHpq6.esm.js +0 -1253
  235. package/dist/chunks/KHR_lights_punctual-BqCsHpq6.esm.js.map +0 -1
  236. package/dist/chunks/KHR_materials_anisotropy-CBXgWuYi.esm.js +0 -64
  237. package/dist/chunks/KHR_materials_anisotropy-CBXgWuYi.esm.js.map +0 -1
  238. package/dist/chunks/KHR_materials_anisotropy-CaAsBsTX.esm.min.js +0 -2
  239. package/dist/chunks/KHR_materials_anisotropy-CaAsBsTX.esm.min.js.map +0 -1
  240. package/dist/chunks/KHR_materials_clearcoat-C6RVXzZz.esm.min.js +0 -2
  241. package/dist/chunks/KHR_materials_clearcoat-C6RVXzZz.esm.min.js.map +0 -1
  242. package/dist/chunks/KHR_materials_clearcoat-CthlCRjO.esm.js +0 -96
  243. package/dist/chunks/KHR_materials_clearcoat-CthlCRjO.esm.js.map +0 -1
  244. package/dist/chunks/KHR_materials_diffuse_transmission-C8bVjG7e.esm.js +0 -97
  245. package/dist/chunks/KHR_materials_diffuse_transmission-C8bVjG7e.esm.js.map +0 -1
  246. package/dist/chunks/KHR_materials_diffuse_transmission-CtPW9sTh.esm.min.js +0 -2
  247. package/dist/chunks/KHR_materials_diffuse_transmission-CtPW9sTh.esm.min.js.map +0 -1
  248. package/dist/chunks/KHR_materials_dispersion-DxDAr-IM.esm.min.js +0 -2
  249. package/dist/chunks/KHR_materials_dispersion-DxDAr-IM.esm.min.js.map +0 -1
  250. package/dist/chunks/KHR_materials_dispersion-XsmNHe_Z.esm.js +0 -62
  251. package/dist/chunks/KHR_materials_dispersion-XsmNHe_Z.esm.js.map +0 -1
  252. package/dist/chunks/KHR_materials_emissive_strength-Cc1AJ6d1.esm.js +0 -55
  253. package/dist/chunks/KHR_materials_emissive_strength-Cc1AJ6d1.esm.js.map +0 -1
  254. package/dist/chunks/KHR_materials_emissive_strength-CoPKCbsu.esm.min.js +0 -2
  255. package/dist/chunks/KHR_materials_emissive_strength-CoPKCbsu.esm.min.js.map +0 -1
  256. package/dist/chunks/KHR_materials_ior-BasPQ6Hu.esm.js +0 -64
  257. package/dist/chunks/KHR_materials_ior-BasPQ6Hu.esm.js.map +0 -1
  258. package/dist/chunks/KHR_materials_ior-C1F7H1TS.esm.min.js +0 -2
  259. package/dist/chunks/KHR_materials_ior-C1F7H1TS.esm.min.js.map +0 -1
  260. package/dist/chunks/KHR_materials_iridescence-CUzr7WWT.esm.js +0 -72
  261. package/dist/chunks/KHR_materials_iridescence-CUzr7WWT.esm.js.map +0 -1
  262. package/dist/chunks/KHR_materials_iridescence-DpQCDDxa.esm.min.js +0 -2
  263. package/dist/chunks/KHR_materials_iridescence-DpQCDDxa.esm.min.js.map +0 -1
  264. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-AoTReTYa.esm.js +0 -81
  265. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-AoTReTYa.esm.js.map +0 -1
  266. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DE4fVKKd.esm.min.js +0 -2
  267. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DE4fVKKd.esm.min.js.map +0 -1
  268. package/dist/chunks/KHR_materials_sheen-BTWQN8Es.esm.min.js +0 -2
  269. package/dist/chunks/KHR_materials_sheen-BTWQN8Es.esm.min.js.map +0 -1
  270. package/dist/chunks/KHR_materials_sheen-RRZPW8rG.esm.js +0 -85
  271. package/dist/chunks/KHR_materials_sheen-RRZPW8rG.esm.js.map +0 -1
  272. package/dist/chunks/KHR_materials_specular-HMLcFlb9.esm.min.js +0 -2
  273. package/dist/chunks/KHR_materials_specular-HMLcFlb9.esm.min.js.map +0 -1
  274. package/dist/chunks/KHR_materials_specular-Lnug5rox.esm.js +0 -75
  275. package/dist/chunks/KHR_materials_specular-Lnug5rox.esm.js.map +0 -1
  276. package/dist/chunks/KHR_materials_transmission-C-2MvEIh.esm.js +0 -307
  277. package/dist/chunks/KHR_materials_transmission-C-2MvEIh.esm.js.map +0 -1
  278. package/dist/chunks/KHR_materials_transmission-DhlELR0K.esm.min.js +0 -2
  279. package/dist/chunks/KHR_materials_transmission-DhlELR0K.esm.min.js.map +0 -1
  280. package/dist/chunks/KHR_materials_unlit-B3T9dRpU.esm.min.js +0 -2
  281. package/dist/chunks/KHR_materials_unlit-B3T9dRpU.esm.min.js.map +0 -1
  282. package/dist/chunks/KHR_materials_unlit-CnhmoQd7.esm.js +0 -74
  283. package/dist/chunks/KHR_materials_unlit-CnhmoQd7.esm.js.map +0 -1
  284. package/dist/chunks/KHR_materials_variants-COhi8MiJ.esm.min.js +0 -2
  285. package/dist/chunks/KHR_materials_variants-COhi8MiJ.esm.min.js.map +0 -1
  286. package/dist/chunks/KHR_materials_variants-amXBFitV.esm.js +0 -238
  287. package/dist/chunks/KHR_materials_variants-amXBFitV.esm.js.map +0 -1
  288. package/dist/chunks/KHR_materials_volume-C2MuBvtc.esm.js +0 -87
  289. package/dist/chunks/KHR_materials_volume-C2MuBvtc.esm.js.map +0 -1
  290. package/dist/chunks/KHR_materials_volume-DQQx7Xnn.esm.min.js +0 -2
  291. package/dist/chunks/KHR_materials_volume-DQQx7Xnn.esm.min.js.map +0 -1
  292. package/dist/chunks/KHR_mesh_quantization-DrCyawOg.esm.min.js +0 -2
  293. package/dist/chunks/KHR_mesh_quantization-DrCyawOg.esm.min.js.map +0 -1
  294. package/dist/chunks/KHR_mesh_quantization-jubAnKrX.esm.js +0 -26
  295. package/dist/chunks/KHR_mesh_quantization-jubAnKrX.esm.js.map +0 -1
  296. package/dist/chunks/KHR_texture_basisu-BXphCKtb.esm.min.js +0 -2
  297. package/dist/chunks/KHR_texture_basisu-BXphCKtb.esm.min.js.map +0 -1
  298. package/dist/chunks/KHR_texture_basisu-D8p_gAx9.esm.js +0 -43
  299. package/dist/chunks/KHR_texture_basisu-D8p_gAx9.esm.js.map +0 -1
  300. package/dist/chunks/KHR_texture_transform-B_y1ftx5.esm.min.js +0 -2
  301. package/dist/chunks/KHR_texture_transform-B_y1ftx5.esm.min.js.map +0 -1
  302. package/dist/chunks/KHR_texture_transform-C1UKUQH2.esm.js +0 -63
  303. package/dist/chunks/KHR_texture_transform-C1UKUQH2.esm.js.map +0 -1
  304. package/dist/chunks/KHR_xmp_json_ld-C74qIt7_.esm.min.js +0 -2
  305. package/dist/chunks/KHR_xmp_json_ld-C74qIt7_.esm.min.js.map +0 -1
  306. package/dist/chunks/KHR_xmp_json_ld-DMVYxT7w.esm.js +0 -51
  307. package/dist/chunks/KHR_xmp_json_ld-DMVYxT7w.esm.js.map +0 -1
  308. package/dist/chunks/MSFT_audio_emitter--QZDwc6f.esm.js +0 -2236
  309. package/dist/chunks/MSFT_audio_emitter--QZDwc6f.esm.js.map +0 -1
  310. package/dist/chunks/MSFT_audio_emitter-BXP5h7zb.esm.min.js +0 -2
  311. package/dist/chunks/MSFT_audio_emitter-BXP5h7zb.esm.min.js.map +0 -1
  312. package/dist/chunks/MSFT_lod-CgUkPEkw.esm.min.js +0 -2
  313. package/dist/chunks/MSFT_lod-CgUkPEkw.esm.min.js.map +0 -1
  314. package/dist/chunks/MSFT_lod-DJ8KYBBc.esm.js +0 -337
  315. package/dist/chunks/MSFT_lod-DJ8KYBBc.esm.js.map +0 -1
  316. package/dist/chunks/MSFT_minecraftMesh-DYOfa8T8.esm.min.js +0 -2
  317. package/dist/chunks/MSFT_minecraftMesh-DYOfa8T8.esm.min.js.map +0 -1
  318. package/dist/chunks/MSFT_minecraftMesh-DZuOISwp.esm.js +0 -46
  319. package/dist/chunks/MSFT_minecraftMesh-DZuOISwp.esm.js.map +0 -1
  320. package/dist/chunks/MSFT_sRGBFactors-CceiOCu9.esm.js +0 -47
  321. package/dist/chunks/MSFT_sRGBFactors-CceiOCu9.esm.js.map +0 -1
  322. package/dist/chunks/MSFT_sRGBFactors-Ck-TOHvT.esm.min.js +0 -2
  323. package/dist/chunks/MSFT_sRGBFactors-Ck-TOHvT.esm.min.js.map +0 -1
  324. package/dist/chunks/assetContainer-DtOf0_DF.esm.js +0 -1598
  325. package/dist/chunks/assetContainer-DtOf0_DF.esm.js.map +0 -1
  326. package/dist/chunks/assetContainer-Ws38Sjv8.esm.min.js +0 -2
  327. package/dist/chunks/assetContainer-Ws38Sjv8.esm.min.js.map +0 -1
  328. package/dist/chunks/audioEngine-BUapsmlk.esm.min.js +0 -2
  329. package/dist/chunks/audioEngine-BUapsmlk.esm.min.js.map +0 -1
  330. package/dist/chunks/audioEngine-NIyvsLSd.esm.js +0 -305
  331. package/dist/chunks/audioEngine-NIyvsLSd.esm.js.map +0 -1
  332. package/dist/chunks/bakedVertexAnimation-B02h-aCk.esm.min.js +0 -2
  333. package/dist/chunks/bakedVertexAnimation-B02h-aCk.esm.min.js.map +0 -1
  334. package/dist/chunks/bakedVertexAnimation-DVkvvhey.esm.js +0 -119
  335. package/dist/chunks/bakedVertexAnimation-DVkvvhey.esm.js.map +0 -1
  336. package/dist/chunks/basisTextureLoader-BlDCmrFH.esm.js +0 -600
  337. package/dist/chunks/basisTextureLoader-BlDCmrFH.esm.js.map +0 -1
  338. package/dist/chunks/basisTextureLoader-D4_xAWoz.esm.min.js +0 -2
  339. package/dist/chunks/basisTextureLoader-D4_xAWoz.esm.min.js.map +0 -1
  340. package/dist/chunks/dds-BF1J8MBi.esm.min.js +0 -2
  341. package/dist/chunks/dds-BF1J8MBi.esm.min.js.map +0 -1
  342. package/dist/chunks/dds-DfV87nVy.esm.js +0 -540
  343. package/dist/chunks/dds-DfV87nVy.esm.js.map +0 -1
  344. package/dist/chunks/ddsTextureLoader-BSYGOg7u.esm.js +0 -88
  345. package/dist/chunks/ddsTextureLoader-BSYGOg7u.esm.js.map +0 -1
  346. package/dist/chunks/ddsTextureLoader-qS7wc4o2.esm.min.js +0 -2
  347. package/dist/chunks/ddsTextureLoader-qS7wc4o2.esm.min.js.map +0 -1
  348. package/dist/chunks/decalFragment-DGJouiBd.esm.min.js +0 -2
  349. package/dist/chunks/decalFragment-DGJouiBd.esm.min.js.map +0 -1
  350. package/dist/chunks/decalFragment-xfilJu8a.esm.js +0 -18
  351. package/dist/chunks/decalFragment-xfilJu8a.esm.js.map +0 -1
  352. package/dist/chunks/default.fragment-B3O6AOmC.esm.min.js +0 -2
  353. package/dist/chunks/default.fragment-B3O6AOmC.esm.min.js.map +0 -1
  354. package/dist/chunks/default.fragment-BPxY8FmI.esm.js +0 -515
  355. package/dist/chunks/default.fragment-BPxY8FmI.esm.js.map +0 -1
  356. package/dist/chunks/default.fragment-BxOozwq5.esm.min.js +0 -2
  357. package/dist/chunks/default.fragment-BxOozwq5.esm.min.js.map +0 -1
  358. package/dist/chunks/default.fragment-oLEPQLuu.esm.js +0 -449
  359. package/dist/chunks/default.fragment-oLEPQLuu.esm.js.map +0 -1
  360. package/dist/chunks/default.vertex-B-C-rwg0.esm.min.js +0 -2
  361. package/dist/chunks/default.vertex-B-C-rwg0.esm.min.js.map +0 -1
  362. package/dist/chunks/default.vertex-B2gkf8U0.esm.js +0 -199
  363. package/dist/chunks/default.vertex-B2gkf8U0.esm.js.map +0 -1
  364. package/dist/chunks/default.vertex-CsM_7qHB.esm.min.js +0 -2
  365. package/dist/chunks/default.vertex-CsM_7qHB.esm.min.js.map +0 -1
  366. package/dist/chunks/default.vertex-U_6B9MIv.esm.js +0 -180
  367. package/dist/chunks/default.vertex-U_6B9MIv.esm.js.map +0 -1
  368. package/dist/chunks/defaultUboDeclaration-288fHvy2.esm.min.js +0 -2
  369. package/dist/chunks/defaultUboDeclaration-288fHvy2.esm.min.js.map +0 -1
  370. package/dist/chunks/defaultUboDeclaration-BTktDqqp.esm.js +0 -13
  371. package/dist/chunks/defaultUboDeclaration-BTktDqqp.esm.js.map +0 -1
  372. package/dist/chunks/defaultUboDeclaration-Bt2R0LJe.esm.min.js +0 -2
  373. package/dist/chunks/defaultUboDeclaration-Bt2R0LJe.esm.min.js.map +0 -1
  374. package/dist/chunks/defaultUboDeclaration-c6EMN7lX.esm.js +0 -15
  375. package/dist/chunks/defaultUboDeclaration-c6EMN7lX.esm.js.map +0 -1
  376. package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js +0 -11
  377. package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js.map +0 -1
  378. package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js +0 -2
  379. package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js.map +0 -1
  380. package/dist/chunks/dumpTools-CCQTslDO.esm.min.js +0 -2
  381. package/dist/chunks/dumpTools-CCQTslDO.esm.min.js.map +0 -1
  382. package/dist/chunks/dumpTools-CTudj6Xw.esm.js +0 -400
  383. package/dist/chunks/dumpTools-CTudj6Xw.esm.js.map +0 -1
  384. package/dist/chunks/engine-CX7Hv8cy.esm.min.js +0 -2
  385. package/dist/chunks/engine-CX7Hv8cy.esm.min.js.map +0 -1
  386. package/dist/chunks/engine-Tj_bLBh9.esm.js +0 -2174
  387. package/dist/chunks/engine-Tj_bLBh9.esm.js.map +0 -1
  388. package/dist/chunks/engine.common-BLNTMdbd.esm.js +0 -1088
  389. package/dist/chunks/engine.common-BLNTMdbd.esm.js.map +0 -1
  390. package/dist/chunks/engine.common-DxJ1G5SQ.esm.min.js +0 -2
  391. package/dist/chunks/engine.common-DxJ1G5SQ.esm.min.js.map +0 -1
  392. package/dist/chunks/envTextureLoader-CQ0BSS8J.esm.js +0 -64
  393. package/dist/chunks/envTextureLoader-CQ0BSS8J.esm.js.map +0 -1
  394. package/dist/chunks/envTextureLoader-Ypn90f50.esm.min.js +0 -2
  395. package/dist/chunks/envTextureLoader-Ypn90f50.esm.min.js.map +0 -1
  396. package/dist/chunks/environmentTextureTools-5aPKfJSj.esm.min.js +0 -2
  397. package/dist/chunks/environmentTextureTools-5aPKfJSj.esm.min.js.map +0 -1
  398. package/dist/chunks/environmentTextureTools-BYLfInjg.esm.js +0 -382
  399. package/dist/chunks/environmentTextureTools-BYLfInjg.esm.js.map +0 -1
  400. package/dist/chunks/exrTextureLoader-B22KYxZL.esm.min.js +0 -2
  401. package/dist/chunks/exrTextureLoader-B22KYxZL.esm.min.js.map +0 -1
  402. package/dist/chunks/exrTextureLoader-DY9W1opy.esm.js +0 -1682
  403. package/dist/chunks/exrTextureLoader-DY9W1opy.esm.js.map +0 -1
  404. package/dist/chunks/fogFragment-B0JF9R1L.esm.js +0 -102
  405. package/dist/chunks/fogFragment-B0JF9R1L.esm.js.map +0 -1
  406. package/dist/chunks/fogFragment-_AvbK5of.esm.min.js +0 -2
  407. package/dist/chunks/fogFragment-_AvbK5of.esm.min.js.map +0 -1
  408. package/dist/chunks/fresnelFunction-B41RRVrC.esm.min.js +0 -2
  409. package/dist/chunks/fresnelFunction-B41RRVrC.esm.min.js.map +0 -1
  410. package/dist/chunks/fresnelFunction-CjtL3ZQU.esm.js +0 -12
  411. package/dist/chunks/fresnelFunction-CjtL3ZQU.esm.js.map +0 -1
  412. package/dist/chunks/glTFLoader-Bct1Spm4.esm.js +0 -7552
  413. package/dist/chunks/glTFLoader-Bct1Spm4.esm.js.map +0 -1
  414. package/dist/chunks/glTFLoader-E0xFzXS-.esm.min.js +0 -2
  415. package/dist/chunks/glTFLoader-E0xFzXS-.esm.min.js.map +0 -1
  416. package/dist/chunks/glTFLoaderAnimation-BHcQZz18.esm.min.js +0 -2
  417. package/dist/chunks/glTFLoaderAnimation-BHcQZz18.esm.min.js.map +0 -1
  418. package/dist/chunks/glTFLoaderAnimation-CmU2mWS1.esm.js +0 -77
  419. package/dist/chunks/glTFLoaderAnimation-CmU2mWS1.esm.js.map +0 -1
  420. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js +0 -2
  421. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js.map +0 -1
  422. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js +0 -67
  423. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js.map +0 -1
  424. package/dist/chunks/harmonicsFunctions-BFSRGmum.esm.min.js +0 -2
  425. package/dist/chunks/harmonicsFunctions-BFSRGmum.esm.min.js.map +0 -1
  426. package/dist/chunks/harmonicsFunctions-BhmxpY-P.esm.js +0 -35
  427. package/dist/chunks/harmonicsFunctions-BhmxpY-P.esm.js.map +0 -1
  428. package/dist/chunks/harmonicsFunctions-ByKkavwU.esm.js +0 -34
  429. package/dist/chunks/harmonicsFunctions-ByKkavwU.esm.js.map +0 -1
  430. package/dist/chunks/harmonicsFunctions-CKDRrNQ6.esm.min.js +0 -2
  431. package/dist/chunks/harmonicsFunctions-CKDRrNQ6.esm.min.js.map +0 -1
  432. package/dist/chunks/hdrTextureLoader-Bo3cB7Lv.esm.min.js +0 -2
  433. package/dist/chunks/hdrTextureLoader-Bo3cB7Lv.esm.min.js.map +0 -1
  434. package/dist/chunks/hdrTextureLoader-ClRh4jRt.esm.js +0 -252
  435. package/dist/chunks/hdrTextureLoader-ClRh4jRt.esm.js.map +0 -1
  436. package/dist/chunks/helperFunctions-B1pe8Z7a.esm.min.js +0 -2
  437. package/dist/chunks/helperFunctions-B1pe8Z7a.esm.min.js.map +0 -1
  438. package/dist/chunks/helperFunctions-B5juEVwN.esm.min.js +0 -2
  439. package/dist/chunks/helperFunctions-B5juEVwN.esm.min.js.map +0 -1
  440. package/dist/chunks/helperFunctions-DEBR6-u7.esm.js +0 -108
  441. package/dist/chunks/helperFunctions-DEBR6-u7.esm.js.map +0 -1
  442. package/dist/chunks/helperFunctions-KYwTAbM5.esm.js +0 -80
  443. package/dist/chunks/helperFunctions-KYwTAbM5.esm.js.map +0 -1
  444. package/dist/chunks/index-DCThadff.esm.min.js +0 -57
  445. package/dist/chunks/index-DCThadff.esm.min.js.map +0 -1
  446. package/dist/chunks/index-i45KM5wt.esm.js +0 -73918
  447. package/dist/chunks/index-i45KM5wt.esm.js.map +0 -1
  448. package/dist/chunks/ktxTextureLoader-BteOQPJ-.esm.js +0 -814
  449. package/dist/chunks/ktxTextureLoader-BteOQPJ-.esm.js.map +0 -1
  450. package/dist/chunks/ktxTextureLoader-DCvwamD4.esm.min.js +0 -2
  451. package/dist/chunks/ktxTextureLoader-DCvwamD4.esm.min.js.map +0 -1
  452. package/dist/chunks/logDepthDeclaration-6-bRoRMp.esm.js +0 -20
  453. package/dist/chunks/logDepthDeclaration-6-bRoRMp.esm.js.map +0 -1
  454. package/dist/chunks/logDepthDeclaration-BF62x-6O.esm.js +0 -35
  455. package/dist/chunks/logDepthDeclaration-BF62x-6O.esm.js.map +0 -1
  456. package/dist/chunks/logDepthDeclaration-CS-h8z55.esm.min.js +0 -2
  457. package/dist/chunks/logDepthDeclaration-CS-h8z55.esm.min.js.map +0 -1
  458. package/dist/chunks/logDepthDeclaration-D-u6tkH6.esm.min.js +0 -2
  459. package/dist/chunks/logDepthDeclaration-D-u6tkH6.esm.min.js.map +0 -1
  460. package/dist/chunks/logDepthVertex-CIWw0ajC.esm.min.js +0 -2
  461. package/dist/chunks/logDepthVertex-CIWw0ajC.esm.min.js.map +0 -1
  462. package/dist/chunks/logDepthVertex-CRQsg3cE.esm.min.js +0 -2
  463. package/dist/chunks/logDepthVertex-CRQsg3cE.esm.min.js.map +0 -1
  464. package/dist/chunks/logDepthVertex-Droi2Yja.esm.js +0 -488
  465. package/dist/chunks/logDepthVertex-Droi2Yja.esm.js.map +0 -1
  466. package/dist/chunks/logDepthVertex-TGCjPGL7.esm.js +0 -77
  467. package/dist/chunks/logDepthVertex-TGCjPGL7.esm.js.map +0 -1
  468. package/dist/chunks/mainUVVaryingDeclaration-BmrgR8ih.esm.min.js +0 -2
  469. package/dist/chunks/mainUVVaryingDeclaration-BmrgR8ih.esm.min.js.map +0 -1
  470. package/dist/chunks/mainUVVaryingDeclaration-uDb83rWA.esm.js +0 -11
  471. package/dist/chunks/mainUVVaryingDeclaration-uDb83rWA.esm.js.map +0 -1
  472. package/dist/chunks/meshUboDeclaration-CIHoJAB0.esm.min.js +0 -2
  473. package/dist/chunks/meshUboDeclaration-CIHoJAB0.esm.min.js.map +0 -1
  474. package/dist/chunks/meshUboDeclaration-h8NVM0MP.esm.js +0 -24
  475. package/dist/chunks/meshUboDeclaration-h8NVM0MP.esm.js.map +0 -1
  476. package/dist/chunks/objFileLoader-BD8KUQa-.esm.min.js +0 -2
  477. package/dist/chunks/objFileLoader-BD8KUQa-.esm.min.js.map +0 -1
  478. package/dist/chunks/objFileLoader-a8al6qfI.esm.js +0 -1280
  479. package/dist/chunks/objFileLoader-a8al6qfI.esm.js.map +0 -1
  480. package/dist/chunks/oitFragment-104y4Hyr.esm.js +0 -1210
  481. package/dist/chunks/oitFragment-104y4Hyr.esm.js.map +0 -1
  482. package/dist/chunks/oitFragment-CRT-iHIi.esm.min.js +0 -2
  483. package/dist/chunks/oitFragment-CRT-iHIi.esm.min.js.map +0 -1
  484. package/dist/chunks/oitFragment-CrDxXess.esm.js +0 -1150
  485. package/dist/chunks/oitFragment-CrDxXess.esm.js.map +0 -1
  486. package/dist/chunks/oitFragment-DWLhPBUC.esm.min.js +0 -2
  487. package/dist/chunks/oitFragment-DWLhPBUC.esm.min.js.map +0 -1
  488. package/dist/chunks/pass.fragment-CRqA_HHv.esm.js +0 -15
  489. package/dist/chunks/pass.fragment-CRqA_HHv.esm.js.map +0 -1
  490. package/dist/chunks/pass.fragment-CeNm157-.esm.js +0 -15
  491. package/dist/chunks/pass.fragment-CeNm157-.esm.js.map +0 -1
  492. package/dist/chunks/pass.fragment-CxcM67FL.esm.min.js +0 -2
  493. package/dist/chunks/pass.fragment-CxcM67FL.esm.min.js.map +0 -1
  494. package/dist/chunks/pass.fragment-K8_XsgN9.esm.min.js +0 -2
  495. package/dist/chunks/pass.fragment-K8_XsgN9.esm.min.js.map +0 -1
  496. package/dist/chunks/pbr.fragment-CFMkx8jC.esm.min.js +0 -2
  497. package/dist/chunks/pbr.fragment-CFMkx8jC.esm.min.js.map +0 -1
  498. package/dist/chunks/pbr.fragment-CKtaIXsL.esm.js +0 -3165
  499. package/dist/chunks/pbr.fragment-CKtaIXsL.esm.js.map +0 -1
  500. package/dist/chunks/pbr.fragment-CWLPSob7.esm.js +0 -3219
  501. package/dist/chunks/pbr.fragment-CWLPSob7.esm.js.map +0 -1
  502. package/dist/chunks/pbr.fragment-pDzHjA6u.esm.min.js +0 -2
  503. package/dist/chunks/pbr.fragment-pDzHjA6u.esm.min.js.map +0 -1
  504. package/dist/chunks/pbr.vertex-BCq0De4D.esm.min.js +0 -2
  505. package/dist/chunks/pbr.vertex-BCq0De4D.esm.min.js.map +0 -1
  506. package/dist/chunks/pbr.vertex-BOJ7TLi6.esm.min.js +0 -2
  507. package/dist/chunks/pbr.vertex-BOJ7TLi6.esm.min.js.map +0 -1
  508. package/dist/chunks/pbr.vertex-CLlgFGIX.esm.js +0 -210
  509. package/dist/chunks/pbr.vertex-CLlgFGIX.esm.js.map +0 -1
  510. package/dist/chunks/pbr.vertex-CUX-Z5Tg.esm.js +0 -335
  511. package/dist/chunks/pbr.vertex-CUX-Z5Tg.esm.js.map +0 -1
  512. package/dist/chunks/postprocess.vertex-BYENs4wG.esm.min.js +0 -2
  513. package/dist/chunks/postprocess.vertex-BYENs4wG.esm.min.js.map +0 -1
  514. package/dist/chunks/postprocess.vertex-Bqj_5lyC.esm.js +0 -18
  515. package/dist/chunks/postprocess.vertex-Bqj_5lyC.esm.js.map +0 -1
  516. package/dist/chunks/postprocess.vertex-DTaYWAuh.esm.js +0 -20
  517. package/dist/chunks/postprocess.vertex-DTaYWAuh.esm.js.map +0 -1
  518. package/dist/chunks/postprocess.vertex-uGItl7aS.esm.min.js +0 -2
  519. package/dist/chunks/postprocess.vertex-uGItl7aS.esm.min.js.map +0 -1
  520. package/dist/chunks/rawTexture-BKl9f99r.esm.js +0 -191
  521. package/dist/chunks/rawTexture-BKl9f99r.esm.js.map +0 -1
  522. package/dist/chunks/rawTexture-DOBOA9uq.esm.min.js +0 -2
  523. package/dist/chunks/rawTexture-DOBOA9uq.esm.min.js.map +0 -1
  524. package/dist/chunks/rgbdDecode.fragment-Bd_8JAXf.esm.min.js +0 -2
  525. package/dist/chunks/rgbdDecode.fragment-Bd_8JAXf.esm.min.js.map +0 -1
  526. package/dist/chunks/rgbdDecode.fragment-CHGsGt97.esm.js +0 -17
  527. package/dist/chunks/rgbdDecode.fragment-CHGsGt97.esm.js.map +0 -1
  528. package/dist/chunks/rgbdDecode.fragment-D0yxoG1W.esm.js +0 -17
  529. package/dist/chunks/rgbdDecode.fragment-D0yxoG1W.esm.js.map +0 -1
  530. package/dist/chunks/rgbdDecode.fragment-wf3PyIe5.esm.min.js +0 -2
  531. package/dist/chunks/rgbdDecode.fragment-wf3PyIe5.esm.min.js.map +0 -1
  532. package/dist/chunks/rgbdEncode.fragment-Bs6Y2eSE.esm.js +0 -17
  533. package/dist/chunks/rgbdEncode.fragment-Bs6Y2eSE.esm.js.map +0 -1
  534. package/dist/chunks/rgbdEncode.fragment-CYLsqeED.esm.min.js +0 -2
  535. package/dist/chunks/rgbdEncode.fragment-CYLsqeED.esm.min.js.map +0 -1
  536. package/dist/chunks/rgbdEncode.fragment-DhVJfIyu.esm.min.js +0 -2
  537. package/dist/chunks/rgbdEncode.fragment-DhVJfIyu.esm.min.js.map +0 -1
  538. package/dist/chunks/rgbdEncode.fragment-DmK4SU9X.esm.js +0 -17
  539. package/dist/chunks/rgbdEncode.fragment-DmK4SU9X.esm.js.map +0 -1
  540. package/dist/chunks/splatFileLoader-BRqcWyJ6.esm.js +0 -3190
  541. package/dist/chunks/splatFileLoader-BRqcWyJ6.esm.js.map +0 -1
  542. package/dist/chunks/splatFileLoader-Ds_kblue.esm.min.js +0 -2
  543. package/dist/chunks/splatFileLoader-Ds_kblue.esm.min.js.map +0 -1
  544. package/dist/chunks/standardMaterial-AEXQRY9V.esm.min.js +0 -2
  545. package/dist/chunks/standardMaterial-AEXQRY9V.esm.min.js.map +0 -1
  546. package/dist/chunks/standardMaterial-KBjQQGiq.esm.js +0 -1809
  547. package/dist/chunks/standardMaterial-KBjQQGiq.esm.js.map +0 -1
  548. package/dist/chunks/stlFileLoader-7qz5L_15.esm.js +0 -237
  549. package/dist/chunks/stlFileLoader-7qz5L_15.esm.js.map +0 -1
  550. package/dist/chunks/stlFileLoader-kei1bRei.esm.min.js +0 -2
  551. package/dist/chunks/stlFileLoader-kei1bRei.esm.min.js.map +0 -1
  552. package/dist/chunks/tgaTextureLoader-BEqNNjkG.esm.min.js +0 -2
  553. package/dist/chunks/tgaTextureLoader-BEqNNjkG.esm.min.js.map +0 -1
  554. package/dist/chunks/tgaTextureLoader-BFJGgK0x.esm.js +0 -349
  555. package/dist/chunks/tgaTextureLoader-BFJGgK0x.esm.js.map +0 -1
  556. package/dist/chunks/thinEngine-BvNa8EcA.esm.min.js +0 -2
  557. package/dist/chunks/thinEngine-BvNa8EcA.esm.min.js.map +0 -1
  558. package/dist/chunks/thinEngine-zXcS8QLI.esm.js +0 -3721
  559. package/dist/chunks/thinEngine-zXcS8QLI.esm.js.map +0 -1
  560. package/dist/chunks/thinInstanceMesh--6R86mha.esm.js +0 -314
  561. package/dist/chunks/thinInstanceMesh--6R86mha.esm.js.map +0 -1
  562. package/dist/chunks/thinInstanceMesh-B7Mkv_xn.esm.min.js +0 -2
  563. package/dist/chunks/thinInstanceMesh-B7Mkv_xn.esm.min.js.map +0 -1
  564. package/dist/chunks/vertexColorMixing-CKfzFOUN.esm.min.js +0 -2
  565. package/dist/chunks/vertexColorMixing-CKfzFOUN.esm.min.js.map +0 -1
  566. package/dist/chunks/vertexColorMixing-CPqnUe_6.esm.js +0 -528
  567. package/dist/chunks/vertexColorMixing-CPqnUe_6.esm.js.map +0 -1
  568. package/dist/chunks/webgpuEngine-B6i0zqHL.esm.js +0 -11170
  569. package/dist/chunks/webgpuEngine-B6i0zqHL.esm.js.map +0 -1
  570. package/dist/chunks/webgpuEngine-DkQ6W-eN.esm.min.js +0 -2
  571. package/dist/chunks/webgpuEngine-DkQ6W-eN.esm.min.js.map +0 -1
  572. package/dist/chunks/workerPool-BUOov2K1.esm.js +0 -122
  573. package/dist/chunks/workerPool-BUOov2K1.esm.js.map +0 -1
  574. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js +0 -2
  575. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js.map +0 -1
  576. package/lib/index.d.ts +0 -281
  577. package/lib/index.js +0 -965
  578. package/lib/index.js.map +0 -1
@@ -1,1280 +0,0 @@
1
- import { p as Color3, q as Texture, k as Color4, s as Vector2, t as Vector3, V as VertexBuffer, L as Logger, u as Geometry, M as Mesh, v as VertexData, O as OBJFileLoaderMetadata, T as Tools, w as registerSceneLoaderPlugin } from './index-i45KM5wt.esm.js';
2
- import { A as AssetContainer } from './assetContainer-DtOf0_DF.esm.js';
3
- import { S as StandardMaterial } from './standardMaterial-KBjQQGiq.esm.js';
4
-
5
- /**
6
- * Class reading and parsing the MTL file bundled with the obj file.
7
- */
8
- class MTLFileLoader {
9
- constructor() {
10
- /**
11
- * All material loaded from the mtl will be set here
12
- */
13
- this.materials = [];
14
- }
15
- /**
16
- * This function will read the mtl file and create each material described inside
17
- * This function could be improve by adding :
18
- * -some component missing (Ni, Tf...)
19
- * -including the specific options available
20
- *
21
- * @param scene defines the scene the material will be created in
22
- * @param data defines the mtl data to parse
23
- * @param rootUrl defines the rooturl to use in order to load relative dependencies
24
- * @param assetContainer defines the asset container to store the material in (can be null)
25
- */
26
- parseMTL(scene, data, rootUrl, assetContainer) {
27
- if (data instanceof ArrayBuffer) {
28
- return;
29
- }
30
- //Split the lines from the file
31
- const lines = data.split("\n");
32
- // whitespace char ie: [ \t\r\n\f]
33
- const delimiter_pattern = /\s+/;
34
- //Array with RGB colors
35
- let color;
36
- //New material
37
- let material = null;
38
- //Look at each line
39
- for (let i = 0; i < lines.length; i++) {
40
- const line = lines[i].trim();
41
- // Blank line or comment
42
- if (line.length === 0 || line.charAt(0) === "#") {
43
- continue;
44
- }
45
- //Get the first parameter (keyword)
46
- const pos = line.indexOf(" ");
47
- let key = pos >= 0 ? line.substring(0, pos) : line;
48
- key = key.toLowerCase();
49
- //Get the data following the key
50
- const value = pos >= 0 ? line.substring(pos + 1).trim() : "";
51
- //This mtl keyword will create the new material
52
- if (key === "newmtl") {
53
- //Check if it is the first material.
54
- // Materials specifications are described after this keyword.
55
- if (material) {
56
- //Add the previous material in the material array.
57
- this.materials.push(material);
58
- }
59
- //Create a new material.
60
- // value is the name of the material read in the mtl file
61
- scene._blockEntityCollection = !!assetContainer;
62
- material = new StandardMaterial(value, scene);
63
- material._parentContainer = assetContainer;
64
- scene._blockEntityCollection = false;
65
- }
66
- else if (key === "kd" && material) {
67
- // Diffuse color (color under white light) using RGB values
68
- //value = "r g b"
69
- color = value.split(delimiter_pattern, 3).map(parseFloat);
70
- //color = [r,g,b]
71
- //Set tghe color into the material
72
- material.diffuseColor = Color3.FromArray(color);
73
- }
74
- else if (key === "ka" && material) {
75
- // Ambient color (color under shadow) using RGB values
76
- //value = "r g b"
77
- color = value.split(delimiter_pattern, 3).map(parseFloat);
78
- //color = [r,g,b]
79
- //Set tghe color into the material
80
- material.ambientColor = Color3.FromArray(color);
81
- }
82
- else if (key === "ks" && material) {
83
- // Specular color (color when light is reflected from shiny surface) using RGB values
84
- //value = "r g b"
85
- color = value.split(delimiter_pattern, 3).map(parseFloat);
86
- //color = [r,g,b]
87
- //Set the color into the material
88
- material.specularColor = Color3.FromArray(color);
89
- }
90
- else if (key === "ke" && material) {
91
- // Emissive color using RGB values
92
- color = value.split(delimiter_pattern, 3).map(parseFloat);
93
- material.emissiveColor = Color3.FromArray(color);
94
- }
95
- else if (key === "ns" && material) {
96
- //value = "Integer"
97
- material.specularPower = parseFloat(value);
98
- }
99
- else if (key === "d" && material) {
100
- //d is dissolve for current material. It mean alpha for BABYLON
101
- material.alpha = parseFloat(value);
102
- //Texture
103
- //This part can be improved by adding the possible options of texture
104
- }
105
- else if (key === "map_ka" && material) {
106
- // ambient texture map with a loaded image
107
- //We must first get the folder of the image
108
- material.ambientTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);
109
- }
110
- else if (key === "map_kd" && material) {
111
- // Diffuse texture map with a loaded image
112
- material.diffuseTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);
113
- }
114
- else if (key === "map_ks" && material) {
115
- // Specular texture map with a loaded image
116
- //We must first get the folder of the image
117
- material.specularTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);
118
- }
119
- else if (key === "map_ns") ;
120
- else if (key === "map_bump" && material) {
121
- //The bump texture
122
- const values = value.split(delimiter_pattern);
123
- const bumpMultiplierIndex = values.indexOf("-bm");
124
- let bumpMultiplier = null;
125
- if (bumpMultiplierIndex >= 0) {
126
- bumpMultiplier = values[bumpMultiplierIndex + 1];
127
- values.splice(bumpMultiplierIndex, 2); // remove
128
- }
129
- material.bumpTexture = MTLFileLoader._GetTexture(rootUrl, values.join(" "), scene);
130
- if (material.bumpTexture && bumpMultiplier !== null) {
131
- material.bumpTexture.level = parseFloat(bumpMultiplier);
132
- }
133
- }
134
- else if (key === "map_d" && material) {
135
- // The dissolve of the material
136
- material.opacityTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);
137
- //Options for illumination
138
- }
139
- else ;
140
- }
141
- //At the end of the file, add the last material
142
- if (material) {
143
- this.materials.push(material);
144
- }
145
- }
146
- /**
147
- * Gets the texture for the material.
148
- *
149
- * If the material is imported from input file,
150
- * We sanitize the url to ensure it takes the texture from aside the material.
151
- *
152
- * @param rootUrl The root url to load from
153
- * @param value The value stored in the mtl
154
- * @param scene
155
- * @returns The Texture
156
- */
157
- static _GetTexture(rootUrl, value, scene) {
158
- if (!value) {
159
- return null;
160
- }
161
- let url = rootUrl;
162
- // Load from input file.
163
- if (rootUrl === "file:") {
164
- let lastDelimiter = value.lastIndexOf("\\");
165
- if (lastDelimiter === -1) {
166
- lastDelimiter = value.lastIndexOf("/");
167
- }
168
- if (lastDelimiter > -1) {
169
- url += value.substring(lastDelimiter + 1);
170
- }
171
- else {
172
- url += value;
173
- }
174
- }
175
- // Not from input file.
176
- else {
177
- url += value;
178
- }
179
- return new Texture(url, scene, false, MTLFileLoader.INVERT_TEXTURE_Y);
180
- }
181
- }
182
- /**
183
- * Invert Y-Axis of referenced textures on load
184
- */
185
- MTLFileLoader.INVERT_TEXTURE_Y = true;
186
-
187
- /**
188
- * Class used to load mesh data from OBJ content
189
- */
190
- class SolidParser {
191
- /**
192
- * Creates a new SolidParser
193
- * @param materialToUse defines the array to fill with the list of materials to use (it will be filled by the parse function)
194
- * @param babylonMeshesArray defines the array to fill with the list of loaded meshes (it will be filled by the parse function)
195
- * @param loadingOptions defines the loading options to use
196
- */
197
- constructor(materialToUse, babylonMeshesArray, loadingOptions) {
198
- this._positions = []; //values for the positions of vertices
199
- this._normals = []; //Values for the normals
200
- this._uvs = []; //Values for the textures
201
- this._colors = [];
202
- this._meshesFromObj = []; //[mesh] Contains all the obj meshes
203
- this._indicesForBabylon = []; //The list of indices for VertexData
204
- this._wrappedPositionForBabylon = []; //The list of position in vectors
205
- this._wrappedUvsForBabylon = []; //Array with all value of uvs to match with the indices
206
- this._wrappedColorsForBabylon = []; // Array with all color values to match with the indices
207
- this._wrappedNormalsForBabylon = []; //Array with all value of normals to match with the indices
208
- this._tuplePosNorm = []; //Create a tuple with indice of Position, Normal, UV [pos, norm, uvs]
209
- this._curPositionInIndices = 0;
210
- this._hasMeshes = false; //Meshes are defined in the file
211
- this._unwrappedPositionsForBabylon = []; //Value of positionForBabylon w/o Vector3() [x,y,z]
212
- this._unwrappedColorsForBabylon = []; // Value of colorForBabylon w/o Color4() [r,g,b,a]
213
- this._unwrappedNormalsForBabylon = []; //Value of normalsForBabylon w/o Vector3() [x,y,z]
214
- this._unwrappedUVForBabylon = []; //Value of uvsForBabylon w/o Vector3() [x,y,z]
215
- this._triangles = []; //Indices from new triangles coming from polygons
216
- this._materialNameFromObj = ""; //The name of the current material
217
- this._objMeshName = ""; //The name of the current obj mesh
218
- this._increment = 1; //Id for meshes created by the multimaterial
219
- this._isFirstMaterial = true;
220
- this._grayColor = new Color4(0.5, 0.5, 0.5, 1);
221
- this._hasLineData = false; //If this mesh has line segment(l) data
222
- this._materialToUse = materialToUse;
223
- this._babylonMeshesArray = babylonMeshesArray;
224
- this._loadingOptions = loadingOptions;
225
- }
226
- /**
227
- * Search for obj in the given array.
228
- * This function is called to check if a couple of data already exists in an array.
229
- *
230
- * If found, returns the index of the founded tuple index. Returns -1 if not found
231
- * @param arr Array<{ normals: Array<number>, idx: Array<number> }>
232
- * @param obj Array<number>
233
- * @returns {boolean}
234
- */
235
- _isInArray(arr, obj) {
236
- if (!arr[obj[0]]) {
237
- arr[obj[0]] = { normals: [], idx: [] };
238
- }
239
- const idx = arr[obj[0]].normals.indexOf(obj[1]);
240
- return idx === -1 ? -1 : arr[obj[0]].idx[idx];
241
- }
242
- _isInArrayUV(arr, obj) {
243
- if (!arr[obj[0]]) {
244
- arr[obj[0]] = { normals: [], idx: [], uv: [] };
245
- }
246
- const idx = arr[obj[0]].normals.indexOf(obj[1]);
247
- if (idx != 1 && obj[2] === arr[obj[0]].uv[idx]) {
248
- return arr[obj[0]].idx[idx];
249
- }
250
- return -1;
251
- }
252
- /**
253
- * This function set the data for each triangle.
254
- * Data are position, normals and uvs
255
- * If a tuple of (position, normal) is not set, add the data into the corresponding array
256
- * If the tuple already exist, add only their indice
257
- *
258
- * @param indicePositionFromObj Integer The index in positions array
259
- * @param indiceUvsFromObj Integer The index in uvs array
260
- * @param indiceNormalFromObj Integer The index in normals array
261
- * @param positionVectorFromOBJ Vector3 The value of position at index objIndice
262
- * @param textureVectorFromOBJ Vector3 The value of uvs
263
- * @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale
264
- * @param positionColorsFromOBJ
265
- */
266
- _setData(indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj, positionVectorFromOBJ, textureVectorFromOBJ, normalsVectorFromOBJ, positionColorsFromOBJ) {
267
- //Check if this tuple already exists in the list of tuples
268
- let _index;
269
- if (this._loadingOptions.optimizeWithUV) {
270
- _index = this._isInArrayUV(this._tuplePosNorm, [indicePositionFromObj, indiceNormalFromObj, indiceUvsFromObj]);
271
- }
272
- else {
273
- _index = this._isInArray(this._tuplePosNorm, [indicePositionFromObj, indiceNormalFromObj]);
274
- }
275
- //If it not exists
276
- if (_index === -1) {
277
- //Add an new indice.
278
- //The array of indices is only an array with his length equal to the number of triangles - 1.
279
- //We add vertices data in this order
280
- this._indicesForBabylon.push(this._wrappedPositionForBabylon.length);
281
- //Push the position of vertice for Babylon
282
- //Each element is a Vector3(x,y,z)
283
- this._wrappedPositionForBabylon.push(positionVectorFromOBJ);
284
- //Push the uvs for Babylon
285
- //Each element is a Vector2(u,v)
286
- //If the UVs are missing, set (u,v)=(0,0)
287
- textureVectorFromOBJ = textureVectorFromOBJ ?? new Vector2(0, 0);
288
- this._wrappedUvsForBabylon.push(textureVectorFromOBJ);
289
- //Push the normals for Babylon
290
- //Each element is a Vector3(x,y,z)
291
- this._wrappedNormalsForBabylon.push(normalsVectorFromOBJ);
292
- if (positionColorsFromOBJ !== undefined) {
293
- //Push the colors for Babylon
294
- //Each element is a BABYLON.Color4(r,g,b,a)
295
- this._wrappedColorsForBabylon.push(positionColorsFromOBJ);
296
- }
297
- //Add the tuple in the comparison list
298
- this._tuplePosNorm[indicePositionFromObj].normals.push(indiceNormalFromObj);
299
- this._tuplePosNorm[indicePositionFromObj].idx.push(this._curPositionInIndices++);
300
- if (this._loadingOptions.optimizeWithUV) {
301
- this._tuplePosNorm[indicePositionFromObj].uv.push(indiceUvsFromObj);
302
- }
303
- }
304
- else {
305
- //The tuple already exists
306
- //Add the index of the already existing tuple
307
- //At this index we can get the value of position, normal, color and uvs of vertex
308
- this._indicesForBabylon.push(_index);
309
- }
310
- }
311
- /**
312
- * Transform Vector() and BABYLON.Color() objects into numbers in an array
313
- */
314
- _unwrapData() {
315
- //Every array has the same length
316
- for (let l = 0; l < this._wrappedPositionForBabylon.length; l++) {
317
- //Push the x, y, z values of each element in the unwrapped array
318
- this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[l].x * this._handednessSign, this._wrappedPositionForBabylon[l].y, this._wrappedPositionForBabylon[l].z);
319
- this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[l].x * this._handednessSign, this._wrappedNormalsForBabylon[l].y, this._wrappedNormalsForBabylon[l].z);
320
- this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[l].x, this._wrappedUvsForBabylon[l].y); //z is an optional value not supported by BABYLON
321
- if (this._loadingOptions.importVertexColors) {
322
- //Push the r, g, b, a values of each element in the unwrapped array
323
- this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[l].r, this._wrappedColorsForBabylon[l].g, this._wrappedColorsForBabylon[l].b, this._wrappedColorsForBabylon[l].a);
324
- }
325
- }
326
- // Reset arrays for the next new meshes
327
- this._wrappedPositionForBabylon.length = 0;
328
- this._wrappedNormalsForBabylon.length = 0;
329
- this._wrappedUvsForBabylon.length = 0;
330
- this._wrappedColorsForBabylon.length = 0;
331
- this._tuplePosNorm.length = 0;
332
- this._curPositionInIndices = 0;
333
- }
334
- /**
335
- * Create triangles from polygons
336
- * It is important to notice that a triangle is a polygon
337
- * We get 5 patterns of face defined in OBJ File :
338
- * facePattern1 = ["1","2","3","4","5","6"]
339
- * facePattern2 = ["1/1","2/2","3/3","4/4","5/5","6/6"]
340
- * facePattern3 = ["1/1/1","2/2/2","3/3/3","4/4/4","5/5/5","6/6/6"]
341
- * facePattern4 = ["1//1","2//2","3//3","4//4","5//5","6//6"]
342
- * facePattern5 = ["-1/-1/-1","-2/-2/-2","-3/-3/-3","-4/-4/-4","-5/-5/-5","-6/-6/-6"]
343
- * Each pattern is divided by the same method
344
- * @param faces Array[String] The indices of elements
345
- * @param v Integer The variable to increment
346
- */
347
- _getTriangles(faces, v) {
348
- //Work for each element of the array
349
- for (let faceIndex = v; faceIndex < faces.length - 1; faceIndex++) {
350
- //Add on the triangle variable the indexes to obtain triangles
351
- this._pushTriangle(faces, faceIndex);
352
- }
353
- //Result obtained after 2 iterations:
354
- //Pattern1 => triangle = ["1","2","3","1","3","4"];
355
- //Pattern2 => triangle = ["1/1","2/2","3/3","1/1","3/3","4/4"];
356
- //Pattern3 => triangle = ["1/1/1","2/2/2","3/3/3","1/1/1","3/3/3","4/4/4"];
357
- //Pattern4 => triangle = ["1//1","2//2","3//3","1//1","3//3","4//4"];
358
- //Pattern5 => triangle = ["-1/-1/-1","-2/-2/-2","-3/-3/-3","-1/-1/-1","-3/-3/-3","-4/-4/-4"];
359
- }
360
- /**
361
- * Create triangles and push the data for each polygon for the pattern 1
362
- * In this pattern we get vertice positions
363
- * @param face
364
- * @param v
365
- */
366
- _setDataForCurrentFaceWithPattern1(face, v) {
367
- //Get the indices of triangles for each polygon
368
- this._getTriangles(face, v);
369
- //For each element in the triangles array.
370
- //This var could contains 1 to an infinity of triangles
371
- for (let k = 0; k < this._triangles.length; k++) {
372
- // Set position indice
373
- const indicePositionFromObj = parseInt(this._triangles[k]) - 1;
374
- this._setData(indicePositionFromObj, 0, 0, // In the pattern 1, normals and uvs are not defined
375
- this._positions[indicePositionFromObj], // Get the vectors data
376
- Vector2.Zero(), Vector3.Up(), // Create default vectors
377
- this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined);
378
- }
379
- //Reset variable for the next line
380
- this._triangles.length = 0;
381
- }
382
- /**
383
- * Create triangles and push the data for each polygon for the pattern 2
384
- * In this pattern we get vertice positions and uvs
385
- * @param face
386
- * @param v
387
- */
388
- _setDataForCurrentFaceWithPattern2(face, v) {
389
- //Get the indices of triangles for each polygon
390
- this._getTriangles(face, v);
391
- for (let k = 0; k < this._triangles.length; k++) {
392
- //triangle[k] = "1/1"
393
- //Split the data for getting position and uv
394
- const point = this._triangles[k].split("/"); // ["1", "1"]
395
- //Set position indice
396
- const indicePositionFromObj = parseInt(point[0]) - 1;
397
- //Set uv indice
398
- const indiceUvsFromObj = parseInt(point[1]) - 1;
399
- this._setData(indicePositionFromObj, indiceUvsFromObj, 0, //Default value for normals
400
- this._positions[indicePositionFromObj], //Get the values for each element
401
- this._uvs[indiceUvsFromObj] ?? Vector2.Zero(), Vector3.Up(), //Default value for normals
402
- this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined);
403
- }
404
- //Reset variable for the next line
405
- this._triangles.length = 0;
406
- }
407
- /**
408
- * Create triangles and push the data for each polygon for the pattern 3
409
- * In this pattern we get vertice positions, uvs and normals
410
- * @param face
411
- * @param v
412
- */
413
- _setDataForCurrentFaceWithPattern3(face, v) {
414
- //Get the indices of triangles for each polygon
415
- this._getTriangles(face, v);
416
- for (let k = 0; k < this._triangles.length; k++) {
417
- //triangle[k] = "1/1/1"
418
- //Split the data for getting position, uv, and normals
419
- const point = this._triangles[k].split("/"); // ["1", "1", "1"]
420
- // Set position indice
421
- const indicePositionFromObj = parseInt(point[0]) - 1;
422
- // Set uv indice
423
- const indiceUvsFromObj = parseInt(point[1]) - 1;
424
- // Set normal indice
425
- const indiceNormalFromObj = parseInt(point[2]) - 1;
426
- this._setData(indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj, this._positions[indicePositionFromObj], this._uvs[indiceUvsFromObj] ?? Vector2.Zero(), this._normals[indiceNormalFromObj] ?? Vector3.Up() //Set the vector for each component
427
- );
428
- }
429
- //Reset variable for the next line
430
- this._triangles.length = 0;
431
- }
432
- /**
433
- * Create triangles and push the data for each polygon for the pattern 4
434
- * In this pattern we get vertice positions and normals
435
- * @param face
436
- * @param v
437
- */
438
- _setDataForCurrentFaceWithPattern4(face, v) {
439
- this._getTriangles(face, v);
440
- for (let k = 0; k < this._triangles.length; k++) {
441
- //triangle[k] = "1//1"
442
- //Split the data for getting position and normals
443
- const point = this._triangles[k].split("//"); // ["1", "1"]
444
- // We check indices, and normals
445
- const indicePositionFromObj = parseInt(point[0]) - 1;
446
- const indiceNormalFromObj = parseInt(point[1]) - 1;
447
- this._setData(indicePositionFromObj, 1, //Default value for uv
448
- indiceNormalFromObj, this._positions[indicePositionFromObj], //Get each vector of data
449
- Vector2.Zero(), this._normals[indiceNormalFromObj], this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined);
450
- }
451
- //Reset variable for the next line
452
- this._triangles.length = 0;
453
- }
454
- /*
455
- * Create triangles and push the data for each polygon for the pattern 3
456
- * In this pattern we get vertice positions, uvs and normals
457
- * @param face
458
- * @param v
459
- */
460
- _setDataForCurrentFaceWithPattern5(face, v) {
461
- //Get the indices of triangles for each polygon
462
- this._getTriangles(face, v);
463
- for (let k = 0; k < this._triangles.length; k++) {
464
- //triangle[k] = "-1/-1/-1"
465
- //Split the data for getting position, uv, and normals
466
- const point = this._triangles[k].split("/"); // ["-1", "-1", "-1"]
467
- // Set position indice
468
- const indicePositionFromObj = this._positions.length + parseInt(point[0]);
469
- // Set uv indice
470
- const indiceUvsFromObj = this._uvs.length + parseInt(point[1]);
471
- // Set normal indice
472
- const indiceNormalFromObj = this._normals.length + parseInt(point[2]);
473
- this._setData(indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj, this._positions[indicePositionFromObj], this._uvs[indiceUvsFromObj], this._normals[indiceNormalFromObj], //Set the vector for each component
474
- this._loadingOptions.importVertexColors ? this._colors[indicePositionFromObj] : undefined);
475
- }
476
- //Reset variable for the next line
477
- this._triangles.length = 0;
478
- }
479
- _addPreviousObjMesh() {
480
- //Check if it is not the first mesh. Otherwise we don't have data.
481
- if (this._meshesFromObj.length > 0) {
482
- //Get the previous mesh for applying the data about the faces
483
- //=> in obj file, faces definition append after the name of the mesh
484
- this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];
485
- //Set the data into Array for the mesh
486
- this._unwrapData();
487
- if (this._loadingOptions.useLegacyBehavior) {
488
- // Reverse tab. Otherwise face are displayed in the wrong sens
489
- this._indicesForBabylon.reverse();
490
- }
491
- //Set the information for the mesh
492
- //Slice the array to avoid rewriting because of the fact this is the same var which be rewrited
493
- this._handledMesh.indices = this._indicesForBabylon.slice();
494
- this._handledMesh.positions = this._unwrappedPositionsForBabylon.slice();
495
- this._handledMesh.normals = this._unwrappedNormalsForBabylon.slice();
496
- this._handledMesh.uvs = this._unwrappedUVForBabylon.slice();
497
- this._handledMesh.hasLines = this._hasLineData;
498
- if (this._loadingOptions.importVertexColors) {
499
- this._handledMesh.colors = this._unwrappedColorsForBabylon.slice();
500
- }
501
- //Reset the array for the next mesh
502
- this._indicesForBabylon.length = 0;
503
- this._unwrappedPositionsForBabylon.length = 0;
504
- this._unwrappedColorsForBabylon.length = 0;
505
- this._unwrappedNormalsForBabylon.length = 0;
506
- this._unwrappedUVForBabylon.length = 0;
507
- this._hasLineData = false;
508
- }
509
- }
510
- _optimizeNormals(mesh) {
511
- const positions = mesh.getVerticesData(VertexBuffer.PositionKind);
512
- const normals = mesh.getVerticesData(VertexBuffer.NormalKind);
513
- const mapVertices = {};
514
- if (!positions || !normals) {
515
- return;
516
- }
517
- for (let i = 0; i < positions.length / 3; i++) {
518
- const x = positions[i * 3 + 0];
519
- const y = positions[i * 3 + 1];
520
- const z = positions[i * 3 + 2];
521
- const key = x + "_" + y + "_" + z;
522
- let lst = mapVertices[key];
523
- if (!lst) {
524
- lst = [];
525
- mapVertices[key] = lst;
526
- }
527
- lst.push(i);
528
- }
529
- const normal = new Vector3();
530
- for (const key in mapVertices) {
531
- const lst = mapVertices[key];
532
- if (lst.length < 2) {
533
- continue;
534
- }
535
- const v0Idx = lst[0];
536
- for (let i = 1; i < lst.length; ++i) {
537
- const vIdx = lst[i];
538
- normals[v0Idx * 3 + 0] += normals[vIdx * 3 + 0];
539
- normals[v0Idx * 3 + 1] += normals[vIdx * 3 + 1];
540
- normals[v0Idx * 3 + 2] += normals[vIdx * 3 + 2];
541
- }
542
- normal.copyFromFloats(normals[v0Idx * 3 + 0], normals[v0Idx * 3 + 1], normals[v0Idx * 3 + 2]);
543
- normal.normalize();
544
- for (let i = 0; i < lst.length; ++i) {
545
- const vIdx = lst[i];
546
- normals[vIdx * 3 + 0] = normal.x;
547
- normals[vIdx * 3 + 1] = normal.y;
548
- normals[vIdx * 3 + 2] = normal.z;
549
- }
550
- }
551
- mesh.setVerticesData(VertexBuffer.NormalKind, normals);
552
- }
553
- static _IsLineElement(line) {
554
- return line.startsWith("l");
555
- }
556
- static _IsObjectElement(line) {
557
- return line.startsWith("o");
558
- }
559
- static _IsGroupElement(line) {
560
- return line.startsWith("g");
561
- }
562
- /**
563
- * Function used to parse an OBJ string
564
- * @param meshesNames defines the list of meshes to load (all if not defined)
565
- * @param data defines the OBJ string
566
- * @param scene defines the hosting scene
567
- * @param assetContainer defines the asset container to load data in
568
- * @param onFileToLoadFound defines a callback that will be called if a MTL file is found
569
- */
570
- parse(meshesNames, data, scene, assetContainer, onFileToLoadFound) {
571
- if (this._loadingOptions.useLegacyBehavior) {
572
- this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);
573
- this._handednessSign = 1;
574
- }
575
- else if (scene.useRightHandedSystem) {
576
- this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex + 1], faces[faceIndex]);
577
- this._handednessSign = 1;
578
- }
579
- else {
580
- this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);
581
- this._handednessSign = -1;
582
- }
583
- // Split the file into lines
584
- // Preprocess line data
585
- const linesOBJ = data.split("\n");
586
- const lineLines = [];
587
- let currentGroup = [];
588
- lineLines.push(currentGroup);
589
- for (let i = 0; i < linesOBJ.length; i++) {
590
- const line = linesOBJ[i].trim().replace(/\s\s/g, " ");
591
- // Comment or newLine
592
- if (line.length === 0 || line.charAt(0) === "#") {
593
- continue;
594
- }
595
- if (SolidParser._IsGroupElement(line) || SolidParser._IsObjectElement(line)) {
596
- currentGroup = [];
597
- lineLines.push(currentGroup);
598
- }
599
- if (SolidParser._IsLineElement(line)) {
600
- const lineValues = line.split(" ");
601
- // create line elements with two vertices only
602
- for (let i = 1; i < lineValues.length - 1; i++) {
603
- currentGroup.push(`l ${lineValues[i]} ${lineValues[i + 1]}`);
604
- }
605
- }
606
- else {
607
- currentGroup.push(line);
608
- }
609
- }
610
- const lines = lineLines.flat();
611
- // Look at each line
612
- for (let i = 0; i < lines.length; i++) {
613
- const line = lines[i].trim().replace(/\s\s/g, " ");
614
- let result;
615
- // Comment or newLine
616
- if (line.length === 0 || line.charAt(0) === "#") {
617
- continue;
618
- }
619
- else if (SolidParser.VertexPattern.test(line)) {
620
- //Get information about one position possible for the vertices
621
- result = line.match(/[^ ]+/g); // match will return non-null due to passing regex pattern
622
- // Value of result with line: "v 1.0 2.0 3.0"
623
- // ["v", "1.0", "2.0", "3.0"]
624
- // Create a Vector3 with the position x, y, z
625
- this._positions.push(new Vector3(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));
626
- if (this._loadingOptions.importVertexColors) {
627
- if (result.length >= 7) {
628
- const r = parseFloat(result[4]);
629
- const g = parseFloat(result[5]);
630
- const b = parseFloat(result[6]);
631
- this._colors.push(new Color4(r > 1 ? r / 255 : r, g > 1 ? g / 255 : g, b > 1 ? b / 255 : b, result.length === 7 || result[7] === undefined ? 1 : parseFloat(result[7])));
632
- }
633
- else {
634
- // TODO: maybe push NULL and if all are NULL to skip (and remove grayColor var).
635
- this._colors.push(this._grayColor);
636
- }
637
- }
638
- }
639
- else if ((result = SolidParser.NormalPattern.exec(line)) !== null) {
640
- //Create a Vector3 with the normals x, y, z
641
- //Value of result
642
- // ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
643
- //Add the Vector in the list of normals
644
- this._normals.push(new Vector3(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));
645
- }
646
- else if ((result = SolidParser.UVPattern.exec(line)) !== null) {
647
- //Create a Vector2 with the normals u, v
648
- //Value of result
649
- // ["vt 0.1 0.2 0.3", "0.1", "0.2"]
650
- //Add the Vector in the list of uvs
651
- this._uvs.push(new Vector2(parseFloat(result[1]) * this._loadingOptions.UVScaling.x, parseFloat(result[2]) * this._loadingOptions.UVScaling.y));
652
- //Identify patterns of faces
653
- //Face could be defined in different type of pattern
654
- }
655
- else if ((result = SolidParser.FacePattern3.exec(line)) !== null) {
656
- //Value of result:
657
- //["f 1/1/1 2/2/2 3/3/3", "1/1/1 2/2/2 3/3/3"...]
658
- //Set the data for this face
659
- this._setDataForCurrentFaceWithPattern3(result[1].trim().split(" "), // ["1/1/1", "2/2/2", "3/3/3"]
660
- 1);
661
- }
662
- else if ((result = SolidParser.FacePattern4.exec(line)) !== null) {
663
- //Value of result:
664
- //["f 1//1 2//2 3//3", "1//1 2//2 3//3"...]
665
- //Set the data for this face
666
- this._setDataForCurrentFaceWithPattern4(result[1].trim().split(" "), // ["1//1", "2//2", "3//3"]
667
- 1);
668
- }
669
- else if ((result = SolidParser.FacePattern5.exec(line)) !== null) {
670
- //Value of result:
671
- //["f -1/-1/-1 -2/-2/-2 -3/-3/-3", "-1/-1/-1 -2/-2/-2 -3/-3/-3"...]
672
- //Set the data for this face
673
- this._setDataForCurrentFaceWithPattern5(result[1].trim().split(" "), // ["-1/-1/-1", "-2/-2/-2", "-3/-3/-3"]
674
- 1);
675
- }
676
- else if ((result = SolidParser.FacePattern2.exec(line)) !== null) {
677
- //Value of result:
678
- //["f 1/1 2/2 3/3", "1/1 2/2 3/3"...]
679
- //Set the data for this face
680
- this._setDataForCurrentFaceWithPattern2(result[1].trim().split(" "), // ["1/1", "2/2", "3/3"]
681
- 1);
682
- }
683
- else if ((result = SolidParser.FacePattern1.exec(line)) !== null) {
684
- //Value of result
685
- //["f 1 2 3", "1 2 3"...]
686
- //Set the data for this face
687
- this._setDataForCurrentFaceWithPattern1(result[1].trim().split(" "), // ["1", "2", "3"]
688
- 1);
689
- // Define a mesh or an object
690
- // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh
691
- }
692
- else if ((result = SolidParser.LinePattern1.exec(line)) !== null) {
693
- //Value of result
694
- //["l 1 2"]
695
- //Set the data for this face
696
- this._setDataForCurrentFaceWithPattern1(result[1].trim().split(" "), // ["1", "2"]
697
- 0);
698
- this._hasLineData = true;
699
- // Define a mesh or an object
700
- // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh
701
- }
702
- else if ((result = SolidParser.LinePattern2.exec(line)) !== null) {
703
- //Value of result
704
- //["l 1/1 2/2"]
705
- //Set the data for this face
706
- this._setDataForCurrentFaceWithPattern2(result[1].trim().split(" "), // ["1/1", "2/2"]
707
- 0);
708
- this._hasLineData = true;
709
- // Define a mesh or an object
710
- // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh
711
- }
712
- else if ((result = SolidParser.LinePattern3.exec(line)) !== null) {
713
- //Value of result
714
- //["l 1/1/1 2/2/2"]
715
- //Set the data for this face
716
- this._setDataForCurrentFaceWithPattern3(result[1].trim().split(" "), // ["1/1/1", "2/2/2"]
717
- 0);
718
- this._hasLineData = true;
719
- // Define a mesh or an object
720
- // Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh
721
- }
722
- else if (SolidParser.GroupDescriptor.test(line) || SolidParser.ObjectDescriptor.test(line)) {
723
- // Create a new mesh corresponding to the name of the group.
724
- // Definition of the mesh
725
- const objMesh = {
726
- name: line.substring(2).trim(),
727
- indices: null,
728
- positions: null,
729
- normals: null,
730
- uvs: null,
731
- colors: null,
732
- materialName: this._materialNameFromObj,
733
- isObject: SolidParser.ObjectDescriptor.test(line),
734
- };
735
- this._addPreviousObjMesh();
736
- //Push the last mesh created with only the name
737
- this._meshesFromObj.push(objMesh);
738
- //Set this variable to indicate that now meshesFromObj has objects defined inside
739
- this._hasMeshes = true;
740
- this._isFirstMaterial = true;
741
- this._increment = 1;
742
- //Keyword for applying a material
743
- }
744
- else if (SolidParser.UseMtlDescriptor.test(line)) {
745
- //Get the name of the material
746
- this._materialNameFromObj = line.substring(7).trim();
747
- //If this new material is in the same mesh
748
- if (!this._isFirstMaterial || !this._hasMeshes) {
749
- //Set the data for the previous mesh
750
- this._addPreviousObjMesh();
751
- //Create a new mesh
752
- const objMesh =
753
- //Set the name of the current obj mesh
754
- {
755
- name: (this._objMeshName || "mesh") + "_mm" + this._increment.toString(),
756
- indices: null,
757
- positions: null,
758
- normals: null,
759
- uvs: null,
760
- colors: null,
761
- materialName: this._materialNameFromObj,
762
- isObject: false,
763
- };
764
- this._increment++;
765
- //If meshes are already defined
766
- this._meshesFromObj.push(objMesh);
767
- this._hasMeshes = true;
768
- }
769
- //Set the material name if the previous line define a mesh
770
- if (this._hasMeshes && this._isFirstMaterial) {
771
- //Set the material name to the previous mesh (1 material per mesh)
772
- this._meshesFromObj[this._meshesFromObj.length - 1].materialName = this._materialNameFromObj;
773
- this._isFirstMaterial = false;
774
- }
775
- // Keyword for loading the mtl file
776
- }
777
- else if (SolidParser.MtlLibGroupDescriptor.test(line)) {
778
- // Get the name of mtl file
779
- onFileToLoadFound(line.substring(7).trim());
780
- // Apply smoothing
781
- }
782
- else if (SolidParser.SmoothDescriptor.test(line)) ;
783
- else {
784
- //If there is another possibility
785
- Logger.Log("Unhandled expression at line : " + line);
786
- }
787
- }
788
- // At the end of the file, add the last mesh into the meshesFromObj array
789
- if (this._hasMeshes) {
790
- // Set the data for the last mesh
791
- this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];
792
- if (this._loadingOptions.useLegacyBehavior) {
793
- //Reverse indices for displaying faces in the good sense
794
- this._indicesForBabylon.reverse();
795
- }
796
- //Get the good array
797
- this._unwrapData();
798
- //Set array
799
- this._handledMesh.indices = this._indicesForBabylon;
800
- this._handledMesh.positions = this._unwrappedPositionsForBabylon;
801
- this._handledMesh.normals = this._unwrappedNormalsForBabylon;
802
- this._handledMesh.uvs = this._unwrappedUVForBabylon;
803
- this._handledMesh.hasLines = this._hasLineData;
804
- if (this._loadingOptions.importVertexColors) {
805
- this._handledMesh.colors = this._unwrappedColorsForBabylon;
806
- }
807
- }
808
- // If any o or g keyword not found, create a mesh with a random id
809
- if (!this._hasMeshes) {
810
- let newMaterial = null;
811
- if (this._indicesForBabylon.length) {
812
- if (this._loadingOptions.useLegacyBehavior) {
813
- // reverse tab of indices
814
- this._indicesForBabylon.reverse();
815
- }
816
- //Get positions normals uvs
817
- this._unwrapData();
818
- }
819
- else {
820
- // There is no indices in the file. We will have to switch to point cloud rendering
821
- for (const pos of this._positions) {
822
- this._unwrappedPositionsForBabylon.push(pos.x, pos.y, pos.z);
823
- }
824
- if (this._normals.length) {
825
- for (const normal of this._normals) {
826
- this._unwrappedNormalsForBabylon.push(normal.x, normal.y, normal.z);
827
- }
828
- }
829
- if (this._uvs.length) {
830
- for (const uv of this._uvs) {
831
- this._unwrappedUVForBabylon.push(uv.x, uv.y);
832
- }
833
- }
834
- if (this._colors.length) {
835
- for (const color of this._colors) {
836
- this._unwrappedColorsForBabylon.push(color.r, color.g, color.b, color.a);
837
- }
838
- }
839
- if (!this._materialNameFromObj) {
840
- // Create a material with point cloud on
841
- newMaterial = new StandardMaterial(Geometry.RandomId(), scene);
842
- newMaterial.pointsCloud = true;
843
- this._materialNameFromObj = newMaterial.name;
844
- if (!this._normals.length) {
845
- newMaterial.disableLighting = true;
846
- newMaterial.emissiveColor = Color3.White();
847
- }
848
- }
849
- }
850
- //Set data for one mesh
851
- this._meshesFromObj.push({
852
- name: Geometry.RandomId(),
853
- indices: this._indicesForBabylon,
854
- positions: this._unwrappedPositionsForBabylon,
855
- colors: this._unwrappedColorsForBabylon,
856
- normals: this._unwrappedNormalsForBabylon,
857
- uvs: this._unwrappedUVForBabylon,
858
- materialName: this._materialNameFromObj,
859
- directMaterial: newMaterial,
860
- isObject: true,
861
- hasLines: this._hasLineData,
862
- });
863
- }
864
- //Set data for each mesh
865
- for (let j = 0; j < this._meshesFromObj.length; j++) {
866
- //check meshesNames (stlFileLoader)
867
- if (meshesNames && this._meshesFromObj[j].name) {
868
- if (meshesNames instanceof Array) {
869
- if (meshesNames.indexOf(this._meshesFromObj[j].name) === -1) {
870
- continue;
871
- }
872
- }
873
- else {
874
- if (this._meshesFromObj[j].name !== meshesNames) {
875
- continue;
876
- }
877
- }
878
- }
879
- //Get the current mesh
880
- //Set the data with VertexBuffer for each mesh
881
- this._handledMesh = this._meshesFromObj[j];
882
- //Create a Mesh with the name of the obj mesh
883
- scene._blockEntityCollection = !!assetContainer;
884
- const babylonMesh = new Mesh(this._meshesFromObj[j].name, scene);
885
- babylonMesh._parentContainer = assetContainer;
886
- scene._blockEntityCollection = false;
887
- this._handledMesh._babylonMesh = babylonMesh;
888
- // If this is a group mesh, it should have an object mesh as a parent. So look for the first object mesh that appears before it.
889
- if (!this._handledMesh.isObject) {
890
- for (let k = j - 1; k >= 0; --k) {
891
- if (this._meshesFromObj[k].isObject && this._meshesFromObj[k]._babylonMesh) {
892
- babylonMesh.parent = this._meshesFromObj[k]._babylonMesh;
893
- break;
894
- }
895
- }
896
- }
897
- //Push the name of the material to an array
898
- //This is indispensable for the importMesh function
899
- this._materialToUse.push(this._meshesFromObj[j].materialName);
900
- //If the mesh is a line mesh
901
- if (this._handledMesh.hasLines) {
902
- babylonMesh._internalMetadata ??= {};
903
- babylonMesh._internalMetadata["_isLine"] = true; //this is a line mesh
904
- }
905
- if (this._handledMesh.positions?.length === 0) {
906
- //Push the mesh into an array
907
- this._babylonMeshesArray.push(babylonMesh);
908
- continue;
909
- }
910
- const vertexData = new VertexData(); //The container for the values
911
- //Set the data for the babylonMesh
912
- vertexData.uvs = this._handledMesh.uvs;
913
- vertexData.indices = this._handledMesh.indices;
914
- vertexData.positions = this._handledMesh.positions;
915
- if (this._loadingOptions.computeNormals) {
916
- const normals = new Array();
917
- VertexData.ComputeNormals(this._handledMesh.positions, this._handledMesh.indices, normals);
918
- vertexData.normals = normals;
919
- }
920
- else {
921
- vertexData.normals = this._handledMesh.normals;
922
- }
923
- if (this._loadingOptions.importVertexColors) {
924
- vertexData.colors = this._handledMesh.colors;
925
- }
926
- //Set the data from the VertexBuffer to the current Mesh
927
- vertexData.applyToMesh(babylonMesh);
928
- if (this._loadingOptions.invertY) {
929
- babylonMesh.scaling.y *= -1;
930
- }
931
- if (this._loadingOptions.optimizeNormals) {
932
- this._optimizeNormals(babylonMesh);
933
- }
934
- //Push the mesh into an array
935
- this._babylonMeshesArray.push(babylonMesh);
936
- if (this._handledMesh.directMaterial) {
937
- babylonMesh.material = this._handledMesh.directMaterial;
938
- }
939
- }
940
- }
941
- }
942
- // Descriptor
943
- /** Object descriptor */
944
- SolidParser.ObjectDescriptor = /^o/;
945
- /** Group descriptor */
946
- SolidParser.GroupDescriptor = /^g/;
947
- /** Material lib descriptor */
948
- SolidParser.MtlLibGroupDescriptor = /^mtllib /;
949
- /** Use a material descriptor */
950
- SolidParser.UseMtlDescriptor = /^usemtl /;
951
- /** Smooth descriptor */
952
- SolidParser.SmoothDescriptor = /^s /;
953
- // Patterns
954
- /** Pattern used to detect a vertex */
955
- SolidParser.VertexPattern = /^v(\s+[\d|.|+|\-|e|E]+){3,7}/;
956
- /** Pattern used to detect a normal */
957
- SolidParser.NormalPattern = /^vn(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/;
958
- /** Pattern used to detect a UV set */
959
- SolidParser.UVPattern = /^vt(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/;
960
- /** Pattern used to detect a first kind of face (f vertex vertex vertex) */
961
- SolidParser.FacePattern1 = /^f\s+(([\d]{1,}[\s]?){3,})+/;
962
- /** Pattern used to detect a second kind of face (f vertex/uvs vertex/uvs vertex/uvs) */
963
- SolidParser.FacePattern2 = /^f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/;
964
- /** Pattern used to detect a third kind of face (f vertex/uvs/normal vertex/uvs/normal vertex/uvs/normal) */
965
- SolidParser.FacePattern3 = /^f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/;
966
- /** Pattern used to detect a fourth kind of face (f vertex//normal vertex//normal vertex//normal)*/
967
- SolidParser.FacePattern4 = /^f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/;
968
- /** Pattern used to detect a fifth kind of face (f -vertex/-uvs/-normal -vertex/-uvs/-normal -vertex/-uvs/-normal) */
969
- SolidParser.FacePattern5 = /^f\s+(((-[\d]{1,}\/-[\d]{1,}\/-[\d]{1,}[\s]?){3,})+)/;
970
- /** Pattern used to detect a line(l vertex vertex) */
971
- SolidParser.LinePattern1 = /^l\s+(([\d]{1,}[\s]?){2,})+/;
972
- /** Pattern used to detect a second kind of line (l vertex/uvs vertex/uvs) */
973
- SolidParser.LinePattern2 = /^l\s+((([\d]{1,}\/[\d]{1,}[\s]?){2,})+)/;
974
- /** Pattern used to detect a third kind of line (l vertex/uvs/normal vertex/uvs/normal) */
975
- SolidParser.LinePattern3 = /^l\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){2,})+)/;
976
-
977
- /**
978
- * OBJ file type loader.
979
- * This is a babylon scene loader plugin.
980
- */
981
- class OBJFileLoader {
982
- /**
983
- * Invert Y-Axis of referenced textures on load
984
- */
985
- static get INVERT_TEXTURE_Y() {
986
- return MTLFileLoader.INVERT_TEXTURE_Y;
987
- }
988
- static set INVERT_TEXTURE_Y(value) {
989
- MTLFileLoader.INVERT_TEXTURE_Y = value;
990
- }
991
- /**
992
- * Creates loader for .OBJ files
993
- *
994
- * @param loadingOptions options for loading and parsing OBJ/MTL files.
995
- */
996
- constructor(loadingOptions) {
997
- /**
998
- * Defines the name of the plugin.
999
- */
1000
- this.name = OBJFileLoaderMetadata.name;
1001
- /**
1002
- * Defines the extension the plugin is able to load.
1003
- */
1004
- this.extensions = OBJFileLoaderMetadata.extensions;
1005
- this._assetContainer = null;
1006
- this._loadingOptions = loadingOptions || OBJFileLoader._DefaultLoadingOptions;
1007
- }
1008
- static get _DefaultLoadingOptions() {
1009
- return {
1010
- computeNormals: OBJFileLoader.COMPUTE_NORMALS,
1011
- optimizeNormals: OBJFileLoader.OPTIMIZE_NORMALS,
1012
- importVertexColors: OBJFileLoader.IMPORT_VERTEX_COLORS,
1013
- invertY: OBJFileLoader.INVERT_Y,
1014
- invertTextureY: OBJFileLoader.INVERT_TEXTURE_Y,
1015
- // eslint-disable-next-line @typescript-eslint/naming-convention
1016
- UVScaling: OBJFileLoader.UV_SCALING,
1017
- materialLoadingFailsSilently: OBJFileLoader.MATERIAL_LOADING_FAILS_SILENTLY,
1018
- optimizeWithUV: OBJFileLoader.OPTIMIZE_WITH_UV,
1019
- skipMaterials: OBJFileLoader.SKIP_MATERIALS,
1020
- useLegacyBehavior: OBJFileLoader.USE_LEGACY_BEHAVIOR,
1021
- };
1022
- }
1023
- /**
1024
- * Calls synchronously the MTL file attached to this obj.
1025
- * Load function or importMesh function don't enable to load 2 files in the same time asynchronously.
1026
- * Without this function materials are not displayed in the first frame (but displayed after).
1027
- * In consequence it is impossible to get material information in your HTML file
1028
- *
1029
- * @param url The URL of the MTL file
1030
- * @param rootUrl defines where to load data from
1031
- * @param onSuccess Callback function to be called when the MTL file is loaded
1032
- * @param onFailure
1033
- */
1034
- _loadMTL(url, rootUrl, onSuccess, onFailure) {
1035
- //The complete path to the mtl file
1036
- const pathOfFile = rootUrl + url;
1037
- // Loads through the babylon tools to allow fileInput search.
1038
- Tools.LoadFile(pathOfFile, onSuccess, undefined, undefined, false, (request, exception) => {
1039
- onFailure(pathOfFile, exception);
1040
- });
1041
- }
1042
- /**
1043
- * Instantiates a OBJ file loader plugin.
1044
- * @returns the created plugin
1045
- */
1046
- createPlugin() {
1047
- return new OBJFileLoader(OBJFileLoader._DefaultLoadingOptions);
1048
- }
1049
- /**
1050
- * If the data string can be loaded directly.
1051
- * @returns if the data can be loaded directly
1052
- */
1053
- canDirectLoad() {
1054
- return false;
1055
- }
1056
- /**
1057
- * Imports one or more meshes from the loaded OBJ data and adds them to the scene
1058
- * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
1059
- * @param scene the scene the meshes should be added to
1060
- * @param data the OBJ data to load
1061
- * @param rootUrl root url to load from
1062
- * @returns a promise containing the loaded meshes, particles, skeletons and animations
1063
- */
1064
- importMeshAsync(meshesNames, scene, data, rootUrl) {
1065
- //get the meshes from OBJ file
1066
- return this._parseSolid(meshesNames, scene, data, rootUrl).then((meshes) => {
1067
- return {
1068
- meshes: meshes,
1069
- particleSystems: [],
1070
- skeletons: [],
1071
- animationGroups: [],
1072
- transformNodes: [],
1073
- geometries: [],
1074
- lights: [],
1075
- spriteManagers: [],
1076
- };
1077
- });
1078
- }
1079
- /**
1080
- * Imports all objects from the loaded OBJ data and adds them to the scene
1081
- * @param scene the scene the objects should be added to
1082
- * @param data the OBJ data to load
1083
- * @param rootUrl root url to load from
1084
- * @returns a promise which completes when objects have been loaded to the scene
1085
- */
1086
- loadAsync(scene, data, rootUrl) {
1087
- //Get the 3D model
1088
- return this.importMeshAsync(null, scene, data, rootUrl).then(() => {
1089
- // return void
1090
- });
1091
- }
1092
- /**
1093
- * Load into an asset container.
1094
- * @param scene The scene to load into
1095
- * @param data The data to import
1096
- * @param rootUrl The root url for scene and resources
1097
- * @returns The loaded asset container
1098
- */
1099
- loadAssetContainerAsync(scene, data, rootUrl) {
1100
- const container = new AssetContainer(scene);
1101
- this._assetContainer = container;
1102
- return this.importMeshAsync(null, scene, data, rootUrl)
1103
- .then((result) => {
1104
- result.meshes.forEach((mesh) => container.meshes.push(mesh));
1105
- result.meshes.forEach((mesh) => {
1106
- const material = mesh.material;
1107
- if (material) {
1108
- // Materials
1109
- if (container.materials.indexOf(material) == -1) {
1110
- container.materials.push(material);
1111
- // Textures
1112
- const textures = material.getActiveTextures();
1113
- textures.forEach((t) => {
1114
- if (container.textures.indexOf(t) == -1) {
1115
- container.textures.push(t);
1116
- }
1117
- });
1118
- }
1119
- }
1120
- });
1121
- this._assetContainer = null;
1122
- return container;
1123
- })
1124
- .catch((ex) => {
1125
- this._assetContainer = null;
1126
- throw ex;
1127
- });
1128
- }
1129
- /**
1130
- * Read the OBJ file and create an Array of meshes.
1131
- * Each mesh contains all information given by the OBJ and the MTL file.
1132
- * i.e. vertices positions and indices, optional normals values, optional UV values, optional material
1133
- * @param meshesNames defines a string or array of strings of the mesh names that should be loaded from the file
1134
- * @param scene defines the scene where are displayed the data
1135
- * @param data defines the content of the obj file
1136
- * @param rootUrl defines the path to the folder
1137
- * @returns the list of loaded meshes
1138
- */
1139
- _parseSolid(meshesNames, scene, data, rootUrl) {
1140
- let fileToLoad = ""; //The name of the mtlFile to load
1141
- const materialsFromMTLFile = new MTLFileLoader();
1142
- const materialToUse = [];
1143
- const babylonMeshesArray = []; //The mesh for babylon
1144
- // Sanitize data
1145
- data = data.replace(/#.*$/gm, "").trim();
1146
- // Main function
1147
- const solidParser = new SolidParser(materialToUse, babylonMeshesArray, this._loadingOptions);
1148
- solidParser.parse(meshesNames, data, scene, this._assetContainer, (fileName) => {
1149
- fileToLoad = fileName;
1150
- });
1151
- // load the materials
1152
- const mtlPromises = [];
1153
- // Check if we have a file to load
1154
- if (fileToLoad !== "" && !this._loadingOptions.skipMaterials) {
1155
- //Load the file synchronously
1156
- mtlPromises.push(new Promise((resolve, reject) => {
1157
- this._loadMTL(fileToLoad, rootUrl, (dataLoaded) => {
1158
- try {
1159
- //Create materials thanks MTLLoader function
1160
- materialsFromMTLFile.parseMTL(scene, dataLoaded, rootUrl, this._assetContainer);
1161
- //Look at each material loaded in the mtl file
1162
- for (let n = 0; n < materialsFromMTLFile.materials.length; n++) {
1163
- //Three variables to get all meshes with the same material
1164
- let startIndex = 0;
1165
- const _indices = [];
1166
- let _index;
1167
- //The material from MTL file is used in the meshes loaded
1168
- //Push the indice in an array
1169
- //Check if the material is not used for another mesh
1170
- while ((_index = materialToUse.indexOf(materialsFromMTLFile.materials[n].name, startIndex)) > -1) {
1171
- _indices.push(_index);
1172
- startIndex = _index + 1;
1173
- }
1174
- //If the material is not used dispose it
1175
- if (_index === -1 && _indices.length === 0) {
1176
- //If the material is not needed, remove it
1177
- materialsFromMTLFile.materials[n].dispose();
1178
- }
1179
- else {
1180
- for (let o = 0; o < _indices.length; o++) {
1181
- //Apply the material to the Mesh for each mesh with the material
1182
- const mesh = babylonMeshesArray[_indices[o]];
1183
- const material = materialsFromMTLFile.materials[n];
1184
- mesh.material = material;
1185
- if (!mesh.getTotalIndices()) {
1186
- // No indices, we need to turn on point cloud
1187
- material.pointsCloud = true;
1188
- }
1189
- }
1190
- }
1191
- }
1192
- resolve();
1193
- }
1194
- catch (e) {
1195
- Tools.Warn(`Error processing MTL file: '${fileToLoad}'`);
1196
- if (this._loadingOptions.materialLoadingFailsSilently) {
1197
- resolve();
1198
- }
1199
- else {
1200
- reject(e);
1201
- }
1202
- }
1203
- }, (pathOfFile, exception) => {
1204
- Tools.Warn(`Error downloading MTL file: '${fileToLoad}'`);
1205
- if (this._loadingOptions.materialLoadingFailsSilently) {
1206
- resolve();
1207
- }
1208
- else {
1209
- reject(exception);
1210
- }
1211
- });
1212
- }));
1213
- }
1214
- //Return an array with all Mesh
1215
- return Promise.all(mtlPromises).then(() => {
1216
- const isLine = (mesh) => Boolean(mesh._internalMetadata?.["_isLine"] ?? false);
1217
- // Iterate over the mesh, determine if it is a line mesh, clone or modify the material to line rendering.
1218
- babylonMeshesArray.forEach((mesh) => {
1219
- if (isLine(mesh)) {
1220
- let mat = mesh.material ?? new StandardMaterial(mesh.name + "_line", scene);
1221
- // If another mesh is using this material and it is not a line then we need to clone it.
1222
- const needClone = mat.getBindedMeshes().filter((e) => !isLine(e)).length > 0;
1223
- if (needClone) {
1224
- mat = mat.clone(mat.name + "_line") ?? mat;
1225
- }
1226
- mat.wireframe = true;
1227
- mesh.material = mat;
1228
- if (mesh._internalMetadata) {
1229
- mesh._internalMetadata["_isLine"] = undefined;
1230
- }
1231
- }
1232
- });
1233
- return babylonMeshesArray;
1234
- });
1235
- }
1236
- }
1237
- /**
1238
- * Defines if UVs are optimized by default during load.
1239
- */
1240
- OBJFileLoader.OPTIMIZE_WITH_UV = true;
1241
- /**
1242
- * Invert model on y-axis (does a model scaling inversion)
1243
- */
1244
- OBJFileLoader.INVERT_Y = false;
1245
- /**
1246
- * Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
1247
- */
1248
- OBJFileLoader.IMPORT_VERTEX_COLORS = false;
1249
- /**
1250
- * Compute the normals for the model, even if normals are present in the file.
1251
- */
1252
- OBJFileLoader.COMPUTE_NORMALS = false;
1253
- /**
1254
- * Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces.
1255
- * Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.
1256
- */
1257
- OBJFileLoader.OPTIMIZE_NORMALS = false;
1258
- /**
1259
- * Defines custom scaling of UV coordinates of loaded meshes.
1260
- */
1261
- OBJFileLoader.UV_SCALING = new Vector2(1, 1);
1262
- /**
1263
- * Skip loading the materials even if defined in the OBJ file (materials are ignored).
1264
- */
1265
- OBJFileLoader.SKIP_MATERIALS = false;
1266
- /**
1267
- * When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.
1268
- *
1269
- * Defaults to true for backwards compatibility.
1270
- */
1271
- OBJFileLoader.MATERIAL_LOADING_FAILS_SILENTLY = true;
1272
- /**
1273
- * Loads assets without handedness conversions. This flag is for compatibility. Use it only if absolutely required. Defaults to false.
1274
- */
1275
- OBJFileLoader.USE_LEGACY_BEHAVIOR = false;
1276
- //Add this loader into the register plugin
1277
- registerSceneLoaderPlugin(new OBJFileLoader());
1278
-
1279
- export { OBJFileLoader };
1280
- //# sourceMappingURL=objFileLoader-a8al6qfI.esm.js.map