@needle-tools/engine 5.1.0-alpha.8 → 5.1.0-beta
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 +17 -0
- package/components.needle.json +1 -1
- package/dist/{materialx-CE2sUv2B.umd.cjs → materialx-B47Bz-xs.umd.cjs} +1 -1
- package/dist/{materialx-u1EqYrhu.min.js → materialx-B85WjP7E.min.js} +1 -1
- package/dist/{materialx-vyB2Zbt4.js → materialx-jkHmVPez.js} +1 -1
- package/dist/{needle-engine.bundle-3LOy9tj8.js → needle-engine.bundle-BWkDSRyF.js} +6248 -6001
- package/dist/{needle-engine.bundle-BuI2pjv1.min.js → needle-engine.bundle-BvgS8xMP.min.js} +171 -171
- package/dist/{needle-engine.bundle-DQy9vQdJ.umd.cjs → needle-engine.bundle-CdVr_iIe.umd.cjs} +142 -142
- package/dist/needle-engine.d.ts +359 -46
- package/dist/needle-engine.js +618 -606
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{vendor-ButPLzor.umd.cjs → vendor-1UvpPPSB.umd.cjs} +2 -2
- package/dist/{vendor-DqZC4Is7.min.js → vendor-BQ2Vuntm.min.js} +4 -4
- package/dist/{vendor-DkWSNjMV.js → vendor-BslSKZPo.js} +113 -106
- 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/engine_audio.d.ts +30 -1
- package/lib/engine/engine_audio.js +57 -13
- package/lib/engine/engine_audio.js.map +1 -1
- package/lib/engine/engine_init.js +2 -2
- package/lib/engine/engine_init.js.map +1 -1
- package/lib/engine/engine_license.d.ts +7 -7
- package/lib/engine/engine_license.js +72 -72
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_math.d.ts +1 -1
- package/lib/engine/engine_math.js +10 -4
- package/lib/engine/engine_math.js.map +1 -1
- package/lib/engine/engine_networking_blob.js +3 -3
- package/lib/engine/engine_networking_blob.js.map +1 -1
- package/lib/engine/engine_scenedata.js +7 -0
- package/lib/engine/engine_scenedata.js.map +1 -1
- package/lib/engine/engine_serialization_core.js +7 -2
- package/lib/engine/engine_serialization_core.js.map +1 -1
- package/lib/engine/engine_time_utils.d.ts +10 -6
- package/lib/engine/engine_time_utils.js +10 -6
- package/lib/engine/engine_time_utils.js.map +1 -1
- package/lib/engine/engine_utils_qrcode.js +2 -2
- package/lib/engine/engine_utils_qrcode.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.js +2 -2
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
- package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
- package/lib/engine/xr/TempXRContext.js +2 -2
- package/lib/engine/xr/TempXRContext.js.map +1 -1
- package/lib/engine-components/AudioSource.d.ts +46 -2
- package/lib/engine-components/AudioSource.js +268 -60
- package/lib/engine-components/AudioSource.js.map +1 -1
- package/lib/engine-components/Component.js +2 -1
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/DragControls.js +2 -2
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/DragControlsConstraints.d.ts +0 -15
- package/lib/engine-components/DragControlsConstraints.js +14 -8
- package/lib/engine-components/DragControlsConstraints.js.map +1 -1
- package/lib/engine-components/EventList.js +1 -1
- package/lib/engine-components/EventList.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.d.ts +2 -0
- package/lib/engine-components/SceneSwitcher.js +43 -16
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/SeeThrough.d.ts +39 -0
- package/lib/engine-components/SeeThrough.js +69 -1
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/api.d.ts +1 -0
- package/lib/engine-components/api.js +1 -0
- package/lib/engine-components/api.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +10 -0
- package/lib/engine-components/codegen/components.js +10 -0
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
- package/lib/engine-components/timeline/PlayableDirector.js +1 -1
- package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
- package/lib/engine-components/web/ScrollFollow.d.ts +33 -0
- package/lib/engine-components/web/ScrollFollow.js +164 -22
- package/lib/engine-components/web/ScrollFollow.js.map +1 -1
- package/lib/needle-app.d.ts +18 -0
- package/lib/needle-app.js +19 -0
- package/lib/needle-app.js.map +1 -0
- package/package.json +3 -2
- package/plugins/common/license.js +25 -4
- package/plugins/common/needle-engine.js +5 -2
- package/plugins/types/userconfig.d.ts +22 -0
- package/plugins/vite/dts-generator.d.ts +24 -0
- package/plugins/vite/dts-generator.js +40 -7
- package/plugins/vite/index.d.ts +2 -0
- package/plugins/vite/index.js +17 -0
- package/plugins/vite/license.js +4 -4
- package/plugins/vite/needle-app.js +78 -5
- package/plugins/vite/remote.d.ts +28 -0
- package/plugins/vite/remote.js +124 -0
- package/src/engine/api.ts +1 -1
- package/src/engine/engine_audio.ts +68 -15
- package/src/engine/engine_gameobject.ts +1 -1
- package/src/engine/engine_init.ts +2 -2
- package/src/engine/engine_license.ts +69 -69
- package/src/engine/engine_math.ts +11 -4
- package/src/engine/engine_networking_blob.ts +3 -3
- package/src/engine/engine_scenedata.ts +7 -2
- package/src/engine/engine_serialization_core.ts +7 -2
- package/src/engine/engine_time_utils.ts +10 -6
- package/src/engine/engine_utils_qrcode.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
- package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
- package/src/engine/webcomponents/needle-engine.ts +2 -2
- package/src/engine/xr/TempXRContext.ts +2 -2
- package/src/engine-components/AudioSource.ts +256 -55
- package/src/engine-components/Component.ts +2 -1
- package/src/engine-components/DragControls.ts +3 -2
- package/src/engine-components/DragControlsConstraints.ts +16 -8
- package/src/engine-components/EventList.ts +1 -1
- package/src/engine-components/SceneSwitcher.ts +37 -15
- package/src/engine-components/SeeThrough.ts +75 -1
- package/src/engine-components/api.ts +1 -0
- package/src/engine-components/codegen/components.ts +10 -0
- package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
- package/src/engine-components/timeline/PlayableDirector.ts +1 -1
- package/src/engine-components/web/ScrollFollow.ts +168 -22
package/dist/needle-engine.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ import { Pass } from 'postprocessing';
|
|
|
75
75
|
import { peerjs } from 'peerjs';
|
|
76
76
|
import { PeerJSOption } from 'peerjs';
|
|
77
77
|
import { PerspectiveCamera } from 'three';
|
|
78
|
+
import { Plane } from 'three';
|
|
78
79
|
import { PositionalAudio } from 'three';
|
|
79
80
|
import { postprocessing } from 'postprocessing';
|
|
80
81
|
import { Particle as QParticle } from 'three.quarks';
|
|
@@ -117,11 +118,11 @@ import { XRHandSpace } from 'three';
|
|
|
117
118
|
|
|
118
119
|
export declare const $componentName: unique symbol;
|
|
119
120
|
|
|
120
|
-
|
|
121
|
+
/* Excluded from this release type: $fwGZrGe */
|
|
121
122
|
|
|
122
|
-
|
|
123
|
+
export declare const $physicsKey: unique symbol;
|
|
123
124
|
|
|
124
|
-
/* Excluded from this release type:
|
|
125
|
+
/* Excluded from this release type: _$qWUhYZU */
|
|
125
126
|
|
|
126
127
|
export declare class __Ignore {
|
|
127
128
|
}
|
|
@@ -1980,11 +1981,18 @@ export declare class AudioSource extends Component {
|
|
|
1980
1981
|
private sound;
|
|
1981
1982
|
private helper;
|
|
1982
1983
|
private wasPlaying;
|
|
1983
|
-
private audioLoader;
|
|
1984
1984
|
private shouldPlay;
|
|
1985
|
-
private _lastClipStartedLoading;
|
|
1986
1985
|
private _loadedClip;
|
|
1987
1986
|
private _audioElement;
|
|
1987
|
+
/**
|
|
1988
|
+
* True when {@link _audioElement} is a file-URL element routed through
|
|
1989
|
+
* `sound.setMediaElementSource()` (the iOS-survivable string-clip path). For this path ALL
|
|
1990
|
+
* playback control (play/pause/stop/loop/pitch/time/isPlaying) goes through the element,
|
|
1991
|
+
* because three.js sets `hasPlaybackControl = false` once a media source is attached.
|
|
1992
|
+
* It is `false` for the distinct MediaStream path (which uses an element with `srcObject`
|
|
1993
|
+
* plus `setMediaStreamSource()` and is controlled differently).
|
|
1994
|
+
*/
|
|
1995
|
+
private _usesMediaElementSource;
|
|
1988
1996
|
private _entryNode;
|
|
1989
1997
|
private _spatialGain;
|
|
1990
1998
|
private _bypassGain;
|
|
@@ -2008,11 +2016,39 @@ export declare class AudioSource extends Component {
|
|
|
2008
2016
|
* @returns The {@link AudioContext} or null if not available
|
|
2009
2017
|
*/
|
|
2010
2018
|
get audioContext(): AudioContext | undefined;
|
|
2019
|
+
/**
|
|
2020
|
+
* Resumes the shared AudioContext if it is currently suspended/interrupted and the
|
|
2021
|
+
* page is visible. Uses the same policy as the global resume handler so this never
|
|
2022
|
+
* triggers the iOS `InvalidStateError: Failed to start the audio device` (which
|
|
2023
|
+
* happens when resuming while the page is hidden). No-op when the context is already
|
|
2024
|
+
* running or when resuming is not currently allowed.
|
|
2025
|
+
*/
|
|
2026
|
+
private ensureContextResumed;
|
|
2011
2027
|
/* Excluded from this release type: awake */
|
|
2012
2028
|
/* Excluded from this release type: onEnable */
|
|
2013
2029
|
/* Excluded from this release type: onDisable */
|
|
2014
2030
|
private onVisibilityChanged;
|
|
2015
2031
|
private onApplicationMuteChanged;
|
|
2032
|
+
/**
|
|
2033
|
+
* Sets up playback of a string (file URL) clip through an `HTMLAudioElement` routed into the
|
|
2034
|
+
* Web Audio graph via `sound.setMediaElementSource()`.
|
|
2035
|
+
*
|
|
2036
|
+
* Why a media element instead of a decoded `AudioBuffer`: on iOS Safari an
|
|
2037
|
+
* `AudioBufferSourceNode` has its output torn down after a device lock / audio-session
|
|
2038
|
+
* interruption and cannot be reliably revived. A `MediaElementAudioSourceNode` survives the
|
|
2039
|
+
* lock because the playing `<audio>` element keeps iOS's media session alive, so the shared
|
|
2040
|
+
* AudioContext is never torn down and resumes cleanly. This is the same approach three.js's own
|
|
2041
|
+
* `webaudio_orientation` example uses.
|
|
2042
|
+
*
|
|
2043
|
+
* This does NOT start playback — it only creates/wires the element so a later `.play()` (driven
|
|
2044
|
+
* by a user gesture) is cheap.
|
|
2045
|
+
*/
|
|
2046
|
+
private createAudioFromElement;
|
|
2047
|
+
/**
|
|
2048
|
+
* Sets up the {@link PositionalAudio} graph for a MediaStream clip (used for the MediaStream
|
|
2049
|
+
* path only — string clips go through {@link createAudioFromElement}). The actual stream node
|
|
2050
|
+
* is attached in {@link play} via `setMediaStreamSource`.
|
|
2051
|
+
*/
|
|
2016
2052
|
private createAudio;
|
|
2017
2053
|
private __onAllowAudioCallback;
|
|
2018
2054
|
/**
|
|
@@ -2034,6 +2070,15 @@ export declare class AudioSource extends Component {
|
|
|
2034
2070
|
* @returns A promise that resolves when playback starts successfully, or rejects on error
|
|
2035
2071
|
*/
|
|
2036
2072
|
play(clip?: string | MediaStream | undefined): Promise<boolean>;
|
|
2073
|
+
/**
|
|
2074
|
+
* Smoothly ramp the spatial-graph entry-gain node to `target` (1 = audible, 0 = silent) over a
|
|
2075
|
+
* few ms. A short *fade* — not a hard 0/1 gain change and not a connect/disconnect — is what
|
|
2076
|
+
* avoids the click on pause/resume (an instant change or a graph (dis)connect steps the waveform
|
|
2077
|
+
* → audible click). On iOS the MediaElementAudioSourceNode keeps feeding the graph after
|
|
2078
|
+
* element.pause() following an interruption, so fading this gain to 0 is what actually silences a
|
|
2079
|
+
* "paused" media clip; element.pause() only freezes its playback position.
|
|
2080
|
+
*/
|
|
2081
|
+
private fadeEntryGain;
|
|
2037
2082
|
/**
|
|
2038
2083
|
* Pauses audio playback while maintaining the current position.
|
|
2039
2084
|
* Use play() to resume from the paused position.
|
|
@@ -2217,6 +2262,24 @@ declare enum Axis {
|
|
|
2217
2262
|
Vertical = "y"
|
|
2218
2263
|
}
|
|
2219
2264
|
|
|
2265
|
+
/**
|
|
2266
|
+
* Constrains a dragged object to rotate only around a fixed world-space axis.
|
|
2267
|
+
* Uses swing-twist decomposition to extract only the twist component around
|
|
2268
|
+
* the given axis from the delta rotation since drag start, discarding any
|
|
2269
|
+
* perpendicular swing that would tilt the object.
|
|
2270
|
+
*
|
|
2271
|
+
* This is the correct constraint for XZ-plane dragging when the parent is
|
|
2272
|
+
* rotated — it restricts the object to yaw around the plane normal regardless
|
|
2273
|
+
* of how the plane is oriented in world space.
|
|
2274
|
+
*/
|
|
2275
|
+
export declare class AxisRotationConstraint implements IDragConstraint {
|
|
2276
|
+
private readonly _startQuat;
|
|
2277
|
+
private readonly _axis;
|
|
2278
|
+
constructor(axis: Vector3);
|
|
2279
|
+
init(ctx: IDragConstraintContext): void;
|
|
2280
|
+
apply(followObject: GameObject): void;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2220
2283
|
declare type BalloonOptions = {
|
|
2221
2284
|
type: LogType;
|
|
2222
2285
|
/**
|
|
@@ -2466,8 +2529,6 @@ export declare class BloomEffect extends PostProcessingEffect {
|
|
|
2466
2529
|
onCreateEffect(): BloomEffect_2;
|
|
2467
2530
|
}
|
|
2468
2531
|
|
|
2469
|
-
/* Excluded from this release type: bLW */
|
|
2470
|
-
|
|
2471
2532
|
/**
|
|
2472
2533
|
* BoxCollider represents a box-shaped (cuboid) collision volume.
|
|
2473
2534
|
* Most common collider type, efficient for walls, floors, crates, and rectangular objects.
|
|
@@ -5989,7 +6050,7 @@ export declare enum DragMode {
|
|
|
5989
6050
|
* All properties are lazy getters over the flat serialized fields on the owning `DragControls`,
|
|
5990
6051
|
* so runtime writes to those fields are reflected immediately without any extra bookkeeping.
|
|
5991
6052
|
*/
|
|
5992
|
-
declare class DragProfile {
|
|
6053
|
+
export declare class DragProfile {
|
|
5993
6054
|
private readonly _dc;
|
|
5994
6055
|
private readonly _xr;
|
|
5995
6056
|
/* Excluded from this release type: __constructor */
|
|
@@ -7007,6 +7068,33 @@ export declare class FixedJoint extends Joint {
|
|
|
7007
7068
|
protected createJoint(self: Rigidbody, other: Rigidbody): any;
|
|
7008
7069
|
}
|
|
7009
7070
|
|
|
7071
|
+
/**
|
|
7072
|
+
* Freezes individual rotation axes (X, Y, and/or Z) of the dragged object.
|
|
7073
|
+
* The locked axis values are captured once at construction time and restored every frame.
|
|
7074
|
+
*
|
|
7075
|
+
* Set {@link useLocalSpace} to `true` to lock axes in the object's local space;
|
|
7076
|
+
* leave it `false` (default) to lock axes in world space.
|
|
7077
|
+
*
|
|
7078
|
+
* @example Lock Y-axis rotation in world space:
|
|
7079
|
+
* ```ts
|
|
7080
|
+
* const c = new FixedRotationAxesConstraint(RotationAxis.Y, false);
|
|
7081
|
+
* // init is called automatically by DragControls, or call manually: c.init(ctx);
|
|
7082
|
+
* ```
|
|
7083
|
+
*/
|
|
7084
|
+
export declare class FixedRotationAxesConstraint implements IDragConstraint {
|
|
7085
|
+
frozenAxes: RotationAxis;
|
|
7086
|
+
useLocalSpace: boolean;
|
|
7087
|
+
private readonly _startEuler;
|
|
7088
|
+
private readonly _eulerCache;
|
|
7089
|
+
/**
|
|
7090
|
+
* @param frozenAxes Bitfield of {@link RotationAxis} values indicating which axes to lock.
|
|
7091
|
+
* @param useLocalSpace When `true`, axes are locked in the object's local space; otherwise world space.
|
|
7092
|
+
*/
|
|
7093
|
+
constructor(frozenAxes: RotationAxis, useLocalSpace?: boolean);
|
|
7094
|
+
init(ctx: IDragConstraintContext): void;
|
|
7095
|
+
apply(followObject: GameObject): void;
|
|
7096
|
+
}
|
|
7097
|
+
|
|
7010
7098
|
declare type FocusRect = DOMRect | Element | {
|
|
7011
7099
|
x: number;
|
|
7012
7100
|
y: number;
|
|
@@ -7917,6 +8005,22 @@ export declare class GltfExportBox extends BoxHelperComponent {
|
|
|
7917
8005
|
sceneRoot?: Object3D;
|
|
7918
8006
|
}
|
|
7919
8007
|
|
|
8008
|
+
/** Projects the grabbed attachment point back onto a plane after position is resolved,
|
|
8009
|
+
* with optional grid snapping on that plane.
|
|
8010
|
+
* Owned by the strategy that requires plane-clamping (e.g. {@link XZPlaneDragStrategy}). */
|
|
8011
|
+
export declare class GrabPointPlaneConstraint implements IDragConstraint {
|
|
8012
|
+
/** Plane to project the grabbed point onto. Typically the strategy's fixed drag plane. */
|
|
8013
|
+
readonly plane: Plane;
|
|
8014
|
+
/** Attachment point in dragged-object local space. Set once at drag start; the handler
|
|
8015
|
+
* mutates this Vector3 in-place so updates are reflected automatically. */
|
|
8016
|
+
hitPointInLocalSpace: Vector3 | null;
|
|
8017
|
+
/** Grid snap resolution on the plane. 0 = projection only, no snapping. */
|
|
8018
|
+
snapResolution: number;
|
|
8019
|
+
constructor(plane: Plane);
|
|
8020
|
+
init(ctx: IDragConstraintContext): void;
|
|
8021
|
+
apply(followObject: GameObject): void;
|
|
8022
|
+
}
|
|
8023
|
+
|
|
7920
8024
|
export declare class Gradient {
|
|
7921
8025
|
alphaKeys: Array<AlphaKey>;
|
|
7922
8026
|
colorKeys: Array<ColorKey>;
|
|
@@ -8078,6 +8182,15 @@ export declare class GridLayoutGroup extends LayoutGroup {
|
|
|
8078
8182
|
protected onCalculateLayout(): void;
|
|
8079
8183
|
}
|
|
8080
8184
|
|
|
8185
|
+
/** Snaps the follow object's world position to a uniform grid. Resolution ≤ 0 is a no-op.
|
|
8186
|
+
* For XZ-plane mode, use {@link GrabPointPlaneConstraint} instead (it handles both
|
|
8187
|
+
* plane-clamping and optional grid-snapping on the plane). */
|
|
8188
|
+
export declare class GridSnapConstraint implements IDragConstraint {
|
|
8189
|
+
snapGridResolution: number;
|
|
8190
|
+
constructor(snapGridResolution: number);
|
|
8191
|
+
apply(followObject: GameObject): void;
|
|
8192
|
+
}
|
|
8193
|
+
|
|
8081
8194
|
/**
|
|
8082
8195
|
* The [GroundProjectedEnv](https://engine.needle.tools/docs/api/GroundProjectedEnv) projects the environment map onto a virtual ground plane.
|
|
8083
8196
|
* Creates a realistic floor from 360° panoramas/HDRIs by deforming the skybox
|
|
@@ -8632,6 +8745,47 @@ export declare interface IDisposable {
|
|
|
8632
8745
|
dispose(): void;
|
|
8633
8746
|
}
|
|
8634
8747
|
|
|
8748
|
+
/**
|
|
8749
|
+
* Contract for drag constraints applied after a follow object's position is resolved each frame.
|
|
8750
|
+
* Implement this interface to add custom position/rotation/scale restrictions.
|
|
8751
|
+
*/
|
|
8752
|
+
declare interface IDragConstraint {
|
|
8753
|
+
/**
|
|
8754
|
+
* Called once at drag start and again whenever the drag context resets
|
|
8755
|
+
* (e.g. multi-touch → single-pointer transition). Capture any object snapshot
|
|
8756
|
+
* (position, rotation, scale) you need to hold fixed during the drag.
|
|
8757
|
+
* Constraints that need no dynamic initialization may omit this method.
|
|
8758
|
+
*/
|
|
8759
|
+
init?(context: IDragConstraintContext): void;
|
|
8760
|
+
/** Modifies followObject in-place. Invoked after position is resolved each frame. */
|
|
8761
|
+
apply(followObject: GameObject): void;
|
|
8762
|
+
}
|
|
8763
|
+
|
|
8764
|
+
/**
|
|
8765
|
+
* Context passed to {@link IDragConstraint.init} at drag start and whenever the drag context
|
|
8766
|
+
* resets (e.g. transitioning from multi-touch back to single-pointer).
|
|
8767
|
+
* Provides a snapshot of the dragged object and attachment data a constraint needs
|
|
8768
|
+
* to initialize or re-initialize its locked reference values.
|
|
8769
|
+
*/
|
|
8770
|
+
declare interface IDragConstraintContext {
|
|
8771
|
+
/** The object being dragged. Cast to IGameObject for world-space properties. */
|
|
8772
|
+
readonly gameObject: Object3D;
|
|
8773
|
+
/** Drag attachment point in the dragged object's local space. */
|
|
8774
|
+
readonly hitPointInLocalSpace: Vector3;
|
|
8775
|
+
/** Surface normal at drag attachment in the dragged object's local space. */
|
|
8776
|
+
readonly hitNormalInLocalSpace: Vector3;
|
|
8777
|
+
/**
|
|
8778
|
+
* Local-space bounding box at scale=1. Non-null only for multi-touch drags
|
|
8779
|
+
* where scale-aware constraints (e.g. keeping the bounds bottom grounded) are needed.
|
|
8780
|
+
*/
|
|
8781
|
+
readonly boundsAtScaleOne: Box3 | null;
|
|
8782
|
+
/**
|
|
8783
|
+
* World scale of the object captured at the start of the current drag phase.
|
|
8784
|
+
* Non-null alongside boundsAtScaleOne for multi-touch; null for single-pointer.
|
|
8785
|
+
*/
|
|
8786
|
+
readonly initialWorldScale: Vector3 | null;
|
|
8787
|
+
}
|
|
8788
|
+
|
|
8635
8789
|
/** Implement to receive callbacks from {@type @needle-tools/editor-sync} package */
|
|
8636
8790
|
declare interface IEditorModification {
|
|
8637
8791
|
/**
|
|
@@ -10365,6 +10519,20 @@ declare abstract class Joint extends Component {
|
|
|
10365
10519
|
protected abstract createJoint(self: Rigidbody, other: Rigidbody): any;
|
|
10366
10520
|
}
|
|
10367
10521
|
|
|
10522
|
+
/** Locks the follow object's world rotation to the quaternion captured at drag-start. */
|
|
10523
|
+
export declare class KeepRotationConstraint implements IDragConstraint {
|
|
10524
|
+
private readonly _savedQuat;
|
|
10525
|
+
init(ctx: IDragConstraintContext): void;
|
|
10526
|
+
apply(followObject: GameObject): void;
|
|
10527
|
+
}
|
|
10528
|
+
|
|
10529
|
+
/** Locks the follow object's world scale to the value captured at drag-start. */
|
|
10530
|
+
export declare class KeepScaleConstraint implements IDragConstraint {
|
|
10531
|
+
private readonly _savedScale;
|
|
10532
|
+
init(ctx: IDragConstraintContext): void;
|
|
10533
|
+
apply(followObject: GameObject): void;
|
|
10534
|
+
}
|
|
10535
|
+
|
|
10368
10536
|
declare const enum KeyboardEnumType {
|
|
10369
10537
|
KeyDown = "keydown",
|
|
10370
10538
|
KeyUp = "keyup",
|
|
@@ -11006,7 +11174,7 @@ declare class LowPassFilter {
|
|
|
11006
11174
|
setAlpha(alpha: number): void;
|
|
11007
11175
|
filter(value: number, alpha: number): number;
|
|
11008
11176
|
lastValue(): number | null;
|
|
11009
|
-
reset(value
|
|
11177
|
+
reset(value?: number): void;
|
|
11010
11178
|
}
|
|
11011
11179
|
|
|
11012
11180
|
declare type MagicSkyboxName = "studio" | "blurred-skybox" | "quicklook-ar" | "quicklook";
|
|
@@ -15337,6 +15505,24 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15337
15505
|
bounds: Box3;
|
|
15338
15506
|
};
|
|
15339
15507
|
|
|
15508
|
+
/** Locks the follow object's signed distance from a plane to a value set at drag start.
|
|
15509
|
+
* Owned by {@link XZPlaneDragStrategy} to prevent slow Y drift in the side-view fallback path.
|
|
15510
|
+
* Immune to grab-point projection errors, stale matrixWorld, and epsilon guards.
|
|
15511
|
+
*
|
|
15512
|
+
* When {@link boundsBottomSignedDistFromPivot} is non-zero (set by {@link MultiTouchDragHandler}
|
|
15513
|
+
* for XZPlane scaling), the effective locked height is shifted each frame so the **bottom of the
|
|
15514
|
+
* object's bounds** stays at the height captured at drag start instead of the pivot. */
|
|
15515
|
+
export declare class PlaneHeightLockConstraint implements IDragConstraint {
|
|
15516
|
+
private readonly plane;
|
|
15517
|
+
private _lockedHeight;
|
|
15518
|
+
private _boundsBottomSignedDistFromPivot;
|
|
15519
|
+
/** Current pinch-scale ratio, updated each frame by {@link MultiTouchDragHandler}. */
|
|
15520
|
+
currentScaleRatio: number;
|
|
15521
|
+
constructor(plane: Plane);
|
|
15522
|
+
init(ctx: IDragConstraintContext): void;
|
|
15523
|
+
apply(followObject: GameObject): void;
|
|
15524
|
+
}
|
|
15525
|
+
|
|
15340
15526
|
/**
|
|
15341
15527
|
* PlayableDirector is the main component for controlling timelines in Needle Engine.
|
|
15342
15528
|
* It orchestrates playback of TimelineAssets containing animation, audio, signal,
|
|
@@ -16422,11 +16608,14 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
16422
16608
|
* Progress.end("export-usdz");
|
|
16423
16609
|
*
|
|
16424
16610
|
* // Auto step with weights:
|
|
16611
|
+
* // A numeric weight applies to the NEXT step — it sets how many steps the
|
|
16612
|
+
* // following auto-step advances. The call it is passed on advances by the
|
|
16613
|
+
* // previously-set weight (1 by default).
|
|
16425
16614
|
* Progress.start("export-usdz", undefined, (progress) => console.log("Progress: " + progress));
|
|
16426
|
-
* Progress.report("export-usdz", { message: "Exporting objects", autoStep: true, totalSteps: 10 });
|
|
16427
|
-
* Progress.report("export-usdz", { message: "
|
|
16428
|
-
* Progress.report("export-usdz", "Exporting object 2");
|
|
16429
|
-
* Progress.report("export-usdz", "Exporting object 3");
|
|
16615
|
+
* Progress.report("export-usdz", { message: "Exporting objects", autoStep: true, totalSteps: 10 }); // step 1/10 (10%)
|
|
16616
|
+
* Progress.report("export-usdz", { message: "Heavy step", autoStep: 8 }); // step 2/10 (20%); weight 8 applies to the next step
|
|
16617
|
+
* Progress.report("export-usdz", "Exporting object 2"); // advances by 8 -> step 10/10 (100%)
|
|
16618
|
+
* Progress.report("export-usdz", "Exporting object 3"); // stays at 100%
|
|
16430
16619
|
*
|
|
16431
16620
|
* // Child scopes:
|
|
16432
16621
|
* Progress.start("export-usdz", undefined, (progress) => console.log("Progress: " + progress));
|
|
@@ -16458,8 +16647,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
16458
16647
|
* Progress.report("export-usdz", { totalSteps: 20, autoStep: true });
|
|
16459
16648
|
* // show the progress as 50%
|
|
16460
16649
|
* Progress.report("export-usdz", { progress: 0.5 });
|
|
16461
|
-
* // give
|
|
16462
|
-
*
|
|
16650
|
+
* // give a weight of 20 to the NEXT step (useful for steps that take longer
|
|
16651
|
+
* // and/or have child scopes); the following auto-step will advance by 20.
|
|
16652
|
+
* Progress.report("export-usdz", { message: "Long process", autoStep: 20 });
|
|
16463
16653
|
* // show the current step and total steps and implicitly calculate progress as 10%
|
|
16464
16654
|
* Progress.report("export-usdz", { currentStep: 1, totalSteps: 10 });
|
|
16465
16655
|
*/
|
|
@@ -17043,7 +17233,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
17043
17233
|
unapply(obj: Object3D): void;
|
|
17044
17234
|
}
|
|
17045
17235
|
|
|
17046
|
-
declare enum ReflectionProbeUsage {
|
|
17236
|
+
export declare enum ReflectionProbeUsage {
|
|
17047
17237
|
Off = 0,
|
|
17048
17238
|
BlendProbes = 1,
|
|
17049
17239
|
BlendProbesAndSkybox = 2,
|
|
@@ -17815,6 +18005,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
17815
18005
|
RoomStateSent = "room-state-sent"
|
|
17816
18006
|
}
|
|
17817
18007
|
|
|
18008
|
+
/**
|
|
18009
|
+
* Flags controlling which rotation axes are frozen by {@link FixedRotationAxesConstraint}.
|
|
18010
|
+
* Values can be combined with the bitwise OR operator (`|`).
|
|
18011
|
+
* @example Freeze X and Z: `RotationAxis.X | RotationAxis.Z`
|
|
18012
|
+
*/
|
|
18013
|
+
declare enum RotationAxis {
|
|
18014
|
+
X = 1,
|
|
18015
|
+
Y = 2,
|
|
18016
|
+
Z = 4
|
|
18017
|
+
}
|
|
18018
|
+
|
|
17818
18019
|
export declare class RotationBySpeedModule {
|
|
17819
18020
|
enabled: boolean;
|
|
17820
18021
|
range: Vec2;
|
|
@@ -17872,6 +18073,22 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
17872
18073
|
*/
|
|
17873
18074
|
declare type ScaleClipType = "linear" | "spring";
|
|
17874
18075
|
|
|
18076
|
+
export declare class ScaleLimitConstraint implements IDragConstraint {
|
|
18077
|
+
min: number;
|
|
18078
|
+
max: number;
|
|
18079
|
+
relativeToInitialScale: boolean;
|
|
18080
|
+
/**
|
|
18081
|
+
* @param min Lower bound. Relative mode: fraction of initial scale. Raw mode: absolute world-scale per axis.
|
|
18082
|
+
* @param max Upper bound. Relative mode: fraction of initial scale. Raw mode: absolute world-scale per axis.
|
|
18083
|
+
* @param relativeToInitialScale When `true`, clamp is relative to `initialWorldScale`. When `false`, each axis is clamped independently.
|
|
18084
|
+
* @param initialWorldScale Reference to the object's world scale captured at drag start. Required for relative mode.
|
|
18085
|
+
*/
|
|
18086
|
+
private readonly _initialWorldScale;
|
|
18087
|
+
constructor(min: number, max: number, relativeToInitialScale?: boolean);
|
|
18088
|
+
init(ctx: IDragConstraintContext): void;
|
|
18089
|
+
apply(followObject: GameObject): void;
|
|
18090
|
+
}
|
|
18091
|
+
|
|
17875
18092
|
export { SceneData }
|
|
17876
18093
|
|
|
17877
18094
|
export declare class SceneLightSettings extends Component {
|
|
@@ -18103,6 +18320,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18103
18320
|
switchScene(scene: AssetReference): Promise<boolean>;
|
|
18104
18321
|
private __unloadCurrentScene;
|
|
18105
18322
|
private _currentlyLoadingScene?;
|
|
18323
|
+
private _loadingRequestId;
|
|
18324
|
+
private _activeLoadingRequestId;
|
|
18106
18325
|
/* Excluded from this release type: __internalSwitchScene */
|
|
18107
18326
|
preload(index: number): Promise<boolean> | Promise<ArrayBufferLike | null>;
|
|
18108
18327
|
private tryLoadFromQueryParam;
|
|
@@ -18758,6 +18977,22 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18758
18977
|
*/
|
|
18759
18978
|
htmlSelector: string | null;
|
|
18760
18979
|
mode: "window";
|
|
18980
|
+
/**
|
|
18981
|
+
* Read the scroll position from the **top-level window** instead of the window Needle Engine
|
|
18982
|
+
* runs in. This matters when the canvas is embedded in an iframe:
|
|
18983
|
+
* - When the page is **not** embedded this has no effect — the top window *is* the current window.
|
|
18984
|
+
* - When embedded in a **same-origin** iframe, the component follows the *host page's* scroll,
|
|
18985
|
+
* which is almost always the intent (an embedded iframe usually isn't scrollable itself).
|
|
18986
|
+
*
|
|
18987
|
+
* Set this to `false` to always follow the engine's own window scroll, e.g. when the iframe
|
|
18988
|
+
* itself is scrollable and you want to follow its own scroll rather than the host's.
|
|
18989
|
+
*
|
|
18990
|
+
* If the top window is **cross-origin** (and therefore inaccessible), the component
|
|
18991
|
+
* transparently falls back to the local window and logs a warning in development —
|
|
18992
|
+
* cross-origin embeds would require a `postMessage` scroll bridge from the host page.
|
|
18993
|
+
* @default true
|
|
18994
|
+
*/
|
|
18995
|
+
useTopWindowScroll: boolean;
|
|
18761
18996
|
/**
|
|
18762
18997
|
* Event fired when the scroll position changes
|
|
18763
18998
|
*/
|
|
@@ -18771,9 +19006,25 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18771
19006
|
private _appliedValue;
|
|
18772
19007
|
private _needsUpdate;
|
|
18773
19008
|
private _firstUpdate;
|
|
19009
|
+
/** The window whose scroll position currently drives this component (resolved from {@link useTopWindowScroll}). */
|
|
19010
|
+
private _scrollWindow;
|
|
19011
|
+
/** The window the `wheel` listener is attached to — kept so we remove it from the same window. */
|
|
19012
|
+
private _wheelTarget;
|
|
19013
|
+
private _crossOriginWarned;
|
|
19014
|
+
private _viewTimelineWarned;
|
|
18774
19015
|
awake(): void;
|
|
18775
19016
|
/* Excluded from this release type: onEnable */
|
|
18776
19017
|
/* Excluded from this release type: onDisable */
|
|
19018
|
+
/* Excluded from this release type: onValidate */
|
|
19019
|
+
/**
|
|
19020
|
+
* Resolves which browsing context's scroll position should drive this component.
|
|
19021
|
+
* Honors {@link useTopWindowScroll}. When the top window is requested but is cross-origin
|
|
19022
|
+
* (and therefore inaccessible) it falls back to the local window and warns once —
|
|
19023
|
+
* cross-origin embeds would need a `postMessage` scroll bridge from the host page.
|
|
19024
|
+
*/
|
|
19025
|
+
private resolveScrollWindow;
|
|
19026
|
+
/** (Re)resolves the scroll window and moves the `wheel` listener onto it. */
|
|
19027
|
+
private rebindScrollListener;
|
|
18777
19028
|
/* Excluded from this release type: lateUpdate */
|
|
18778
19029
|
private _lastSelectorValue;
|
|
18779
19030
|
private _lastSelectorElement;
|
|
@@ -18923,13 +19174,42 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18923
19174
|
*
|
|
18924
19175
|
*/
|
|
18925
19176
|
autoUpdate: boolean;
|
|
19177
|
+
/**
|
|
19178
|
+
* The alpha (opacity) the object is currently faded to, in the `[0, 1]` range.
|
|
19179
|
+
* `1` means fully visible, `0` means fully hidden. This is the live, animated value
|
|
19180
|
+
* (it lerps toward the target over {@link fadeDuration}), updated every frame the fade runs.
|
|
19181
|
+
*
|
|
19182
|
+
* External components can read this to react to the see-through state — e.g. toggling a
|
|
19183
|
+
* collider, muting audio, or driving a UI prompt as the object fades in or out.
|
|
19184
|
+
*
|
|
19185
|
+
* @example React to the object becoming (almost) hidden
|
|
19186
|
+
* ```ts
|
|
19187
|
+
* if (seeThrough.currentAlpha < 0.1) {
|
|
19188
|
+
* // object is essentially see-through now
|
|
19189
|
+
* }
|
|
19190
|
+
* ```
|
|
19191
|
+
* @default 1
|
|
19192
|
+
*/
|
|
19193
|
+
get currentAlpha(): number;
|
|
19194
|
+
/**
|
|
19195
|
+
* Below this alpha the object stops casting a shadow. The shadow map only stores depth, so a
|
|
19196
|
+
* faded object would otherwise keep casting a fully solid shadow (three.js does not fade shadows
|
|
19197
|
+
* by opacity). Toggling shadow casting off near-invisible is the cleanest fix; we drive it via
|
|
19198
|
+
* the {@link Renderer.shadowCastingMode} so it cooperates with the per-frame shadow settings the
|
|
19199
|
+
* Renderer re-applies. Note this is a hard on/off, not a fade.
|
|
19200
|
+
*/
|
|
19201
|
+
static readonly shadowHideThreshold = 0.05;
|
|
18926
19202
|
private readonly _referencePointVector;
|
|
18927
19203
|
private readonly _referencePointDir;
|
|
18928
19204
|
private _distance;
|
|
18929
19205
|
private _renderer;
|
|
18930
19206
|
private _needsUpdate;
|
|
18931
19207
|
private _id;
|
|
19208
|
+
private _currentAlpha;
|
|
19209
|
+
/** Renderers whose shadow casting we turned off while hidden, mapped to their original mode for restore. */
|
|
19210
|
+
private readonly _suppressedShadowCasting;
|
|
18932
19211
|
/* Excluded from this release type: onEnable */
|
|
19212
|
+
/* Excluded from this release type: onDestroy */
|
|
18933
19213
|
/* Excluded from this release type: update */
|
|
18934
19214
|
private updateDirection;
|
|
18935
19215
|
/**
|
|
@@ -18938,6 +19218,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18938
19218
|
* @param duration Duration in seconds to reach the target alpha. 0 means immediate. Default is the component's fadeDuration.
|
|
18939
19219
|
*/
|
|
18940
19220
|
updateAlpha(targetAlpha: number, duration?: number): void;
|
|
19221
|
+
/**
|
|
19222
|
+
* Suppress or restore a renderer's shadow casting based on its current alpha.
|
|
19223
|
+
* Driving {@link Renderer.shadowCastingMode} (rather than the raw `mesh.castShadow`) is required
|
|
19224
|
+
* because the Renderer re-applies that setting every frame; we remember the original mode so it
|
|
19225
|
+
* is restored exactly when the object fades back in.
|
|
19226
|
+
*/
|
|
19227
|
+
private updateShadowCasting;
|
|
19228
|
+
/** Restore every renderer we suppressed shadow casting on, then clear the bookkeeping. */
|
|
19229
|
+
private restoreSuppressedShadowCasting;
|
|
18941
19230
|
}
|
|
18942
19231
|
|
|
18943
19232
|
export declare function sendDestroyed(guid: string, con: INetworkConnection, opts?: SyncDestroyOptions): void;
|
|
@@ -19156,7 +19445,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19156
19445
|
|
|
19157
19446
|
export declare function setWorldScale(obj: Object3D, vec: Vector3): void;
|
|
19158
19447
|
|
|
19159
|
-
declare enum ShadowCastingMode {
|
|
19448
|
+
export declare enum ShadowCastingMode {
|
|
19160
19449
|
Off = 0,
|
|
19161
19450
|
On = 1,
|
|
19162
19451
|
TwoSided = 2,
|
|
@@ -19590,6 +19879,28 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19590
19879
|
updateNow(hard: boolean): void;
|
|
19591
19880
|
}
|
|
19592
19881
|
|
|
19882
|
+
/**
|
|
19883
|
+
* Used by {@link SnapToSurfacesDragStrategy} for two-pointer (multi-touch) drags.
|
|
19884
|
+
* Casts a downward ray each frame from the follow object's world position and adjusts
|
|
19885
|
+
* it so the dragged object's bounding-box contact face rests on the detected surface.
|
|
19886
|
+
*
|
|
19887
|
+
* Only injected into the constraint pipeline for multi-touch; the single-pointer path
|
|
19888
|
+
* continues to use {@link SnapToSurfacesDragStrategy.update} (pointer ray + drag plane
|
|
19889
|
+
* intersection) unchanged.
|
|
19890
|
+
*/
|
|
19891
|
+
export declare class SnapToSurfaceConstraint implements IDragConstraint {
|
|
19892
|
+
private readonly _context;
|
|
19893
|
+
private _gameObject;
|
|
19894
|
+
private _boundsAtScaleOne;
|
|
19895
|
+
private readonly _t1;
|
|
19896
|
+
private readonly _t2;
|
|
19897
|
+
private readonly _t3;
|
|
19898
|
+
private readonly _t4;
|
|
19899
|
+
constructor(_context: Context);
|
|
19900
|
+
init(ctx: IDragConstraintContext): void;
|
|
19901
|
+
apply(followObject: GameObject): void;
|
|
19902
|
+
}
|
|
19903
|
+
|
|
19593
19904
|
/** used to find data registered via gltf files e.g. find lightmaps for a Renderer component that were shipped inside a gltf */
|
|
19594
19905
|
export declare type SourceIdentifier = string;
|
|
19595
19906
|
|
|
@@ -24841,9 +25152,40 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
24841
25152
|
All = 4294967295
|
|
24842
25153
|
}
|
|
24843
25154
|
|
|
25155
|
+
/* Excluded from this release type: _XtEQ */
|
|
25156
|
+
|
|
24844
25157
|
export { }
|
|
24845
25158
|
|
|
24846
25159
|
|
|
25160
|
+
declare module 'three' {
|
|
25161
|
+
interface SkinnedMesh {
|
|
25162
|
+
staticGenerator?: StaticGeometryGenerator;
|
|
25163
|
+
staticGeometry?: BufferGeometry;
|
|
25164
|
+
staticGeometryLastUpdate?: number;
|
|
25165
|
+
}
|
|
25166
|
+
interface Mesh {
|
|
25167
|
+
acceleratedRaycast?: any;
|
|
25168
|
+
}
|
|
25169
|
+
interface SkinnedMesh {
|
|
25170
|
+
/** @deprecated use autoUpdateMeshBvhInterval */
|
|
25171
|
+
autoUpdateMeshBVH?: boolean;
|
|
25172
|
+
/**
|
|
25173
|
+
* Interval in milliseconds to automatically update the mesh BVH. When set to >= 0 the BVH will be updated every x milliseconds.
|
|
25174
|
+
* @default undefined (disabled)
|
|
25175
|
+
*/
|
|
25176
|
+
autoUpdateMeshBvhInterval?: number;
|
|
25177
|
+
bvhNeedsUpdate?: boolean;
|
|
25178
|
+
}
|
|
25179
|
+
}
|
|
25180
|
+
|
|
25181
|
+
|
|
25182
|
+
declare module 'three' {
|
|
25183
|
+
interface Vector3 {
|
|
25184
|
+
slerp(end: Vector3, t: number): Vector3;
|
|
25185
|
+
}
|
|
25186
|
+
}
|
|
25187
|
+
|
|
25188
|
+
|
|
24847
25189
|
declare module 'three' {
|
|
24848
25190
|
interface Object3D {
|
|
24849
25191
|
get guid(): string | undefined;
|
|
@@ -24982,32 +25324,3 @@ declare module 'three' {
|
|
|
24982
25324
|
contains(object: Object3D | null | undefined): boolean;
|
|
24983
25325
|
}
|
|
24984
25326
|
}
|
|
24985
|
-
|
|
24986
|
-
|
|
24987
|
-
declare module 'three' {
|
|
24988
|
-
interface Vector3 {
|
|
24989
|
-
slerp(end: Vector3, t: number): Vector3;
|
|
24990
|
-
}
|
|
24991
|
-
}
|
|
24992
|
-
|
|
24993
|
-
|
|
24994
|
-
declare module 'three' {
|
|
24995
|
-
interface SkinnedMesh {
|
|
24996
|
-
staticGenerator?: StaticGeometryGenerator;
|
|
24997
|
-
staticGeometry?: BufferGeometry;
|
|
24998
|
-
staticGeometryLastUpdate?: number;
|
|
24999
|
-
}
|
|
25000
|
-
interface Mesh {
|
|
25001
|
-
acceleratedRaycast?: any;
|
|
25002
|
-
}
|
|
25003
|
-
interface SkinnedMesh {
|
|
25004
|
-
/** @deprecated use autoUpdateMeshBvhInterval */
|
|
25005
|
-
autoUpdateMeshBVH?: boolean;
|
|
25006
|
-
/**
|
|
25007
|
-
* Interval in milliseconds to automatically update the mesh BVH. When set to >= 0 the BVH will be updated every x milliseconds.
|
|
25008
|
-
* @default undefined (disabled)
|
|
25009
|
-
*/
|
|
25010
|
-
autoUpdateMeshBvhInterval?: number;
|
|
25011
|
-
bvhNeedsUpdate?: boolean;
|
|
25012
|
-
}
|
|
25013
|
-
}
|