@needle-tools/engine 4.11.4 → 4.11.5-next.4201116
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 -0
- package/components.needle.json +1 -1
- package/dist/generateMeshBVH.worker-mO20N_b8.js +21 -0
- package/dist/{gltf-progressive-GwdQV1Qx.umd.cjs → gltf-progressive-DWcmTMCh.umd.cjs} +1 -1
- package/dist/{gltf-progressive-CftVUJy3.min.js → gltf-progressive-DZrY8VT6.min.js} +2 -2
- package/dist/{gltf-progressive-BvlZQAkt.js → gltf-progressive-DgYz5BYa.js} +19 -19
- package/dist/loader.worker-Dip-PthR.js +23 -0
- package/dist/{needle-engine.bundle-BxK1-fWD.umd.cjs → needle-engine.bundle-Cb9DQNr9.umd.cjs} +155 -160
- package/dist/{needle-engine.bundle-DmMrUPFQ.js → needle-engine.bundle-D2l0lwCn.js} +6509 -6332
- package/dist/{needle-engine.bundle-CQdk7IvU.min.js → needle-engine.bundle-DaoW7sFK.min.js} +162 -167
- package/dist/needle-engine.d.ts +18189 -1
- package/dist/needle-engine.js +336 -335
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-CJC0Npcd.js → postprocessing-BTW9pD_s.js} +1822 -1723
- package/dist/{postprocessing-DrM4PWU3.umd.cjs → postprocessing-CMgoN5t5.umd.cjs} +229 -158
- package/dist/{postprocessing-l7zsdO_Q.min.js → postprocessing-DYDtB188.min.js} +227 -156
- package/dist/rapier-B3oL1ap-.js +5217 -0
- package/dist/rapier-DJ-luMxr.min.js +1 -0
- package/dist/rapier-DQltNJbN.umd.cjs +1 -0
- package/dist/{three-BDW9I486.min.js → three-B7CT31Bt.min.js} +1 -5
- package/dist/{three-MHVqtJYj.js → three-DfMvBzXi.js} +0 -5
- package/dist/{three-examples-CgwGHSgz.umd.cjs → three-examples-CsW4_6LI.umd.cjs} +2 -7
- package/dist/{three-examples-fvEPSC8L.min.js → three-examples-D1P7eEhn.min.js} +2 -7
- package/dist/{three-examples-C5Ht-QFN.js → three-examples-D1SK93ek.js} +1 -7
- package/dist/{three-mesh-ui-BjWTTk1R.js → three-mesh-ui-C_uSB5dD.js} +1 -1
- package/dist/{three-mesh-ui-Bm32sS2a.umd.cjs → three-mesh-ui-DpATDXwU.umd.cjs} +1 -1
- package/dist/{three-mesh-ui-CLdkp21K.min.js → three-mesh-ui-LQ44s0AL.min.js} +1 -1
- package/dist/{three-iFaDq9U3.umd.cjs → three-qj71I7J3.umd.cjs} +2 -6
- package/dist/{vendor-CsyK1CFs.min.js → vendor-BKGa4GE0.min.js} +34 -39
- package/dist/{vendor-petGQl0N.js → vendor-D0zoswDa.js} +1626 -1605
- package/dist/{vendor-6kAXU6fm.umd.cjs → vendor-UCpFAwt1.umd.cjs} +30 -35
- package/lib/engine/api.d.ts +1 -1
- package/lib/engine/api.js +1 -1
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/debug/debug_spector.d.ts +16 -0
- package/lib/engine/debug/debug_spector.js +28 -0
- package/lib/engine/debug/debug_spector.js.map +1 -0
- package/lib/engine/engine_addressables.d.ts +74 -11
- package/lib/engine/engine_addressables.js +74 -11
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_application.d.ts +7 -0
- package/lib/engine/engine_application.js +8 -1
- package/lib/engine/engine_application.js.map +1 -1
- package/lib/engine/engine_camera.fit.d.ts +48 -3
- package/lib/engine/engine_camera.fit.js +29 -0
- package/lib/engine/engine_camera.fit.js.map +1 -1
- package/lib/engine/engine_context.d.ts +33 -8
- package/lib/engine/engine_context.js +47 -8
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_loaders.d.ts +0 -6
- package/lib/engine/engine_loaders.js +5 -5
- package/lib/engine/engine_loaders.js.map +1 -1
- package/lib/engine/engine_physics.js +6 -2
- package/lib/engine/engine_physics.js.map +1 -1
- package/lib/engine/engine_physics_rapier.d.ts +11 -2
- package/lib/engine/engine_physics_rapier.js +9 -0
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine/engine_scenelighting.d.ts +12 -1
- package/lib/engine/engine_scenelighting.js +21 -1
- package/lib/engine/engine_scenelighting.js.map +1 -1
- package/lib/engine/engine_texture.d.ts +1 -1
- package/lib/engine/engine_tonemapping.d.ts +1 -1
- package/lib/engine/engine_types.d.ts +16 -0
- package/lib/engine/engine_typestore.d.ts +1 -0
- package/lib/engine/engine_typestore.js +5 -6
- package/lib/engine/engine_typestore.js.map +1 -1
- package/lib/engine/engine_utils_qrcode.js +1 -1
- package/lib/engine/engine_utils_qrcode.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_components.d.ts +4 -4
- package/lib/engine/extensions/NEEDLE_components.js +36 -17
- package/lib/engine/extensions/NEEDLE_components.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_lightmaps.js +2 -2
- package/lib/engine/extensions/NEEDLE_lightmaps.js.map +1 -1
- package/lib/engine/extensions/extensions.d.ts +2 -2
- package/lib/engine/extensions/extensions.js +11 -5
- package/lib/engine/extensions/extensions.js.map +1 -1
- package/lib/engine/webcomponents/buttons.d.ts +3 -1
- package/lib/engine/webcomponents/buttons.js +3 -1
- package/lib/engine/webcomponents/buttons.js.map +1 -1
- package/lib/engine/webcomponents/logo-element.d.ts +11 -0
- package/lib/engine/webcomponents/logo-element.js +6 -0
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +63 -5
- package/lib/engine/webcomponents/needle menu/needle-menu.js +57 -5
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-button.d.ts +5 -0
- package/lib/engine/webcomponents/needle-button.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.attributes.d.ts +11 -2
- package/lib/engine/webcomponents/needle-engine.d.ts +162 -8
- package/lib/engine/webcomponents/needle-engine.js +33 -7
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.js +2 -1
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine-components/AlignmentConstraint.d.ts +9 -0
- package/lib/engine-components/AlignmentConstraint.js +9 -0
- package/lib/engine-components/AlignmentConstraint.js.map +1 -1
- package/lib/engine-components/Animator.d.ts +1 -0
- package/lib/engine-components/Animator.js.map +1 -1
- package/lib/engine-components/AudioListener.d.ts +2 -0
- package/lib/engine-components/AudioListener.js +2 -0
- package/lib/engine-components/AudioListener.js.map +1 -1
- package/lib/engine-components/AudioSource.d.ts +1 -0
- package/lib/engine-components/AudioSource.js +1 -0
- package/lib/engine-components/AudioSource.js.map +1 -1
- package/lib/engine-components/AxesHelper.d.ts +2 -0
- package/lib/engine-components/AxesHelper.js +2 -0
- package/lib/engine-components/AxesHelper.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +1 -0
- package/lib/engine-components/Camera.js +1 -0
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/CharacterController.d.ts +4 -1
- package/lib/engine-components/CharacterController.js +4 -1
- package/lib/engine-components/CharacterController.js.map +1 -1
- package/lib/engine-components/Component.d.ts +5 -0
- package/lib/engine-components/Component.js +7 -0
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/DeleteBox.d.ts +2 -0
- package/lib/engine-components/DeleteBox.js +2 -0
- package/lib/engine-components/DeleteBox.js.map +1 -1
- package/lib/engine-components/DeviceFlag.d.ts +4 -0
- package/lib/engine-components/DeviceFlag.js +4 -0
- package/lib/engine-components/DeviceFlag.js.map +1 -1
- package/lib/engine-components/DragControls.d.ts +1 -0
- package/lib/engine-components/DragControls.js +1 -0
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/DropListener.d.ts +1 -0
- package/lib/engine-components/DropListener.js +1 -0
- package/lib/engine-components/DropListener.js.map +1 -1
- package/lib/engine-components/Duplicatable.d.ts +1 -0
- package/lib/engine-components/Duplicatable.js +1 -0
- package/lib/engine-components/Duplicatable.js.map +1 -1
- package/lib/engine-components/EventTrigger.d.ts +2 -0
- package/lib/engine-components/EventTrigger.js +2 -0
- package/lib/engine-components/EventTrigger.js.map +1 -1
- package/lib/engine-components/GridHelper.d.ts +2 -0
- package/lib/engine-components/GridHelper.js +2 -0
- package/lib/engine-components/GridHelper.js.map +1 -1
- package/lib/engine-components/GroundProjection.d.ts +1 -0
- package/lib/engine-components/GroundProjection.js +1 -0
- package/lib/engine-components/GroundProjection.js.map +1 -1
- package/lib/engine-components/LODGroup.d.ts +2 -0
- package/lib/engine-components/LODGroup.js +2 -0
- package/lib/engine-components/LODGroup.js.map +1 -1
- package/lib/engine-components/Light.d.ts +1 -0
- package/lib/engine-components/Light.js +1 -0
- package/lib/engine-components/Light.js.map +1 -1
- package/lib/engine-components/LookAtConstraint.d.ts +1 -0
- package/lib/engine-components/LookAtConstraint.js +1 -0
- package/lib/engine-components/LookAtConstraint.js.map +1 -1
- package/lib/engine-components/NeedleMenu.d.ts +1 -0
- package/lib/engine-components/NeedleMenu.js +1 -0
- package/lib/engine-components/NeedleMenu.js.map +1 -1
- package/lib/engine-components/NestedGltf.d.ts +1 -0
- package/lib/engine-components/NestedGltf.js +1 -0
- package/lib/engine-components/NestedGltf.js.map +1 -1
- package/lib/engine-components/Networking.d.ts +1 -0
- package/lib/engine-components/Networking.js +1 -0
- package/lib/engine-components/Networking.js.map +1 -1
- package/lib/engine-components/OffsetConstraint.d.ts +7 -0
- package/lib/engine-components/OffsetConstraint.js +7 -0
- package/lib/engine-components/OffsetConstraint.js.map +1 -1
- package/lib/engine-components/OrbitControls.d.ts +1 -0
- package/lib/engine-components/OrbitControls.js +1 -0
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/PlayerColor.d.ts +2 -0
- package/lib/engine-components/PlayerColor.js +2 -0
- package/lib/engine-components/PlayerColor.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.d.ts +1 -0
- package/lib/engine-components/ReflectionProbe.js +17 -10
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/Renderer.js +16 -42
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/RendererInstancing.d.ts +5 -3
- package/lib/engine-components/RendererInstancing.js +64 -31
- package/lib/engine-components/RendererInstancing.js.map +1 -1
- package/lib/engine-components/RendererLightmap.d.ts +1 -0
- package/lib/engine-components/RendererLightmap.js +24 -18
- package/lib/engine-components/RendererLightmap.js.map +1 -1
- package/lib/engine-components/RigidBody.d.ts +1 -0
- package/lib/engine-components/RigidBody.js +1 -0
- package/lib/engine-components/RigidBody.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.d.ts +1 -0
- package/lib/engine-components/SceneSwitcher.js +1 -0
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/ScreenCapture.d.ts +1 -0
- package/lib/engine-components/ScreenCapture.js +1 -0
- package/lib/engine-components/ScreenCapture.js.map +1 -1
- package/lib/engine-components/SeeThrough.d.ts +1 -0
- package/lib/engine-components/SeeThrough.js +1 -0
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/ShadowCatcher.d.ts +2 -0
- package/lib/engine-components/ShadowCatcher.js +2 -0
- package/lib/engine-components/ShadowCatcher.js.map +1 -1
- package/lib/engine-components/Skybox.d.ts +16 -5
- package/lib/engine-components/Skybox.js +38 -25
- package/lib/engine-components/Skybox.js.map +1 -1
- package/lib/engine-components/SmoothFollow.d.ts +1 -0
- package/lib/engine-components/SmoothFollow.js +1 -0
- package/lib/engine-components/SmoothFollow.js.map +1 -1
- package/lib/engine-components/SpatialTrigger.d.ts +1 -0
- package/lib/engine-components/SpatialTrigger.js +1 -0
- package/lib/engine-components/SpatialTrigger.js.map +1 -1
- package/lib/engine-components/SpectatorCamera.d.ts +1 -0
- package/lib/engine-components/SpectatorCamera.js +1 -0
- package/lib/engine-components/SpectatorCamera.js.map +1 -1
- package/lib/engine-components/SpriteRenderer.d.ts +1 -0
- package/lib/engine-components/SpriteRenderer.js +1 -0
- package/lib/engine-components/SpriteRenderer.js.map +1 -1
- package/lib/engine-components/SyncedCamera.d.ts +2 -0
- package/lib/engine-components/SyncedCamera.js +2 -0
- package/lib/engine-components/SyncedCamera.js.map +1 -1
- package/lib/engine-components/SyncedRoom.d.ts +1 -0
- package/lib/engine-components/SyncedRoom.js +1 -0
- package/lib/engine-components/SyncedRoom.js.map +1 -1
- package/lib/engine-components/SyncedTransform.d.ts +2 -0
- package/lib/engine-components/SyncedTransform.js +2 -0
- package/lib/engine-components/SyncedTransform.js.map +1 -1
- package/lib/engine-components/TransformGizmo.d.ts +2 -0
- package/lib/engine-components/TransformGizmo.js +2 -0
- package/lib/engine-components/TransformGizmo.js.map +1 -1
- package/lib/engine-components/VideoPlayer.d.ts +1 -0
- package/lib/engine-components/VideoPlayer.js +1 -0
- package/lib/engine-components/VideoPlayer.js.map +1 -1
- package/lib/engine-components/Voip.d.ts +1 -0
- package/lib/engine-components/Voip.js +1 -0
- package/lib/engine-components/Voip.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.d.ts +24 -3
- package/lib/engine-components/export/usdz/USDZExporter.js +36 -2
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +18 -0
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +18 -0
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
- package/lib/engine-components/particlesystem/ParticleSystem.d.ts +1 -0
- package/lib/engine-components/particlesystem/ParticleSystem.js +1 -0
- package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
- package/lib/engine-components/physics/Attractor.d.ts +3 -0
- package/lib/engine-components/physics/Attractor.js +3 -0
- package/lib/engine-components/physics/Attractor.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +1 -0
- package/lib/engine-components/postprocessing/Effects/BloomEffect.js +1 -0
- package/lib/engine-components/postprocessing/Effects/BloomEffect.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.d.ts +4 -0
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js +4 -0
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +3 -0
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +3 -0
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/DepthOfField.d.ts +4 -0
- package/lib/engine-components/postprocessing/Effects/DepthOfField.js +4 -0
- package/lib/engine-components/postprocessing/Effects/DepthOfField.js.map +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 +3 -0
- package/lib/engine-components/postprocessing/Effects/Pixelation.js +3 -0
- package/lib/engine-components/postprocessing/Effects/Pixelation.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.d.ts +4 -0
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js +4 -0
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +4 -0
- package/lib/engine-components/postprocessing/Effects/Sharpening.js +4 -0
- package/lib/engine-components/postprocessing/Effects/Sharpening.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.d.ts +4 -0
- package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js +4 -0
- package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +4 -0
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js +4 -0
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Vignette.d.ts +4 -0
- package/lib/engine-components/postprocessing/Effects/Vignette.js +4 -0
- package/lib/engine-components/postprocessing/Effects/Vignette.js.map +1 -1
- package/lib/engine-components/postprocessing/Volume.d.ts +1 -0
- package/lib/engine-components/postprocessing/Volume.js +1 -0
- package/lib/engine-components/postprocessing/Volume.js.map +1 -1
- package/lib/engine-components/splines/Spline.d.ts +1 -0
- package/lib/engine-components/splines/Spline.js +1 -0
- package/lib/engine-components/splines/Spline.js.map +1 -1
- package/lib/engine-components/splines/SplineWalker.d.ts +1 -0
- package/lib/engine-components/splines/SplineWalker.js +1 -0
- package/lib/engine-components/splines/SplineWalker.js.map +1 -1
- package/lib/engine-components/timeline/PlayableDirector.d.ts +3 -1
- package/lib/engine-components/timeline/PlayableDirector.js +17 -9
- package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
- package/lib/engine-components/timeline/SignalAsset.d.ts +1 -0
- package/lib/engine-components/timeline/SignalAsset.js +1 -0
- package/lib/engine-components/timeline/SignalAsset.js.map +1 -1
- package/lib/engine-components/ui/Button.d.ts +4 -0
- package/lib/engine-components/ui/Button.js +4 -0
- package/lib/engine-components/ui/Button.js.map +1 -1
- package/lib/engine-components/ui/Canvas.d.ts +5 -0
- package/lib/engine-components/ui/Canvas.js +5 -0
- package/lib/engine-components/ui/Canvas.js.map +1 -1
- package/lib/engine-components/ui/CanvasGroup.d.ts +4 -0
- package/lib/engine-components/ui/CanvasGroup.js +4 -0
- package/lib/engine-components/ui/CanvasGroup.js.map +1 -1
- package/lib/engine-components/ui/EventSystem.d.ts +2 -0
- package/lib/engine-components/ui/EventSystem.js +2 -0
- package/lib/engine-components/ui/EventSystem.js.map +1 -1
- package/lib/engine-components/ui/Image.d.ts +4 -0
- package/lib/engine-components/ui/Image.js +4 -0
- package/lib/engine-components/ui/Image.js.map +1 -1
- package/lib/engine-components/ui/InputField.d.ts +4 -0
- package/lib/engine-components/ui/InputField.js +4 -0
- package/lib/engine-components/ui/InputField.js.map +1 -1
- package/lib/engine-components/ui/Outline.d.ts +7 -0
- package/lib/engine-components/ui/Outline.js +7 -0
- package/lib/engine-components/ui/Outline.js.map +1 -1
- package/lib/engine-components/ui/Text.d.ts +1 -0
- package/lib/engine-components/ui/Text.js +1 -0
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/lib/engine-components/utils/LookAt.d.ts +1 -0
- package/lib/engine-components/utils/LookAt.js +1 -0
- package/lib/engine-components/utils/LookAt.js.map +1 -1
- package/lib/engine-components/web/Clickthrough.d.ts +1 -1
- package/lib/engine-components/web/Clickthrough.js +1 -1
- package/lib/engine-components/web/CursorFollow.d.ts +2 -0
- package/lib/engine-components/web/CursorFollow.js +3 -0
- package/lib/engine-components/web/CursorFollow.js.map +1 -1
- package/lib/engine-components/web/HoverAnimation.d.ts +1 -0
- package/lib/engine-components/web/HoverAnimation.js +1 -0
- package/lib/engine-components/web/HoverAnimation.js.map +1 -1
- package/lib/engine-components/web/ScrollFollow.d.ts +2 -0
- package/lib/engine-components/web/ScrollFollow.js +2 -0
- package/lib/engine-components/web/ScrollFollow.js.map +1 -1
- package/lib/engine-components/web/ViewBox.d.ts +1 -0
- package/lib/engine-components/web/ViewBox.js +1 -0
- package/lib/engine-components/web/ViewBox.js.map +1 -1
- package/lib/engine-components/webxr/Avatar.d.ts +5 -0
- package/lib/engine-components/webxr/Avatar.js +5 -0
- package/lib/engine-components/webxr/Avatar.js.map +1 -1
- package/lib/engine-components/webxr/WebARCameraBackground.d.ts +1 -0
- package/lib/engine-components/webxr/WebARCameraBackground.js +1 -0
- package/lib/engine-components/webxr/WebARCameraBackground.js.map +1 -1
- package/lib/engine-components/webxr/WebARSessionRoot.d.ts +1 -0
- package/lib/engine-components/webxr/WebARSessionRoot.js +1 -0
- package/lib/engine-components/webxr/WebARSessionRoot.js.map +1 -1
- package/lib/engine-components/webxr/WebXR.d.ts +1 -1
- package/lib/engine-components/webxr/WebXR.js +5 -1
- package/lib/engine-components/webxr/WebXR.js.map +1 -1
- package/lib/engine-components/webxr/controllers/XRControllerFollow.d.ts +1 -0
- package/lib/engine-components/webxr/controllers/XRControllerFollow.js +1 -0
- package/lib/engine-components/webxr/controllers/XRControllerFollow.js.map +1 -1
- package/lib/engine-components/webxr/controllers/XRControllerModel.d.ts +4 -0
- package/lib/engine-components/webxr/controllers/XRControllerModel.js +5 -1
- package/lib/engine-components/webxr/controllers/XRControllerModel.js.map +1 -1
- package/lib/engine-components/webxr/controllers/XRControllerMovement.d.ts +1 -0
- package/lib/engine-components/webxr/controllers/XRControllerMovement.js +1 -0
- package/lib/engine-components/webxr/controllers/XRControllerMovement.js.map +1 -1
- package/lib/engine-components-experimental/networking/PlayerSync.d.ts +2 -0
- package/lib/engine-components-experimental/networking/PlayerSync.js +2 -0
- package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
- package/lib/needle-engine.js +2 -1
- package/lib/needle-engine.js.map +1 -1
- package/package.json +18 -12
- package/plugins/types/needleConfig.d.ts +1 -1
- package/plugins/types/next.d.ts +1 -1
- package/plugins/types/userconfig.d.ts +1 -1
- package/src/engine/api.ts +1 -1
- package/src/engine/debug/debug_spector.ts +43 -0
- package/src/engine/engine_addressables.ts +75 -11
- package/src/engine/engine_application.ts +16 -1
- package/src/engine/engine_camera.fit.ts +49 -4
- package/src/engine/engine_context.ts +59 -10
- package/src/engine/engine_loaders.ts +6 -6
- package/src/engine/engine_physics.ts +6 -2
- package/src/engine/engine_physics_rapier.ts +11 -2
- package/src/engine/engine_scenelighting.ts +30 -8
- package/src/engine/engine_texture.ts +1 -1
- package/src/engine/engine_tonemapping.ts +1 -1
- package/src/engine/engine_types.ts +17 -0
- package/src/engine/engine_typestore.ts +5 -6
- package/src/engine/engine_utils_qrcode.ts +1 -1
- package/src/engine/extensions/NEEDLE_components.ts +47 -26
- package/src/engine/extensions/NEEDLE_lightmaps.ts +2 -2
- package/src/engine/extensions/extensions.ts +11 -5
- package/src/engine/webcomponents/buttons.ts +3 -1
- package/src/engine/webcomponents/logo-element.ts +12 -0
- package/src/engine/webcomponents/needle menu/needle-menu.ts +64 -6
- package/src/engine/webcomponents/needle-button.ts +6 -0
- package/src/engine/webcomponents/needle-engine.attributes.ts +12 -3
- package/src/engine/webcomponents/needle-engine.ts +165 -13
- package/src/engine/xr/NeedleXRSession.ts +3 -1
- package/src/engine-components/AlignmentConstraint.ts +9 -0
- package/src/engine-components/Animator.ts +1 -0
- package/src/engine-components/AudioListener.ts +2 -0
- package/src/engine-components/AudioSource.ts +1 -0
- package/src/engine-components/AxesHelper.ts +2 -0
- package/src/engine-components/Camera.ts +1 -0
- package/src/engine-components/CharacterController.ts +4 -1
- package/src/engine-components/Component.ts +9 -1
- package/src/engine-components/DeleteBox.ts +2 -0
- package/src/engine-components/DeviceFlag.ts +4 -0
- package/src/engine-components/DragControls.ts +1 -0
- package/src/engine-components/DropListener.ts +1 -0
- package/src/engine-components/Duplicatable.ts +1 -0
- package/src/engine-components/EventTrigger.ts +2 -0
- package/src/engine-components/GridHelper.ts +2 -0
- package/src/engine-components/GroundProjection.ts +1 -0
- package/src/engine-components/LODGroup.ts +2 -0
- package/src/engine-components/Light.ts +1 -0
- package/src/engine-components/LookAtConstraint.ts +1 -0
- package/src/engine-components/NeedleMenu.ts +1 -0
- package/src/engine-components/NestedGltf.ts +1 -0
- package/src/engine-components/Networking.ts +1 -0
- package/src/engine-components/OffsetConstraint.ts +7 -0
- package/src/engine-components/OrbitControls.ts +1 -0
- package/src/engine-components/PlayerColor.ts +2 -0
- package/src/engine-components/ReflectionProbe.ts +19 -10
- package/src/engine-components/Renderer.ts +16 -44
- package/src/engine-components/RendererInstancing.ts +69 -33
- package/src/engine-components/RendererLightmap.ts +27 -17
- package/src/engine-components/RigidBody.ts +1 -0
- package/src/engine-components/SceneSwitcher.ts +1 -0
- package/src/engine-components/ScreenCapture.ts +1 -0
- package/src/engine-components/SeeThrough.ts +1 -0
- package/src/engine-components/ShadowCatcher.ts +2 -0
- package/src/engine-components/Skybox.ts +48 -36
- package/src/engine-components/SmoothFollow.ts +1 -0
- package/src/engine-components/SpatialTrigger.ts +1 -0
- package/src/engine-components/SpectatorCamera.ts +1 -0
- package/src/engine-components/SpriteRenderer.ts +1 -0
- package/src/engine-components/SyncedCamera.ts +2 -0
- package/src/engine-components/SyncedRoom.ts +1 -0
- package/src/engine-components/SyncedTransform.ts +2 -0
- package/src/engine-components/TransformGizmo.ts +2 -0
- package/src/engine-components/VideoPlayer.ts +1 -0
- package/src/engine-components/Voip.ts +1 -0
- package/src/engine-components/export/usdz/USDZExporter.ts +52 -5
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +18 -0
- package/src/engine-components/particlesystem/ParticleSystem.ts +1 -0
- package/src/engine-components/physics/Attractor.ts +3 -0
- package/src/engine-components/postprocessing/Effects/BloomEffect.ts +1 -0
- package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +4 -0
- package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +3 -0
- package/src/engine-components/postprocessing/Effects/DepthOfField.ts +4 -0
- package/src/engine-components/postprocessing/Effects/EffectWrapper.ts +1 -0
- package/src/engine-components/postprocessing/Effects/Pixelation.ts +3 -0
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +4 -0
- package/src/engine-components/postprocessing/Effects/Sharpening.ts +4 -0
- package/src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +4 -0
- package/src/engine-components/postprocessing/Effects/Tonemapping.ts +4 -0
- package/src/engine-components/postprocessing/Effects/Vignette.ts +4 -0
- package/src/engine-components/postprocessing/Volume.ts +1 -0
- package/src/engine-components/splines/Spline.ts +1 -0
- package/src/engine-components/splines/SplineWalker.ts +1 -0
- package/src/engine-components/timeline/PlayableDirector.ts +17 -10
- package/src/engine-components/timeline/SignalAsset.ts +1 -0
- package/src/engine-components/ui/Button.ts +4 -0
- package/src/engine-components/ui/Canvas.ts +5 -0
- package/src/engine-components/ui/CanvasGroup.ts +4 -0
- package/src/engine-components/ui/EventSystem.ts +2 -0
- package/src/engine-components/ui/Image.ts +4 -0
- package/src/engine-components/ui/InputField.ts +4 -0
- package/src/engine-components/ui/Outline.ts +7 -0
- package/src/engine-components/ui/Text.ts +1 -0
- package/src/engine-components/utils/LookAt.ts +1 -0
- package/src/engine-components/web/Clickthrough.ts +1 -1
- package/src/engine-components/web/CursorFollow.ts +4 -0
- package/src/engine-components/web/HoverAnimation.ts +1 -0
- package/src/engine-components/web/ScrollFollow.ts +2 -0
- package/src/engine-components/web/ViewBox.ts +1 -0
- package/src/engine-components/webxr/Avatar.ts +5 -0
- package/src/engine-components/webxr/WebARCameraBackground.ts +1 -0
- package/src/engine-components/webxr/WebARSessionRoot.ts +1 -0
- package/src/engine-components/webxr/WebXR.ts +5 -1
- package/src/engine-components/webxr/controllers/XRControllerFollow.ts +1 -0
- package/src/engine-components/webxr/controllers/XRControllerModel.ts +5 -1
- package/src/engine-components/webxr/controllers/XRControllerMovement.ts +1 -0
- package/src/engine-components-experimental/networking/PlayerSync.ts +2 -0
- package/src/needle-engine.ts +4 -2
- package/dist/generateMeshBVH.worker-B9bjdr6J.js +0 -25
- package/dist/loader.worker-CiTwpNPW.js +0 -27
- package/dist/rapier-BqdcSmKY.umd.cjs +0 -1
- package/dist/rapier-Cg3w3nFI.min.js +0 -1
- package/dist/rapier-sU12SWAs.js +0 -5217
package/package.json
CHANGED
|
@@ -1,27 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/engine",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.5-next.4201116",
|
|
4
4
|
"description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.",
|
|
5
5
|
"main": "dist/needle-engine.min.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
+
"types": "./dist/needle-engine.d.ts",
|
|
8
9
|
"import": "./lib/needle-engine.js",
|
|
9
10
|
"require": "./dist/needle-engine.umd.cjs"
|
|
10
11
|
},
|
|
11
12
|
"./package.json": "./package.json",
|
|
13
|
+
"./components.json": "./components.needle.json",
|
|
12
14
|
"./asap": "./lib/asap/needle-asap.js",
|
|
13
15
|
"./vite": {
|
|
14
|
-
"types": "./plugins/types/vite.d.
|
|
16
|
+
"types": "./plugins/types/vite.d.ts",
|
|
15
17
|
"import": "./plugins/vite/index.js",
|
|
16
18
|
"require": "./plugins/vite/index.js"
|
|
17
19
|
},
|
|
18
20
|
"./next": {
|
|
19
|
-
"types": "./plugins/types/next.d.
|
|
21
|
+
"types": "./plugins/types/next.d.ts",
|
|
20
22
|
"import": "./plugins/next/index.js",
|
|
21
23
|
"require": "./plugins/next/index.js"
|
|
22
24
|
},
|
|
23
|
-
"./plugins/vite/index.js":
|
|
24
|
-
|
|
25
|
+
"./plugins/vite/index.js": {
|
|
26
|
+
"types": "./plugins/types/vite.d.ts",
|
|
27
|
+
"default": "./plugins/vite/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./plugins/next/index.js": {
|
|
30
|
+
"types": "./plugins/types/next.d.ts",
|
|
31
|
+
"default": "./plugins/next/index.js"
|
|
32
|
+
}
|
|
25
33
|
},
|
|
26
34
|
"type": "module",
|
|
27
35
|
"repository": {
|
|
@@ -48,6 +56,8 @@
|
|
|
48
56
|
"test": "node plugins/test/test.mjs",
|
|
49
57
|
"test:circular-imports": "node plugins/test/check-circular-imports.mjs",
|
|
50
58
|
"test:tsc": "tsc --strict false && tsc --strict true",
|
|
59
|
+
"test:attw": "npx --yes @arethetypeswrong/cli --pack dist",
|
|
60
|
+
"generate:custom-elements": "npx web-component-analyzer src --format vscode --outFile custom-elements.json && node scripts/clean-wca-json.mjs",
|
|
51
61
|
"lint": "eslint --ext .ts src",
|
|
52
62
|
"lint:fix": "eslint --ext .ts src --fix",
|
|
53
63
|
"stats": "howfat ."
|
|
@@ -60,11 +70,6 @@
|
|
|
60
70
|
"src",
|
|
61
71
|
"lib",
|
|
62
72
|
"dist",
|
|
63
|
-
"dist/needle-engine.js",
|
|
64
|
-
"dist/needle-engine.d.ts",
|
|
65
|
-
"dist/needle-engine.umd.cjs",
|
|
66
|
-
"dist/needle-engine.min.js",
|
|
67
|
-
"dist/needle-engine.light.min.js",
|
|
68
73
|
"plugins",
|
|
69
74
|
"components.needle.json"
|
|
70
75
|
],
|
|
@@ -141,7 +146,7 @@
|
|
|
141
146
|
"npm-watch": "^0.11.0",
|
|
142
147
|
"typescript": "^4.5.5",
|
|
143
148
|
"vite": "7",
|
|
144
|
-
"vite-plugin-dts": "^4.5.
|
|
149
|
+
"vite-plugin-dts": "^4.5.4"
|
|
145
150
|
},
|
|
146
151
|
"peerDependencies": {
|
|
147
152
|
"open": "^10.1.0"
|
|
@@ -166,7 +171,8 @@
|
|
|
166
171
|
"quiet": false
|
|
167
172
|
}
|
|
168
173
|
},
|
|
174
|
+
"customElements": "./custom-elements.json",
|
|
169
175
|
"module": "lib/needle-engine.js",
|
|
170
176
|
"typings": "lib/needle-engine.d.ts",
|
|
171
177
|
"types": "lib/needle-engine.d.ts"
|
|
172
|
-
}
|
|
178
|
+
}
|
package/plugins/types/next.d.ts
CHANGED
package/src/engine/api.ts
CHANGED
|
@@ -75,8 +75,8 @@ export { registerType, TypeStore } from "./engine_typestore.js";
|
|
|
75
75
|
export { prefix, validate } from "./engine_util_decorator.js";
|
|
76
76
|
export * from "./engine_utils.js";
|
|
77
77
|
export * from "./engine_utils_format.js";
|
|
78
|
-
export * from "./engine_utils_screenshot.js";
|
|
79
78
|
export { generateQRCode } from "./engine_utils_qrcode.js";
|
|
79
|
+
export * from "./engine_utils_screenshot.js";
|
|
80
80
|
export * from "./export/index.js";
|
|
81
81
|
export * from "./extensions/index.js";
|
|
82
82
|
export * from "./js-extensions/index.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Context } from "../engine_setup.js";
|
|
2
|
+
import { isDevEnvironment } from "./debug.js";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
SPECTOR?: {
|
|
7
|
+
Spector: new () => Spector;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
interface Spector {
|
|
11
|
+
displayUI: () => void;
|
|
12
|
+
setCanvas: (canvas: HTMLCanvasElement) => void;
|
|
13
|
+
spyCanvases: boolean;
|
|
14
|
+
startCaptureOnNextFrame: () => void;
|
|
15
|
+
captureCanvas: (canvas: HTMLCanvasElement) => any;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export function initSpectorIfAvailable(_context: Context, canvas: HTMLCanvasElement): void {
|
|
21
|
+
if (typeof window !== undefined && window.SPECTOR) {
|
|
22
|
+
console.log(window.SPECTOR);
|
|
23
|
+
const params = new URLSearchParams(window.location.search);
|
|
24
|
+
if (params.has("spector")) {
|
|
25
|
+
const frame = Number.parseInt(params.get("spector") || "0") || 0;
|
|
26
|
+
console.log("Scheduled Spector capture at frame #" + frame);
|
|
27
|
+
const spector = new window.SPECTOR.Spector();
|
|
28
|
+
spector.spyCanvases = true;
|
|
29
|
+
waitForFrameAndCapture();
|
|
30
|
+
return;
|
|
31
|
+
|
|
32
|
+
function waitForFrameAndCapture() {
|
|
33
|
+
if (frame > _context.time.frame) return window.requestAnimationFrame(() => waitForFrameAndCapture());
|
|
34
|
+
const res = spector.captureCanvas(canvas);
|
|
35
|
+
if (res && res instanceof Promise) res.then(() => spector.displayUI());
|
|
36
|
+
else spector.displayUI();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (isDevEnvironment()) {
|
|
40
|
+
console.debug("Spector available: Add '?spector=<frame>' to the URL to enable it and capture a frame.");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -3,6 +3,7 @@ import { Group, Object3D, Texture, TextureLoader } from "three";
|
|
|
3
3
|
import { getParam, resolveUrl } from "../engine/engine_utils.js";
|
|
4
4
|
import { destroy, type IInstantiateOptions, instantiate, InstantiateOptions, isDestroyed } from "./engine_gameobject.js";
|
|
5
5
|
import { getLoader } from "./engine_gltf.js";
|
|
6
|
+
import type { loadAsset } from "./engine_loaders.js";
|
|
6
7
|
import { processNewScripts } from "./engine_mainloop_utils.js";
|
|
7
8
|
import { BlobStorage } from "./engine_networking_blob.js";
|
|
8
9
|
import { registerPrefabProvider, syncInstantiate, SyncInstantiateOptions } from "./engine_networking_instantiate.js";
|
|
@@ -79,13 +80,50 @@ export type ProgressCallback = (asset: AssetReference, prog: ProgressEvent) => v
|
|
|
79
80
|
|
|
80
81
|
const $assetReference = Symbol("assetReference");
|
|
81
82
|
|
|
82
|
-
/** ### AssetReferences can be used to
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* -
|
|
87
|
-
* -
|
|
88
|
-
* -
|
|
83
|
+
/** ### AssetReferences can be used to load glTF or GLB assets
|
|
84
|
+
* Use {@link AssetReference.getOrCreateFromUrl} to get an AssetReference for a URL to be easily loaded. When using the same URL multiple times the same AssetReference will be returned, this avoids loading or creating the same asset multiple times.
|
|
85
|
+
*
|
|
86
|
+
* **Important methods:**
|
|
87
|
+
* - {@link preload} to load the asset binary without creating an instance yet.
|
|
88
|
+
* - {@link loadAssetAsync} to load the asset and create an instance.
|
|
89
|
+
* - {@link instantiate} to load the asset and create another instance.
|
|
90
|
+
* - {@link unload} to dispose allocated memory and destroy the asset instance.
|
|
91
|
+
*
|
|
92
|
+
* @example Loading an asset from a URL
|
|
93
|
+
* ```ts
|
|
94
|
+
* import { AssetReference } from '@needle-tools/engine';
|
|
95
|
+
* const assetRef = AssetReference.getOrCreateFromUrl("https://example.com/myModel.glb");
|
|
96
|
+
* const instance = await assetRef.loadAssetAsync();
|
|
97
|
+
* scene.add(instance);
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @example Referencing an asset in a component and loading it on start
|
|
101
|
+
* ```ts
|
|
102
|
+
* import { Behaviour, serializable, AssetReference } from '@needle-tools/engine';
|
|
103
|
+
*
|
|
104
|
+
* export class MyComponent extends Behaviour {
|
|
105
|
+
*
|
|
106
|
+
* @serializable(AssetReference)
|
|
107
|
+
* myModel?: AssetReference;
|
|
108
|
+
*
|
|
109
|
+
* // Load the model on start. Start is called after awake and onEnable
|
|
110
|
+
* start() {
|
|
111
|
+
* if (this.myModel) {
|
|
112
|
+
* this.myModel.loadAssetAsync().then(instance => {
|
|
113
|
+
* if (instance) {
|
|
114
|
+
* // add the loaded model to this component's game object
|
|
115
|
+
* this.gameObject.add(instance);
|
|
116
|
+
* }
|
|
117
|
+
* });
|
|
118
|
+
* }
|
|
119
|
+
* }
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* ### Related:
|
|
124
|
+
* - {@link ImageReference} to load external image URLs
|
|
125
|
+
* - {@link FileReference} to load external file URLs
|
|
126
|
+
* - {@link loadAsset} to load assets directly without using AssetReferences
|
|
89
127
|
*/
|
|
90
128
|
export class AssetReference {
|
|
91
129
|
|
|
@@ -524,12 +562,33 @@ new AddressableSerializer();
|
|
|
524
562
|
|
|
525
563
|
const failedTexturePromise = Promise.resolve(null);
|
|
526
564
|
|
|
527
|
-
/**
|
|
565
|
+
/**
|
|
566
|
+
* Load images or textures from external URLs.
|
|
567
|
+
*
|
|
568
|
+
* **Important methods:**
|
|
569
|
+
* - {@link createHTMLImage} to create an HTMLImageElement from the URL
|
|
570
|
+
* - {@link createTexture} to create a Three.js Texture from the URL
|
|
571
|
+
*
|
|
528
572
|
* @example
|
|
529
573
|
* ```ts
|
|
530
|
-
* @
|
|
531
|
-
*
|
|
574
|
+
* import { ImageReference, serializable } from '@needle-tools/engine';
|
|
575
|
+
*
|
|
576
|
+
* export class MyComponent extends Behaviour {
|
|
577
|
+
* @serializable(ImageReference)
|
|
578
|
+
* myImage?:ImageReference;
|
|
579
|
+
* async start() {
|
|
580
|
+
* if(this.myImage) {
|
|
581
|
+
* const texture = await this.myImage.createTexture();
|
|
582
|
+
* if(texture) {
|
|
583
|
+
* // use the texture
|
|
584
|
+
* }
|
|
585
|
+
* }
|
|
586
|
+
* }
|
|
532
587
|
* ```
|
|
588
|
+
*
|
|
589
|
+
* ### Related:
|
|
590
|
+
* - {@link AssetReference} to load glTF or GLB assets
|
|
591
|
+
* - {@link FileReference} to load external file URLs
|
|
533
592
|
*/
|
|
534
593
|
export class ImageReference {
|
|
535
594
|
|
|
@@ -637,7 +696,12 @@ new ImageReferenceSerializer();
|
|
|
637
696
|
|
|
638
697
|
|
|
639
698
|
|
|
640
|
-
/**
|
|
699
|
+
/**
|
|
700
|
+
* Use this if a file is a external file URL. The file can be any arbitrary binary data like a videofile or a text asset.
|
|
701
|
+
*
|
|
702
|
+
* ### Related:
|
|
703
|
+
* - {@link AssetReference} to load glTF or GLB assets
|
|
704
|
+
* - {@link ImageReference} to load external image URLs
|
|
641
705
|
*/
|
|
642
706
|
export class FileReference {
|
|
643
707
|
|
|
@@ -15,7 +15,7 @@ const userInteractionCallbacks: Function[] = [];
|
|
|
15
15
|
*/
|
|
16
16
|
export function internalOnUserInputRegistered() {
|
|
17
17
|
if (userInteractionRegistered) return;
|
|
18
|
-
if (isDevEnvironment()) console.debug("User
|
|
18
|
+
if (isDevEnvironment()) console.debug("[Needle Engine] User input registered: Media playback is now allowed.");
|
|
19
19
|
userInteractionRegistered = true;
|
|
20
20
|
const copy = [...userInteractionCallbacks];
|
|
21
21
|
userInteractionCallbacks.length = 0;
|
|
@@ -28,6 +28,21 @@ document.addEventListener('dragstart', internalOnUserInputRegistered);
|
|
|
28
28
|
document.addEventListener('touchend', internalOnUserInputRegistered);
|
|
29
29
|
document.addEventListener('keydown', internalOnUserInputRegistered);
|
|
30
30
|
|
|
31
|
+
|
|
32
|
+
declare global {
|
|
33
|
+
interface Navigator {
|
|
34
|
+
userActivation?: {
|
|
35
|
+
isActive: boolean;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// User Activation should be available across browsers since November 2023 https://developer.mozilla.org/en-US/docs/Web/API/UserActivation
|
|
40
|
+
if (typeof window !== "undefined" && "userActivation" in navigator && navigator.userActivation?.isActive) {
|
|
41
|
+
if (isDevEnvironment()) console.debug("[Needle Engine] User input already active: Media playback is now allowed.");
|
|
42
|
+
userInteractionCallbacks.length = 0;
|
|
43
|
+
userInteractionRegistered = true;
|
|
44
|
+
}
|
|
45
|
+
|
|
31
46
|
/**
|
|
32
47
|
* The Application class can be used to mute audio globally, and to check if the application (canvas) is currently visible (it's tab is active and not minimized).
|
|
33
48
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Camera, Object3D, PerspectiveCamera, Vector3, Vector3Like } from "three";
|
|
2
2
|
|
|
3
3
|
import { GroundProjectedEnv } from "../engine-components/GroundProjection.js";
|
|
4
|
+
import type { OrbitControls } from "../engine-components/OrbitControls.js";
|
|
4
5
|
import { findObjectOfType } from "./engine_components.js";
|
|
5
6
|
import { Context } from "./engine_context.js";
|
|
6
7
|
import { Gizmos } from "./engine_gizmos.js";
|
|
@@ -9,7 +10,10 @@ import { NeedleXRSession } from "./xr/NeedleXRSession.js";
|
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
|
-
* Options for fitting
|
|
13
|
+
* Options for fitting a camera to the scene or specific objects.
|
|
14
|
+
*
|
|
15
|
+
* Used by {@link OrbitControls.fitCamera} and the {@link fitCamera}.
|
|
16
|
+
*
|
|
13
17
|
*/
|
|
14
18
|
export type FitCameraOptions = {
|
|
15
19
|
/** When enabled debug rendering will be shown */
|
|
@@ -31,8 +35,17 @@ export type FitCameraOptions = {
|
|
|
31
35
|
*/
|
|
32
36
|
camera?: Camera,
|
|
33
37
|
|
|
38
|
+
/**
|
|
39
|
+
* The current zoom level of the camera (used to avoid clipping when fitting)
|
|
40
|
+
*/
|
|
34
41
|
currentZoom?: number,
|
|
42
|
+
/**
|
|
43
|
+
* Minimum and maximum zoom levels for the camera (e.g. if zoom is constrained by OrbitControls)
|
|
44
|
+
*/
|
|
35
45
|
minZoom?: number,
|
|
46
|
+
/**
|
|
47
|
+
* Maximum zoom level for the camera (e.g. if zoom is constrained by OrbitControls)
|
|
48
|
+
*/
|
|
36
49
|
maxZoom?: number,
|
|
37
50
|
|
|
38
51
|
/**
|
|
@@ -40,7 +53,11 @@ export type FitCameraOptions = {
|
|
|
40
53
|
*/
|
|
41
54
|
objects?: Object3D[] | Object3D;
|
|
42
55
|
|
|
43
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* A factor to control padding around the fitted objects.
|
|
58
|
+
*
|
|
59
|
+
* Values > 1 will add more space around the fitted objects, values < 1 will zoom in closer.
|
|
60
|
+
*
|
|
44
61
|
* @default 1.1
|
|
45
62
|
*/
|
|
46
63
|
fitOffset?: number,
|
|
@@ -74,7 +91,7 @@ export type FitCameraOptions = {
|
|
|
74
91
|
relativeTargetOffset?: Partial<Vector3Like>,
|
|
75
92
|
|
|
76
93
|
/**
|
|
77
|
-
*
|
|
94
|
+
* Target field of view (FOV) for the camera
|
|
78
95
|
*/
|
|
79
96
|
fov?: number,
|
|
80
97
|
}
|
|
@@ -86,7 +103,35 @@ export type FitCameraReturnType = {
|
|
|
86
103
|
fov: number | undefined
|
|
87
104
|
}
|
|
88
105
|
|
|
89
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Fit the camera to the specified objects or the whole scene.
|
|
108
|
+
* Adjusts the camera position and optionally the FOV to ensure all objects are visible.
|
|
109
|
+
*
|
|
110
|
+
* @example Fit the main camera to the entire scene:
|
|
111
|
+
* ```ts
|
|
112
|
+
* import { fitCamera } from '@needle-tools/engine';
|
|
113
|
+
*
|
|
114
|
+
* // Fit the main camera to the entire scene
|
|
115
|
+
* fitCamera();
|
|
116
|
+
* ```
|
|
117
|
+
* @example Fit a specific camera to specific objects with custom options:
|
|
118
|
+
* ```ts
|
|
119
|
+
* import { fitCamera } from '@needle-tools/engine';
|
|
120
|
+
*
|
|
121
|
+
* // Fit a specific camera to specific objects with custom options
|
|
122
|
+
* const myCamera = ...; // your camera
|
|
123
|
+
* const objectsToFit = [...]; // array of objects to fit
|
|
124
|
+
* fitCamera({
|
|
125
|
+
* camera: myCamera,
|
|
126
|
+
* objects: objectsToFit,
|
|
127
|
+
* fitOffset: 1,
|
|
128
|
+
* fov: 20,
|
|
129
|
+
* });
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* @param options Options for fitting the camera
|
|
133
|
+
* @returns
|
|
134
|
+
*/
|
|
90
135
|
export function fitCamera(options?: FitCameraOptions): null | FitCameraReturnType {
|
|
91
136
|
|
|
92
137
|
if (NeedleXRSession.active) {
|
|
@@ -13,6 +13,7 @@ import * as Stats from 'three/examples/jsm/libs/stats.module.js';
|
|
|
13
13
|
import type { EffectComposer as ThreeEffectComposer } from "three/examples/jsm/postprocessing/EffectComposer.js";
|
|
14
14
|
import { nodeFrame } from "three/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js";
|
|
15
15
|
|
|
16
|
+
import { initSpectorIfAvailable } from './debug/debug_spector.js';
|
|
16
17
|
import { isDevEnvironment, LogType, showBalloonError, showBalloonMessage } from './debug/index.js';
|
|
17
18
|
import { Addressables } from './engine_addressables.js';
|
|
18
19
|
import { AnimationsRegistry } from './engine_animation.js';
|
|
@@ -37,7 +38,7 @@ import { RendererData as SceneLighting } from './engine_scenelighting.js';
|
|
|
37
38
|
import { getTempColor, logHierarchy } from './engine_three_utils.js';
|
|
38
39
|
import { Time } from './engine_time.js';
|
|
39
40
|
import { patchTonemapping } from './engine_tonemapping.js';
|
|
40
|
-
import type { CoroutineData, ICamera, IComponent, IContext, ILight, LoadedModel, Model, Vec2 } from "./engine_types.js";
|
|
41
|
+
import type { CoroutineData, ICamera, IComponent, IContext, ILight, LoadedModel, Model, SourceIdentifier, Vec2 } from "./engine_types.js";
|
|
41
42
|
import { deepClone, delay, DeviceUtilities, getParam } from './engine_utils.js';
|
|
42
43
|
import type { INeedleXRSessionEventReceiver, NeedleXRSession } from './engine_xr.js';
|
|
43
44
|
import { NeedleMenu } from './webcomponents/needle menu/needle-menu.js';
|
|
@@ -129,9 +130,12 @@ export function registerComponent(script: IComponent, context?: Context) {
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
/**
|
|
132
|
-
* The context is the main
|
|
133
|
-
* It can be used to access the scene, renderer,
|
|
134
|
-
*
|
|
133
|
+
* The Needle Engine context is the main access point that holds all the data and state of a Needle Engine application.
|
|
134
|
+
* It can be used to access the {@link Context.scene}, {@link Context.renderer}, {@link Context.mainCamera}, {@link Context.input}, {@link Context.physics}, {@link Context.time}, {@link Context.connection} (networking), and more.
|
|
135
|
+
*
|
|
136
|
+
* The context is automatically created when using the `<needle-engine>` web component.
|
|
137
|
+
*
|
|
138
|
+
* @example Accessing the context from a [component](https://engine.needle.tools/docs/api/Behaviour):
|
|
135
139
|
* ```typescript
|
|
136
140
|
* import { Behaviour } from "@needle-tools/engine";
|
|
137
141
|
* import { Mesh, BoxGeometry, MeshBasicMaterial } from "three";
|
|
@@ -142,6 +146,18 @@ export function registerComponent(script: IComponent, context?: Context) {
|
|
|
142
146
|
* }
|
|
143
147
|
* }
|
|
144
148
|
* ```
|
|
149
|
+
*
|
|
150
|
+
* @example Accessing the context from a [hook](https://engine.needle.tools/docs/scripting.html#hooks) without a component e.g. from a javascript module or svelte or react component.
|
|
151
|
+
*
|
|
152
|
+
* ```typescript
|
|
153
|
+
* import { onStart } from "@needle-tools/engine";
|
|
154
|
+
*
|
|
155
|
+
* onStart((context) => {
|
|
156
|
+
* console.log("Hello from onStart hook");
|
|
157
|
+
* context.scene.add(new Mesh(new BoxGeometry(), new MeshBasicMaterial()));
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
145
161
|
*/
|
|
146
162
|
export class Context implements IContext {
|
|
147
163
|
|
|
@@ -357,6 +373,7 @@ export class Context implements IContext {
|
|
|
357
373
|
*/
|
|
358
374
|
composer: EffectComposer | ThreeEffectComposer | null = null;
|
|
359
375
|
|
|
376
|
+
// #region internal script lists
|
|
360
377
|
/**
|
|
361
378
|
* @internal All known components. Don't use directly
|
|
362
379
|
*/
|
|
@@ -424,6 +441,9 @@ export class Context implements IContext {
|
|
|
424
441
|
/** @internal */
|
|
425
442
|
readonly new_scripts_xr: INeedleXRSessionEventReceiver[] = [];
|
|
426
443
|
|
|
444
|
+
// #endregion
|
|
445
|
+
// #region Properties
|
|
446
|
+
|
|
427
447
|
/**
|
|
428
448
|
* The **main camera component** of the scene - this camera is used for rendering.
|
|
429
449
|
* Use `setCurrentCamera` for updating the main camera.
|
|
@@ -468,25 +488,36 @@ export class Context implements IContext {
|
|
|
468
488
|
physics: Physics;
|
|
469
489
|
/** access networking methods (use it to send or listen to messages or join a networking backend) */
|
|
470
490
|
connection: NetworkConnection;
|
|
471
|
-
/**
|
|
472
|
-
* @deprecated AssetDataBase is deprecated
|
|
473
|
-
*/
|
|
491
|
+
/** @deprecated AssetDatabase is deprecated */
|
|
474
492
|
assets: AssetDatabase;
|
|
475
493
|
/** The main light in the scene */
|
|
476
494
|
mainLight: ILight | null = null;
|
|
477
495
|
/** @deprecated Use sceneLighting */
|
|
478
496
|
get rendererData() { return this.sceneLighting }
|
|
497
|
+
/** Access the scene lighting manager to control lighting settings in the context */
|
|
479
498
|
sceneLighting: SceneLighting;
|
|
480
499
|
addressables: Addressables;
|
|
481
500
|
lightmaps: ILightDataRegistry;
|
|
482
501
|
players: PlayerViewManager;
|
|
502
|
+
|
|
503
|
+
/** Access the LODs manager to control LOD behavior in the context */
|
|
483
504
|
readonly lodsManager: LODsManager;
|
|
484
505
|
/** Access the needle menu to add or remove buttons to the menu element */
|
|
485
506
|
readonly menu: NeedleMenu;
|
|
486
507
|
|
|
487
|
-
/**
|
|
508
|
+
/**
|
|
509
|
+
* Checks if the context is fully created and ready
|
|
510
|
+
* @returns true if the context is fully created and ready
|
|
511
|
+
*/
|
|
488
512
|
get isCreated() { return this._isCreated; }
|
|
489
513
|
|
|
514
|
+
/**
|
|
515
|
+
* The source identifier(s) of the root scene(s) loaded into this context.
|
|
516
|
+
* When using `<needle-engine>` web component this will be the `src` attribute(s).
|
|
517
|
+
* @returns The source identifier for of the root scene
|
|
518
|
+
*/
|
|
519
|
+
get rootSourceId(): SourceIdentifier | undefined { return this.rootSceneSourceIdentifiers[0] || undefined; }
|
|
520
|
+
|
|
490
521
|
private _needsUpdateSize: boolean = false;
|
|
491
522
|
private _isCreated: boolean = false;
|
|
492
523
|
private _isCreating: boolean = false;
|
|
@@ -541,6 +572,7 @@ export class Context implements IContext {
|
|
|
541
572
|
ContextRegistry.register(this);
|
|
542
573
|
}
|
|
543
574
|
|
|
575
|
+
// #region Renderer
|
|
544
576
|
/**
|
|
545
577
|
* Calling this function will dispose the current renderer and create a new one which will then be assigned to the context. It can be used to create a new renderer with custom WebGLRendererParameters.
|
|
546
578
|
* **Note**: Instead you can also modify the static `Context.DefaultWebGlRendererParameters` before the context is created.
|
|
@@ -591,6 +623,8 @@ export class Context implements IContext {
|
|
|
591
623
|
|
|
592
624
|
this.input.bindEvents();
|
|
593
625
|
|
|
626
|
+
initSpectorIfAvailable(this, this.renderer.domElement);
|
|
627
|
+
|
|
594
628
|
return this.renderer;
|
|
595
629
|
}
|
|
596
630
|
|
|
@@ -894,6 +928,7 @@ export class Context implements IContext {
|
|
|
894
928
|
}
|
|
895
929
|
}
|
|
896
930
|
|
|
931
|
+
// #region onBeforeRender / onAfterRender listeners
|
|
897
932
|
private readonly _onBeforeRenderListeners = new Map<string, OnRenderCallback[]>();
|
|
898
933
|
private readonly _onAfterRenderListeners = new Map<string, OnRenderCallback[]>();
|
|
899
934
|
|
|
@@ -991,6 +1026,8 @@ export class Context implements IContext {
|
|
|
991
1026
|
private _lastStyleComputedResult: boolean | undefined = undefined;
|
|
992
1027
|
|
|
993
1028
|
private _createId: number = 0;
|
|
1029
|
+
|
|
1030
|
+
// #region internal create
|
|
994
1031
|
private async internalOnCreate(opts?: ContextCreateArgs): Promise<boolean> {
|
|
995
1032
|
const createId = ++this._createId;
|
|
996
1033
|
|
|
@@ -1200,6 +1237,11 @@ export class Context implements IContext {
|
|
|
1200
1237
|
if (opts?.abortSignal?.aborted) {
|
|
1201
1238
|
return false;
|
|
1202
1239
|
}
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
const mainIdentifier = this.rootSourceId;
|
|
1243
|
+
if (mainIdentifier) this.sceneLighting.enable(mainIdentifier);
|
|
1244
|
+
|
|
1203
1245
|
invokeLifecycleFunctions(this, ContextEvent.ContextCreated);
|
|
1204
1246
|
if (debug) console.log("Context Created...", this.renderer, this.renderer.domElement)
|
|
1205
1247
|
|
|
@@ -1209,13 +1251,18 @@ export class Context implements IContext {
|
|
|
1209
1251
|
return true;
|
|
1210
1252
|
}
|
|
1211
1253
|
|
|
1254
|
+
|
|
1255
|
+
private readonly rootSceneSourceIdentifiers: SourceIdentifier[] = [];
|
|
1212
1256
|
private async internalLoadInitialContent(createId: number, args: ContextCreateArgs): Promise<Array<LoadedModel>> {
|
|
1257
|
+
this.rootSceneSourceIdentifiers.length = 0;
|
|
1258
|
+
|
|
1213
1259
|
const results = new Array<LoadedModel>();
|
|
1214
1260
|
// early out if we dont have any files to load
|
|
1215
1261
|
if (args.files.length === 0) return results;
|
|
1216
1262
|
|
|
1217
|
-
|
|
1218
1263
|
const files = [...args.files];
|
|
1264
|
+
this.rootSceneSourceIdentifiers.push(...files);
|
|
1265
|
+
|
|
1219
1266
|
const progressArg: LoadingProgressArgs = {
|
|
1220
1267
|
name: "",
|
|
1221
1268
|
progress: null!,
|
|
@@ -1223,6 +1270,7 @@ export class Context implements IContext {
|
|
|
1223
1270
|
count: files.length
|
|
1224
1271
|
}
|
|
1225
1272
|
|
|
1273
|
+
|
|
1226
1274
|
const loader = getLoader();
|
|
1227
1275
|
// this hash should be constant since it is used to initialize the UIDProvider per initially loaded scene
|
|
1228
1276
|
const loadingHash = 0;
|
|
@@ -1661,7 +1709,8 @@ export class Context implements IContext {
|
|
|
1661
1709
|
|
|
1662
1710
|
if (this._stats) {
|
|
1663
1711
|
this._stats.end();
|
|
1664
|
-
|
|
1712
|
+
const dt = this.time.fps < 20 ? 50 : 150;
|
|
1713
|
+
if (this.time.frameCount % dt === 0)
|
|
1665
1714
|
console.log(this.renderer.info.render.calls + " DrawCalls", "\nRender:", { ...this.renderer.info.render }, "\nMemory:", { ...this.renderer.info.memory }, "\nTarget Framerate: " + this.targetFrameRate);
|
|
1666
1715
|
}
|
|
1667
1716
|
|
|
@@ -13,7 +13,7 @@ import { registerPrewarmObject } from "./engine_mainloop_utils.js";
|
|
|
13
13
|
import { SerializationContext } from "./engine_serialization_core.js";
|
|
14
14
|
import { Context } from "./engine_setup.js"
|
|
15
15
|
import { postprocessFBXMaterials } from "./engine_three_utils.js";
|
|
16
|
-
import { CustomModel, isGLTFModel, Model, type UIDProvider } from "./engine_types.js";
|
|
16
|
+
import { CustomModel, isGLTFModel, Model, SourceIdentifier, type UIDProvider } from "./engine_types.js";
|
|
17
17
|
import * as utils from "./engine_utils.js";
|
|
18
18
|
import { tryDetermineMimetypeFromURL } from "./engine_utils_format.js"
|
|
19
19
|
import { invokeLoadedImportPluginHooks, registerComponentExtension, registerExtensions } from "./extensions/extensions.js";
|
|
@@ -43,7 +43,7 @@ const debugFileTypes = utils.getParam("debugfileformat");
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
async function onCreateLoader(url: string, context: Context, sourceId: SourceIdentifier): Promise<CustomLoader | GLTFLoader | FBXLoader | USDZLoader | OBJLoader | null> {
|
|
47
47
|
|
|
48
48
|
const type = await tryDetermineMimetypeFromURL(url, { useExtension: true }) || "unknown";
|
|
49
49
|
if (debugFileTypes) console.debug(`Determined file type: '${type}' for url '${url}'`, { registeredModelLoaderCallbacks });
|
|
@@ -67,7 +67,7 @@ export async function onCreateLoader(url: string, context: Context): Promise<Cus
|
|
|
67
67
|
{
|
|
68
68
|
console.warn(`Unknown file type (${type}). Needle Engine will fallback to the GLTFLoader - To support more model formats please create a Needle loader plugin.\nUse import { NeedleEngineModelLoader } from \"@needle-tools/engine\" namespace to register your loader.`, url);
|
|
69
69
|
const loader = new GLTFLoader();
|
|
70
|
-
await registerExtensions(loader, context, url);
|
|
70
|
+
await registerExtensions(loader, context, url, sourceId);
|
|
71
71
|
return loader;
|
|
72
72
|
}
|
|
73
73
|
case "model/fbx":
|
|
@@ -88,7 +88,7 @@ export async function onCreateLoader(url: string, context: Context): Promise<Cus
|
|
|
88
88
|
case "model/vrm":
|
|
89
89
|
{
|
|
90
90
|
const loader = new GLTFLoader();
|
|
91
|
-
await registerExtensions(loader, context, url);
|
|
91
|
+
await registerExtensions(loader, context, url, sourceId);
|
|
92
92
|
return loader;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -117,7 +117,7 @@ export async function parseSync(context: Context, data: string | ArrayBuffer, pa
|
|
|
117
117
|
path = "";
|
|
118
118
|
}
|
|
119
119
|
if (printGltf) console.log("Parse glTF", path)
|
|
120
|
-
const loader = await onCreateLoader(path, context);
|
|
120
|
+
const loader = await onCreateLoader(path, context, path);
|
|
121
121
|
if (!loader) {
|
|
122
122
|
return undefined;
|
|
123
123
|
}
|
|
@@ -193,7 +193,7 @@ export async function loadSync(context: Context, url: string, sourceId: string,
|
|
|
193
193
|
// but due to the async nature and potentially triggering multiple loads at the same time
|
|
194
194
|
// we need to make sure the extensions dont override each other
|
|
195
195
|
// creating new loaders should not be expensive as well
|
|
196
|
-
const loader = await onCreateLoader(url, context);
|
|
196
|
+
const loader = await onCreateLoader(url, context, sourceId);
|
|
197
197
|
if (!loader) {
|
|
198
198
|
return undefined;
|
|
199
199
|
}
|
|
@@ -13,6 +13,7 @@ import type { IPhysicsEngine } from './engine_types.js';
|
|
|
13
13
|
import { getParam } from "./engine_utils.js"
|
|
14
14
|
|
|
15
15
|
const debugPhysics = getParam("debugphysics");
|
|
16
|
+
const debugWorker = getParam("debugworker");
|
|
16
17
|
const layerMaskHelper: Layers = new Layers();
|
|
17
18
|
|
|
18
19
|
|
|
@@ -654,6 +655,9 @@ namespace NEMeshBVH {
|
|
|
654
655
|
// if there are no workers available, create a new one
|
|
655
656
|
if (!workerInstance && workerInstances.length < 3) {
|
|
656
657
|
try {
|
|
658
|
+
if (debugWorker) {
|
|
659
|
+
console.warn("[GenerateMeshBVHWorker] Creating worker with import.meta.url:", import.meta.url);
|
|
660
|
+
}
|
|
657
661
|
workerInstance = new _GenerateMeshBVHWorker();
|
|
658
662
|
workerInstances.push(workerInstance);
|
|
659
663
|
}
|
|
@@ -665,8 +669,8 @@ namespace NEMeshBVH {
|
|
|
665
669
|
failedToCreateMeshBVHWorker += 10;
|
|
666
670
|
}
|
|
667
671
|
else {
|
|
668
|
-
console.error("Failed to create MeshBVH worker");
|
|
669
|
-
console.
|
|
672
|
+
console.error("Failed to create MeshBVH worker. Please see below for more details:");
|
|
673
|
+
console.log(err);
|
|
670
674
|
}
|
|
671
675
|
failedToCreateMeshBVHWorker++;
|
|
672
676
|
}
|