@babylonjs/viewer 7.40.0 → 7.40.1-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/photoStudio.env +0 -0
- package/dist/babylon-viewer.esm.js +2 -0
- package/dist/babylon-viewer.esm.js.map +1 -0
- package/dist/babylon-viewer.esm.min.js +2 -0
- package/dist/babylon-viewer.esm.min.js.map +1 -0
- package/dist/chunks/EXT_lights_ies-gxFyrTPG.esm.min.js +2 -0
- package/dist/chunks/EXT_lights_ies-gxFyrTPG.esm.min.js.map +1 -0
- package/dist/chunks/EXT_lights_ies-pE68tmBj.esm.js +84 -0
- package/dist/chunks/EXT_lights_ies-pE68tmBj.esm.js.map +1 -0
- package/dist/chunks/EXT_lights_image_based-B8Oal0Ur.esm.min.js +2 -0
- package/dist/chunks/EXT_lights_image_based-B8Oal0Ur.esm.min.js.map +1 -0
- package/dist/chunks/EXT_lights_image_based-CmP_ZGlF.esm.js +171 -0
- package/dist/chunks/EXT_lights_image_based-CmP_ZGlF.esm.js.map +1 -0
- package/dist/chunks/EXT_mesh_gpu_instancing-DSFpOud_.esm.min.js +2 -0
- package/dist/chunks/EXT_mesh_gpu_instancing-DSFpOud_.esm.min.js.map +1 -0
- package/dist/chunks/EXT_mesh_gpu_instancing-DksAVeyV.esm.js +86 -0
- package/dist/chunks/EXT_mesh_gpu_instancing-DksAVeyV.esm.js.map +1 -0
- package/dist/chunks/EXT_meshopt_compression-CNUItnkN.esm.min.js +2 -0
- package/dist/chunks/EXT_meshopt_compression-CNUItnkN.esm.min.js.map +1 -0
- package/dist/chunks/EXT_meshopt_compression-CeM-AELC.esm.js +134 -0
- package/dist/chunks/EXT_meshopt_compression-CeM-AELC.esm.js.map +1 -0
- package/dist/chunks/EXT_texture_avif-BWOJV_Yf.esm.js +44 -0
- package/dist/chunks/EXT_texture_avif-BWOJV_Yf.esm.js.map +1 -0
- package/dist/chunks/EXT_texture_avif-CSTfqZHT.esm.min.js +2 -0
- package/dist/chunks/EXT_texture_avif-CSTfqZHT.esm.min.js.map +1 -0
- package/dist/chunks/EXT_texture_webp-4Pxv5jC9.esm.min.js +2 -0
- package/dist/chunks/EXT_texture_webp-4Pxv5jC9.esm.min.js.map +1 -0
- package/dist/chunks/EXT_texture_webp-C9og1YZL.esm.js +43 -0
- package/dist/chunks/EXT_texture_webp-C9og1YZL.esm.js.map +1 -0
- package/dist/chunks/ExtrasAsMetadata-BmFy6ZgN.esm.js +64 -0
- package/dist/chunks/ExtrasAsMetadata-BmFy6ZgN.esm.js.map +1 -0
- package/dist/chunks/ExtrasAsMetadata-BwYwFtj7.esm.min.js +2 -0
- package/dist/chunks/ExtrasAsMetadata-BwYwFtj7.esm.min.js.map +1 -0
- package/dist/chunks/KHR_animation_pointer-BM2iOlKg.esm.js +352 -0
- package/dist/chunks/KHR_animation_pointer-BM2iOlKg.esm.js.map +1 -0
- package/dist/chunks/KHR_animation_pointer-C7FvhqL3.esm.min.js +2 -0
- package/dist/chunks/KHR_animation_pointer-C7FvhqL3.esm.min.js.map +1 -0
- package/dist/chunks/KHR_draco_mesh_compression-BocaEHGh.esm.js +617 -0
- package/dist/chunks/KHR_draco_mesh_compression-BocaEHGh.esm.js.map +1 -0
- package/dist/chunks/KHR_draco_mesh_compression-CjRCmIUz.esm.min.js +2 -0
- package/dist/chunks/KHR_draco_mesh_compression-CjRCmIUz.esm.min.js.map +1 -0
- package/dist/chunks/KHR_interactivity-C_ndoQHo.esm.min.js +2 -0
- package/dist/chunks/KHR_interactivity-C_ndoQHo.esm.min.js.map +1 -0
- package/dist/chunks/KHR_interactivity-ClHXW_8S.esm.js +4033 -0
- package/dist/chunks/KHR_interactivity-ClHXW_8S.esm.js.map +1 -0
- package/dist/chunks/KHR_lights_punctual-D0u7ZFj4.esm.js +581 -0
- package/dist/chunks/KHR_lights_punctual-D0u7ZFj4.esm.js.map +1 -0
- package/dist/chunks/KHR_lights_punctual-Z509RdIo.esm.min.js +2 -0
- package/dist/chunks/KHR_lights_punctual-Z509RdIo.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_anisotropy-Dz4vBqG3.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_anisotropy-Dz4vBqG3.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_anisotropy-VuLS4v3P.esm.js +65 -0
- package/dist/chunks/KHR_materials_anisotropy-VuLS4v3P.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_clearcoat-DM7vCrC3.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_clearcoat-DM7vCrC3.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_clearcoat-Dt0nQ5Ky.esm.js +96 -0
- package/dist/chunks/KHR_materials_clearcoat-Dt0nQ5Ky.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_diffuse_transmission-1Pa4ScwD.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_diffuse_transmission-1Pa4ScwD.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_diffuse_transmission-DIUHVeOQ.esm.js +97 -0
- package/dist/chunks/KHR_materials_diffuse_transmission-DIUHVeOQ.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_dispersion-CMpGZsUw.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_dispersion-CMpGZsUw.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_dispersion-CeSj8nUI.esm.js +62 -0
- package/dist/chunks/KHR_materials_dispersion-CeSj8nUI.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_emissive_strength-CQQX31qK.esm.js +55 -0
- package/dist/chunks/KHR_materials_emissive_strength-CQQX31qK.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_emissive_strength-DH4A4kIp.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_emissive_strength-DH4A4kIp.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_ior-BTU1gw-j.esm.js +64 -0
- package/dist/chunks/KHR_materials_ior-BTU1gw-j.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_ior-DyzPdK6b.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_ior-DyzPdK6b.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_iridescence-8ZgbULX5.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_iridescence-8ZgbULX5.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_iridescence-D2HCEadq.esm.js +72 -0
- package/dist/chunks/KHR_materials_iridescence-D2HCEadq.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-C4K79VpA.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-C4K79VpA.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DtJVJ-gl.esm.js +81 -0
- package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DtJVJ-gl.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_sheen-CT4KjW_v.esm.js +85 -0
- package/dist/chunks/KHR_materials_sheen-CT4KjW_v.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_sheen-DQt5abo-.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_sheen-DQt5abo-.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_specular-CCvL1awH.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_specular-CCvL1awH.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_specular-CgLKBQCa.esm.js +75 -0
- package/dist/chunks/KHR_materials_specular-CgLKBQCa.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_transmission-B64oDwox.esm.js +307 -0
- package/dist/chunks/KHR_materials_transmission-B64oDwox.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_transmission-C6yPYKde.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_transmission-C6yPYKde.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_unlit-BGPDq328.esm.js +74 -0
- package/dist/chunks/KHR_materials_unlit-BGPDq328.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_unlit-Sz3qCEGr.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_unlit-Sz3qCEGr.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_variants-Cqw7xft3.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_variants-Cqw7xft3.esm.min.js.map +1 -0
- package/dist/chunks/KHR_materials_variants-D7rYTNoB.esm.js +262 -0
- package/dist/chunks/KHR_materials_variants-D7rYTNoB.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_volume-BBsNt0LM.esm.js +87 -0
- package/dist/chunks/KHR_materials_volume-BBsNt0LM.esm.js.map +1 -0
- package/dist/chunks/KHR_materials_volume-DfWO7kG_.esm.min.js +2 -0
- package/dist/chunks/KHR_materials_volume-DfWO7kG_.esm.min.js.map +1 -0
- package/dist/chunks/KHR_mesh_quantization-BiDGkiGh.esm.min.js +2 -0
- package/dist/chunks/KHR_mesh_quantization-BiDGkiGh.esm.min.js.map +1 -0
- package/dist/chunks/KHR_mesh_quantization-fE1qitjF.esm.js +26 -0
- package/dist/chunks/KHR_mesh_quantization-fE1qitjF.esm.js.map +1 -0
- package/dist/chunks/KHR_node_hoverability-DaOK-Y48.esm.min.js +2 -0
- package/dist/chunks/KHR_node_hoverability-DaOK-Y48.esm.min.js.map +1 -0
- package/dist/chunks/KHR_node_hoverability-glogCdHq.esm.js +39 -0
- package/dist/chunks/KHR_node_hoverability-glogCdHq.esm.js.map +1 -0
- package/dist/chunks/KHR_node_visibility-BCVXn2la.esm.min.js +2 -0
- package/dist/chunks/KHR_node_visibility-BCVXn2la.esm.min.js.map +1 -0
- package/dist/chunks/KHR_node_visibility-CCfVtnan.esm.js +46 -0
- package/dist/chunks/KHR_node_visibility-CCfVtnan.esm.js.map +1 -0
- package/dist/chunks/KHR_texture_basisu-_cpZJuOo.esm.min.js +2 -0
- package/dist/chunks/KHR_texture_basisu-_cpZJuOo.esm.min.js.map +1 -0
- package/dist/chunks/KHR_texture_basisu-nhRrTq0b.esm.js +43 -0
- package/dist/chunks/KHR_texture_basisu-nhRrTq0b.esm.js.map +1 -0
- package/dist/chunks/KHR_texture_transform-AgI_J0Ru.esm.js +63 -0
- package/dist/chunks/KHR_texture_transform-AgI_J0Ru.esm.js.map +1 -0
- package/dist/chunks/KHR_texture_transform-CgcA7bhJ.esm.min.js +2 -0
- package/dist/chunks/KHR_texture_transform-CgcA7bhJ.esm.min.js.map +1 -0
- package/dist/chunks/KHR_xmp_json_ld-C37VZwlU.esm.min.js +2 -0
- package/dist/chunks/KHR_xmp_json_ld-C37VZwlU.esm.min.js.map +1 -0
- package/dist/chunks/KHR_xmp_json_ld-Cm4z6qFH.esm.js +51 -0
- package/dist/chunks/KHR_xmp_json_ld-Cm4z6qFH.esm.js.map +1 -0
- package/dist/chunks/MSFT_audio_emitter-4EFTMS8D.esm.js +2207 -0
- package/dist/chunks/MSFT_audio_emitter-4EFTMS8D.esm.js.map +1 -0
- package/dist/chunks/MSFT_audio_emitter-Czn1DAbD.esm.min.js +2 -0
- package/dist/chunks/MSFT_audio_emitter-Czn1DAbD.esm.min.js.map +1 -0
- package/dist/chunks/MSFT_lod-Bn4FnO5A.esm.js +337 -0
- package/dist/chunks/MSFT_lod-Bn4FnO5A.esm.js.map +1 -0
- package/dist/chunks/MSFT_lod-DDB-SKXR.esm.min.js +2 -0
- package/dist/chunks/MSFT_lod-DDB-SKXR.esm.min.js.map +1 -0
- package/dist/chunks/MSFT_minecraftMesh-APRwcxWb.esm.min.js +2 -0
- package/dist/chunks/MSFT_minecraftMesh-APRwcxWb.esm.min.js.map +1 -0
- package/dist/chunks/MSFT_minecraftMesh-DPvby_FZ.esm.js +46 -0
- package/dist/chunks/MSFT_minecraftMesh-DPvby_FZ.esm.js.map +1 -0
- package/dist/chunks/MSFT_sRGBFactors-D33sXFGi.esm.js +47 -0
- package/dist/chunks/MSFT_sRGBFactors-D33sXFGi.esm.js.map +1 -0
- package/dist/chunks/MSFT_sRGBFactors-OsUqZSue.esm.min.js +2 -0
- package/dist/chunks/MSFT_sRGBFactors-OsUqZSue.esm.min.js.map +1 -0
- package/dist/chunks/animationGroup-BR3zskS8.esm.js +2482 -0
- package/dist/chunks/animationGroup-BR3zskS8.esm.js.map +1 -0
- package/dist/chunks/animationGroup-ChIp5GuO.esm.min.js +2 -0
- package/dist/chunks/animationGroup-ChIp5GuO.esm.min.js.map +1 -0
- package/dist/chunks/assetContainer-DLSDgjTx.esm.min.js +2 -0
- package/dist/chunks/assetContainer-DLSDgjTx.esm.min.js.map +1 -0
- package/dist/chunks/assetContainer-cm8rvay3.esm.js +1720 -0
- package/dist/chunks/assetContainer-cm8rvay3.esm.js.map +1 -0
- package/dist/chunks/audioEngine-Cx5dB73O.esm.js +305 -0
- package/dist/chunks/audioEngine-Cx5dB73O.esm.js.map +1 -0
- package/dist/chunks/audioEngine-hKZ2m0jY.esm.min.js +2 -0
- package/dist/chunks/audioEngine-hKZ2m0jY.esm.min.js.map +1 -0
- package/dist/chunks/bakedVertexAnimation-BCUFE4CP.esm.min.js +2 -0
- package/dist/chunks/bakedVertexAnimation-BCUFE4CP.esm.min.js.map +1 -0
- package/dist/chunks/bakedVertexAnimation-ByPKjjzz.esm.js +114 -0
- package/dist/chunks/bakedVertexAnimation-ByPKjjzz.esm.js.map +1 -0
- package/dist/chunks/basisTextureLoader-BIqCbGFg.esm.min.js +2 -0
- package/dist/chunks/basisTextureLoader-BIqCbGFg.esm.min.js.map +1 -0
- package/dist/chunks/basisTextureLoader-CT8X4ynA.esm.js +600 -0
- package/dist/chunks/basisTextureLoader-CT8X4ynA.esm.js.map +1 -0
- package/dist/chunks/dds-BDOPTCsA.esm.min.js +2 -0
- package/dist/chunks/dds-BDOPTCsA.esm.min.js.map +1 -0
- package/dist/chunks/dds-BYrGO6eI.esm.js +540 -0
- package/dist/chunks/dds-BYrGO6eI.esm.js.map +1 -0
- package/dist/chunks/ddsTextureLoader-BbrffKmM.esm.min.js +2 -0
- package/dist/chunks/ddsTextureLoader-BbrffKmM.esm.min.js.map +1 -0
- package/dist/chunks/ddsTextureLoader-C36kkIBH.esm.js +88 -0
- package/dist/chunks/ddsTextureLoader-C36kkIBH.esm.js.map +1 -0
- package/dist/chunks/decalFragment-07cq9QvS.esm.min.js +2 -0
- package/dist/chunks/decalFragment-07cq9QvS.esm.min.js.map +1 -0
- package/dist/chunks/decalFragment-B16Nfnl3.esm.js +18 -0
- package/dist/chunks/decalFragment-B16Nfnl3.esm.js.map +1 -0
- package/dist/chunks/default.fragment-BkjbMxBE.esm.min.js +2 -0
- package/dist/chunks/default.fragment-BkjbMxBE.esm.min.js.map +1 -0
- package/dist/chunks/default.fragment-C-8jVS2k.esm.min.js +2 -0
- package/dist/chunks/default.fragment-C-8jVS2k.esm.min.js.map +1 -0
- package/dist/chunks/default.fragment-C3Pectqi.esm.js +515 -0
- package/dist/chunks/default.fragment-C3Pectqi.esm.js.map +1 -0
- package/dist/chunks/default.fragment-D3LhG5le.esm.js +446 -0
- package/dist/chunks/default.fragment-D3LhG5le.esm.js.map +1 -0
- package/dist/chunks/default.vertex-CPx_2Z0S.esm.js +181 -0
- package/dist/chunks/default.vertex-CPx_2Z0S.esm.js.map +1 -0
- package/dist/chunks/default.vertex-CVMUuXku.esm.js +202 -0
- package/dist/chunks/default.vertex-CVMUuXku.esm.js.map +1 -0
- package/dist/chunks/default.vertex-CbVQZVXB.esm.min.js +2 -0
- package/dist/chunks/default.vertex-CbVQZVXB.esm.min.js.map +1 -0
- package/dist/chunks/default.vertex-S3Wv9p0Q.esm.min.js +2 -0
- package/dist/chunks/default.vertex-S3Wv9p0Q.esm.min.js.map +1 -0
- package/dist/chunks/defaultUboDeclaration-BdxOUPT0.esm.min.js +2 -0
- package/dist/chunks/defaultUboDeclaration-BdxOUPT0.esm.min.js.map +1 -0
- package/dist/chunks/defaultUboDeclaration-CUaZKOKG.esm.min.js +2 -0
- package/dist/chunks/defaultUboDeclaration-CUaZKOKG.esm.min.js.map +1 -0
- package/dist/chunks/defaultUboDeclaration-DdcmVbYg.esm.js +15 -0
- package/dist/chunks/defaultUboDeclaration-DdcmVbYg.esm.js.map +1 -0
- package/dist/chunks/defaultUboDeclaration-rLhenj1H.esm.js +13 -0
- package/dist/chunks/defaultUboDeclaration-rLhenj1H.esm.js.map +1 -0
- package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js +11 -0
- package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js.map +1 -0
- package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js +2 -0
- package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js.map +1 -0
- package/dist/chunks/dumpTools-CPmY0U7D.esm.js +200 -0
- package/dist/chunks/dumpTools-CPmY0U7D.esm.js.map +1 -0
- package/dist/chunks/dumpTools-DVDwJ2sz.esm.min.js +2 -0
- package/dist/chunks/dumpTools-DVDwJ2sz.esm.min.js.map +1 -0
- package/dist/chunks/engine-BqSrdURz.esm.min.js +2 -0
- package/dist/chunks/engine-BqSrdURz.esm.min.js.map +1 -0
- package/dist/chunks/engine-D_GgT2Nf.esm.js +2216 -0
- package/dist/chunks/engine-D_GgT2Nf.esm.js.map +1 -0
- package/dist/chunks/engine.common-CN1Lug5p.esm.js +1162 -0
- package/dist/chunks/engine.common-CN1Lug5p.esm.js.map +1 -0
- package/dist/chunks/engine.common-DgiXKhLy.esm.min.js +2 -0
- package/dist/chunks/engine.common-DgiXKhLy.esm.min.js.map +1 -0
- package/dist/chunks/envTextureLoader-BORNR9vu.esm.min.js +2 -0
- package/dist/chunks/envTextureLoader-BORNR9vu.esm.min.js.map +1 -0
- package/dist/chunks/envTextureLoader-DHwsXTfw.esm.js +64 -0
- package/dist/chunks/envTextureLoader-DHwsXTfw.esm.js.map +1 -0
- package/dist/chunks/environmentTextureTools-B2vnsFq-.esm.js +382 -0
- package/dist/chunks/environmentTextureTools-B2vnsFq-.esm.js.map +1 -0
- package/dist/chunks/environmentTextureTools-BYQHZH-c.esm.min.js +2 -0
- package/dist/chunks/environmentTextureTools-BYQHZH-c.esm.min.js.map +1 -0
- package/dist/chunks/exrTextureLoader-B8FQohBr.esm.js +1683 -0
- package/dist/chunks/exrTextureLoader-B8FQohBr.esm.js.map +1 -0
- package/dist/chunks/exrTextureLoader-D8xP0GLQ.esm.min.js +2 -0
- package/dist/chunks/exrTextureLoader-D8xP0GLQ.esm.min.js.map +1 -0
- package/dist/chunks/fogFragment-5YT33bDn.esm.js +102 -0
- package/dist/chunks/fogFragment-5YT33bDn.esm.js.map +1 -0
- package/dist/chunks/fogFragment-BOBZ2KwN.esm.min.js +2 -0
- package/dist/chunks/fogFragment-BOBZ2KwN.esm.min.js.map +1 -0
- package/dist/chunks/fogFragment-CLENZGuB.esm.js +101 -0
- package/dist/chunks/fogFragment-CLENZGuB.esm.js.map +1 -0
- package/dist/chunks/fogFragment-D9dudohA.esm.min.js +2 -0
- package/dist/chunks/fogFragment-D9dudohA.esm.min.js.map +1 -0
- package/dist/chunks/fresnelFunction-BkO99b6C.esm.js +12 -0
- package/dist/chunks/fresnelFunction-BkO99b6C.esm.js.map +1 -0
- package/dist/chunks/fresnelFunction-CqiLsMCu.esm.min.js +2 -0
- package/dist/chunks/fresnelFunction-CqiLsMCu.esm.min.js.map +1 -0
- package/dist/chunks/glTFLoader-CkL-dxBD.esm.min.js +2 -0
- package/dist/chunks/glTFLoader-CkL-dxBD.esm.min.js.map +1 -0
- package/dist/chunks/glTFLoader-IEHRfiUn.esm.js +7586 -0
- package/dist/chunks/glTFLoader-IEHRfiUn.esm.js.map +1 -0
- package/dist/chunks/glTFLoaderAnimation-CV32Nmqb.esm.js +77 -0
- package/dist/chunks/glTFLoaderAnimation-CV32Nmqb.esm.js.map +1 -0
- package/dist/chunks/glTFLoaderAnimation-Cq2ziV9o.esm.min.js +2 -0
- package/dist/chunks/glTFLoaderAnimation-Cq2ziV9o.esm.min.js.map +1 -0
- package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js +2 -0
- package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js.map +1 -0
- package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js +67 -0
- package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js.map +1 -0
- package/dist/chunks/harmonicsFunctions-B5QCEZvF.esm.js +34 -0
- package/dist/chunks/harmonicsFunctions-B5QCEZvF.esm.js.map +1 -0
- package/dist/chunks/harmonicsFunctions-BxLCgoIQ.esm.min.js +2 -0
- package/dist/chunks/harmonicsFunctions-BxLCgoIQ.esm.min.js.map +1 -0
- package/dist/chunks/harmonicsFunctions-Daxnf8NE.esm.min.js +2 -0
- package/dist/chunks/harmonicsFunctions-Daxnf8NE.esm.min.js.map +1 -0
- package/dist/chunks/harmonicsFunctions-UzG0C-sm.esm.js +35 -0
- package/dist/chunks/harmonicsFunctions-UzG0C-sm.esm.js.map +1 -0
- package/dist/chunks/hdrTextureLoader-BpVjKGyb.esm.min.js +2 -0
- package/dist/chunks/hdrTextureLoader-BpVjKGyb.esm.min.js.map +1 -0
- package/dist/chunks/hdrTextureLoader-DgW8CxRF.esm.js +253 -0
- package/dist/chunks/hdrTextureLoader-DgW8CxRF.esm.js.map +1 -0
- package/dist/chunks/helperFunctions-BFgvMG5S.esm.min.js +2 -0
- package/dist/chunks/helperFunctions-BFgvMG5S.esm.min.js.map +1 -0
- package/dist/chunks/helperFunctions-BatAhE6u.esm.js +108 -0
- package/dist/chunks/helperFunctions-BatAhE6u.esm.js.map +1 -0
- package/dist/chunks/helperFunctions-qECwmiwu.esm.min.js +2 -0
- package/dist/chunks/helperFunctions-qECwmiwu.esm.min.js.map +1 -0
- package/dist/chunks/helperFunctions-vbA-oTJx.esm.js +80 -0
- package/dist/chunks/helperFunctions-vbA-oTJx.esm.js.map +1 -0
- package/dist/chunks/iesTextureLoader-Ccd5pvbh.esm.min.js +2 -0
- package/dist/chunks/iesTextureLoader-Ccd5pvbh.esm.min.js.map +1 -0
- package/dist/chunks/iesTextureLoader-nMYnOfhm.esm.js +189 -0
- package/dist/chunks/iesTextureLoader-nMYnOfhm.esm.js.map +1 -0
- package/dist/chunks/index-BHIM4QBr.esm.min.js +57 -0
- package/dist/chunks/index-BHIM4QBr.esm.min.js.map +1 -0
- package/dist/chunks/index-CtkZLm9J.esm.js +74717 -0
- package/dist/chunks/index-CtkZLm9J.esm.js.map +1 -0
- package/dist/chunks/ktxTextureLoader-CkkvHzY3.esm.js +814 -0
- package/dist/chunks/ktxTextureLoader-CkkvHzY3.esm.js.map +1 -0
- package/dist/chunks/ktxTextureLoader-CwGlHia2.esm.min.js +2 -0
- package/dist/chunks/ktxTextureLoader-CwGlHia2.esm.min.js.map +1 -0
- package/dist/chunks/logDepthDeclaration-BiUSPlzz.esm.js +35 -0
- package/dist/chunks/logDepthDeclaration-BiUSPlzz.esm.js.map +1 -0
- package/dist/chunks/logDepthDeclaration-Bq2fzMbS.esm.js +11 -0
- package/dist/chunks/logDepthDeclaration-Bq2fzMbS.esm.js.map +1 -0
- package/dist/chunks/logDepthDeclaration-C8DJP16D.esm.min.js +2 -0
- package/dist/chunks/logDepthDeclaration-C8DJP16D.esm.min.js.map +1 -0
- package/dist/chunks/logDepthDeclaration-DJpvEdPG.esm.min.js +2 -0
- package/dist/chunks/logDepthDeclaration-DJpvEdPG.esm.min.js.map +1 -0
- package/dist/chunks/logDepthVertex-C00_obGd.esm.min.js +2 -0
- package/dist/chunks/logDepthVertex-C00_obGd.esm.min.js.map +1 -0
- package/dist/chunks/logDepthVertex-CYIGBMYd.esm.js +77 -0
- package/dist/chunks/logDepthVertex-CYIGBMYd.esm.js.map +1 -0
- package/dist/chunks/logDepthVertex-CxT8FVOf.esm.js +81 -0
- package/dist/chunks/logDepthVertex-CxT8FVOf.esm.js.map +1 -0
- package/dist/chunks/logDepthVertex-SyM_Fu5K.esm.min.js +2 -0
- package/dist/chunks/logDepthVertex-SyM_Fu5K.esm.min.js.map +1 -0
- package/dist/chunks/mainUVVaryingDeclaration-BaIG4IFB.esm.js +11 -0
- package/dist/chunks/mainUVVaryingDeclaration-BaIG4IFB.esm.js.map +1 -0
- package/dist/chunks/mainUVVaryingDeclaration-CQzOmEIM.esm.min.js +2 -0
- package/dist/chunks/mainUVVaryingDeclaration-CQzOmEIM.esm.min.js.map +1 -0
- package/dist/chunks/mainUVVaryingDeclaration-D100Qvmm.esm.min.js +2 -0
- package/dist/chunks/mainUVVaryingDeclaration-D100Qvmm.esm.min.js.map +1 -0
- package/dist/chunks/mainUVVaryingDeclaration-OSD7irdC.esm.js +11 -0
- package/dist/chunks/mainUVVaryingDeclaration-OSD7irdC.esm.js.map +1 -0
- package/dist/chunks/meshUboDeclaration--wzKOTOT.esm.min.js +2 -0
- package/dist/chunks/meshUboDeclaration--wzKOTOT.esm.min.js.map +1 -0
- package/dist/chunks/meshUboDeclaration-DIi9ZPDc.esm.js +26 -0
- package/dist/chunks/meshUboDeclaration-DIi9ZPDc.esm.js.map +1 -0
- package/dist/chunks/objFileLoader-Cda8pwUd.esm.js +1338 -0
- package/dist/chunks/objFileLoader-Cda8pwUd.esm.js.map +1 -0
- package/dist/chunks/objFileLoader-kzI-pZ8o.esm.min.js +2 -0
- package/dist/chunks/objFileLoader-kzI-pZ8o.esm.min.js.map +1 -0
- package/dist/chunks/oitFragment-4cP4dKVP.esm.min.js +2 -0
- package/dist/chunks/oitFragment-4cP4dKVP.esm.min.js.map +1 -0
- package/dist/chunks/oitFragment-Bz1w36ia.esm.js +1078 -0
- package/dist/chunks/oitFragment-Bz1w36ia.esm.js.map +1 -0
- package/dist/chunks/oitFragment-DUkW-kmb.esm.min.js +2 -0
- package/dist/chunks/oitFragment-DUkW-kmb.esm.min.js.map +1 -0
- package/dist/chunks/oitFragment-DiuTTpNa.esm.js +1240 -0
- package/dist/chunks/oitFragment-DiuTTpNa.esm.js.map +1 -0
- package/dist/chunks/pass.fragment-B8l5NRgR.esm.min.js +2 -0
- package/dist/chunks/pass.fragment-B8l5NRgR.esm.min.js.map +1 -0
- package/dist/chunks/pass.fragment-BF4UEoT8.esm.min.js +2 -0
- package/dist/chunks/pass.fragment-BF4UEoT8.esm.min.js.map +1 -0
- package/dist/chunks/pass.fragment-CD3_26yo.esm.js +15 -0
- package/dist/chunks/pass.fragment-CD3_26yo.esm.js.map +1 -0
- package/dist/chunks/pass.fragment-DfeELUEn.esm.js +15 -0
- package/dist/chunks/pass.fragment-DfeELUEn.esm.js.map +1 -0
- package/dist/chunks/pbr.fragment-BDylAp64.esm.min.js +2 -0
- package/dist/chunks/pbr.fragment-BDylAp64.esm.min.js.map +1 -0
- package/dist/chunks/pbr.fragment-C1qko419.esm.min.js +2 -0
- package/dist/chunks/pbr.fragment-C1qko419.esm.min.js.map +1 -0
- package/dist/chunks/pbr.fragment-EBVxSAEQ.esm.js +3232 -0
- package/dist/chunks/pbr.fragment-EBVxSAEQ.esm.js.map +1 -0
- package/dist/chunks/pbr.fragment-lt62m8b7.esm.js +3273 -0
- package/dist/chunks/pbr.fragment-lt62m8b7.esm.js.map +1 -0
- package/dist/chunks/pbr.vertex-CGRL_eY2.esm.js +339 -0
- package/dist/chunks/pbr.vertex-CGRL_eY2.esm.js.map +1 -0
- package/dist/chunks/pbr.vertex-CHv4zeYj.esm.min.js +2 -0
- package/dist/chunks/pbr.vertex-CHv4zeYj.esm.min.js.map +1 -0
- package/dist/chunks/pbr.vertex-Dk4h9ywZ.esm.min.js +2 -0
- package/dist/chunks/pbr.vertex-Dk4h9ywZ.esm.min.js.map +1 -0
- package/dist/chunks/pbr.vertex-DopP5mYu.esm.js +214 -0
- package/dist/chunks/pbr.vertex-DopP5mYu.esm.js.map +1 -0
- package/dist/chunks/postprocess.vertex-Bt30-Flh.esm.min.js +2 -0
- package/dist/chunks/postprocess.vertex-Bt30-Flh.esm.min.js.map +1 -0
- package/dist/chunks/postprocess.vertex-pLUOpXIY.esm.js +20 -0
- package/dist/chunks/postprocess.vertex-pLUOpXIY.esm.js.map +1 -0
- package/dist/chunks/rawTexture-78KJgWfq.esm.js +191 -0
- package/dist/chunks/rawTexture-78KJgWfq.esm.js.map +1 -0
- package/dist/chunks/rawTexture-CCCnj14W.esm.min.js +2 -0
- package/dist/chunks/rawTexture-CCCnj14W.esm.min.js.map +1 -0
- package/dist/chunks/ray-CfhmGTmj.esm.js +946 -0
- package/dist/chunks/ray-CfhmGTmj.esm.js.map +1 -0
- package/dist/chunks/ray-Du89cGmz.esm.min.js +2 -0
- package/dist/chunks/ray-Du89cGmz.esm.min.js.map +1 -0
- package/dist/chunks/rgbdDecode.fragment-BHAQKD_5.esm.js +13 -0
- package/dist/chunks/rgbdDecode.fragment-BHAQKD_5.esm.js.map +1 -0
- package/dist/chunks/rgbdDecode.fragment-CV6q4aIi.esm.js +13 -0
- package/dist/chunks/rgbdDecode.fragment-CV6q4aIi.esm.js.map +1 -0
- package/dist/chunks/rgbdDecode.fragment-DEu4F_6T.esm.min.js +2 -0
- package/dist/chunks/rgbdDecode.fragment-DEu4F_6T.esm.min.js.map +1 -0
- package/dist/chunks/rgbdDecode.fragment-DiJfgZKv.esm.min.js +2 -0
- package/dist/chunks/rgbdDecode.fragment-DiJfgZKv.esm.min.js.map +1 -0
- package/dist/chunks/rgbdEncode.fragment-CR30N0Mr.esm.js +13 -0
- package/dist/chunks/rgbdEncode.fragment-CR30N0Mr.esm.js.map +1 -0
- package/dist/chunks/rgbdEncode.fragment-CUE3DGC8.esm.min.js +2 -0
- package/dist/chunks/rgbdEncode.fragment-CUE3DGC8.esm.min.js.map +1 -0
- package/dist/chunks/rgbdEncode.fragment-DdFs5QJM.esm.js +13 -0
- package/dist/chunks/rgbdEncode.fragment-DdFs5QJM.esm.js.map +1 -0
- package/dist/chunks/rgbdEncode.fragment-omm81hdD.esm.min.js +2 -0
- package/dist/chunks/rgbdEncode.fragment-omm81hdD.esm.min.js.map +1 -0
- package/dist/chunks/splatFileLoader-BnaOhITn.esm.js +3379 -0
- package/dist/chunks/splatFileLoader-BnaOhITn.esm.js.map +1 -0
- package/dist/chunks/splatFileLoader-CuMIDOsR.esm.min.js +2 -0
- package/dist/chunks/splatFileLoader-CuMIDOsR.esm.min.js.map +1 -0
- package/dist/chunks/spotLight-Ca0-j1Op.esm.js +701 -0
- package/dist/chunks/spotLight-Ca0-j1Op.esm.js.map +1 -0
- package/dist/chunks/spotLight-DXuSbTaJ.esm.min.js +2 -0
- package/dist/chunks/spotLight-DXuSbTaJ.esm.min.js.map +1 -0
- package/dist/chunks/standardMaterial-DKyaZtcm.esm.js +1805 -0
- package/dist/chunks/standardMaterial-DKyaZtcm.esm.js.map +1 -0
- package/dist/chunks/standardMaterial-h3ccobBt.esm.min.js +2 -0
- package/dist/chunks/standardMaterial-h3ccobBt.esm.min.js.map +1 -0
- package/dist/chunks/stlFileLoader-CDv97liE.esm.js +238 -0
- package/dist/chunks/stlFileLoader-CDv97liE.esm.js.map +1 -0
- package/dist/chunks/stlFileLoader-e2ImyWaM.esm.min.js +2 -0
- package/dist/chunks/stlFileLoader-e2ImyWaM.esm.min.js.map +1 -0
- package/dist/chunks/tgaTextureLoader-DJaEph-Q.esm.js +349 -0
- package/dist/chunks/tgaTextureLoader-DJaEph-Q.esm.js.map +1 -0
- package/dist/chunks/tgaTextureLoader-slv-QvZW.esm.min.js +2 -0
- package/dist/chunks/tgaTextureLoader-slv-QvZW.esm.min.js.map +1 -0
- package/dist/chunks/thinEngine-Ue9ZAvRK.esm.js +3848 -0
- package/dist/chunks/thinEngine-Ue9ZAvRK.esm.js.map +1 -0
- package/dist/chunks/thinEngine-pihAbdON.esm.min.js +2 -0
- package/dist/chunks/thinEngine-pihAbdON.esm.min.js.map +1 -0
- package/dist/chunks/thinInstanceMesh-BgfKoejL.esm.min.js +2 -0
- package/dist/chunks/thinInstanceMesh-BgfKoejL.esm.min.js.map +1 -0
- package/dist/chunks/thinInstanceMesh-V41szD4h.esm.js +314 -0
- package/dist/chunks/thinInstanceMesh-V41szD4h.esm.js.map +1 -0
- package/dist/chunks/vertexColorMixing-CZsK7mYP.esm.min.js +2 -0
- package/dist/chunks/vertexColorMixing-CZsK7mYP.esm.min.js.map +1 -0
- package/dist/chunks/vertexColorMixing-DKVusFas.esm.js +522 -0
- package/dist/chunks/vertexColorMixing-DKVusFas.esm.js.map +1 -0
- package/dist/chunks/vertexColorMixing-DeZKI8QK.esm.js +412 -0
- package/dist/chunks/vertexColorMixing-DeZKI8QK.esm.js.map +1 -0
- package/dist/chunks/vertexColorMixing-axGN1U7X.esm.min.js +2 -0
- package/dist/chunks/vertexColorMixing-axGN1U7X.esm.min.js.map +1 -0
- package/dist/chunks/webgpuEngine-COis70hT.esm.js +11533 -0
- package/dist/chunks/webgpuEngine-COis70hT.esm.js.map +1 -0
- package/dist/chunks/webgpuEngine-Cx_GlShD.esm.min.js +2 -0
- package/dist/chunks/webgpuEngine-Cx_GlShD.esm.min.js.map +1 -0
- package/dist/chunks/workerPool-BUOov2K1.esm.js +122 -0
- package/dist/chunks/workerPool-BUOov2K1.esm.js.map +1 -0
- package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js +2 -0
- package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js.map +1 -0
- package/lib/index.d.ts +559 -0
- package/lib/index.js +2083 -0
- package/lib/index.js.map +1 -0
- package/package.json +19 -28
- package/readme.md +28 -28
- package/configuration/configuration.d.ts +0 -107
- package/configuration/configuration.js +0 -16
- package/configuration/configuration.js.map +0 -1
- package/configuration/configurationCompatibility.d.ts +0 -8
- package/configuration/configurationCompatibility.js +0 -66
- package/configuration/configurationCompatibility.js.map +0 -1
- package/configuration/configurationContainer.d.ts +0 -10
- package/configuration/configurationContainer.js +0 -10
- package/configuration/configurationContainer.js.map +0 -1
- package/configuration/globals.d.ts +0 -6
- package/configuration/globals.js +0 -18
- package/configuration/globals.js.map +0 -1
- package/configuration/index.d.ts +0 -2
- package/configuration/index.js +0 -4
- package/configuration/index.js.map +0 -1
- package/configuration/interfaces/cameraConfiguration.d.ts +0 -31
- package/configuration/interfaces/cameraConfiguration.js +0 -2
- package/configuration/interfaces/cameraConfiguration.js.map +0 -1
- package/configuration/interfaces/colorGradingConfiguration.d.ts +0 -81
- package/configuration/interfaces/colorGradingConfiguration.js +0 -2
- package/configuration/interfaces/colorGradingConfiguration.js.map +0 -1
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +0 -20
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +0 -2
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +0 -1
- package/configuration/interfaces/environmentMapConfiguration.d.ts +0 -22
- package/configuration/interfaces/environmentMapConfiguration.js +0 -2
- package/configuration/interfaces/environmentMapConfiguration.js.map +0 -1
- package/configuration/interfaces/groundConfiguration.d.ts +0 -24
- package/configuration/interfaces/groundConfiguration.js +0 -2
- package/configuration/interfaces/groundConfiguration.js.map +0 -1
- package/configuration/interfaces/imageProcessingConfiguration.d.ts +0 -45
- package/configuration/interfaces/imageProcessingConfiguration.js +0 -2
- package/configuration/interfaces/imageProcessingConfiguration.js.map +0 -1
- package/configuration/interfaces/index.d.ts +0 -15
- package/configuration/interfaces/index.js +0 -16
- package/configuration/interfaces/index.js.map +0 -1
- package/configuration/interfaces/lightConfiguration.d.ts +0 -60
- package/configuration/interfaces/lightConfiguration.js +0 -2
- package/configuration/interfaces/lightConfiguration.js.map +0 -1
- package/configuration/interfaces/modelAnimationConfiguration.d.ts +0 -26
- package/configuration/interfaces/modelAnimationConfiguration.js +0 -2
- package/configuration/interfaces/modelAnimationConfiguration.js.map +0 -1
- package/configuration/interfaces/modelConfiguration.d.ts +0 -65
- package/configuration/interfaces/modelConfiguration.js +0 -2
- package/configuration/interfaces/modelConfiguration.js.map +0 -1
- package/configuration/interfaces/observersConfiguration.d.ts +0 -5
- package/configuration/interfaces/observersConfiguration.js +0 -2
- package/configuration/interfaces/observersConfiguration.js.map +0 -1
- package/configuration/interfaces/sceneConfiguration.d.ts +0 -48
- package/configuration/interfaces/sceneConfiguration.js +0 -2
- package/configuration/interfaces/sceneConfiguration.js.map +0 -1
- package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +0 -23
- package/configuration/interfaces/sceneOptimizerConfiguration.js +0 -2
- package/configuration/interfaces/sceneOptimizerConfiguration.js.map +0 -1
- package/configuration/interfaces/skyboxConfiguration.d.ts +0 -21
- package/configuration/interfaces/skyboxConfiguration.js +0 -2
- package/configuration/interfaces/skyboxConfiguration.js.map +0 -1
- package/configuration/interfaces/templateConfiguration.d.ts +0 -67
- package/configuration/interfaces/templateConfiguration.js +0 -2
- package/configuration/interfaces/templateConfiguration.js.map +0 -1
- package/configuration/interfaces/vrConfiguration.d.ts +0 -16
- package/configuration/interfaces/vrConfiguration.js +0 -2
- package/configuration/interfaces/vrConfiguration.js.map +0 -1
- package/configuration/loader.d.ts +0 -4
- package/configuration/loader.js +0 -17
- package/configuration/loader.js.map +0 -1
- package/configuration/mappers.d.ts +0 -43
- package/configuration/mappers.js +0 -193
- package/configuration/mappers.js.map +0 -1
- package/configuration/renderOnlyLoader.d.ts +0 -33
- package/configuration/renderOnlyLoader.js +0 -162
- package/configuration/renderOnlyLoader.js.map +0 -1
- package/configuration/types/default.d.ts +0 -6
- package/configuration/types/default.js +0 -121
- package/configuration/types/default.js.map +0 -1
- package/configuration/types/environmentMap.d.ts +0 -5
- package/configuration/types/environmentMap.js +0 -14
- package/configuration/types/environmentMap.js.map +0 -1
- package/configuration/types/extended.d.ts +0 -6
- package/configuration/types/extended.js +0 -317
- package/configuration/types/extended.js.map +0 -1
- package/configuration/types/index.d.ts +0 -14
- package/configuration/types/index.js +0 -51
- package/configuration/types/index.js.map +0 -1
- package/configuration/types/minimal.d.ts +0 -6
- package/configuration/types/minimal.js +0 -43
- package/configuration/types/minimal.js.map +0 -1
- package/configuration/types/renderOnlyDefault.d.ts +0 -30
- package/configuration/types/renderOnlyDefault.js +0 -31
- package/configuration/types/renderOnlyDefault.js.map +0 -1
- package/configuration/types/shadowLight.d.ts +0 -9
- package/configuration/types/shadowLight.js +0 -64
- package/configuration/types/shadowLight.js.map +0 -1
- package/helper/index.d.ts +0 -29
- package/helper/index.js +0 -66
- package/helper/index.js.map +0 -1
- package/index.d.ts +0 -30
- package/index.js +0 -46
- package/index.js.map +0 -1
- package/initializer.d.ts +0 -11
- package/initializer.js +0 -35
- package/initializer.js.map +0 -1
- package/interfaces.d.ts +0 -5
- package/interfaces.js +0 -7
- package/interfaces.js.map +0 -1
- package/labs/environmentSerializer.d.ts +0 -126
- package/labs/environmentSerializer.js +0 -191
- package/labs/environmentSerializer.js.map +0 -1
- package/labs/texture.d.ts +0 -183
- package/labs/texture.js +0 -351
- package/labs/texture.js.map +0 -1
- package/labs/viewerLabs.d.ts +0 -51
- package/labs/viewerLabs.js +0 -134
- package/labs/viewerLabs.js.map +0 -1
- package/loader/modelLoader.d.ts +0 -56
- package/loader/modelLoader.js +0 -202
- package/loader/modelLoader.js.map +0 -1
- package/loader/plugins/applyMaterialConfig.d.ts +0 -12
- package/loader/plugins/applyMaterialConfig.js +0 -16
- package/loader/plugins/applyMaterialConfig.js.map +0 -1
- package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +0 -9
- package/loader/plugins/extendedMaterialLoaderPlugin.js +0 -16
- package/loader/plugins/extendedMaterialLoaderPlugin.js.map +0 -1
- package/loader/plugins/index.d.ts +0 -19
- package/loader/plugins/index.js +0 -44
- package/loader/plugins/index.js.map +0 -1
- package/loader/plugins/loaderPlugin.d.ts +0 -24
- package/loader/plugins/loaderPlugin.js +0 -2
- package/loader/plugins/loaderPlugin.js.map +0 -1
- package/loader/plugins/msftLodLoaderPlugin.d.ts +0 -12
- package/loader/plugins/msftLodLoaderPlugin.js +0 -21
- package/loader/plugins/msftLodLoaderPlugin.js.map +0 -1
- package/loader/plugins/telemetryLoaderPlugin.d.ts +0 -12
- package/loader/plugins/telemetryLoaderPlugin.js +0 -36
- package/loader/plugins/telemetryLoaderPlugin.js.map +0 -1
- package/managers/observablesManager.d.ts +0 -66
- package/managers/observablesManager.js +0 -35
- package/managers/observablesManager.js.map +0 -1
- package/managers/sceneManager.d.ts +0 -245
- package/managers/sceneManager.js +0 -1375
- package/managers/sceneManager.js.map +0 -1
- package/managers/telemetryManager.d.ts +0 -78
- package/managers/telemetryManager.js +0 -117
- package/managers/telemetryManager.js.map +0 -1
- package/model/modelAnimation.d.ts +0 -215
- package/model/modelAnimation.js +0 -237
- package/model/modelAnimation.js.map +0 -1
- package/model/viewerModel.d.ts +0 -233
- package/model/viewerModel.js +0 -673
- package/model/viewerModel.js.map +0 -1
- package/optimizer/custom/extended.d.ts +0 -13
- package/optimizer/custom/extended.js +0 -101
- package/optimizer/custom/extended.js.map +0 -1
- package/optimizer/custom/index.d.ts +0 -9
- package/optimizer/custom/index.js +0 -26
- package/optimizer/custom/index.js.map +0 -1
- package/renderOnlyIndex.d.ts +0 -11
- package/renderOnlyIndex.js +0 -18
- package/renderOnlyIndex.js.map +0 -1
- package/templating/eventManager.d.ts +0 -35
- package/templating/eventManager.js +0 -66
- package/templating/eventManager.js.map +0 -1
- package/templating/plugins/hdButtonPlugin.d.ts +0 -9
- package/templating/plugins/hdButtonPlugin.js +0 -22
- package/templating/plugins/hdButtonPlugin.js.map +0 -1
- package/templating/plugins/printButton.d.ts +0 -9
- package/templating/plugins/printButton.js +0 -41
- package/templating/plugins/printButton.js.map +0 -1
- package/templating/templateManager.d.ts +0 -197
- package/templating/templateManager.js +0 -561
- package/templating/templateManager.js.map +0 -1
- package/templating/viewerTemplatePlugin.d.ts +0 -21
- package/templating/viewerTemplatePlugin.js +0 -69
- package/templating/viewerTemplatePlugin.js.map +0 -1
- package/viewer/defaultViewer.d.ts +0 -130
- package/viewer/defaultViewer.js +0 -672
- package/viewer/defaultViewer.js.map +0 -1
- package/viewer/renderOnlyViewer.d.ts +0 -9
- package/viewer/renderOnlyViewer.js +0 -46
- package/viewer/renderOnlyViewer.js.map +0 -1
- package/viewer/viewer.d.ts +0 -258
- package/viewer/viewer.js +0 -783
- package/viewer/viewer.js.map +0 -1
- package/viewer/viewerManager.d.ts +0 -58
- package/viewer/viewerManager.js +0 -91
- package/viewer/viewerManager.js.map +0 -1
- package/viewer/viewerWithTemplate.d.ts +0 -9
- package/viewer/viewerWithTemplate.js +0 -20
- package/viewer/viewerWithTemplate.js.map +0 -1
|
@@ -0,0 +1,1338 @@
|
|
|
1
|
+
import { s as Color3, t as Texture, m as Color4, u as Vector2, v as Vector3, V as VertexBuffer, L as Logger, w as Geometry, M as Mesh, x as VertexData, O as OBJFileLoaderMetadata, T as Tools, y as registerSceneLoaderPlugin } from './index-CtkZLm9J.esm.js';
|
|
2
|
+
import { A as AssetContainer } from './assetContainer-cm8rvay3.esm.js';
|
|
3
|
+
import { S as StandardMaterial } from './standardMaterial-DKyaZtcm.esm.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Class reading and parsing the MTL file bundled with the obj file.
|
|
7
|
+
*/
|
|
8
|
+
class MTLFileLoader {
|
|
9
|
+
constructor() {
|
|
10
|
+
/**
|
|
11
|
+
* All material loaded from the mtl will be set here
|
|
12
|
+
*/
|
|
13
|
+
this.materials = [];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* This function will read the mtl file and create each material described inside
|
|
17
|
+
* This function could be improve by adding :
|
|
18
|
+
* -some component missing (Ni, Tf...)
|
|
19
|
+
* -including the specific options available
|
|
20
|
+
*
|
|
21
|
+
* @param scene defines the scene the material will be created in
|
|
22
|
+
* @param data defines the mtl data to parse
|
|
23
|
+
* @param rootUrl defines the rooturl to use in order to load relative dependencies
|
|
24
|
+
* @param assetContainer defines the asset container to store the material in (can be null)
|
|
25
|
+
*/
|
|
26
|
+
parseMTL(scene, data, rootUrl, assetContainer) {
|
|
27
|
+
if (data instanceof ArrayBuffer) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
//Split the lines from the file
|
|
31
|
+
const lines = data.split("\n");
|
|
32
|
+
// whitespace char ie: [ \t\r\n\f]
|
|
33
|
+
const delimiter_pattern = /\s+/;
|
|
34
|
+
//Array with RGB colors
|
|
35
|
+
let color;
|
|
36
|
+
//New material
|
|
37
|
+
let material = null;
|
|
38
|
+
//Look at each line
|
|
39
|
+
for (let i = 0; i < lines.length; i++) {
|
|
40
|
+
const line = lines[i].trim();
|
|
41
|
+
// Blank line or comment
|
|
42
|
+
if (line.length === 0 || line.charAt(0) === "#") {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
//Get the first parameter (keyword)
|
|
46
|
+
const pos = line.indexOf(" ");
|
|
47
|
+
let key = pos >= 0 ? line.substring(0, pos) : line;
|
|
48
|
+
key = key.toLowerCase();
|
|
49
|
+
//Get the data following the key
|
|
50
|
+
const value = pos >= 0 ? line.substring(pos + 1).trim() : "";
|
|
51
|
+
//This mtl keyword will create the new material
|
|
52
|
+
if (key === "newmtl") {
|
|
53
|
+
//Check if it is the first material.
|
|
54
|
+
// Materials specifications are described after this keyword.
|
|
55
|
+
if (material) {
|
|
56
|
+
//Add the previous material in the material array.
|
|
57
|
+
this.materials.push(material);
|
|
58
|
+
}
|
|
59
|
+
//Create a new material.
|
|
60
|
+
// value is the name of the material read in the mtl file
|
|
61
|
+
scene._blockEntityCollection = !!assetContainer;
|
|
62
|
+
material = new StandardMaterial(value, scene);
|
|
63
|
+
material._parentContainer = assetContainer;
|
|
64
|
+
scene._blockEntityCollection = false;
|
|
65
|
+
}
|
|
66
|
+
else if (key === "kd" && material) {
|
|
67
|
+
// Diffuse color (color under white light) using RGB values
|
|
68
|
+
//value = "r g b"
|
|
69
|
+
color = value.split(delimiter_pattern, 3).map(parseFloat);
|
|
70
|
+
//color = [r,g,b]
|
|
71
|
+
//Set tghe color into the material
|
|
72
|
+
material.diffuseColor = Color3.FromArray(color);
|
|
73
|
+
}
|
|
74
|
+
else if (key === "ka" && material) {
|
|
75
|
+
// Ambient color (color under shadow) using RGB values
|
|
76
|
+
//value = "r g b"
|
|
77
|
+
color = value.split(delimiter_pattern, 3).map(parseFloat);
|
|
78
|
+
//color = [r,g,b]
|
|
79
|
+
//Set tghe color into the material
|
|
80
|
+
material.ambientColor = Color3.FromArray(color);
|
|
81
|
+
}
|
|
82
|
+
else if (key === "ks" && material) {
|
|
83
|
+
// Specular color (color when light is reflected from shiny surface) using RGB values
|
|
84
|
+
//value = "r g b"
|
|
85
|
+
color = value.split(delimiter_pattern, 3).map(parseFloat);
|
|
86
|
+
//color = [r,g,b]
|
|
87
|
+
//Set the color into the material
|
|
88
|
+
material.specularColor = Color3.FromArray(color);
|
|
89
|
+
}
|
|
90
|
+
else if (key === "ke" && material) {
|
|
91
|
+
// Emissive color using RGB values
|
|
92
|
+
color = value.split(delimiter_pattern, 3).map(parseFloat);
|
|
93
|
+
material.emissiveColor = Color3.FromArray(color);
|
|
94
|
+
}
|
|
95
|
+
else if (key === "ns" && material) {
|
|
96
|
+
//value = "Integer"
|
|
97
|
+
material.specularPower = parseFloat(value);
|
|
98
|
+
}
|
|
99
|
+
else if (key === "d" && material) {
|
|
100
|
+
//d is dissolve for current material. It mean alpha for BABYLON
|
|
101
|
+
material.alpha = parseFloat(value);
|
|
102
|
+
//Texture
|
|
103
|
+
//This part can be improved by adding the possible options of texture
|
|
104
|
+
}
|
|
105
|
+
else if (key === "map_ka" && material) {
|
|
106
|
+
// ambient texture map with a loaded image
|
|
107
|
+
//We must first get the folder of the image
|
|
108
|
+
material.ambientTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);
|
|
109
|
+
}
|
|
110
|
+
else if (key === "map_kd" && material) {
|
|
111
|
+
// Diffuse texture map with a loaded image
|
|
112
|
+
material.diffuseTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);
|
|
113
|
+
}
|
|
114
|
+
else if (key === "map_ks" && material) {
|
|
115
|
+
// Specular texture map with a loaded image
|
|
116
|
+
//We must first get the folder of the image
|
|
117
|
+
material.specularTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);
|
|
118
|
+
}
|
|
119
|
+
else if (key === "map_ns") ;
|
|
120
|
+
else if (key === "map_bump" && material) {
|
|
121
|
+
//The bump texture
|
|
122
|
+
const values = value.split(delimiter_pattern);
|
|
123
|
+
const bumpMultiplierIndex = values.indexOf("-bm");
|
|
124
|
+
let bumpMultiplier = null;
|
|
125
|
+
if (bumpMultiplierIndex >= 0) {
|
|
126
|
+
bumpMultiplier = values[bumpMultiplierIndex + 1];
|
|
127
|
+
values.splice(bumpMultiplierIndex, 2); // remove
|
|
128
|
+
}
|
|
129
|
+
material.bumpTexture = MTLFileLoader._GetTexture(rootUrl, values.join(" "), scene);
|
|
130
|
+
if (material.bumpTexture && bumpMultiplier !== null) {
|
|
131
|
+
material.bumpTexture.level = parseFloat(bumpMultiplier);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else if (key === "map_d" && material) {
|
|
135
|
+
// The dissolve of the material
|
|
136
|
+
material.opacityTexture = MTLFileLoader._GetTexture(rootUrl, value, scene);
|
|
137
|
+
//Options for illumination
|
|
138
|
+
}
|
|
139
|
+
else ;
|
|
140
|
+
}
|
|
141
|
+
//At the end of the file, add the last material
|
|
142
|
+
if (material) {
|
|
143
|
+
this.materials.push(material);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Gets the texture for the material.
|
|
148
|
+
*
|
|
149
|
+
* If the material is imported from input file,
|
|
150
|
+
* We sanitize the url to ensure it takes the texture from aside the material.
|
|
151
|
+
*
|
|
152
|
+
* @param rootUrl The root url to load from
|
|
153
|
+
* @param value The value stored in the mtl
|
|
154
|
+
* @param scene
|
|
155
|
+
* @returns The Texture
|
|
156
|
+
*/
|
|
157
|
+
static _GetTexture(rootUrl, value, scene) {
|
|
158
|
+
if (!value) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
let url = rootUrl;
|
|
162
|
+
// Load from input file.
|
|
163
|
+
if (rootUrl === "file:") {
|
|
164
|
+
let lastDelimiter = value.lastIndexOf("\\");
|
|
165
|
+
if (lastDelimiter === -1) {
|
|
166
|
+
lastDelimiter = value.lastIndexOf("/");
|
|
167
|
+
}
|
|
168
|
+
if (lastDelimiter > -1) {
|
|
169
|
+
url += value.substring(lastDelimiter + 1);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
url += value;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// Not from input file.
|
|
176
|
+
else {
|
|
177
|
+
url += value;
|
|
178
|
+
}
|
|
179
|
+
return new Texture(url, scene, false, MTLFileLoader.INVERT_TEXTURE_Y);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Invert Y-Axis of referenced textures on load
|
|
184
|
+
*/
|
|
185
|
+
MTLFileLoader.INVERT_TEXTURE_Y = true;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Class used to load mesh data from OBJ content
|
|
189
|
+
*/
|
|
190
|
+
class SolidParser {
|
|
191
|
+
/**
|
|
192
|
+
* Creates a new SolidParser
|
|
193
|
+
* @param materialToUse defines the array to fill with the list of materials to use (it will be filled by the parse function)
|
|
194
|
+
* @param babylonMeshesArray defines the array to fill with the list of loaded meshes (it will be filled by the parse function)
|
|
195
|
+
* @param loadingOptions defines the loading options to use
|
|
196
|
+
*/
|
|
197
|
+
constructor(materialToUse, babylonMeshesArray, loadingOptions) {
|
|
198
|
+
this._positions = []; //values for the positions of vertices
|
|
199
|
+
this._normals = []; //Values for the normals
|
|
200
|
+
this._uvs = []; //Values for the textures
|
|
201
|
+
this._colors = [];
|
|
202
|
+
this._extColors = []; //Extension color
|
|
203
|
+
this._meshesFromObj = []; //[mesh] Contains all the obj meshes
|
|
204
|
+
this._indicesForBabylon = []; //The list of indices for VertexData
|
|
205
|
+
this._wrappedPositionForBabylon = []; //The list of position in vectors
|
|
206
|
+
this._wrappedUvsForBabylon = []; //Array with all value of uvs to match with the indices
|
|
207
|
+
this._wrappedColorsForBabylon = []; // Array with all color values to match with the indices
|
|
208
|
+
this._wrappedNormalsForBabylon = []; //Array with all value of normals to match with the indices
|
|
209
|
+
this._tuplePosNorm = []; //Create a tuple with indice of Position, Normal, UV [pos, norm, uvs]
|
|
210
|
+
this._curPositionInIndices = 0;
|
|
211
|
+
this._hasMeshes = false; //Meshes are defined in the file
|
|
212
|
+
this._unwrappedPositionsForBabylon = []; //Value of positionForBabylon w/o Vector3() [x,y,z]
|
|
213
|
+
this._unwrappedColorsForBabylon = []; // Value of colorForBabylon w/o Color4() [r,g,b,a]
|
|
214
|
+
this._unwrappedNormalsForBabylon = []; //Value of normalsForBabylon w/o Vector3() [x,y,z]
|
|
215
|
+
this._unwrappedUVForBabylon = []; //Value of uvsForBabylon w/o Vector3() [x,y,z]
|
|
216
|
+
this._triangles = []; //Indices from new triangles coming from polygons
|
|
217
|
+
this._materialNameFromObj = ""; //The name of the current material
|
|
218
|
+
this._objMeshName = ""; //The name of the current obj mesh
|
|
219
|
+
this._increment = 1; //Id for meshes created by the multimaterial
|
|
220
|
+
this._isFirstMaterial = true;
|
|
221
|
+
this._grayColor = new Color4(0.5, 0.5, 0.5, 1);
|
|
222
|
+
this._hasLineData = false; //If this mesh has line segment(l) data
|
|
223
|
+
this._materialToUse = materialToUse;
|
|
224
|
+
this._babylonMeshesArray = babylonMeshesArray;
|
|
225
|
+
this._loadingOptions = loadingOptions;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Search for obj in the given array.
|
|
229
|
+
* This function is called to check if a couple of data already exists in an array.
|
|
230
|
+
*
|
|
231
|
+
* If found, returns the index of the founded tuple index. Returns -1 if not found
|
|
232
|
+
* @param arr Array<{ normals: Array<number>, idx: Array<number> }>
|
|
233
|
+
* @param obj Array<number>
|
|
234
|
+
* @returns {boolean}
|
|
235
|
+
*/
|
|
236
|
+
_isInArray(arr, obj) {
|
|
237
|
+
if (!arr[obj[0]]) {
|
|
238
|
+
arr[obj[0]] = { normals: [], idx: [] };
|
|
239
|
+
}
|
|
240
|
+
const idx = arr[obj[0]].normals.indexOf(obj[1]);
|
|
241
|
+
return idx === -1 ? -1 : arr[obj[0]].idx[idx];
|
|
242
|
+
}
|
|
243
|
+
_isInArrayUV(arr, obj) {
|
|
244
|
+
if (!arr[obj[0]]) {
|
|
245
|
+
arr[obj[0]] = { normals: [], idx: [], uv: [] };
|
|
246
|
+
}
|
|
247
|
+
const idx = arr[obj[0]].normals.indexOf(obj[1]);
|
|
248
|
+
if (idx != 1 && obj[2] === arr[obj[0]].uv[idx]) {
|
|
249
|
+
return arr[obj[0]].idx[idx];
|
|
250
|
+
}
|
|
251
|
+
return -1;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* This function set the data for each triangle.
|
|
255
|
+
* Data are position, normals and uvs
|
|
256
|
+
* If a tuple of (position, normal) is not set, add the data into the corresponding array
|
|
257
|
+
* If the tuple already exist, add only their indice
|
|
258
|
+
*
|
|
259
|
+
* @param indicePositionFromObj Integer The index in positions array
|
|
260
|
+
* @param indiceUvsFromObj Integer The index in uvs array
|
|
261
|
+
* @param indiceNormalFromObj Integer The index in normals array
|
|
262
|
+
* @param positionVectorFromOBJ Vector3 The value of position at index objIndice
|
|
263
|
+
* @param textureVectorFromOBJ Vector3 The value of uvs
|
|
264
|
+
* @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale
|
|
265
|
+
* @param positionColorsFromOBJ
|
|
266
|
+
*/
|
|
267
|
+
_setData(indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj, positionVectorFromOBJ, textureVectorFromOBJ, normalsVectorFromOBJ, positionColorsFromOBJ) {
|
|
268
|
+
//Check if this tuple already exists in the list of tuples
|
|
269
|
+
let _index;
|
|
270
|
+
if (this._loadingOptions.optimizeWithUV) {
|
|
271
|
+
_index = this._isInArrayUV(this._tuplePosNorm, [indicePositionFromObj, indiceNormalFromObj, indiceUvsFromObj]);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
_index = this._isInArray(this._tuplePosNorm, [indicePositionFromObj, indiceNormalFromObj]);
|
|
275
|
+
}
|
|
276
|
+
//If it not exists
|
|
277
|
+
if (_index === -1) {
|
|
278
|
+
//Add an new indice.
|
|
279
|
+
//The array of indices is only an array with his length equal to the number of triangles - 1.
|
|
280
|
+
//We add vertices data in this order
|
|
281
|
+
this._indicesForBabylon.push(this._wrappedPositionForBabylon.length);
|
|
282
|
+
//Push the position of vertice for Babylon
|
|
283
|
+
//Each element is a Vector3(x,y,z)
|
|
284
|
+
this._wrappedPositionForBabylon.push(positionVectorFromOBJ);
|
|
285
|
+
//Push the uvs for Babylon
|
|
286
|
+
//Each element is a Vector2(u,v)
|
|
287
|
+
//If the UVs are missing, set (u,v)=(0,0)
|
|
288
|
+
textureVectorFromOBJ = textureVectorFromOBJ ?? new Vector2(0, 0);
|
|
289
|
+
this._wrappedUvsForBabylon.push(textureVectorFromOBJ);
|
|
290
|
+
//Push the normals for Babylon
|
|
291
|
+
//Each element is a Vector3(x,y,z)
|
|
292
|
+
this._wrappedNormalsForBabylon.push(normalsVectorFromOBJ);
|
|
293
|
+
if (positionColorsFromOBJ !== undefined) {
|
|
294
|
+
//Push the colors for Babylon
|
|
295
|
+
//Each element is a BABYLON.Color4(r,g,b,a)
|
|
296
|
+
this._wrappedColorsForBabylon.push(positionColorsFromOBJ);
|
|
297
|
+
}
|
|
298
|
+
//Add the tuple in the comparison list
|
|
299
|
+
this._tuplePosNorm[indicePositionFromObj].normals.push(indiceNormalFromObj);
|
|
300
|
+
this._tuplePosNorm[indicePositionFromObj].idx.push(this._curPositionInIndices++);
|
|
301
|
+
if (this._loadingOptions.optimizeWithUV) {
|
|
302
|
+
this._tuplePosNorm[indicePositionFromObj].uv.push(indiceUvsFromObj);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
//The tuple already exists
|
|
307
|
+
//Add the index of the already existing tuple
|
|
308
|
+
//At this index we can get the value of position, normal, color and uvs of vertex
|
|
309
|
+
this._indicesForBabylon.push(_index);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Transform Vector() and BABYLON.Color() objects into numbers in an array
|
|
314
|
+
*/
|
|
315
|
+
_unwrapData() {
|
|
316
|
+
try {
|
|
317
|
+
//Every array has the same length
|
|
318
|
+
for (let l = 0; l < this._wrappedPositionForBabylon.length; l++) {
|
|
319
|
+
//Push the x, y, z values of each element in the unwrapped array
|
|
320
|
+
this._unwrappedPositionsForBabylon.push(this._wrappedPositionForBabylon[l].x * this._handednessSign, this._wrappedPositionForBabylon[l].y, this._wrappedPositionForBabylon[l].z);
|
|
321
|
+
this._unwrappedNormalsForBabylon.push(this._wrappedNormalsForBabylon[l].x * this._handednessSign, this._wrappedNormalsForBabylon[l].y, this._wrappedNormalsForBabylon[l].z);
|
|
322
|
+
this._unwrappedUVForBabylon.push(this._wrappedUvsForBabylon[l].x, this._wrappedUvsForBabylon[l].y); //z is an optional value not supported by BABYLON
|
|
323
|
+
if (this._loadingOptions.importVertexColors) {
|
|
324
|
+
//Push the r, g, b, a values of each element in the unwrapped array
|
|
325
|
+
this._unwrappedColorsForBabylon.push(this._wrappedColorsForBabylon[l].r, this._wrappedColorsForBabylon[l].g, this._wrappedColorsForBabylon[l].b, this._wrappedColorsForBabylon[l].a);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
// Reset arrays for the next new meshes
|
|
329
|
+
this._wrappedPositionForBabylon.length = 0;
|
|
330
|
+
this._wrappedNormalsForBabylon.length = 0;
|
|
331
|
+
this._wrappedUvsForBabylon.length = 0;
|
|
332
|
+
this._wrappedColorsForBabylon.length = 0;
|
|
333
|
+
this._tuplePosNorm.length = 0;
|
|
334
|
+
this._curPositionInIndices = 0;
|
|
335
|
+
}
|
|
336
|
+
catch (e) {
|
|
337
|
+
throw new Error("Unable to unwrap data while parsing OBJ data.");
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Create triangles from polygons
|
|
342
|
+
* It is important to notice that a triangle is a polygon
|
|
343
|
+
* We get 5 patterns of face defined in OBJ File :
|
|
344
|
+
* facePattern1 = ["1","2","3","4","5","6"]
|
|
345
|
+
* facePattern2 = ["1/1","2/2","3/3","4/4","5/5","6/6"]
|
|
346
|
+
* facePattern3 = ["1/1/1","2/2/2","3/3/3","4/4/4","5/5/5","6/6/6"]
|
|
347
|
+
* facePattern4 = ["1//1","2//2","3//3","4//4","5//5","6//6"]
|
|
348
|
+
* facePattern5 = ["-1/-1/-1","-2/-2/-2","-3/-3/-3","-4/-4/-4","-5/-5/-5","-6/-6/-6"]
|
|
349
|
+
* Each pattern is divided by the same method
|
|
350
|
+
* @param faces Array[String] The indices of elements
|
|
351
|
+
* @param v Integer The variable to increment
|
|
352
|
+
*/
|
|
353
|
+
_getTriangles(faces, v) {
|
|
354
|
+
//Work for each element of the array
|
|
355
|
+
for (let faceIndex = v; faceIndex < faces.length - 1; faceIndex++) {
|
|
356
|
+
//Add on the triangle variable the indexes to obtain triangles
|
|
357
|
+
this._pushTriangle(faces, faceIndex);
|
|
358
|
+
}
|
|
359
|
+
//Result obtained after 2 iterations:
|
|
360
|
+
//Pattern1 => triangle = ["1","2","3","1","3","4"];
|
|
361
|
+
//Pattern2 => triangle = ["1/1","2/2","3/3","1/1","3/3","4/4"];
|
|
362
|
+
//Pattern3 => triangle = ["1/1/1","2/2/2","3/3/3","1/1/1","3/3/3","4/4/4"];
|
|
363
|
+
//Pattern4 => triangle = ["1//1","2//2","3//3","1//1","3//3","4//4"];
|
|
364
|
+
//Pattern5 => triangle = ["-1/-1/-1","-2/-2/-2","-3/-3/-3","-1/-1/-1","-3/-3/-3","-4/-4/-4"];
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* To get color between color and extension color
|
|
368
|
+
* @param index Integer The index of the element in the array
|
|
369
|
+
* @returns value of target color
|
|
370
|
+
*/
|
|
371
|
+
_getColor(index) {
|
|
372
|
+
if (this._loadingOptions.importVertexColors) {
|
|
373
|
+
return this._extColors[index] ?? this._colors[index];
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
return undefined;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Create triangles and push the data for each polygon for the pattern 1
|
|
381
|
+
* In this pattern we get vertice positions
|
|
382
|
+
* @param face
|
|
383
|
+
* @param v
|
|
384
|
+
*/
|
|
385
|
+
_setDataForCurrentFaceWithPattern1(face, v) {
|
|
386
|
+
//Get the indices of triangles for each polygon
|
|
387
|
+
this._getTriangles(face, v);
|
|
388
|
+
//For each element in the triangles array.
|
|
389
|
+
//This var could contains 1 to an infinity of triangles
|
|
390
|
+
for (let k = 0; k < this._triangles.length; k++) {
|
|
391
|
+
// Set position indice
|
|
392
|
+
const indicePositionFromObj = parseInt(this._triangles[k]) - 1;
|
|
393
|
+
this._setData(indicePositionFromObj, 0, 0, // In the pattern 1, normals and uvs are not defined
|
|
394
|
+
this._positions[indicePositionFromObj], // Get the vectors data
|
|
395
|
+
Vector2.Zero(), Vector3.Up(), // Create default vectors
|
|
396
|
+
this._getColor(indicePositionFromObj));
|
|
397
|
+
}
|
|
398
|
+
//Reset variable for the next line
|
|
399
|
+
this._triangles.length = 0;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Create triangles and push the data for each polygon for the pattern 2
|
|
403
|
+
* In this pattern we get vertice positions and uvs
|
|
404
|
+
* @param face
|
|
405
|
+
* @param v
|
|
406
|
+
*/
|
|
407
|
+
_setDataForCurrentFaceWithPattern2(face, v) {
|
|
408
|
+
//Get the indices of triangles for each polygon
|
|
409
|
+
this._getTriangles(face, v);
|
|
410
|
+
for (let k = 0; k < this._triangles.length; k++) {
|
|
411
|
+
//triangle[k] = "1/1"
|
|
412
|
+
//Split the data for getting position and uv
|
|
413
|
+
const point = this._triangles[k].split("/"); // ["1", "1"]
|
|
414
|
+
//Set position indice
|
|
415
|
+
const indicePositionFromObj = parseInt(point[0]) - 1;
|
|
416
|
+
//Set uv indice
|
|
417
|
+
const indiceUvsFromObj = parseInt(point[1]) - 1;
|
|
418
|
+
this._setData(indicePositionFromObj, indiceUvsFromObj, 0, //Default value for normals
|
|
419
|
+
this._positions[indicePositionFromObj], //Get the values for each element
|
|
420
|
+
this._uvs[indiceUvsFromObj] ?? Vector2.Zero(), Vector3.Up(), //Default value for normals
|
|
421
|
+
this._getColor(indicePositionFromObj));
|
|
422
|
+
}
|
|
423
|
+
//Reset variable for the next line
|
|
424
|
+
this._triangles.length = 0;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Create triangles and push the data for each polygon for the pattern 3
|
|
428
|
+
* In this pattern we get vertice positions, uvs and normals
|
|
429
|
+
* @param face
|
|
430
|
+
* @param v
|
|
431
|
+
*/
|
|
432
|
+
_setDataForCurrentFaceWithPattern3(face, v) {
|
|
433
|
+
//Get the indices of triangles for each polygon
|
|
434
|
+
this._getTriangles(face, v);
|
|
435
|
+
for (let k = 0; k < this._triangles.length; k++) {
|
|
436
|
+
//triangle[k] = "1/1/1"
|
|
437
|
+
//Split the data for getting position, uv, and normals
|
|
438
|
+
const point = this._triangles[k].split("/"); // ["1", "1", "1"]
|
|
439
|
+
// Set position indice
|
|
440
|
+
const indicePositionFromObj = parseInt(point[0]) - 1;
|
|
441
|
+
// Set uv indice
|
|
442
|
+
const indiceUvsFromObj = parseInt(point[1]) - 1;
|
|
443
|
+
// Set normal indice
|
|
444
|
+
const indiceNormalFromObj = parseInt(point[2]) - 1;
|
|
445
|
+
this._setData(indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj, this._positions[indicePositionFromObj], this._uvs[indiceUvsFromObj] ?? Vector2.Zero(), this._normals[indiceNormalFromObj] ?? Vector3.Up() //Set the vector for each component
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
//Reset variable for the next line
|
|
449
|
+
this._triangles.length = 0;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Create triangles and push the data for each polygon for the pattern 4
|
|
453
|
+
* In this pattern we get vertice positions and normals
|
|
454
|
+
* @param face
|
|
455
|
+
* @param v
|
|
456
|
+
*/
|
|
457
|
+
_setDataForCurrentFaceWithPattern4(face, v) {
|
|
458
|
+
this._getTriangles(face, v);
|
|
459
|
+
for (let k = 0; k < this._triangles.length; k++) {
|
|
460
|
+
//triangle[k] = "1//1"
|
|
461
|
+
//Split the data for getting position and normals
|
|
462
|
+
const point = this._triangles[k].split("//"); // ["1", "1"]
|
|
463
|
+
// We check indices, and normals
|
|
464
|
+
const indicePositionFromObj = parseInt(point[0]) - 1;
|
|
465
|
+
const indiceNormalFromObj = parseInt(point[1]) - 1;
|
|
466
|
+
this._setData(indicePositionFromObj, 1, //Default value for uv
|
|
467
|
+
indiceNormalFromObj, this._positions[indicePositionFromObj], //Get each vector of data
|
|
468
|
+
Vector2.Zero(), this._normals[indiceNormalFromObj], this._getColor(indicePositionFromObj));
|
|
469
|
+
}
|
|
470
|
+
//Reset variable for the next line
|
|
471
|
+
this._triangles.length = 0;
|
|
472
|
+
}
|
|
473
|
+
/*
|
|
474
|
+
* Create triangles and push the data for each polygon for the pattern 3
|
|
475
|
+
* In this pattern we get vertice positions, uvs and normals
|
|
476
|
+
* @param face
|
|
477
|
+
* @param v
|
|
478
|
+
*/
|
|
479
|
+
_setDataForCurrentFaceWithPattern5(face, v) {
|
|
480
|
+
//Get the indices of triangles for each polygon
|
|
481
|
+
this._getTriangles(face, v);
|
|
482
|
+
for (let k = 0; k < this._triangles.length; k++) {
|
|
483
|
+
//triangle[k] = "-1/-1/-1"
|
|
484
|
+
//Split the data for getting position, uv, and normals
|
|
485
|
+
const point = this._triangles[k].split("/"); // ["-1", "-1", "-1"]
|
|
486
|
+
// Set position indice
|
|
487
|
+
const indicePositionFromObj = this._positions.length + parseInt(point[0]);
|
|
488
|
+
// Set uv indice
|
|
489
|
+
const indiceUvsFromObj = this._uvs.length + parseInt(point[1]);
|
|
490
|
+
// Set normal indice
|
|
491
|
+
const indiceNormalFromObj = this._normals.length + parseInt(point[2]);
|
|
492
|
+
this._setData(indicePositionFromObj, indiceUvsFromObj, indiceNormalFromObj, this._positions[indicePositionFromObj], this._uvs[indiceUvsFromObj], this._normals[indiceNormalFromObj], //Set the vector for each component
|
|
493
|
+
this._getColor(indicePositionFromObj));
|
|
494
|
+
}
|
|
495
|
+
//Reset variable for the next line
|
|
496
|
+
this._triangles.length = 0;
|
|
497
|
+
}
|
|
498
|
+
_addPreviousObjMesh() {
|
|
499
|
+
//Check if it is not the first mesh. Otherwise we don't have data.
|
|
500
|
+
if (this._meshesFromObj.length > 0) {
|
|
501
|
+
//Get the previous mesh for applying the data about the faces
|
|
502
|
+
//=> in obj file, faces definition append after the name of the mesh
|
|
503
|
+
this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];
|
|
504
|
+
//Set the data into Array for the mesh
|
|
505
|
+
this._unwrapData();
|
|
506
|
+
if (this._loadingOptions.useLegacyBehavior) {
|
|
507
|
+
// Reverse tab. Otherwise face are displayed in the wrong sens
|
|
508
|
+
this._indicesForBabylon.reverse();
|
|
509
|
+
}
|
|
510
|
+
//Set the information for the mesh
|
|
511
|
+
//Slice the array to avoid rewriting because of the fact this is the same var which be rewrited
|
|
512
|
+
this._handledMesh.indices = this._indicesForBabylon.slice();
|
|
513
|
+
this._handledMesh.positions = this._unwrappedPositionsForBabylon.slice();
|
|
514
|
+
this._handledMesh.normals = this._unwrappedNormalsForBabylon.slice();
|
|
515
|
+
this._handledMesh.uvs = this._unwrappedUVForBabylon.slice();
|
|
516
|
+
this._handledMesh.hasLines = this._hasLineData;
|
|
517
|
+
if (this._loadingOptions.importVertexColors) {
|
|
518
|
+
this._handledMesh.colors = this._unwrappedColorsForBabylon.slice();
|
|
519
|
+
}
|
|
520
|
+
//Reset the array for the next mesh
|
|
521
|
+
this._indicesForBabylon.length = 0;
|
|
522
|
+
this._unwrappedPositionsForBabylon.length = 0;
|
|
523
|
+
this._unwrappedColorsForBabylon.length = 0;
|
|
524
|
+
this._unwrappedNormalsForBabylon.length = 0;
|
|
525
|
+
this._unwrappedUVForBabylon.length = 0;
|
|
526
|
+
this._hasLineData = false;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
_optimizeNormals(mesh) {
|
|
530
|
+
const positions = mesh.getVerticesData(VertexBuffer.PositionKind);
|
|
531
|
+
const normals = mesh.getVerticesData(VertexBuffer.NormalKind);
|
|
532
|
+
const mapVertices = {};
|
|
533
|
+
if (!positions || !normals) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
for (let i = 0; i < positions.length / 3; i++) {
|
|
537
|
+
const x = positions[i * 3 + 0];
|
|
538
|
+
const y = positions[i * 3 + 1];
|
|
539
|
+
const z = positions[i * 3 + 2];
|
|
540
|
+
const key = x + "_" + y + "_" + z;
|
|
541
|
+
let lst = mapVertices[key];
|
|
542
|
+
if (!lst) {
|
|
543
|
+
lst = [];
|
|
544
|
+
mapVertices[key] = lst;
|
|
545
|
+
}
|
|
546
|
+
lst.push(i);
|
|
547
|
+
}
|
|
548
|
+
const normal = new Vector3();
|
|
549
|
+
for (const key in mapVertices) {
|
|
550
|
+
const lst = mapVertices[key];
|
|
551
|
+
if (lst.length < 2) {
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
const v0Idx = lst[0];
|
|
555
|
+
for (let i = 1; i < lst.length; ++i) {
|
|
556
|
+
const vIdx = lst[i];
|
|
557
|
+
normals[v0Idx * 3 + 0] += normals[vIdx * 3 + 0];
|
|
558
|
+
normals[v0Idx * 3 + 1] += normals[vIdx * 3 + 1];
|
|
559
|
+
normals[v0Idx * 3 + 2] += normals[vIdx * 3 + 2];
|
|
560
|
+
}
|
|
561
|
+
normal.copyFromFloats(normals[v0Idx * 3 + 0], normals[v0Idx * 3 + 1], normals[v0Idx * 3 + 2]);
|
|
562
|
+
normal.normalize();
|
|
563
|
+
for (let i = 0; i < lst.length; ++i) {
|
|
564
|
+
const vIdx = lst[i];
|
|
565
|
+
normals[vIdx * 3 + 0] = normal.x;
|
|
566
|
+
normals[vIdx * 3 + 1] = normal.y;
|
|
567
|
+
normals[vIdx * 3 + 2] = normal.z;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
mesh.setVerticesData(VertexBuffer.NormalKind, normals);
|
|
571
|
+
}
|
|
572
|
+
static _IsLineElement(line) {
|
|
573
|
+
return line.startsWith("l");
|
|
574
|
+
}
|
|
575
|
+
static _IsObjectElement(line) {
|
|
576
|
+
return line.startsWith("o");
|
|
577
|
+
}
|
|
578
|
+
static _IsGroupElement(line) {
|
|
579
|
+
return line.startsWith("g");
|
|
580
|
+
}
|
|
581
|
+
static _GetZbrushMRGB(line, notParse) {
|
|
582
|
+
if (!line.startsWith("mrgb"))
|
|
583
|
+
return null;
|
|
584
|
+
line = line.replace("mrgb", "").trim();
|
|
585
|
+
// if include vertex color , not load mrgb anymore
|
|
586
|
+
if (notParse)
|
|
587
|
+
return [];
|
|
588
|
+
const regex = /[a-z0-9]/g;
|
|
589
|
+
const regArray = line.match(regex);
|
|
590
|
+
if (!regArray || regArray.length % 8 !== 0) {
|
|
591
|
+
return [];
|
|
592
|
+
}
|
|
593
|
+
const array = [];
|
|
594
|
+
for (let regIndex = 0; regIndex < regArray.length / 8; regIndex++) {
|
|
595
|
+
//each item is MMRRGGBB, m is material index
|
|
596
|
+
// const m = regArray[regIndex * 8 + 0] + regArray[regIndex * 8 + 1];
|
|
597
|
+
const r = regArray[regIndex * 8 + 2] + regArray[regIndex * 8 + 3];
|
|
598
|
+
const g = regArray[regIndex * 8 + 4] + regArray[regIndex * 8 + 5];
|
|
599
|
+
const b = regArray[regIndex * 8 + 6] + regArray[regIndex * 8 + 7];
|
|
600
|
+
array.push(new Color4(parseInt(r, 16) / 255, parseInt(g, 16) / 255, parseInt(b, 16) / 255, 1));
|
|
601
|
+
}
|
|
602
|
+
return array;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Function used to parse an OBJ string
|
|
606
|
+
* @param meshesNames defines the list of meshes to load (all if not defined)
|
|
607
|
+
* @param data defines the OBJ string
|
|
608
|
+
* @param scene defines the hosting scene
|
|
609
|
+
* @param assetContainer defines the asset container to load data in
|
|
610
|
+
* @param onFileToLoadFound defines a callback that will be called if a MTL file is found
|
|
611
|
+
*/
|
|
612
|
+
parse(meshesNames, data, scene, assetContainer, onFileToLoadFound) {
|
|
613
|
+
//Move Santitize here to forbid delete zbrush data
|
|
614
|
+
// Sanitize data
|
|
615
|
+
data = data.replace(/#MRGB/g, "mrgb");
|
|
616
|
+
data = data.replace(/#.*$/gm, "").trim();
|
|
617
|
+
if (this._loadingOptions.useLegacyBehavior) {
|
|
618
|
+
this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);
|
|
619
|
+
this._handednessSign = 1;
|
|
620
|
+
}
|
|
621
|
+
else if (scene.useRightHandedSystem) {
|
|
622
|
+
this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex + 1], faces[faceIndex]);
|
|
623
|
+
this._handednessSign = 1;
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
this._pushTriangle = (faces, faceIndex) => this._triangles.push(faces[0], faces[faceIndex], faces[faceIndex + 1]);
|
|
627
|
+
this._handednessSign = -1;
|
|
628
|
+
}
|
|
629
|
+
// Split the file into lines
|
|
630
|
+
// Preprocess line data
|
|
631
|
+
const linesOBJ = data.split("\n");
|
|
632
|
+
const lineLines = [];
|
|
633
|
+
let currentGroup = [];
|
|
634
|
+
lineLines.push(currentGroup);
|
|
635
|
+
for (let i = 0; i < linesOBJ.length; i++) {
|
|
636
|
+
const line = linesOBJ[i].trim().replace(/\s\s/g, " ");
|
|
637
|
+
// Comment or newLine
|
|
638
|
+
if (line.length === 0 || line.charAt(0) === "#") {
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
if (SolidParser._IsGroupElement(line) || SolidParser._IsObjectElement(line)) {
|
|
642
|
+
currentGroup = [];
|
|
643
|
+
lineLines.push(currentGroup);
|
|
644
|
+
}
|
|
645
|
+
if (SolidParser._IsLineElement(line)) {
|
|
646
|
+
const lineValues = line.split(" ");
|
|
647
|
+
// create line elements with two vertices only
|
|
648
|
+
for (let i = 1; i < lineValues.length - 1; i++) {
|
|
649
|
+
currentGroup.push(`l ${lineValues[i]} ${lineValues[i + 1]}`);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
currentGroup.push(line);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
const lines = lineLines.flat();
|
|
657
|
+
// Look at each line
|
|
658
|
+
for (let i = 0; i < lines.length; i++) {
|
|
659
|
+
const line = lines[i].trim().replace(/\s\s/g, " ");
|
|
660
|
+
let result;
|
|
661
|
+
// Comment or newLine
|
|
662
|
+
if (line.length === 0 || line.charAt(0) === "#") {
|
|
663
|
+
continue;
|
|
664
|
+
}
|
|
665
|
+
else if (SolidParser.VertexPattern.test(line)) {
|
|
666
|
+
//Get information about one position possible for the vertices
|
|
667
|
+
result = line.match(/[^ ]+/g); // match will return non-null due to passing regex pattern
|
|
668
|
+
// Value of result with line: "v 1.0 2.0 3.0"
|
|
669
|
+
// ["v", "1.0", "2.0", "3.0"]
|
|
670
|
+
// Create a Vector3 with the position x, y, z
|
|
671
|
+
this._positions.push(new Vector3(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));
|
|
672
|
+
if (this._loadingOptions.importVertexColors) {
|
|
673
|
+
if (result.length >= 7) {
|
|
674
|
+
const r = parseFloat(result[4]);
|
|
675
|
+
const g = parseFloat(result[5]);
|
|
676
|
+
const b = parseFloat(result[6]);
|
|
677
|
+
this._colors.push(new Color4(r > 1 ? r / 255 : r, g > 1 ? g / 255 : g, b > 1 ? b / 255 : b, result.length === 7 || result[7] === undefined ? 1 : parseFloat(result[7])));
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
// TODO: maybe push NULL and if all are NULL to skip (and remove grayColor var).
|
|
681
|
+
this._colors.push(this._grayColor);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
else if ((result = SolidParser.NormalPattern.exec(line)) !== null) {
|
|
686
|
+
//Create a Vector3 with the normals x, y, z
|
|
687
|
+
//Value of result
|
|
688
|
+
// ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
|
|
689
|
+
//Add the Vector in the list of normals
|
|
690
|
+
this._normals.push(new Vector3(parseFloat(result[1]), parseFloat(result[2]), parseFloat(result[3])));
|
|
691
|
+
}
|
|
692
|
+
else if ((result = SolidParser.UVPattern.exec(line)) !== null) {
|
|
693
|
+
//Create a Vector2 with the normals u, v
|
|
694
|
+
//Value of result
|
|
695
|
+
// ["vt 0.1 0.2 0.3", "0.1", "0.2"]
|
|
696
|
+
//Add the Vector in the list of uvs
|
|
697
|
+
this._uvs.push(new Vector2(parseFloat(result[1]) * this._loadingOptions.UVScaling.x, parseFloat(result[2]) * this._loadingOptions.UVScaling.y));
|
|
698
|
+
//Identify patterns of faces
|
|
699
|
+
//Face could be defined in different type of pattern
|
|
700
|
+
}
|
|
701
|
+
else if ((result = SolidParser.FacePattern3.exec(line)) !== null) {
|
|
702
|
+
//Value of result:
|
|
703
|
+
//["f 1/1/1 2/2/2 3/3/3", "1/1/1 2/2/2 3/3/3"...]
|
|
704
|
+
//Set the data for this face
|
|
705
|
+
this._setDataForCurrentFaceWithPattern3(result[1].trim().split(" "), // ["1/1/1", "2/2/2", "3/3/3"]
|
|
706
|
+
1);
|
|
707
|
+
}
|
|
708
|
+
else if ((result = SolidParser.FacePattern4.exec(line)) !== null) {
|
|
709
|
+
//Value of result:
|
|
710
|
+
//["f 1//1 2//2 3//3", "1//1 2//2 3//3"...]
|
|
711
|
+
//Set the data for this face
|
|
712
|
+
this._setDataForCurrentFaceWithPattern4(result[1].trim().split(" "), // ["1//1", "2//2", "3//3"]
|
|
713
|
+
1);
|
|
714
|
+
}
|
|
715
|
+
else if ((result = SolidParser.FacePattern5.exec(line)) !== null) {
|
|
716
|
+
//Value of result:
|
|
717
|
+
//["f -1/-1/-1 -2/-2/-2 -3/-3/-3", "-1/-1/-1 -2/-2/-2 -3/-3/-3"...]
|
|
718
|
+
//Set the data for this face
|
|
719
|
+
this._setDataForCurrentFaceWithPattern5(result[1].trim().split(" "), // ["-1/-1/-1", "-2/-2/-2", "-3/-3/-3"]
|
|
720
|
+
1);
|
|
721
|
+
}
|
|
722
|
+
else if ((result = SolidParser.FacePattern2.exec(line)) !== null) {
|
|
723
|
+
//Value of result:
|
|
724
|
+
//["f 1/1 2/2 3/3", "1/1 2/2 3/3"...]
|
|
725
|
+
//Set the data for this face
|
|
726
|
+
this._setDataForCurrentFaceWithPattern2(result[1].trim().split(" "), // ["1/1", "2/2", "3/3"]
|
|
727
|
+
1);
|
|
728
|
+
}
|
|
729
|
+
else if ((result = SolidParser.FacePattern1.exec(line)) !== null) {
|
|
730
|
+
//Value of result
|
|
731
|
+
//["f 1 2 3", "1 2 3"...]
|
|
732
|
+
//Set the data for this face
|
|
733
|
+
this._setDataForCurrentFaceWithPattern1(result[1].trim().split(" "), // ["1", "2", "3"]
|
|
734
|
+
1);
|
|
735
|
+
// Define a mesh or an object
|
|
736
|
+
// Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh
|
|
737
|
+
}
|
|
738
|
+
else if ((result = SolidParser.LinePattern1.exec(line)) !== null) {
|
|
739
|
+
//Value of result
|
|
740
|
+
//["l 1 2"]
|
|
741
|
+
//Set the data for this face
|
|
742
|
+
this._setDataForCurrentFaceWithPattern1(result[1].trim().split(" "), // ["1", "2"]
|
|
743
|
+
0);
|
|
744
|
+
this._hasLineData = true;
|
|
745
|
+
// Define a mesh or an object
|
|
746
|
+
// Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh
|
|
747
|
+
}
|
|
748
|
+
else if ((result = SolidParser.LinePattern2.exec(line)) !== null) {
|
|
749
|
+
//Value of result
|
|
750
|
+
//["l 1/1 2/2"]
|
|
751
|
+
//Set the data for this face
|
|
752
|
+
this._setDataForCurrentFaceWithPattern2(result[1].trim().split(" "), // ["1/1", "2/2"]
|
|
753
|
+
0);
|
|
754
|
+
this._hasLineData = true;
|
|
755
|
+
// Define a mesh or an object
|
|
756
|
+
// Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh
|
|
757
|
+
}
|
|
758
|
+
else if ((result = SolidParser._GetZbrushMRGB(line, !this._loadingOptions.importVertexColors))) {
|
|
759
|
+
result.forEach((element) => {
|
|
760
|
+
this._extColors.push(element);
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
else if ((result = SolidParser.LinePattern3.exec(line)) !== null) {
|
|
764
|
+
//Value of result
|
|
765
|
+
//["l 1/1/1 2/2/2"]
|
|
766
|
+
//Set the data for this face
|
|
767
|
+
this._setDataForCurrentFaceWithPattern3(result[1].trim().split(" "), // ["1/1/1", "2/2/2"]
|
|
768
|
+
0);
|
|
769
|
+
this._hasLineData = true;
|
|
770
|
+
// Define a mesh or an object
|
|
771
|
+
// Each time this keyword is analyzed, create a new Object with all data for creating a babylonMesh
|
|
772
|
+
}
|
|
773
|
+
else if (SolidParser.GroupDescriptor.test(line) || SolidParser.ObjectDescriptor.test(line)) {
|
|
774
|
+
// Create a new mesh corresponding to the name of the group.
|
|
775
|
+
// Definition of the mesh
|
|
776
|
+
const objMesh = {
|
|
777
|
+
name: line.substring(2).trim(), //Set the name of the current obj mesh
|
|
778
|
+
indices: null,
|
|
779
|
+
positions: null,
|
|
780
|
+
normals: null,
|
|
781
|
+
uvs: null,
|
|
782
|
+
colors: null,
|
|
783
|
+
materialName: this._materialNameFromObj,
|
|
784
|
+
isObject: SolidParser.ObjectDescriptor.test(line),
|
|
785
|
+
};
|
|
786
|
+
this._addPreviousObjMesh();
|
|
787
|
+
//Push the last mesh created with only the name
|
|
788
|
+
this._meshesFromObj.push(objMesh);
|
|
789
|
+
//Set this variable to indicate that now meshesFromObj has objects defined inside
|
|
790
|
+
this._hasMeshes = true;
|
|
791
|
+
this._isFirstMaterial = true;
|
|
792
|
+
this._increment = 1;
|
|
793
|
+
//Keyword for applying a material
|
|
794
|
+
}
|
|
795
|
+
else if (SolidParser.UseMtlDescriptor.test(line)) {
|
|
796
|
+
//Get the name of the material
|
|
797
|
+
this._materialNameFromObj = line.substring(7).trim();
|
|
798
|
+
//If this new material is in the same mesh
|
|
799
|
+
if (!this._isFirstMaterial || !this._hasMeshes) {
|
|
800
|
+
//Set the data for the previous mesh
|
|
801
|
+
this._addPreviousObjMesh();
|
|
802
|
+
//Create a new mesh
|
|
803
|
+
const objMesh =
|
|
804
|
+
//Set the name of the current obj mesh
|
|
805
|
+
{
|
|
806
|
+
name: (this._objMeshName || "mesh") + "_mm" + this._increment.toString(), //Set the name of the current obj mesh
|
|
807
|
+
indices: null,
|
|
808
|
+
positions: null,
|
|
809
|
+
normals: null,
|
|
810
|
+
uvs: null,
|
|
811
|
+
colors: null,
|
|
812
|
+
materialName: this._materialNameFromObj,
|
|
813
|
+
isObject: false,
|
|
814
|
+
};
|
|
815
|
+
this._increment++;
|
|
816
|
+
//If meshes are already defined
|
|
817
|
+
this._meshesFromObj.push(objMesh);
|
|
818
|
+
this._hasMeshes = true;
|
|
819
|
+
}
|
|
820
|
+
//Set the material name if the previous line define a mesh
|
|
821
|
+
if (this._hasMeshes && this._isFirstMaterial) {
|
|
822
|
+
//Set the material name to the previous mesh (1 material per mesh)
|
|
823
|
+
this._meshesFromObj[this._meshesFromObj.length - 1].materialName = this._materialNameFromObj;
|
|
824
|
+
this._isFirstMaterial = false;
|
|
825
|
+
}
|
|
826
|
+
// Keyword for loading the mtl file
|
|
827
|
+
}
|
|
828
|
+
else if (SolidParser.MtlLibGroupDescriptor.test(line)) {
|
|
829
|
+
// Get the name of mtl file
|
|
830
|
+
onFileToLoadFound(line.substring(7).trim());
|
|
831
|
+
// Apply smoothing
|
|
832
|
+
}
|
|
833
|
+
else if (SolidParser.SmoothDescriptor.test(line)) ;
|
|
834
|
+
else {
|
|
835
|
+
//If there is another possibility
|
|
836
|
+
Logger.Log("Unhandled expression at line : " + line);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
// At the end of the file, add the last mesh into the meshesFromObj array
|
|
840
|
+
if (this._hasMeshes) {
|
|
841
|
+
// Set the data for the last mesh
|
|
842
|
+
this._handledMesh = this._meshesFromObj[this._meshesFromObj.length - 1];
|
|
843
|
+
if (this._loadingOptions.useLegacyBehavior) {
|
|
844
|
+
//Reverse indices for displaying faces in the good sense
|
|
845
|
+
this._indicesForBabylon.reverse();
|
|
846
|
+
}
|
|
847
|
+
//Get the good array
|
|
848
|
+
this._unwrapData();
|
|
849
|
+
//Set array
|
|
850
|
+
this._handledMesh.indices = this._indicesForBabylon;
|
|
851
|
+
this._handledMesh.positions = this._unwrappedPositionsForBabylon;
|
|
852
|
+
this._handledMesh.normals = this._unwrappedNormalsForBabylon;
|
|
853
|
+
this._handledMesh.uvs = this._unwrappedUVForBabylon;
|
|
854
|
+
this._handledMesh.hasLines = this._hasLineData;
|
|
855
|
+
if (this._loadingOptions.importVertexColors) {
|
|
856
|
+
this._handledMesh.colors = this._unwrappedColorsForBabylon;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
// If any o or g keyword not found, create a mesh with a random id
|
|
860
|
+
if (!this._hasMeshes) {
|
|
861
|
+
let newMaterial = null;
|
|
862
|
+
if (this._indicesForBabylon.length) {
|
|
863
|
+
if (this._loadingOptions.useLegacyBehavior) {
|
|
864
|
+
// reverse tab of indices
|
|
865
|
+
this._indicesForBabylon.reverse();
|
|
866
|
+
}
|
|
867
|
+
//Get positions normals uvs
|
|
868
|
+
this._unwrapData();
|
|
869
|
+
}
|
|
870
|
+
else {
|
|
871
|
+
// There is no indices in the file. We will have to switch to point cloud rendering
|
|
872
|
+
for (const pos of this._positions) {
|
|
873
|
+
this._unwrappedPositionsForBabylon.push(pos.x, pos.y, pos.z);
|
|
874
|
+
}
|
|
875
|
+
if (this._normals.length) {
|
|
876
|
+
for (const normal of this._normals) {
|
|
877
|
+
this._unwrappedNormalsForBabylon.push(normal.x, normal.y, normal.z);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
if (this._uvs.length) {
|
|
881
|
+
for (const uv of this._uvs) {
|
|
882
|
+
this._unwrappedUVForBabylon.push(uv.x, uv.y);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
if (this._extColors.length) {
|
|
886
|
+
for (const color of this._extColors) {
|
|
887
|
+
this._unwrappedColorsForBabylon.push(color.r, color.g, color.b, color.a);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
else {
|
|
891
|
+
if (this._colors.length) {
|
|
892
|
+
for (const color of this._colors) {
|
|
893
|
+
this._unwrappedColorsForBabylon.push(color.r, color.g, color.b, color.a);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
if (!this._materialNameFromObj) {
|
|
898
|
+
// Create a material with point cloud on
|
|
899
|
+
newMaterial = new StandardMaterial(Geometry.RandomId(), scene);
|
|
900
|
+
newMaterial.pointsCloud = true;
|
|
901
|
+
this._materialNameFromObj = newMaterial.name;
|
|
902
|
+
if (!this._normals.length) {
|
|
903
|
+
newMaterial.disableLighting = true;
|
|
904
|
+
newMaterial.emissiveColor = Color3.White();
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
//Set data for one mesh
|
|
909
|
+
this._meshesFromObj.push({
|
|
910
|
+
name: Geometry.RandomId(),
|
|
911
|
+
indices: this._indicesForBabylon,
|
|
912
|
+
positions: this._unwrappedPositionsForBabylon,
|
|
913
|
+
colors: this._unwrappedColorsForBabylon,
|
|
914
|
+
normals: this._unwrappedNormalsForBabylon,
|
|
915
|
+
uvs: this._unwrappedUVForBabylon,
|
|
916
|
+
materialName: this._materialNameFromObj,
|
|
917
|
+
directMaterial: newMaterial,
|
|
918
|
+
isObject: true,
|
|
919
|
+
hasLines: this._hasLineData,
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
//Set data for each mesh
|
|
923
|
+
for (let j = 0; j < this._meshesFromObj.length; j++) {
|
|
924
|
+
//check meshesNames (stlFileLoader)
|
|
925
|
+
if (meshesNames && this._meshesFromObj[j].name) {
|
|
926
|
+
if (meshesNames instanceof Array) {
|
|
927
|
+
if (meshesNames.indexOf(this._meshesFromObj[j].name) === -1) {
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
else {
|
|
932
|
+
if (this._meshesFromObj[j].name !== meshesNames) {
|
|
933
|
+
continue;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
//Get the current mesh
|
|
938
|
+
//Set the data with VertexBuffer for each mesh
|
|
939
|
+
this._handledMesh = this._meshesFromObj[j];
|
|
940
|
+
//Create a Mesh with the name of the obj mesh
|
|
941
|
+
scene._blockEntityCollection = !!assetContainer;
|
|
942
|
+
const babylonMesh = new Mesh(this._meshesFromObj[j].name, scene);
|
|
943
|
+
babylonMesh._parentContainer = assetContainer;
|
|
944
|
+
scene._blockEntityCollection = false;
|
|
945
|
+
this._handledMesh._babylonMesh = babylonMesh;
|
|
946
|
+
// If this is a group mesh, it should have an object mesh as a parent. So look for the first object mesh that appears before it.
|
|
947
|
+
if (!this._handledMesh.isObject) {
|
|
948
|
+
for (let k = j - 1; k >= 0; --k) {
|
|
949
|
+
if (this._meshesFromObj[k].isObject && this._meshesFromObj[k]._babylonMesh) {
|
|
950
|
+
babylonMesh.parent = this._meshesFromObj[k]._babylonMesh;
|
|
951
|
+
break;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
//Push the name of the material to an array
|
|
956
|
+
//This is indispensable for the importMesh function
|
|
957
|
+
this._materialToUse.push(this._meshesFromObj[j].materialName);
|
|
958
|
+
//If the mesh is a line mesh
|
|
959
|
+
if (this._handledMesh.hasLines) {
|
|
960
|
+
babylonMesh._internalMetadata ??= {};
|
|
961
|
+
babylonMesh._internalMetadata["_isLine"] = true; //this is a line mesh
|
|
962
|
+
}
|
|
963
|
+
if (this._handledMesh.positions?.length === 0) {
|
|
964
|
+
//Push the mesh into an array
|
|
965
|
+
this._babylonMeshesArray.push(babylonMesh);
|
|
966
|
+
continue;
|
|
967
|
+
}
|
|
968
|
+
const vertexData = new VertexData(); //The container for the values
|
|
969
|
+
//Set the data for the babylonMesh
|
|
970
|
+
vertexData.uvs = this._handledMesh.uvs;
|
|
971
|
+
vertexData.indices = this._handledMesh.indices;
|
|
972
|
+
vertexData.positions = this._handledMesh.positions;
|
|
973
|
+
if (this._loadingOptions.computeNormals) {
|
|
974
|
+
const normals = new Array();
|
|
975
|
+
VertexData.ComputeNormals(this._handledMesh.positions, this._handledMesh.indices, normals);
|
|
976
|
+
vertexData.normals = normals;
|
|
977
|
+
}
|
|
978
|
+
else {
|
|
979
|
+
vertexData.normals = this._handledMesh.normals;
|
|
980
|
+
}
|
|
981
|
+
if (this._loadingOptions.importVertexColors) {
|
|
982
|
+
vertexData.colors = this._handledMesh.colors;
|
|
983
|
+
}
|
|
984
|
+
//Set the data from the VertexBuffer to the current Mesh
|
|
985
|
+
vertexData.applyToMesh(babylonMesh);
|
|
986
|
+
if (this._loadingOptions.invertY) {
|
|
987
|
+
babylonMesh.scaling.y *= -1;
|
|
988
|
+
}
|
|
989
|
+
if (this._loadingOptions.optimizeNormals) {
|
|
990
|
+
this._optimizeNormals(babylonMesh);
|
|
991
|
+
}
|
|
992
|
+
//Push the mesh into an array
|
|
993
|
+
this._babylonMeshesArray.push(babylonMesh);
|
|
994
|
+
if (this._handledMesh.directMaterial) {
|
|
995
|
+
babylonMesh.material = this._handledMesh.directMaterial;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
// Descriptor
|
|
1001
|
+
/** Object descriptor */
|
|
1002
|
+
SolidParser.ObjectDescriptor = /^o/;
|
|
1003
|
+
/** Group descriptor */
|
|
1004
|
+
SolidParser.GroupDescriptor = /^g/;
|
|
1005
|
+
/** Material lib descriptor */
|
|
1006
|
+
SolidParser.MtlLibGroupDescriptor = /^mtllib /;
|
|
1007
|
+
/** Use a material descriptor */
|
|
1008
|
+
SolidParser.UseMtlDescriptor = /^usemtl /;
|
|
1009
|
+
/** Smooth descriptor */
|
|
1010
|
+
SolidParser.SmoothDescriptor = /^s /;
|
|
1011
|
+
// Patterns
|
|
1012
|
+
/** Pattern used to detect a vertex */
|
|
1013
|
+
SolidParser.VertexPattern = /^v(\s+[\d|.|+|\-|e|E]+){3,7}/;
|
|
1014
|
+
/** Pattern used to detect a normal */
|
|
1015
|
+
SolidParser.NormalPattern = /^vn(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/;
|
|
1016
|
+
/** Pattern used to detect a UV set */
|
|
1017
|
+
SolidParser.UVPattern = /^vt(\s+[\d|.|+|\-|e|E]+)( +[\d|.|+|\-|e|E]+)/;
|
|
1018
|
+
/** Pattern used to detect a first kind of face (f vertex vertex vertex) */
|
|
1019
|
+
SolidParser.FacePattern1 = /^f\s+(([\d]{1,}[\s]?){3,})+/;
|
|
1020
|
+
/** Pattern used to detect a second kind of face (f vertex/uvs vertex/uvs vertex/uvs) */
|
|
1021
|
+
SolidParser.FacePattern2 = /^f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/;
|
|
1022
|
+
/** Pattern used to detect a third kind of face (f vertex/uvs/normal vertex/uvs/normal vertex/uvs/normal) */
|
|
1023
|
+
SolidParser.FacePattern3 = /^f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/;
|
|
1024
|
+
/** Pattern used to detect a fourth kind of face (f vertex//normal vertex//normal vertex//normal)*/
|
|
1025
|
+
SolidParser.FacePattern4 = /^f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/;
|
|
1026
|
+
/** Pattern used to detect a fifth kind of face (f -vertex/-uvs/-normal -vertex/-uvs/-normal -vertex/-uvs/-normal) */
|
|
1027
|
+
SolidParser.FacePattern5 = /^f\s+(((-[\d]{1,}\/-[\d]{1,}\/-[\d]{1,}[\s]?){3,})+)/;
|
|
1028
|
+
/** Pattern used to detect a line(l vertex vertex) */
|
|
1029
|
+
SolidParser.LinePattern1 = /^l\s+(([\d]{1,}[\s]?){2,})+/;
|
|
1030
|
+
/** Pattern used to detect a second kind of line (l vertex/uvs vertex/uvs) */
|
|
1031
|
+
SolidParser.LinePattern2 = /^l\s+((([\d]{1,}\/[\d]{1,}[\s]?){2,})+)/;
|
|
1032
|
+
/** Pattern used to detect a third kind of line (l vertex/uvs/normal vertex/uvs/normal) */
|
|
1033
|
+
SolidParser.LinePattern3 = /^l\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){2,})+)/;
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* OBJ file type loader.
|
|
1037
|
+
* This is a babylon scene loader plugin.
|
|
1038
|
+
*/
|
|
1039
|
+
class OBJFileLoader {
|
|
1040
|
+
/**
|
|
1041
|
+
* Invert Y-Axis of referenced textures on load
|
|
1042
|
+
*/
|
|
1043
|
+
static get INVERT_TEXTURE_Y() {
|
|
1044
|
+
return MTLFileLoader.INVERT_TEXTURE_Y;
|
|
1045
|
+
}
|
|
1046
|
+
static set INVERT_TEXTURE_Y(value) {
|
|
1047
|
+
MTLFileLoader.INVERT_TEXTURE_Y = value;
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Creates loader for .OBJ files
|
|
1051
|
+
*
|
|
1052
|
+
* @param loadingOptions options for loading and parsing OBJ/MTL files.
|
|
1053
|
+
*/
|
|
1054
|
+
constructor(loadingOptions) {
|
|
1055
|
+
/**
|
|
1056
|
+
* Defines the name of the plugin.
|
|
1057
|
+
*/
|
|
1058
|
+
this.name = OBJFileLoaderMetadata.name;
|
|
1059
|
+
/**
|
|
1060
|
+
* Defines the extension the plugin is able to load.
|
|
1061
|
+
*/
|
|
1062
|
+
this.extensions = OBJFileLoaderMetadata.extensions;
|
|
1063
|
+
this._assetContainer = null;
|
|
1064
|
+
this._loadingOptions = loadingOptions || OBJFileLoader._DefaultLoadingOptions;
|
|
1065
|
+
}
|
|
1066
|
+
static get _DefaultLoadingOptions() {
|
|
1067
|
+
return {
|
|
1068
|
+
computeNormals: OBJFileLoader.COMPUTE_NORMALS,
|
|
1069
|
+
optimizeNormals: OBJFileLoader.OPTIMIZE_NORMALS,
|
|
1070
|
+
importVertexColors: OBJFileLoader.IMPORT_VERTEX_COLORS,
|
|
1071
|
+
invertY: OBJFileLoader.INVERT_Y,
|
|
1072
|
+
invertTextureY: OBJFileLoader.INVERT_TEXTURE_Y,
|
|
1073
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1074
|
+
UVScaling: OBJFileLoader.UV_SCALING,
|
|
1075
|
+
materialLoadingFailsSilently: OBJFileLoader.MATERIAL_LOADING_FAILS_SILENTLY,
|
|
1076
|
+
optimizeWithUV: OBJFileLoader.OPTIMIZE_WITH_UV,
|
|
1077
|
+
skipMaterials: OBJFileLoader.SKIP_MATERIALS,
|
|
1078
|
+
useLegacyBehavior: OBJFileLoader.USE_LEGACY_BEHAVIOR,
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Calls synchronously the MTL file attached to this obj.
|
|
1083
|
+
* Load function or importMesh function don't enable to load 2 files in the same time asynchronously.
|
|
1084
|
+
* Without this function materials are not displayed in the first frame (but displayed after).
|
|
1085
|
+
* In consequence it is impossible to get material information in your HTML file
|
|
1086
|
+
*
|
|
1087
|
+
* @param url The URL of the MTL file
|
|
1088
|
+
* @param rootUrl defines where to load data from
|
|
1089
|
+
* @param onSuccess Callback function to be called when the MTL file is loaded
|
|
1090
|
+
* @param onFailure
|
|
1091
|
+
*/
|
|
1092
|
+
_loadMTL(url, rootUrl, onSuccess, onFailure) {
|
|
1093
|
+
//The complete path to the mtl file
|
|
1094
|
+
const pathOfFile = rootUrl + url;
|
|
1095
|
+
// Loads through the babylon tools to allow fileInput search.
|
|
1096
|
+
Tools.LoadFile(pathOfFile, onSuccess, undefined, undefined, false, (request, exception) => {
|
|
1097
|
+
onFailure(pathOfFile, exception);
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Instantiates a OBJ file loader plugin.
|
|
1102
|
+
* @returns the created plugin
|
|
1103
|
+
*/
|
|
1104
|
+
createPlugin() {
|
|
1105
|
+
return new OBJFileLoader(OBJFileLoader._DefaultLoadingOptions);
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* If the data string can be loaded directly.
|
|
1109
|
+
* @returns if the data can be loaded directly
|
|
1110
|
+
*/
|
|
1111
|
+
canDirectLoad() {
|
|
1112
|
+
return false;
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Imports one or more meshes from the loaded OBJ data and adds them to the scene
|
|
1116
|
+
* @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
|
|
1117
|
+
* @param scene the scene the meshes should be added to
|
|
1118
|
+
* @param data the OBJ data to load
|
|
1119
|
+
* @param rootUrl root url to load from
|
|
1120
|
+
* @returns a promise containing the loaded meshes, particles, skeletons and animations
|
|
1121
|
+
*/
|
|
1122
|
+
importMeshAsync(meshesNames, scene, data, rootUrl) {
|
|
1123
|
+
//get the meshes from OBJ file
|
|
1124
|
+
return this._parseSolid(meshesNames, scene, data, rootUrl).then((meshes) => {
|
|
1125
|
+
return {
|
|
1126
|
+
meshes: meshes,
|
|
1127
|
+
particleSystems: [],
|
|
1128
|
+
skeletons: [],
|
|
1129
|
+
animationGroups: [],
|
|
1130
|
+
transformNodes: [],
|
|
1131
|
+
geometries: [],
|
|
1132
|
+
lights: [],
|
|
1133
|
+
spriteManagers: [],
|
|
1134
|
+
};
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Imports all objects from the loaded OBJ data and adds them to the scene
|
|
1139
|
+
* @param scene the scene the objects should be added to
|
|
1140
|
+
* @param data the OBJ data to load
|
|
1141
|
+
* @param rootUrl root url to load from
|
|
1142
|
+
* @returns a promise which completes when objects have been loaded to the scene
|
|
1143
|
+
*/
|
|
1144
|
+
loadAsync(scene, data, rootUrl) {
|
|
1145
|
+
//Get the 3D model
|
|
1146
|
+
return this.importMeshAsync(null, scene, data, rootUrl).then(() => {
|
|
1147
|
+
// return void
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Load into an asset container.
|
|
1152
|
+
* @param scene The scene to load into
|
|
1153
|
+
* @param data The data to import
|
|
1154
|
+
* @param rootUrl The root url for scene and resources
|
|
1155
|
+
* @returns The loaded asset container
|
|
1156
|
+
*/
|
|
1157
|
+
loadAssetContainerAsync(scene, data, rootUrl) {
|
|
1158
|
+
const container = new AssetContainer(scene);
|
|
1159
|
+
this._assetContainer = container;
|
|
1160
|
+
return this.importMeshAsync(null, scene, data, rootUrl)
|
|
1161
|
+
.then((result) => {
|
|
1162
|
+
result.meshes.forEach((mesh) => container.meshes.push(mesh));
|
|
1163
|
+
result.meshes.forEach((mesh) => {
|
|
1164
|
+
const material = mesh.material;
|
|
1165
|
+
if (material) {
|
|
1166
|
+
// Materials
|
|
1167
|
+
if (container.materials.indexOf(material) == -1) {
|
|
1168
|
+
container.materials.push(material);
|
|
1169
|
+
// Textures
|
|
1170
|
+
const textures = material.getActiveTextures();
|
|
1171
|
+
textures.forEach((t) => {
|
|
1172
|
+
if (container.textures.indexOf(t) == -1) {
|
|
1173
|
+
container.textures.push(t);
|
|
1174
|
+
}
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
this._assetContainer = null;
|
|
1180
|
+
return container;
|
|
1181
|
+
})
|
|
1182
|
+
.catch((ex) => {
|
|
1183
|
+
this._assetContainer = null;
|
|
1184
|
+
throw ex;
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Read the OBJ file and create an Array of meshes.
|
|
1189
|
+
* Each mesh contains all information given by the OBJ and the MTL file.
|
|
1190
|
+
* i.e. vertices positions and indices, optional normals values, optional UV values, optional material
|
|
1191
|
+
* @param meshesNames defines a string or array of strings of the mesh names that should be loaded from the file
|
|
1192
|
+
* @param scene defines the scene where are displayed the data
|
|
1193
|
+
* @param data defines the content of the obj file
|
|
1194
|
+
* @param rootUrl defines the path to the folder
|
|
1195
|
+
* @returns the list of loaded meshes
|
|
1196
|
+
*/
|
|
1197
|
+
_parseSolid(meshesNames, scene, data, rootUrl) {
|
|
1198
|
+
let fileToLoad = ""; //The name of the mtlFile to load
|
|
1199
|
+
const materialsFromMTLFile = new MTLFileLoader();
|
|
1200
|
+
const materialToUse = [];
|
|
1201
|
+
const babylonMeshesArray = []; //The mesh for babylon
|
|
1202
|
+
// Sanitize data
|
|
1203
|
+
data = data.replace(/#.*$/gm, "").trim();
|
|
1204
|
+
// Main function
|
|
1205
|
+
const solidParser = new SolidParser(materialToUse, babylonMeshesArray, this._loadingOptions);
|
|
1206
|
+
solidParser.parse(meshesNames, data, scene, this._assetContainer, (fileName) => {
|
|
1207
|
+
fileToLoad = fileName;
|
|
1208
|
+
});
|
|
1209
|
+
// load the materials
|
|
1210
|
+
const mtlPromises = [];
|
|
1211
|
+
// Check if we have a file to load
|
|
1212
|
+
if (fileToLoad !== "" && !this._loadingOptions.skipMaterials) {
|
|
1213
|
+
//Load the file synchronously
|
|
1214
|
+
mtlPromises.push(new Promise((resolve, reject) => {
|
|
1215
|
+
this._loadMTL(fileToLoad, rootUrl, (dataLoaded) => {
|
|
1216
|
+
try {
|
|
1217
|
+
//Create materials thanks MTLLoader function
|
|
1218
|
+
materialsFromMTLFile.parseMTL(scene, dataLoaded, rootUrl, this._assetContainer);
|
|
1219
|
+
//Look at each material loaded in the mtl file
|
|
1220
|
+
for (let n = 0; n < materialsFromMTLFile.materials.length; n++) {
|
|
1221
|
+
//Three variables to get all meshes with the same material
|
|
1222
|
+
let startIndex = 0;
|
|
1223
|
+
const _indices = [];
|
|
1224
|
+
let _index;
|
|
1225
|
+
//The material from MTL file is used in the meshes loaded
|
|
1226
|
+
//Push the indice in an array
|
|
1227
|
+
//Check if the material is not used for another mesh
|
|
1228
|
+
while ((_index = materialToUse.indexOf(materialsFromMTLFile.materials[n].name, startIndex)) > -1) {
|
|
1229
|
+
_indices.push(_index);
|
|
1230
|
+
startIndex = _index + 1;
|
|
1231
|
+
}
|
|
1232
|
+
//If the material is not used dispose it
|
|
1233
|
+
if (_index === -1 && _indices.length === 0) {
|
|
1234
|
+
//If the material is not needed, remove it
|
|
1235
|
+
materialsFromMTLFile.materials[n].dispose();
|
|
1236
|
+
}
|
|
1237
|
+
else {
|
|
1238
|
+
for (let o = 0; o < _indices.length; o++) {
|
|
1239
|
+
//Apply the material to the Mesh for each mesh with the material
|
|
1240
|
+
const mesh = babylonMeshesArray[_indices[o]];
|
|
1241
|
+
const material = materialsFromMTLFile.materials[n];
|
|
1242
|
+
mesh.material = material;
|
|
1243
|
+
if (!mesh.getTotalIndices()) {
|
|
1244
|
+
// No indices, we need to turn on point cloud
|
|
1245
|
+
material.pointsCloud = true;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
resolve();
|
|
1251
|
+
}
|
|
1252
|
+
catch (e) {
|
|
1253
|
+
Tools.Warn(`Error processing MTL file: '${fileToLoad}'`);
|
|
1254
|
+
if (this._loadingOptions.materialLoadingFailsSilently) {
|
|
1255
|
+
resolve();
|
|
1256
|
+
}
|
|
1257
|
+
else {
|
|
1258
|
+
reject(e);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
}, (pathOfFile, exception) => {
|
|
1262
|
+
Tools.Warn(`Error downloading MTL file: '${fileToLoad}'`);
|
|
1263
|
+
if (this._loadingOptions.materialLoadingFailsSilently) {
|
|
1264
|
+
resolve();
|
|
1265
|
+
}
|
|
1266
|
+
else {
|
|
1267
|
+
reject(exception);
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
}));
|
|
1271
|
+
}
|
|
1272
|
+
//Return an array with all Mesh
|
|
1273
|
+
return Promise.all(mtlPromises).then(() => {
|
|
1274
|
+
const isLine = (mesh) => Boolean(mesh._internalMetadata?.["_isLine"] ?? false);
|
|
1275
|
+
// Iterate over the mesh, determine if it is a line mesh, clone or modify the material to line rendering.
|
|
1276
|
+
babylonMeshesArray.forEach((mesh) => {
|
|
1277
|
+
if (isLine(mesh)) {
|
|
1278
|
+
let mat = mesh.material ?? new StandardMaterial(mesh.name + "_line", scene);
|
|
1279
|
+
// If another mesh is using this material and it is not a line then we need to clone it.
|
|
1280
|
+
const needClone = mat.getBindedMeshes().filter((e) => !isLine(e)).length > 0;
|
|
1281
|
+
if (needClone) {
|
|
1282
|
+
mat = mat.clone(mat.name + "_line") ?? mat;
|
|
1283
|
+
}
|
|
1284
|
+
mat.wireframe = true;
|
|
1285
|
+
mesh.material = mat;
|
|
1286
|
+
if (mesh._internalMetadata) {
|
|
1287
|
+
mesh._internalMetadata["_isLine"] = undefined;
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
return babylonMeshesArray;
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Defines if UVs are optimized by default during load.
|
|
1297
|
+
*/
|
|
1298
|
+
OBJFileLoader.OPTIMIZE_WITH_UV = true;
|
|
1299
|
+
/**
|
|
1300
|
+
* Invert model on y-axis (does a model scaling inversion)
|
|
1301
|
+
*/
|
|
1302
|
+
OBJFileLoader.INVERT_Y = false;
|
|
1303
|
+
/**
|
|
1304
|
+
* Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.
|
|
1305
|
+
*/
|
|
1306
|
+
OBJFileLoader.IMPORT_VERTEX_COLORS = false;
|
|
1307
|
+
/**
|
|
1308
|
+
* Compute the normals for the model, even if normals are present in the file.
|
|
1309
|
+
*/
|
|
1310
|
+
OBJFileLoader.COMPUTE_NORMALS = false;
|
|
1311
|
+
/**
|
|
1312
|
+
* Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces.
|
|
1313
|
+
* Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.
|
|
1314
|
+
*/
|
|
1315
|
+
OBJFileLoader.OPTIMIZE_NORMALS = false;
|
|
1316
|
+
/**
|
|
1317
|
+
* Defines custom scaling of UV coordinates of loaded meshes.
|
|
1318
|
+
*/
|
|
1319
|
+
OBJFileLoader.UV_SCALING = new Vector2(1, 1);
|
|
1320
|
+
/**
|
|
1321
|
+
* Skip loading the materials even if defined in the OBJ file (materials are ignored).
|
|
1322
|
+
*/
|
|
1323
|
+
OBJFileLoader.SKIP_MATERIALS = false;
|
|
1324
|
+
/**
|
|
1325
|
+
* When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.
|
|
1326
|
+
*
|
|
1327
|
+
* Defaults to true for backwards compatibility.
|
|
1328
|
+
*/
|
|
1329
|
+
OBJFileLoader.MATERIAL_LOADING_FAILS_SILENTLY = true;
|
|
1330
|
+
/**
|
|
1331
|
+
* Loads assets without handedness conversions. This flag is for compatibility. Use it only if absolutely required. Defaults to false.
|
|
1332
|
+
*/
|
|
1333
|
+
OBJFileLoader.USE_LEGACY_BEHAVIOR = false;
|
|
1334
|
+
//Add this loader into the register plugin
|
|
1335
|
+
registerSceneLoaderPlugin(new OBJFileLoader());
|
|
1336
|
+
|
|
1337
|
+
export { OBJFileLoader };
|
|
1338
|
+
//# sourceMappingURL=objFileLoader-Cda8pwUd.esm.js.map
|