@babylonjs/viewer 7.23.1-alpha → 7.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +192 -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 +199 -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 +27 -17
- package/readme.md +21 -35
- 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 +21 -0
- package/templating/plugins/hdButtonPlugin.js.map +1 -0
- package/templating/plugins/printButton.d.ts +9 -0
- package/templating/plugins/printButton.js +40 -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 +675 -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/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_image_based-D3ZBYLgC.esm.js +0 -170
- package/dist/chunks/EXT_lights_image_based-D3ZBYLgC.esm.js.map +0 -1
- package/dist/chunks/EXT_lights_image_based-DyWZGFdC.esm.min.js +0 -2
- package/dist/chunks/EXT_lights_image_based-DyWZGFdC.esm.min.js.map +0 -1
- package/dist/chunks/EXT_mesh_gpu_instancing-BsSuxC3A.esm.js +0 -86
- package/dist/chunks/EXT_mesh_gpu_instancing-BsSuxC3A.esm.js.map +0 -1
- package/dist/chunks/EXT_mesh_gpu_instancing-DtTWXKzv.esm.min.js +0 -2
- package/dist/chunks/EXT_mesh_gpu_instancing-DtTWXKzv.esm.min.js.map +0 -1
- package/dist/chunks/EXT_meshopt_compression-BncKn2rD.esm.js +0 -134
- package/dist/chunks/EXT_meshopt_compression-BncKn2rD.esm.js.map +0 -1
- package/dist/chunks/EXT_meshopt_compression-CjW8GcrA.esm.min.js +0 -2
- package/dist/chunks/EXT_meshopt_compression-CjW8GcrA.esm.min.js.map +0 -1
- package/dist/chunks/EXT_texture_avif-DLrVqqUz.esm.min.js +0 -2
- package/dist/chunks/EXT_texture_avif-DLrVqqUz.esm.min.js.map +0 -1
- package/dist/chunks/EXT_texture_avif-wG4GNQfZ.esm.js +0 -44
- package/dist/chunks/EXT_texture_avif-wG4GNQfZ.esm.js.map +0 -1
- package/dist/chunks/EXT_texture_webp-BccV6Svg.esm.js +0 -43
- package/dist/chunks/EXT_texture_webp-BccV6Svg.esm.js.map +0 -1
- package/dist/chunks/EXT_texture_webp-DNAe2ii8.esm.min.js +0 -2
- package/dist/chunks/EXT_texture_webp-DNAe2ii8.esm.min.js.map +0 -1
- package/dist/chunks/ExtrasAsMetadata-BA0NyQBn.esm.js +0 -64
- package/dist/chunks/ExtrasAsMetadata-BA0NyQBn.esm.js.map +0 -1
- package/dist/chunks/ExtrasAsMetadata-BN02lRw7.esm.min.js +0 -2
- package/dist/chunks/ExtrasAsMetadata-BN02lRw7.esm.min.js.map +0 -1
- package/dist/chunks/KHR_animation_pointer-B7mk-XJN.esm.min.js +0 -2
- package/dist/chunks/KHR_animation_pointer-B7mk-XJN.esm.min.js.map +0 -1
- package/dist/chunks/KHR_animation_pointer-BFFpQV4X.esm.js +0 -343
- package/dist/chunks/KHR_animation_pointer-BFFpQV4X.esm.js.map +0 -1
- package/dist/chunks/KHR_draco_mesh_compression-7zqRIpZt.esm.js +0 -610
- package/dist/chunks/KHR_draco_mesh_compression-7zqRIpZt.esm.js.map +0 -1
- package/dist/chunks/KHR_draco_mesh_compression-Bw4rV4ln.esm.min.js +0 -2
- package/dist/chunks/KHR_draco_mesh_compression-Bw4rV4ln.esm.min.js.map +0 -1
- package/dist/chunks/KHR_interactivity-Bd_6hpGb.esm.js +0 -4033
- package/dist/chunks/KHR_interactivity-Bd_6hpGb.esm.js.map +0 -1
- package/dist/chunks/KHR_interactivity-DIJyLERv.esm.min.js +0 -2
- package/dist/chunks/KHR_interactivity-DIJyLERv.esm.min.js.map +0 -1
- package/dist/chunks/KHR_lights_punctual-CFUUYlNK.esm.min.js +0 -2
- package/dist/chunks/KHR_lights_punctual-CFUUYlNK.esm.min.js.map +0 -1
- package/dist/chunks/KHR_lights_punctual-XL2dnY2h.esm.js +0 -1253
- package/dist/chunks/KHR_lights_punctual-XL2dnY2h.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_anisotropy-04SftzV0.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_anisotropy-04SftzV0.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_anisotropy-gAd08wDG.esm.js +0 -64
- package/dist/chunks/KHR_materials_anisotropy-gAd08wDG.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_clearcoat-9GQaVx6k.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_clearcoat-9GQaVx6k.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_clearcoat-Cv_yIIaW.esm.js +0 -96
- package/dist/chunks/KHR_materials_clearcoat-Cv_yIIaW.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_diffuse_transmission-Dj9EU7q2.esm.js +0 -96
- package/dist/chunks/KHR_materials_diffuse_transmission-Dj9EU7q2.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_diffuse_transmission-fmv70uuH.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_diffuse_transmission-fmv70uuH.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_dispersion-CCzM2Avp.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_dispersion-CCzM2Avp.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_dispersion-JNxGdAqc.esm.js +0 -63
- package/dist/chunks/KHR_materials_dispersion-JNxGdAqc.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_emissive_strength-D25-ItKl.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_emissive_strength-D25-ItKl.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_emissive_strength-DlkptyaM.esm.js +0 -55
- package/dist/chunks/KHR_materials_emissive_strength-DlkptyaM.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_ior-Jqj5Ph_V.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_ior-Jqj5Ph_V.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_ior-KGZBae4Y.esm.js +0 -64
- package/dist/chunks/KHR_materials_ior-KGZBae4Y.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_iridescence-ByOHUtdO.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_iridescence-ByOHUtdO.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_iridescence-FmAV1QDy.esm.js +0 -72
- package/dist/chunks/KHR_materials_iridescence-FmAV1QDy.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-BiqCrcmj.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-BiqCrcmj.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-CRnlTYx-.esm.js +0 -81
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-CRnlTYx-.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_sheen-7li6Dlkh.esm.js +0 -85
- package/dist/chunks/KHR_materials_sheen-7li6Dlkh.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_sheen-BL2qM8Rp.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_sheen-BL2qM8Rp.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_specular-C2ks7gPC.esm.js +0 -75
- package/dist/chunks/KHR_materials_specular-C2ks7gPC.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_specular-DCAt3T_l.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_specular-DCAt3T_l.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_transmission-B8w41MT6.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_transmission-B8w41MT6.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_transmission-DRL9BE9q.esm.js +0 -307
- package/dist/chunks/KHR_materials_transmission-DRL9BE9q.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_unlit-B-il-TRX.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_unlit-B-il-TRX.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_unlit-B44Oqon6.esm.js +0 -74
- package/dist/chunks/KHR_materials_unlit-B44Oqon6.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_variants-BCdEgpch.esm.js +0 -238
- package/dist/chunks/KHR_materials_variants-BCdEgpch.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_variants-ClQElTeo.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_variants-ClQElTeo.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_volume-BXv3M95S.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_volume-BXv3M95S.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_volume-BuUrRniE.esm.js +0 -88
- package/dist/chunks/KHR_materials_volume-BuUrRniE.esm.js.map +0 -1
- package/dist/chunks/KHR_mesh_quantization-WPngIGGs.esm.min.js +0 -2
- package/dist/chunks/KHR_mesh_quantization-WPngIGGs.esm.min.js.map +0 -1
- package/dist/chunks/KHR_mesh_quantization-p2nyy6Ym.esm.js +0 -26
- package/dist/chunks/KHR_mesh_quantization-p2nyy6Ym.esm.js.map +0 -1
- package/dist/chunks/KHR_texture_basisu-BHsmOUDV.esm.js +0 -43
- package/dist/chunks/KHR_texture_basisu-BHsmOUDV.esm.js.map +0 -1
- package/dist/chunks/KHR_texture_basisu-DObdWvzE.esm.min.js +0 -2
- package/dist/chunks/KHR_texture_basisu-DObdWvzE.esm.min.js.map +0 -1
- package/dist/chunks/KHR_texture_transform-B7NCdTO_.esm.js +0 -63
- package/dist/chunks/KHR_texture_transform-B7NCdTO_.esm.js.map +0 -1
- package/dist/chunks/KHR_texture_transform-D6Ee6UiP.esm.min.js +0 -2
- package/dist/chunks/KHR_texture_transform-D6Ee6UiP.esm.min.js.map +0 -1
- package/dist/chunks/KHR_xmp_json_ld-Coh_hfCi.esm.js +0 -51
- package/dist/chunks/KHR_xmp_json_ld-Coh_hfCi.esm.js.map +0 -1
- package/dist/chunks/KHR_xmp_json_ld-ijOY8DMb.esm.min.js +0 -2
- package/dist/chunks/KHR_xmp_json_ld-ijOY8DMb.esm.min.js.map +0 -1
- package/dist/chunks/MSFT_audio_emitter-CGjUSgI2.esm.min.js +0 -2
- package/dist/chunks/MSFT_audio_emitter-CGjUSgI2.esm.min.js.map +0 -1
- package/dist/chunks/MSFT_audio_emitter-fFvTv2YK.esm.js +0 -1600
- package/dist/chunks/MSFT_audio_emitter-fFvTv2YK.esm.js.map +0 -1
- package/dist/chunks/MSFT_lod-Bql1icOF.esm.js +0 -337
- package/dist/chunks/MSFT_lod-Bql1icOF.esm.js.map +0 -1
- package/dist/chunks/MSFT_lod-Du_akN0I.esm.min.js +0 -2
- package/dist/chunks/MSFT_lod-Du_akN0I.esm.min.js.map +0 -1
- package/dist/chunks/MSFT_minecraftMesh-Brch3HUo.esm.min.js +0 -2
- package/dist/chunks/MSFT_minecraftMesh-Brch3HUo.esm.min.js.map +0 -1
- package/dist/chunks/MSFT_minecraftMesh-jrYC8YE9.esm.js +0 -46
- package/dist/chunks/MSFT_minecraftMesh-jrYC8YE9.esm.js.map +0 -1
- package/dist/chunks/MSFT_sRGBFactors-Dp3CtJ9B.esm.js +0 -47
- package/dist/chunks/MSFT_sRGBFactors-Dp3CtJ9B.esm.js.map +0 -1
- package/dist/chunks/MSFT_sRGBFactors-LZM-HF4P.esm.min.js +0 -2
- package/dist/chunks/MSFT_sRGBFactors-LZM-HF4P.esm.min.js.map +0 -1
- package/dist/chunks/assetContainer-Bo08Fxv3.esm.min.js +0 -2
- package/dist/chunks/assetContainer-Bo08Fxv3.esm.min.js.map +0 -1
- package/dist/chunks/assetContainer-DVOdWL9b.esm.js +0 -1598
- package/dist/chunks/assetContainer-DVOdWL9b.esm.js.map +0 -1
- package/dist/chunks/basisTextureLoader-C2Or-Jx_.esm.min.js +0 -2
- package/dist/chunks/basisTextureLoader-C2Or-Jx_.esm.min.js.map +0 -1
- package/dist/chunks/basisTextureLoader-DiYg6uNN.esm.js +0 -600
- package/dist/chunks/basisTextureLoader-DiYg6uNN.esm.js.map +0 -1
- package/dist/chunks/ddsTextureLoader-CDlttCBi.esm.js +0 -87
- package/dist/chunks/ddsTextureLoader-CDlttCBi.esm.js.map +0 -1
- package/dist/chunks/ddsTextureLoader-T_I1TPiz.esm.min.js +0 -2
- package/dist/chunks/ddsTextureLoader-T_I1TPiz.esm.min.js.map +0 -1
- package/dist/chunks/default.fragment-C8ZCxgTK.esm.js +0 -515
- package/dist/chunks/default.fragment-C8ZCxgTK.esm.js.map +0 -1
- package/dist/chunks/default.fragment-Conpp30r.esm.js +0 -452
- package/dist/chunks/default.fragment-Conpp30r.esm.js.map +0 -1
- package/dist/chunks/default.fragment-DTP98j1l.esm.min.js +0 -2
- package/dist/chunks/default.fragment-DTP98j1l.esm.min.js.map +0 -1
- package/dist/chunks/default.fragment-DjistPBR.esm.min.js +0 -2
- package/dist/chunks/default.fragment-DjistPBR.esm.min.js.map +0 -1
- package/dist/chunks/default.vertex-BSCjzhXG.esm.js +0 -178
- package/dist/chunks/default.vertex-BSCjzhXG.esm.js.map +0 -1
- package/dist/chunks/default.vertex-Ba7zxY0T.esm.min.js +0 -2
- package/dist/chunks/default.vertex-Ba7zxY0T.esm.min.js.map +0 -1
- package/dist/chunks/default.vertex-CPurFhOJ.esm.js +0 -199
- package/dist/chunks/default.vertex-CPurFhOJ.esm.js.map +0 -1
- package/dist/chunks/default.vertex-D_4jDtBx.esm.min.js +0 -2
- package/dist/chunks/default.vertex-D_4jDtBx.esm.min.js.map +0 -1
- package/dist/chunks/defaultUboDeclaration-BjT2yBnm.esm.js +0 -15
- package/dist/chunks/defaultUboDeclaration-BjT2yBnm.esm.js.map +0 -1
- package/dist/chunks/defaultUboDeclaration-BuAk9gJA.esm.min.js +0 -2
- package/dist/chunks/defaultUboDeclaration-BuAk9gJA.esm.min.js.map +0 -1
- package/dist/chunks/defaultUboDeclaration-CC8YfLoS.esm.min.js +0 -2
- package/dist/chunks/defaultUboDeclaration-CC8YfLoS.esm.min.js.map +0 -1
- package/dist/chunks/defaultUboDeclaration-ClvuiT6M.esm.js +0 -13
- package/dist/chunks/defaultUboDeclaration-ClvuiT6M.esm.js.map +0 -1
- package/dist/chunks/envTextureLoader-DuE-52NK.esm.min.js +0 -2
- package/dist/chunks/envTextureLoader-DuE-52NK.esm.min.js.map +0 -1
- package/dist/chunks/envTextureLoader-ENMUumOz.esm.js +0 -63
- package/dist/chunks/envTextureLoader-ENMUumOz.esm.js.map +0 -1
- package/dist/chunks/environmentTextureTools-Cw-ZbYYv.esm.js +0 -381
- package/dist/chunks/environmentTextureTools-Cw-ZbYYv.esm.js.map +0 -1
- package/dist/chunks/environmentTextureTools-mWXMV1Cr.esm.min.js +0 -2
- package/dist/chunks/environmentTextureTools-mWXMV1Cr.esm.min.js.map +0 -1
- package/dist/chunks/exrTextureLoader-9ioAK1Ph.esm.js +0 -1682
- package/dist/chunks/exrTextureLoader-9ioAK1Ph.esm.js.map +0 -1
- package/dist/chunks/exrTextureLoader-zc2N62c3.esm.min.js +0 -2
- package/dist/chunks/exrTextureLoader-zc2N62c3.esm.min.js.map +0 -1
- package/dist/chunks/fogFragment-DLguActo.esm.min.js +0 -2
- package/dist/chunks/fogFragment-DLguActo.esm.min.js.map +0 -1
- package/dist/chunks/fogFragment-sACeXatv.esm.js +0 -102
- package/dist/chunks/fogFragment-sACeXatv.esm.js.map +0 -1
- package/dist/chunks/glTFLoader-BuxqXvJ-.esm.min.js +0 -2
- package/dist/chunks/glTFLoader-BuxqXvJ-.esm.min.js.map +0 -1
- package/dist/chunks/glTFLoader-DB7AOurF.esm.js +0 -7552
- package/dist/chunks/glTFLoader-DB7AOurF.esm.js.map +0 -1
- package/dist/chunks/glTFLoaderAnimation-BWhMcDgk.esm.min.js +0 -2
- package/dist/chunks/glTFLoaderAnimation-BWhMcDgk.esm.min.js.map +0 -1
- package/dist/chunks/glTFLoaderAnimation-DK5fvCTY.esm.js +0 -77
- package/dist/chunks/glTFLoaderAnimation-DK5fvCTY.esm.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-BMUi3P6Y.esm.js +0 -35
- package/dist/chunks/harmonicsFunctions-BMUi3P6Y.esm.js.map +0 -1
- package/dist/chunks/harmonicsFunctions-BWj3xZKa.esm.min.js +0 -2
- package/dist/chunks/harmonicsFunctions-BWj3xZKa.esm.min.js.map +0 -1
- package/dist/chunks/harmonicsFunctions-D9GUclWs.esm.min.js +0 -2
- package/dist/chunks/harmonicsFunctions-D9GUclWs.esm.min.js.map +0 -1
- package/dist/chunks/harmonicsFunctions-DQngcILt.esm.js +0 -34
- package/dist/chunks/harmonicsFunctions-DQngcILt.esm.js.map +0 -1
- package/dist/chunks/hdrTextureLoader-3TOTpFyV.esm.min.js +0 -2
- package/dist/chunks/hdrTextureLoader-3TOTpFyV.esm.min.js.map +0 -1
- package/dist/chunks/hdrTextureLoader-zIHMNTOp.esm.js +0 -252
- package/dist/chunks/hdrTextureLoader-zIHMNTOp.esm.js.map +0 -1
- package/dist/chunks/helperFunctions-B_yzbgEv.esm.min.js +0 -2
- package/dist/chunks/helperFunctions-B_yzbgEv.esm.min.js.map +0 -1
- package/dist/chunks/helperFunctions-BjYz-6zr.esm.js +0 -108
- package/dist/chunks/helperFunctions-BjYz-6zr.esm.js.map +0 -1
- package/dist/chunks/helperFunctions-CXLST6hZ.esm.js +0 -80
- package/dist/chunks/helperFunctions-CXLST6hZ.esm.js.map +0 -1
- package/dist/chunks/helperFunctions-DTBzTIjJ.esm.min.js +0 -2
- package/dist/chunks/helperFunctions-DTBzTIjJ.esm.min.js.map +0 -1
- package/dist/chunks/index-CTNAO7X0.esm.js +0 -81630
- package/dist/chunks/index-CTNAO7X0.esm.js.map +0 -1
- package/dist/chunks/index-DYqHhEAk.esm.min.js +0 -57
- package/dist/chunks/index-DYqHhEAk.esm.min.js.map +0 -1
- package/dist/chunks/ktxTextureLoader-9AGBpjf1.esm.js +0 -814
- package/dist/chunks/ktxTextureLoader-9AGBpjf1.esm.js.map +0 -1
- package/dist/chunks/ktxTextureLoader-DbSU4wBV.esm.min.js +0 -2
- package/dist/chunks/ktxTextureLoader-DbSU4wBV.esm.min.js.map +0 -1
- package/dist/chunks/logDepthDeclaration-BCN89cGc.esm.min.js +0 -2
- package/dist/chunks/logDepthDeclaration-BCN89cGc.esm.min.js.map +0 -1
- package/dist/chunks/logDepthDeclaration-CZCatKgj.esm.js +0 -42
- package/dist/chunks/logDepthDeclaration-CZCatKgj.esm.js.map +0 -1
- package/dist/chunks/logDepthDeclaration-_gJVcKC2.esm.js +0 -35
- package/dist/chunks/logDepthDeclaration-_gJVcKC2.esm.js.map +0 -1
- package/dist/chunks/logDepthDeclaration-cpc5vyCy.esm.min.js +0 -2
- package/dist/chunks/logDepthDeclaration-cpc5vyCy.esm.min.js.map +0 -1
- package/dist/chunks/logDepthVertex-7sCVTIjr.esm.min.js +0 -2
- package/dist/chunks/logDepthVertex-7sCVTIjr.esm.min.js.map +0 -1
- package/dist/chunks/logDepthVertex-B09oc-mi.esm.js +0 -77
- package/dist/chunks/logDepthVertex-B09oc-mi.esm.js.map +0 -1
- package/dist/chunks/logDepthVertex-Bq3-XtSp.esm.min.js +0 -2
- package/dist/chunks/logDepthVertex-Bq3-XtSp.esm.min.js.map +0 -1
- package/dist/chunks/logDepthVertex-DZoye-59.esm.js +0 -605
- package/dist/chunks/logDepthVertex-DZoye-59.esm.js.map +0 -1
- package/dist/chunks/mainUVVaryingDeclaration-LHNQQPPQ.esm.js +0 -11
- package/dist/chunks/mainUVVaryingDeclaration-LHNQQPPQ.esm.js.map +0 -1
- package/dist/chunks/mainUVVaryingDeclaration-wmRFnah8.esm.min.js +0 -2
- package/dist/chunks/mainUVVaryingDeclaration-wmRFnah8.esm.min.js.map +0 -1
- package/dist/chunks/objFileLoader-BvWwH6aj.esm.js +0 -1280
- package/dist/chunks/objFileLoader-BvWwH6aj.esm.js.map +0 -1
- package/dist/chunks/objFileLoader-LDP87u1T.esm.min.js +0 -2
- package/dist/chunks/objFileLoader-LDP87u1T.esm.min.js.map +0 -1
- package/dist/chunks/oitFragment-BAVtrG6V.esm.min.js +0 -2
- package/dist/chunks/oitFragment-BAVtrG6V.esm.min.js.map +0 -1
- package/dist/chunks/oitFragment-BqzVjWja.esm.js +0 -1210
- package/dist/chunks/oitFragment-BqzVjWja.esm.js.map +0 -1
- package/dist/chunks/oitFragment-CIelz994.esm.js +0 -1166
- package/dist/chunks/oitFragment-CIelz994.esm.js.map +0 -1
- package/dist/chunks/oitFragment-P20Uiy73.esm.min.js +0 -2
- package/dist/chunks/oitFragment-P20Uiy73.esm.min.js.map +0 -1
- package/dist/chunks/pass.fragment-D-67YTNJ.esm.min.js +0 -2
- package/dist/chunks/pass.fragment-D-67YTNJ.esm.min.js.map +0 -1
- package/dist/chunks/pass.fragment-ke3_LMQY.esm.js +0 -15
- package/dist/chunks/pass.fragment-ke3_LMQY.esm.js.map +0 -1
- package/dist/chunks/pbr.fragment-3QJykQmh.esm.js +0 -3228
- package/dist/chunks/pbr.fragment-3QJykQmh.esm.js.map +0 -1
- package/dist/chunks/pbr.fragment-BfhoPEE4.esm.js +0 -3163
- package/dist/chunks/pbr.fragment-BfhoPEE4.esm.js.map +0 -1
- package/dist/chunks/pbr.fragment-BpCKAJQO.esm.min.js +0 -2
- package/dist/chunks/pbr.fragment-BpCKAJQO.esm.min.js.map +0 -1
- package/dist/chunks/pbr.fragment-Buc8F3ii.esm.min.js +0 -2
- package/dist/chunks/pbr.fragment-Buc8F3ii.esm.min.js.map +0 -1
- package/dist/chunks/pbr.vertex-Bwl6238q.esm.min.js +0 -2
- package/dist/chunks/pbr.vertex-Bwl6238q.esm.min.js.map +0 -1
- package/dist/chunks/pbr.vertex-COtog_7X.esm.js +0 -335
- package/dist/chunks/pbr.vertex-COtog_7X.esm.js.map +0 -1
- package/dist/chunks/pbr.vertex-CX-ksiMG.esm.min.js +0 -2
- package/dist/chunks/pbr.vertex-CX-ksiMG.esm.min.js.map +0 -1
- package/dist/chunks/pbr.vertex-WxxbIMZL.esm.js +0 -208
- package/dist/chunks/pbr.vertex-WxxbIMZL.esm.js.map +0 -1
- package/dist/chunks/postprocess.vertex-6VuephE3.esm.min.js +0 -2
- package/dist/chunks/postprocess.vertex-6VuephE3.esm.min.js.map +0 -1
- package/dist/chunks/postprocess.vertex-y9rNSbFH.esm.js +0 -20
- package/dist/chunks/postprocess.vertex-y9rNSbFH.esm.js.map +0 -1
- package/dist/chunks/rawTexture-BjAjz6eU.esm.min.js +0 -2
- package/dist/chunks/rawTexture-BjAjz6eU.esm.min.js.map +0 -1
- package/dist/chunks/rawTexture-DzCCPFKA.esm.js +0 -562
- package/dist/chunks/rawTexture-DzCCPFKA.esm.js.map +0 -1
- package/dist/chunks/rgbdDecode.fragment-B2z-Bt71.esm.js +0 -17
- package/dist/chunks/rgbdDecode.fragment-B2z-Bt71.esm.js.map +0 -1
- package/dist/chunks/rgbdDecode.fragment-CdzoW-6f.esm.min.js +0 -2
- package/dist/chunks/rgbdDecode.fragment-CdzoW-6f.esm.min.js.map +0 -1
- package/dist/chunks/rgbdDecode.fragment-DrLvcO8Q.esm.js +0 -17
- package/dist/chunks/rgbdDecode.fragment-DrLvcO8Q.esm.js.map +0 -1
- package/dist/chunks/rgbdDecode.fragment-DuXK_20s.esm.min.js +0 -2
- package/dist/chunks/rgbdDecode.fragment-DuXK_20s.esm.min.js.map +0 -1
- package/dist/chunks/rgbdEncode.fragment-B8TjBZ9S.esm.js +0 -17
- package/dist/chunks/rgbdEncode.fragment-B8TjBZ9S.esm.js.map +0 -1
- package/dist/chunks/rgbdEncode.fragment-CGQHcoVr.esm.min.js +0 -2
- package/dist/chunks/rgbdEncode.fragment-CGQHcoVr.esm.min.js.map +0 -1
- package/dist/chunks/rgbdEncode.fragment-CHPMUGpL.esm.js +0 -17
- package/dist/chunks/rgbdEncode.fragment-CHPMUGpL.esm.js.map +0 -1
- package/dist/chunks/rgbdEncode.fragment-Ch8KaRMn.esm.min.js +0 -2
- package/dist/chunks/rgbdEncode.fragment-Ch8KaRMn.esm.min.js.map +0 -1
- package/dist/chunks/splatFileLoader-BOlEs8up.esm.min.js +0 -2
- package/dist/chunks/splatFileLoader-BOlEs8up.esm.min.js.map +0 -1
- package/dist/chunks/splatFileLoader-bjTdN6CH.esm.js +0 -3137
- package/dist/chunks/splatFileLoader-bjTdN6CH.esm.js.map +0 -1
- package/dist/chunks/standardMaterial-AtuI8LET.esm.min.js +0 -2
- package/dist/chunks/standardMaterial-AtuI8LET.esm.min.js.map +0 -1
- package/dist/chunks/standardMaterial-pkPTNFQZ.esm.js +0 -1809
- package/dist/chunks/standardMaterial-pkPTNFQZ.esm.js.map +0 -1
- package/dist/chunks/stlFileLoader-D_S8zIWi.esm.min.js +0 -2
- package/dist/chunks/stlFileLoader-D_S8zIWi.esm.min.js.map +0 -1
- package/dist/chunks/stlFileLoader-LAl8UbnA.esm.js +0 -237
- package/dist/chunks/stlFileLoader-LAl8UbnA.esm.js.map +0 -1
- package/dist/chunks/tgaTextureLoader-6J7hFLap.esm.min.js +0 -2
- package/dist/chunks/tgaTextureLoader-6J7hFLap.esm.min.js.map +0 -1
- package/dist/chunks/tgaTextureLoader-C9bFUsSu.esm.js +0 -349
- package/dist/chunks/tgaTextureLoader-C9bFUsSu.esm.js.map +0 -1
- package/dist/chunks/thinInstanceMesh-01jRjs2y.esm.js +0 -314
- package/dist/chunks/thinInstanceMesh-01jRjs2y.esm.js.map +0 -1
- package/dist/chunks/thinInstanceMesh-BkM6bBqz.esm.min.js +0 -2
- package/dist/chunks/thinInstanceMesh-BkM6bBqz.esm.min.js.map +0 -1
- package/dist/chunks/vertexColorMixing-BQURABk9.esm.js +0 -528
- package/dist/chunks/vertexColorMixing-BQURABk9.esm.js.map +0 -1
- package/dist/chunks/vertexColorMixing-DtyijcYJ.esm.min.js +0 -2
- package/dist/chunks/vertexColorMixing-DtyijcYJ.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 -237
- package/lib/index.js +0 -871
- package/lib/index.js.map +0 -1
package/lib/index.js
DELETED
|
@@ -1,871 +0,0 @@
|
|
|
1
|
-
import { ArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera.js';
|
|
2
|
-
import { HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight.js';
|
|
3
|
-
import { loadAssetContainerAsync } from '@babylonjs/core/Loading/sceneLoader.js';
|
|
4
|
-
import { PBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial.js';
|
|
5
|
-
import { CubeTexture } from '@babylonjs/core/Materials/Textures/cubeTexture.js';
|
|
6
|
-
import { Texture } from '@babylonjs/core/Materials/Textures/texture.js';
|
|
7
|
-
import { Color4 } from '@babylonjs/core/Maths/math.color.js';
|
|
8
|
-
import { Scalar } from '@babylonjs/core/Maths/math.scalar.js';
|
|
9
|
-
import { Vector3 } from '@babylonjs/core/Maths/math.vector.js';
|
|
10
|
-
import { CreateBox } from '@babylonjs/core/Meshes/Builders/boxBuilder.js';
|
|
11
|
-
import { AsyncLock } from '@babylonjs/core/Misc/asyncLock.js';
|
|
12
|
-
import { Observable } from '@babylonjs/core/Misc/observable.js';
|
|
13
|
-
import { Scene } from '@babylonjs/core/scene.js';
|
|
14
|
-
import { registerBuiltInLoaders } from '@babylonjs/loaders/dynamic.js';
|
|
15
|
-
import '@babylonjs/core/Animations/animatable.js';
|
|
16
|
-
import { __decorate } from '@babylonjs/core/tslib.es6.js';
|
|
17
|
-
import { css, LitElement, html } from 'lit';
|
|
18
|
-
import { property, state, query, customElement } from 'lit/decorators.js';
|
|
19
|
-
import { Logger } from '@babylonjs/core/Misc/logger.js';
|
|
20
|
-
import { Engine } from '@babylonjs/core/Engines/engine.js';
|
|
21
|
-
|
|
22
|
-
function createSkybox(scene, camera, environmentTexture, blur) {
|
|
23
|
-
const hdrSkybox = CreateBox("hdrSkyBox", undefined, scene);
|
|
24
|
-
const hdrSkyboxMaterial = new PBRMaterial("skyBox", scene);
|
|
25
|
-
hdrSkyboxMaterial.backFaceCulling = false;
|
|
26
|
-
hdrSkyboxMaterial.reflectionTexture = environmentTexture.clone();
|
|
27
|
-
if (hdrSkyboxMaterial.reflectionTexture) {
|
|
28
|
-
hdrSkyboxMaterial.reflectionTexture.coordinatesMode = Texture.SKYBOX_MODE;
|
|
29
|
-
}
|
|
30
|
-
hdrSkyboxMaterial.microSurface = 1.0 - blur;
|
|
31
|
-
hdrSkyboxMaterial.disableLighting = true;
|
|
32
|
-
hdrSkyboxMaterial.twoSidedLighting = true;
|
|
33
|
-
hdrSkybox.material = hdrSkyboxMaterial;
|
|
34
|
-
hdrSkybox.isPickable = false;
|
|
35
|
-
hdrSkybox.infiniteDistance = true;
|
|
36
|
-
hdrSkybox.ignoreCameraMaxZ = true;
|
|
37
|
-
updateSkybox(hdrSkybox, camera);
|
|
38
|
-
return hdrSkybox;
|
|
39
|
-
}
|
|
40
|
-
function updateSkybox(skybox, camera) {
|
|
41
|
-
skybox?.scaling.setAll((camera.maxZ - camera.minZ) / 2);
|
|
42
|
-
}
|
|
43
|
-
const defaultViewerOptions = {
|
|
44
|
-
backgroundColor: new Color4(0.1, 0.1, 0.2, 1.0),
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Provides an experience for viewing a single 3D model.
|
|
48
|
-
* @remarks
|
|
49
|
-
* The Viewer is not tied to a specific UI framework and can be used with Babylon.js in a browser or with Babylon Native.
|
|
50
|
-
* Includes (or will include) support for common model viewing requirements such as:
|
|
51
|
-
* - Loading different model formats.
|
|
52
|
-
* - Setting up a camera and providing default behaviors like auto orbit and pose interpolation.
|
|
53
|
-
* - Framing the loaded model in the camera's view.
|
|
54
|
-
* - Setting up the environment, lighting, and tone mapping.
|
|
55
|
-
* - Enumerating and playing (or auto playing) animations.
|
|
56
|
-
* - Enumerating and switching between material variants.
|
|
57
|
-
* - Full screen and XR modes.
|
|
58
|
-
*/
|
|
59
|
-
class Viewer {
|
|
60
|
-
constructor(_engine, options) {
|
|
61
|
-
this._engine = _engine;
|
|
62
|
-
/**
|
|
63
|
-
* Fired when a model is loaded into the viewer.
|
|
64
|
-
*/
|
|
65
|
-
this.onModelLoaded = new Observable();
|
|
66
|
-
/**
|
|
67
|
-
* Fired when an error occurs while loading a model.
|
|
68
|
-
*/
|
|
69
|
-
this.onModelError = new Observable();
|
|
70
|
-
/**
|
|
71
|
-
* Fired when the selected animation changes.
|
|
72
|
-
*/
|
|
73
|
-
this.onSelectedAnimationChanged = new Observable();
|
|
74
|
-
/**
|
|
75
|
-
* Fired when the animation speed changes.
|
|
76
|
-
*/
|
|
77
|
-
this.onAnimationSpeedChanged = new Observable();
|
|
78
|
-
/**
|
|
79
|
-
* Fired when the selected animation is playing or paused.
|
|
80
|
-
*/
|
|
81
|
-
this.onIsAnimationPlayingChanged = new Observable();
|
|
82
|
-
/**
|
|
83
|
-
* Fired when the current point on the selected animation timeline changes.
|
|
84
|
-
*/
|
|
85
|
-
this.onAnimationProgressChanged = new Observable();
|
|
86
|
-
this._skybox = null;
|
|
87
|
-
this._isDisposed = false;
|
|
88
|
-
this._loadModelLock = new AsyncLock();
|
|
89
|
-
this._loadModelAbortController = null;
|
|
90
|
-
this._loadEnvironmentLock = new AsyncLock();
|
|
91
|
-
this._environment = null;
|
|
92
|
-
this._loadEnvironmentAbortController = null;
|
|
93
|
-
this._selectedAnimation = -1;
|
|
94
|
-
this._activeAnimationObservers = [];
|
|
95
|
-
this._animationSpeed = 1;
|
|
96
|
-
const finalOptions = { ...defaultViewerOptions, ...options };
|
|
97
|
-
this._details = {
|
|
98
|
-
scene: new Scene(this._engine),
|
|
99
|
-
model: null,
|
|
100
|
-
};
|
|
101
|
-
this._details.scene.clearColor = finalOptions.backgroundColor;
|
|
102
|
-
this._camera = new ArcRotateCamera("camera1", 0, 0, 1, Vector3.Zero(), this._details.scene);
|
|
103
|
-
this._camera.attachControl();
|
|
104
|
-
this._updateCamera(); // set default camera values
|
|
105
|
-
this._autoRotationBehavior = this._camera.getBehaviorByName("AutoRotation");
|
|
106
|
-
// Load a default light, but ignore errors as the user might be immediately loading their own environment.
|
|
107
|
-
this.loadEnvironmentAsync(undefined).catch(() => { });
|
|
108
|
-
// TODO: render at least back ground. Maybe we can only run renderloop when a mesh is loaded. What to render until then?
|
|
109
|
-
const render = () => {
|
|
110
|
-
this._details.scene.render();
|
|
111
|
-
if (this.isAnimationPlaying) {
|
|
112
|
-
this.onAnimationProgressChanged.notifyObservers();
|
|
113
|
-
this._autoRotationBehavior.resetLastInteractionTime();
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
this._engine.runRenderLoop(render);
|
|
117
|
-
this._renderLoopController = {
|
|
118
|
-
dispose: () => this._engine.stopRenderLoop(render),
|
|
119
|
-
};
|
|
120
|
-
options?.onInitialized?.(this._details);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* The list of animation names for the currently loaded model.
|
|
124
|
-
*/
|
|
125
|
-
get animations() {
|
|
126
|
-
return this._details.model?.animationGroups.map((group) => group.name) ?? [];
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* The currently selected animation index.
|
|
130
|
-
*/
|
|
131
|
-
get selectedAnimation() {
|
|
132
|
-
return this._selectedAnimation;
|
|
133
|
-
}
|
|
134
|
-
set selectedAnimation(value) {
|
|
135
|
-
value = Math.round(Scalar.Clamp(value, -1, this.animations.length - 1));
|
|
136
|
-
if (value !== this._selectedAnimation) {
|
|
137
|
-
const startAnimation = this.isAnimationPlaying;
|
|
138
|
-
if (this._activeAnimation) {
|
|
139
|
-
this._activeAnimation.goToFrame(0);
|
|
140
|
-
this._activeAnimation.stop();
|
|
141
|
-
this._activeAnimationObservers.forEach((observer) => observer.remove());
|
|
142
|
-
this._activeAnimationObservers = [];
|
|
143
|
-
}
|
|
144
|
-
this._selectedAnimation = value;
|
|
145
|
-
if (this._activeAnimation) {
|
|
146
|
-
this._activeAnimationObservers = [
|
|
147
|
-
this._activeAnimation.onAnimationGroupPlayObservable.add(() => {
|
|
148
|
-
this.onIsAnimationPlayingChanged.notifyObservers();
|
|
149
|
-
}),
|
|
150
|
-
this._activeAnimation.onAnimationGroupPauseObservable.add(() => {
|
|
151
|
-
this.onIsAnimationPlayingChanged.notifyObservers();
|
|
152
|
-
}),
|
|
153
|
-
this._activeAnimation.onAnimationGroupEndObservable.add(() => {
|
|
154
|
-
this.onIsAnimationPlayingChanged.notifyObservers();
|
|
155
|
-
this.onAnimationProgressChanged.notifyObservers();
|
|
156
|
-
}),
|
|
157
|
-
];
|
|
158
|
-
this._activeAnimation.start(true, this._animationSpeed);
|
|
159
|
-
if (!startAnimation) {
|
|
160
|
-
this.pauseAnimation();
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
this.onSelectedAnimationChanged.notifyObservers();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* True if an animation is currently playing.
|
|
168
|
-
*/
|
|
169
|
-
get isAnimationPlaying() {
|
|
170
|
-
return this._activeAnimation?.isPlaying ?? false;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* The speed scale at which animations are played.
|
|
174
|
-
*/
|
|
175
|
-
get animationSpeed() {
|
|
176
|
-
return this._animationSpeed;
|
|
177
|
-
}
|
|
178
|
-
set animationSpeed(value) {
|
|
179
|
-
this._animationSpeed = value;
|
|
180
|
-
this._applyAnimationSpeed();
|
|
181
|
-
this.onAnimationSpeedChanged.notifyObservers();
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* The current point on the selected animation timeline, normalized between 0 and 1.
|
|
185
|
-
*/
|
|
186
|
-
get animationProgress() {
|
|
187
|
-
if (this._activeAnimation) {
|
|
188
|
-
return this._activeAnimation.getCurrentFrame() / (this._activeAnimation.to - this._activeAnimation.from);
|
|
189
|
-
}
|
|
190
|
-
return 0;
|
|
191
|
-
}
|
|
192
|
-
set animationProgress(value) {
|
|
193
|
-
if (this._activeAnimation) {
|
|
194
|
-
this._activeAnimation.goToFrame(value * (this._activeAnimation.to - this._activeAnimation.from));
|
|
195
|
-
this.onAnimationProgressChanged.notifyObservers();
|
|
196
|
-
this._autoRotationBehavior.resetLastInteractionTime();
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
get _activeAnimation() {
|
|
200
|
-
return this._details.model?.animationGroups[this._selectedAnimation] ?? null;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Loads a 3D model from the specified URL.
|
|
204
|
-
* @remarks
|
|
205
|
-
* If a model is already loaded, it will be unloaded before loading the new model.
|
|
206
|
-
* @param source A url or File or ArrayBufferView that points to the model to load.
|
|
207
|
-
* @param options The options to use when loading the model.
|
|
208
|
-
* @param abortSignal An optional signal that can be used to abort the loading process.
|
|
209
|
-
*/
|
|
210
|
-
async loadModelAsync(source, options, abortSignal) {
|
|
211
|
-
this._throwIfDisposedOrAborted(abortSignal);
|
|
212
|
-
this._loadModelAbortController?.abort("New model is being loaded before previous model finished loading.");
|
|
213
|
-
const abortController = (this._loadModelAbortController = new AbortController());
|
|
214
|
-
// TODO: Disable audio for now, later figure out how to re-introduce it through dynamic imports.
|
|
215
|
-
options = {
|
|
216
|
-
...(options ?? {}),
|
|
217
|
-
pluginOptions: {
|
|
218
|
-
...(options?.pluginOptions ?? {}),
|
|
219
|
-
gltf: {
|
|
220
|
-
...(options?.pluginOptions?.gltf ?? {}),
|
|
221
|
-
extensionOptions: {
|
|
222
|
-
...(options?.pluginOptions?.gltf?.extensionOptions ?? {}),
|
|
223
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
224
|
-
KHR_audio: {
|
|
225
|
-
enabled: false,
|
|
226
|
-
},
|
|
227
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
228
|
-
MSFT_audio_emitter: {
|
|
229
|
-
enabled: false,
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
};
|
|
235
|
-
await this._loadModelLock.lockAsync(async () => {
|
|
236
|
-
this._throwIfDisposedOrAborted(abortSignal, abortController.signal);
|
|
237
|
-
this._details.model?.dispose();
|
|
238
|
-
this.selectedAnimation = -1;
|
|
239
|
-
try {
|
|
240
|
-
this._details.model = await loadAssetContainerAsync(source, this._details.scene, options);
|
|
241
|
-
this._details.model.animationGroups.forEach((group) => group.stop());
|
|
242
|
-
this.selectedAnimation = 0;
|
|
243
|
-
this._details.model.addAllToScene();
|
|
244
|
-
this._updateCamera();
|
|
245
|
-
this._applyAnimationSpeed();
|
|
246
|
-
this.onModelLoaded.notifyObservers();
|
|
247
|
-
}
|
|
248
|
-
catch (e) {
|
|
249
|
-
this.onModelError.notifyObservers(e);
|
|
250
|
-
throw e;
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Loads an environment texture from the specified url and sets up a corresponding skybox.
|
|
256
|
-
* @remarks
|
|
257
|
-
* If no url is provided, a default hemispheric light will be created.
|
|
258
|
-
* If an environment is already loaded, it will be unloaded before loading the new environment.
|
|
259
|
-
* @param url The url of the environment texture to load.
|
|
260
|
-
* @param options The options to use when loading the environment.
|
|
261
|
-
* @param abortSignal An optional signal that can be used to abort the loading process.
|
|
262
|
-
*/
|
|
263
|
-
async loadEnvironmentAsync(url, options, abortSignal) {
|
|
264
|
-
this._throwIfDisposedOrAborted(abortSignal);
|
|
265
|
-
this._loadEnvironmentAbortController?.abort("New environment is being loaded before previous environment finished loading.");
|
|
266
|
-
const abortController = (this._loadEnvironmentAbortController = new AbortController());
|
|
267
|
-
await this._loadEnvironmentLock.lockAsync(async () => {
|
|
268
|
-
this._throwIfDisposedOrAborted(abortSignal, abortController.signal);
|
|
269
|
-
this._environment?.dispose();
|
|
270
|
-
this._environment = await new Promise((resolve, reject) => {
|
|
271
|
-
if (!url) {
|
|
272
|
-
const light = new HemisphericLight("hemilight", Vector3.Up(), this._details.scene);
|
|
273
|
-
this._details.scene.autoClear = true;
|
|
274
|
-
resolve(light);
|
|
275
|
-
}
|
|
276
|
-
else {
|
|
277
|
-
const cubeTexture = CubeTexture.CreateFromPrefilteredData(url, this._details.scene);
|
|
278
|
-
this._details.scene.environmentTexture = cubeTexture;
|
|
279
|
-
const skybox = createSkybox(this._details.scene, this._camera, cubeTexture, 0.3);
|
|
280
|
-
this._skybox = skybox;
|
|
281
|
-
this._details.scene.autoClear = false;
|
|
282
|
-
const dispose = () => {
|
|
283
|
-
cubeTexture.dispose();
|
|
284
|
-
skybox.dispose();
|
|
285
|
-
this._skybox = null;
|
|
286
|
-
};
|
|
287
|
-
const successObserver = cubeTexture.onLoadObservable.addOnce(() => {
|
|
288
|
-
successObserver.remove();
|
|
289
|
-
errorObserver.remove();
|
|
290
|
-
resolve({
|
|
291
|
-
dispose,
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
const errorObserver = Texture.OnTextureLoadErrorObservable.add((texture) => {
|
|
295
|
-
if (texture === cubeTexture) {
|
|
296
|
-
successObserver.remove();
|
|
297
|
-
errorObserver.remove();
|
|
298
|
-
dispose();
|
|
299
|
-
reject(new Error("Failed to load environment texture."));
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Toggles the play/pause animation state if there is a selected animation.
|
|
308
|
-
*/
|
|
309
|
-
toggleAnimation() {
|
|
310
|
-
if (this.isAnimationPlaying) {
|
|
311
|
-
this.pauseAnimation();
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
this.playAnimation();
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Plays the selected animation if there is one.
|
|
319
|
-
*/
|
|
320
|
-
playAnimation() {
|
|
321
|
-
this._activeAnimation?.play(true);
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Pauses the selected animation if there is one.
|
|
325
|
-
*/
|
|
326
|
-
async pauseAnimation() {
|
|
327
|
-
this._activeAnimation?.pause();
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Disposes of the resources held by the Viewer.
|
|
331
|
-
*/
|
|
332
|
-
dispose() {
|
|
333
|
-
this.selectedAnimation = -1;
|
|
334
|
-
this.animationProgress = 0;
|
|
335
|
-
this._renderLoopController.dispose();
|
|
336
|
-
this._details.scene.dispose();
|
|
337
|
-
this.onModelLoaded.clear();
|
|
338
|
-
this.onModelError.clear();
|
|
339
|
-
this.onSelectedAnimationChanged.clear();
|
|
340
|
-
this.onAnimationSpeedChanged.clear();
|
|
341
|
-
this.onIsAnimationPlayingChanged.clear();
|
|
342
|
-
this.onAnimationProgressChanged.clear();
|
|
343
|
-
this._isDisposed = true;
|
|
344
|
-
}
|
|
345
|
-
// copy/paste from sandbox and scene helpers
|
|
346
|
-
_updateCamera() {
|
|
347
|
-
// Enable camera's behaviors
|
|
348
|
-
this._camera.useFramingBehavior = true;
|
|
349
|
-
const framingBehavior = this._camera.getBehaviorByName("Framing");
|
|
350
|
-
framingBehavior.framingTime = 0;
|
|
351
|
-
framingBehavior.elevationReturnTime = -1;
|
|
352
|
-
let radius = 1;
|
|
353
|
-
if (this._details.scene.meshes.length) {
|
|
354
|
-
// get bounds and prepare framing/camera radius from its values
|
|
355
|
-
this._camera.lowerRadiusLimit = null;
|
|
356
|
-
const worldExtends = this._details.scene.getWorldExtends((mesh) => {
|
|
357
|
-
return mesh.isVisible && mesh.isEnabled();
|
|
358
|
-
});
|
|
359
|
-
framingBehavior.zoomOnBoundingInfo(worldExtends.min, worldExtends.max);
|
|
360
|
-
const worldSize = worldExtends.max.subtract(worldExtends.min);
|
|
361
|
-
const worldCenter = worldExtends.min.add(worldSize.scale(0.5));
|
|
362
|
-
radius = worldSize.length() * 1.2;
|
|
363
|
-
if (!isFinite(radius)) {
|
|
364
|
-
radius = 1;
|
|
365
|
-
worldCenter.copyFromFloats(0, 0, 0);
|
|
366
|
-
}
|
|
367
|
-
this._camera.setTarget(worldCenter);
|
|
368
|
-
}
|
|
369
|
-
this._camera.lowerRadiusLimit = radius * 0.01;
|
|
370
|
-
this._camera.wheelPrecision = 100 / radius;
|
|
371
|
-
this._camera.alpha = Math.PI / 2;
|
|
372
|
-
this._camera.beta = Math.PI / 2;
|
|
373
|
-
this._camera.radius = radius;
|
|
374
|
-
this._camera.minZ = radius * 0.01;
|
|
375
|
-
this._camera.maxZ = radius * 1000;
|
|
376
|
-
this._camera.speed = radius * 0.2;
|
|
377
|
-
this._camera.useAutoRotationBehavior = true;
|
|
378
|
-
this._camera.pinchPrecision = 200 / this._camera.radius;
|
|
379
|
-
this._camera.upperRadiusLimit = 5 * this._camera.radius;
|
|
380
|
-
this._camera.wheelDeltaPercentage = 0.01;
|
|
381
|
-
this._camera.pinchDeltaPercentage = 0.01;
|
|
382
|
-
this._camera.restoreStateInterpolationFactor = 0.1;
|
|
383
|
-
updateSkybox(this._skybox, this._camera);
|
|
384
|
-
}
|
|
385
|
-
_applyAnimationSpeed() {
|
|
386
|
-
this._details.model?.animationGroups.forEach((group) => (group.speedRatio = this._animationSpeed));
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Check for disposed or aborted state (basically everything that can interrupt an async operation).
|
|
390
|
-
* @param abortSignals A set of optional AbortSignals to also check.
|
|
391
|
-
*/
|
|
392
|
-
_throwIfDisposedOrAborted(...abortSignals) {
|
|
393
|
-
if (this._isDisposed) {
|
|
394
|
-
throw new Error("Viewer is disposed.");
|
|
395
|
-
}
|
|
396
|
-
for (const signal of abortSignals) {
|
|
397
|
-
signal?.throwIfAborted();
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
(() => {
|
|
402
|
-
registerBuiltInLoaders();
|
|
403
|
-
})();
|
|
404
|
-
|
|
405
|
-
const defaultCanvasViewerOptions = {
|
|
406
|
-
engine: "WebGL",
|
|
407
|
-
};
|
|
408
|
-
/**
|
|
409
|
-
* Creates a Viewer instance that is bound to an HTML canvas.
|
|
410
|
-
* @remarks
|
|
411
|
-
* This function can be shared across multiple UI integrations (e.g. Web Components, React, etc.).
|
|
412
|
-
* @param canvas The canvas element to bind the Viewer to.
|
|
413
|
-
* @param options The options to use when creating the Viewer and binding it to the specified canvas.
|
|
414
|
-
* @returns A Viewer instance that is bound to the specified canvas.
|
|
415
|
-
*/
|
|
416
|
-
function createViewerForCanvas(canvas, options) {
|
|
417
|
-
const finalOptions = { ...defaultCanvasViewerOptions, ...options };
|
|
418
|
-
const disposeActions = [];
|
|
419
|
-
// If the canvas is resized, note that the engine needs a resize, but don't resize it here as it will result in flickering.
|
|
420
|
-
let needsResize = false;
|
|
421
|
-
const resizeObserver = new ResizeObserver(() => (needsResize = true));
|
|
422
|
-
resizeObserver.observe(canvas);
|
|
423
|
-
disposeActions.push(() => resizeObserver.disconnect());
|
|
424
|
-
// Create an engine instance.
|
|
425
|
-
// TODO: Create a WebGL or WebGPUEngine based on the engine option.
|
|
426
|
-
const engine = new Engine(canvas, undefined, options);
|
|
427
|
-
// Override the onInitialized callback to add in some specific behavior.
|
|
428
|
-
const onInitialized = finalOptions.onInitialized;
|
|
429
|
-
finalOptions.onInitialized = (details) => {
|
|
430
|
-
// Resize if needed right before rendering the Viewer scene to avoid any flickering.
|
|
431
|
-
const beforeRenderObserver = details.scene.onBeforeRenderObservable.add(() => {
|
|
432
|
-
if (needsResize) {
|
|
433
|
-
engine.resize();
|
|
434
|
-
needsResize = false;
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
disposeActions.push(() => beforeRenderObserver.remove());
|
|
438
|
-
// Call the original onInitialized callback, if one was provided.
|
|
439
|
-
onInitialized?.(details);
|
|
440
|
-
};
|
|
441
|
-
// Instantiate the Viewer with the engine and options.
|
|
442
|
-
const viewer = new Viewer(engine, finalOptions);
|
|
443
|
-
disposeActions.push(viewer.dispose.bind(viewer));
|
|
444
|
-
disposeActions.push(() => engine.dispose());
|
|
445
|
-
// Override the Viewer's dispose method to add in additional cleanup.
|
|
446
|
-
viewer.dispose = () => disposeActions.forEach((dispose) => dispose());
|
|
447
|
-
// TODO: Creating an engine instance will be async if we use a dynamic import for choosing either Engine or WebGPUEngine,
|
|
448
|
-
// or even when just creating a WebGPUEngine since we have to call initAsync. To keep the UI integration layer
|
|
449
|
-
// simple (e.g. not have to deal with asynchronous creation of the Viewer), should we also be able to pass Promise<AbstractEngine> to the Viewer constructor?
|
|
450
|
-
return viewer;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
// Icon SVG is pulled from https://fluentuipr.z22.web.core.windows.net/heads/master/public-docsite-v9/storybook/iframe.html?id=icons-catalog--page&viewMode=story
|
|
454
|
-
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";
|
|
455
|
-
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";
|
|
456
|
-
const allowedAnimationSpeeds = [0.5, 1, 1.5, 2];
|
|
457
|
-
/**
|
|
458
|
-
* Represents a custom element that displays a 3D model using the Babylon.js Viewer.
|
|
459
|
-
*/
|
|
460
|
-
let HTML3DElement = class HTML3DElement extends LitElement {
|
|
461
|
-
constructor() {
|
|
462
|
-
super(...arguments);
|
|
463
|
-
/**
|
|
464
|
-
* The model URL.
|
|
465
|
-
*/
|
|
466
|
-
this.src = "";
|
|
467
|
-
/**
|
|
468
|
-
* The environment URL.
|
|
469
|
-
*/
|
|
470
|
-
this.env = "";
|
|
471
|
-
/**
|
|
472
|
-
* The speed scale at which animations are played.
|
|
473
|
-
*/
|
|
474
|
-
this.animationSpeed = 1;
|
|
475
|
-
/**
|
|
476
|
-
* The current point on the selected animation timeline, normalized between 0 and 1.
|
|
477
|
-
*/
|
|
478
|
-
this.animationProgress = 0;
|
|
479
|
-
this._animations = [];
|
|
480
|
-
this._selectedAnimation = -1;
|
|
481
|
-
this._isAnimationPlaying = false;
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* The list of animation names for the currently loaded model.
|
|
485
|
-
*/
|
|
486
|
-
get animations() {
|
|
487
|
-
return this._animations;
|
|
488
|
-
}
|
|
489
|
-
/**
|
|
490
|
-
* The currently selected animation index.
|
|
491
|
-
*/
|
|
492
|
-
get selectedAnimation() {
|
|
493
|
-
return this._selectedAnimation;
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* True if an animation is currently playing.
|
|
497
|
-
*/
|
|
498
|
-
get isAnimationPlaying() {
|
|
499
|
-
return this._isAnimationPlaying;
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* Toggles the play/pause animation state if there is a selected animation.
|
|
503
|
-
*/
|
|
504
|
-
toggleAnimation() {
|
|
505
|
-
this.viewer?.toggleAnimation();
|
|
506
|
-
}
|
|
507
|
-
// eslint-disable-next-line babylonjs/available
|
|
508
|
-
connectedCallback() {
|
|
509
|
-
super.connectedCallback();
|
|
510
|
-
this._setupViewer();
|
|
511
|
-
}
|
|
512
|
-
// eslint-disable-next-line babylonjs/available
|
|
513
|
-
firstUpdated(_changedProperties) {
|
|
514
|
-
super.firstUpdated(_changedProperties);
|
|
515
|
-
this._setupViewer();
|
|
516
|
-
}
|
|
517
|
-
// eslint-disable-next-line babylonjs/available
|
|
518
|
-
disconnectedCallback() {
|
|
519
|
-
super.disconnectedCallback();
|
|
520
|
-
this._tearDownViewer();
|
|
521
|
-
}
|
|
522
|
-
// eslint-disable-next-line babylonjs/available
|
|
523
|
-
update(changedProperties) {
|
|
524
|
-
super.update(changedProperties);
|
|
525
|
-
if (changedProperties.has("animationSpeed")) {
|
|
526
|
-
this._updateAnimationSpeed();
|
|
527
|
-
}
|
|
528
|
-
if (changedProperties.has("_selectedAnimation")) {
|
|
529
|
-
this._updateSelectedAnimation();
|
|
530
|
-
}
|
|
531
|
-
if (changedProperties.has("src")) {
|
|
532
|
-
this._updateModel();
|
|
533
|
-
}
|
|
534
|
-
if (changedProperties.has("env")) {
|
|
535
|
-
this._updateEnv();
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
// eslint-disable-next-line babylonjs/available
|
|
539
|
-
render() {
|
|
540
|
-
return html `
|
|
541
|
-
<div class="full-size">
|
|
542
|
-
<canvas id="renderCanvas" class="full-size" touch-action="none"></canvas>
|
|
543
|
-
${this.animations.length === 0
|
|
544
|
-
? ""
|
|
545
|
-
: html `
|
|
546
|
-
<slot name="tool-bar">
|
|
547
|
-
<div part="tool-bar" class="tool-bar">
|
|
548
|
-
<div class="progress-control">
|
|
549
|
-
<button aria-label="${this.isAnimationPlaying ? "Pause" : "Play"}" @click="${this.toggleAnimation}">
|
|
550
|
-
${!this.isAnimationPlaying
|
|
551
|
-
? html `<svg viewBox="0 0 20 20">
|
|
552
|
-
<path d="${playFilledIcon}" fill="currentColor"></path>
|
|
553
|
-
</svg>`
|
|
554
|
-
: html `<svg viewBox="-3 -2 24 24">
|
|
555
|
-
<path d="${pauseFilledIcon}" fill="currentColor"></path>
|
|
556
|
-
</svg>`}
|
|
557
|
-
</button>
|
|
558
|
-
<input
|
|
559
|
-
aria-label="Animation Progress"
|
|
560
|
-
class="progress-wrapper"
|
|
561
|
-
type="range"
|
|
562
|
-
min="0"
|
|
563
|
-
max="1"
|
|
564
|
-
step="0.0001"
|
|
565
|
-
.value="${this.animationProgress}"
|
|
566
|
-
@input="${this._onProgressChanged}"
|
|
567
|
-
@pointerdown="${this._onProgressPointerDown}"
|
|
568
|
-
/>
|
|
569
|
-
</div>
|
|
570
|
-
<select aria-label="Select Animation Speed" @change="${this._onAnimationSpeedChanged}">
|
|
571
|
-
${allowedAnimationSpeeds.map((speed) => html `<option value="${speed}" .selected="${this.animationSpeed === speed}">${speed}x</option>`)}
|
|
572
|
-
</select>
|
|
573
|
-
${this.animations.length > 1
|
|
574
|
-
? html `<select aria-label="Select Animation" @change="${this._onSelectedAnimationChanged}">
|
|
575
|
-
${this.animations.map((name, index) => html `<option value="${index}" .selected="${this.selectedAnimation == index}">${name}</option>`)}
|
|
576
|
-
</select>`
|
|
577
|
-
: ""}
|
|
578
|
-
</div>
|
|
579
|
-
</slot>
|
|
580
|
-
`}
|
|
581
|
-
</div>
|
|
582
|
-
`;
|
|
583
|
-
}
|
|
584
|
-
addEventListener(type, listener, options) {
|
|
585
|
-
super.addEventListener(type, listener, options);
|
|
586
|
-
}
|
|
587
|
-
_dispatchCustomEvent(type) {
|
|
588
|
-
this.dispatchEvent(new Event(type));
|
|
589
|
-
}
|
|
590
|
-
_onSelectedAnimationChanged(event) {
|
|
591
|
-
const selectElement = event.target;
|
|
592
|
-
this._selectedAnimation = Number(selectElement.value);
|
|
593
|
-
}
|
|
594
|
-
_onAnimationSpeedChanged(event) {
|
|
595
|
-
const selectElement = event.target;
|
|
596
|
-
this.animationSpeed = Number(selectElement.value);
|
|
597
|
-
}
|
|
598
|
-
_onProgressChanged(event) {
|
|
599
|
-
if (this.viewer) {
|
|
600
|
-
const input = event.target;
|
|
601
|
-
const value = Number(input.value);
|
|
602
|
-
if (value !== this.animationProgress) {
|
|
603
|
-
this.viewer.animationProgress = value;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
_onProgressPointerDown(event) {
|
|
608
|
-
if (this.viewer?.isAnimationPlaying) {
|
|
609
|
-
this.viewer.pauseAnimation();
|
|
610
|
-
const input = event.target;
|
|
611
|
-
input.addEventListener("pointerup", () => this.viewer?.playAnimation(), { once: true });
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
_setupViewer() {
|
|
615
|
-
if (this._canvas && !this.viewer) {
|
|
616
|
-
this.viewer = createViewerForCanvas(this._canvas);
|
|
617
|
-
this.viewer.onModelLoaded.add(() => {
|
|
618
|
-
this._animations = [...(this.viewer?.animations ?? [])];
|
|
619
|
-
this._dispatchCustomEvent("modelchange");
|
|
620
|
-
});
|
|
621
|
-
this.viewer.onModelError.add(() => {
|
|
622
|
-
this._dispatchCustomEvent("modelerror");
|
|
623
|
-
});
|
|
624
|
-
this.viewer.onSelectedAnimationChanged.add(() => {
|
|
625
|
-
this._selectedAnimation = this.viewer?.selectedAnimation ?? -1;
|
|
626
|
-
this._dispatchCustomEvent("selectedanimationchange");
|
|
627
|
-
});
|
|
628
|
-
this.viewer.onAnimationSpeedChanged.add(() => {
|
|
629
|
-
let speed = this.viewer?.animationSpeed ?? 1;
|
|
630
|
-
speed = allowedAnimationSpeeds.reduce((prev, curr) => (Math.abs(curr - speed) < Math.abs(prev - speed) ? curr : prev));
|
|
631
|
-
this.animationSpeed = speed;
|
|
632
|
-
this._dispatchCustomEvent("animationspeedchange");
|
|
633
|
-
});
|
|
634
|
-
this.viewer.onIsAnimationPlayingChanged.add(() => {
|
|
635
|
-
this._isAnimationPlaying = this.viewer?.isAnimationPlaying ?? false;
|
|
636
|
-
this._dispatchCustomEvent("animationplayingchange");
|
|
637
|
-
});
|
|
638
|
-
this.viewer.onAnimationProgressChanged.add(() => {
|
|
639
|
-
this.animationProgress = this.viewer?.animationProgress ?? 0;
|
|
640
|
-
this._dispatchCustomEvent("animationprogresschange");
|
|
641
|
-
});
|
|
642
|
-
this._updateSelectedAnimation();
|
|
643
|
-
this._updateAnimationSpeed();
|
|
644
|
-
this._updateModel();
|
|
645
|
-
this._updateEnv();
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
_tearDownViewer() {
|
|
649
|
-
if (this.viewer) {
|
|
650
|
-
this.viewer.dispose();
|
|
651
|
-
this.viewer = undefined;
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
_updateAnimationSpeed() {
|
|
655
|
-
if (this.viewer) {
|
|
656
|
-
this.viewer.animationSpeed = this.animationSpeed;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
_updateSelectedAnimation() {
|
|
660
|
-
if (this.viewer) {
|
|
661
|
-
this.viewer.selectedAnimation = this._selectedAnimation;
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
async _updateModel() {
|
|
665
|
-
if (this.src) {
|
|
666
|
-
await this.viewer?.loadModelAsync(this.src).catch(Logger.Log);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
_updateEnv() {
|
|
670
|
-
this.viewer?.loadEnvironmentAsync(this.env || undefined).catch(Logger.Log);
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention, jsdoc/require-jsdoc
|
|
674
|
-
HTML3DElement.styles = css `
|
|
675
|
-
:host {
|
|
676
|
-
--ui-foreground-color: white;
|
|
677
|
-
--ui-background-hue: 233;
|
|
678
|
-
--ui-background-saturation: 8%;
|
|
679
|
-
--ui-background-lightness: 39%;
|
|
680
|
-
--ui-background-opacity: 0.75;
|
|
681
|
-
--ui-background-color: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), var(--ui-background-opacity));
|
|
682
|
-
--ui-background-color-hover: hsla(
|
|
683
|
-
var(--ui-background-hue),
|
|
684
|
-
var(--ui-background-saturation),
|
|
685
|
-
calc(var(--ui-background-lightness) - 10%),
|
|
686
|
-
calc(var(--ui-background-opacity) - 0.1)
|
|
687
|
-
);
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
* {
|
|
691
|
-
box-sizing: border-box;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
.full-size {
|
|
695
|
-
display: block;
|
|
696
|
-
width: 100%;
|
|
697
|
-
height: 100%;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
.tool-bar {
|
|
701
|
-
position: absolute;
|
|
702
|
-
display: flex;
|
|
703
|
-
flex-direction: row;
|
|
704
|
-
border-radius: 12px;
|
|
705
|
-
border-color: var(--ui-foreground-color);
|
|
706
|
-
height: 48px;
|
|
707
|
-
width: calc(100% - 24px);
|
|
708
|
-
min-width: 150px;
|
|
709
|
-
max-width: 1280px;
|
|
710
|
-
bottom: 12px;
|
|
711
|
-
left: 50%;
|
|
712
|
-
transform: translateX(-50%);
|
|
713
|
-
background-color: var(--ui-background-color);
|
|
714
|
-
color: var(--ui-foreground-color);
|
|
715
|
-
-webkit-tap-highlight-color: transparent;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
.tool-bar * {
|
|
719
|
-
height: 100%;
|
|
720
|
-
min-width: 48px;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
.tool-bar select {
|
|
724
|
-
background: none;
|
|
725
|
-
min-width: 52px;
|
|
726
|
-
max-width: 128px;
|
|
727
|
-
border: 1px solid transparent;
|
|
728
|
-
border-radius: inherit;
|
|
729
|
-
color: inherit;
|
|
730
|
-
font-size: 14px;
|
|
731
|
-
padding: 12px;
|
|
732
|
-
cursor: pointer;
|
|
733
|
-
outline: none;
|
|
734
|
-
appearance: none; /* Remove default styling */
|
|
735
|
-
-webkit-appearance: none; /* Remove default styling for Safari */
|
|
736
|
-
-moz-appearance: none; /* Remove default styling for Firefox */
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
.tool-bar select:hover,
|
|
740
|
-
.tool-bar select:focus {
|
|
741
|
-
background-color: var(--ui-background-color-hover);
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
.tool-bar select option {
|
|
745
|
-
background-color: var(--ui-background-color);
|
|
746
|
-
color: var(--ui-foreground-color);
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
.tool-bar select:focus-visible {
|
|
750
|
-
border-color: inherit;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
.tool-bar button {
|
|
754
|
-
background: none;
|
|
755
|
-
border: 1px solid transparent;
|
|
756
|
-
border-radius: inherit;
|
|
757
|
-
color: inherit;
|
|
758
|
-
padding: 0;
|
|
759
|
-
cursor: pointer;
|
|
760
|
-
outline: none;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
.tool-bar button:hover {
|
|
764
|
-
background-color: var(--ui-background-color-hover);
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
.tool-bar button:focus-visible {
|
|
768
|
-
border-color: inherit;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
.tool-bar button svg {
|
|
772
|
-
width: 32px;
|
|
773
|
-
height: 32px;
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
.progress-control {
|
|
777
|
-
display: flex;
|
|
778
|
-
flex: 1;
|
|
779
|
-
position: relative;
|
|
780
|
-
overflow: hidden;
|
|
781
|
-
cursor: pointer;
|
|
782
|
-
align-items: center;
|
|
783
|
-
border-radius: inherit;
|
|
784
|
-
border-color: inherit;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
.progress-wrapper {
|
|
788
|
-
-webkit-appearance: none;
|
|
789
|
-
cursor: pointer;
|
|
790
|
-
width: 100%;
|
|
791
|
-
height: 100%;
|
|
792
|
-
outline: none;
|
|
793
|
-
border: 1px solid transparent;
|
|
794
|
-
border-radius: inherit;
|
|
795
|
-
padding: 0 12px;
|
|
796
|
-
background-color: transparent;
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
.progress-wrapper:focus-visible {
|
|
800
|
-
border-color: inherit;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
/*Chrome -webkit */
|
|
804
|
-
|
|
805
|
-
.progress-wrapper::-webkit-slider-thumb {
|
|
806
|
-
-webkit-appearance: none;
|
|
807
|
-
width: 20px;
|
|
808
|
-
height: 20px;
|
|
809
|
-
border: 2px solid;
|
|
810
|
-
color: var(--ui-foreground-color);
|
|
811
|
-
border-radius: 50%;
|
|
812
|
-
background: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), 1);
|
|
813
|
-
margin-top: -10px;
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
.progress-wrapper::-webkit-slider-runnable-track {
|
|
817
|
-
height: 2px;
|
|
818
|
-
-webkit-appearance: none;
|
|
819
|
-
background-color: var(--ui-foreground-color);
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
/** FireFox -moz */
|
|
823
|
-
|
|
824
|
-
.progress-wrapper::-moz-range-progress {
|
|
825
|
-
height: 2px;
|
|
826
|
-
background-color: var(--ui-foreground-color);
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
.progress-wrapper::-moz-range-thumb {
|
|
830
|
-
width: 16px;
|
|
831
|
-
height: 16px;
|
|
832
|
-
border: 2px solid var(--ui-foreground-color);
|
|
833
|
-
border-radius: 50%;
|
|
834
|
-
background: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), 1);
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
.progress-wrapper::-moz-range-track {
|
|
838
|
-
height: 2px;
|
|
839
|
-
background: var(--ui-foreground-color);
|
|
840
|
-
}
|
|
841
|
-
`;
|
|
842
|
-
__decorate([
|
|
843
|
-
property()
|
|
844
|
-
], HTML3DElement.prototype, "src", void 0);
|
|
845
|
-
__decorate([
|
|
846
|
-
property()
|
|
847
|
-
], HTML3DElement.prototype, "env", void 0);
|
|
848
|
-
__decorate([
|
|
849
|
-
property({ attribute: "animation-speed" })
|
|
850
|
-
], HTML3DElement.prototype, "animationSpeed", void 0);
|
|
851
|
-
__decorate([
|
|
852
|
-
property({ attribute: false })
|
|
853
|
-
], HTML3DElement.prototype, "animationProgress", void 0);
|
|
854
|
-
__decorate([
|
|
855
|
-
state()
|
|
856
|
-
], HTML3DElement.prototype, "_animations", void 0);
|
|
857
|
-
__decorate([
|
|
858
|
-
state()
|
|
859
|
-
], HTML3DElement.prototype, "_selectedAnimation", void 0);
|
|
860
|
-
__decorate([
|
|
861
|
-
state()
|
|
862
|
-
], HTML3DElement.prototype, "_isAnimationPlaying", void 0);
|
|
863
|
-
__decorate([
|
|
864
|
-
query("#renderCanvas")
|
|
865
|
-
], HTML3DElement.prototype, "_canvas", void 0);
|
|
866
|
-
HTML3DElement = __decorate([
|
|
867
|
-
customElement("babylon-viewer")
|
|
868
|
-
], HTML3DElement);
|
|
869
|
-
|
|
870
|
-
export { HTML3DElement, Viewer, createViewerForCanvas };
|
|
871
|
-
//# sourceMappingURL=index.js.map
|