@needle-tools/engine 4.13.0 → 4.13.1
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/{needle-engine.bundle-CxaKFQVS.min.js → needle-engine.bundle-BNIUpreS.min.js} +107 -107
- package/dist/{needle-engine.bundle-Dl3TFYyv.js → needle-engine.bundle-DauZUYl7.js} +2347 -1845
- package/dist/{needle-engine.bundle-J4k4znv8.umd.cjs → needle-engine.bundle-tjI5Fq2c.umd.cjs} +108 -108
- package/dist/needle-engine.d.ts +4022 -419
- package/dist/needle-engine.js +2 -2
- 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 +16 -0
- 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 +21 -5
- package/lib/engine/engine_utils.js +21 -5
- package/lib/engine/engine_utils.js.map +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/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-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 +45 -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 +1 -1
- package/lib/engine-components/utils/OpenURL.js +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 +171 -7
- package/lib/engine-components/web/CursorFollow.js +171 -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 +4 -1
- package/lib/engine-components/web/ScrollFollow.js +4 -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/WebXR.d.ts +10 -2
- package/lib/engine-components/webxr/WebXR.js +10 -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 +1 -1
- package/plugins/vite/custom-element-data.js +128 -19
- package/src/engine/engine_context.ts +16 -0
- 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 +21 -5
- package/src/engine/extensions/NEEDLE_materialx.ts +5 -4
- package/src/engine/extensions/index.ts +2 -2
- 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 +48 -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 +1 -1
- package/src/engine-components/web/Clickthrough.ts +119 -10
- package/src/engine-components/web/CursorFollow.ts +174 -9
- package/src/engine-components/web/HoverAnimation.ts +142 -13
- package/src/engine-components/web/ScrollFollow.ts +4 -1
- package/src/engine-components/web/ViewBox.ts +118 -18
- package/src/engine-components/webxr/TeleportTarget.ts +23 -4
- package/src/engine-components/webxr/WebXR.ts +11 -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
|
@@ -60,12 +60,50 @@ declare module 'three/examples/jsm/controls/OrbitControls.js' {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
63
|
+
/**
|
|
64
|
+
* [OrbitControls](https://engine.needle.tools/docs/api/OrbitControls) provides interactive camera control using three.js OrbitControls.
|
|
65
|
+
* Users can rotate, pan, and zoom the camera to explore 3D scenes.
|
|
66
|
+
*
|
|
67
|
+
* **Features:**
|
|
68
|
+
* - Rotation around a target point (orbit)
|
|
69
|
+
* - Panning to move the view
|
|
70
|
+
* - Zooming via scroll or pinch
|
|
71
|
+
* - Auto-rotation for showcases
|
|
72
|
+
* - Configurable angle and distance limits
|
|
73
|
+
* - Smooth damping for natural feel
|
|
74
|
+
*
|
|
75
|
+
* 
|
|
76
|
+
*
|
|
77
|
+
* **Access underlying controls:**
|
|
78
|
+
* - `controls` - The three.js OrbitControls instance
|
|
79
|
+
* - `controllerObject` - The object being controlled (usually the camera)
|
|
80
|
+
*
|
|
81
|
+
* **Debug options:**
|
|
82
|
+
* - `?debugorbit` - Log orbit control events
|
|
83
|
+
* - `?freecam` - Enable unrestricted camera movement
|
|
84
|
+
*
|
|
85
|
+
* @example Basic setup
|
|
86
|
+
* ```ts
|
|
87
|
+
* const orbitControls = camera.getComponent(OrbitControls);
|
|
88
|
+
* orbitControls.autoRotate = true;
|
|
89
|
+
* orbitControls.autoRotateSpeed = 2;
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @example Set look-at target
|
|
93
|
+
* ```ts
|
|
94
|
+
* orbitControls.setLookTargetPosition(new Vector3(0, 1, 0), true);
|
|
95
|
+
* // Or move both camera and target
|
|
96
|
+
* orbitControls.setCameraTargetPosition(new Vector3(5, 2, 5), new Vector3(0, 0, 0));
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
66
99
|
* @summary Camera controller using three.js OrbitControls
|
|
67
100
|
* @category Camera and Controls
|
|
68
101
|
* @group Components
|
|
102
|
+
* @see {@link LookAtConstraint} for setting the look-at target
|
|
103
|
+
* @see {@link SmoothFollow} for smooth camera following
|
|
104
|
+
* @see {@link Camera} for camera configuration
|
|
105
|
+
* @link https://threejs.org/docs/#examples/en/controls/OrbitControls
|
|
106
|
+
* @link https://engine.needle.tools/samples/panorama-controls alternative controls in samples
|
|
69
107
|
*/
|
|
70
108
|
export class OrbitControls extends Behaviour implements ICameraController {
|
|
71
109
|
|
|
@@ -7,7 +7,7 @@ import { Behaviour, GameObject } from "./Component.js";
|
|
|
7
7
|
import { AvatarMarker } from "./webxr/WebXRAvatar.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* PlayerColor
|
|
10
|
+
* [PlayerColor](https://engine.needle.tools/docs/api/PlayerColor) Assigns a unique color for each user in the room to the object it is attached to.
|
|
11
11
|
* The color is generated based on the user's ID.
|
|
12
12
|
*
|
|
13
13
|
* @summary Assigns a unique color to the player object
|
|
@@ -15,13 +15,28 @@ const $reflectionProbeKey = Symbol("reflectionProbeKey");
|
|
|
15
15
|
const $originalMaterial = Symbol("original material");
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* The [ReflectionProbe](https://engine.needle.tools/docs/api/ReflectionProbe) provides environment reflection data to materials within its defined area.
|
|
19
|
+
* Use for chrome-like materials that need accurate environment reflections.
|
|
20
|
+
*
|
|
21
|
+
* **Setup:**
|
|
22
|
+
* 1. Add ReflectionProbe component to an object
|
|
23
|
+
* 2. Assign a cubemap or HDR texture
|
|
24
|
+
* 3. In Renderer components, assign the probe as anchor override
|
|
25
|
+
*
|
|
26
|
+
* **Note:** Volume-based automatic assignment is not fully supported yet.
|
|
27
|
+
* Objects (Renderer components) can explicitly reference their reflection probe.
|
|
28
|
+
*
|
|
29
|
+
* **Debug options:**
|
|
30
|
+
* - `?debugreflectionprobe` - Log probe info
|
|
31
|
+
* - `?noreflectionprobe` - Disable all reflection probes
|
|
32
|
+
*
|
|
33
|
+
* - Example: https://engine.needle.tools/samples/reflection-probes
|
|
34
|
+
*
|
|
22
35
|
* @summary Provides reflection data to materials
|
|
23
36
|
* @category Rendering
|
|
24
37
|
* @group Components
|
|
38
|
+
* @see {@link Renderer} for material and rendering control
|
|
39
|
+
* @see {@link Light} for scene lighting
|
|
25
40
|
*/
|
|
26
41
|
export class ReflectionProbe extends Behaviour {
|
|
27
42
|
|
|
@@ -45,7 +60,6 @@ export class ReflectionProbe extends Behaviour {
|
|
|
45
60
|
return probe;
|
|
46
61
|
}
|
|
47
62
|
}
|
|
48
|
-
// TODO not supported right now, as we'd have to pass the ReflectionProbe scale through as well.
|
|
49
63
|
else if (probe.isInBox(object)) {
|
|
50
64
|
if (debug) console.log("Found reflection probe", object.name, probe.name);
|
|
51
65
|
return probe;
|
|
@@ -200,8 +200,43 @@ class SharedMaterialArray implements ISharedMaterials {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
|
+
* The [Renderer](https://engine.needle.tools/docs/api/Renderer) component controls rendering properties of meshes including materials,
|
|
204
|
+
* lightmaps, reflection probes, and GPU instancing.
|
|
205
|
+
*
|
|
206
|
+
* **Materials:**
|
|
207
|
+
* Access materials via `sharedMaterials` array. Changes affect all instances.
|
|
208
|
+
* Use material cloning for per-instance variations.
|
|
209
|
+
*
|
|
210
|
+
* **Instancing:**
|
|
211
|
+
* Enable GPU instancing for improved performance with many identical objects.
|
|
212
|
+
* Use `Renderer.setInstanced(obj, true)` or `enableInstancing` property.
|
|
213
|
+
*
|
|
214
|
+
* **Lightmaps:**
|
|
215
|
+
* Baked lighting is automatically applied when exported from Unity or Blender.
|
|
216
|
+
* Access via the associated {@link RendererLightmap} component.
|
|
217
|
+
*
|
|
218
|
+
* [](https://engine.needle.tools/samples/multiple-lightmaps/)
|
|
219
|
+
*
|
|
220
|
+
* **Debug options:**
|
|
221
|
+
* - `?debugrenderer` - Log renderer info
|
|
222
|
+
* - `?wireframe` - Show wireframe rendering
|
|
223
|
+
* - `?noinstancing` - Disable GPU instancing
|
|
224
|
+
*
|
|
225
|
+
* @example Change material at runtime
|
|
226
|
+
* ```ts
|
|
227
|
+
* const renderer = myObject.getComponent(Renderer);
|
|
228
|
+
* renderer.sharedMaterials[0] = newMaterial;
|
|
229
|
+
* ```
|
|
230
|
+
*
|
|
231
|
+
* @example Enable instancing
|
|
232
|
+
* ```ts
|
|
233
|
+
* Renderer.setInstanced(myObject, true);
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
203
236
|
* @category Rendering
|
|
204
237
|
* @group Components
|
|
238
|
+
* @see {@link ReflectionProbe} for environment reflections
|
|
239
|
+
* @see {@link Light} for scene lighting
|
|
205
240
|
*/
|
|
206
241
|
export class Renderer extends Behaviour implements IRenderer {
|
|
207
242
|
|
|
@@ -691,7 +726,6 @@ export class Renderer extends Behaviour implements IRenderer {
|
|
|
691
726
|
}
|
|
692
727
|
|
|
693
728
|
if (this.reflectionProbeUsage !== ReflectionProbeUsage.Off && this._reflectionProbe) {
|
|
694
|
-
if (!this._lightmaps?.length) // Currently reflectionprobes cant be used with lightmaps
|
|
695
729
|
this._reflectionProbe.onSet(this);
|
|
696
730
|
}
|
|
697
731
|
// since three 163 we need to set the envMap to the scene envMap if it is not set
|
|
@@ -2,14 +2,18 @@ import { Matrix4, Object3D, Quaternion, Vector3, Vector3Like } from "three";
|
|
|
2
2
|
|
|
3
3
|
import { isDevEnvironment } from "../engine/debug/index.js";
|
|
4
4
|
import { MODULES } from "../engine/engine_modules.js";
|
|
5
|
+
import type { Physics } from "../engine/engine_physics.js";
|
|
5
6
|
import { CollisionDetectionMode, RigidbodyConstraints } from "../engine/engine_physics.types.js";
|
|
7
|
+
import type { RapierPhysics } from "../engine/engine_physics_rapier.js";
|
|
6
8
|
import { serializable } from "../engine/engine_serialization_decorator.js";
|
|
7
9
|
import { Context, FrameEvent } from "../engine/engine_setup.js";
|
|
8
|
-
import { getWorldPosition } from "../engine/engine_three_utils.js";
|
|
9
10
|
import type { IRigidbody, Vec3 } from "../engine/engine_types.js";
|
|
10
11
|
import { validate } from "../engine/engine_util_decorator.js";
|
|
11
12
|
import { delayForFrames, Watch } from "../engine/engine_utils.js";
|
|
13
|
+
import type { CharacterController } from "./CharacterController.js";
|
|
14
|
+
import type { BoxCollider, CapsuleCollider, Collider,MeshCollider, SphereCollider } from "./Collider.js";
|
|
12
15
|
import { Behaviour } from "./Component.js";
|
|
16
|
+
import type { Joint } from "./Joints.js";
|
|
13
17
|
|
|
14
18
|
class TransformWatch {
|
|
15
19
|
|
|
@@ -134,15 +138,67 @@ class TransformWatch {
|
|
|
134
138
|
}
|
|
135
139
|
|
|
136
140
|
/**
|
|
137
|
-
*
|
|
141
|
+
* Rigidbody component for realistic physics simulation and dynamic interactions.
|
|
142
|
+
* Used together with a {@link Collider} to enable physical behavior like gravity, collisions,
|
|
143
|
+
* forces, and constraints. Powered by the Rapier physics engine.
|
|
138
144
|
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
+
* 
|
|
146
|
+
*
|
|
147
|
+
* **Key features:**
|
|
148
|
+
* - Dynamic, kinematic, or static body types
|
|
149
|
+
* - Automatic or manual mass calculation
|
|
150
|
+
* - Gravity, drag, and angular drag control
|
|
151
|
+
* - Position and rotation constraints (locking axes)
|
|
152
|
+
* - Force, impulse, and velocity manipulation
|
|
153
|
+
* - Sleep/wake optimization for performance
|
|
154
|
+
* - Continuous collision detection (CCD) support
|
|
155
|
+
*
|
|
156
|
+
* @example Basic dynamic rigidbody
|
|
157
|
+
* ```ts
|
|
158
|
+
* const rb = this.gameObject.getComponent(Rigidbody);
|
|
159
|
+
* rb.useGravity = true;
|
|
160
|
+
* rb.mass = 2.0;
|
|
161
|
+
* rb.drag = 0.5;
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @example Apply force to move object
|
|
165
|
+
* ```ts
|
|
166
|
+
* const rb = this.gameObject.getComponent(Rigidbody);
|
|
167
|
+
* rb.applyForce(new Vector3(0, 10, 0)); // Upward force
|
|
168
|
+
* rb.applyImpulse(new Vector3(5, 0, 0)); // Instant velocity change
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* @example Kinematic rigidbody (manually controlled)
|
|
172
|
+
* ```ts
|
|
173
|
+
* const rb = this.gameObject.getComponent(Rigidbody);
|
|
174
|
+
* rb.isKinematic = true; // Not affected by forces
|
|
175
|
+
* rb.teleport({ x: 0, y: 5, z: 0 }); // Move without physics
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @example Lock rotation on Y axis (useful for characters)
|
|
179
|
+
* ```ts
|
|
180
|
+
* const rb = this.gameObject.getComponent(Rigidbody);
|
|
181
|
+
* rb.lockRotationY = true;
|
|
182
|
+
* // Or use constraints for multiple axes:
|
|
183
|
+
* rb.constraints = RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezePositionZ;
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @summary Enables physics simulation with forces, gravity, and collisions
|
|
187
|
+
* @category Physics
|
|
145
188
|
* @group Components
|
|
189
|
+
* @see {@link BoxCollider} for box-shaped colliders
|
|
190
|
+
* @see {@link SphereCollider} for sphere-shaped colliders
|
|
191
|
+
* @see {@link CapsuleCollider} for capsule-shaped colliders
|
|
192
|
+
* @see {@link MeshCollider} for mesh-based colliders
|
|
193
|
+
* @see {@link Collider} for collider base class
|
|
194
|
+
* @see {@link CharacterController} for character movement
|
|
195
|
+
* @see {@link Joint} for connecting bodies
|
|
196
|
+
* @see {@link RapierPhysics} for physics engine implementation
|
|
197
|
+
* @see {@link Physics} for raycasting and physics utilities
|
|
198
|
+
* @link https://engine.needle.tools/samples/physics-basic/
|
|
199
|
+
* @link https://engine.needle.tools/samples/physics-playground/
|
|
200
|
+
* @link https://engine.needle.tools/samples/physics-&-animation/
|
|
201
|
+
* @link https://rapier.rs/docs/user_guides/javascript/rigid_bodies
|
|
146
202
|
*/
|
|
147
203
|
export class Rigidbody extends Behaviour implements IRigidbody {
|
|
148
204
|
|
|
@@ -84,6 +84,13 @@ export interface ISceneEventListener {
|
|
|
84
84
|
* - [Needle Website](https://needle.tools)
|
|
85
85
|
* - [Songs Of Cultures](https://app.songsofcultures.com)
|
|
86
86
|
*
|
|
87
|
+
* 
|
|
88
|
+
* *Replace entire scenes with the SceneSwitcher.*
|
|
89
|
+
*
|
|
90
|
+
* 
|
|
91
|
+
* *Multiple SceneSwitcher components can be used at the same time and they can also be nested
|
|
92
|
+
* (a scene loaded by a SceneSwitcher can also have a SceneSwitcher to load sub-scenes).*
|
|
93
|
+
*
|
|
87
94
|
* ### Interfaces
|
|
88
95
|
* Use the {@link ISceneEventListener} interface to listen to scene open and closing events with the ability to modify transitions and stall the scene loading process.
|
|
89
96
|
*
|
|
@@ -111,6 +118,10 @@ export interface ISceneEventListener {
|
|
|
111
118
|
* @summary Dynamically loads and switches between multiple scenes
|
|
112
119
|
* @category Asset Management
|
|
113
120
|
* @group Components
|
|
121
|
+
* @see {@link ISceneEventListener} for scene transition callbacks
|
|
122
|
+
* @see {@link AssetReference} for loading individual assets
|
|
123
|
+
* @see {@link NestedGltf} for embedding static glTF content
|
|
124
|
+
* @link https://engine.needle.tools/docs/how-to-guides/components/scene-switcher.html
|
|
114
125
|
*/
|
|
115
126
|
export class SceneSwitcher extends Behaviour {
|
|
116
127
|
|
|
@@ -61,19 +61,52 @@ export declare type ScreenCaptureOptions = {
|
|
|
61
61
|
deviceFilter?: (device: MediaDeviceInfo) => boolean,
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
64
|
+
/**
|
|
65
|
+
* ScreenCapture enables sharing screen, camera, or microphone with users in a networked room.
|
|
66
|
+
* The stream is displayed via a {@link VideoPlayer} component on the same GameObject.
|
|
67
|
+
*
|
|
68
|
+
* **Supported capture devices:**
|
|
69
|
+
* - `Screen` - Share desktop/window/tab
|
|
70
|
+
* - `Camera` - Share webcam feed
|
|
71
|
+
* - `Microphone` - Audio only
|
|
72
|
+
* - `Canvas` - Share the 3D canvas (experimental)
|
|
72
73
|
*
|
|
74
|
+
* 
|
|
75
|
+
*
|
|
76
|
+
* **How it works:**
|
|
77
|
+
* - Click the object to start/stop sharing (if `allowStartOnClick` is true)
|
|
78
|
+
* - Or call `share()` / `close()` programmatically
|
|
79
|
+
* - Stream is sent to all users in the same room via WebRTC
|
|
80
|
+
* - Receiving clients see the video on their VideoPlayer
|
|
81
|
+
*
|
|
82
|
+
* **Debug:** Append `?debugscreensharing` to the URL for console logging.
|
|
83
|
+
*
|
|
84
|
+
* @example Start screen sharing programmatically
|
|
85
|
+
* ```ts
|
|
86
|
+
* const capture = myScreen.getComponent(ScreenCapture);
|
|
87
|
+
* await capture?.share({ device: "Screen" });
|
|
88
|
+
*
|
|
89
|
+
* // Later, stop sharing
|
|
90
|
+
* capture?.close();
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example Share webcam with constraints
|
|
94
|
+
* ```ts
|
|
95
|
+
* await capture?.share({
|
|
96
|
+
* device: "Camera",
|
|
97
|
+
* constraints: { width: 1280, height: 720 }
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
73
101
|
* @summary Share screen, camera or microphone in a networked room
|
|
74
102
|
* @category Networking
|
|
103
|
+
* @category Multimedia
|
|
75
104
|
* @group Components
|
|
76
|
-
|
|
105
|
+
* @see {@link VideoPlayer} for displaying the received stream
|
|
106
|
+
* @see {@link Voip} for voice-only communication
|
|
107
|
+
* @see {@link SyncedRoom} for room management
|
|
108
|
+
* @link https://engine.needle.tools/docs/networking.html
|
|
109
|
+
*/
|
|
77
110
|
export class ScreenCapture extends Behaviour implements IPointerClickHandler {
|
|
78
111
|
|
|
79
112
|
/**
|
|
@@ -10,6 +10,8 @@ import { Behaviour } from "./Component.js";
|
|
|
10
10
|
import { IUSDExporterExtension } from "./export/usdz/Extension.js";
|
|
11
11
|
import { USDZExporter } from "./export/usdz/USDZExporter.js";
|
|
12
12
|
import { Renderer } from "./Renderer.js";
|
|
13
|
+
import type { Camera } from "./Camera.js";
|
|
14
|
+
import type { OrbitControls } from "./OrbitControls.js";
|
|
13
15
|
|
|
14
16
|
const debugSeeThrough = getParam("debugseethrough");
|
|
15
17
|
|
|
@@ -32,17 +34,82 @@ let i = 0;
|
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
37
|
+
* Automatically fades objects to transparent when they obscure a reference point from the camera's view.
|
|
38
|
+
* Perfect for architectural visualization, third-person games, or any scenario where objects should
|
|
39
|
+
* become see-through when blocking the view of important content.
|
|
40
|
+
*
|
|
41
|
+
* [](https://engine.needle.tools/samples/see-through)
|
|
42
|
+
*
|
|
43
|
+
* **How it works:**
|
|
44
|
+
* - Monitors the angle between the camera, this object, and a reference point
|
|
45
|
+
* - When the object blocks the view to the reference point, it fades out
|
|
46
|
+
* - Automatically affects all {@link Renderer} components on this object and children
|
|
47
|
+
* - Supports both transparent fading and alpha hash (dithered) fading
|
|
48
|
+
*
|
|
49
|
+
* **Key Features:**
|
|
50
|
+
* - Smooth fade transitions with configurable duration
|
|
51
|
+
* - Optional alpha hash for maintaining opaque rendering (better performance)
|
|
52
|
+
* - Automatic or manual update modes
|
|
53
|
+
* - Disables raycasting when faded (objects become click-through)
|
|
54
|
+
* - Preserves original material properties when re-enabled
|
|
55
|
+
*
|
|
56
|
+
* **Configuration:**
|
|
57
|
+
* - `referencePoint` - Object to keep visible (defaults to scene root)
|
|
58
|
+
* - `fadeDuration` - Transition speed (default: 0.05 seconds)
|
|
59
|
+
* - `minAlpha` - Minimum opacity when faded (default: 0 = fully transparent)
|
|
60
|
+
* - `useAlphaHash` - Use dithered transparency instead of true transparency (default: true)
|
|
61
|
+
*
|
|
62
|
+
* **Performance:**
|
|
63
|
+
* - Materials are cloned once per renderer to avoid affecting shared materials
|
|
64
|
+
* - Updates direction calculation every 20 frames by default (configurable via `autoUpdate`)
|
|
65
|
+
* - Use `needsUpdate = true` to force immediate recalculation
|
|
66
|
+
*
|
|
67
|
+
* **Requirements:**
|
|
68
|
+
* Requires at least one {@link Renderer} component on the same object or child objects.
|
|
69
|
+
*
|
|
70
|
+
* @example Make walls transparent when blocking view
|
|
71
|
+
* ```ts
|
|
72
|
+
* // Add to walls or obstacles
|
|
73
|
+
* const seeThrough = wall.addComponent(SeeThrough);
|
|
74
|
+
* seeThrough.referencePoint = player; // Keep player visible
|
|
75
|
+
* seeThrough.fadeDuration = 0.2; // Smooth fade
|
|
76
|
+
* seeThrough.minAlpha = 0.2; // Slightly visible when faded
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example Third-person camera with see-through objects
|
|
80
|
+
* ```ts
|
|
81
|
+
* const character = GameObject.findByName("Character");
|
|
82
|
+
* const obstacles = GameObject.findByTag("Obstacle");
|
|
83
|
+
*
|
|
84
|
+
* for (const obstacle of obstacles) {
|
|
85
|
+
* const st = obstacle.addComponent(SeeThrough);
|
|
86
|
+
* st.referencePoint = character;
|
|
87
|
+
* st.useAlphaHash = true; // Better performance
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @example Manual control of see-through effect
|
|
92
|
+
* ```ts
|
|
93
|
+
* const seeThrough = this.gameObject.getComponent(SeeThrough);
|
|
94
|
+
* if (seeThrough) {
|
|
95
|
+
* seeThrough.autoUpdate = false; // Disable automatic fading
|
|
96
|
+
*
|
|
97
|
+
* // Manually control transparency
|
|
98
|
+
* seeThrough.updateAlpha(0.5, 0.3); // Fade to 50% over 0.3 seconds
|
|
99
|
+
*
|
|
100
|
+
* // Or use override for precise control
|
|
101
|
+
* seeThrough.overrideAlpha = 0.8; // Force 80% opacity
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @summary Fades objects when they obscure the camera's view of a reference point
|
|
44
106
|
* @category Rendering
|
|
45
107
|
* @group Components
|
|
108
|
+
* @see {@link Renderer} for material/rendering control (required)
|
|
109
|
+
* @see {@link Camera} for camera setup and configuration
|
|
110
|
+
* @see {@link OrbitControls} for camera controls in similar use cases
|
|
111
|
+
* @link https://see-through-walls-z23hmxbz1kjfjn.needle.run/ for live demo
|
|
112
|
+
* @link https://engine.needle.tools/samples/see-through for sample project
|
|
46
113
|
*/
|
|
47
114
|
export class SeeThrough extends Behaviour {
|
|
48
115
|
|
|
@@ -4,6 +4,9 @@ import { ObjectUtils, PrimitiveType } from "../engine/engine_create_objects.js";
|
|
|
4
4
|
import { serializable } from "../engine/engine_serialization_decorator.js";
|
|
5
5
|
import { RGBAColor } from "../engine/js-extensions/index.js";
|
|
6
6
|
import { Behaviour } from "./Component.js";
|
|
7
|
+
import type { ContactShadows } from "./ContactShadows.js";
|
|
8
|
+
import type { Light } from "./Light.js";
|
|
9
|
+
import type { Renderer } from "./Renderer.js";
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* The mode of the ShadowCatcher.
|
|
@@ -18,14 +21,66 @@ enum ShadowMode {
|
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
|
-
* ShadowCatcher
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* ShadowCatcher renders real-time shadows cast by lights onto a mesh surface.
|
|
25
|
+
* Captures actual shadow data from the scene's lighting system (directional lights, point lights, spot lights).
|
|
26
|
+
*
|
|
27
|
+
* If the GameObject is a Mesh, it applies a shadow-catching material to it.
|
|
28
|
+
* Otherwise, it creates a quad mesh with the shadow-catching material automatically.
|
|
29
|
+
*
|
|
30
|
+
* [](https://engine.needle.tools/samples/shadow-catcher/)
|
|
31
|
+
* *Additive ShadowCatcher mode with point light shadows*
|
|
32
|
+
*
|
|
33
|
+
* [](https://engine.needle.tools/samples/transmission/)
|
|
34
|
+
* *ShadowCatcher with directional light shadows*
|
|
35
|
+
*
|
|
36
|
+
* **Shadow Modes:**
|
|
37
|
+
* - `ShadowMask` - Only renders shadows (works best with directional lights)
|
|
38
|
+
* - `Additive` - Renders light additively (works best with point/spot lights)
|
|
39
|
+
* - `Occluder` - Occludes light without rendering shadows
|
|
40
|
+
*
|
|
41
|
+
* **ShadowCatcher vs ContactShadows:**
|
|
42
|
+
* - **ShadowCatcher**: Real-time shadows from actual lights. Accurate directional shadows that match light sources. Requires lights with shadows enabled. Updates every frame.
|
|
43
|
+
* - **{@link ContactShadows}**: Proximity-based ambient occlusion-style shadows. Extremely soft and diffuse, ideal for subtle grounding. Better performance, works without lights.
|
|
44
|
+
*
|
|
45
|
+
* **When to use ShadowCatcher:**
|
|
46
|
+
* - You need accurate shadows that match specific light directions
|
|
47
|
+
* - Scene has real-time lighting with shadow-casting lights
|
|
48
|
+
* - Shadows need to follow light attenuation and angles
|
|
49
|
+
* - AR/VR scenarios where light estimation is available
|
|
50
|
+
* - Hard or semi-hard shadow edges are desired
|
|
51
|
+
*
|
|
52
|
+
* **When to use ContactShadows instead:**
|
|
53
|
+
* - You want very soft, ambient occlusion-style ground shadows
|
|
54
|
+
* - Performance is critical (no per-frame shadow rendering)
|
|
55
|
+
* - Scene doesn't have shadow-casting lights
|
|
56
|
+
* - Product visualization or configurators (subtle grounding effect)
|
|
57
|
+
* - Soft, diffuse shadows are more visually appealing than accurate ones
|
|
58
|
+
*
|
|
59
|
+
* **Note:** ShadowCatcher meshes are not raycastable by default (layer 2). Change layers in `onEnable()` if raycasting is needed.
|
|
60
|
+
*
|
|
61
|
+
* @example Basic shadow catcher plane
|
|
62
|
+
* ```ts
|
|
63
|
+
* const plane = new Object3D();
|
|
64
|
+
* const catcher = addComponent(plane, ShadowCatcher);
|
|
65
|
+
* catcher.mode = ShadowMode.ShadowMask;
|
|
66
|
+
* catcher.shadowColor = new RGBAColor(0, 0, 0, 0.8);
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @example Apply to existing mesh
|
|
70
|
+
* ```ts
|
|
71
|
+
* const mesh = this.gameObject.getComponent(Mesh);
|
|
72
|
+
* const catcher = addComponent(mesh, ShadowCatcher);
|
|
73
|
+
* // The mesh will now catch shadows from scene lights
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @summary Renders real-time shadows from lights onto surfaces
|
|
27
77
|
* @category Rendering
|
|
28
78
|
* @group Components
|
|
79
|
+
* @see {@link ContactShadows} for proximity-based fake shadows (better performance)
|
|
80
|
+
* @see {@link Light} for shadow-casting light configuration
|
|
81
|
+
* @see {@link Renderer} for shadow receiving settings
|
|
82
|
+
* @link https://engine.needle.tools/samples/shadow-catcher/
|
|
83
|
+
* @link https://engine.needle.tools/samples/transmission/
|
|
29
84
|
*/
|
|
30
85
|
export class ShadowCatcher extends Behaviour {
|
|
31
86
|
|
|
@@ -114,20 +114,52 @@ ContextRegistry.registerCallback(ContextEvent.ContextCreationStart, () => {
|
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
|
-
* RemoteSkybox
|
|
118
|
-
* It supports .hdr, .exr, .jpg, .png files.
|
|
119
|
-
*
|
|
117
|
+
* The [RemoteSkybox](https://engine.needle.tools/docs/api/RemoteSkybox) component allows you to set the skybox or environment texture of a scene from a URL, a local file or a static skybox name.
|
|
118
|
+
* It supports .hdr, .exr, .jpg, .png, and .ktx2 files.
|
|
119
|
+
*
|
|
120
|
+
* **HTML Attributes:**
|
|
121
|
+
* You can control skybox and environment from HTML using `<needle-engine>` attributes:
|
|
122
|
+
* - `background-image`: Sets the scene background/skybox image
|
|
123
|
+
* - `environment-image`: Sets the scene environment map (for reflections and lighting)
|
|
124
|
+
*
|
|
125
|
+
* These attributes accept URLs or magic skybox names (see examples below).
|
|
126
|
+
*
|
|
127
|
+
* **Magic Skybox Names:**
|
|
128
|
+
* Built-in optimized skyboxes hosted on Needle CDN:
|
|
129
|
+
* - `"studio"` - Neutral studio lighting (default)
|
|
130
|
+
* - `"blurred-skybox"` - Blurred environment
|
|
131
|
+
* - `"quicklook"` - Apple QuickLook object mode style
|
|
132
|
+
* - `"quicklook-ar"` - Apple QuickLook AR mode style
|
|
133
|
+
*
|
|
120
134
|
* ### Events
|
|
121
135
|
* - `dropped-unknown-url`: Emitted when a file is dropped on the scene. The event detail contains the sender, the url and a function to apply the url.
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
136
|
+
*
|
|
137
|
+
* @example Using HTML attributes
|
|
138
|
+
* ```html
|
|
139
|
+
* <needle-engine
|
|
140
|
+
* background-image="https://example.com/skybox.hdr"
|
|
141
|
+
* environment-image="studio">
|
|
142
|
+
* </needle-engine>
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* @example Using magic skybox names
|
|
146
|
+
* ```html
|
|
147
|
+
* <needle-engine background-image="studio"></needle-engine>
|
|
148
|
+
* <needle-engine environment-image="quicklook"></needle-engine>
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @example Adding via code
|
|
124
152
|
* ```ts
|
|
125
|
-
* GameObject.addComponent(gameObject,
|
|
153
|
+
* GameObject.addComponent(gameObject, RemoteSkybox, {
|
|
154
|
+
* url: "https://example.com/skybox.hdr",
|
|
155
|
+
* background: true,
|
|
156
|
+
* environment: true
|
|
157
|
+
* });
|
|
126
158
|
* ```
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
159
|
+
*
|
|
160
|
+
* @example Handle custom dropped URL
|
|
129
161
|
* ```ts
|
|
130
|
-
* const skybox = GameObject.addComponent(gameObject,
|
|
162
|
+
* const skybox = GameObject.addComponent(gameObject, RemoteSkybox);
|
|
131
163
|
* skybox.addEventListener("dropped-unknown-url", (evt) => {
|
|
132
164
|
* let url = evt.detail.url;
|
|
133
165
|
* console.log("User dropped file", url);
|
|
@@ -137,15 +169,19 @@ ContextRegistry.registerCallback(ContextEvent.ContextCreationStart, () => {
|
|
|
137
169
|
* evt.detail.apply(url);
|
|
138
170
|
* });
|
|
139
171
|
* ```
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
172
|
+
*
|
|
173
|
+
* @example Update skybox at runtime
|
|
142
174
|
* ```ts
|
|
143
175
|
* skybox.setSkybox("https://example.com/skybox.hdr");
|
|
176
|
+
* // Or use a magic name:
|
|
177
|
+
* skybox.setSkybox("studio");
|
|
144
178
|
* ```
|
|
145
|
-
*
|
|
179
|
+
*
|
|
146
180
|
* @summary Sets the skybox or environment texture of a scene
|
|
147
181
|
* @category Rendering
|
|
148
182
|
* @group Components
|
|
183
|
+
* @see {@link Camera} for clearFlags and background control
|
|
184
|
+
* @link https://engine.needle.tools/docs/html.html#needle-engine-element
|
|
149
185
|
*/
|
|
150
186
|
export class RemoteSkybox extends Behaviour {
|
|
151
187
|
|