@babylonjs/viewer 7.31.0-alpha → 7.31.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 +350 -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 -18
- package/readme.md +21 -145
- 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 +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_image_based-1Sn4IFKs.esm.min.js +0 -2
- package/dist/chunks/EXT_lights_image_based-1Sn4IFKs.esm.min.js.map +0 -1
- package/dist/chunks/EXT_lights_image_based-D3t-ue9C.esm.js +0 -172
- package/dist/chunks/EXT_lights_image_based-D3t-ue9C.esm.js.map +0 -1
- package/dist/chunks/EXT_mesh_gpu_instancing-CzXou_C5.esm.min.js +0 -2
- package/dist/chunks/EXT_mesh_gpu_instancing-CzXou_C5.esm.min.js.map +0 -1
- package/dist/chunks/EXT_mesh_gpu_instancing-DNqfkZKe.esm.js +0 -86
- package/dist/chunks/EXT_mesh_gpu_instancing-DNqfkZKe.esm.js.map +0 -1
- package/dist/chunks/EXT_meshopt_compression-BFcdcCqV.esm.js +0 -134
- package/dist/chunks/EXT_meshopt_compression-BFcdcCqV.esm.js.map +0 -1
- package/dist/chunks/EXT_meshopt_compression-ypfe6hxf.esm.min.js +0 -2
- package/dist/chunks/EXT_meshopt_compression-ypfe6hxf.esm.min.js.map +0 -1
- package/dist/chunks/EXT_texture_avif-BY8qfvRI.esm.min.js +0 -2
- package/dist/chunks/EXT_texture_avif-BY8qfvRI.esm.min.js.map +0 -1
- package/dist/chunks/EXT_texture_avif-Rv3zIg4n.esm.js +0 -44
- package/dist/chunks/EXT_texture_avif-Rv3zIg4n.esm.js.map +0 -1
- package/dist/chunks/EXT_texture_webp-D2O_CsAp.esm.js +0 -43
- package/dist/chunks/EXT_texture_webp-D2O_CsAp.esm.js.map +0 -1
- package/dist/chunks/EXT_texture_webp-oE-jrE0E.esm.min.js +0 -2
- package/dist/chunks/EXT_texture_webp-oE-jrE0E.esm.min.js.map +0 -1
- package/dist/chunks/ExtrasAsMetadata-BhuY0e54.esm.js +0 -64
- package/dist/chunks/ExtrasAsMetadata-BhuY0e54.esm.js.map +0 -1
- package/dist/chunks/ExtrasAsMetadata-qFEtoYbf.esm.min.js +0 -2
- package/dist/chunks/ExtrasAsMetadata-qFEtoYbf.esm.min.js.map +0 -1
- package/dist/chunks/KHR_animation_pointer-Bj6qGv9V.esm.min.js +0 -2
- package/dist/chunks/KHR_animation_pointer-Bj6qGv9V.esm.min.js.map +0 -1
- package/dist/chunks/KHR_animation_pointer-e5LnBZe7.esm.js +0 -343
- package/dist/chunks/KHR_animation_pointer-e5LnBZe7.esm.js.map +0 -1
- package/dist/chunks/KHR_draco_mesh_compression-BnFvVWE1.esm.js +0 -610
- package/dist/chunks/KHR_draco_mesh_compression-BnFvVWE1.esm.js.map +0 -1
- package/dist/chunks/KHR_draco_mesh_compression-CVQu_5W6.esm.min.js +0 -2
- package/dist/chunks/KHR_draco_mesh_compression-CVQu_5W6.esm.min.js.map +0 -1
- package/dist/chunks/KHR_interactivity-D7Zg2GDq.esm.js +0 -4033
- package/dist/chunks/KHR_interactivity-D7Zg2GDq.esm.js.map +0 -1
- package/dist/chunks/KHR_interactivity-xGH2Adpb.esm.min.js +0 -2
- package/dist/chunks/KHR_interactivity-xGH2Adpb.esm.min.js.map +0 -1
- package/dist/chunks/KHR_lights_punctual-BBAuDZDL.esm.js +0 -1253
- package/dist/chunks/KHR_lights_punctual-BBAuDZDL.esm.js.map +0 -1
- package/dist/chunks/KHR_lights_punctual-By9M6UVy.esm.min.js +0 -2
- package/dist/chunks/KHR_lights_punctual-By9M6UVy.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_anisotropy-Dkjoca14.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_anisotropy-Dkjoca14.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_anisotropy-qH3HobA9.esm.js +0 -64
- package/dist/chunks/KHR_materials_anisotropy-qH3HobA9.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_clearcoat-DAuJsTVp.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_clearcoat-DAuJsTVp.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_clearcoat-Rh6mwG6v.esm.js +0 -96
- package/dist/chunks/KHR_materials_clearcoat-Rh6mwG6v.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_diffuse_transmission-CaxPwhcF.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_diffuse_transmission-CaxPwhcF.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_diffuse_transmission-jR3LYlsn.esm.js +0 -97
- package/dist/chunks/KHR_materials_diffuse_transmission-jR3LYlsn.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_dispersion-BRhiELQt.esm.js +0 -62
- package/dist/chunks/KHR_materials_dispersion-BRhiELQt.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_dispersion-c6lYSa9v.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_dispersion-c6lYSa9v.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_emissive_strength-C4KADmHK.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_emissive_strength-C4KADmHK.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_emissive_strength-COLYrrO0.esm.js +0 -55
- package/dist/chunks/KHR_materials_emissive_strength-COLYrrO0.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_ior-9bOEUBVJ.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_ior-9bOEUBVJ.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_ior-CfRDQILO.esm.js +0 -64
- package/dist/chunks/KHR_materials_ior-CfRDQILO.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_iridescence-BK4vIyb6.esm.js +0 -72
- package/dist/chunks/KHR_materials_iridescence-BK4vIyb6.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_iridescence-DMeUVUvt.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_iridescence-DMeUVUvt.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-CWS40ry_.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-CWS40ry_.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-cT4jFxi_.esm.js +0 -81
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-cT4jFxi_.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_sheen-BsgoALiy.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_sheen-BsgoALiy.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_sheen-CvenDbqD.esm.js +0 -85
- package/dist/chunks/KHR_materials_sheen-CvenDbqD.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_specular-BeN-G9hP.esm.js +0 -75
- package/dist/chunks/KHR_materials_specular-BeN-G9hP.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_specular-Czv7IKcP.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_specular-Czv7IKcP.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_transmission-Bak4NBR7.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_transmission-Bak4NBR7.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_transmission-heOgvXed.esm.js +0 -307
- package/dist/chunks/KHR_materials_transmission-heOgvXed.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_unlit-IBVAhMFj.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_unlit-IBVAhMFj.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_unlit-wxh2_v42.esm.js +0 -74
- package/dist/chunks/KHR_materials_unlit-wxh2_v42.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_variants-BsiSr1O-.esm.js +0 -238
- package/dist/chunks/KHR_materials_variants-BsiSr1O-.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_variants-Dj5fUGRW.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_variants-Dj5fUGRW.esm.min.js.map +0 -1
- package/dist/chunks/KHR_materials_volume-CZH9egfT.esm.js +0 -87
- package/dist/chunks/KHR_materials_volume-CZH9egfT.esm.js.map +0 -1
- package/dist/chunks/KHR_materials_volume-DfCuukn0.esm.min.js +0 -2
- package/dist/chunks/KHR_materials_volume-DfCuukn0.esm.min.js.map +0 -1
- package/dist/chunks/KHR_mesh_quantization-BIobOHHb.esm.min.js +0 -2
- package/dist/chunks/KHR_mesh_quantization-BIobOHHb.esm.min.js.map +0 -1
- package/dist/chunks/KHR_mesh_quantization-QON7M_53.esm.js +0 -26
- package/dist/chunks/KHR_mesh_quantization-QON7M_53.esm.js.map +0 -1
- package/dist/chunks/KHR_texture_basisu-BoG2JtnT.esm.js +0 -43
- package/dist/chunks/KHR_texture_basisu-BoG2JtnT.esm.js.map +0 -1
- package/dist/chunks/KHR_texture_basisu-CzUzxtEH.esm.min.js +0 -2
- package/dist/chunks/KHR_texture_basisu-CzUzxtEH.esm.min.js.map +0 -1
- package/dist/chunks/KHR_texture_transform-B3PKgt19.esm.min.js +0 -2
- package/dist/chunks/KHR_texture_transform-B3PKgt19.esm.min.js.map +0 -1
- package/dist/chunks/KHR_texture_transform-Da8RjC5v.esm.js +0 -63
- package/dist/chunks/KHR_texture_transform-Da8RjC5v.esm.js.map +0 -1
- package/dist/chunks/KHR_xmp_json_ld-BXaa7VXe.esm.js +0 -51
- package/dist/chunks/KHR_xmp_json_ld-BXaa7VXe.esm.js.map +0 -1
- package/dist/chunks/KHR_xmp_json_ld-HVJ543WV.esm.min.js +0 -2
- package/dist/chunks/KHR_xmp_json_ld-HVJ543WV.esm.min.js.map +0 -1
- package/dist/chunks/MSFT_audio_emitter-BYUSVj_s.esm.js +0 -2207
- package/dist/chunks/MSFT_audio_emitter-BYUSVj_s.esm.js.map +0 -1
- package/dist/chunks/MSFT_audio_emitter-Bf4t92OW.esm.min.js +0 -2
- package/dist/chunks/MSFT_audio_emitter-Bf4t92OW.esm.min.js.map +0 -1
- package/dist/chunks/MSFT_lod-BTk5ksDE.esm.min.js +0 -2
- package/dist/chunks/MSFT_lod-BTk5ksDE.esm.min.js.map +0 -1
- package/dist/chunks/MSFT_lod-D5456UFP.esm.js +0 -337
- package/dist/chunks/MSFT_lod-D5456UFP.esm.js.map +0 -1
- package/dist/chunks/MSFT_minecraftMesh-CCs8f9du.esm.js +0 -46
- package/dist/chunks/MSFT_minecraftMesh-CCs8f9du.esm.js.map +0 -1
- package/dist/chunks/MSFT_minecraftMesh-CgKnODjc.esm.min.js +0 -2
- package/dist/chunks/MSFT_minecraftMesh-CgKnODjc.esm.min.js.map +0 -1
- package/dist/chunks/MSFT_sRGBFactors-BNCv6Gre.esm.min.js +0 -2
- package/dist/chunks/MSFT_sRGBFactors-BNCv6Gre.esm.min.js.map +0 -1
- package/dist/chunks/MSFT_sRGBFactors-C3nCz417.esm.js +0 -47
- package/dist/chunks/MSFT_sRGBFactors-C3nCz417.esm.js.map +0 -1
- package/dist/chunks/animationGroup-B_FlMnip.esm.js +0 -2479
- package/dist/chunks/animationGroup-B_FlMnip.esm.js.map +0 -1
- package/dist/chunks/animationGroup-U_g242TE.esm.min.js +0 -2
- package/dist/chunks/animationGroup-U_g242TE.esm.min.js.map +0 -1
- package/dist/chunks/assetContainer-DJXgbG9e.esm.min.js +0 -2
- package/dist/chunks/assetContainer-DJXgbG9e.esm.min.js.map +0 -1
- package/dist/chunks/assetContainer-shLWEkis.esm.js +0 -1720
- package/dist/chunks/assetContainer-shLWEkis.esm.js.map +0 -1
- package/dist/chunks/audioEngine-BdqCvyFS.esm.min.js +0 -2
- package/dist/chunks/audioEngine-BdqCvyFS.esm.min.js.map +0 -1
- package/dist/chunks/audioEngine-CSl97t3Y.esm.js +0 -305
- package/dist/chunks/audioEngine-CSl97t3Y.esm.js.map +0 -1
- package/dist/chunks/bakedVertexAnimation-C225r8bl.esm.min.js +0 -2
- package/dist/chunks/bakedVertexAnimation-C225r8bl.esm.min.js.map +0 -1
- package/dist/chunks/bakedVertexAnimation-Dne6l1Oz.esm.js +0 -119
- package/dist/chunks/bakedVertexAnimation-Dne6l1Oz.esm.js.map +0 -1
- package/dist/chunks/basisTextureLoader-BfheE-xD.esm.min.js +0 -2
- package/dist/chunks/basisTextureLoader-BfheE-xD.esm.min.js.map +0 -1
- package/dist/chunks/basisTextureLoader-VQfGwMJX.esm.js +0 -600
- package/dist/chunks/basisTextureLoader-VQfGwMJX.esm.js.map +0 -1
- package/dist/chunks/dds-CPxH79qD.esm.min.js +0 -2
- package/dist/chunks/dds-CPxH79qD.esm.min.js.map +0 -1
- package/dist/chunks/dds-jupK5Xca.esm.js +0 -540
- package/dist/chunks/dds-jupK5Xca.esm.js.map +0 -1
- package/dist/chunks/ddsTextureLoader-CWwCoP7e.esm.js +0 -88
- package/dist/chunks/ddsTextureLoader-CWwCoP7e.esm.js.map +0 -1
- package/dist/chunks/ddsTextureLoader-ee9z1K7d.esm.min.js +0 -2
- package/dist/chunks/ddsTextureLoader-ee9z1K7d.esm.min.js.map +0 -1
- package/dist/chunks/decalFragment-Bgt_beL3.esm.min.js +0 -2
- package/dist/chunks/decalFragment-Bgt_beL3.esm.min.js.map +0 -1
- package/dist/chunks/decalFragment-U3dusC_b.esm.js +0 -18
- package/dist/chunks/decalFragment-U3dusC_b.esm.js.map +0 -1
- package/dist/chunks/default.fragment-755hWDS-.esm.min.js +0 -2
- package/dist/chunks/default.fragment-755hWDS-.esm.min.js.map +0 -1
- package/dist/chunks/default.fragment-D_6g-4FJ.esm.min.js +0 -2
- package/dist/chunks/default.fragment-D_6g-4FJ.esm.min.js.map +0 -1
- package/dist/chunks/default.fragment-gPrZWAN-.esm.js +0 -515
- package/dist/chunks/default.fragment-gPrZWAN-.esm.js.map +0 -1
- package/dist/chunks/default.fragment-nUN83GhL.esm.js +0 -449
- package/dist/chunks/default.fragment-nUN83GhL.esm.js.map +0 -1
- package/dist/chunks/default.vertex-DtF9_kYE.esm.min.js +0 -2
- package/dist/chunks/default.vertex-DtF9_kYE.esm.min.js.map +0 -1
- package/dist/chunks/default.vertex-DvTIJZKP.esm.min.js +0 -2
- package/dist/chunks/default.vertex-DvTIJZKP.esm.min.js.map +0 -1
- package/dist/chunks/default.vertex-F2GFvisP.esm.js +0 -199
- package/dist/chunks/default.vertex-F2GFvisP.esm.js.map +0 -1
- package/dist/chunks/default.vertex-OWU0h_CV.esm.js +0 -180
- package/dist/chunks/default.vertex-OWU0h_CV.esm.js.map +0 -1
- package/dist/chunks/defaultUboDeclaration-BaqLnFSv.esm.js +0 -15
- package/dist/chunks/defaultUboDeclaration-BaqLnFSv.esm.js.map +0 -1
- package/dist/chunks/defaultUboDeclaration-CUGFIA-Y.esm.min.js +0 -2
- package/dist/chunks/defaultUboDeclaration-CUGFIA-Y.esm.min.js.map +0 -1
- package/dist/chunks/defaultUboDeclaration-DbiYbpus.esm.min.js +0 -2
- package/dist/chunks/defaultUboDeclaration-DbiYbpus.esm.min.js.map +0 -1
- package/dist/chunks/defaultUboDeclaration-DlF6YqnH.esm.js +0 -13
- package/dist/chunks/defaultUboDeclaration-DlF6YqnH.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-CC7eSIIa.esm.min.js +0 -2
- package/dist/chunks/dumpTools-CC7eSIIa.esm.min.js.map +0 -1
- package/dist/chunks/dumpTools-CP5neapl.esm.js +0 -402
- package/dist/chunks/dumpTools-CP5neapl.esm.js.map +0 -1
- package/dist/chunks/engine-CXvt3UCI.esm.min.js +0 -2
- package/dist/chunks/engine-CXvt3UCI.esm.min.js.map +0 -1
- package/dist/chunks/engine-trgW7_81.esm.js +0 -2174
- package/dist/chunks/engine-trgW7_81.esm.js.map +0 -1
- package/dist/chunks/engine.common-BPl1llb8.esm.min.js +0 -2
- package/dist/chunks/engine.common-BPl1llb8.esm.min.js.map +0 -1
- package/dist/chunks/engine.common-GP9nuuba.esm.js +0 -1088
- package/dist/chunks/engine.common-GP9nuuba.esm.js.map +0 -1
- package/dist/chunks/envTextureLoader-1bAO1Mm5.esm.js +0 -65
- package/dist/chunks/envTextureLoader-1bAO1Mm5.esm.js.map +0 -1
- package/dist/chunks/envTextureLoader-ClAG0fvY.esm.min.js +0 -2
- package/dist/chunks/envTextureLoader-ClAG0fvY.esm.min.js.map +0 -1
- package/dist/chunks/environmentTextureTools-DObcbjyn.esm.js +0 -382
- package/dist/chunks/environmentTextureTools-DObcbjyn.esm.js.map +0 -1
- package/dist/chunks/environmentTextureTools-DSF9-gKd.esm.min.js +0 -2
- package/dist/chunks/environmentTextureTools-DSF9-gKd.esm.min.js.map +0 -1
- package/dist/chunks/exrTextureLoader-KLC0QCGj.esm.min.js +0 -2
- package/dist/chunks/exrTextureLoader-KLC0QCGj.esm.min.js.map +0 -1
- package/dist/chunks/exrTextureLoader-b9G_ErfI.esm.js +0 -1682
- package/dist/chunks/exrTextureLoader-b9G_ErfI.esm.js.map +0 -1
- package/dist/chunks/fogFragment-Cr8RDhS8.esm.min.js +0 -2
- package/dist/chunks/fogFragment-Cr8RDhS8.esm.min.js.map +0 -1
- package/dist/chunks/fogFragment-CxJJx6zN.esm.js +0 -102
- package/dist/chunks/fogFragment-CxJJx6zN.esm.js.map +0 -1
- package/dist/chunks/fresnelFunction-BbOBXKTe.esm.min.js +0 -2
- package/dist/chunks/fresnelFunction-BbOBXKTe.esm.min.js.map +0 -1
- package/dist/chunks/fresnelFunction-Cpph6xZu.esm.js +0 -12
- package/dist/chunks/fresnelFunction-Cpph6xZu.esm.js.map +0 -1
- package/dist/chunks/glTFLoader-BFTXjWeW.esm.js +0 -7577
- package/dist/chunks/glTFLoader-BFTXjWeW.esm.js.map +0 -1
- package/dist/chunks/glTFLoader-C1FQTJvU.esm.min.js +0 -2
- package/dist/chunks/glTFLoader-C1FQTJvU.esm.min.js.map +0 -1
- package/dist/chunks/glTFLoaderAnimation-BCVHkNQT.esm.js +0 -77
- package/dist/chunks/glTFLoaderAnimation-BCVHkNQT.esm.js.map +0 -1
- package/dist/chunks/glTFLoaderAnimation-ncwBNhw0.esm.min.js +0 -2
- package/dist/chunks/glTFLoaderAnimation-ncwBNhw0.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-66G9hOzR.esm.js +0 -35
- package/dist/chunks/harmonicsFunctions-66G9hOzR.esm.js.map +0 -1
- package/dist/chunks/harmonicsFunctions-Bvt11NHS.esm.js +0 -34
- package/dist/chunks/harmonicsFunctions-Bvt11NHS.esm.js.map +0 -1
- package/dist/chunks/harmonicsFunctions-D0Re3qr9.esm.min.js +0 -2
- package/dist/chunks/harmonicsFunctions-D0Re3qr9.esm.min.js.map +0 -1
- package/dist/chunks/harmonicsFunctions-D9bArd30.esm.min.js +0 -2
- package/dist/chunks/harmonicsFunctions-D9bArd30.esm.min.js.map +0 -1
- package/dist/chunks/hdrTextureLoader-BMnKRS4K.esm.min.js +0 -2
- package/dist/chunks/hdrTextureLoader-BMnKRS4K.esm.min.js.map +0 -1
- package/dist/chunks/hdrTextureLoader-ETVy5rPX.esm.js +0 -252
- package/dist/chunks/hdrTextureLoader-ETVy5rPX.esm.js.map +0 -1
- package/dist/chunks/helperFunctions-1Uut4KQI.esm.js +0 -108
- package/dist/chunks/helperFunctions-1Uut4KQI.esm.js.map +0 -1
- package/dist/chunks/helperFunctions-1x6PNrxE.esm.min.js +0 -2
- package/dist/chunks/helperFunctions-1x6PNrxE.esm.min.js.map +0 -1
- package/dist/chunks/helperFunctions-CJjw4iZI.esm.js +0 -80
- package/dist/chunks/helperFunctions-CJjw4iZI.esm.js.map +0 -1
- package/dist/chunks/helperFunctions-J9m3fJc_.esm.min.js +0 -2
- package/dist/chunks/helperFunctions-J9m3fJc_.esm.min.js.map +0 -1
- package/dist/chunks/index-Cb7zGjYe.esm.js +0 -72045
- package/dist/chunks/index-Cb7zGjYe.esm.js.map +0 -1
- package/dist/chunks/index-CkOp_ioW.esm.min.js +0 -57
- package/dist/chunks/index-CkOp_ioW.esm.min.js.map +0 -1
- package/dist/chunks/ktxTextureLoader-C4PPft8N.esm.min.js +0 -2
- package/dist/chunks/ktxTextureLoader-C4PPft8N.esm.min.js.map +0 -1
- package/dist/chunks/ktxTextureLoader-DLZDXIUP.esm.js +0 -814
- package/dist/chunks/ktxTextureLoader-DLZDXIUP.esm.js.map +0 -1
- package/dist/chunks/logDepthDeclaration-BOGD7tpa.esm.min.js +0 -2
- package/dist/chunks/logDepthDeclaration-BOGD7tpa.esm.min.js.map +0 -1
- package/dist/chunks/logDepthDeclaration-BRSEcIOm.esm.min.js +0 -2
- package/dist/chunks/logDepthDeclaration-BRSEcIOm.esm.min.js.map +0 -1
- package/dist/chunks/logDepthDeclaration-Bix7HqfF.esm.js +0 -20
- package/dist/chunks/logDepthDeclaration-Bix7HqfF.esm.js.map +0 -1
- package/dist/chunks/logDepthDeclaration-CvnYdiLu.esm.js +0 -35
- package/dist/chunks/logDepthDeclaration-CvnYdiLu.esm.js.map +0 -1
- package/dist/chunks/logDepthVertex-CwCjtdqq.esm.min.js +0 -2
- package/dist/chunks/logDepthVertex-CwCjtdqq.esm.min.js.map +0 -1
- package/dist/chunks/logDepthVertex-Nm8V7C0Z.esm.min.js +0 -2
- package/dist/chunks/logDepthVertex-Nm8V7C0Z.esm.min.js.map +0 -1
- package/dist/chunks/logDepthVertex-_i7_lZHr.esm.js +0 -77
- package/dist/chunks/logDepthVertex-_i7_lZHr.esm.js.map +0 -1
- package/dist/chunks/logDepthVertex-eenp9mns.esm.js +0 -488
- package/dist/chunks/logDepthVertex-eenp9mns.esm.js.map +0 -1
- package/dist/chunks/mainUVVaryingDeclaration-HzWn5jph.esm.js +0 -11
- package/dist/chunks/mainUVVaryingDeclaration-HzWn5jph.esm.js.map +0 -1
- package/dist/chunks/mainUVVaryingDeclaration-lsGkWAON.esm.min.js +0 -2
- package/dist/chunks/mainUVVaryingDeclaration-lsGkWAON.esm.min.js.map +0 -1
- package/dist/chunks/meshUboDeclaration-BmNS2VSX.esm.min.js +0 -2
- package/dist/chunks/meshUboDeclaration-BmNS2VSX.esm.min.js.map +0 -1
- package/dist/chunks/meshUboDeclaration-CEgHTdJe.esm.js +0 -24
- package/dist/chunks/meshUboDeclaration-CEgHTdJe.esm.js.map +0 -1
- package/dist/chunks/objFileLoader-8bz2-Jb0.esm.min.js +0 -2
- package/dist/chunks/objFileLoader-8bz2-Jb0.esm.min.js.map +0 -1
- package/dist/chunks/objFileLoader-BDQi-zCy.esm.js +0 -1338
- package/dist/chunks/objFileLoader-BDQi-zCy.esm.js.map +0 -1
- package/dist/chunks/oitFragment-Be6X-0NA.esm.js +0 -1150
- package/dist/chunks/oitFragment-Be6X-0NA.esm.js.map +0 -1
- package/dist/chunks/oitFragment-DWdtkgKQ.esm.min.js +0 -2
- package/dist/chunks/oitFragment-DWdtkgKQ.esm.min.js.map +0 -1
- package/dist/chunks/oitFragment-o6GCGw0X.esm.min.js +0 -2
- package/dist/chunks/oitFragment-o6GCGw0X.esm.min.js.map +0 -1
- package/dist/chunks/oitFragment-x42vz6VK.esm.js +0 -1210
- package/dist/chunks/oitFragment-x42vz6VK.esm.js.map +0 -1
- package/dist/chunks/pass.fragment-CMPjD56P.esm.js +0 -15
- package/dist/chunks/pass.fragment-CMPjD56P.esm.js.map +0 -1
- package/dist/chunks/pass.fragment-DeE_D_Ho.esm.min.js +0 -2
- package/dist/chunks/pass.fragment-DeE_D_Ho.esm.min.js.map +0 -1
- package/dist/chunks/pass.fragment-XFaFDzze.esm.min.js +0 -2
- package/dist/chunks/pass.fragment-XFaFDzze.esm.min.js.map +0 -1
- package/dist/chunks/pass.fragment-sInzyG4C.esm.js +0 -15
- package/dist/chunks/pass.fragment-sInzyG4C.esm.js.map +0 -1
- package/dist/chunks/pbr.fragment-B9NWhj7v.esm.min.js +0 -2
- package/dist/chunks/pbr.fragment-B9NWhj7v.esm.min.js.map +0 -1
- package/dist/chunks/pbr.fragment-BhRoKi7n.esm.min.js +0 -2
- package/dist/chunks/pbr.fragment-BhRoKi7n.esm.min.js.map +0 -1
- package/dist/chunks/pbr.fragment-CUczqvrb.esm.js +0 -3219
- package/dist/chunks/pbr.fragment-CUczqvrb.esm.js.map +0 -1
- package/dist/chunks/pbr.fragment-gKQNER09.esm.js +0 -3165
- package/dist/chunks/pbr.fragment-gKQNER09.esm.js.map +0 -1
- package/dist/chunks/pbr.vertex-C4dWKPQ3.esm.js +0 -335
- package/dist/chunks/pbr.vertex-C4dWKPQ3.esm.js.map +0 -1
- package/dist/chunks/pbr.vertex-CATY0wtz.esm.js +0 -210
- package/dist/chunks/pbr.vertex-CATY0wtz.esm.js.map +0 -1
- package/dist/chunks/pbr.vertex-CeQL7NsJ.esm.min.js +0 -2
- package/dist/chunks/pbr.vertex-CeQL7NsJ.esm.min.js.map +0 -1
- package/dist/chunks/pbr.vertex-D74kRBI7.esm.min.js +0 -2
- package/dist/chunks/pbr.vertex-D74kRBI7.esm.min.js.map +0 -1
- package/dist/chunks/postprocess.vertex-D9sxQJT6.esm.js +0 -18
- package/dist/chunks/postprocess.vertex-D9sxQJT6.esm.js.map +0 -1
- package/dist/chunks/postprocess.vertex-DdMLiNeD.esm.min.js +0 -2
- package/dist/chunks/postprocess.vertex-DdMLiNeD.esm.min.js.map +0 -1
- package/dist/chunks/postprocess.vertex-DdSrvJuP.esm.min.js +0 -2
- package/dist/chunks/postprocess.vertex-DdSrvJuP.esm.min.js.map +0 -1
- package/dist/chunks/postprocess.vertex-EjDuDs7l.esm.js +0 -20
- package/dist/chunks/postprocess.vertex-EjDuDs7l.esm.js.map +0 -1
- package/dist/chunks/rawTexture-Bo4-e4rx.esm.js +0 -191
- package/dist/chunks/rawTexture-Bo4-e4rx.esm.js.map +0 -1
- package/dist/chunks/rawTexture-WJAHgyBM.esm.min.js +0 -2
- package/dist/chunks/rawTexture-WJAHgyBM.esm.min.js.map +0 -1
- package/dist/chunks/rgbdDecode.fragment-BsO7SzGw.esm.js +0 -17
- package/dist/chunks/rgbdDecode.fragment-BsO7SzGw.esm.js.map +0 -1
- package/dist/chunks/rgbdDecode.fragment-CXGWY_Zq.esm.js +0 -17
- package/dist/chunks/rgbdDecode.fragment-CXGWY_Zq.esm.js.map +0 -1
- package/dist/chunks/rgbdDecode.fragment-DHrGqYGx.esm.min.js +0 -2
- package/dist/chunks/rgbdDecode.fragment-DHrGqYGx.esm.min.js.map +0 -1
- package/dist/chunks/rgbdDecode.fragment-M48plJKv.esm.min.js +0 -2
- package/dist/chunks/rgbdDecode.fragment-M48plJKv.esm.min.js.map +0 -1
- package/dist/chunks/rgbdEncode.fragment-72S9TLT4.esm.js +0 -17
- package/dist/chunks/rgbdEncode.fragment-72S9TLT4.esm.js.map +0 -1
- package/dist/chunks/rgbdEncode.fragment-BUON0ZNd.esm.min.js +0 -2
- package/dist/chunks/rgbdEncode.fragment-BUON0ZNd.esm.min.js.map +0 -1
- package/dist/chunks/rgbdEncode.fragment-CNl9WQUM.esm.min.js +0 -2
- package/dist/chunks/rgbdEncode.fragment-CNl9WQUM.esm.min.js.map +0 -1
- package/dist/chunks/rgbdEncode.fragment-DtRf0vhW.esm.js +0 -17
- package/dist/chunks/rgbdEncode.fragment-DtRf0vhW.esm.js.map +0 -1
- package/dist/chunks/splatFileLoader-1QbSvkNp.esm.min.js +0 -2
- package/dist/chunks/splatFileLoader-1QbSvkNp.esm.min.js.map +0 -1
- package/dist/chunks/splatFileLoader-BLSQsIhb.esm.js +0 -3534
- package/dist/chunks/splatFileLoader-BLSQsIhb.esm.js.map +0 -1
- package/dist/chunks/standardMaterial-4sW8n3MU.esm.min.js +0 -2
- package/dist/chunks/standardMaterial-4sW8n3MU.esm.min.js.map +0 -1
- package/dist/chunks/standardMaterial-BMVfbLzg.esm.js +0 -1800
- package/dist/chunks/standardMaterial-BMVfbLzg.esm.js.map +0 -1
- package/dist/chunks/stlFileLoader-BsbF7xOo.esm.js +0 -238
- package/dist/chunks/stlFileLoader-BsbF7xOo.esm.js.map +0 -1
- package/dist/chunks/stlFileLoader-CIEDAEkS.esm.min.js +0 -2
- package/dist/chunks/stlFileLoader-CIEDAEkS.esm.min.js.map +0 -1
- package/dist/chunks/tgaTextureLoader-BbTIdrAk.esm.min.js +0 -2
- package/dist/chunks/tgaTextureLoader-BbTIdrAk.esm.min.js.map +0 -1
- package/dist/chunks/tgaTextureLoader-Dzknjg7w.esm.js +0 -349
- package/dist/chunks/tgaTextureLoader-Dzknjg7w.esm.js.map +0 -1
- package/dist/chunks/thinEngine-D9PVgBpS.esm.min.js +0 -2
- package/dist/chunks/thinEngine-D9PVgBpS.esm.min.js.map +0 -1
- package/dist/chunks/thinEngine-DGKggD4b.esm.js +0 -3721
- package/dist/chunks/thinEngine-DGKggD4b.esm.js.map +0 -1
- package/dist/chunks/thinInstanceMesh-Cm7oVt83.esm.js +0 -314
- package/dist/chunks/thinInstanceMesh-Cm7oVt83.esm.js.map +0 -1
- package/dist/chunks/thinInstanceMesh-CpMngBy7.esm.min.js +0 -2
- package/dist/chunks/thinInstanceMesh-CpMngBy7.esm.min.js.map +0 -1
- package/dist/chunks/vertexColorMixing-DH0rI910.esm.min.js +0 -2
- package/dist/chunks/vertexColorMixing-DH0rI910.esm.min.js.map +0 -1
- package/dist/chunks/vertexColorMixing-U49ClqLL.esm.js +0 -528
- package/dist/chunks/vertexColorMixing-U49ClqLL.esm.js.map +0 -1
- package/dist/chunks/webgpuEngine-BL-YuOoY.esm.min.js +0 -2
- package/dist/chunks/webgpuEngine-BL-YuOoY.esm.min.js.map +0 -1
- package/dist/chunks/webgpuEngine-DPV5C2k5.esm.js +0 -11191
- package/dist/chunks/webgpuEngine-DPV5C2k5.esm.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/docs/ViewerDefault.jpg +0 -0
- package/docs/ViewerParts.jpg +0 -0
- package/docs/ViewerSlots.jpg +0 -0
- package/docs/ViewerStyled.jpg +0 -0
- package/lib/index.d.ts +0 -325
- package/lib/index.js +0 -1116
- package/lib/index.js.map +0 -1
package/lib/index.js
DELETED
|
@@ -1,1116 +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 { Clamp } from '@babylonjs/core/Maths/math.scalar.functions.js';
|
|
9
|
-
import { Vector3, TmpVectors } from '@babylonjs/core/Maths/math.vector.js';
|
|
10
|
-
import { CreateBox } from '@babylonjs/core/Meshes/Builders/boxBuilder.js';
|
|
11
|
-
import { computeMaxExtents } from '@babylonjs/core/Meshes/meshUtils.js';
|
|
12
|
-
import { AsyncLock } from '@babylonjs/core/Misc/asyncLock.js';
|
|
13
|
-
import { Observable } from '@babylonjs/core/Misc/observable.js';
|
|
14
|
-
import { Scene } from '@babylonjs/core/scene.js';
|
|
15
|
-
import { registerBuiltInLoaders } from '@babylonjs/loaders/dynamic.js';
|
|
16
|
-
import { Viewport } from '@babylonjs/core/Maths/math.viewport.js';
|
|
17
|
-
import { GetHotSpotToRef } from '@babylonjs/core/Meshes/abstractMesh.hotSpot.js';
|
|
18
|
-
import { SnapshotRenderingHelper } from '@babylonjs/core/Misc/snapshotRenderingHelper.js';
|
|
19
|
-
import { __decorate } from '@babylonjs/core/tslib.es6.js';
|
|
20
|
-
import { css, LitElement, html } from 'lit';
|
|
21
|
-
import { property, state, query, customElement } from 'lit/decorators.js';
|
|
22
|
-
import { Logger } from '@babylonjs/core/Misc/logger.js';
|
|
23
|
-
|
|
24
|
-
function throwIfAborted(...abortSignals) {
|
|
25
|
-
for (const signal of abortSignals) {
|
|
26
|
-
signal?.throwIfAborted();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function createSkybox(scene, camera, environmentTexture, blur) {
|
|
30
|
-
const hdrSkybox = CreateBox("hdrSkyBox", undefined, scene);
|
|
31
|
-
const hdrSkyboxMaterial = new PBRMaterial("skyBox", scene);
|
|
32
|
-
hdrSkyboxMaterial.backFaceCulling = false;
|
|
33
|
-
hdrSkyboxMaterial.reflectionTexture = environmentTexture.clone();
|
|
34
|
-
if (hdrSkyboxMaterial.reflectionTexture) {
|
|
35
|
-
hdrSkyboxMaterial.reflectionTexture.coordinatesMode = Texture.SKYBOX_MODE;
|
|
36
|
-
}
|
|
37
|
-
hdrSkyboxMaterial.microSurface = 1.0 - blur;
|
|
38
|
-
hdrSkyboxMaterial.disableLighting = true;
|
|
39
|
-
hdrSkyboxMaterial.twoSidedLighting = true;
|
|
40
|
-
hdrSkybox.material = hdrSkyboxMaterial;
|
|
41
|
-
hdrSkybox.isPickable = false;
|
|
42
|
-
hdrSkybox.infiniteDistance = true;
|
|
43
|
-
updateSkybox(hdrSkybox, camera);
|
|
44
|
-
return hdrSkybox;
|
|
45
|
-
}
|
|
46
|
-
function updateSkybox(skybox, camera) {
|
|
47
|
-
skybox?.scaling.setAll((camera.maxZ - camera.minZ) / 2);
|
|
48
|
-
}
|
|
49
|
-
const defaultViewerOptions = {
|
|
50
|
-
backgroundColor: new Color4(0.1, 0.1, 0.2, 1.0),
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Provides an experience for viewing a single 3D model.
|
|
54
|
-
* @remarks
|
|
55
|
-
* The Viewer is not tied to a specific UI framework and can be used with Babylon.js in a browser or with Babylon Native.
|
|
56
|
-
* Includes (or will include) support for common model viewing requirements such as:
|
|
57
|
-
* - Loading different model formats.
|
|
58
|
-
* - Setting up a camera and providing default behaviors like auto orbit and pose interpolation.
|
|
59
|
-
* - Framing the loaded model in the camera's view.
|
|
60
|
-
* - Setting up the environment, lighting, and tone mapping.
|
|
61
|
-
* - Enumerating and playing (or auto playing) animations.
|
|
62
|
-
* - Enumerating and switching between material variants.
|
|
63
|
-
* - Full screen and XR modes.
|
|
64
|
-
*/
|
|
65
|
-
class Viewer {
|
|
66
|
-
constructor(_engine, options) {
|
|
67
|
-
this._engine = _engine;
|
|
68
|
-
/**
|
|
69
|
-
* Fired when the environment has changed.
|
|
70
|
-
*/
|
|
71
|
-
this.onEnvironmentChanged = new Observable();
|
|
72
|
-
/**
|
|
73
|
-
* Fired when an error occurs while loading the environment.
|
|
74
|
-
*/
|
|
75
|
-
this.onEnvironmentError = new Observable();
|
|
76
|
-
/**
|
|
77
|
-
* Fired when a model is loaded into the viewer (or unloaded from the viewer).
|
|
78
|
-
*/
|
|
79
|
-
this.onModelChanged = new Observable();
|
|
80
|
-
/**
|
|
81
|
-
* Fired when an error occurs while loading a model.
|
|
82
|
-
*/
|
|
83
|
-
this.onModelError = new Observable();
|
|
84
|
-
/**
|
|
85
|
-
* Fired when the selected animation changes.
|
|
86
|
-
*/
|
|
87
|
-
this.onSelectedAnimationChanged = new Observable();
|
|
88
|
-
/**
|
|
89
|
-
* Fired when the animation speed changes.
|
|
90
|
-
*/
|
|
91
|
-
this.onAnimationSpeedChanged = new Observable();
|
|
92
|
-
/**
|
|
93
|
-
* Fired when the selected animation is playing or paused.
|
|
94
|
-
*/
|
|
95
|
-
this.onIsAnimationPlayingChanged = new Observable();
|
|
96
|
-
/**
|
|
97
|
-
* Fired when the current point on the selected animation timeline changes.
|
|
98
|
-
*/
|
|
99
|
-
this.onAnimationProgressChanged = new Observable();
|
|
100
|
-
this._skybox = null;
|
|
101
|
-
this._light = null;
|
|
102
|
-
this._isDisposed = false;
|
|
103
|
-
this._loadModelLock = new AsyncLock();
|
|
104
|
-
this._loadModelAbortController = null;
|
|
105
|
-
this._loadEnvironmentLock = new AsyncLock();
|
|
106
|
-
this._environment = null;
|
|
107
|
-
this._loadEnvironmentAbortController = null;
|
|
108
|
-
this._selectedAnimation = -1;
|
|
109
|
-
this._activeAnimationObservers = [];
|
|
110
|
-
this._animationSpeed = 1;
|
|
111
|
-
const finalOptions = { ...defaultViewerOptions, ...options };
|
|
112
|
-
this._details = {
|
|
113
|
-
viewer: this,
|
|
114
|
-
scene: new Scene(this._engine),
|
|
115
|
-
model: null,
|
|
116
|
-
};
|
|
117
|
-
this._details.scene.performancePriority = 2 /* ScenePerformancePriority.Aggressive */;
|
|
118
|
-
this._details.scene.clearColor = finalOptions.backgroundColor;
|
|
119
|
-
this._snapshotHelper = new SnapshotRenderingHelper(this._details.scene, { morphTargetsNumMaxInfluences: 30 });
|
|
120
|
-
this._camera = new ArcRotateCamera("camera1", 0, 0, 1, Vector3.Zero(), this._details.scene);
|
|
121
|
-
this._camera.attachControl();
|
|
122
|
-
this._updateCamera(); // set default camera values
|
|
123
|
-
this._autoRotationBehavior = this._camera.getBehaviorByName("AutoRotation");
|
|
124
|
-
// Load a default light, but ignore errors as the user might be immediately loading their own environment.
|
|
125
|
-
this.resetEnvironment().catch(() => { });
|
|
126
|
-
// TODO: render at least back ground. Maybe we can only run renderloop when a mesh is loaded. What to render until then?
|
|
127
|
-
const render = () => {
|
|
128
|
-
this._details.scene.render();
|
|
129
|
-
if (this.isAnimationPlaying) {
|
|
130
|
-
this.onAnimationProgressChanged.notifyObservers();
|
|
131
|
-
this._autoRotationBehavior.resetLastInteractionTime();
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
this._engine.runRenderLoop(render);
|
|
135
|
-
this._renderLoopController = {
|
|
136
|
-
dispose: () => this._engine.stopRenderLoop(render),
|
|
137
|
-
};
|
|
138
|
-
options?.onInitialized?.(this._details);
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* The list of animation names for the currently loaded model.
|
|
142
|
-
*/
|
|
143
|
-
get animations() {
|
|
144
|
-
return this._details.model?.animationGroups.map((group) => group.name) ?? [];
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* The currently selected animation index.
|
|
148
|
-
*/
|
|
149
|
-
get selectedAnimation() {
|
|
150
|
-
return this._selectedAnimation;
|
|
151
|
-
}
|
|
152
|
-
set selectedAnimation(value) {
|
|
153
|
-
value = Math.round(Clamp(value, -1, this.animations.length - 1));
|
|
154
|
-
if (value !== this._selectedAnimation) {
|
|
155
|
-
const startAnimation = this.isAnimationPlaying;
|
|
156
|
-
if (this._activeAnimation) {
|
|
157
|
-
this._activeAnimationObservers.forEach((observer) => observer.remove());
|
|
158
|
-
this._activeAnimationObservers = [];
|
|
159
|
-
this._activeAnimation.pause();
|
|
160
|
-
this._activeAnimation.goToFrame(0);
|
|
161
|
-
}
|
|
162
|
-
this._selectedAnimation = value;
|
|
163
|
-
if (this._activeAnimation) {
|
|
164
|
-
this._activeAnimation.goToFrame(0);
|
|
165
|
-
this._activeAnimation.play(true);
|
|
166
|
-
if (!startAnimation) {
|
|
167
|
-
this.pauseAnimation();
|
|
168
|
-
}
|
|
169
|
-
this._activeAnimationObservers = [
|
|
170
|
-
this._activeAnimation.onAnimationGroupPlayObservable.add(() => {
|
|
171
|
-
this.onIsAnimationPlayingChanged.notifyObservers();
|
|
172
|
-
}),
|
|
173
|
-
this._activeAnimation.onAnimationGroupPauseObservable.add(() => {
|
|
174
|
-
this.onIsAnimationPlayingChanged.notifyObservers();
|
|
175
|
-
}),
|
|
176
|
-
this._activeAnimation.onAnimationGroupEndObservable.add(() => {
|
|
177
|
-
this.onIsAnimationPlayingChanged.notifyObservers();
|
|
178
|
-
this.onAnimationProgressChanged.notifyObservers();
|
|
179
|
-
}),
|
|
180
|
-
];
|
|
181
|
-
}
|
|
182
|
-
this._updateCamera();
|
|
183
|
-
this.onSelectedAnimationChanged.notifyObservers();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* True if an animation is currently playing.
|
|
188
|
-
*/
|
|
189
|
-
get isAnimationPlaying() {
|
|
190
|
-
return this._activeAnimation?.isPlaying ?? false;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* The speed scale at which animations are played.
|
|
194
|
-
*/
|
|
195
|
-
get animationSpeed() {
|
|
196
|
-
return this._animationSpeed;
|
|
197
|
-
}
|
|
198
|
-
set animationSpeed(value) {
|
|
199
|
-
this._animationSpeed = value;
|
|
200
|
-
this._applyAnimationSpeed();
|
|
201
|
-
this.onAnimationSpeedChanged.notifyObservers();
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* The current point on the selected animation timeline, normalized between 0 and 1.
|
|
205
|
-
*/
|
|
206
|
-
get animationProgress() {
|
|
207
|
-
if (this._activeAnimation) {
|
|
208
|
-
return this._activeAnimation.getCurrentFrame() / (this._activeAnimation.to - this._activeAnimation.from);
|
|
209
|
-
}
|
|
210
|
-
return 0;
|
|
211
|
-
}
|
|
212
|
-
set animationProgress(value) {
|
|
213
|
-
if (this._activeAnimation) {
|
|
214
|
-
this._activeAnimation.goToFrame(value * (this._activeAnimation.to - this._activeAnimation.from));
|
|
215
|
-
this.onAnimationProgressChanged.notifyObservers();
|
|
216
|
-
this._autoRotationBehavior.resetLastInteractionTime();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
get _activeAnimation() {
|
|
220
|
-
return this._details.model?.animationGroups[this._selectedAnimation] ?? null;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Loads a 3D model from the specified URL.
|
|
224
|
-
* @remarks
|
|
225
|
-
* If a model is already loaded, it will be unloaded before loading the new model.
|
|
226
|
-
* @param source A url or File or ArrayBufferView that points to the model to load.
|
|
227
|
-
* @param options The options to use when loading the model.
|
|
228
|
-
* @param abortSignal An optional signal that can be used to abort the loading process.
|
|
229
|
-
*/
|
|
230
|
-
async loadModel(source, options, abortSignal) {
|
|
231
|
-
await this._updateModel(source, options, abortSignal);
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Unloads the current 3D model if one is loaded.
|
|
235
|
-
* @param abortSignal An optional signal that can be used to abort the reset.
|
|
236
|
-
*/
|
|
237
|
-
async resetModel(abortSignal) {
|
|
238
|
-
await this._updateModel(undefined, undefined, abortSignal);
|
|
239
|
-
}
|
|
240
|
-
async _updateModel(source, options, abortSignal) {
|
|
241
|
-
this._throwIfDisposedOrAborted(abortSignal);
|
|
242
|
-
this._loadModelAbortController?.abort("New model is being loaded before previous model finished loading.");
|
|
243
|
-
const abortController = (this._loadModelAbortController = new AbortController());
|
|
244
|
-
await this._loadModelLock.lockAsync(async () => {
|
|
245
|
-
throwIfAborted(abortSignal, abortController.signal);
|
|
246
|
-
this._snapshotHelper.disableSnapshotRendering();
|
|
247
|
-
this._details.model?.dispose();
|
|
248
|
-
this._details.model = null;
|
|
249
|
-
this.selectedAnimation = -1;
|
|
250
|
-
try {
|
|
251
|
-
if (source) {
|
|
252
|
-
this._details.model = await loadAssetContainerAsync(source, this._details.scene, options);
|
|
253
|
-
this._details.model.animationGroups.forEach((group) => {
|
|
254
|
-
group.start(true, this.animationSpeed);
|
|
255
|
-
group.pause();
|
|
256
|
-
});
|
|
257
|
-
this.selectedAnimation = 0;
|
|
258
|
-
this._snapshotHelper.fixMeshes(this._details.model.meshes);
|
|
259
|
-
this._details.model.addAllToScene();
|
|
260
|
-
}
|
|
261
|
-
this._updateCamera();
|
|
262
|
-
this._updateLight();
|
|
263
|
-
this._applyAnimationSpeed();
|
|
264
|
-
this.onModelChanged.notifyObservers();
|
|
265
|
-
}
|
|
266
|
-
catch (e) {
|
|
267
|
-
this.onModelError.notifyObservers(e);
|
|
268
|
-
throw e;
|
|
269
|
-
}
|
|
270
|
-
finally {
|
|
271
|
-
this._snapshotHelper.enableSnapshotRendering();
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Loads an environment texture from the specified url and sets up a corresponding skybox.
|
|
277
|
-
* @remarks
|
|
278
|
-
* If an environment is already loaded, it will be unloaded before loading the new environment.
|
|
279
|
-
* @param url The url of the environment texture to load.
|
|
280
|
-
* @param options The options to use when loading the environment.
|
|
281
|
-
* @param abortSignal An optional signal that can be used to abort the loading process.
|
|
282
|
-
*/
|
|
283
|
-
async loadEnvironment(url, options, abortSignal) {
|
|
284
|
-
await this._updateEnvironment(url, options, abortSignal);
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Unloads the current environment if one is loaded.
|
|
288
|
-
* @param abortSignal An optional signal that can be used to abort the reset.
|
|
289
|
-
*/
|
|
290
|
-
async resetEnvironment(abortSignal) {
|
|
291
|
-
await this._updateEnvironment(undefined, undefined, abortSignal);
|
|
292
|
-
}
|
|
293
|
-
async _updateEnvironment(url, options, abortSignal) {
|
|
294
|
-
this._throwIfDisposedOrAborted(abortSignal);
|
|
295
|
-
this._loadEnvironmentAbortController?.abort("New environment is being loaded before previous environment finished loading.");
|
|
296
|
-
const abortController = (this._loadEnvironmentAbortController = new AbortController());
|
|
297
|
-
await this._loadEnvironmentLock.lockAsync(async () => {
|
|
298
|
-
throwIfAborted(abortSignal, abortController.signal);
|
|
299
|
-
this._snapshotHelper.disableSnapshotRendering();
|
|
300
|
-
this._environment?.dispose();
|
|
301
|
-
this._environment = null;
|
|
302
|
-
this._details.scene.autoClear = true;
|
|
303
|
-
try {
|
|
304
|
-
if (url) {
|
|
305
|
-
this._environment = await new Promise((resolve, reject) => {
|
|
306
|
-
const cubeTexture = CubeTexture.CreateFromPrefilteredData(url, this._details.scene);
|
|
307
|
-
this._details.scene.environmentTexture = cubeTexture;
|
|
308
|
-
const skybox = createSkybox(this._details.scene, this._camera, cubeTexture, 0.3);
|
|
309
|
-
this._snapshotHelper.fixMeshes([skybox]);
|
|
310
|
-
this._skybox = skybox;
|
|
311
|
-
this._details.scene.autoClear = false;
|
|
312
|
-
const dispose = () => {
|
|
313
|
-
cubeTexture.dispose();
|
|
314
|
-
skybox.dispose();
|
|
315
|
-
this._skybox = null;
|
|
316
|
-
};
|
|
317
|
-
const successObserver = cubeTexture.onLoadObservable.addOnce(() => {
|
|
318
|
-
successObserver.remove();
|
|
319
|
-
errorObserver.remove();
|
|
320
|
-
resolve({
|
|
321
|
-
dispose,
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
const errorObserver = Texture.OnTextureLoadErrorObservable.add((texture) => {
|
|
325
|
-
if (texture === cubeTexture) {
|
|
326
|
-
successObserver.remove();
|
|
327
|
-
errorObserver.remove();
|
|
328
|
-
dispose();
|
|
329
|
-
reject(new Error("Failed to load environment texture."));
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
this._updateLight();
|
|
335
|
-
this.onEnvironmentChanged.notifyObservers();
|
|
336
|
-
}
|
|
337
|
-
catch (e) {
|
|
338
|
-
this.onEnvironmentError.notifyObservers(e);
|
|
339
|
-
throw e;
|
|
340
|
-
}
|
|
341
|
-
finally {
|
|
342
|
-
this._snapshotHelper.enableSnapshotRendering();
|
|
343
|
-
}
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Toggles the play/pause animation state if there is a selected animation.
|
|
348
|
-
*/
|
|
349
|
-
toggleAnimation() {
|
|
350
|
-
if (this.isAnimationPlaying) {
|
|
351
|
-
this.pauseAnimation();
|
|
352
|
-
}
|
|
353
|
-
else {
|
|
354
|
-
this.playAnimation();
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Plays the selected animation if there is one.
|
|
359
|
-
*/
|
|
360
|
-
playAnimation() {
|
|
361
|
-
this._activeAnimation?.play(true);
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Pauses the selected animation if there is one.
|
|
365
|
-
*/
|
|
366
|
-
async pauseAnimation() {
|
|
367
|
-
this._activeAnimation?.pause();
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Disposes of the resources held by the Viewer.
|
|
371
|
-
*/
|
|
372
|
-
dispose() {
|
|
373
|
-
this.selectedAnimation = -1;
|
|
374
|
-
this.animationProgress = 0;
|
|
375
|
-
this._loadEnvironmentAbortController?.abort("Thew viewer is being disposed.");
|
|
376
|
-
this._loadModelAbortController?.abort("Thew viewer is being disposed.");
|
|
377
|
-
this._renderLoopController.dispose();
|
|
378
|
-
this._details.scene.dispose();
|
|
379
|
-
this.onEnvironmentChanged.clear();
|
|
380
|
-
this.onEnvironmentError.clear();
|
|
381
|
-
this.onModelChanged.clear();
|
|
382
|
-
this.onModelError.clear();
|
|
383
|
-
this.onSelectedAnimationChanged.clear();
|
|
384
|
-
this.onAnimationSpeedChanged.clear();
|
|
385
|
-
this.onIsAnimationPlayingChanged.clear();
|
|
386
|
-
this.onAnimationProgressChanged.clear();
|
|
387
|
-
this._isDisposed = true;
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* retrun world and canvas coordinates of an hot spot
|
|
391
|
-
* @param hotSpotQuery mesh index and surface information to query the hot spot positions
|
|
392
|
-
* @param res Query a Hot Spot and does the conversion for Babylon Hot spot to a more generic HotSpotPositions, without Vector types
|
|
393
|
-
* @returns true if hotspot found
|
|
394
|
-
*/
|
|
395
|
-
getHotSpotToRef(hotSpotQuery, res) {
|
|
396
|
-
if (!this._details.model) {
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
const worldPos = TmpVectors.Vector3[1];
|
|
400
|
-
const screenPos = TmpVectors.Vector3[0];
|
|
401
|
-
const mesh = this._details.model.meshes[hotSpotQuery.meshIndex];
|
|
402
|
-
if (!mesh) {
|
|
403
|
-
return false;
|
|
404
|
-
}
|
|
405
|
-
GetHotSpotToRef(mesh, hotSpotQuery, worldPos);
|
|
406
|
-
const renderWidth = this._engine.getRenderWidth(); // Get the canvas width
|
|
407
|
-
const renderHeight = this._engine.getRenderHeight(); // Get the canvas height
|
|
408
|
-
const viewportWidth = this._camera.viewport.width * renderWidth;
|
|
409
|
-
const viewportHeight = this._camera.viewport.height * renderHeight;
|
|
410
|
-
const scene = this._details.scene;
|
|
411
|
-
Vector3.ProjectToRef(worldPos, mesh.getWorldMatrix(), scene.getTransformMatrix(), new Viewport(0, 0, viewportWidth, viewportHeight), screenPos);
|
|
412
|
-
res.screenPosition = [screenPos.x, screenPos.y];
|
|
413
|
-
res.worldPosition = [worldPos.x, worldPos.y, worldPos.z];
|
|
414
|
-
return true;
|
|
415
|
-
}
|
|
416
|
-
_updateCamera() {
|
|
417
|
-
// Enable camera's behaviors
|
|
418
|
-
this._camera.useFramingBehavior = true;
|
|
419
|
-
const framingBehavior = this._camera.getBehaviorByName("Framing");
|
|
420
|
-
framingBehavior.framingTime = 0;
|
|
421
|
-
framingBehavior.elevationReturnTime = -1;
|
|
422
|
-
let radius = 1;
|
|
423
|
-
if (this._details.model?.meshes.length) {
|
|
424
|
-
// get bounds and prepare framing/camera radius from its values
|
|
425
|
-
this._camera.lowerRadiusLimit = null;
|
|
426
|
-
const maxExtents = computeMaxExtents(this._details.model.meshes, this._activeAnimation);
|
|
427
|
-
const worldExtents = {
|
|
428
|
-
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))),
|
|
429
|
-
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))),
|
|
430
|
-
};
|
|
431
|
-
framingBehavior.zoomOnBoundingInfo(worldExtents.min, worldExtents.max);
|
|
432
|
-
const worldSize = worldExtents.max.subtract(worldExtents.min);
|
|
433
|
-
const worldCenter = worldExtents.min.add(worldSize.scale(0.5));
|
|
434
|
-
radius = worldSize.length() * 1.1;
|
|
435
|
-
if (!isFinite(radius)) {
|
|
436
|
-
radius = 1;
|
|
437
|
-
worldCenter.copyFromFloats(0, 0, 0);
|
|
438
|
-
}
|
|
439
|
-
this._camera.setTarget(worldCenter);
|
|
440
|
-
}
|
|
441
|
-
this._camera.lowerRadiusLimit = radius * 0.01;
|
|
442
|
-
this._camera.wheelPrecision = 100 / radius;
|
|
443
|
-
this._camera.alpha = Math.PI / 2;
|
|
444
|
-
this._camera.beta = Math.PI / 2.4;
|
|
445
|
-
this._camera.radius = radius;
|
|
446
|
-
this._camera.minZ = radius * 0.01;
|
|
447
|
-
this._camera.maxZ = radius * 1000;
|
|
448
|
-
this._camera.speed = radius * 0.2;
|
|
449
|
-
this._camera.useAutoRotationBehavior = true;
|
|
450
|
-
this._camera.pinchPrecision = 200 / this._camera.radius;
|
|
451
|
-
this._camera.upperRadiusLimit = 5 * this._camera.radius;
|
|
452
|
-
this._camera.wheelDeltaPercentage = 0.01;
|
|
453
|
-
this._camera.pinchDeltaPercentage = 0.01;
|
|
454
|
-
this._camera.restoreStateInterpolationFactor = 0.1;
|
|
455
|
-
this._camera.storeState();
|
|
456
|
-
updateSkybox(this._skybox, this._camera);
|
|
457
|
-
}
|
|
458
|
-
_updateLight() {
|
|
459
|
-
let shouldHaveDefaultLight;
|
|
460
|
-
if (!this._details.model) {
|
|
461
|
-
shouldHaveDefaultLight = false;
|
|
462
|
-
}
|
|
463
|
-
else {
|
|
464
|
-
const hasModelProvidedLights = this._details.model.lights.length > 0;
|
|
465
|
-
const hasImageBasedLighting = !!this._environment;
|
|
466
|
-
const hasMaterials = this._details.model.materials.length > 0;
|
|
467
|
-
const hasNonPBRMaterials = this._details.model.materials.some((material) => !(material instanceof PBRMaterial));
|
|
468
|
-
if (hasModelProvidedLights) {
|
|
469
|
-
shouldHaveDefaultLight = false;
|
|
470
|
-
}
|
|
471
|
-
else {
|
|
472
|
-
shouldHaveDefaultLight = !hasImageBasedLighting || !hasMaterials || hasNonPBRMaterials;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
if (shouldHaveDefaultLight) {
|
|
476
|
-
if (!this._light) {
|
|
477
|
-
this._light = new HemisphericLight("defaultLight", Vector3.Up(), this._details.scene);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
this._light?.dispose();
|
|
482
|
-
this._light = null;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
_applyAnimationSpeed() {
|
|
486
|
-
this._details.model?.animationGroups.forEach((group) => (group.speedRatio = this._animationSpeed));
|
|
487
|
-
}
|
|
488
|
-
/**
|
|
489
|
-
* Check for disposed or aborted state (basically everything that can interrupt an async operation).
|
|
490
|
-
* @param abortSignals A set of optional AbortSignals to also check.
|
|
491
|
-
*/
|
|
492
|
-
_throwIfDisposedOrAborted(...abortSignals) {
|
|
493
|
-
if (this._isDisposed) {
|
|
494
|
-
throw new Error("Viewer is disposed.");
|
|
495
|
-
}
|
|
496
|
-
throwIfAborted(...abortSignals);
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
(() => {
|
|
500
|
-
registerBuiltInLoaders();
|
|
501
|
-
})();
|
|
502
|
-
|
|
503
|
-
const defaultCanvasViewerOptions = {};
|
|
504
|
-
/**
|
|
505
|
-
* Chooses a default engine for the current browser environment.
|
|
506
|
-
* @returns The default engine to use.
|
|
507
|
-
*/
|
|
508
|
-
function getDefaultEngine() {
|
|
509
|
-
// TODO: When WebGPU is fully production ready, we may want to prefer it if it is supported by the browser.
|
|
510
|
-
return "WebGL";
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Creates a Viewer instance that is bound to an HTML canvas.
|
|
514
|
-
* @remarks
|
|
515
|
-
* This function can be shared across multiple UI integrations (e.g. Web Components, React, etc.).
|
|
516
|
-
* @param canvas The canvas element to bind the Viewer to.
|
|
517
|
-
* @param options The options to use when creating the Viewer and binding it to the specified canvas.
|
|
518
|
-
* @returns A Viewer instance that is bound to the specified canvas.
|
|
519
|
-
*/
|
|
520
|
-
async function createViewerForCanvas(canvas, options) {
|
|
521
|
-
const finalOptions = { ...defaultCanvasViewerOptions, ...options };
|
|
522
|
-
const disposeActions = [];
|
|
523
|
-
// If the canvas is resized, note that the engine needs a resize, but don't resize it here as it will result in flickering.
|
|
524
|
-
let needsResize = false;
|
|
525
|
-
const resizeObserver = new ResizeObserver(() => (needsResize = true));
|
|
526
|
-
resizeObserver.observe(canvas);
|
|
527
|
-
disposeActions.push(() => resizeObserver.disconnect());
|
|
528
|
-
// Create an engine instance.
|
|
529
|
-
let engine;
|
|
530
|
-
switch (finalOptions.engine ?? getDefaultEngine()) {
|
|
531
|
-
case "WebGL": {
|
|
532
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention, no-case-declarations
|
|
533
|
-
const { Engine } = await import('@babylonjs/core/Engines/engine.js');
|
|
534
|
-
engine = new Engine(canvas, undefined, options);
|
|
535
|
-
break;
|
|
536
|
-
}
|
|
537
|
-
case "WebGPU": {
|
|
538
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention, no-case-declarations
|
|
539
|
-
const { WebGPUEngine } = await import('@babylonjs/core/Engines/webgpuEngine.js');
|
|
540
|
-
const webGPUEngine = new WebGPUEngine(canvas, options);
|
|
541
|
-
await webGPUEngine.initAsync();
|
|
542
|
-
engine = webGPUEngine;
|
|
543
|
-
break;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
// Override the onInitialized callback to add in some specific behavior.
|
|
547
|
-
const onInitialized = finalOptions.onInitialized;
|
|
548
|
-
finalOptions.onInitialized = (details) => {
|
|
549
|
-
// Resize if needed right before rendering the Viewer scene to avoid any flickering.
|
|
550
|
-
const beforeRenderObserver = details.scene.onBeforeRenderObservable.add(() => {
|
|
551
|
-
if (needsResize) {
|
|
552
|
-
engine.resize();
|
|
553
|
-
needsResize = false;
|
|
554
|
-
}
|
|
555
|
-
});
|
|
556
|
-
disposeActions.push(() => beforeRenderObserver.remove());
|
|
557
|
-
// Call the original onInitialized callback, if one was provided.
|
|
558
|
-
onInitialized?.(details);
|
|
559
|
-
};
|
|
560
|
-
// Instantiate the Viewer with the engine and options.
|
|
561
|
-
const viewer = new Viewer(engine, finalOptions);
|
|
562
|
-
disposeActions.push(viewer.dispose.bind(viewer));
|
|
563
|
-
disposeActions.push(() => engine.dispose());
|
|
564
|
-
// Override the Viewer's dispose method to add in additional cleanup.
|
|
565
|
-
viewer.dispose = () => disposeActions.forEach((dispose) => dispose());
|
|
566
|
-
return viewer;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
// 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
|
|
570
|
-
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";
|
|
571
|
-
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";
|
|
572
|
-
const allowedAnimationSpeeds = [0.5, 1, 1.5, 2];
|
|
573
|
-
/**
|
|
574
|
-
* Represents a custom element that displays a 3D model using the Babylon.js Viewer.
|
|
575
|
-
*/
|
|
576
|
-
let HTML3DElement = class HTML3DElement extends LitElement {
|
|
577
|
-
constructor() {
|
|
578
|
-
super(...arguments);
|
|
579
|
-
this._viewerLock = new AsyncLock();
|
|
580
|
-
/**
|
|
581
|
-
* The engine to use for rendering.
|
|
582
|
-
*/
|
|
583
|
-
this.engine = getDefaultEngine();
|
|
584
|
-
/**
|
|
585
|
-
* The model URL.
|
|
586
|
-
*/
|
|
587
|
-
this.source = null;
|
|
588
|
-
/**
|
|
589
|
-
* Forces the model to be loaded with the specified extension.
|
|
590
|
-
* @remarks
|
|
591
|
-
* If this property is not set, the extension will be inferred from the model URL when possible.
|
|
592
|
-
*/
|
|
593
|
-
this.extension = null;
|
|
594
|
-
/**
|
|
595
|
-
* The environment URL.
|
|
596
|
-
*/
|
|
597
|
-
this.environment = null;
|
|
598
|
-
/**
|
|
599
|
-
* A string value that encodes one or more hotspots.
|
|
600
|
-
*/
|
|
601
|
-
this.hotspots = null;
|
|
602
|
-
/**
|
|
603
|
-
* The speed scale at which animations are played.
|
|
604
|
-
*/
|
|
605
|
-
this.animationSpeed = 1;
|
|
606
|
-
/**
|
|
607
|
-
* The current point on the selected animation timeline, normalized between 0 and 1.
|
|
608
|
-
*/
|
|
609
|
-
this.animationProgress = 0;
|
|
610
|
-
this._animations = [];
|
|
611
|
-
this._selectedAnimation = -1;
|
|
612
|
-
this._isAnimationPlaying = false;
|
|
613
|
-
}
|
|
614
|
-
/**
|
|
615
|
-
* Gets the underlying viewer details (when the underlying viewer is in a loaded state).
|
|
616
|
-
* This is useful for advanced scenarios where direct access to the viewer or Babylon scene is needed.
|
|
617
|
-
*/
|
|
618
|
-
get viewerDetails() {
|
|
619
|
-
return this._viewerDetails;
|
|
620
|
-
}
|
|
621
|
-
/**
|
|
622
|
-
* Get hotspot world and screen values from a named hotspot
|
|
623
|
-
* @param name slot of the hot spot
|
|
624
|
-
* @param result resulting world and screen positions
|
|
625
|
-
* @returns world and screen space coordinates
|
|
626
|
-
*/
|
|
627
|
-
queryHotSpot(name, result) {
|
|
628
|
-
// Retrieve all hotspots inside the viewer element
|
|
629
|
-
let resultFound = false;
|
|
630
|
-
// Iterate through each hotspot to get the 'data-surface' and 'data-name' attributes
|
|
631
|
-
if (this._viewerDetails) {
|
|
632
|
-
const hotspot = this.hotspots?.[name];
|
|
633
|
-
if (hotspot) {
|
|
634
|
-
resultFound = this._viewerDetails.viewer.getHotSpotToRef(hotspot, result);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
return resultFound;
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* The list of animation names for the currently loaded model.
|
|
641
|
-
*/
|
|
642
|
-
get animations() {
|
|
643
|
-
return this._animations;
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* The currently selected animation index.
|
|
647
|
-
*/
|
|
648
|
-
get selectedAnimation() {
|
|
649
|
-
return this._selectedAnimation;
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* True if an animation is currently playing.
|
|
653
|
-
*/
|
|
654
|
-
get isAnimationPlaying() {
|
|
655
|
-
return this._isAnimationPlaying;
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* Toggles the play/pause animation state if there is a selected animation.
|
|
659
|
-
*/
|
|
660
|
-
toggleAnimation() {
|
|
661
|
-
this._viewerDetails?.viewer.toggleAnimation();
|
|
662
|
-
}
|
|
663
|
-
// eslint-disable-next-line babylonjs/available
|
|
664
|
-
connectedCallback() {
|
|
665
|
-
super.connectedCallback();
|
|
666
|
-
this._setupViewer();
|
|
667
|
-
}
|
|
668
|
-
// eslint-disable-next-line babylonjs/available
|
|
669
|
-
disconnectedCallback() {
|
|
670
|
-
super.disconnectedCallback();
|
|
671
|
-
this._tearDownViewer();
|
|
672
|
-
}
|
|
673
|
-
// eslint-disable-next-line babylonjs/available
|
|
674
|
-
update(changedProperties) {
|
|
675
|
-
super.update(changedProperties);
|
|
676
|
-
if (changedProperties.get("engine")) {
|
|
677
|
-
this._tearDownViewer();
|
|
678
|
-
this._setupViewer();
|
|
679
|
-
}
|
|
680
|
-
else {
|
|
681
|
-
if (changedProperties.has("animationSpeed")) {
|
|
682
|
-
this._updateAnimationSpeed();
|
|
683
|
-
}
|
|
684
|
-
if (changedProperties.has("_selectedAnimation")) {
|
|
685
|
-
this._updateSelectedAnimation();
|
|
686
|
-
}
|
|
687
|
-
if (changedProperties.has("source")) {
|
|
688
|
-
this._updateModel();
|
|
689
|
-
}
|
|
690
|
-
if (changedProperties.has("environment")) {
|
|
691
|
-
this._updateEnv();
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
// eslint-disable-next-line babylonjs/available
|
|
696
|
-
render() {
|
|
697
|
-
// NOTE: The unnamed 'slot' element holds all child elements of the <babylon-viewer> that do not specify a 'slot' attribute.
|
|
698
|
-
return html `
|
|
699
|
-
<div class="full-size">
|
|
700
|
-
<div id="canvasContainer" class="full-size"></div>
|
|
701
|
-
<slot class="full-size children-slot"></slot>
|
|
702
|
-
${this.animations.length === 0
|
|
703
|
-
? ""
|
|
704
|
-
: html `
|
|
705
|
-
<slot name="tool-bar">
|
|
706
|
-
<div part="tool-bar" class="tool-bar">
|
|
707
|
-
<div class="progress-control">
|
|
708
|
-
<button aria-label="${this.isAnimationPlaying ? "Pause" : "Play"}" @click="${this.toggleAnimation}">
|
|
709
|
-
${!this.isAnimationPlaying
|
|
710
|
-
? html `<svg viewBox="0 0 20 20">
|
|
711
|
-
<path d="${playFilledIcon}" fill="currentColor"></path>
|
|
712
|
-
</svg>`
|
|
713
|
-
: html `<svg viewBox="-3 -2 24 24">
|
|
714
|
-
<path d="${pauseFilledIcon}" fill="currentColor"></path>
|
|
715
|
-
</svg>`}
|
|
716
|
-
</button>
|
|
717
|
-
<input
|
|
718
|
-
aria-label="Animation Progress"
|
|
719
|
-
class="progress-wrapper"
|
|
720
|
-
type="range"
|
|
721
|
-
min="0"
|
|
722
|
-
max="1"
|
|
723
|
-
step="0.0001"
|
|
724
|
-
.value="${this.animationProgress}"
|
|
725
|
-
@input="${this._onProgressChanged}"
|
|
726
|
-
@pointerdown="${this._onProgressPointerDown}"
|
|
727
|
-
/>
|
|
728
|
-
</div>
|
|
729
|
-
<select aria-label="Select Animation Speed" @change="${this._onAnimationSpeedChanged}">
|
|
730
|
-
${allowedAnimationSpeeds.map((speed) => html `<option value="${speed}" .selected="${this.animationSpeed === speed}">${speed}x</option>`)}
|
|
731
|
-
</select>
|
|
732
|
-
${this.animations.length > 1
|
|
733
|
-
? html `<select aria-label="Select Animation" @change="${this._onSelectedAnimationChanged}">
|
|
734
|
-
${this.animations.map((name, index) => html `<option value="${index}" .selected="${this.selectedAnimation == index}">${name}</option>`)}
|
|
735
|
-
</select>`
|
|
736
|
-
: ""}
|
|
737
|
-
</div>
|
|
738
|
-
</slot>
|
|
739
|
-
`}
|
|
740
|
-
</div>
|
|
741
|
-
`;
|
|
742
|
-
}
|
|
743
|
-
addEventListener(type, listener, options) {
|
|
744
|
-
super.addEventListener(type, listener, options);
|
|
745
|
-
}
|
|
746
|
-
_dispatchCustomEvent(type, event) {
|
|
747
|
-
this.dispatchEvent(event(type));
|
|
748
|
-
}
|
|
749
|
-
_onSelectedAnimationChanged(event) {
|
|
750
|
-
const selectElement = event.target;
|
|
751
|
-
this._selectedAnimation = Number(selectElement.value);
|
|
752
|
-
}
|
|
753
|
-
_onAnimationSpeedChanged(event) {
|
|
754
|
-
const selectElement = event.target;
|
|
755
|
-
this.animationSpeed = Number(selectElement.value);
|
|
756
|
-
}
|
|
757
|
-
_onProgressChanged(event) {
|
|
758
|
-
if (this._viewerDetails) {
|
|
759
|
-
const input = event.target;
|
|
760
|
-
const value = Number(input.value);
|
|
761
|
-
if (value !== this.animationProgress) {
|
|
762
|
-
this._viewerDetails.viewer.animationProgress = value;
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
_onProgressPointerDown(event) {
|
|
767
|
-
if (this._viewerDetails?.viewer.isAnimationPlaying) {
|
|
768
|
-
this._viewerDetails.viewer.pauseAnimation();
|
|
769
|
-
const input = event.target;
|
|
770
|
-
input.addEventListener("pointerup", () => this._viewerDetails?.viewer.playAnimation(), { once: true });
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
async _setupViewer() {
|
|
774
|
-
await this._viewerLock.lockAsync(async () => {
|
|
775
|
-
// The first time the element is connected, the canvas container may not be available yet.
|
|
776
|
-
// Wait for the first update if needed.
|
|
777
|
-
if (!this._canvasContainer) {
|
|
778
|
-
await this.updateComplete;
|
|
779
|
-
}
|
|
780
|
-
if (this._canvasContainer && !this._viewerDetails) {
|
|
781
|
-
const canvas = document.createElement("canvas");
|
|
782
|
-
canvas.className = "full-size";
|
|
783
|
-
canvas.setAttribute("touch-action", "none");
|
|
784
|
-
this._canvasContainer.appendChild(canvas);
|
|
785
|
-
await createViewerForCanvas(canvas, {
|
|
786
|
-
engine: this.engine,
|
|
787
|
-
onInitialized: (details) => {
|
|
788
|
-
this._viewerDetails = details;
|
|
789
|
-
details.viewer.onEnvironmentChanged.add(() => {
|
|
790
|
-
this._dispatchCustomEvent("environmentchange", (type) => new Event(type));
|
|
791
|
-
});
|
|
792
|
-
details.viewer.onEnvironmentError.add((error) => {
|
|
793
|
-
this._dispatchCustomEvent("environmenterror", (type) => new ErrorEvent(type, { error }));
|
|
794
|
-
});
|
|
795
|
-
details.viewer.onModelChanged.add(() => {
|
|
796
|
-
this._animations = [...details.viewer.animations];
|
|
797
|
-
this._dispatchCustomEvent("modelchange", (type) => new Event(type));
|
|
798
|
-
});
|
|
799
|
-
details.viewer.onModelError.add((error) => {
|
|
800
|
-
this._animations = [...details.viewer.animations];
|
|
801
|
-
this._dispatchCustomEvent("modelerror", (type) => new ErrorEvent(type, { error }));
|
|
802
|
-
});
|
|
803
|
-
details.viewer.onSelectedAnimationChanged.add(() => {
|
|
804
|
-
this._selectedAnimation = details.viewer.selectedAnimation ?? -1;
|
|
805
|
-
this._dispatchCustomEvent("selectedanimationchange", (type) => new Event(type));
|
|
806
|
-
});
|
|
807
|
-
details.viewer.onAnimationSpeedChanged.add(() => {
|
|
808
|
-
let speed = details.viewer.animationSpeed ?? 1;
|
|
809
|
-
speed = allowedAnimationSpeeds.reduce((prev, curr) => (Math.abs(curr - speed) < Math.abs(prev - speed) ? curr : prev));
|
|
810
|
-
this.animationSpeed = speed;
|
|
811
|
-
this._dispatchCustomEvent("animationspeedchange", (type) => new Event(type));
|
|
812
|
-
});
|
|
813
|
-
details.viewer.onIsAnimationPlayingChanged.add(() => {
|
|
814
|
-
this._isAnimationPlaying = details.viewer.isAnimationPlaying ?? false;
|
|
815
|
-
this._dispatchCustomEvent("animationplayingchange", (type) => new Event(type));
|
|
816
|
-
});
|
|
817
|
-
details.viewer.onAnimationProgressChanged.add(() => {
|
|
818
|
-
this.animationProgress = details.viewer.animationProgress ?? 0;
|
|
819
|
-
this._dispatchCustomEvent("animationprogresschange", (type) => new Event(type));
|
|
820
|
-
});
|
|
821
|
-
this._updateSelectedAnimation();
|
|
822
|
-
this._updateAnimationSpeed();
|
|
823
|
-
this._updateModel();
|
|
824
|
-
this._updateEnv();
|
|
825
|
-
this._dispatchCustomEvent("viewerready", (type) => new Event(type));
|
|
826
|
-
},
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
});
|
|
830
|
-
}
|
|
831
|
-
async _tearDownViewer() {
|
|
832
|
-
await this._viewerLock.lockAsync(async () => {
|
|
833
|
-
if (this._viewerDetails) {
|
|
834
|
-
this._viewerDetails.viewer.dispose();
|
|
835
|
-
this._viewerDetails = undefined;
|
|
836
|
-
}
|
|
837
|
-
// We want to replace the canvas for two reasons:
|
|
838
|
-
// 1. When the viewer element is reconnected to the DOM, we don't want to briefly see the last frame of the previous model.
|
|
839
|
-
// 2. If we are changing engines (e.g. WebGL to WebGPU), we need to create a new canvas for the new engine.
|
|
840
|
-
if (this._canvasContainer && this._canvasContainer.firstElementChild) {
|
|
841
|
-
this._canvasContainer.removeChild(this._canvasContainer.firstElementChild);
|
|
842
|
-
}
|
|
843
|
-
});
|
|
844
|
-
}
|
|
845
|
-
_updateAnimationSpeed() {
|
|
846
|
-
if (this._viewerDetails) {
|
|
847
|
-
this._viewerDetails.viewer.animationSpeed = this.animationSpeed;
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
_updateSelectedAnimation() {
|
|
851
|
-
if (this._viewerDetails) {
|
|
852
|
-
this._viewerDetails.viewer.selectedAnimation = this._selectedAnimation;
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
async _updateModel() {
|
|
856
|
-
try {
|
|
857
|
-
if (this.source) {
|
|
858
|
-
await this._viewerDetails?.viewer.loadModel(this.source, { pluginExtension: this.extension ?? undefined });
|
|
859
|
-
}
|
|
860
|
-
else {
|
|
861
|
-
await this._viewerDetails?.viewer.resetModel();
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
catch (error) {
|
|
865
|
-
Logger.Log(error);
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
async _updateEnv() {
|
|
869
|
-
try {
|
|
870
|
-
if (this.environment) {
|
|
871
|
-
await this._viewerDetails?.viewer.loadEnvironment(this.environment);
|
|
872
|
-
}
|
|
873
|
-
else {
|
|
874
|
-
await this._viewerDetails?.viewer.resetEnvironment();
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
catch (error) {
|
|
878
|
-
Logger.Log(error);
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
};
|
|
882
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention, jsdoc/require-jsdoc
|
|
883
|
-
HTML3DElement.styles = css `
|
|
884
|
-
:host {
|
|
885
|
-
--ui-foreground-color: white;
|
|
886
|
-
--ui-background-hue: 233;
|
|
887
|
-
--ui-background-saturation: 8%;
|
|
888
|
-
--ui-background-lightness: 39%;
|
|
889
|
-
--ui-background-opacity: 0.75;
|
|
890
|
-
--ui-background-color: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), var(--ui-background-opacity));
|
|
891
|
-
--ui-background-color-hover: hsla(
|
|
892
|
-
var(--ui-background-hue),
|
|
893
|
-
var(--ui-background-saturation),
|
|
894
|
-
calc(var(--ui-background-lightness) - 10%),
|
|
895
|
-
calc(var(--ui-background-opacity) - 0.1)
|
|
896
|
-
);
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
* {
|
|
900
|
-
box-sizing: border-box;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
.full-size {
|
|
904
|
-
display: block;
|
|
905
|
-
position: relative;
|
|
906
|
-
width: 100%;
|
|
907
|
-
height: 100%;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
.children-slot {
|
|
911
|
-
position: absolute;
|
|
912
|
-
top: 0;
|
|
913
|
-
background: transparent;
|
|
914
|
-
pointer-events: none;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
.tool-bar {
|
|
918
|
-
position: absolute;
|
|
919
|
-
display: flex;
|
|
920
|
-
flex-direction: row;
|
|
921
|
-
border-radius: 12px;
|
|
922
|
-
border-color: var(--ui-foreground-color);
|
|
923
|
-
height: 48px;
|
|
924
|
-
width: calc(100% - 24px);
|
|
925
|
-
min-width: 150px;
|
|
926
|
-
max-width: 1280px;
|
|
927
|
-
bottom: 12px;
|
|
928
|
-
left: 50%;
|
|
929
|
-
transform: translateX(-50%);
|
|
930
|
-
background-color: var(--ui-background-color);
|
|
931
|
-
color: var(--ui-foreground-color);
|
|
932
|
-
-webkit-tap-highlight-color: transparent;
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
.tool-bar * {
|
|
936
|
-
height: 100%;
|
|
937
|
-
min-width: 48px;
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
.tool-bar select {
|
|
941
|
-
background: none;
|
|
942
|
-
min-width: 52px;
|
|
943
|
-
max-width: 128px;
|
|
944
|
-
border: 1px solid transparent;
|
|
945
|
-
border-radius: inherit;
|
|
946
|
-
color: inherit;
|
|
947
|
-
font-size: 14px;
|
|
948
|
-
padding: 12px;
|
|
949
|
-
cursor: pointer;
|
|
950
|
-
outline: none;
|
|
951
|
-
appearance: none; /* Remove default styling */
|
|
952
|
-
-webkit-appearance: none; /* Remove default styling for Safari */
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
.tool-bar select:hover,
|
|
956
|
-
.tool-bar select:focus {
|
|
957
|
-
background-color: var(--ui-background-color-hover);
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
.tool-bar select option {
|
|
961
|
-
background-color: var(--ui-background-color);
|
|
962
|
-
color: var(--ui-foreground-color);
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
.tool-bar select:focus-visible {
|
|
966
|
-
border-color: inherit;
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
.tool-bar button {
|
|
970
|
-
background: none;
|
|
971
|
-
border: 1px solid transparent;
|
|
972
|
-
border-radius: inherit;
|
|
973
|
-
color: inherit;
|
|
974
|
-
padding: 0;
|
|
975
|
-
cursor: pointer;
|
|
976
|
-
outline: none;
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
.tool-bar button:hover {
|
|
980
|
-
background-color: var(--ui-background-color-hover);
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
.tool-bar button:focus-visible {
|
|
984
|
-
border-color: inherit;
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
.tool-bar button svg {
|
|
988
|
-
width: 32px;
|
|
989
|
-
height: 32px;
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
.progress-control {
|
|
993
|
-
display: flex;
|
|
994
|
-
flex: 1;
|
|
995
|
-
position: relative;
|
|
996
|
-
overflow: hidden;
|
|
997
|
-
cursor: pointer;
|
|
998
|
-
align-items: center;
|
|
999
|
-
border-radius: inherit;
|
|
1000
|
-
border-color: inherit;
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
.progress-wrapper {
|
|
1004
|
-
-webkit-appearance: none;
|
|
1005
|
-
cursor: pointer;
|
|
1006
|
-
width: 100%;
|
|
1007
|
-
height: 100%;
|
|
1008
|
-
outline: none;
|
|
1009
|
-
border: 1px solid transparent;
|
|
1010
|
-
border-radius: inherit;
|
|
1011
|
-
padding: 0 12px;
|
|
1012
|
-
background-color: transparent;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
.progress-wrapper:focus-visible {
|
|
1016
|
-
border-color: inherit;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
/*Chrome -webkit */
|
|
1020
|
-
|
|
1021
|
-
.progress-wrapper::-webkit-slider-thumb {
|
|
1022
|
-
-webkit-appearance: none;
|
|
1023
|
-
width: 20px;
|
|
1024
|
-
height: 20px;
|
|
1025
|
-
border: 2px solid;
|
|
1026
|
-
color: var(--ui-foreground-color);
|
|
1027
|
-
border-radius: 50%;
|
|
1028
|
-
background: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), 1);
|
|
1029
|
-
margin-top: -10px;
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
.progress-wrapper::-webkit-slider-runnable-track {
|
|
1033
|
-
height: 2px;
|
|
1034
|
-
-webkit-appearance: none;
|
|
1035
|
-
background-color: var(--ui-foreground-color);
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
/** FireFox -moz */
|
|
1039
|
-
|
|
1040
|
-
.progress-wrapper::-moz-range-progress {
|
|
1041
|
-
height: 2px;
|
|
1042
|
-
background-color: var(--ui-foreground-color);
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
.progress-wrapper::-moz-range-thumb {
|
|
1046
|
-
width: 16px;
|
|
1047
|
-
height: 16px;
|
|
1048
|
-
border: 2px solid var(--ui-foreground-color);
|
|
1049
|
-
border-radius: 50%;
|
|
1050
|
-
background: hsla(var(--ui-background-hue), var(--ui-background-saturation), var(--ui-background-lightness), 1);
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
.progress-wrapper::-moz-range-track {
|
|
1054
|
-
height: 2px;
|
|
1055
|
-
background: var(--ui-foreground-color);
|
|
1056
|
-
}
|
|
1057
|
-
`;
|
|
1058
|
-
__decorate([
|
|
1059
|
-
property({ reflect: true })
|
|
1060
|
-
], HTML3DElement.prototype, "engine", void 0);
|
|
1061
|
-
__decorate([
|
|
1062
|
-
property({ reflect: true })
|
|
1063
|
-
], HTML3DElement.prototype, "source", void 0);
|
|
1064
|
-
__decorate([
|
|
1065
|
-
property({ reflect: true })
|
|
1066
|
-
], HTML3DElement.prototype, "extension", void 0);
|
|
1067
|
-
__decorate([
|
|
1068
|
-
property({ reflect: true })
|
|
1069
|
-
], HTML3DElement.prototype, "environment", void 0);
|
|
1070
|
-
__decorate([
|
|
1071
|
-
property({
|
|
1072
|
-
type: "string",
|
|
1073
|
-
converter: (value) => {
|
|
1074
|
-
if (!value) {
|
|
1075
|
-
return null;
|
|
1076
|
-
}
|
|
1077
|
-
const array = value.split(/\s+/);
|
|
1078
|
-
if (array.length % 8 !== 0) {
|
|
1079
|
-
throw new Error(`hotspots should be defined in sets of 8 elements: 'name meshIndex pointIndex1 pointIndex2 pointIndex3 barycentricCoord1 barycentricCoord2 barycentricCoord3', but a total of ${array.length} elements were found in '${value}'`);
|
|
1080
|
-
}
|
|
1081
|
-
const hotspots = {};
|
|
1082
|
-
for (let offset = 0; offset < array.length; offset += 8) {
|
|
1083
|
-
hotspots[array[offset]] = {
|
|
1084
|
-
meshIndex: Number(array[offset + 1]),
|
|
1085
|
-
pointIndex: [Number(array[offset + 2]), Number(array[offset + 3]), Number(array[offset + 4])],
|
|
1086
|
-
barycentric: [Number(array[offset + 5]), Number(array[offset + 6]), Number(array[offset + 7])],
|
|
1087
|
-
};
|
|
1088
|
-
}
|
|
1089
|
-
return hotspots;
|
|
1090
|
-
},
|
|
1091
|
-
})
|
|
1092
|
-
], HTML3DElement.prototype, "hotspots", void 0);
|
|
1093
|
-
__decorate([
|
|
1094
|
-
property({ attribute: "animation-speed", reflect: true })
|
|
1095
|
-
], HTML3DElement.prototype, "animationSpeed", void 0);
|
|
1096
|
-
__decorate([
|
|
1097
|
-
property({ attribute: false })
|
|
1098
|
-
], HTML3DElement.prototype, "animationProgress", void 0);
|
|
1099
|
-
__decorate([
|
|
1100
|
-
state()
|
|
1101
|
-
], HTML3DElement.prototype, "_animations", void 0);
|
|
1102
|
-
__decorate([
|
|
1103
|
-
state()
|
|
1104
|
-
], HTML3DElement.prototype, "_selectedAnimation", void 0);
|
|
1105
|
-
__decorate([
|
|
1106
|
-
state()
|
|
1107
|
-
], HTML3DElement.prototype, "_isAnimationPlaying", void 0);
|
|
1108
|
-
__decorate([
|
|
1109
|
-
query("#canvasContainer")
|
|
1110
|
-
], HTML3DElement.prototype, "_canvasContainer", void 0);
|
|
1111
|
-
HTML3DElement = __decorate([
|
|
1112
|
-
customElement("babylon-viewer")
|
|
1113
|
-
], HTML3DElement);
|
|
1114
|
-
|
|
1115
|
-
export { HTML3DElement, Viewer, createViewerForCanvas, getDefaultEngine };
|
|
1116
|
-
//# sourceMappingURL=index.js.map
|