@babylonjs/viewer 7.25.2-alpha → 7.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (530) 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-BH3hZg5O.esm.min.js +0 -2
  197. package/dist/chunks/EXT_lights_image_based-BH3hZg5O.esm.min.js.map +0 -1
  198. package/dist/chunks/EXT_lights_image_based-DzfllwXH.esm.js +0 -170
  199. package/dist/chunks/EXT_lights_image_based-DzfllwXH.esm.js.map +0 -1
  200. package/dist/chunks/EXT_mesh_gpu_instancing-C9OEhnvW.esm.js +0 -86
  201. package/dist/chunks/EXT_mesh_gpu_instancing-C9OEhnvW.esm.js.map +0 -1
  202. package/dist/chunks/EXT_mesh_gpu_instancing-CXIBSaqJ.esm.min.js +0 -2
  203. package/dist/chunks/EXT_mesh_gpu_instancing-CXIBSaqJ.esm.min.js.map +0 -1
  204. package/dist/chunks/EXT_meshopt_compression-FHhysyRP.esm.min.js +0 -2
  205. package/dist/chunks/EXT_meshopt_compression-FHhysyRP.esm.min.js.map +0 -1
  206. package/dist/chunks/EXT_meshopt_compression-MDnzeuix.esm.js +0 -134
  207. package/dist/chunks/EXT_meshopt_compression-MDnzeuix.esm.js.map +0 -1
  208. package/dist/chunks/EXT_texture_avif-DYg5PN0r.esm.js +0 -44
  209. package/dist/chunks/EXT_texture_avif-DYg5PN0r.esm.js.map +0 -1
  210. package/dist/chunks/EXT_texture_avif-aYOG80m1.esm.min.js +0 -2
  211. package/dist/chunks/EXT_texture_avif-aYOG80m1.esm.min.js.map +0 -1
  212. package/dist/chunks/EXT_texture_webp-C4SoS8oM.esm.min.js +0 -2
  213. package/dist/chunks/EXT_texture_webp-C4SoS8oM.esm.min.js.map +0 -1
  214. package/dist/chunks/EXT_texture_webp-CFXwdFPL.esm.js +0 -43
  215. package/dist/chunks/EXT_texture_webp-CFXwdFPL.esm.js.map +0 -1
  216. package/dist/chunks/ExtrasAsMetadata-0irOjN40.esm.min.js +0 -2
  217. package/dist/chunks/ExtrasAsMetadata-0irOjN40.esm.min.js.map +0 -1
  218. package/dist/chunks/ExtrasAsMetadata-CMMGMmGq.esm.js +0 -64
  219. package/dist/chunks/ExtrasAsMetadata-CMMGMmGq.esm.js.map +0 -1
  220. package/dist/chunks/KHR_animation_pointer-BP1GTrPy.esm.js +0 -343
  221. package/dist/chunks/KHR_animation_pointer-BP1GTrPy.esm.js.map +0 -1
  222. package/dist/chunks/KHR_animation_pointer-DYUHlqMb.esm.min.js +0 -2
  223. package/dist/chunks/KHR_animation_pointer-DYUHlqMb.esm.min.js.map +0 -1
  224. package/dist/chunks/KHR_draco_mesh_compression-1__XqV2v.esm.js +0 -610
  225. package/dist/chunks/KHR_draco_mesh_compression-1__XqV2v.esm.js.map +0 -1
  226. package/dist/chunks/KHR_draco_mesh_compression-DugkDX1-.esm.min.js +0 -2
  227. package/dist/chunks/KHR_draco_mesh_compression-DugkDX1-.esm.min.js.map +0 -1
  228. package/dist/chunks/KHR_interactivity-CG9wdbbE.esm.js +0 -4033
  229. package/dist/chunks/KHR_interactivity-CG9wdbbE.esm.js.map +0 -1
  230. package/dist/chunks/KHR_interactivity-DTEAfXZw.esm.min.js +0 -2
  231. package/dist/chunks/KHR_interactivity-DTEAfXZw.esm.min.js.map +0 -1
  232. package/dist/chunks/KHR_lights_punctual-BJoC3s-k.esm.js +0 -1253
  233. package/dist/chunks/KHR_lights_punctual-BJoC3s-k.esm.js.map +0 -1
  234. package/dist/chunks/KHR_lights_punctual-CJ8IXFIN.esm.min.js +0 -2
  235. package/dist/chunks/KHR_lights_punctual-CJ8IXFIN.esm.min.js.map +0 -1
  236. package/dist/chunks/KHR_materials_anisotropy-D-JkJqtx.esm.min.js +0 -2
  237. package/dist/chunks/KHR_materials_anisotropy-D-JkJqtx.esm.min.js.map +0 -1
  238. package/dist/chunks/KHR_materials_anisotropy-vQUJOfyf.esm.js +0 -64
  239. package/dist/chunks/KHR_materials_anisotropy-vQUJOfyf.esm.js.map +0 -1
  240. package/dist/chunks/KHR_materials_clearcoat-DGkjpld9.esm.js +0 -96
  241. package/dist/chunks/KHR_materials_clearcoat-DGkjpld9.esm.js.map +0 -1
  242. package/dist/chunks/KHR_materials_clearcoat-D_sScrmJ.esm.min.js +0 -2
  243. package/dist/chunks/KHR_materials_clearcoat-D_sScrmJ.esm.min.js.map +0 -1
  244. package/dist/chunks/KHR_materials_diffuse_transmission-B-AVMVdy.esm.js +0 -97
  245. package/dist/chunks/KHR_materials_diffuse_transmission-B-AVMVdy.esm.js.map +0 -1
  246. package/dist/chunks/KHR_materials_diffuse_transmission-D89RzboR.esm.min.js +0 -2
  247. package/dist/chunks/KHR_materials_diffuse_transmission-D89RzboR.esm.min.js.map +0 -1
  248. package/dist/chunks/KHR_materials_dispersion-B8b6MXDS.esm.min.js +0 -2
  249. package/dist/chunks/KHR_materials_dispersion-B8b6MXDS.esm.min.js.map +0 -1
  250. package/dist/chunks/KHR_materials_dispersion-Biijd7CZ.esm.js +0 -62
  251. package/dist/chunks/KHR_materials_dispersion-Biijd7CZ.esm.js.map +0 -1
  252. package/dist/chunks/KHR_materials_emissive_strength-CphmP7Mx.esm.min.js +0 -2
  253. package/dist/chunks/KHR_materials_emissive_strength-CphmP7Mx.esm.min.js.map +0 -1
  254. package/dist/chunks/KHR_materials_emissive_strength-HYht21Ls.esm.js +0 -55
  255. package/dist/chunks/KHR_materials_emissive_strength-HYht21Ls.esm.js.map +0 -1
  256. package/dist/chunks/KHR_materials_ior-CMHiVWXF.esm.js +0 -64
  257. package/dist/chunks/KHR_materials_ior-CMHiVWXF.esm.js.map +0 -1
  258. package/dist/chunks/KHR_materials_ior-Dtd5Uruf.esm.min.js +0 -2
  259. package/dist/chunks/KHR_materials_ior-Dtd5Uruf.esm.min.js.map +0 -1
  260. package/dist/chunks/KHR_materials_iridescence-BPYqwadf.esm.min.js +0 -2
  261. package/dist/chunks/KHR_materials_iridescence-BPYqwadf.esm.min.js.map +0 -1
  262. package/dist/chunks/KHR_materials_iridescence-uiK5wAia.esm.js +0 -72
  263. package/dist/chunks/KHR_materials_iridescence-uiK5wAia.esm.js.map +0 -1
  264. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-At-foveb.esm.js +0 -81
  265. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-At-foveb.esm.js.map +0 -1
  266. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-D-0vzv_p.esm.min.js +0 -2
  267. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-D-0vzv_p.esm.min.js.map +0 -1
  268. package/dist/chunks/KHR_materials_sheen-D9QlTIrL.esm.min.js +0 -2
  269. package/dist/chunks/KHR_materials_sheen-D9QlTIrL.esm.min.js.map +0 -1
  270. package/dist/chunks/KHR_materials_sheen-D_dNVJOm.esm.js +0 -85
  271. package/dist/chunks/KHR_materials_sheen-D_dNVJOm.esm.js.map +0 -1
  272. package/dist/chunks/KHR_materials_specular-BoPxT-Mo.esm.min.js +0 -2
  273. package/dist/chunks/KHR_materials_specular-BoPxT-Mo.esm.min.js.map +0 -1
  274. package/dist/chunks/KHR_materials_specular-DQxjj2Cx.esm.js +0 -75
  275. package/dist/chunks/KHR_materials_specular-DQxjj2Cx.esm.js.map +0 -1
  276. package/dist/chunks/KHR_materials_transmission-BFM7Cmhe.esm.js +0 -307
  277. package/dist/chunks/KHR_materials_transmission-BFM7Cmhe.esm.js.map +0 -1
  278. package/dist/chunks/KHR_materials_transmission-Cmv46WbD.esm.min.js +0 -2
  279. package/dist/chunks/KHR_materials_transmission-Cmv46WbD.esm.min.js.map +0 -1
  280. package/dist/chunks/KHR_materials_unlit-5NSHSTuh.esm.js +0 -74
  281. package/dist/chunks/KHR_materials_unlit-5NSHSTuh.esm.js.map +0 -1
  282. package/dist/chunks/KHR_materials_unlit-D0eVH4Om.esm.min.js +0 -2
  283. package/dist/chunks/KHR_materials_unlit-D0eVH4Om.esm.min.js.map +0 -1
  284. package/dist/chunks/KHR_materials_variants-DV9kQ9N0.esm.js +0 -238
  285. package/dist/chunks/KHR_materials_variants-DV9kQ9N0.esm.js.map +0 -1
  286. package/dist/chunks/KHR_materials_variants-q_OSyG78.esm.min.js +0 -2
  287. package/dist/chunks/KHR_materials_variants-q_OSyG78.esm.min.js.map +0 -1
  288. package/dist/chunks/KHR_materials_volume-B-2guGwk.esm.min.js +0 -2
  289. package/dist/chunks/KHR_materials_volume-B-2guGwk.esm.min.js.map +0 -1
  290. package/dist/chunks/KHR_materials_volume-ByNJMyHb.esm.js +0 -87
  291. package/dist/chunks/KHR_materials_volume-ByNJMyHb.esm.js.map +0 -1
  292. package/dist/chunks/KHR_mesh_quantization-B-dDY2nG.esm.min.js +0 -2
  293. package/dist/chunks/KHR_mesh_quantization-B-dDY2nG.esm.min.js.map +0 -1
  294. package/dist/chunks/KHR_mesh_quantization-CtRIMI9n.esm.js +0 -26
  295. package/dist/chunks/KHR_mesh_quantization-CtRIMI9n.esm.js.map +0 -1
  296. package/dist/chunks/KHR_texture_basisu-Bpv_M6W8.esm.js +0 -43
  297. package/dist/chunks/KHR_texture_basisu-Bpv_M6W8.esm.js.map +0 -1
  298. package/dist/chunks/KHR_texture_basisu-CDZ_8ojt.esm.min.js +0 -2
  299. package/dist/chunks/KHR_texture_basisu-CDZ_8ojt.esm.min.js.map +0 -1
  300. package/dist/chunks/KHR_texture_transform-DR04vBMi.esm.js +0 -63
  301. package/dist/chunks/KHR_texture_transform-DR04vBMi.esm.js.map +0 -1
  302. package/dist/chunks/KHR_texture_transform-Dxlw1ALx.esm.min.js +0 -2
  303. package/dist/chunks/KHR_texture_transform-Dxlw1ALx.esm.min.js.map +0 -1
  304. package/dist/chunks/KHR_xmp_json_ld-BE7tnUAA.esm.js +0 -51
  305. package/dist/chunks/KHR_xmp_json_ld-BE7tnUAA.esm.js.map +0 -1
  306. package/dist/chunks/KHR_xmp_json_ld-Cba_e7FN.esm.min.js +0 -2
  307. package/dist/chunks/KHR_xmp_json_ld-Cba_e7FN.esm.min.js.map +0 -1
  308. package/dist/chunks/MSFT_audio_emitter-C7N149TS.esm.min.js +0 -2
  309. package/dist/chunks/MSFT_audio_emitter-C7N149TS.esm.min.js.map +0 -1
  310. package/dist/chunks/MSFT_audio_emitter-Dli0UATE.esm.js +0 -2236
  311. package/dist/chunks/MSFT_audio_emitter-Dli0UATE.esm.js.map +0 -1
  312. package/dist/chunks/MSFT_lod-B_XcOQr8.esm.min.js +0 -2
  313. package/dist/chunks/MSFT_lod-B_XcOQr8.esm.min.js.map +0 -1
  314. package/dist/chunks/MSFT_lod-Ce-KRZp9.esm.js +0 -337
  315. package/dist/chunks/MSFT_lod-Ce-KRZp9.esm.js.map +0 -1
  316. package/dist/chunks/MSFT_minecraftMesh-C1iLB8-L.esm.min.js +0 -2
  317. package/dist/chunks/MSFT_minecraftMesh-C1iLB8-L.esm.min.js.map +0 -1
  318. package/dist/chunks/MSFT_minecraftMesh-D7vFOPNh.esm.js +0 -46
  319. package/dist/chunks/MSFT_minecraftMesh-D7vFOPNh.esm.js.map +0 -1
  320. package/dist/chunks/MSFT_sRGBFactors-DCJApvhI.esm.js +0 -47
  321. package/dist/chunks/MSFT_sRGBFactors-DCJApvhI.esm.js.map +0 -1
  322. package/dist/chunks/MSFT_sRGBFactors-IRTTNK8h.esm.min.js +0 -2
  323. package/dist/chunks/MSFT_sRGBFactors-IRTTNK8h.esm.min.js.map +0 -1
  324. package/dist/chunks/assetContainer-9BV4w6Ec.esm.js +0 -1598
  325. package/dist/chunks/assetContainer-9BV4w6Ec.esm.js.map +0 -1
  326. package/dist/chunks/assetContainer-Cu6LKJHz.esm.min.js +0 -2
  327. package/dist/chunks/assetContainer-Cu6LKJHz.esm.min.js.map +0 -1
  328. package/dist/chunks/audioEngine-Bh-HZCai.esm.min.js +0 -2
  329. package/dist/chunks/audioEngine-Bh-HZCai.esm.min.js.map +0 -1
  330. package/dist/chunks/audioEngine-pydGAEd8.esm.js +0 -305
  331. package/dist/chunks/audioEngine-pydGAEd8.esm.js.map +0 -1
  332. package/dist/chunks/basisTextureLoader-BD8_wqQL.esm.min.js +0 -2
  333. package/dist/chunks/basisTextureLoader-BD8_wqQL.esm.min.js.map +0 -1
  334. package/dist/chunks/basisTextureLoader-JmRg1Sfn.esm.js +0 -600
  335. package/dist/chunks/basisTextureLoader-JmRg1Sfn.esm.js.map +0 -1
  336. package/dist/chunks/ddsTextureLoader-Bpjp8qSf.esm.js +0 -87
  337. package/dist/chunks/ddsTextureLoader-Bpjp8qSf.esm.js.map +0 -1
  338. package/dist/chunks/ddsTextureLoader-CEyJTB3O.esm.min.js +0 -2
  339. package/dist/chunks/ddsTextureLoader-CEyJTB3O.esm.min.js.map +0 -1
  340. package/dist/chunks/default.fragment-B11bdnrB.esm.min.js +0 -2
  341. package/dist/chunks/default.fragment-B11bdnrB.esm.min.js.map +0 -1
  342. package/dist/chunks/default.fragment-Bawtijue.esm.min.js +0 -2
  343. package/dist/chunks/default.fragment-Bawtijue.esm.min.js.map +0 -1
  344. package/dist/chunks/default.fragment-D3k4gvNV.esm.js +0 -456
  345. package/dist/chunks/default.fragment-D3k4gvNV.esm.js.map +0 -1
  346. package/dist/chunks/default.fragment-DL3qA9UG.esm.js +0 -515
  347. package/dist/chunks/default.fragment-DL3qA9UG.esm.js.map +0 -1
  348. package/dist/chunks/default.vertex-B7OOfc9A.esm.js +0 -178
  349. package/dist/chunks/default.vertex-B7OOfc9A.esm.js.map +0 -1
  350. package/dist/chunks/default.vertex-BKC2A0e0.esm.js +0 -199
  351. package/dist/chunks/default.vertex-BKC2A0e0.esm.js.map +0 -1
  352. package/dist/chunks/default.vertex-BRncvhAx.esm.min.js +0 -2
  353. package/dist/chunks/default.vertex-BRncvhAx.esm.min.js.map +0 -1
  354. package/dist/chunks/default.vertex-sJaJV_6d.esm.min.js +0 -2
  355. package/dist/chunks/default.vertex-sJaJV_6d.esm.min.js.map +0 -1
  356. package/dist/chunks/defaultUboDeclaration-C1JdSocs.esm.min.js +0 -2
  357. package/dist/chunks/defaultUboDeclaration-C1JdSocs.esm.min.js.map +0 -1
  358. package/dist/chunks/defaultUboDeclaration-Cszg1EQW.esm.js +0 -13
  359. package/dist/chunks/defaultUboDeclaration-Cszg1EQW.esm.js.map +0 -1
  360. package/dist/chunks/defaultUboDeclaration-DB7zHENU.esm.js +0 -15
  361. package/dist/chunks/defaultUboDeclaration-DB7zHENU.esm.js.map +0 -1
  362. package/dist/chunks/defaultUboDeclaration-XHlan1gc.esm.min.js +0 -2
  363. package/dist/chunks/defaultUboDeclaration-XHlan1gc.esm.min.js.map +0 -1
  364. package/dist/chunks/engine-DZrewcWP.esm.js +0 -1613
  365. package/dist/chunks/engine-DZrewcWP.esm.js.map +0 -1
  366. package/dist/chunks/engine-sFOTJhn4.esm.min.js +0 -2
  367. package/dist/chunks/engine-sFOTJhn4.esm.min.js.map +0 -1
  368. package/dist/chunks/envTextureLoader-DLAJXIl8.esm.min.js +0 -2
  369. package/dist/chunks/envTextureLoader-DLAJXIl8.esm.min.js.map +0 -1
  370. package/dist/chunks/envTextureLoader-DpLIoFjS.esm.js +0 -63
  371. package/dist/chunks/envTextureLoader-DpLIoFjS.esm.js.map +0 -1
  372. package/dist/chunks/environmentTextureTools-CiyJLBbf.esm.min.js +0 -2
  373. package/dist/chunks/environmentTextureTools-CiyJLBbf.esm.min.js.map +0 -1
  374. package/dist/chunks/environmentTextureTools-bPqq81in.esm.js +0 -381
  375. package/dist/chunks/environmentTextureTools-bPqq81in.esm.js.map +0 -1
  376. package/dist/chunks/exrTextureLoader-DJ7PbPlF.esm.min.js +0 -2
  377. package/dist/chunks/exrTextureLoader-DJ7PbPlF.esm.min.js.map +0 -1
  378. package/dist/chunks/exrTextureLoader-DYsBnFky.esm.js +0 -1682
  379. package/dist/chunks/exrTextureLoader-DYsBnFky.esm.js.map +0 -1
  380. package/dist/chunks/fogFragment-BLvD2fqs.esm.min.js +0 -2
  381. package/dist/chunks/fogFragment-BLvD2fqs.esm.min.js.map +0 -1
  382. package/dist/chunks/fogFragment-b0NlRwYe.esm.js +0 -102
  383. package/dist/chunks/fogFragment-b0NlRwYe.esm.js.map +0 -1
  384. package/dist/chunks/glTFLoader-BikrhFtn.esm.js +0 -7552
  385. package/dist/chunks/glTFLoader-BikrhFtn.esm.js.map +0 -1
  386. package/dist/chunks/glTFLoader-mZPFBYSM.esm.min.js +0 -2
  387. package/dist/chunks/glTFLoader-mZPFBYSM.esm.min.js.map +0 -1
  388. package/dist/chunks/glTFLoaderAnimation-BdwTR5Nl.esm.js +0 -77
  389. package/dist/chunks/glTFLoaderAnimation-BdwTR5Nl.esm.js.map +0 -1
  390. package/dist/chunks/glTFLoaderAnimation-CiKBDKnk.esm.min.js +0 -2
  391. package/dist/chunks/glTFLoaderAnimation-CiKBDKnk.esm.min.js.map +0 -1
  392. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js +0 -2
  393. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js.map +0 -1
  394. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js +0 -67
  395. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js.map +0 -1
  396. package/dist/chunks/harmonicsFunctions-C12V8Ng1.esm.js +0 -35
  397. package/dist/chunks/harmonicsFunctions-C12V8Ng1.esm.js.map +0 -1
  398. package/dist/chunks/harmonicsFunctions-CRoab7mv.esm.min.js +0 -2
  399. package/dist/chunks/harmonicsFunctions-CRoab7mv.esm.min.js.map +0 -1
  400. package/dist/chunks/harmonicsFunctions-CZi4YSE7.esm.js +0 -34
  401. package/dist/chunks/harmonicsFunctions-CZi4YSE7.esm.js.map +0 -1
  402. package/dist/chunks/harmonicsFunctions-GFzLo9xW.esm.min.js +0 -2
  403. package/dist/chunks/harmonicsFunctions-GFzLo9xW.esm.min.js.map +0 -1
  404. package/dist/chunks/hdrTextureLoader-CsWJNnG5.esm.js +0 -252
  405. package/dist/chunks/hdrTextureLoader-CsWJNnG5.esm.js.map +0 -1
  406. package/dist/chunks/hdrTextureLoader-Cwi3SM4o.esm.min.js +0 -2
  407. package/dist/chunks/hdrTextureLoader-Cwi3SM4o.esm.min.js.map +0 -1
  408. package/dist/chunks/helperFunctions-21b9-yGo.esm.min.js +0 -2
  409. package/dist/chunks/helperFunctions-21b9-yGo.esm.min.js.map +0 -1
  410. package/dist/chunks/helperFunctions-COVDWwPu.esm.js +0 -80
  411. package/dist/chunks/helperFunctions-COVDWwPu.esm.js.map +0 -1
  412. package/dist/chunks/helperFunctions-CQzJ5T38.esm.min.js +0 -2
  413. package/dist/chunks/helperFunctions-CQzJ5T38.esm.min.js.map +0 -1
  414. package/dist/chunks/helperFunctions-CUKI67ax.esm.js +0 -108
  415. package/dist/chunks/helperFunctions-CUKI67ax.esm.js.map +0 -1
  416. package/dist/chunks/index-5EaMDaGg.esm.js +0 -79820
  417. package/dist/chunks/index-5EaMDaGg.esm.js.map +0 -1
  418. package/dist/chunks/index-RwQCgcf4.esm.min.js +0 -57
  419. package/dist/chunks/index-RwQCgcf4.esm.min.js.map +0 -1
  420. package/dist/chunks/ktxTextureLoader-34pzZN2D.esm.js +0 -814
  421. package/dist/chunks/ktxTextureLoader-34pzZN2D.esm.js.map +0 -1
  422. package/dist/chunks/ktxTextureLoader-Dj2b7tTw.esm.min.js +0 -2
  423. package/dist/chunks/ktxTextureLoader-Dj2b7tTw.esm.min.js.map +0 -1
  424. package/dist/chunks/logDepthDeclaration-BTOfKIR5.esm.min.js +0 -2
  425. package/dist/chunks/logDepthDeclaration-BTOfKIR5.esm.min.js.map +0 -1
  426. package/dist/chunks/logDepthDeclaration-Boz5U8vN.esm.min.js +0 -2
  427. package/dist/chunks/logDepthDeclaration-Boz5U8vN.esm.min.js.map +0 -1
  428. package/dist/chunks/logDepthDeclaration-Dc0_n0rX.esm.js +0 -42
  429. package/dist/chunks/logDepthDeclaration-Dc0_n0rX.esm.js.map +0 -1
  430. package/dist/chunks/logDepthDeclaration-cImBekwl.esm.js +0 -35
  431. package/dist/chunks/logDepthDeclaration-cImBekwl.esm.js.map +0 -1
  432. package/dist/chunks/logDepthVertex-ABvK0V0R.esm.js +0 -77
  433. package/dist/chunks/logDepthVertex-ABvK0V0R.esm.js.map +0 -1
  434. package/dist/chunks/logDepthVertex-BA4bq6Km.esm.min.js +0 -2
  435. package/dist/chunks/logDepthVertex-BA4bq6Km.esm.min.js.map +0 -1
  436. package/dist/chunks/logDepthVertex-C7FgfYJH.esm.js +0 -605
  437. package/dist/chunks/logDepthVertex-C7FgfYJH.esm.js.map +0 -1
  438. package/dist/chunks/logDepthVertex-Da8gAKX-.esm.min.js +0 -2
  439. package/dist/chunks/logDepthVertex-Da8gAKX-.esm.min.js.map +0 -1
  440. package/dist/chunks/mainUVVaryingDeclaration-B-9VKUsa.esm.js +0 -11
  441. package/dist/chunks/mainUVVaryingDeclaration-B-9VKUsa.esm.js.map +0 -1
  442. package/dist/chunks/mainUVVaryingDeclaration-CNcp6TRG.esm.min.js +0 -2
  443. package/dist/chunks/mainUVVaryingDeclaration-CNcp6TRG.esm.min.js.map +0 -1
  444. package/dist/chunks/objFileLoader-3iAEdRPX.esm.js +0 -1280
  445. package/dist/chunks/objFileLoader-3iAEdRPX.esm.js.map +0 -1
  446. package/dist/chunks/objFileLoader-Cr90DdHJ.esm.min.js +0 -2
  447. package/dist/chunks/objFileLoader-Cr90DdHJ.esm.min.js.map +0 -1
  448. package/dist/chunks/oitFragment-BxefW3dP.esm.min.js +0 -2
  449. package/dist/chunks/oitFragment-BxefW3dP.esm.min.js.map +0 -1
  450. package/dist/chunks/oitFragment-DNM4M_TM.esm.js +0 -1166
  451. package/dist/chunks/oitFragment-DNM4M_TM.esm.js.map +0 -1
  452. package/dist/chunks/oitFragment-QOO-2oNY.esm.min.js +0 -2
  453. package/dist/chunks/oitFragment-QOO-2oNY.esm.min.js.map +0 -1
  454. package/dist/chunks/oitFragment-c8QTGncf.esm.js +0 -1210
  455. package/dist/chunks/oitFragment-c8QTGncf.esm.js.map +0 -1
  456. package/dist/chunks/pass.fragment-54wWMjH0.esm.js +0 -15
  457. package/dist/chunks/pass.fragment-54wWMjH0.esm.js.map +0 -1
  458. package/dist/chunks/pass.fragment-C2zJ2wfh.esm.min.js +0 -2
  459. package/dist/chunks/pass.fragment-C2zJ2wfh.esm.min.js.map +0 -1
  460. package/dist/chunks/pbr.fragment-B2LdxiLY.esm.js +0 -3163
  461. package/dist/chunks/pbr.fragment-B2LdxiLY.esm.js.map +0 -1
  462. package/dist/chunks/pbr.fragment-BdB3ttR4.esm.min.js +0 -2
  463. package/dist/chunks/pbr.fragment-BdB3ttR4.esm.min.js.map +0 -1
  464. package/dist/chunks/pbr.fragment-BweiXotT.esm.js +0 -3219
  465. package/dist/chunks/pbr.fragment-BweiXotT.esm.js.map +0 -1
  466. package/dist/chunks/pbr.fragment-DO84e7Qh.esm.min.js +0 -2
  467. package/dist/chunks/pbr.fragment-DO84e7Qh.esm.min.js.map +0 -1
  468. package/dist/chunks/pbr.vertex-BXRa8Hxv.esm.js +0 -335
  469. package/dist/chunks/pbr.vertex-BXRa8Hxv.esm.js.map +0 -1
  470. package/dist/chunks/pbr.vertex-CF2Ccw8q.esm.min.js +0 -2
  471. package/dist/chunks/pbr.vertex-CF2Ccw8q.esm.min.js.map +0 -1
  472. package/dist/chunks/pbr.vertex-Dp1NB2h0.esm.min.js +0 -2
  473. package/dist/chunks/pbr.vertex-Dp1NB2h0.esm.min.js.map +0 -1
  474. package/dist/chunks/pbr.vertex-ou_Fcm2v.esm.js +0 -208
  475. package/dist/chunks/pbr.vertex-ou_Fcm2v.esm.js.map +0 -1
  476. package/dist/chunks/postprocess.vertex-C12ptRTz.esm.js +0 -20
  477. package/dist/chunks/postprocess.vertex-C12ptRTz.esm.js.map +0 -1
  478. package/dist/chunks/postprocess.vertex-D9PCzQ_C.esm.min.js +0 -2
  479. package/dist/chunks/postprocess.vertex-D9PCzQ_C.esm.min.js.map +0 -1
  480. package/dist/chunks/rawTexture-BTLHgkBf.esm.js +0 -562
  481. package/dist/chunks/rawTexture-BTLHgkBf.esm.js.map +0 -1
  482. package/dist/chunks/rawTexture-Cb8Vzv3y.esm.min.js +0 -2
  483. package/dist/chunks/rawTexture-Cb8Vzv3y.esm.min.js.map +0 -1
  484. package/dist/chunks/rgbdDecode.fragment-4VUd_LZa.esm.js +0 -17
  485. package/dist/chunks/rgbdDecode.fragment-4VUd_LZa.esm.js.map +0 -1
  486. package/dist/chunks/rgbdDecode.fragment-B97s0YHK.esm.min.js +0 -2
  487. package/dist/chunks/rgbdDecode.fragment-B97s0YHK.esm.min.js.map +0 -1
  488. package/dist/chunks/rgbdDecode.fragment-CgqRZDLm.esm.js +0 -17
  489. package/dist/chunks/rgbdDecode.fragment-CgqRZDLm.esm.js.map +0 -1
  490. package/dist/chunks/rgbdDecode.fragment-DSa_xyAA.esm.min.js +0 -2
  491. package/dist/chunks/rgbdDecode.fragment-DSa_xyAA.esm.min.js.map +0 -1
  492. package/dist/chunks/rgbdEncode.fragment-C3-vIdKY.esm.js +0 -17
  493. package/dist/chunks/rgbdEncode.fragment-C3-vIdKY.esm.js.map +0 -1
  494. package/dist/chunks/rgbdEncode.fragment-CZ7DFmJC.esm.min.js +0 -2
  495. package/dist/chunks/rgbdEncode.fragment-CZ7DFmJC.esm.min.js.map +0 -1
  496. package/dist/chunks/rgbdEncode.fragment-CnIc0eyH.esm.min.js +0 -2
  497. package/dist/chunks/rgbdEncode.fragment-CnIc0eyH.esm.min.js.map +0 -1
  498. package/dist/chunks/rgbdEncode.fragment-DA8KkHQU.esm.js +0 -17
  499. package/dist/chunks/rgbdEncode.fragment-DA8KkHQU.esm.js.map +0 -1
  500. package/dist/chunks/splatFileLoader-BiXQ9pqp.esm.min.js +0 -2
  501. package/dist/chunks/splatFileLoader-BiXQ9pqp.esm.min.js.map +0 -1
  502. package/dist/chunks/splatFileLoader-D17axd4l.esm.js +0 -3179
  503. package/dist/chunks/splatFileLoader-D17axd4l.esm.js.map +0 -1
  504. package/dist/chunks/standardMaterial-CYafMW8c.esm.js +0 -1809
  505. package/dist/chunks/standardMaterial-CYafMW8c.esm.js.map +0 -1
  506. package/dist/chunks/standardMaterial-xLALVwqX.esm.min.js +0 -2
  507. package/dist/chunks/standardMaterial-xLALVwqX.esm.min.js.map +0 -1
  508. package/dist/chunks/stlFileLoader-BIeNnvqG.esm.js +0 -237
  509. package/dist/chunks/stlFileLoader-BIeNnvqG.esm.js.map +0 -1
  510. package/dist/chunks/stlFileLoader-CqtYJIkJ.esm.min.js +0 -2
  511. package/dist/chunks/stlFileLoader-CqtYJIkJ.esm.min.js.map +0 -1
  512. package/dist/chunks/tgaTextureLoader-CDefV-xQ.esm.min.js +0 -2
  513. package/dist/chunks/tgaTextureLoader-CDefV-xQ.esm.min.js.map +0 -1
  514. package/dist/chunks/tgaTextureLoader-CerR7twj.esm.js +0 -349
  515. package/dist/chunks/tgaTextureLoader-CerR7twj.esm.js.map +0 -1
  516. package/dist/chunks/thinInstanceMesh-InKoMs06.esm.js +0 -314
  517. package/dist/chunks/thinInstanceMesh-InKoMs06.esm.js.map +0 -1
  518. package/dist/chunks/thinInstanceMesh-XV_b72vY.esm.min.js +0 -2
  519. package/dist/chunks/thinInstanceMesh-XV_b72vY.esm.min.js.map +0 -1
  520. package/dist/chunks/vertexColorMixing-Dm0jnWj1.esm.js +0 -528
  521. package/dist/chunks/vertexColorMixing-Dm0jnWj1.esm.js.map +0 -1
  522. package/dist/chunks/vertexColorMixing-N0v0Ism3.esm.min.js +0 -2
  523. package/dist/chunks/vertexColorMixing-N0v0Ism3.esm.min.js.map +0 -1
  524. package/dist/chunks/workerPool-BUOov2K1.esm.js +0 -122
  525. package/dist/chunks/workerPool-BUOov2K1.esm.js.map +0 -1
  526. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js +0 -2
  527. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js.map +0 -1
  528. package/lib/index.d.ts +0 -275
  529. package/lib/index.js +0 -942
  530. package/lib/index.js.map +0 -1
package/lib/index.js DELETED
@@ -1,942 +0,0 @@
1
- import { ArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera.js';
2
- import { HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight.js';
3
- import { loadAssetContainerAsync } from '@babylonjs/core/Loading/sceneLoader.js';
4
- import { PBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial.js';
5
- import { CubeTexture } from '@babylonjs/core/Materials/Textures/cubeTexture.js';
6
- import { Texture } from '@babylonjs/core/Materials/Textures/texture.js';
7
- import { Color4 } from '@babylonjs/core/Maths/math.color.js';
8
- import { Scalar } from '@babylonjs/core/Maths/math.scalar.js';
9
- import { Vector3 } from '@babylonjs/core/Maths/math.vector.js';
10
- import { CreateBox } from '@babylonjs/core/Meshes/Builders/boxBuilder.js';
11
- import { AsyncLock } from '@babylonjs/core/Misc/asyncLock.js';
12
- import { Observable } from '@babylonjs/core/Misc/observable.js';
13
- import { Scene } from '@babylonjs/core/scene.js';
14
- import { registerBuiltInLoaders } from '@babylonjs/loaders/dynamic.js';
15
- import '@babylonjs/core/Animations/animatable.js';
16
- import { __decorate } from '@babylonjs/core/tslib.es6.js';
17
- import { css, LitElement, html } from 'lit';
18
- import { property, state, query, customElement } from 'lit/decorators.js';
19
- import { Logger } from '@babylonjs/core/Misc/logger.js';
20
-
21
- function createSkybox(scene, camera, environmentTexture, blur) {
22
- const hdrSkybox = CreateBox("hdrSkyBox", undefined, scene);
23
- const hdrSkyboxMaterial = new PBRMaterial("skyBox", scene);
24
- hdrSkyboxMaterial.backFaceCulling = false;
25
- hdrSkyboxMaterial.reflectionTexture = environmentTexture.clone();
26
- if (hdrSkyboxMaterial.reflectionTexture) {
27
- hdrSkyboxMaterial.reflectionTexture.coordinatesMode = Texture.SKYBOX_MODE;
28
- }
29
- hdrSkyboxMaterial.microSurface = 1.0 - blur;
30
- hdrSkyboxMaterial.disableLighting = true;
31
- hdrSkyboxMaterial.twoSidedLighting = true;
32
- hdrSkybox.material = hdrSkyboxMaterial;
33
- hdrSkybox.isPickable = false;
34
- hdrSkybox.infiniteDistance = true;
35
- hdrSkybox.ignoreCameraMaxZ = true;
36
- updateSkybox(hdrSkybox, camera);
37
- return hdrSkybox;
38
- }
39
- function updateSkybox(skybox, camera) {
40
- skybox?.scaling.setAll((camera.maxZ - camera.minZ) / 2);
41
- }
42
- const defaultViewerOptions = {
43
- backgroundColor: new Color4(0.1, 0.1, 0.2, 1.0),
44
- };
45
- /**
46
- * Provides an experience for viewing a single 3D model.
47
- * @remarks
48
- * The Viewer is not tied to a specific UI framework and can be used with Babylon.js in a browser or with Babylon Native.
49
- * Includes (or will include) support for common model viewing requirements such as:
50
- * - Loading different model formats.
51
- * - Setting up a camera and providing default behaviors like auto orbit and pose interpolation.
52
- * - Framing the loaded model in the camera's view.
53
- * - Setting up the environment, lighting, and tone mapping.
54
- * - Enumerating and playing (or auto playing) animations.
55
- * - Enumerating and switching between material variants.
56
- * - Full screen and XR modes.
57
- */
58
- class Viewer {
59
- constructor(_engine, options) {
60
- this._engine = _engine;
61
- /**
62
- * Fired when the environment has changed.
63
- */
64
- this.onEnvironmentChanged = new Observable();
65
- /**
66
- * Fired when an error occurs while loading the environment.
67
- */
68
- this.onEnvironmentError = new Observable();
69
- /**
70
- * Fired when a model is loaded into the viewer (or unloaded from the viewer).
71
- */
72
- this.onModelChanged = new Observable();
73
- /**
74
- * Fired when an error occurs while loading a model.
75
- */
76
- this.onModelError = new Observable();
77
- /**
78
- * Fired when the selected animation changes.
79
- */
80
- this.onSelectedAnimationChanged = new Observable();
81
- /**
82
- * Fired when the animation speed changes.
83
- */
84
- this.onAnimationSpeedChanged = new Observable();
85
- /**
86
- * Fired when the selected animation is playing or paused.
87
- */
88
- this.onIsAnimationPlayingChanged = new Observable();
89
- /**
90
- * Fired when the current point on the selected animation timeline changes.
91
- */
92
- this.onAnimationProgressChanged = new Observable();
93
- this._skybox = null;
94
- this._isDisposed = false;
95
- this._loadModelLock = new AsyncLock();
96
- this._loadModelAbortController = null;
97
- this._loadEnvironmentLock = new AsyncLock();
98
- this._environment = null;
99
- this._loadEnvironmentAbortController = null;
100
- this._selectedAnimation = -1;
101
- this._activeAnimationObservers = [];
102
- this._animationSpeed = 1;
103
- const finalOptions = { ...defaultViewerOptions, ...options };
104
- this._details = {
105
- viewer: this,
106
- scene: new Scene(this._engine),
107
- model: null,
108
- };
109
- this._details.scene.clearColor = finalOptions.backgroundColor;
110
- this._camera = new ArcRotateCamera("camera1", 0, 0, 1, Vector3.Zero(), this._details.scene);
111
- this._camera.attachControl();
112
- this._updateCamera(); // set default camera values
113
- this._autoRotationBehavior = this._camera.getBehaviorByName("AutoRotation");
114
- // Load a default light, but ignore errors as the user might be immediately loading their own environment.
115
- this.resetEnvironmentAsync().catch(() => { });
116
- // TODO: render at least back ground. Maybe we can only run renderloop when a mesh is loaded. What to render until then?
117
- const render = () => {
118
- this._details.scene.render();
119
- if (this.isAnimationPlaying) {
120
- this.onAnimationProgressChanged.notifyObservers();
121
- this._autoRotationBehavior.resetLastInteractionTime();
122
- }
123
- };
124
- this._engine.runRenderLoop(render);
125
- this._renderLoopController = {
126
- dispose: () => this._engine.stopRenderLoop(render),
127
- };
128
- options?.onInitialized?.(this._details);
129
- }
130
- /**
131
- * The list of animation names for the currently loaded model.
132
- */
133
- get animations() {
134
- return this._details.model?.animationGroups.map((group) => group.name) ?? [];
135
- }
136
- /**
137
- * The currently selected animation index.
138
- */
139
- get selectedAnimation() {
140
- return this._selectedAnimation;
141
- }
142
- set selectedAnimation(value) {
143
- value = Math.round(Scalar.Clamp(value, -1, this.animations.length - 1));
144
- if (value !== this._selectedAnimation) {
145
- const startAnimation = this.isAnimationPlaying;
146
- if (this._activeAnimation) {
147
- this._activeAnimation.goToFrame(0);
148
- this._activeAnimation.stop();
149
- this._activeAnimationObservers.forEach((observer) => observer.remove());
150
- this._activeAnimationObservers = [];
151
- }
152
- this._selectedAnimation = value;
153
- if (this._activeAnimation) {
154
- this._activeAnimationObservers = [
155
- this._activeAnimation.onAnimationGroupPlayObservable.add(() => {
156
- this.onIsAnimationPlayingChanged.notifyObservers();
157
- }),
158
- this._activeAnimation.onAnimationGroupPauseObservable.add(() => {
159
- this.onIsAnimationPlayingChanged.notifyObservers();
160
- }),
161
- this._activeAnimation.onAnimationGroupEndObservable.add(() => {
162
- this.onIsAnimationPlayingChanged.notifyObservers();
163
- this.onAnimationProgressChanged.notifyObservers();
164
- }),
165
- ];
166
- this._activeAnimation.start(true, this._animationSpeed);
167
- if (!startAnimation) {
168
- this.pauseAnimation();
169
- }
170
- }
171
- this.onSelectedAnimationChanged.notifyObservers();
172
- }
173
- }
174
- /**
175
- * True if an animation is currently playing.
176
- */
177
- get isAnimationPlaying() {
178
- return this._activeAnimation?.isPlaying ?? false;
179
- }
180
- /**
181
- * The speed scale at which animations are played.
182
- */
183
- get animationSpeed() {
184
- return this._animationSpeed;
185
- }
186
- set animationSpeed(value) {
187
- this._animationSpeed = value;
188
- this._applyAnimationSpeed();
189
- this.onAnimationSpeedChanged.notifyObservers();
190
- }
191
- /**
192
- * The current point on the selected animation timeline, normalized between 0 and 1.
193
- */
194
- get animationProgress() {
195
- if (this._activeAnimation) {
196
- return this._activeAnimation.getCurrentFrame() / (this._activeAnimation.to - this._activeAnimation.from);
197
- }
198
- return 0;
199
- }
200
- set animationProgress(value) {
201
- if (this._activeAnimation) {
202
- this._activeAnimation.goToFrame(value * (this._activeAnimation.to - this._activeAnimation.from));
203
- this.onAnimationProgressChanged.notifyObservers();
204
- this._autoRotationBehavior.resetLastInteractionTime();
205
- }
206
- }
207
- get _activeAnimation() {
208
- return this._details.model?.animationGroups[this._selectedAnimation] ?? null;
209
- }
210
- /**
211
- * Loads a 3D model from the specified URL.
212
- * @remarks
213
- * If a model is already loaded, it will be unloaded before loading the new model.
214
- * @param source A url or File or ArrayBufferView that points to the model to load.
215
- * @param options The options to use when loading the model.
216
- * @param abortSignal An optional signal that can be used to abort the loading process.
217
- */
218
- async loadModelAsync(source, options, abortSignal) {
219
- await this._updateModelAsync(source, options, abortSignal);
220
- }
221
- /**
222
- * Resets the model to an empty scene.
223
- * @param abortSignal An optional signal that can be used to abort the reset.
224
- */
225
- async resetModelAsync(abortSignal) {
226
- await this._updateModelAsync(undefined, undefined, abortSignal);
227
- }
228
- async _updateModelAsync(source, options, abortSignal) {
229
- this._throwIfDisposedOrAborted(abortSignal);
230
- this._loadModelAbortController?.abort("New model is being loaded before previous model finished loading.");
231
- const abortController = (this._loadModelAbortController = new AbortController());
232
- await this._loadModelLock.lockAsync(async () => {
233
- this._throwIfDisposedOrAborted(abortSignal, abortController.signal);
234
- this._details.model?.dispose();
235
- this.selectedAnimation = -1;
236
- try {
237
- this._details.model = null;
238
- if (source) {
239
- this._details.model = await loadAssetContainerAsync(source, this._details.scene, options);
240
- this._details.model.animationGroups.forEach((group) => group.stop());
241
- this.selectedAnimation = 0;
242
- this._details.model.addAllToScene();
243
- }
244
- this._updateCamera();
245
- this._applyAnimationSpeed();
246
- this.onModelChanged.notifyObservers();
247
- }
248
- catch (e) {
249
- this.onModelError.notifyObservers(e);
250
- throw e;
251
- }
252
- });
253
- }
254
- /**
255
- * Loads an environment texture from the specified url and sets up a corresponding skybox.
256
- * @remarks
257
- * If an environment is already loaded, it will be unloaded before loading the new environment.
258
- * @param url The url of the environment texture to load.
259
- * @param options The options to use when loading the environment.
260
- * @param abortSignal An optional signal that can be used to abort the loading process.
261
- */
262
- async loadEnvironmentAsync(url, options, abortSignal) {
263
- await this._updateEnvironmentAsync(url, options, abortSignal);
264
- }
265
- /**
266
- * Resets the environment to a simple hemispheric light.
267
- * @param abortSignal An optional signal that can be used to abort the reset.
268
- */
269
- async resetEnvironmentAsync(abortSignal) {
270
- await this._updateEnvironmentAsync(undefined, undefined, abortSignal);
271
- }
272
- async _updateEnvironmentAsync(url, options, abortSignal) {
273
- this._throwIfDisposedOrAborted(abortSignal);
274
- this._loadEnvironmentAbortController?.abort("New environment is being loaded before previous environment finished loading.");
275
- const abortController = (this._loadEnvironmentAbortController = new AbortController());
276
- await this._loadEnvironmentLock.lockAsync(async () => {
277
- this._throwIfDisposedOrAborted(abortSignal, abortController.signal);
278
- this._environment?.dispose();
279
- try {
280
- this._environment = await new Promise((resolve, reject) => {
281
- if (!url) {
282
- const light = new HemisphericLight("hemilight", Vector3.Up(), this._details.scene);
283
- this._details.scene.autoClear = true;
284
- resolve(light);
285
- }
286
- else {
287
- const cubeTexture = CubeTexture.CreateFromPrefilteredData(url, this._details.scene);
288
- this._details.scene.environmentTexture = cubeTexture;
289
- const skybox = createSkybox(this._details.scene, this._camera, cubeTexture, 0.3);
290
- this._skybox = skybox;
291
- this._details.scene.autoClear = false;
292
- const dispose = () => {
293
- cubeTexture.dispose();
294
- skybox.dispose();
295
- this._skybox = null;
296
- };
297
- const successObserver = cubeTexture.onLoadObservable.addOnce(() => {
298
- successObserver.remove();
299
- errorObserver.remove();
300
- resolve({
301
- dispose,
302
- });
303
- });
304
- const errorObserver = Texture.OnTextureLoadErrorObservable.add((texture) => {
305
- if (texture === cubeTexture) {
306
- successObserver.remove();
307
- errorObserver.remove();
308
- dispose();
309
- reject(new Error("Failed to load environment texture."));
310
- }
311
- });
312
- }
313
- this.onEnvironmentChanged.notifyObservers();
314
- });
315
- }
316
- catch (e) {
317
- this.onEnvironmentError.notifyObservers(e);
318
- throw e;
319
- }
320
- });
321
- }
322
- /**
323
- * Toggles the play/pause animation state if there is a selected animation.
324
- */
325
- toggleAnimation() {
326
- if (this.isAnimationPlaying) {
327
- this.pauseAnimation();
328
- }
329
- else {
330
- this.playAnimation();
331
- }
332
- }
333
- /**
334
- * Plays the selected animation if there is one.
335
- */
336
- playAnimation() {
337
- this._activeAnimation?.play(true);
338
- }
339
- /**
340
- * Pauses the selected animation if there is one.
341
- */
342
- async pauseAnimation() {
343
- this._activeAnimation?.pause();
344
- }
345
- /**
346
- * Disposes of the resources held by the Viewer.
347
- */
348
- dispose() {
349
- this.selectedAnimation = -1;
350
- this.animationProgress = 0;
351
- this._renderLoopController.dispose();
352
- this._details.scene.dispose();
353
- this.onEnvironmentChanged.clear();
354
- this.onEnvironmentError.clear();
355
- this.onModelChanged.clear();
356
- this.onModelError.clear();
357
- this.onSelectedAnimationChanged.clear();
358
- this.onAnimationSpeedChanged.clear();
359
- this.onIsAnimationPlayingChanged.clear();
360
- this.onAnimationProgressChanged.clear();
361
- this._isDisposed = true;
362
- }
363
- // copy/paste from sandbox and scene helpers
364
- _updateCamera() {
365
- // Enable camera's behaviors
366
- this._camera.useFramingBehavior = true;
367
- const framingBehavior = this._camera.getBehaviorByName("Framing");
368
- framingBehavior.framingTime = 0;
369
- framingBehavior.elevationReturnTime = -1;
370
- let radius = 1;
371
- if (this._details.scene.meshes.length) {
372
- // get bounds and prepare framing/camera radius from its values
373
- this._camera.lowerRadiusLimit = null;
374
- const worldExtends = this._details.scene.getWorldExtends((mesh) => {
375
- return mesh.isVisible && mesh.isEnabled();
376
- });
377
- framingBehavior.zoomOnBoundingInfo(worldExtends.min, worldExtends.max);
378
- const worldSize = worldExtends.max.subtract(worldExtends.min);
379
- const worldCenter = worldExtends.min.add(worldSize.scale(0.5));
380
- radius = worldSize.length() * 1.2;
381
- if (!isFinite(radius)) {
382
- radius = 1;
383
- worldCenter.copyFromFloats(0, 0, 0);
384
- }
385
- this._camera.setTarget(worldCenter);
386
- }
387
- this._camera.lowerRadiusLimit = radius * 0.01;
388
- this._camera.wheelPrecision = 100 / radius;
389
- this._camera.alpha = Math.PI / 2;
390
- this._camera.beta = Math.PI / 2;
391
- this._camera.radius = radius;
392
- this._camera.minZ = radius * 0.01;
393
- this._camera.maxZ = radius * 1000;
394
- this._camera.speed = radius * 0.2;
395
- this._camera.useAutoRotationBehavior = true;
396
- this._camera.pinchPrecision = 200 / this._camera.radius;
397
- this._camera.upperRadiusLimit = 5 * this._camera.radius;
398
- this._camera.wheelDeltaPercentage = 0.01;
399
- this._camera.pinchDeltaPercentage = 0.01;
400
- this._camera.restoreStateInterpolationFactor = 0.1;
401
- updateSkybox(this._skybox, this._camera);
402
- }
403
- _applyAnimationSpeed() {
404
- this._details.model?.animationGroups.forEach((group) => (group.speedRatio = this._animationSpeed));
405
- }
406
- /**
407
- * Check for disposed or aborted state (basically everything that can interrupt an async operation).
408
- * @param abortSignals A set of optional AbortSignals to also check.
409
- */
410
- _throwIfDisposedOrAborted(...abortSignals) {
411
- if (this._isDisposed) {
412
- throw new Error("Viewer is disposed.");
413
- }
414
- for (const signal of abortSignals) {
415
- signal?.throwIfAborted();
416
- }
417
- }
418
- }
419
- (() => {
420
- registerBuiltInLoaders();
421
- })();
422
-
423
- const defaultCanvasViewerOptions = {};
424
- /**
425
- * Creates a Viewer instance that is bound to an HTML canvas.
426
- * @remarks
427
- * This function can be shared across multiple UI integrations (e.g. Web Components, React, etc.).
428
- * @param canvas The canvas element to bind the Viewer to.
429
- * @param options The options to use when creating the Viewer and binding it to the specified canvas.
430
- * @returns A Viewer instance that is bound to the specified canvas.
431
- */
432
- async function createViewerForCanvas(canvas, options) {
433
- const finalOptions = { ...defaultCanvasViewerOptions, ...options };
434
- const disposeActions = [];
435
- // If the canvas is resized, note that the engine needs a resize, but don't resize it here as it will result in flickering.
436
- let needsResize = false;
437
- const resizeObserver = new ResizeObserver(() => (needsResize = true));
438
- resizeObserver.observe(canvas);
439
- disposeActions.push(() => resizeObserver.disconnect());
440
- // Create an engine instance.
441
- let engine;
442
- switch (finalOptions.engine) {
443
- case undefined:
444
- case "WebGL": {
445
- // eslint-disable-next-line @typescript-eslint/naming-convention, no-case-declarations
446
- const { Engine } = await import('@babylonjs/core/Engines/engine.js');
447
- engine = new Engine(canvas, undefined, options);
448
- break;
449
- }
450
- // case "WebGPU": {
451
- // // eslint-disable-next-line @typescript-eslint/naming-convention
452
- // const { WebGPUEngine } = await import("core/Engines/webgpuEngine");
453
- // const webGPUEngine = new WebGPUEngine(canvas, options);
454
- // await webGPUEngine.initAsync();
455
- // engine = webGPUEngine;
456
- // break;
457
- // }
458
- }
459
- // Override the onInitialized callback to add in some specific behavior.
460
- const onInitialized = finalOptions.onInitialized;
461
- finalOptions.onInitialized = (details) => {
462
- // Resize if needed right before rendering the Viewer scene to avoid any flickering.
463
- const beforeRenderObserver = details.scene.onBeforeRenderObservable.add(() => {
464
- if (needsResize) {
465
- engine.resize();
466
- needsResize = false;
467
- }
468
- });
469
- disposeActions.push(() => beforeRenderObserver.remove());
470
- // Call the original onInitialized callback, if one was provided.
471
- onInitialized?.(details);
472
- };
473
- // Instantiate the Viewer with the engine and options.
474
- const viewer = new Viewer(engine, finalOptions);
475
- disposeActions.push(viewer.dispose.bind(viewer));
476
- disposeActions.push(() => engine.dispose());
477
- // Override the Viewer's dispose method to add in additional cleanup.
478
- viewer.dispose = () => disposeActions.forEach((dispose) => dispose());
479
- return viewer;
480
- }
481
-
482
- // Icon SVG is pulled from https://fluentuipr.z22.web.core.windows.net/heads/master/public-docsite-v9/storybook/iframe.html?id=icons-catalog--page&viewMode=story
483
- const playFilledIcon = "M17.22 8.68a1.5 1.5 0 0 1 0 2.63l-10 5.5A1.5 1.5 0 0 1 5 15.5v-11A1.5 1.5 0 0 1 7.22 3.2l10 5.5Z";
484
- const pauseFilledIcon = "M5 2a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h2a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H5Zm8 0a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h2a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-2Z";
485
- const allowedAnimationSpeeds = [0.5, 1, 1.5, 2];
486
- /**
487
- * Represents a custom element that displays a 3D model using the Babylon.js Viewer.
488
- */
489
- let HTML3DElement = class HTML3DElement extends LitElement {
490
- constructor() {
491
- super(...arguments);
492
- this._viewerLock = new AsyncLock();
493
- /**
494
- * The speed scale at which animations are played.
495
- */
496
- this.animationSpeed = 1;
497
- /**
498
- * The current point on the selected animation timeline, normalized between 0 and 1.
499
- */
500
- this.animationProgress = 0;
501
- this._animations = [];
502
- this._selectedAnimation = -1;
503
- this._isAnimationPlaying = false;
504
- }
505
- /**
506
- * The list of animation names for the currently loaded model.
507
- */
508
- get animations() {
509
- return this._animations;
510
- }
511
- /**
512
- * The currently selected animation index.
513
- */
514
- get selectedAnimation() {
515
- return this._selectedAnimation;
516
- }
517
- /**
518
- * True if an animation is currently playing.
519
- */
520
- get isAnimationPlaying() {
521
- return this._isAnimationPlaying;
522
- }
523
- /**
524
- * Toggles the play/pause animation state if there is a selected animation.
525
- */
526
- toggleAnimation() {
527
- this._viewer?.toggleAnimation();
528
- }
529
- // eslint-disable-next-line babylonjs/available
530
- connectedCallback() {
531
- super.connectedCallback();
532
- this._setupViewer();
533
- }
534
- // eslint-disable-next-line babylonjs/available
535
- firstUpdated(_changedProperties) {
536
- super.firstUpdated(_changedProperties);
537
- this._setupViewer();
538
- }
539
- // eslint-disable-next-line babylonjs/available
540
- disconnectedCallback() {
541
- super.disconnectedCallback();
542
- this._tearDownViewer();
543
- }
544
- // eslint-disable-next-line babylonjs/available
545
- update(changedProperties) {
546
- super.update(changedProperties);
547
- if (changedProperties.has("engine")) {
548
- this._tearDownViewer();
549
- this._setupViewer();
550
- }
551
- else {
552
- if (changedProperties.has("animationSpeed")) {
553
- this._updateAnimationSpeed();
554
- }
555
- if (changedProperties.has("_selectedAnimation")) {
556
- this._updateSelectedAnimation();
557
- }
558
- if (changedProperties.has("src")) {
559
- this._updateModel();
560
- }
561
- if (changedProperties.has("env")) {
562
- this._updateEnv();
563
- }
564
- }
565
- }
566
- // eslint-disable-next-line babylonjs/available
567
- render() {
568
- return html `
569
- <div class="full-size">
570
- <canvas id="renderCanvas" class="full-size" touch-action="none"></canvas>
571
- ${this.animations.length === 0
572
- ? ""
573
- : html `
574
- <slot name="tool-bar">
575
- <div part="tool-bar" class="tool-bar">
576
- <div class="progress-control">
577
- <button aria-label="${this.isAnimationPlaying ? "Pause" : "Play"}" @click="${this.toggleAnimation}">
578
- ${!this.isAnimationPlaying
579
- ? html `<svg viewBox="0 0 20 20">
580
- <path d="${playFilledIcon}" fill="currentColor"></path>
581
- </svg>`
582
- : html `<svg viewBox="-3 -2 24 24">
583
- <path d="${pauseFilledIcon}" fill="currentColor"></path>
584
- </svg>`}
585
- </button>
586
- <input
587
- aria-label="Animation Progress"
588
- class="progress-wrapper"
589
- type="range"
590
- min="0"
591
- max="1"
592
- step="0.0001"
593
- .value="${this.animationProgress}"
594
- @input="${this._onProgressChanged}"
595
- @pointerdown="${this._onProgressPointerDown}"
596
- />
597
- </div>
598
- <select aria-label="Select Animation Speed" @change="${this._onAnimationSpeedChanged}">
599
- ${allowedAnimationSpeeds.map((speed) => html `<option value="${speed}" .selected="${this.animationSpeed === speed}">${speed}x</option>`)}
600
- </select>
601
- ${this.animations.length > 1
602
- ? html `<select aria-label="Select Animation" @change="${this._onSelectedAnimationChanged}">
603
- ${this.animations.map((name, index) => html `<option value="${index}" .selected="${this.selectedAnimation == index}">${name}</option>`)}
604
- </select>`
605
- : ""}
606
- </div>
607
- </slot>
608
- `}
609
- </div>
610
- `;
611
- }
612
- addEventListener(type, listener, options) {
613
- super.addEventListener(type, listener, options);
614
- }
615
- _dispatchCustomEvent(...args) {
616
- const [type, details] = args;
617
- this.dispatchEvent(details ? new CustomEvent(type, { detail: details }) : new Event(type));
618
- }
619
- _onSelectedAnimationChanged(event) {
620
- const selectElement = event.target;
621
- this._selectedAnimation = Number(selectElement.value);
622
- }
623
- _onAnimationSpeedChanged(event) {
624
- const selectElement = event.target;
625
- this.animationSpeed = Number(selectElement.value);
626
- }
627
- _onProgressChanged(event) {
628
- if (this._viewer) {
629
- const input = event.target;
630
- const value = Number(input.value);
631
- if (value !== this.animationProgress) {
632
- this._viewer.animationProgress = value;
633
- }
634
- }
635
- }
636
- _onProgressPointerDown(event) {
637
- if (this._viewer?.isAnimationPlaying) {
638
- this._viewer.pauseAnimation();
639
- const input = event.target;
640
- input.addEventListener("pointerup", () => this._viewer?.playAnimation(), { once: true });
641
- }
642
- }
643
- async _setupViewer() {
644
- if (this._canvas) {
645
- await this._viewerLock.lockAsync(async () => {
646
- if (!this._viewer) {
647
- await createViewerForCanvas(this._canvas, {
648
- engine: this.engine,
649
- onInitialized: (details) => {
650
- this._viewer = details.viewer;
651
- details.viewer.onEnvironmentChanged.add(() => {
652
- this._dispatchCustomEvent("environmentchange");
653
- });
654
- details.viewer.onEnvironmentError.add(() => {
655
- this._dispatchCustomEvent("environmenterror");
656
- });
657
- details.viewer.onModelChanged.add(() => {
658
- this._animations = [...(this._viewer?.animations ?? [])];
659
- this._dispatchCustomEvent("modelchange");
660
- });
661
- details.viewer.onModelError.add(() => {
662
- this._dispatchCustomEvent("modelerror");
663
- });
664
- details.viewer.onSelectedAnimationChanged.add(() => {
665
- this._selectedAnimation = this._viewer?.selectedAnimation ?? -1;
666
- this._dispatchCustomEvent("selectedanimationchange");
667
- });
668
- details.viewer.onAnimationSpeedChanged.add(() => {
669
- let speed = this._viewer?.animationSpeed ?? 1;
670
- speed = allowedAnimationSpeeds.reduce((prev, curr) => (Math.abs(curr - speed) < Math.abs(prev - speed) ? curr : prev));
671
- this.animationSpeed = speed;
672
- this._dispatchCustomEvent("animationspeedchange");
673
- });
674
- details.viewer.onIsAnimationPlayingChanged.add(() => {
675
- this._isAnimationPlaying = this._viewer?.isAnimationPlaying ?? false;
676
- this._dispatchCustomEvent("animationplayingchange");
677
- });
678
- details.viewer.onAnimationProgressChanged.add(() => {
679
- this.animationProgress = this._viewer?.animationProgress ?? 0;
680
- this._dispatchCustomEvent("animationprogresschange");
681
- });
682
- this._updateSelectedAnimation();
683
- this._updateAnimationSpeed();
684
- this._updateModel();
685
- this._updateEnv();
686
- this._dispatchCustomEvent("viewerready", details);
687
- },
688
- });
689
- }
690
- });
691
- }
692
- }
693
- async _tearDownViewer() {
694
- await this._viewerLock.lockAsync(async () => {
695
- if (this._viewer) {
696
- this._viewer.dispose();
697
- this._viewer = undefined;
698
- }
699
- });
700
- }
701
- _updateAnimationSpeed() {
702
- if (this._viewer) {
703
- this._viewer.animationSpeed = this.animationSpeed;
704
- }
705
- }
706
- _updateSelectedAnimation() {
707
- if (this._viewer) {
708
- this._viewer.selectedAnimation = this._selectedAnimation;
709
- }
710
- }
711
- async _updateModel() {
712
- try {
713
- if (this.src) {
714
- await this._viewer?.loadModelAsync(this.src, { pluginExtension: this.extension });
715
- }
716
- else {
717
- await this._viewer?.resetModelAsync();
718
- }
719
- }
720
- catch (error) {
721
- Logger.Log(error);
722
- }
723
- }
724
- async _updateEnv() {
725
- try {
726
- if (this.env) {
727
- await this._viewer?.loadEnvironmentAsync(this.env);
728
- }
729
- else {
730
- await this._viewer?.resetEnvironmentAsync();
731
- }
732
- }
733
- catch (error) {
734
- Logger.Log(error);
735
- }
736
- }
737
- };
738
- // eslint-disable-next-line @typescript-eslint/naming-convention, jsdoc/require-jsdoc
739
- HTML3DElement.styles = css `
740
- :host {
741
- --ui-foreground-color: white;
742
- --ui-background-hue: 233;
743
- --ui-background-saturation: 8%;
744
- --ui-background-lightness: 39%;
745
- --ui-background-opacity: 0.75;
746
- --ui-background-color: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), var(--ui-background-opacity));
747
- --ui-background-color-hover: hsla(
748
- var(--ui-background-hue),
749
- var(--ui-background-saturation),
750
- calc(var(--ui-background-lightness) - 10%),
751
- calc(var(--ui-background-opacity) - 0.1)
752
- );
753
- }
754
-
755
- * {
756
- box-sizing: border-box;
757
- }
758
-
759
- .full-size {
760
- display: block;
761
- width: 100%;
762
- height: 100%;
763
- }
764
-
765
- .tool-bar {
766
- position: absolute;
767
- display: flex;
768
- flex-direction: row;
769
- border-radius: 12px;
770
- border-color: var(--ui-foreground-color);
771
- height: 48px;
772
- width: calc(100% - 24px);
773
- min-width: 150px;
774
- max-width: 1280px;
775
- bottom: 12px;
776
- left: 50%;
777
- transform: translateX(-50%);
778
- background-color: var(--ui-background-color);
779
- color: var(--ui-foreground-color);
780
- -webkit-tap-highlight-color: transparent;
781
- }
782
-
783
- .tool-bar * {
784
- height: 100%;
785
- min-width: 48px;
786
- }
787
-
788
- .tool-bar select {
789
- background: none;
790
- min-width: 52px;
791
- max-width: 128px;
792
- border: 1px solid transparent;
793
- border-radius: inherit;
794
- color: inherit;
795
- font-size: 14px;
796
- padding: 12px;
797
- cursor: pointer;
798
- outline: none;
799
- appearance: none; /* Remove default styling */
800
- -webkit-appearance: none; /* Remove default styling for Safari */
801
- -moz-appearance: none; /* Remove default styling for Firefox */
802
- }
803
-
804
- .tool-bar select:hover,
805
- .tool-bar select:focus {
806
- background-color: var(--ui-background-color-hover);
807
- }
808
-
809
- .tool-bar select option {
810
- background-color: var(--ui-background-color);
811
- color: var(--ui-foreground-color);
812
- }
813
-
814
- .tool-bar select:focus-visible {
815
- border-color: inherit;
816
- }
817
-
818
- .tool-bar button {
819
- background: none;
820
- border: 1px solid transparent;
821
- border-radius: inherit;
822
- color: inherit;
823
- padding: 0;
824
- cursor: pointer;
825
- outline: none;
826
- }
827
-
828
- .tool-bar button:hover {
829
- background-color: var(--ui-background-color-hover);
830
- }
831
-
832
- .tool-bar button:focus-visible {
833
- border-color: inherit;
834
- }
835
-
836
- .tool-bar button svg {
837
- width: 32px;
838
- height: 32px;
839
- }
840
-
841
- .progress-control {
842
- display: flex;
843
- flex: 1;
844
- position: relative;
845
- overflow: hidden;
846
- cursor: pointer;
847
- align-items: center;
848
- border-radius: inherit;
849
- border-color: inherit;
850
- }
851
-
852
- .progress-wrapper {
853
- -webkit-appearance: none;
854
- cursor: pointer;
855
- width: 100%;
856
- height: 100%;
857
- outline: none;
858
- border: 1px solid transparent;
859
- border-radius: inherit;
860
- padding: 0 12px;
861
- background-color: transparent;
862
- }
863
-
864
- .progress-wrapper:focus-visible {
865
- border-color: inherit;
866
- }
867
-
868
- /*Chrome -webkit */
869
-
870
- .progress-wrapper::-webkit-slider-thumb {
871
- -webkit-appearance: none;
872
- width: 20px;
873
- height: 20px;
874
- border: 2px solid;
875
- color: var(--ui-foreground-color);
876
- border-radius: 50%;
877
- background: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), 1);
878
- margin-top: -10px;
879
- }
880
-
881
- .progress-wrapper::-webkit-slider-runnable-track {
882
- height: 2px;
883
- -webkit-appearance: none;
884
- background-color: var(--ui-foreground-color);
885
- }
886
-
887
- /** FireFox -moz */
888
-
889
- .progress-wrapper::-moz-range-progress {
890
- height: 2px;
891
- background-color: var(--ui-foreground-color);
892
- }
893
-
894
- .progress-wrapper::-moz-range-thumb {
895
- width: 16px;
896
- height: 16px;
897
- border: 2px solid var(--ui-foreground-color);
898
- border-radius: 50%;
899
- background: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), 1);
900
- }
901
-
902
- .progress-wrapper::-moz-range-track {
903
- height: 2px;
904
- background: var(--ui-foreground-color);
905
- }
906
- `;
907
- __decorate([
908
- property({ reflect: true })
909
- ], HTML3DElement.prototype, "engine", void 0);
910
- __decorate([
911
- property({ reflect: true })
912
- ], HTML3DElement.prototype, "src", void 0);
913
- __decorate([
914
- property({ reflect: true })
915
- ], HTML3DElement.prototype, "extension", void 0);
916
- __decorate([
917
- property({ reflect: true })
918
- ], HTML3DElement.prototype, "env", void 0);
919
- __decorate([
920
- property({ attribute: "animation-speed", reflect: true })
921
- ], HTML3DElement.prototype, "animationSpeed", void 0);
922
- __decorate([
923
- property({ attribute: false })
924
- ], HTML3DElement.prototype, "animationProgress", void 0);
925
- __decorate([
926
- state()
927
- ], HTML3DElement.prototype, "_animations", void 0);
928
- __decorate([
929
- state()
930
- ], HTML3DElement.prototype, "_selectedAnimation", void 0);
931
- __decorate([
932
- state()
933
- ], HTML3DElement.prototype, "_isAnimationPlaying", void 0);
934
- __decorate([
935
- query("#renderCanvas")
936
- ], HTML3DElement.prototype, "_canvas", void 0);
937
- HTML3DElement = __decorate([
938
- customElement("babylon-viewer")
939
- ], HTML3DElement);
940
-
941
- export { HTML3DElement, Viewer, createViewerForCanvas };
942
- //# sourceMappingURL=index.js.map