@babylonjs/viewer 7.41.1 → 7.42.0-alpha
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.
- package/assets/photoStudio.env +0 -0
- package/dist/babylon-viewer.esm.js +2 -0
- package/dist/babylon-viewer.esm.js.map +1 -0
- package/dist/babylon-viewer.esm.min.js +2 -0
- package/dist/babylon-viewer.esm.min.js.map +1 -0
- package/dist/chunks/EXT_lights_ies-BHDD74jk.esm.min.js +2 -0
- package/dist/chunks/EXT_lights_ies-BHDD74jk.esm.min.js.map +1 -0
- package/dist/chunks/EXT_lights_ies-CJfRNbJm.esm.js +84 -0
- package/dist/chunks/EXT_lights_ies-CJfRNbJm.esm.js.map +1 -0
- package/dist/chunks/EXT_lights_image_based-B460Sv95.esm.min.js +2 -0
- package/dist/chunks/EXT_lights_image_based-B460Sv95.esm.min.js.map +1 -0
- package/dist/chunks/EXT_lights_image_based-CQ6UCahL.esm.js +171 -0
- package/dist/chunks/EXT_lights_image_based-CQ6UCahL.esm.js.map +1 -0
- package/dist/chunks/EXT_mesh_gpu_instancing-D77OfiDS.esm.js +86 -0
- package/dist/chunks/EXT_mesh_gpu_instancing-D77OfiDS.esm.js.map +1 -0
- package/dist/chunks/EXT_mesh_gpu_instancing-GMG29Y9J.esm.min.js +2 -0
- package/dist/chunks/EXT_mesh_gpu_instancing-GMG29Y9J.esm.min.js.map +1 -0
- package/dist/chunks/EXT_meshopt_compression-CniiOX0a.esm.js +134 -0
- package/dist/chunks/EXT_meshopt_compression-CniiOX0a.esm.js.map +1 -0
- package/dist/chunks/EXT_meshopt_compression-DCcKdizI.esm.min.js +2 -0
- package/dist/chunks/EXT_meshopt_compression-DCcKdizI.esm.min.js.map +1 -0
- package/dist/chunks/EXT_texture_avif-By7mk6aS.esm.min.js +2 -0
- package/dist/chunks/EXT_texture_avif-By7mk6aS.esm.min.js.map +1 -0
- package/dist/chunks/EXT_texture_avif-DnaKno7b.esm.js +44 -0
- package/dist/chunks/EXT_texture_avif-DnaKno7b.esm.js.map +1 -0
- package/dist/chunks/EXT_texture_webp-Bm29ukIo.esm.js +43 -0
- package/dist/chunks/EXT_texture_webp-Bm29ukIo.esm.js.map +1 -0
- package/dist/chunks/EXT_texture_webp-DtSWYlAE.esm.min.js +2 -0
- package/dist/chunks/EXT_texture_webp-DtSWYlAE.esm.min.js.map +1 -0
- package/dist/chunks/ExtrasAsMetadata-BUO8J2zR.esm.js +64 -0
- package/dist/chunks/ExtrasAsMetadata-BUO8J2zR.esm.js.map +1 -0
- package/dist/chunks/ExtrasAsMetadata-mi3fn9sR.esm.min.js +2 -0
- package/dist/chunks/ExtrasAsMetadata-mi3fn9sR.esm.min.js.map +1 -0
- package/dist/chunks/KHR_animation_pointer-COeThtQe.esm.min.js +2 -0
- package/dist/chunks/KHR_animation_pointer-COeThtQe.esm.min.js.map +1 -0
- package/dist/chunks/KHR_animation_pointer-DXqgkZGB.esm.js +352 -0
- package/dist/chunks/KHR_animation_pointer-DXqgkZGB.esm.js.map +1 -0
- package/dist/chunks/KHR_draco_mesh_compression-Bh9XGNFd.esm.js +610 -0
- package/dist/chunks/KHR_draco_mesh_compression-Bh9XGNFd.esm.js.map +1 -0
- package/dist/chunks/KHR_draco_mesh_compression-DyU2KIa2.esm.min.js +2 -0
- package/dist/chunks/KHR_draco_mesh_compression-DyU2KIa2.esm.min.js.map +1 -0
- package/dist/chunks/KHR_interactivity-QP9zFX3U.esm.js +4033 -0
- package/dist/chunks/KHR_interactivity-QP9zFX3U.esm.js.map +1 -0
- package/dist/chunks/KHR_interactivity-_r7e7vwA.esm.min.js +2 -0
- package/dist/chunks/KHR_interactivity-_r7e7vwA.esm.min.js.map +1 -0
- package/dist/chunks/KHR_lights_punctual-DWGx9KlE.esm.js +581 -0
- package/dist/chunks/KHR_lights_punctual-DWGx9KlE.esm.js.map +1 -0
- package/dist/chunks/KHR_lights_punctual-cz3ulMW0.esm.min.js +2 -0
- package/dist/chunks/KHR_lights_punctual-cz3ulMW0.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_anisotropy-BSvZxEnx.esm.js +65 -0
- package/dist/chunks/KHR_materials_anisotropy-BSvZxEnx.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_anisotropy-CtKPvN_z.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_anisotropy-CtKPvN_z.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_clearcoat-BephgEiM.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_clearcoat-BephgEiM.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_clearcoat-C3QB9HNC.esm.js +96 -0
- package/dist/chunks/KHR_materials_clearcoat-C3QB9HNC.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_diffuse_transmission-CZvfLdyF.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_diffuse_transmission-CZvfLdyF.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_diffuse_transmission-DuM5GD2L.esm.js +97 -0
- package/dist/chunks/KHR_materials_diffuse_transmission-DuM5GD2L.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_dispersion-0FtkqUmS.esm.js +62 -0
- package/dist/chunks/KHR_materials_dispersion-0FtkqUmS.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_dispersion-C7mAat5y.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_dispersion-C7mAat5y.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_emissive_strength-Bz2y9OnA.esm.js +55 -0
- package/dist/chunks/KHR_materials_emissive_strength-Bz2y9OnA.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_emissive_strength-b7ZNj1HF.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_emissive_strength-b7ZNj1HF.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_ior-C5-JiuLs.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_ior-C5-JiuLs.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_ior-D1jjzmsp.esm.js +64 -0
- package/dist/chunks/KHR_materials_ior-D1jjzmsp.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_iridescence-CChET9-W.esm.js +72 -0
- package/dist/chunks/KHR_materials_iridescence-CChET9-W.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_iridescence-hATfgETI.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_iridescence-hATfgETI.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-B-HlmeqI.esm.js +81 -0
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-B-HlmeqI.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-_IaUmSJE.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-_IaUmSJE.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_sheen-D2QD8uSC.esm.js +85 -0
- package/dist/chunks/KHR_materials_sheen-D2QD8uSC.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_sheen-cqxpRyXD.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_sheen-cqxpRyXD.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_specular-DnHIH9RX.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_specular-DnHIH9RX.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_specular-vwRXhXVF.esm.js +75 -0
- package/dist/chunks/KHR_materials_specular-vwRXhXVF.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_transmission-D81TRCgt.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_transmission-D81TRCgt.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_transmission-nPX6lno-.esm.js +307 -0
- package/dist/chunks/KHR_materials_transmission-nPX6lno-.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_unlit-CLSTXPsk.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_unlit-CLSTXPsk.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_unlit-pmQPq5qR.esm.js +74 -0
- package/dist/chunks/KHR_materials_unlit-pmQPq5qR.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_variants-C_XVH51a.esm.js +262 -0
- package/dist/chunks/KHR_materials_variants-C_XVH51a.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_variants-Czo1ZM8r.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_variants-Czo1ZM8r.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_volume-BJVGGE1g.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_volume-BJVGGE1g.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_volume-C4EKOzF-.esm.js +87 -0
- package/dist/chunks/KHR_materials_volume-C4EKOzF-.esm.js.map +1 -0
- package/dist/chunks/KHR_mesh_quantization-CZIcA8DN.esm.min.js +2 -0
- package/dist/chunks/KHR_mesh_quantization-CZIcA8DN.esm.min.js.map +1 -0
- package/dist/chunks/KHR_mesh_quantization-DG9WNux6.esm.js +26 -0
- package/dist/chunks/KHR_mesh_quantization-DG9WNux6.esm.js.map +1 -0
- package/dist/chunks/KHR_node_hoverability-C1YMkQ95.esm.js +39 -0
- package/dist/chunks/KHR_node_hoverability-C1YMkQ95.esm.js.map +1 -0
- package/dist/chunks/KHR_node_hoverability-HxHiCdR9.esm.min.js +2 -0
- package/dist/chunks/KHR_node_hoverability-HxHiCdR9.esm.min.js.map +1 -0
- package/dist/chunks/KHR_node_visibility-C5tc6GOc.esm.js +46 -0
- package/dist/chunks/KHR_node_visibility-C5tc6GOc.esm.js.map +1 -0
- package/dist/chunks/KHR_node_visibility-CSqn8wRd.esm.min.js +2 -0
- package/dist/chunks/KHR_node_visibility-CSqn8wRd.esm.min.js.map +1 -0
- package/dist/chunks/KHR_texture_basisu-DA2FE-qb.esm.min.js +2 -0
- package/dist/chunks/KHR_texture_basisu-DA2FE-qb.esm.min.js.map +1 -0
- package/dist/chunks/KHR_texture_basisu-KtQL54P-.esm.js +43 -0
- package/dist/chunks/KHR_texture_basisu-KtQL54P-.esm.js.map +1 -0
- package/dist/chunks/KHR_texture_transform-Cb6Q41F3.esm.js +63 -0
- package/dist/chunks/KHR_texture_transform-Cb6Q41F3.esm.js.map +1 -0
- package/dist/chunks/KHR_texture_transform-GdBAq_uW.esm.min.js +2 -0
- package/dist/chunks/KHR_texture_transform-GdBAq_uW.esm.min.js.map +1 -0
- package/dist/chunks/KHR_xmp_json_ld-CD_mkZDv.esm.min.js +2 -0
- package/dist/chunks/KHR_xmp_json_ld-CD_mkZDv.esm.min.js.map +1 -0
- package/dist/chunks/KHR_xmp_json_ld-f1rcQfsd.esm.js +51 -0
- package/dist/chunks/KHR_xmp_json_ld-f1rcQfsd.esm.js.map +1 -0
- package/dist/chunks/MSFT_audio_emitter-BU83EIcP.esm.min.js +2 -0
- package/dist/chunks/MSFT_audio_emitter-BU83EIcP.esm.min.js.map +1 -0
- package/dist/chunks/MSFT_audio_emitter-ClwdeJaR.esm.js +2201 -0
- package/dist/chunks/MSFT_audio_emitter-ClwdeJaR.esm.js.map +1 -0
- package/dist/chunks/MSFT_lod-D3MQWFc3.esm.min.js +2 -0
- package/dist/chunks/MSFT_lod-D3MQWFc3.esm.min.js.map +1 -0
- package/dist/chunks/MSFT_lod-DkM5iXcm.esm.js +337 -0
- package/dist/chunks/MSFT_lod-DkM5iXcm.esm.js.map +1 -0
- package/dist/chunks/MSFT_minecraftMesh-CG9JY5Ic.esm.min.js +2 -0
- package/dist/chunks/MSFT_minecraftMesh-CG9JY5Ic.esm.min.js.map +1 -0
- package/dist/chunks/MSFT_minecraftMesh-Cyjdx_Y_.esm.js +46 -0
- package/dist/chunks/MSFT_minecraftMesh-Cyjdx_Y_.esm.js.map +1 -0
- package/dist/chunks/MSFT_sRGBFactors-Bm3_fRmt.esm.min.js +2 -0
- package/dist/chunks/MSFT_sRGBFactors-Bm3_fRmt.esm.min.js.map +1 -0
- package/dist/chunks/MSFT_sRGBFactors-uFdNij-4.esm.js +47 -0
- package/dist/chunks/MSFT_sRGBFactors-uFdNij-4.esm.js.map +1 -0
- package/dist/chunks/animationGroup-CravGs2P.esm.min.js +2 -0
- package/dist/chunks/animationGroup-CravGs2P.esm.min.js.map +1 -0
- package/dist/chunks/animationGroup-DqmFa1Nk.esm.js +2482 -0
- package/dist/chunks/animationGroup-DqmFa1Nk.esm.js.map +1 -0
- package/dist/chunks/assetContainer-0Qu2XIWb.esm.js +1720 -0
- package/dist/chunks/assetContainer-0Qu2XIWb.esm.js.map +1 -0
- package/dist/chunks/assetContainer-CMuD-n3X.esm.min.js +2 -0
- package/dist/chunks/assetContainer-CMuD-n3X.esm.min.js.map +1 -0
- package/dist/chunks/audioEngine--EMyAh-L.esm.js +305 -0
- package/dist/chunks/audioEngine--EMyAh-L.esm.js.map +1 -0
- package/dist/chunks/audioEngine-3doZGQV6.esm.min.js +2 -0
- package/dist/chunks/audioEngine-3doZGQV6.esm.min.js.map +1 -0
- package/dist/chunks/bakedVertexAnimation-DgMI1D24.esm.min.js +2 -0
- package/dist/chunks/bakedVertexAnimation-DgMI1D24.esm.min.js.map +1 -0
- package/dist/chunks/bakedVertexAnimation-gQlUctpB.esm.js +114 -0
- package/dist/chunks/bakedVertexAnimation-gQlUctpB.esm.js.map +1 -0
- package/dist/chunks/basisTextureLoader-B0PY0ILM.esm.js +600 -0
- package/dist/chunks/basisTextureLoader-B0PY0ILM.esm.js.map +1 -0
- package/dist/chunks/basisTextureLoader-ES0mOtqQ.esm.min.js +2 -0
- package/dist/chunks/basisTextureLoader-ES0mOtqQ.esm.min.js.map +1 -0
- package/dist/chunks/dds-DEZD6DKL.esm.min.js +2 -0
- package/dist/chunks/dds-DEZD6DKL.esm.min.js.map +1 -0
- package/dist/chunks/dds-HwVEMga8.esm.js +540 -0
- package/dist/chunks/dds-HwVEMga8.esm.js.map +1 -0
- package/dist/chunks/ddsTextureLoader-3PDKukdG.esm.js +88 -0
- package/dist/chunks/ddsTextureLoader-3PDKukdG.esm.js.map +1 -0
- package/dist/chunks/ddsTextureLoader-C62DqYdE.esm.min.js +2 -0
- package/dist/chunks/ddsTextureLoader-C62DqYdE.esm.min.js.map +1 -0
- package/dist/chunks/decalFragment-B9KsZn_u.esm.min.js +2 -0
- package/dist/chunks/decalFragment-B9KsZn_u.esm.min.js.map +1 -0
- package/dist/chunks/decalFragment-CNA1EQK9.esm.js +18 -0
- package/dist/chunks/decalFragment-CNA1EQK9.esm.js.map +1 -0
- package/dist/chunks/default.fragment-BsajFq2Q.esm.js +446 -0
- package/dist/chunks/default.fragment-BsajFq2Q.esm.js.map +1 -0
- package/dist/chunks/default.fragment-C7O2NjXo.esm.min.js +2 -0
- package/dist/chunks/default.fragment-C7O2NjXo.esm.min.js.map +1 -0
- package/dist/chunks/default.fragment-CNef5Xlg.esm.min.js +2 -0
- package/dist/chunks/default.fragment-CNef5Xlg.esm.min.js.map +1 -0
- package/dist/chunks/default.fragment-DAO0SBl-.esm.js +515 -0
- package/dist/chunks/default.fragment-DAO0SBl-.esm.js.map +1 -0
- package/dist/chunks/default.vertex-Ban5pFUb.esm.js +211 -0
- package/dist/chunks/default.vertex-Ban5pFUb.esm.js.map +1 -0
- package/dist/chunks/default.vertex-CPjp6YBQ.esm.min.js +2 -0
- package/dist/chunks/default.vertex-CPjp6YBQ.esm.min.js.map +1 -0
- package/dist/chunks/default.vertex-CemfGK4Y.esm.min.js +2 -0
- package/dist/chunks/default.vertex-CemfGK4Y.esm.min.js.map +1 -0
- package/dist/chunks/default.vertex-QE4cV7Y2.esm.js +190 -0
- package/dist/chunks/default.vertex-QE4cV7Y2.esm.js.map +1 -0
- package/dist/chunks/defaultUboDeclaration-B5nIsoCQ.esm.min.js +2 -0
- package/dist/chunks/defaultUboDeclaration-B5nIsoCQ.esm.min.js.map +1 -0
- package/dist/chunks/defaultUboDeclaration-B8tY8ajW.esm.js +15 -0
- package/dist/chunks/defaultUboDeclaration-B8tY8ajW.esm.js.map +1 -0
- package/dist/chunks/defaultUboDeclaration-D7yr1BRw.esm.js +13 -0
- package/dist/chunks/defaultUboDeclaration-D7yr1BRw.esm.js.map +1 -0
- package/dist/chunks/defaultUboDeclaration-Db_EQWlv.esm.min.js +2 -0
- package/dist/chunks/defaultUboDeclaration-Db_EQWlv.esm.min.js.map +1 -0
- package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js +11 -0
- package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js.map +1 -0
- package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js +2 -0
- package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js.map +1 -0
- package/dist/chunks/dumpTools-C13JzZr_.esm.min.js +2 -0
- package/dist/chunks/dumpTools-C13JzZr_.esm.min.js.map +1 -0
- package/dist/chunks/dumpTools-D6BRv6Ws.esm.js +200 -0
- package/dist/chunks/dumpTools-D6BRv6Ws.esm.js.map +1 -0
- package/dist/chunks/engine-29lBc-mw.esm.min.js +2 -0
- package/dist/chunks/engine-29lBc-mw.esm.min.js.map +1 -0
- package/dist/chunks/engine-Bk6S663t.esm.js +2213 -0
- package/dist/chunks/engine-Bk6S663t.esm.js.map +1 -0
- package/dist/chunks/engine.common-D_DOB0rT.esm.js +1162 -0
- package/dist/chunks/engine.common-D_DOB0rT.esm.js.map +1 -0
- package/dist/chunks/engine.common-OpqDqcE2.esm.min.js +2 -0
- package/dist/chunks/engine.common-OpqDqcE2.esm.min.js.map +1 -0
- package/dist/chunks/envTextureLoader-DS13pG9w.esm.js +64 -0
- package/dist/chunks/envTextureLoader-DS13pG9w.esm.js.map +1 -0
- package/dist/chunks/envTextureLoader-Dt6q0XDu.esm.min.js +2 -0
- package/dist/chunks/envTextureLoader-Dt6q0XDu.esm.min.js.map +1 -0
- package/dist/chunks/environmentTextureTools-DKN-Hd8c.esm.min.js +2 -0
- package/dist/chunks/environmentTextureTools-DKN-Hd8c.esm.min.js.map +1 -0
- package/dist/chunks/environmentTextureTools-DWkvV21A.esm.js +382 -0
- package/dist/chunks/environmentTextureTools-DWkvV21A.esm.js.map +1 -0
- package/dist/chunks/exrTextureLoader-6o4jfUaF.esm.js +1683 -0
- package/dist/chunks/exrTextureLoader-6o4jfUaF.esm.js.map +1 -0
- package/dist/chunks/exrTextureLoader-CXV9O3pZ.esm.min.js +2 -0
- package/dist/chunks/exrTextureLoader-CXV9O3pZ.esm.min.js.map +1 -0
- package/dist/chunks/fogFragment-BdOtsPe3.esm.js +102 -0
- package/dist/chunks/fogFragment-BdOtsPe3.esm.js.map +1 -0
- package/dist/chunks/fogFragment-Cv3Bqrrg.esm.js +101 -0
- package/dist/chunks/fogFragment-Cv3Bqrrg.esm.js.map +1 -0
- package/dist/chunks/fogFragment-D91rqvp0.esm.min.js +2 -0
- package/dist/chunks/fogFragment-D91rqvp0.esm.min.js.map +1 -0
- package/dist/chunks/fogFragment-qdYpZbGA.esm.min.js +2 -0
- package/dist/chunks/fogFragment-qdYpZbGA.esm.min.js.map +1 -0
- package/dist/chunks/fresnelFunction-DBMK4K-2.esm.min.js +2 -0
- package/dist/chunks/fresnelFunction-DBMK4K-2.esm.min.js.map +1 -0
- package/dist/chunks/fresnelFunction-o5ZOc6C0.esm.js +12 -0
- package/dist/chunks/fresnelFunction-o5ZOc6C0.esm.js.map +1 -0
- package/dist/chunks/glTFLoader-Dj_JCgqJ.esm.min.js +2 -0
- package/dist/chunks/glTFLoader-Dj_JCgqJ.esm.min.js.map +1 -0
- package/dist/chunks/glTFLoader-DnWHbX53.esm.js +7693 -0
- package/dist/chunks/glTFLoader-DnWHbX53.esm.js.map +1 -0
- package/dist/chunks/glTFLoaderAnimation-A_WVS-lt.esm.min.js +2 -0
- package/dist/chunks/glTFLoaderAnimation-A_WVS-lt.esm.min.js.map +1 -0
- package/dist/chunks/glTFLoaderAnimation-C3gHlipY.esm.js +77 -0
- package/dist/chunks/glTFLoaderAnimation-C3gHlipY.esm.js.map +1 -0
- package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js +2 -0
- package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js.map +1 -0
- package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js +67 -0
- package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js.map +1 -0
- package/dist/chunks/harmonicsFunctions-91QStv6v.esm.min.js +2 -0
- package/dist/chunks/harmonicsFunctions-91QStv6v.esm.min.js.map +1 -0
- package/dist/chunks/harmonicsFunctions-DBJQNoSA.esm.min.js +2 -0
- package/dist/chunks/harmonicsFunctions-DBJQNoSA.esm.min.js.map +1 -0
- package/dist/chunks/harmonicsFunctions-DXdlMMN6.esm.js +34 -0
- package/dist/chunks/harmonicsFunctions-DXdlMMN6.esm.js.map +1 -0
- package/dist/chunks/harmonicsFunctions-VtAD6DeX.esm.js +35 -0
- package/dist/chunks/harmonicsFunctions-VtAD6DeX.esm.js.map +1 -0
- package/dist/chunks/hdrTextureLoader-CYtpPSzs.esm.js +253 -0
- package/dist/chunks/hdrTextureLoader-CYtpPSzs.esm.js.map +1 -0
- package/dist/chunks/hdrTextureLoader-CzZ1hV7q.esm.min.js +2 -0
- package/dist/chunks/hdrTextureLoader-CzZ1hV7q.esm.min.js.map +1 -0
- package/dist/chunks/helperFunctions-Bn3a_gzG.esm.js +110 -0
- package/dist/chunks/helperFunctions-Bn3a_gzG.esm.js.map +1 -0
- package/dist/chunks/helperFunctions-CA_QOVSE.esm.js +83 -0
- package/dist/chunks/helperFunctions-CA_QOVSE.esm.js.map +1 -0
- package/dist/chunks/helperFunctions-mebe29sq.esm.min.js +2 -0
- package/dist/chunks/helperFunctions-mebe29sq.esm.min.js.map +1 -0
- package/dist/chunks/helperFunctions-wIdfkMdZ.esm.min.js +2 -0
- package/dist/chunks/helperFunctions-wIdfkMdZ.esm.min.js.map +1 -0
- package/dist/chunks/iesTextureLoader-D8_bkaCP.esm.min.js +2 -0
- package/dist/chunks/iesTextureLoader-D8_bkaCP.esm.min.js.map +1 -0
- package/dist/chunks/iesTextureLoader-K1MQUalq.esm.js +189 -0
- package/dist/chunks/iesTextureLoader-K1MQUalq.esm.js.map +1 -0
- package/dist/chunks/index-Bo5F_mGk.esm.min.js +57 -0
- package/dist/chunks/index-Bo5F_mGk.esm.min.js.map +1 -0
- package/dist/chunks/index-Dlf001gP.esm.js +74889 -0
- package/dist/chunks/index-Dlf001gP.esm.js.map +1 -0
- package/dist/chunks/ktxTextureLoader-B6UHYOxL.esm.js +814 -0
- package/dist/chunks/ktxTextureLoader-B6UHYOxL.esm.js.map +1 -0
- package/dist/chunks/ktxTextureLoader-s_dbtiwN.esm.min.js +2 -0
- package/dist/chunks/ktxTextureLoader-s_dbtiwN.esm.min.js.map +1 -0
- package/dist/chunks/logDepthDeclaration--xmemf5p.esm.min.js +2 -0
- package/dist/chunks/logDepthDeclaration--xmemf5p.esm.min.js.map +1 -0
- package/dist/chunks/logDepthDeclaration-Babs-3_m.esm.js +35 -0
- package/dist/chunks/logDepthDeclaration-Babs-3_m.esm.js.map +1 -0
- package/dist/chunks/logDepthDeclaration-BvoznvSG.esm.min.js +2 -0
- package/dist/chunks/logDepthDeclaration-BvoznvSG.esm.min.js.map +1 -0
- package/dist/chunks/logDepthDeclaration-_EPT9ybx.esm.js +11 -0
- package/dist/chunks/logDepthDeclaration-_EPT9ybx.esm.js.map +1 -0
- package/dist/chunks/logDepthVertex-0vve_qKh.esm.js +77 -0
- package/dist/chunks/logDepthVertex-0vve_qKh.esm.js.map +1 -0
- package/dist/chunks/logDepthVertex-BkGmO8_s.esm.js +81 -0
- package/dist/chunks/logDepthVertex-BkGmO8_s.esm.js.map +1 -0
- package/dist/chunks/logDepthVertex-CVcNpHQe.esm.min.js +2 -0
- package/dist/chunks/logDepthVertex-CVcNpHQe.esm.min.js.map +1 -0
- package/dist/chunks/logDepthVertex-DL8eWalk.esm.min.js +2 -0
- package/dist/chunks/logDepthVertex-DL8eWalk.esm.min.js.map +1 -0
- package/dist/chunks/mainUVVaryingDeclaration-9DUO7sPf.esm.js +11 -0
- package/dist/chunks/mainUVVaryingDeclaration-9DUO7sPf.esm.js.map +1 -0
- package/dist/chunks/mainUVVaryingDeclaration-DXZGPs7O.esm.js +11 -0
- package/dist/chunks/mainUVVaryingDeclaration-DXZGPs7O.esm.js.map +1 -0
- package/dist/chunks/mainUVVaryingDeclaration-DaFtbg5X.esm.min.js +2 -0
- package/dist/chunks/mainUVVaryingDeclaration-DaFtbg5X.esm.min.js.map +1 -0
- package/dist/chunks/mainUVVaryingDeclaration-lKBcMFcP.esm.min.js +2 -0
- package/dist/chunks/mainUVVaryingDeclaration-lKBcMFcP.esm.min.js.map +1 -0
- package/dist/chunks/mesh.vertexData.functions-B_pMCAzZ.esm.js +119 -0
- package/dist/chunks/mesh.vertexData.functions-B_pMCAzZ.esm.js.map +1 -0
- package/dist/chunks/mesh.vertexData.functions-Bo7e6Of9.esm.min.js +2 -0
- package/dist/chunks/mesh.vertexData.functions-Bo7e6Of9.esm.min.js.map +1 -0
- package/dist/chunks/meshUboDeclaration-BN0BlYEZ.esm.js +26 -0
- package/dist/chunks/meshUboDeclaration-BN0BlYEZ.esm.js.map +1 -0
- package/dist/chunks/meshUboDeclaration-BcQ1P_co.esm.min.js +2 -0
- package/dist/chunks/meshUboDeclaration-BcQ1P_co.esm.min.js.map +1 -0
- package/dist/chunks/objFileLoader-Lx7JtYFA.esm.min.js +2 -0
- package/dist/chunks/objFileLoader-Lx7JtYFA.esm.min.js.map +1 -0
- package/dist/chunks/objFileLoader-_nxEPYB4.esm.js +1338 -0
- package/dist/chunks/objFileLoader-_nxEPYB4.esm.js.map +1 -0
- package/dist/chunks/oitFragment-BPgREULe.esm.js +1240 -0
- package/dist/chunks/oitFragment-BPgREULe.esm.js.map +1 -0
- package/dist/chunks/oitFragment-CKNxTV0T.esm.min.js +2 -0
- package/dist/chunks/oitFragment-CKNxTV0T.esm.min.js.map +1 -0
- package/dist/chunks/oitFragment-CT3oWGRL.esm.js +1078 -0
- package/dist/chunks/oitFragment-CT3oWGRL.esm.js.map +1 -0
- package/dist/chunks/oitFragment-CXrV_64a.esm.min.js +2 -0
- package/dist/chunks/oitFragment-CXrV_64a.esm.min.js.map +1 -0
- package/dist/chunks/pass.fragment-BugqjVKo.esm.js +15 -0
- package/dist/chunks/pass.fragment-BugqjVKo.esm.js.map +1 -0
- package/dist/chunks/pass.fragment-X-KK3tOa.esm.min.js +2 -0
- package/dist/chunks/pass.fragment-X-KK3tOa.esm.min.js.map +1 -0
- package/dist/chunks/pass.fragment-pJ1J3AeO.esm.min.js +2 -0
- package/dist/chunks/pass.fragment-pJ1J3AeO.esm.min.js.map +1 -0
- package/dist/chunks/pass.fragment-tk9KCmM-.esm.js +15 -0
- package/dist/chunks/pass.fragment-tk9KCmM-.esm.js.map +1 -0
- package/dist/chunks/pbr.fragment-C4BFWzEP.esm.js +3269 -0
- package/dist/chunks/pbr.fragment-C4BFWzEP.esm.js.map +1 -0
- package/dist/chunks/pbr.fragment-CTE0zFNb.esm.min.js +2 -0
- package/dist/chunks/pbr.fragment-CTE0zFNb.esm.min.js.map +1 -0
- package/dist/chunks/pbr.fragment-DZRIiJzv.esm.js +3222 -0
- package/dist/chunks/pbr.fragment-DZRIiJzv.esm.js.map +1 -0
- package/dist/chunks/pbr.fragment-Dk1kkP87.esm.min.js +2 -0
- package/dist/chunks/pbr.fragment-Dk1kkP87.esm.min.js.map +1 -0
- package/dist/chunks/pbr.vertex-Ba8BDEep.esm.min.js +2 -0
- package/dist/chunks/pbr.vertex-Ba8BDEep.esm.min.js.map +1 -0
- package/dist/chunks/pbr.vertex-DM2WONhK.esm.js +223 -0
- package/dist/chunks/pbr.vertex-DM2WONhK.esm.js.map +1 -0
- package/dist/chunks/pbr.vertex-DVghYyb7.esm.min.js +2 -0
- package/dist/chunks/pbr.vertex-DVghYyb7.esm.min.js.map +1 -0
- package/dist/chunks/pbr.vertex-DiVjR6Bs.esm.js +348 -0
- package/dist/chunks/pbr.vertex-DiVjR6Bs.esm.js.map +1 -0
- package/dist/chunks/postprocess.vertex-CtVD6qfW.esm.min.js +2 -0
- package/dist/chunks/postprocess.vertex-CtVD6qfW.esm.min.js.map +1 -0
- package/dist/chunks/postprocess.vertex-DntzOpKV.esm.js +20 -0
- package/dist/chunks/postprocess.vertex-DntzOpKV.esm.js.map +1 -0
- package/dist/chunks/rawTexture-BAt5J3G4.esm.min.js +2 -0
- package/dist/chunks/rawTexture-BAt5J3G4.esm.min.js.map +1 -0
- package/dist/chunks/rawTexture-D0O_yrdQ.esm.js +191 -0
- package/dist/chunks/rawTexture-D0O_yrdQ.esm.js.map +1 -0
- package/dist/chunks/ray-Bbt37I0I.esm.js +946 -0
- package/dist/chunks/ray-Bbt37I0I.esm.js.map +1 -0
- package/dist/chunks/ray-OQ0d0a-k.esm.min.js +2 -0
- package/dist/chunks/ray-OQ0d0a-k.esm.min.js.map +1 -0
- package/dist/chunks/rgbdDecode.fragment-4HjKGwMm.esm.min.js +2 -0
- package/dist/chunks/rgbdDecode.fragment-4HjKGwMm.esm.min.js.map +1 -0
- package/dist/chunks/rgbdDecode.fragment-CKVGwRZO.esm.js +13 -0
- package/dist/chunks/rgbdDecode.fragment-CKVGwRZO.esm.js.map +1 -0
- package/dist/chunks/rgbdDecode.fragment-Cn6YVnkB.esm.js +13 -0
- package/dist/chunks/rgbdDecode.fragment-Cn6YVnkB.esm.js.map +1 -0
- package/dist/chunks/rgbdDecode.fragment-DwcDy8Eo.esm.min.js +2 -0
- package/dist/chunks/rgbdDecode.fragment-DwcDy8Eo.esm.min.js.map +1 -0
- package/dist/chunks/rgbdEncode.fragment-BUluDIqG.esm.min.js +2 -0
- package/dist/chunks/rgbdEncode.fragment-BUluDIqG.esm.min.js.map +1 -0
- package/dist/chunks/rgbdEncode.fragment-CEiZq0Qt.esm.js +13 -0
- package/dist/chunks/rgbdEncode.fragment-CEiZq0Qt.esm.js.map +1 -0
- package/dist/chunks/rgbdEncode.fragment-CY0yYtEl.esm.js +13 -0
- package/dist/chunks/rgbdEncode.fragment-CY0yYtEl.esm.js.map +1 -0
- package/dist/chunks/rgbdEncode.fragment-DS4_h_Qc.esm.min.js +2 -0
- package/dist/chunks/rgbdEncode.fragment-DS4_h_Qc.esm.min.js.map +1 -0
- package/dist/chunks/splatFileLoader-C9ykR2nU.esm.js +3387 -0
- package/dist/chunks/splatFileLoader-C9ykR2nU.esm.js.map +1 -0
- package/dist/chunks/splatFileLoader-fz6lXWf1.esm.min.js +2 -0
- package/dist/chunks/splatFileLoader-fz6lXWf1.esm.min.js.map +1 -0
- package/dist/chunks/spotLight-BJUVKiS1.esm.min.js +2 -0
- package/dist/chunks/spotLight-BJUVKiS1.esm.min.js.map +1 -0
- package/dist/chunks/spotLight-DPadbSE2.esm.js +701 -0
- package/dist/chunks/spotLight-DPadbSE2.esm.js.map +1 -0
- package/dist/chunks/standardMaterial-BFBsF3pv.esm.min.js +2 -0
- package/dist/chunks/standardMaterial-BFBsF3pv.esm.min.js.map +1 -0
- package/dist/chunks/standardMaterial-eJkfs5dX.esm.js +1807 -0
- package/dist/chunks/standardMaterial-eJkfs5dX.esm.js.map +1 -0
- package/dist/chunks/stlFileLoader-D-4wZdg7.esm.js +238 -0
- package/dist/chunks/stlFileLoader-D-4wZdg7.esm.js.map +1 -0
- package/dist/chunks/stlFileLoader-DFdDdaYW.esm.min.js +2 -0
- package/dist/chunks/stlFileLoader-DFdDdaYW.esm.min.js.map +1 -0
- package/dist/chunks/tgaTextureLoader-84Uwk9uE.esm.min.js +2 -0
- package/dist/chunks/tgaTextureLoader-84Uwk9uE.esm.min.js.map +1 -0
- package/dist/chunks/tgaTextureLoader-DDAxGDFK.esm.js +349 -0
- package/dist/chunks/tgaTextureLoader-DDAxGDFK.esm.js.map +1 -0
- package/dist/chunks/thinEngine-CiBi1yBe.esm.min.js +2 -0
- package/dist/chunks/thinEngine-CiBi1yBe.esm.min.js.map +1 -0
- package/dist/chunks/thinEngine-iDkoF96X.esm.js +3848 -0
- package/dist/chunks/thinEngine-iDkoF96X.esm.js.map +1 -0
- package/dist/chunks/thinInstanceMesh-DGBYkFXN.esm.js +314 -0
- package/dist/chunks/thinInstanceMesh-DGBYkFXN.esm.js.map +1 -0
- package/dist/chunks/thinInstanceMesh-MROq1d7v.esm.min.js +2 -0
- package/dist/chunks/thinInstanceMesh-MROq1d7v.esm.min.js.map +1 -0
- package/dist/chunks/vertexColorMixing-0VXbzCuF.esm.js +428 -0
- package/dist/chunks/vertexColorMixing-0VXbzCuF.esm.js.map +1 -0
- package/dist/chunks/vertexColorMixing-B3GD6hE2.esm.js +538 -0
- package/dist/chunks/vertexColorMixing-B3GD6hE2.esm.js.map +1 -0
- package/dist/chunks/vertexColorMixing-ClVYo-h9.esm.min.js +2 -0
- package/dist/chunks/vertexColorMixing-ClVYo-h9.esm.min.js.map +1 -0
- package/dist/chunks/vertexColorMixing-j0Dix_Wy.esm.min.js +2 -0
- package/dist/chunks/vertexColorMixing-j0Dix_Wy.esm.min.js.map +1 -0
- package/dist/chunks/webgpuEngine-BLhhEybd.esm.min.js +2 -0
- package/dist/chunks/webgpuEngine-BLhhEybd.esm.min.js.map +1 -0
- package/dist/chunks/webgpuEngine-Cs5fkngY.esm.js +11533 -0
- package/dist/chunks/webgpuEngine-Cs5fkngY.esm.js.map +1 -0
- package/dist/chunks/workerPool-BUOov2K1.esm.js +122 -0
- package/dist/chunks/workerPool-BUOov2K1.esm.js.map +1 -0
- package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js +2 -0
- package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js.map +1 -0
- package/lib/index.d.ts +591 -0
- package/lib/index.js +2165 -0
- package/lib/index.js.map +1 -0
- package/package.json +19 -28
- package/readme.md +28 -28
- package/configuration/configuration.d.ts +0 -107
- package/configuration/configuration.js +0 -16
- package/configuration/configuration.js.map +0 -1
- package/configuration/configurationCompatibility.d.ts +0 -8
- package/configuration/configurationCompatibility.js +0 -66
- package/configuration/configurationCompatibility.js.map +0 -1
- package/configuration/configurationContainer.d.ts +0 -10
- package/configuration/configurationContainer.js +0 -10
- package/configuration/configurationContainer.js.map +0 -1
- package/configuration/globals.d.ts +0 -6
- package/configuration/globals.js +0 -18
- package/configuration/globals.js.map +0 -1
- package/configuration/index.d.ts +0 -2
- package/configuration/index.js +0 -4
- package/configuration/index.js.map +0 -1
- package/configuration/interfaces/cameraConfiguration.d.ts +0 -31
- package/configuration/interfaces/cameraConfiguration.js +0 -2
- package/configuration/interfaces/cameraConfiguration.js.map +0 -1
- package/configuration/interfaces/colorGradingConfiguration.d.ts +0 -81
- package/configuration/interfaces/colorGradingConfiguration.js +0 -2
- package/configuration/interfaces/colorGradingConfiguration.js.map +0 -1
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +0 -20
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +0 -2
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +0 -1
- package/configuration/interfaces/environmentMapConfiguration.d.ts +0 -22
- package/configuration/interfaces/environmentMapConfiguration.js +0 -2
- package/configuration/interfaces/environmentMapConfiguration.js.map +0 -1
- package/configuration/interfaces/groundConfiguration.d.ts +0 -24
- package/configuration/interfaces/groundConfiguration.js +0 -2
- package/configuration/interfaces/groundConfiguration.js.map +0 -1
- package/configuration/interfaces/imageProcessingConfiguration.d.ts +0 -45
- package/configuration/interfaces/imageProcessingConfiguration.js +0 -2
- package/configuration/interfaces/imageProcessingConfiguration.js.map +0 -1
- package/configuration/interfaces/index.d.ts +0 -15
- package/configuration/interfaces/index.js +0 -16
- package/configuration/interfaces/index.js.map +0 -1
- package/configuration/interfaces/lightConfiguration.d.ts +0 -60
- package/configuration/interfaces/lightConfiguration.js +0 -2
- package/configuration/interfaces/lightConfiguration.js.map +0 -1
- package/configuration/interfaces/modelAnimationConfiguration.d.ts +0 -26
- package/configuration/interfaces/modelAnimationConfiguration.js +0 -2
- package/configuration/interfaces/modelAnimationConfiguration.js.map +0 -1
- package/configuration/interfaces/modelConfiguration.d.ts +0 -65
- package/configuration/interfaces/modelConfiguration.js +0 -2
- package/configuration/interfaces/modelConfiguration.js.map +0 -1
- package/configuration/interfaces/observersConfiguration.d.ts +0 -5
- package/configuration/interfaces/observersConfiguration.js +0 -2
- package/configuration/interfaces/observersConfiguration.js.map +0 -1
- package/configuration/interfaces/sceneConfiguration.d.ts +0 -48
- package/configuration/interfaces/sceneConfiguration.js +0 -2
- package/configuration/interfaces/sceneConfiguration.js.map +0 -1
- package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +0 -23
- package/configuration/interfaces/sceneOptimizerConfiguration.js +0 -2
- package/configuration/interfaces/sceneOptimizerConfiguration.js.map +0 -1
- package/configuration/interfaces/skyboxConfiguration.d.ts +0 -21
- package/configuration/interfaces/skyboxConfiguration.js +0 -2
- package/configuration/interfaces/skyboxConfiguration.js.map +0 -1
- package/configuration/interfaces/templateConfiguration.d.ts +0 -67
- package/configuration/interfaces/templateConfiguration.js +0 -2
- package/configuration/interfaces/templateConfiguration.js.map +0 -1
- package/configuration/interfaces/vrConfiguration.d.ts +0 -16
- package/configuration/interfaces/vrConfiguration.js +0 -2
- package/configuration/interfaces/vrConfiguration.js.map +0 -1
- package/configuration/loader.d.ts +0 -4
- package/configuration/loader.js +0 -17
- package/configuration/loader.js.map +0 -1
- package/configuration/mappers.d.ts +0 -43
- package/configuration/mappers.js +0 -193
- package/configuration/mappers.js.map +0 -1
- package/configuration/renderOnlyLoader.d.ts +0 -33
- package/configuration/renderOnlyLoader.js +0 -162
- package/configuration/renderOnlyLoader.js.map +0 -1
- package/configuration/types/default.d.ts +0 -6
- package/configuration/types/default.js +0 -121
- package/configuration/types/default.js.map +0 -1
- package/configuration/types/environmentMap.d.ts +0 -5
- package/configuration/types/environmentMap.js +0 -14
- package/configuration/types/environmentMap.js.map +0 -1
- package/configuration/types/extended.d.ts +0 -6
- package/configuration/types/extended.js +0 -317
- package/configuration/types/extended.js.map +0 -1
- package/configuration/types/index.d.ts +0 -14
- package/configuration/types/index.js +0 -51
- package/configuration/types/index.js.map +0 -1
- package/configuration/types/minimal.d.ts +0 -6
- package/configuration/types/minimal.js +0 -43
- package/configuration/types/minimal.js.map +0 -1
- package/configuration/types/renderOnlyDefault.d.ts +0 -30
- package/configuration/types/renderOnlyDefault.js +0 -31
- package/configuration/types/renderOnlyDefault.js.map +0 -1
- package/configuration/types/shadowLight.d.ts +0 -9
- package/configuration/types/shadowLight.js +0 -64
- package/configuration/types/shadowLight.js.map +0 -1
- package/helper/index.d.ts +0 -29
- package/helper/index.js +0 -66
- package/helper/index.js.map +0 -1
- package/index.d.ts +0 -30
- package/index.js +0 -46
- package/index.js.map +0 -1
- package/initializer.d.ts +0 -11
- package/initializer.js +0 -35
- package/initializer.js.map +0 -1
- package/interfaces.d.ts +0 -5
- package/interfaces.js +0 -7
- package/interfaces.js.map +0 -1
- package/labs/environmentSerializer.d.ts +0 -126
- package/labs/environmentSerializer.js +0 -191
- package/labs/environmentSerializer.js.map +0 -1
- package/labs/texture.d.ts +0 -183
- package/labs/texture.js +0 -351
- package/labs/texture.js.map +0 -1
- package/labs/viewerLabs.d.ts +0 -51
- package/labs/viewerLabs.js +0 -134
- package/labs/viewerLabs.js.map +0 -1
- package/loader/modelLoader.d.ts +0 -56
- package/loader/modelLoader.js +0 -202
- package/loader/modelLoader.js.map +0 -1
- package/loader/plugins/applyMaterialConfig.d.ts +0 -12
- package/loader/plugins/applyMaterialConfig.js +0 -16
- package/loader/plugins/applyMaterialConfig.js.map +0 -1
- package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +0 -9
- package/loader/plugins/extendedMaterialLoaderPlugin.js +0 -16
- package/loader/plugins/extendedMaterialLoaderPlugin.js.map +0 -1
- package/loader/plugins/index.d.ts +0 -19
- package/loader/plugins/index.js +0 -44
- package/loader/plugins/index.js.map +0 -1
- package/loader/plugins/loaderPlugin.d.ts +0 -24
- package/loader/plugins/loaderPlugin.js +0 -2
- package/loader/plugins/loaderPlugin.js.map +0 -1
- package/loader/plugins/msftLodLoaderPlugin.d.ts +0 -12
- package/loader/plugins/msftLodLoaderPlugin.js +0 -21
- package/loader/plugins/msftLodLoaderPlugin.js.map +0 -1
- package/loader/plugins/telemetryLoaderPlugin.d.ts +0 -12
- package/loader/plugins/telemetryLoaderPlugin.js +0 -36
- package/loader/plugins/telemetryLoaderPlugin.js.map +0 -1
- package/managers/observablesManager.d.ts +0 -66
- package/managers/observablesManager.js +0 -35
- package/managers/observablesManager.js.map +0 -1
- package/managers/sceneManager.d.ts +0 -245
- package/managers/sceneManager.js +0 -1375
- package/managers/sceneManager.js.map +0 -1
- package/managers/telemetryManager.d.ts +0 -78
- package/managers/telemetryManager.js +0 -117
- package/managers/telemetryManager.js.map +0 -1
- package/model/modelAnimation.d.ts +0 -215
- package/model/modelAnimation.js +0 -237
- package/model/modelAnimation.js.map +0 -1
- package/model/viewerModel.d.ts +0 -233
- package/model/viewerModel.js +0 -673
- package/model/viewerModel.js.map +0 -1
- package/optimizer/custom/extended.d.ts +0 -13
- package/optimizer/custom/extended.js +0 -101
- package/optimizer/custom/extended.js.map +0 -1
- package/optimizer/custom/index.d.ts +0 -9
- package/optimizer/custom/index.js +0 -26
- package/optimizer/custom/index.js.map +0 -1
- package/renderOnlyIndex.d.ts +0 -11
- package/renderOnlyIndex.js +0 -18
- package/renderOnlyIndex.js.map +0 -1
- package/templating/eventManager.d.ts +0 -35
- package/templating/eventManager.js +0 -66
- package/templating/eventManager.js.map +0 -1
- package/templating/plugins/hdButtonPlugin.d.ts +0 -9
- package/templating/plugins/hdButtonPlugin.js +0 -22
- package/templating/plugins/hdButtonPlugin.js.map +0 -1
- package/templating/plugins/printButton.d.ts +0 -9
- package/templating/plugins/printButton.js +0 -41
- package/templating/plugins/printButton.js.map +0 -1
- package/templating/templateManager.d.ts +0 -197
- package/templating/templateManager.js +0 -561
- package/templating/templateManager.js.map +0 -1
- package/templating/viewerTemplatePlugin.d.ts +0 -21
- package/templating/viewerTemplatePlugin.js +0 -69
- package/templating/viewerTemplatePlugin.js.map +0 -1
- package/viewer/defaultViewer.d.ts +0 -130
- package/viewer/defaultViewer.js +0 -672
- package/viewer/defaultViewer.js.map +0 -1
- package/viewer/renderOnlyViewer.d.ts +0 -9
- package/viewer/renderOnlyViewer.js +0 -46
- package/viewer/renderOnlyViewer.js.map +0 -1
- package/viewer/viewer.d.ts +0 -258
- package/viewer/viewer.js +0 -783
- package/viewer/viewer.js.map +0 -1
- package/viewer/viewerManager.d.ts +0 -58
- package/viewer/viewerManager.js +0 -91
- package/viewer/viewerManager.js.map +0 -1
- package/viewer/viewerWithTemplate.d.ts +0 -9
- package/viewer/viewerWithTemplate.js +0 -20
- package/viewer/viewerWithTemplate.js.map +0 -1
package/lib/index.js
ADDED
|
@@ -0,0 +1,2165 @@
|
|
|
1
|
+
import { ArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera.js';
|
|
2
|
+
import { PointerEventTypes } from '@babylonjs/core/Events/pointerEvents.js';
|
|
3
|
+
import { HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight.js';
|
|
4
|
+
import { loadAssetContainerAsync } from '@babylonjs/core/Loading/sceneLoader.js';
|
|
5
|
+
import { ImageProcessingConfiguration } from '@babylonjs/core/Materials/imageProcessingConfiguration.js';
|
|
6
|
+
import { PBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial.js';
|
|
7
|
+
import { CubeTexture } from '@babylonjs/core/Materials/Textures/cubeTexture.js';
|
|
8
|
+
import { Texture } from '@babylonjs/core/Materials/Textures/texture.js';
|
|
9
|
+
import { Clamp } from '@babylonjs/core/Maths/math.scalar.functions.js';
|
|
10
|
+
import { Vector3, Matrix } from '@babylonjs/core/Maths/math.vector.js';
|
|
11
|
+
import { Viewport } from '@babylonjs/core/Maths/math.viewport.js';
|
|
12
|
+
import { GetHotSpotToRef } from '@babylonjs/core/Meshes/abstractMesh.hotSpot.js';
|
|
13
|
+
import { CreateBox } from '@babylonjs/core/Meshes/Builders/boxBuilder.js';
|
|
14
|
+
import { computeMaxExtents } from '@babylonjs/core/Meshes/meshUtils.js';
|
|
15
|
+
import { BuildTuple } from '@babylonjs/core/Misc/arrayTools.js';
|
|
16
|
+
import { AsyncLock } from '@babylonjs/core/Misc/asyncLock.js';
|
|
17
|
+
import { deepMerge } from '@babylonjs/core/Misc/deepMerger.js';
|
|
18
|
+
import { Observable } from '@babylonjs/core/Misc/observable.js';
|
|
19
|
+
import { SnapshotRenderingHelper } from '@babylonjs/core/Misc/snapshotRenderingHelper.js';
|
|
20
|
+
import { Scene } from '@babylonjs/core/scene.js';
|
|
21
|
+
import { registerBuiltInLoaders } from '@babylonjs/loaders/dynamic.js';
|
|
22
|
+
import { __decorate } from '@babylonjs/core/tslib.es6.js';
|
|
23
|
+
import { Color4 } from '@babylonjs/core/Maths/math.color.js';
|
|
24
|
+
import { Logger } from '@babylonjs/core/Misc/logger.js';
|
|
25
|
+
|
|
26
|
+
const toneMappingOptions = ["none", "standard", "aces", "neutral"];
|
|
27
|
+
/**
|
|
28
|
+
* Checks if the given value is a valid tone mapping option.
|
|
29
|
+
* @param value The value to check.
|
|
30
|
+
* @returns True if the value is a valid tone mapping option, otherwise false.
|
|
31
|
+
*/
|
|
32
|
+
function isToneMapping(value) {
|
|
33
|
+
return toneMappingOptions.includes(value);
|
|
34
|
+
}
|
|
35
|
+
function throwIfAborted(...abortSignals) {
|
|
36
|
+
for (const signal of abortSignals) {
|
|
37
|
+
signal?.throwIfAborted();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function createSkybox(scene, camera, reflectionTexture, blur) {
|
|
41
|
+
const hdrSkybox = CreateBox("hdrSkyBox", undefined, scene);
|
|
42
|
+
const hdrSkyboxMaterial = new PBRMaterial("skyBox", scene);
|
|
43
|
+
// Use the default image processing configuration on the skybox (e.g. don't apply tone mapping, contrast, or exposure).
|
|
44
|
+
hdrSkyboxMaterial.imageProcessingConfiguration = new ImageProcessingConfiguration();
|
|
45
|
+
hdrSkyboxMaterial.backFaceCulling = false;
|
|
46
|
+
hdrSkyboxMaterial.reflectionTexture = reflectionTexture;
|
|
47
|
+
if (hdrSkyboxMaterial.reflectionTexture) {
|
|
48
|
+
hdrSkyboxMaterial.reflectionTexture.coordinatesMode = Texture.SKYBOX_MODE;
|
|
49
|
+
}
|
|
50
|
+
hdrSkyboxMaterial.microSurface = 1.0 - blur;
|
|
51
|
+
hdrSkyboxMaterial.disableLighting = true;
|
|
52
|
+
hdrSkyboxMaterial.twoSidedLighting = true;
|
|
53
|
+
hdrSkybox.material = hdrSkyboxMaterial;
|
|
54
|
+
hdrSkybox.isPickable = false;
|
|
55
|
+
hdrSkybox.infiniteDistance = true;
|
|
56
|
+
updateSkybox(hdrSkybox, camera);
|
|
57
|
+
return hdrSkybox;
|
|
58
|
+
}
|
|
59
|
+
function updateSkybox(skybox, camera) {
|
|
60
|
+
skybox?.scaling.setAll((camera.maxZ - camera.minZ) / 2);
|
|
61
|
+
}
|
|
62
|
+
const defaultLoadEnvironmentOptions = {
|
|
63
|
+
lighting: true,
|
|
64
|
+
skybox: true,
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Provides the result of a hot spot query.
|
|
68
|
+
*/
|
|
69
|
+
class ViewerHotSpotResult {
|
|
70
|
+
constructor() {
|
|
71
|
+
/**
|
|
72
|
+
* 2D canvas position in pixels
|
|
73
|
+
*/
|
|
74
|
+
this.screenPosition = [NaN, NaN];
|
|
75
|
+
/**
|
|
76
|
+
* 3D world coordinates
|
|
77
|
+
*/
|
|
78
|
+
this.worldPosition = [NaN, NaN, NaN];
|
|
79
|
+
/**
|
|
80
|
+
* visibility range is [-1..1]. A value of 0 means camera eye is on the plane.
|
|
81
|
+
*/
|
|
82
|
+
this.visibility = NaN;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @experimental
|
|
87
|
+
* Provides an experience for viewing a single 3D model.
|
|
88
|
+
* @remarks
|
|
89
|
+
* The Viewer is not tied to a specific UI framework and can be used with Babylon.js in a browser or with Babylon Native.
|
|
90
|
+
*/
|
|
91
|
+
class Viewer {
|
|
92
|
+
constructor(_engine, options) {
|
|
93
|
+
this._engine = _engine;
|
|
94
|
+
/**
|
|
95
|
+
* Fired when the environment has changed.
|
|
96
|
+
*/
|
|
97
|
+
this.onEnvironmentChanged = new Observable();
|
|
98
|
+
/**
|
|
99
|
+
* Fired when an error occurs while loading the environment.
|
|
100
|
+
*/
|
|
101
|
+
this.onEnvironmentError = new Observable();
|
|
102
|
+
/**
|
|
103
|
+
* Fired when the skybox blur changes.
|
|
104
|
+
*/
|
|
105
|
+
this.onSkyboxBlurChanged = new Observable();
|
|
106
|
+
/**
|
|
107
|
+
* Fired when the post processing state changes.
|
|
108
|
+
*/
|
|
109
|
+
this.onPostProcessingChanged = new Observable();
|
|
110
|
+
/**
|
|
111
|
+
* Fired when a model is loaded into the viewer (or unloaded from the viewer).
|
|
112
|
+
*/
|
|
113
|
+
this.onModelChanged = new Observable();
|
|
114
|
+
/**
|
|
115
|
+
* Fired when an error occurs while loading a model.
|
|
116
|
+
*/
|
|
117
|
+
this.onModelError = new Observable();
|
|
118
|
+
/**
|
|
119
|
+
* Fired when progress changes on loading activity.
|
|
120
|
+
*/
|
|
121
|
+
this.onLoadingProgressChanged = new Observable();
|
|
122
|
+
/**
|
|
123
|
+
* Fired when the camera auto orbit state changes.
|
|
124
|
+
*/
|
|
125
|
+
this.onCameraAutoOrbitChanged = new Observable();
|
|
126
|
+
/**
|
|
127
|
+
* Fired when the selected animation changes.
|
|
128
|
+
*/
|
|
129
|
+
this.onSelectedAnimationChanged = new Observable();
|
|
130
|
+
/**
|
|
131
|
+
* Fired when the animation speed changes.
|
|
132
|
+
*/
|
|
133
|
+
this.onAnimationSpeedChanged = new Observable();
|
|
134
|
+
/**
|
|
135
|
+
* Fired when the selected animation is playing or paused.
|
|
136
|
+
*/
|
|
137
|
+
this.onIsAnimationPlayingChanged = new Observable();
|
|
138
|
+
/**
|
|
139
|
+
* Fired when the current point on the selected animation timeline changes.
|
|
140
|
+
*/
|
|
141
|
+
this.onAnimationProgressChanged = new Observable();
|
|
142
|
+
/**
|
|
143
|
+
* Fired when the selected material variant changes.
|
|
144
|
+
*/
|
|
145
|
+
this.onSelectedMaterialVariantChanged = new Observable();
|
|
146
|
+
this._tempVectors = BuildTuple(4, Vector3.Zero);
|
|
147
|
+
this._meshDataCache = new Map();
|
|
148
|
+
this._renderLoopController = null;
|
|
149
|
+
this._materialVariantsController = null;
|
|
150
|
+
this._skybox = null;
|
|
151
|
+
this._skyboxBlur = 0.3;
|
|
152
|
+
this._light = null;
|
|
153
|
+
this._suspendRenderCount = 0;
|
|
154
|
+
this._isDisposed = false;
|
|
155
|
+
this._loadModelLock = new AsyncLock();
|
|
156
|
+
this._loadModelAbortController = null;
|
|
157
|
+
this._loadEnvironmentLock = new AsyncLock();
|
|
158
|
+
this._loadEnvironmentAbortController = null;
|
|
159
|
+
this._loadSkyboxLock = new AsyncLock();
|
|
160
|
+
this._loadSkyboxAbortController = null;
|
|
161
|
+
this._isLoadingModel = false;
|
|
162
|
+
this._modelLoadingProgress = null;
|
|
163
|
+
this._selectedAnimation = -1;
|
|
164
|
+
this._activeAnimationObservers = [];
|
|
165
|
+
this._animationSpeed = 1;
|
|
166
|
+
{
|
|
167
|
+
const scene = new Scene(this._engine);
|
|
168
|
+
// Deduce tone mapping, contrast, and exposure from the scene (so the viewer stays in sync if anything mutates these values directly on the scene).
|
|
169
|
+
this._toneMappingEnabled = scene.imageProcessingConfiguration.toneMappingEnabled;
|
|
170
|
+
this._toneMappingType = scene.imageProcessingConfiguration.toneMappingType;
|
|
171
|
+
this._contrast = scene.imageProcessingConfiguration.contrast;
|
|
172
|
+
this._exposure = scene.imageProcessingConfiguration.exposure;
|
|
173
|
+
this._imageProcessingConfigurationObserver = scene.imageProcessingConfiguration.onUpdateParameters.add(() => {
|
|
174
|
+
let hasChanged = false;
|
|
175
|
+
if (this._toneMappingEnabled !== scene.imageProcessingConfiguration.toneMappingEnabled) {
|
|
176
|
+
this._toneMappingEnabled = scene.imageProcessingConfiguration.toneMappingEnabled;
|
|
177
|
+
hasChanged = true;
|
|
178
|
+
}
|
|
179
|
+
if (this._toneMappingType !== scene.imageProcessingConfiguration.toneMappingType) {
|
|
180
|
+
this._toneMappingType = scene.imageProcessingConfiguration.toneMappingType;
|
|
181
|
+
hasChanged = true;
|
|
182
|
+
}
|
|
183
|
+
if (this._contrast !== scene.imageProcessingConfiguration.contrast) {
|
|
184
|
+
this._contrast = scene.imageProcessingConfiguration.contrast;
|
|
185
|
+
hasChanged = true;
|
|
186
|
+
}
|
|
187
|
+
if (this._exposure !== scene.imageProcessingConfiguration.exposure) {
|
|
188
|
+
this._exposure = scene.imageProcessingConfiguration.exposure;
|
|
189
|
+
hasChanged = true;
|
|
190
|
+
}
|
|
191
|
+
if (hasChanged) {
|
|
192
|
+
this.onPostProcessingChanged.notifyObservers();
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
const camera = new ArcRotateCamera("Viewer Default Camera", 0, 0, 1, Vector3.Zero(), scene);
|
|
196
|
+
camera.useInputToRestoreState = false;
|
|
197
|
+
scene.onPointerObservable.add(async (pointerInfo) => {
|
|
198
|
+
const pickingInfo = await this._pick(pointerInfo.event.offsetX, pointerInfo.event.offsetY);
|
|
199
|
+
if (pickingInfo?.pickedPoint) {
|
|
200
|
+
const distance = pickingInfo.pickedPoint.subtract(camera.position).dot(camera.getForwardRay().direction);
|
|
201
|
+
// Immediately reset the target and the radius based on the distance to the picked point.
|
|
202
|
+
// This eliminates unnecessary camera movement on the local z-axis when interpolating.
|
|
203
|
+
camera.target = camera.position.add(camera.getForwardRay().direction.scale(distance));
|
|
204
|
+
camera.radius = distance;
|
|
205
|
+
camera.interpolateTo(undefined, undefined, undefined, pickingInfo.pickedPoint);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
camera.restoreState();
|
|
209
|
+
}
|
|
210
|
+
}, PointerEventTypes.POINTERDOUBLETAP);
|
|
211
|
+
this._details = {
|
|
212
|
+
viewer: this,
|
|
213
|
+
scene,
|
|
214
|
+
camera,
|
|
215
|
+
model: null,
|
|
216
|
+
suspendRendering: () => this._suspendRendering(),
|
|
217
|
+
pick: (screenX, screenY) => this._pick(screenX, screenY),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
this._details.scene.skipFrustumClipping = true;
|
|
221
|
+
this._details.scene.skipPointerDownPicking = true;
|
|
222
|
+
this._details.scene.skipPointerUpPicking = true;
|
|
223
|
+
this._details.scene.skipPointerMovePicking = true;
|
|
224
|
+
this._snapshotHelper = new SnapshotRenderingHelper(this._details.scene, { morphTargetsNumMaxInfluences: 30 });
|
|
225
|
+
this._details.camera.attachControl();
|
|
226
|
+
this._updateCamera(); // set default camera values
|
|
227
|
+
this._autoRotationBehavior = this._details.camera.getBehaviorByName("AutoRotation");
|
|
228
|
+
// Default to KHR PBR Neutral tone mapping.
|
|
229
|
+
this.postProcessing = {
|
|
230
|
+
toneMapping: "neutral",
|
|
231
|
+
};
|
|
232
|
+
// Load a default light, but ignore errors as the user might be immediately loading their own environment.
|
|
233
|
+
this.resetEnvironment().catch(() => { });
|
|
234
|
+
this._beginRendering();
|
|
235
|
+
options?.onInitialized?.(this._details);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The camera auto orbit configuration.
|
|
239
|
+
*/
|
|
240
|
+
get cameraAutoOrbit() {
|
|
241
|
+
return {
|
|
242
|
+
enabled: this._details.camera.behaviors.includes(this._autoRotationBehavior),
|
|
243
|
+
speed: this._autoRotationBehavior.idleRotationSpeed,
|
|
244
|
+
delay: this._autoRotationBehavior.idleRotationWaitTime,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
set cameraAutoOrbit(value) {
|
|
248
|
+
if (value.enabled !== undefined && value.enabled !== this.cameraAutoOrbit.enabled) {
|
|
249
|
+
if (value.enabled) {
|
|
250
|
+
this._details.camera.addBehavior(this._autoRotationBehavior);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
this._details.camera.removeBehavior(this._autoRotationBehavior);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (value.delay !== undefined) {
|
|
257
|
+
this._autoRotationBehavior.idleRotationWaitTime = value.delay;
|
|
258
|
+
}
|
|
259
|
+
if (value.speed !== undefined) {
|
|
260
|
+
this._autoRotationBehavior.idleRotationSpeed = value.speed;
|
|
261
|
+
}
|
|
262
|
+
this.onCameraAutoOrbitChanged.notifyObservers();
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* A value between 0 and 1 that specifies how much to blur the skybox.
|
|
266
|
+
*/
|
|
267
|
+
get skyboxBlur() {
|
|
268
|
+
return this._skyboxBlur;
|
|
269
|
+
}
|
|
270
|
+
set skyboxBlur(value) {
|
|
271
|
+
if (value !== this._skyboxBlur) {
|
|
272
|
+
this._skyboxBlur = value;
|
|
273
|
+
if (this._skybox) {
|
|
274
|
+
const material = this._skybox.material;
|
|
275
|
+
if (material instanceof PBRMaterial) {
|
|
276
|
+
this._snapshotHelper.disableSnapshotRendering();
|
|
277
|
+
material.microSurface = 1.0 - value;
|
|
278
|
+
this._snapshotHelper.enableSnapshotRendering();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
this.onSkyboxBlurChanged.notifyObservers();
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* The post processing configuration.
|
|
286
|
+
*/
|
|
287
|
+
get postProcessing() {
|
|
288
|
+
let toneMapping;
|
|
289
|
+
switch (this._toneMappingType) {
|
|
290
|
+
case ImageProcessingConfiguration.TONEMAPPING_STANDARD:
|
|
291
|
+
toneMapping = "standard";
|
|
292
|
+
break;
|
|
293
|
+
case ImageProcessingConfiguration.TONEMAPPING_ACES:
|
|
294
|
+
toneMapping = "aces";
|
|
295
|
+
break;
|
|
296
|
+
case ImageProcessingConfiguration.TONEMAPPING_KHR_PBR_NEUTRAL:
|
|
297
|
+
toneMapping = "neutral";
|
|
298
|
+
break;
|
|
299
|
+
default:
|
|
300
|
+
toneMapping = "none";
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
return {
|
|
304
|
+
toneMapping,
|
|
305
|
+
contrast: this._contrast,
|
|
306
|
+
exposure: this._exposure,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
set postProcessing(value) {
|
|
310
|
+
this._snapshotHelper.disableSnapshotRendering();
|
|
311
|
+
if (value.toneMapping !== undefined) {
|
|
312
|
+
if (value.toneMapping === "none") {
|
|
313
|
+
this._details.scene.imageProcessingConfiguration.toneMappingEnabled = false;
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
switch (value.toneMapping) {
|
|
317
|
+
case "standard":
|
|
318
|
+
this._details.scene.imageProcessingConfiguration.toneMappingType = ImageProcessingConfiguration.TONEMAPPING_STANDARD;
|
|
319
|
+
break;
|
|
320
|
+
case "aces":
|
|
321
|
+
this._details.scene.imageProcessingConfiguration.toneMappingType = ImageProcessingConfiguration.TONEMAPPING_ACES;
|
|
322
|
+
break;
|
|
323
|
+
case "neutral":
|
|
324
|
+
this._details.scene.imageProcessingConfiguration.toneMappingType = ImageProcessingConfiguration.TONEMAPPING_KHR_PBR_NEUTRAL;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
this._details.scene.imageProcessingConfiguration.toneMappingEnabled = true;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (value.contrast !== undefined) {
|
|
331
|
+
this._details.scene.imageProcessingConfiguration.contrast = value.contrast;
|
|
332
|
+
}
|
|
333
|
+
if (value.exposure !== undefined) {
|
|
334
|
+
this._details.scene.imageProcessingConfiguration.exposure = value.exposure;
|
|
335
|
+
}
|
|
336
|
+
this._details.scene.imageProcessingConfiguration.isEnabled = this._toneMappingEnabled || this._contrast !== 1 || this._exposure !== 1;
|
|
337
|
+
this._snapshotHelper.enableSnapshotRendering();
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Gets information about loading activity.
|
|
341
|
+
* @remarks
|
|
342
|
+
* false indicates no loading activity.
|
|
343
|
+
* true indicates loading activity with no progress information.
|
|
344
|
+
* A number between 0 and 1 indicates loading activity with progress information.
|
|
345
|
+
*/
|
|
346
|
+
get loadingProgress() {
|
|
347
|
+
if (this._isLoadingModel) {
|
|
348
|
+
return this._modelLoadingProgress ?? true;
|
|
349
|
+
}
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* The list of animation names for the currently loaded model.
|
|
354
|
+
*/
|
|
355
|
+
get animations() {
|
|
356
|
+
return this._details.model?.animationGroups.map((group) => group.name) ?? [];
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* The currently selected animation index.
|
|
360
|
+
*/
|
|
361
|
+
get selectedAnimation() {
|
|
362
|
+
return this._selectedAnimation;
|
|
363
|
+
}
|
|
364
|
+
set selectedAnimation(value) {
|
|
365
|
+
value = Math.round(Clamp(value, -1, this.animations.length - 1));
|
|
366
|
+
if (value !== this._selectedAnimation) {
|
|
367
|
+
const startAnimation = this.isAnimationPlaying;
|
|
368
|
+
if (this._activeAnimation) {
|
|
369
|
+
this._activeAnimationObservers.forEach((observer) => observer.remove());
|
|
370
|
+
this._activeAnimationObservers = [];
|
|
371
|
+
this._activeAnimation.pause();
|
|
372
|
+
this._activeAnimation.goToFrame(0);
|
|
373
|
+
}
|
|
374
|
+
this._selectedAnimation = value;
|
|
375
|
+
if (this._activeAnimation) {
|
|
376
|
+
this._activeAnimation.goToFrame(0);
|
|
377
|
+
this._activeAnimation.play(true);
|
|
378
|
+
if (!startAnimation) {
|
|
379
|
+
this.pauseAnimation();
|
|
380
|
+
}
|
|
381
|
+
this._activeAnimationObservers = [
|
|
382
|
+
this._activeAnimation.onAnimationGroupPlayObservable.add(() => {
|
|
383
|
+
this.onIsAnimationPlayingChanged.notifyObservers();
|
|
384
|
+
}),
|
|
385
|
+
this._activeAnimation.onAnimationGroupPauseObservable.add(() => {
|
|
386
|
+
this.onIsAnimationPlayingChanged.notifyObservers();
|
|
387
|
+
}),
|
|
388
|
+
this._activeAnimation.onAnimationGroupEndObservable.add(() => {
|
|
389
|
+
this.onIsAnimationPlayingChanged.notifyObservers();
|
|
390
|
+
this.onAnimationProgressChanged.notifyObservers();
|
|
391
|
+
}),
|
|
392
|
+
];
|
|
393
|
+
this._updateCamera(!this._isLoadingModel);
|
|
394
|
+
}
|
|
395
|
+
this.onSelectedAnimationChanged.notifyObservers();
|
|
396
|
+
this.onAnimationProgressChanged.notifyObservers();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* True if an animation is currently playing.
|
|
401
|
+
*/
|
|
402
|
+
get isAnimationPlaying() {
|
|
403
|
+
return this._activeAnimation?.isPlaying ?? false;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* The speed scale at which animations are played.
|
|
407
|
+
*/
|
|
408
|
+
get animationSpeed() {
|
|
409
|
+
return this._animationSpeed;
|
|
410
|
+
}
|
|
411
|
+
set animationSpeed(value) {
|
|
412
|
+
this._animationSpeed = value;
|
|
413
|
+
this._applyAnimationSpeed();
|
|
414
|
+
this.onAnimationSpeedChanged.notifyObservers();
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* The current point on the selected animation timeline, normalized between 0 and 1.
|
|
418
|
+
*/
|
|
419
|
+
get animationProgress() {
|
|
420
|
+
if (this._activeAnimation) {
|
|
421
|
+
return this._activeAnimation.getCurrentFrame() / (this._activeAnimation.to - this._activeAnimation.from);
|
|
422
|
+
}
|
|
423
|
+
return 0;
|
|
424
|
+
}
|
|
425
|
+
set animationProgress(value) {
|
|
426
|
+
if (this._activeAnimation) {
|
|
427
|
+
this._activeAnimation.goToFrame(value * (this._activeAnimation.to - this._activeAnimation.from));
|
|
428
|
+
this.onAnimationProgressChanged.notifyObservers();
|
|
429
|
+
this._autoRotationBehavior.resetLastInteractionTime();
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
get _activeAnimation() {
|
|
433
|
+
return this._details.model?.animationGroups[this._selectedAnimation] ?? null;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* The list of material variant names for the currently loaded model.
|
|
437
|
+
*/
|
|
438
|
+
get materialVariants() {
|
|
439
|
+
return this._materialVariantsController?.variants ?? [];
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* The currently selected material variant.
|
|
443
|
+
*/
|
|
444
|
+
get selectedMaterialVariant() {
|
|
445
|
+
return this._materialVariantsController?.selectedVariant ?? null;
|
|
446
|
+
}
|
|
447
|
+
set selectedMaterialVariant(value) {
|
|
448
|
+
if (value !== this.selectedMaterialVariant && this._materialVariantsController?.variants.includes(value)) {
|
|
449
|
+
this._snapshotHelper.disableSnapshotRendering();
|
|
450
|
+
this._materialVariantsController.selectedVariant = value;
|
|
451
|
+
this._snapshotHelper.enableSnapshotRendering();
|
|
452
|
+
this.onSelectedMaterialVariantChanged.notifyObservers();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Loads a 3D model from the specified URL.
|
|
457
|
+
* @remarks
|
|
458
|
+
* If a model is already loaded, it will be unloaded before loading the new model.
|
|
459
|
+
* @param source A url or File or ArrayBufferView that points to the model to load.
|
|
460
|
+
* @param options The options to use when loading the model.
|
|
461
|
+
* @param abortSignal An optional signal that can be used to abort the loading process.
|
|
462
|
+
*/
|
|
463
|
+
async loadModel(source, options, abortSignal) {
|
|
464
|
+
await this._updateModel(source, options, abortSignal);
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Unloads the current 3D model if one is loaded.
|
|
468
|
+
* @param abortSignal An optional signal that can be used to abort the reset.
|
|
469
|
+
*/
|
|
470
|
+
async resetModel(abortSignal) {
|
|
471
|
+
await this._updateModel(undefined, undefined, abortSignal);
|
|
472
|
+
}
|
|
473
|
+
async _updateModel(source, options, abortSignal) {
|
|
474
|
+
this._throwIfDisposedOrAborted(abortSignal);
|
|
475
|
+
const originalOnProgress = options?.onProgress;
|
|
476
|
+
const onProgress = (event) => {
|
|
477
|
+
originalOnProgress?.(event);
|
|
478
|
+
if (this._isLoadingModel) {
|
|
479
|
+
this._modelLoadingProgress = event.lengthComputable ? event.loaded / event.total : null;
|
|
480
|
+
this.onLoadingProgressChanged.notifyObservers();
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
delete options?.onProgress;
|
|
484
|
+
const originalOnMaterialVariantsLoaded = options?.pluginOptions?.gltf?.extensionOptions?.KHR_materials_variants?.onLoaded;
|
|
485
|
+
const onMaterialVariantsLoaded = (controller) => {
|
|
486
|
+
originalOnMaterialVariantsLoaded?.(controller);
|
|
487
|
+
this._materialVariantsController = controller;
|
|
488
|
+
};
|
|
489
|
+
delete options?.pluginOptions?.gltf?.extensionOptions?.KHR_materials_variants?.onLoaded;
|
|
490
|
+
const defaultOptions = {
|
|
491
|
+
// Pass a progress callback to update the loading progress.
|
|
492
|
+
onProgress,
|
|
493
|
+
pluginOptions: {
|
|
494
|
+
gltf: {
|
|
495
|
+
// Enable transparency as coverage by default to be 3D Commerce compliant by default.
|
|
496
|
+
// https://doc.babylonjs.com/setup/support/3D_commerce_certif
|
|
497
|
+
transparencyAsCoverage: true,
|
|
498
|
+
extensionOptions: {
|
|
499
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
500
|
+
KHR_materials_variants: {
|
|
501
|
+
// Capture the material variants controller when it is loaded.
|
|
502
|
+
onLoaded: onMaterialVariantsLoaded,
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
};
|
|
508
|
+
options = deepMerge(defaultOptions, options ?? {});
|
|
509
|
+
this._loadModelAbortController?.abort("New model is being loaded before previous model finished loading.");
|
|
510
|
+
const abortController = (this._loadModelAbortController = new AbortController());
|
|
511
|
+
await this._loadModelLock.lockAsync(async () => {
|
|
512
|
+
throwIfAborted(abortSignal, abortController.signal);
|
|
513
|
+
this._snapshotHelper.disableSnapshotRendering();
|
|
514
|
+
this._details.model?.dispose();
|
|
515
|
+
this._details.model = null;
|
|
516
|
+
this._meshDataCache.clear();
|
|
517
|
+
this._materialVariantsController = null;
|
|
518
|
+
this.onSelectedMaterialVariantChanged.notifyObservers();
|
|
519
|
+
this.selectedAnimation = -1;
|
|
520
|
+
try {
|
|
521
|
+
if (source) {
|
|
522
|
+
this._isLoadingModel = true;
|
|
523
|
+
this._modelLoadingProgress = 0;
|
|
524
|
+
this.onLoadingProgressChanged.notifyObservers();
|
|
525
|
+
this._details.model = await loadAssetContainerAsync(source, this._details.scene, options);
|
|
526
|
+
this.onSelectedMaterialVariantChanged.notifyObservers();
|
|
527
|
+
this._details.model.animationGroups.forEach((group) => {
|
|
528
|
+
group.start(true, this.animationSpeed);
|
|
529
|
+
group.pause();
|
|
530
|
+
});
|
|
531
|
+
this.selectedAnimation = options?.defaultAnimation ?? 0;
|
|
532
|
+
this._snapshotHelper.fixMeshes(this._details.model.meshes);
|
|
533
|
+
this._details.model.addAllToScene();
|
|
534
|
+
}
|
|
535
|
+
this._updateCamera();
|
|
536
|
+
this._updateLight();
|
|
537
|
+
this._applyAnimationSpeed();
|
|
538
|
+
this.onModelChanged.notifyObservers();
|
|
539
|
+
}
|
|
540
|
+
catch (e) {
|
|
541
|
+
this.onModelError.notifyObservers(e);
|
|
542
|
+
throw e;
|
|
543
|
+
}
|
|
544
|
+
finally {
|
|
545
|
+
this._isLoadingModel = false;
|
|
546
|
+
this.onLoadingProgressChanged.notifyObservers();
|
|
547
|
+
this._snapshotHelper.enableSnapshotRendering();
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Loads an environment texture from the specified url and sets up a corresponding skybox.
|
|
553
|
+
* @remarks
|
|
554
|
+
* If an environment is already loaded, it will be unloaded before loading the new environment.
|
|
555
|
+
* @param url The url of the environment texture to load.
|
|
556
|
+
* @param options The options to use when loading the environment.
|
|
557
|
+
* @param abortSignal An optional signal that can be used to abort the loading process.
|
|
558
|
+
*/
|
|
559
|
+
async loadEnvironment(url, options, abortSignal) {
|
|
560
|
+
await this._updateEnvironment(url, options, abortSignal);
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Unloads the current environment if one is loaded.
|
|
564
|
+
* @param options The options to use when resetting the environment.
|
|
565
|
+
* @param abortSignal An optional signal that can be used to abort the reset.
|
|
566
|
+
*/
|
|
567
|
+
async resetEnvironment(options, abortSignal) {
|
|
568
|
+
await this._updateEnvironment(undefined, options, abortSignal);
|
|
569
|
+
}
|
|
570
|
+
async _updateEnvironment(url, options, abortSignal) {
|
|
571
|
+
this._throwIfDisposedOrAborted(abortSignal);
|
|
572
|
+
options = options ?? defaultLoadEnvironmentOptions;
|
|
573
|
+
if (!options.lighting && !options.skybox) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
const locks = [];
|
|
577
|
+
if (options.lighting) {
|
|
578
|
+
this._loadEnvironmentAbortController?.abort("New environment lighting is being loaded before previous environment lighting finished loading.");
|
|
579
|
+
locks.push(this._loadEnvironmentLock);
|
|
580
|
+
}
|
|
581
|
+
if (options.skybox) {
|
|
582
|
+
this._loadSkyboxAbortController?.abort("New environment skybox is being loaded before previous environment skybox finished loading.");
|
|
583
|
+
locks.push(this._loadSkyboxLock);
|
|
584
|
+
}
|
|
585
|
+
const environmentAbortController = (this._loadEnvironmentAbortController = options.lighting ? new AbortController() : null);
|
|
586
|
+
const skyboxAbortController = (this._loadSkyboxAbortController = options.skybox ? new AbortController() : null);
|
|
587
|
+
await AsyncLock.LockAsync(async () => {
|
|
588
|
+
throwIfAborted(abortSignal, environmentAbortController?.signal, skyboxAbortController?.signal);
|
|
589
|
+
this._snapshotHelper.disableSnapshotRendering();
|
|
590
|
+
const dispose = () => {
|
|
591
|
+
if (options.lighting) {
|
|
592
|
+
this._details.scene.environmentTexture?.dispose();
|
|
593
|
+
this._details.scene.environmentTexture = null;
|
|
594
|
+
}
|
|
595
|
+
if (options.skybox) {
|
|
596
|
+
this._skybox?.dispose(undefined, true);
|
|
597
|
+
this._skybox = null;
|
|
598
|
+
this._details.scene.autoClear = true;
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
// First dispose the current environment and/or skybox.
|
|
602
|
+
dispose();
|
|
603
|
+
try {
|
|
604
|
+
if (url) {
|
|
605
|
+
const cubeTexture = CubeTexture.CreateFromPrefilteredData(url, this._details.scene);
|
|
606
|
+
if (options.lighting) {
|
|
607
|
+
this._details.scene.environmentTexture = cubeTexture;
|
|
608
|
+
}
|
|
609
|
+
if (options.skybox) {
|
|
610
|
+
const reflectionTexture = options.lighting ? cubeTexture.clone() : cubeTexture;
|
|
611
|
+
this._skybox = createSkybox(this._details.scene, this._details.camera, reflectionTexture, this.skyboxBlur);
|
|
612
|
+
this._snapshotHelper.fixMeshes([this._skybox]);
|
|
613
|
+
this._details.scene.autoClear = false;
|
|
614
|
+
}
|
|
615
|
+
await new Promise((resolve, reject) => {
|
|
616
|
+
const successObserver = cubeTexture.onLoadObservable.addOnce(() => {
|
|
617
|
+
successObserver.remove();
|
|
618
|
+
errorObserver.remove();
|
|
619
|
+
resolve();
|
|
620
|
+
});
|
|
621
|
+
const errorObserver = Texture.OnTextureLoadErrorObservable.add((texture) => {
|
|
622
|
+
if (texture === cubeTexture) {
|
|
623
|
+
successObserver.remove();
|
|
624
|
+
errorObserver.remove();
|
|
625
|
+
reject(new Error("Failed to load environment texture."));
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
this._updateLight();
|
|
631
|
+
this.onEnvironmentChanged.notifyObservers();
|
|
632
|
+
}
|
|
633
|
+
catch (e) {
|
|
634
|
+
dispose();
|
|
635
|
+
this.onEnvironmentError.notifyObservers(e);
|
|
636
|
+
throw e;
|
|
637
|
+
}
|
|
638
|
+
finally {
|
|
639
|
+
this._snapshotHelper.enableSnapshotRendering();
|
|
640
|
+
}
|
|
641
|
+
}, locks);
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Toggles the play/pause animation state if there is a selected animation.
|
|
645
|
+
*/
|
|
646
|
+
toggleAnimation() {
|
|
647
|
+
if (this.isAnimationPlaying) {
|
|
648
|
+
this.pauseAnimation();
|
|
649
|
+
}
|
|
650
|
+
else {
|
|
651
|
+
this.playAnimation();
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Plays the selected animation if there is one.
|
|
656
|
+
*/
|
|
657
|
+
playAnimation() {
|
|
658
|
+
this._activeAnimation?.play(true);
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Pauses the selected animation if there is one.
|
|
662
|
+
*/
|
|
663
|
+
async pauseAnimation() {
|
|
664
|
+
this._activeAnimation?.pause();
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Resets the camera to its initial pose.
|
|
668
|
+
*/
|
|
669
|
+
resetCamera() {
|
|
670
|
+
this._details.camera.restoreState();
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Disposes of the resources held by the Viewer.
|
|
674
|
+
*/
|
|
675
|
+
dispose() {
|
|
676
|
+
this.selectedAnimation = -1;
|
|
677
|
+
this.animationProgress = 0;
|
|
678
|
+
this._loadEnvironmentAbortController?.abort("Thew viewer is being disposed.");
|
|
679
|
+
this._loadModelAbortController?.abort("Thew viewer is being disposed.");
|
|
680
|
+
this._renderLoopController?.dispose();
|
|
681
|
+
this._details.scene.dispose();
|
|
682
|
+
this.onEnvironmentChanged.clear();
|
|
683
|
+
this.onEnvironmentError.clear();
|
|
684
|
+
this.onSkyboxBlurChanged.clear();
|
|
685
|
+
this.onPostProcessingChanged.clear();
|
|
686
|
+
this.onModelChanged.clear();
|
|
687
|
+
this.onModelError.clear();
|
|
688
|
+
this.onCameraAutoOrbitChanged.clear();
|
|
689
|
+
this.onSelectedAnimationChanged.clear();
|
|
690
|
+
this.onAnimationSpeedChanged.clear();
|
|
691
|
+
this.onIsAnimationPlayingChanged.clear();
|
|
692
|
+
this.onAnimationProgressChanged.clear();
|
|
693
|
+
this.onLoadingProgressChanged.clear();
|
|
694
|
+
this._imageProcessingConfigurationObserver.remove();
|
|
695
|
+
this._isDisposed = true;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* retrun world and canvas coordinates of an hot spot
|
|
699
|
+
* @param query mesh index and surface information to query the hot spot positions
|
|
700
|
+
* @param result Query a Hot Spot and does the conversion for Babylon Hot spot to a more generic HotSpotPositions, without Vector types
|
|
701
|
+
* @returns true if hotspot found
|
|
702
|
+
*/
|
|
703
|
+
getHotSpotToRef(query, result) {
|
|
704
|
+
if (!this._details.model) {
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
const worldNormal = this._tempVectors[2];
|
|
708
|
+
const worldPos = this._tempVectors[1];
|
|
709
|
+
const screenPos = this._tempVectors[0];
|
|
710
|
+
if (query.type === "surface") {
|
|
711
|
+
const mesh = this._details.model.meshes[query.meshIndex];
|
|
712
|
+
if (!mesh) {
|
|
713
|
+
return false;
|
|
714
|
+
}
|
|
715
|
+
if (!GetHotSpotToRef(mesh, query, worldPos, worldNormal)) {
|
|
716
|
+
return false;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
else {
|
|
720
|
+
worldPos.copyFromFloats(query.position[0], query.position[1], query.position[2]);
|
|
721
|
+
worldNormal.copyFromFloats(query.normal[0], query.normal[1], query.normal[2]);
|
|
722
|
+
}
|
|
723
|
+
const renderWidth = this._engine.getRenderWidth(); // Get the canvas width
|
|
724
|
+
const renderHeight = this._engine.getRenderHeight(); // Get the canvas height
|
|
725
|
+
const viewportWidth = this._details.camera.viewport.width * renderWidth;
|
|
726
|
+
const viewportHeight = this._details.camera.viewport.height * renderHeight;
|
|
727
|
+
const scene = this._details.scene;
|
|
728
|
+
Vector3.ProjectToRef(worldPos, Matrix.IdentityReadOnly, scene.getTransformMatrix(), new Viewport(0, 0, viewportWidth, viewportHeight), screenPos);
|
|
729
|
+
result.screenPosition[0] = screenPos.x;
|
|
730
|
+
result.screenPosition[1] = screenPos.y;
|
|
731
|
+
result.worldPosition[0] = worldPos.x;
|
|
732
|
+
result.worldPosition[1] = worldPos.y;
|
|
733
|
+
result.worldPosition[2] = worldPos.z;
|
|
734
|
+
// visibility
|
|
735
|
+
const eyeToSurface = this._tempVectors[3];
|
|
736
|
+
eyeToSurface.copyFrom(this._details.camera.globalPosition);
|
|
737
|
+
eyeToSurface.subtractInPlace(worldPos);
|
|
738
|
+
eyeToSurface.normalize();
|
|
739
|
+
result.visibility = Vector3.Dot(eyeToSurface, worldNormal);
|
|
740
|
+
return true;
|
|
741
|
+
}
|
|
742
|
+
_suspendRendering() {
|
|
743
|
+
this._renderLoopController?.dispose();
|
|
744
|
+
this._suspendRenderCount++;
|
|
745
|
+
let disposed = false;
|
|
746
|
+
return {
|
|
747
|
+
dispose: () => {
|
|
748
|
+
if (!disposed) {
|
|
749
|
+
disposed = true;
|
|
750
|
+
this._suspendRenderCount--;
|
|
751
|
+
if (this._suspendRenderCount === 0) {
|
|
752
|
+
this._beginRendering();
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
},
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
_beginRendering() {
|
|
759
|
+
if (!this._renderLoopController) {
|
|
760
|
+
const render = () => {
|
|
761
|
+
this._details.scene.render();
|
|
762
|
+
// Update the camera panning sensitivity related properties based on the camera's distance from the target.
|
|
763
|
+
this._details.camera.panningSensibility = 5000 / this._details.camera.radius;
|
|
764
|
+
this._details.camera.speed = this._details.camera.radius * 0.2;
|
|
765
|
+
if (this.isAnimationPlaying) {
|
|
766
|
+
this.onAnimationProgressChanged.notifyObservers();
|
|
767
|
+
this._autoRotationBehavior.resetLastInteractionTime();
|
|
768
|
+
}
|
|
769
|
+
};
|
|
770
|
+
this._engine.runRenderLoop(render);
|
|
771
|
+
let disposed = false;
|
|
772
|
+
this._renderLoopController = {
|
|
773
|
+
dispose: () => {
|
|
774
|
+
if (!disposed) {
|
|
775
|
+
disposed = true;
|
|
776
|
+
this._engine.stopRenderLoop(render);
|
|
777
|
+
this._renderLoopController = null;
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
_updateCamera(interpolate = false) {
|
|
784
|
+
this._details.camera.useFramingBehavior = true;
|
|
785
|
+
const framingBehavior = this._details.camera.getBehaviorByName("Framing");
|
|
786
|
+
framingBehavior.framingTime = 0;
|
|
787
|
+
framingBehavior.elevationReturnTime = -1;
|
|
788
|
+
this._details.camera.useAutoRotationBehavior = true;
|
|
789
|
+
const currentAlpha = this._details.camera.alpha;
|
|
790
|
+
const currentBeta = this._details.camera.beta;
|
|
791
|
+
const currentRadius = this._details.camera.radius;
|
|
792
|
+
const currentTarget = this._details.camera.target;
|
|
793
|
+
const goalAlpha = Math.PI / 2;
|
|
794
|
+
const goalBeta = Math.PI / 2.4;
|
|
795
|
+
let goalRadius = 1;
|
|
796
|
+
let goalTarget = currentTarget;
|
|
797
|
+
if (this._details.model?.meshes.length) {
|
|
798
|
+
// get bounds and prepare framing/camera radius from its values
|
|
799
|
+
this._details.camera.lowerRadiusLimit = null;
|
|
800
|
+
const maxExtents = computeMaxExtents(this._details.model.meshes, this._activeAnimation);
|
|
801
|
+
const worldExtents = {
|
|
802
|
+
min: new Vector3(Math.min(...maxExtents.map((e) => e.minimum.x)), Math.min(...maxExtents.map((e) => e.minimum.y)), Math.min(...maxExtents.map((e) => e.minimum.z))),
|
|
803
|
+
max: new Vector3(Math.max(...maxExtents.map((e) => e.maximum.x)), Math.max(...maxExtents.map((e) => e.maximum.y)), Math.max(...maxExtents.map((e) => e.maximum.z))),
|
|
804
|
+
};
|
|
805
|
+
framingBehavior.zoomOnBoundingInfo(worldExtents.min, worldExtents.max);
|
|
806
|
+
const worldSize = worldExtents.max.subtract(worldExtents.min);
|
|
807
|
+
const worldCenter = worldExtents.min.add(worldSize.scale(0.5));
|
|
808
|
+
goalRadius = worldSize.length() * 1.1;
|
|
809
|
+
if (!isFinite(goalRadius)) {
|
|
810
|
+
goalRadius = 1;
|
|
811
|
+
worldCenter.copyFromFloats(0, 0, 0);
|
|
812
|
+
}
|
|
813
|
+
goalTarget = worldCenter;
|
|
814
|
+
}
|
|
815
|
+
this._details.camera.alpha = Math.PI / 2;
|
|
816
|
+
this._details.camera.beta = Math.PI / 2.4;
|
|
817
|
+
this._details.camera.radius = goalRadius;
|
|
818
|
+
this._details.camera.target = goalTarget;
|
|
819
|
+
this._details.camera.lowerRadiusLimit = goalRadius * 0.001;
|
|
820
|
+
this._details.camera.upperRadiusLimit = goalRadius * 5;
|
|
821
|
+
this._details.camera.minZ = goalRadius * 0.001;
|
|
822
|
+
this._details.camera.maxZ = goalRadius * 1000;
|
|
823
|
+
this._details.camera.wheelDeltaPercentage = 0.01;
|
|
824
|
+
this._details.camera.useNaturalPinchZoom = true;
|
|
825
|
+
this._details.camera.restoreStateInterpolationFactor = 0.1;
|
|
826
|
+
this._details.camera.storeState();
|
|
827
|
+
if (interpolate) {
|
|
828
|
+
this._details.camera.alpha = currentAlpha;
|
|
829
|
+
this._details.camera.beta = currentBeta;
|
|
830
|
+
this._details.camera.radius = currentRadius;
|
|
831
|
+
this._details.camera.target = currentTarget;
|
|
832
|
+
this._details.camera.interpolateTo(goalAlpha, goalBeta, goalRadius, goalTarget);
|
|
833
|
+
}
|
|
834
|
+
updateSkybox(this._skybox, this._details.camera);
|
|
835
|
+
}
|
|
836
|
+
_updateLight() {
|
|
837
|
+
let shouldHaveDefaultLight;
|
|
838
|
+
if (!this._details.model) {
|
|
839
|
+
shouldHaveDefaultLight = false;
|
|
840
|
+
}
|
|
841
|
+
else {
|
|
842
|
+
const hasModelProvidedLights = this._details.model.lights.length > 0;
|
|
843
|
+
const hasImageBasedLighting = !!this._details.scene.environmentTexture;
|
|
844
|
+
const hasMaterials = this._details.model.materials.length > 0;
|
|
845
|
+
const hasNonPBRMaterials = this._details.model.materials.some((material) => !(material instanceof PBRMaterial));
|
|
846
|
+
if (hasModelProvidedLights) {
|
|
847
|
+
shouldHaveDefaultLight = false;
|
|
848
|
+
}
|
|
849
|
+
else {
|
|
850
|
+
shouldHaveDefaultLight = !hasImageBasedLighting || !hasMaterials || hasNonPBRMaterials;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
if (shouldHaveDefaultLight) {
|
|
854
|
+
if (!this._light) {
|
|
855
|
+
this._light = new HemisphericLight("defaultLight", Vector3.Up(), this._details.scene);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
else {
|
|
859
|
+
this._light?.dispose();
|
|
860
|
+
this._light = null;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
_applyAnimationSpeed() {
|
|
864
|
+
this._details.model?.animationGroups.forEach((group) => (group.speedRatio = this._animationSpeed));
|
|
865
|
+
}
|
|
866
|
+
async _pick(screenX, screenY) {
|
|
867
|
+
await import('@babylonjs/core/Culling/ray.js');
|
|
868
|
+
if (this._details.model) {
|
|
869
|
+
const model = this._details.model;
|
|
870
|
+
// Refresh bounding info to ensure morph target and skeletal animations are taken into account.
|
|
871
|
+
model.meshes.forEach((mesh) => {
|
|
872
|
+
let cache = this._meshDataCache.get(mesh);
|
|
873
|
+
if (!cache) {
|
|
874
|
+
cache = {};
|
|
875
|
+
this._meshDataCache.set(mesh, cache);
|
|
876
|
+
}
|
|
877
|
+
mesh.refreshBoundingInfo({ applyMorph: true, applySkeleton: true, cache });
|
|
878
|
+
});
|
|
879
|
+
const pickingInfo = this._details.scene.pick(screenX, screenY, (mesh) => model.meshes.includes(mesh));
|
|
880
|
+
if (pickingInfo.hit) {
|
|
881
|
+
return pickingInfo;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
return null;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Check for disposed or aborted state (basically everything that can interrupt an async operation).
|
|
888
|
+
* @param abortSignals A set of optional AbortSignals to also check.
|
|
889
|
+
*/
|
|
890
|
+
_throwIfDisposedOrAborted(...abortSignals) {
|
|
891
|
+
if (this._isDisposed) {
|
|
892
|
+
throw new Error("Viewer is disposed.");
|
|
893
|
+
}
|
|
894
|
+
throwIfAborted(...abortSignals);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
(() => {
|
|
898
|
+
registerBuiltInLoaders();
|
|
899
|
+
})();
|
|
900
|
+
|
|
901
|
+
/**
|
|
902
|
+
* @license
|
|
903
|
+
* Copyright 2019 Google LLC
|
|
904
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
905
|
+
*/
|
|
906
|
+
const t$2=globalThis,e$4=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$3=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$4&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$3.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$3.set(s,t));}return t}toString(){return this.cssText}};const r$5=t=>new n$3("string"==typeof t?t:t+"",void 0,s$1),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$3(o,t,s$1)},S$1=(s,o)=>{if(e$4)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$4?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$5(e)})(t):t;
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* @license
|
|
910
|
+
* Copyright 2017 Google LLC
|
|
911
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
912
|
+
*/const{is:i$2,defineProperty:e$3,getOwnPropertyDescriptor:r$4,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$2,getPrototypeOf:n$2}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),y$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&e$3(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$4(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...h$1(t),...o$2(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return !1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$EC(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f$1)(this[t],s))return;this.P(t,s,i);}!1===this.isUpdatePending&&(this._$ES=this._$ET());}P(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$ET(){this.isUpdatePending=!0;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.P(s,this[s],i);}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EU();}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU();}updated(t){}firstUpdated(t){}}b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[d$1("elementProperties")]=new Map,b[d$1("finalized")]=new Map,p$1?.({ReactiveElement:b}),(a$1.reactiveElementVersions??=[]).push("2.0.4");
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* @license
|
|
916
|
+
* Copyright 2017 Google LLC
|
|
917
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
918
|
+
*/
|
|
919
|
+
const t$1=globalThis,i$1=t$1.trustedTypes,s=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$2="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o$1="?"+h,n$1=`<${o$1}>`,r$3=document,l=()=>r$3.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$3.createTreeWalker(r$3,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$2+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$2)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o$1)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$3.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$3).importNode(i,!0);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$3,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$3.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t$1.litHtmlPolyfillSupport;j?.(N,R),(t$1.litHtmlVersions??=[]).push("3.2.1");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* @license
|
|
923
|
+
* Copyright 2017 Google LLC
|
|
924
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
925
|
+
*/let r$2 = class r extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(s,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return T}};r$2._$litElement$=!0,r$2["finalized"]=!0,globalThis.litElementHydrateSupport?.({LitElement:r$2});const i=globalThis.litElementPolyfillSupport;i?.({LitElement:r$2});(globalThis.litElementVersions??=[]).push("4.1.1");
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* @license
|
|
929
|
+
* Copyright 2017 Google LLC
|
|
930
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
931
|
+
*/
|
|
932
|
+
const t=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* @license
|
|
936
|
+
* Copyright 2017 Google LLC
|
|
937
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
938
|
+
*/const o={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1},r$1=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.P(o,void 0,t),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,r?{...t,wrapped:!0}:t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* @license
|
|
942
|
+
* Copyright 2017 Google LLC
|
|
943
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
944
|
+
*/function r(r){return n({...r,state:!0,attribute:!1})}
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* @license
|
|
948
|
+
* Copyright 2017 Google LLC
|
|
949
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
950
|
+
*/
|
|
951
|
+
const e$1=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* @license
|
|
955
|
+
* Copyright 2017 Google LLC
|
|
956
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
957
|
+
*/function e(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$1(n,s,{get(){return o(this)}})}}
|
|
958
|
+
|
|
959
|
+
const defaultCanvasViewerOptions = {};
|
|
960
|
+
/**
|
|
961
|
+
* Chooses a default engine for the current browser environment.
|
|
962
|
+
* @returns The default engine to use.
|
|
963
|
+
*/
|
|
964
|
+
function getDefaultEngine() {
|
|
965
|
+
// TODO: When WebGPU is fully production ready, we may want to prefer it if it is supported by the browser.
|
|
966
|
+
return "WebGL";
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* @experimental
|
|
970
|
+
* Creates a Viewer instance that is bound to an HTML canvas.
|
|
971
|
+
* @remarks
|
|
972
|
+
* This function can be shared across multiple UI integrations (e.g. Web Components, React, etc.).
|
|
973
|
+
* @param canvas The canvas element to bind the Viewer to.
|
|
974
|
+
* @param options The options to use when creating the Viewer and binding it to the specified canvas.
|
|
975
|
+
* @returns A Viewer instance that is bound to the specified canvas.
|
|
976
|
+
*/
|
|
977
|
+
async function createViewerForCanvas(canvas, options) {
|
|
978
|
+
const finalOptions = { ...defaultCanvasViewerOptions, ...options };
|
|
979
|
+
const disposeActions = [];
|
|
980
|
+
// If the canvas is resized, note that the engine needs a resize, but don't resize it here as it will result in flickering.
|
|
981
|
+
let needsResize = false;
|
|
982
|
+
const resizeObserver = new ResizeObserver(() => (needsResize = true));
|
|
983
|
+
resizeObserver.observe(canvas);
|
|
984
|
+
disposeActions.push(() => resizeObserver.disconnect());
|
|
985
|
+
// Create an engine instance.
|
|
986
|
+
let engine;
|
|
987
|
+
switch (finalOptions.engine ?? getDefaultEngine()) {
|
|
988
|
+
case "WebGL": {
|
|
989
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention, no-case-declarations
|
|
990
|
+
const { Engine } = await import('@babylonjs/core/Engines/engine.js');
|
|
991
|
+
engine = new Engine(canvas, undefined, options);
|
|
992
|
+
break;
|
|
993
|
+
}
|
|
994
|
+
case "WebGPU": {
|
|
995
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention, no-case-declarations
|
|
996
|
+
const { WebGPUEngine } = await import('@babylonjs/core/Engines/webgpuEngine.js');
|
|
997
|
+
const webGPUEngine = new WebGPUEngine(canvas, options);
|
|
998
|
+
await webGPUEngine.initAsync();
|
|
999
|
+
engine = webGPUEngine;
|
|
1000
|
+
break;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
// Override the onInitialized callback to add in some specific behavior.
|
|
1004
|
+
const onInitialized = finalOptions.onInitialized;
|
|
1005
|
+
finalOptions.onInitialized = (details) => {
|
|
1006
|
+
// Resize if needed right before rendering the Viewer scene to avoid any flickering.
|
|
1007
|
+
const beforeRenderObserver = details.scene.onBeforeRenderObservable.add(() => {
|
|
1008
|
+
if (needsResize) {
|
|
1009
|
+
engine.resize();
|
|
1010
|
+
needsResize = false;
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
disposeActions.push(() => beforeRenderObserver.remove());
|
|
1014
|
+
// If the canvas is not visible, suspend rendering.
|
|
1015
|
+
let offscreenRenderingSuspension = null;
|
|
1016
|
+
const intersectionObserver = new IntersectionObserver((entries) => {
|
|
1017
|
+
if (entries.length > 0) {
|
|
1018
|
+
if (entries[entries.length - 1].isIntersecting) {
|
|
1019
|
+
offscreenRenderingSuspension?.dispose();
|
|
1020
|
+
offscreenRenderingSuspension = null;
|
|
1021
|
+
}
|
|
1022
|
+
else {
|
|
1023
|
+
offscreenRenderingSuspension = details.suspendRendering();
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
intersectionObserver.observe(canvas);
|
|
1028
|
+
disposeActions.push(() => intersectionObserver.disconnect());
|
|
1029
|
+
// Call the original onInitialized callback, if one was provided.
|
|
1030
|
+
onInitialized?.(details);
|
|
1031
|
+
};
|
|
1032
|
+
// Instantiate the Viewer with the engine and options.
|
|
1033
|
+
const viewer = new Viewer(engine, finalOptions);
|
|
1034
|
+
disposeActions.push(viewer.dispose.bind(viewer));
|
|
1035
|
+
disposeActions.push(() => engine.dispose());
|
|
1036
|
+
// Override the Viewer's dispose method to add in additional cleanup.
|
|
1037
|
+
viewer.dispose = () => disposeActions.forEach((dispose) => dispose());
|
|
1038
|
+
return viewer;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
var HTML3DElement_1;
|
|
1042
|
+
// Icon SVG is pulled from https://iconcloud.design
|
|
1043
|
+
const playFilledIcon = "M5 5.27368C5 3.56682 6.82609 2.48151 8.32538 3.2973L20.687 10.0235C22.2531 10.8756 22.2531 13.124 20.687 13.9762L8.32538 20.7024C6.82609 21.5181 5 20.4328 5 18.726V5.27368Z";
|
|
1044
|
+
const pauseFilledIcon = "M5.74609 3C4.7796 3 3.99609 3.7835 3.99609 4.75V19.25C3.99609 20.2165 4.7796 21 5.74609 21H9.24609C10.2126 21 10.9961 20.2165 10.9961 19.25V4.75C10.9961 3.7835 10.2126 3 9.24609 3H5.74609ZM14.7461 3C13.7796 3 12.9961 3.7835 12.9961 4.75V19.25C12.9961 20.2165 13.7796 21 14.7461 21H18.2461C19.2126 21 19.9961 20.2165 19.9961 19.25V4.75C19.9961 3.7835 19.2126 3 18.2461 3H14.7461Z";
|
|
1045
|
+
const arrowResetFilledIcon = "M7.20711 2.54289C7.59763 2.93342 7.59763 3.56658 7.20711 3.95711L5.41421 5.75H13.25C17.6683 5.75 21.25 9.33172 21.25 13.75C21.25 18.1683 17.6683 21.75 13.25 21.75C8.83172 21.75 5.25 18.1683 5.25 13.75C5.25 13.1977 5.69772 12.75 6.25 12.75C6.80228 12.75 7.25 13.1977 7.25 13.75C7.25 17.0637 9.93629 19.75 13.25 19.75C16.5637 19.75 19.25 17.0637 19.25 13.75C19.25 10.4363 16.5637 7.75 13.25 7.75H5.41421L7.20711 9.54289C7.59763 9.93342 7.59763 10.5666 7.20711 10.9571C6.81658 11.3476 6.18342 11.3476 5.79289 10.9571L2.29289 7.45711C1.90237 7.06658 1.90237 6.43342 2.29289 6.04289L5.79289 2.54289C6.18342 2.15237 6.81658 2.15237 7.20711 2.54289Z";
|
|
1046
|
+
const targetFilledIcon = "M12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14ZM6 12C6 8.68629 8.68629 6 12 6C15.3137 6 18 8.68629 18 12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12ZM12 8C9.79086 8 8 9.79086 8 12C8 14.2091 9.79086 16 12 16C14.2091 16 16 14.2091 16 12C16 9.79086 14.2091 8 12 8ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4Z";
|
|
1047
|
+
const allowedAnimationSpeeds = [0.5, 1, 1.5, 2];
|
|
1048
|
+
// Converts any standard html color string to a Color4 object.
|
|
1049
|
+
function parseColor(color) {
|
|
1050
|
+
if (!color) {
|
|
1051
|
+
return null;
|
|
1052
|
+
}
|
|
1053
|
+
const canvas = document.createElement("canvas");
|
|
1054
|
+
canvas.width = canvas.height = 1;
|
|
1055
|
+
const context = canvas.getContext("2d");
|
|
1056
|
+
if (!context) {
|
|
1057
|
+
throw new Error("Unable to get 2d context for parseColor");
|
|
1058
|
+
}
|
|
1059
|
+
context.clearRect(0, 0, 1, 1);
|
|
1060
|
+
context.fillStyle = color;
|
|
1061
|
+
context.fillRect(0, 0, 1, 1);
|
|
1062
|
+
const data = context.getImageData(0, 0, 1, 1).data;
|
|
1063
|
+
return new Color4(data[0] / 255, data[1] / 255, data[2] / 255, data[3] / 255);
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Displays a 3D model using the Babylon.js Viewer.
|
|
1067
|
+
*/
|
|
1068
|
+
let HTML3DElement = HTML3DElement_1 = class HTML3DElement extends r$2 {
|
|
1069
|
+
constructor() {
|
|
1070
|
+
super(...arguments);
|
|
1071
|
+
this._viewerLock = new AsyncLock();
|
|
1072
|
+
// Bindings for properties that are synchronized both ways between the lower level Viewer and the HTML3DElement.
|
|
1073
|
+
this._propertyBindings = [
|
|
1074
|
+
this._createPropertyBinding("clearColor", (details) => details.scene.onClearColorChangedObservable, (details) => (details.scene.clearColor = this.clearColor ?? new Color4(0, 0, 0, 0)), (details) => (this.clearColor = details.scene.clearColor)),
|
|
1075
|
+
this._createPropertyBinding("skyboxBlur", (details) => details.viewer.onSkyboxBlurChanged, (details) => (details.viewer.skyboxBlur = this.skyboxBlur ?? details.viewer.skyboxBlur), (details) => (this.skyboxBlur = details.viewer.skyboxBlur)),
|
|
1076
|
+
this._createPropertyBinding("toneMapping", (details) => details.viewer.onPostProcessingChanged, (details) => {
|
|
1077
|
+
if (this.toneMapping) {
|
|
1078
|
+
details.viewer.postProcessing = { toneMapping: this.toneMapping };
|
|
1079
|
+
}
|
|
1080
|
+
}, (details) => (this.toneMapping = details.viewer.postProcessing?.toneMapping)),
|
|
1081
|
+
this._createPropertyBinding("contrast", (details) => details.viewer.onPostProcessingChanged, (details) => (details.viewer.postProcessing = { contrast: this.contrast ?? undefined }), (details) => (this.contrast = details.viewer.postProcessing.contrast)),
|
|
1082
|
+
this._createPropertyBinding("exposure", (details) => details.viewer.onPostProcessingChanged, (details) => (details.viewer.postProcessing = { exposure: this.exposure ?? undefined }), (details) => (this.exposure = details.viewer.postProcessing.exposure)),
|
|
1083
|
+
this._createPropertyBinding("cameraAutoOrbit", (details) => details.viewer.onCameraAutoOrbitChanged, (details) => (details.viewer.cameraAutoOrbit = { enabled: this.cameraAutoOrbit }), (details) => (this.cameraAutoOrbit = details.viewer.cameraAutoOrbit.enabled)),
|
|
1084
|
+
this._createPropertyBinding("cameraAutoOrbitSpeed", (details) => details.viewer.onCameraAutoOrbitChanged, (details) => (details.viewer.cameraAutoOrbit = { speed: this.cameraAutoOrbitSpeed ?? undefined }), (details) => (this.cameraAutoOrbitSpeed = details.viewer.cameraAutoOrbit.speed)),
|
|
1085
|
+
this._createPropertyBinding("cameraAutoOrbitDelay", (details) => details.viewer.onCameraAutoOrbitChanged, (details) => (details.viewer.cameraAutoOrbit = { delay: this.cameraAutoOrbitDelay ?? undefined }), (details) => (this.cameraAutoOrbitDelay = details.viewer.cameraAutoOrbit.delay)),
|
|
1086
|
+
this._createPropertyBinding("animationSpeed", (details) => details.viewer.onAnimationSpeedChanged, (details) => (details.viewer.animationSpeed = this.animationSpeed), (details) => {
|
|
1087
|
+
let speed = details.viewer.animationSpeed;
|
|
1088
|
+
speed = allowedAnimationSpeeds.reduce((prev, curr) => (Math.abs(curr - speed) < Math.abs(prev - speed) ? curr : prev));
|
|
1089
|
+
this.animationSpeed = speed;
|
|
1090
|
+
this._dispatchCustomEvent("animationspeedchange", (type) => new Event(type));
|
|
1091
|
+
}),
|
|
1092
|
+
this._createPropertyBinding("selectedAnimation", (details) => details.viewer.onSelectedAnimationChanged, (details) => (details.viewer.selectedAnimation = this.selectedAnimation ?? details.viewer.selectedAnimation), (details) => (this.selectedAnimation = details.viewer.selectedAnimation)),
|
|
1093
|
+
this._createPropertyBinding("selectedMaterialVariant", (details) => details.viewer.onSelectedMaterialVariantChanged, (details) => (details.viewer.selectedMaterialVariant = this.selectedMaterialVariant ?? details.viewer.selectedMaterialVariant ?? ""), (details) => (this.selectedMaterialVariant = details.viewer.selectedMaterialVariant)),
|
|
1094
|
+
];
|
|
1095
|
+
/**
|
|
1096
|
+
* The engine to use for rendering.
|
|
1097
|
+
*/
|
|
1098
|
+
this.engine = getDefaultEngine();
|
|
1099
|
+
/**
|
|
1100
|
+
* The model URL.
|
|
1101
|
+
*/
|
|
1102
|
+
this.source = null;
|
|
1103
|
+
/**
|
|
1104
|
+
* Forces the model to be loaded with the specified extension.
|
|
1105
|
+
* @remarks
|
|
1106
|
+
* If this property is not set, the extension will be inferred from the model URL when possible.
|
|
1107
|
+
*/
|
|
1108
|
+
this.extension = null;
|
|
1109
|
+
/**
|
|
1110
|
+
* The texture URL for lighting.
|
|
1111
|
+
*/
|
|
1112
|
+
this.environmentLighting = null;
|
|
1113
|
+
/**
|
|
1114
|
+
* The texture URL for the skybox.
|
|
1115
|
+
*/
|
|
1116
|
+
this.environmentSkybox = null;
|
|
1117
|
+
this._loadingProgress = false;
|
|
1118
|
+
/**
|
|
1119
|
+
* A value between 0 and 1 that specifies how much to blur the skybox.
|
|
1120
|
+
*/
|
|
1121
|
+
this.skyboxBlur = null;
|
|
1122
|
+
/**
|
|
1123
|
+
* The tone mapping to use for rendering the scene.
|
|
1124
|
+
*/
|
|
1125
|
+
this.toneMapping = null;
|
|
1126
|
+
/**
|
|
1127
|
+
* The contrast applied to the scene.
|
|
1128
|
+
*/
|
|
1129
|
+
this.contrast = null;
|
|
1130
|
+
/**
|
|
1131
|
+
* The exposure applied to the scene.
|
|
1132
|
+
*/
|
|
1133
|
+
this.exposure = null;
|
|
1134
|
+
/**
|
|
1135
|
+
* The clear color (e.g. background color) for the viewer.
|
|
1136
|
+
*/
|
|
1137
|
+
this.clearColor = null;
|
|
1138
|
+
/**
|
|
1139
|
+
* Enables or disables camera auto-orbit.
|
|
1140
|
+
*/
|
|
1141
|
+
this.cameraAutoOrbit = false;
|
|
1142
|
+
/**
|
|
1143
|
+
* The speed at which the camera auto-orbits around the target.
|
|
1144
|
+
*/
|
|
1145
|
+
this.cameraAutoOrbitSpeed = null;
|
|
1146
|
+
/**
|
|
1147
|
+
* The delay in milliseconds before the camera starts auto-orbiting.
|
|
1148
|
+
*/
|
|
1149
|
+
this.cameraAutoOrbitDelay = null;
|
|
1150
|
+
/**
|
|
1151
|
+
* Camera orbit can only be set as an attribute, and is set on the camera each time a new model is loaded.
|
|
1152
|
+
* For access to the real time camera properties, use viewerDetails.camera.
|
|
1153
|
+
*/
|
|
1154
|
+
this._cameraOrbitCoercer = null;
|
|
1155
|
+
/**
|
|
1156
|
+
* Camera target can only be set as an attribute, and is set on the camera each time a new model is loaded.
|
|
1157
|
+
* For access to the real time camera properties, use viewerDetails.camera.
|
|
1158
|
+
*/
|
|
1159
|
+
this._cameraTargetCoercer = null;
|
|
1160
|
+
/**
|
|
1161
|
+
* A string value that encodes one or more hotspots.
|
|
1162
|
+
*/
|
|
1163
|
+
this.hotSpots = {};
|
|
1164
|
+
/**
|
|
1165
|
+
* True if the default animation should play automatically when a model is loaded.
|
|
1166
|
+
*/
|
|
1167
|
+
this.animationAutoPlay = false;
|
|
1168
|
+
/**
|
|
1169
|
+
* The currently selected animation index.
|
|
1170
|
+
*/
|
|
1171
|
+
this.selectedAnimation = null;
|
|
1172
|
+
/**
|
|
1173
|
+
* The speed scale at which animations are played.
|
|
1174
|
+
*/
|
|
1175
|
+
this.animationSpeed = 1;
|
|
1176
|
+
/**
|
|
1177
|
+
* The current point on the selected animation timeline, normalized between 0 and 1.
|
|
1178
|
+
*/
|
|
1179
|
+
this.animationProgress = 0;
|
|
1180
|
+
this._animations = [];
|
|
1181
|
+
this._isAnimationPlaying = false;
|
|
1182
|
+
/**
|
|
1183
|
+
* The currently selected material variant.
|
|
1184
|
+
*/
|
|
1185
|
+
this.selectedMaterialVariant = null;
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Gets the underlying viewer details (when the underlying viewer is in a loaded state).
|
|
1189
|
+
* This is useful for advanced scenarios where direct access to the viewer or Babylon scene is needed.
|
|
1190
|
+
*/
|
|
1191
|
+
get viewerDetails() {
|
|
1192
|
+
return this._viewerDetails;
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Get hotspot world and screen values from a named hotspot
|
|
1196
|
+
* @param name slot of the hot spot
|
|
1197
|
+
* @param result resulting world and screen positions
|
|
1198
|
+
* @returns world position, world normal and screen space coordinates
|
|
1199
|
+
*/
|
|
1200
|
+
queryHotSpot(name, result) {
|
|
1201
|
+
return this._queryHotSpot(name, result) != null;
|
|
1202
|
+
}
|
|
1203
|
+
_queryHotSpot(name, result) {
|
|
1204
|
+
if (this._viewerDetails) {
|
|
1205
|
+
const hotSpot = this.hotSpots?.[name];
|
|
1206
|
+
if (hotSpot) {
|
|
1207
|
+
if (this._viewerDetails.viewer.getHotSpotToRef(hotSpot, result)) {
|
|
1208
|
+
return hotSpot;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
return null;
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Updates the camera to focus on a named hotspot.
|
|
1216
|
+
* @param name The name of the hotspot to focus on.
|
|
1217
|
+
* @returns true if the hotspot was found and the camera was updated, false otherwise.
|
|
1218
|
+
*/
|
|
1219
|
+
focusHotSpot(name) {
|
|
1220
|
+
const result = new ViewerHotSpotResult();
|
|
1221
|
+
const query = this._queryHotSpot(name, result);
|
|
1222
|
+
if (query && this._viewerDetails) {
|
|
1223
|
+
this._viewerDetails.viewer.pauseAnimation();
|
|
1224
|
+
const cameraOrbit = query.cameraOrbit ?? [undefined, undefined, undefined];
|
|
1225
|
+
this._viewerDetails.camera.interpolateTo(cameraOrbit[0], cameraOrbit[1], cameraOrbit[2], new Vector3(result.worldPosition[0], result.worldPosition[1], result.worldPosition[2]));
|
|
1226
|
+
return true;
|
|
1227
|
+
}
|
|
1228
|
+
return false;
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* The texture URLs used for lighting and skybox. Setting this property will set both environmentLighting and environmentSkybox.
|
|
1232
|
+
*/
|
|
1233
|
+
get environment() {
|
|
1234
|
+
return { lighting: this.environmentLighting, skybox: this.environmentSkybox };
|
|
1235
|
+
}
|
|
1236
|
+
set environment(url) {
|
|
1237
|
+
this.environmentLighting = url;
|
|
1238
|
+
this.environmentSkybox = url;
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Gets information about loading activity.
|
|
1242
|
+
* @remarks
|
|
1243
|
+
* false indicates no loading activity.
|
|
1244
|
+
* true indicates loading activity with no progress information.
|
|
1245
|
+
* A number between 0 and 1 indicates loading activity with progress information.
|
|
1246
|
+
*/
|
|
1247
|
+
get loadingProgress() {
|
|
1248
|
+
return this._loadingProgress;
|
|
1249
|
+
}
|
|
1250
|
+
get _hasHotSpots() {
|
|
1251
|
+
return Object.keys(this.hotSpots).length > 0;
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* The list of animation names for the currently loaded model.
|
|
1255
|
+
*/
|
|
1256
|
+
get animations() {
|
|
1257
|
+
return this._animations;
|
|
1258
|
+
}
|
|
1259
|
+
get _hasAnimations() {
|
|
1260
|
+
return this._animations.length > 0;
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* True if an animation is currently playing.
|
|
1264
|
+
*/
|
|
1265
|
+
get isAnimationPlaying() {
|
|
1266
|
+
return this._isAnimationPlaying;
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* The list of material variants for the currently loaded model.
|
|
1270
|
+
*/
|
|
1271
|
+
get materialVariants() {
|
|
1272
|
+
return this._viewerDetails?.viewer.materialVariants ?? [];
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Toggles the play/pause animation state if there is a selected animation.
|
|
1276
|
+
*/
|
|
1277
|
+
toggleAnimation() {
|
|
1278
|
+
this._viewerDetails?.viewer.toggleAnimation();
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Resets the camera to its initial pose.
|
|
1282
|
+
*/
|
|
1283
|
+
resetCamera() {
|
|
1284
|
+
this._viewerDetails?.viewer.resetCamera();
|
|
1285
|
+
}
|
|
1286
|
+
/** @internal */
|
|
1287
|
+
connectedCallback() {
|
|
1288
|
+
super.connectedCallback();
|
|
1289
|
+
this._setupViewer();
|
|
1290
|
+
}
|
|
1291
|
+
/** @internal */
|
|
1292
|
+
disconnectedCallback() {
|
|
1293
|
+
super.disconnectedCallback();
|
|
1294
|
+
this._tearDownViewer();
|
|
1295
|
+
}
|
|
1296
|
+
/** @internal */
|
|
1297
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1298
|
+
update(changedProperties) {
|
|
1299
|
+
super.update(changedProperties);
|
|
1300
|
+
if (this._materialSelect) {
|
|
1301
|
+
this._materialSelect.value = "";
|
|
1302
|
+
}
|
|
1303
|
+
if (changedProperties.get("engine")) {
|
|
1304
|
+
this._tearDownViewer();
|
|
1305
|
+
this._setupViewer();
|
|
1306
|
+
}
|
|
1307
|
+
else {
|
|
1308
|
+
this._propertyBindings.filter((binding) => changedProperties.has(binding.property)).forEach((binding) => binding.updateViewer());
|
|
1309
|
+
if (changedProperties.has("source")) {
|
|
1310
|
+
this._updateModel();
|
|
1311
|
+
}
|
|
1312
|
+
if (changedProperties.has("environmentLighting") || changedProperties.has("environmentSkybox")) {
|
|
1313
|
+
this._updateEnv({
|
|
1314
|
+
lighting: changedProperties.has("environmentLighting"),
|
|
1315
|
+
skybox: changedProperties.has("environmentSkybox"),
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
/** @internal */
|
|
1321
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1322
|
+
render() {
|
|
1323
|
+
const showProgressBar = this.loadingProgress !== false;
|
|
1324
|
+
// If loadingProgress is true, then the progress bar is indeterminate so the value doesn't matter.
|
|
1325
|
+
const progressValue = typeof this.loadingProgress === "boolean" ? 0 : this.loadingProgress * 100;
|
|
1326
|
+
const isIndeterminate = this.loadingProgress === true;
|
|
1327
|
+
const progressBar = x `
|
|
1328
|
+
<div part="progress-bar" class="bar loading-progress-outer ${showProgressBar ? "" : "loading-progress-outer-inactive"}" aria-label="Loading Progress">
|
|
1329
|
+
<div
|
|
1330
|
+
class="loading-progress-inner ${isIndeterminate ? "loading-progress-inner-indeterminate" : ""}"
|
|
1331
|
+
style="${isIndeterminate ? "" : `width: ${progressValue}%`}"
|
|
1332
|
+
></div>
|
|
1333
|
+
</div>
|
|
1334
|
+
`;
|
|
1335
|
+
// Setup the list of toolbar controls.
|
|
1336
|
+
let toolbarControls = [];
|
|
1337
|
+
if (this._viewerDetails?.model != null) {
|
|
1338
|
+
// If the model has animations, add animation controls.
|
|
1339
|
+
if (this._hasAnimations) {
|
|
1340
|
+
toolbarControls.push(x `
|
|
1341
|
+
<div class="animation-timeline">
|
|
1342
|
+
<button aria-label="${this.isAnimationPlaying ? "Pause" : "Play"}" @click="${this.toggleAnimation}">
|
|
1343
|
+
${!this.isAnimationPlaying
|
|
1344
|
+
? x `
|
|
1345
|
+
<svg viewBox="0 0 24 24">
|
|
1346
|
+
<path d="${playFilledIcon}" fill="currentColor"></path>
|
|
1347
|
+
</svg>
|
|
1348
|
+
`
|
|
1349
|
+
: x `
|
|
1350
|
+
<svg viewBox="0 0 24 24">
|
|
1351
|
+
<path d="${pauseFilledIcon}" fill="currentColor"></path>
|
|
1352
|
+
</svg>
|
|
1353
|
+
`}
|
|
1354
|
+
</button>
|
|
1355
|
+
<input
|
|
1356
|
+
aria-label="Animation Progress"
|
|
1357
|
+
class="animation-timeline-input"
|
|
1358
|
+
type="range"
|
|
1359
|
+
min="0"
|
|
1360
|
+
max="1"
|
|
1361
|
+
step="0.0001"
|
|
1362
|
+
.value="${this.animationProgress}"
|
|
1363
|
+
@input="${this._onAnimationTimelineChanged}"
|
|
1364
|
+
@pointerdown="${this._onAnimationTimelinePointerDown}"
|
|
1365
|
+
/>
|
|
1366
|
+
</div>
|
|
1367
|
+
<select aria-label="Select Animation Speed" @change="${this._onAnimationSpeedChanged}">
|
|
1368
|
+
${allowedAnimationSpeeds.map((speed) => x `<option value="${speed}" .selected="${this.animationSpeed === speed}">${speed}x</option> `)}
|
|
1369
|
+
</select>
|
|
1370
|
+
${this.animations.length > 1
|
|
1371
|
+
? x `<select aria-label="Select Animation" @change="${this._onSelectedAnimationChanged}">
|
|
1372
|
+
${this.animations.map((name, index) => x `<option value="${index}" .selected="${this.selectedAnimation === index}">${name}</option>`)}
|
|
1373
|
+
</select>`
|
|
1374
|
+
: ""}
|
|
1375
|
+
`);
|
|
1376
|
+
}
|
|
1377
|
+
// If the model has material variants, add material variant controls.
|
|
1378
|
+
if (this.materialVariants.length > 1) {
|
|
1379
|
+
toolbarControls.push(x `
|
|
1380
|
+
<select aria-label="Select Material Variant" @change="${this._onMaterialVariantChanged}">
|
|
1381
|
+
${this.materialVariants.map((name) => x `<option value="${name}" .selected="${this.selectedMaterialVariant === name}">${name}</option>`)}
|
|
1382
|
+
</select>
|
|
1383
|
+
`);
|
|
1384
|
+
}
|
|
1385
|
+
// Always include a button to reset the camera pose.
|
|
1386
|
+
toolbarControls.push(x `
|
|
1387
|
+
<button aria-label="Reset Camera Pose" @click="${this.resetCamera}">
|
|
1388
|
+
<svg viewBox="0 0 24 24">
|
|
1389
|
+
<path d="${arrowResetFilledIcon}" fill="currentColor"></path>
|
|
1390
|
+
</svg>
|
|
1391
|
+
</button>
|
|
1392
|
+
`);
|
|
1393
|
+
// If hotspots have been defined, add hotspot controls.
|
|
1394
|
+
if (this._hasHotSpots) {
|
|
1395
|
+
toolbarControls.push(x `
|
|
1396
|
+
<div class="select-container">
|
|
1397
|
+
<select id="materialSelect" aria-label="Select HotSpot" @change="${this._onHotSpotsChanged}">
|
|
1398
|
+
<!-- When the select is forced to be less wide than the options, padding on the right is lost. Pad with white space. -->
|
|
1399
|
+
${Object.keys(this.hotSpots).map((name) => x `<option value="${name}">${name} </option>`)}
|
|
1400
|
+
</select>
|
|
1401
|
+
<!-- This button is not actually interactive, we want input to pass through to the select below. -->
|
|
1402
|
+
<button style="pointer-events: none">
|
|
1403
|
+
<svg viewBox="0 0 24 24">
|
|
1404
|
+
<path d="${targetFilledIcon}" fill="currentColor"></path>
|
|
1405
|
+
</svg>
|
|
1406
|
+
</button>
|
|
1407
|
+
</div>
|
|
1408
|
+
`);
|
|
1409
|
+
}
|
|
1410
|
+
// Add a vertical divider between each toolbar control.
|
|
1411
|
+
const controlCount = toolbarControls.length;
|
|
1412
|
+
const separator = x `<div class="divider"></div>`;
|
|
1413
|
+
toolbarControls = toolbarControls.reduce((toolbarControls, toolbarControl, index) => {
|
|
1414
|
+
if (index < controlCount - 1) {
|
|
1415
|
+
return [...toolbarControls, toolbarControl, separator];
|
|
1416
|
+
}
|
|
1417
|
+
else {
|
|
1418
|
+
return [...toolbarControls, toolbarControl];
|
|
1419
|
+
}
|
|
1420
|
+
}, new Array());
|
|
1421
|
+
}
|
|
1422
|
+
// NOTE: The unnamed 'slot' element holds all child elements of the <babylon-viewer> that do not specify a 'slot' attribute.
|
|
1423
|
+
return x `
|
|
1424
|
+
<div class="full-size">
|
|
1425
|
+
<div id="canvasContainer" class="full-size"></div>
|
|
1426
|
+
<slot class="full-size children-slot"></slot>
|
|
1427
|
+
<slot name="progress-bar"> ${progressBar}</slot>
|
|
1428
|
+
${toolbarControls.length === 0
|
|
1429
|
+
? ""
|
|
1430
|
+
: x `
|
|
1431
|
+
<slot name="tool-bar">
|
|
1432
|
+
<div part="tool-bar" class="bar ${this._hasAnimations ? "" : "bar-min"} tool-bar">${toolbarControls}</div>
|
|
1433
|
+
</slot>
|
|
1434
|
+
`}
|
|
1435
|
+
</div>
|
|
1436
|
+
`;
|
|
1437
|
+
}
|
|
1438
|
+
addEventListener(type, listener, options) {
|
|
1439
|
+
super.addEventListener(type, listener, options);
|
|
1440
|
+
}
|
|
1441
|
+
_dispatchCustomEvent(type, event) {
|
|
1442
|
+
this.dispatchEvent(event(type));
|
|
1443
|
+
}
|
|
1444
|
+
_onSelectedAnimationChanged(event) {
|
|
1445
|
+
const selectElement = event.target;
|
|
1446
|
+
this.selectedAnimation = Number(selectElement.value);
|
|
1447
|
+
}
|
|
1448
|
+
_onAnimationSpeedChanged(event) {
|
|
1449
|
+
const selectElement = event.target;
|
|
1450
|
+
this.animationSpeed = Number(selectElement.value);
|
|
1451
|
+
}
|
|
1452
|
+
_onAnimationTimelineChanged(event) {
|
|
1453
|
+
if (this._viewerDetails) {
|
|
1454
|
+
const input = event.target;
|
|
1455
|
+
const value = Number(input.value);
|
|
1456
|
+
if (value !== this.animationProgress) {
|
|
1457
|
+
this._viewerDetails.viewer.animationProgress = value;
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
_onAnimationTimelinePointerDown(event) {
|
|
1462
|
+
if (this._viewerDetails?.viewer.isAnimationPlaying) {
|
|
1463
|
+
this._viewerDetails.viewer.pauseAnimation();
|
|
1464
|
+
const input = event.target;
|
|
1465
|
+
input.addEventListener("pointerup", () => this._viewerDetails?.viewer.playAnimation(), { once: true });
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
_onMaterialVariantChanged(event) {
|
|
1469
|
+
const selectElement = event.target;
|
|
1470
|
+
this.selectedMaterialVariant = selectElement.value;
|
|
1471
|
+
}
|
|
1472
|
+
_onHotSpotsChanged(event) {
|
|
1473
|
+
const selectElement = event.target;
|
|
1474
|
+
const hotSpotName = selectElement.value;
|
|
1475
|
+
// We don't actually want a selected value, this is just a one time trigger.
|
|
1476
|
+
selectElement.value = "";
|
|
1477
|
+
this.focusHotSpot(hotSpotName);
|
|
1478
|
+
}
|
|
1479
|
+
// Helper function to simplify keeping Viewer properties in sync with HTML3DElement properties.
|
|
1480
|
+
_createPropertyBinding(property, getObservable, updateViewer, updateElement) {
|
|
1481
|
+
return {
|
|
1482
|
+
property,
|
|
1483
|
+
// Called each time a Viewer instance is created.
|
|
1484
|
+
onInitialized: (viewerDetails) => {
|
|
1485
|
+
getObservable(viewerDetails).add(() => {
|
|
1486
|
+
updateElement(viewerDetails);
|
|
1487
|
+
});
|
|
1488
|
+
updateViewer(viewerDetails);
|
|
1489
|
+
},
|
|
1490
|
+
// Called when the HTML3DElement property should be propagated to the Viewer.
|
|
1491
|
+
updateViewer: () => {
|
|
1492
|
+
if (this._viewerDetails) {
|
|
1493
|
+
updateViewer(this._viewerDetails);
|
|
1494
|
+
}
|
|
1495
|
+
},
|
|
1496
|
+
// Called to re-sync the HTML3DElement property with its corresponding attribute.
|
|
1497
|
+
syncToAttribute: () => {
|
|
1498
|
+
const descriptor = HTML3DElement_1.elementProperties.get(property);
|
|
1499
|
+
if (descriptor) {
|
|
1500
|
+
if (descriptor.attribute) {
|
|
1501
|
+
const attributeName = descriptor.attribute === true ? property : descriptor.attribute;
|
|
1502
|
+
if (this.hasAttribute(attributeName)) {
|
|
1503
|
+
const attributeValue = this.getAttribute(attributeName);
|
|
1504
|
+
const converter = typeof descriptor.converter === "function"
|
|
1505
|
+
? descriptor.converter
|
|
1506
|
+
: descriptor.converter?.fromAttribute !== undefined
|
|
1507
|
+
? descriptor.converter.fromAttribute
|
|
1508
|
+
: u$1.fromAttribute;
|
|
1509
|
+
this[property] = converter ? converter(attributeValue, descriptor.type) : attributeValue;
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
},
|
|
1514
|
+
};
|
|
1515
|
+
}
|
|
1516
|
+
async _setupViewer() {
|
|
1517
|
+
await this._viewerLock.lockAsync(async () => {
|
|
1518
|
+
// The first time the element is connected, the canvas container may not be available yet.
|
|
1519
|
+
// Wait for the first update if needed.
|
|
1520
|
+
if (!this._canvasContainer) {
|
|
1521
|
+
await this.updateComplete;
|
|
1522
|
+
}
|
|
1523
|
+
if (this._canvasContainer && !this._viewerDetails) {
|
|
1524
|
+
const canvas = document.createElement("canvas");
|
|
1525
|
+
canvas.className = "full-size canvas";
|
|
1526
|
+
canvas.setAttribute("touch-action", "none");
|
|
1527
|
+
this._canvasContainer.appendChild(canvas);
|
|
1528
|
+
await createViewerForCanvas(canvas, {
|
|
1529
|
+
engine: this.engine,
|
|
1530
|
+
onInitialized: (details) => {
|
|
1531
|
+
this._viewerDetails = details;
|
|
1532
|
+
details.viewer.onEnvironmentChanged.add(() => {
|
|
1533
|
+
this._dispatchCustomEvent("environmentchange", (type) => new Event(type));
|
|
1534
|
+
});
|
|
1535
|
+
details.viewer.onEnvironmentError.add((error) => {
|
|
1536
|
+
this._dispatchCustomEvent("environmenterror", (type) => new ErrorEvent(type, { error }));
|
|
1537
|
+
});
|
|
1538
|
+
details.viewer.onModelChanged.add(() => {
|
|
1539
|
+
this._animations = [...details.viewer.animations];
|
|
1540
|
+
// When attributes are explicitly set, they are re-applied when a new model is loaded.
|
|
1541
|
+
this._propertyBindings.forEach((binding) => binding.syncToAttribute());
|
|
1542
|
+
// The same goes for camera pose attributes, but it is handled a little differently because there are no corresponding public properties
|
|
1543
|
+
// (since the underlying Babylon camera already has these properties).
|
|
1544
|
+
this._cameraOrbitCoercer?.(details.camera);
|
|
1545
|
+
this._cameraTargetCoercer?.(details.camera);
|
|
1546
|
+
// If animation auto play was set, then start the default animation (if possible).
|
|
1547
|
+
if (this.animationAutoPlay) {
|
|
1548
|
+
details.viewer.playAnimation();
|
|
1549
|
+
}
|
|
1550
|
+
this._dispatchCustomEvent("modelchange", (type) => new Event(type));
|
|
1551
|
+
});
|
|
1552
|
+
details.viewer.onModelError.add((error) => {
|
|
1553
|
+
this._animations = [...details.viewer.animations];
|
|
1554
|
+
this._dispatchCustomEvent("modelerror", (type) => new ErrorEvent(type, { error }));
|
|
1555
|
+
});
|
|
1556
|
+
details.viewer.onLoadingProgressChanged.add(() => {
|
|
1557
|
+
this._loadingProgress = details.viewer.loadingProgress;
|
|
1558
|
+
this._dispatchCustomEvent("loadingprogresschange", (type) => new Event(type));
|
|
1559
|
+
});
|
|
1560
|
+
details.viewer.onIsAnimationPlayingChanged.add(() => {
|
|
1561
|
+
this._isAnimationPlaying = details.viewer.isAnimationPlaying ?? false;
|
|
1562
|
+
this._dispatchCustomEvent("animationplayingchange", (type) => new Event(type));
|
|
1563
|
+
});
|
|
1564
|
+
details.viewer.onAnimationProgressChanged.add(() => {
|
|
1565
|
+
this.animationProgress = details.viewer.animationProgress ?? 0;
|
|
1566
|
+
this._dispatchCustomEvent("animationprogresschange", (type) => new Event(type));
|
|
1567
|
+
});
|
|
1568
|
+
details.scene.onAfterRenderCameraObservable.add(() => {
|
|
1569
|
+
this._dispatchCustomEvent("viewerrender", (type) => new Event(type));
|
|
1570
|
+
});
|
|
1571
|
+
this._updateModel();
|
|
1572
|
+
this._updateEnv({ lighting: true, skybox: true });
|
|
1573
|
+
this._propertyBindings.forEach((binding) => binding.onInitialized(details));
|
|
1574
|
+
this._dispatchCustomEvent("viewerready", (type) => new Event(type));
|
|
1575
|
+
},
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
async _tearDownViewer() {
|
|
1581
|
+
await this._viewerLock.lockAsync(async () => {
|
|
1582
|
+
if (this._viewerDetails) {
|
|
1583
|
+
this._viewerDetails.viewer.dispose();
|
|
1584
|
+
this._viewerDetails = undefined;
|
|
1585
|
+
}
|
|
1586
|
+
// We want to replace the canvas for two reasons:
|
|
1587
|
+
// 1. When the viewer element is reconnected to the DOM, we don't want to briefly see the last frame of the previous model.
|
|
1588
|
+
// 2. If we are changing engines (e.g. WebGL to WebGPU), we need to create a new canvas for the new engine.
|
|
1589
|
+
if (this._canvasContainer && this._canvasContainer.firstElementChild) {
|
|
1590
|
+
this._canvasContainer.removeChild(this._canvasContainer.firstElementChild);
|
|
1591
|
+
}
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1594
|
+
async _updateModel() {
|
|
1595
|
+
if (this._viewerDetails) {
|
|
1596
|
+
try {
|
|
1597
|
+
if (this.source) {
|
|
1598
|
+
await this._viewerDetails.viewer.loadModel(this.source, { pluginExtension: this.extension ?? undefined, defaultAnimation: this.selectedAnimation ?? 0 });
|
|
1599
|
+
}
|
|
1600
|
+
else {
|
|
1601
|
+
await this._viewerDetails.viewer.resetModel();
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
catch (error) {
|
|
1605
|
+
Logger.Log(error);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
async _updateEnv(options) {
|
|
1610
|
+
if (this._viewerDetails) {
|
|
1611
|
+
try {
|
|
1612
|
+
const updates = [];
|
|
1613
|
+
if (options.lighting && options.skybox && this.environmentLighting === this.environmentSkybox) {
|
|
1614
|
+
updates.push([this.environmentLighting, { lighting: true, skybox: true }]);
|
|
1615
|
+
}
|
|
1616
|
+
else {
|
|
1617
|
+
if (options.lighting) {
|
|
1618
|
+
updates.push([this.environmentLighting, { lighting: true }]);
|
|
1619
|
+
}
|
|
1620
|
+
if (options.skybox) {
|
|
1621
|
+
updates.push([this.environmentSkybox, { skybox: true }]);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
updates.forEach(async ([url, options]) => {
|
|
1625
|
+
if (url) {
|
|
1626
|
+
await this._viewerDetails?.viewer.loadEnvironment(url, options);
|
|
1627
|
+
}
|
|
1628
|
+
else {
|
|
1629
|
+
await this._viewerDetails?.viewer.resetEnvironment(options);
|
|
1630
|
+
}
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
catch (error) {
|
|
1634
|
+
Logger.Log(error);
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
/** @internal */
|
|
1640
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1641
|
+
HTML3DElement.styles = i$3 `
|
|
1642
|
+
:host {
|
|
1643
|
+
--ui-foreground-color: white;
|
|
1644
|
+
--ui-background-hue: 233;
|
|
1645
|
+
--ui-background-saturation: 8%;
|
|
1646
|
+
--ui-background-lightness: 39%;
|
|
1647
|
+
--ui-background-opacity: 0.75;
|
|
1648
|
+
--ui-background-color: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), var(--ui-background-opacity));
|
|
1649
|
+
--ui-background-color-hover: hsla(
|
|
1650
|
+
var(--ui-background-hue),
|
|
1651
|
+
var(--ui-background-saturation),
|
|
1652
|
+
calc(var(--ui-background-lightness) - 10%),
|
|
1653
|
+
calc(var(--ui-background-opacity) - 0.1)
|
|
1654
|
+
);
|
|
1655
|
+
all: inherit;
|
|
1656
|
+
overflow: hidden;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
.full-size {
|
|
1660
|
+
display: block;
|
|
1661
|
+
position: relative;
|
|
1662
|
+
width: 100%;
|
|
1663
|
+
height: 100%;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
.canvas {
|
|
1667
|
+
outline: none;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
.children-slot {
|
|
1671
|
+
position: absolute;
|
|
1672
|
+
top: 0;
|
|
1673
|
+
background: transparent;
|
|
1674
|
+
pointer-events: none;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
.bar {
|
|
1678
|
+
position: absolute;
|
|
1679
|
+
width: calc(100% - 24px);
|
|
1680
|
+
min-width: 150px;
|
|
1681
|
+
max-width: 1280px;
|
|
1682
|
+
left: 50%;
|
|
1683
|
+
transform: translateX(-50%);
|
|
1684
|
+
background-color: var(--ui-background-color);
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
.bar-min {
|
|
1688
|
+
width: unset;
|
|
1689
|
+
min-width: unset;
|
|
1690
|
+
max-width: unset;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
.loading-progress-outer {
|
|
1694
|
+
height: 4px;
|
|
1695
|
+
border-radius: 4px;
|
|
1696
|
+
border: 1px solid var(--ui-background-color);
|
|
1697
|
+
outline: none;
|
|
1698
|
+
top: 12px;
|
|
1699
|
+
pointer-events: none;
|
|
1700
|
+
transition: opacity 0.5s ease;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
.loading-progress-outer-inactive {
|
|
1704
|
+
opacity: 0;
|
|
1705
|
+
/* Set the background color to the foreground color while in the inactive state so that the color seen is correct while fading out the opacity. */
|
|
1706
|
+
background-color: var(--ui-foreground-color);
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
.loading-progress-inner {
|
|
1710
|
+
width: 0;
|
|
1711
|
+
height: 100%;
|
|
1712
|
+
border-radius: inherit;
|
|
1713
|
+
background-color: var(--ui-foreground-color);
|
|
1714
|
+
transition: width 0.3s linear;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
/* The right side of the inner progress bar starts aligned with the left side of the outer progress bar (container).
|
|
1718
|
+
So, if the width is 30%, then the left side of the inner progress bar moves a total of 130% of the width of the container.
|
|
1719
|
+
This is why the first keyframe is at 23% ((100/130)*30).
|
|
1720
|
+
*/
|
|
1721
|
+
@keyframes indeterminate {
|
|
1722
|
+
0% {
|
|
1723
|
+
left: 0%;
|
|
1724
|
+
width: 0%;
|
|
1725
|
+
}
|
|
1726
|
+
23% {
|
|
1727
|
+
left: 0%;
|
|
1728
|
+
width: 30%;
|
|
1729
|
+
}
|
|
1730
|
+
77% {
|
|
1731
|
+
left: 70%;
|
|
1732
|
+
width: 30%;
|
|
1733
|
+
}
|
|
1734
|
+
100% {
|
|
1735
|
+
left: 100%;
|
|
1736
|
+
width: 0%;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
.loading-progress-inner-indeterminate {
|
|
1741
|
+
position: absolute;
|
|
1742
|
+
animation: indeterminate 1.5s infinite;
|
|
1743
|
+
animation-timing-function: linear;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
.tool-bar {
|
|
1747
|
+
display: flex;
|
|
1748
|
+
flex-direction: row;
|
|
1749
|
+
align-items: center;
|
|
1750
|
+
border-radius: 12px;
|
|
1751
|
+
border-color: var(--ui-foreground-color);
|
|
1752
|
+
height: 48px;
|
|
1753
|
+
bottom: 12px;
|
|
1754
|
+
color: var(--ui-foreground-color);
|
|
1755
|
+
-webkit-tap-highlight-color: transparent;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
.tool-bar * {
|
|
1759
|
+
height: 100%;
|
|
1760
|
+
min-width: 48px;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
.tool-bar .divider {
|
|
1764
|
+
min-width: 1px;
|
|
1765
|
+
margin: 0px 6px;
|
|
1766
|
+
height: 66%;
|
|
1767
|
+
background-color: var(--ui-foreground-color);
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
.tool-bar select {
|
|
1771
|
+
background: none;
|
|
1772
|
+
min-width: 52px;
|
|
1773
|
+
max-width: 128px;
|
|
1774
|
+
border: 1px solid transparent;
|
|
1775
|
+
border-radius: inherit;
|
|
1776
|
+
color: inherit;
|
|
1777
|
+
font-size: 14px;
|
|
1778
|
+
padding: 0px 12px;
|
|
1779
|
+
cursor: pointer;
|
|
1780
|
+
outline: none;
|
|
1781
|
+
appearance: none; /* Remove default styling */
|
|
1782
|
+
-webkit-appearance: none; /* Remove default styling for Safari */
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
.tool-bar .select-container {
|
|
1786
|
+
position: relative;
|
|
1787
|
+
display: flex;
|
|
1788
|
+
border-radius: inherit;
|
|
1789
|
+
border-width: 0;
|
|
1790
|
+
padding: 0;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
.tool-bar .select-container select {
|
|
1794
|
+
position: absolute;
|
|
1795
|
+
min-width: 0;
|
|
1796
|
+
width: 100%;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
.tool-bar .select-container button {
|
|
1800
|
+
position: absolute;
|
|
1801
|
+
border-width: 0;
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
.tool-bar select:hover,
|
|
1805
|
+
.tool-bar select:focus {
|
|
1806
|
+
background-color: var(--ui-background-color-hover);
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
.tool-bar select option {
|
|
1810
|
+
background-color: var(--ui-background-color);
|
|
1811
|
+
color: var(--ui-foreground-color);
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
.tool-bar select:focus-visible {
|
|
1815
|
+
border-color: inherit;
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
.tool-bar button {
|
|
1819
|
+
background: none;
|
|
1820
|
+
border: 1px solid transparent;
|
|
1821
|
+
border-radius: inherit;
|
|
1822
|
+
color: inherit;
|
|
1823
|
+
padding: 0;
|
|
1824
|
+
cursor: pointer;
|
|
1825
|
+
outline: none;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
.tool-bar button:hover {
|
|
1829
|
+
background-color: var(--ui-background-color-hover);
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
.tool-bar button:focus-visible {
|
|
1833
|
+
border-color: inherit;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
.tool-bar button svg {
|
|
1837
|
+
width: 32px;
|
|
1838
|
+
height: 32px;
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
.animation-timeline {
|
|
1842
|
+
display: flex;
|
|
1843
|
+
flex: 1;
|
|
1844
|
+
position: relative;
|
|
1845
|
+
overflow: hidden;
|
|
1846
|
+
cursor: pointer;
|
|
1847
|
+
align-items: center;
|
|
1848
|
+
border-radius: inherit;
|
|
1849
|
+
border-color: inherit;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
.animation-timeline-input {
|
|
1853
|
+
-webkit-appearance: none;
|
|
1854
|
+
cursor: pointer;
|
|
1855
|
+
width: 100%;
|
|
1856
|
+
height: 100%;
|
|
1857
|
+
outline: none;
|
|
1858
|
+
border: 1px solid transparent;
|
|
1859
|
+
border-radius: inherit;
|
|
1860
|
+
padding: 0 12px;
|
|
1861
|
+
background-color: transparent;
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
.animation-timeline-input:focus-visible {
|
|
1865
|
+
border-color: inherit;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/*Chrome -webkit */
|
|
1869
|
+
|
|
1870
|
+
.animation-timeline-input::-webkit-slider-thumb {
|
|
1871
|
+
-webkit-appearance: none;
|
|
1872
|
+
width: 20px;
|
|
1873
|
+
height: 20px;
|
|
1874
|
+
border: 2px solid;
|
|
1875
|
+
color: var(--ui-foreground-color);
|
|
1876
|
+
border-radius: 50%;
|
|
1877
|
+
background: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), 1);
|
|
1878
|
+
margin-top: -10px;
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
.animation-timeline-input::-webkit-slider-runnable-track {
|
|
1882
|
+
height: 2px;
|
|
1883
|
+
-webkit-appearance: none;
|
|
1884
|
+
background-color: var(--ui-foreground-color);
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
/** FireFox -moz */
|
|
1888
|
+
|
|
1889
|
+
.animation-timeline-input::-moz-range-progress {
|
|
1890
|
+
height: 2px;
|
|
1891
|
+
background-color: var(--ui-foreground-color);
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
.animation-timeline-input::-moz-range-thumb {
|
|
1895
|
+
width: 16px;
|
|
1896
|
+
height: 16px;
|
|
1897
|
+
border: 2px solid var(--ui-foreground-color);
|
|
1898
|
+
border-radius: 50%;
|
|
1899
|
+
background: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), 1);
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
.animation-timeline-input::-moz-range-track {
|
|
1903
|
+
height: 2px;
|
|
1904
|
+
background: var(--ui-foreground-color);
|
|
1905
|
+
}
|
|
1906
|
+
`;
|
|
1907
|
+
__decorate([
|
|
1908
|
+
n({
|
|
1909
|
+
converter: (value) => {
|
|
1910
|
+
if (value === "WebGL" || value === "WebGPU") {
|
|
1911
|
+
return value;
|
|
1912
|
+
}
|
|
1913
|
+
return getDefaultEngine();
|
|
1914
|
+
},
|
|
1915
|
+
})
|
|
1916
|
+
], HTML3DElement.prototype, "engine", void 0);
|
|
1917
|
+
__decorate([
|
|
1918
|
+
n()
|
|
1919
|
+
], HTML3DElement.prototype, "source", void 0);
|
|
1920
|
+
__decorate([
|
|
1921
|
+
n()
|
|
1922
|
+
], HTML3DElement.prototype, "extension", void 0);
|
|
1923
|
+
__decorate([
|
|
1924
|
+
n({
|
|
1925
|
+
hasChanged: (newValue, oldValue) => {
|
|
1926
|
+
return newValue.lighting !== oldValue.lighting || newValue.skybox !== oldValue.skybox;
|
|
1927
|
+
},
|
|
1928
|
+
})
|
|
1929
|
+
], HTML3DElement.prototype, "environment", null);
|
|
1930
|
+
__decorate([
|
|
1931
|
+
n({ attribute: "environment-lighting" })
|
|
1932
|
+
], HTML3DElement.prototype, "environmentLighting", void 0);
|
|
1933
|
+
__decorate([
|
|
1934
|
+
n({ attribute: "environment-skybox" })
|
|
1935
|
+
], HTML3DElement.prototype, "environmentSkybox", void 0);
|
|
1936
|
+
__decorate([
|
|
1937
|
+
r()
|
|
1938
|
+
], HTML3DElement.prototype, "_loadingProgress", void 0);
|
|
1939
|
+
__decorate([
|
|
1940
|
+
n({ attribute: "skybox-blur" })
|
|
1941
|
+
], HTML3DElement.prototype, "skyboxBlur", void 0);
|
|
1942
|
+
__decorate([
|
|
1943
|
+
n({
|
|
1944
|
+
attribute: "tone-mapping",
|
|
1945
|
+
converter: (value) => {
|
|
1946
|
+
if (!value || !isToneMapping(value)) {
|
|
1947
|
+
return "neutral";
|
|
1948
|
+
}
|
|
1949
|
+
return value;
|
|
1950
|
+
},
|
|
1951
|
+
})
|
|
1952
|
+
], HTML3DElement.prototype, "toneMapping", void 0);
|
|
1953
|
+
__decorate([
|
|
1954
|
+
n()
|
|
1955
|
+
], HTML3DElement.prototype, "contrast", void 0);
|
|
1956
|
+
__decorate([
|
|
1957
|
+
n()
|
|
1958
|
+
], HTML3DElement.prototype, "exposure", void 0);
|
|
1959
|
+
__decorate([
|
|
1960
|
+
n({
|
|
1961
|
+
attribute: "clear-color",
|
|
1962
|
+
reflect: true,
|
|
1963
|
+
converter: {
|
|
1964
|
+
fromAttribute: parseColor,
|
|
1965
|
+
toAttribute: (color) => (color ? color.toHexString() : null),
|
|
1966
|
+
},
|
|
1967
|
+
})
|
|
1968
|
+
], HTML3DElement.prototype, "clearColor", void 0);
|
|
1969
|
+
__decorate([
|
|
1970
|
+
n({
|
|
1971
|
+
attribute: "camera-auto-orbit",
|
|
1972
|
+
type: Boolean,
|
|
1973
|
+
})
|
|
1974
|
+
], HTML3DElement.prototype, "cameraAutoOrbit", void 0);
|
|
1975
|
+
__decorate([
|
|
1976
|
+
n({
|
|
1977
|
+
attribute: "camera-auto-orbit-speed",
|
|
1978
|
+
type: Number,
|
|
1979
|
+
})
|
|
1980
|
+
], HTML3DElement.prototype, "cameraAutoOrbitSpeed", void 0);
|
|
1981
|
+
__decorate([
|
|
1982
|
+
n({
|
|
1983
|
+
attribute: "camera-auto-orbit-delay",
|
|
1984
|
+
type: Number,
|
|
1985
|
+
})
|
|
1986
|
+
], HTML3DElement.prototype, "cameraAutoOrbitDelay", void 0);
|
|
1987
|
+
__decorate([
|
|
1988
|
+
n({
|
|
1989
|
+
attribute: "camera-orbit",
|
|
1990
|
+
converter: (value) => {
|
|
1991
|
+
if (!value) {
|
|
1992
|
+
return null;
|
|
1993
|
+
}
|
|
1994
|
+
const array = value.split(/\s+/);
|
|
1995
|
+
if (array.length !== 3) {
|
|
1996
|
+
throw new Error("cameraOrbit should be defined as 'alpha beta radius'");
|
|
1997
|
+
}
|
|
1998
|
+
return (camera) => {
|
|
1999
|
+
for (const [index, property] of ["alpha", "beta", "radius"].entries()) {
|
|
2000
|
+
const value = array[index];
|
|
2001
|
+
if (value !== "auto") {
|
|
2002
|
+
camera[property] = Number(value);
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
};
|
|
2006
|
+
},
|
|
2007
|
+
})
|
|
2008
|
+
], HTML3DElement.prototype, "_cameraOrbitCoercer", void 0);
|
|
2009
|
+
__decorate([
|
|
2010
|
+
n({
|
|
2011
|
+
attribute: "camera-target",
|
|
2012
|
+
converter: (value) => {
|
|
2013
|
+
if (!value) {
|
|
2014
|
+
return null;
|
|
2015
|
+
}
|
|
2016
|
+
const array = value.split(/\s+/);
|
|
2017
|
+
if (array.length !== 3) {
|
|
2018
|
+
throw new Error("cameraTarget should be defined as 'x y z'");
|
|
2019
|
+
}
|
|
2020
|
+
return (camera) => {
|
|
2021
|
+
const target = camera.target;
|
|
2022
|
+
for (const [index, property] of ["x", "y", "z"].entries()) {
|
|
2023
|
+
const value = array[index];
|
|
2024
|
+
if (value !== "auto") {
|
|
2025
|
+
target[property] = Number(value);
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
camera.target = target.clone();
|
|
2029
|
+
};
|
|
2030
|
+
},
|
|
2031
|
+
})
|
|
2032
|
+
], HTML3DElement.prototype, "_cameraTargetCoercer", void 0);
|
|
2033
|
+
__decorate([
|
|
2034
|
+
n({
|
|
2035
|
+
attribute: "hotspots",
|
|
2036
|
+
converter: (value) => {
|
|
2037
|
+
if (!value) {
|
|
2038
|
+
return {};
|
|
2039
|
+
}
|
|
2040
|
+
return JSON.parse(value);
|
|
2041
|
+
},
|
|
2042
|
+
})
|
|
2043
|
+
], HTML3DElement.prototype, "hotSpots", void 0);
|
|
2044
|
+
__decorate([
|
|
2045
|
+
n({ attribute: "animation-auto-play", reflect: true, type: Boolean })
|
|
2046
|
+
], HTML3DElement.prototype, "animationAutoPlay", void 0);
|
|
2047
|
+
__decorate([
|
|
2048
|
+
n({ attribute: "selected-animation", type: Number })
|
|
2049
|
+
], HTML3DElement.prototype, "selectedAnimation", void 0);
|
|
2050
|
+
__decorate([
|
|
2051
|
+
n({ attribute: "animation-speed" })
|
|
2052
|
+
], HTML3DElement.prototype, "animationSpeed", void 0);
|
|
2053
|
+
__decorate([
|
|
2054
|
+
n({ attribute: false })
|
|
2055
|
+
], HTML3DElement.prototype, "animationProgress", void 0);
|
|
2056
|
+
__decorate([
|
|
2057
|
+
r()
|
|
2058
|
+
], HTML3DElement.prototype, "_animations", void 0);
|
|
2059
|
+
__decorate([
|
|
2060
|
+
r()
|
|
2061
|
+
], HTML3DElement.prototype, "_isAnimationPlaying", void 0);
|
|
2062
|
+
__decorate([
|
|
2063
|
+
n({ attribute: "material-variant" })
|
|
2064
|
+
], HTML3DElement.prototype, "selectedMaterialVariant", void 0);
|
|
2065
|
+
__decorate([
|
|
2066
|
+
e("#canvasContainer")
|
|
2067
|
+
], HTML3DElement.prototype, "_canvasContainer", void 0);
|
|
2068
|
+
__decorate([
|
|
2069
|
+
e("#materialSelect")
|
|
2070
|
+
], HTML3DElement.prototype, "_materialSelect", void 0);
|
|
2071
|
+
HTML3DElement = HTML3DElement_1 = __decorate([
|
|
2072
|
+
t("babylon-viewer")
|
|
2073
|
+
], HTML3DElement);
|
|
2074
|
+
|
|
2075
|
+
/**
|
|
2076
|
+
* Displays child elements at the screen space location of a hotspot in a babylon-viewer.
|
|
2077
|
+
* @remarks
|
|
2078
|
+
* The babylon-viewer-annotation element must be a child of a babylon-viewer element.
|
|
2079
|
+
*/
|
|
2080
|
+
let HTML3DAnnotationElement = class HTML3DAnnotationElement extends r$2 {
|
|
2081
|
+
constructor() {
|
|
2082
|
+
super(...arguments);
|
|
2083
|
+
this._internals = this.attachInternals();
|
|
2084
|
+
this._viewerAttachment = null;
|
|
2085
|
+
/**
|
|
2086
|
+
* The name of the hotspot to track.
|
|
2087
|
+
*/
|
|
2088
|
+
this.hotSpot = "";
|
|
2089
|
+
}
|
|
2090
|
+
/** @internal */
|
|
2091
|
+
connectedCallback() {
|
|
2092
|
+
super.connectedCallback();
|
|
2093
|
+
this._internals.states?.add("invalid");
|
|
2094
|
+
if (!(this.parentElement instanceof HTML3DElement)) {
|
|
2095
|
+
// eslint-disable-next-line no-console
|
|
2096
|
+
console.warn("The babylon-viewer-annotation element must be a child of a babylon-viewer element.");
|
|
2097
|
+
return;
|
|
2098
|
+
}
|
|
2099
|
+
const viewerElement = this.parentElement;
|
|
2100
|
+
const hotSpotResult = new ViewerHotSpotResult();
|
|
2101
|
+
const onViewerRendered = () => {
|
|
2102
|
+
if (this.hotSpot) {
|
|
2103
|
+
if (viewerElement.queryHotSpot(this.hotSpot, hotSpotResult)) {
|
|
2104
|
+
const [screenX, screenY] = hotSpotResult.screenPosition;
|
|
2105
|
+
this.style.transform = `translate(${screenX}px, ${screenY}px)`;
|
|
2106
|
+
this._internals.states?.delete("invalid");
|
|
2107
|
+
if (hotSpotResult.visibility <= 0) {
|
|
2108
|
+
this._internals.states?.add("back-facing");
|
|
2109
|
+
}
|
|
2110
|
+
else {
|
|
2111
|
+
this._internals.states?.delete("back-facing");
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
else {
|
|
2115
|
+
this._internals.states?.add("invalid");
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
};
|
|
2119
|
+
viewerElement.addEventListener("viewerrender", onViewerRendered);
|
|
2120
|
+
this._viewerAttachment = {
|
|
2121
|
+
dispose() {
|
|
2122
|
+
viewerElement.removeEventListener("viewerrender", onViewerRendered);
|
|
2123
|
+
},
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
2126
|
+
/** @internal */
|
|
2127
|
+
disconnectedCallback() {
|
|
2128
|
+
super.disconnectedCallback();
|
|
2129
|
+
this._viewerAttachment?.dispose();
|
|
2130
|
+
this._viewerAttachment = null;
|
|
2131
|
+
this._internals.states?.add("invalid");
|
|
2132
|
+
}
|
|
2133
|
+
/** @internal */
|
|
2134
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2135
|
+
render() {
|
|
2136
|
+
return x ` <slot></slot> `;
|
|
2137
|
+
}
|
|
2138
|
+
};
|
|
2139
|
+
/** @internal */
|
|
2140
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2141
|
+
HTML3DAnnotationElement.styles = i$3 `
|
|
2142
|
+
:host {
|
|
2143
|
+
display: inline-block;
|
|
2144
|
+
position: absolute;
|
|
2145
|
+
transition: opacity 0.25s;
|
|
2146
|
+
}
|
|
2147
|
+
:host([hidden]) {
|
|
2148
|
+
display: none;
|
|
2149
|
+
}
|
|
2150
|
+
:host(:state(back-facing)) {
|
|
2151
|
+
opacity: 0.2;
|
|
2152
|
+
}
|
|
2153
|
+
:host(:state(invalid)) {
|
|
2154
|
+
display: none;
|
|
2155
|
+
}
|
|
2156
|
+
`;
|
|
2157
|
+
__decorate([
|
|
2158
|
+
n({ attribute: "hotspot" })
|
|
2159
|
+
], HTML3DAnnotationElement.prototype, "hotSpot", void 0);
|
|
2160
|
+
HTML3DAnnotationElement = __decorate([
|
|
2161
|
+
t("babylon-viewer-annotation")
|
|
2162
|
+
], HTML3DAnnotationElement);
|
|
2163
|
+
|
|
2164
|
+
export { HTML3DAnnotationElement, HTML3DElement, Viewer, ViewerHotSpotResult, createViewerForCanvas };
|
|
2165
|
+
//# sourceMappingURL=index.js.map
|