@babylonjs/viewer 7.40.1-alpha → 7.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configuration/configuration.d.ts +107 -0
- package/configuration/configuration.js +16 -0
- package/configuration/configuration.js.map +1 -0
- package/configuration/configurationCompatibility.d.ts +8 -0
- package/configuration/configurationCompatibility.js +66 -0
- package/configuration/configurationCompatibility.js.map +1 -0
- package/configuration/configurationContainer.d.ts +10 -0
- package/configuration/configurationContainer.js +10 -0
- package/configuration/configurationContainer.js.map +1 -0
- package/configuration/globals.d.ts +6 -0
- package/configuration/globals.js +18 -0
- package/configuration/globals.js.map +1 -0
- package/configuration/index.d.ts +2 -0
- package/configuration/index.js +4 -0
- package/configuration/index.js.map +1 -0
- package/configuration/interfaces/cameraConfiguration.d.ts +31 -0
- package/configuration/interfaces/cameraConfiguration.js +2 -0
- package/configuration/interfaces/cameraConfiguration.js.map +1 -0
- package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -0
- package/configuration/interfaces/colorGradingConfiguration.js +2 -0
- package/configuration/interfaces/colorGradingConfiguration.js.map +1 -0
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -0
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +2 -0
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +1 -0
- package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -0
- package/configuration/interfaces/environmentMapConfiguration.js +2 -0
- package/configuration/interfaces/environmentMapConfiguration.js.map +1 -0
- package/configuration/interfaces/groundConfiguration.d.ts +24 -0
- package/configuration/interfaces/groundConfiguration.js +2 -0
- package/configuration/interfaces/groundConfiguration.js.map +1 -0
- package/configuration/interfaces/imageProcessingConfiguration.d.ts +45 -0
- package/configuration/interfaces/imageProcessingConfiguration.js +2 -0
- package/configuration/interfaces/imageProcessingConfiguration.js.map +1 -0
- package/configuration/interfaces/index.d.ts +15 -0
- package/configuration/interfaces/index.js +16 -0
- package/configuration/interfaces/index.js.map +1 -0
- package/configuration/interfaces/lightConfiguration.d.ts +60 -0
- package/configuration/interfaces/lightConfiguration.js +2 -0
- package/configuration/interfaces/lightConfiguration.js.map +1 -0
- package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -0
- package/configuration/interfaces/modelAnimationConfiguration.js +2 -0
- package/configuration/interfaces/modelAnimationConfiguration.js.map +1 -0
- package/configuration/interfaces/modelConfiguration.d.ts +65 -0
- package/configuration/interfaces/modelConfiguration.js +2 -0
- package/configuration/interfaces/modelConfiguration.js.map +1 -0
- package/configuration/interfaces/observersConfiguration.d.ts +5 -0
- package/configuration/interfaces/observersConfiguration.js +2 -0
- package/configuration/interfaces/observersConfiguration.js.map +1 -0
- package/configuration/interfaces/sceneConfiguration.d.ts +48 -0
- package/configuration/interfaces/sceneConfiguration.js +2 -0
- package/configuration/interfaces/sceneConfiguration.js.map +1 -0
- package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -0
- package/configuration/interfaces/sceneOptimizerConfiguration.js +2 -0
- package/configuration/interfaces/sceneOptimizerConfiguration.js.map +1 -0
- package/configuration/interfaces/skyboxConfiguration.d.ts +21 -0
- package/configuration/interfaces/skyboxConfiguration.js +2 -0
- package/configuration/interfaces/skyboxConfiguration.js.map +1 -0
- package/configuration/interfaces/templateConfiguration.d.ts +67 -0
- package/configuration/interfaces/templateConfiguration.js +2 -0
- package/configuration/interfaces/templateConfiguration.js.map +1 -0
- package/configuration/interfaces/vrConfiguration.d.ts +16 -0
- package/configuration/interfaces/vrConfiguration.js +2 -0
- package/configuration/interfaces/vrConfiguration.js.map +1 -0
- package/configuration/loader.d.ts +4 -0
- package/configuration/loader.js +17 -0
- package/configuration/loader.js.map +1 -0
- package/configuration/mappers.d.ts +43 -0
- package/configuration/mappers.js +193 -0
- package/configuration/mappers.js.map +1 -0
- package/configuration/renderOnlyLoader.d.ts +33 -0
- package/configuration/renderOnlyLoader.js +162 -0
- package/configuration/renderOnlyLoader.js.map +1 -0
- package/configuration/types/default.d.ts +6 -0
- package/configuration/types/default.js +121 -0
- package/configuration/types/default.js.map +1 -0
- package/configuration/types/environmentMap.d.ts +5 -0
- package/configuration/types/environmentMap.js +14 -0
- package/configuration/types/environmentMap.js.map +1 -0
- package/configuration/types/extended.d.ts +6 -0
- package/configuration/types/extended.js +317 -0
- package/configuration/types/extended.js.map +1 -0
- package/configuration/types/index.d.ts +14 -0
- package/configuration/types/index.js +51 -0
- package/configuration/types/index.js.map +1 -0
- package/configuration/types/minimal.d.ts +6 -0
- package/configuration/types/minimal.js +43 -0
- package/configuration/types/minimal.js.map +1 -0
- package/configuration/types/renderOnlyDefault.d.ts +30 -0
- package/configuration/types/renderOnlyDefault.js +31 -0
- package/configuration/types/renderOnlyDefault.js.map +1 -0
- package/configuration/types/shadowLight.d.ts +9 -0
- package/configuration/types/shadowLight.js +64 -0
- package/configuration/types/shadowLight.js.map +1 -0
- package/helper/index.d.ts +29 -0
- package/helper/index.js +66 -0
- package/helper/index.js.map +1 -0
- package/index.d.ts +30 -0
- package/index.js +46 -0
- package/index.js.map +1 -0
- package/initializer.d.ts +11 -0
- package/initializer.js +35 -0
- package/initializer.js.map +1 -0
- package/interfaces.d.ts +5 -0
- package/interfaces.js +7 -0
- package/interfaces.js.map +1 -0
- package/labs/environmentSerializer.d.ts +126 -0
- package/labs/environmentSerializer.js +191 -0
- package/labs/environmentSerializer.js.map +1 -0
- package/labs/texture.d.ts +183 -0
- package/labs/texture.js +351 -0
- package/labs/texture.js.map +1 -0
- package/labs/viewerLabs.d.ts +51 -0
- package/labs/viewerLabs.js +134 -0
- package/labs/viewerLabs.js.map +1 -0
- package/loader/modelLoader.d.ts +56 -0
- package/loader/modelLoader.js +202 -0
- package/loader/modelLoader.js.map +1 -0
- package/loader/plugins/applyMaterialConfig.d.ts +12 -0
- package/loader/plugins/applyMaterialConfig.js +16 -0
- package/loader/plugins/applyMaterialConfig.js.map +1 -0
- package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -0
- package/loader/plugins/extendedMaterialLoaderPlugin.js +16 -0
- package/loader/plugins/extendedMaterialLoaderPlugin.js.map +1 -0
- package/loader/plugins/index.d.ts +19 -0
- package/loader/plugins/index.js +44 -0
- package/loader/plugins/index.js.map +1 -0
- package/loader/plugins/loaderPlugin.d.ts +24 -0
- package/loader/plugins/loaderPlugin.js +2 -0
- package/loader/plugins/loaderPlugin.js.map +1 -0
- package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -0
- package/loader/plugins/msftLodLoaderPlugin.js +21 -0
- package/loader/plugins/msftLodLoaderPlugin.js.map +1 -0
- package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -0
- package/loader/plugins/telemetryLoaderPlugin.js +36 -0
- package/loader/plugins/telemetryLoaderPlugin.js.map +1 -0
- package/managers/observablesManager.d.ts +66 -0
- package/managers/observablesManager.js +35 -0
- package/managers/observablesManager.js.map +1 -0
- package/managers/sceneManager.d.ts +245 -0
- package/managers/sceneManager.js +1375 -0
- package/managers/sceneManager.js.map +1 -0
- package/managers/telemetryManager.d.ts +78 -0
- package/managers/telemetryManager.js +117 -0
- package/managers/telemetryManager.js.map +1 -0
- package/model/modelAnimation.d.ts +215 -0
- package/model/modelAnimation.js +237 -0
- package/model/modelAnimation.js.map +1 -0
- package/model/viewerModel.d.ts +233 -0
- package/model/viewerModel.js +673 -0
- package/model/viewerModel.js.map +1 -0
- package/optimizer/custom/extended.d.ts +13 -0
- package/optimizer/custom/extended.js +101 -0
- package/optimizer/custom/extended.js.map +1 -0
- package/optimizer/custom/index.d.ts +9 -0
- package/optimizer/custom/index.js +26 -0
- package/optimizer/custom/index.js.map +1 -0
- package/package.json +28 -19
- package/readme.md +28 -28
- package/renderOnlyIndex.d.ts +11 -0
- package/renderOnlyIndex.js +18 -0
- package/renderOnlyIndex.js.map +1 -0
- package/templating/eventManager.d.ts +35 -0
- package/templating/eventManager.js +66 -0
- package/templating/eventManager.js.map +1 -0
- package/templating/plugins/hdButtonPlugin.d.ts +9 -0
- package/templating/plugins/hdButtonPlugin.js +22 -0
- package/templating/plugins/hdButtonPlugin.js.map +1 -0
- package/templating/plugins/printButton.d.ts +9 -0
- package/templating/plugins/printButton.js +41 -0
- package/templating/plugins/printButton.js.map +1 -0
- package/templating/templateManager.d.ts +197 -0
- package/templating/templateManager.js +561 -0
- package/templating/templateManager.js.map +1 -0
- package/templating/viewerTemplatePlugin.d.ts +21 -0
- package/templating/viewerTemplatePlugin.js +69 -0
- package/templating/viewerTemplatePlugin.js.map +1 -0
- package/viewer/defaultViewer.d.ts +130 -0
- package/viewer/defaultViewer.js +672 -0
- package/viewer/defaultViewer.js.map +1 -0
- package/viewer/renderOnlyViewer.d.ts +9 -0
- package/viewer/renderOnlyViewer.js +46 -0
- package/viewer/renderOnlyViewer.js.map +1 -0
- package/viewer/viewer.d.ts +258 -0
- package/viewer/viewer.js +783 -0
- package/viewer/viewer.js.map +1 -0
- package/viewer/viewerManager.d.ts +58 -0
- package/viewer/viewerManager.js +91 -0
- package/viewer/viewerManager.js.map +1 -0
- package/viewer/viewerWithTemplate.d.ts +9 -0
- package/viewer/viewerWithTemplate.js +20 -0
- package/viewer/viewerWithTemplate.js.map +1 -0
- package/assets/photoStudio.env +0 -0
- package/dist/babylon-viewer.esm.js +0 -2
- package/dist/babylon-viewer.esm.js.map +0 -1
- package/dist/babylon-viewer.esm.min.js +0 -2
- package/dist/babylon-viewer.esm.min.js.map +0 -1
- package/dist/chunks/EXT_lights_ies-gxFyrTPG.esm.min.js +0 -2
- package/dist/chunks/EXT_lights_ies-gxFyrTPG.esm.min.js.map +0 -1
- package/dist/chunks/EXT_lights_ies-pE68tmBj.esm.js +0 -84
- package/dist/chunks/EXT_lights_ies-pE68tmBj.esm.js.map +0 -1
- package/dist/chunks/EXT_lights_image_based-B8Oal0Ur.esm.min.js +0 -2
- package/dist/chunks/EXT_lights_image_based-B8Oal0Ur.esm.min.js.map +0 -1
- package/dist/chunks/EXT_lights_image_based-CmP_ZGlF.esm.js +0 -171
- package/dist/chunks/EXT_lights_image_based-CmP_ZGlF.esm.js.map +0 -1
- package/dist/chunks/EXT_mesh_gpu_instancing-DSFpOud_.esm.min.js +0 -2
- package/dist/chunks/EXT_mesh_gpu_instancing-DSFpOud_.esm.min.js.map +0 -1
- package/dist/chunks/EXT_mesh_gpu_instancing-DksAVeyV.esm.js +0 -86
- package/dist/chunks/EXT_mesh_gpu_instancing-DksAVeyV.esm.js.map +0 -1
- package/dist/chunks/EXT_meshopt_compression-CNUItnkN.esm.min.js +0 -2
- package/dist/chunks/EXT_meshopt_compression-CNUItnkN.esm.min.js.map +0 -1
- package/dist/chunks/EXT_meshopt_compression-CeM-AELC.esm.js +0 -134
- package/dist/chunks/EXT_meshopt_compression-CeM-AELC.esm.js.map +0 -1
- package/dist/chunks/EXT_texture_avif-BWOJV_Yf.esm.js +0 -44
- package/dist/chunks/EXT_texture_avif-BWOJV_Yf.esm.js.map +0 -1
- package/dist/chunks/EXT_texture_avif-CSTfqZHT.esm.min.js +0 -2
- package/dist/chunks/EXT_texture_avif-CSTfqZHT.esm.min.js.map +0 -1
- package/dist/chunks/EXT_texture_webp-4Pxv5jC9.esm.min.js +0 -2
- package/dist/chunks/EXT_texture_webp-4Pxv5jC9.esm.min.js.map +0 -1
- package/dist/chunks/EXT_texture_webp-C9og1YZL.esm.js +0 -43
- package/dist/chunks/EXT_texture_webp-C9og1YZL.esm.js.map +0 -1
- package/dist/chunks/ExtrasAsMetadata-BmFy6ZgN.esm.js +0 -64
- package/dist/chunks/ExtrasAsMetadata-BmFy6ZgN.esm.js.map +0 -1
- package/dist/chunks/ExtrasAsMetadata-BwYwFtj7.esm.min.js +0 -2
- package/dist/chunks/ExtrasAsMetadata-BwYwFtj7.esm.min.js.map +0 -1
- package/dist/chunks/KHR_animation_pointer-BM2iOlKg.esm.js +0 -352
- package/dist/chunks/KHR_animation_pointer-BM2iOlKg.esm.js.map +0 -1
- package/dist/chunks/KHR_animation_pointer-C7FvhqL3.esm.min.js +0 -2
- package/dist/chunks/KHR_animation_pointer-C7FvhqL3.esm.min.js.map +0 -1
- package/dist/chunks/KHR_draco_mesh_compression-BocaEHGh.esm.js +0 -617
- package/dist/chunks/KHR_draco_mesh_compression-BocaEHGh.esm.js.map +0 -1
- package/dist/chunks/KHR_draco_mesh_compression-CjRCmIUz.esm.min.js +0 -2
- package/dist/chunks/KHR_draco_mesh_compression-CjRCmIUz.esm.min.js.map +0 -1
- package/dist/chunks/KHR_interactivity-C_ndoQHo.esm.min.js +0 -2
- package/dist/chunks/KHR_interactivity-C_ndoQHo.esm.min.js.map +0 -1
- package/dist/chunks/KHR_interactivity-ClHXW_8S.esm.js +0 -4033
- package/dist/chunks/KHR_interactivity-ClHXW_8S.esm.js.map +0 -1
- package/dist/chunks/KHR_lights_punctual-D0u7ZFj4.esm.js +0 -581
- package/dist/chunks/KHR_lights_punctual-D0u7ZFj4.esm.js.map +0 -1
- package/dist/chunks/KHR_lights_punctual-Z509RdIo.esm.min.js +0 -2
- package/dist/chunks/KHR_lights_punctual-Z509RdIo.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_anisotropy-Dz4vBqG3.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_anisotropy-Dz4vBqG3.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_anisotropy-VuLS4v3P.esm.js +0 -65
- package/dist/chunks/KHR_materials_anisotropy-VuLS4v3P.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_clearcoat-DM7vCrC3.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_clearcoat-DM7vCrC3.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_clearcoat-Dt0nQ5Ky.esm.js +0 -96
- package/dist/chunks/KHR_materials_clearcoat-Dt0nQ5Ky.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_diffuse_transmission-1Pa4ScwD.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_diffuse_transmission-1Pa4ScwD.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_diffuse_transmission-DIUHVeOQ.esm.js +0 -97
- package/dist/chunks/KHR_materials_diffuse_transmission-DIUHVeOQ.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_dispersion-CMpGZsUw.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_dispersion-CMpGZsUw.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_dispersion-CeSj8nUI.esm.js +0 -62
- package/dist/chunks/KHR_materials_dispersion-CeSj8nUI.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_emissive_strength-CQQX31qK.esm.js +0 -55
- package/dist/chunks/KHR_materials_emissive_strength-CQQX31qK.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_emissive_strength-DH4A4kIp.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_emissive_strength-DH4A4kIp.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_ior-BTU1gw-j.esm.js +0 -64
- package/dist/chunks/KHR_materials_ior-BTU1gw-j.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_ior-DyzPdK6b.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_ior-DyzPdK6b.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_iridescence-8ZgbULX5.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_iridescence-8ZgbULX5.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_iridescence-D2HCEadq.esm.js +0 -72
- package/dist/chunks/KHR_materials_iridescence-D2HCEadq.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-C4K79VpA.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-C4K79VpA.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DtJVJ-gl.esm.js +0 -81
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DtJVJ-gl.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_sheen-CT4KjW_v.esm.js +0 -85
- package/dist/chunks/KHR_materials_sheen-CT4KjW_v.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_sheen-DQt5abo-.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_sheen-DQt5abo-.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_specular-CCvL1awH.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_specular-CCvL1awH.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_specular-CgLKBQCa.esm.js +0 -75
- package/dist/chunks/KHR_materials_specular-CgLKBQCa.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_transmission-B64oDwox.esm.js +0 -307
- package/dist/chunks/KHR_materials_transmission-B64oDwox.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_transmission-C6yPYKde.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_transmission-C6yPYKde.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_unlit-BGPDq328.esm.js +0 -74
- package/dist/chunks/KHR_materials_unlit-BGPDq328.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_unlit-Sz3qCEGr.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_unlit-Sz3qCEGr.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_variants-Cqw7xft3.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_variants-Cqw7xft3.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_variants-D7rYTNoB.esm.js +0 -262
- package/dist/chunks/KHR_materials_variants-D7rYTNoB.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_volume-BBsNt0LM.esm.js +0 -87
- package/dist/chunks/KHR_materials_volume-BBsNt0LM.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_volume-DfWO7kG_.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_volume-DfWO7kG_.esm.min.js.map +0 -1
- package/dist/chunks/KHR_mesh_quantization-BiDGkiGh.esm.min.js +0 -2
- package/dist/chunks/KHR_mesh_quantization-BiDGkiGh.esm.min.js.map +0 -1
- package/dist/chunks/KHR_mesh_quantization-fE1qitjF.esm.js +0 -26
- package/dist/chunks/KHR_mesh_quantization-fE1qitjF.esm.js.map +0 -1
- package/dist/chunks/KHR_node_hoverability-DaOK-Y48.esm.min.js +0 -2
- package/dist/chunks/KHR_node_hoverability-DaOK-Y48.esm.min.js.map +0 -1
- package/dist/chunks/KHR_node_hoverability-glogCdHq.esm.js +0 -39
- package/dist/chunks/KHR_node_hoverability-glogCdHq.esm.js.map +0 -1
- package/dist/chunks/KHR_node_visibility-BCVXn2la.esm.min.js +0 -2
- package/dist/chunks/KHR_node_visibility-BCVXn2la.esm.min.js.map +0 -1
- package/dist/chunks/KHR_node_visibility-CCfVtnan.esm.js +0 -46
- package/dist/chunks/KHR_node_visibility-CCfVtnan.esm.js.map +0 -1
- package/dist/chunks/KHR_texture_basisu-_cpZJuOo.esm.min.js +0 -2
- package/dist/chunks/KHR_texture_basisu-_cpZJuOo.esm.min.js.map +0 -1
- package/dist/chunks/KHR_texture_basisu-nhRrTq0b.esm.js +0 -43
- package/dist/chunks/KHR_texture_basisu-nhRrTq0b.esm.js.map +0 -1
- package/dist/chunks/KHR_texture_transform-AgI_J0Ru.esm.js +0 -63
- package/dist/chunks/KHR_texture_transform-AgI_J0Ru.esm.js.map +0 -1
- package/dist/chunks/KHR_texture_transform-CgcA7bhJ.esm.min.js +0 -2
- package/dist/chunks/KHR_texture_transform-CgcA7bhJ.esm.min.js.map +0 -1
- package/dist/chunks/KHR_xmp_json_ld-C37VZwlU.esm.min.js +0 -2
- package/dist/chunks/KHR_xmp_json_ld-C37VZwlU.esm.min.js.map +0 -1
- package/dist/chunks/KHR_xmp_json_ld-Cm4z6qFH.esm.js +0 -51
- package/dist/chunks/KHR_xmp_json_ld-Cm4z6qFH.esm.js.map +0 -1
- package/dist/chunks/MSFT_audio_emitter-4EFTMS8D.esm.js +0 -2207
- package/dist/chunks/MSFT_audio_emitter-4EFTMS8D.esm.js.map +0 -1
- package/dist/chunks/MSFT_audio_emitter-Czn1DAbD.esm.min.js +0 -2
- package/dist/chunks/MSFT_audio_emitter-Czn1DAbD.esm.min.js.map +0 -1
- package/dist/chunks/MSFT_lod-Bn4FnO5A.esm.js +0 -337
- package/dist/chunks/MSFT_lod-Bn4FnO5A.esm.js.map +0 -1
- package/dist/chunks/MSFT_lod-DDB-SKXR.esm.min.js +0 -2
- package/dist/chunks/MSFT_lod-DDB-SKXR.esm.min.js.map +0 -1
- package/dist/chunks/MSFT_minecraftMesh-APRwcxWb.esm.min.js +0 -2
- package/dist/chunks/MSFT_minecraftMesh-APRwcxWb.esm.min.js.map +0 -1
- package/dist/chunks/MSFT_minecraftMesh-DPvby_FZ.esm.js +0 -46
- package/dist/chunks/MSFT_minecraftMesh-DPvby_FZ.esm.js.map +0 -1
- package/dist/chunks/MSFT_sRGBFactors-D33sXFGi.esm.js +0 -47
- package/dist/chunks/MSFT_sRGBFactors-D33sXFGi.esm.js.map +0 -1
- package/dist/chunks/MSFT_sRGBFactors-OsUqZSue.esm.min.js +0 -2
- package/dist/chunks/MSFT_sRGBFactors-OsUqZSue.esm.min.js.map +0 -1
- package/dist/chunks/animationGroup-BR3zskS8.esm.js +0 -2482
- package/dist/chunks/animationGroup-BR3zskS8.esm.js.map +0 -1
- package/dist/chunks/animationGroup-ChIp5GuO.esm.min.js +0 -2
- package/dist/chunks/animationGroup-ChIp5GuO.esm.min.js.map +0 -1
- package/dist/chunks/assetContainer-DLSDgjTx.esm.min.js +0 -2
- package/dist/chunks/assetContainer-DLSDgjTx.esm.min.js.map +0 -1
- package/dist/chunks/assetContainer-cm8rvay3.esm.js +0 -1720
- package/dist/chunks/assetContainer-cm8rvay3.esm.js.map +0 -1
- package/dist/chunks/audioEngine-Cx5dB73O.esm.js +0 -305
- package/dist/chunks/audioEngine-Cx5dB73O.esm.js.map +0 -1
- package/dist/chunks/audioEngine-hKZ2m0jY.esm.min.js +0 -2
- package/dist/chunks/audioEngine-hKZ2m0jY.esm.min.js.map +0 -1
- package/dist/chunks/bakedVertexAnimation-BCUFE4CP.esm.min.js +0 -2
- package/dist/chunks/bakedVertexAnimation-BCUFE4CP.esm.min.js.map +0 -1
- package/dist/chunks/bakedVertexAnimation-ByPKjjzz.esm.js +0 -114
- package/dist/chunks/bakedVertexAnimation-ByPKjjzz.esm.js.map +0 -1
- package/dist/chunks/basisTextureLoader-BIqCbGFg.esm.min.js +0 -2
- package/dist/chunks/basisTextureLoader-BIqCbGFg.esm.min.js.map +0 -1
- package/dist/chunks/basisTextureLoader-CT8X4ynA.esm.js +0 -600
- package/dist/chunks/basisTextureLoader-CT8X4ynA.esm.js.map +0 -1
- package/dist/chunks/dds-BDOPTCsA.esm.min.js +0 -2
- package/dist/chunks/dds-BDOPTCsA.esm.min.js.map +0 -1
- package/dist/chunks/dds-BYrGO6eI.esm.js +0 -540
- package/dist/chunks/dds-BYrGO6eI.esm.js.map +0 -1
- package/dist/chunks/ddsTextureLoader-BbrffKmM.esm.min.js +0 -2
- package/dist/chunks/ddsTextureLoader-BbrffKmM.esm.min.js.map +0 -1
- package/dist/chunks/ddsTextureLoader-C36kkIBH.esm.js +0 -88
- package/dist/chunks/ddsTextureLoader-C36kkIBH.esm.js.map +0 -1
- package/dist/chunks/decalFragment-07cq9QvS.esm.min.js +0 -2
- package/dist/chunks/decalFragment-07cq9QvS.esm.min.js.map +0 -1
- package/dist/chunks/decalFragment-B16Nfnl3.esm.js +0 -18
- package/dist/chunks/decalFragment-B16Nfnl3.esm.js.map +0 -1
- package/dist/chunks/default.fragment-BkjbMxBE.esm.min.js +0 -2
- package/dist/chunks/default.fragment-BkjbMxBE.esm.min.js.map +0 -1
- package/dist/chunks/default.fragment-C-8jVS2k.esm.min.js +0 -2
- package/dist/chunks/default.fragment-C-8jVS2k.esm.min.js.map +0 -1
- package/dist/chunks/default.fragment-C3Pectqi.esm.js +0 -515
- package/dist/chunks/default.fragment-C3Pectqi.esm.js.map +0 -1
- package/dist/chunks/default.fragment-D3LhG5le.esm.js +0 -446
- package/dist/chunks/default.fragment-D3LhG5le.esm.js.map +0 -1
- package/dist/chunks/default.vertex-CPx_2Z0S.esm.js +0 -181
- package/dist/chunks/default.vertex-CPx_2Z0S.esm.js.map +0 -1
- package/dist/chunks/default.vertex-CVMUuXku.esm.js +0 -202
- package/dist/chunks/default.vertex-CVMUuXku.esm.js.map +0 -1
- package/dist/chunks/default.vertex-CbVQZVXB.esm.min.js +0 -2
- package/dist/chunks/default.vertex-CbVQZVXB.esm.min.js.map +0 -1
- package/dist/chunks/default.vertex-S3Wv9p0Q.esm.min.js +0 -2
- package/dist/chunks/default.vertex-S3Wv9p0Q.esm.min.js.map +0 -1
- package/dist/chunks/defaultUboDeclaration-BdxOUPT0.esm.min.js +0 -2
- package/dist/chunks/defaultUboDeclaration-BdxOUPT0.esm.min.js.map +0 -1
- package/dist/chunks/defaultUboDeclaration-CUaZKOKG.esm.min.js +0 -2
- package/dist/chunks/defaultUboDeclaration-CUaZKOKG.esm.min.js.map +0 -1
- package/dist/chunks/defaultUboDeclaration-DdcmVbYg.esm.js +0 -15
- package/dist/chunks/defaultUboDeclaration-DdcmVbYg.esm.js.map +0 -1
- package/dist/chunks/defaultUboDeclaration-rLhenj1H.esm.js +0 -13
- package/dist/chunks/defaultUboDeclaration-rLhenj1H.esm.js.map +0 -1
- package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js +0 -11
- package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js.map +0 -1
- package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js +0 -2
- package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js.map +0 -1
- package/dist/chunks/dumpTools-CPmY0U7D.esm.js +0 -200
- package/dist/chunks/dumpTools-CPmY0U7D.esm.js.map +0 -1
- package/dist/chunks/dumpTools-DVDwJ2sz.esm.min.js +0 -2
- package/dist/chunks/dumpTools-DVDwJ2sz.esm.min.js.map +0 -1
- package/dist/chunks/engine-BqSrdURz.esm.min.js +0 -2
- package/dist/chunks/engine-BqSrdURz.esm.min.js.map +0 -1
- package/dist/chunks/engine-D_GgT2Nf.esm.js +0 -2216
- package/dist/chunks/engine-D_GgT2Nf.esm.js.map +0 -1
- package/dist/chunks/engine.common-CN1Lug5p.esm.js +0 -1162
- package/dist/chunks/engine.common-CN1Lug5p.esm.js.map +0 -1
- package/dist/chunks/engine.common-DgiXKhLy.esm.min.js +0 -2
- package/dist/chunks/engine.common-DgiXKhLy.esm.min.js.map +0 -1
- package/dist/chunks/envTextureLoader-BORNR9vu.esm.min.js +0 -2
- package/dist/chunks/envTextureLoader-BORNR9vu.esm.min.js.map +0 -1
- package/dist/chunks/envTextureLoader-DHwsXTfw.esm.js +0 -64
- package/dist/chunks/envTextureLoader-DHwsXTfw.esm.js.map +0 -1
- package/dist/chunks/environmentTextureTools-B2vnsFq-.esm.js +0 -382
- package/dist/chunks/environmentTextureTools-B2vnsFq-.esm.js.map +0 -1
- package/dist/chunks/environmentTextureTools-BYQHZH-c.esm.min.js +0 -2
- package/dist/chunks/environmentTextureTools-BYQHZH-c.esm.min.js.map +0 -1
- package/dist/chunks/exrTextureLoader-B8FQohBr.esm.js +0 -1683
- package/dist/chunks/exrTextureLoader-B8FQohBr.esm.js.map +0 -1
- package/dist/chunks/exrTextureLoader-D8xP0GLQ.esm.min.js +0 -2
- package/dist/chunks/exrTextureLoader-D8xP0GLQ.esm.min.js.map +0 -1
- package/dist/chunks/fogFragment-5YT33bDn.esm.js +0 -102
- package/dist/chunks/fogFragment-5YT33bDn.esm.js.map +0 -1
- package/dist/chunks/fogFragment-BOBZ2KwN.esm.min.js +0 -2
- package/dist/chunks/fogFragment-BOBZ2KwN.esm.min.js.map +0 -1
- package/dist/chunks/fogFragment-CLENZGuB.esm.js +0 -101
- package/dist/chunks/fogFragment-CLENZGuB.esm.js.map +0 -1
- package/dist/chunks/fogFragment-D9dudohA.esm.min.js +0 -2
- package/dist/chunks/fogFragment-D9dudohA.esm.min.js.map +0 -1
- package/dist/chunks/fresnelFunction-BkO99b6C.esm.js +0 -12
- package/dist/chunks/fresnelFunction-BkO99b6C.esm.js.map +0 -1
- package/dist/chunks/fresnelFunction-CqiLsMCu.esm.min.js +0 -2
- package/dist/chunks/fresnelFunction-CqiLsMCu.esm.min.js.map +0 -1
- package/dist/chunks/glTFLoader-CkL-dxBD.esm.min.js +0 -2
- package/dist/chunks/glTFLoader-CkL-dxBD.esm.min.js.map +0 -1
- package/dist/chunks/glTFLoader-IEHRfiUn.esm.js +0 -7586
- package/dist/chunks/glTFLoader-IEHRfiUn.esm.js.map +0 -1
- package/dist/chunks/glTFLoaderAnimation-CV32Nmqb.esm.js +0 -77
- package/dist/chunks/glTFLoaderAnimation-CV32Nmqb.esm.js.map +0 -1
- package/dist/chunks/glTFLoaderAnimation-Cq2ziV9o.esm.min.js +0 -2
- package/dist/chunks/glTFLoaderAnimation-Cq2ziV9o.esm.min.js.map +0 -1
- package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js +0 -2
- package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js.map +0 -1
- package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js +0 -67
- package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js.map +0 -1
- package/dist/chunks/harmonicsFunctions-B5QCEZvF.esm.js +0 -34
- package/dist/chunks/harmonicsFunctions-B5QCEZvF.esm.js.map +0 -1
- package/dist/chunks/harmonicsFunctions-BxLCgoIQ.esm.min.js +0 -2
- package/dist/chunks/harmonicsFunctions-BxLCgoIQ.esm.min.js.map +0 -1
- package/dist/chunks/harmonicsFunctions-Daxnf8NE.esm.min.js +0 -2
- package/dist/chunks/harmonicsFunctions-Daxnf8NE.esm.min.js.map +0 -1
- package/dist/chunks/harmonicsFunctions-UzG0C-sm.esm.js +0 -35
- package/dist/chunks/harmonicsFunctions-UzG0C-sm.esm.js.map +0 -1
- package/dist/chunks/hdrTextureLoader-BpVjKGyb.esm.min.js +0 -2
- package/dist/chunks/hdrTextureLoader-BpVjKGyb.esm.min.js.map +0 -1
- package/dist/chunks/hdrTextureLoader-DgW8CxRF.esm.js +0 -253
- package/dist/chunks/hdrTextureLoader-DgW8CxRF.esm.js.map +0 -1
- package/dist/chunks/helperFunctions-BFgvMG5S.esm.min.js +0 -2
- package/dist/chunks/helperFunctions-BFgvMG5S.esm.min.js.map +0 -1
- package/dist/chunks/helperFunctions-BatAhE6u.esm.js +0 -108
- package/dist/chunks/helperFunctions-BatAhE6u.esm.js.map +0 -1
- package/dist/chunks/helperFunctions-qECwmiwu.esm.min.js +0 -2
- package/dist/chunks/helperFunctions-qECwmiwu.esm.min.js.map +0 -1
- package/dist/chunks/helperFunctions-vbA-oTJx.esm.js +0 -80
- package/dist/chunks/helperFunctions-vbA-oTJx.esm.js.map +0 -1
- package/dist/chunks/iesTextureLoader-Ccd5pvbh.esm.min.js +0 -2
- package/dist/chunks/iesTextureLoader-Ccd5pvbh.esm.min.js.map +0 -1
- package/dist/chunks/iesTextureLoader-nMYnOfhm.esm.js +0 -189
- package/dist/chunks/iesTextureLoader-nMYnOfhm.esm.js.map +0 -1
- package/dist/chunks/index-BHIM4QBr.esm.min.js +0 -57
- package/dist/chunks/index-BHIM4QBr.esm.min.js.map +0 -1
- package/dist/chunks/index-CtkZLm9J.esm.js +0 -74717
- package/dist/chunks/index-CtkZLm9J.esm.js.map +0 -1
- package/dist/chunks/ktxTextureLoader-CkkvHzY3.esm.js +0 -814
- package/dist/chunks/ktxTextureLoader-CkkvHzY3.esm.js.map +0 -1
- package/dist/chunks/ktxTextureLoader-CwGlHia2.esm.min.js +0 -2
- package/dist/chunks/ktxTextureLoader-CwGlHia2.esm.min.js.map +0 -1
- package/dist/chunks/logDepthDeclaration-BiUSPlzz.esm.js +0 -35
- package/dist/chunks/logDepthDeclaration-BiUSPlzz.esm.js.map +0 -1
- package/dist/chunks/logDepthDeclaration-Bq2fzMbS.esm.js +0 -11
- package/dist/chunks/logDepthDeclaration-Bq2fzMbS.esm.js.map +0 -1
- package/dist/chunks/logDepthDeclaration-C8DJP16D.esm.min.js +0 -2
- package/dist/chunks/logDepthDeclaration-C8DJP16D.esm.min.js.map +0 -1
- package/dist/chunks/logDepthDeclaration-DJpvEdPG.esm.min.js +0 -2
- package/dist/chunks/logDepthDeclaration-DJpvEdPG.esm.min.js.map +0 -1
- package/dist/chunks/logDepthVertex-C00_obGd.esm.min.js +0 -2
- package/dist/chunks/logDepthVertex-C00_obGd.esm.min.js.map +0 -1
- package/dist/chunks/logDepthVertex-CYIGBMYd.esm.js +0 -77
- package/dist/chunks/logDepthVertex-CYIGBMYd.esm.js.map +0 -1
- package/dist/chunks/logDepthVertex-CxT8FVOf.esm.js +0 -81
- package/dist/chunks/logDepthVertex-CxT8FVOf.esm.js.map +0 -1
- package/dist/chunks/logDepthVertex-SyM_Fu5K.esm.min.js +0 -2
- package/dist/chunks/logDepthVertex-SyM_Fu5K.esm.min.js.map +0 -1
- package/dist/chunks/mainUVVaryingDeclaration-BaIG4IFB.esm.js +0 -11
- package/dist/chunks/mainUVVaryingDeclaration-BaIG4IFB.esm.js.map +0 -1
- package/dist/chunks/mainUVVaryingDeclaration-CQzOmEIM.esm.min.js +0 -2
- package/dist/chunks/mainUVVaryingDeclaration-CQzOmEIM.esm.min.js.map +0 -1
- package/dist/chunks/mainUVVaryingDeclaration-D100Qvmm.esm.min.js +0 -2
- package/dist/chunks/mainUVVaryingDeclaration-D100Qvmm.esm.min.js.map +0 -1
- package/dist/chunks/mainUVVaryingDeclaration-OSD7irdC.esm.js +0 -11
- package/dist/chunks/mainUVVaryingDeclaration-OSD7irdC.esm.js.map +0 -1
- package/dist/chunks/meshUboDeclaration--wzKOTOT.esm.min.js +0 -2
- package/dist/chunks/meshUboDeclaration--wzKOTOT.esm.min.js.map +0 -1
- package/dist/chunks/meshUboDeclaration-DIi9ZPDc.esm.js +0 -26
- package/dist/chunks/meshUboDeclaration-DIi9ZPDc.esm.js.map +0 -1
- package/dist/chunks/objFileLoader-Cda8pwUd.esm.js +0 -1338
- package/dist/chunks/objFileLoader-Cda8pwUd.esm.js.map +0 -1
- package/dist/chunks/objFileLoader-kzI-pZ8o.esm.min.js +0 -2
- package/dist/chunks/objFileLoader-kzI-pZ8o.esm.min.js.map +0 -1
- package/dist/chunks/oitFragment-4cP4dKVP.esm.min.js +0 -2
- package/dist/chunks/oitFragment-4cP4dKVP.esm.min.js.map +0 -1
- package/dist/chunks/oitFragment-Bz1w36ia.esm.js +0 -1078
- package/dist/chunks/oitFragment-Bz1w36ia.esm.js.map +0 -1
- package/dist/chunks/oitFragment-DUkW-kmb.esm.min.js +0 -2
- package/dist/chunks/oitFragment-DUkW-kmb.esm.min.js.map +0 -1
- package/dist/chunks/oitFragment-DiuTTpNa.esm.js +0 -1240
- package/dist/chunks/oitFragment-DiuTTpNa.esm.js.map +0 -1
- package/dist/chunks/pass.fragment-B8l5NRgR.esm.min.js +0 -2
- package/dist/chunks/pass.fragment-B8l5NRgR.esm.min.js.map +0 -1
- package/dist/chunks/pass.fragment-BF4UEoT8.esm.min.js +0 -2
- package/dist/chunks/pass.fragment-BF4UEoT8.esm.min.js.map +0 -1
- package/dist/chunks/pass.fragment-CD3_26yo.esm.js +0 -15
- package/dist/chunks/pass.fragment-CD3_26yo.esm.js.map +0 -1
- package/dist/chunks/pass.fragment-DfeELUEn.esm.js +0 -15
- package/dist/chunks/pass.fragment-DfeELUEn.esm.js.map +0 -1
- package/dist/chunks/pbr.fragment-BDylAp64.esm.min.js +0 -2
- package/dist/chunks/pbr.fragment-BDylAp64.esm.min.js.map +0 -1
- package/dist/chunks/pbr.fragment-C1qko419.esm.min.js +0 -2
- package/dist/chunks/pbr.fragment-C1qko419.esm.min.js.map +0 -1
- package/dist/chunks/pbr.fragment-EBVxSAEQ.esm.js +0 -3232
- package/dist/chunks/pbr.fragment-EBVxSAEQ.esm.js.map +0 -1
- package/dist/chunks/pbr.fragment-lt62m8b7.esm.js +0 -3273
- package/dist/chunks/pbr.fragment-lt62m8b7.esm.js.map +0 -1
- package/dist/chunks/pbr.vertex-CGRL_eY2.esm.js +0 -339
- package/dist/chunks/pbr.vertex-CGRL_eY2.esm.js.map +0 -1
- package/dist/chunks/pbr.vertex-CHv4zeYj.esm.min.js +0 -2
- package/dist/chunks/pbr.vertex-CHv4zeYj.esm.min.js.map +0 -1
- package/dist/chunks/pbr.vertex-Dk4h9ywZ.esm.min.js +0 -2
- package/dist/chunks/pbr.vertex-Dk4h9ywZ.esm.min.js.map +0 -1
- package/dist/chunks/pbr.vertex-DopP5mYu.esm.js +0 -214
- package/dist/chunks/pbr.vertex-DopP5mYu.esm.js.map +0 -1
- package/dist/chunks/postprocess.vertex-Bt30-Flh.esm.min.js +0 -2
- package/dist/chunks/postprocess.vertex-Bt30-Flh.esm.min.js.map +0 -1
- package/dist/chunks/postprocess.vertex-pLUOpXIY.esm.js +0 -20
- package/dist/chunks/postprocess.vertex-pLUOpXIY.esm.js.map +0 -1
- package/dist/chunks/rawTexture-78KJgWfq.esm.js +0 -191
- package/dist/chunks/rawTexture-78KJgWfq.esm.js.map +0 -1
- package/dist/chunks/rawTexture-CCCnj14W.esm.min.js +0 -2
- package/dist/chunks/rawTexture-CCCnj14W.esm.min.js.map +0 -1
- package/dist/chunks/ray-CfhmGTmj.esm.js +0 -946
- package/dist/chunks/ray-CfhmGTmj.esm.js.map +0 -1
- package/dist/chunks/ray-Du89cGmz.esm.min.js +0 -2
- package/dist/chunks/ray-Du89cGmz.esm.min.js.map +0 -1
- package/dist/chunks/rgbdDecode.fragment-BHAQKD_5.esm.js +0 -13
- package/dist/chunks/rgbdDecode.fragment-BHAQKD_5.esm.js.map +0 -1
- package/dist/chunks/rgbdDecode.fragment-CV6q4aIi.esm.js +0 -13
- package/dist/chunks/rgbdDecode.fragment-CV6q4aIi.esm.js.map +0 -1
- package/dist/chunks/rgbdDecode.fragment-DEu4F_6T.esm.min.js +0 -2
- package/dist/chunks/rgbdDecode.fragment-DEu4F_6T.esm.min.js.map +0 -1
- package/dist/chunks/rgbdDecode.fragment-DiJfgZKv.esm.min.js +0 -2
- package/dist/chunks/rgbdDecode.fragment-DiJfgZKv.esm.min.js.map +0 -1
- package/dist/chunks/rgbdEncode.fragment-CR30N0Mr.esm.js +0 -13
- package/dist/chunks/rgbdEncode.fragment-CR30N0Mr.esm.js.map +0 -1
- package/dist/chunks/rgbdEncode.fragment-CUE3DGC8.esm.min.js +0 -2
- package/dist/chunks/rgbdEncode.fragment-CUE3DGC8.esm.min.js.map +0 -1
- package/dist/chunks/rgbdEncode.fragment-DdFs5QJM.esm.js +0 -13
- package/dist/chunks/rgbdEncode.fragment-DdFs5QJM.esm.js.map +0 -1
- package/dist/chunks/rgbdEncode.fragment-omm81hdD.esm.min.js +0 -2
- package/dist/chunks/rgbdEncode.fragment-omm81hdD.esm.min.js.map +0 -1
- package/dist/chunks/splatFileLoader-BnaOhITn.esm.js +0 -3379
- package/dist/chunks/splatFileLoader-BnaOhITn.esm.js.map +0 -1
- package/dist/chunks/splatFileLoader-CuMIDOsR.esm.min.js +0 -2
- package/dist/chunks/splatFileLoader-CuMIDOsR.esm.min.js.map +0 -1
- package/dist/chunks/spotLight-Ca0-j1Op.esm.js +0 -701
- package/dist/chunks/spotLight-Ca0-j1Op.esm.js.map +0 -1
- package/dist/chunks/spotLight-DXuSbTaJ.esm.min.js +0 -2
- package/dist/chunks/spotLight-DXuSbTaJ.esm.min.js.map +0 -1
- package/dist/chunks/standardMaterial-DKyaZtcm.esm.js +0 -1805
- package/dist/chunks/standardMaterial-DKyaZtcm.esm.js.map +0 -1
- package/dist/chunks/standardMaterial-h3ccobBt.esm.min.js +0 -2
- package/dist/chunks/standardMaterial-h3ccobBt.esm.min.js.map +0 -1
- package/dist/chunks/stlFileLoader-CDv97liE.esm.js +0 -238
- package/dist/chunks/stlFileLoader-CDv97liE.esm.js.map +0 -1
- package/dist/chunks/stlFileLoader-e2ImyWaM.esm.min.js +0 -2
- package/dist/chunks/stlFileLoader-e2ImyWaM.esm.min.js.map +0 -1
- package/dist/chunks/tgaTextureLoader-DJaEph-Q.esm.js +0 -349
- package/dist/chunks/tgaTextureLoader-DJaEph-Q.esm.js.map +0 -1
- package/dist/chunks/tgaTextureLoader-slv-QvZW.esm.min.js +0 -2
- package/dist/chunks/tgaTextureLoader-slv-QvZW.esm.min.js.map +0 -1
- package/dist/chunks/thinEngine-Ue9ZAvRK.esm.js +0 -3848
- package/dist/chunks/thinEngine-Ue9ZAvRK.esm.js.map +0 -1
- package/dist/chunks/thinEngine-pihAbdON.esm.min.js +0 -2
- package/dist/chunks/thinEngine-pihAbdON.esm.min.js.map +0 -1
- package/dist/chunks/thinInstanceMesh-BgfKoejL.esm.min.js +0 -2
- package/dist/chunks/thinInstanceMesh-BgfKoejL.esm.min.js.map +0 -1
- package/dist/chunks/thinInstanceMesh-V41szD4h.esm.js +0 -314
- package/dist/chunks/thinInstanceMesh-V41szD4h.esm.js.map +0 -1
- package/dist/chunks/vertexColorMixing-CZsK7mYP.esm.min.js +0 -2
- package/dist/chunks/vertexColorMixing-CZsK7mYP.esm.min.js.map +0 -1
- package/dist/chunks/vertexColorMixing-DKVusFas.esm.js +0 -522
- package/dist/chunks/vertexColorMixing-DKVusFas.esm.js.map +0 -1
- package/dist/chunks/vertexColorMixing-DeZKI8QK.esm.js +0 -412
- package/dist/chunks/vertexColorMixing-DeZKI8QK.esm.js.map +0 -1
- package/dist/chunks/vertexColorMixing-axGN1U7X.esm.min.js +0 -2
- package/dist/chunks/vertexColorMixing-axGN1U7X.esm.min.js.map +0 -1
- package/dist/chunks/webgpuEngine-COis70hT.esm.js +0 -11533
- package/dist/chunks/webgpuEngine-COis70hT.esm.js.map +0 -1
- package/dist/chunks/webgpuEngine-Cx_GlShD.esm.min.js +0 -2
- package/dist/chunks/webgpuEngine-Cx_GlShD.esm.min.js.map +0 -1
- package/dist/chunks/workerPool-BUOov2K1.esm.js +0 -122
- package/dist/chunks/workerPool-BUOov2K1.esm.js.map +0 -1
- package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js +0 -2
- package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js.map +0 -1
- package/lib/index.d.ts +0 -559
- package/lib/index.js +0 -2083
- package/lib/index.js.map +0 -1
package/lib/index.js
DELETED
|
@@ -1,2083 +0,0 @@
|
|
|
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, environmentTexture, 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 = environmentTexture.clone();
|
|
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
|
-
/**
|
|
63
|
-
* Provides the result of a hot spot query.
|
|
64
|
-
*/
|
|
65
|
-
class ViewerHotSpotResult {
|
|
66
|
-
constructor() {
|
|
67
|
-
/**
|
|
68
|
-
* 2D canvas position in pixels
|
|
69
|
-
*/
|
|
70
|
-
this.screenPosition = [NaN, NaN];
|
|
71
|
-
/**
|
|
72
|
-
* 3D world coordinates
|
|
73
|
-
*/
|
|
74
|
-
this.worldPosition = [NaN, NaN, NaN];
|
|
75
|
-
/**
|
|
76
|
-
* visibility range is [-1..1]. A value of 0 means camera eye is on the plane.
|
|
77
|
-
*/
|
|
78
|
-
this.visibility = NaN;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* @experimental
|
|
83
|
-
* Provides an experience for viewing a single 3D model.
|
|
84
|
-
* @remarks
|
|
85
|
-
* The Viewer is not tied to a specific UI framework and can be used with Babylon.js in a browser or with Babylon Native.
|
|
86
|
-
* Includes (or will include) support for common model viewing requirements such as:
|
|
87
|
-
* - Loading different model formats.
|
|
88
|
-
* - Setting up a camera and providing default behaviors like auto orbit and pose interpolation.
|
|
89
|
-
* - Framing the loaded model in the camera's view.
|
|
90
|
-
* - Setting up the environment, lighting, and tone mapping.
|
|
91
|
-
* - Enumerating and playing (or auto playing) animations.
|
|
92
|
-
* - Enumerating and switching between material variants.
|
|
93
|
-
* - Full screen and XR modes.
|
|
94
|
-
*/
|
|
95
|
-
class Viewer {
|
|
96
|
-
constructor(_engine, options) {
|
|
97
|
-
this._engine = _engine;
|
|
98
|
-
/**
|
|
99
|
-
* Fired when the environment has changed.
|
|
100
|
-
*/
|
|
101
|
-
this.onEnvironmentChanged = new Observable();
|
|
102
|
-
/**
|
|
103
|
-
* Fired when an error occurs while loading the environment.
|
|
104
|
-
*/
|
|
105
|
-
this.onEnvironmentError = new Observable();
|
|
106
|
-
/**
|
|
107
|
-
* Fired when the skybox blur changes.
|
|
108
|
-
*/
|
|
109
|
-
this.onSkyboxBlurChanged = new Observable();
|
|
110
|
-
/**
|
|
111
|
-
* Fired when the post processing state changes.
|
|
112
|
-
*/
|
|
113
|
-
this.onPostProcessingChanged = new Observable();
|
|
114
|
-
/**
|
|
115
|
-
* Fired when a model is loaded into the viewer (or unloaded from the viewer).
|
|
116
|
-
*/
|
|
117
|
-
this.onModelChanged = new Observable();
|
|
118
|
-
/**
|
|
119
|
-
* Fired when an error occurs while loading a model.
|
|
120
|
-
*/
|
|
121
|
-
this.onModelError = new Observable();
|
|
122
|
-
/**
|
|
123
|
-
* Fired when progress changes on loading activity.
|
|
124
|
-
*/
|
|
125
|
-
this.onLoadingProgressChanged = new Observable();
|
|
126
|
-
/**
|
|
127
|
-
* Fired when the camera auto orbit state changes.
|
|
128
|
-
*/
|
|
129
|
-
this.onCameraAutoOrbitChanged = new Observable();
|
|
130
|
-
/**
|
|
131
|
-
* Fired when the selected animation changes.
|
|
132
|
-
*/
|
|
133
|
-
this.onSelectedAnimationChanged = new Observable();
|
|
134
|
-
/**
|
|
135
|
-
* Fired when the animation speed changes.
|
|
136
|
-
*/
|
|
137
|
-
this.onAnimationSpeedChanged = new Observable();
|
|
138
|
-
/**
|
|
139
|
-
* Fired when the selected animation is playing or paused.
|
|
140
|
-
*/
|
|
141
|
-
this.onIsAnimationPlayingChanged = new Observable();
|
|
142
|
-
/**
|
|
143
|
-
* Fired when the current point on the selected animation timeline changes.
|
|
144
|
-
*/
|
|
145
|
-
this.onAnimationProgressChanged = new Observable();
|
|
146
|
-
/**
|
|
147
|
-
* Fired when the selected material variant changes.
|
|
148
|
-
*/
|
|
149
|
-
this.onSelectedMaterialVariantChanged = new Observable();
|
|
150
|
-
this._tempVectors = BuildTuple(4, Vector3.Zero);
|
|
151
|
-
this._meshDataCache = new Map();
|
|
152
|
-
this._renderLoopController = null;
|
|
153
|
-
this._materialVariantsController = null;
|
|
154
|
-
this._skybox = null;
|
|
155
|
-
this._skyboxBlur = 0.3;
|
|
156
|
-
this._light = null;
|
|
157
|
-
this._suspendRenderCount = 0;
|
|
158
|
-
this._isDisposed = false;
|
|
159
|
-
this._loadModelLock = new AsyncLock();
|
|
160
|
-
this._loadModelAbortController = null;
|
|
161
|
-
this._loadEnvironmentLock = new AsyncLock();
|
|
162
|
-
this._environment = null;
|
|
163
|
-
this._loadEnvironmentAbortController = null;
|
|
164
|
-
this._isLoadingModel = false;
|
|
165
|
-
this._modelLoadingProgress = null;
|
|
166
|
-
this._selectedAnimation = -1;
|
|
167
|
-
this._activeAnimationObservers = [];
|
|
168
|
-
this._animationSpeed = 1;
|
|
169
|
-
{
|
|
170
|
-
const scene = new Scene(this._engine);
|
|
171
|
-
// Deduce tone mapping, contrast, and exposure from the scene (so the viewer stays in sync if anything mutates these values directly on the scene).
|
|
172
|
-
this._toneMappingEnabled = scene.imageProcessingConfiguration.toneMappingEnabled;
|
|
173
|
-
this._toneMappingType = scene.imageProcessingConfiguration.toneMappingType;
|
|
174
|
-
this._contrast = scene.imageProcessingConfiguration.contrast;
|
|
175
|
-
this._exposure = scene.imageProcessingConfiguration.exposure;
|
|
176
|
-
this._imageProcessingConfigurationObserver = scene.imageProcessingConfiguration.onUpdateParameters.add(() => {
|
|
177
|
-
let hasChanged = false;
|
|
178
|
-
if (this._toneMappingEnabled !== scene.imageProcessingConfiguration.toneMappingEnabled) {
|
|
179
|
-
this._toneMappingEnabled = scene.imageProcessingConfiguration.toneMappingEnabled;
|
|
180
|
-
hasChanged = true;
|
|
181
|
-
}
|
|
182
|
-
if (this._toneMappingType !== scene.imageProcessingConfiguration.toneMappingType) {
|
|
183
|
-
this._toneMappingType = scene.imageProcessingConfiguration.toneMappingType;
|
|
184
|
-
hasChanged = true;
|
|
185
|
-
}
|
|
186
|
-
if (this._contrast !== scene.imageProcessingConfiguration.contrast) {
|
|
187
|
-
this._contrast = scene.imageProcessingConfiguration.contrast;
|
|
188
|
-
hasChanged = true;
|
|
189
|
-
}
|
|
190
|
-
if (this._exposure !== scene.imageProcessingConfiguration.exposure) {
|
|
191
|
-
this._exposure = scene.imageProcessingConfiguration.exposure;
|
|
192
|
-
hasChanged = true;
|
|
193
|
-
}
|
|
194
|
-
if (hasChanged) {
|
|
195
|
-
this.onPostProcessingChanged.notifyObservers();
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
const camera = new ArcRotateCamera("Viewer Default Camera", 0, 0, 1, Vector3.Zero(), scene);
|
|
199
|
-
camera.useInputToRestoreState = false;
|
|
200
|
-
scene.onPointerObservable.add(async (pointerInfo) => {
|
|
201
|
-
const pickingInfo = await this._pick(pointerInfo.event.offsetX, pointerInfo.event.offsetY);
|
|
202
|
-
if (pickingInfo?.pickedPoint) {
|
|
203
|
-
const distance = pickingInfo.pickedPoint.subtract(camera.position).dot(camera.getForwardRay().direction);
|
|
204
|
-
// Immediately reset the target and the radius based on the distance to the picked point.
|
|
205
|
-
// This eliminates unnecessary camera movement on the local z-axis when interpolating.
|
|
206
|
-
camera.target = camera.position.add(camera.getForwardRay().direction.scale(distance));
|
|
207
|
-
camera.radius = distance;
|
|
208
|
-
camera.interpolateTo(undefined, undefined, undefined, pickingInfo.pickedPoint);
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
camera.restoreState();
|
|
212
|
-
}
|
|
213
|
-
}, PointerEventTypes.POINTERDOUBLETAP);
|
|
214
|
-
this._details = {
|
|
215
|
-
viewer: this,
|
|
216
|
-
scene,
|
|
217
|
-
camera,
|
|
218
|
-
model: null,
|
|
219
|
-
suspendRendering: () => this._suspendRendering(),
|
|
220
|
-
pick: (screenX, screenY) => this._pick(screenX, screenY),
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
this._details.scene.skipFrustumClipping = true;
|
|
224
|
-
this._details.scene.skipPointerDownPicking = true;
|
|
225
|
-
this._details.scene.skipPointerUpPicking = true;
|
|
226
|
-
this._details.scene.skipPointerMovePicking = true;
|
|
227
|
-
this._snapshotHelper = new SnapshotRenderingHelper(this._details.scene, { morphTargetsNumMaxInfluences: 30 });
|
|
228
|
-
this._details.camera.attachControl();
|
|
229
|
-
this._updateCamera(); // set default camera values
|
|
230
|
-
this._autoRotationBehavior = this._details.camera.getBehaviorByName("AutoRotation");
|
|
231
|
-
// Default to KHR PBR Neutral tone mapping.
|
|
232
|
-
this.postProcessing = {
|
|
233
|
-
toneMapping: "neutral",
|
|
234
|
-
};
|
|
235
|
-
// Load a default light, but ignore errors as the user might be immediately loading their own environment.
|
|
236
|
-
this.resetEnvironment().catch(() => { });
|
|
237
|
-
this._beginRendering();
|
|
238
|
-
options?.onInitialized?.(this._details);
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* The camera auto orbit configuration.
|
|
242
|
-
*/
|
|
243
|
-
get cameraAutoOrbit() {
|
|
244
|
-
return {
|
|
245
|
-
enabled: this._details.camera.behaviors.includes(this._autoRotationBehavior),
|
|
246
|
-
speed: this._autoRotationBehavior.idleRotationSpeed,
|
|
247
|
-
delay: this._autoRotationBehavior.idleRotationWaitTime,
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
set cameraAutoOrbit(value) {
|
|
251
|
-
if (value.enabled !== undefined && value.enabled !== this.cameraAutoOrbit.enabled) {
|
|
252
|
-
if (value.enabled) {
|
|
253
|
-
this._details.camera.addBehavior(this._autoRotationBehavior);
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
this._details.camera.removeBehavior(this._autoRotationBehavior);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
if (value.delay !== undefined) {
|
|
260
|
-
this._autoRotationBehavior.idleRotationWaitTime = value.delay;
|
|
261
|
-
}
|
|
262
|
-
if (value.speed !== undefined) {
|
|
263
|
-
this._autoRotationBehavior.idleRotationSpeed = value.speed;
|
|
264
|
-
}
|
|
265
|
-
this.onCameraAutoOrbitChanged.notifyObservers();
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* A value between 0 and 1 that specifies how much to blur the skybox.
|
|
269
|
-
*/
|
|
270
|
-
get skyboxBlur() {
|
|
271
|
-
return this._skyboxBlur;
|
|
272
|
-
}
|
|
273
|
-
set skyboxBlur(value) {
|
|
274
|
-
if (value !== this._skyboxBlur) {
|
|
275
|
-
this._skyboxBlur = value;
|
|
276
|
-
if (this._skybox) {
|
|
277
|
-
const material = this._skybox.material;
|
|
278
|
-
if (material instanceof PBRMaterial) {
|
|
279
|
-
this._snapshotHelper.disableSnapshotRendering();
|
|
280
|
-
material.microSurface = 1.0 - value;
|
|
281
|
-
this._snapshotHelper.enableSnapshotRendering();
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
this.onSkyboxBlurChanged.notifyObservers();
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* The post processing configuration.
|
|
289
|
-
*/
|
|
290
|
-
get postProcessing() {
|
|
291
|
-
let toneMapping;
|
|
292
|
-
switch (this._toneMappingType) {
|
|
293
|
-
case ImageProcessingConfiguration.TONEMAPPING_STANDARD:
|
|
294
|
-
toneMapping = "standard";
|
|
295
|
-
break;
|
|
296
|
-
case ImageProcessingConfiguration.TONEMAPPING_ACES:
|
|
297
|
-
toneMapping = "aces";
|
|
298
|
-
break;
|
|
299
|
-
case ImageProcessingConfiguration.TONEMAPPING_KHR_PBR_NEUTRAL:
|
|
300
|
-
toneMapping = "neutral";
|
|
301
|
-
break;
|
|
302
|
-
default:
|
|
303
|
-
toneMapping = "none";
|
|
304
|
-
break;
|
|
305
|
-
}
|
|
306
|
-
return {
|
|
307
|
-
toneMapping,
|
|
308
|
-
contrast: this._contrast,
|
|
309
|
-
exposure: this._exposure,
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
set postProcessing(value) {
|
|
313
|
-
this._snapshotHelper.disableSnapshotRendering();
|
|
314
|
-
if (value.toneMapping !== undefined) {
|
|
315
|
-
if (value.toneMapping === "none") {
|
|
316
|
-
this._details.scene.imageProcessingConfiguration.toneMappingEnabled = false;
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
switch (value.toneMapping) {
|
|
320
|
-
case "standard":
|
|
321
|
-
this._details.scene.imageProcessingConfiguration.toneMappingType = ImageProcessingConfiguration.TONEMAPPING_STANDARD;
|
|
322
|
-
break;
|
|
323
|
-
case "aces":
|
|
324
|
-
this._details.scene.imageProcessingConfiguration.toneMappingType = ImageProcessingConfiguration.TONEMAPPING_ACES;
|
|
325
|
-
break;
|
|
326
|
-
case "neutral":
|
|
327
|
-
this._details.scene.imageProcessingConfiguration.toneMappingType = ImageProcessingConfiguration.TONEMAPPING_KHR_PBR_NEUTRAL;
|
|
328
|
-
break;
|
|
329
|
-
}
|
|
330
|
-
this._details.scene.imageProcessingConfiguration.toneMappingEnabled = true;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
if (value.contrast !== undefined) {
|
|
334
|
-
this._details.scene.imageProcessingConfiguration.contrast = value.contrast;
|
|
335
|
-
}
|
|
336
|
-
if (value.exposure !== undefined) {
|
|
337
|
-
this._details.scene.imageProcessingConfiguration.exposure = value.exposure;
|
|
338
|
-
}
|
|
339
|
-
this._details.scene.imageProcessingConfiguration.isEnabled = this._toneMappingEnabled || this._contrast !== 1 || this._exposure !== 1;
|
|
340
|
-
this._snapshotHelper.enableSnapshotRendering();
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Gets information about loading activity.
|
|
344
|
-
* @remarks
|
|
345
|
-
* false indicates no loading activity.
|
|
346
|
-
* true indicates loading activity with no progress information.
|
|
347
|
-
* A number between 0 and 1 indicates loading activity with progress information.
|
|
348
|
-
*/
|
|
349
|
-
get loadingProgress() {
|
|
350
|
-
if (this._isLoadingModel) {
|
|
351
|
-
return this._modelLoadingProgress ?? true;
|
|
352
|
-
}
|
|
353
|
-
return false;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* The list of animation names for the currently loaded model.
|
|
357
|
-
*/
|
|
358
|
-
get animations() {
|
|
359
|
-
return this._details.model?.animationGroups.map((group) => group.name) ?? [];
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* The currently selected animation index.
|
|
363
|
-
*/
|
|
364
|
-
get selectedAnimation() {
|
|
365
|
-
return this._selectedAnimation;
|
|
366
|
-
}
|
|
367
|
-
set selectedAnimation(value) {
|
|
368
|
-
value = Math.round(Clamp(value, -1, this.animations.length - 1));
|
|
369
|
-
if (value !== this._selectedAnimation) {
|
|
370
|
-
const startAnimation = this.isAnimationPlaying;
|
|
371
|
-
if (this._activeAnimation) {
|
|
372
|
-
this._activeAnimationObservers.forEach((observer) => observer.remove());
|
|
373
|
-
this._activeAnimationObservers = [];
|
|
374
|
-
this._activeAnimation.pause();
|
|
375
|
-
this._activeAnimation.goToFrame(0);
|
|
376
|
-
}
|
|
377
|
-
this._selectedAnimation = value;
|
|
378
|
-
if (this._activeAnimation) {
|
|
379
|
-
this._activeAnimation.goToFrame(0);
|
|
380
|
-
this._activeAnimation.play(true);
|
|
381
|
-
if (!startAnimation) {
|
|
382
|
-
this.pauseAnimation();
|
|
383
|
-
}
|
|
384
|
-
this._activeAnimationObservers = [
|
|
385
|
-
this._activeAnimation.onAnimationGroupPlayObservable.add(() => {
|
|
386
|
-
this.onIsAnimationPlayingChanged.notifyObservers();
|
|
387
|
-
}),
|
|
388
|
-
this._activeAnimation.onAnimationGroupPauseObservable.add(() => {
|
|
389
|
-
this.onIsAnimationPlayingChanged.notifyObservers();
|
|
390
|
-
}),
|
|
391
|
-
this._activeAnimation.onAnimationGroupEndObservable.add(() => {
|
|
392
|
-
this.onIsAnimationPlayingChanged.notifyObservers();
|
|
393
|
-
this.onAnimationProgressChanged.notifyObservers();
|
|
394
|
-
}),
|
|
395
|
-
];
|
|
396
|
-
this._updateCamera(!this._isLoadingModel);
|
|
397
|
-
}
|
|
398
|
-
this.onSelectedAnimationChanged.notifyObservers();
|
|
399
|
-
this.onAnimationProgressChanged.notifyObservers();
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* True if an animation is currently playing.
|
|
404
|
-
*/
|
|
405
|
-
get isAnimationPlaying() {
|
|
406
|
-
return this._activeAnimation?.isPlaying ?? false;
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* The speed scale at which animations are played.
|
|
410
|
-
*/
|
|
411
|
-
get animationSpeed() {
|
|
412
|
-
return this._animationSpeed;
|
|
413
|
-
}
|
|
414
|
-
set animationSpeed(value) {
|
|
415
|
-
this._animationSpeed = value;
|
|
416
|
-
this._applyAnimationSpeed();
|
|
417
|
-
this.onAnimationSpeedChanged.notifyObservers();
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* The current point on the selected animation timeline, normalized between 0 and 1.
|
|
421
|
-
*/
|
|
422
|
-
get animationProgress() {
|
|
423
|
-
if (this._activeAnimation) {
|
|
424
|
-
return this._activeAnimation.getCurrentFrame() / (this._activeAnimation.to - this._activeAnimation.from);
|
|
425
|
-
}
|
|
426
|
-
return 0;
|
|
427
|
-
}
|
|
428
|
-
set animationProgress(value) {
|
|
429
|
-
if (this._activeAnimation) {
|
|
430
|
-
this._activeAnimation.goToFrame(value * (this._activeAnimation.to - this._activeAnimation.from));
|
|
431
|
-
this.onAnimationProgressChanged.notifyObservers();
|
|
432
|
-
this._autoRotationBehavior.resetLastInteractionTime();
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
get _activeAnimation() {
|
|
436
|
-
return this._details.model?.animationGroups[this._selectedAnimation] ?? null;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* The list of material variant names for the currently loaded model.
|
|
440
|
-
*/
|
|
441
|
-
get materialVariants() {
|
|
442
|
-
return this._materialVariantsController?.variants ?? [];
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* The currently selected material variant.
|
|
446
|
-
*/
|
|
447
|
-
get selectedMaterialVariant() {
|
|
448
|
-
return this._materialVariantsController?.selectedVariant ?? null;
|
|
449
|
-
}
|
|
450
|
-
set selectedMaterialVariant(value) {
|
|
451
|
-
if (value !== this.selectedMaterialVariant && this._materialVariantsController?.variants.includes(value)) {
|
|
452
|
-
this._snapshotHelper.disableSnapshotRendering();
|
|
453
|
-
this._materialVariantsController.selectedVariant = value;
|
|
454
|
-
this._snapshotHelper.enableSnapshotRendering();
|
|
455
|
-
this.onSelectedMaterialVariantChanged.notifyObservers();
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Loads a 3D model from the specified URL.
|
|
460
|
-
* @remarks
|
|
461
|
-
* If a model is already loaded, it will be unloaded before loading the new model.
|
|
462
|
-
* @param source A url or File or ArrayBufferView that points to the model to load.
|
|
463
|
-
* @param options The options to use when loading the model.
|
|
464
|
-
* @param abortSignal An optional signal that can be used to abort the loading process.
|
|
465
|
-
*/
|
|
466
|
-
async loadModel(source, options, abortSignal) {
|
|
467
|
-
await this._updateModel(source, options, abortSignal);
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Unloads the current 3D model if one is loaded.
|
|
471
|
-
* @param abortSignal An optional signal that can be used to abort the reset.
|
|
472
|
-
*/
|
|
473
|
-
async resetModel(abortSignal) {
|
|
474
|
-
await this._updateModel(undefined, undefined, abortSignal);
|
|
475
|
-
}
|
|
476
|
-
async _updateModel(source, options, abortSignal) {
|
|
477
|
-
this._throwIfDisposedOrAborted(abortSignal);
|
|
478
|
-
const originalOnProgress = options?.onProgress;
|
|
479
|
-
const onProgress = (event) => {
|
|
480
|
-
originalOnProgress?.(event);
|
|
481
|
-
if (this._isLoadingModel) {
|
|
482
|
-
this._modelLoadingProgress = event.lengthComputable ? event.loaded / event.total : null;
|
|
483
|
-
this.onLoadingProgressChanged.notifyObservers();
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
delete options?.onProgress;
|
|
487
|
-
const originalOnMaterialVariantsLoaded = options?.pluginOptions?.gltf?.extensionOptions?.KHR_materials_variants?.onLoaded;
|
|
488
|
-
const onMaterialVariantsLoaded = (controller) => {
|
|
489
|
-
originalOnMaterialVariantsLoaded?.(controller);
|
|
490
|
-
this._materialVariantsController = controller;
|
|
491
|
-
};
|
|
492
|
-
delete options?.pluginOptions?.gltf?.extensionOptions?.KHR_materials_variants?.onLoaded;
|
|
493
|
-
const defaultOptions = {
|
|
494
|
-
// Pass a progress callback to update the loading progress.
|
|
495
|
-
onProgress,
|
|
496
|
-
pluginOptions: {
|
|
497
|
-
gltf: {
|
|
498
|
-
// Enable transparency as coverage by default to be 3D Commerce compliant by default.
|
|
499
|
-
// https://doc.babylonjs.com/setup/support/3D_commerce_certif
|
|
500
|
-
transparencyAsCoverage: true,
|
|
501
|
-
extensionOptions: {
|
|
502
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
503
|
-
KHR_materials_variants: {
|
|
504
|
-
// Capture the material variants controller when it is loaded.
|
|
505
|
-
onLoaded: onMaterialVariantsLoaded,
|
|
506
|
-
},
|
|
507
|
-
},
|
|
508
|
-
},
|
|
509
|
-
},
|
|
510
|
-
};
|
|
511
|
-
options = deepMerge(defaultOptions, options ?? {});
|
|
512
|
-
this._loadModelAbortController?.abort("New model is being loaded before previous model finished loading.");
|
|
513
|
-
const abortController = (this._loadModelAbortController = new AbortController());
|
|
514
|
-
await this._loadModelLock.lockAsync(async () => {
|
|
515
|
-
throwIfAborted(abortSignal, abortController.signal);
|
|
516
|
-
this._snapshotHelper.disableSnapshotRendering();
|
|
517
|
-
this._details.model?.dispose();
|
|
518
|
-
this._details.model = null;
|
|
519
|
-
this._meshDataCache.clear();
|
|
520
|
-
this._materialVariantsController = null;
|
|
521
|
-
this.onSelectedMaterialVariantChanged.notifyObservers();
|
|
522
|
-
this.selectedAnimation = -1;
|
|
523
|
-
try {
|
|
524
|
-
if (source) {
|
|
525
|
-
this._isLoadingModel = true;
|
|
526
|
-
this._modelLoadingProgress = 0;
|
|
527
|
-
this.onLoadingProgressChanged.notifyObservers();
|
|
528
|
-
this._details.model = await loadAssetContainerAsync(source, this._details.scene, options);
|
|
529
|
-
this.onSelectedMaterialVariantChanged.notifyObservers();
|
|
530
|
-
this._details.model.animationGroups.forEach((group) => {
|
|
531
|
-
group.start(true, this.animationSpeed);
|
|
532
|
-
group.pause();
|
|
533
|
-
});
|
|
534
|
-
this.selectedAnimation = options?.defaultAnimation ?? 0;
|
|
535
|
-
this._snapshotHelper.fixMeshes(this._details.model.meshes);
|
|
536
|
-
this._details.model.addAllToScene();
|
|
537
|
-
}
|
|
538
|
-
this._updateCamera();
|
|
539
|
-
this._updateLight();
|
|
540
|
-
this._applyAnimationSpeed();
|
|
541
|
-
this.onModelChanged.notifyObservers();
|
|
542
|
-
}
|
|
543
|
-
catch (e) {
|
|
544
|
-
this.onModelError.notifyObservers(e);
|
|
545
|
-
throw e;
|
|
546
|
-
}
|
|
547
|
-
finally {
|
|
548
|
-
this._isLoadingModel = false;
|
|
549
|
-
this.onLoadingProgressChanged.notifyObservers();
|
|
550
|
-
this._snapshotHelper.enableSnapshotRendering();
|
|
551
|
-
}
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
/**
|
|
555
|
-
* Loads an environment texture from the specified url and sets up a corresponding skybox.
|
|
556
|
-
* @remarks
|
|
557
|
-
* If an environment is already loaded, it will be unloaded before loading the new environment.
|
|
558
|
-
* @param url The url of the environment texture to load.
|
|
559
|
-
* @param options The options to use when loading the environment.
|
|
560
|
-
* @param abortSignal An optional signal that can be used to abort the loading process.
|
|
561
|
-
*/
|
|
562
|
-
async loadEnvironment(url, options, abortSignal) {
|
|
563
|
-
await this._updateEnvironment(url, options, abortSignal);
|
|
564
|
-
}
|
|
565
|
-
/**
|
|
566
|
-
* Unloads the current environment if one is loaded.
|
|
567
|
-
* @param abortSignal An optional signal that can be used to abort the reset.
|
|
568
|
-
*/
|
|
569
|
-
async resetEnvironment(abortSignal) {
|
|
570
|
-
await this._updateEnvironment(undefined, undefined, abortSignal);
|
|
571
|
-
}
|
|
572
|
-
async _updateEnvironment(url, options, abortSignal) {
|
|
573
|
-
this._throwIfDisposedOrAborted(abortSignal);
|
|
574
|
-
this._loadEnvironmentAbortController?.abort("New environment is being loaded before previous environment finished loading.");
|
|
575
|
-
const abortController = (this._loadEnvironmentAbortController = new AbortController());
|
|
576
|
-
await this._loadEnvironmentLock.lockAsync(async () => {
|
|
577
|
-
throwIfAborted(abortSignal, abortController.signal);
|
|
578
|
-
this._snapshotHelper.disableSnapshotRendering();
|
|
579
|
-
this._environment?.dispose();
|
|
580
|
-
this._environment = null;
|
|
581
|
-
this._details.scene.autoClear = true;
|
|
582
|
-
const disposeActions = [];
|
|
583
|
-
try {
|
|
584
|
-
if (url) {
|
|
585
|
-
const cubeTexture = CubeTexture.CreateFromPrefilteredData(url, this._details.scene);
|
|
586
|
-
disposeActions.push(() => cubeTexture.dispose());
|
|
587
|
-
const skybox = createSkybox(this._details.scene, this._details.camera, cubeTexture, this.skyboxBlur);
|
|
588
|
-
disposeActions.push(() => skybox.dispose());
|
|
589
|
-
this._snapshotHelper.fixMeshes([skybox]);
|
|
590
|
-
this._details.scene.environmentTexture = cubeTexture;
|
|
591
|
-
disposeActions.push(() => (this._details.scene.environmentTexture = null));
|
|
592
|
-
this._skybox = skybox;
|
|
593
|
-
disposeActions.push(() => (this._skybox = null));
|
|
594
|
-
this._details.scene.autoClear = false;
|
|
595
|
-
disposeActions.push(() => (this._details.scene.autoClear = true));
|
|
596
|
-
const dispose = () => disposeActions.forEach((dispose) => dispose());
|
|
597
|
-
this._environment = await new Promise((resolve, reject) => {
|
|
598
|
-
const successObserver = cubeTexture.onLoadObservable.addOnce(() => {
|
|
599
|
-
successObserver.remove();
|
|
600
|
-
errorObserver.remove();
|
|
601
|
-
resolve({
|
|
602
|
-
dispose,
|
|
603
|
-
});
|
|
604
|
-
});
|
|
605
|
-
const errorObserver = Texture.OnTextureLoadErrorObservable.add((texture) => {
|
|
606
|
-
if (texture === cubeTexture) {
|
|
607
|
-
successObserver.remove();
|
|
608
|
-
errorObserver.remove();
|
|
609
|
-
dispose();
|
|
610
|
-
reject(new Error("Failed to load environment texture."));
|
|
611
|
-
}
|
|
612
|
-
});
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
this._updateLight();
|
|
616
|
-
this.onEnvironmentChanged.notifyObservers();
|
|
617
|
-
}
|
|
618
|
-
catch (e) {
|
|
619
|
-
disposeActions.forEach((dispose) => dispose());
|
|
620
|
-
this.onEnvironmentError.notifyObservers(e);
|
|
621
|
-
throw e;
|
|
622
|
-
}
|
|
623
|
-
finally {
|
|
624
|
-
this._snapshotHelper.enableSnapshotRendering();
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
/**
|
|
629
|
-
* Toggles the play/pause animation state if there is a selected animation.
|
|
630
|
-
*/
|
|
631
|
-
toggleAnimation() {
|
|
632
|
-
if (this.isAnimationPlaying) {
|
|
633
|
-
this.pauseAnimation();
|
|
634
|
-
}
|
|
635
|
-
else {
|
|
636
|
-
this.playAnimation();
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* Plays the selected animation if there is one.
|
|
641
|
-
*/
|
|
642
|
-
playAnimation() {
|
|
643
|
-
this._activeAnimation?.play(true);
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* Pauses the selected animation if there is one.
|
|
647
|
-
*/
|
|
648
|
-
async pauseAnimation() {
|
|
649
|
-
this._activeAnimation?.pause();
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* Disposes of the resources held by the Viewer.
|
|
653
|
-
*/
|
|
654
|
-
dispose() {
|
|
655
|
-
this.selectedAnimation = -1;
|
|
656
|
-
this.animationProgress = 0;
|
|
657
|
-
this._loadEnvironmentAbortController?.abort("Thew viewer is being disposed.");
|
|
658
|
-
this._loadModelAbortController?.abort("Thew viewer is being disposed.");
|
|
659
|
-
this._renderLoopController?.dispose();
|
|
660
|
-
this._details.scene.dispose();
|
|
661
|
-
this.onEnvironmentChanged.clear();
|
|
662
|
-
this.onEnvironmentError.clear();
|
|
663
|
-
this.onSkyboxBlurChanged.clear();
|
|
664
|
-
this.onPostProcessingChanged.clear();
|
|
665
|
-
this.onModelChanged.clear();
|
|
666
|
-
this.onModelError.clear();
|
|
667
|
-
this.onCameraAutoOrbitChanged.clear();
|
|
668
|
-
this.onSelectedAnimationChanged.clear();
|
|
669
|
-
this.onAnimationSpeedChanged.clear();
|
|
670
|
-
this.onIsAnimationPlayingChanged.clear();
|
|
671
|
-
this.onAnimationProgressChanged.clear();
|
|
672
|
-
this.onLoadingProgressChanged.clear();
|
|
673
|
-
this._imageProcessingConfigurationObserver.remove();
|
|
674
|
-
this._isDisposed = true;
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* retrun world and canvas coordinates of an hot spot
|
|
678
|
-
* @param query mesh index and surface information to query the hot spot positions
|
|
679
|
-
* @param result Query a Hot Spot and does the conversion for Babylon Hot spot to a more generic HotSpotPositions, without Vector types
|
|
680
|
-
* @returns true if hotspot found
|
|
681
|
-
*/
|
|
682
|
-
getHotSpotToRef(query, result) {
|
|
683
|
-
if (!this._details.model) {
|
|
684
|
-
return false;
|
|
685
|
-
}
|
|
686
|
-
const worldNormal = this._tempVectors[2];
|
|
687
|
-
const worldPos = this._tempVectors[1];
|
|
688
|
-
const screenPos = this._tempVectors[0];
|
|
689
|
-
if (query.type === "surface") {
|
|
690
|
-
const mesh = this._details.model.meshes[query.meshIndex];
|
|
691
|
-
if (!mesh) {
|
|
692
|
-
return false;
|
|
693
|
-
}
|
|
694
|
-
if (!GetHotSpotToRef(mesh, query, worldPos, worldNormal)) {
|
|
695
|
-
return false;
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
else {
|
|
699
|
-
worldPos.copyFromFloats(query.position[0], query.position[1], query.position[2]);
|
|
700
|
-
worldNormal.copyFromFloats(query.normal[0], query.normal[1], query.normal[2]);
|
|
701
|
-
}
|
|
702
|
-
const renderWidth = this._engine.getRenderWidth(); // Get the canvas width
|
|
703
|
-
const renderHeight = this._engine.getRenderHeight(); // Get the canvas height
|
|
704
|
-
const viewportWidth = this._details.camera.viewport.width * renderWidth;
|
|
705
|
-
const viewportHeight = this._details.camera.viewport.height * renderHeight;
|
|
706
|
-
const scene = this._details.scene;
|
|
707
|
-
Vector3.ProjectToRef(worldPos, Matrix.IdentityReadOnly, scene.getTransformMatrix(), new Viewport(0, 0, viewportWidth, viewportHeight), screenPos);
|
|
708
|
-
result.screenPosition[0] = screenPos.x;
|
|
709
|
-
result.screenPosition[1] = screenPos.y;
|
|
710
|
-
result.worldPosition[0] = worldPos.x;
|
|
711
|
-
result.worldPosition[1] = worldPos.y;
|
|
712
|
-
result.worldPosition[2] = worldPos.z;
|
|
713
|
-
// visibility
|
|
714
|
-
const eyeToSurface = this._tempVectors[3];
|
|
715
|
-
eyeToSurface.copyFrom(this._details.camera.globalPosition);
|
|
716
|
-
eyeToSurface.subtractInPlace(worldPos);
|
|
717
|
-
eyeToSurface.normalize();
|
|
718
|
-
result.visibility = Vector3.Dot(eyeToSurface, worldNormal);
|
|
719
|
-
return true;
|
|
720
|
-
}
|
|
721
|
-
_suspendRendering() {
|
|
722
|
-
this._renderLoopController?.dispose();
|
|
723
|
-
this._suspendRenderCount++;
|
|
724
|
-
let disposed = false;
|
|
725
|
-
return {
|
|
726
|
-
dispose: () => {
|
|
727
|
-
if (!disposed) {
|
|
728
|
-
disposed = true;
|
|
729
|
-
this._suspendRenderCount--;
|
|
730
|
-
if (this._suspendRenderCount === 0) {
|
|
731
|
-
this._beginRendering();
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
},
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
_beginRendering() {
|
|
738
|
-
if (!this._renderLoopController) {
|
|
739
|
-
const render = () => {
|
|
740
|
-
this._details.scene.render();
|
|
741
|
-
// Update the camera panning sensitivity related properties based on the camera's distance from the target.
|
|
742
|
-
this._details.camera.panningSensibility = 5000 / this._details.camera.radius;
|
|
743
|
-
this._details.camera.speed = this._details.camera.radius * 0.2;
|
|
744
|
-
if (this.isAnimationPlaying) {
|
|
745
|
-
this.onAnimationProgressChanged.notifyObservers();
|
|
746
|
-
this._autoRotationBehavior.resetLastInteractionTime();
|
|
747
|
-
}
|
|
748
|
-
};
|
|
749
|
-
this._engine.runRenderLoop(render);
|
|
750
|
-
let disposed = false;
|
|
751
|
-
this._renderLoopController = {
|
|
752
|
-
dispose: () => {
|
|
753
|
-
if (!disposed) {
|
|
754
|
-
disposed = true;
|
|
755
|
-
this._engine.stopRenderLoop(render);
|
|
756
|
-
this._renderLoopController = null;
|
|
757
|
-
}
|
|
758
|
-
},
|
|
759
|
-
};
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
_updateCamera(interpolate = false) {
|
|
763
|
-
this._details.camera.useFramingBehavior = true;
|
|
764
|
-
const framingBehavior = this._details.camera.getBehaviorByName("Framing");
|
|
765
|
-
framingBehavior.framingTime = 0;
|
|
766
|
-
framingBehavior.elevationReturnTime = -1;
|
|
767
|
-
this._details.camera.useAutoRotationBehavior = true;
|
|
768
|
-
const currentAlpha = this._details.camera.alpha;
|
|
769
|
-
const currentBeta = this._details.camera.beta;
|
|
770
|
-
const currentRadius = this._details.camera.radius;
|
|
771
|
-
const currentTarget = this._details.camera.target;
|
|
772
|
-
const goalAlpha = Math.PI / 2;
|
|
773
|
-
const goalBeta = Math.PI / 2.4;
|
|
774
|
-
let goalRadius = 1;
|
|
775
|
-
let goalTarget = currentTarget;
|
|
776
|
-
if (this._details.model?.meshes.length) {
|
|
777
|
-
// get bounds and prepare framing/camera radius from its values
|
|
778
|
-
this._details.camera.lowerRadiusLimit = null;
|
|
779
|
-
const maxExtents = computeMaxExtents(this._details.model.meshes, this._activeAnimation);
|
|
780
|
-
const worldExtents = {
|
|
781
|
-
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))),
|
|
782
|
-
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))),
|
|
783
|
-
};
|
|
784
|
-
framingBehavior.zoomOnBoundingInfo(worldExtents.min, worldExtents.max);
|
|
785
|
-
const worldSize = worldExtents.max.subtract(worldExtents.min);
|
|
786
|
-
const worldCenter = worldExtents.min.add(worldSize.scale(0.5));
|
|
787
|
-
goalRadius = worldSize.length() * 1.1;
|
|
788
|
-
if (!isFinite(goalRadius)) {
|
|
789
|
-
goalRadius = 1;
|
|
790
|
-
worldCenter.copyFromFloats(0, 0, 0);
|
|
791
|
-
}
|
|
792
|
-
goalTarget = worldCenter;
|
|
793
|
-
}
|
|
794
|
-
this._details.camera.alpha = Math.PI / 2;
|
|
795
|
-
this._details.camera.beta = Math.PI / 2.4;
|
|
796
|
-
this._details.camera.radius = goalRadius;
|
|
797
|
-
this._details.camera.target = goalTarget;
|
|
798
|
-
this._details.camera.lowerRadiusLimit = goalRadius * 0.001;
|
|
799
|
-
this._details.camera.upperRadiusLimit = goalRadius * 5;
|
|
800
|
-
this._details.camera.minZ = goalRadius * 0.001;
|
|
801
|
-
this._details.camera.maxZ = goalRadius * 1000;
|
|
802
|
-
this._details.camera.wheelDeltaPercentage = 0.01;
|
|
803
|
-
this._details.camera.useNaturalPinchZoom = true;
|
|
804
|
-
this._details.camera.restoreStateInterpolationFactor = 0.1;
|
|
805
|
-
this._details.camera.storeState();
|
|
806
|
-
if (interpolate) {
|
|
807
|
-
this._details.camera.alpha = currentAlpha;
|
|
808
|
-
this._details.camera.beta = currentBeta;
|
|
809
|
-
this._details.camera.radius = currentRadius;
|
|
810
|
-
this._details.camera.target = currentTarget;
|
|
811
|
-
this._details.camera.interpolateTo(goalAlpha, goalBeta, goalRadius, goalTarget);
|
|
812
|
-
}
|
|
813
|
-
updateSkybox(this._skybox, this._details.camera);
|
|
814
|
-
}
|
|
815
|
-
_updateLight() {
|
|
816
|
-
let shouldHaveDefaultLight;
|
|
817
|
-
if (!this._details.model) {
|
|
818
|
-
shouldHaveDefaultLight = false;
|
|
819
|
-
}
|
|
820
|
-
else {
|
|
821
|
-
const hasModelProvidedLights = this._details.model.lights.length > 0;
|
|
822
|
-
const hasImageBasedLighting = !!this._environment;
|
|
823
|
-
const hasMaterials = this._details.model.materials.length > 0;
|
|
824
|
-
const hasNonPBRMaterials = this._details.model.materials.some((material) => !(material instanceof PBRMaterial));
|
|
825
|
-
if (hasModelProvidedLights) {
|
|
826
|
-
shouldHaveDefaultLight = false;
|
|
827
|
-
}
|
|
828
|
-
else {
|
|
829
|
-
shouldHaveDefaultLight = !hasImageBasedLighting || !hasMaterials || hasNonPBRMaterials;
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
if (shouldHaveDefaultLight) {
|
|
833
|
-
if (!this._light) {
|
|
834
|
-
this._light = new HemisphericLight("defaultLight", Vector3.Up(), this._details.scene);
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
else {
|
|
838
|
-
this._light?.dispose();
|
|
839
|
-
this._light = null;
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
_applyAnimationSpeed() {
|
|
843
|
-
this._details.model?.animationGroups.forEach((group) => (group.speedRatio = this._animationSpeed));
|
|
844
|
-
}
|
|
845
|
-
async _pick(screenX, screenY) {
|
|
846
|
-
await import('@babylonjs/core/Culling/ray.js');
|
|
847
|
-
if (this._details.model) {
|
|
848
|
-
const model = this._details.model;
|
|
849
|
-
// Refresh bounding info to ensure morph target and skeletal animations are taken into account.
|
|
850
|
-
model.meshes.forEach((mesh) => {
|
|
851
|
-
let cache = this._meshDataCache.get(mesh);
|
|
852
|
-
if (!cache) {
|
|
853
|
-
cache = {};
|
|
854
|
-
this._meshDataCache.set(mesh, cache);
|
|
855
|
-
}
|
|
856
|
-
mesh.refreshBoundingInfo({ applyMorph: true, applySkeleton: true, cache });
|
|
857
|
-
});
|
|
858
|
-
const pickingInfo = this._details.scene.pick(screenX, screenY, (mesh) => model.meshes.includes(mesh));
|
|
859
|
-
if (pickingInfo.hit) {
|
|
860
|
-
return pickingInfo;
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
return null;
|
|
864
|
-
}
|
|
865
|
-
/**
|
|
866
|
-
* Check for disposed or aborted state (basically everything that can interrupt an async operation).
|
|
867
|
-
* @param abortSignals A set of optional AbortSignals to also check.
|
|
868
|
-
*/
|
|
869
|
-
_throwIfDisposedOrAborted(...abortSignals) {
|
|
870
|
-
if (this._isDisposed) {
|
|
871
|
-
throw new Error("Viewer is disposed.");
|
|
872
|
-
}
|
|
873
|
-
throwIfAborted(...abortSignals);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
(() => {
|
|
877
|
-
registerBuiltInLoaders();
|
|
878
|
-
})();
|
|
879
|
-
|
|
880
|
-
/**
|
|
881
|
-
* @license
|
|
882
|
-
* Copyright 2019 Google LLC
|
|
883
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
884
|
-
*/
|
|
885
|
-
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;
|
|
886
|
-
|
|
887
|
-
/**
|
|
888
|
-
* @license
|
|
889
|
-
* Copyright 2017 Google LLC
|
|
890
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
891
|
-
*/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");
|
|
892
|
-
|
|
893
|
-
/**
|
|
894
|
-
* @license
|
|
895
|
-
* Copyright 2017 Google LLC
|
|
896
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
897
|
-
*/
|
|
898
|
-
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};
|
|
899
|
-
|
|
900
|
-
/**
|
|
901
|
-
* @license
|
|
902
|
-
* Copyright 2017 Google LLC
|
|
903
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
904
|
-
*/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");
|
|
905
|
-
|
|
906
|
-
/**
|
|
907
|
-
* @license
|
|
908
|
-
* Copyright 2017 Google LLC
|
|
909
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
910
|
-
*/
|
|
911
|
-
const t=t=>(e,o)=>{void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
|
|
912
|
-
|
|
913
|
-
/**
|
|
914
|
-
* @license
|
|
915
|
-
* Copyright 2017 Google LLC
|
|
916
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
917
|
-
*/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)}
|
|
918
|
-
|
|
919
|
-
/**
|
|
920
|
-
* @license
|
|
921
|
-
* Copyright 2017 Google LLC
|
|
922
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
923
|
-
*/function r(r){return n({...r,state:!0,attribute:!1})}
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* @license
|
|
927
|
-
* Copyright 2017 Google LLC
|
|
928
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
929
|
-
*/
|
|
930
|
-
const e$1=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
|
|
931
|
-
|
|
932
|
-
/**
|
|
933
|
-
* @license
|
|
934
|
-
* Copyright 2017 Google LLC
|
|
935
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
936
|
-
*/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)}})}}
|
|
937
|
-
|
|
938
|
-
const defaultCanvasViewerOptions = {};
|
|
939
|
-
/**
|
|
940
|
-
* Chooses a default engine for the current browser environment.
|
|
941
|
-
* @returns The default engine to use.
|
|
942
|
-
*/
|
|
943
|
-
function getDefaultEngine() {
|
|
944
|
-
// TODO: When WebGPU is fully production ready, we may want to prefer it if it is supported by the browser.
|
|
945
|
-
return "WebGL";
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
* @experimental
|
|
949
|
-
* Creates a Viewer instance that is bound to an HTML canvas.
|
|
950
|
-
* @remarks
|
|
951
|
-
* This function can be shared across multiple UI integrations (e.g. Web Components, React, etc.).
|
|
952
|
-
* @param canvas The canvas element to bind the Viewer to.
|
|
953
|
-
* @param options The options to use when creating the Viewer and binding it to the specified canvas.
|
|
954
|
-
* @returns A Viewer instance that is bound to the specified canvas.
|
|
955
|
-
*/
|
|
956
|
-
async function createViewerForCanvas(canvas, options) {
|
|
957
|
-
const finalOptions = { ...defaultCanvasViewerOptions, ...options };
|
|
958
|
-
const disposeActions = [];
|
|
959
|
-
// If the canvas is resized, note that the engine needs a resize, but don't resize it here as it will result in flickering.
|
|
960
|
-
let needsResize = false;
|
|
961
|
-
const resizeObserver = new ResizeObserver(() => (needsResize = true));
|
|
962
|
-
resizeObserver.observe(canvas);
|
|
963
|
-
disposeActions.push(() => resizeObserver.disconnect());
|
|
964
|
-
// Create an engine instance.
|
|
965
|
-
let engine;
|
|
966
|
-
switch (finalOptions.engine ?? getDefaultEngine()) {
|
|
967
|
-
case "WebGL": {
|
|
968
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention, no-case-declarations
|
|
969
|
-
const { Engine } = await import('@babylonjs/core/Engines/engine.js');
|
|
970
|
-
engine = new Engine(canvas, undefined, options);
|
|
971
|
-
break;
|
|
972
|
-
}
|
|
973
|
-
case "WebGPU": {
|
|
974
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention, no-case-declarations
|
|
975
|
-
const { WebGPUEngine } = await import('@babylonjs/core/Engines/webgpuEngine.js');
|
|
976
|
-
const webGPUEngine = new WebGPUEngine(canvas, options);
|
|
977
|
-
await webGPUEngine.initAsync();
|
|
978
|
-
engine = webGPUEngine;
|
|
979
|
-
break;
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
// Override the onInitialized callback to add in some specific behavior.
|
|
983
|
-
const onInitialized = finalOptions.onInitialized;
|
|
984
|
-
finalOptions.onInitialized = (details) => {
|
|
985
|
-
// Resize if needed right before rendering the Viewer scene to avoid any flickering.
|
|
986
|
-
const beforeRenderObserver = details.scene.onBeforeRenderObservable.add(() => {
|
|
987
|
-
if (needsResize) {
|
|
988
|
-
engine.resize();
|
|
989
|
-
needsResize = false;
|
|
990
|
-
}
|
|
991
|
-
});
|
|
992
|
-
disposeActions.push(() => beforeRenderObserver.remove());
|
|
993
|
-
// If the canvas is not visible, suspend rendering.
|
|
994
|
-
let offscreenRenderingSuspension = null;
|
|
995
|
-
const interactionObserver = new IntersectionObserver((entries) => {
|
|
996
|
-
if (entries.length > 0) {
|
|
997
|
-
if (entries[entries.length - 1].isIntersecting) {
|
|
998
|
-
offscreenRenderingSuspension?.dispose();
|
|
999
|
-
offscreenRenderingSuspension = null;
|
|
1000
|
-
}
|
|
1001
|
-
else {
|
|
1002
|
-
offscreenRenderingSuspension = details.suspendRendering();
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
});
|
|
1006
|
-
interactionObserver.observe(canvas);
|
|
1007
|
-
disposeActions.push(() => interactionObserver.disconnect());
|
|
1008
|
-
// Call the original onInitialized callback, if one was provided.
|
|
1009
|
-
onInitialized?.(details);
|
|
1010
|
-
};
|
|
1011
|
-
// Instantiate the Viewer with the engine and options.
|
|
1012
|
-
const viewer = new Viewer(engine, finalOptions);
|
|
1013
|
-
disposeActions.push(viewer.dispose.bind(viewer));
|
|
1014
|
-
disposeActions.push(() => engine.dispose());
|
|
1015
|
-
// Override the Viewer's dispose method to add in additional cleanup.
|
|
1016
|
-
viewer.dispose = () => disposeActions.forEach((dispose) => dispose());
|
|
1017
|
-
return viewer;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
var HTML3DElement_1;
|
|
1021
|
-
// Icon SVG is pulled from https://react.fluentui.dev/?path=/docs/icons-catalog--docs
|
|
1022
|
-
const playFilledIcon = "M17.22 8.68a1.5 1.5 0 0 1 0 2.63l-10 5.5A1.5 1.5 0 0 1 5 15.5v-11A1.5 1.5 0 0 1 7.22 3.2l10 5.5Z";
|
|
1023
|
-
const pauseFilledIcon = "M5 2a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h2a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H5Zm8 0a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h2a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-2Z";
|
|
1024
|
-
const targetFilledIcon = "M10 11.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM5 10a5 5 0 1 1 10 0 5 5 0 0 1-10 0Zm5-3.5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7ZM2 10a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Z";
|
|
1025
|
-
const allowedAnimationSpeeds = [0.5, 1, 1.5, 2];
|
|
1026
|
-
// Converts any standard html color string to a Color4 object.
|
|
1027
|
-
function parseColor(color) {
|
|
1028
|
-
if (!color) {
|
|
1029
|
-
return null;
|
|
1030
|
-
}
|
|
1031
|
-
const canvas = document.createElement("canvas");
|
|
1032
|
-
canvas.width = canvas.height = 1;
|
|
1033
|
-
const context = canvas.getContext("2d");
|
|
1034
|
-
if (!context) {
|
|
1035
|
-
throw new Error("Unable to get 2d context for parseColor");
|
|
1036
|
-
}
|
|
1037
|
-
context.clearRect(0, 0, 1, 1);
|
|
1038
|
-
context.fillStyle = color;
|
|
1039
|
-
context.fillRect(0, 0, 1, 1);
|
|
1040
|
-
const data = context.getImageData(0, 0, 1, 1).data;
|
|
1041
|
-
return new Color4(data[0] / 255, data[1] / 255, data[2] / 255, data[3] / 255);
|
|
1042
|
-
}
|
|
1043
|
-
/**
|
|
1044
|
-
* Displays a 3D model using the Babylon.js Viewer.
|
|
1045
|
-
*/
|
|
1046
|
-
let HTML3DElement = HTML3DElement_1 = class HTML3DElement extends r$2 {
|
|
1047
|
-
constructor() {
|
|
1048
|
-
super(...arguments);
|
|
1049
|
-
this._viewerLock = new AsyncLock();
|
|
1050
|
-
// Bindings for properties that are synchronized both ways between the lower level Viewer and the HTML3DElement.
|
|
1051
|
-
this._propertyBindings = [
|
|
1052
|
-
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)),
|
|
1053
|
-
this._createPropertyBinding("skyboxBlur", (details) => details.viewer.onSkyboxBlurChanged, (details) => (details.viewer.skyboxBlur = this.skyboxBlur ?? details.viewer.skyboxBlur), (details) => (this.skyboxBlur = details.viewer.skyboxBlur)),
|
|
1054
|
-
this._createPropertyBinding("toneMapping", (details) => details.viewer.onPostProcessingChanged, (details) => {
|
|
1055
|
-
if (this.toneMapping) {
|
|
1056
|
-
details.viewer.postProcessing = { toneMapping: this.toneMapping };
|
|
1057
|
-
}
|
|
1058
|
-
}, (details) => (this.toneMapping = details.viewer.postProcessing?.toneMapping)),
|
|
1059
|
-
this._createPropertyBinding("contrast", (details) => details.viewer.onPostProcessingChanged, (details) => (details.viewer.postProcessing = { contrast: this.contrast ?? undefined }), (details) => (this.contrast = details.viewer.postProcessing.contrast)),
|
|
1060
|
-
this._createPropertyBinding("exposure", (details) => details.viewer.onPostProcessingChanged, (details) => (details.viewer.postProcessing = { exposure: this.exposure ?? undefined }), (details) => (this.exposure = details.viewer.postProcessing.exposure)),
|
|
1061
|
-
this._createPropertyBinding("cameraAutoOrbit", (details) => details.viewer.onCameraAutoOrbitChanged, (details) => (details.viewer.cameraAutoOrbit = { enabled: this.cameraAutoOrbit }), (details) => (this.cameraAutoOrbit = details.viewer.cameraAutoOrbit.enabled)),
|
|
1062
|
-
this._createPropertyBinding("cameraAutoOrbitSpeed", (details) => details.viewer.onCameraAutoOrbitChanged, (details) => (details.viewer.cameraAutoOrbit = { speed: this.cameraAutoOrbitSpeed ?? undefined }), (details) => (this.cameraAutoOrbitSpeed = details.viewer.cameraAutoOrbit.speed)),
|
|
1063
|
-
this._createPropertyBinding("cameraAutoOrbitDelay", (details) => details.viewer.onCameraAutoOrbitChanged, (details) => (details.viewer.cameraAutoOrbit = { delay: this.cameraAutoOrbitDelay ?? undefined }), (details) => (this.cameraAutoOrbitDelay = details.viewer.cameraAutoOrbit.delay)),
|
|
1064
|
-
this._createPropertyBinding("animationSpeed", (details) => details.viewer.onAnimationSpeedChanged, (details) => (details.viewer.animationSpeed = this.animationSpeed), (details) => {
|
|
1065
|
-
let speed = details.viewer.animationSpeed;
|
|
1066
|
-
speed = allowedAnimationSpeeds.reduce((prev, curr) => (Math.abs(curr - speed) < Math.abs(prev - speed) ? curr : prev));
|
|
1067
|
-
this.animationSpeed = speed;
|
|
1068
|
-
this._dispatchCustomEvent("animationspeedchange", (type) => new Event(type));
|
|
1069
|
-
}),
|
|
1070
|
-
this._createPropertyBinding("selectedAnimation", (details) => details.viewer.onSelectedAnimationChanged, (details) => (details.viewer.selectedAnimation = this.selectedAnimation ?? details.viewer.selectedAnimation), (details) => (this.selectedAnimation = details.viewer.selectedAnimation)),
|
|
1071
|
-
this._createPropertyBinding("selectedMaterialVariant", (details) => details.viewer.onSelectedMaterialVariantChanged, (details) => (details.viewer.selectedMaterialVariant = this.selectedMaterialVariant ?? details.viewer.selectedMaterialVariant ?? ""), (details) => (this.selectedMaterialVariant = details.viewer.selectedMaterialVariant)),
|
|
1072
|
-
];
|
|
1073
|
-
/**
|
|
1074
|
-
* The engine to use for rendering.
|
|
1075
|
-
*/
|
|
1076
|
-
this.engine = getDefaultEngine();
|
|
1077
|
-
/**
|
|
1078
|
-
* The model URL.
|
|
1079
|
-
*/
|
|
1080
|
-
this.source = null;
|
|
1081
|
-
/**
|
|
1082
|
-
* Forces the model to be loaded with the specified extension.
|
|
1083
|
-
* @remarks
|
|
1084
|
-
* If this property is not set, the extension will be inferred from the model URL when possible.
|
|
1085
|
-
*/
|
|
1086
|
-
this.extension = null;
|
|
1087
|
-
/**
|
|
1088
|
-
* The environment URL.
|
|
1089
|
-
*/
|
|
1090
|
-
this.environment = null;
|
|
1091
|
-
this._loadingProgress = false;
|
|
1092
|
-
/**
|
|
1093
|
-
* A value between 0 and 1 that specifies how much to blur the skybox.
|
|
1094
|
-
*/
|
|
1095
|
-
this.skyboxBlur = null;
|
|
1096
|
-
/**
|
|
1097
|
-
* The tone mapping to use for rendering the scene.
|
|
1098
|
-
*/
|
|
1099
|
-
this.toneMapping = null;
|
|
1100
|
-
/**
|
|
1101
|
-
* The contrast applied to the scene.
|
|
1102
|
-
*/
|
|
1103
|
-
this.contrast = null;
|
|
1104
|
-
/**
|
|
1105
|
-
* The exposure applied to the scene.
|
|
1106
|
-
*/
|
|
1107
|
-
this.exposure = null;
|
|
1108
|
-
/**
|
|
1109
|
-
* The clear color (e.g. background color) for the viewer.
|
|
1110
|
-
*/
|
|
1111
|
-
this.clearColor = null;
|
|
1112
|
-
/**
|
|
1113
|
-
* Enables or disables camera auto-orbit.
|
|
1114
|
-
*/
|
|
1115
|
-
this.cameraAutoOrbit = false;
|
|
1116
|
-
/**
|
|
1117
|
-
* The speed at which the camera auto-orbits around the target.
|
|
1118
|
-
*/
|
|
1119
|
-
this.cameraAutoOrbitSpeed = null;
|
|
1120
|
-
/**
|
|
1121
|
-
* The delay in milliseconds before the camera starts auto-orbiting.
|
|
1122
|
-
*/
|
|
1123
|
-
this.cameraAutoOrbitDelay = null;
|
|
1124
|
-
/**
|
|
1125
|
-
* Camera orbit can only be set as an attribute, and is set on the camera each time a new model is loaded.
|
|
1126
|
-
* For access to the real time camera properties, use viewerDetails.camera.
|
|
1127
|
-
*/
|
|
1128
|
-
this._cameraOrbitCoercer = null;
|
|
1129
|
-
/**
|
|
1130
|
-
* Camera target can only be set as an attribute, and is set on the camera each time a new model is loaded.
|
|
1131
|
-
* For access to the real time camera properties, use viewerDetails.camera.
|
|
1132
|
-
*/
|
|
1133
|
-
this._cameraTargetCoercer = null;
|
|
1134
|
-
/**
|
|
1135
|
-
* A string value that encodes one or more hotspots.
|
|
1136
|
-
*/
|
|
1137
|
-
this.hotSpots = {};
|
|
1138
|
-
/**
|
|
1139
|
-
* True if the default animation should play automatically when a model is loaded.
|
|
1140
|
-
*/
|
|
1141
|
-
this.animationAutoPlay = false;
|
|
1142
|
-
/**
|
|
1143
|
-
* The currently selected animation index.
|
|
1144
|
-
*/
|
|
1145
|
-
this.selectedAnimation = null;
|
|
1146
|
-
/**
|
|
1147
|
-
* The speed scale at which animations are played.
|
|
1148
|
-
*/
|
|
1149
|
-
this.animationSpeed = 1;
|
|
1150
|
-
/**
|
|
1151
|
-
* The current point on the selected animation timeline, normalized between 0 and 1.
|
|
1152
|
-
*/
|
|
1153
|
-
this.animationProgress = 0;
|
|
1154
|
-
this._animations = [];
|
|
1155
|
-
this._isAnimationPlaying = false;
|
|
1156
|
-
/**
|
|
1157
|
-
* The currently selected material variant.
|
|
1158
|
-
*/
|
|
1159
|
-
this.selectedMaterialVariant = null;
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* Gets the underlying viewer details (when the underlying viewer is in a loaded state).
|
|
1163
|
-
* This is useful for advanced scenarios where direct access to the viewer or Babylon scene is needed.
|
|
1164
|
-
*/
|
|
1165
|
-
get viewerDetails() {
|
|
1166
|
-
return this._viewerDetails;
|
|
1167
|
-
}
|
|
1168
|
-
/**
|
|
1169
|
-
* Get hotspot world and screen values from a named hotspot
|
|
1170
|
-
* @param name slot of the hot spot
|
|
1171
|
-
* @param result resulting world and screen positions
|
|
1172
|
-
* @returns world position, world normal and screen space coordinates
|
|
1173
|
-
*/
|
|
1174
|
-
queryHotSpot(name, result) {
|
|
1175
|
-
return this._queryHotSpot(name, result) != null;
|
|
1176
|
-
}
|
|
1177
|
-
_queryHotSpot(name, result) {
|
|
1178
|
-
if (this._viewerDetails) {
|
|
1179
|
-
const hotSpot = this.hotSpots?.[name];
|
|
1180
|
-
if (hotSpot) {
|
|
1181
|
-
if (this._viewerDetails.viewer.getHotSpotToRef(hotSpot, result)) {
|
|
1182
|
-
return hotSpot;
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
return null;
|
|
1187
|
-
}
|
|
1188
|
-
/**
|
|
1189
|
-
* Updates the camera to focus on a named hotspot.
|
|
1190
|
-
* @param name The name of the hotspot to focus on.
|
|
1191
|
-
* @returns true if the hotspot was found and the camera was updated, false otherwise.
|
|
1192
|
-
*/
|
|
1193
|
-
focusHotSpot(name) {
|
|
1194
|
-
const result = new ViewerHotSpotResult();
|
|
1195
|
-
const query = this._queryHotSpot(name, result);
|
|
1196
|
-
if (query && this._viewerDetails) {
|
|
1197
|
-
this._viewerDetails.viewer.pauseAnimation();
|
|
1198
|
-
const cameraOrbit = query.cameraOrbit ?? [undefined, undefined, undefined];
|
|
1199
|
-
this._viewerDetails.camera.interpolateTo(cameraOrbit[0], cameraOrbit[1], cameraOrbit[2], new Vector3(result.worldPosition[0], result.worldPosition[1], result.worldPosition[2]));
|
|
1200
|
-
return true;
|
|
1201
|
-
}
|
|
1202
|
-
return false;
|
|
1203
|
-
}
|
|
1204
|
-
/**
|
|
1205
|
-
* Gets information about loading activity.
|
|
1206
|
-
* @remarks
|
|
1207
|
-
* false indicates no loading activity.
|
|
1208
|
-
* true indicates loading activity with no progress information.
|
|
1209
|
-
* A number between 0 and 1 indicates loading activity with progress information.
|
|
1210
|
-
*/
|
|
1211
|
-
get loadingProgress() {
|
|
1212
|
-
return this._loadingProgress;
|
|
1213
|
-
}
|
|
1214
|
-
get _hasHotSpots() {
|
|
1215
|
-
return Object.keys(this.hotSpots).length > 0;
|
|
1216
|
-
}
|
|
1217
|
-
/**
|
|
1218
|
-
* The list of animation names for the currently loaded model.
|
|
1219
|
-
*/
|
|
1220
|
-
get animations() {
|
|
1221
|
-
return this._animations;
|
|
1222
|
-
}
|
|
1223
|
-
get _hasAnimations() {
|
|
1224
|
-
return this._animations.length > 0;
|
|
1225
|
-
}
|
|
1226
|
-
/**
|
|
1227
|
-
* True if an animation is currently playing.
|
|
1228
|
-
*/
|
|
1229
|
-
get isAnimationPlaying() {
|
|
1230
|
-
return this._isAnimationPlaying;
|
|
1231
|
-
}
|
|
1232
|
-
/**
|
|
1233
|
-
* The list of material variants for the currently loaded model.
|
|
1234
|
-
*/
|
|
1235
|
-
get materialVariants() {
|
|
1236
|
-
return this._viewerDetails?.viewer.materialVariants ?? [];
|
|
1237
|
-
}
|
|
1238
|
-
/**
|
|
1239
|
-
* Toggles the play/pause animation state if there is a selected animation.
|
|
1240
|
-
*/
|
|
1241
|
-
toggleAnimation() {
|
|
1242
|
-
this._viewerDetails?.viewer.toggleAnimation();
|
|
1243
|
-
}
|
|
1244
|
-
// eslint-disable-next-line babylonjs/available
|
|
1245
|
-
connectedCallback() {
|
|
1246
|
-
super.connectedCallback();
|
|
1247
|
-
this._setupViewer();
|
|
1248
|
-
}
|
|
1249
|
-
// eslint-disable-next-line babylonjs/available
|
|
1250
|
-
disconnectedCallback() {
|
|
1251
|
-
super.disconnectedCallback();
|
|
1252
|
-
this._tearDownViewer();
|
|
1253
|
-
}
|
|
1254
|
-
// eslint-disable-next-line babylonjs/available
|
|
1255
|
-
update(changedProperties) {
|
|
1256
|
-
super.update(changedProperties);
|
|
1257
|
-
if (this._materialSelect) {
|
|
1258
|
-
this._materialSelect.value = "";
|
|
1259
|
-
}
|
|
1260
|
-
if (changedProperties.get("engine")) {
|
|
1261
|
-
this._tearDownViewer();
|
|
1262
|
-
this._setupViewer();
|
|
1263
|
-
}
|
|
1264
|
-
else {
|
|
1265
|
-
this._propertyBindings.filter((binding) => changedProperties.has(binding.property)).forEach((binding) => binding.updateViewer());
|
|
1266
|
-
if (changedProperties.has("source")) {
|
|
1267
|
-
this._updateModel();
|
|
1268
|
-
}
|
|
1269
|
-
if (changedProperties.has("environment")) {
|
|
1270
|
-
this._updateEnv();
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
// eslint-disable-next-line babylonjs/available
|
|
1275
|
-
render() {
|
|
1276
|
-
const showProgressBar = this.loadingProgress !== false;
|
|
1277
|
-
// If loadingProgress is true, then the progress bar is indeterminate so the value doesn't matter.
|
|
1278
|
-
const progressValue = typeof this.loadingProgress === "boolean" ? 0 : this.loadingProgress * 100;
|
|
1279
|
-
const isIndeterminate = this.loadingProgress === true;
|
|
1280
|
-
const progressBar = x `
|
|
1281
|
-
<div part="progress-bar" class="bar loading-progress-outer ${showProgressBar ? "" : "loading-progress-outer-inactive"}" aria-label="Loading Progress">
|
|
1282
|
-
<div
|
|
1283
|
-
class="loading-progress-inner ${isIndeterminate ? "loading-progress-inner-indeterminate" : ""}"
|
|
1284
|
-
style="${isIndeterminate ? "" : `width: ${progressValue}%`}"
|
|
1285
|
-
></div>
|
|
1286
|
-
</div>
|
|
1287
|
-
`;
|
|
1288
|
-
// Setup the list of toolbar controls.
|
|
1289
|
-
let toolbarControls = [];
|
|
1290
|
-
if (this._viewerDetails?.model != null) {
|
|
1291
|
-
// If the model has animations, add animation controls.
|
|
1292
|
-
if (this._hasAnimations) {
|
|
1293
|
-
toolbarControls.push(x `
|
|
1294
|
-
<div class="animation-timeline">
|
|
1295
|
-
<button aria-label="${this.isAnimationPlaying ? "Pause" : "Play"}" @click="${this.toggleAnimation}">
|
|
1296
|
-
${!this.isAnimationPlaying
|
|
1297
|
-
? x `
|
|
1298
|
-
<svg viewBox="0 0 20 20">
|
|
1299
|
-
<path d="${playFilledIcon}" fill="currentColor"></path>
|
|
1300
|
-
</svg>
|
|
1301
|
-
`
|
|
1302
|
-
: x `
|
|
1303
|
-
<svg viewBox="-3 -2 24 24">
|
|
1304
|
-
<path d="${pauseFilledIcon}" fill="currentColor"></path>
|
|
1305
|
-
</svg>
|
|
1306
|
-
`}
|
|
1307
|
-
</button>
|
|
1308
|
-
<input
|
|
1309
|
-
aria-label="Animation Progress"
|
|
1310
|
-
class="animation-timeline-input"
|
|
1311
|
-
type="range"
|
|
1312
|
-
min="0"
|
|
1313
|
-
max="1"
|
|
1314
|
-
step="0.0001"
|
|
1315
|
-
.value="${this.animationProgress}"
|
|
1316
|
-
@input="${this._onAnimationTimelineChanged}"
|
|
1317
|
-
@pointerdown="${this._onAnimationTimelinePointerDown}"
|
|
1318
|
-
/>
|
|
1319
|
-
</div>
|
|
1320
|
-
<select aria-label="Select Animation Speed" @change="${this._onAnimationSpeedChanged}">
|
|
1321
|
-
${allowedAnimationSpeeds.map((speed) => x `<option value="${speed}" .selected="${this.animationSpeed === speed}">${speed}x</option> `)}
|
|
1322
|
-
</select>
|
|
1323
|
-
${this.animations.length > 1
|
|
1324
|
-
? x `<select aria-label="Select Animation" @change="${this._onSelectedAnimationChanged}">
|
|
1325
|
-
${this.animations.map((name, index) => x `<option value="${index}" .selected="${this.selectedAnimation === index}">${name}</option>`)}
|
|
1326
|
-
</select>`
|
|
1327
|
-
: ""}
|
|
1328
|
-
`);
|
|
1329
|
-
}
|
|
1330
|
-
// If the model has material variants, add material variant controls.
|
|
1331
|
-
if (this.materialVariants.length > 1) {
|
|
1332
|
-
toolbarControls.push(x `
|
|
1333
|
-
<select aria-label="Select Material Variant" @change="${this._onMaterialVariantChanged}">
|
|
1334
|
-
${this.materialVariants.map((name) => x `<option value="${name}" .selected="${this.selectedMaterialVariant === name}">${name}</option>`)}
|
|
1335
|
-
</select>
|
|
1336
|
-
`);
|
|
1337
|
-
}
|
|
1338
|
-
// If hotspots have been defined, add hotspot controls.
|
|
1339
|
-
if (this._hasHotSpots) {
|
|
1340
|
-
toolbarControls.push(x `
|
|
1341
|
-
<div class="select-container">
|
|
1342
|
-
<select id="materialSelect" aria-label="Select HotSpot" @change="${this._onHotSpotsChanged}">
|
|
1343
|
-
<!-- When the select is forced to be less wide than the options, padding on the right is lost. Pad with white space. -->
|
|
1344
|
-
${Object.keys(this.hotSpots).map((name) => x `<option value="${name}">${name} </option>`)}
|
|
1345
|
-
</select>
|
|
1346
|
-
<!-- This button is not actually interactive, we want input to pass through to the select below. -->
|
|
1347
|
-
<button style="pointer-events: none">
|
|
1348
|
-
<svg viewBox="0 0 20 20">
|
|
1349
|
-
<path d="${targetFilledIcon}" fill="currentColor"></path>
|
|
1350
|
-
</svg>
|
|
1351
|
-
</button>
|
|
1352
|
-
</div>
|
|
1353
|
-
`);
|
|
1354
|
-
}
|
|
1355
|
-
// Add a vertical divider between each toolbar control.
|
|
1356
|
-
const controlCount = toolbarControls.length;
|
|
1357
|
-
const separator = x `<div class="divider"></div>`;
|
|
1358
|
-
toolbarControls = toolbarControls.reduce((toolbarControls, toolbarControl, index) => {
|
|
1359
|
-
if (index < controlCount - 1) {
|
|
1360
|
-
return [...toolbarControls, toolbarControl, separator];
|
|
1361
|
-
}
|
|
1362
|
-
else {
|
|
1363
|
-
return [...toolbarControls, toolbarControl];
|
|
1364
|
-
}
|
|
1365
|
-
}, new Array());
|
|
1366
|
-
}
|
|
1367
|
-
// NOTE: The unnamed 'slot' element holds all child elements of the <babylon-viewer> that do not specify a 'slot' attribute.
|
|
1368
|
-
return x `
|
|
1369
|
-
<div class="full-size">
|
|
1370
|
-
<div id="canvasContainer" class="full-size"></div>
|
|
1371
|
-
<slot class="full-size children-slot"></slot>
|
|
1372
|
-
<slot name="progress-bar"> ${progressBar}</slot>
|
|
1373
|
-
${toolbarControls.length === 0
|
|
1374
|
-
? ""
|
|
1375
|
-
: x `
|
|
1376
|
-
<slot name="tool-bar">
|
|
1377
|
-
<div part="tool-bar" class="bar ${this._hasAnimations ? "" : "bar-min"} tool-bar">${toolbarControls}</div>
|
|
1378
|
-
</slot>
|
|
1379
|
-
`}
|
|
1380
|
-
</div>
|
|
1381
|
-
`;
|
|
1382
|
-
}
|
|
1383
|
-
addEventListener(type, listener, options) {
|
|
1384
|
-
super.addEventListener(type, listener, options);
|
|
1385
|
-
}
|
|
1386
|
-
_dispatchCustomEvent(type, event) {
|
|
1387
|
-
this.dispatchEvent(event(type));
|
|
1388
|
-
}
|
|
1389
|
-
_onSelectedAnimationChanged(event) {
|
|
1390
|
-
const selectElement = event.target;
|
|
1391
|
-
this.selectedAnimation = Number(selectElement.value);
|
|
1392
|
-
}
|
|
1393
|
-
_onAnimationSpeedChanged(event) {
|
|
1394
|
-
const selectElement = event.target;
|
|
1395
|
-
this.animationSpeed = Number(selectElement.value);
|
|
1396
|
-
}
|
|
1397
|
-
_onAnimationTimelineChanged(event) {
|
|
1398
|
-
if (this._viewerDetails) {
|
|
1399
|
-
const input = event.target;
|
|
1400
|
-
const value = Number(input.value);
|
|
1401
|
-
if (value !== this.animationProgress) {
|
|
1402
|
-
this._viewerDetails.viewer.animationProgress = value;
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
|
-
_onAnimationTimelinePointerDown(event) {
|
|
1407
|
-
if (this._viewerDetails?.viewer.isAnimationPlaying) {
|
|
1408
|
-
this._viewerDetails.viewer.pauseAnimation();
|
|
1409
|
-
const input = event.target;
|
|
1410
|
-
input.addEventListener("pointerup", () => this._viewerDetails?.viewer.playAnimation(), { once: true });
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
_onMaterialVariantChanged(event) {
|
|
1414
|
-
const selectElement = event.target;
|
|
1415
|
-
this.selectedMaterialVariant = selectElement.value;
|
|
1416
|
-
}
|
|
1417
|
-
_onHotSpotsChanged(event) {
|
|
1418
|
-
const selectElement = event.target;
|
|
1419
|
-
const hotSpotName = selectElement.value;
|
|
1420
|
-
// We don't actually want a selected value, this is just a one time trigger.
|
|
1421
|
-
selectElement.value = "";
|
|
1422
|
-
this.focusHotSpot(hotSpotName);
|
|
1423
|
-
}
|
|
1424
|
-
// Helper function to simplify keeping Viewer properties in sync with HTML3DElement properties.
|
|
1425
|
-
_createPropertyBinding(property, getObservable, updateViewer, updateElement) {
|
|
1426
|
-
return {
|
|
1427
|
-
property,
|
|
1428
|
-
// Called each time a Viewer instance is created.
|
|
1429
|
-
onInitialized: (viewerDetails) => {
|
|
1430
|
-
getObservable(viewerDetails).add(() => {
|
|
1431
|
-
updateElement(viewerDetails);
|
|
1432
|
-
});
|
|
1433
|
-
updateViewer(viewerDetails);
|
|
1434
|
-
},
|
|
1435
|
-
// Called when the HTML3DElement property should be propagated to the Viewer.
|
|
1436
|
-
updateViewer: () => {
|
|
1437
|
-
if (this._viewerDetails) {
|
|
1438
|
-
updateViewer(this._viewerDetails);
|
|
1439
|
-
}
|
|
1440
|
-
},
|
|
1441
|
-
// Called to re-sync the HTML3DElement property with its corresponding attribute.
|
|
1442
|
-
syncToAttribute: () => {
|
|
1443
|
-
const descriptor = HTML3DElement_1.elementProperties.get(property);
|
|
1444
|
-
if (descriptor) {
|
|
1445
|
-
if (descriptor.attribute) {
|
|
1446
|
-
const attributeName = descriptor.attribute === true ? property : descriptor.attribute;
|
|
1447
|
-
if (this.hasAttribute(attributeName)) {
|
|
1448
|
-
const attributeValue = this.getAttribute(attributeName);
|
|
1449
|
-
const converter = typeof descriptor.converter === "function"
|
|
1450
|
-
? descriptor.converter
|
|
1451
|
-
: descriptor.converter?.fromAttribute !== undefined
|
|
1452
|
-
? descriptor.converter.fromAttribute
|
|
1453
|
-
: u$1.fromAttribute;
|
|
1454
|
-
this[property] = converter ? converter(attributeValue, descriptor.type) : attributeValue;
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
},
|
|
1459
|
-
};
|
|
1460
|
-
}
|
|
1461
|
-
async _setupViewer() {
|
|
1462
|
-
await this._viewerLock.lockAsync(async () => {
|
|
1463
|
-
// The first time the element is connected, the canvas container may not be available yet.
|
|
1464
|
-
// Wait for the first update if needed.
|
|
1465
|
-
if (!this._canvasContainer) {
|
|
1466
|
-
await this.updateComplete;
|
|
1467
|
-
}
|
|
1468
|
-
if (this._canvasContainer && !this._viewerDetails) {
|
|
1469
|
-
const canvas = document.createElement("canvas");
|
|
1470
|
-
canvas.className = "full-size canvas";
|
|
1471
|
-
canvas.setAttribute("touch-action", "none");
|
|
1472
|
-
this._canvasContainer.appendChild(canvas);
|
|
1473
|
-
await createViewerForCanvas(canvas, {
|
|
1474
|
-
engine: this.engine,
|
|
1475
|
-
onInitialized: (details) => {
|
|
1476
|
-
this._viewerDetails = details;
|
|
1477
|
-
details.viewer.onEnvironmentChanged.add(() => {
|
|
1478
|
-
this._dispatchCustomEvent("environmentchange", (type) => new Event(type));
|
|
1479
|
-
});
|
|
1480
|
-
details.viewer.onEnvironmentError.add((error) => {
|
|
1481
|
-
this._dispatchCustomEvent("environmenterror", (type) => new ErrorEvent(type, { error }));
|
|
1482
|
-
});
|
|
1483
|
-
details.viewer.onModelChanged.add(() => {
|
|
1484
|
-
this._animations = [...details.viewer.animations];
|
|
1485
|
-
// When attributes are explicitly set, they are re-applied when a new model is loaded.
|
|
1486
|
-
this._propertyBindings.forEach((binding) => binding.syncToAttribute());
|
|
1487
|
-
// The same goes for camera pose attributes, but it is handled a little differently because there are no corresponding public properties
|
|
1488
|
-
// (since the underlying Babylon camera already has these properties).
|
|
1489
|
-
this._cameraOrbitCoercer?.(details.camera);
|
|
1490
|
-
this._cameraTargetCoercer?.(details.camera);
|
|
1491
|
-
// If animation auto play was set, then start the default animation (if possible).
|
|
1492
|
-
if (this.animationAutoPlay) {
|
|
1493
|
-
details.viewer.playAnimation();
|
|
1494
|
-
}
|
|
1495
|
-
this._dispatchCustomEvent("modelchange", (type) => new Event(type));
|
|
1496
|
-
});
|
|
1497
|
-
details.viewer.onModelError.add((error) => {
|
|
1498
|
-
this._animations = [...details.viewer.animations];
|
|
1499
|
-
this._dispatchCustomEvent("modelerror", (type) => new ErrorEvent(type, { error }));
|
|
1500
|
-
});
|
|
1501
|
-
details.viewer.onLoadingProgressChanged.add(() => {
|
|
1502
|
-
this._loadingProgress = details.viewer.loadingProgress;
|
|
1503
|
-
this._dispatchCustomEvent("loadingprogresschange", (type) => new Event(type));
|
|
1504
|
-
});
|
|
1505
|
-
details.viewer.onIsAnimationPlayingChanged.add(() => {
|
|
1506
|
-
this._isAnimationPlaying = details.viewer.isAnimationPlaying ?? false;
|
|
1507
|
-
this._dispatchCustomEvent("animationplayingchange", (type) => new Event(type));
|
|
1508
|
-
});
|
|
1509
|
-
details.viewer.onAnimationProgressChanged.add(() => {
|
|
1510
|
-
this.animationProgress = details.viewer.animationProgress ?? 0;
|
|
1511
|
-
this._dispatchCustomEvent("animationprogresschange", (type) => new Event(type));
|
|
1512
|
-
});
|
|
1513
|
-
details.scene.onAfterRenderCameraObservable.add(() => {
|
|
1514
|
-
this._dispatchCustomEvent("viewerrender", (type) => new Event(type));
|
|
1515
|
-
});
|
|
1516
|
-
this._updateModel();
|
|
1517
|
-
this._updateEnv();
|
|
1518
|
-
this._propertyBindings.forEach((binding) => binding.onInitialized(details));
|
|
1519
|
-
this._dispatchCustomEvent("viewerready", (type) => new Event(type));
|
|
1520
|
-
},
|
|
1521
|
-
});
|
|
1522
|
-
}
|
|
1523
|
-
});
|
|
1524
|
-
}
|
|
1525
|
-
async _tearDownViewer() {
|
|
1526
|
-
await this._viewerLock.lockAsync(async () => {
|
|
1527
|
-
if (this._viewerDetails) {
|
|
1528
|
-
this._viewerDetails.viewer.dispose();
|
|
1529
|
-
this._viewerDetails = undefined;
|
|
1530
|
-
}
|
|
1531
|
-
// We want to replace the canvas for two reasons:
|
|
1532
|
-
// 1. When the viewer element is reconnected to the DOM, we don't want to briefly see the last frame of the previous model.
|
|
1533
|
-
// 2. If we are changing engines (e.g. WebGL to WebGPU), we need to create a new canvas for the new engine.
|
|
1534
|
-
if (this._canvasContainer && this._canvasContainer.firstElementChild) {
|
|
1535
|
-
this._canvasContainer.removeChild(this._canvasContainer.firstElementChild);
|
|
1536
|
-
}
|
|
1537
|
-
});
|
|
1538
|
-
}
|
|
1539
|
-
async _updateModel() {
|
|
1540
|
-
if (this._viewerDetails) {
|
|
1541
|
-
try {
|
|
1542
|
-
if (this.source) {
|
|
1543
|
-
await this._viewerDetails.viewer.loadModel(this.source, { pluginExtension: this.extension ?? undefined, defaultAnimation: this.selectedAnimation ?? 0 });
|
|
1544
|
-
}
|
|
1545
|
-
else {
|
|
1546
|
-
await this._viewerDetails.viewer.resetModel();
|
|
1547
|
-
}
|
|
1548
|
-
}
|
|
1549
|
-
catch (error) {
|
|
1550
|
-
Logger.Log(error);
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1554
|
-
async _updateEnv() {
|
|
1555
|
-
if (this._viewerDetails) {
|
|
1556
|
-
try {
|
|
1557
|
-
if (this.environment) {
|
|
1558
|
-
await this._viewerDetails.viewer.loadEnvironment(this.environment);
|
|
1559
|
-
}
|
|
1560
|
-
else {
|
|
1561
|
-
await this._viewerDetails.viewer.resetEnvironment();
|
|
1562
|
-
}
|
|
1563
|
-
}
|
|
1564
|
-
catch (error) {
|
|
1565
|
-
Logger.Log(error);
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
}
|
|
1569
|
-
};
|
|
1570
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention, jsdoc/require-jsdoc
|
|
1571
|
-
HTML3DElement.styles = i$3 `
|
|
1572
|
-
:host {
|
|
1573
|
-
--ui-foreground-color: white;
|
|
1574
|
-
--ui-background-hue: 233;
|
|
1575
|
-
--ui-background-saturation: 8%;
|
|
1576
|
-
--ui-background-lightness: 39%;
|
|
1577
|
-
--ui-background-opacity: 0.75;
|
|
1578
|
-
--ui-background-color: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), var(--ui-background-opacity));
|
|
1579
|
-
--ui-background-color-hover: hsla(
|
|
1580
|
-
var(--ui-background-hue),
|
|
1581
|
-
var(--ui-background-saturation),
|
|
1582
|
-
calc(var(--ui-background-lightness) - 10%),
|
|
1583
|
-
calc(var(--ui-background-opacity) - 0.1)
|
|
1584
|
-
);
|
|
1585
|
-
all: inherit;
|
|
1586
|
-
overflow: hidden;
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
.full-size {
|
|
1590
|
-
display: block;
|
|
1591
|
-
position: relative;
|
|
1592
|
-
width: 100%;
|
|
1593
|
-
height: 100%;
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
.canvas {
|
|
1597
|
-
outline: none;
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
.children-slot {
|
|
1601
|
-
position: absolute;
|
|
1602
|
-
top: 0;
|
|
1603
|
-
background: transparent;
|
|
1604
|
-
pointer-events: none;
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
.bar {
|
|
1608
|
-
position: absolute;
|
|
1609
|
-
width: calc(100% - 24px);
|
|
1610
|
-
min-width: 150px;
|
|
1611
|
-
max-width: 1280px;
|
|
1612
|
-
left: 50%;
|
|
1613
|
-
transform: translateX(-50%);
|
|
1614
|
-
background-color: var(--ui-background-color);
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
.bar-min {
|
|
1618
|
-
width: unset;
|
|
1619
|
-
min-width: unset;
|
|
1620
|
-
max-width: unset;
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
.loading-progress-outer {
|
|
1624
|
-
height: 4px;
|
|
1625
|
-
border-radius: 4px;
|
|
1626
|
-
border: 1px solid var(--ui-background-color);
|
|
1627
|
-
outline: none;
|
|
1628
|
-
top: 12px;
|
|
1629
|
-
pointer-events: none;
|
|
1630
|
-
transition: opacity 0.5s ease;
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
.loading-progress-outer-inactive {
|
|
1634
|
-
opacity: 0;
|
|
1635
|
-
/* 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. */
|
|
1636
|
-
background-color: var(--ui-foreground-color);
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
.loading-progress-inner {
|
|
1640
|
-
width: 0;
|
|
1641
|
-
height: 100%;
|
|
1642
|
-
border-radius: inherit;
|
|
1643
|
-
background-color: var(--ui-foreground-color);
|
|
1644
|
-
transition: width 0.3s linear;
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
/* The right side of the inner progress bar starts aligned with the left side of the outer progress bar (container).
|
|
1648
|
-
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.
|
|
1649
|
-
This is why the first keyframe is at 23% ((100/130)*30).
|
|
1650
|
-
*/
|
|
1651
|
-
@keyframes indeterminate {
|
|
1652
|
-
0% {
|
|
1653
|
-
left: 0%;
|
|
1654
|
-
width: 0%;
|
|
1655
|
-
}
|
|
1656
|
-
23% {
|
|
1657
|
-
left: 0%;
|
|
1658
|
-
width: 30%;
|
|
1659
|
-
}
|
|
1660
|
-
77% {
|
|
1661
|
-
left: 70%;
|
|
1662
|
-
width: 30%;
|
|
1663
|
-
}
|
|
1664
|
-
100% {
|
|
1665
|
-
left: 100%;
|
|
1666
|
-
width: 0%;
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
.loading-progress-inner-indeterminate {
|
|
1671
|
-
position: absolute;
|
|
1672
|
-
animation: indeterminate 1.5s infinite;
|
|
1673
|
-
animation-timing-function: linear;
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
.tool-bar {
|
|
1677
|
-
display: flex;
|
|
1678
|
-
flex-direction: row;
|
|
1679
|
-
align-items: center;
|
|
1680
|
-
border-radius: 12px;
|
|
1681
|
-
border-color: var(--ui-foreground-color);
|
|
1682
|
-
height: 48px;
|
|
1683
|
-
bottom: 12px;
|
|
1684
|
-
color: var(--ui-foreground-color);
|
|
1685
|
-
-webkit-tap-highlight-color: transparent;
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
.tool-bar * {
|
|
1689
|
-
height: 100%;
|
|
1690
|
-
min-width: 48px;
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
.tool-bar .divider {
|
|
1694
|
-
min-width: 1px;
|
|
1695
|
-
margin: 0px 6px;
|
|
1696
|
-
height: 66%;
|
|
1697
|
-
background-color: var(--ui-foreground-color);
|
|
1698
|
-
}
|
|
1699
|
-
|
|
1700
|
-
.tool-bar select {
|
|
1701
|
-
background: none;
|
|
1702
|
-
min-width: 52px;
|
|
1703
|
-
max-width: 128px;
|
|
1704
|
-
border: 1px solid transparent;
|
|
1705
|
-
border-radius: inherit;
|
|
1706
|
-
color: inherit;
|
|
1707
|
-
font-size: 14px;
|
|
1708
|
-
padding: 0px 12px;
|
|
1709
|
-
cursor: pointer;
|
|
1710
|
-
outline: none;
|
|
1711
|
-
appearance: none; /* Remove default styling */
|
|
1712
|
-
-webkit-appearance: none; /* Remove default styling for Safari */
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
.tool-bar .select-container {
|
|
1716
|
-
position: relative;
|
|
1717
|
-
display: flex;
|
|
1718
|
-
border-radius: inherit;
|
|
1719
|
-
border-width: 0;
|
|
1720
|
-
padding: 0;
|
|
1721
|
-
}
|
|
1722
|
-
|
|
1723
|
-
.tool-bar .select-container select {
|
|
1724
|
-
position: absolute;
|
|
1725
|
-
min-width: 0;
|
|
1726
|
-
width: 100%;
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
.tool-bar .select-container button {
|
|
1730
|
-
position: absolute;
|
|
1731
|
-
border-width: 0;
|
|
1732
|
-
}
|
|
1733
|
-
|
|
1734
|
-
.tool-bar select:hover,
|
|
1735
|
-
.tool-bar select:focus {
|
|
1736
|
-
background-color: var(--ui-background-color-hover);
|
|
1737
|
-
}
|
|
1738
|
-
|
|
1739
|
-
.tool-bar select option {
|
|
1740
|
-
background-color: var(--ui-background-color);
|
|
1741
|
-
color: var(--ui-foreground-color);
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
.tool-bar select:focus-visible {
|
|
1745
|
-
border-color: inherit;
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
.tool-bar button {
|
|
1749
|
-
background: none;
|
|
1750
|
-
border: 1px solid transparent;
|
|
1751
|
-
border-radius: inherit;
|
|
1752
|
-
color: inherit;
|
|
1753
|
-
padding: 0;
|
|
1754
|
-
cursor: pointer;
|
|
1755
|
-
outline: none;
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
.tool-bar button:hover {
|
|
1759
|
-
background-color: var(--ui-background-color-hover);
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
.tool-bar button:focus-visible {
|
|
1763
|
-
border-color: inherit;
|
|
1764
|
-
}
|
|
1765
|
-
|
|
1766
|
-
.tool-bar button svg {
|
|
1767
|
-
width: 32px;
|
|
1768
|
-
height: 32px;
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1771
|
-
.animation-timeline {
|
|
1772
|
-
display: flex;
|
|
1773
|
-
flex: 1;
|
|
1774
|
-
position: relative;
|
|
1775
|
-
overflow: hidden;
|
|
1776
|
-
cursor: pointer;
|
|
1777
|
-
align-items: center;
|
|
1778
|
-
border-radius: inherit;
|
|
1779
|
-
border-color: inherit;
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
.animation-timeline-input {
|
|
1783
|
-
-webkit-appearance: none;
|
|
1784
|
-
cursor: pointer;
|
|
1785
|
-
width: 100%;
|
|
1786
|
-
height: 100%;
|
|
1787
|
-
outline: none;
|
|
1788
|
-
border: 1px solid transparent;
|
|
1789
|
-
border-radius: inherit;
|
|
1790
|
-
padding: 0 12px;
|
|
1791
|
-
background-color: transparent;
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
.animation-timeline-input:focus-visible {
|
|
1795
|
-
border-color: inherit;
|
|
1796
|
-
}
|
|
1797
|
-
|
|
1798
|
-
/*Chrome -webkit */
|
|
1799
|
-
|
|
1800
|
-
.animation-timeline-input::-webkit-slider-thumb {
|
|
1801
|
-
-webkit-appearance: none;
|
|
1802
|
-
width: 20px;
|
|
1803
|
-
height: 20px;
|
|
1804
|
-
border: 2px solid;
|
|
1805
|
-
color: var(--ui-foreground-color);
|
|
1806
|
-
border-radius: 50%;
|
|
1807
|
-
background: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), 1);
|
|
1808
|
-
margin-top: -10px;
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
.animation-timeline-input::-webkit-slider-runnable-track {
|
|
1812
|
-
height: 2px;
|
|
1813
|
-
-webkit-appearance: none;
|
|
1814
|
-
background-color: var(--ui-foreground-color);
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
/** FireFox -moz */
|
|
1818
|
-
|
|
1819
|
-
.animation-timeline-input::-moz-range-progress {
|
|
1820
|
-
height: 2px;
|
|
1821
|
-
background-color: var(--ui-foreground-color);
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
.animation-timeline-input::-moz-range-thumb {
|
|
1825
|
-
width: 16px;
|
|
1826
|
-
height: 16px;
|
|
1827
|
-
border: 2px solid var(--ui-foreground-color);
|
|
1828
|
-
border-radius: 50%;
|
|
1829
|
-
background: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), 1);
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
.animation-timeline-input::-moz-range-track {
|
|
1833
|
-
height: 2px;
|
|
1834
|
-
background: var(--ui-foreground-color);
|
|
1835
|
-
}
|
|
1836
|
-
`;
|
|
1837
|
-
__decorate([
|
|
1838
|
-
n({
|
|
1839
|
-
converter: (value) => {
|
|
1840
|
-
if (value === "WebGL" || value === "WebGPU") {
|
|
1841
|
-
return value;
|
|
1842
|
-
}
|
|
1843
|
-
return getDefaultEngine();
|
|
1844
|
-
},
|
|
1845
|
-
})
|
|
1846
|
-
], HTML3DElement.prototype, "engine", void 0);
|
|
1847
|
-
__decorate([
|
|
1848
|
-
n({ reflect: true })
|
|
1849
|
-
], HTML3DElement.prototype, "source", void 0);
|
|
1850
|
-
__decorate([
|
|
1851
|
-
n({ reflect: true })
|
|
1852
|
-
], HTML3DElement.prototype, "extension", void 0);
|
|
1853
|
-
__decorate([
|
|
1854
|
-
n({ reflect: true })
|
|
1855
|
-
], HTML3DElement.prototype, "environment", void 0);
|
|
1856
|
-
__decorate([
|
|
1857
|
-
r()
|
|
1858
|
-
], HTML3DElement.prototype, "_loadingProgress", void 0);
|
|
1859
|
-
__decorate([
|
|
1860
|
-
n({ attribute: "skybox-blur" })
|
|
1861
|
-
], HTML3DElement.prototype, "skyboxBlur", void 0);
|
|
1862
|
-
__decorate([
|
|
1863
|
-
n({
|
|
1864
|
-
attribute: "tone-mapping",
|
|
1865
|
-
converter: (value) => {
|
|
1866
|
-
if (!value || !isToneMapping(value)) {
|
|
1867
|
-
return "neutral";
|
|
1868
|
-
}
|
|
1869
|
-
return value;
|
|
1870
|
-
},
|
|
1871
|
-
})
|
|
1872
|
-
], HTML3DElement.prototype, "toneMapping", void 0);
|
|
1873
|
-
__decorate([
|
|
1874
|
-
n()
|
|
1875
|
-
], HTML3DElement.prototype, "contrast", void 0);
|
|
1876
|
-
__decorate([
|
|
1877
|
-
n()
|
|
1878
|
-
], HTML3DElement.prototype, "exposure", void 0);
|
|
1879
|
-
__decorate([
|
|
1880
|
-
n({
|
|
1881
|
-
attribute: "clear-color",
|
|
1882
|
-
reflect: true,
|
|
1883
|
-
converter: {
|
|
1884
|
-
fromAttribute: parseColor,
|
|
1885
|
-
toAttribute: (color) => (color ? color.toHexString() : null),
|
|
1886
|
-
},
|
|
1887
|
-
})
|
|
1888
|
-
], HTML3DElement.prototype, "clearColor", void 0);
|
|
1889
|
-
__decorate([
|
|
1890
|
-
n({
|
|
1891
|
-
attribute: "camera-auto-orbit",
|
|
1892
|
-
type: Boolean,
|
|
1893
|
-
})
|
|
1894
|
-
], HTML3DElement.prototype, "cameraAutoOrbit", void 0);
|
|
1895
|
-
__decorate([
|
|
1896
|
-
n({
|
|
1897
|
-
attribute: "camera-auto-orbit-speed",
|
|
1898
|
-
type: Number,
|
|
1899
|
-
})
|
|
1900
|
-
], HTML3DElement.prototype, "cameraAutoOrbitSpeed", void 0);
|
|
1901
|
-
__decorate([
|
|
1902
|
-
n({
|
|
1903
|
-
attribute: "camera-auto-orbit-delay",
|
|
1904
|
-
type: Number,
|
|
1905
|
-
})
|
|
1906
|
-
], HTML3DElement.prototype, "cameraAutoOrbitDelay", void 0);
|
|
1907
|
-
__decorate([
|
|
1908
|
-
n({
|
|
1909
|
-
attribute: "camera-orbit",
|
|
1910
|
-
converter: (value) => {
|
|
1911
|
-
if (!value) {
|
|
1912
|
-
return null;
|
|
1913
|
-
}
|
|
1914
|
-
const array = value.split(/\s+/);
|
|
1915
|
-
if (array.length !== 3) {
|
|
1916
|
-
throw new Error("cameraOrbit should be defined as 'alpha beta radius'");
|
|
1917
|
-
}
|
|
1918
|
-
return (camera) => {
|
|
1919
|
-
for (const [index, property] of ["alpha", "beta", "radius"].entries()) {
|
|
1920
|
-
const value = array[index];
|
|
1921
|
-
if (value !== "auto") {
|
|
1922
|
-
camera[property] = Number(value);
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
};
|
|
1926
|
-
},
|
|
1927
|
-
})
|
|
1928
|
-
], HTML3DElement.prototype, "_cameraOrbitCoercer", void 0);
|
|
1929
|
-
__decorate([
|
|
1930
|
-
n({
|
|
1931
|
-
attribute: "camera-target",
|
|
1932
|
-
converter: (value) => {
|
|
1933
|
-
if (!value) {
|
|
1934
|
-
return null;
|
|
1935
|
-
}
|
|
1936
|
-
const array = value.split(/\s+/);
|
|
1937
|
-
if (array.length !== 3) {
|
|
1938
|
-
throw new Error("cameraTarget should be defined as 'x y z'");
|
|
1939
|
-
}
|
|
1940
|
-
return (camera) => {
|
|
1941
|
-
const target = camera.target;
|
|
1942
|
-
for (const [index, property] of ["x", "y", "z"].entries()) {
|
|
1943
|
-
const value = array[index];
|
|
1944
|
-
if (value !== "auto") {
|
|
1945
|
-
target[property] = Number(value);
|
|
1946
|
-
}
|
|
1947
|
-
}
|
|
1948
|
-
camera.target = target.clone();
|
|
1949
|
-
};
|
|
1950
|
-
},
|
|
1951
|
-
})
|
|
1952
|
-
], HTML3DElement.prototype, "_cameraTargetCoercer", void 0);
|
|
1953
|
-
__decorate([
|
|
1954
|
-
n({
|
|
1955
|
-
attribute: "hotspots",
|
|
1956
|
-
converter: (value) => {
|
|
1957
|
-
if (!value) {
|
|
1958
|
-
return {};
|
|
1959
|
-
}
|
|
1960
|
-
return JSON.parse(value);
|
|
1961
|
-
},
|
|
1962
|
-
})
|
|
1963
|
-
], HTML3DElement.prototype, "hotSpots", void 0);
|
|
1964
|
-
__decorate([
|
|
1965
|
-
n({ attribute: "animation-auto-play", reflect: true, type: Boolean })
|
|
1966
|
-
], HTML3DElement.prototype, "animationAutoPlay", void 0);
|
|
1967
|
-
__decorate([
|
|
1968
|
-
n({ attribute: "selected-animation", type: Number })
|
|
1969
|
-
], HTML3DElement.prototype, "selectedAnimation", void 0);
|
|
1970
|
-
__decorate([
|
|
1971
|
-
n({ attribute: "animation-speed" })
|
|
1972
|
-
], HTML3DElement.prototype, "animationSpeed", void 0);
|
|
1973
|
-
__decorate([
|
|
1974
|
-
n({ attribute: false })
|
|
1975
|
-
], HTML3DElement.prototype, "animationProgress", void 0);
|
|
1976
|
-
__decorate([
|
|
1977
|
-
r()
|
|
1978
|
-
], HTML3DElement.prototype, "_animations", void 0);
|
|
1979
|
-
__decorate([
|
|
1980
|
-
r()
|
|
1981
|
-
], HTML3DElement.prototype, "_isAnimationPlaying", void 0);
|
|
1982
|
-
__decorate([
|
|
1983
|
-
n({ attribute: "material-variant" })
|
|
1984
|
-
], HTML3DElement.prototype, "selectedMaterialVariant", void 0);
|
|
1985
|
-
__decorate([
|
|
1986
|
-
e("#canvasContainer")
|
|
1987
|
-
], HTML3DElement.prototype, "_canvasContainer", void 0);
|
|
1988
|
-
__decorate([
|
|
1989
|
-
e("#materialSelect")
|
|
1990
|
-
], HTML3DElement.prototype, "_materialSelect", void 0);
|
|
1991
|
-
HTML3DElement = HTML3DElement_1 = __decorate([
|
|
1992
|
-
t("babylon-viewer")
|
|
1993
|
-
], HTML3DElement);
|
|
1994
|
-
|
|
1995
|
-
/**
|
|
1996
|
-
* Displays child elements at the screen space location of a hotspot in a babylon-viewer.
|
|
1997
|
-
* @remarks
|
|
1998
|
-
* The babylon-viewer-annotation element must be a child of a babylon-viewer element.
|
|
1999
|
-
*/
|
|
2000
|
-
let HTML3DAnnotationElement = class HTML3DAnnotationElement extends r$2 {
|
|
2001
|
-
constructor() {
|
|
2002
|
-
super(...arguments);
|
|
2003
|
-
this._internals = this.attachInternals();
|
|
2004
|
-
this._viewerAttachment = null;
|
|
2005
|
-
/**
|
|
2006
|
-
* The name of the hotspot to track.
|
|
2007
|
-
*/
|
|
2008
|
-
this.hotSpot = "";
|
|
2009
|
-
}
|
|
2010
|
-
// eslint-disable-next-line babylonjs/available
|
|
2011
|
-
connectedCallback() {
|
|
2012
|
-
super.connectedCallback();
|
|
2013
|
-
this._internals.states?.add("invalid");
|
|
2014
|
-
if (!(this.parentElement instanceof HTML3DElement)) {
|
|
2015
|
-
// eslint-disable-next-line no-console
|
|
2016
|
-
console.warn("The babylon-viewer-annotation element must be a child of a babylon-viewer element.");
|
|
2017
|
-
return;
|
|
2018
|
-
}
|
|
2019
|
-
const viewerElement = this.parentElement;
|
|
2020
|
-
const hotSpotResult = new ViewerHotSpotResult();
|
|
2021
|
-
const onViewerRendered = () => {
|
|
2022
|
-
if (this.hotSpot) {
|
|
2023
|
-
if (viewerElement.queryHotSpot(this.hotSpot, hotSpotResult)) {
|
|
2024
|
-
const [screenX, screenY] = hotSpotResult.screenPosition;
|
|
2025
|
-
this.style.transform = `translate(${screenX}px, ${screenY}px)`;
|
|
2026
|
-
this._internals.states?.delete("invalid");
|
|
2027
|
-
if (hotSpotResult.visibility <= 0) {
|
|
2028
|
-
this._internals.states?.add("back-facing");
|
|
2029
|
-
}
|
|
2030
|
-
else {
|
|
2031
|
-
this._internals.states?.delete("back-facing");
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
else {
|
|
2035
|
-
this._internals.states?.add("invalid");
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
};
|
|
2039
|
-
viewerElement.addEventListener("viewerrender", onViewerRendered);
|
|
2040
|
-
this._viewerAttachment = {
|
|
2041
|
-
dispose() {
|
|
2042
|
-
viewerElement.removeEventListener("viewerrender", onViewerRendered);
|
|
2043
|
-
},
|
|
2044
|
-
};
|
|
2045
|
-
}
|
|
2046
|
-
// eslint-disable-next-line babylonjs/available
|
|
2047
|
-
disconnectedCallback() {
|
|
2048
|
-
super.disconnectedCallback();
|
|
2049
|
-
this._viewerAttachment?.dispose();
|
|
2050
|
-
this._viewerAttachment = null;
|
|
2051
|
-
this._internals.states?.add("invalid");
|
|
2052
|
-
}
|
|
2053
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2054
|
-
render() {
|
|
2055
|
-
return x ` <slot></slot> `;
|
|
2056
|
-
}
|
|
2057
|
-
};
|
|
2058
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention, jsdoc/require-jsdoc
|
|
2059
|
-
HTML3DAnnotationElement.styles = i$3 `
|
|
2060
|
-
:host {
|
|
2061
|
-
display: inline-block;
|
|
2062
|
-
position: absolute;
|
|
2063
|
-
transition: opacity 0.25s;
|
|
2064
|
-
}
|
|
2065
|
-
:host([hidden]) {
|
|
2066
|
-
display: none;
|
|
2067
|
-
}
|
|
2068
|
-
:host(:state(back-facing)) {
|
|
2069
|
-
opacity: 0.2;
|
|
2070
|
-
}
|
|
2071
|
-
:host(:state(invalid)) {
|
|
2072
|
-
display: none;
|
|
2073
|
-
}
|
|
2074
|
-
`;
|
|
2075
|
-
__decorate([
|
|
2076
|
-
n({ attribute: "hotspot" })
|
|
2077
|
-
], HTML3DAnnotationElement.prototype, "hotSpot", void 0);
|
|
2078
|
-
HTML3DAnnotationElement = __decorate([
|
|
2079
|
-
t("babylon-viewer-annotation")
|
|
2080
|
-
], HTML3DAnnotationElement);
|
|
2081
|
-
|
|
2082
|
-
export { HTML3DAnnotationElement, HTML3DElement, Viewer, ViewerHotSpotResult, createViewerForCanvas };
|
|
2083
|
-
//# sourceMappingURL=index.js.map
|