@needle-tools/engine 2.24.0-pre
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 +568 -0
- package/LICENSE.md +10 -0
- package/README.md +11 -0
- package/dist/needle-engine.d.ts +5011 -0
- package/dist/needle-engine.js +6605 -0
- package/dist/needle-engine.js.map +7 -0
- package/dist/needle-engine.min.js +167 -0
- package/dist/needle-engine.min.js.map +7 -0
- package/lib/engine/debug/error_overlay.d.ts +1 -0
- package/lib/engine/debug/error_overlay.js +110 -0
- package/lib/engine/debug/error_overlay.js.map +1 -0
- package/lib/engine/engine.d.ts +27 -0
- package/lib/engine/engine.js +13 -0
- package/lib/engine/engine.js.map +1 -0
- package/lib/engine/engine_addressables.d.ts +46 -0
- package/lib/engine/engine_addressables.js +264 -0
- package/lib/engine/engine_addressables.js.map +1 -0
- package/lib/engine/engine_application.d.ts +13 -0
- package/lib/engine/engine_application.js +35 -0
- package/lib/engine/engine_application.js.map +1 -0
- package/lib/engine/engine_assetdatabase.d.ts +54 -0
- package/lib/engine/engine_assetdatabase.js +150 -0
- package/lib/engine/engine_assetdatabase.js.map +1 -0
- package/lib/engine/engine_caching.d.ts +0 -0
- package/lib/engine/engine_caching.js +2 -0
- package/lib/engine/engine_caching.js.map +1 -0
- package/lib/engine/engine_constants.d.ts +2 -0
- package/lib/engine/engine_constants.js +3 -0
- package/lib/engine/engine_constants.js.map +1 -0
- package/lib/engine/engine_coroutine.d.ts +3 -0
- package/lib/engine/engine_coroutine.js +14 -0
- package/lib/engine/engine_coroutine.js.map +1 -0
- package/lib/engine/engine_default_parameters.d.ts +2 -0
- package/lib/engine/engine_default_parameters.js +4 -0
- package/lib/engine/engine_default_parameters.js.map +1 -0
- package/lib/engine/engine_element.d.ts +32 -0
- package/lib/engine/engine_element.js +340 -0
- package/lib/engine/engine_element.js.map +1 -0
- package/lib/engine/engine_element_loading.d.ts +31 -0
- package/lib/engine/engine_element_loading.js +154 -0
- package/lib/engine/engine_element_loading.js.map +1 -0
- package/lib/engine/engine_element_overlay.d.ts +17 -0
- package/lib/engine/engine_element_overlay.js +95 -0
- package/lib/engine/engine_element_overlay.js.map +1 -0
- package/lib/engine/engine_gizmos.d.ts +2 -0
- package/lib/engine/engine_gizmos.js +14 -0
- package/lib/engine/engine_gizmos.js.map +1 -0
- package/lib/engine/engine_gltf.d.ts +2 -0
- package/lib/engine/engine_gltf.js +2 -0
- package/lib/engine/engine_gltf.js.map +1 -0
- package/lib/engine/engine_gltf_builtin_components.d.ts +8 -0
- package/lib/engine/engine_gltf_builtin_components.js +251 -0
- package/lib/engine/engine_gltf_builtin_components.js.map +1 -0
- package/lib/engine/engine_input.d.ts +193 -0
- package/lib/engine/engine_input.js +566 -0
- package/lib/engine/engine_input.js.map +1 -0
- package/lib/engine/engine_input_utils.d.ts +2 -0
- package/lib/engine/engine_input_utils.js +23 -0
- package/lib/engine/engine_input_utils.js.map +1 -0
- package/lib/engine/engine_lightdata.d.ts +21 -0
- package/lib/engine/engine_lightdata.js +85 -0
- package/lib/engine/engine_lightdata.js.map +1 -0
- package/lib/engine/engine_loaders.d.ts +3 -0
- package/lib/engine/engine_loaders.js +20 -0
- package/lib/engine/engine_loaders.js.map +1 -0
- package/lib/engine/engine_mainloop_utils.d.ts +9 -0
- package/lib/engine/engine_mainloop_utils.js +288 -0
- package/lib/engine/engine_mainloop_utils.js.map +1 -0
- package/lib/engine/engine_math.d.ts +11 -0
- package/lib/engine/engine_math.js +40 -0
- package/lib/engine/engine_math.js.map +1 -0
- package/lib/engine/engine_networking.d.ts +133 -0
- package/lib/engine/engine_networking.js +541 -0
- package/lib/engine/engine_networking.js.map +1 -0
- package/lib/engine/engine_networking_auto.d.ts +18 -0
- package/lib/engine/engine_networking_auto.js +252 -0
- package/lib/engine/engine_networking_auto.js.map +1 -0
- package/lib/engine/engine_networking_files.d.ts +23 -0
- package/lib/engine/engine_networking_files.js +173 -0
- package/lib/engine/engine_networking_files.js.map +1 -0
- package/lib/engine/engine_networking_files_default_components.d.ts +3 -0
- package/lib/engine/engine_networking_files_default_components.js +45 -0
- package/lib/engine/engine_networking_files_default_components.js.map +1 -0
- package/lib/engine/engine_networking_instantiate.d.ts +34 -0
- package/lib/engine/engine_networking_instantiate.js +274 -0
- package/lib/engine/engine_networking_instantiate.js.map +1 -0
- package/lib/engine/engine_networking_peer.d.ts +10 -0
- package/lib/engine/engine_networking_peer.js +106 -0
- package/lib/engine/engine_networking_peer.js.map +1 -0
- package/lib/engine/engine_networking_utils.d.ts +1 -0
- package/lib/engine/engine_networking_utils.js +11 -0
- package/lib/engine/engine_networking_utils.js.map +1 -0
- package/lib/engine/engine_networking_websocket.d.ts +0 -0
- package/lib/engine/engine_networking_websocket.js +3 -0
- package/lib/engine/engine_networking_websocket.js.map +1 -0
- package/lib/engine/engine_physics.d.ts +88 -0
- package/lib/engine/engine_physics.js +563 -0
- package/lib/engine/engine_physics.js.map +1 -0
- package/lib/engine/engine_rendererdata.d.ts +48 -0
- package/lib/engine/engine_rendererdata.js +182 -0
- package/lib/engine/engine_rendererdata.js.map +1 -0
- package/lib/engine/engine_scenetools.d.ts +25 -0
- package/lib/engine/engine_scenetools.js +211 -0
- package/lib/engine/engine_scenetools.js.map +1 -0
- package/lib/engine/engine_serialization.d.ts +3 -0
- package/lib/engine/engine_serialization.js +5 -0
- package/lib/engine/engine_serialization.js.map +1 -0
- package/lib/engine/engine_serialization_builtin_serializer.d.ts +49 -0
- package/lib/engine/engine_serialization_builtin_serializer.js +238 -0
- package/lib/engine/engine_serialization_builtin_serializer.js.map +1 -0
- package/lib/engine/engine_serialization_core.d.ts +70 -0
- package/lib/engine/engine_serialization_core.js +417 -0
- package/lib/engine/engine_serialization_core.js.map +1 -0
- package/lib/engine/engine_serialization_decorator.d.ts +9 -0
- package/lib/engine/engine_serialization_decorator.js +44 -0
- package/lib/engine/engine_serialization_decorator.js.map +1 -0
- package/lib/engine/engine_setup.d.ts +129 -0
- package/lib/engine/engine_setup.js +609 -0
- package/lib/engine/engine_setup.js.map +1 -0
- package/lib/engine/engine_shaders.d.ts +31 -0
- package/lib/engine/engine_shaders.js +230 -0
- package/lib/engine/engine_shaders.js.map +1 -0
- package/lib/engine/engine_three_utils.d.ts +20 -0
- package/lib/engine/engine_three_utils.js +247 -0
- package/lib/engine/engine_three_utils.js.map +1 -0
- package/lib/engine/engine_time.d.ts +13 -0
- package/lib/engine/engine_time.js +31 -0
- package/lib/engine/engine_time.js.map +1 -0
- package/lib/engine/engine_typestore.d.ts +7 -0
- package/lib/engine/engine_typestore.js +17 -0
- package/lib/engine/engine_typestore.js.map +1 -0
- package/lib/engine/engine_utils.d.ts +34 -0
- package/lib/engine/engine_utils.js +239 -0
- package/lib/engine/engine_utils.js.map +1 -0
- package/lib/engine/engine_web_api.d.ts +12 -0
- package/lib/engine/engine_web_api.js +114 -0
- package/lib/engine/engine_web_api.js.map +1 -0
- package/lib/engine/extensions/KHR_animation_pointer.d.ts +0 -0
- package/lib/engine/extensions/KHR_animation_pointer.js +385 -0
- package/lib/engine/extensions/KHR_animation_pointer.js.map +1 -0
- package/lib/engine/extensions/NEEDLE_animator_controller.d.ts +0 -0
- package/lib/engine/extensions/NEEDLE_animator_controller.js +59 -0
- package/lib/engine/extensions/NEEDLE_animator_controller.js.map +1 -0
- package/lib/engine/extensions/NEEDLE_animator_controller_model.d.ts +108 -0
- package/lib/engine/extensions/NEEDLE_animator_controller_model.js +92 -0
- package/lib/engine/extensions/NEEDLE_animator_controller_model.js.map +1 -0
- package/lib/engine/extensions/NEEDLE_components.d.ts +32 -0
- package/lib/engine/extensions/NEEDLE_components.js +193 -0
- package/lib/engine/extensions/NEEDLE_components.js.map +1 -0
- package/lib/engine/extensions/NEEDLE_deferred_texture.d.ts +18 -0
- package/lib/engine/extensions/NEEDLE_deferred_texture.js +149 -0
- package/lib/engine/extensions/NEEDLE_deferred_texture.js.map +1 -0
- package/lib/engine/extensions/NEEDLE_gameobject_data.d.ts +10 -0
- package/lib/engine/extensions/NEEDLE_gameobject_data.js +54 -0
- package/lib/engine/extensions/NEEDLE_gameobject_data.js.map +1 -0
- package/lib/engine/extensions/NEEDLE_lighting_settings.d.ts +35 -0
- package/lib/engine/extensions/NEEDLE_lighting_settings.js +136 -0
- package/lib/engine/extensions/NEEDLE_lighting_settings.js.map +1 -0
- package/lib/engine/extensions/NEEDLE_lightmaps.d.ts +17 -0
- package/lib/engine/extensions/NEEDLE_lightmaps.js +69 -0
- package/lib/engine/extensions/NEEDLE_lightmaps.js.map +1 -0
- package/lib/engine/extensions/NEEDLE_persistent_assets.d.ts +11 -0
- package/lib/engine/extensions/NEEDLE_persistent_assets.js +64 -0
- package/lib/engine/extensions/NEEDLE_persistent_assets.js.map +1 -0
- package/lib/engine/extensions/NEEDLE_render_objects.d.ts +12 -0
- package/lib/engine/extensions/NEEDLE_render_objects.js +144 -0
- package/lib/engine/extensions/NEEDLE_render_objects.js.map +1 -0
- package/lib/engine/extensions/NEEDLE_techniques_webgl.d.ts +39 -0
- package/lib/engine/extensions/NEEDLE_techniques_webgl.js +419 -0
- package/lib/engine/extensions/NEEDLE_techniques_webgl.js.map +1 -0
- package/lib/engine/extensions/NEEDLE_timeline.d.ts +0 -0
- package/lib/engine/extensions/NEEDLE_timeline.js +57 -0
- package/lib/engine/extensions/NEEDLE_timeline.js.map +1 -0
- package/lib/engine/extensions/extension_resolver.d.ts +4 -0
- package/lib/engine/extensions/extension_resolver.js +2 -0
- package/lib/engine/extensions/extension_resolver.js.map +1 -0
- package/lib/engine/extensions/extension_utils.d.ts +2 -0
- package/lib/engine/extensions/extension_utils.js +130 -0
- package/lib/engine/extensions/extension_utils.js.map +1 -0
- package/lib/engine/extensions/extensions.d.ts +6 -0
- package/lib/engine/extensions/extensions.js +41 -0
- package/lib/engine/extensions/extensions.js.map +1 -0
- package/lib/engine/shaders/shaderData.d.ts +55 -0
- package/lib/engine/shaders/shaderData.js +59 -0
- package/lib/engine/shaders/shaderData.js.map +1 -0
- package/lib/engine/tests/simulate_avatars.d.ts +0 -0
- package/lib/engine/tests/simulate_avatars.js +3 -0
- package/lib/engine/tests/simulate_avatars.js.map +1 -0
- package/lib/engine/tests/test_utils.d.ts +2 -0
- package/lib/engine/tests/test_utils.js +54 -0
- package/lib/engine/tests/test_utils.js.map +1 -0
- package/lib/engine-components/AlignmentConstraint.d.ts +10 -0
- package/lib/engine-components/AlignmentConstraint.js +27 -0
- package/lib/engine-components/AlignmentConstraint.js.map +1 -0
- package/lib/engine-components/Animation.d.ts +44 -0
- package/lib/engine-components/Animation.js +257 -0
- package/lib/engine-components/Animation.js.map +1 -0
- package/lib/engine-components/AnimationCurve.d.ts +15 -0
- package/lib/engine-components/AnimationCurve.js +62 -0
- package/lib/engine-components/AnimationCurve.js.map +1 -0
- package/lib/engine-components/Animator.d.ts +48 -0
- package/lib/engine-components/Animator.js +126 -0
- package/lib/engine-components/Animator.js.map +1 -0
- package/lib/engine-components/AnimatorController.d.ts +39 -0
- package/lib/engine-components/AnimatorController.js +687 -0
- package/lib/engine-components/AnimatorController.js.map +1 -0
- package/lib/engine-components/AudioListener.d.ts +7 -0
- package/lib/engine-components/AudioListener.js +29 -0
- package/lib/engine-components/AudioListener.js.map +1 -0
- package/lib/engine-components/AudioSource.d.ts +61 -0
- package/lib/engine-components/AudioSource.js +377 -0
- package/lib/engine-components/AudioSource.js.map +1 -0
- package/lib/engine-components/AvatarLoader.d.ts +22 -0
- package/lib/engine-components/AvatarLoader.js +203 -0
- package/lib/engine-components/AvatarLoader.js.map +1 -0
- package/lib/engine-components/AxesHelper.d.ts +9 -0
- package/lib/engine-components/AxesHelper.js +43 -0
- package/lib/engine-components/AxesHelper.js.map +1 -0
- package/lib/engine-components/BasicIKConstraint.d.ts +9 -0
- package/lib/engine-components/BasicIKConstraint.js +44 -0
- package/lib/engine-components/BasicIKConstraint.js.map +1 -0
- package/lib/engine-components/BoxCollider.d.ts +2 -0
- package/lib/engine-components/BoxCollider.js +3 -0
- package/lib/engine-components/BoxCollider.js.map +1 -0
- package/lib/engine-components/BoxHelperComponent.d.ts +16 -0
- package/lib/engine-components/BoxHelperComponent.js +72 -0
- package/lib/engine-components/BoxHelperComponent.js.map +1 -0
- package/lib/engine-components/Camera.d.ts +38 -0
- package/lib/engine-components/Camera.js +258 -0
- package/lib/engine-components/Camera.js.map +1 -0
- package/lib/engine-components/Collider.d.ts +21 -0
- package/lib/engine-components/Collider.js +65 -0
- package/lib/engine-components/Collider.js.map +1 -0
- package/lib/engine-components/Component.d.ts +165 -0
- package/lib/engine-components/Component.js +895 -0
- package/lib/engine-components/Component.js.map +1 -0
- package/lib/engine-components/ComponentExtensions.d.ts +2 -0
- package/lib/engine-components/ComponentExtensions.js +3 -0
- package/lib/engine-components/ComponentExtensions.js.map +1 -0
- package/lib/engine-components/DeleteBox.d.ts +9 -0
- package/lib/engine-components/DeleteBox.js +27 -0
- package/lib/engine-components/DeleteBox.js.map +1 -0
- package/lib/engine-components/DeviceFlag.d.ts +12 -0
- package/lib/engine-components/DeviceFlag.js +50 -0
- package/lib/engine-components/DeviceFlag.js.map +1 -0
- package/lib/engine-components/DragControls.d.ts +44 -0
- package/lib/engine-components/DragControls.js +465 -0
- package/lib/engine-components/DragControls.js.map +1 -0
- package/lib/engine-components/DropListener.d.ts +15 -0
- package/lib/engine-components/DropListener.js +102 -0
- package/lib/engine-components/DropListener.js.map +1 -0
- package/lib/engine-components/Duplicatable.d.ts +16 -0
- package/lib/engine-components/Duplicatable.js +150 -0
- package/lib/engine-components/Duplicatable.js.map +1 -0
- package/lib/engine-components/EventList.d.ts +22 -0
- package/lib/engine-components/EventList.js +97 -0
- package/lib/engine-components/EventList.js.map +1 -0
- package/lib/engine-components/EventTrigger.d.ts +3 -0
- package/lib/engine-components/EventTrigger.js +4 -0
- package/lib/engine-components/EventTrigger.js.map +1 -0
- package/lib/engine-components/EventType.d.ts +19 -0
- package/lib/engine-components/EventType.js +72 -0
- package/lib/engine-components/EventType.js.map +1 -0
- package/lib/engine-components/FlyControls.d.ts +7 -0
- package/lib/engine-components/FlyControls.js +22 -0
- package/lib/engine-components/FlyControls.js.map +1 -0
- package/lib/engine-components/Gizmos.d.ts +12 -0
- package/lib/engine-components/Gizmos.js +61 -0
- package/lib/engine-components/Gizmos.js.map +1 -0
- package/lib/engine-components/GltfExport.d.ts +28 -0
- package/lib/engine-components/GltfExport.js +201 -0
- package/lib/engine-components/GltfExport.js.map +1 -0
- package/lib/engine-components/GridHelper.d.ts +11 -0
- package/lib/engine-components/GridHelper.js +41 -0
- package/lib/engine-components/GridHelper.js.map +1 -0
- package/lib/engine-components/GroundProjection.d.ts +18 -0
- package/lib/engine-components/GroundProjection.js +77 -0
- package/lib/engine-components/GroundProjection.js.map +1 -0
- package/lib/engine-components/Interactable.d.ts +10 -0
- package/lib/engine-components/Interactable.js +13 -0
- package/lib/engine-components/Interactable.js.map +1 -0
- package/lib/engine-components/LODGroup.d.ts +29 -0
- package/lib/engine-components/LODGroup.js +176 -0
- package/lib/engine-components/LODGroup.js.map +1 -0
- package/lib/engine-components/Light.d.ts +69 -0
- package/lib/engine-components/Light.js +407 -0
- package/lib/engine-components/Light.js.map +1 -0
- package/lib/engine-components/LookAtConstraint.d.ts +7 -0
- package/lib/engine-components/LookAtConstraint.js +18 -0
- package/lib/engine-components/LookAtConstraint.js.map +1 -0
- package/lib/engine-components/MeshCollider.d.ts +4 -0
- package/lib/engine-components/MeshCollider.js +8 -0
- package/lib/engine-components/MeshCollider.js.map +1 -0
- package/lib/engine-components/NavMesh.d.ts +5 -0
- package/lib/engine-components/NavMesh.js +11 -0
- package/lib/engine-components/NavMesh.js.map +1 -0
- package/lib/engine-components/NestedGltf.d.ts +10 -0
- package/lib/engine-components/NestedGltf.js +61 -0
- package/lib/engine-components/NestedGltf.js.map +1 -0
- package/lib/engine-components/Networking.d.ts +9 -0
- package/lib/engine-components/Networking.js +47 -0
- package/lib/engine-components/Networking.js.map +1 -0
- package/lib/engine-components/OffsetConstraint.d.ts +11 -0
- package/lib/engine-components/OffsetConstraint.js +31 -0
- package/lib/engine-components/OffsetConstraint.js.map +1 -0
- package/lib/engine-components/OrbitControls.d.ts +45 -0
- package/lib/engine-components/OrbitControls.js +247 -0
- package/lib/engine-components/OrbitControls.js.map +1 -0
- package/lib/engine-components/ParticleSystem.d.ts +34 -0
- package/lib/engine-components/ParticleSystem.js +216 -0
- package/lib/engine-components/ParticleSystem.js.map +1 -0
- package/lib/engine-components/ParticleSystemModules.d.ts +93 -0
- package/lib/engine-components/ParticleSystemModules.js +167 -0
- package/lib/engine-components/ParticleSystemModules.js.map +1 -0
- package/lib/engine-components/PlayerColor.d.ts +13 -0
- package/lib/engine-components/PlayerColor.js +85 -0
- package/lib/engine-components/PlayerColor.js.map +1 -0
- package/lib/engine-components/Renderer.d.ts +72 -0
- package/lib/engine-components/Renderer.js +678 -0
- package/lib/engine-components/Renderer.js.map +1 -0
- package/lib/engine-components/RendererLightmap.d.ts +23 -0
- package/lib/engine-components/RendererLightmap.js +128 -0
- package/lib/engine-components/RendererLightmap.js.map +1 -0
- package/lib/engine-components/Rigidbody.d.ts +42 -0
- package/lib/engine-components/Rigidbody.js +170 -0
- package/lib/engine-components/Rigidbody.js.map +1 -0
- package/lib/engine-components/ScreenCapture.d.ts +9 -0
- package/lib/engine-components/ScreenCapture.js +44 -0
- package/lib/engine-components/ScreenCapture.js.map +1 -0
- package/lib/engine-components/ShadowCatcher.d.ts +15 -0
- package/lib/engine-components/ShadowCatcher.js +94 -0
- package/lib/engine-components/ShadowCatcher.js.map +1 -0
- package/lib/engine-components/Skybox.d.ts +16 -0
- package/lib/engine-components/Skybox.js +121 -0
- package/lib/engine-components/Skybox.js.map +1 -0
- package/lib/engine-components/SmoothFollow.d.ts +13 -0
- package/lib/engine-components/SmoothFollow.js +57 -0
- package/lib/engine-components/SmoothFollow.js.map +1 -0
- package/lib/engine-components/SpatialTrigger.d.ts +27 -0
- package/lib/engine-components/SpatialTrigger.js +145 -0
- package/lib/engine-components/SpatialTrigger.js.map +1 -0
- package/lib/engine-components/SpectatorCamera.d.ts +36 -0
- package/lib/engine-components/SpectatorCamera.js +311 -0
- package/lib/engine-components/SpectatorCamera.js.map +1 -0
- package/lib/engine-components/SphereCollider.d.ts +2 -0
- package/lib/engine-components/SphereCollider.js +3 -0
- package/lib/engine-components/SphereCollider.js.map +1 -0
- package/lib/engine-components/SpringJoint.d.ts +13 -0
- package/lib/engine-components/SpringJoint.js +42 -0
- package/lib/engine-components/SpringJoint.js.map +1 -0
- package/lib/engine-components/SpriteRenderer.d.ts +33 -0
- package/lib/engine-components/SpriteRenderer.js +141 -0
- package/lib/engine-components/SpriteRenderer.js.map +1 -0
- package/lib/engine-components/SyncedCamera.d.ts +23 -0
- package/lib/engine-components/SyncedCamera.js +188 -0
- package/lib/engine-components/SyncedCamera.js.map +1 -0
- package/lib/engine-components/SyncedRoom.d.ts +20 -0
- package/lib/engine-components/SyncedRoom.js +151 -0
- package/lib/engine-components/SyncedRoom.js.map +1 -0
- package/lib/engine-components/SyncedTransform.d.ts +35 -0
- package/lib/engine-components/SyncedTransform.js +268 -0
- package/lib/engine-components/SyncedTransform.js.map +1 -0
- package/lib/engine-components/TestRunner.d.ts +13 -0
- package/lib/engine-components/TestRunner.js +100 -0
- package/lib/engine-components/TestRunner.js.map +1 -0
- package/lib/engine-components/TransformGizmo.d.ts +15 -0
- package/lib/engine-components/TransformGizmo.js +166 -0
- package/lib/engine-components/TransformGizmo.js.map +1 -0
- package/lib/engine-components/VideoPlayer.d.ts +55 -0
- package/lib/engine-components/VideoPlayer.js +307 -0
- package/lib/engine-components/VideoPlayer.js.map +1 -0
- package/lib/engine-components/Voip.d.ts +22 -0
- package/lib/engine-components/Voip.js +400 -0
- package/lib/engine-components/Voip.js.map +1 -0
- package/lib/engine-components/Volume.d.ts +30 -0
- package/lib/engine-components/Volume.js +86 -0
- package/lib/engine-components/Volume.js.map +1 -0
- package/lib/engine-components/WebARSessionRoot.d.ts +21 -0
- package/lib/engine-components/WebARSessionRoot.js +105 -0
- package/lib/engine-components/WebARSessionRoot.js.map +1 -0
- package/lib/engine-components/WebXR.d.ts +90 -0
- package/lib/engine-components/WebXR.js +498 -0
- package/lib/engine-components/WebXR.js.map +1 -0
- package/lib/engine-components/WebXRAvatar.d.ts +59 -0
- package/lib/engine-components/WebXRAvatar.js +263 -0
- package/lib/engine-components/WebXRAvatar.js.map +1 -0
- package/lib/engine-components/WebXRController.d.ts +145 -0
- package/lib/engine-components/WebXRController.js +924 -0
- package/lib/engine-components/WebXRController.js.map +1 -0
- package/lib/engine-components/WebXRGrabRendering.d.ts +42 -0
- package/lib/engine-components/WebXRGrabRendering.js +138 -0
- package/lib/engine-components/WebXRGrabRendering.js.map +1 -0
- package/lib/engine-components/WebXRRig.d.ts +4 -0
- package/lib/engine-components/WebXRRig.js +8 -0
- package/lib/engine-components/WebXRRig.js.map +1 -0
- package/lib/engine-components/WebXRSync.d.ts +54 -0
- package/lib/engine-components/WebXRSync.js +405 -0
- package/lib/engine-components/WebXRSync.js.map +1 -0
- package/lib/engine-components/XRFlag.d.ts +32 -0
- package/lib/engine-components/XRFlag.js +115 -0
- package/lib/engine-components/XRFlag.js.map +1 -0
- package/lib/engine-components/avatar/AvatarBlink_Simple.d.ts +10 -0
- package/lib/engine-components/avatar/AvatarBlink_Simple.js +76 -0
- package/lib/engine-components/avatar/AvatarBlink_Simple.js.map +1 -0
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.d.ts +13 -0
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js +75 -0
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js.map +1 -0
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.d.ts +27 -0
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.js +120 -0
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.js.map +1 -0
- package/lib/engine-components/avatar/Avatar_MouthShapes.d.ts +13 -0
- package/lib/engine-components/avatar/Avatar_MouthShapes.js +77 -0
- package/lib/engine-components/avatar/Avatar_MouthShapes.js.map +1 -0
- package/lib/engine-components/avatar/Avatar_MustacheShake.d.ts +8 -0
- package/lib/engine-components/avatar/Avatar_MustacheShake.js +29 -0
- package/lib/engine-components/avatar/Avatar_MustacheShake.js.map +1 -0
- package/lib/engine-components/codegen/exports.d.ts +140 -0
- package/lib/engine-components/codegen/exports.js +142 -0
- package/lib/engine-components/codegen/exports.js.map +1 -0
- package/lib/engine-components/debug/LogStats.d.ts +5 -0
- package/lib/engine-components/debug/LogStats.js +19 -0
- package/lib/engine-components/debug/LogStats.js.map +1 -0
- package/lib/engine-components/js-extensions/RGBAColor.d.ts +9 -0
- package/lib/engine-components/js-extensions/RGBAColor.js +35 -0
- package/lib/engine-components/js-extensions/RGBAColor.js.map +1 -0
- package/lib/engine-components/timeline/PlayableDirector.d.ts +66 -0
- package/lib/engine-components/timeline/PlayableDirector.js +460 -0
- package/lib/engine-components/timeline/PlayableDirector.js.map +1 -0
- package/lib/engine-components/timeline/SignalAsset.d.ts +19 -0
- package/lib/engine-components/timeline/SignalAsset.js +87 -0
- package/lib/engine-components/timeline/SignalAsset.js.map +1 -0
- package/lib/engine-components/timeline/TimelineModels.d.ts +86 -0
- package/lib/engine-components/timeline/TimelineModels.js +23 -0
- package/lib/engine-components/timeline/TimelineModels.js.map +1 -0
- package/lib/engine-components/timeline/TimelineTracks.d.ts +73 -0
- package/lib/engine-components/timeline/TimelineTracks.js +573 -0
- package/lib/engine-components/timeline/TimelineTracks.js.map +1 -0
- package/lib/engine-components/ui/BaseUIComponent.d.ts +24 -0
- package/lib/engine-components/ui/BaseUIComponent.js +129 -0
- package/lib/engine-components/ui/BaseUIComponent.js.map +1 -0
- package/lib/engine-components/ui/Button.d.ts +55 -0
- package/lib/engine-components/ui/Button.js +217 -0
- package/lib/engine-components/ui/Button.js.map +1 -0
- package/lib/engine-components/ui/Canvas.d.ts +39 -0
- package/lib/engine-components/ui/Canvas.js +169 -0
- package/lib/engine-components/ui/Canvas.js.map +1 -0
- package/lib/engine-components/ui/CanvasGroup.d.ts +14 -0
- package/lib/engine-components/ui/CanvasGroup.js +53 -0
- package/lib/engine-components/ui/CanvasGroup.js.map +1 -0
- package/lib/engine-components/ui/EventSystem.d.ts +44 -0
- package/lib/engine-components/ui/EventSystem.js +480 -0
- package/lib/engine-components/ui/EventSystem.js.map +1 -0
- package/lib/engine-components/ui/Graphic.d.ts +33 -0
- package/lib/engine-components/ui/Graphic.js +145 -0
- package/lib/engine-components/ui/Graphic.js.map +1 -0
- package/lib/engine-components/ui/Image.d.ts +20 -0
- package/lib/engine-components/ui/Image.js +61 -0
- package/lib/engine-components/ui/Image.js.map +1 -0
- package/lib/engine-components/ui/InputField.d.ts +25 -0
- package/lib/engine-components/ui/InputField.js +179 -0
- package/lib/engine-components/ui/InputField.js.map +1 -0
- package/lib/engine-components/ui/Interfaces.d.ts +7 -0
- package/lib/engine-components/ui/Interfaces.js +2 -0
- package/lib/engine-components/ui/Interfaces.js.map +1 -0
- package/lib/engine-components/ui/Keyboard.d.ts +31 -0
- package/lib/engine-components/ui/Keyboard.js +177 -0
- package/lib/engine-components/ui/Keyboard.js.map +1 -0
- package/lib/engine-components/ui/Layout.d.ts +10 -0
- package/lib/engine-components/ui/Layout.js +11 -0
- package/lib/engine-components/ui/Layout.js.map +1 -0
- package/lib/engine-components/ui/PointerEvents.d.ts +35 -0
- package/lib/engine-components/ui/PointerEvents.js +20 -0
- package/lib/engine-components/ui/PointerEvents.js.map +1 -0
- package/lib/engine-components/ui/Raycaster.d.ts +20 -0
- package/lib/engine-components/ui/Raycaster.js +40 -0
- package/lib/engine-components/ui/Raycaster.js.map +1 -0
- package/lib/engine-components/ui/RectTransform.d.ts +39 -0
- package/lib/engine-components/ui/RectTransform.js +173 -0
- package/lib/engine-components/ui/RectTransform.js.map +1 -0
- package/lib/engine-components/ui/SpatialHtml.d.ts +6 -0
- package/lib/engine-components/ui/SpatialHtml.js +58 -0
- package/lib/engine-components/ui/SpatialHtml.js.map +1 -0
- package/lib/engine-components/ui/Text.d.ts +68 -0
- package/lib/engine-components/ui/Text.js +631 -0
- package/lib/engine-components/ui/Text.js.map +1 -0
- package/lib/engine-components/ui/Utils.d.ts +19 -0
- package/lib/engine-components/ui/Utils.js +85 -0
- package/lib/engine-components/ui/Utils.js.map +1 -0
- package/lib/engine-schemes/schemes.d.ts +4 -0
- package/lib/engine-schemes/schemes.js +20 -0
- package/lib/engine-schemes/schemes.js.map +1 -0
- package/lib/engine-schemes/synced-camera-model.d.ts +25 -0
- package/lib/engine-schemes/synced-camera-model.js +68 -0
- package/lib/engine-schemes/synced-camera-model.js.map +1 -0
- package/lib/engine-schemes/synced-transform-model.d.ts +31 -0
- package/lib/engine-schemes/synced-transform-model.js +67 -0
- package/lib/engine-schemes/synced-transform-model.js.map +1 -0
- package/lib/engine-schemes/transform.d.ts +12 -0
- package/lib/engine-schemes/transform.js +40 -0
- package/lib/engine-schemes/transform.js.map +1 -0
- package/lib/engine-schemes/vec3.d.ts +11 -0
- package/lib/engine-schemes/vec3.js +30 -0
- package/lib/engine-schemes/vec3.js.map +1 -0
- package/lib/engine-schemes/vec4.d.ts +12 -0
- package/lib/engine-schemes/vec4.js +34 -0
- package/lib/engine-schemes/vec4.js.map +1 -0
- package/lib/engine-schemes/vr-user-state-buffer.d.ts +36 -0
- package/lib/engine-schemes/vr-user-state-buffer.js +104 -0
- package/lib/engine-schemes/vr-user-state-buffer.js.map +1 -0
- package/lib/needle-engine.d.ts +5 -0
- package/lib/needle-engine.js +34 -0
- package/lib/needle-engine.js.map +1 -0
- package/package.json +63 -0
- package/src/engine/codegen/register_types.js +297 -0
- package/src/engine/debug/error_overlay.ts +122 -0
- package/src/engine/engine.ts +15 -0
- package/src/engine/engine_addressables.ts +297 -0
- package/src/engine/engine_application.ts +42 -0
- package/src/engine/engine_assetdatabase.ts +215 -0
- package/src/engine/engine_caching.ts +0 -0
- package/src/engine/engine_components.js +202 -0
- package/src/engine/engine_constants.ts +3 -0
- package/src/engine/engine_coroutine.ts +16 -0
- package/src/engine/engine_default_parameters.ts +4 -0
- package/src/engine/engine_element.ts +380 -0
- package/src/engine/engine_element_loading.ts +178 -0
- package/src/engine/engine_element_overlay.ts +108 -0
- package/src/engine/engine_fileloader.js +9 -0
- package/src/engine/engine_generic_utils.js +14 -0
- package/src/engine/engine_gizmos.ts +15 -0
- package/src/engine/engine_gltf.ts +4 -0
- package/src/engine/engine_gltf_builtin_components.ts +298 -0
- package/src/engine/engine_input.ts +581 -0
- package/src/engine/engine_input_utils.ts +24 -0
- package/src/engine/engine_lightdata.ts +111 -0
- package/src/engine/engine_loaders.ts +26 -0
- package/src/engine/engine_mainloop_utils.ts +292 -0
- package/src/engine/engine_math.ts +43 -0
- package/src/engine/engine_networking.ts +664 -0
- package/src/engine/engine_networking_auto.ts +300 -0
- package/src/engine/engine_networking_files.ts +198 -0
- package/src/engine/engine_networking_files_default_components.ts +54 -0
- package/src/engine/engine_networking_instantiate.ts +321 -0
- package/src/engine/engine_networking_peer.ts +128 -0
- package/src/engine/engine_networking_utils.ts +12 -0
- package/src/engine/engine_networking_websocket.ts +1 -0
- package/src/engine/engine_physics.ts +652 -0
- package/src/engine/engine_rendererdata.ts +214 -0
- package/src/engine/engine_scenetools.ts +231 -0
- package/src/engine/engine_serialization.ts +4 -0
- package/src/engine/engine_serialization_builtin_serializer.ts +266 -0
- package/src/engine/engine_serialization_core.ts +513 -0
- package/src/engine/engine_serialization_decorator.ts +55 -0
- package/src/engine/engine_setup.ts +705 -0
- package/src/engine/engine_shaders.ts +243 -0
- package/src/engine/engine_three_utils.ts +290 -0
- package/src/engine/engine_time.ts +38 -0
- package/src/engine/engine_typestore.ts +21 -0
- package/src/engine/engine_utils.ts +268 -0
- package/src/engine/engine_web_api.ts +122 -0
- package/src/engine/extensions/EXT_texture_exr.js +42 -0
- package/src/engine/extensions/KHR_animation_pointer.ts +484 -0
- package/src/engine/extensions/NEEDLE_animator_controller.ts +68 -0
- package/src/engine/extensions/NEEDLE_animator_controller_model.ts +185 -0
- package/src/engine/extensions/NEEDLE_components.ts +234 -0
- package/src/engine/extensions/NEEDLE_deferred_texture.ts +175 -0
- package/src/engine/extensions/NEEDLE_gameobject_data.ts +76 -0
- package/src/engine/extensions/NEEDLE_lighting_settings.ts +161 -0
- package/src/engine/extensions/NEEDLE_lightmaps.ts +93 -0
- package/src/engine/extensions/NEEDLE_persistent_assets.ts +76 -0
- package/src/engine/extensions/NEEDLE_render_objects.ts +197 -0
- package/src/engine/extensions/NEEDLE_techniques_webgl.ts +482 -0
- package/src/engine/extensions/NEEDLE_timeline.ts +68 -0
- package/src/engine/extensions/extension_resolver.ts +5 -0
- package/src/engine/extensions/extension_utils.ts +138 -0
- package/src/engine/extensions/extensions.ts +49 -0
- package/src/engine/shaders/shaderData.ts +68 -0
- package/src/engine/tests/simulate_avatars.ts +2 -0
- package/src/engine/tests/test_utils.ts +63 -0
- package/src/engine-components/AlignmentConstraint.ts +33 -0
- package/src/engine-components/Animation.ts +282 -0
- package/src/engine-components/AnimationCurve.ts +42 -0
- package/src/engine-components/Animator.ts +148 -0
- package/src/engine-components/AnimatorController.ts +799 -0
- package/src/engine-components/AudioListener.ts +32 -0
- package/src/engine-components/AudioSource.ts +383 -0
- package/src/engine-components/AvatarLoader.ts +240 -0
- package/src/engine-components/AxesHelper.ts +32 -0
- package/src/engine-components/BasicIKConstraint.ts +54 -0
- package/src/engine-components/BoxCollider.ts +2 -0
- package/src/engine-components/BoxHelperComponent.ts +83 -0
- package/src/engine-components/Camera.ts +261 -0
- package/src/engine-components/Collider.ts +72 -0
- package/src/engine-components/Component.ts +1042 -0
- package/src/engine-components/ComponentExtensions.ts +7 -0
- package/src/engine-components/DeleteBox.ts +34 -0
- package/src/engine-components/DeviceFlag.ts +46 -0
- package/src/engine-components/DragControls.ts +534 -0
- package/src/engine-components/DropListener.ts +101 -0
- package/src/engine-components/Duplicatable.ts +146 -0
- package/src/engine-components/EventList.ts +116 -0
- package/src/engine-components/EventTrigger.ts +28 -0
- package/src/engine-components/EventType.ts +88 -0
- package/src/engine-components/FlyControls.ts +27 -0
- package/src/engine-components/Gizmos.ts +53 -0
- package/src/engine-components/GltfExport.ts +232 -0
- package/src/engine-components/GridHelper.ts +32 -0
- package/src/engine-components/GroundProjection.ts +75 -0
- package/src/engine-components/Interactable.ts +28 -0
- package/src/engine-components/LODGroup.ts +173 -0
- package/src/engine-components/Light.ts +418 -0
- package/src/engine-components/LookAtConstraint.ts +12 -0
- package/src/engine-components/MeshCollider.ts +12 -0
- package/src/engine-components/NavMesh.ts +118 -0
- package/src/engine-components/NestedGltf.ts +56 -0
- package/src/engine-components/Networking.ts +58 -0
- package/src/engine-components/OffsetConstraint.ts +32 -0
- package/src/engine-components/OrbitControls.ts +270 -0
- package/src/engine-components/ParticleSystem.ts +249 -0
- package/src/engine-components/ParticleSystemModules.ts +173 -0
- package/src/engine-components/PlayerColor.ts +93 -0
- package/src/engine-components/Renderer.ts +732 -0
- package/src/engine-components/RendererLightmap.ts +152 -0
- package/src/engine-components/RigidBody.ts +177 -0
- package/src/engine-components/ScreenCapture.ts +47 -0
- package/src/engine-components/ShadowCatcher.ts +93 -0
- package/src/engine-components/Skybox.ts +116 -0
- package/src/engine-components/SmoothFollow.ts +55 -0
- package/src/engine-components/SpatialTrigger.ts +142 -0
- package/src/engine-components/SpectatorCamera.ts +350 -0
- package/src/engine-components/SphereCollider.ts +2 -0
- package/src/engine-components/SpringJoint.ts +45 -0
- package/src/engine-components/SpriteRenderer.ts +143 -0
- package/src/engine-components/SyncedCamera.ts +206 -0
- package/src/engine-components/SyncedRoom.ts +157 -0
- package/src/engine-components/SyncedTransform.ts +339 -0
- package/src/engine-components/TestRunner.ts +116 -0
- package/src/engine-components/TransformGizmo.ts +185 -0
- package/src/engine-components/VideoPlayer.ts +308 -0
- package/src/engine-components/Voip.ts +455 -0
- package/src/engine-components/Volume.ts +86 -0
- package/src/engine-components/WebARSessionRoot.ts +109 -0
- package/src/engine-components/WebXR.ts +586 -0
- package/src/engine-components/WebXRAvatar.ts +326 -0
- package/src/engine-components/WebXRController.ts +1049 -0
- package/src/engine-components/WebXRGrabRendering.ts +151 -0
- package/src/engine-components/WebXRRig.ts +9 -0
- package/src/engine-components/WebXRSync.ts +458 -0
- package/src/engine-components/XRFlag.ts +134 -0
- package/src/engine-components/avatar/AvatarBlink_Simple.ts +68 -0
- package/src/engine-components/avatar/AvatarEyeLook_Rotation.ts +69 -0
- package/src/engine-components/avatar/Avatar_Brain_LookAt.ts +137 -0
- package/src/engine-components/avatar/Avatar_MouthShapes.ts +81 -0
- package/src/engine-components/avatar/Avatar_MustacheShake.ts +29 -0
- package/src/engine-components/codegen/exports.ts +141 -0
- package/src/engine-components/debug/LogStats.ts +22 -0
- package/src/engine-components/js-extensions/RGBAColor.ts +36 -0
- package/src/engine-components/timeline/PlayableDirector.ts +485 -0
- package/src/engine-components/timeline/SignalAsset.ts +108 -0
- package/src/engine-components/timeline/TimelineModels.ts +91 -0
- package/src/engine-components/timeline/TimelineTracks.ts +627 -0
- package/src/engine-components/ui/BaseUIComponent.ts +153 -0
- package/src/engine-components/ui/Button.ts +251 -0
- package/src/engine-components/ui/Canvas.ts +166 -0
- package/src/engine-components/ui/CanvasGroup.ts +47 -0
- package/src/engine-components/ui/EventSystem.ts +523 -0
- package/src/engine-components/ui/Graphic.ts +157 -0
- package/src/engine-components/ui/Image.ts +57 -0
- package/src/engine-components/ui/InputField.ts +235 -0
- package/src/engine-components/ui/Interfaces.ts +8 -0
- package/src/engine-components/ui/Keyboard.ts +203 -0
- package/src/engine-components/ui/Layout.ts +17 -0
- package/src/engine-components/ui/PointerEvents.ts +54 -0
- package/src/engine-components/ui/Raycaster.ts +47 -0
- package/src/engine-components/ui/RectTransform.ts +180 -0
- package/src/engine-components/ui/SpatialHtml.ts +63 -0
- package/src/engine-components/ui/Text.ts +634 -0
- package/src/engine-components/ui/Utils.ts +105 -0
- package/src/engine-components-experimental/Presentation.ts +13 -0
- package/src/engine-components-experimental/annotation/LineDrawer.ts +191 -0
- package/src/engine-components-experimental/annotation/LinesManager.ts +218 -0
- package/src/engine-components-experimental/networking/PlayerSync.ts +131 -0
- package/src/engine-schemes/COMPILE_SCHEMES.bat +4 -0
- package/src/engine-schemes/COMPILE_TS.bat +12 -0
- package/src/engine-schemes/schemes.ts +29 -0
- package/src/engine-schemes/synced-camera-model.ts +92 -0
- package/src/engine-schemes/synced-transform-model.ts +90 -0
- package/src/engine-schemes/syncedCamera.fbs +11 -0
- package/src/engine-schemes/transform.ts +50 -0
- package/src/engine-schemes/transforms.fbs +26 -0
- package/src/engine-schemes/vec.fbs +19 -0
- package/src/engine-schemes/vec2.ts +33 -0
- package/src/engine-schemes/vec3.ts +38 -0
- package/src/engine-schemes/vec4.ts +43 -0
- package/src/engine-schemes/vr-user-state-buffer.ts +138 -0
- package/src/engine-schemes/vrUserStateBuffer.fbs +17 -0
- package/src/needle-engine.ts +39 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function makeErrorsVisibleForDevelopment(): void;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { getParam } from "../engine_utils";
|
|
2
|
+
import { isLocalNetwork } from "../engine_networking_utils";
|
|
3
|
+
import { Context } from "../engine_setup";
|
|
4
|
+
const debug = getParam("debugdebug");
|
|
5
|
+
const hide = getParam("noerrors");
|
|
6
|
+
const errorContainer = new Map();
|
|
7
|
+
const locationRegex = new RegExp(" at .+\/(.+?\.ts)", "g");
|
|
8
|
+
var LogType;
|
|
9
|
+
(function (LogType) {
|
|
10
|
+
LogType[LogType["Log"] = 0] = "Log";
|
|
11
|
+
LogType[LogType["Warn"] = 1] = "Warn";
|
|
12
|
+
LogType[LogType["Error"] = 2] = "Error";
|
|
13
|
+
})(LogType || (LogType = {}));
|
|
14
|
+
export function makeErrorsVisibleForDevelopment() {
|
|
15
|
+
if (hide)
|
|
16
|
+
return;
|
|
17
|
+
if (isLocalNetwork()) {
|
|
18
|
+
if (debug)
|
|
19
|
+
console.log(window.location.hostname);
|
|
20
|
+
const error = console.error;
|
|
21
|
+
console.error = (...args) => {
|
|
22
|
+
error.apply(console, args);
|
|
23
|
+
handleLog(LogType.Error, args, null, null);
|
|
24
|
+
};
|
|
25
|
+
window.addEventListener("error", (event) => {
|
|
26
|
+
if (!event)
|
|
27
|
+
return;
|
|
28
|
+
handleLog(LogType.Error, event.error, event.filename, event.lineno);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function handleLog(type, message, _file, _line) {
|
|
33
|
+
const context = Context.Current;
|
|
34
|
+
if (!context)
|
|
35
|
+
return;
|
|
36
|
+
if (type === LogType.Error) {
|
|
37
|
+
if (Array.isArray(message)) {
|
|
38
|
+
message = message.join(" ");
|
|
39
|
+
}
|
|
40
|
+
appendErrorMessageToDomElement(context.domElement, message);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function getLocation(err) {
|
|
44
|
+
const location = err.stack;
|
|
45
|
+
console.log(location);
|
|
46
|
+
if (location) {
|
|
47
|
+
locationRegex.exec(location);
|
|
48
|
+
const match = locationRegex.exec(location);
|
|
49
|
+
return match ? match[1] : "";
|
|
50
|
+
}
|
|
51
|
+
return "";
|
|
52
|
+
}
|
|
53
|
+
function getErrorContainer(domElement) {
|
|
54
|
+
if (errorContainer.has(domElement)) {
|
|
55
|
+
return errorContainer.get(domElement);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const container = document.createElement("div");
|
|
59
|
+
container.style.position = "absolute";
|
|
60
|
+
container.style.top = "0";
|
|
61
|
+
container.style.left = "0";
|
|
62
|
+
container.style.margin = "5px";
|
|
63
|
+
container.style.width = "calc(100% - 10px)";
|
|
64
|
+
container.style.zIndex = "1000";
|
|
65
|
+
container.style.pointerEvents = "none";
|
|
66
|
+
container.style.display = "flex";
|
|
67
|
+
container.style.alignItems = "end";
|
|
68
|
+
container.style.flexDirection = "column";
|
|
69
|
+
container.style.color = "white";
|
|
70
|
+
container.style.overflow = "auto";
|
|
71
|
+
domElement.appendChild(container);
|
|
72
|
+
errorContainer.set(domElement, container);
|
|
73
|
+
return container;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function appendErrorMessageToDomElement(element, msg, location) {
|
|
77
|
+
const container = getErrorContainer(element);
|
|
78
|
+
if (container.childElementCount >= 5) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const errorElement = document.createElement("div");
|
|
82
|
+
container.appendChild(errorElement);
|
|
83
|
+
errorElement.style.display = "flex";
|
|
84
|
+
errorElement.style.alignItems = "start";
|
|
85
|
+
errorElement.style.flexDirection = "row";
|
|
86
|
+
// errorElement.style.justifyContent = "space-between";
|
|
87
|
+
// errorElement.style.width = "100%";
|
|
88
|
+
errorElement.style.padding = ".2em";
|
|
89
|
+
errorElement.style.backgroundColor = "rgba(0,0,0,1)";
|
|
90
|
+
errorElement.style.marginBottom = "2px";
|
|
91
|
+
errorElement.style.borderRadius = "8px";
|
|
92
|
+
errorElement.style.color = "#ff5555";
|
|
93
|
+
errorElement.style.fontWeight = "bold";
|
|
94
|
+
errorElement.title = "Open developer console to debug";
|
|
95
|
+
errorElement.style.pointerEvents = "all";
|
|
96
|
+
errorElement.style.userSelect = "text";
|
|
97
|
+
const messageElement = document.createElement("div");
|
|
98
|
+
const locationElement = document.createElement("div");
|
|
99
|
+
errorElement.appendChild(messageElement);
|
|
100
|
+
errorElement.appendChild(locationElement);
|
|
101
|
+
if (msg.length > 200) {
|
|
102
|
+
msg = msg.substring(0, 200) + "...";
|
|
103
|
+
}
|
|
104
|
+
messageElement.innerText = msg; // "Javascript error: please open the browser developer console to debug";// + msg;
|
|
105
|
+
locationElement.innerText = location || "";
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
container.removeChild(errorElement);
|
|
108
|
+
}, 10000);
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=error_overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error_overlay.js","sourceRoot":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K,CAAC,eAAe,GAAG,eAAe,CAAC;IACrD,YAAY,CAAC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC;IACxC,YAAY,CAAC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC;IACxC,YAAY,CAAC,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;IACrC,YAAY,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC;IACvC,YAAY,CAAC,KAAK,GAAG,iCAAiC,CAAC;IACvD,YAAY,CAAC,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC;IACzC,YAAY,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC;IAEvC,MAAM,cAAc,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACrD,MAAM,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACtD,YAAY,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACzC,YAAY,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAC1C,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE;QAClB,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC;KACvC;IACD,cAAc,CAAC,SAAS,GAAG,GAAG,CAAC,CAAA,mFAAmF;IAClH,eAAe,CAAC,SAAS,GAAG,QAAQ,IAAI,EAAE,CAAC;IAC3C,UAAU,CAAC,GAAG,EAAE;QACZ,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC,EAAE,KAAK,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as engine_setup from "./engine_setup";
|
|
2
|
+
import * as engine_scenetools from "./engine_scenetools";
|
|
3
|
+
import "./tests/test_utils";
|
|
4
|
+
import { RGBAColor } from "../engine-components/js-extensions/RGBAColor";
|
|
5
|
+
declare const engine: {
|
|
6
|
+
RGBAColor: typeof RGBAColor;
|
|
7
|
+
addGltfLoadEventListener(type: engine_scenetools.GltfLoadEventType, listener: engine_scenetools.GltfLoadEventCallback): void;
|
|
8
|
+
removeGltfLoadEventListener(type: engine_scenetools.GltfLoadEventType, listener: engine_scenetools.GltfLoadEventCallback): void;
|
|
9
|
+
parseSync(context: engine_setup.Context, data: any, path: string, seed: number | import("../engine-components/Component").UIDProvider | null): Promise<import("three/examples/jsm/loaders/GLTFLoader").GLTF | undefined>;
|
|
10
|
+
loadSync(context: engine_setup.Context, url: string, seed: number | import("../engine-components/Component").UIDProvider | null, _allowAddingAnimator?: boolean, prog?: ((ProgressEvent: any) => void) | undefined): Promise<import("three/examples/jsm/loaders/GLTFLoader").GLTF | undefined>;
|
|
11
|
+
findAnimationsLate(_context: engine_setup.Context, gltf: any, callbackarray: any, allowAddingAnimator?: boolean): void;
|
|
12
|
+
findAnimations(gltf: import("three/examples/jsm/loaders/GLTFLoader").GLTF, allowAddingAnimator?: boolean): void;
|
|
13
|
+
tryFindObjectByName(name: any, obj: any, recursive?: boolean): any;
|
|
14
|
+
tryFindObject(globalObjectIdentifier: any, obj: any, recursive?: boolean): any;
|
|
15
|
+
tryFindScript(globalObjectIdentifier: any, list?: null): import("../engine-components/Component").Behaviour | null;
|
|
16
|
+
GltfLoadEventType: typeof engine_scenetools.GltfLoadEventType;
|
|
17
|
+
GltfLoadEvent: typeof engine_scenetools.GltfLoadEvent;
|
|
18
|
+
build_scene_functions: {
|
|
19
|
+
[name: string]: (context: engine_setup.Context) => Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
LoadingProgressArgs: typeof engine_setup.LoadingProgressArgs;
|
|
22
|
+
LoadingOptions: typeof engine_setup.LoadingOptions;
|
|
23
|
+
ContextArgs: typeof engine_setup.ContextArgs;
|
|
24
|
+
FrameEvent: typeof engine_setup.FrameEvent;
|
|
25
|
+
Context: typeof engine_setup.Context;
|
|
26
|
+
};
|
|
27
|
+
export { engine as engine };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as engine_setup from "./engine_setup";
|
|
2
|
+
import * as engine_scenetools from "./engine_scenetools";
|
|
3
|
+
import "./tests/test_utils";
|
|
4
|
+
import { RGBAColor } from "../engine-components/js-extensions/RGBAColor";
|
|
5
|
+
import { makeErrorsVisibleForDevelopment } from "./debug/error_overlay";
|
|
6
|
+
makeErrorsVisibleForDevelopment();
|
|
7
|
+
const engine = {
|
|
8
|
+
...engine_setup,
|
|
9
|
+
...engine_scenetools,
|
|
10
|
+
RGBAColor,
|
|
11
|
+
};
|
|
12
|
+
export { engine as engine };
|
|
13
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../engine/engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAExE,+BAA+B,EAAE,CAAC;AAElC,MAAM,MAAM,GAAG;IACX,GAAG,YAAY;IACf,GAAG,iBAAiB;IACpB,SAAS;CACZ,CAAC;AAEF,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { GameObject, InstantiateOptions } from "../engine-components/Component";
|
|
2
|
+
import { Context } from "./engine_setup";
|
|
3
|
+
import { SourceIdentifier } from "./engine_gltf";
|
|
4
|
+
export declare class Addressables {
|
|
5
|
+
private _context;
|
|
6
|
+
constructor(context: Context);
|
|
7
|
+
private preUpdate;
|
|
8
|
+
private _assetReferences;
|
|
9
|
+
findAssetReference(uri: string): AssetReference | null;
|
|
10
|
+
registerAssetReference(ref: AssetReference): AssetReference;
|
|
11
|
+
}
|
|
12
|
+
export declare type ProgressCallback = (asset: AssetReference, prog: ProgressEvent) => void;
|
|
13
|
+
export declare class AssetReference {
|
|
14
|
+
static getOrCreate(sourceId: SourceIdentifier, uri: string, context: Context): AssetReference;
|
|
15
|
+
get asset(): any;
|
|
16
|
+
protected set asset(val: any);
|
|
17
|
+
private _loading?;
|
|
18
|
+
get uri(): string;
|
|
19
|
+
get rawAsset(): any;
|
|
20
|
+
private _asset;
|
|
21
|
+
private _glbRoot?;
|
|
22
|
+
private _uri;
|
|
23
|
+
private _progressListeners;
|
|
24
|
+
private _isLoadingRawBinary;
|
|
25
|
+
private _rawBinary?;
|
|
26
|
+
constructor(uri: string);
|
|
27
|
+
private onResolvePrefab;
|
|
28
|
+
private get mustLoad();
|
|
29
|
+
isLoaded(): boolean | ArrayBuffer;
|
|
30
|
+
unload(): void;
|
|
31
|
+
preload(): Promise<ArrayBuffer | null>;
|
|
32
|
+
loadAssetAsync(prog?: ProgressCallback | null): Promise<any>;
|
|
33
|
+
instantiate(parent?: THREE.Object3D | InstantiateOptions): Promise<GameObject | null>;
|
|
34
|
+
instantiateSynced(parent?: THREE.Object3D | InstantiateOptions, saveOnServer?: boolean): Promise<GameObject | null>;
|
|
35
|
+
beginListenDownload(evt: ProgressCallback): void;
|
|
36
|
+
endListenDownload(evt: ProgressCallback): void;
|
|
37
|
+
private raiseProgressEvent;
|
|
38
|
+
private onInstantiate;
|
|
39
|
+
/**
|
|
40
|
+
* try to ignore the intermediate created object
|
|
41
|
+
* because it causes trouble if we instantiate an assetreference per player
|
|
42
|
+
* and call destroy on the player marker root
|
|
43
|
+
* @returns the scene root object if the asset was a glb/gltf
|
|
44
|
+
*/
|
|
45
|
+
private tryGetActualGameObjectRoot;
|
|
46
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { getParam, getPath } from "../engine/engine_utils";
|
|
2
|
+
import { GameObject, InstantiateOptions } from "../engine-components/Component";
|
|
3
|
+
import { loadSync, parseSync } from "./engine_scenetools";
|
|
4
|
+
import { TypeSerializer } from "./engine_serialization_core";
|
|
5
|
+
import { Context } from "./engine_setup";
|
|
6
|
+
import { Object3D } from "three";
|
|
7
|
+
import { processNewScripts } from "./engine_mainloop_utils";
|
|
8
|
+
import { registerPrefabProvider, syncInstantiate } from "./engine_networking_instantiate";
|
|
9
|
+
import { download } from "./engine_web_api";
|
|
10
|
+
const debug = getParam("debugaddressables");
|
|
11
|
+
export class Addressables {
|
|
12
|
+
_context;
|
|
13
|
+
constructor(context) {
|
|
14
|
+
this._context = context;
|
|
15
|
+
this._context.pre_update_callbacks.push(this.preUpdate.bind(this));
|
|
16
|
+
}
|
|
17
|
+
preUpdate() {
|
|
18
|
+
}
|
|
19
|
+
_assetReferences = {};
|
|
20
|
+
findAssetReference(uri) {
|
|
21
|
+
return this._assetReferences[uri] || null;
|
|
22
|
+
}
|
|
23
|
+
registerAssetReference(ref) {
|
|
24
|
+
if (!ref.uri)
|
|
25
|
+
return ref;
|
|
26
|
+
if (!this._assetReferences[ref.uri]) {
|
|
27
|
+
this._assetReferences[ref.uri] = ref;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.warn("Asset reference already registered", ref);
|
|
31
|
+
}
|
|
32
|
+
return ref;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export class AssetReference {
|
|
36
|
+
static getOrCreate(sourceId, uri, context) {
|
|
37
|
+
const fullPath = getPath(sourceId, uri);
|
|
38
|
+
if (debug)
|
|
39
|
+
console.log("GetOrCreate Addressable from", sourceId, uri, "FinalPath=", fullPath);
|
|
40
|
+
const addressables = context.addressables;
|
|
41
|
+
const existing = addressables.findAssetReference(fullPath);
|
|
42
|
+
if (existing)
|
|
43
|
+
return existing;
|
|
44
|
+
const ref = new AssetReference(fullPath);
|
|
45
|
+
addressables.registerAssetReference(ref);
|
|
46
|
+
return ref;
|
|
47
|
+
}
|
|
48
|
+
get asset() {
|
|
49
|
+
return this._glbRoot ?? this._asset;
|
|
50
|
+
}
|
|
51
|
+
set asset(val) {
|
|
52
|
+
this._asset = val;
|
|
53
|
+
}
|
|
54
|
+
_loading;
|
|
55
|
+
get uri() {
|
|
56
|
+
return this._uri;
|
|
57
|
+
}
|
|
58
|
+
get rawAsset() { return this._asset; }
|
|
59
|
+
_asset;
|
|
60
|
+
_glbRoot;
|
|
61
|
+
_uri;
|
|
62
|
+
_progressListeners = [];
|
|
63
|
+
_isLoadingRawBinary = false;
|
|
64
|
+
_rawBinary;
|
|
65
|
+
constructor(uri) {
|
|
66
|
+
this._uri = uri;
|
|
67
|
+
registerPrefabProvider(this._uri, this.onResolvePrefab.bind(this));
|
|
68
|
+
}
|
|
69
|
+
async onResolvePrefab(uri) {
|
|
70
|
+
if (uri === this.uri) {
|
|
71
|
+
if (this.mustLoad)
|
|
72
|
+
await this.loadAssetAsync();
|
|
73
|
+
if (this.asset) {
|
|
74
|
+
return this.asset;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
get mustLoad() {
|
|
80
|
+
return !this.asset || this.asset.__destroyed === true;
|
|
81
|
+
}
|
|
82
|
+
isLoaded() { return this._rawBinary || this.asset !== undefined; }
|
|
83
|
+
unload() {
|
|
84
|
+
if (this.asset) {
|
|
85
|
+
if (debug)
|
|
86
|
+
console.log("Unload", this.asset);
|
|
87
|
+
// TODO: we need a way to remove objects from the context (including components) without actually "destroying" them
|
|
88
|
+
if (this.asset.scene)
|
|
89
|
+
GameObject.destroy(this.asset.scene);
|
|
90
|
+
else
|
|
91
|
+
GameObject.destroy(this.asset);
|
|
92
|
+
}
|
|
93
|
+
this.asset = null;
|
|
94
|
+
}
|
|
95
|
+
async preload() {
|
|
96
|
+
if (!this.mustLoad)
|
|
97
|
+
return null;
|
|
98
|
+
if (this._isLoadingRawBinary)
|
|
99
|
+
return null;
|
|
100
|
+
if (this._rawBinary !== undefined)
|
|
101
|
+
return this._rawBinary;
|
|
102
|
+
this._isLoadingRawBinary = true;
|
|
103
|
+
if (debug)
|
|
104
|
+
console.log("Preload", this.uri);
|
|
105
|
+
const res = await download(this.uri, p => {
|
|
106
|
+
this.raiseProgressEvent(p);
|
|
107
|
+
});
|
|
108
|
+
this._rawBinary = res?.buffer ?? null;
|
|
109
|
+
this._isLoadingRawBinary = false;
|
|
110
|
+
return this._rawBinary;
|
|
111
|
+
}
|
|
112
|
+
async loadAssetAsync(prog) {
|
|
113
|
+
if (!this.mustLoad)
|
|
114
|
+
return;
|
|
115
|
+
if (prog)
|
|
116
|
+
this._progressListeners.push(prog);
|
|
117
|
+
if (this._loading !== undefined) {
|
|
118
|
+
// console.warn("Wait for other loading thiny");
|
|
119
|
+
return this._loading;
|
|
120
|
+
}
|
|
121
|
+
const context = Context.Current;
|
|
122
|
+
// TODO: technically we shouldnt call awake only when the object is added to a scene
|
|
123
|
+
// addressables now allow loading things without adding them to a scene immediately
|
|
124
|
+
// we should "address" (LUL) this
|
|
125
|
+
// console.log("START LOADING");
|
|
126
|
+
if (this._rawBinary) {
|
|
127
|
+
this._loading = parseSync(context, this._rawBinary, this.uri, null);
|
|
128
|
+
this.raiseProgressEvent(new ProgressEvent("progress", { loaded: this._rawBinary.byteLength, total: this._rawBinary.byteLength }));
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
if (debug)
|
|
132
|
+
console.log("Load async", this.uri);
|
|
133
|
+
this._loading = loadSync(context, this.uri, null, true, prog => {
|
|
134
|
+
this.raiseProgressEvent(prog);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
const res = await this._loading;
|
|
138
|
+
// clear all progress listeners after download has finished
|
|
139
|
+
this._progressListeners.length = 0;
|
|
140
|
+
this._glbRoot = this.tryGetActualGameObjectRoot(res);
|
|
141
|
+
this._loading = undefined;
|
|
142
|
+
if (res) {
|
|
143
|
+
// we need to handle the pre_setup callsbacks before instantiating
|
|
144
|
+
// because that is where deserialization happens
|
|
145
|
+
processNewScripts(context);
|
|
146
|
+
if (res.scene !== undefined) {
|
|
147
|
+
this.asset = res;
|
|
148
|
+
}
|
|
149
|
+
return this.asset;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async instantiate(parent) {
|
|
153
|
+
return this.onInstantiate(parent, false);
|
|
154
|
+
}
|
|
155
|
+
async instantiateSynced(parent, saveOnServer = true) {
|
|
156
|
+
return this.onInstantiate(parent, true, saveOnServer);
|
|
157
|
+
}
|
|
158
|
+
beginListenDownload(evt) {
|
|
159
|
+
if (this._progressListeners.indexOf(evt) < 0)
|
|
160
|
+
this._progressListeners.push(evt);
|
|
161
|
+
}
|
|
162
|
+
endListenDownload(evt) {
|
|
163
|
+
const index = this._progressListeners.indexOf(evt);
|
|
164
|
+
if (index >= 0) {
|
|
165
|
+
this._progressListeners.splice(index, 1);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
raiseProgressEvent(prog) {
|
|
169
|
+
for (const list of this._progressListeners) {
|
|
170
|
+
list(this, prog);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
async onInstantiate(parent, networked = false, saveOnServer) {
|
|
174
|
+
const context = Context.Current;
|
|
175
|
+
if (!parent)
|
|
176
|
+
parent = context.scene;
|
|
177
|
+
if (this.mustLoad) {
|
|
178
|
+
await this.loadAssetAsync();
|
|
179
|
+
}
|
|
180
|
+
if (debug)
|
|
181
|
+
console.log("Instantiate", this.uri, "parent:", parent);
|
|
182
|
+
if (this.asset) {
|
|
183
|
+
if (debug)
|
|
184
|
+
console.log("Add to scene", this.asset);
|
|
185
|
+
let options = parent instanceof InstantiateOptions ? parent : null;
|
|
186
|
+
if (!options) {
|
|
187
|
+
options = new InstantiateOptions();
|
|
188
|
+
}
|
|
189
|
+
if (typeof parent === "object") {
|
|
190
|
+
if (parent instanceof Object3D) {
|
|
191
|
+
options.parent = parent;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
Object.assign(options, parent);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (networked) {
|
|
198
|
+
options.context = context;
|
|
199
|
+
const prefab = this.asset;
|
|
200
|
+
prefab.guid = this.uri;
|
|
201
|
+
const instance = syncInstantiate(prefab, options, undefined, saveOnServer);
|
|
202
|
+
if (instance) {
|
|
203
|
+
return instance;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
const instance = GameObject.instantiate(this.asset, options);
|
|
208
|
+
if (instance) {
|
|
209
|
+
return instance;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
else if (debug)
|
|
214
|
+
console.warn("Failed to load asset", this.uri);
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* try to ignore the intermediate created object
|
|
219
|
+
* because it causes trouble if we instantiate an assetreference per player
|
|
220
|
+
* and call destroy on the player marker root
|
|
221
|
+
* @returns the scene root object if the asset was a glb/gltf
|
|
222
|
+
*/
|
|
223
|
+
tryGetActualGameObjectRoot(asset) {
|
|
224
|
+
if (asset && asset.scene) {
|
|
225
|
+
// some exporters produce additional root objects
|
|
226
|
+
const scene = asset.scene;
|
|
227
|
+
if (scene.isGroup && scene.children.length === 1 && scene.children[0].name + "glb" === scene.name) {
|
|
228
|
+
const root = scene.children[0];
|
|
229
|
+
return root;
|
|
230
|
+
}
|
|
231
|
+
// ok the scene is the scene, just use that then
|
|
232
|
+
else
|
|
233
|
+
return scene;
|
|
234
|
+
}
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
class AddressableSerializer extends TypeSerializer {
|
|
239
|
+
constructor() {
|
|
240
|
+
super([AssetReference]);
|
|
241
|
+
}
|
|
242
|
+
onSerialize(data, _context) {
|
|
243
|
+
if (data && data.uri !== undefined && typeof data.uri === "string") {
|
|
244
|
+
return data.uri;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
onDeserialize(data, context) {
|
|
248
|
+
if (typeof data === "string") {
|
|
249
|
+
if (!context.context) {
|
|
250
|
+
console.error("Missing context");
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
if (!context.gltfId) {
|
|
254
|
+
console.error("Missing spurce id");
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
const ref = AssetReference.getOrCreate(context.gltfId, data, context.context);
|
|
258
|
+
return ref;
|
|
259
|
+
}
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
new AddressableSerializer();
|
|
264
|
+
//# sourceMappingURL=engine_addressables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine_addressables.js","sourceRoot":"","sources":["../../../engine/engine_addressables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAwB,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAyB,QAAQ,EAAS,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAoB,sBAAsB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAC5G,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,MAAM,KAAK,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AAE5C,MAAM,OAAO,YAAY;IAEb,QAAQ,CAAU;IAE1B,YAAY,OAAgB;QACxB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACvE,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_setup";
|
|
2
|
+
export declare enum ApplicationEvents {
|
|
3
|
+
Visible = "application-visible",
|
|
4
|
+
Hidden = "application-hidden"
|
|
5
|
+
}
|
|
6
|
+
export declare class Application extends EventTarget {
|
|
7
|
+
private context;
|
|
8
|
+
get hasFocus(): boolean;
|
|
9
|
+
get isVisible(): boolean;
|
|
10
|
+
private _isVisible;
|
|
11
|
+
constructor(context: Context);
|
|
12
|
+
private onVisiblityChanged;
|
|
13
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export var ApplicationEvents;
|
|
2
|
+
(function (ApplicationEvents) {
|
|
3
|
+
ApplicationEvents["Visible"] = "application-visible";
|
|
4
|
+
ApplicationEvents["Hidden"] = "application-hidden";
|
|
5
|
+
})(ApplicationEvents || (ApplicationEvents = {}));
|
|
6
|
+
export class Application extends EventTarget {
|
|
7
|
+
context;
|
|
8
|
+
get hasFocus() {
|
|
9
|
+
return document.hasFocus();
|
|
10
|
+
}
|
|
11
|
+
get isVisible() {
|
|
12
|
+
return this._isVisible;
|
|
13
|
+
}
|
|
14
|
+
_isVisible = true;
|
|
15
|
+
constructor(context) {
|
|
16
|
+
super();
|
|
17
|
+
this.context = context;
|
|
18
|
+
// console.log("APP");
|
|
19
|
+
window.addEventListener("visibilitychange", this.onVisiblityChanged.bind(this), false);
|
|
20
|
+
}
|
|
21
|
+
onVisiblityChanged(evt) {
|
|
22
|
+
// console.log(evt.target.visibilityState)
|
|
23
|
+
switch (evt.target.visibilityState) {
|
|
24
|
+
case "hidden":
|
|
25
|
+
this._isVisible = false;
|
|
26
|
+
this.dispatchEvent(new Event(ApplicationEvents.Hidden));
|
|
27
|
+
break;
|
|
28
|
+
case "visible":
|
|
29
|
+
this._isVisible = true;
|
|
30
|
+
this.dispatchEvent(new Event(ApplicationEvents.Visible));
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=engine_application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine_application.js","sourceRoot":"","sources":["../../../engine/engine_application.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IACzB,oDAA+B,CAAA;IAC/B,kDAA6B,CAAA;AACjC,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B;AAED,MAAM,OAAO,WAAY,SAAQ,WAAW;IAEhC,OAAO,CAAW;IAE1B,IAAW,QAAQ;QACf,OAAO,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;IAED,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAEO,UAAU,GAAY,IAAI,CAAC;IAEnC,YAAY,OAAiB;QACzB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,sBAAsB;QACtB,MAAM,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IAC3F,CAAC;IAEO,kBAAkB,CAAC,GAAG;QAC1B,0CAA0C;QAC1C,QAAQ,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE;YAChC,KAAK,QAAQ;gBACT,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;gBACxB,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;gBACxD,MAAM;YACV,KAAK,SAAS;gBACV,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;gBACvB,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;gBACzD,MAAM;SACb;IACL,CAAC;CACJ"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { Scene } from 'three';
|
|
3
|
+
declare class TextureInfo {
|
|
4
|
+
name: string;
|
|
5
|
+
sampler: number;
|
|
6
|
+
source: number;
|
|
7
|
+
extras: {
|
|
8
|
+
guid: string;
|
|
9
|
+
} | undefined;
|
|
10
|
+
}
|
|
11
|
+
declare class GltfJson {
|
|
12
|
+
textures: TextureInfo[];
|
|
13
|
+
bufferViews: Array<{
|
|
14
|
+
buffer: number;
|
|
15
|
+
byteOffset: number;
|
|
16
|
+
byteLength: number;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
declare class GltfParser {
|
|
20
|
+
cache: any;
|
|
21
|
+
json: GltfJson;
|
|
22
|
+
associations: Map<any, any>;
|
|
23
|
+
textureLoader: THREE.TextureLoader;
|
|
24
|
+
loadTexture: Function;
|
|
25
|
+
}
|
|
26
|
+
declare class Gltf {
|
|
27
|
+
parser: GltfParser;
|
|
28
|
+
scene: Scene;
|
|
29
|
+
}
|
|
30
|
+
/** @deprecated */
|
|
31
|
+
export declare class AssetDatabase {
|
|
32
|
+
constructor();
|
|
33
|
+
private texturesLoader;
|
|
34
|
+
private textures;
|
|
35
|
+
private texturesLoading;
|
|
36
|
+
/** @deprecated */
|
|
37
|
+
loadTexture(url: string): Promise<THREE.Texture | null>;
|
|
38
|
+
/** @deprecated */
|
|
39
|
+
getTexture(guid: string): THREE.Texture | null;
|
|
40
|
+
/** @deprecated */
|
|
41
|
+
findTexture(name: string): THREE.Texture | null;
|
|
42
|
+
/** @deprecated */
|
|
43
|
+
findMesh(name: string): THREE.Mesh | null;
|
|
44
|
+
/** @deprecated */
|
|
45
|
+
findMaterial(name: string): THREE.Material | null;
|
|
46
|
+
/** @deprecated */
|
|
47
|
+
registerGltf(_gltf: Gltf): Promise<void>;
|
|
48
|
+
/** @deprecated */
|
|
49
|
+
registerAsset(_asset: any): void;
|
|
50
|
+
private _materials;
|
|
51
|
+
private _meshes;
|
|
52
|
+
private _textures;
|
|
53
|
+
}
|
|
54
|
+
export {};
|