@needle-tools/engine 4.13.0 → 4.13.1-next.6cb1b73
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 +8 -1
- package/README.md +37 -0
- package/components.needle.json +1 -1
- package/custom-elements.json +138 -4
- package/dist/gltf-progressive-BTd714P0.min.js +9 -0
- package/dist/gltf-progressive-CrHduHPm.umd.cjs +9 -0
- package/dist/{gltf-progressive-eiJCrjLb.js → gltf-progressive-CsyU_5lc.js} +364 -287
- package/dist/{needle-engine.bundle-CxaKFQVS.min.js → needle-engine.bundle-DRSn34Va.min.js} +109 -109
- package/dist/{needle-engine.bundle-J4k4znv8.umd.cjs → needle-engine.bundle-qTjHpin6.umd.cjs} +110 -110
- package/dist/{needle-engine.bundle-Dl3TFYyv.js → needle-engine.bundle-wB3o8RB6.js} +2655 -2130
- package/dist/needle-engine.d.ts +4202 -423
- package/dist/needle-engine.js +3 -3
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/engine_context.d.ts +16 -0
- package/lib/engine/engine_context.js +28 -2
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_gameobject.d.ts +72 -0
- package/lib/engine/engine_gameobject.js +38 -0
- package/lib/engine/engine_gameobject.js.map +1 -1
- package/lib/engine/engine_input.d.ts +80 -4
- package/lib/engine/engine_input.js +78 -2
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_math.d.ts +81 -2
- package/lib/engine/engine_math.js +68 -2
- package/lib/engine/engine_math.js.map +1 -1
- package/lib/engine/engine_networking.d.ts +181 -14
- package/lib/engine/engine_networking.js +181 -14
- package/lib/engine/engine_networking.js.map +1 -1
- package/lib/engine/engine_networking_auto.d.ts +35 -8
- package/lib/engine/engine_networking_auto.js +35 -8
- package/lib/engine/engine_networking_auto.js.map +1 -1
- package/lib/engine/engine_physics.d.ts +37 -1
- package/lib/engine/engine_physics.js +37 -1
- package/lib/engine/engine_physics.js.map +1 -1
- package/lib/engine/engine_physics_rapier.d.ts +78 -0
- package/lib/engine/engine_physics_rapier.js +78 -0
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine/engine_serialization_decorator.d.ts +28 -2
- package/lib/engine/engine_serialization_decorator.js +28 -2
- package/lib/engine/engine_serialization_decorator.js.map +1 -1
- package/lib/engine/engine_time.d.ts +23 -3
- package/lib/engine/engine_time.js +23 -3
- package/lib/engine/engine_time.js.map +1 -1
- package/lib/engine/engine_util_decorator.d.ts +31 -1
- package/lib/engine/engine_util_decorator.js +31 -1
- package/lib/engine/engine_util_decorator.js.map +1 -1
- package/lib/engine/engine_utils.d.ts +22 -5
- package/lib/engine/engine_utils.js +22 -5
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/engine_utils_screenshot.d.ts +171 -14
- package/lib/engine/engine_utils_screenshot.js +65 -0
- package/lib/engine/engine_utils_screenshot.js.map +1 -1
- package/lib/engine/engine_utils_screenshot.xr.d.ts +1 -1
- package/lib/engine/engine_utils_screenshot.xr.js +1 -1
- package/lib/engine/extensions/NEEDLE_materialx.d.ts +2 -2
- package/lib/engine/extensions/NEEDLE_materialx.js +2 -2
- package/lib/engine/extensions/NEEDLE_materialx.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_techniques_webgl.js +3 -0
- package/lib/engine/extensions/NEEDLE_techniques_webgl.js.map +1 -1
- package/lib/engine/extensions/index.d.ts +1 -1
- package/lib/engine/extensions/index.js +1 -1
- package/lib/engine/extensions/index.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.d.ts +5 -0
- package/lib/engine/xr/NeedleXRSession.js +5 -0
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine-components/AlignmentConstraint.d.ts +23 -3
- package/lib/engine-components/AlignmentConstraint.js +23 -3
- package/lib/engine-components/AlignmentConstraint.js.map +1 -1
- package/lib/engine-components/Animation.d.ts +42 -0
- package/lib/engine-components/Animation.js +36 -0
- package/lib/engine-components/Animation.js.map +1 -1
- package/lib/engine-components/Animator.d.ts +37 -4
- package/lib/engine-components/Animator.js +37 -4
- package/lib/engine-components/Animator.js.map +1 -1
- package/lib/engine-components/AudioListener.d.ts +1 -1
- package/lib/engine-components/AudioListener.js +1 -1
- package/lib/engine-components/AudioSource.d.ts +32 -10
- package/lib/engine-components/AudioSource.js +32 -10
- package/lib/engine-components/AudioSource.js.map +1 -1
- package/lib/engine-components/AxesHelper.d.ts +22 -3
- package/lib/engine-components/AxesHelper.js +22 -3
- package/lib/engine-components/AxesHelper.js.map +1 -1
- package/lib/engine-components/BasicIKConstraint.d.ts +27 -4
- package/lib/engine-components/BasicIKConstraint.js +27 -4
- package/lib/engine-components/BasicIKConstraint.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +32 -2
- package/lib/engine-components/Camera.js +32 -2
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/CharacterController.d.ts +68 -4
- package/lib/engine-components/CharacterController.js +68 -4
- package/lib/engine-components/CharacterController.js.map +1 -1
- package/lib/engine-components/Collider.d.ts +69 -12
- package/lib/engine-components/Collider.js +69 -12
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/ContactShadows.d.ts +28 -6
- package/lib/engine-components/ContactShadows.js +33 -8
- package/lib/engine-components/ContactShadows.js.map +1 -1
- package/lib/engine-components/DeleteBox.d.ts +43 -2
- package/lib/engine-components/DeleteBox.js +43 -2
- package/lib/engine-components/DeleteBox.js.map +1 -1
- package/lib/engine-components/DeviceFlag.d.ts +21 -2
- package/lib/engine-components/DeviceFlag.js +21 -2
- package/lib/engine-components/DeviceFlag.js.map +1 -1
- package/lib/engine-components/DragControls.d.ts +32 -2
- package/lib/engine-components/DragControls.js +32 -2
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/DropListener.d.ts +33 -21
- package/lib/engine-components/DropListener.js +33 -21
- package/lib/engine-components/DropListener.js.map +1 -1
- package/lib/engine-components/Duplicatable.d.ts +36 -5
- package/lib/engine-components/Duplicatable.js +36 -5
- package/lib/engine-components/Duplicatable.js.map +1 -1
- package/lib/engine-components/EventList.d.ts +38 -10
- package/lib/engine-components/EventList.js +40 -12
- package/lib/engine-components/EventList.js.map +1 -1
- package/lib/engine-components/EventTrigger.d.ts +1 -1
- package/lib/engine-components/EventTrigger.js +1 -1
- package/lib/engine-components/Fog.d.ts +23 -1
- package/lib/engine-components/Fog.js +23 -1
- package/lib/engine-components/Fog.js.map +1 -1
- package/lib/engine-components/GridHelper.d.ts +18 -2
- package/lib/engine-components/GridHelper.js +18 -2
- package/lib/engine-components/GridHelper.js.map +1 -1
- package/lib/engine-components/GroundProjection.d.ts +24 -2
- package/lib/engine-components/GroundProjection.js +24 -2
- package/lib/engine-components/GroundProjection.js.map +1 -1
- package/lib/engine-components/Interactable.d.ts +17 -2
- package/lib/engine-components/Interactable.js +17 -2
- package/lib/engine-components/Interactable.js.map +1 -1
- package/lib/engine-components/Joints.d.ts +50 -7
- package/lib/engine-components/Joints.js +50 -7
- package/lib/engine-components/Joints.js.map +1 -1
- package/lib/engine-components/LODGroup.d.ts +36 -14
- package/lib/engine-components/LODGroup.js +43 -11
- package/lib/engine-components/LODGroup.js.map +1 -1
- package/lib/engine-components/Light.d.ts +30 -5
- package/lib/engine-components/Light.js +30 -5
- package/lib/engine-components/Light.js.map +1 -1
- package/lib/engine-components/LookAtConstraint.d.ts +22 -7
- package/lib/engine-components/LookAtConstraint.js +22 -7
- package/lib/engine-components/LookAtConstraint.js.map +1 -1
- package/lib/engine-components/NeedleMenu.d.ts +27 -5
- package/lib/engine-components/NeedleMenu.js +27 -5
- package/lib/engine-components/NeedleMenu.js.map +1 -1
- package/lib/engine-components/NestedGltf.d.ts +39 -4
- package/lib/engine-components/NestedGltf.js +42 -4
- package/lib/engine-components/NestedGltf.js.map +1 -1
- package/lib/engine-components/OffsetConstraint.d.ts +27 -3
- package/lib/engine-components/OffsetConstraint.js +27 -3
- package/lib/engine-components/OffsetConstraint.js.map +1 -1
- package/lib/engine-components/OrbitControls.d.ts +41 -3
- package/lib/engine-components/OrbitControls.js +41 -3
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/PlayerColor.d.ts +1 -1
- package/lib/engine-components/PlayerColor.js +1 -1
- package/lib/engine-components/ReflectionProbe.d.ts +17 -2
- package/lib/engine-components/ReflectionProbe.js +17 -3
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/Renderer.d.ts +35 -0
- package/lib/engine-components/Renderer.js +36 -2
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/RigidBody.d.ts +57 -5
- package/lib/engine-components/RigidBody.js +57 -5
- package/lib/engine-components/RigidBody.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.d.ts +11 -0
- package/lib/engine-components/SceneSwitcher.js +11 -0
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/ScreenCapture.d.ts +39 -6
- package/lib/engine-components/ScreenCapture.js +39 -6
- package/lib/engine-components/ScreenCapture.js.map +1 -1
- package/lib/engine-components/SeeThrough.d.ts +70 -5
- package/lib/engine-components/SeeThrough.js +70 -5
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/ShadowCatcher.d.ts +56 -4
- package/lib/engine-components/ShadowCatcher.js +56 -4
- package/lib/engine-components/ShadowCatcher.js.map +1 -1
- package/lib/engine-components/Skybox.d.ts +43 -7
- package/lib/engine-components/Skybox.js +43 -7
- package/lib/engine-components/Skybox.js.map +1 -1
- package/lib/engine-components/SmoothFollow.d.ts +66 -7
- package/lib/engine-components/SmoothFollow.js +66 -7
- package/lib/engine-components/SmoothFollow.js.map +1 -1
- package/lib/engine-components/SpatialTrigger.d.ts +48 -1
- package/lib/engine-components/SpatialTrigger.js +48 -1
- package/lib/engine-components/SpatialTrigger.js.map +1 -1
- package/lib/engine-components/SpectatorCamera.d.ts +21 -3
- package/lib/engine-components/SpectatorCamera.js +21 -3
- package/lib/engine-components/SpectatorCamera.js.map +1 -1
- package/lib/engine-components/SyncedRoom.d.ts +7 -1
- package/lib/engine-components/SyncedRoom.js +7 -1
- package/lib/engine-components/SyncedRoom.js.map +1 -1
- package/lib/engine-components/SyncedTransform.d.ts +55 -6
- package/lib/engine-components/SyncedTransform.js +55 -6
- package/lib/engine-components/SyncedTransform.js.map +1 -1
- package/lib/engine-components/TransformGizmo.d.ts +30 -3
- package/lib/engine-components/TransformGizmo.js +30 -3
- package/lib/engine-components/TransformGizmo.js.map +1 -1
- package/lib/engine-components/VideoPlayer.d.ts +33 -6
- package/lib/engine-components/VideoPlayer.js +51 -6
- package/lib/engine-components/VideoPlayer.js.map +1 -1
- package/lib/engine-components/Voip.d.ts +33 -2
- package/lib/engine-components/Voip.js +33 -2
- package/lib/engine-components/Voip.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.d.ts +47 -13
- package/lib/engine-components/export/usdz/USDZExporter.js +47 -13
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/particlesystem/ParticleSystem.d.ts +82 -3
- package/lib/engine-components/particlesystem/ParticleSystem.js +82 -3
- package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Antialiasing.d.ts +1 -0
- package/lib/engine-components/postprocessing/Effects/Antialiasing.js +1 -0
- package/lib/engine-components/postprocessing/Effects/Antialiasing.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/BloomEffect.js +1 -1
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js +1 -1
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +1 -1
- package/lib/engine-components/postprocessing/Effects/DepthOfField.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/DepthOfField.js +1 -1
- package/lib/engine-components/postprocessing/Effects/EffectWrapper.d.ts +1 -0
- package/lib/engine-components/postprocessing/Effects/EffectWrapper.js +1 -0
- package/lib/engine-components/postprocessing/Effects/EffectWrapper.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Pixelation.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/Pixelation.js +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js +1 -1
- package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/Sharpening.js +1 -1
- package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js +1 -1
- package/lib/engine-components/postprocessing/Effects/Vignette.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/Vignette.js +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +1 -1
- package/lib/engine-components/postprocessing/Volume.d.ts +1 -1
- package/lib/engine-components/postprocessing/Volume.js +1 -1
- package/lib/engine-components/splines/Spline.d.ts +409 -12
- package/lib/engine-components/splines/Spline.js +409 -12
- package/lib/engine-components/splines/Spline.js.map +1 -1
- package/lib/engine-components/splines/SplineUtils.d.ts +1 -0
- package/lib/engine-components/splines/SplineUtils.js +1 -0
- package/lib/engine-components/splines/SplineUtils.js.map +1 -1
- package/lib/engine-components/splines/SplineWalker.d.ts +3 -1
- package/lib/engine-components/splines/SplineWalker.js +3 -1
- package/lib/engine-components/splines/SplineWalker.js.map +1 -1
- package/lib/engine-components/timeline/PlayableDirector.d.ts +103 -14
- package/lib/engine-components/timeline/PlayableDirector.js +95 -25
- package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
- package/lib/engine-components/timeline/TimelineModels.d.ts +14 -0
- package/lib/engine-components/timeline/TimelineModels.js +4 -0
- package/lib/engine-components/timeline/TimelineModels.js.map +1 -1
- package/lib/engine-components/ui/Button.d.ts +29 -3
- package/lib/engine-components/ui/Button.js +29 -3
- package/lib/engine-components/ui/Button.js.map +1 -1
- package/lib/engine-components/ui/Canvas.d.ts +29 -4
- package/lib/engine-components/ui/Canvas.js +29 -4
- package/lib/engine-components/ui/Canvas.js.map +1 -1
- package/lib/engine-components/ui/CanvasGroup.d.ts +1 -1
- package/lib/engine-components/ui/CanvasGroup.js +1 -1
- package/lib/engine-components/ui/EventSystem.d.ts +1 -1
- package/lib/engine-components/ui/EventSystem.js +1 -1
- package/lib/engine-components/ui/Graphic.d.ts +1 -0
- package/lib/engine-components/ui/Graphic.js +1 -0
- package/lib/engine-components/ui/Graphic.js.map +1 -1
- package/lib/engine-components/ui/Image.d.ts +22 -3
- package/lib/engine-components/ui/Image.js +22 -3
- package/lib/engine-components/ui/Image.js.map +1 -1
- package/lib/engine-components/ui/InputField.d.ts +1 -1
- package/lib/engine-components/ui/InputField.js +1 -1
- package/lib/engine-components/ui/Layout.d.ts +3 -0
- package/lib/engine-components/ui/Layout.js +3 -0
- package/lib/engine-components/ui/Layout.js.map +1 -1
- package/lib/engine-components/ui/Outline.d.ts +1 -1
- package/lib/engine-components/ui/Outline.js +1 -1
- package/lib/engine-components/ui/PointerEvents.d.ts +1 -1
- package/lib/engine-components/ui/PointerEvents.js +1 -1
- package/lib/engine-components/ui/Raycaster.d.ts +55 -6
- package/lib/engine-components/ui/Raycaster.js +55 -6
- package/lib/engine-components/ui/Raycaster.js.map +1 -1
- package/lib/engine-components/ui/RectTransform.d.ts +1 -1
- package/lib/engine-components/ui/RectTransform.js +1 -1
- package/lib/engine-components/ui/SpatialHtml.d.ts +1 -1
- package/lib/engine-components/ui/SpatialHtml.js +1 -1
- package/lib/engine-components/ui/Text.d.ts +23 -1
- package/lib/engine-components/ui/Text.js +23 -1
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/lib/engine-components/utils/LookAt.d.ts +1 -1
- package/lib/engine-components/utils/LookAt.js +1 -1
- package/lib/engine-components/utils/OpenURL.d.ts +2 -1
- package/lib/engine-components/utils/OpenURL.js +2 -1
- package/lib/engine-components/utils/OpenURL.js.map +1 -1
- package/lib/engine-components/web/Clickthrough.d.ts +116 -7
- package/lib/engine-components/web/Clickthrough.js +116 -7
- package/lib/engine-components/web/Clickthrough.js.map +1 -1
- package/lib/engine-components/web/CursorFollow.d.ts +172 -7
- package/lib/engine-components/web/CursorFollow.js +172 -7
- package/lib/engine-components/web/CursorFollow.js.map +1 -1
- package/lib/engine-components/web/HoverAnimation.d.ts +140 -11
- package/lib/engine-components/web/HoverAnimation.js +140 -11
- package/lib/engine-components/web/HoverAnimation.js.map +1 -1
- package/lib/engine-components/web/ScrollFollow.d.ts +5 -1
- package/lib/engine-components/web/ScrollFollow.js +5 -1
- package/lib/engine-components/web/ScrollFollow.js.map +1 -1
- package/lib/engine-components/web/ViewBox.d.ts +116 -16
- package/lib/engine-components/web/ViewBox.js +110 -16
- package/lib/engine-components/web/ViewBox.js.map +1 -1
- package/lib/engine-components/webxr/TeleportTarget.d.ts +21 -2
- package/lib/engine-components/webxr/TeleportTarget.js +21 -2
- package/lib/engine-components/webxr/TeleportTarget.js.map +1 -1
- package/lib/engine-components/webxr/WebARCameraBackground.d.ts +9 -0
- package/lib/engine-components/webxr/WebARCameraBackground.js +9 -0
- package/lib/engine-components/webxr/WebARCameraBackground.js.map +1 -1
- package/lib/engine-components/webxr/WebXR.d.ts +11 -2
- package/lib/engine-components/webxr/WebXR.js +11 -2
- package/lib/engine-components/webxr/WebXR.js.map +1 -1
- package/lib/engine-components/webxr/WebXRAvatar.d.ts +39 -2
- package/lib/engine-components/webxr/WebXRAvatar.js +35 -3
- package/lib/engine-components/webxr/WebXRAvatar.js.map +1 -1
- package/lib/engine-components/webxr/WebXRImageTracking.d.ts +266 -30
- package/lib/engine-components/webxr/WebXRImageTracking.js +266 -30
- package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
- package/lib/engine-components/webxr/WebXRPlaneTracking.d.ts +1 -1
- package/lib/engine-components/webxr/WebXRPlaneTracking.js +1 -1
- package/lib/engine-components/webxr/XRFlag.d.ts +29 -2
- package/lib/engine-components/webxr/XRFlag.js +29 -2
- package/lib/engine-components/webxr/XRFlag.js.map +1 -1
- package/package.json +3 -3
- package/plugins/vite/custom-element-data.js +128 -19
- package/src/engine/engine_context.ts +33 -3
- package/src/engine/engine_gameobject.ts +73 -0
- package/src/engine/engine_input.ts +83 -7
- package/src/engine/engine_math.ts +81 -2
- package/src/engine/engine_networking.ts +186 -17
- package/src/engine/engine_networking_auto.ts +36 -9
- package/src/engine/engine_physics.ts +41 -1
- package/src/engine/engine_physics_rapier.ts +81 -0
- package/src/engine/engine_serialization_decorator.ts +28 -2
- package/src/engine/engine_time.ts +23 -3
- package/src/engine/engine_util_decorator.ts +31 -1
- package/src/engine/engine_utils.ts +22 -5
- package/src/engine/engine_utils_screenshot.ts +241 -17
- package/src/engine/engine_utils_screenshot.xr.ts +1 -1
- package/src/engine/extensions/NEEDLE_materialx.ts +5 -4
- package/src/engine/extensions/NEEDLE_techniques_webgl.ts +3 -0
- package/src/engine/extensions/index.ts +2 -2
- package/src/engine/xr/NeedleXRSession.ts +5 -0
- package/src/engine-components/AlignmentConstraint.ts +24 -4
- package/src/engine-components/Animation.ts +44 -2
- package/src/engine-components/Animator.ts +40 -7
- package/src/engine-components/AudioListener.ts +1 -1
- package/src/engine-components/AudioSource.ts +37 -15
- package/src/engine-components/AxesHelper.ts +23 -4
- package/src/engine-components/BasicIKConstraint.ts +28 -5
- package/src/engine-components/Camera.ts +33 -3
- package/src/engine-components/CharacterController.ts +74 -7
- package/src/engine-components/Collider.ts +78 -21
- package/src/engine-components/ContactShadows.ts +41 -11
- package/src/engine-components/DeleteBox.ts +43 -2
- package/src/engine-components/DeviceFlag.ts +22 -3
- package/src/engine-components/DragControls.ts +32 -2
- package/src/engine-components/DropListener.ts +41 -29
- package/src/engine-components/Duplicatable.ts +37 -6
- package/src/engine-components/EventList.ts +43 -15
- package/src/engine-components/EventTrigger.ts +1 -1
- package/src/engine-components/Fog.ts +23 -1
- package/src/engine-components/GridHelper.ts +18 -2
- package/src/engine-components/GroundProjection.ts +25 -3
- package/src/engine-components/Interactable.ts +17 -2
- package/src/engine-components/Joints.ts +51 -8
- package/src/engine-components/LODGroup.ts +45 -11
- package/src/engine-components/Light.ts +35 -13
- package/src/engine-components/LookAtConstraint.ts +26 -8
- package/src/engine-components/NeedleMenu.ts +29 -7
- package/src/engine-components/NestedGltf.ts +40 -4
- package/src/engine-components/OffsetConstraint.ts +27 -3
- package/src/engine-components/OrbitControls.ts +41 -3
- package/src/engine-components/PlayerColor.ts +1 -1
- package/src/engine-components/ReflectionProbe.ts +19 -5
- package/src/engine-components/Renderer.ts +35 -1
- package/src/engine-components/RigidBody.ts +64 -8
- package/src/engine-components/SceneSwitcher.ts +11 -0
- package/src/engine-components/ScreenCapture.ts +42 -9
- package/src/engine-components/SeeThrough.ts +76 -9
- package/src/engine-components/ShadowCatcher.ts +61 -6
- package/src/engine-components/Skybox.ts +48 -12
- package/src/engine-components/SmoothFollow.ts +68 -7
- package/src/engine-components/SpatialTrigger.ts +51 -4
- package/src/engine-components/SpectatorCamera.ts +23 -5
- package/src/engine-components/SyncedRoom.ts +8 -2
- package/src/engine-components/SyncedTransform.ts +59 -10
- package/src/engine-components/TransformGizmo.ts +31 -4
- package/src/engine-components/VideoPlayer.ts +54 -6
- package/src/engine-components/Voip.ts +33 -2
- package/src/engine-components/export/usdz/USDZExporter.ts +47 -13
- package/src/engine-components/particlesystem/ParticleSystem.ts +84 -5
- package/src/engine-components/postprocessing/Effects/Antialiasing.ts +1 -0
- package/src/engine-components/postprocessing/Effects/BloomEffect.ts +1 -1
- package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +1 -1
- package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +1 -1
- package/src/engine-components/postprocessing/Effects/DepthOfField.ts +1 -1
- package/src/engine-components/postprocessing/Effects/EffectWrapper.ts +1 -0
- package/src/engine-components/postprocessing/Effects/Pixelation.ts +1 -1
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +1 -1
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Sharpening.ts +1 -1
- package/src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Tonemapping.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Vignette.ts +1 -1
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
- package/src/engine-components/postprocessing/Volume.ts +1 -1
- package/src/engine-components/splines/Spline.ts +412 -14
- package/src/engine-components/splines/SplineUtils.ts +1 -0
- package/src/engine-components/splines/SplineWalker.ts +4 -2
- package/src/engine-components/timeline/PlayableDirector.ts +108 -27
- package/src/engine-components/timeline/SignalAsset.ts +1 -1
- package/src/engine-components/timeline/TimelineModels.ts +18 -2
- package/src/engine-components/ui/Button.ts +29 -3
- package/src/engine-components/ui/Canvas.ts +29 -4
- package/src/engine-components/ui/CanvasGroup.ts +2 -2
- package/src/engine-components/ui/EventSystem.ts +1 -1
- package/src/engine-components/ui/Graphic.ts +1 -0
- package/src/engine-components/ui/Image.ts +22 -3
- package/src/engine-components/ui/InputField.ts +2 -2
- package/src/engine-components/ui/Layout.ts +3 -0
- package/src/engine-components/ui/Outline.ts +1 -1
- package/src/engine-components/ui/PointerEvents.ts +1 -1
- package/src/engine-components/ui/Raycaster.ts +57 -8
- package/src/engine-components/ui/RectTransform.ts +2 -2
- package/src/engine-components/ui/SpatialHtml.ts +1 -1
- package/src/engine-components/ui/Text.ts +24 -2
- package/src/engine-components/utils/LookAt.ts +1 -1
- package/src/engine-components/utils/OpenURL.ts +2 -1
- package/src/engine-components/web/Clickthrough.ts +119 -10
- package/src/engine-components/web/CursorFollow.ts +175 -9
- package/src/engine-components/web/HoverAnimation.ts +142 -13
- package/src/engine-components/web/ScrollFollow.ts +5 -1
- package/src/engine-components/web/ViewBox.ts +118 -18
- package/src/engine-components/webxr/TeleportTarget.ts +23 -4
- package/src/engine-components/webxr/WebARCameraBackground.ts +12 -3
- package/src/engine-components/webxr/WebXR.ts +12 -3
- package/src/engine-components/webxr/WebXRAvatar.ts +41 -4
- package/src/engine-components/webxr/WebXRImageTracking.ts +282 -38
- package/src/engine-components/webxr/WebXRPlaneTracking.ts +1 -1
- package/src/engine-components/webxr/XRFlag.ts +30 -3
- package/dist/gltf-progressive-BURrJW0U.umd.cjs +0 -8
- package/dist/gltf-progressive-DHLDFNvQ.min.js +0 -8
|
@@ -111,11 +111,27 @@ export function getUrlParams() {
|
|
|
111
111
|
// bit strange that we have to pass T in here as well but otherwise the type parameter is stripped it seems
|
|
112
112
|
type Param<T extends string> = string | boolean | number | T;
|
|
113
113
|
|
|
114
|
-
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
114
|
+
/**
|
|
115
|
+
* Checks if a URL parameter exists and returns its value.
|
|
116
|
+
* Useful for debugging, feature flags, and configuration.
|
|
117
|
+
*
|
|
118
|
+
* @param paramName The URL parameter name to check
|
|
119
|
+
* @returns
|
|
120
|
+
* - `true` if the parameter exists without a value (e.g. `?debug`)
|
|
121
|
+
* - `false` if the parameter doesn't exist or is set to `0`
|
|
122
|
+
* - The numeric value if it's a number (e.g. `?level=5` returns `5`)
|
|
123
|
+
* - The string value otherwise (e.g. `?name=test` returns `"test"`)
|
|
124
|
+
*
|
|
125
|
+
* @example Check debug mode
|
|
126
|
+
* ```ts
|
|
127
|
+
* if (getParam("debug")) {
|
|
128
|
+
* console.log("Debug mode enabled");
|
|
129
|
+
* }
|
|
130
|
+
* ```
|
|
131
|
+
* @example Get a numeric value
|
|
132
|
+
* ```ts
|
|
133
|
+
* const level = getParam("level"); // Returns number if ?level=5
|
|
134
|
+
* ```
|
|
119
135
|
*/
|
|
120
136
|
export function getParam<T extends string>(paramName: T): Param<T> {
|
|
121
137
|
if (showHelp && !requestedParams.includes(paramName))
|
|
@@ -573,6 +589,7 @@ declare global {
|
|
|
573
589
|
|
|
574
590
|
/**
|
|
575
591
|
* Utility functions to detect certain device types (mobile, desktop), browsers, or capabilities.
|
|
592
|
+
* @category Utilities
|
|
576
593
|
*/
|
|
577
594
|
export namespace DeviceUtilities {
|
|
578
595
|
|
|
@@ -32,6 +32,7 @@ declare type ScreenshotImageMimeType = "image/webp" | "image/png" | "image/jpeg"
|
|
|
32
32
|
* const dataUrl = screenshot();
|
|
33
33
|
* saveImage(dataUrl, "screenshot.png");
|
|
34
34
|
* ```
|
|
35
|
+
*
|
|
35
36
|
*/
|
|
36
37
|
export function screenshot(context?: Context, width?: number, height?: number, mimeType: ScreenshotImageMimeType = "image/webp", camera?: Camera | null): string | null {
|
|
37
38
|
return screenshot2({ context, width, height, mimeType, camera });
|
|
@@ -106,12 +107,30 @@ export declare type ScreenshotOptionsBlob = ScreenshotOptions & {
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
export declare type ScreenshotOptionsShare = ScreenshotOptions & {
|
|
110
|
+
/**
|
|
111
|
+
* Set `{ type: "share" }` to share the screenshot using the Web Share API. The promise will resolve with the blob of the screenshot and whether it was shared successfully or not. Note that the Web Share API is only available in secure contexts (HTTPS) and on some platforms.
|
|
112
|
+
*/
|
|
109
113
|
type: "share",
|
|
114
|
+
/**
|
|
115
|
+
* The filename to use when sharing the screenshot. If not provided, a default filename will be used.
|
|
116
|
+
*/
|
|
110
117
|
filename?: string,
|
|
118
|
+
/**
|
|
119
|
+
* The mime type of the shared file. If not provided, the mime type will be inferred from the screenshot options or default to "image/png".
|
|
120
|
+
*/
|
|
111
121
|
file_type?: ScreenshotImageMimeType,
|
|
112
122
|
|
|
123
|
+
/**
|
|
124
|
+
* The title to use when sharing the screenshot. This is optional and may not be supported by all platforms.
|
|
125
|
+
*/
|
|
113
126
|
title?: string,
|
|
127
|
+
/**
|
|
128
|
+
* The text to use when sharing the screenshot. This is optional and may not be supported by all platforms.
|
|
129
|
+
*/
|
|
114
130
|
text?: string,
|
|
131
|
+
/**
|
|
132
|
+
* The URL to use when sharing the screenshot. This is optional and may not be supported by all platforms.
|
|
133
|
+
*/
|
|
115
134
|
url?: string,
|
|
116
135
|
}
|
|
117
136
|
|
|
@@ -120,36 +139,241 @@ declare type ScreenshotOptionsShareReturnType = {
|
|
|
120
139
|
shared: boolean,
|
|
121
140
|
}
|
|
122
141
|
|
|
123
|
-
/**
|
|
124
|
-
* Take a screenshot from the current scene and return a {@link Texture}. This can applied to a surface in 3D space.
|
|
125
|
-
* @param opts Provide `{ type: "texture" }` to get a texture instead of a data url.
|
|
142
|
+
/**
|
|
143
|
+
* Take a screenshot from the current scene and return a {@link Texture}. This can be applied to a surface in 3D space.
|
|
144
|
+
* @param opts Provide `{ type: "texture" }` to get a texture instead of a data url.
|
|
126
145
|
* @returns The texture of the screenshot. Returns null if the screenshot could not be taken.
|
|
146
|
+
* @category Utilities
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* // Create a texture from the current view
|
|
150
|
+
* const screenshotTexture = screenshot2({ type: "texture", width: 512, height: 512 });
|
|
151
|
+
* if (screenshotTexture) {
|
|
152
|
+
* myMaterial.map = screenshotTexture;
|
|
153
|
+
* myMaterial.needsUpdate = true;
|
|
154
|
+
* }
|
|
155
|
+
*
|
|
156
|
+
* // Update an existing texture
|
|
157
|
+
* const existingTexture = new Texture();
|
|
158
|
+
* screenshot2({ type: "texture", target: existingTexture, transparent: true });
|
|
159
|
+
* ```
|
|
127
160
|
*/
|
|
128
161
|
export function screenshot2(opts: ScreenshotOptionsTexture): Texture | null;
|
|
162
|
+
|
|
129
163
|
/**
|
|
130
|
-
* Take a screenshot from the current scene.
|
|
131
|
-
*
|
|
132
|
-
* @
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
164
|
+
* Take a screenshot from the current scene and return a data URL string.
|
|
165
|
+
*
|
|
166
|
+
* @param opts Screenshot options. All properties are optional.
|
|
167
|
+
* @returns The data URL of the screenshot (e.g., "data:image/png;base64,..."). Returns null if the screenshot could not be taken.
|
|
168
|
+
* @category Utilities
|
|
169
|
+
*
|
|
170
|
+
* @example Basic screenshot
|
|
171
|
+
* ```ts
|
|
172
|
+
* // Take a simple screenshot with default settings
|
|
173
|
+
* const dataUrl = screenshot2({});
|
|
174
|
+
* console.log(dataUrl); // "data:image/webp;base64,..."
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* @example High-resolution screenshot with transparent background
|
|
178
|
+
* ```ts
|
|
179
|
+
* const dataUrl = screenshot2({
|
|
180
|
+
* width: 2048,
|
|
181
|
+
* height: 2048,
|
|
182
|
+
* mimeType: "image/png",
|
|
183
|
+
* transparent: true,
|
|
184
|
+
* trim: true, // Remove transparent edges
|
|
185
|
+
* });
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* @example Screenshot with custom background color
|
|
189
|
+
* ```ts
|
|
190
|
+
* import { Color } from "three";
|
|
191
|
+
*
|
|
192
|
+
* const dataUrl = screenshot2({
|
|
193
|
+
* width: 1024,
|
|
194
|
+
* height: 1024,
|
|
195
|
+
* background: new Color(0x00ff00), // Green background
|
|
196
|
+
* });
|
|
197
|
+
* ```
|
|
198
|
+
*
|
|
199
|
+
* @example Download screenshot automatically
|
|
200
|
+
* ```ts
|
|
201
|
+
* screenshot2({
|
|
202
|
+
* width: 1920,
|
|
203
|
+
* height: 1080,
|
|
204
|
+
* mimeType: "image/jpeg",
|
|
205
|
+
* download_filename: "my-scene.jpg",
|
|
206
|
+
* });
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* @example Manual download using saveImage
|
|
210
|
+
* ```ts
|
|
211
|
+
* const dataUrl = screenshot2({
|
|
212
|
+
* width: 1024,
|
|
213
|
+
* height: 1024,
|
|
214
|
+
* mimeType: "image/webp",
|
|
215
|
+
* transparent: true,
|
|
216
|
+
* });
|
|
217
|
+
* if (dataUrl) {
|
|
218
|
+
* saveImage(dataUrl, "screenshot.webp");
|
|
219
|
+
* }
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* @example Screenshot from specific camera
|
|
223
|
+
* ```ts
|
|
224
|
+
* const myCamera = this.gameObject.getComponent(Camera);
|
|
225
|
+
* const dataUrl = screenshot2({
|
|
226
|
+
* camera: myCamera,
|
|
227
|
+
* width: 1024,
|
|
136
228
|
* height: 1024,
|
|
137
|
-
*
|
|
138
|
-
* transparent: true,
|
|
139
|
-
* })
|
|
140
|
-
* // use saveImage to download the image
|
|
141
|
-
* saveImage(res, "screenshot.webp");
|
|
229
|
+
* });
|
|
142
230
|
* ```
|
|
143
231
|
*/
|
|
144
232
|
export function screenshot2(opts: ScreenshotOptionsDataUrl): string | null;
|
|
145
233
|
|
|
146
234
|
/**
|
|
147
|
-
* Take a screenshot asynchronously
|
|
148
|
-
*
|
|
149
|
-
* @param
|
|
235
|
+
* Take a screenshot asynchronously and return a Blob. This is useful when you need to process or upload the image data.
|
|
236
|
+
*
|
|
237
|
+
* @param opts Set `{ type: "blob" }` to get a blob instead of a data url. All other {@link ScreenshotOptions} are also available.
|
|
238
|
+
* @returns A Promise that resolves with the Blob of the screenshot. Returns null if the screenshot could not be taken.
|
|
239
|
+
* @category Utilities
|
|
240
|
+
*
|
|
241
|
+
* @example Upload screenshot to server
|
|
242
|
+
* ```ts
|
|
243
|
+
* const blob = await screenshot2({ type: "blob", mimeType: "image/png" });
|
|
244
|
+
* if (blob) {
|
|
245
|
+
* const formData = new FormData();
|
|
246
|
+
* formData.append("screenshot", blob, "screenshot.png");
|
|
247
|
+
* await fetch("/api/upload", { method: "POST", body: formData });
|
|
248
|
+
* }
|
|
249
|
+
* ```
|
|
250
|
+
*
|
|
251
|
+
* @example Save blob to file (browser download)
|
|
252
|
+
* ```ts
|
|
253
|
+
* const blob = await screenshot2({
|
|
254
|
+
* type: "blob",
|
|
255
|
+
* width: 1920,
|
|
256
|
+
* height: 1080,
|
|
257
|
+
* transparent: true
|
|
258
|
+
* });
|
|
259
|
+
* if (blob) {
|
|
260
|
+
* const url = URL.createObjectURL(blob);
|
|
261
|
+
* saveImage(url, "screenshot.png");
|
|
262
|
+
* URL.revokeObjectURL(url); // Clean up
|
|
263
|
+
* }
|
|
264
|
+
* ```
|
|
150
265
|
*/
|
|
151
266
|
export function screenshot2(opts: ScreenshotOptionsBlob): Promise<Blob | null>;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Take a screenshot and share it using the Web Share API (mobile-friendly).
|
|
270
|
+
*
|
|
271
|
+
* **Note**: The Web Share API is only available in secure contexts (HTTPS) and may not be supported on all platforms/browsers.
|
|
272
|
+
*
|
|
273
|
+
* @param opts Set `{ type: "share" }` to share the screenshot. Additional options like `filename`, `title`, `text`, and `url` can be provided.
|
|
274
|
+
* @returns A Promise that resolves with an object containing the blob and whether it was successfully shared.
|
|
275
|
+
* @category Utilities
|
|
276
|
+
*
|
|
277
|
+
* @example Share screenshot on mobile
|
|
278
|
+
* ```ts
|
|
279
|
+
* const result = await screenshot2({
|
|
280
|
+
* type: "share",
|
|
281
|
+
* filename: "my-creation.png",
|
|
282
|
+
* title: "Check out my 3D scene!",
|
|
283
|
+
* text: "I created this with Needle Engine",
|
|
284
|
+
* url: "https://engine.needle.tools",
|
|
285
|
+
* mimeType: "image/png",
|
|
286
|
+
* });
|
|
287
|
+
*
|
|
288
|
+
* if (result.shared) {
|
|
289
|
+
* console.log("Screenshot shared successfully!");
|
|
290
|
+
* } else {
|
|
291
|
+
* console.log("User cancelled or sharing not supported");
|
|
292
|
+
* }
|
|
293
|
+
* ```
|
|
294
|
+
*
|
|
295
|
+
* @example Share with fallback
|
|
296
|
+
* ```ts
|
|
297
|
+
* const result = await screenshot2({
|
|
298
|
+
* type: "share",
|
|
299
|
+
* filename: "screenshot.webp",
|
|
300
|
+
* file_type: "image/webp",
|
|
301
|
+
* });
|
|
302
|
+
*
|
|
303
|
+
* if (!result.shared && result.blob) {
|
|
304
|
+
* // Fallback: download the image instead
|
|
305
|
+
* const url = URL.createObjectURL(result.blob);
|
|
306
|
+
* saveImage(url, "screenshot.webp");
|
|
307
|
+
* URL.revokeObjectURL(url);
|
|
308
|
+
* }
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
152
311
|
export function screenshot2(opts: ScreenshotOptionsShare): Promise<ScreenshotOptionsShareReturnType>;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Take a screenshot from the current scene with advanced options.
|
|
315
|
+
*
|
|
316
|
+
* This is the main screenshot function in Needle Engine with support for multiple output formats:
|
|
317
|
+
* - **Data URL** (default): Returns a base64-encoded string suitable for img src attributes
|
|
318
|
+
* - **Texture**: Returns a Three.js Texture that can be applied to materials
|
|
319
|
+
* - **Blob**: Returns a Blob for uploading or processing (async)
|
|
320
|
+
* - **Share**: Uses the Web Share API to share the screenshot (async, mobile-friendly)
|
|
321
|
+
*
|
|
322
|
+
* @param opts Screenshot options. Use the `type` property to specify output format. See {@link ScreenshotOptions} for all available options.
|
|
323
|
+
* @returns Depending on the `type` option:
|
|
324
|
+
* - Data URL (string) when `type` is undefined or not specified
|
|
325
|
+
* - Texture when `type: "texture"`
|
|
326
|
+
* - Promise<Blob | null> when `type: "blob"`
|
|
327
|
+
* - Promise<{blob, shared}> when `type: "share"`
|
|
328
|
+
*
|
|
329
|
+
* Returns null (or Promise resolving to null) if the screenshot could not be taken.
|
|
330
|
+
*
|
|
331
|
+
* @category Utilities
|
|
332
|
+
*
|
|
333
|
+
* @example WebXR / AR Screenshots
|
|
334
|
+
* ```ts
|
|
335
|
+
* // Screenshots work automatically in WebXR sessions
|
|
336
|
+
* // The camera feed will be composited with your 3D content
|
|
337
|
+
* const dataUrl = screenshot2({
|
|
338
|
+
* width: 1920,
|
|
339
|
+
* height: 1080
|
|
340
|
+
* });
|
|
341
|
+
* ```
|
|
342
|
+
*
|
|
343
|
+
* **Note for AR Screenshots**: To include the device camera feed in AR screenshots, you need to request camera access.
|
|
344
|
+
* This is done automatically when you use {@link WebARCameraBackground} component in your scene.
|
|
345
|
+
* If you're not using WebARCameraBackground, you can request camera access manually:
|
|
346
|
+
* ```ts
|
|
347
|
+
* export class MyComponent extends Behaviour {
|
|
348
|
+
* onBeforeXR(mode: XRSessionMode, args: XRSessionInit): void {
|
|
349
|
+
* if (mode === "immersive-ar") {
|
|
350
|
+
* args.optionalFeatures = args.optionalFeatures || [];
|
|
351
|
+
* args.optionalFeatures.push('camera-access');
|
|
352
|
+
* }
|
|
353
|
+
* }
|
|
354
|
+
* }
|
|
355
|
+
* ```
|
|
356
|
+
* Without camera access, AR screenshots will only show your 3D content without the real-world background.
|
|
357
|
+
*
|
|
358
|
+
* @example Combining multiple options
|
|
359
|
+
* ```ts
|
|
360
|
+
* // High-res transparent screenshot with custom camera
|
|
361
|
+
* const myCamera = this.gameObject.getComponent(Camera);
|
|
362
|
+
* const texture = screenshot2({
|
|
363
|
+
* type: "texture",
|
|
364
|
+
* camera: myCamera,
|
|
365
|
+
* width: 2048,
|
|
366
|
+
* height: 2048,
|
|
367
|
+
* transparent: true,
|
|
368
|
+
* trim: true,
|
|
369
|
+
* render_events: true, // Ensure reflection probes are updated
|
|
370
|
+
* });
|
|
371
|
+
* ```
|
|
372
|
+
*
|
|
373
|
+
* @see {@link screenshot} for a simpler alternative with fewer options
|
|
374
|
+
* @see {@link saveImage} for downloading data URLs
|
|
375
|
+
* @see {@link ScreenshotOptions} for all available options
|
|
376
|
+
*/
|
|
153
377
|
export function screenshot2(opts: ScreenshotOptionsDataUrl | ScreenshotOptionsTexture | ScreenshotOptionsBlob | ScreenshotOptionsShare)
|
|
154
378
|
: Texture | string | null | Promise<Blob | null> | Promise<ScreenshotOptionsShareReturnType> {
|
|
155
379
|
|
|
@@ -5,7 +5,7 @@ import { isDevEnvironment, showBalloonError } from "./debug/index.js";
|
|
|
5
5
|
// Adapted from WebARCameraBackground
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Assigns the camera feed to a texture - this must be called during the render loop
|
|
8
|
+
* Assigns the camera feed to a texture - this must be called during the render loop.
|
|
9
9
|
*/
|
|
10
10
|
export function updateTextureFromXRFrame(renderer: WebGLRenderer, target: Texture): boolean {
|
|
11
11
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Loader, LoadingManager, Material, Object3D, TextureLoader } from "three";
|
|
2
|
-
import { GLTFLoader, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { GLTFLoader, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
3
|
+
|
|
4
|
+
import { ObjectUtils } from "../engine_create_objects.js";
|
|
5
|
+
import { MODULES } from "../engine_modules.js";
|
|
6
|
+
import { IContext } from "../engine_types.js";
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
// #region Utils
|
|
@@ -621,6 +621,9 @@ function createUniformProperties(material: CustomShader) {
|
|
|
621
621
|
case "_Color":
|
|
622
622
|
defineProperty("color", key);
|
|
623
623
|
break;
|
|
624
|
+
case "_map":
|
|
625
|
+
defineProperty("map", key);
|
|
626
|
+
break;
|
|
624
627
|
// case "_Metallic":
|
|
625
628
|
// defineProperty("metalness", key);
|
|
626
629
|
// break;
|
|
@@ -2,6 +2,6 @@ export { compareAssociation } from "./extension_utils.js"
|
|
|
2
2
|
export * from "./extensions.js"
|
|
3
3
|
export * from "./NEEDLE_animator_controller_model.js"
|
|
4
4
|
export { SceneLightSettings } from "./NEEDLE_lighting_settings.js"
|
|
5
|
+
export { MaterialX } from "./NEEDLE_materialx.js"
|
|
5
6
|
export * from "./NEEDLE_progressive.js"
|
|
6
|
-
export { CustomShader } from "./NEEDLE_techniques_webgl.js"
|
|
7
|
-
export { MaterialX } from "./NEEDLE_materialx.js"
|
|
7
|
+
export { CustomShader } from "./NEEDLE_techniques_webgl.js"
|
|
@@ -279,7 +279,12 @@ const $initialFov = Symbol("initial-fov");
|
|
|
279
279
|
* The XRRig can be accessed via the `rig` property
|
|
280
280
|
* Set a custom XRRig via `NeedleXRSession.addRig(...)` or `NeedleXRSession.removeRig(...)`
|
|
281
281
|
* By default the active XRRig with the highest priority in the scene is used
|
|
282
|
+
*
|
|
283
|
+
* ### Screenshots in XR
|
|
284
|
+
* Screenshots work automatically during XR sessions, including AR camera feed compositing. See {@link screenshot2} for more information.
|
|
285
|
+
*
|
|
282
286
|
* @category XR
|
|
287
|
+
* @see {@link screenshot2} for taking screenshots in XR sessions
|
|
283
288
|
*/
|
|
284
289
|
export class NeedleXRSession implements INeedleXRSession {
|
|
285
290
|
|
|
@@ -5,12 +5,32 @@ import * as utils from "./../engine/engine_three_utils.js";
|
|
|
5
5
|
import { Behaviour, GameObject } from "./Component.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* The [AlignmentConstraint](https://engine.needle.tools/docs/api/AlignmentConstraint) positions and scales this GameObject to span between two target objects.
|
|
9
|
+
* The object is rotated to face `to` and scaled along Z to match the distance.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* **Use cases:**
|
|
12
|
+
* - Dynamic beams or laser effects between objects
|
|
13
|
+
* - Stretchy connectors or ropes
|
|
14
|
+
* - Visual links between UI elements
|
|
15
|
+
* - Debug lines between transforms
|
|
16
|
+
*
|
|
17
|
+
* **How it works:**
|
|
18
|
+
* - Position: Centered between `from` and `to` (or at `from` if not centered)
|
|
19
|
+
* - Rotation: Looks at `to` from `from`
|
|
20
|
+
* - Scale: Z-axis scales to match distance, X/Y use `width`
|
|
21
|
+
*
|
|
22
|
+
* @example Create a beam between two objects
|
|
23
|
+
* ```ts
|
|
24
|
+
* const beam = beamMesh.addComponent(AlignmentConstraint);
|
|
25
|
+
* // Set targets via serialized properties in editor
|
|
26
|
+
* // or via code if properties are exposed
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @summary Aligns and scales object between two targets
|
|
12
30
|
* @category Constraints
|
|
13
|
-
* @group Components
|
|
31
|
+
* @group Components
|
|
32
|
+
* @see {@link LookAtConstraint} for rotation-only constraints
|
|
33
|
+
* @see {@link SmoothFollow} for following with smoothing
|
|
14
34
|
**/
|
|
15
35
|
export class AlignmentConstraint extends Behaviour {
|
|
16
36
|
|
|
@@ -10,6 +10,12 @@ import { Behaviour } from "./Component.js";
|
|
|
10
10
|
|
|
11
11
|
const debug = getParam("debuganimation");
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Options for controlling animation playback via {@link Animation.play}.
|
|
15
|
+
* All options are optional - defaults are sensible for most use cases.
|
|
16
|
+
*
|
|
17
|
+
* @see {@link Animation} for the component that uses these options
|
|
18
|
+
*/
|
|
13
19
|
export declare type PlayOptions = {
|
|
14
20
|
/**
|
|
15
21
|
* The fade duration in seconds for the action to fade in and other actions to fade out (if exclusive is enabled)
|
|
@@ -59,11 +65,47 @@ declare type AnimationIdentifier = AnimationClip | number | string | undefined;
|
|
|
59
65
|
class Vec2 { x!: number; y!: number }
|
|
60
66
|
|
|
61
67
|
/**
|
|
62
|
-
* Animation component to play animations on a GameObject.
|
|
68
|
+
* Animation component to play animations on a GameObject.
|
|
69
|
+
* For simpler animation needs compared to {@link Animator}, this component directly
|
|
70
|
+
* plays AnimationClips without state machine logic.
|
|
71
|
+
*
|
|
72
|
+
* **Key features:**
|
|
73
|
+
* - Play animations by index, name, or clip reference
|
|
74
|
+
* - Cross-fade between animations with `fadeDuration`
|
|
75
|
+
* - Loop or play once with optional clamping
|
|
76
|
+
* - Random start time and speed variation
|
|
77
|
+
* - Promise-based completion handling
|
|
78
|
+
*
|
|
63
79
|
*
|
|
64
|
-
*
|
|
80
|
+
* 
|
|
81
|
+
*
|
|
82
|
+
* @example Play animation by name
|
|
83
|
+
* ```ts
|
|
84
|
+
* const anim = this.gameObject.getComponent(Animation);
|
|
85
|
+
* await anim?.play("Walk", { loop: true, fadeDuration: 0.3 });
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @example Play with options
|
|
89
|
+
* ```ts
|
|
90
|
+
* anim?.play(0, {
|
|
91
|
+
* loop: false,
|
|
92
|
+
* clampWhenFinished: true,
|
|
93
|
+
* speed: 2
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @summary Plays animations from AnimationClips
|
|
65
98
|
* @category Animation and Sequencing
|
|
66
99
|
* @group Components
|
|
100
|
+
* @see {@link Animator} for state machine-based animation
|
|
101
|
+
* @see {@link PlayOptions} for all playback options
|
|
102
|
+
* @link https://engine.needle.tools/samples/?overlay=samples&tag=animation
|
|
103
|
+
* @link https://engine.needle.tools/samples/imunogard/
|
|
104
|
+
*
|
|
105
|
+
* @link https://engine.needle.tools/docs/blender/animation.html
|
|
106
|
+
*
|
|
107
|
+
* 
|
|
108
|
+
*
|
|
67
109
|
*/
|
|
68
110
|
export class Animation extends Behaviour implements IAnimationComponent {
|
|
69
111
|
|
|
@@ -12,7 +12,7 @@ import { Behaviour } from "./Component.js";
|
|
|
12
12
|
const debug = getParam("debuganimator");
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Represents an event emitted by an animation mixer
|
|
15
|
+
* Represents an event emitted by an animation mixer
|
|
16
16
|
* @category Animation and Sequencing
|
|
17
17
|
* @group Components
|
|
18
18
|
*/
|
|
@@ -28,7 +28,7 @@ export declare class MixerEvent {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* Configuration options for playing animations
|
|
31
|
+
* Configuration options for playing animations
|
|
32
32
|
* @category Animation and Sequencing
|
|
33
33
|
*/
|
|
34
34
|
export declare class PlayOptions {
|
|
@@ -38,15 +38,48 @@ export declare class PlayOptions {
|
|
|
38
38
|
clampWhenFinished?: boolean;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
41
|
+
/**
|
|
42
|
+
* Animator plays and manages state-machine based animations on a GameObject.
|
|
43
|
+
* Uses an {@link AnimatorController} for state transitions, blending, and parameters.
|
|
44
|
+
*
|
|
45
|
+
* **State machine animations:**
|
|
46
|
+
* Define animation states and transitions in Unity's Animator window or in [Blender's Animator Controller editor](https://engine.needle.tools/docs/blender/animation.html)
|
|
47
|
+
* Control transitions via parameters (bool, int, float, trigger).
|
|
45
48
|
*
|
|
49
|
+
* 
|
|
50
|
+
*
|
|
51
|
+
* **Creating at runtime:**
|
|
52
|
+
* Use `AnimatorController.createFromClips()` to create controllers from code.
|
|
53
|
+
*
|
|
54
|
+
* **Parameters:**
|
|
55
|
+
* - `setTrigger(name)` - Trigger a one-shot transition
|
|
56
|
+
* - `setBool(name, value)` - Set boolean parameter
|
|
57
|
+
* - `setFloat(name, value)` - Set float parameter
|
|
58
|
+
* - `setInteger(name, value)` - Set integer parameter
|
|
59
|
+
*
|
|
60
|
+
* @example Trigger animation state
|
|
61
|
+
* ```ts
|
|
62
|
+
* const animator = myCharacter.getComponent(Animator);
|
|
63
|
+
* animator.setTrigger("Jump");
|
|
64
|
+
* animator.setFloat("Speed", 5);
|
|
65
|
+
* animator.setBool("IsRunning", true);
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example Listen to animation events
|
|
69
|
+
* ```ts
|
|
70
|
+
* animator.onLoop(evt => console.log("Animation looped"));
|
|
71
|
+
* animator.onFinished(evt => console.log("Animation finished"));
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
46
74
|
* @summary Plays and manages animations on a GameObject based on an AnimatorController
|
|
47
75
|
* @category Animation and Sequencing
|
|
48
76
|
* @group Components
|
|
49
|
-
|
|
77
|
+
* @see {@link AnimatorController} for state machine configuration
|
|
78
|
+
* @see {@link Animation} for simple clip playback
|
|
79
|
+
* @see {@link PlayableDirector} for timeline-based animation
|
|
80
|
+
*
|
|
81
|
+
* @link https://engine.needle.tools/docs/blender/animation.html
|
|
82
|
+
*/
|
|
50
83
|
export class Animator extends Behaviour implements IAnimationComponent {
|
|
51
84
|
|
|
52
85
|
/**
|
|
@@ -5,7 +5,7 @@ import { Camera } from "./Camera.js";
|
|
|
5
5
|
import { Behaviour, GameObject } from "./Component.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* AudioListener represents a listener that can hear audio sources in the scene.
|
|
8
|
+
* The [AudioListener](https://engine.needle.tools/docs/api/AudioListener) represents a listener that can hear audio sources in the scene.
|
|
9
9
|
* This component creates and manages a Three.js {@link three#AudioListener}, automatically connecting it
|
|
10
10
|
* to the main camera or a Camera in the parent hierarchy.
|
|
11
11
|
*
|
|
@@ -37,24 +37,46 @@ export enum AudioRolloffMode {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
* Plays audio clips in the scene
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
40
|
+
/**
|
|
41
|
+
* Plays audio clips in the scene with support for spatial (3D) positioning.
|
|
42
|
+
*
|
|
43
|
+
* **Browser autoplay policies:**
|
|
44
|
+
* Web browsers require user interaction before playing audio. Use
|
|
45
|
+
* `AudioSource.userInteractionRegistered` to check if playback is allowed,
|
|
46
|
+
* or `registerWaitForAllowAudio()` to queue playback until interaction occurs.
|
|
47
|
+
*
|
|
48
|
+
* **Spatial audio:**
|
|
49
|
+
* Set `spatialBlend` to 1 for full 3D positioning, or 0 for 2D (non-spatial).
|
|
50
|
+
* Requires an {@link AudioListener} in the scene (typically on the camera).
|
|
51
|
+
*
|
|
52
|
+
* **Visibility handling:**
|
|
53
|
+
* Audio automatically pauses when the tab is hidden unless `playInBackground = true`.
|
|
54
|
+
* On mobile, audio always pauses in background regardless of this setting.
|
|
55
|
+
*
|
|
56
|
+
* @example Play audio on button click
|
|
57
|
+
* ```ts
|
|
58
|
+
* onClick() {
|
|
59
|
+
* const audio = this.getComponent(AudioSource);
|
|
60
|
+
* audio.play();
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example Wait for user interaction
|
|
65
|
+
* ```ts
|
|
66
|
+
* AudioSource.registerWaitForAllowAudio(() => {
|
|
67
|
+
* this.getComponent(AudioSource)?.play();
|
|
68
|
+
* });
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
55
71
|
* @summary Plays audio clips from files or media streams
|
|
56
72
|
* @category Multimedia
|
|
57
73
|
* @group Components
|
|
74
|
+
* @see {@link AudioListener} for the audio receiver component
|
|
75
|
+
* @see {@link AudioRolloffMode} for distance attenuation options
|
|
76
|
+
* @see {@link Voip} for voice communication
|
|
77
|
+
* @see {@link PlayableDirector} for timeline-based audio
|
|
78
|
+
* @link https://engine.needle.tools/samples/?overlay=samples&tag=audio
|
|
79
|
+
* @link https://spatial-audio-zubckswmztj.needle.run/
|
|
58
80
|
*/
|
|
59
81
|
export class AudioSource extends Behaviour {
|
|
60
82
|
|