@needle-tools/engine 5.1.0-canary.30cc545 → 5.1.0-canary.40da791
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/.needle/generated/needle-bindings.gen.d.ts +5 -0
- package/CHANGELOG.md +91 -0
- package/SKILL.md +4 -1
- package/components.needle.json +1 -1
- package/dist/{needle-engine.bundle-d_9mSxN4.js → needle-engine.bundle-Cu2B9CsR.js} +16112 -15269
- package/dist/needle-engine.bundle-ZoVUaB89.umd.cjs +1733 -0
- package/dist/needle-engine.bundle-hBWUJPxm.min.js +1733 -0
- package/dist/needle-engine.d.ts +1527 -384
- package/dist/needle-engine.js +573 -569
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/three.js +1 -0
- package/dist/three.min.js +21 -21
- package/dist/three.umd.cjs +16 -16
- package/lib/engine/api.d.ts +8 -1
- package/lib/engine/api.js +6 -0
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/codegen/register_types.js +10 -18
- package/lib/engine/codegen/register_types.js.map +1 -1
- package/lib/engine/debug/debug_spatial_console.d.ts +2 -0
- package/lib/engine/debug/debug_spatial_console.js +10 -7
- package/lib/engine/debug/debug_spatial_console.js.map +1 -1
- package/lib/engine/engine_addressables.d.ts +2 -0
- package/lib/engine/engine_addressables.js +6 -3
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_audio.d.ts +68 -0
- package/lib/engine/engine_audio.js +172 -0
- package/lib/engine/engine_audio.js.map +1 -1
- package/lib/engine/engine_camera.fit.js +16 -4
- package/lib/engine/engine_camera.fit.js.map +1 -1
- package/lib/engine/engine_components.js +1 -1
- package/lib/engine/engine_components.js.map +1 -1
- package/lib/engine/engine_context.d.ts +41 -27
- package/lib/engine/engine_context.js +57 -30
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_context_eventbus.d.ts +47 -0
- package/lib/engine/engine_context_eventbus.js +47 -0
- package/lib/engine/engine_context_eventbus.js.map +1 -0
- package/lib/engine/engine_disposable.d.ts +172 -0
- package/lib/engine/engine_disposable.js +136 -0
- package/lib/engine/engine_disposable.js.map +1 -0
- package/lib/engine/engine_gameobject.d.ts +1 -10
- package/lib/engine/engine_gameobject.js +22 -120
- package/lib/engine/engine_gameobject.js.map +1 -1
- package/lib/engine/engine_gltf_builtin_components.js +7 -69
- package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
- package/lib/engine/engine_init.js +16 -1
- package/lib/engine/engine_init.js.map +1 -1
- package/lib/engine/engine_input.d.ts +24 -5
- package/lib/engine/engine_input.js +3 -2
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_instantiate_resolve.d.ts +42 -0
- package/lib/engine/engine_instantiate_resolve.js +372 -0
- package/lib/engine/engine_instantiate_resolve.js.map +1 -0
- package/lib/engine/engine_license.d.ts +2 -0
- package/lib/engine/engine_license.js +14 -6
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_lifecycle_functions_internal.js +5 -0
- package/lib/engine/engine_lifecycle_functions_internal.js.map +1 -1
- package/lib/engine/engine_mainloop_utils.js +7 -4
- package/lib/engine/engine_mainloop_utils.js.map +1 -1
- package/lib/engine/engine_networking.d.ts +51 -37
- package/lib/engine/engine_networking.js +132 -82
- package/lib/engine/engine_networking.js.map +1 -1
- package/lib/engine/engine_networking.transport.websocket.d.ts +15 -0
- package/lib/engine/engine_networking.transport.websocket.js +38 -0
- package/lib/engine/engine_networking.transport.websocket.js.map +1 -0
- package/lib/engine/engine_networking_blob.js +1 -1
- package/lib/engine/engine_networking_blob.js.map +1 -1
- package/lib/engine/engine_networking_instantiate.js +2 -2
- package/lib/engine/engine_networking_instantiate.js.map +1 -1
- package/lib/engine/engine_networking_types.d.ts +39 -1
- package/lib/engine/engine_networking_types.js +7 -0
- package/lib/engine/engine_networking_types.js.map +1 -1
- package/lib/engine/engine_physics_rapier.d.ts +21 -3
- package/lib/engine/engine_physics_rapier.js +94 -25
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine/engine_scenedata.d.ts +13 -17
- package/lib/engine/engine_scenedata.js +58 -31
- package/lib/engine/engine_scenedata.js.map +1 -1
- package/lib/engine/engine_serialization_builtin_serializer.d.ts +10 -16
- package/lib/engine/engine_serialization_builtin_serializer.js +56 -46
- package/lib/engine/engine_serialization_builtin_serializer.js.map +1 -1
- package/lib/engine/engine_serialization_core.d.ts +1 -0
- package/lib/engine/engine_serialization_core.js +7 -0
- package/lib/engine/engine_serialization_core.js.map +1 -1
- package/lib/engine/engine_ssr.d.ts +2 -0
- package/lib/engine/engine_ssr.js +2 -0
- package/lib/engine/engine_ssr.js.map +1 -1
- package/lib/engine/engine_types.d.ts +31 -11
- package/lib/engine/engine_types.js +1 -1
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine/engine_util_decorator.js +7 -2
- package/lib/engine/engine_util_decorator.js.map +1 -1
- package/lib/engine/engine_utils.d.ts +1 -1
- package/lib/engine/engine_utils.js +19 -5
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js.map +1 -1
- package/lib/engine/webcomponents/jsx.d.ts +51 -0
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +3 -4
- package/lib/engine/webcomponents/needle menu/needle-menu.js +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-button.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +10 -4
- package/lib/engine/webcomponents/needle-engine.js +1 -1
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.d.ts +3 -2
- package/lib/engine/xr/NeedleXRSession.js +50 -14
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine/xr/events.d.ts +1 -1
- package/lib/engine/xr/events.js.map +1 -1
- package/lib/engine-components/Animation.js +17 -16
- package/lib/engine-components/Animation.js.map +1 -1
- package/lib/engine-components/AnimationBuilder.d.ts +158 -0
- package/lib/engine-components/AnimationBuilder.js +305 -0
- package/lib/engine-components/AnimationBuilder.js.map +1 -0
- package/lib/engine-components/Animator.d.ts +6 -0
- package/lib/engine-components/Animator.js +23 -13
- package/lib/engine-components/Animator.js.map +1 -1
- package/lib/engine-components/AnimatorController.builder.d.ts +191 -0
- package/lib/engine-components/AnimatorController.builder.js +263 -0
- package/lib/engine-components/AnimatorController.builder.js.map +1 -0
- package/lib/engine-components/AnimatorController.d.ts +4 -119
- package/lib/engine-components/AnimatorController.js +37 -233
- package/lib/engine-components/AnimatorController.js.map +1 -1
- package/lib/engine-components/AudioSource.d.ts +19 -3
- package/lib/engine-components/AudioSource.js +121 -68
- package/lib/engine-components/AudioSource.js.map +1 -1
- package/lib/engine-components/Collider.d.ts +18 -9
- package/lib/engine-components/Collider.js +61 -14
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/Component.d.ts +72 -9
- package/lib/engine-components/Component.js +114 -10
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/ContactShadows.d.ts +1 -0
- package/lib/engine-components/ContactShadows.js +14 -1
- package/lib/engine-components/ContactShadows.js.map +1 -1
- package/lib/engine-components/DragControls.d.ts +7 -0
- package/lib/engine-components/DragControls.js +19 -7
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/DropListener.js +3 -0
- package/lib/engine-components/DropListener.js.map +1 -1
- package/lib/engine-components/EventList.d.ts +31 -9
- package/lib/engine-components/EventList.js +37 -76
- package/lib/engine-components/EventList.js.map +1 -1
- package/lib/engine-components/Joints.d.ts +4 -2
- package/lib/engine-components/Joints.js +19 -3
- package/lib/engine-components/Joints.js.map +1 -1
- package/lib/engine-components/Light.d.ts +6 -8
- package/lib/engine-components/Light.js +48 -27
- package/lib/engine-components/Light.js.map +1 -1
- package/lib/engine-components/Networking.d.ts +1 -1
- package/lib/engine-components/Networking.js +1 -1
- package/lib/engine-components/OrbitControls.d.ts +0 -2
- package/lib/engine-components/OrbitControls.js +30 -12
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.js +2 -0
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/RigidBody.d.ts +12 -4
- package/lib/engine-components/RigidBody.js +18 -4
- package/lib/engine-components/RigidBody.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.js +3 -0
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/SeeThrough.js +2 -2
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/api.d.ts +2 -1
- package/lib/engine-components/api.js +2 -1
- package/lib/engine-components/api.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +7 -13
- package/lib/engine-components/codegen/components.js +7 -13
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +1 -1
- package/lib/engine-components/postprocessing/VolumeParameter.d.ts +2 -0
- package/lib/engine-components/postprocessing/VolumeParameter.js +4 -1
- package/lib/engine-components/postprocessing/VolumeParameter.js.map +1 -1
- package/lib/engine-components/timeline/PlayableDirector.d.ts +21 -11
- package/lib/engine-components/timeline/PlayableDirector.js +75 -67
- package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
- package/lib/engine-components/timeline/SignalAsset.d.ts +3 -1
- package/lib/engine-components/timeline/SignalAsset.js +1 -0
- package/lib/engine-components/timeline/SignalAsset.js.map +1 -1
- package/lib/engine-components/timeline/TimelineBuilder.d.ts +413 -0
- package/lib/engine-components/timeline/TimelineBuilder.js +506 -0
- package/lib/engine-components/timeline/TimelineBuilder.js.map +1 -0
- package/lib/engine-components/timeline/TimelineModels.d.ts +2 -1
- package/lib/engine-components/timeline/TimelineModels.js +3 -0
- package/lib/engine-components/timeline/TimelineModels.js.map +1 -1
- package/lib/engine-components/timeline/TimelineTracks.d.ts +37 -6
- package/lib/engine-components/timeline/TimelineTracks.js +92 -26
- package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
- package/lib/engine-components/timeline/index.d.ts +2 -1
- package/lib/engine-components/timeline/index.js +2 -0
- package/lib/engine-components/timeline/index.js.map +1 -1
- package/lib/engine-components/ui/Canvas.d.ts +1 -1
- package/lib/engine-components/ui/Canvas.js +2 -8
- package/lib/engine-components/ui/Canvas.js.map +1 -1
- package/lib/engine-components/ui/Text.d.ts +1 -0
- package/lib/engine-components/ui/Text.js +10 -7
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/lib/engine-components/web/CursorFollow.d.ts +0 -1
- package/lib/engine-components/web/CursorFollow.js +21 -13
- package/lib/engine-components/web/CursorFollow.js.map +1 -1
- package/lib/engine-components/webxr/WebXRImageTracking.js +4 -0
- package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
- package/lib/needle-engine.d.ts +2 -0
- package/lib/needle-engine.js +2 -0
- package/lib/needle-engine.js.map +1 -1
- package/package.json +3 -83
- package/plugins/common/license.js +5 -2
- package/plugins/common/worker.js +9 -4
- package/plugins/dts-generator/dts.codegen.js +255 -50
- package/plugins/dts-generator/dts.scan.js +37 -9
- package/plugins/dts-generator/dts.writer.js +1 -1
- package/plugins/dts-generator/glb.discovery.js +140 -23
- package/plugins/dts-generator/glb.extractor.js +48 -8
- package/plugins/dts-generator/glb.reader.js +80 -27
- package/plugins/dts-generator/index.js +1 -1
- package/plugins/types/needle-bindings.d.ts +25 -14
- package/plugins/types/userconfig.d.ts +12 -0
- package/plugins/vite/asap.js +18 -9
- package/plugins/vite/dependencies.js +29 -10
- package/plugins/vite/dependency-watcher.d.ts +2 -2
- package/plugins/vite/dependency-watcher.js +5 -6
- package/plugins/vite/drop.d.ts +2 -2
- package/plugins/vite/drop.js +3 -4
- package/plugins/vite/dts-generator.d.ts +2 -2
- package/plugins/vite/dts-generator.js +43 -9
- package/plugins/vite/editor-connection.js +3 -3
- package/plugins/vite/index.d.ts +9 -3
- package/plugins/vite/index.js +23 -10
- package/plugins/vite/license.js +19 -1
- package/plugins/vite/local-files-core.js +3 -3
- package/plugins/vite/local-files-utils.d.ts +3 -1
- package/plugins/vite/local-files-utils.js +29 -5
- package/plugins/vite/meta.js +4 -2
- package/plugins/vite/poster.d.ts +2 -2
- package/plugins/vite/poster.js +3 -5
- package/plugins/vite/reload.d.ts +2 -2
- package/plugins/vite/reload.js +23 -23
- package/plugins/vite/server.js +2 -1
- package/src/engine/api.ts +11 -1
- package/src/engine/codegen/register_types.ts +10 -18
- package/src/engine/debug/debug_spatial_console.ts +10 -7
- package/src/engine/engine_addressables.ts +6 -3
- package/src/engine/engine_audio.ts +184 -0
- package/src/engine/engine_camera.fit.ts +15 -4
- package/src/engine/engine_components.ts +1 -1
- package/src/engine/engine_context.ts +67 -37
- package/src/engine/engine_context_eventbus.ts +73 -0
- package/src/engine/engine_disposable.ts +214 -0
- package/src/engine/engine_gameobject.ts +54 -159
- package/src/engine/engine_gltf_builtin_components.ts +7 -76
- package/src/engine/engine_init.ts +15 -1
- package/src/engine/engine_input.ts +28 -7
- package/src/engine/engine_instantiate_resolve.ts +407 -0
- package/src/engine/engine_license.ts +12 -10
- package/src/engine/engine_lifecycle_functions_internal.ts +7 -0
- package/src/engine/engine_mainloop_utils.ts +7 -4
- package/src/engine/engine_networking.transport.websocket.ts +45 -0
- package/src/engine/engine_networking.ts +161 -137
- package/src/engine/engine_networking_blob.ts +1 -1
- package/src/engine/engine_networking_instantiate.ts +2 -2
- package/src/engine/engine_networking_types.ts +41 -1
- package/src/engine/engine_physics_rapier.ts +102 -33
- package/src/engine/engine_scenedata.ts +56 -30
- package/src/engine/engine_serialization_builtin_serializer.ts +64 -52
- package/src/engine/engine_serialization_core.ts +9 -0
- package/src/engine/engine_ssr.ts +3 -0
- package/src/engine/engine_types.ts +48 -27
- package/src/engine/engine_util_decorator.ts +7 -2
- package/src/engine/engine_utils.ts +16 -5
- package/src/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
- package/src/engine/webcomponents/jsx.d.ts +51 -0
- package/src/engine/webcomponents/logo-element.ts +1 -0
- package/src/engine/webcomponents/needle menu/needle-menu.ts +3 -2
- package/src/engine/webcomponents/needle-button.ts +1 -0
- package/src/engine/webcomponents/needle-engine.ts +11 -4
- package/src/engine/xr/NeedleXRSession.ts +48 -13
- package/src/engine/xr/events.ts +1 -1
- package/src/engine-components/Animation.ts +19 -16
- package/src/engine-components/AnimationBuilder.ts +472 -0
- package/src/engine-components/Animator.ts +24 -12
- package/src/engine-components/AnimatorController.builder.ts +387 -0
- package/src/engine-components/AnimatorController.ts +24 -292
- package/src/engine-components/AudioSource.ts +130 -79
- package/src/engine-components/Collider.ts +66 -18
- package/src/engine-components/Component.ts +118 -20
- package/src/engine-components/ContactShadows.ts +15 -1
- package/src/engine-components/DragControls.ts +18 -11
- package/src/engine-components/DropListener.ts +3 -0
- package/src/engine-components/EventList.ts +45 -83
- package/src/engine-components/Joints.ts +20 -4
- package/src/engine-components/Light.ts +49 -27
- package/src/engine-components/Networking.ts +1 -1
- package/src/engine-components/OrbitControls.ts +34 -14
- package/src/engine-components/ReflectionProbe.ts +2 -0
- package/src/engine-components/RigidBody.ts +18 -4
- package/src/engine-components/SceneSwitcher.ts +3 -0
- package/src/engine-components/SeeThrough.ts +2 -2
- package/src/engine-components/api.ts +2 -1
- package/src/engine-components/codegen/components.ts +7 -13
- package/src/engine-components/postprocessing/VolumeParameter.ts +4 -1
- package/src/engine-components/timeline/PlayableDirector.ts +83 -81
- package/src/engine-components/timeline/SignalAsset.ts +4 -1
- package/src/engine-components/timeline/TimelineBuilder.ts +824 -0
- package/src/engine-components/timeline/TimelineModels.ts +5 -1
- package/src/engine-components/timeline/TimelineTracks.ts +96 -27
- package/src/engine-components/timeline/index.ts +2 -1
- package/src/engine-components/ui/Canvas.ts +2 -8
- package/src/engine-components/ui/Text.ts +12 -8
- package/src/engine-components/web/CursorFollow.ts +21 -14
- package/src/engine-components/webxr/WebXRImageTracking.ts +2 -0
- package/src/needle-engine.ts +3 -0
- package/dist/needle-engine.bundle-BMlLSACE.umd.cjs +0 -1732
- package/dist/needle-engine.bundle-BXPPQRer.min.js +0 -1732
- package/lib/engine-components/AvatarLoader.d.ts +0 -80
- package/lib/engine-components/AvatarLoader.js +0 -232
- package/lib/engine-components/AvatarLoader.js.map +0 -1
- package/lib/engine-components/avatar/AvatarBlink_Simple.d.ts +0 -11
- package/lib/engine-components/avatar/AvatarBlink_Simple.js +0 -77
- package/lib/engine-components/avatar/AvatarBlink_Simple.js.map +0 -1
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.d.ts +0 -14
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js +0 -69
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js.map +0 -1
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.d.ts +0 -29
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.js +0 -122
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.js.map +0 -1
- package/lib/engine-components/avatar/Avatar_MouthShapes.d.ts +0 -15
- package/lib/engine-components/avatar/Avatar_MouthShapes.js +0 -80
- package/lib/engine-components/avatar/Avatar_MouthShapes.js.map +0 -1
- package/lib/engine-components/avatar/Avatar_MustacheShake.d.ts +0 -9
- package/lib/engine-components/avatar/Avatar_MustacheShake.js +0 -30
- package/lib/engine-components/avatar/Avatar_MustacheShake.js.map +0 -1
- package/src/engine-components/AvatarLoader.ts +0 -264
- package/src/engine-components/avatar/AvatarBlink_Simple.ts +0 -70
- package/src/engine-components/avatar/AvatarEyeLook_Rotation.ts +0 -64
- package/src/engine-components/avatar/Avatar_Brain_LookAt.ts +0 -140
- package/src/engine-components/avatar/Avatar_MouthShapes.ts +0 -84
- package/src/engine-components/avatar/Avatar_MustacheShake.ts +0 -32
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CameraHelper, Color, DirectionalLight, DirectionalLightHelper, Light as ThreeLight, OrthographicCamera, PointLight, SpotLight, Vector3 } from "three";
|
|
2
2
|
|
|
3
3
|
import { serializable } from "../engine/engine_serialization_decorator.js";
|
|
4
|
-
import { FrameEvent } from "../engine/engine_setup.js";
|
|
5
4
|
import { setWorldPositionXYZ } from "../engine/engine_three_utils.js";
|
|
6
5
|
import type { ILight } from "../engine/engine_types.js";
|
|
7
6
|
import { getParam } from "../engine/engine_utils.js";
|
|
8
7
|
import type { NeedleXREventArgs } from "../engine/xr/api.js";
|
|
9
8
|
import { Behaviour, GameObject } from "./Component.js";
|
|
9
|
+
import { isDevEnvironment } from "../engine/debug/index.js";
|
|
10
10
|
|
|
11
11
|
// https://threejs.org/examples/webgl_shadowmap_csm.html
|
|
12
12
|
|
|
@@ -106,11 +106,43 @@ enum LightShadows {
|
|
|
106
106
|
export class Light extends Behaviour implements ILight {
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
* The type of light
|
|
110
|
-
* Can not be changed at runtime.
|
|
109
|
+
* The type of light as a lowercase string: `"directional"`, `"point"`, `"spot"`.
|
|
110
|
+
* Implements {@link ILight.type}. Can not be changed at runtime.
|
|
111
111
|
*/
|
|
112
|
+
get type(): ILight["type"] {
|
|
113
|
+
return this._type;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Numeric LightType serialized from Unity/Blender — converts to string on write */
|
|
112
117
|
@serializable()
|
|
113
|
-
|
|
118
|
+
set type(value: LightType | ILight["type"]) {
|
|
119
|
+
if (this.light && this.__didAwake) {
|
|
120
|
+
throw new Error("Changing the light type at runtime is not supported");
|
|
121
|
+
}
|
|
122
|
+
switch (value) {
|
|
123
|
+
case LightType.Directional:
|
|
124
|
+
this._type = "directional";
|
|
125
|
+
break;
|
|
126
|
+
case LightType.Point:
|
|
127
|
+
this._type = "point";
|
|
128
|
+
break;
|
|
129
|
+
case LightType.Spot:
|
|
130
|
+
this._type = "spot";
|
|
131
|
+
break;
|
|
132
|
+
case "directional":
|
|
133
|
+
case "point":
|
|
134
|
+
case "spot":
|
|
135
|
+
this._type = value;
|
|
136
|
+
break;
|
|
137
|
+
default:
|
|
138
|
+
if (debug || isDevEnvironment())
|
|
139
|
+
console.warn(`[Light] Unsupported light type: ${LightType[value]} (${value}) on '${this.name}'`);
|
|
140
|
+
this._type = "unsupported" as any;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
private _type: ILight["type"] = "point";
|
|
145
|
+
|
|
114
146
|
|
|
115
147
|
/**
|
|
116
148
|
* The maximum distance the light affects.
|
|
@@ -345,7 +377,7 @@ export class Light extends Behaviour implements ILight {
|
|
|
345
377
|
*/
|
|
346
378
|
public getWorldPosition(vec: Vector3): Vector3 {
|
|
347
379
|
if (this.light) {
|
|
348
|
-
if (this.type ===
|
|
380
|
+
if (this.type === "directional") {
|
|
349
381
|
return this.light.getWorldPosition(vec).multiplyScalar(1);
|
|
350
382
|
}
|
|
351
383
|
return this.light.getWorldPosition(vec);
|
|
@@ -372,12 +404,13 @@ export class Light extends Behaviour implements ILight {
|
|
|
372
404
|
else if (this.light.parent !== this.gameObject)
|
|
373
405
|
this.gameObject.add(this.light);
|
|
374
406
|
}
|
|
375
|
-
|
|
376
|
-
this.startCoroutine(this.updateMainLightRoutine(), FrameEvent.LateUpdate);
|
|
407
|
+
this.context.lights.push(this);
|
|
377
408
|
}
|
|
378
409
|
|
|
379
410
|
onDisable() {
|
|
380
411
|
if (debug) console.log("DISABLE LIGHT", this.name);
|
|
412
|
+
const index = this.context.lights.indexOf(this);
|
|
413
|
+
if (index !== -1) this.context.lights.splice(index, 1);
|
|
381
414
|
if (this.light) {
|
|
382
415
|
if (this.selfIsLight)
|
|
383
416
|
this.light.intensity = 0;
|
|
@@ -399,14 +432,14 @@ export class Light extends Behaviour implements ILight {
|
|
|
399
432
|
this._intensity = this.light.intensity;
|
|
400
433
|
|
|
401
434
|
switch (this.type) {
|
|
402
|
-
case
|
|
435
|
+
case "directional":
|
|
403
436
|
this.setDirectionalLight(this.light as DirectionalLight);
|
|
404
437
|
break;
|
|
405
438
|
}
|
|
406
439
|
}
|
|
407
440
|
else if (!this.light) {
|
|
408
441
|
switch (this.type) {
|
|
409
|
-
case
|
|
442
|
+
case "directional":
|
|
410
443
|
// console.log(this);
|
|
411
444
|
const dirLight = new DirectionalLight(this.color, this.intensity * Math.PI);
|
|
412
445
|
// directional light target is at 0 0 0 by default
|
|
@@ -425,7 +458,7 @@ export class Light extends Behaviour implements ILight {
|
|
|
425
458
|
}
|
|
426
459
|
break;
|
|
427
460
|
|
|
428
|
-
case
|
|
461
|
+
case "spot":
|
|
429
462
|
const spotLight = new SpotLight(this.color, this.intensity * Math.PI, this.range, toRadians(this.spotAngle / 2), 1 - toRadians(this.innerSpotAngle / 2) / toRadians(this.spotAngle / 2), 2);
|
|
430
463
|
spotLight.position.set(0, 0, 0);
|
|
431
464
|
spotLight.rotation.set(0, 0, 0);
|
|
@@ -437,13 +470,18 @@ export class Light extends Behaviour implements ILight {
|
|
|
437
470
|
spotLightTarget.rotation.set(0, 0, 0);
|
|
438
471
|
break;
|
|
439
472
|
|
|
440
|
-
case
|
|
473
|
+
case "point":
|
|
441
474
|
const pointLight = new PointLight(this.color, this.intensity * Math.PI, this.range);
|
|
442
475
|
this.light = pointLight;
|
|
443
476
|
|
|
444
477
|
// const pointHelper = new PointLightHelper(pointLight, this.range, this.color);
|
|
445
478
|
// scene.add(pointHelper);
|
|
446
479
|
break;
|
|
480
|
+
|
|
481
|
+
default:
|
|
482
|
+
if (debug) console.warn(`[Light] Unsupported light type: ${LightType[this.type as any]} (${this.type}) on '${this.name}'`);
|
|
483
|
+
break;
|
|
484
|
+
|
|
447
485
|
}
|
|
448
486
|
}
|
|
449
487
|
|
|
@@ -526,22 +564,6 @@ export class Light extends Behaviour implements ILight {
|
|
|
526
564
|
|
|
527
565
|
}
|
|
528
566
|
|
|
529
|
-
/**
|
|
530
|
-
* Coroutine that updates the main light reference in the context
|
|
531
|
-
* if this directional light should be the main light
|
|
532
|
-
*/
|
|
533
|
-
*updateMainLightRoutine() {
|
|
534
|
-
while (true) {
|
|
535
|
-
if (this.type === LightType.Directional) {
|
|
536
|
-
if (!this.context.mainLight || this.intensity > this.context.mainLight.intensity) {
|
|
537
|
-
this.context.mainLight = this;
|
|
538
|
-
}
|
|
539
|
-
yield;
|
|
540
|
-
}
|
|
541
|
-
break;
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
|
|
545
567
|
/**
|
|
546
568
|
* Controls whether the renderer's shadow map type can be changed when soft shadows are used
|
|
547
569
|
*/
|
|
@@ -37,7 +37,7 @@ const debug = getParam("debugnet");
|
|
|
37
37
|
* @see {@link RoomEvents} for room lifecycle events
|
|
38
38
|
* @see {@link isLocalNetwork} for local network detection
|
|
39
39
|
* @link https://engine.needle.tools/docs/how-to-guides/networking/
|
|
40
|
-
* @summary
|
|
40
|
+
* @summary Configures the websocket server URL for multiplayer networking
|
|
41
41
|
* @category Networking
|
|
42
42
|
* @group Components
|
|
43
43
|
*/
|
|
@@ -663,7 +663,15 @@ export class OrbitControls extends Behaviour implements ICameraController {
|
|
|
663
663
|
}
|
|
664
664
|
this._controls.enabled = true;
|
|
665
665
|
|
|
666
|
-
|
|
666
|
+
// Interrupt programmatic transitions on meaningful new user interaction:
|
|
667
|
+
// - Middle/right button down (always intentional camera control)
|
|
668
|
+
// - Mouse wheel (zoom intent)
|
|
669
|
+
// - Left button drag start: getPointerDown(0) with a position delta — a bare click
|
|
670
|
+
// without movement shouldn't cancel an animation, but starting to drag should.
|
|
671
|
+
// Using getPointerDown (not getPointerPressed) ensures we only interrupt once at
|
|
672
|
+
// drag onset, not continuously every frame during a drag.
|
|
673
|
+
const leftDragStart = this.context.input.getPointerDown(0) && (this.context.input.getPointerPositionDelta(0)?.length() || 0) > .1;
|
|
674
|
+
if (this.context.input.getPointerDown(1) || this.context.input.getPointerDown(2) || this.context.input.mouseWheelChanged || leftDragStart) {
|
|
667
675
|
this._inputs += 1;
|
|
668
676
|
}
|
|
669
677
|
if (this._inputs > 0 && this.allowInterrupt) {
|
|
@@ -758,19 +766,26 @@ export class OrbitControls extends Behaviour implements ICameraController {
|
|
|
758
766
|
|
|
759
767
|
if (this.targetBounds) {
|
|
760
768
|
// #region target bounds
|
|
761
|
-
const targetVector = this._controls.target;
|
|
762
769
|
const boundsCenter = this.targetBounds.worldPosition;
|
|
763
770
|
const boundsHalfSize = getTempVector(this.targetBounds.worldScale).multiplyScalar(0.5);
|
|
764
771
|
const min = getTempVector(boundsCenter).sub(boundsHalfSize);
|
|
765
772
|
const max = getTempVector(boundsCenter).add(boundsHalfSize);
|
|
766
|
-
|
|
767
|
-
const duration = .1;
|
|
768
|
-
if (duration <= 0) targetVector.copy(newTarget);
|
|
769
|
-
else targetVector.lerp(newTarget, this.context.time.deltaTime / duration);
|
|
773
|
+
|
|
770
774
|
if (this._lookTargetLerpActive) {
|
|
771
|
-
|
|
772
|
-
|
|
775
|
+
// During a programmatic transition (fitCamera / setLookTargetPosition with immediate: false),
|
|
776
|
+
// only clamp the destination. The look-target lerp (above) handles moving _controls.target
|
|
777
|
+
// towards the endpoint — we must not fight it by also lerping _controls.target here.
|
|
778
|
+
this._lookTargetEndPosition.clamp(min, max);
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
// Interactive use (pan/orbit): smoothly push the target back into bounds
|
|
782
|
+
const targetVector = this._controls.target;
|
|
783
|
+
const newTarget = getTempVector(targetVector).clamp(min, max);
|
|
784
|
+
const duration = .1;
|
|
785
|
+
if (duration <= 0) targetVector.copy(newTarget);
|
|
786
|
+
else targetVector.lerp(newTarget, Math.min(1, this.context.time.deltaTime / duration));
|
|
773
787
|
}
|
|
788
|
+
|
|
774
789
|
if (debug) {
|
|
775
790
|
Gizmos.DrawWireBox(boundsCenter, boundsHalfSize.multiplyScalar(2), 0xffaa00);
|
|
776
791
|
}
|
|
@@ -847,7 +862,8 @@ export class OrbitControls extends Behaviour implements ICameraController {
|
|
|
847
862
|
this._controls.update(this.context.time.deltaTime);
|
|
848
863
|
|
|
849
864
|
if (debug) {
|
|
850
|
-
|
|
865
|
+
const distance = this._controls.getDistance();
|
|
866
|
+
Gizmos.DrawWireSphere(this._controls.target, 0.01 * distance, 0x00ff00);
|
|
851
867
|
}
|
|
852
868
|
}
|
|
853
869
|
}
|
|
@@ -1022,7 +1038,8 @@ export class OrbitControls extends Behaviour implements ICameraController {
|
|
|
1022
1038
|
|
|
1023
1039
|
if (debug) {
|
|
1024
1040
|
console.warn("OrbitControls: setLookTargetPosition", position, immediateOrDuration);
|
|
1025
|
-
|
|
1041
|
+
const distance = this._controls.getDistance();
|
|
1042
|
+
Gizmos.DrawWireSphere(this._lookTargetEndPosition, 0.01 * distance, 0xff5500, 2);
|
|
1026
1043
|
}
|
|
1027
1044
|
|
|
1028
1045
|
if (immediateOrDuration === true) {
|
|
@@ -1086,13 +1103,16 @@ export class OrbitControls extends Behaviour implements ICameraController {
|
|
|
1086
1103
|
// Adapted from https://discourse.threejs.org/t/camera-zoom-to-fit-object/936/24
|
|
1087
1104
|
// Slower but better implementation that takes bones and exact vertex positions into account: https://github.com/google/model-viewer/blob/04e900c5027de8c5306fe1fe9627707f42811b05/packages/model-viewer/src/three-components/ModelScene.ts#L321
|
|
1088
1105
|
|
|
1089
|
-
/**
|
|
1090
|
-
* Fits the camera to show the objects provided (defaults to the scene if no objects are passed in)
|
|
1106
|
+
/**
|
|
1107
|
+
* Fits the camera to show the objects provided (defaults to the scene if no objects are passed in)
|
|
1091
1108
|
* @param options The options for fitting the camera. Use to provide objects to fit to, fit direction and size and other settings.
|
|
1092
1109
|
*/
|
|
1093
1110
|
fitCamera(options?: OrbitFitCameraOptions);
|
|
1094
|
-
|
|
1095
|
-
|
|
1111
|
+
// Deprecated overload commented out: it accepted Object3D as first arg, which caused
|
|
1112
|
+
// TypeScript autocomplete to show Object3D properties (position, worldPosition, etc.)
|
|
1113
|
+
// instead of OrbitFitCameraOptions. The implementation still handles Object3D at runtime
|
|
1114
|
+
// for backwards-compat — use fitCamera({ objects: [...] }) instead.
|
|
1115
|
+
// fitCamera(objects?: Object3D | Array<Object3D>, options?: Omit<OrbitFitCameraOptions, "objects">);
|
|
1096
1116
|
fitCamera(objectsOrOptions?: Object3D | Array<Object3D> | OrbitFitCameraOptions, options?: OrbitFitCameraOptions): void {
|
|
1097
1117
|
|
|
1098
1118
|
|
|
@@ -290,6 +290,8 @@ export class ReflectionProbe extends Behaviour {
|
|
|
290
290
|
const current = block.getOverride("envMap")?.value;
|
|
291
291
|
if (current === this.texture) {
|
|
292
292
|
block.removeOveride("envMap");
|
|
293
|
+
block.removeOveride("envMapRotation");
|
|
294
|
+
block.removeOveride("envMapIntensity");
|
|
293
295
|
}
|
|
294
296
|
}
|
|
295
297
|
}
|
|
@@ -204,12 +204,19 @@ export class Rigidbody extends Behaviour implements IRigidbody {
|
|
|
204
204
|
|
|
205
205
|
get isRigidbody() { return true; }
|
|
206
206
|
|
|
207
|
-
/** When true the mass
|
|
207
|
+
/** When true the mass is automatically computed from the attached colliders using `mass = density × volume`.
|
|
208
|
+
* Each collider's {@link Collider.density} determines how heavy it contributes to the total mass.
|
|
209
|
+
* Disable to set mass explicitly via the `mass` property.
|
|
210
|
+
*/
|
|
208
211
|
@validate()
|
|
209
212
|
autoMass: boolean = true;
|
|
210
213
|
|
|
211
|
-
/**
|
|
212
|
-
*
|
|
214
|
+
/** The mass of the rigidbody in kg (when `autoMass` is disabled).
|
|
215
|
+
* When `autoMass` is enabled, reading this returns the computed mass from `density × volume` of all attached colliders.
|
|
216
|
+
* Setting this property automatically disables `autoMass`.
|
|
217
|
+
*
|
|
218
|
+
* **Prefer using {@link Collider.density}** with `autoMass` enabled instead — density scales
|
|
219
|
+
* naturally with collider size, while explicit mass stays fixed regardless of shape changes.
|
|
213
220
|
*/
|
|
214
221
|
@serializable()
|
|
215
222
|
set mass(value: number) {
|
|
@@ -403,9 +410,16 @@ export class Rigidbody extends Behaviour implements IRigidbody {
|
|
|
403
410
|
this.context.physics.engine?.removeBody(this);
|
|
404
411
|
}
|
|
405
412
|
|
|
406
|
-
onValidate() {
|
|
413
|
+
onValidate(property?: string) {
|
|
407
414
|
this._propertiesChanged = true;
|
|
415
|
+
if (property === "autoMass" && !this.autoMass) {
|
|
416
|
+
if (isDevEnvironment() && !Rigidbody._didWarnAutoMass) {
|
|
417
|
+
Rigidbody._didWarnAutoMass = true;
|
|
418
|
+
console.warn("[Rigidbody] autoMass disabled — consider using Collider.density instead of setting mass explicitly. Density scales naturally with collider size.");
|
|
419
|
+
}
|
|
420
|
+
}
|
|
408
421
|
}
|
|
422
|
+
private static _didWarnAutoMass = false;
|
|
409
423
|
|
|
410
424
|
// need to do this right before updating physics to prevent rendered object glitching through physical bodies
|
|
411
425
|
* beforePhysics() {
|
|
@@ -747,6 +747,9 @@ export class SceneSwitcher extends Behaviour {
|
|
|
747
747
|
const openedEvt = new CustomEvent<LoadSceneEvent>("scene-opened", { detail: { scene: scene, switcher: this, index: index } });
|
|
748
748
|
this.dispatchEvent(openedEvt);
|
|
749
749
|
this.sceneLoaded?.invoke(this);
|
|
750
|
+
if (this._currentSceneAsset) {
|
|
751
|
+
this.context.events.emit("scene-content-changed", { source: this, object: this._currentSceneAsset });
|
|
752
|
+
}
|
|
750
753
|
return true;
|
|
751
754
|
}
|
|
752
755
|
}
|
|
@@ -249,10 +249,10 @@ export class SeeThrough extends Behaviour {
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
const materials = renderer.sharedMaterials;// : this.rendererMaterials.get(renderer);
|
|
252
|
-
if (!materials) return;
|
|
252
|
+
if (!materials?.length) return;
|
|
253
253
|
|
|
254
254
|
const block = MaterialPropertyBlock.get(renderer.gameObject);
|
|
255
|
-
const currentOpacity = (block.getOverride("opacity")?.value ?? materials[0]
|
|
255
|
+
const currentOpacity = (block.getOverride("opacity")?.value ?? materials[0]?.opacity ?? 1);
|
|
256
256
|
|
|
257
257
|
let newAlpha = Mathf.lerp(currentOpacity, targetAlpha, duration <= 0 ? 1 : this.context.time.deltaTime / duration);;
|
|
258
258
|
if (newAlpha >= 0.99) newAlpha = 1;
|
|
@@ -34,8 +34,9 @@
|
|
|
34
34
|
* @module Built-in Components
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
+
export { AnimationBuilder, type AnimationKeyframe, type Tween, type AnimationInterpolation } from "./AnimationBuilder.js";
|
|
38
|
+
export { AnimatorControllerBuilder, type ConditionMode, type StateOptions, type TransitionOptions } from "./AnimatorController.builder.js";
|
|
37
39
|
export * from "./codegen/components.js";
|
|
38
|
-
export { AnimatorControllerBuilder, type ConditionMode, type StateOptions, type TransitionOptions } from "./AnimatorController.js";
|
|
39
40
|
export { Collider } from "./Collider.js"; // export abstract type
|
|
40
41
|
export { Behaviour, Component, GameObject } from "./Component.js";
|
|
41
42
|
|
|
@@ -3,21 +3,13 @@
|
|
|
3
3
|
export class __Ignore {}
|
|
4
4
|
export { AlignmentConstraint } from "../AlignmentConstraint.js";
|
|
5
5
|
export { Animation } from "../Animation.js";
|
|
6
|
+
export { AnimationBuilder } from "../AnimationBuilder.js";
|
|
6
7
|
export { Keyframe } from "../AnimationCurve.js";
|
|
7
8
|
export { AnimationCurve } from "../AnimationCurve.js";
|
|
8
9
|
export { Animator } from "../Animator.js";
|
|
9
|
-
export { AnimatorControllerBuilder } from "../AnimatorController.js";
|
|
10
10
|
export { AnimatorController } from "../AnimatorController.js";
|
|
11
11
|
export { AudioListener } from "../AudioListener.js";
|
|
12
12
|
export { AudioSource } from "../AudioSource.js";
|
|
13
|
-
export { Avatar_POI } from "../avatar/Avatar_Brain_LookAt.js";
|
|
14
|
-
export { Avatar_Brain_LookAt } from "../avatar/Avatar_Brain_LookAt.js";
|
|
15
|
-
export { Avatar_MouthShapes } from "../avatar/Avatar_MouthShapes.js";
|
|
16
|
-
export { Avatar_MustacheShake } from "../avatar/Avatar_MustacheShake.js";
|
|
17
|
-
export { AvatarBlink_Simple } from "../avatar/AvatarBlink_Simple.js";
|
|
18
|
-
export { AvatarEyeLook_Rotation } from "../avatar/AvatarEyeLook_Rotation.js";
|
|
19
|
-
export { AvatarModel } from "../AvatarLoader.js";
|
|
20
|
-
export { AvatarLoader } from "../AvatarLoader.js";
|
|
21
13
|
export { AxesHelper } from "../AxesHelper.js";
|
|
22
14
|
export { BasicIKConstraint } from "../BasicIKConstraint.js";
|
|
23
15
|
export { BoxHelperComponent } from "../BoxHelperComponent.js";
|
|
@@ -168,11 +160,13 @@ export { PlayableDirector } from "../timeline/PlayableDirector.js";
|
|
|
168
160
|
export { SignalAsset } from "../timeline/SignalAsset.js";
|
|
169
161
|
export { SignalReceiverEvent } from "../timeline/SignalAsset.js";
|
|
170
162
|
export { SignalReceiver } from "../timeline/SignalAsset.js";
|
|
171
|
-
export {
|
|
172
|
-
export {
|
|
173
|
-
export {
|
|
163
|
+
export { TimelineBuilder } from "../timeline/TimelineBuilder.js";
|
|
164
|
+
export { TimelineAnimationTrack } from "../timeline/TimelineTracks.js";
|
|
165
|
+
export { TimelineAudioTrack } from "../timeline/TimelineTracks.js";
|
|
166
|
+
export { TimelineMarkerTrack } from "../timeline/TimelineTracks.js";
|
|
174
167
|
export { SignalTrackHandler } from "../timeline/TimelineTracks.js";
|
|
175
|
-
export {
|
|
168
|
+
export { TimelineActivationTrack } from "../timeline/TimelineTracks.js";
|
|
169
|
+
export { TimelineControlTrack } from "../timeline/TimelineTracks.js";
|
|
176
170
|
export { TransformGizmo } from "../TransformGizmo.js";
|
|
177
171
|
export { BaseUIComponent } from "../ui/BaseUIComponent.js";
|
|
178
172
|
export { UIRootComponent } from "../ui/BaseUIComponent.js";
|