@needle-tools/engine 4.7.2-alpha → 4.7.2-next.099105f
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/CHANGELOG.md +3782 -3782
- package/LICENSE.md +10 -10
- package/README.md +64 -64
- package/components.needle.json +1 -1
- package/dist/generateMeshBVH.worker-BaNp_Xtp.js +25 -0
- package/dist/gltf-progressive-CNdBjvz6.js +1145 -0
- package/dist/gltf-progressive-C_oN6wCA.umd.cjs +8 -0
- package/dist/gltf-progressive-MgWOszRl.min.js +8 -0
- package/dist/{needle-engine.bundle-BhDF-YSv.min.js → needle-engine.bundle-CL0uOHVo.min.js} +108 -107
- package/dist/{needle-engine.bundle-gp00DTS4.js → needle-engine.bundle-CMENyq1b.js} +2077 -2061
- package/dist/{needle-engine.bundle-D2myV4E4.umd.cjs → needle-engine.bundle-CODH82Jn.umd.cjs} +99 -98
- package/dist/needle-engine.d.ts +130 -129
- package/dist/needle-engine.js +4 -4
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-8AQTeZsr.umd.cjs → postprocessing-CjW23fio.umd.cjs} +2 -2
- package/dist/{postprocessing-BkxN_08g.js → postprocessing-DYLNOL3W.js} +3 -3
- package/dist/{postprocessing-BDScN9yu.min.js → postprocessing-xYQWCHFu.min.js} +2 -2
- package/dist/{three-DMrv-4ar.umd.cjs → three-B_hneGZr.umd.cjs} +4 -4
- package/dist/{three-Bz6X1mrw.js → three-DrqIzZTH.js} +4198 -4198
- package/dist/{three-Boa-jOq-.min.js → three-DuDKwKB8.min.js} +33 -33
- package/dist/{three-examples-GggCDHv0.js → three-examples-B50TT3Iu.js} +5 -5
- package/dist/{three-examples-DuVhxqft.min.js → three-examples-DaDLBuy6.min.js} +14 -14
- package/dist/{three-examples-C7ryg8vN.umd.cjs → three-examples-X3OadjXB.umd.cjs} +3 -3
- package/dist/{three-mesh-ui-CY6Izc7C.min.js → three-mesh-ui-B3p3gyUz.min.js} +1 -1
- package/dist/{three-mesh-ui-CwlN0FUC.umd.cjs → three-mesh-ui-CQiIQIlA.umd.cjs} +1 -1
- package/dist/{three-mesh-ui-CLNOfsWn.js → three-mesh-ui-CxuWt7m-.js} +1 -1
- package/dist/{vendor-zxXa3Dmr.min.js → vendor-BlSxe9JJ.min.js} +3 -3
- package/dist/{vendor-BSD1RQIh.js → vendor-BmYIgaS1.js} +3 -3
- package/dist/{vendor-DHr4aqIZ.umd.cjs → vendor-Cavtu3CP.umd.cjs} +3 -3
- package/lib/asap/needle-asap.d.ts +1 -1
- package/lib/asap/needle-asap.js +95 -95
- package/lib/asap/sessiongranted.d.ts +3 -3
- package/lib/asap/sessiongranted.js +65 -65
- package/lib/asap/utils.d.ts +1 -1
- package/lib/asap/utils.js +3 -3
- package/lib/engine/analytics/index.d.ts +6 -6
- package/lib/engine/analytics/index.js +12 -12
- package/lib/engine/analytics/lcp.d.ts +3 -3
- package/lib/engine/analytics/lcp.js +34 -34
- package/lib/engine/api.d.ts +82 -82
- package/lib/engine/api.js +81 -81
- package/lib/engine/assets/index.d.ts +11 -11
- package/lib/engine/assets/index.js +47 -47
- package/lib/engine/assets/static.d.ts +1 -1
- package/lib/engine/assets/static.js +4 -4
- package/lib/engine/codegen/register_types.d.ts +1 -1
- package/lib/engine/codegen/register_types.js +300 -300
- package/lib/engine/debug/debug.d.ts +15 -15
- package/lib/engine/debug/debug.js +44 -44
- package/lib/engine/debug/debug_console.d.ts +2 -2
- package/lib/engine/debug/debug_console.js +307 -307
- package/lib/engine/debug/debug_overlay.d.ts +22 -22
- package/lib/engine/debug/debug_overlay.js +316 -316
- package/lib/engine/debug/debug_spatial_console.d.ts +2 -2
- package/lib/engine/debug/debug_spatial_console.js +390 -390
- package/lib/engine/debug/index.d.ts +2 -2
- package/lib/engine/debug/index.js +2 -2
- package/lib/engine/engine_addressables.d.ts +164 -164
- package/lib/engine/engine_addressables.js +601 -601
- package/lib/engine/engine_animation.d.ts +43 -43
- package/lib/engine/engine_animation.js +133 -133
- package/lib/engine/engine_application.d.ts +45 -45
- package/lib/engine/engine_application.js +104 -104
- package/lib/engine/engine_assetdatabase.d.ts +25 -25
- package/lib/engine/engine_assetdatabase.js +346 -346
- package/lib/engine/engine_audio.d.ts +4 -4
- package/lib/engine/engine_audio.js +23 -23
- package/lib/engine/engine_camera.d.ts +13 -13
- package/lib/engine/engine_camera.js +30 -30
- package/lib/engine/engine_components.d.ts +110 -110
- package/lib/engine/engine_components.js +374 -374
- package/lib/engine/engine_components_internal.d.ts +9 -9
- package/lib/engine/engine_components_internal.js +36 -36
- package/lib/engine/engine_constants.d.ts +10 -10
- package/lib/engine/engine_constants.js +41 -41
- package/lib/engine/engine_context.d.ts +475 -475
- package/lib/engine/engine_context.js +1672 -1673
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_context_registry.d.ts +71 -71
- package/lib/engine/engine_context_registry.js +117 -117
- package/lib/engine/engine_coroutine.d.ts +35 -35
- package/lib/engine/engine_coroutine.js +52 -52
- package/lib/engine/engine_create_objects.d.ts +119 -119
- package/lib/engine/engine_create_objects.js +320 -320
- package/lib/engine/engine_default_parameters.d.ts +2 -2
- package/lib/engine/engine_default_parameters.js +3 -3
- package/lib/engine/engine_editor-sync.d.ts +21 -21
- package/lib/engine/engine_editor-sync.js +4 -4
- package/lib/engine/engine_fileloader.d.ts +2 -2
- package/lib/engine/engine_fileloader.js +8 -8
- package/lib/engine/engine_gameobject.d.ts +68 -68
- package/lib/engine/engine_gameobject.js +619 -619
- package/lib/engine/engine_generic_utils.d.ts +1 -1
- package/lib/engine/engine_generic_utils.js +13 -13
- package/lib/engine/engine_gizmos.d.ts +149 -149
- package/lib/engine/engine_gizmos.js +530 -530
- package/lib/engine/engine_gltf.d.ts +12 -12
- package/lib/engine/engine_gltf.js +15 -15
- package/lib/engine/engine_gltf_builtin_components.d.ts +11 -11
- package/lib/engine/engine_gltf_builtin_components.js +341 -341
- package/lib/engine/engine_hot_reload.d.ts +8 -8
- package/lib/engine/engine_hot_reload.js +197 -197
- package/lib/engine/engine_input.d.ts +362 -362
- package/lib/engine/engine_input.js +1294 -1294
- package/lib/engine/engine_input_utils.d.ts +2 -2
- package/lib/engine/engine_input_utils.js +22 -22
- package/lib/engine/engine_instancing.d.ts +19 -19
- package/lib/engine/engine_instancing.js +39 -39
- package/lib/engine/engine_license.d.ts +11 -11
- package/lib/engine/engine_license.js +369 -369
- package/lib/engine/engine_lifecycle_api.d.ts +83 -83
- package/lib/engine/engine_lifecycle_api.js +106 -106
- package/lib/engine/engine_lifecycle_functions_internal.d.ts +32 -32
- package/lib/engine/engine_lifecycle_functions_internal.js +146 -146
- package/lib/engine/engine_lightdata.d.ts +23 -23
- package/lib/engine/engine_lightdata.js +101 -101
- package/lib/engine/engine_loaders.callbacks.d.ts +97 -97
- package/lib/engine/engine_loaders.callbacks.js +86 -86
- package/lib/engine/engine_loaders.d.ts +48 -48
- package/lib/engine/engine_loaders.gltf.d.ts +13 -13
- package/lib/engine/engine_loaders.gltf.js +62 -62
- package/lib/engine/engine_loaders.js +337 -337
- package/lib/engine/engine_lods.d.ts +35 -35
- package/lib/engine/engine_lods.js +160 -160
- package/lib/engine/engine_lods.js.map +1 -1
- package/lib/engine/engine_mainloop_utils.d.ts +32 -32
- package/lib/engine/engine_mainloop_utils.js +466 -466
- package/lib/engine/engine_math.d.ts +114 -114
- package/lib/engine/engine_math.js +247 -247
- package/lib/engine/engine_modules.d.ts +36 -36
- package/lib/engine/engine_modules.js +85 -85
- package/lib/engine/engine_networking.d.ts +260 -260
- package/lib/engine/engine_networking.js +764 -764
- package/lib/engine/engine_networking_auto.d.ts +24 -24
- package/lib/engine/engine_networking_auto.js +310 -310
- package/lib/engine/engine_networking_blob.d.ts +48 -48
- package/lib/engine/engine_networking_blob.js +228 -228
- package/lib/engine/engine_networking_files.d.ts +35 -35
- package/lib/engine/engine_networking_files.js +172 -172
- package/lib/engine/engine_networking_files_default_components.d.ts +6 -6
- package/lib/engine/engine_networking_files_default_components.js +42 -42
- package/lib/engine/engine_networking_instantiate.d.ts +100 -100
- package/lib/engine/engine_networking_instantiate.js +345 -345
- package/lib/engine/engine_networking_peer.d.ts +15 -15
- package/lib/engine/engine_networking_peer.js +132 -132
- package/lib/engine/engine_networking_streams.d.ts +123 -123
- package/lib/engine/engine_networking_streams.js +645 -645
- package/lib/engine/engine_networking_types.d.ts +22 -22
- package/lib/engine/engine_networking_types.js +7 -7
- package/lib/engine/engine_networking_utils.d.ts +2 -2
- package/lib/engine/engine_networking_utils.js +20 -20
- package/lib/engine/engine_networking_websocket.d.ts +1 -1
- package/lib/engine/engine_networking_websocket.js +2 -2
- package/lib/engine/engine_patcher.d.ts +10 -10
- package/lib/engine/engine_patcher.js +142 -142
- package/lib/engine/engine_physics.d.ts +152 -152
- package/lib/engine/engine_physics.js +645 -645
- package/lib/engine/engine_physics.types.d.ts +40 -40
- package/lib/engine/engine_physics.types.js +33 -33
- package/lib/engine/engine_physics_rapier.d.ts +147 -147
- package/lib/engine/engine_physics_rapier.js +1433 -1433
- package/lib/engine/engine_playerview.d.ts +26 -26
- package/lib/engine/engine_playerview.js +64 -64
- package/lib/engine/engine_scenelighting.d.ts +71 -71
- package/lib/engine/engine_scenelighting.js +226 -226
- package/lib/engine/engine_serialization.d.ts +3 -3
- package/lib/engine/engine_serialization.js +3 -3
- package/lib/engine/engine_serialization_builtin_serializer.d.ts +72 -72
- package/lib/engine/engine_serialization_builtin_serializer.js +403 -403
- package/lib/engine/engine_serialization_core.d.ts +94 -94
- package/lib/engine/engine_serialization_core.js +607 -607
- package/lib/engine/engine_serialization_decorator.d.ts +23 -23
- package/lib/engine/engine_serialization_decorator.js +66 -66
- package/lib/engine/engine_setup.d.ts +1 -1
- package/lib/engine/engine_setup.js +2 -2
- package/lib/engine/engine_shaders.d.ts +53 -53
- package/lib/engine/engine_shaders.js +252 -252
- package/lib/engine/engine_shims.d.ts +4 -4
- package/lib/engine/engine_shims.js +24 -24
- package/lib/engine/engine_test_utils.d.ts +39 -39
- package/lib/engine/engine_test_utils.js +83 -83
- package/lib/engine/engine_texture.d.ts +28 -28
- package/lib/engine/engine_texture.js +64 -64
- package/lib/engine/engine_three_utils.d.ts +204 -204
- package/lib/engine/engine_three_utils.js +788 -788
- package/lib/engine/engine_time.d.ts +51 -51
- package/lib/engine/engine_time.js +82 -82
- package/lib/engine/engine_time_utils.d.ts +88 -88
- package/lib/engine/engine_time_utils.js +215 -215
- package/lib/engine/engine_tonemapping.d.ts +6 -6
- package/lib/engine/engine_tonemapping.js +198 -197
- package/lib/engine/engine_tonemapping.js.map +1 -1
- package/lib/engine/engine_types.d.ts +578 -578
- package/lib/engine/engine_types.js +95 -95
- package/lib/engine/engine_typestore.d.ts +28 -28
- package/lib/engine/engine_typestore.js +55 -55
- package/lib/engine/engine_util_decorator.d.ts +13 -13
- package/lib/engine/engine_util_decorator.js +116 -116
- package/lib/engine/engine_utils.d.ts +248 -248
- package/lib/engine/engine_utils.js +1012 -1012
- package/lib/engine/engine_utils_format.d.ts +24 -24
- package/lib/engine/engine_utils_format.js +239 -239
- package/lib/engine/engine_utils_screenshot.d.ts +159 -159
- package/lib/engine/engine_utils_screenshot.js +522 -522
- package/lib/engine/engine_utils_screenshot.xr.d.ts +5 -5
- package/lib/engine/engine_utils_screenshot.xr.js +90 -90
- package/lib/engine/engine_xr.d.ts +1 -1
- package/lib/engine/engine_xr.js +1 -1
- package/lib/engine/export/gltf/Writers.d.ts +19 -19
- package/lib/engine/export/gltf/Writers.js +24 -24
- package/lib/engine/export/gltf/index.d.ts +11 -11
- package/lib/engine/export/gltf/index.js +123 -123
- package/lib/engine/export/index.d.ts +2 -2
- package/lib/engine/export/index.js +2 -2
- package/lib/engine/export/state.d.ts +7 -7
- package/lib/engine/export/state.js +17 -17
- package/lib/engine/export/utils.d.ts +2 -2
- package/lib/engine/export/utils.js +7 -7
- package/lib/engine/extensions/EXT_texture_exr.d.ts +8 -8
- package/lib/engine/extensions/EXT_texture_exr.js +32 -32
- package/lib/engine/extensions/NEEDLE_animator_controller_model.d.ts +122 -122
- package/lib/engine/extensions/NEEDLE_animator_controller_model.js +95 -95
- package/lib/engine/extensions/NEEDLE_components.d.ts +35 -35
- package/lib/engine/extensions/NEEDLE_components.js +220 -220
- package/lib/engine/extensions/NEEDLE_gameobject_data.d.ts +10 -10
- package/lib/engine/extensions/NEEDLE_gameobject_data.js +57 -57
- package/lib/engine/extensions/NEEDLE_lighting_settings.d.ts +37 -37
- package/lib/engine/extensions/NEEDLE_lighting_settings.js +157 -157
- package/lib/engine/extensions/NEEDLE_lightmaps.d.ts +18 -18
- package/lib/engine/extensions/NEEDLE_lightmaps.js +99 -99
- package/lib/engine/extensions/NEEDLE_persistent_assets.d.ts +11 -11
- package/lib/engine/extensions/NEEDLE_persistent_assets.js +63 -63
- package/lib/engine/extensions/NEEDLE_progressive.d.ts +1 -1
- package/lib/engine/extensions/NEEDLE_progressive.js +1 -1
- package/lib/engine/extensions/NEEDLE_render_objects.d.ts +13 -13
- package/lib/engine/extensions/NEEDLE_render_objects.js +159 -159
- package/lib/engine/extensions/NEEDLE_techniques_webgl.d.ts +38 -38
- package/lib/engine/extensions/NEEDLE_techniques_webgl.js +564 -564
- package/lib/engine/extensions/extension_resolver.d.ts +4 -4
- package/lib/engine/extensions/extension_resolver.js +1 -1
- package/lib/engine/extensions/extension_utils.d.ts +12 -12
- package/lib/engine/extensions/extension_utils.js +152 -152
- package/lib/engine/extensions/extensions.d.ts +32 -32
- package/lib/engine/extensions/extensions.js +107 -107
- package/lib/engine/extensions/index.d.ts +6 -6
- package/lib/engine/extensions/index.js +6 -6
- package/lib/engine/extensions/usage_tracker.d.ts +13 -13
- package/lib/engine/extensions/usage_tracker.js +65 -65
- package/lib/engine/js-extensions/Camera.d.ts +1 -1
- package/lib/engine/js-extensions/Camera.js +39 -39
- package/lib/engine/js-extensions/ExtensionUtils.d.ts +9 -9
- package/lib/engine/js-extensions/ExtensionUtils.js +67 -67
- package/lib/engine/js-extensions/Layers.d.ts +6 -6
- package/lib/engine/js-extensions/Layers.js +22 -22
- package/lib/engine/js-extensions/Object3D.d.ts +120 -120
- package/lib/engine/js-extensions/Object3D.js +136 -136
- package/lib/engine/js-extensions/RGBAColor.d.ts +23 -23
- package/lib/engine/js-extensions/RGBAColor.js +111 -111
- package/lib/engine/js-extensions/Vector.d.ts +3 -3
- package/lib/engine/js-extensions/Vector.js +13 -13
- package/lib/engine/js-extensions/index.d.ts +5 -5
- package/lib/engine/js-extensions/index.js +5 -5
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.d.ts +4 -4
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +79 -79
- package/lib/engine/shaders/shaderData.d.ts +55 -55
- package/lib/engine/shaders/shaderData.js +58 -58
- package/lib/engine/tests/test_utils.d.ts +2 -2
- package/lib/engine/tests/test_utils.js +53 -53
- package/lib/engine/webcomponents/WebXRButtons.d.ts +56 -56
- package/lib/engine/webcomponents/WebXRButtons.js +230 -230
- package/lib/engine/webcomponents/api.d.ts +5 -5
- package/lib/engine/webcomponents/api.js +4 -4
- package/lib/engine/webcomponents/buttons.d.ts +51 -51
- package/lib/engine/webcomponents/buttons.js +264 -264
- package/lib/engine/webcomponents/fonts.d.ts +9 -9
- package/lib/engine/webcomponents/fonts.js +32 -32
- package/lib/engine/webcomponents/icons.d.ts +9 -9
- package/lib/engine/webcomponents/icons.js +52 -52
- package/lib/engine/webcomponents/index.d.ts +1 -1
- package/lib/engine/webcomponents/index.js +1 -1
- package/lib/engine/webcomponents/logo-element.d.ts +10 -10
- package/lib/engine/webcomponents/logo-element.js +67 -67
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.d.ts +37 -37
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +513 -513
- package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +155 -155
- package/lib/engine/webcomponents/needle menu/needle-menu.js +1029 -1029
- package/lib/engine/webcomponents/needle-button.d.ts +34 -34
- package/lib/engine/webcomponents/needle-button.js +161 -161
- package/lib/engine/webcomponents/needle-engine.ar-overlay.d.ts +21 -21
- package/lib/engine/webcomponents/needle-engine.ar-overlay.js +166 -166
- package/lib/engine/webcomponents/needle-engine.attributes.d.ts +69 -69
- package/lib/engine/webcomponents/needle-engine.attributes.js +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +115 -116
- package/lib/engine/webcomponents/needle-engine.extras.d.ts +6 -6
- package/lib/engine/webcomponents/needle-engine.extras.js +13 -13
- package/lib/engine/webcomponents/needle-engine.js +845 -821
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.loading.d.ts +44 -44
- package/lib/engine/webcomponents/needle-engine.loading.js +341 -341
- package/lib/engine/xr/NeedleXRController.d.ts +313 -313
- package/lib/engine/xr/NeedleXRController.js +1007 -1007
- package/lib/engine/xr/NeedleXRSession.d.ts +340 -340
- package/lib/engine/xr/NeedleXRSession.js +1463 -1463
- package/lib/engine/xr/NeedleXRSync.d.ts +22 -22
- package/lib/engine/xr/NeedleXRSync.js +188 -188
- package/lib/engine/xr/SceneTransition.d.ts +18 -18
- package/lib/engine/xr/SceneTransition.js +69 -69
- package/lib/engine/xr/TempXRContext.d.ts +34 -34
- package/lib/engine/xr/TempXRContext.js +187 -187
- package/lib/engine/xr/XRRig.d.ts +7 -7
- package/lib/engine/xr/XRRig.js +1 -1
- package/lib/engine/xr/api.d.ts +6 -6
- package/lib/engine/xr/api.js +6 -6
- package/lib/engine/xr/events.d.ts +66 -66
- package/lib/engine/xr/events.js +93 -93
- package/lib/engine/xr/internal.d.ts +12 -12
- package/lib/engine/xr/internal.js +25 -25
- package/lib/engine/xr/usdz.d.ts +12 -12
- package/lib/engine/xr/usdz.js +29 -29
- package/lib/engine/xr/utils.d.ts +11 -11
- package/lib/engine/xr/utils.js +34 -34
- package/lib/engine-components/AlignmentConstraint.d.ts +10 -10
- package/lib/engine-components/AlignmentConstraint.js +39 -39
- package/lib/engine-components/Animation.d.ts +156 -156
- package/lib/engine-components/Animation.js +508 -508
- package/lib/engine-components/AnimationCurve.d.ts +40 -40
- package/lib/engine-components/AnimationCurve.js +159 -159
- package/lib/engine-components/AnimationUtils.d.ts +8 -8
- package/lib/engine-components/AnimationUtils.js +27 -27
- package/lib/engine-components/AnimationUtilsAutoplay.d.ts +1 -1
- package/lib/engine-components/AnimationUtilsAutoplay.js +39 -39
- package/lib/engine-components/Animator.d.ts +217 -217
- package/lib/engine-components/Animator.js +354 -354
- package/lib/engine-components/AnimatorController.d.ts +227 -227
- package/lib/engine-components/AnimatorController.js +1152 -1152
- package/lib/engine-components/AudioListener.d.ts +33 -33
- package/lib/engine-components/AudioListener.js +86 -86
- package/lib/engine-components/AudioSource.d.ts +217 -217
- package/lib/engine-components/AudioSource.js +635 -635
- package/lib/engine-components/AvatarLoader.d.ts +80 -80
- package/lib/engine-components/AvatarLoader.js +231 -231
- package/lib/engine-components/AxesHelper.d.ts +32 -32
- package/lib/engine-components/AxesHelper.js +67 -67
- package/lib/engine-components/BasicIKConstraint.d.ts +9 -9
- package/lib/engine-components/BasicIKConstraint.js +43 -43
- package/lib/engine-components/BoxCollider.d.ts +2 -2
- package/lib/engine-components/BoxCollider.js +2 -2
- package/lib/engine-components/BoxHelperComponent.d.ts +47 -47
- package/lib/engine-components/BoxHelperComponent.js +102 -102
- package/lib/engine-components/Camera.d.ts +231 -231
- package/lib/engine-components/Camera.js +700 -700
- package/lib/engine-components/CameraUtils.d.ts +1 -1
- package/lib/engine-components/CameraUtils.js +123 -123
- package/lib/engine-components/CharacterController.d.ts +55 -55
- package/lib/engine-components/CharacterController.js +236 -236
- package/lib/engine-components/Collider.d.ts +188 -188
- package/lib/engine-components/Collider.js +369 -369
- package/lib/engine-components/Component.d.ts +792 -792
- package/lib/engine-components/Component.js +920 -920
- package/lib/engine-components/ContactShadows.d.ts +94 -94
- package/lib/engine-components/ContactShadows.js +453 -453
- package/lib/engine-components/DeleteBox.d.ts +19 -19
- package/lib/engine-components/DeleteBox.js +58 -58
- package/lib/engine-components/DeviceFlag.d.ts +16 -16
- package/lib/engine-components/DeviceFlag.js +47 -47
- package/lib/engine-components/DragControls.d.ts +170 -170
- package/lib/engine-components/DragControls.js +1421 -1421
- package/lib/engine-components/DropListener.d.ts +215 -215
- package/lib/engine-components/DropListener.js +642 -642
- package/lib/engine-components/Duplicatable.d.ts +35 -35
- package/lib/engine-components/Duplicatable.js +202 -202
- package/lib/engine-components/EventList.d.ts +54 -54
- package/lib/engine-components/EventList.js +232 -232
- package/lib/engine-components/EventTrigger.d.ts +33 -33
- package/lib/engine-components/EventTrigger.js +75 -75
- package/lib/engine-components/EventType.d.ts +22 -22
- package/lib/engine-components/EventType.js +23 -23
- package/lib/engine-components/Fog.d.ts +22 -22
- package/lib/engine-components/Fog.js +61 -61
- package/lib/engine-components/Gizmos.d.ts +17 -17
- package/lib/engine-components/Gizmos.js +64 -64
- package/lib/engine-components/GridHelper.d.ts +20 -20
- package/lib/engine-components/GridHelper.js +54 -54
- package/lib/engine-components/GroundProjection.d.ts +67 -67
- package/lib/engine-components/GroundProjection.js +343 -343
- package/lib/engine-components/Interactable.d.ts +12 -12
- package/lib/engine-components/Interactable.js +12 -12
- package/lib/engine-components/Joints.d.ts +19 -19
- package/lib/engine-components/Joints.js +51 -51
- package/lib/engine-components/LODGroup.d.ts +35 -35
- package/lib/engine-components/LODGroup.js +152 -152
- package/lib/engine-components/Light.d.ts +180 -180
- package/lib/engine-components/Light.js +535 -535
- package/lib/engine-components/LookAtConstraint.d.ts +19 -19
- package/lib/engine-components/LookAtConstraint.js +35 -35
- package/lib/engine-components/NeedleMenu.d.ts +50 -50
- package/lib/engine-components/NeedleMenu.js +92 -92
- package/lib/engine-components/NestedGltf.d.ts +25 -25
- package/lib/engine-components/NestedGltf.js +88 -88
- package/lib/engine-components/Networking.d.ts +54 -54
- package/lib/engine-components/Networking.js +112 -112
- package/lib/engine-components/OffsetConstraint.d.ts +14 -14
- package/lib/engine-components/OffsetConstraint.js +65 -65
- package/lib/engine-components/OrbitControls.d.ts +268 -268
- package/lib/engine-components/OrbitControls.js +1015 -1015
- package/lib/engine-components/PlayerColor.d.ts +19 -19
- package/lib/engine-components/PlayerColor.js +94 -94
- package/lib/engine-components/ReflectionProbe.d.ts +28 -28
- package/lib/engine-components/ReflectionProbe.js +204 -204
- package/lib/engine-components/Renderer.d.ts +153 -153
- package/lib/engine-components/Renderer.js +834 -834
- package/lib/engine-components/RendererInstancing.d.ts +140 -140
- package/lib/engine-components/RendererInstancing.js +744 -744
- package/lib/engine-components/RendererLightmap.d.ts +24 -24
- package/lib/engine-components/RendererLightmap.js +182 -182
- package/lib/engine-components/RigidBody.d.ts +155 -155
- package/lib/engine-components/RigidBody.js +517 -517
- package/lib/engine-components/SceneSwitcher.d.ts +263 -263
- package/lib/engine-components/SceneSwitcher.js +971 -971
- package/lib/engine-components/ScreenCapture.d.ts +144 -144
- package/lib/engine-components/ScreenCapture.js +547 -547
- package/lib/engine-components/ShadowCatcher.d.ts +33 -33
- package/lib/engine-components/ShadowCatcher.js +166 -166
- package/lib/engine-components/Skybox.d.ts +88 -88
- package/lib/engine-components/Skybox.js +469 -469
- package/lib/engine-components/SmoothFollow.d.ts +34 -34
- package/lib/engine-components/SmoothFollow.js +82 -82
- package/lib/engine-components/SpatialTrigger.d.ts +102 -102
- package/lib/engine-components/SpatialTrigger.js +225 -225
- package/lib/engine-components/SpectatorCamera.d.ts +111 -111
- package/lib/engine-components/SpectatorCamera.js +715 -715
- package/lib/engine-components/SphereCollider.d.ts +2 -2
- package/lib/engine-components/SphereCollider.js +2 -2
- package/lib/engine-components/SpriteRenderer.d.ts +132 -132
- package/lib/engine-components/SpriteRenderer.js +472 -472
- package/lib/engine-components/SyncedCamera.d.ts +41 -41
- package/lib/engine-components/SyncedCamera.js +199 -199
- package/lib/engine-components/SyncedRoom.d.ts +106 -106
- package/lib/engine-components/SyncedRoom.js +371 -371
- package/lib/engine-components/SyncedTransform.d.ts +94 -94
- package/lib/engine-components/SyncedTransform.js +331 -331
- package/lib/engine-components/TestRunner.d.ts +16 -16
- package/lib/engine-components/TestRunner.js +102 -102
- package/lib/engine-components/TransformGizmo.d.ts +75 -75
- package/lib/engine-components/TransformGizmo.js +209 -209
- package/lib/engine-components/VideoPlayer.d.ts +184 -184
- package/lib/engine-components/VideoPlayer.js +978 -978
- package/lib/engine-components/Voip.d.ts +67 -67
- package/lib/engine-components/Voip.js +360 -360
- package/lib/engine-components/api.d.ts +51 -51
- package/lib/engine-components/api.js +50 -50
- package/lib/engine-components/avatar/AvatarBlink_Simple.d.ts +11 -11
- package/lib/engine-components/avatar/AvatarBlink_Simple.js +76 -76
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.d.ts +14 -14
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js +68 -68
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.d.ts +29 -29
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.js +121 -121
- package/lib/engine-components/avatar/Avatar_MouthShapes.d.ts +15 -15
- package/lib/engine-components/avatar/Avatar_MouthShapes.js +79 -79
- package/lib/engine-components/avatar/Avatar_MustacheShake.d.ts +9 -9
- package/lib/engine-components/avatar/Avatar_MustacheShake.js +29 -29
- package/lib/engine-components/codegen/components.d.ts +216 -216
- package/lib/engine-components/codegen/components.js +218 -218
- package/lib/engine-components/debug/LogStats.d.ts +5 -5
- package/lib/engine-components/debug/LogStats.js +18 -18
- package/lib/engine-components/export/gltf/GltfExport.d.ts +30 -30
- package/lib/engine-components/export/gltf/GltfExport.js +246 -246
- package/lib/engine-components/export/gltf/index.d.ts +1 -1
- package/lib/engine-components/export/gltf/index.js +1 -1
- package/lib/engine-components/export/index.d.ts +1 -1
- package/lib/engine-components/export/index.js +1 -1
- package/lib/engine-components/export/usdz/Extension.d.ts +22 -22
- package/lib/engine-components/export/usdz/Extension.js +1 -1
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.d.ts +162 -162
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +1789 -1789
- package/lib/engine-components/export/usdz/USDZExporter.d.ts +130 -130
- package/lib/engine-components/export/usdz/USDZExporter.js +663 -663
- package/lib/engine-components/export/usdz/extensions/Animation.d.ts +106 -106
- package/lib/engine-components/export/usdz/extensions/Animation.js +1071 -1071
- package/lib/engine-components/export/usdz/extensions/DocumentExtension.d.ts +5 -5
- package/lib/engine-components/export/usdz/extensions/DocumentExtension.js +6 -6
- package/lib/engine-components/export/usdz/extensions/NodeMaterialConverter.d.ts +10 -10
- package/lib/engine-components/export/usdz/extensions/NodeMaterialConverter.js +451 -451
- package/lib/engine-components/export/usdz/extensions/USDZText.d.ts +54 -54
- package/lib/engine-components/export/usdz/extensions/USDZText.js +203 -203
- package/lib/engine-components/export/usdz/extensions/USDZUI.d.ts +8 -8
- package/lib/engine-components/export/usdz/extensions/USDZUI.js +158 -158
- package/lib/engine-components/export/usdz/extensions/behavior/Actions.d.ts +30 -30
- package/lib/engine-components/export/usdz/extensions/behavior/Actions.js +88 -88
- package/lib/engine-components/export/usdz/extensions/behavior/AudioExtension.d.ts +10 -10
- package/lib/engine-components/export/usdz/extensions/behavior/AudioExtension.js +86 -86
- package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.d.ts +28 -28
- package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.js +290 -290
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +190 -190
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +1060 -1060
- package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.d.ts +135 -135
- package/lib/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.js +548 -548
- package/lib/engine-components/export/usdz/extensions/behavior/PhysicsExtension.d.ts +7 -7
- package/lib/engine-components/export/usdz/extensions/behavior/PhysicsExtension.js +115 -115
- package/lib/engine-components/export/usdz/index.d.ts +3 -3
- package/lib/engine-components/export/usdz/index.js +2 -2
- package/lib/engine-components/export/usdz/utils/animationutils.d.ts +7 -7
- package/lib/engine-components/export/usdz/utils/animationutils.js +163 -163
- package/lib/engine-components/export/usdz/utils/quicklook.d.ts +2 -2
- package/lib/engine-components/export/usdz/utils/quicklook.js +43 -43
- package/lib/engine-components/particlesystem/ParticleSystem.d.ts +177 -177
- package/lib/engine-components/particlesystem/ParticleSystem.js +1176 -1176
- package/lib/engine-components/particlesystem/ParticleSystemModules.d.ts +526 -526
- package/lib/engine-components/particlesystem/ParticleSystemModules.js +1930 -1930
- package/lib/engine-components/particlesystem/ParticleSystemSubEmitter.d.ts +25 -25
- package/lib/engine-components/particlesystem/ParticleSystemSubEmitter.js +87 -87
- package/lib/engine-components/particlesystem/api.d.ts +2 -2
- package/lib/engine-components/particlesystem/api.js +2 -2
- package/lib/engine-components/postprocessing/Effects/Antialiasing.d.ts +17 -17
- package/lib/engine-components/postprocessing/Effects/Antialiasing.js +59 -59
- package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +46 -46
- package/lib/engine-components/postprocessing/Effects/BloomEffect.js +113 -113
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.d.ts +11 -11
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js +39 -39
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +23 -23
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +111 -111
- package/lib/engine-components/postprocessing/Effects/DepthOfField.d.ts +25 -25
- package/lib/engine-components/postprocessing/Effects/DepthOfField.js +104 -104
- package/lib/engine-components/postprocessing/Effects/EffectWrapper.d.ts +12 -12
- package/lib/engine-components/postprocessing/Effects/EffectWrapper.js +18 -18
- package/lib/engine-components/postprocessing/Effects/Pixelation.d.ts +11 -11
- package/lib/engine-components/postprocessing/Effects/Pixelation.js +32 -32
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.d.ts +18 -18
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js +91 -91
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.d.ts +70 -70
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js +176 -176
- package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +18 -18
- package/lib/engine-components/postprocessing/Effects/Sharpening.js +127 -127
- package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.d.ts +17 -17
- package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js +70 -70
- package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +19 -19
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js +94 -94
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +13 -13
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.js +51 -51
- package/lib/engine-components/postprocessing/Effects/Vignette.d.ts +15 -15
- package/lib/engine-components/postprocessing/Effects/Vignette.js +60 -60
- package/lib/engine-components/postprocessing/PostProcessingEffect.d.ts +90 -90
- package/lib/engine-components/postprocessing/PostProcessingEffect.js +168 -168
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +42 -42
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +494 -494
- package/lib/engine-components/postprocessing/Volume.d.ts +90 -90
- package/lib/engine-components/postprocessing/Volume.js +385 -385
- package/lib/engine-components/postprocessing/VolumeParameter.d.ts +26 -26
- package/lib/engine-components/postprocessing/VolumeParameter.js +136 -136
- package/lib/engine-components/postprocessing/VolumeProfile.d.ts +15 -15
- package/lib/engine-components/postprocessing/VolumeProfile.js +60 -60
- package/lib/engine-components/postprocessing/index.d.ts +6 -6
- package/lib/engine-components/postprocessing/index.js +6 -6
- package/lib/engine-components/postprocessing/utils.d.ts +55 -55
- package/lib/engine-components/postprocessing/utils.js +119 -119
- package/lib/engine-components/timeline/PlayableDirector.d.ts +163 -163
- package/lib/engine-components/timeline/PlayableDirector.js +686 -686
- package/lib/engine-components/timeline/SignalAsset.d.ts +24 -24
- package/lib/engine-components/timeline/SignalAsset.js +130 -130
- package/lib/engine-components/timeline/TimelineModels.d.ts +89 -89
- package/lib/engine-components/timeline/TimelineModels.js +22 -22
- package/lib/engine-components/timeline/TimelineTracks.d.ts +110 -110
- package/lib/engine-components/timeline/TimelineTracks.js +879 -879
- package/lib/engine-components/timeline/index.d.ts +4 -4
- package/lib/engine-components/timeline/index.js +3 -3
- package/lib/engine-components/ui/BaseUIComponent.d.ts +48 -48
- package/lib/engine-components/ui/BaseUIComponent.js +170 -170
- package/lib/engine-components/ui/Button.d.ts +64 -64
- package/lib/engine-components/ui/Button.js +315 -315
- package/lib/engine-components/ui/Canvas.d.ts +74 -74
- package/lib/engine-components/ui/Canvas.js +407 -407
- package/lib/engine-components/ui/CanvasGroup.d.ts +19 -19
- package/lib/engine-components/ui/CanvasGroup.js +58 -58
- package/lib/engine-components/ui/EventSystem.d.ts +125 -125
- package/lib/engine-components/ui/EventSystem.js +765 -765
- package/lib/engine-components/ui/Graphic.d.ts +55 -55
- package/lib/engine-components/ui/Graphic.js +255 -255
- package/lib/engine-components/ui/Image.d.ts +35 -35
- package/lib/engine-components/ui/Image.js +116 -116
- package/lib/engine-components/ui/InputField.d.ts +42 -42
- package/lib/engine-components/ui/InputField.js +268 -268
- package/lib/engine-components/ui/Interfaces.d.ts +38 -38
- package/lib/engine-components/ui/Interfaces.js +12 -12
- package/lib/engine-components/ui/Layout.d.ts +84 -84
- package/lib/engine-components/ui/Layout.js +330 -330
- package/lib/engine-components/ui/Outline.d.ts +7 -7
- package/lib/engine-components/ui/Outline.js +20 -20
- package/lib/engine-components/ui/PointerEvents.d.ts +115 -115
- package/lib/engine-components/ui/PointerEvents.js +145 -145
- package/lib/engine-components/ui/RaycastUtils.d.ts +11 -11
- package/lib/engine-components/ui/RaycastUtils.js +67 -67
- package/lib/engine-components/ui/Raycaster.d.ts +30 -30
- package/lib/engine-components/ui/Raycaster.js +95 -95
- package/lib/engine-components/ui/RectTransform.d.ts +61 -61
- package/lib/engine-components/ui/RectTransform.js +356 -356
- package/lib/engine-components/ui/SpatialHtml.d.ts +8 -8
- package/lib/engine-components/ui/SpatialHtml.js +79 -79
- package/lib/engine-components/ui/Symbols.d.ts +1 -1
- package/lib/engine-components/ui/Symbols.js +1 -1
- package/lib/engine-components/ui/Text.d.ts +78 -78
- package/lib/engine-components/ui/Text.js +539 -539
- package/lib/engine-components/ui/Utils.d.ts +24 -24
- package/lib/engine-components/ui/Utils.js +90 -90
- package/lib/engine-components/ui/index.d.ts +1 -1
- package/lib/engine-components/ui/index.js +1 -1
- package/lib/engine-components/utils/EnvironmentScene.d.ts +5 -5
- package/lib/engine-components/utils/EnvironmentScene.js +205 -205
- package/lib/engine-components/utils/LookAt.d.ts +31 -31
- package/lib/engine-components/utils/LookAt.js +82 -82
- package/lib/engine-components/utils/OpenURL.d.ts +42 -42
- package/lib/engine-components/utils/OpenURL.js +119 -119
- package/lib/engine-components/webxr/Avatar.d.ts +25 -25
- package/lib/engine-components/webxr/Avatar.js +255 -255
- package/lib/engine-components/webxr/TeleportTarget.d.ts +7 -7
- package/lib/engine-components/webxr/TeleportTarget.js +7 -7
- package/lib/engine-components/webxr/WebARCameraBackground.d.ts +30 -30
- package/lib/engine-components/webxr/WebARCameraBackground.js +155 -155
- package/lib/engine-components/webxr/WebARSessionRoot.d.ts +98 -98
- package/lib/engine-components/webxr/WebARSessionRoot.js +770 -770
- package/lib/engine-components/webxr/WebXR.d.ts +232 -232
- package/lib/engine-components/webxr/WebXR.js +561 -561
- package/lib/engine-components/webxr/WebXRAvatar.d.ts +27 -27
- package/lib/engine-components/webxr/WebXRAvatar.js +44 -44
- package/lib/engine-components/webxr/WebXRImageTracking.d.ts +86 -86
- package/lib/engine-components/webxr/WebXRImageTracking.js +471 -471
- package/lib/engine-components/webxr/WebXRPlaneTracking.d.ts +92 -92
- package/lib/engine-components/webxr/WebXRPlaneTracking.js +500 -500
- package/lib/engine-components/webxr/WebXRRig.d.ts +32 -32
- package/lib/engine-components/webxr/WebXRRig.js +72 -72
- package/lib/engine-components/webxr/XRFlag.d.ts +38 -38
- package/lib/engine-components/webxr/XRFlag.js +139 -139
- package/lib/engine-components/webxr/controllers/XRControllerFollow.d.ts +47 -47
- package/lib/engine-components/webxr/controllers/XRControllerFollow.js +120 -120
- package/lib/engine-components/webxr/controllers/XRControllerModel.d.ts +43 -43
- package/lib/engine-components/webxr/controllers/XRControllerModel.js +352 -352
- package/lib/engine-components/webxr/controllers/XRControllerMovement.d.ts +78 -78
- package/lib/engine-components/webxr/controllers/XRControllerMovement.js +506 -506
- package/lib/engine-components/webxr/index.d.ts +3 -3
- package/lib/engine-components/webxr/index.js +3 -3
- package/lib/engine-components/webxr/types.d.ts +3 -3
- package/lib/engine-components/webxr/types.js +1 -1
- package/lib/engine-components-experimental/Presentation.d.ts +6 -6
- package/lib/engine-components-experimental/Presentation.js +9 -9
- package/lib/engine-components-experimental/api.d.ts +4 -4
- package/lib/engine-components-experimental/api.js +4 -4
- package/lib/engine-components-experimental/networking/PlayerSync.d.ts +156 -156
- package/lib/engine-components-experimental/networking/PlayerSync.js +377 -377
- package/lib/engine-schemes/api.d.ts +12 -12
- package/lib/engine-schemes/api.js +12 -12
- package/lib/engine-schemes/schemes.d.ts +7 -7
- package/lib/engine-schemes/schemes.js +19 -19
- package/lib/engine-schemes/synced-camera-model.d.ts +25 -25
- package/lib/engine-schemes/synced-camera-model.js +67 -67
- package/lib/engine-schemes/synced-transform-model.d.ts +31 -31
- package/lib/engine-schemes/synced-transform-model.js +66 -66
- package/lib/engine-schemes/transform.d.ts +12 -12
- package/lib/engine-schemes/transform.js +39 -39
- package/lib/engine-schemes/vec2.d.ts +10 -10
- package/lib/engine-schemes/vec2.js +25 -25
- package/lib/engine-schemes/vec3.d.ts +11 -11
- package/lib/engine-schemes/vec3.js +29 -29
- package/lib/engine-schemes/vec4.d.ts +12 -12
- package/lib/engine-schemes/vec4.js +33 -33
- package/lib/engine-schemes/vr-user-state-buffer.d.ts +37 -37
- package/lib/engine-schemes/vr-user-state-buffer.js +110 -110
- package/lib/include/three/EXT_mesh_gpu_instancing_exporter.d.ts +6 -6
- package/lib/include/three/EXT_mesh_gpu_instancing_exporter.js +45 -45
- package/lib/needle-engine.d.ts +7 -7
- package/lib/needle-engine.js +64 -64
- package/package.json +3 -3
- package/plugins/common/buildinfo.js +64 -64
- package/plugins/common/cloud.js +1 -1
- package/plugins/common/config.cjs +31 -31
- package/plugins/common/config.js +35 -35
- package/plugins/common/files.js +31 -31
- package/plugins/common/generator.js +10 -10
- package/plugins/common/license.js +452 -452
- package/plugins/common/logger.js +327 -327
- package/plugins/common/npm.js +15 -15
- package/plugins/common/timers.js +7 -7
- package/plugins/common/version.js +37 -37
- package/plugins/gltf-packer.mjs +1 -1
- package/plugins/next/alias.cjs +39 -39
- package/plugins/next/license.cjs +24 -24
- package/plugins/next/meshbvhworker.cjs +18 -18
- package/plugins/next/next.js +141 -141
- package/plugins/types/index.d.ts +2 -2
- package/plugins/types/license.d.ts +24 -24
- package/plugins/types/needleConfig.d.ts +27 -27
- package/plugins/types/next.d.ts +2 -2
- package/plugins/types/userconfig.d.ts +124 -124
- package/plugins/types/vite.d.ts +13 -13
- package/plugins/types/webmanifest.d.ts +32 -32
- package/plugins/vite/alias.js +189 -189
- package/plugins/vite/asap.js +251 -251
- package/plugins/vite/build-pipeline.js +371 -371
- package/plugins/vite/build.js +19 -19
- package/plugins/vite/buildinfo.js +41 -41
- package/plugins/vite/config.js +106 -106
- package/plugins/vite/copyfiles.js +138 -138
- package/plugins/vite/defines.js +70 -70
- package/plugins/vite/dependencies.js +232 -232
- package/plugins/vite/dependency-watcher.js +237 -237
- package/plugins/vite/drop-client.js +76 -76
- package/plugins/vite/drop.js +87 -87
- package/plugins/vite/editor-connection.js +124 -124
- package/plugins/vite/facebook-instant-games.js +102 -102
- package/plugins/vite/gzip.js +5 -5
- package/plugins/vite/imports-logger.js +143 -143
- package/plugins/vite/index.js +147 -147
- package/plugins/vite/license.js +56 -56
- package/plugins/vite/local-files.js +440 -440
- package/plugins/vite/logger.client.js +272 -272
- package/plugins/vite/logger.js +100 -100
- package/plugins/vite/materialx.js +31 -31
- package/plugins/vite/meta.js +163 -163
- package/plugins/vite/npm.js +7 -7
- package/plugins/vite/peer.js +29 -29
- package/plugins/vite/poster-client.js +73 -73
- package/plugins/vite/poster.js +79 -79
- package/plugins/vite/pwa.js +604 -604
- package/plugins/vite/reload-client.js +15 -15
- package/plugins/vite/reload.js +351 -351
- package/plugins/vite/server.js +66 -66
- package/plugins/vite/transform-codegen.js +55 -55
- package/plugins/vite/transform.js +32 -32
- package/plugins/vite/vite-4.4-hack.js +31 -31
- package/src/asap/needle-asap.ts +111 -111
- package/src/asap/sessiongranted.ts +75 -75
- package/src/asap/utils.ts +4 -4
- package/src/engine/analytics/index.ts +10 -10
- package/src/engine/analytics/lcp.ts +35 -35
- package/src/engine/api.ts +82 -82
- package/src/engine/assets/index.ts +59 -59
- package/src/engine/assets/static.js +5 -5
- package/src/engine/codegen/register_types.ts +300 -300
- package/src/engine/debug/debug.ts +51 -51
- package/src/engine/debug/debug_console.ts +333 -333
- package/src/engine/debug/debug_overlay.ts +332 -332
- package/src/engine/debug/debug_spatial_console.ts +429 -429
- package/src/engine/debug/index.ts +1 -1
- package/src/engine/engine_addressables.ts +671 -671
- package/src/engine/engine_animation.ts +145 -145
- package/src/engine/engine_application.ts +113 -113
- package/src/engine/engine_assetdatabase.ts +389 -389
- package/src/engine/engine_audio.ts +24 -24
- package/src/engine/engine_camera.ts +39 -39
- package/src/engine/engine_components.ts +366 -366
- package/src/engine/engine_components_internal.ts +40 -40
- package/src/engine/engine_constants.ts +52 -52
- package/src/engine/engine_context.ts +1822 -1824
- package/src/engine/engine_context_registry.ts +129 -129
- package/src/engine/engine_coroutine.ts +54 -54
- package/src/engine/engine_create_objects.ts +411 -411
- package/src/engine/engine_default_parameters.ts +3 -3
- package/src/engine/engine_editor-sync.ts +28 -28
- package/src/engine/engine_fileloader.js +9 -9
- package/src/engine/engine_gameobject.ts +712 -712
- package/src/engine/engine_generic_utils.js +13 -13
- package/src/engine/engine_gizmos.ts +577 -577
- package/src/engine/engine_gltf.ts +29 -29
- package/src/engine/engine_gltf_builtin_components.ts +403 -403
- package/src/engine/engine_hot_reload.ts +210 -210
- package/src/engine/engine_input.ts +1500 -1500
- package/src/engine/engine_input_utils.ts +23 -23
- package/src/engine/engine_instancing.ts +45 -45
- package/src/engine/engine_license.ts +386 -386
- package/src/engine/engine_lifecycle_api.ts +113 -113
- package/src/engine/engine_lifecycle_functions_internal.ts +193 -193
- package/src/engine/engine_lightdata.ts +125 -125
- package/src/engine/engine_loaders.callbacks.ts +136 -136
- package/src/engine/engine_loaders.gltf.ts +82 -82
- package/src/engine/engine_loaders.ts +378 -378
- package/src/engine/engine_lods.ts +185 -186
- package/src/engine/engine_mainloop_utils.ts +472 -472
- package/src/engine/engine_math.ts +282 -282
- package/src/engine/engine_modules.ts +83 -83
- package/src/engine/engine_networking.ts +862 -862
- package/src/engine/engine_networking_auto.ts +352 -352
- package/src/engine/engine_networking_blob.ts +275 -275
- package/src/engine/engine_networking_files.ts +217 -217
- package/src/engine/engine_networking_files_default_components.ts +58 -58
- package/src/engine/engine_networking_instantiate.ts +419 -419
- package/src/engine/engine_networking_peer.ts +159 -159
- package/src/engine/engine_networking_streams.ts +713 -713
- package/src/engine/engine_networking_types.ts +24 -24
- package/src/engine/engine_networking_utils.ts +23 -23
- package/src/engine/engine_networking_websocket.ts +2 -2
- package/src/engine/engine_patcher.ts +199 -199
- package/src/engine/engine_physics.ts +783 -783
- package/src/engine/engine_physics.types.ts +46 -46
- package/src/engine/engine_physics_rapier.ts +1577 -1577
- package/src/engine/engine_playerview.ts +80 -80
- package/src/engine/engine_scenelighting.ts +294 -294
- package/src/engine/engine_serialization.ts +2 -2
- package/src/engine/engine_serialization_builtin_serializer.ts +473 -473
- package/src/engine/engine_serialization_core.ts +720 -720
- package/src/engine/engine_serialization_decorator.ts +80 -80
- package/src/engine/engine_setup.ts +1 -1
- package/src/engine/engine_shaders.ts +267 -267
- package/src/engine/engine_shims.ts +32 -32
- package/src/engine/engine_test_utils.ts +109 -109
- package/src/engine/engine_texture.ts +82 -82
- package/src/engine/engine_three_utils.ts +928 -928
- package/src/engine/engine_time.ts +94 -94
- package/src/engine/engine_time_utils.ts +237 -237
- package/src/engine/engine_tonemapping.ts +209 -208
- package/src/engine/engine_types.ts +730 -730
- package/src/engine/engine_typestore.ts +63 -63
- package/src/engine/engine_util_decorator.ts +136 -136
- package/src/engine/engine_utils.ts +1115 -1115
- package/src/engine/engine_utils_format.ts +273 -273
- package/src/engine/engine_utils_screenshot.ts +708 -708
- package/src/engine/engine_utils_screenshot.xr.ts +103 -103
- package/src/engine/export/gltf/Writers.ts +34 -34
- package/src/engine/export/gltf/index.ts +158 -158
- package/src/engine/export/index.ts +2 -2
- package/src/engine/export/state.ts +19 -19
- package/src/engine/export/utils.ts +9 -9
- package/src/engine/extensions/EXT_texture_exr.ts +50 -50
- package/src/engine/extensions/NEEDLE_animator_controller_model.ts +195 -195
- package/src/engine/extensions/NEEDLE_components.ts +268 -268
- package/src/engine/extensions/NEEDLE_gameobject_data.ts +81 -81
- package/src/engine/extensions/NEEDLE_lighting_settings.ts +185 -185
- package/src/engine/extensions/NEEDLE_lightmaps.ts +119 -119
- package/src/engine/extensions/NEEDLE_persistent_assets.ts +76 -76
- package/src/engine/extensions/NEEDLE_render_objects.ts +209 -209
- package/src/engine/extensions/NEEDLE_techniques_webgl.ts +640 -640
- package/src/engine/extensions/extension_resolver.ts +4 -4
- package/src/engine/extensions/extension_utils.ts +166 -166
- package/src/engine/extensions/extensions.ts +140 -140
- package/src/engine/extensions/index.ts +5 -5
- package/src/engine/extensions/usage_tracker.ts +100 -100
- package/src/engine/js-extensions/Camera.ts +37 -37
- package/src/engine/js-extensions/ExtensionUtils.ts +85 -85
- package/src/engine/js-extensions/Layers.ts +23 -23
- package/src/engine/js-extensions/Object3D.ts +296 -296
- package/src/engine/js-extensions/RGBAColor.ts +126 -126
- package/src/engine/js-extensions/Vector.ts +18 -18
- package/src/engine/js-extensions/index.ts +4 -4
- package/src/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +125 -125
- package/src/engine/shaders/shaderData.ts +67 -67
- package/src/engine/tests/test_utils.ts +63 -63
- package/src/engine/webcomponents/WebXRButtons.ts +260 -260
- package/src/engine/webcomponents/api.ts +6 -6
- package/src/engine/webcomponents/buttons.ts +292 -292
- package/src/engine/webcomponents/fonts.ts +41 -41
- package/src/engine/webcomponents/icons.ts +57 -57
- package/src/engine/webcomponents/index.ts +1 -1
- package/src/engine/webcomponents/logo-element.ts +78 -78
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +573 -573
- package/src/engine/webcomponents/needle menu/needle-menu.ts +1118 -1118
- package/src/engine/webcomponents/needle-button.ts +181 -181
- package/src/engine/webcomponents/needle-engine.ar-overlay.ts +186 -186
- package/src/engine/webcomponents/needle-engine.attributes.ts +82 -82
- package/src/engine/webcomponents/needle-engine.extras.ts +16 -16
- package/src/engine/webcomponents/needle-engine.loading.ts +373 -373
- package/src/engine/webcomponents/needle-engine.ts +890 -860
- package/src/engine/xr/NeedleXRController.ts +1125 -1125
- package/src/engine/xr/NeedleXRSession.ts +1624 -1624
- package/src/engine/xr/NeedleXRSync.ts +220 -220
- package/src/engine/xr/SceneTransition.ts +78 -78
- package/src/engine/xr/TempXRContext.ts +216 -216
- package/src/engine/xr/XRRig.ts +9 -9
- package/src/engine/xr/api.ts +5 -5
- package/src/engine/xr/events.ts +102 -102
- package/src/engine/xr/internal.ts +34 -34
- package/src/engine/xr/usdz.ts +30 -30
- package/src/engine/xr/utils.ts +39 -39
- package/src/engine-components/AlignmentConstraint.ts +36 -36
- package/src/engine-components/Animation.ts +557 -557
- package/src/engine-components/AnimationCurve.ts +150 -150
- package/src/engine-components/AnimationUtils.ts +28 -28
- package/src/engine-components/AnimationUtilsAutoplay.ts +43 -43
- package/src/engine-components/Animator.ts +397 -397
- package/src/engine-components/AnimatorController.ts +1293 -1293
- package/src/engine-components/AudioListener.ts +92 -92
- package/src/engine-components/AudioSource.ts +644 -644
- package/src/engine-components/AvatarLoader.ts +263 -263
- package/src/engine-components/AxesHelper.ts +59 -59
- package/src/engine-components/BasicIKConstraint.ts +54 -54
- package/src/engine-components/BoxCollider.ts +1 -1
- package/src/engine-components/BoxHelperComponent.ts +114 -114
- package/src/engine-components/Camera.ts +719 -719
- package/src/engine-components/CameraUtils.ts +138 -138
- package/src/engine-components/CharacterController.ts +253 -253
- package/src/engine-components/Collider.ts +374 -374
- package/src/engine-components/Component.ts +1297 -1297
- package/src/engine-components/ContactShadows.ts +506 -506
- package/src/engine-components/DeleteBox.ts +62 -62
- package/src/engine-components/DeviceFlag.ts +46 -46
- package/src/engine-components/DragControls.ts +1623 -1623
- package/src/engine-components/DropListener.ts +713 -713
- package/src/engine-components/Duplicatable.ts +198 -198
- package/src/engine-components/EventList.ts +266 -266
- package/src/engine-components/EventTrigger.ts +74 -74
- package/src/engine-components/EventType.ts +22 -22
- package/src/engine-components/Fog.ts +60 -60
- package/src/engine-components/Gizmos.ts +56 -56
- package/src/engine-components/GridHelper.ts +48 -48
- package/src/engine-components/GroundProjection.ts +356 -356
- package/src/engine-components/Interactable.ts +14 -14
- package/src/engine-components/Joints.ts +52 -52
- package/src/engine-components/LODGroup.ts +153 -153
- package/src/engine-components/Light.ts +558 -558
- package/src/engine-components/LookAtConstraint.ts +25 -25
- package/src/engine-components/NeedleMenu.ts +84 -84
- package/src/engine-components/NestedGltf.ts +86 -86
- package/src/engine-components/Networking.ts +114 -114
- package/src/engine-components/OffsetConstraint.ts +60 -60
- package/src/engine-components/OrbitControls.ts +1074 -1074
- package/src/engine-components/PlayerColor.ts +103 -103
- package/src/engine-components/ReflectionProbe.ts +220 -220
- package/src/engine-components/Renderer.ts +903 -903
- package/src/engine-components/RendererInstancing.ts +855 -855
- package/src/engine-components/RendererLightmap.ts +198 -198
- package/src/engine-components/RigidBody.ts +526 -526
- package/src/engine-components/SceneSwitcher.ts +1030 -1030
- package/src/engine-components/ScreenCapture.ts +592 -592
- package/src/engine-components/ShadowCatcher.ts +172 -172
- package/src/engine-components/Skybox.ts +475 -475
- package/src/engine-components/SmoothFollow.ts +76 -76
- package/src/engine-components/SpatialTrigger.ts +229 -229
- package/src/engine-components/SpectatorCamera.ts +787 -787
- package/src/engine-components/SphereCollider.ts +1 -1
- package/src/engine-components/SpriteRenderer.ts +468 -468
- package/src/engine-components/SyncedCamera.ts +220 -220
- package/src/engine-components/SyncedRoom.ts +380 -380
- package/src/engine-components/SyncedTransform.ts +383 -383
- package/src/engine-components/TestRunner.ts +118 -118
- package/src/engine-components/TransformGizmo.ts +219 -219
- package/src/engine-components/VideoPlayer.ts +1025 -1025
- package/src/engine-components/Voip.ts +363 -363
- package/src/engine-components/api.ts +60 -60
- package/src/engine-components/avatar/AvatarBlink_Simple.ts +69 -69
- package/src/engine-components/avatar/AvatarEyeLook_Rotation.ts +63 -63
- package/src/engine-components/avatar/Avatar_Brain_LookAt.ts +139 -139
- package/src/engine-components/avatar/Avatar_MouthShapes.ts +83 -83
- package/src/engine-components/avatar/Avatar_MustacheShake.ts +31 -31
- package/src/engine-components/codegen/components.ts +217 -217
- package/src/engine-components/debug/LogStats.ts +21 -21
- package/src/engine-components/export/gltf/GltfExport.ts +265 -265
- package/src/engine-components/export/usdz/Extension.ts +24 -24
- package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +2426 -2426
- package/src/engine-components/export/usdz/USDZExporter.ts +705 -705
- package/src/engine-components/export/usdz/extensions/Animation.ts +1204 -1204
- package/src/engine-components/export/usdz/extensions/DocumentExtension.ts +9 -9
- package/src/engine-components/export/usdz/extensions/NodeMaterialConverter.ts +532 -532
- package/src/engine-components/export/usdz/extensions/USDZText.ts +240 -240
- package/src/engine-components/export/usdz/extensions/USDZUI.ts +189 -189
- package/src/engine-components/export/usdz/extensions/behavior/Actions.ts +99 -99
- package/src/engine-components/export/usdz/extensions/behavior/AudioExtension.ts +102 -102
- package/src/engine-components/export/usdz/extensions/behavior/Behaviour.ts +320 -320
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +1225 -1225
- package/src/engine-components/export/usdz/extensions/behavior/BehavioursBuilder.ts +646 -646
- package/src/engine-components/export/usdz/extensions/behavior/PhysicsExtension.ts +132 -132
- package/src/engine-components/export/usdz/index.ts +2 -2
- package/src/engine-components/export/usdz/utils/animationutils.ts +191 -191
- package/src/engine-components/export/usdz/utils/quicklook.ts +50 -50
- package/src/engine-components/particlesystem/ParticleSystem.ts +1287 -1287
- package/src/engine-components/particlesystem/ParticleSystemModules.ts +1765 -1765
- package/src/engine-components/particlesystem/ParticleSystemSubEmitter.ts +111 -111
- package/src/engine-components/particlesystem/api.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Antialiasing.ts +64 -64
- package/src/engine-components/postprocessing/Effects/BloomEffect.ts +116 -116
- package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +37 -37
- package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +106 -106
- package/src/engine-components/postprocessing/Effects/DepthOfField.ts +103 -103
- package/src/engine-components/postprocessing/Effects/EffectWrapper.ts +25 -25
- package/src/engine-components/postprocessing/Effects/Pixelation.ts +32 -32
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +90 -90
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +192 -192
- package/src/engine-components/postprocessing/Effects/Sharpening.ts +143 -143
- package/src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +61 -61
- package/src/engine-components/postprocessing/Effects/Tonemapping.ts +103 -103
- package/src/engine-components/postprocessing/Effects/Tonemapping.utils.ts +60 -60
- package/src/engine-components/postprocessing/Effects/Vignette.ts +59 -59
- package/src/engine-components/postprocessing/PostProcessingEffect.ts +192 -192
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +572 -572
- package/src/engine-components/postprocessing/Volume.ts +426 -426
- package/src/engine-components/postprocessing/VolumeParameter.ts +158 -158
- package/src/engine-components/postprocessing/VolumeProfile.ts +61 -61
- package/src/engine-components/postprocessing/index.ts +5 -5
- package/src/engine-components/postprocessing/utils.ts +154 -154
- package/src/engine-components/timeline/PlayableDirector.ts +722 -722
- package/src/engine-components/timeline/SignalAsset.ts +144 -144
- package/src/engine-components/timeline/TimelineModels.ts +92 -92
- package/src/engine-components/timeline/TimelineTracks.ts +967 -967
- package/src/engine-components/timeline/index.ts +3 -3
- package/src/engine-components/ui/BaseUIComponent.ts +203 -203
- package/src/engine-components/ui/Button.ts +307 -307
- package/src/engine-components/ui/Canvas.ts +419 -419
- package/src/engine-components/ui/CanvasGroup.ts +54 -54
- package/src/engine-components/ui/EventSystem.ts +854 -854
- package/src/engine-components/ui/Graphic.ts +275 -275
- package/src/engine-components/ui/Image.ts +112 -112
- package/src/engine-components/ui/InputField.ts +321 -321
- package/src/engine-components/ui/Interfaces.ts +57 -57
- package/src/engine-components/ui/Layout.ts +334 -334
- package/src/engine-components/ui/Outline.ts +13 -13
- package/src/engine-components/ui/PointerEvents.ts +206 -206
- package/src/engine-components/ui/RaycastUtils.ts +69 -69
- package/src/engine-components/ui/Raycaster.ts +102 -102
- package/src/engine-components/ui/RectTransform.ts +375 -375
- package/src/engine-components/ui/SpatialHtml.ts +79 -79
- package/src/engine-components/ui/Symbols.ts +1 -1
- package/src/engine-components/ui/Text.ts +578 -578
- package/src/engine-components/ui/Utils.ts +113 -113
- package/src/engine-components/utils/EnvironmentScene.ts +245 -245
- package/src/engine-components/utils/LookAt.ts +88 -88
- package/src/engine-components/utils/OpenURL.ts +114 -114
- package/src/engine-components/webxr/Avatar.ts +265 -265
- package/src/engine-components/webxr/TeleportTarget.ts +9 -9
- package/src/engine-components/webxr/WebARCameraBackground.ts +175 -175
- package/src/engine-components/webxr/WebARSessionRoot.ts +880 -880
- package/src/engine-components/webxr/WebXR.ts +585 -585
- package/src/engine-components/webxr/WebXRAvatar.ts +66 -66
- package/src/engine-components/webxr/WebXRImageTracking.ts +519 -519
- package/src/engine-components/webxr/WebXRPlaneTracking.ts +570 -570
- package/src/engine-components/webxr/WebXRRig.ts +77 -77
- package/src/engine-components/webxr/XRFlag.ts +147 -147
- package/src/engine-components/webxr/controllers/XRControllerFollow.ts +118 -118
- package/src/engine-components/webxr/controllers/XRControllerModel.ts +373 -373
- package/src/engine-components/webxr/controllers/XRControllerMovement.ts +550 -550
- package/src/engine-components/webxr/index.ts +2 -2
- package/src/engine-components/webxr/types.ts +3 -3
- package/src/engine-components-experimental/Presentation.ts +12 -12
- package/src/engine-components-experimental/api.ts +4 -4
- package/src/engine-components-experimental/networking/PlayerSync.ts +401 -401
- package/src/engine-schemes/COMPILE_SCHEMES.bat +3 -3
- package/src/engine-schemes/COMPILE_TS.bat +11 -11
- package/src/engine-schemes/README.md +1 -1
- package/src/engine-schemes/api.ts +12 -12
- package/src/engine-schemes/schemes.ts +28 -28
- package/src/engine-schemes/synced-camera-model.ts +92 -92
- package/src/engine-schemes/synced-transform-model.ts +90 -90
- package/src/engine-schemes/syncedCamera.fbs +10 -10
- package/src/engine-schemes/transform.ts +50 -50
- package/src/engine-schemes/transforms.fbs +25 -25
- package/src/engine-schemes/vec.fbs +19 -19
- package/src/engine-schemes/vec2.ts +33 -33
- package/src/engine-schemes/vec3.ts +38 -38
- package/src/engine-schemes/vec4.ts +43 -43
- package/src/engine-schemes/vr-user-state-buffer.ts +145 -145
- package/src/engine-schemes/vrUserStateBuffer.fbs +17 -17
- package/src/include/draco/draco_decoder.js +34 -34
- package/src/include/ktx2/basis_transcoder.js +21 -21
- package/src/include/needle/arial-msdf.json +1471 -1471
- package/src/include/three/DragControls.js +231 -231
- package/src/include/three/EXT_mesh_gpu_instancing_exporter.js +66 -66
- package/src/needle-engine.ts +70 -70
- package/dist/generateMeshBVH.worker-Cdfpaq5W.js +0 -25
- package/dist/gltf-progressive-YjtQYFa9.js +0 -1052
- package/dist/gltf-progressive-yOP1mp5W.min.js +0 -8
- package/dist/gltf-progressive-zdhlW609.umd.cjs +0 -8
- package/src/engine-schemes/dist/api.js +0 -17
- package/src/engine-schemes/dist/api.js.meta +0 -7
- package/src/engine-schemes/dist/schemes.js +0 -25
- package/src/engine-schemes/dist/schemes.js.meta +0 -7
- package/src/engine-schemes/dist/synced-camera-model.js +0 -74
- package/src/engine-schemes/dist/synced-camera-model.js.meta +0 -7
- package/src/engine-schemes/dist/synced-transform-model.js +0 -73
- package/src/engine-schemes/dist/synced-transform-model.js.meta +0 -7
- package/src/engine-schemes/dist/transform.js +0 -46
- package/src/engine-schemes/dist/transform.js.meta +0 -7
- package/src/engine-schemes/dist/vec2.js +0 -32
- package/src/engine-schemes/dist/vec2.js.meta +0 -7
- package/src/engine-schemes/dist/vec3.js +0 -36
- package/src/engine-schemes/dist/vec3.js.meta +0 -7
- package/src/engine-schemes/dist/vec4.js +0 -40
- package/src/engine-schemes/dist/vec4.js.meta +0 -7
- package/src/engine-schemes/dist/vr-user-state-buffer.js +0 -110
- package/src/engine-schemes/dist/vr-user-state-buffer.js.meta +0 -7
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";var qe=Object.defineProperty;var Ee=n=>{throw TypeError(n)};var Ke=(n,t,e)=>t in n?qe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var c=(n,t,e)=>Ke(n,typeof t!="symbol"?t+"":t,e),Ge=(n,t,e)=>t.has(n)||Ee("Cannot "+e);var y=(n,t,e)=>(Ge(n,t,"read from private field"),e?e.call(n):t.get(n)),j=(n,t,e)=>t.has(n)?Ee("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),z=(n,t,e,r)=>(Ge(n,t,"write to private field"),r?r.call(n,e):t.set(n,e),e);const p=require("./three-B_hneGZr.umd.cjs"),te=require("./three-examples-X3OadjXB.umd.cjs"),Ye="";globalThis.GLTF_PROGRESSIVE_VERSION=Ye;console.debug("[gltf-progressive] version -");let W="https://www.gstatic.com/draco/versioned/decoders/1.5.7/",re="https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";const He=W,je=re,ke=new URL(W+"draco_decoder.js");ke.searchParams.append("range","true");fetch(ke,{method:"GET",headers:{Range:"bytes=0-1"}}).catch(n=>{console.debug(`Failed to fetch remote Draco decoder from ${W} (offline: ${typeof navigator<"u"?navigator.onLine:"unknown"})`),W===He&&$e("./include/draco/"),re===je&&Fe("./include/ktx2/")}).finally(()=>{Ue()});function $e(n){W=n,B&&B[be]!=W?(console.debug("Updating Draco decoder path to "+n),B[be]=W,B.setDecoderPath(W),B.preload()):console.debug("Setting Draco decoder path to "+n)}function Fe(n){re=n,U&&U.transcoderPath!=re?(console.debug("Updating KTX2 transcoder path to "+n),U.setTranscoderPath(re),U.init()):console.debug("Setting KTX2 transcoder path to "+n)}const be=Symbol("dracoDecoderPath");let B,me,U;function Ue(){B||(B=new te.DRACOLoader,B[be]=W,B.setDecoderPath(W),B.setDecoderConfig({type:"js"}),B.preload()),U||(U=new te.KTX2Loader,U.setTranscoderPath(re),U.init()),me||(me=te.MeshoptDecoder)}function Pe(n){return Ue(),n?U.detectSupport(n):n!==null&&console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"),{dracoLoader:B,ktx2Loader:U,meshoptDecoder:me}}function Ae(n){n.dracoLoader||n.setDRACOLoader(B),n.ktx2Loader||n.setKTX2Loader(U),n.meshoptDecoder||n.setMeshoptDecoder(me)}const Se=new WeakMap;function Ce(n,t){let e=Se.get(n);e?e=Object.assign(e,t):e=t,Se.set(n,e)}const De=te.GLTFLoader.prototype.load;function Je(...n){const t=Se.get(this);let e=n[0];const r=new URL(e,window.location.href);if(r.hostname.endsWith("needle.tools")){const o=(t==null?void 0:t.progressive)!==void 0?t.progressive:!0,s=t!=null&&t.usecase?t.usecase:"default";o?this.requestHeader.Accept=`*/*;progressive=allowed;usecase=${s}`:this.requestHeader.Accept=`*/*;usecase=${s}`,e=r.toString()}return n[0]=e,De==null?void 0:De.call(this,...n)}te.GLTFLoader.prototype.load=Je;de("debugprogressive");function de(n){if(typeof window>"u")return!1;const e=new URL(window.location.href).searchParams.get(n);return e==null||e==="0"||e==="false"?!1:e===""?!0:e}function Qe(n,t){if(t===void 0||t.startsWith("./")||t.startsWith("http")||n===void 0)return t;const e=n.lastIndexOf("/");if(e>=0){const r=n.substring(0,e+1);for(;r.endsWith("/")&&t.startsWith("/");)t=t.substring(1);return r+t}return t}let ne;function Ze(){return ne!==void 0||(ne=/iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent),de("debugprogressive")&&console.log("[glTF Progressive]: isMobileDevice",ne)),ne}function et(){if(typeof window>"u")return!1;const n=new URL(window.location.href),t=n.hostname==="localhost"||/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n.hostname);return n.hostname==="127.0.0.1"||t}const tt=typeof window>"u"&&typeof document>"u",Te=Symbol("needle:raycast-mesh");function oe(n){return(n==null?void 0:n[Te])instanceof p.BufferGeometry?n[Te]:null}function rt(n,t){if((n.type==="Mesh"||n.type==="SkinnedMesh")&&!oe(n)){const r=ot(t);r.userData={isRaycastMesh:!0},n[Te]=r}}function st(n=!0){if(n){if(ae)return;const t=ae=p.Mesh.prototype.raycast;p.Mesh.prototype.raycast=function(e,r){const i=this,o=oe(i);let s;o&&i.isMesh&&(s=i.geometry,i.geometry=o),t.call(this,e,r),s&&(i.geometry=s)}}else{if(!ae)return;p.Mesh.prototype.raycast=ae,ae=null}}let ae=null;function ot(n){const t=new p.BufferGeometry;for(const e in n.attributes)t.setAttribute(e,n.getAttribute(e));return t.setIndex(n.getIndex()),t}const Q=new Array,M=de("debugprogressive");let pe,ee=-1;if(M){let n=function(){ee+=1,ee>=t&&(ee=-1),console.log(`Toggle LOD level [${ee}]`)},t=6;window.addEventListener("keyup",e=>{e.key==="p"&&n(),e.key==="w"&&(pe=!pe,console.log(`Toggle wireframe [${pe}]`));const r=parseInt(e.key);!isNaN(r)&&r>=0&&(ee=r,console.log(`Set LOD level to [${ee}]`))})}function Ne(n){if(M)if(Array.isArray(n))for(const t of n)Ne(t);else n&&"wireframe"in n&&(n.wireframe=pe===!0)}const K="NEEDLE_progressive",ve=Symbol("needle-progressive-texture"),w=class w{constructor(t,e){c(this,"parser");c(this,"url");c(this,"_isLoadingMesh");c(this,"loadMesh",t=>{var r,i;if(this._isLoadingMesh)return null;const e=(i=(r=this.parser.json.meshes[t])==null?void 0:r.extensions)==null?void 0:i[K];return e?(this._isLoadingMesh=!0,this.parser.getDependency("mesh",t).then(o=>{var s;return this._isLoadingMesh=!1,o&&w.registerMesh(this.url,e.guid,o,(s=e.lods)==null?void 0:s.length,0,e),o})):null});M&&console.log("Progressive extension registered for",e),this.parser=t,this.url=e}get name(){return K}static getMeshLODExtension(t){const e=this.getAssignedLODInformation(t);return e!=null&&e.key?this.lodInfos.get(e.key):null}static getPrimitiveIndex(t){var r;const e=(r=this.getAssignedLODInformation(t))==null?void 0:r.index;return e??-1}static getMaterialMinMaxLODsCount(t,e){const r=this,i="LODS:minmax",o=t[i];if(o!=null)return o;if(e||(e={min_count:1/0,max_count:0,lods:[]}),Array.isArray(t)){for(const a of t)this.getMaterialMinMaxLODsCount(a,e);return t[i]=e,e}if(M==="verbose"&&console.log("getMaterialMinMaxLODsCount",t),t.type==="ShaderMaterial"||t.type==="RawShaderMaterial"){const a=t;for(const l of Object.keys(a.uniforms)){const u=a.uniforms[l].value;(u==null?void 0:u.isTexture)===!0&&s(u,e)}}else if(t.isMaterial)for(const a of Object.keys(t)){const l=t[a];(l==null?void 0:l.isTexture)===!0&&s(l,e)}return t[i]=e,e;function s(a,l){const u=r.getAssignedLODInformation(a);if(u){const d=r.lodInfos.get(u.key);if(d&&d.lods){l.min_count=Math.min(l.min_count,d.lods.length),l.max_count=Math.max(l.max_count,d.lods.length);for(let h=0;h<d.lods.length;h++){const g=d.lods[h];g.width&&(l.lods[h]=l.lods[h]||{min_height:1/0,max_height:0},l.lods[h].min_height=Math.min(l.lods[h].min_height,g.height),l.lods[h].max_height=Math.max(l.lods[h].max_height,g.height))}}}}}static hasLODLevelAvailable(t,e){var o;if(Array.isArray(t)){for(const s of t)if(this.hasLODLevelAvailable(s,e))return!0;return!1}if(t.isMaterial===!0){for(const s of Object.keys(t)){const a=t[s];if(a&&a.isTexture&&this.hasLODLevelAvailable(a,e))return!0}return!1}else if(t.isGroup===!0){for(const s of t.children)if(s.isMesh===!0&&this.hasLODLevelAvailable(s,e))return!0}let r,i;if(t.isMesh?r=t.geometry:(t.isBufferGeometry||t.isTexture)&&(r=t),r&&(o=r==null?void 0:r.userData)!=null&&o.LODS){const s=r.userData.LODS;if(i=this.lodInfos.get(s.key),e===void 0)return i!=null;if(i)return Array.isArray(i.lods)?e<i.lods.length:e===0}return!1}static assignMeshLOD(t,e){var r;if(!t)return Promise.resolve(null);if(t instanceof p.Mesh||t.isMesh===!0){const i=t.geometry,o=this.getAssignedLODInformation(i);if(!o)return Promise.resolve(null);for(const s of Q)(r=s.onBeforeGetLODMesh)==null||r.call(s,t,e);return t["LOD:requested level"]=e,w.getOrLoadLOD(i,e).then(s=>{if(Array.isArray(s)){const a=o.index||0;s=s[a]}return t["LOD:requested level"]===e&&(delete t["LOD:requested level"],s&&i!=s&&((s==null?void 0:s.isBufferGeometry)?t.geometry=s:M&&console.error("Invalid LOD geometry",s))),s}).catch(s=>(console.error("Error loading mesh LOD",t,s),null))}else M&&console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh",t);return Promise.resolve(null)}static assignTextureLOD(t,e=0){if(!t)return Promise.resolve(null);if(t.isMesh===!0){const r=t;if(Array.isArray(r.material)){const i=new Array;for(const o of r.material){const s=this.assignTextureLOD(o,e);i.push(s)}return Promise.all(i).then(o=>{const s=new Array;for(const a of o)Array.isArray(a)&&s.push(...a);return s})}else return this.assignTextureLOD(r.material,e)}if(t.isMaterial===!0){const r=t,i=[],o=new Array;if(r.uniforms&&(r.isRawShaderMaterial||r.isShaderMaterial===!0)){const s=r;for(const a of Object.keys(s.uniforms)){const l=s.uniforms[a].value;if((l==null?void 0:l.isTexture)===!0){const u=this.assignTextureLODForSlot(l,e,r,a).then(d=>(d&&s.uniforms[a].value!=d&&(s.uniforms[a].value=d,s.uniformsNeedUpdate=!0),d));i.push(u),o.push(a)}}}else for(const s of Object.keys(r)){const a=r[s];if((a==null?void 0:a.isTexture)===!0){const l=this.assignTextureLODForSlot(a,e,r,s);i.push(l),o.push(s)}}return Promise.all(i).then(s=>{const a=new Array;for(let l=0;l<s.length;l++){const u=s[l],d=o[l];u&&u.isTexture===!0?a.push({material:r,slot:d,texture:u,level:e}):a.push({material:r,slot:d,texture:null,level:e})}return a})}if(t instanceof p.Texture||t.isTexture===!0){const r=t;return this.assignTextureLODForSlot(r,e,null,null)}return Promise.resolve(null)}static assignTextureLODForSlot(t,e,r,i){return(t==null?void 0:t.isTexture)!==!0?Promise.resolve(null):i==="glyphMap"?Promise.resolve(t):w.getOrLoadLOD(t,e).then(o=>{if(Array.isArray(o))return null;if((o==null?void 0:o.isTexture)===!0){if(o!=t&&r&&i){const s=r[i];if(s&&!M){const a=this.getAssignedLODInformation(s);if(a&&(a==null?void 0:a.level)<e)return M==="verbose"&&console.warn("Assigned texture level is already higher: ",a.level,e,r,s,o),null}r[i]=o}return o}else M=="verbose"&&console.warn("No LOD found for",t,e);return null}).catch(o=>(console.error("Error loading LOD",t,o),null))}afterRoot(t){var e,r;return M&&console.log("AFTER",this.url,t),(e=this.parser.json.textures)==null||e.forEach((i,o)=>{var s;if(i!=null&&i.extensions){const a=i==null?void 0:i.extensions[K];if(a){if(!a.lods){M&&console.warn("Texture has no LODs",a);return}let l=!1;for(const u of this.parser.associations.keys())if(u.isTexture===!0){const d=this.parser.associations.get(u);(d==null?void 0:d.textures)===o&&(l=!0,w.registerTexture(this.url,u,(s=a.lods)==null?void 0:s.length,o,a))}l||this.parser.getDependency("texture",o).then(u=>{var d;u&&w.registerTexture(this.url,u,(d=a.lods)==null?void 0:d.length,o,a)})}}}),(r=this.parser.json.meshes)==null||r.forEach((i,o)=>{if(i!=null&&i.extensions){const s=i==null?void 0:i.extensions[K];if(s&&s.lods){for(const a of this.parser.associations.keys())if(a.isMesh){const l=this.parser.associations.get(a);(l==null?void 0:l.meshes)===o&&w.registerMesh(this.url,s.guid,a,s.lods.length,l.primitives,s)}}}}),null}static async getOrLoadLOD(t,e){var a,l,u,d;const r=M=="verbose",i=t.userData.LODS;if(!i)return null;const o=i==null?void 0:i.key;let s;if(t.isTexture===!0){const h=t;h.source&&h.source[ve]&&(s=h.source[ve])}if(s||(s=w.lodInfos.get(o)),s){if(e>0){let v=!1;const S=Array.isArray(s.lods);if(S&&e>=s.lods.length?v=!0:S||(v=!0),v)return this.lowresCache.get(o)}const h=Array.isArray(s.lods)?(a=s.lods[e])==null?void 0:a.path:s.lods;if(!h)return M&&!s["missing:uri"]&&(s["missing:uri"]=!0,console.warn("Missing uri for progressive asset for LOD "+e,s)),null;const g=Qe(i.url,h);if(g.endsWith(".glb")||g.endsWith(".gltf")){if(!s.guid)return console.warn("missing pointer for glb/gltf texture",s),null;const v=g+"_"+s.guid,S=this.previouslyLoaded.get(v);if(S!==void 0){r&&console.log(`LOD ${e} was already loading/loaded: ${v}`);let _=await S.catch(m=>(console.error(`Error loading LOD ${e} from ${g}
|
|
2
|
+
`,m),null)),b=!1;if(_==null||(_ instanceof p.Texture&&t instanceof p.Texture?(l=_.image)!=null&&l.data||(u=_.source)!=null&&u.data?_=this.copySettings(t,_):(b=!0,this.previouslyLoaded.delete(v)):_ instanceof p.BufferGeometry&&t instanceof p.BufferGeometry&&((d=_.attributes.position)!=null&&d.array||(b=!0,this.previouslyLoaded.delete(v)))),!b)return _}const D=s,N=new Promise(async(_,b)=>{const m=new te.GLTFLoader;Ae(m),M&&(await new Promise(T=>setTimeout(T,1e3)),r&&console.warn("Start loading (delayed) "+g,D.guid));let q=g;if(D&&Array.isArray(D.lods)){const T=D.lods[e];T.hash&&(q+="?v="+T.hash)}const A=await m.loadAsync(q).catch(T=>(console.error(`Error loading LOD ${e} from ${g}
|
|
3
|
+
`,T),null));if(!A)return null;const R=A.parser;r&&console.log("Loading finished "+g,D.guid);let I=0;if(A.parser.json.textures){let T=!1;for(const f of A.parser.json.textures){if(f!=null&&f.extensions){const P=f==null?void 0:f.extensions[K];if(P!=null&&P.guid&&P.guid===D.guid){T=!0;break}}I++}if(T){let f=await R.getDependency("texture",I);return f&&w.assignLODInformation(i.url,f,o,e,void 0),r&&console.log('change "'+t.name+'" → "'+f.name+'"',g,I,f,v),t instanceof p.Texture&&(f=this.copySettings(t,f)),f&&(f.guid=D.guid),_(f)}else M&&console.warn("Could not find texture with guid",D.guid,A.parser.json)}if(I=0,A.parser.json.meshes){let T=!1;for(const f of A.parser.json.meshes){if(f!=null&&f.extensions){const P=f==null?void 0:f.extensions[K];if(P!=null&&P.guid&&P.guid===D.guid){T=!0;break}}I++}if(T){const f=await R.getDependency("mesh",I);if(r&&console.log(`Loaded Mesh "${f.name}"`,g,I,f,v),f.isMesh===!0){const P=f.geometry;return w.assignLODInformation(i.url,P,o,e,0),_(P)}else{const P=new Array;for(let x=0;x<f.children.length;x++){const O=f.children[x];if(O.isMesh===!0){const C=O.geometry;w.assignLODInformation(i.url,C,o,e,x),P.push(C)}}return _(P)}}else M&&console.warn("Could not find mesh with guid",D.guid,A.parser.json)}return _(null)});return this.previouslyLoaded.set(v,N),await N}else if(t instanceof p.Texture){r&&console.log("Load texture from uri: "+g);const S=await new p.TextureLoader().loadAsync(g);return S?(S.guid=s.guid,S.flipY=!1,S.needsUpdate=!0,S.colorSpace=t.colorSpace,r&&console.log(s,S)):M&&console.warn("failed loading",g),S}}else M&&console.warn(`Can not load LOD ${e}: no LOD info found for "${o}" ${t.name}`,t.type);return null}static assignLODInformation(t,e,r,i,o){if(!e)return;e.userData||(e.userData={});const s=new it(t,r,i,o);e.userData.LODS=s}static getAssignedLODInformation(t){var e;return((e=t==null?void 0:t.userData)==null?void 0:e.LODS)||null}static copySettings(t,e){return e?(M&&console.warn(`Copy texture settings
|
|
4
|
+
`,t.uuid,`
|
|
5
|
+
`,e.uuid),e=e.clone(),e.offset=t.offset,e.repeat=t.repeat,e.colorSpace=t.colorSpace,e.magFilter=t.magFilter,e.minFilter=t.minFilter,e.wrapS=t.wrapS,e.wrapT=t.wrapT,e.flipY=t.flipY,e.anisotropy=t.anisotropy,e.mipmaps||(e.generateMipmaps=t.generateMipmaps),e):t}};c(w,"registerTexture",(t,e,r,i,o)=>{if(M&&console.log("> Progressive: register texture",i,e.name,e.uuid,e,o),!e){M&&console.error("gltf-progressive: Register texture without texture");return}e.source&&(e.source[ve]=o);const s=o.guid;w.assignLODInformation(t,e,s,r,i),w.lodInfos.set(s,o),w.lowresCache.set(s,e)}),c(w,"registerMesh",(t,e,r,i,o,s)=>{var u;const a=r.geometry;if(!a){M&&console.warn("gltf-progressive: Register mesh without geometry");return}a.userData||(a.userData={}),M&&console.log("> Progressive: register mesh "+r.name,{index:o,uuid:r.uuid},s,r),w.assignLODInformation(t,a,e,i,o),w.lodInfos.set(e,s);let l=w.lowresCache.get(e);l?l.push(r.geometry):l=[r.geometry],w.lowresCache.set(e,l),i>0&&!oe(r)&&rt(r,a);for(const d of Q)(u=d.onRegisteredNewMesh)==null||u.call(d,r,s)}),c(w,"lodInfos",new Map),c(w,"previouslyLoaded",new Map),c(w,"lowresCache",new Map);let F=w;class it{constructor(t,e,r,i){c(this,"url");c(this,"key");c(this,"level");c(this,"index");this.url=t,this.key=e,this.level=r,i!=null&&(this.index=i)}}class ye{constructor(t,e){c(this,"frame_start");c(this,"frame_capture_end");c(this,"ready");c(this,"_resolve");c(this,"_signal");c(this,"_resolved",!1);c(this,"_addedCount",0);c(this,"_resolvedCount",0);c(this,"_awaiting",[]);c(this,"_currentFrame",0);var o;const r=t===0?2:1,i=Math.max(e.frames??r,r);this.frame_start=t,this.frame_capture_end=t+i,this.ready=new Promise(s=>{this._resolve=s}),this.ready.finally(()=>{this._resolved=!0,this._awaiting.length=0}),this._signal=e.signal,(o=this._signal)==null||o.addEventListener("abort",()=>{this.resolveNow()})}get awaitedCount(){return this._addedCount}get resolvedCount(){return this._resolvedCount}get currentlyAwaiting(){return this._awaiting.length}update(t){var e;this._currentFrame=t,((e=this._signal)!=null&&e.aborted||this._currentFrame>this.frame_capture_end&&this._awaiting.length===0)&&this.resolveNow()}add(t,e){if(this._resolved){console.warn("PromiseGroup: Trying to add a promise to a resolved group, ignoring.");return}this._currentFrame>this.frame_capture_end||(this._awaiting.push(e),this._addedCount++,e.finally(()=>{this._resolvedCount++,this._awaiting.splice(this._awaiting.indexOf(e),1)}))}resolveNow(){var t,e;this._resolved||(e=this._resolve)==null||e.call(this,{awaited_count:this._addedCount,resolved_count:this._resolvedCount,cancelled:((t=this._signal)==null?void 0:t.aborted)??!1})}}c(ye,"addPromise",(t,e,r)=>{r.forEach(i=>{i.add(t,e)})});const $=de("debugprogressive"),nt=de("noprogressive"),_e=Symbol("Needle:LODSManager"),Oe=Symbol("Needle:LODState"),J=Symbol("Needle:CurrentLOD"),E={mesh_lod:-1,texture_lod:-1};var L,G,Y,Le,Z,se,xe,H;let ce=(L=class{constructor(t,e){c(this,"renderer");c(this,"context");c(this,"projectionScreenMatrix",new p.Matrix4);c(this,"targetTriangleDensity",2e5);c(this,"skinnedMeshAutoUpdateBoundsInterval",30);c(this,"updateInterval","auto");j(this,G,1);c(this,"pause",!1);c(this,"manual",!1);c(this,"_newPromiseGroups",[]);c(this,"_promiseGroupIds",0);c(this,"_lodchangedlisteners",[]);j(this,Y);j(this,Le,new p.Clock);j(this,Z,0);j(this,se,0);j(this,xe,0);j(this,H,0);c(this,"_fpsBuffer",[60,60,60,60,60]);c(this,"_sphere",new p.Sphere);c(this,"_tempBox",new p.Box3);c(this,"_tempBox2",new p.Box3);c(this,"tempMatrix",new p.Matrix4);c(this,"_tempWorldPosition",new p.Vector3);c(this,"_tempBoxSize",new p.Vector3);c(this,"_tempBox2Size",new p.Vector3);this.renderer=t,this.context={...e}}static getObjectLODState(t){return t[Oe]}static addPlugin(t){Q.push(t)}static removePlugin(t){const e=Q.indexOf(t);e>=0&&Q.splice(e,1)}static get(t,e){if(t[_e])return console.debug("[gltf-progressive] LODsManager already exists for this renderer"),t[_e];const r=new L(t,{engine:"unknown",...e});return t[_e]=r,r}get plugins(){return Q}awaitLoading(t){const e=this._promiseGroupIds++,r=new ye(y(this,Z),{...t});this._newPromiseGroups.push(r);const i=performance.now();return r.ready.finally(()=>{const o=this._newPromiseGroups.indexOf(r);o>=0&&(this._newPromiseGroups.splice(o,1),et()&&performance.measure("LODsManager:awaitLoading",{start:i,detail:{id:e,name:t==null?void 0:t.name,awaited:r.awaitedCount,resolved:r.resolvedCount}}))}),r.ready}_postprocessPromiseGroups(){if(this._newPromiseGroups.length!==0)for(let t=this._newPromiseGroups.length-1;t>=0;t--)this._newPromiseGroups[t].update(y(this,Z))}addEventListener(t,e){t==="changed"&&this._lodchangedlisteners.push(e)}removeEventListener(t,e){if(t==="changed"){const r=this._lodchangedlisteners.indexOf(e);r>=0&&this._lodchangedlisteners.splice(r,1)}}enable(){if(y(this,Y))return;console.debug("[gltf-progressive] Enabling LODsManager for renderer");let t=0;z(this,Y,this.renderer.render);const e=this;Pe(this.renderer),this.renderer.render=function(r,i){const o=e.renderer.getRenderTarget();(o==null||"isXRRenderTarget"in o&&o.isXRRenderTarget)&&(t=0,z(e,Z,y(e,Z)+1),z(e,se,y(e,Le).getDelta()),z(e,xe,y(e,xe)+y(e,se)),e._fpsBuffer.shift(),e._fpsBuffer.push(1/y(e,se)),z(e,H,e._fpsBuffer.reduce((a,l)=>a+l)/e._fpsBuffer.length),$&&y(e,Z)%200===0&&console.log("FPS",Math.round(y(e,H)),"Interval:",y(e,G)));const s=t++;y(e,Y).call(this,r,i),e.onAfterRender(r,i,s)}}disable(){y(this,Y)&&(console.debug("[gltf-progressive] Disabling LODsManager for renderer"),this.renderer.render=y(this,Y),z(this,Y,void 0))}update(t,e){this.internalUpdate(t,e)}onAfterRender(t,e,r){if(this.pause)return;const o=this.renderer.renderLists.get(t,0).opaque;let s=!0;if(o.length===1){const a=o[0].material;(a.name==="EffectMaterial"||a.name==="CopyShader")&&(s=!1)}if((e.parent&&e.parent.type==="CubeCamera"||r>=1&&e.type==="OrthographicCamera")&&(s=!1),s){if(nt||(this.updateInterval==="auto"?y(this,H)<40&&y(this,G)<10?(z(this,G,y(this,G)+1),$&&console.warn("↓ Reducing LOD updates",y(this,G),y(this,H).toFixed(0))):y(this,H)>=60&&y(this,G)>1&&(z(this,G,y(this,G)-1),$&&console.warn("↑ Increasing LOD updates",y(this,G),y(this,H).toFixed(0))):z(this,G,this.updateInterval),y(this,G)>0&&y(this,Z)%y(this,G)!=0))return;this.internalUpdate(t,e),this._postprocessPromiseGroups()}}internalUpdate(t,e){var l,u;const r=this.renderer.renderLists.get(t,0),i=r.opaque;this.projectionScreenMatrix.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse);const o=this.targetTriangleDensity;for(const d of i){if(d.material&&(((l=d.geometry)==null?void 0:l.type)==="BoxGeometry"||((u=d.geometry)==null?void 0:u.type)==="BufferGeometry")&&(d.material.name==="SphericalGaussianBlur"||d.material.name=="BackgroundCubeMaterial"||d.material.name==="CubemapFromEquirect"||d.material.name==="EquirectangularToCubeUV")){$&&(d.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"]||(d.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"]=!0,console.warn("Ignoring skybox or BLIT object",d,d.material.name,d.material.type)));continue}switch(d.material.type){case"LineBasicMaterial":case"LineDashedMaterial":case"PointsMaterial":case"ShadowMaterial":case"MeshDistanceMaterial":case"MeshDepthMaterial":continue}if($==="color"&&d.material&&!d.object.progressive_debug_color){d.object.progressive_debug_color=!0;const g=Math.random()*16777215,v=new p.MeshStandardMaterial({color:g});d.object.material=v}const h=d.object;(h instanceof p.Mesh||h.isMesh)&&this.updateLODs(t,e,h,o)}const s=r.transparent;for(const d of s){const h=d.object;(h instanceof p.Mesh||h.isMesh)&&this.updateLODs(t,e,h,o)}const a=r.transmissive;for(const d of a){const h=d.object;(h instanceof p.Mesh||h.isMesh)&&this.updateLODs(t,e,h,o)}}updateLODs(t,e,r,i){var a,l;r.userData||(r.userData={});let o=r[Oe];if(o||(o=new at,r[Oe]=o),o.frames++<2)return;for(const u of Q)(a=u.onBeforeUpdateLOD)==null||a.call(u,this.renderer,t,e,r);const s=L.overrideGlobalLodLevel!==void 0?L.overrideGlobalLodLevel:ee;s>=0?(E.mesh_lod=s,E.texture_lod=s):(this.calculateLodLevel(e,r,o,i,E),E.mesh_lod=Math.round(E.mesh_lod),E.texture_lod=Math.round(E.texture_lod)),E.mesh_lod>=0&&this.loadProgressiveMeshes(r,E.mesh_lod),r.material&&E.texture_lod>=0&&this.loadProgressiveTextures(r.material,E.texture_lod),M&&r.material&&!r.isGizmo&&Ne(r.material);for(const u of Q)(l=u.onAfterUpdatedLOD)==null||l.call(u,this.renderer,t,e,r,E);o.lastLodLevel_Mesh=E.mesh_lod,o.lastLodLevel_Texture=E.texture_lod}loadProgressiveTextures(t,e){if(!t)return;if(Array.isArray(t)){for(const o of t)this.loadProgressiveTextures(o,e);return}let r=!1;(t[J]===void 0||e<t[J])&&(r=!0);const i=t["DEBUG:LOD"];if(i!=null&&(r=t[J]!=i,e=i),r){t[J]=e;const o=F.assignTextureLOD(t,e).then(s=>{this._lodchangedlisteners.forEach(a=>a({type:"texture",level:e,object:t}))});ye.addPromise("texture",o,this._newPromiseGroups)}}loadProgressiveMeshes(t,e){if(!t)return Promise.resolve(null);let r=t[J]!==e;const i=t["DEBUG:LOD"];if(i!=null&&(r=t[J]!=i,e=i),r){t[J]=e;const o=t.geometry,s=F.assignMeshLOD(t,e).then(a=>(a&&t[J]==e&&o!=t.geometry&&this._lodchangedlisteners.forEach(l=>l({type:"mesh",level:e,object:t})),a));return ye.addPromise("mesh",s,this._newPromiseGroups),s}return Promise.resolve(null)}static isInside(t,e){const r=t.min,i=t.max,o=(r.x+i.x)*.5,s=(r.y+i.y)*.5;return this._tempPtInside.set(o,s,r.z).applyMatrix4(e).z<0}calculateLodLevel(t,e,r,i,o){var N,X,_;if(!e){o.mesh_lod=-1,o.texture_lod=-1;return}if(!t){o.mesh_lod=-1,o.texture_lod=-1;return}let a=10+1,l=!1;if($&&e["DEBUG:LOD"]!=null)return e["DEBUG:LOD"];const u=(N=F.getMeshLODExtension(e.geometry))==null?void 0:N.lods,d=F.getPrimitiveIndex(e.geometry),h=u&&u.length>0,g=F.getMaterialMinMaxLODsCount(e.material),v=(g==null?void 0:g.min_count)!=1/0&&g.min_count>0&&g.max_count>0;if(!h&&!v){o.mesh_lod=0,o.texture_lod=0;return}h||(l=!0,a=0);const S=this.renderer.domElement.clientHeight||this.renderer.domElement.height;let D=e.geometry.boundingBox;if(e.type==="SkinnedMesh"){const b=e;if(!b.boundingBox)b.computeBoundingBox();else if(this.skinnedMeshAutoUpdateBoundsInterval>0&&r.frames%this.skinnedMeshAutoUpdateBoundsInterval===0){const m=oe(b),q=b.geometry;m&&(b.geometry=m),b.computeBoundingBox(),b.geometry=q}D=b.boundingBox}if(D){const b=t;if(e.geometry.attributes.color&&e.geometry.attributes.color.count<100&&e.geometry.boundingSphere){this._sphere.copy(e.geometry.boundingSphere),this._sphere.applyMatrix4(e.matrixWorld);const x=t.getWorldPosition(this._tempWorldPosition);if(this._sphere.containsPoint(x)){o.mesh_lod=0,o.texture_lod=0;return}}if(this._tempBox.copy(D),this._tempBox.applyMatrix4(e.matrixWorld),b.isPerspectiveCamera&&L.isInside(this._tempBox,this.projectionScreenMatrix)){o.mesh_lod=0,o.texture_lod=0;return}if(this._tempBox.applyMatrix4(this.projectionScreenMatrix),this.renderer.xr.enabled&&b.isPerspectiveCamera&&b.fov>70){const x=this._tempBox.min,O=this._tempBox.max;let C=x.x,k=x.y,V=O.x,ie=O.y;const ue=2,we=1.5,fe=(x.x+O.x)*.5,he=(x.y+O.y)*.5;C=(C-fe)*ue+fe,k=(k-he)*ue+he,V=(V-fe)*ue+fe,ie=(ie-he)*ue+he;const We=C<0&&V>0?0:Math.min(Math.abs(x.x),Math.abs(O.x)),Xe=k<0&&ie>0?0:Math.min(Math.abs(x.y),Math.abs(O.y)),Me=Math.max(We,Xe);r.lastCentrality=(we-Me)*(we-Me)*(we-Me)}else r.lastCentrality=1;const m=this._tempBox.getSize(this._tempBoxSize);m.multiplyScalar(.5),screen.availHeight>0&&S>0&&m.multiplyScalar(S/screen.availHeight),t.isPerspectiveCamera?m.x*=t.aspect:t.isOrthographicCamera;const q=t.matrixWorldInverse,A=this._tempBox2;A.copy(D),A.applyMatrix4(e.matrixWorld),A.applyMatrix4(q);const R=A.getSize(this._tempBox2Size),I=Math.max(R.x,R.y);if(Math.max(m.x,m.y)!=0&&I!=0&&(m.z=R.z/Math.max(R.x,R.y)*Math.max(m.x,m.y)),r.lastScreenCoverage=Math.max(m.x,m.y,m.z),r.lastScreenspaceVolume.copy(m),r.lastScreenCoverage*=r.lastCentrality,$&&L.debugDrawLine){const x=this.tempMatrix.copy(this.projectionScreenMatrix);x.invert();const O=L.corner0,C=L.corner1,k=L.corner2,V=L.corner3;O.copy(this._tempBox.min),C.copy(this._tempBox.max),C.x=O.x,k.copy(this._tempBox.max),k.y=O.y,V.copy(this._tempBox.max);const ie=(O.z+V.z)*.5;O.z=C.z=k.z=V.z=ie,O.applyMatrix4(x),C.applyMatrix4(x),k.applyMatrix4(x),V.applyMatrix4(x),L.debugDrawLine(O,C,255),L.debugDrawLine(O,k,255),L.debugDrawLine(C,V,255),L.debugDrawLine(k,V,255)}let f=999;if(u&&r.lastScreenCoverage>0)for(let x=0;x<u.length;x++){const O=u[x];if((((X=O.densities)==null?void 0:X[d])||O.density||1e-5)/r.lastScreenCoverage<i){f=x;break}}f<a&&(a=f,l=!0)}if(l?o.mesh_lod=a:o.mesh_lod=r.lastLodLevel_Mesh,$&&o.mesh_lod!=r.lastLodLevel_Mesh){const m=u==null?void 0:u[o.mesh_lod];m&&console.log(`Mesh LOD changed: ${r.lastLodLevel_Mesh} → ${o.mesh_lod} (${m.density.toFixed(0)}) - ${e.name}`)}if(v){const b="saveData"in globalThis.navigator&&globalThis.navigator.saveData===!0;if(r.lastLodLevel_Texture<0){if(o.texture_lod=g.max_count-1,$){const m=g.lods[g.max_count-1];$&&console.log(`First Texture LOD ${o.texture_lod} (${m.max_height}px) - ${e.name}`)}}else{const m=r.lastScreenspaceVolume.x+r.lastScreenspaceVolume.y+r.lastScreenspaceVolume.z;let q=r.lastScreenCoverage*4;((_=this.context)==null?void 0:_.engine)==="model-viewer"&&(q*=1.5);const R=S/window.devicePixelRatio*q;let I=!1;for(let T=g.lods.length-1;T>=0;T--){const f=g.lods[T];if(!(b&&f.max_height>=2048)&&!(Ze()&&f.max_height>4096)&&(f.max_height>R||!I&&T===0)){if(I=!0,o.texture_lod=T,o.texture_lod<r.lastLodLevel_Texture){const P=f.max_height;$&&console.log(`Texture LOD changed: ${r.lastLodLevel_Texture} → ${o.texture_lod} = ${P}px
|
|
6
|
+
Screensize: ${R.toFixed(0)}px, Coverage: ${(100*r.lastScreenCoverage).toFixed(2)}%, Volume ${m.toFixed(1)}
|
|
7
|
+
${e.name}`)}break}}}}else o.texture_lod=0}},G=new WeakMap,Y=new WeakMap,Le=new WeakMap,Z=new WeakMap,se=new WeakMap,xe=new WeakMap,H=new WeakMap,c(L,"debugDrawLine"),c(L,"overrideGlobalLodLevel"),c(L,"corner0",new p.Vector3),c(L,"corner1",new p.Vector3),c(L,"corner2",new p.Vector3),c(L,"corner3",new p.Vector3),c(L,"_tempPtInside",new p.Vector3),L);class at{constructor(){c(this,"frames",0);c(this,"lastLodLevel_Mesh",-1);c(this,"lastLodLevel_Texture",-1);c(this,"lastScreenCoverage",0);c(this,"lastScreenspaceVolume",new p.Vector3);c(this,"lastCentrality",0)}}const Be=Symbol("NEEDLE_mesh_lod"),ge=Symbol("NEEDLE_texture_lod");let le=null;function Ve(){const n=lt();n&&(n.mapURLs(function(t){return Ie(),t}),Ie(),le==null||le.disconnect(),le=new MutationObserver(t=>{t.forEach(e=>{e.addedNodes.forEach(r=>{r instanceof HTMLElement&&r.tagName.toLowerCase()==="model-viewer"&&ze(r)})})}),le.observe(document,{childList:!0,subtree:!0}))}function lt(){if(typeof customElements>"u")return null;const n=customElements.get("model-viewer");return n||(customElements.whenDefined("model-viewer").then(()=>{console.debug("[gltf-progressive] model-viewer defined"),Ve()}),null)}function Ie(){if(typeof document>"u")return;document.querySelectorAll("model-viewer").forEach(t=>{ze(t)})}const Re=new WeakSet;let ct=0;function ze(n){if(!n||Re.has(n))return null;Re.add(n),console.debug("[gltf-progressive] found new model-viewer..."+ ++ct+`
|
|
8
|
+
`,n.getAttribute("src"));let t=null,e=null,r=null;for(let i=n;i!=null;i=Object.getPrototypeOf(i)){const o=Object.getOwnPropertySymbols(i),s=o.find(u=>u.toString()=="Symbol(renderer)"),a=o.find(u=>u.toString()=="Symbol(scene)"),l=o.find(u=>u.toString()=="Symbol(needsRender)");!t&&s!=null&&(t=n[s].threeRenderer),!e&&a!=null&&(e=n[a]),!r&&l!=null&&(r=n[l])}if(t&&e){let i=function(){if(r){let s=0,a=setInterval(()=>{if(s++>5){clearInterval(a);return}r==null||r.call(n)},300)}};console.debug("[gltf-progressive] setup model-viewer");const o=ce.get(t,{engine:"model-viewer"});return ce.addPlugin(new dt),o.enable(),o.addEventListener("changed",()=>{r==null||r.call(n)}),n.addEventListener("model-visibility",s=>{s.detail.visible&&(r==null||r.call(n))}),n.addEventListener("load",()=>{i()}),()=>{o.disable()}}return null}class dt{constructor(){c(this,"_didWarnAboutMissingUrl",!1)}onBeforeUpdateLOD(t,e,r,i){this.tryParseMeshLOD(e,i),this.tryParseTextureLOD(e,i)}getUrl(t){if(!t)return null;let e=t.getAttribute("src");return e||(e=t.src),e||(this._didWarnAboutMissingUrl||console.warn("No url found in modelviewer",t),this._didWarnAboutMissingUrl=!0),e}tryGetCurrentGLTF(t){return t._currentGLTF}tryGetCurrentModelViewer(t){return t.element}tryParseTextureLOD(t,e){if(e[ge]==!0)return;e[ge]=!0;const r=this.tryGetCurrentGLTF(t),i=this.tryGetCurrentModelViewer(t),o=this.getUrl(i);if(o&&r&&e.material){let s=function(l){var d,h,g;if(l[ge]==!0)return;l[ge]=!0,l.userData&&(l.userData.LOD=-1);const u=Object.keys(l);for(let v=0;v<u.length;v++){const S=u[v],D=l[S];if((D==null?void 0:D.isTexture)===!0){const N=(h=(d=D.userData)==null?void 0:d.associations)==null?void 0:h.textures;if(N==null)continue;const X=r.parser.json.textures[N];if(!X){console.warn("Texture data not found for texture index "+N);continue}if((g=X==null?void 0:X.extensions)!=null&&g[K]){const _=X.extensions[K];_&&o&&F.registerTexture(o,D,_.lods.length,N,_)}}}};const a=e.material;if(Array.isArray(a))for(const l of a)s(l);else s(a)}}tryParseMeshLOD(t,e){var s,a;if(e[Be]==!0)return;e[Be]=!0;const r=this.tryGetCurrentModelViewer(t),i=this.getUrl(r);if(!i)return;const o=(a=(s=e.userData)==null?void 0:s.gltfExtensions)==null?void 0:a[K];if(o&&i){const l=e.uuid;F.registerMesh(i,l,e,0,o.lods.length,o)}}}function ut(n,t,e,r){Pe(t),Ae(e),Ce(e,{progressive:!0,...r==null?void 0:r.hints}),e.register(o=>new F(o,n));const i=ce.get(t);return(r==null?void 0:r.enableLODsManager)!==!1&&i.enable(),i}Ve();if(!tt){const n={gltfProgressive:{useNeedleProgressive:ut,LODsManager:ce,configureLoader:Ce,getRaycastMesh:oe,useRaycastMeshes:st}};if(!globalThis.Needle)globalThis.Needle=n;else for(const t in n)globalThis.Needle[t]=n[t]}exports.LODsManager=ce;exports.NEEDLE_progressive=F;exports.addDracoAndKTX2Loaders=Ae;exports.configureLoader=Ce;exports.createLoaders=Pe;exports.getRaycastMesh=oe;exports.setDracoDecoderLocation=$e;exports.setKTX2TranscoderLocation=Fe;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var Ke=Object.defineProperty,Ee=r=>{throw TypeError(r)},He=(r,e,t)=>e in r?Ke(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,c=(r,e,t)=>He(r,typeof e!="symbol"?e+"":e,t),Ce=(r,e,t)=>e.has(r)||Ee("Cannot "+t),v=(r,e,t)=>(Ce(r,e,"read from private field"),t?t.call(r):e.get(r)),J=(r,e,t)=>e.has(r)?Ee("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),F=(r,e,t,o)=>(Ce(r,e,"write to private field"),o?o.call(r,t):e.set(r,t),t);import{BufferGeometry as de,Mesh as Q,Texture as re,TextureLoader as Ye,Matrix4 as Ie,Clock as Je,MeshStandardMaterial as Qe,Sphere as Ze,Box3 as Be,Vector3 as W}from"./three-DuDKwKB8.min.js";import{DRACOLoader as et,KTX2Loader as tt,MeshoptDecoder as rt,GLTFLoader as Le}from"./three-examples-DaDLBuy6.min.js";const st="";globalThis.GLTF_PROGRESSIVE_VERSION=st,console.debug("[gltf-progressive] version -");let $="https://www.gstatic.com/draco/versioned/decoders/1.5.7/",ee="https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";const ot=$,nt=ee,Ge=new URL($+"draco_decoder.js");Ge.searchParams.append("range","true"),fetch(Ge,{method:"GET",headers:{Range:"bytes=0-1"}}).catch(r=>{console.debug(`Failed to fetch remote Draco decoder from ${$} (offline: ${typeof navigator<"u"?navigator.onLine:"unknown"})`),$===ot&&ke("./include/draco/"),ee===nt&&Re("./include/ktx2/")}).finally(()=>{je()});function ke(r){$=r,A&&A[we]!=$?(console.debug("Updating Draco decoder path to "+r),A[we]=$,A.setDecoderPath($),A.preload()):console.debug("Setting Draco decoder path to "+r)}function Re(r){ee=r,B&&B.transcoderPath!=ee?(console.debug("Updating KTX2 transcoder path to "+r),B.setTranscoderPath(ee),B.init()):console.debug("Setting KTX2 transcoder path to "+r)}const we=Symbol("dracoDecoderPath");let A,ce,B;function je(){A||(A=new et,A[we]=$,A.setDecoderPath($),A.setDecoderConfig({type:"js"}),A.preload()),B||(B=new tt,B.setTranscoderPath(ee),B.init()),ce||(ce=rt)}function _e(r){return je(),r?B.detectSupport(r):r!==null&&console.warn("No renderer provided to detect ktx2 support - loading KTX2 textures might fail"),{dracoLoader:A,ktx2Loader:B,meshoptDecoder:ce}}function De(r){r.dracoLoader||r.setDRACOLoader(A),r.ktx2Loader||r.setKTX2Loader(B),r.meshoptDecoder||r.setMeshoptDecoder(ce)}const Me=new WeakMap;function be(r,e){let t=Me.get(r);t?t=Object.assign(t,e):t=e,Me.set(r,t)}const Ne=Le.prototype.load;function it(...r){const e=Me.get(this);let t=r[0];const o=new URL(t,window.location.href);if(o.hostname.endsWith("needle.tools")){const s=e?.progressive!==void 0?e.progressive:!0,i=e!=null&&e.usecase?e.usecase:"default";s?this.requestHeader.Accept=`*/*;progressive=allowed;usecase=${i}`:this.requestHeader.Accept=`*/*;usecase=${i}`,t=o.toString()}return r[0]=t,Ne?.call(this,...r)}Le.prototype.load=it,se("debugprogressive");function se(r){if(typeof window>"u")return!1;const e=new URL(window.location.href).searchParams.get(r);return e==null||e==="0"||e==="false"?!1:e===""?!0:e}function at(r,e){if(e===void 0||e.startsWith("./")||e.startsWith("http")||r===void 0)return e;const t=r.lastIndexOf("/");if(t>=0){const o=r.substring(0,t+1);for(;o.endsWith("/")&&e.startsWith("/");)e=e.substring(1);return o+e}return e}let he;function lt(){return he!==void 0||(he=/iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent),se("debugprogressive")&&console.log("[glTF Progressive]: isMobileDevice",he)),he}function ut(){if(typeof window>"u")return!1;const r=new URL(window.location.href),e=r.hostname==="localhost"||/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(r.hostname);return r.hostname==="127.0.0.1"||e}const dt=typeof window>"u"&&typeof document>"u",Oe=Symbol("needle:raycast-mesh");function te(r){return r?.[Oe]instanceof de?r[Oe]:null}function ct(r,e){if((r.type==="Mesh"||r.type==="SkinnedMesh")&&!te(r)){const t=gt(e);t.userData={isRaycastMesh:!0},r[Oe]=t}}function ht(r=!0){if(r){if(oe)return;const e=oe=Q.prototype.raycast;Q.prototype.raycast=function(t,o){const s=this,i=te(s);let n;i&&s.isMesh&&(n=s.geometry,s.geometry=i),e.call(this,t,o),n&&(s.geometry=n)}}else{if(!oe)return;Q.prototype.raycast=oe,oe=null}}let oe=null;function gt(r){const e=new de;for(const t in r.attributes)e.setAttribute(t,r.getAttribute(t));return e.setIndex(r.getIndex()),e}const X=new Array,L=se("debugprogressive");let ge,Z=-1;if(L){let r=function(){Z+=1,Z>=e&&(Z=-1),console.log(`Toggle LOD level [${Z}]`)},e=6;window.addEventListener("keyup",t=>{t.key==="p"&&r(),t.key==="w"&&(ge=!ge,console.log(`Toggle wireframe [${ge}]`));const o=parseInt(t.key);!isNaN(o)&&o>=0&&(Z=o,console.log(`Set LOD level to [${Z}]`))})}function $e(r){if(L)if(Array.isArray(r))for(const e of r)$e(e);else r&&"wireframe"in r&&(r.wireframe=ge===!0)}const U="NEEDLE_progressive",Se=Symbol("needle-progressive-texture"),E=class k{constructor(e,t){c(this,"parser"),c(this,"url"),c(this,"_isLoadingMesh"),c(this,"loadMesh",o=>{var s,i;if(this._isLoadingMesh)return null;const n=(i=(s=this.parser.json.meshes[o])==null?void 0:s.extensions)==null?void 0:i[U];return n?(this._isLoadingMesh=!0,this.parser.getDependency("mesh",o).then(a=>{var l;return this._isLoadingMesh=!1,a&&k.registerMesh(this.url,n.guid,a,(l=n.lods)==null?void 0:l.length,0,n),a})):null}),L&&console.log("Progressive extension registered for",t),this.parser=e,this.url=t}get name(){return U}static getMeshLODExtension(e){const t=this.getAssignedLODInformation(e);return t!=null&&t.key?this.lodInfos.get(t.key):null}static getPrimitiveIndex(e){var t;return((t=this.getAssignedLODInformation(e))==null?void 0:t.index)??-1}static getMaterialMinMaxLODsCount(e,t){const o=this,s="LODS:minmax",i=e[s];if(i!=null)return i;if(t||(t={min_count:1/0,max_count:0,lods:[]}),Array.isArray(e)){for(const a of e)this.getMaterialMinMaxLODsCount(a,t);return e[s]=t,t}if(L==="verbose"&&console.log("getMaterialMinMaxLODsCount",e),e.type==="ShaderMaterial"||e.type==="RawShaderMaterial"){const a=e;for(const l of Object.keys(a.uniforms)){const u=a.uniforms[l].value;u?.isTexture===!0&&n(u,t)}}else if(e.isMaterial)for(const a of Object.keys(e)){const l=e[a];l?.isTexture===!0&&n(l,t)}return e[s]=t,t;function n(a,l){const u=o.getAssignedLODInformation(a);if(u){const d=o.lodInfos.get(u.key);if(d&&d.lods){l.min_count=Math.min(l.min_count,d.lods.length),l.max_count=Math.max(l.max_count,d.lods.length);for(let w=0;w<d.lods.length;w++){const y=d.lods[w];y.width&&(l.lods[w]=l.lods[w]||{min_height:1/0,max_height:0},l.lods[w].min_height=Math.min(l.lods[w].min_height,y.height),l.lods[w].max_height=Math.max(l.lods[w].max_height,y.height))}}}}}static hasLODLevelAvailable(e,t){var o;if(Array.isArray(e)){for(const n of e)if(this.hasLODLevelAvailable(n,t))return!0;return!1}if(e.isMaterial===!0){for(const n of Object.keys(e)){const a=e[n];if(a&&a.isTexture&&this.hasLODLevelAvailable(a,t))return!0}return!1}else if(e.isGroup===!0){for(const n of e.children)if(n.isMesh===!0&&this.hasLODLevelAvailable(n,t))return!0}let s,i;if(e.isMesh?s=e.geometry:(e.isBufferGeometry||e.isTexture)&&(s=e),s&&(o=s?.userData)!=null&&o.LODS){const n=s.userData.LODS;if(i=this.lodInfos.get(n.key),t===void 0)return i!=null;if(i)return Array.isArray(i.lods)?t<i.lods.length:t===0}return!1}static assignMeshLOD(e,t){var o;if(!e)return Promise.resolve(null);if(e instanceof Q||e.isMesh===!0){const s=e.geometry,i=this.getAssignedLODInformation(s);if(!i)return Promise.resolve(null);for(const n of X)(o=n.onBeforeGetLODMesh)==null||o.call(n,e,t);return e["LOD:requested level"]=t,k.getOrLoadLOD(s,t).then(n=>{if(Array.isArray(n)){const a=i.index||0;n=n[a]}return e["LOD:requested level"]===t&&(delete e["LOD:requested level"],n&&s!=n&&(n?.isBufferGeometry?e.geometry=n:L&&console.error("Invalid LOD geometry",n))),n}).catch(n=>(console.error("Error loading mesh LOD",e,n),null))}else L&&console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh",e);return Promise.resolve(null)}static assignTextureLOD(e,t=0){if(!e)return Promise.resolve(null);if(e.isMesh===!0){const o=e;if(Array.isArray(o.material)){const s=new Array;for(const i of o.material){const n=this.assignTextureLOD(i,t);s.push(n)}return Promise.all(s).then(i=>{const n=new Array;for(const a of i)Array.isArray(a)&&n.push(...a);return n})}else return this.assignTextureLOD(o.material,t)}if(e.isMaterial===!0){const o=e,s=[],i=new Array;if(o.uniforms&&(o.isRawShaderMaterial||o.isShaderMaterial===!0)){const n=o;for(const a of Object.keys(n.uniforms)){const l=n.uniforms[a].value;if(l?.isTexture===!0){const u=this.assignTextureLODForSlot(l,t,o,a).then(d=>(d&&n.uniforms[a].value!=d&&(n.uniforms[a].value=d,n.uniformsNeedUpdate=!0),d));s.push(u),i.push(a)}}}else for(const n of Object.keys(o)){const a=o[n];if(a?.isTexture===!0){const l=this.assignTextureLODForSlot(a,t,o,n);s.push(l),i.push(n)}}return Promise.all(s).then(n=>{const a=new Array;for(let l=0;l<n.length;l++){const u=n[l],d=i[l];u&&u.isTexture===!0?a.push({material:o,slot:d,texture:u,level:t}):a.push({material:o,slot:d,texture:null,level:t})}return a})}if(e instanceof re||e.isTexture===!0){const o=e;return this.assignTextureLODForSlot(o,t,null,null)}return Promise.resolve(null)}static assignTextureLODForSlot(e,t,o,s){return e?.isTexture!==!0?Promise.resolve(null):s==="glyphMap"?Promise.resolve(e):k.getOrLoadLOD(e,t).then(i=>{if(Array.isArray(i))return null;if(i?.isTexture===!0){if(i!=e&&o&&s){const n=o[s];if(n&&!L){const a=this.getAssignedLODInformation(n);if(a&&a?.level<t)return L==="verbose"&&console.warn("Assigned texture level is already higher: ",a.level,t,o,n,i),null}o[s]=i}return i}else L=="verbose"&&console.warn("No LOD found for",e,t);return null}).catch(i=>(console.error("Error loading LOD",e,i),null))}afterRoot(e){var t,o;return L&&console.log("AFTER",this.url,e),(t=this.parser.json.textures)==null||t.forEach((s,i)=>{var n;if(s!=null&&s.extensions){const a=s?.extensions[U];if(a){if(!a.lods){L&&console.warn("Texture has no LODs",a);return}let l=!1;for(const u of this.parser.associations.keys())if(u.isTexture===!0){const d=this.parser.associations.get(u);d?.textures===i&&(l=!0,k.registerTexture(this.url,u,(n=a.lods)==null?void 0:n.length,i,a))}l||this.parser.getDependency("texture",i).then(u=>{var d;u&&k.registerTexture(this.url,u,(d=a.lods)==null?void 0:d.length,i,a)})}}}),(o=this.parser.json.meshes)==null||o.forEach((s,i)=>{if(s!=null&&s.extensions){const n=s?.extensions[U];if(n&&n.lods){for(const a of this.parser.associations.keys())if(a.isMesh){const l=this.parser.associations.get(a);l?.meshes===i&&k.registerMesh(this.url,n.guid,a,n.lods.length,l.primitives,n)}}}}),null}static async getOrLoadLOD(e,t){var o,s,i,n;const a=L=="verbose",l=e.userData.LODS;if(!l)return null;const u=l?.key;let d;if(e.isTexture===!0){const w=e;w.source&&w.source[Se]&&(d=w.source[Se])}if(d||(d=k.lodInfos.get(u)),d){if(t>0){let m=!1;const R=Array.isArray(d.lods);if(R&&t>=d.lods.length?m=!0:R||(m=!0),m)return this.lowresCache.get(u)}const w=Array.isArray(d.lods)?(o=d.lods[t])==null?void 0:o.path:d.lods;if(!w)return L&&!d["missing:uri"]&&(d["missing:uri"]=!0,console.warn("Missing uri for progressive asset for LOD "+t,d)),null;const y=at(l.url,w);if(y.endsWith(".glb")||y.endsWith(".gltf")){if(!d.guid)return console.warn("missing pointer for glb/gltf texture",d),null;const m=y+"_"+d.guid,R=this.previouslyLoaded.get(m);if(R!==void 0){a&&console.log(`LOD ${t} was already loading/loaded: ${m}`);let g=await R.catch(I=>(console.error(`Error loading LOD ${t} from ${y}
|
|
2
|
+
`,I),null)),p=!1;if(g==null||(g instanceof re&&e instanceof re?(s=g.image)!=null&&s.data||(i=g.source)!=null&&i.data?g=this.copySettings(e,g):(p=!0,this.previouslyLoaded.delete(m)):g instanceof de&&e instanceof de&&((n=g.attributes.position)!=null&&n.array||(p=!0,this.previouslyLoaded.delete(m)))),!p)return g}const D=d,C=new Promise(async(g,p)=>{const I=new Le;De(I),L&&(await new Promise(f=>setTimeout(f,1e3)),a&&console.warn("Start loading (delayed) "+y,D.guid));let j=y;if(D&&Array.isArray(D.lods)){const f=D.lods[t];f.hash&&(j+="?v="+f.hash)}const M=await I.loadAsync(j).catch(f=>(console.error(`Error loading LOD ${t} from ${y}
|
|
3
|
+
`,f),null));if(!M)return null;const N=M.parser;a&&console.log("Loading finished "+y,D.guid);let b=0;if(M.parser.json.textures){let f=!1;for(const h of M.parser.json.textures){if(h!=null&&h.extensions){const x=h?.extensions[U];if(x!=null&&x.guid&&x.guid===D.guid){f=!0;break}}b++}if(f){let h=await N.getDependency("texture",b);return h&&k.assignLODInformation(l.url,h,u,t,void 0),a&&console.log('change "'+e.name+'" \u2192 "'+h.name+'"',y,b,h,m),e instanceof re&&(h=this.copySettings(e,h)),h&&(h.guid=D.guid),g(h)}else L&&console.warn("Could not find texture with guid",D.guid,M.parser.json)}if(b=0,M.parser.json.meshes){let f=!1;for(const h of M.parser.json.meshes){if(h!=null&&h.extensions){const x=h?.extensions[U];if(x!=null&&x.guid&&x.guid===D.guid){f=!0;break}}b++}if(f){const h=await N.getDependency("mesh",b);if(a&&console.log(`Loaded Mesh "${h.name}"`,y,b,h,m),h.isMesh===!0){const x=h.geometry;return k.assignLODInformation(l.url,x,u,t,0),g(x)}else{const x=new Array;for(let O=0;O<h.children.length;O++){const P=h.children[O];if(P.isMesh===!0){const V=P.geometry;k.assignLODInformation(l.url,V,u,t,O),x.push(V)}}return g(x)}}else L&&console.warn("Could not find mesh with guid",D.guid,M.parser.json)}return g(null)});return this.previouslyLoaded.set(m,C),await C}else if(e instanceof re){a&&console.log("Load texture from uri: "+y);const m=await new Ye().loadAsync(y);return m?(m.guid=d.guid,m.flipY=!1,m.needsUpdate=!0,m.colorSpace=e.colorSpace,a&&console.log(d,m)):L&&console.warn("failed loading",y),m}}else L&&console.warn(`Can not load LOD ${t}: no LOD info found for "${u}" ${e.name}`,e.type);return null}static assignLODInformation(e,t,o,s,i){if(!t)return;t.userData||(t.userData={});const n=new ft(e,o,s,i);t.userData.LODS=n}static getAssignedLODInformation(e){var t;return((t=e?.userData)==null?void 0:t.LODS)||null}static copySettings(e,t){return t?(L&&console.warn(`Copy texture settings
|
|
4
|
+
`,e.uuid,`
|
|
5
|
+
`,t.uuid),t=t.clone(),t.offset=e.offset,t.repeat=e.repeat,t.colorSpace=e.colorSpace,t.magFilter=e.magFilter,t.minFilter=e.minFilter,t.wrapS=e.wrapS,t.wrapT=e.wrapT,t.flipY=e.flipY,t.anisotropy=e.anisotropy,t.mipmaps||(t.generateMipmaps=e.generateMipmaps),t):e}};c(E,"registerTexture",(r,e,t,o,s)=>{if(L&&console.log("> Progressive: register texture",o,e.name,e.uuid,e,s),!e){L&&console.error("gltf-progressive: Register texture without texture");return}e.source&&(e.source[Se]=s);const i=s.guid;E.assignLODInformation(r,e,i,t,o),E.lodInfos.set(i,s),E.lowresCache.set(i,e)}),c(E,"registerMesh",(r,e,t,o,s,i)=>{var n;const a=t.geometry;if(!a){L&&console.warn("gltf-progressive: Register mesh without geometry");return}a.userData||(a.userData={}),L&&console.log("> Progressive: register mesh "+t.name,{index:s,uuid:t.uuid},i,t),E.assignLODInformation(r,a,e,o,s),E.lodInfos.set(e,i);let l=E.lowresCache.get(e);l?l.push(t.geometry):l=[t.geometry],E.lowresCache.set(e,l),o>0&&!te(t)&&ct(t,a);for(const u of X)(n=u.onRegisteredNewMesh)==null||n.call(u,t,i)}),c(E,"lodInfos",new Map),c(E,"previouslyLoaded",new Map),c(E,"lowresCache",new Map);let z=E;class ft{constructor(e,t,o,s){c(this,"url"),c(this,"key"),c(this,"level"),c(this,"index"),this.url=e,this.key=t,this.level=o,s!=null&&(this.index=s)}}class fe{constructor(e,t){c(this,"frame_start"),c(this,"frame_capture_end"),c(this,"ready"),c(this,"_resolve"),c(this,"_signal"),c(this,"_resolved",!1),c(this,"_addedCount",0),c(this,"_resolvedCount",0),c(this,"_awaiting",[]),c(this,"_currentFrame",0);var o;const s=e===0?2:1,i=Math.max(t.frames??s,s);this.frame_start=e,this.frame_capture_end=e+i,this.ready=new Promise(n=>{this._resolve=n}),this.ready.finally(()=>{this._resolved=!0,this._awaiting.length=0}),this._signal=t.signal,(o=this._signal)==null||o.addEventListener("abort",()=>{this.resolveNow()})}get awaitedCount(){return this._addedCount}get resolvedCount(){return this._resolvedCount}get currentlyAwaiting(){return this._awaiting.length}update(e){var t;this._currentFrame=e,((t=this._signal)!=null&&t.aborted||this._currentFrame>this.frame_capture_end&&this._awaiting.length===0)&&this.resolveNow()}add(e,t){if(this._resolved){console.warn("PromiseGroup: Trying to add a promise to a resolved group, ignoring.");return}this._currentFrame>this.frame_capture_end||(this._awaiting.push(t),this._addedCount++,t.finally(()=>{this._resolvedCount++,this._awaiting.splice(this._awaiting.indexOf(t),1)}))}resolveNow(){var e,t;this._resolved||(t=this._resolve)==null||t.call(this,{awaited_count:this._addedCount,resolved_count:this._resolvedCount,cancelled:((e=this._signal)==null?void 0:e.aborted)??!1})}}c(fe,"addPromise",(r,e,t)=>{t.forEach(o=>{o.add(r,e)})});const G=se("debugprogressive"),mt=se("noprogressive"),Te=Symbol("Needle:LODSManager"),Pe=Symbol("Needle:LODState"),q=Symbol("Needle:CurrentLOD"),S={mesh_lod:-1,texture_lod:-1};var _,T,K,Ae,H,ne,me,Y;let ie=(_=class{constructor(r,e){c(this,"renderer"),c(this,"context"),c(this,"projectionScreenMatrix",new Ie),c(this,"targetTriangleDensity",2e5),c(this,"skinnedMeshAutoUpdateBoundsInterval",30),c(this,"updateInterval","auto"),J(this,T,1),c(this,"pause",!1),c(this,"manual",!1),c(this,"_newPromiseGroups",[]),c(this,"_promiseGroupIds",0),c(this,"_lodchangedlisteners",[]),J(this,K),J(this,Ae,new Je),J(this,H,0),J(this,ne,0),J(this,me,0),J(this,Y,0),c(this,"_fpsBuffer",[60,60,60,60,60]),c(this,"_sphere",new Ze),c(this,"_tempBox",new Be),c(this,"_tempBox2",new Be),c(this,"tempMatrix",new Ie),c(this,"_tempWorldPosition",new W),c(this,"_tempBoxSize",new W),c(this,"_tempBox2Size",new W),this.renderer=r,this.context={...e}}static getObjectLODState(r){return r[Pe]}static addPlugin(r){X.push(r)}static removePlugin(r){const e=X.indexOf(r);e>=0&&X.splice(e,1)}static get(r,e){if(r[Te])return console.debug("[gltf-progressive] LODsManager already exists for this renderer"),r[Te];const t=new _(r,{engine:"unknown",...e});return r[Te]=t,t}get plugins(){return X}awaitLoading(r){const e=this._promiseGroupIds++,t=new fe(v(this,H),{...r});this._newPromiseGroups.push(t);const o=performance.now();return t.ready.finally(()=>{const s=this._newPromiseGroups.indexOf(t);s>=0&&(this._newPromiseGroups.splice(s,1),ut()&&performance.measure("LODsManager:awaitLoading",{start:o,detail:{id:e,name:r?.name,awaited:t.awaitedCount,resolved:t.resolvedCount}}))}),t.ready}_postprocessPromiseGroups(){if(this._newPromiseGroups.length!==0)for(let r=this._newPromiseGroups.length-1;r>=0;r--)this._newPromiseGroups[r].update(v(this,H))}addEventListener(r,e){r==="changed"&&this._lodchangedlisteners.push(e)}removeEventListener(r,e){if(r==="changed"){const t=this._lodchangedlisteners.indexOf(e);t>=0&&this._lodchangedlisteners.splice(t,1)}}enable(){if(v(this,K))return;console.debug("[gltf-progressive] Enabling LODsManager for renderer");let r=0;F(this,K,this.renderer.render);const e=this;_e(this.renderer),this.renderer.render=function(t,o){const s=e.renderer.getRenderTarget();(s==null||"isXRRenderTarget"in s&&s.isXRRenderTarget)&&(r=0,F(e,H,v(e,H)+1),F(e,ne,v(e,Ae).getDelta()),F(e,me,v(e,me)+v(e,ne)),e._fpsBuffer.shift(),e._fpsBuffer.push(1/v(e,ne)),F(e,Y,e._fpsBuffer.reduce((n,a)=>n+a)/e._fpsBuffer.length),G&&v(e,H)%200===0&&console.log("FPS",Math.round(v(e,Y)),"Interval:",v(e,T)));const i=r++;v(e,K).call(this,t,o),e.onAfterRender(t,o,i)}}disable(){v(this,K)&&(console.debug("[gltf-progressive] Disabling LODsManager for renderer"),this.renderer.render=v(this,K),F(this,K,void 0))}update(r,e){this.internalUpdate(r,e)}onAfterRender(r,e,t){if(this.pause)return;const o=this.renderer.renderLists.get(r,0).opaque;let s=!0;if(o.length===1){const i=o[0].material;(i.name==="EffectMaterial"||i.name==="CopyShader")&&(s=!1)}if((e.parent&&e.parent.type==="CubeCamera"||t>=1&&e.type==="OrthographicCamera")&&(s=!1),s){if(mt||(this.updateInterval==="auto"?v(this,Y)<40&&v(this,T)<10?(F(this,T,v(this,T)+1),G&&console.warn("\u2193 Reducing LOD updates",v(this,T),v(this,Y).toFixed(0))):v(this,Y)>=60&&v(this,T)>1&&(F(this,T,v(this,T)-1),G&&console.warn("\u2191 Increasing LOD updates",v(this,T),v(this,Y).toFixed(0))):F(this,T,this.updateInterval),v(this,T)>0&&v(this,H)%v(this,T)!=0))return;this.internalUpdate(r,e),this._postprocessPromiseGroups()}}internalUpdate(r,e){var t,o;const s=this.renderer.renderLists.get(r,0),i=s.opaque;this.projectionScreenMatrix.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse);const n=this.targetTriangleDensity;for(const u of i){if(u.material&&(((t=u.geometry)==null?void 0:t.type)==="BoxGeometry"||((o=u.geometry)==null?void 0:o.type)==="BufferGeometry")&&(u.material.name==="SphericalGaussianBlur"||u.material.name=="BackgroundCubeMaterial"||u.material.name==="CubemapFromEquirect"||u.material.name==="EquirectangularToCubeUV")){G&&(u.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"]||(u.material["NEEDLE_PROGRESSIVE:IGNORE-WARNING"]=!0,console.warn("Ignoring skybox or BLIT object",u,u.material.name,u.material.type)));continue}switch(u.material.type){case"LineBasicMaterial":case"LineDashedMaterial":case"PointsMaterial":case"ShadowMaterial":case"MeshDistanceMaterial":case"MeshDepthMaterial":continue}if(G==="color"&&u.material&&!u.object.progressive_debug_color){u.object.progressive_debug_color=!0;const w=Math.random()*16777215,y=new Qe({color:w});u.object.material=y}const d=u.object;(d instanceof Q||d.isMesh)&&this.updateLODs(r,e,d,n)}const a=s.transparent;for(const u of a){const d=u.object;(d instanceof Q||d.isMesh)&&this.updateLODs(r,e,d,n)}const l=s.transmissive;for(const u of l){const d=u.object;(d instanceof Q||d.isMesh)&&this.updateLODs(r,e,d,n)}}updateLODs(r,e,t,o){var s,i;t.userData||(t.userData={});let n=t[Pe];if(n||(n=new pt,t[Pe]=n),n.frames++<2)return;for(const l of X)(s=l.onBeforeUpdateLOD)==null||s.call(l,this.renderer,r,e,t);const a=_.overrideGlobalLodLevel!==void 0?_.overrideGlobalLodLevel:Z;a>=0?(S.mesh_lod=a,S.texture_lod=a):(this.calculateLodLevel(e,t,n,o,S),S.mesh_lod=Math.round(S.mesh_lod),S.texture_lod=Math.round(S.texture_lod)),S.mesh_lod>=0&&this.loadProgressiveMeshes(t,S.mesh_lod),t.material&&S.texture_lod>=0&&this.loadProgressiveTextures(t.material,S.texture_lod),L&&t.material&&!t.isGizmo&&$e(t.material);for(const l of X)(i=l.onAfterUpdatedLOD)==null||i.call(l,this.renderer,r,e,t,S);n.lastLodLevel_Mesh=S.mesh_lod,n.lastLodLevel_Texture=S.texture_lod}loadProgressiveTextures(r,e){if(!r)return;if(Array.isArray(r)){for(const s of r)this.loadProgressiveTextures(s,e);return}let t=!1;(r[q]===void 0||e<r[q])&&(t=!0);const o=r["DEBUG:LOD"];if(o!=null&&(t=r[q]!=o,e=o),t){r[q]=e;const s=z.assignTextureLOD(r,e).then(i=>{this._lodchangedlisteners.forEach(n=>n({type:"texture",level:e,object:r}))});fe.addPromise("texture",s,this._newPromiseGroups)}}loadProgressiveMeshes(r,e){if(!r)return Promise.resolve(null);let t=r[q]!==e;const o=r["DEBUG:LOD"];if(o!=null&&(t=r[q]!=o,e=o),t){r[q]=e;const s=r.geometry,i=z.assignMeshLOD(r,e).then(n=>(n&&r[q]==e&&s!=r.geometry&&this._lodchangedlisteners.forEach(a=>a({type:"mesh",level:e,object:r})),n));return fe.addPromise("mesh",i,this._newPromiseGroups),i}return Promise.resolve(null)}static isInside(r,e){const t=r.min,o=r.max,s=(t.x+o.x)*.5,i=(t.y+o.y)*.5;return this._tempPtInside.set(s,i,t.z).applyMatrix4(e).z<0}calculateLodLevel(r,e,t,o,s){var i,n,a;if(!e){s.mesh_lod=-1,s.texture_lod=-1;return}if(!r){s.mesh_lod=-1,s.texture_lod=-1;return}let l=10+1,u=!1;if(G&&e["DEBUG:LOD"]!=null)return e["DEBUG:LOD"];const d=(i=z.getMeshLODExtension(e.geometry))==null?void 0:i.lods,w=z.getPrimitiveIndex(e.geometry),y=d&&d.length>0,m=z.getMaterialMinMaxLODsCount(e.material),R=m?.min_count!=1/0&&m.min_count>0&&m.max_count>0;if(!y&&!R){s.mesh_lod=0,s.texture_lod=0;return}y||(u=!0,l=0);const D=this.renderer.domElement.clientHeight||this.renderer.domElement.height;let C=e.geometry.boundingBox;if(e.type==="SkinnedMesh"){const g=e;if(!g.boundingBox)g.computeBoundingBox();else if(this.skinnedMeshAutoUpdateBoundsInterval>0&&t.frames%this.skinnedMeshAutoUpdateBoundsInterval===0){const p=te(g),I=g.geometry;p&&(g.geometry=p),g.computeBoundingBox(),g.geometry=I}C=g.boundingBox}if(C){const g=r;if(e.geometry.attributes.color&&e.geometry.attributes.color.count<100&&e.geometry.boundingSphere){this._sphere.copy(e.geometry.boundingSphere),this._sphere.applyMatrix4(e.matrixWorld);const f=r.getWorldPosition(this._tempWorldPosition);if(this._sphere.containsPoint(f)){s.mesh_lod=0,s.texture_lod=0;return}}if(this._tempBox.copy(C),this._tempBox.applyMatrix4(e.matrixWorld),g.isPerspectiveCamera&&_.isInside(this._tempBox,this.projectionScreenMatrix)){s.mesh_lod=0,s.texture_lod=0;return}if(this._tempBox.applyMatrix4(this.projectionScreenMatrix),this.renderer.xr.enabled&&g.isPerspectiveCamera&&g.fov>70){const f=this._tempBox.min,h=this._tempBox.max;let x=f.x,O=f.y,P=h.x,V=h.y;const ae=2,ye=1.5,le=(f.x+h.x)*.5,ue=(f.y+h.y)*.5;x=(x-le)*ae+le,O=(O-ue)*ae+ue,P=(P-le)*ae+le,V=(V-ue)*ae+ue;const Xe=x<0&&P>0?0:Math.min(Math.abs(f.x),Math.abs(h.x)),qe=O<0&&V>0?0:Math.min(Math.abs(f.y),Math.abs(h.y)),xe=Math.max(Xe,qe);t.lastCentrality=(ye-xe)*(ye-xe)*(ye-xe)}else t.lastCentrality=1;const p=this._tempBox.getSize(this._tempBoxSize);p.multiplyScalar(.5),screen.availHeight>0&&D>0&&p.multiplyScalar(D/screen.availHeight),r.isPerspectiveCamera?p.x*=r.aspect:r.isOrthographicCamera;const I=r.matrixWorldInverse,j=this._tempBox2;j.copy(C),j.applyMatrix4(e.matrixWorld),j.applyMatrix4(I);const M=j.getSize(this._tempBox2Size),N=Math.max(M.x,M.y);if(Math.max(p.x,p.y)!=0&&N!=0&&(p.z=M.z/Math.max(M.x,M.y)*Math.max(p.x,p.y)),t.lastScreenCoverage=Math.max(p.x,p.y,p.z),t.lastScreenspaceVolume.copy(p),t.lastScreenCoverage*=t.lastCentrality,G&&_.debugDrawLine){const f=this.tempMatrix.copy(this.projectionScreenMatrix);f.invert();const h=_.corner0,x=_.corner1,O=_.corner2,P=_.corner3;h.copy(this._tempBox.min),x.copy(this._tempBox.max),x.x=h.x,O.copy(this._tempBox.max),O.y=h.y,P.copy(this._tempBox.max);const V=(h.z+P.z)*.5;h.z=x.z=O.z=P.z=V,h.applyMatrix4(f),x.applyMatrix4(f),O.applyMatrix4(f),P.applyMatrix4(f),_.debugDrawLine(h,x,255),_.debugDrawLine(h,O,255),_.debugDrawLine(x,P,255),_.debugDrawLine(O,P,255)}let b=999;if(d&&t.lastScreenCoverage>0)for(let f=0;f<d.length;f++){const h=d[f];if((((n=h.densities)==null?void 0:n[w])||h.density||1e-5)/t.lastScreenCoverage<o){b=f;break}}b<l&&(l=b,u=!0)}if(u?s.mesh_lod=l:s.mesh_lod=t.lastLodLevel_Mesh,G&&s.mesh_lod!=t.lastLodLevel_Mesh){const g=d?.[s.mesh_lod];g&&console.log(`Mesh LOD changed: ${t.lastLodLevel_Mesh} \u2192 ${s.mesh_lod} (${g.density.toFixed(0)}) - ${e.name}`)}if(R){const g="saveData"in globalThis.navigator&&globalThis.navigator.saveData===!0;if(t.lastLodLevel_Texture<0){if(s.texture_lod=m.max_count-1,G){const p=m.lods[m.max_count-1];G&&console.log(`First Texture LOD ${s.texture_lod} (${p.max_height}px) - ${e.name}`)}}else{const p=t.lastScreenspaceVolume.x+t.lastScreenspaceVolume.y+t.lastScreenspaceVolume.z;let I=t.lastScreenCoverage*4;((a=this.context)==null?void 0:a.engine)==="model-viewer"&&(I*=1.5);const j=D/window.devicePixelRatio*I;let M=!1;for(let N=m.lods.length-1;N>=0;N--){const b=m.lods[N];if(!(g&&b.max_height>=2048)&&!(lt()&&b.max_height>4096)&&(b.max_height>j||!M&&N===0)){if(M=!0,s.texture_lod=N,s.texture_lod<t.lastLodLevel_Texture){const f=b.max_height;G&&console.log(`Texture LOD changed: ${t.lastLodLevel_Texture} \u2192 ${s.texture_lod} = ${f}px
|
|
6
|
+
Screensize: ${j.toFixed(0)}px, Coverage: ${(100*t.lastScreenCoverage).toFixed(2)}%, Volume ${p.toFixed(1)}
|
|
7
|
+
${e.name}`)}break}}}}else s.texture_lod=0}},T=new WeakMap,K=new WeakMap,Ae=new WeakMap,H=new WeakMap,ne=new WeakMap,me=new WeakMap,Y=new WeakMap,c(_,"debugDrawLine"),c(_,"overrideGlobalLodLevel"),c(_,"corner0",new W),c(_,"corner1",new W),c(_,"corner2",new W),c(_,"corner3",new W),c(_,"_tempPtInside",new W),_);class pt{constructor(){c(this,"frames",0),c(this,"lastLodLevel_Mesh",-1),c(this,"lastLodLevel_Texture",-1),c(this,"lastScreenCoverage",0),c(this,"lastScreenspaceVolume",new W),c(this,"lastCentrality",0)}}const Fe=Symbol("NEEDLE_mesh_lod"),pe=Symbol("NEEDLE_texture_lod");let ve=null;function We(){const r=vt();r&&(r.mapURLs(function(e){return Ue(),e}),Ue(),ve?.disconnect(),ve=new MutationObserver(e=>{e.forEach(t=>{t.addedNodes.forEach(o=>{o instanceof HTMLElement&&o.tagName.toLowerCase()==="model-viewer"&&Ve(o)})})}),ve.observe(document,{childList:!0,subtree:!0}))}function vt(){return typeof customElements>"u"?null:customElements.get("model-viewer")||(customElements.whenDefined("model-viewer").then(()=>{console.debug("[gltf-progressive] model-viewer defined"),We()}),null)}function Ue(){typeof document>"u"||document.querySelectorAll("model-viewer").forEach(r=>{Ve(r)})}const ze=new WeakSet;let yt=0;function Ve(r){if(!r||ze.has(r))return null;ze.add(r),console.debug("[gltf-progressive] found new model-viewer..."+ ++yt+`
|
|
8
|
+
`,r.getAttribute("src"));let e=null,t=null,o=null;for(let s=r;s!=null;s=Object.getPrototypeOf(s)){const i=Object.getOwnPropertySymbols(s),n=i.find(u=>u.toString()=="Symbol(renderer)"),a=i.find(u=>u.toString()=="Symbol(scene)"),l=i.find(u=>u.toString()=="Symbol(needsRender)");!e&&n!=null&&(e=r[n].threeRenderer),!t&&a!=null&&(t=r[a]),!o&&l!=null&&(o=r[l])}if(e&&t){let s=function(){if(o){let n=0,a=setInterval(()=>{if(n++>5){clearInterval(a);return}o?.call(r)},300)}};console.debug("[gltf-progressive] setup model-viewer");const i=ie.get(e,{engine:"model-viewer"});return ie.addPlugin(new xt),i.enable(),i.addEventListener("changed",()=>{o?.call(r)}),r.addEventListener("model-visibility",n=>{n.detail.visible&&o?.call(r)}),r.addEventListener("load",()=>{s()}),()=>{i.disable()}}return null}class xt{constructor(){c(this,"_didWarnAboutMissingUrl",!1)}onBeforeUpdateLOD(e,t,o,s){this.tryParseMeshLOD(t,s),this.tryParseTextureLOD(t,s)}getUrl(e){if(!e)return null;let t=e.getAttribute("src");return t||(t=e.src),t||(this._didWarnAboutMissingUrl||console.warn("No url found in modelviewer",e),this._didWarnAboutMissingUrl=!0),t}tryGetCurrentGLTF(e){return e._currentGLTF}tryGetCurrentModelViewer(e){return e.element}tryParseTextureLOD(e,t){if(t[pe]==!0)return;t[pe]=!0;const o=this.tryGetCurrentGLTF(e),s=this.tryGetCurrentModelViewer(e),i=this.getUrl(s);if(i&&o&&t.material){let n=function(l){var u,d,w;if(l[pe]==!0)return;l[pe]=!0,l.userData&&(l.userData.LOD=-1);const y=Object.keys(l);for(let m=0;m<y.length;m++){const R=y[m],D=l[R];if(D?.isTexture===!0){const C=(d=(u=D.userData)==null?void 0:u.associations)==null?void 0:d.textures;if(C==null)continue;const g=o.parser.json.textures[C];if(!g){console.warn("Texture data not found for texture index "+C);continue}if((w=g?.extensions)!=null&&w[U]){const p=g.extensions[U];p&&i&&z.registerTexture(i,D,p.lods.length,C,p)}}}};const a=t.material;if(Array.isArray(a))for(const l of a)n(l);else n(a)}}tryParseMeshLOD(e,t){var o,s;if(t[Fe]==!0)return;t[Fe]=!0;const i=this.tryGetCurrentModelViewer(e),n=this.getUrl(i);if(!n)return;const a=(s=(o=t.userData)==null?void 0:o.gltfExtensions)==null?void 0:s[U];if(a&&n){const l=t.uuid;z.registerMesh(n,l,t,0,a.lods.length,a)}}}function Lt(r,e,t,o){_e(e),De(t),be(t,{progressive:!0,...o?.hints}),t.register(i=>new z(i,r));const s=ie.get(e);return o?.enableLODsManager!==!1&&s.enable(),s}if(We(),!dt){const r={gltfProgressive:{useNeedleProgressive:Lt,LODsManager:ie,configureLoader:be,getRaycastMesh:te,useRaycastMeshes:ht}};if(!globalThis.Needle)globalThis.Needle=r;else for(const e in r)globalThis.Needle[e]=r[e]}export{ie as LODsManager,z as NEEDLE_progressive,De as addDracoAndKTX2Loaders,be as configureLoader,_e as createLoaders,te as getRaycastMesh,ke as setDracoDecoderLocation,Re as setKTX2TranscoderLocation};
|