@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,85 @@
|
|
|
1
|
+
import { LightmapType } from "./extensions/NEEDLE_lightmaps";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
import { getParam } from "./engine_utils";
|
|
4
|
+
const debugLightmap = getParam("debuglightmaps") ? true : false;
|
|
5
|
+
// how do we know which lightmap should be used for which object
|
|
6
|
+
// e.g. if we load in 3 gltf objects and all bring their own lightmaps
|
|
7
|
+
// we need a good way for e.g. Renderer components to safely get THEIR lightmap
|
|
8
|
+
// similarly how do we deal with a gltf bringing its own skybox
|
|
9
|
+
// e.g. it contains a camera and a skybox - the camera should be able to access this skybox if necessary
|
|
10
|
+
// and reflection data should be accessible as well
|
|
11
|
+
export class LightDataRegistry {
|
|
12
|
+
_context;
|
|
13
|
+
_lightmaps = new Map();
|
|
14
|
+
constructor(context) {
|
|
15
|
+
this._context = context;
|
|
16
|
+
}
|
|
17
|
+
registerTexture(sourceId, type, tex, index) {
|
|
18
|
+
if (debugLightmap)
|
|
19
|
+
console.log("Registering lightmap", sourceId, LightmapType[type], tex);
|
|
20
|
+
if (!this._lightmaps.has(sourceId))
|
|
21
|
+
this._lightmaps.set(sourceId, new Map());
|
|
22
|
+
const map = this._lightmaps.get(sourceId);
|
|
23
|
+
const arr = map?.get(type) ?? [];
|
|
24
|
+
if (arr.length < index)
|
|
25
|
+
arr.length = index + 1;
|
|
26
|
+
arr[index] = tex;
|
|
27
|
+
map?.set(type, arr);
|
|
28
|
+
}
|
|
29
|
+
tryGetLightmap(sourceId, index = 0) {
|
|
30
|
+
return this.tryGet(sourceId, LightmapType.Lightmap, index);
|
|
31
|
+
}
|
|
32
|
+
tryGetSkybox(sourceId) {
|
|
33
|
+
return this.tryGet(sourceId, LightmapType.Skybox, 0);
|
|
34
|
+
}
|
|
35
|
+
tryGetReflection(sourceId) {
|
|
36
|
+
return this.tryGet(sourceId, LightmapType.Reflection, 0);
|
|
37
|
+
}
|
|
38
|
+
tryGet(sourceId, type, index) {
|
|
39
|
+
if (!sourceId) {
|
|
40
|
+
if (debugLightmap)
|
|
41
|
+
console.warn("Missing source id");
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const arr = this._lightmaps.get(sourceId)?.get(type) ?? null;
|
|
45
|
+
if (!arr?.length || arr.length <= index)
|
|
46
|
+
return null;
|
|
47
|
+
return arr[index];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// all the chunks we can patch
|
|
51
|
+
// console.log(THREE.ShaderChunk);
|
|
52
|
+
// Unity: ambientOrLightmapUV.xy = v.uv1.xy * unity_LightmapST.xy + unity_LightmapST.zw; ambientOrLightmapUV.zw = 0;
|
|
53
|
+
THREE.ShaderChunk.lights_fragment_maps = THREE.ShaderChunk.lights_fragment_maps.replace("vec4 lightMapTexel = texture2D( lightMap, vUv2 );", `
|
|
54
|
+
|
|
55
|
+
vec2 lUv = vUv2.xy * lightmapScaleOffset.xy + vec2(lightmapScaleOffset.z, (1. - (lightmapScaleOffset.y + lightmapScaleOffset.w)));
|
|
56
|
+
vec4 lightMapTexel = texture2D( lightMap, lUv);
|
|
57
|
+
// The range of RGBM lightmaps goes from 0 to 34.49 (5^2.2) in linear space, and from 0 to 5 in gamma space.
|
|
58
|
+
lightMapTexel.rgb *= lightMapTexel.a * 8.; // no idea where that "8" comes from... heuristically derived
|
|
59
|
+
lightMapTexel.a = 1.;
|
|
60
|
+
lightMapTexel = conv_sRGBToLinear(lightMapTexel);
|
|
61
|
+
`);
|
|
62
|
+
THREE.ShaderChunk.lightmap_pars_fragment = `
|
|
63
|
+
#ifdef USE_LIGHTMAP
|
|
64
|
+
uniform sampler2D lightMap;
|
|
65
|
+
uniform float lightMapIntensity;
|
|
66
|
+
uniform vec4 lightmapScaleOffset;
|
|
67
|
+
|
|
68
|
+
// took from threejs 05fc79cd52b79e8c3e8dec1e7dca72c5c39983a4
|
|
69
|
+
vec4 conv_sRGBToLinear( in vec4 value ) {
|
|
70
|
+
return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
|
|
71
|
+
}
|
|
72
|
+
#endif
|
|
73
|
+
`;
|
|
74
|
+
// When objects use Lightmaps in Unity, they already have IBL applied on the Lightmap,
|
|
75
|
+
// so they shouldn't receive light probe lighting.
|
|
76
|
+
// TODO: this gets difficult if there are additional real-time lightprobes added; we would need to exclude
|
|
77
|
+
// exactly those that were active when lighting was baked... that's complicated!
|
|
78
|
+
THREE.ShaderChunk.lights_fragment_begin = THREE.ShaderChunk.lights_fragment_begin.replace("irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );", `
|
|
79
|
+
#if defined(USE_LIGHTMAP)
|
|
80
|
+
irradiance += 0.;
|
|
81
|
+
#else
|
|
82
|
+
irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
|
|
83
|
+
#endif`);
|
|
84
|
+
THREE.UniformsLib.lightmap["lightmapScaleOffset"] = { value: new THREE.Vector4(1, 1, 0, 0) };
|
|
85
|
+
//#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;;;;;;;KAWtC,CAAC;AAEN,sFAAsF;AACtF,kDAAkD;AAClD,0GAA0G;AAC1G,gFAAgF;AAChF,KAAK,CAAC,WAAW,CAAC,qBAAqB,GAAG,KAAK,CAAC,WAAW,CAAC,qBAAqB,CAAC,OAAO,CACrF,uEAAuE,EAAE;;;;;OAKtE,CAAC,CAAC;AAET,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,qBAAqB,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js';
|
|
2
|
+
import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js';
|
|
3
|
+
let dracoLoader;
|
|
4
|
+
let ktx2Loader;
|
|
5
|
+
export function addDracoAndKTX2Loaders(loader, context) {
|
|
6
|
+
if (!dracoLoader) {
|
|
7
|
+
dracoLoader = new DRACOLoader();
|
|
8
|
+
dracoLoader.setDecoderPath('./include/draco/');
|
|
9
|
+
dracoLoader.setDecoderConfig({ type: 'js' });
|
|
10
|
+
}
|
|
11
|
+
if (!ktx2Loader) {
|
|
12
|
+
ktx2Loader = new KTX2Loader();
|
|
13
|
+
ktx2Loader.setTranscoderPath('./include/ktx2/');
|
|
14
|
+
if (context.renderer)
|
|
15
|
+
ktx2Loader.detectSupport(context.renderer);
|
|
16
|
+
}
|
|
17
|
+
loader.setDRACOLoader(dracoLoader);
|
|
18
|
+
loader.setKTX2Loader(ktx2Loader);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=engine_loaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine_loaders.js","sourceRoot":"","sources":["../../../engine/engine_loaders.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,IAAI,WAAwB,CAAC;AAC7B,IAAI,UAAsB,CAAC;AAG3B,MAAM,UAAU,sBAAsB,CAAC,MAAkB,EAAE,OAAiB;IACxE,IAAI,CAAC,WAAW,EAAE;QACd,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QAChC,WAAW,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;QAC/C,WAAW,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;KAChD;IACD,IAAI,CAAC,UAAU,EAAE;QACb,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QAC9B,UAAU,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;QAChD,IAAI,OAAO,CAAC,QAAQ;YAChB,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;KAClD;IAED,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IACnC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Context } from './engine_setup';
|
|
2
|
+
import { Component } from '../engine-components/Component';
|
|
3
|
+
export declare function processNewScripts(context: Context): void;
|
|
4
|
+
export declare function processRemoveFromScene(script: Component): void;
|
|
5
|
+
export declare function processStart(context: Context): void;
|
|
6
|
+
export declare function addScriptToArrays(script: any, context: Context): void;
|
|
7
|
+
export declare function removeScriptFromContext(script: any, context: Context): void;
|
|
8
|
+
export declare function updateIsActive(): void;
|
|
9
|
+
export declare function updateActiveInHierarchyWithoutEventCall(go: THREE.Object3D): void;
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { Context } from './engine_setup';
|
|
2
|
+
import * as utils from "./engine_generic_utils";
|
|
3
|
+
import * as constants from "./engine_constants";
|
|
4
|
+
import { GameObject } from '../engine-components/Component';
|
|
5
|
+
import { getParam } from './engine_utils';
|
|
6
|
+
const debug = getParam("debugnewscripts");
|
|
7
|
+
// if some other script adds new scripts in onEnable or awake
|
|
8
|
+
// the original array should be cleared before processing it
|
|
9
|
+
// so we use this copy buffer
|
|
10
|
+
const new_scripts_buffer = [];
|
|
11
|
+
export function processNewScripts(context) {
|
|
12
|
+
if (context.new_scripts.length <= 0)
|
|
13
|
+
return;
|
|
14
|
+
if (debug)
|
|
15
|
+
console.log("Register new components", context.new_scripts.length, context.alias ? ("element: " + context.alias) : "");
|
|
16
|
+
// if(new_scripts_post_setup_callbacks.length > 0) console.log(new_scripts_post_setup_callbacks);
|
|
17
|
+
if (context.new_scripts_pre_setup_callbacks.length > 0) {
|
|
18
|
+
for (const cb of context.new_scripts_pre_setup_callbacks) {
|
|
19
|
+
if (!cb)
|
|
20
|
+
continue;
|
|
21
|
+
cb();
|
|
22
|
+
}
|
|
23
|
+
context.new_scripts_pre_setup_callbacks.length = 0;
|
|
24
|
+
}
|
|
25
|
+
// TODO: update all the code from above to use this logic
|
|
26
|
+
// basically code gen should add the scripts to new scripts
|
|
27
|
+
// and this code below should go into some util method
|
|
28
|
+
new_scripts_buffer.length = 0;
|
|
29
|
+
if (context.new_scripts.length > 0) {
|
|
30
|
+
new_scripts_buffer.push(...context.new_scripts);
|
|
31
|
+
}
|
|
32
|
+
context.new_scripts.length = 0;
|
|
33
|
+
// Check valid scripts and add all valid to the scripts array
|
|
34
|
+
for (let i = 0; i < new_scripts_buffer.length; i++) {
|
|
35
|
+
try {
|
|
36
|
+
const script = new_scripts_buffer[i];
|
|
37
|
+
if (script.destroyed)
|
|
38
|
+
continue;
|
|
39
|
+
if (!script.gameObject) {
|
|
40
|
+
console.error("MISSING GAMEOBJECT - will ignore", script);
|
|
41
|
+
new_scripts_buffer.splice(i, 1);
|
|
42
|
+
i--;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
script.context = context;
|
|
46
|
+
updateActiveInHierarchyWithoutEventCall(script.gameObject);
|
|
47
|
+
addScriptToArrays(script, context);
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
console.error(err);
|
|
51
|
+
removeScriptFromContext(new_scripts_buffer[i], context);
|
|
52
|
+
new_scripts_buffer.splice(i, 1);
|
|
53
|
+
i--;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Awake
|
|
57
|
+
for (let i = 0; i < new_scripts_buffer.length; i++) {
|
|
58
|
+
try {
|
|
59
|
+
const script = new_scripts_buffer[i];
|
|
60
|
+
if (script.destroyed) {
|
|
61
|
+
removeScriptFromContext(new_scripts_buffer[i], context);
|
|
62
|
+
new_scripts_buffer.splice(i, 1);
|
|
63
|
+
i--;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
// console.log(script, script.gameObject)
|
|
67
|
+
// TODO: we should not call awake on components with inactive gameobjects
|
|
68
|
+
if (script.__internalAwake !== undefined) {
|
|
69
|
+
if (!script.gameObject) {
|
|
70
|
+
console.error("MISSING GAMEOBJECT", script, script.gameObject);
|
|
71
|
+
}
|
|
72
|
+
updateActiveInHierarchyWithoutEventCall(script.gameObject);
|
|
73
|
+
if (script.activeAndEnabled)
|
|
74
|
+
utils.safeInvoke(script.__internalAwake.bind(script));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
console.error(err);
|
|
79
|
+
removeScriptFromContext(new_scripts_buffer[i], context);
|
|
80
|
+
new_scripts_buffer.splice(i, 1);
|
|
81
|
+
i--;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// OnEnable
|
|
85
|
+
for (let i = 0; i < new_scripts_buffer.length; i++) {
|
|
86
|
+
try {
|
|
87
|
+
const script = new_scripts_buffer[i];
|
|
88
|
+
if (script.destroyed)
|
|
89
|
+
continue;
|
|
90
|
+
// console.log(script, script.enabled, script.activeAndEnabled);
|
|
91
|
+
if (script.enabled === false)
|
|
92
|
+
continue;
|
|
93
|
+
updateActiveInHierarchyWithoutEventCall(script.gameObject);
|
|
94
|
+
if (script.activeAndEnabled === false)
|
|
95
|
+
continue;
|
|
96
|
+
if (script.__internalEnable !== undefined) {
|
|
97
|
+
script.enabled = true;
|
|
98
|
+
utils.safeInvoke(script.__internalEnable.bind(script));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
console.error(err);
|
|
103
|
+
removeScriptFromContext(new_scripts_buffer[i], context);
|
|
104
|
+
new_scripts_buffer.splice(i, 1);
|
|
105
|
+
i--;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Enqueue Start
|
|
109
|
+
for (let i = 0; i < new_scripts_buffer.length; i++) {
|
|
110
|
+
try {
|
|
111
|
+
const script = new_scripts_buffer[i];
|
|
112
|
+
if (script.destroyed)
|
|
113
|
+
continue;
|
|
114
|
+
if (!script.gameObject)
|
|
115
|
+
continue;
|
|
116
|
+
context.new_script_start.push(script);
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
console.error(err);
|
|
120
|
+
removeScriptFromContext(new_scripts_buffer[i], context);
|
|
121
|
+
new_scripts_buffer.splice(i, 1);
|
|
122
|
+
i--;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// for (const script of new_scripts_buffer) {
|
|
126
|
+
// if (script.destroyed) continue;
|
|
127
|
+
// context.scripts.push(script);
|
|
128
|
+
// }
|
|
129
|
+
new_scripts_buffer.length = 0;
|
|
130
|
+
// if(new_scripts_post_setup_callbacks.length > 0) console.log(new_scripts_post_setup_callbacks);
|
|
131
|
+
for (const cb of context.new_scripts_post_setup_callbacks) {
|
|
132
|
+
if (cb)
|
|
133
|
+
cb();
|
|
134
|
+
}
|
|
135
|
+
context.new_scripts_post_setup_callbacks.length = 0;
|
|
136
|
+
}
|
|
137
|
+
export function processRemoveFromScene(script) {
|
|
138
|
+
if (!script)
|
|
139
|
+
return;
|
|
140
|
+
script.__internalDisable();
|
|
141
|
+
removeScriptFromContext(script, script.context);
|
|
142
|
+
}
|
|
143
|
+
export function processStart(context) {
|
|
144
|
+
// Call start on scripts
|
|
145
|
+
for (let i = 0; i < context.new_script_start.length; i++) {
|
|
146
|
+
try {
|
|
147
|
+
const script = context.new_script_start[i];
|
|
148
|
+
if (script.destroyed)
|
|
149
|
+
continue;
|
|
150
|
+
if (script.activeAndEnabled === false)
|
|
151
|
+
continue;
|
|
152
|
+
// keep them in queue until script has started
|
|
153
|
+
// call awake if the script was inactive before
|
|
154
|
+
utils.safeInvoke(script.__internalAwake.bind(script));
|
|
155
|
+
utils.safeInvoke(script.__internalEnable.bind(script));
|
|
156
|
+
// now call start
|
|
157
|
+
utils.safeInvoke(script.__internalStart.bind(script));
|
|
158
|
+
context.new_script_start.splice(i, 1);
|
|
159
|
+
i--;
|
|
160
|
+
}
|
|
161
|
+
catch (err) {
|
|
162
|
+
console.error(err);
|
|
163
|
+
removeScriptFromContext(context.new_script_start[i], context);
|
|
164
|
+
context.new_script_start.splice(i, 1);
|
|
165
|
+
i--;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
export function addScriptToArrays(script, context) {
|
|
170
|
+
// TODO: not sure if this is ideal - maybe we should add a map if we have many scripts?
|
|
171
|
+
const index = context.scripts.indexOf(script);
|
|
172
|
+
if (index !== -1)
|
|
173
|
+
return;
|
|
174
|
+
context.scripts.push(script);
|
|
175
|
+
if (script.earlyUpdate)
|
|
176
|
+
context.scripts_earlyUpdate.push(script);
|
|
177
|
+
if (script.update)
|
|
178
|
+
context.scripts_update.push(script);
|
|
179
|
+
if (script.lateUpdate)
|
|
180
|
+
context.scripts_lateUpdate.push(script);
|
|
181
|
+
if (script.onBeforeRender)
|
|
182
|
+
context.scripts_onBeforeRender.push(script);
|
|
183
|
+
if (script.onAfterRender)
|
|
184
|
+
context.scripts_onAfterRender.push(script);
|
|
185
|
+
}
|
|
186
|
+
export function removeScriptFromContext(script, context) {
|
|
187
|
+
removeFromArray(script, context.new_scripts);
|
|
188
|
+
removeFromArray(script, context.new_script_start);
|
|
189
|
+
removeFromArray(script, context.scripts);
|
|
190
|
+
removeFromArray(script, context.scripts_earlyUpdate);
|
|
191
|
+
removeFromArray(script, context.scripts_update);
|
|
192
|
+
removeFromArray(script, context.scripts_lateUpdate);
|
|
193
|
+
removeFromArray(script, context.scripts_onBeforeRender);
|
|
194
|
+
removeFromArray(script, context.scripts_onAfterRender);
|
|
195
|
+
context.stopAllCoroutinesFrom(script);
|
|
196
|
+
}
|
|
197
|
+
function removeFromArray(script, array) {
|
|
198
|
+
const index = array.indexOf(script);
|
|
199
|
+
if (index >= 0)
|
|
200
|
+
array.splice(index, 1);
|
|
201
|
+
}
|
|
202
|
+
const previousActiveMap = {};
|
|
203
|
+
const previousActiveInHierarchyMap = {};
|
|
204
|
+
export function updateIsActive() {
|
|
205
|
+
if (!Context.Current) {
|
|
206
|
+
console.trace("Invalid call - no current context.");
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
updateIsActiveInHierarchyRecursiveRuntime(Context.Current.scene, Context.Current.scene.visible, true);
|
|
210
|
+
}
|
|
211
|
+
function updateIsActiveInHierarchyRecursiveRuntime(go, activeInHierarchy, allowEventCall) {
|
|
212
|
+
let activeStateChanged = false;
|
|
213
|
+
const active = GameObject.isActiveSelf(go);
|
|
214
|
+
// if (activeInHierarchy) {
|
|
215
|
+
// const prevActive = previousActiveMap[go.uuid];
|
|
216
|
+
// if (prevActive !== undefined) {
|
|
217
|
+
// if (prevActive !== active) {
|
|
218
|
+
// activeStateChanged = true;
|
|
219
|
+
// if (allowEventCall) {
|
|
220
|
+
// perComponent(go, comp => {
|
|
221
|
+
// if (active) {
|
|
222
|
+
// utils.safeInvoke(comp.__internalAwake.bind(comp));
|
|
223
|
+
// comp.onEnable();
|
|
224
|
+
// }
|
|
225
|
+
// else comp.onDisable();
|
|
226
|
+
// });
|
|
227
|
+
// }
|
|
228
|
+
// }
|
|
229
|
+
// }
|
|
230
|
+
// }
|
|
231
|
+
previousActiveMap[go.uuid] = active;
|
|
232
|
+
if (activeInHierarchy)
|
|
233
|
+
activeInHierarchy = GameObject.isActiveSelf(go);
|
|
234
|
+
go[constants.activeInHierarchyFieldName] = activeInHierarchy;
|
|
235
|
+
// only raise events here if we didnt call enable etc already
|
|
236
|
+
if (!activeStateChanged) {
|
|
237
|
+
const prevActiveInHierarchy = previousActiveInHierarchyMap[go.uuid];
|
|
238
|
+
if (prevActiveInHierarchy !== undefined) {
|
|
239
|
+
if (prevActiveInHierarchy !== activeInHierarchy) {
|
|
240
|
+
if (allowEventCall) {
|
|
241
|
+
perComponent(go, comp => {
|
|
242
|
+
if (activeInHierarchy) {
|
|
243
|
+
utils.safeInvoke(comp.__internalAwake.bind(comp));
|
|
244
|
+
comp.onEnable();
|
|
245
|
+
}
|
|
246
|
+
else
|
|
247
|
+
comp.onDisable();
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
previousActiveInHierarchyMap[go.uuid] = activeInHierarchy;
|
|
254
|
+
if (go.children) {
|
|
255
|
+
for (const ch of go.children) {
|
|
256
|
+
updateIsActiveInHierarchyRecursiveRuntime(ch, activeInHierarchy, allowEventCall);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
export function updateActiveInHierarchyWithoutEventCall(go) {
|
|
261
|
+
let activeInHierarchy = true;
|
|
262
|
+
let current = go;
|
|
263
|
+
let foundScene = false;
|
|
264
|
+
while (current) {
|
|
265
|
+
if (!current)
|
|
266
|
+
break;
|
|
267
|
+
if (current.type === "Scene")
|
|
268
|
+
foundScene = true;
|
|
269
|
+
if (!GameObject.isActiveSelf(current)) {
|
|
270
|
+
activeInHierarchy = false;
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
current = current.parent;
|
|
274
|
+
}
|
|
275
|
+
if (!go) {
|
|
276
|
+
console.error("GO is null");
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
go[constants.activeInHierarchyFieldName] = activeInHierarchy && foundScene;
|
|
280
|
+
}
|
|
281
|
+
function perComponent(go, evt) {
|
|
282
|
+
if (go.userData?.components) {
|
|
283
|
+
for (const comp of go.userData.components) {
|
|
284
|
+
evt(comp);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=engine_mainloop_utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine_mainloop_utils.js","sourceRoot":"","sources":["../../../engine/engine_mainloop_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,wBAAwB,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAwB,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,KAAK,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AAE1C,8DAA8D;AAC9D,4DAA4D;AAC5D,6BAA6B;AAC7B,MAAM,kBAAkB,GAAU,EAAE,CAAC;AAErC,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAC9C,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO;IAC5C,IAAI,KAAK;QACL,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAE3H,iGAAiG;IACjG,IAAI,OAAO,CAAC,+BAA+B,CAAC,MAAM,GAAG,CAAC,EAAE;QACpD,KAAK,MAAM,EAAE,IAAI,OAAO,CAAC,+BAA+B,EAAE;YACtD,IAAI,CAAC,E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AK,CAAC;IAChC,OAAO,OAAO,EAAE;QACZ,IAAI,CAAC,OAAO;YAAE,MAAM;QACpB,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;YAAE,UAAU,GAAG,IAAI,CAAC;QAChD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;YACnC,iBAAiB,GAAG,KAAK,CAAC;YAC1B,MAAM;SACT;QACD,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;KAC5B;IACD,IAAI,CAAC,EAAE,EAAE;QACL,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5B,OAAO;KACV;IACD,EAAE,CAAC,SAAS,CAAC,0BAA0B,CAAC,GAAG,iBAAiB,IAAI,UAAU,CAAC;AAC/E,CAAC;AAED,SAAS,YAAY,CAAC,EAAkB,EAAE,GAA8B;IACpE,IAAI,EAAE,CAAC,QAAQ,EAAE,UAAU,EAAE;QACzB,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE;YACvC,GAAG,CAAC,IAAI,CAAC,CAAC;SACb;KACJ;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare class MathHelper {
|
|
2
|
+
random(): number;
|
|
3
|
+
clamp(value: any, min: any, max: any): any;
|
|
4
|
+
clamp01(value: any): any;
|
|
5
|
+
lerp(value1: any, value2: any, amount: any): any;
|
|
6
|
+
moveTowards(value1: any, value2: any, amount: any): any;
|
|
7
|
+
toDegrees(radians: any): number;
|
|
8
|
+
toRadians(degrees: any): number;
|
|
9
|
+
}
|
|
10
|
+
declare const Mathf: MathHelper;
|
|
11
|
+
export { Mathf };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
class MathHelper {
|
|
2
|
+
random() {
|
|
3
|
+
return Math.random();
|
|
4
|
+
}
|
|
5
|
+
clamp(value, min, max) {
|
|
6
|
+
if (value < min) {
|
|
7
|
+
return min;
|
|
8
|
+
}
|
|
9
|
+
else if (value > max) {
|
|
10
|
+
return max;
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
clamp01(value) {
|
|
15
|
+
return this.clamp(value, 0, 1);
|
|
16
|
+
}
|
|
17
|
+
lerp(value1, value2, amount) {
|
|
18
|
+
amount = amount < 0 ? 0 : amount;
|
|
19
|
+
amount = amount > 1 ? 1 : amount;
|
|
20
|
+
return value1 + (value2 - value1) * amount;
|
|
21
|
+
}
|
|
22
|
+
moveTowards(value1, value2, amount) {
|
|
23
|
+
value1 += amount;
|
|
24
|
+
if (amount < 0 && value1 < value2)
|
|
25
|
+
value1 = value2;
|
|
26
|
+
else if (amount > 0 && value1 > value2)
|
|
27
|
+
value1 = value2;
|
|
28
|
+
return value1;
|
|
29
|
+
}
|
|
30
|
+
toDegrees(radians) {
|
|
31
|
+
return radians * 180 / Math.PI;
|
|
32
|
+
}
|
|
33
|
+
toRadians(degrees) {
|
|
34
|
+
return degrees * Math.PI / 180;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
;
|
|
38
|
+
const Mathf = new MathHelper();
|
|
39
|
+
export { Mathf };
|
|
40
|
+
//# sourceMappingURL=engine_math.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine_math.js","sourceRoot":"","sources":["../../../engine/engine_math.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU;IACZ,MAAM;QACF,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;IACD,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG;QAEjB,IAAI,KAAK,GAAG,GAAG,EAAE;YACb,OAAO,GAAG,CAAC;SACd;aACI,IAAI,KAAK,GAAG,GAAG,EAAE;YAClB,OAAO,GAAG,CAAC;SACd;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,CAAC,KAAK;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACnC,CAAC;IACD,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM;QACvB,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACjC,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACjC,OAAO,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;IAC/C,CAAC;IACD,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM;QAC9B,MAAM,IAAI,MAAM,CAAC;QACjB,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,MAAM;YAAE,MAAM,GAAG,MAAM,CAAC;aAC9C,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,MAAM;YAAE,MAAM,GAAG,MAAM,CAAC;QACxD,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,SAAS,CAAC,OAAO;QACb,OAAO,OAAO,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;IACnC,CAAC;IACD,SAAS,CAAC,OAAO;QACb,OAAO,OAAO,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;IACnC,CAAC;CACJ;AAAA,CAAC;AAEF,MAAM,KAAK,GAAG,IAAI,UAAU,EAAE,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Context } from './engine_setup';
|
|
2
|
+
import * as flatbuffers from 'flatbuffers';
|
|
3
|
+
import { PeerNetworking } from './engine_networking_peer';
|
|
4
|
+
export declare const debugNet: boolean;
|
|
5
|
+
export declare const debugOwner: boolean;
|
|
6
|
+
export declare interface IModel {
|
|
7
|
+
guid: string;
|
|
8
|
+
dontSave?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare interface IConnectionData {
|
|
11
|
+
id: string;
|
|
12
|
+
}
|
|
13
|
+
export declare enum ConnectionEvents {
|
|
14
|
+
ConnectionInfo = "connection-start-info"
|
|
15
|
+
}
|
|
16
|
+
export declare enum RoomEvents {
|
|
17
|
+
Join = "join-room",
|
|
18
|
+
Leave = "leave-room",
|
|
19
|
+
JoinedRoom = "joined-room",
|
|
20
|
+
LeftRoom = "left-room",
|
|
21
|
+
UserJoinedRoom = "user-joined-room",
|
|
22
|
+
UserLeftRoom = "user-left-room"
|
|
23
|
+
}
|
|
24
|
+
export declare class JoinedRoomResponse {
|
|
25
|
+
room: string;
|
|
26
|
+
viewId: string;
|
|
27
|
+
allowEditing: boolean;
|
|
28
|
+
inRoom: string[];
|
|
29
|
+
}
|
|
30
|
+
export declare class LeftRoomResponse {
|
|
31
|
+
room: string;
|
|
32
|
+
}
|
|
33
|
+
export declare class UserJoinedOrLeftRoomModel {
|
|
34
|
+
userId: string;
|
|
35
|
+
}
|
|
36
|
+
export declare enum OwnershipEvent {
|
|
37
|
+
RequestHasOwner = "request-has-owner",
|
|
38
|
+
ResponseHasOwner = "response-has-owner",
|
|
39
|
+
RequestIsOwner = "request-is-owner",
|
|
40
|
+
ResponseIsOwner = "response-is-owner",
|
|
41
|
+
RequestOwnership = "request-ownership",
|
|
42
|
+
GainedOwnership = "gained-ownership",
|
|
43
|
+
RemoveOwnership = "remove-ownership",
|
|
44
|
+
LostOwnership = "lost-ownership",
|
|
45
|
+
GainedOwnershipBroadcast = "gained-ownership-broadcast",
|
|
46
|
+
LostOwnershipBroadcast = "lost-ownership-broadcast"
|
|
47
|
+
}
|
|
48
|
+
export declare class OwnershipModel {
|
|
49
|
+
guid: string;
|
|
50
|
+
private connection;
|
|
51
|
+
get hasOwnership(): boolean;
|
|
52
|
+
get isOwned(): boolean | undefined;
|
|
53
|
+
get isConnected(): boolean;
|
|
54
|
+
private _hasOwnership;
|
|
55
|
+
private _isOwned;
|
|
56
|
+
private _gainSubscription;
|
|
57
|
+
private _lostSubscription;
|
|
58
|
+
private _hasOwnerResponse;
|
|
59
|
+
constructor(connection: NetworkConnection, guid: string);
|
|
60
|
+
private _isWaitingForOwnershipResponseCallback;
|
|
61
|
+
updateIsOwned(): void;
|
|
62
|
+
private onHasOwnerResponse;
|
|
63
|
+
requestOwnershipIfNotOwned(): OwnershipModel;
|
|
64
|
+
private waitForHasOwnershipRequestResponse;
|
|
65
|
+
requestOwnershipAsync(): Promise<OwnershipModel>;
|
|
66
|
+
requestOwnership(): OwnershipModel;
|
|
67
|
+
freeOwnership(): OwnershipModel;
|
|
68
|
+
destroy(): void;
|
|
69
|
+
private onGainedOwnership;
|
|
70
|
+
private onLostOwnership;
|
|
71
|
+
}
|
|
72
|
+
export declare enum SendQueue {
|
|
73
|
+
OnConnection = 0,
|
|
74
|
+
OnRoomJoin = 1,
|
|
75
|
+
Queued = 2,
|
|
76
|
+
Immediate = 3
|
|
77
|
+
}
|
|
78
|
+
export declare type BinaryCallback = {
|
|
79
|
+
(data: any | flatbuffers.ByteBuffer): void;
|
|
80
|
+
};
|
|
81
|
+
export declare class NetworkConnection {
|
|
82
|
+
private context;
|
|
83
|
+
private _peer;
|
|
84
|
+
constructor(context: Context);
|
|
85
|
+
get peer(): PeerNetworking;
|
|
86
|
+
tryGetState(guid: string): IModel | null;
|
|
87
|
+
get connectionId(): string | null;
|
|
88
|
+
get isDebugEnabled(): boolean;
|
|
89
|
+
get isConnected(): boolean;
|
|
90
|
+
get currentRoomName(): string | null;
|
|
91
|
+
get allowEditing(): boolean;
|
|
92
|
+
get currentRoomViewId(): string | null;
|
|
93
|
+
get isInRoom(): boolean;
|
|
94
|
+
get currentLatency(): number;
|
|
95
|
+
userIsInRoom(id: string): boolean;
|
|
96
|
+
private _usersInRoomCopy;
|
|
97
|
+
usersInRoom(target?: string[] | null): string[];
|
|
98
|
+
joinRoom(room: string, viewOnly?: boolean): void;
|
|
99
|
+
leaveRoom(room?: string | null): void;
|
|
100
|
+
send(key: string | OwnershipEvent, data?: IModel | object | boolean | null | string | number, queue?: SendQueue): void;
|
|
101
|
+
sendDeleteRemoteState(guid: string): void;
|
|
102
|
+
sendBinary(bin: Uint8Array): void;
|
|
103
|
+
private _defaultMessagesBuffer;
|
|
104
|
+
private _defaultMessagesBufferArray;
|
|
105
|
+
sendBufferedMessagesNow(): void;
|
|
106
|
+
beginListen(key: string | OwnershipEvent, callback: Function): Function;
|
|
107
|
+
stopListening(key: string | OwnershipEvent, callback: Function | null): void;
|
|
108
|
+
beginListenBinrary(identifier: string, callback: BinaryCallback): BinaryCallback;
|
|
109
|
+
stopListenBinary(identifier: string, callback: any): void;
|
|
110
|
+
connect(): void;
|
|
111
|
+
private _listeners;
|
|
112
|
+
private _listenersBinary;
|
|
113
|
+
private connected;
|
|
114
|
+
private channelId;
|
|
115
|
+
private _connectionId;
|
|
116
|
+
private _isConnectingToWebsocket;
|
|
117
|
+
private _ws;
|
|
118
|
+
private _waitingForSocket;
|
|
119
|
+
private _isInRoom;
|
|
120
|
+
private _currentRoomName;
|
|
121
|
+
private _currentRoomViewId;
|
|
122
|
+
private _currentRoomAllowEditing;
|
|
123
|
+
private _currentInRoom;
|
|
124
|
+
private _state;
|
|
125
|
+
private _currentDelay;
|
|
126
|
+
private connectWebsocket;
|
|
127
|
+
private onMessage;
|
|
128
|
+
private handleIncomingBinaryMessage;
|
|
129
|
+
private handleIncomingStringMessage;
|
|
130
|
+
private toMessage;
|
|
131
|
+
private sendWithWebsocket;
|
|
132
|
+
private onSendQueued;
|
|
133
|
+
}
|