@needle-tools/engine 5.0.2 → 5.1.0-canary.87c4c44
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 +24 -0
- package/README.md +6 -7
- package/SKILL.md +39 -21
- package/components.needle.json +1 -1
- package/dist/needle-engine.bundle-BlVD1I5a.min.js +1656 -0
- package/dist/{needle-engine.bundle-BoTyA-Le.js → needle-engine.bundle-CFOipCo_.js} +8519 -7920
- package/dist/needle-engine.bundle-DX2Y-SQF.umd.cjs +1656 -0
- package/dist/needle-engine.d.ts +628 -61
- package/dist/needle-engine.js +575 -565
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{vendor-vHLk8sXu.js → vendor-CAcsI0eU.js} +116 -115
- package/dist/{vendor-CntUvmJu.umd.cjs → vendor-CEM38hLE.umd.cjs} +2 -2
- package/dist/{vendor-DPbfJJ4d.min.js → vendor-HRlxIBga.min.js} +2 -2
- package/lib/engine/api.d.ts +2 -0
- package/lib/engine/api.js +2 -0
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/engine_addressables.js +5 -1
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_animation.d.ts +14 -7
- package/lib/engine/engine_animation.js +49 -9
- package/lib/engine/engine_animation.js.map +1 -1
- package/lib/engine/engine_components.js +33 -4
- package/lib/engine/engine_components.js.map +1 -1
- package/lib/engine/engine_context.d.ts +7 -2
- package/lib/engine/engine_context.js +10 -2
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_gameobject.d.ts +4 -0
- package/lib/engine/engine_gameobject.js.map +1 -1
- package/lib/engine/engine_init.js +2 -0
- package/lib/engine/engine_init.js.map +1 -1
- package/lib/engine/engine_input.js +4 -1
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_materialpropertyblock.js +1 -20
- package/lib/engine/engine_materialpropertyblock.js.map +1 -1
- package/lib/engine/engine_networking.d.ts +11 -8
- package/lib/engine/engine_networking.js +43 -26
- package/lib/engine/engine_networking.js.map +1 -1
- package/lib/engine/engine_networking_instantiate.d.ts +100 -5
- package/lib/engine/engine_networking_instantiate.js +150 -16
- package/lib/engine/engine_networking_instantiate.js.map +1 -1
- package/lib/engine/engine_networking_prefabs.d.ts +59 -0
- package/lib/engine/engine_networking_prefabs.js +67 -0
- package/lib/engine/engine_networking_prefabs.js.map +1 -0
- package/lib/engine/postprocessing/api.d.ts +2 -0
- package/lib/engine/postprocessing/api.js +2 -0
- package/lib/engine/postprocessing/api.js.map +1 -0
- package/lib/engine/postprocessing/index.d.ts +2 -0
- package/lib/engine/postprocessing/index.js +2 -0
- package/lib/engine/postprocessing/index.js.map +1 -0
- package/lib/engine/postprocessing/postprocessing.d.ts +83 -0
- package/lib/engine/postprocessing/postprocessing.js +280 -0
- package/lib/engine/postprocessing/postprocessing.js.map +1 -0
- package/lib/engine/postprocessing/types.d.ts +39 -0
- package/lib/engine/postprocessing/types.js +2 -0
- package/lib/engine/postprocessing/types.js.map +1 -0
- package/lib/engine/webcomponents/WebXRButtons.js +17 -3
- package/lib/engine/webcomponents/WebXRButtons.js.map +1 -1
- package/lib/engine/webcomponents/icons.js +3 -1
- package/lib/engine/webcomponents/icons.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.d.ts +1 -0
- package/lib/engine/xr/NeedleXRSession.js +43 -10
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine/xr/init.d.ts +4 -0
- package/lib/engine/xr/init.js +49 -0
- package/lib/engine/xr/init.js.map +1 -0
- package/lib/engine-components/AnimationUtils.d.ts +4 -1
- package/lib/engine-components/AnimationUtils.js +7 -19
- package/lib/engine-components/AnimationUtils.js.map +1 -1
- package/lib/engine-components/AnimatorController.d.ts +135 -2
- package/lib/engine-components/AnimatorController.js +216 -13
- package/lib/engine-components/AnimatorController.js.map +1 -1
- package/lib/engine-components/OrbitControls.d.ts +4 -0
- package/lib/engine-components/OrbitControls.js +5 -1
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/SeeThrough.d.ts +0 -2
- package/lib/engine-components/SeeThrough.js +0 -89
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/SyncedRoom.d.ts +4 -0
- package/lib/engine-components/SyncedRoom.js +23 -8
- package/lib/engine-components/SyncedRoom.js.map +1 -1
- package/lib/engine-components/SyncedTransform.js +5 -5
- package/lib/engine-components/SyncedTransform.js.map +1 -1
- package/lib/engine-components/Voip.d.ts +46 -0
- package/lib/engine-components/Voip.js +126 -2
- package/lib/engine-components/Voip.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/postprocessing/Effects/Tonemapping.d.ts +5 -2
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js +11 -18
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingEffect.d.ts +3 -4
- package/lib/engine-components/postprocessing/PostProcessingEffect.js +6 -15
- package/lib/engine-components/postprocessing/PostProcessingEffect.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +2 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/lib/engine-components/postprocessing/Volume.d.ts +18 -11
- package/lib/engine-components/postprocessing/Volume.js +61 -140
- package/lib/engine-components/postprocessing/Volume.js.map +1 -1
- package/lib/engine-components/postprocessing/index.d.ts +1 -0
- package/lib/engine-components/postprocessing/index.js +1 -0
- package/lib/engine-components/postprocessing/index.js.map +1 -1
- package/lib/engine-components/postprocessing/utils.d.ts +2 -0
- package/lib/engine-components/postprocessing/utils.js +2 -0
- package/lib/engine-components/postprocessing/utils.js.map +1 -1
- package/lib/engine-components/ui/Canvas.js +2 -2
- package/lib/engine-components/ui/Canvas.js.map +1 -1
- package/lib/engine-components/ui/Graphic.d.ts +3 -3
- package/lib/engine-components/ui/Graphic.js +6 -2
- package/lib/engine-components/ui/Graphic.js.map +1 -1
- package/lib/engine-components/ui/Text.d.ts +64 -11
- package/lib/engine-components/ui/Text.js +154 -45
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/lib/engine-components/ui/index.d.ts +1 -0
- package/lib/engine-components/ui/index.js +1 -0
- package/lib/engine-components/ui/index.js.map +1 -1
- package/lib/engine-components-experimental/networking/PlayerSync.d.ts +25 -3
- package/lib/engine-components-experimental/networking/PlayerSync.js +60 -11
- package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
- package/package.json +6 -5
- package/plugins/vite/ai.d.ts +11 -10
- package/plugins/vite/ai.js +305 -31
- package/plugins/vite/dependencies.js +5 -0
- package/src/engine/api.ts +3 -0
- package/src/engine/engine_addressables.ts +4 -1
- package/src/engine/engine_animation.ts +47 -9
- package/src/engine/engine_components.ts +36 -7
- package/src/engine/engine_context.ts +11 -2
- package/src/engine/engine_gameobject.ts +5 -0
- package/src/engine/engine_init.ts +2 -0
- package/src/engine/engine_input.ts +2 -1
- package/src/engine/engine_materialpropertyblock.ts +1 -20
- package/src/engine/engine_networking.ts +46 -23
- package/src/engine/engine_networking_instantiate.ts +160 -18
- package/src/engine/engine_networking_prefabs.ts +80 -0
- package/src/engine/postprocessing/api.ts +2 -0
- package/src/engine/postprocessing/index.ts +2 -0
- package/src/engine/postprocessing/postprocessing.ts +322 -0
- package/src/engine/postprocessing/types.ts +43 -0
- package/src/engine/webcomponents/WebXRButtons.ts +21 -4
- package/src/engine/webcomponents/icons.ts +5 -3
- package/src/engine/xr/NeedleXRSession.ts +50 -15
- package/src/engine/xr/init.ts +56 -0
- package/src/engine-components/AnimationUtils.ts +7 -17
- package/src/engine-components/AnimatorController.ts +288 -18
- package/src/engine-components/OrbitControls.ts +5 -1
- package/src/engine-components/SeeThrough.ts +0 -116
- package/src/engine-components/SyncedRoom.ts +28 -9
- package/src/engine-components/SyncedTransform.ts +5 -5
- package/src/engine-components/Voip.ts +129 -2
- package/src/engine-components/api.ts +1 -0
- package/src/engine-components/postprocessing/Effects/Tonemapping.ts +16 -24
- package/src/engine-components/postprocessing/PostProcessingEffect.ts +9 -16
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +2 -1
- package/src/engine-components/postprocessing/Volume.ts +72 -163
- package/src/engine-components/postprocessing/index.ts +1 -0
- package/src/engine-components/postprocessing/utils.ts +2 -0
- package/src/engine-components/ui/Canvas.ts +2 -2
- package/src/engine-components/ui/Graphic.ts +7 -3
- package/src/engine-components/ui/Text.ts +170 -52
- package/src/engine-components/ui/index.ts +2 -1
- package/src/engine-components-experimental/networking/PlayerSync.ts +64 -11
- package/dist/needle-engine.bundle-B3ywqx5o.min.js +0 -1654
- package/dist/needle-engine.bundle-CzOPcOui.umd.cjs +0 -1654
package/dist/needle-engine.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { DocumentedOptions } from '../../../node_modules/three-mesh-ui/build/typ
|
|
|
22
22
|
import { Effect } from 'postprocessing';
|
|
23
23
|
import { EffectComposer } from 'postprocessing';
|
|
24
24
|
import { EffectComposer as EffectComposer_2 } from '../../node_modules/@types/three/examples/jsm/postprocessing/EffectComposer.js';
|
|
25
|
+
import { EffectComposer as EffectComposer_3 } from '../../../node_modules/@types/three/examples/jsm/postprocessing/EffectComposer.js';
|
|
25
26
|
import { EmitterShape } from 'three.quarks';
|
|
26
27
|
import { Euler } from 'three';
|
|
27
28
|
import { EventDispatcher } from 'three';
|
|
@@ -90,6 +91,7 @@ import { Sprite as Sprite_2 } from 'three';
|
|
|
90
91
|
import { SpriteMaterial } from 'three';
|
|
91
92
|
import { Texture } from 'three';
|
|
92
93
|
import * as ThreeMeshUI from 'three-mesh-ui';
|
|
94
|
+
import { ToneMapping } from 'three';
|
|
93
95
|
import { TransformControls } from '../../node_modules/@types/three/examples/jsm/controls/TransformControls.js';
|
|
94
96
|
import { Vector2 } from 'three';
|
|
95
97
|
import { Vector2Like } from 'three';
|
|
@@ -644,29 +646,36 @@ declare class AnimationTriggers {
|
|
|
644
646
|
/**
|
|
645
647
|
* Utility class for working with animations.
|
|
646
648
|
*/
|
|
647
|
-
export declare
|
|
649
|
+
export declare namespace AnimationUtils {
|
|
648
650
|
/**
|
|
649
651
|
* Tests if the root object of an AnimationAction can be animated. Objects where matrixAutoUpdate or matrixWorldAutoUpdate is set to false may not animate correctly.
|
|
650
652
|
* @param action The AnimationAction to test
|
|
651
653
|
* @param allowLog Whether to allow logging warnings. Default is false, which only allows logging in development environments.
|
|
652
654
|
* @returns True if the root object can be animated, false otherwise
|
|
653
655
|
*/
|
|
654
|
-
|
|
656
|
+
export function testIfRootCanAnimate(action: AnimationAction, allowLog?: boolean): boolean;
|
|
655
657
|
/**
|
|
656
658
|
* Tries to get the animation actions from an animation mixer.
|
|
657
659
|
* @param mixer The animation mixer to get the actions from
|
|
658
660
|
* @returns The actions or null if the mixer is invalid
|
|
659
661
|
*/
|
|
660
|
-
|
|
661
|
-
|
|
662
|
+
export function tryGetActionsFromMixer(mixer: AnimationMixer): Array<AnimationAction> | null;
|
|
663
|
+
export function tryGetAnimationClipsFromObjectHierarchy(obj: Object3D, target?: Array<AnimationClip>): Array<AnimationClip>;
|
|
664
|
+
/** Internal method - This marks an object as being animated. Make sure to always call isAnimated=false if you stop animating the object
|
|
665
|
+
* @param obj The object to mark
|
|
666
|
+
* @param isAnimated Whether the object is animated or not
|
|
667
|
+
*/
|
|
668
|
+
export function setObjectAnimated(obj: Object3D, animatedBy: object, isAnimated: boolean): void;
|
|
669
|
+
/** Get is the object is currently animated. Currently used by the Animator to check if a timeline animationtrack is actively animating an object */
|
|
670
|
+
export function getObjectAnimated(obj: Object3D): boolean;
|
|
662
671
|
/**
|
|
663
672
|
* Assigns animations from a GLTF file to the objects in the scene.
|
|
664
673
|
* This method will look for objects in the scene that have animations and assign them to the correct objects.
|
|
665
674
|
* @param file The GLTF file to assign the animations from
|
|
666
675
|
*/
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
676
|
+
export function autoplayAnimations(file: Object3D | Pick<Model, "animations" | "scene">): Array<IAnimationComponent> | null;
|
|
677
|
+
export function emptyClip(): AnimationClip;
|
|
678
|
+
export function createScaleClip(options?: ScaleClipOptions): AnimationClip;
|
|
670
679
|
}
|
|
671
680
|
|
|
672
681
|
/**
|
|
@@ -909,8 +918,9 @@ export declare enum AnimatorConditionMode {
|
|
|
909
918
|
* and parameters that affect those transitions. It is used by the {@link Animator}
|
|
910
919
|
* component to control animation behavior on 3D models.
|
|
911
920
|
*
|
|
912
|
-
* Use
|
|
913
|
-
*
|
|
921
|
+
* Use {@link AnimatorController.build} to fluently create a controller with parameters,
|
|
922
|
+
* states, transitions, and conditions. For simple sequential playback,
|
|
923
|
+
* use {@link AnimatorController.createFromClips}.
|
|
914
924
|
*
|
|
915
925
|
* @category Animation and Sequencing
|
|
916
926
|
* @group Utilities
|
|
@@ -925,6 +935,27 @@ export declare class AnimatorController {
|
|
|
925
935
|
* @returns A new AnimatorController instance
|
|
926
936
|
*/
|
|
927
937
|
static createFromClips(clips: AnimationClip[], options?: CreateAnimatorControllerOptions): AnimatorController;
|
|
938
|
+
/**
|
|
939
|
+
* Creates a new {@link AnimatorControllerBuilder} for fluently constructing a controller with
|
|
940
|
+
* parameters, states, transitions, and conditions.
|
|
941
|
+
*
|
|
942
|
+
* @param name - Optional name for the controller
|
|
943
|
+
* @returns A new builder instance
|
|
944
|
+
*
|
|
945
|
+
* @example
|
|
946
|
+
* ```ts
|
|
947
|
+
* const ctrl = AnimatorController.build("MyController")
|
|
948
|
+
* .floatParameter("Speed")
|
|
949
|
+
* .state("Idle", { clip: idleClip, loop: true })
|
|
950
|
+
* .state("Walk", { clip: walkClip, loop: true })
|
|
951
|
+
* .transition("Idle", "Walk", { duration: 0.25 })
|
|
952
|
+
* .condition("Speed", "greater", 0.1)
|
|
953
|
+
* .transition("Walk", "Idle", { duration: 0.25 })
|
|
954
|
+
* .condition("Speed", "less", 0.1)
|
|
955
|
+
* .build();
|
|
956
|
+
* ```
|
|
957
|
+
*/
|
|
958
|
+
static build(name?: string): AnimatorControllerBuilder;
|
|
928
959
|
/**
|
|
929
960
|
* Plays an animation state by name or hash.
|
|
930
961
|
*
|
|
@@ -1116,6 +1147,84 @@ export declare class AnimatorController {
|
|
|
1116
1147
|
private rootMotionHandler?;
|
|
1117
1148
|
}
|
|
1118
1149
|
|
|
1150
|
+
/**
|
|
1151
|
+
* A fluent builder for creating {@link AnimatorController} instances from code.
|
|
1152
|
+
*
|
|
1153
|
+
* Use {@link AnimatorController.build} to create a new builder.
|
|
1154
|
+
*
|
|
1155
|
+
* @example
|
|
1156
|
+
* ```ts
|
|
1157
|
+
* const controller = AnimatorController.build("CharacterController")
|
|
1158
|
+
* .floatParameter("Speed", 0)
|
|
1159
|
+
* .triggerParameter("Jump")
|
|
1160
|
+
* .state("Idle", { clip: idleClip, loop: true })
|
|
1161
|
+
* .state("Walk", { clip: walkClip, loop: true })
|
|
1162
|
+
* .state("Jump", { clip: jumpClip })
|
|
1163
|
+
* .transition("Idle", "Walk", { duration: 0.25 })
|
|
1164
|
+
* .condition("Speed", "greater", 0.1)
|
|
1165
|
+
* .transition("Walk", "Idle", { duration: 0.25 })
|
|
1166
|
+
* .condition("Speed", "less", 0.1)
|
|
1167
|
+
* .transition("*", "Jump", { duration: 0.1 })
|
|
1168
|
+
* .condition("Jump", "if")
|
|
1169
|
+
* .transition("Jump", "Idle", { hasExitTime: true, exitTime: 0.9, duration: 0.25 })
|
|
1170
|
+
* .build();
|
|
1171
|
+
* ```
|
|
1172
|
+
*
|
|
1173
|
+
* @category Animation and Sequencing
|
|
1174
|
+
* @group Utilities
|
|
1175
|
+
*/
|
|
1176
|
+
export declare class AnimatorControllerBuilder {
|
|
1177
|
+
private _name;
|
|
1178
|
+
private _parameters;
|
|
1179
|
+
private _states;
|
|
1180
|
+
private _anyStateTransitions;
|
|
1181
|
+
private _defaultStateName;
|
|
1182
|
+
private _lastTransition;
|
|
1183
|
+
constructor(name?: string);
|
|
1184
|
+
/** Adds a float parameter */
|
|
1185
|
+
floatParameter(name: string, defaultValue?: number): this;
|
|
1186
|
+
/** Adds an integer parameter */
|
|
1187
|
+
intParameter(name: string, defaultValue?: number): this;
|
|
1188
|
+
/** Adds a boolean parameter */
|
|
1189
|
+
boolParameter(name: string, defaultValue?: boolean): this;
|
|
1190
|
+
/** Adds a trigger parameter */
|
|
1191
|
+
triggerParameter(name: string): this;
|
|
1192
|
+
/**
|
|
1193
|
+
* Adds a state to the controller. The first state added becomes the default state.
|
|
1194
|
+
* @param name - Unique name for the state
|
|
1195
|
+
* @param options - State configuration including clip, loop, speed
|
|
1196
|
+
*/
|
|
1197
|
+
state(name: string, options: StateOptions): this;
|
|
1198
|
+
/**
|
|
1199
|
+
* Adds a transition between two states.
|
|
1200
|
+
* Use `"*"` as the source to create a transition from any state.
|
|
1201
|
+
* Chain `.condition()` calls after this to add conditions.
|
|
1202
|
+
* @param from - Source state name, or `"*"` for any-state transition
|
|
1203
|
+
* @param to - Destination state name
|
|
1204
|
+
* @param options - Transition configuration
|
|
1205
|
+
*/
|
|
1206
|
+
transition(from: string, to: string, options?: TransitionOptions): this;
|
|
1207
|
+
/**
|
|
1208
|
+
* Adds a condition to the most recently added transition.
|
|
1209
|
+
* Multiple conditions on the same transition are AND-ed together.
|
|
1210
|
+
* @param parameter - Name of the parameter to evaluate
|
|
1211
|
+
* @param mode - Condition mode: `"if"`, `"ifNot"`, `"greater"`, `"less"`, `"equals"`, `"notEqual"`
|
|
1212
|
+
* @param threshold - Comparison threshold for numeric conditions (default: 0)
|
|
1213
|
+
*/
|
|
1214
|
+
condition(parameter: string, mode: ConditionMode, threshold?: number): this;
|
|
1215
|
+
/**
|
|
1216
|
+
* Sets which state is the default/entry state.
|
|
1217
|
+
* If not called, the first added state is used.
|
|
1218
|
+
* @param name - Name of the state
|
|
1219
|
+
*/
|
|
1220
|
+
defaultState(name: string): this;
|
|
1221
|
+
/**
|
|
1222
|
+
* Builds and returns the {@link AnimatorController}.
|
|
1223
|
+
* Resolves all state name references to indices.
|
|
1224
|
+
*/
|
|
1225
|
+
build(): AnimatorController;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1119
1228
|
export declare type AnimatorControllerModel = {
|
|
1120
1229
|
name: string;
|
|
1121
1230
|
guid: string;
|
|
@@ -3997,6 +4106,9 @@ export declare type Condition = {
|
|
|
3997
4106
|
threshold: number;
|
|
3998
4107
|
};
|
|
3999
4108
|
|
|
4109
|
+
/** String condition modes for the builder, mapped to {@link AnimatorConditionMode} */
|
|
4110
|
+
export declare type ConditionMode = "if" | "ifNot" | "greater" | "less" | "equals" | "notEqual";
|
|
4111
|
+
|
|
4000
4112
|
/** Events regarding the websocket connection (e.g. when the connection opens) */
|
|
4001
4113
|
export declare enum ConnectionEvents {
|
|
4002
4114
|
ConnectionInfo = "connection-start-info"
|
|
@@ -4306,9 +4418,11 @@ export declare class Context implements IContext {
|
|
|
4306
4418
|
*/
|
|
4307
4419
|
renderer: WebGLRenderer;
|
|
4308
4420
|
/**
|
|
4309
|
-
* The effect composer
|
|
4421
|
+
* The effect composer used for rendering postprocessing effects.
|
|
4422
|
+
* @deprecated Use `context.postprocessing.composer` instead.
|
|
4310
4423
|
*/
|
|
4311
|
-
composer: EffectComposer | EffectComposer_2 | null;
|
|
4424
|
+
get composer(): EffectComposer | EffectComposer_2 | null;
|
|
4425
|
+
set composer(value: EffectComposer | EffectComposer_2 | null);
|
|
4312
4426
|
/* Excluded from this release type: scripts */
|
|
4313
4427
|
/* Excluded from this release type: scripts_pausedChanged */
|
|
4314
4428
|
/* Excluded from this release type: scripts_earlyUpdate */
|
|
@@ -4359,6 +4473,8 @@ export declare class Context implements IContext {
|
|
|
4359
4473
|
input: Input;
|
|
4360
4474
|
/** access physics related methods (e.g. raycasting). To access the phyiscs engine use `context.physics.engine` */
|
|
4361
4475
|
physics: Physics;
|
|
4476
|
+
/** access postprocessing effects stack. Add/remove effects and configure adaptive performance settings */
|
|
4477
|
+
postprocessing: PostProcessing;
|
|
4362
4478
|
/** access networking methods (use it to send or listen to messages or join a networking backend) */
|
|
4363
4479
|
connection: NetworkConnection;
|
|
4364
4480
|
/** @deprecated AssetDatabase is deprecated */
|
|
@@ -6432,7 +6548,7 @@ declare enum FogMode {
|
|
|
6432
6548
|
ExponentialSquared = 3
|
|
6433
6549
|
}
|
|
6434
6550
|
|
|
6435
|
-
declare enum FontStyle {
|
|
6551
|
+
export declare enum FontStyle {
|
|
6436
6552
|
Normal = 0,
|
|
6437
6553
|
Bold = 1,
|
|
6438
6554
|
Italic = 2,
|
|
@@ -7280,7 +7396,8 @@ export declare class Gradient {
|
|
|
7280
7396
|
export declare class Graphic extends BaseUIComponent implements IGraphic, IRectTransformChangedReceiver {
|
|
7281
7397
|
get isGraphic(): boolean;
|
|
7282
7398
|
get color(): RGBAColor;
|
|
7283
|
-
set color(col: RGBAColor);
|
|
7399
|
+
set color(col: RGBAColor | Color);
|
|
7400
|
+
private _color;
|
|
7284
7401
|
private _alphaFactor;
|
|
7285
7402
|
setAlphaFactor(factor: number): void;
|
|
7286
7403
|
get alphaFactor(): number;
|
|
@@ -7289,7 +7406,6 @@ export declare class Graphic extends BaseUIComponent implements IGraphic, IRectT
|
|
|
7289
7406
|
private get m_Color();
|
|
7290
7407
|
raycastTarget: boolean;
|
|
7291
7408
|
protected uiObject: ThreeMeshUI.Block | null;
|
|
7292
|
-
private _color;
|
|
7293
7409
|
private _rect;
|
|
7294
7410
|
private _stateManager;
|
|
7295
7411
|
protected get rectTransform(): RectTransform;
|
|
@@ -7631,7 +7747,7 @@ declare abstract class HorizontalOrVerticalLayoutGroup extends LayoutGroup {
|
|
|
7631
7747
|
protected onCalculateLayout(rect: RectTransform): void;
|
|
7632
7748
|
}
|
|
7633
7749
|
|
|
7634
|
-
declare enum HorizontalWrapMode {
|
|
7750
|
+
export declare enum HorizontalWrapMode {
|
|
7635
7751
|
Wrap = 0,
|
|
7636
7752
|
Overflow = 1
|
|
7637
7753
|
}
|
|
@@ -8040,7 +8156,11 @@ export declare interface IInputEventArgs {
|
|
|
8040
8156
|
stopImmediatePropagation?(): void;
|
|
8041
8157
|
}
|
|
8042
8158
|
|
|
8159
|
+
/**
|
|
8160
|
+
* Options for instantiating a GameObject, used in {@link instantiate} and {@link syncInstantiate}
|
|
8161
|
+
*/
|
|
8043
8162
|
export declare type IInstantiateOptions = {
|
|
8163
|
+
/** The ID provider for generating unique IDs / guids */
|
|
8044
8164
|
idProvider?: UIDProvider;
|
|
8045
8165
|
parent?: string | Object3D;
|
|
8046
8166
|
/** position in local space. Set `keepWorldPosition` to true if this is world space */
|
|
@@ -9195,6 +9315,32 @@ export declare interface IPointerUpHandler {
|
|
|
9195
9315
|
onPointerUp?(args: PointerEventData): any;
|
|
9196
9316
|
}
|
|
9197
9317
|
|
|
9318
|
+
/**
|
|
9319
|
+
* Minimal interface for a postprocessing effect as seen by the core stack.
|
|
9320
|
+
* Implemented by `PostProcessingEffect` in engine-components.
|
|
9321
|
+
*/
|
|
9322
|
+
export declare interface IPostProcessingEffect {
|
|
9323
|
+
readonly active: boolean;
|
|
9324
|
+
readonly enabled: boolean;
|
|
9325
|
+
/** When true, this effect is a tonemapping effect. The core stack uses this to detect tonemapping-only scenarios. */
|
|
9326
|
+
readonly isToneMapping?: boolean;
|
|
9327
|
+
}
|
|
9328
|
+
|
|
9329
|
+
/**
|
|
9330
|
+
* Interface for the pipeline builder that manages the EffectComposer.
|
|
9331
|
+
* Implemented by `PostProcessingHandler` in engine-components.
|
|
9332
|
+
*/
|
|
9333
|
+
export declare interface IPostProcessingHandler {
|
|
9334
|
+
readonly composer: EffectComposer | EffectComposer_3 | null;
|
|
9335
|
+
readonly hasSmaaEffect: boolean;
|
|
9336
|
+
multisampling: number;
|
|
9337
|
+
adaptivePixelRatio: boolean;
|
|
9338
|
+
apply(effects: IPostProcessingEffect[]): Promise<void>;
|
|
9339
|
+
unapply(dispose?: boolean): void;
|
|
9340
|
+
updateAdaptivePixelRatio(): void;
|
|
9341
|
+
dispose(): void;
|
|
9342
|
+
}
|
|
9343
|
+
|
|
9198
9344
|
declare type IPostProcessingManager = IComponent & {
|
|
9199
9345
|
get isPostProcessingManager(): boolean;
|
|
9200
9346
|
get dirty(): boolean;
|
|
@@ -9450,6 +9596,19 @@ export declare interface ITimelineAnimationOverride {
|
|
|
9450
9596
|
onTimelinePosition?(director: PlayableDirector, target: Object3D, time: number, position: Vector3): any;
|
|
9451
9597
|
}
|
|
9452
9598
|
|
|
9599
|
+
/**
|
|
9600
|
+
* Extended interface for tonemapping effects.
|
|
9601
|
+
* When ONLY tonemapping effects are in the stack, the core applies tonemapping
|
|
9602
|
+
* directly to the renderer instead of creating a full postprocessing pipeline.
|
|
9603
|
+
*/
|
|
9604
|
+
export declare interface ITonemappingEffect extends IPostProcessingEffect {
|
|
9605
|
+
readonly isToneMapping: true;
|
|
9606
|
+
/** The three.js ToneMapping enum value to apply to the renderer */
|
|
9607
|
+
readonly threeToneMapping: ToneMapping;
|
|
9608
|
+
/** The exposure value to apply to the renderer */
|
|
9609
|
+
readonly toneMappingExposure: number;
|
|
9610
|
+
}
|
|
9611
|
+
|
|
9453
9612
|
declare interface ITypeInformation {
|
|
9454
9613
|
type?: ConstructorConcrete<any>;
|
|
9455
9614
|
}
|
|
@@ -9580,7 +9739,7 @@ declare abstract class LayoutGroup extends Component implements ILayoutGroup {
|
|
|
9580
9739
|
get isDirty(): boolean;
|
|
9581
9740
|
get isLayoutGroup(): boolean;
|
|
9582
9741
|
updateLayout(): void;
|
|
9583
|
-
childAlignment:
|
|
9742
|
+
childAlignment: TextAnchor_2;
|
|
9584
9743
|
reverseArrangement: boolean;
|
|
9585
9744
|
spacing: number;
|
|
9586
9745
|
padding: Padding;
|
|
@@ -11801,6 +11960,7 @@ export declare class NeedleXRSession implements INeedleXRSession {
|
|
|
11801
11960
|
* @returns true if the browser supports the given XRSessionMode
|
|
11802
11961
|
*/
|
|
11803
11962
|
static isSessionSupported(mode: XRSessionMode): Promise<boolean>;
|
|
11963
|
+
private static _sessionSupportedCache;
|
|
11804
11964
|
private static _currentSessionRequest?;
|
|
11805
11965
|
private static _activeSession;
|
|
11806
11966
|
/** Register to listen to XRSession start events. Unsubscribe with `offXRSessionStart` */
|
|
@@ -13107,6 +13267,41 @@ export declare type OnRenderCallback = (renderer: WebGLRenderer, scene: Scene, c
|
|
|
13107
13267
|
* */
|
|
13108
13268
|
export declare function onStart(cb: LifecycleMethod, opts?: LifecycleMethodOptions): () => void;
|
|
13109
13269
|
|
|
13270
|
+
/**
|
|
13271
|
+
* Register a callback that fires when a remote `syncDestroy` event is received.
|
|
13272
|
+
* The callback receives the guid and the resolved Object3D (or null if not found in the scene).
|
|
13273
|
+
* The callback fires **before** the object is destroyed, so you can still access its state.
|
|
13274
|
+
* @param callback Called with the guid and the Object3D about to be destroyed
|
|
13275
|
+
* @returns An unsubscribe function
|
|
13276
|
+
* @category Networking
|
|
13277
|
+
* @example
|
|
13278
|
+
* ```ts
|
|
13279
|
+
* const unsub = onSyncDestroy((guid, obj) => {
|
|
13280
|
+
* console.log("Remote object destroyed:", guid, obj?.name);
|
|
13281
|
+
* });
|
|
13282
|
+
* // later: unsub();
|
|
13283
|
+
* ```
|
|
13284
|
+
*/
|
|
13285
|
+
export declare function onSyncDestroy(callback: SyncDestroyCallback): () => void;
|
|
13286
|
+
|
|
13287
|
+
/**
|
|
13288
|
+
* Register a callback that fires when a remote `syncInstantiate` object is created on this client.
|
|
13289
|
+
* Use this to get references to objects spawned by other users.
|
|
13290
|
+
* @param callback Called with the instantiated Object3D, the network model data, and the Needle Engine context in which the instantiate event was received
|
|
13291
|
+
* @returns An unsubscribe function
|
|
13292
|
+
* @category Networking
|
|
13293
|
+
* @example
|
|
13294
|
+
* ```ts
|
|
13295
|
+
* const unsub = onSyncInstantiate((instance, model, context) => {
|
|
13296
|
+
* console.log("Remote object created:", instance.name, model.originalGuid, context);
|
|
13297
|
+
* });
|
|
13298
|
+
* // later: unsub();
|
|
13299
|
+
* ```
|
|
13300
|
+
* @see {@link syncInstantiate} - Instantiate objects across the network
|
|
13301
|
+
* @see {@link syncDestroy} - Destroy objects across the network
|
|
13302
|
+
*/
|
|
13303
|
+
export declare function onSyncInstantiate(callback: SyncInstantiateCallback): () => void;
|
|
13304
|
+
|
|
13110
13305
|
/** Register a callback in the engine update event
|
|
13111
13306
|
* This is called every frame
|
|
13112
13307
|
* @param cb The callback to be called
|
|
@@ -13370,6 +13565,10 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
13370
13565
|
get targetLerpDuration(): number;
|
|
13371
13566
|
set targetLerpDuration(v: number);
|
|
13372
13567
|
private _lookTargetLerpDuration;
|
|
13568
|
+
/**
|
|
13569
|
+
* When set, the camera's look at target will be clamped within the bounds of the specified Object3D. The bounds are defined by the world position and world scale of the assigned Object3D.
|
|
13570
|
+
* @default null
|
|
13571
|
+
*/
|
|
13373
13572
|
targetBounds: Object3D | null;
|
|
13374
13573
|
/**
|
|
13375
13574
|
* Rotate the camera left (or right) by the specified angle in radians.
|
|
@@ -13625,6 +13824,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
13625
13824
|
private _gainSubscription;
|
|
13626
13825
|
private _lostSubscription;
|
|
13627
13826
|
private _hasOwnerResponse;
|
|
13827
|
+
private _pendingOwnershipResolve;
|
|
13628
13828
|
constructor(connection: NetworkConnection, guid: string);
|
|
13629
13829
|
private _isWaitingForOwnershipResponseCallback;
|
|
13630
13830
|
/**
|
|
@@ -13646,21 +13846,23 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
13646
13846
|
* @throws Rejects with "Timeout" if ownership is not gained within ~1 second
|
|
13647
13847
|
* @example
|
|
13648
13848
|
* ```ts
|
|
13649
|
-
*
|
|
13650
|
-
*
|
|
13849
|
+
* const owned = await ownership.requestOwnership();
|
|
13850
|
+
* if (owned) {
|
|
13651
13851
|
* // Ownership granted, safe to modify object
|
|
13652
|
-
* } catch(e) {
|
|
13653
|
-
* console.warn("Could not gain ownership:", e);
|
|
13654
13852
|
* }
|
|
13655
13853
|
* ```
|
|
13656
13854
|
*/
|
|
13657
|
-
requestOwnershipAsync(): Promise<OwnershipModel>;
|
|
13658
13855
|
/**
|
|
13659
13856
|
* Requests ownership of this object from the networking server.
|
|
13660
|
-
*
|
|
13661
|
-
*
|
|
13857
|
+
* Returns a Promise that resolves with `true` when ownership is granted, or `false` on timeout/failure.
|
|
13858
|
+
* If ownership is already held, resolves immediately with `true`.
|
|
13859
|
+
* @returns Promise that resolves with `true` if ownership was gained, `false` otherwise
|
|
13860
|
+
*/
|
|
13861
|
+
requestOwnership(): Promise<boolean>;
|
|
13862
|
+
/**
|
|
13863
|
+
* @deprecated Use `requestOwnership()` instead for a more reliable way to gain ownership
|
|
13662
13864
|
*/
|
|
13663
|
-
|
|
13865
|
+
requestOwnershipAsync(): Promise<OwnershipModel>;
|
|
13664
13866
|
/**
|
|
13665
13867
|
* Releases ownership of this object, allowing others to take control.
|
|
13666
13868
|
* Call this when you're done modifying an object to allow other users to interact with it.
|
|
@@ -14709,7 +14911,25 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14709
14911
|
* scene.add(res.gameObject);
|
|
14710
14912
|
* ```
|
|
14711
14913
|
*/
|
|
14712
|
-
|
|
14914
|
+
/**
|
|
14915
|
+
* This API is experimental and may change or be removed in the future.
|
|
14916
|
+
* Creates a PlayerSync instance at runtime from a given URL or Object3D and sets it up for networking.
|
|
14917
|
+
* @param urlOrObject Path to the asset that should be instantiated for each player, or a pre-created Object3D to use as the player prefab
|
|
14918
|
+
* @param init Optional initialization parameters for the PlayerSync component
|
|
14919
|
+
* @returns Promise resolving to a PlayerSync instance with a guaranteed asset property
|
|
14920
|
+
* @example
|
|
14921
|
+
* ```typescript
|
|
14922
|
+
* // From a GLB URL:
|
|
14923
|
+
* const res = await PlayerSync.setupFrom("/assets/demo.glb");
|
|
14924
|
+
*
|
|
14925
|
+
* // From a runtime-created Object3D:
|
|
14926
|
+
* const avatar = ObjectUtils.createPrimitive("Sphere");
|
|
14927
|
+
* const res = await PlayerSync.setupFrom(avatar);
|
|
14928
|
+
* ```
|
|
14929
|
+
*/
|
|
14930
|
+
static setupFrom(urlOrObject: string | Object3D, init?: Omit<ComponentInit<PlayerSync>, "asset"> & {
|
|
14931
|
+
guid?: string;
|
|
14932
|
+
}): Promise<PlayerSyncWithAsset>;
|
|
14713
14933
|
/**
|
|
14714
14934
|
* When enabled, PlayerSync will automatically load and instantiate the assigned asset when joining a networked room
|
|
14715
14935
|
*/
|
|
@@ -14719,11 +14939,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14719
14939
|
*/
|
|
14720
14940
|
asset?: AssetReference;
|
|
14721
14941
|
/**
|
|
14722
|
-
* Event invoked when
|
|
14942
|
+
* Event invoked when ANY player instance is spawned — both local and remote.
|
|
14943
|
+
* The event argument is a {@link PlayerSpawnedEventArgs} with the player Object3D and whether it's the local player.
|
|
14944
|
+
* For backward compatibility, the first argument is also the Object3D directly.
|
|
14723
14945
|
* @serializable
|
|
14724
14946
|
*/
|
|
14725
|
-
onPlayerSpawned
|
|
14947
|
+
onPlayerSpawned: EventList<Object3D>;
|
|
14726
14948
|
private _localInstance?;
|
|
14949
|
+
private _unsubSyncInstantiate?;
|
|
14950
|
+
constructor();
|
|
14727
14951
|
awake(): void;
|
|
14728
14952
|
onEnable(): void;
|
|
14729
14953
|
onDisable(): void;
|
|
@@ -14927,6 +15151,84 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14927
15151
|
*/
|
|
14928
15152
|
export declare function postprocessFBXMaterials(obj: Mesh, material: Material | Material[], index?: number, array?: Material[]): boolean;
|
|
14929
15153
|
|
|
15154
|
+
/**
|
|
15155
|
+
* Core postprocessing stack accessible via `context.postprocessing`.
|
|
15156
|
+
* Manages the effect pipeline independently of any specific component.
|
|
15157
|
+
*
|
|
15158
|
+
* Volumes and individual PostProcessingEffect components add/remove effects
|
|
15159
|
+
* to this stack. The stack builds the EffectComposer pipeline when dirty.
|
|
15160
|
+
*
|
|
15161
|
+
* @example Add an effect directly
|
|
15162
|
+
* ```ts
|
|
15163
|
+
* const bloom = new BloomEffect({ intensity: 3 });
|
|
15164
|
+
* this.context.postprocessing.addEffect(bloom);
|
|
15165
|
+
* ```
|
|
15166
|
+
*
|
|
15167
|
+
* @example Remove an effect
|
|
15168
|
+
* ```ts
|
|
15169
|
+
* this.context.postprocessing.removeEffect(bloom);
|
|
15170
|
+
* ```
|
|
15171
|
+
*/
|
|
15172
|
+
export declare class PostProcessing {
|
|
15173
|
+
private readonly _context;
|
|
15174
|
+
private _handler;
|
|
15175
|
+
private readonly _effects;
|
|
15176
|
+
private _isDirty;
|
|
15177
|
+
/** Currently active postprocessing effects in the stack */
|
|
15178
|
+
get effects(): readonly IPostProcessingEffect[];
|
|
15179
|
+
get dirty(): boolean;
|
|
15180
|
+
set dirty(value: boolean);
|
|
15181
|
+
/** The internal PostProcessingHandler that manages the EffectComposer pipeline */
|
|
15182
|
+
get handler(): IPostProcessingHandler | null;
|
|
15183
|
+
/**
|
|
15184
|
+
* The effect composer used to render postprocessing effects.
|
|
15185
|
+
* This is set internally by the PostProcessingHandler when effects are applied.
|
|
15186
|
+
*/
|
|
15187
|
+
get composer(): EffectComposer | EffectComposer_3 | null;
|
|
15188
|
+
set composer(value: EffectComposer | EffectComposer_3 | null);
|
|
15189
|
+
private _composer;
|
|
15190
|
+
/**
|
|
15191
|
+
* Set multisampling to "auto" to automatically adjust the multisampling level based on performance.
|
|
15192
|
+
* Set to a number to manually set the multisampling level.
|
|
15193
|
+
* @default "auto"
|
|
15194
|
+
*/
|
|
15195
|
+
multisampling: "auto" | number;
|
|
15196
|
+
/** When enabled, the device pixel ratio will be gradually reduced when FPS is low
|
|
15197
|
+
* and restored when performance recovers.
|
|
15198
|
+
* @default true
|
|
15199
|
+
*/
|
|
15200
|
+
adaptiveResolution: boolean;
|
|
15201
|
+
constructor(context: Context);
|
|
15202
|
+
/**
|
|
15203
|
+
* Add a post processing effect to the stack.
|
|
15204
|
+
* The effect stack will be rebuilt on the next update.
|
|
15205
|
+
*/
|
|
15206
|
+
addEffect(effect: IPostProcessingEffect): void;
|
|
15207
|
+
/**
|
|
15208
|
+
* Remove a post processing effect from the stack.
|
|
15209
|
+
* The effect stack will be rebuilt on the next update.
|
|
15210
|
+
*/
|
|
15211
|
+
removeEffect(effect: IPostProcessingEffect): void;
|
|
15212
|
+
/** Mark the stack as dirty so the effects are rebuilt on the next update */
|
|
15213
|
+
markDirty(): void;
|
|
15214
|
+
private _enabledTime;
|
|
15215
|
+
private _multisampleAutoChangeTime;
|
|
15216
|
+
private _multisampleAutoDecreaseTime;
|
|
15217
|
+
/* Excluded from this release type: update */
|
|
15218
|
+
private _lastApplyTime?;
|
|
15219
|
+
private _rapidApplyCount;
|
|
15220
|
+
/** When true, tonemapping is applied directly to the renderer (no full pipeline) */
|
|
15221
|
+
private _tonemappingOnlyActive;
|
|
15222
|
+
private _previousToneMapping?;
|
|
15223
|
+
private _previousToneMappingExposure?;
|
|
15224
|
+
private apply;
|
|
15225
|
+
/** Restore renderer tonemapping to previous values when leaving tonemapping-only mode */
|
|
15226
|
+
private restoreTonemapping;
|
|
15227
|
+
/** Lazily creates the PostProcessingHandler to avoid loading the postprocessing library until actually needed */
|
|
15228
|
+
private ensureHandler;
|
|
15229
|
+
/* Excluded from this release type: dispose */
|
|
15230
|
+
}
|
|
15231
|
+
|
|
14930
15232
|
/**
|
|
14931
15233
|
* PostProcessingEffect is a base class for post processing effects that can be applied to the scene.
|
|
14932
15234
|
* To create a custom post processing effect, extend this class and override the `onCreateEffect` method and call `registerCustomEffectType` to make it available in the editor.
|
|
@@ -14955,8 +15257,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14955
15257
|
*
|
|
14956
15258
|
* @category Effects
|
|
14957
15259
|
* @group Components
|
|
15260
|
+
* @see {@link PostProcessing} for core Needle Engine postprocessing control, also accessible via `context.postprocessing`
|
|
14958
15261
|
*/
|
|
14959
|
-
export declare abstract class PostProcessingEffect extends Component implements IEffectProvider, IEditorModification {
|
|
15262
|
+
export declare abstract class PostProcessingEffect extends Component implements IPostProcessingEffect, IEffectProvider, IEditorModification {
|
|
14960
15263
|
get isPostProcessingEffect(): boolean;
|
|
14961
15264
|
/**
|
|
14962
15265
|
* The order of this effect. The higher the order the later the effect will be applied in the post processing stack.
|
|
@@ -14983,10 +15286,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14983
15286
|
* @deprecated
|
|
14984
15287
|
*/
|
|
14985
15288
|
active: boolean;
|
|
14986
|
-
private _manager;
|
|
14987
15289
|
onEnable(): void;
|
|
14988
15290
|
onDisable(): void;
|
|
14989
|
-
protected onEffectEnabled(manager?: IPostProcessingManager): void;
|
|
14990
15291
|
/** override to initialize bindings on parameters */
|
|
14991
15292
|
init(): void;
|
|
14992
15293
|
/** previously created effect (if any) */
|
|
@@ -15048,7 +15349,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15048
15349
|
/**
|
|
15049
15350
|
* [PostProcessingHandler](https://engine.needle.tools/docs/api/PostProcessingHandler) Is responsible for applying post processing effects to the scene. It is internally used by the {@link Volume} component
|
|
15050
15351
|
*/
|
|
15051
|
-
export declare class PostProcessingHandler {
|
|
15352
|
+
export declare class PostProcessingHandler implements IPostProcessingHandler {
|
|
15052
15353
|
private _composer;
|
|
15053
15354
|
private _lastVolumeComponents?;
|
|
15054
15355
|
private readonly _effects;
|
|
@@ -15101,8 +15402,65 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15101
15402
|
private _onCreateEffectsDebug;
|
|
15102
15403
|
}
|
|
15103
15404
|
|
|
15405
|
+
/**
|
|
15406
|
+
* Callback type for prefab providers.
|
|
15407
|
+
* @param guid The guid of the prefab to resolve
|
|
15408
|
+
* @returns The prefab Object3D, or null if not found
|
|
15409
|
+
*/
|
|
15104
15410
|
export declare type PrefabProviderCallback = (guid: string) => Promise<Object3D | null>;
|
|
15105
15411
|
|
|
15412
|
+
/**
|
|
15413
|
+
* Prefab registry for networked instantiation.
|
|
15414
|
+
*
|
|
15415
|
+
* When a remote {@link syncInstantiate} event is received, the engine looks up the prefab
|
|
15416
|
+
* by its guid using this registry. Both GLB-loaded objects and runtime-created objects
|
|
15417
|
+
* can be registered here.
|
|
15418
|
+
*
|
|
15419
|
+
* Note: {@link syncInstantiate} auto-registers prefabs if no provider exists for their guid,
|
|
15420
|
+
* so manual registration is only needed for custom resolution logic.
|
|
15421
|
+
*
|
|
15422
|
+
* @example
|
|
15423
|
+
* ```ts
|
|
15424
|
+
* import { Prefabs, ObjectUtils } from "@needle-tools/engine";
|
|
15425
|
+
*
|
|
15426
|
+
* const cookie = ObjectUtils.createPrimitive("Cube", { color: 0xff8c00 });
|
|
15427
|
+
* cookie.guid = "cookie-prefab";
|
|
15428
|
+
* Prefabs.register("cookie-prefab", async () => cookie);
|
|
15429
|
+
*
|
|
15430
|
+
* console.log(Prefabs.list()); // ["cookie-prefab"]
|
|
15431
|
+
* Prefabs.unregister("cookie-prefab");
|
|
15432
|
+
* ```
|
|
15433
|
+
*
|
|
15434
|
+
* @category Networking
|
|
15435
|
+
*/
|
|
15436
|
+
export declare const Prefabs: {
|
|
15437
|
+
/**
|
|
15438
|
+
* Register a prefab provider that resolves objects by guid for networked instantiation.
|
|
15439
|
+
* When a remote `syncInstantiate` event is received, the engine uses this to find the prefab
|
|
15440
|
+
* to clone on the receiving client.
|
|
15441
|
+
*
|
|
15442
|
+
* @param key The guid to register the provider for
|
|
15443
|
+
* @param fn Callback that returns the prefab Object3D for the given guid
|
|
15444
|
+
*/
|
|
15445
|
+
readonly register: (key: string, fn: PrefabProviderCallback) => void;
|
|
15446
|
+
/**
|
|
15447
|
+
* Unregister a previously registered prefab provider.
|
|
15448
|
+
* @param key The guid to unregister
|
|
15449
|
+
*/
|
|
15450
|
+
readonly unregister: (key: string) => void;
|
|
15451
|
+
/**
|
|
15452
|
+
* Returns a list of all registered prefab provider keys (guids).
|
|
15453
|
+
* Useful for debugging to see which prefabs are available for networked instantiation.
|
|
15454
|
+
*/
|
|
15455
|
+
readonly list: () => string[];
|
|
15456
|
+
/**
|
|
15457
|
+
* Check if a prefab provider is registered for the given guid.
|
|
15458
|
+
* @param key The guid to check
|
|
15459
|
+
*/
|
|
15460
|
+
readonly has: (key: string) => boolean;
|
|
15461
|
+
/* Excluded from this release type: resolve */
|
|
15462
|
+
};
|
|
15463
|
+
|
|
15106
15464
|
export declare type Prefix = (...args: any[]) => any;
|
|
15107
15465
|
|
|
15108
15466
|
/** Experimental attribute
|
|
@@ -15818,7 +16176,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15818
16176
|
|
|
15819
16177
|
export declare function registerLoader<T extends INeedleGltfLoader>(loader: ConstructorConcrete<T>): void;
|
|
15820
16178
|
|
|
15821
|
-
|
|
16179
|
+
/**
|
|
16180
|
+
* Register a prefab provider. Forwards to {@link Prefabs.register}.
|
|
16181
|
+
* @category Networking
|
|
16182
|
+
*/
|
|
16183
|
+
export declare function registerPrefabProvider(key: string, fn: (guid: string) => Promise<Object3D | null>): void;
|
|
15822
16184
|
|
|
15823
16185
|
/* Excluded from this release type: registerPrototypeExtensions */
|
|
15824
16186
|
|
|
@@ -17627,7 +17989,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
17627
17989
|
private _needsUpdate;
|
|
17628
17990
|
private _id;
|
|
17629
17991
|
/* Excluded from this release type: onEnable */
|
|
17630
|
-
/* Excluded from this release type: onDisable */
|
|
17631
17992
|
/* Excluded from this release type: update */
|
|
17632
17993
|
private updateDirection;
|
|
17633
17994
|
/**
|
|
@@ -19356,6 +19717,24 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19356
19717
|
instance?: StateMachineBehaviour;
|
|
19357
19718
|
};
|
|
19358
19719
|
|
|
19720
|
+
/**
|
|
19721
|
+
* Configuration for an animation state in the builder
|
|
19722
|
+
*/
|
|
19723
|
+
export declare type StateOptions = {
|
|
19724
|
+
/** The animation clip for this state */
|
|
19725
|
+
clip: AnimationClip;
|
|
19726
|
+
/** Whether the animation should loop (default: false) */
|
|
19727
|
+
loop?: boolean;
|
|
19728
|
+
/** Base speed multiplier (default: 1) */
|
|
19729
|
+
speed?: number;
|
|
19730
|
+
/** Name of a float parameter to multiply with speed */
|
|
19731
|
+
speedParameter?: string;
|
|
19732
|
+
/** Normalized cycle offset 0-1 (default: 0) */
|
|
19733
|
+
cycleOffset?: number;
|
|
19734
|
+
/** Name of a float parameter to use as cycle offset */
|
|
19735
|
+
cycleOffsetParameter?: string;
|
|
19736
|
+
};
|
|
19737
|
+
|
|
19359
19738
|
declare type StickName = "xr-standard-thumbstick" | "xr-standard-touchpad";
|
|
19360
19739
|
|
|
19361
19740
|
export declare class StreamEndedEvent {
|
|
@@ -19405,6 +19784,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19405
19784
|
*/
|
|
19406
19785
|
export declare function syncDestroy(obj: IGameObject | IComponent, con: INetworkConnection, recursive?: boolean, opts?: SyncDestroyOptions): void;
|
|
19407
19786
|
|
|
19787
|
+
declare type SyncDestroyCallback = (guid: string, object: Object3D) => void;
|
|
19788
|
+
|
|
19408
19789
|
declare type SyncDestroyOptions = {
|
|
19409
19790
|
/** When true the state will be saved in the networking backend */
|
|
19410
19791
|
saveInRoom?: boolean;
|
|
@@ -19521,7 +19902,10 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19521
19902
|
get roomPrefix(): string;
|
|
19522
19903
|
private _roomPrefix;
|
|
19523
19904
|
/* Excluded from this release type: awake */
|
|
19905
|
+
private _hasConnectedBefore;
|
|
19524
19906
|
/* Excluded from this release type: onEnable */
|
|
19907
|
+
/* Excluded from this release type: start */
|
|
19908
|
+
private _connectToRoom;
|
|
19525
19909
|
/* Excluded from this release type: onDisable */
|
|
19526
19910
|
/* Excluded from this release type: onDestroy */
|
|
19527
19911
|
/** Will generate a random room name, set it as an URL parameter and attempt to join the room */
|
|
@@ -19714,13 +20098,67 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19714
20098
|
}) => void;
|
|
19715
20099
|
|
|
19716
20100
|
/**
|
|
19717
|
-
* Instantiate an object across the network.
|
|
20101
|
+
* Instantiate an object across the network. The object is cloned locally and a network message
|
|
20102
|
+
* is sent so all connected clients create the same clone. Late joiners receive the message
|
|
20103
|
+
* via room state replay (unless `deleteOnDisconnect` is set or `save` is false).
|
|
20104
|
+
*
|
|
20105
|
+
* ## How it works internally
|
|
20106
|
+
* 1. The prefab is cloned locally using a seeded {@link InstantiateIdProvider}
|
|
20107
|
+
* 2. The seed ensures all clients generate **identical deterministic guids** for the clone
|
|
20108
|
+
* and all its children — no need to send individual guids over the network
|
|
20109
|
+
* 3. A {@link NewInstanceModel} message is sent containing the prefab's `originalGuid`,
|
|
20110
|
+
* the clone's `guid`, the `seed`, and transform data
|
|
20111
|
+
* 4. On receiving clients, the prefab is resolved via {@link registerPrefabProvider} or
|
|
20112
|
+
* by searching the scene for an object with matching guid, then cloned with the same seed
|
|
20113
|
+
*
|
|
20114
|
+
* ## Runtime-created prefabs (no GLB)
|
|
20115
|
+
* If the object has a `guid` but no prefab provider is registered for it, `syncInstantiate`
|
|
20116
|
+
* will **auto-register** the object as a prefab provider. This means for code-only prefabs
|
|
20117
|
+
* you just need to set a `guid` — no manual `registerPrefabProvider` call needed, as long as
|
|
20118
|
+
* all clients run the same setup code that creates the same prefab with the same guid.
|
|
20119
|
+
*
|
|
20120
|
+
* @param object The object to instantiate. Must have a `guid` property (set one for runtime objects).
|
|
20121
|
+
* @param opts Options for the instantiation, including the network context to send the instantiate event to
|
|
20122
|
+
* @param hostData Optional data about a file to download when this object is instantiated (e.g. when instantiated via file drop)
|
|
20123
|
+
* @param save When false, the state of this instance will not be saved in the networking backend. Default is true.
|
|
20124
|
+
* @returns The instantiated object, or null if instantiation failed (e.g. missing guid or network context)
|
|
20125
|
+
* @see {@link syncDestroy} - Destroy objects across the network
|
|
20126
|
+
* @see {@link onSyncInstantiate} - Register a callback to get references to remotely instantiated objects
|
|
20127
|
+
* @see {@link registerPrefabProvider} - Manually register a prefab provider (auto-registered by syncInstantiate)
|
|
20128
|
+
* @see {@link unregisterPrefabProvider} - Remove a registered prefab provider
|
|
19718
20129
|
* @category Networking
|
|
20130
|
+
*
|
|
20131
|
+
* @example Basic usage with a runtime-created prefab
|
|
20132
|
+
* ```ts
|
|
20133
|
+
* const cookie = ObjectUtils.createPrimitive("Cube", { color: 0xff8c00 });
|
|
20134
|
+
* cookie.guid = "cookie-prefab";
|
|
20135
|
+
* // No need to call registerPrefabProvider — syncInstantiate auto-registers it
|
|
20136
|
+
* syncInstantiate(cookie, { parent: ctx.scene, deleteOnDisconnect: false });
|
|
20137
|
+
* ```
|
|
20138
|
+
*
|
|
20139
|
+
* @example With deterministic seed (advanced)
|
|
20140
|
+
* ```ts
|
|
20141
|
+
* const idProvider = new InstantiateIdProvider("my-seed");
|
|
20142
|
+
* const instance = syncInstantiate(prefab, { context, idProvider });
|
|
20143
|
+
* ```
|
|
20144
|
+
* The seed generates deterministic guids via UUID v5, so all clients produce identical
|
|
20145
|
+
* identifiers for the clone and its children without sending them over the network.
|
|
19719
20146
|
*/
|
|
19720
20147
|
export declare function syncInstantiate(object: IGameObject | Object3D, opts: SyncInstantiateOptions, hostData?: HostData, save?: boolean): IGameObject | null;
|
|
19721
20148
|
|
|
20149
|
+
/**
|
|
20150
|
+
* Callback type for {@link onSyncInstantiate}
|
|
20151
|
+
* @param instance The instantiated object
|
|
20152
|
+
* @param model The network model data sent with the instantiate event
|
|
20153
|
+
* @param context The network context in which the instantiate event was received
|
|
20154
|
+
* @category Networking
|
|
20155
|
+
*/
|
|
20156
|
+
declare type SyncInstantiateCallback = (instance: IGameObject, model: NewInstanceModel, context: IContext) => void;
|
|
20157
|
+
|
|
19722
20158
|
/**
|
|
19723
20159
|
* Instantiation options for {@link syncInstantiate}
|
|
20160
|
+
* @category Networking
|
|
20161
|
+
* @see {@link syncInstantiate} - Instantiate objects across the network
|
|
19724
20162
|
*/
|
|
19725
20163
|
export declare type SyncInstantiateOptions = IInstantiateOptions & Pick<IModel, "deleteOnDisconnect">;
|
|
19726
20164
|
|
|
@@ -19803,19 +20241,75 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19803
20241
|
* @see {@link FontStyle} for bold/italic styles
|
|
19804
20242
|
*/
|
|
19805
20243
|
declare class Text_2 extends Graphic implements IHasAlphaFactor, ICanvasEventReceiver {
|
|
19806
|
-
|
|
19807
|
-
|
|
19808
|
-
|
|
19809
|
-
|
|
19810
|
-
|
|
19811
|
-
|
|
19812
|
-
|
|
20244
|
+
/**
|
|
20245
|
+
* The alignment of the text within its container. This determines how the text is anchored and positioned relative to its RectTransform. For example, `UpperLeft` will anchor the text to the upper left corner of the container, while `MiddleCenter` will center the text both horizontally and vertically. Changing this property will update the underlying three-mesh-ui options and mark the UI as dirty to trigger a re-render.
|
|
20246
|
+
*/
|
|
20247
|
+
set alignment(val: TextAnchor);
|
|
20248
|
+
get alignment(): TextAnchor;
|
|
20249
|
+
private _alignment;
|
|
20250
|
+
/**
|
|
20251
|
+
* Determines how text that exceeds the vertical bounds of the container is handled. If set to `Truncate`, any text that goes beyond the vertical limits of the container will be cut off and not visible. If set to `Overflow`, the text will continue to render outside the container bounds, which may result in it being partially or fully visible depending on the layout and parent containers.
|
|
20252
|
+
* @default VerticalWrapMode.Truncate
|
|
20253
|
+
*/
|
|
20254
|
+
set verticalOverflow(val: VerticalWrapMode);
|
|
20255
|
+
get verticalOverflow(): VerticalWrapMode;
|
|
20256
|
+
private _verticalOverflow;
|
|
20257
|
+
/**
|
|
20258
|
+
* Determines how text that exceeds the horizontal bounds of the container is handled. If set to `Wrap`, the text will automatically wrap to the next line when it reaches the edge of the container. If set to `Overflow`, the text will continue on a single line and may overflow outside the container bounds.
|
|
20259
|
+
* @default HorizontalWrapMode.Wrap
|
|
20260
|
+
*/
|
|
20261
|
+
set horizontalOverflow(val: HorizontalWrapMode);
|
|
20262
|
+
get horizontalOverflow(): HorizontalWrapMode;
|
|
20263
|
+
private _horizontalOverflow;
|
|
20264
|
+
/**
|
|
20265
|
+
* The line spacing multiplier for the text. A value of 1 means normal spacing, 1.5 means 50% more spacing, and 0.5 means 50% less spacing.
|
|
20266
|
+
* @default 1
|
|
20267
|
+
*/
|
|
20268
|
+
set lineSpacing(val: number);
|
|
20269
|
+
get lineSpacing(): number;
|
|
20270
|
+
private _lineSpacing;
|
|
20271
|
+
/**
|
|
20272
|
+
* The style of the font, which can be normal, bold, italic, or bold and italic.
|
|
20273
|
+
*
|
|
20274
|
+
* This is used to determine the correct font variant to use based on the provided `font` property. For example, if you set `font` to "Arial" and `fontStyle` to `FontStyle.Bold`, it will look for a font variant named "Arial-Bold" (or "arial-bold") in the font library. If such a variant exists, it will be used to render the text with the specified style.
|
|
20275
|
+
*
|
|
20276
|
+
* @default FontStyle.Normal
|
|
20277
|
+
*/
|
|
20278
|
+
set fontStyle(val: FontStyle);
|
|
20279
|
+
get fontStyle(): FontStyle;
|
|
20280
|
+
private _fontStyle;
|
|
20281
|
+
/**
|
|
20282
|
+
* The font to use for the text, specified as a URL to a font file.
|
|
20283
|
+
*
|
|
20284
|
+
* The font file must be in MSDF format. You can generate MSDF fonts using tools like [msdf-bmfont-xml](https://github.com/Chlumsky/msdf-bmfont-xml) or by using Needle Engine for Unity where the Needle Engine integration automatically generates MSDF fonts for used font assets.
|
|
20285
|
+
*
|
|
20286
|
+
* @default "https://cdn.needle.tools/static/fonts/msdf/arial/arial"
|
|
20287
|
+
*/
|
|
20288
|
+
set font(val: string | null);
|
|
20289
|
+
get font(): string | null;
|
|
20290
|
+
private _font;
|
|
20291
|
+
/**
|
|
20292
|
+
* Whether to support basic rich text tags in the `text` property. Supported tags include `<b>`, `<i>`, and `<color=hex>`. For example: `Hello <b>World</b>` or `Score: <color=#ff0000>100</color>`
|
|
20293
|
+
* @default false
|
|
20294
|
+
*/
|
|
20295
|
+
set supportRichText(val: boolean);
|
|
20296
|
+
get supportRichText(): boolean;
|
|
20297
|
+
private _supportRichText;
|
|
20298
|
+
/**
|
|
20299
|
+
* Set the alpha factor for the text, which multiplies with the color's alpha to determine overall transparency.
|
|
20300
|
+
*/
|
|
19813
20301
|
setAlphaFactor(factor: number): void;
|
|
20302
|
+
/**
|
|
20303
|
+
* The text content to display. Supports basic rich text tags like `<b>`, `<i>`, and `<color=hex>` if `supportRichText` is enabled.
|
|
20304
|
+
* @default ""
|
|
20305
|
+
*/
|
|
19814
20306
|
get text(): string;
|
|
19815
20307
|
set text(val: string);
|
|
20308
|
+
private _text;
|
|
19816
20309
|
private set_text;
|
|
19817
20310
|
get fontSize(): number;
|
|
19818
20311
|
set fontSize(val: number);
|
|
20312
|
+
private _fontSize;
|
|
19819
20313
|
private sRGBTextColor;
|
|
19820
20314
|
protected onColorChanged(): void;
|
|
19821
20315
|
onParentRectTransformChanged(): void;
|
|
@@ -19823,8 +20317,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19823
20317
|
private updateOverflow;
|
|
19824
20318
|
protected onCreate(_opts: any): void;
|
|
19825
20319
|
onAfterAddedToScene(): void;
|
|
19826
|
-
private _text;
|
|
19827
|
-
private _fontSize;
|
|
19828
20320
|
private _textMeshUi;
|
|
19829
20321
|
private getTextOpts;
|
|
19830
20322
|
onEnable(): void;
|
|
@@ -19851,7 +20343,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19851
20343
|
}
|
|
19852
20344
|
export { Text_2 as Text }
|
|
19853
20345
|
|
|
19854
|
-
declare enum TextAnchor {
|
|
20346
|
+
export declare enum TextAnchor {
|
|
19855
20347
|
UpperLeft = 0,
|
|
19856
20348
|
UpperCenter = 1,
|
|
19857
20349
|
UpperRight = 2,
|
|
@@ -19860,8 +20352,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19860
20352
|
MiddleRight = 5,
|
|
19861
20353
|
LowerLeft = 6,
|
|
19862
20354
|
LowerCenter = 7,
|
|
19863
|
-
LowerRight = 8
|
|
19864
|
-
Custom = 9
|
|
20355
|
+
LowerRight = 8
|
|
19865
20356
|
}
|
|
19866
20357
|
|
|
19867
20358
|
declare enum TextAnchor_2 {
|
|
@@ -19873,7 +20364,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19873
20364
|
MiddleRight = 5,
|
|
19874
20365
|
LowerLeft = 6,
|
|
19875
20366
|
LowerCenter = 7,
|
|
19876
|
-
LowerRight = 8
|
|
20367
|
+
LowerRight = 8,
|
|
20368
|
+
Custom = 9
|
|
19877
20369
|
}
|
|
19878
20370
|
|
|
19879
20371
|
export declare class TextBuilder {
|
|
@@ -20077,10 +20569,12 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20077
20569
|
/** Set the tonemapping mode to e.g. "agx" */
|
|
20078
20570
|
setMode(mode: NEToneMappingModeNames): this;
|
|
20079
20571
|
get isToneMapping(): boolean;
|
|
20080
|
-
|
|
20572
|
+
/** The three.js ToneMapping enum value resolved from the current mode */
|
|
20573
|
+
get threeToneMapping(): ToneMapping;
|
|
20574
|
+
/** The exposure value to apply */
|
|
20575
|
+
get toneMappingExposure(): number;
|
|
20081
20576
|
private _tonemappingEffect;
|
|
20082
20577
|
onCreateEffect(): EffectProviderResult | undefined;
|
|
20083
|
-
onBeforeRender(): void;
|
|
20084
20578
|
}
|
|
20085
20579
|
|
|
20086
20580
|
export declare function toSourceId(src: string | null): SourceIdentifier | undefined;
|
|
@@ -20339,6 +20833,22 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20339
20833
|
Animation = 3
|
|
20340
20834
|
}
|
|
20341
20835
|
|
|
20836
|
+
/**
|
|
20837
|
+
* Configuration for a transition in the builder
|
|
20838
|
+
*/
|
|
20839
|
+
export declare type TransitionOptions = {
|
|
20840
|
+
/** Duration of the crossfade in seconds (default: 0) */
|
|
20841
|
+
duration?: number;
|
|
20842
|
+
/** Normalized exit time 0-1 (default: 1). Only used when hasExitTime is true */
|
|
20843
|
+
exitTime?: number;
|
|
20844
|
+
/** Whether the transition waits for exitTime before transitioning (default: false) */
|
|
20845
|
+
hasExitTime?: boolean;
|
|
20846
|
+
/** Normalized offset into the destination state's animation (default: 0) */
|
|
20847
|
+
offset?: number;
|
|
20848
|
+
/** Whether duration is in seconds (true) or normalized (false) (default: false) */
|
|
20849
|
+
hasFixedDuration?: boolean;
|
|
20850
|
+
};
|
|
20851
|
+
|
|
20342
20852
|
export declare class TriggerBuilder {
|
|
20343
20853
|
private static __sceneStartTrigger?;
|
|
20344
20854
|
static sceneStartTrigger(): TriggerModel;
|
|
@@ -20474,6 +20984,12 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20474
20984
|
|
|
20475
20985
|
/* Excluded from this release type: unregisterHotReloadType */
|
|
20476
20986
|
|
|
20987
|
+
/**
|
|
20988
|
+
* Unregister a prefab provider. Forwards to {@link Prefabs.unregister}.
|
|
20989
|
+
* @category Networking
|
|
20990
|
+
*/
|
|
20991
|
+
export declare function unregisterPrefabProvider(key: string): void;
|
|
20992
|
+
|
|
20477
20993
|
export declare function unwatchWrite(vec: Vector_2, cb: Function): void;
|
|
20478
20994
|
|
|
20479
20995
|
export declare class UriSerializer extends TypeSerializer {
|
|
@@ -20982,7 +21498,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20982
21498
|
protected get primaryAxis(): Axis;
|
|
20983
21499
|
}
|
|
20984
21500
|
|
|
20985
|
-
declare enum VerticalWrapMode {
|
|
21501
|
+
export declare enum VerticalWrapMode {
|
|
20986
21502
|
Truncate = 0,
|
|
20987
21503
|
Overflow = 1
|
|
20988
21504
|
}
|
|
@@ -21441,6 +21957,47 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21441
21957
|
* When enabled debug messages will be printed to the console. This is useful for debugging audio issues. You can also append ?debugvoip to the URL to enable this.
|
|
21442
21958
|
*/
|
|
21443
21959
|
debug: boolean;
|
|
21960
|
+
private _volume;
|
|
21961
|
+
/**
|
|
21962
|
+
* Volume for incoming audio streams (0 = silent, 1 = full volume).
|
|
21963
|
+
* Changes apply immediately to all active incoming streams.
|
|
21964
|
+
*/
|
|
21965
|
+
get volume(): number;
|
|
21966
|
+
set volume(val: number);
|
|
21967
|
+
/**
|
|
21968
|
+
* Get the incoming audio element for a specific user.
|
|
21969
|
+
* Use this to route audio through the Web Audio API for spatial audio, effects, or analysis.
|
|
21970
|
+
* @param userId The connection ID of the remote user
|
|
21971
|
+
* @returns The HTMLAudioElement for this user's stream, or undefined if not connected
|
|
21972
|
+
* @example
|
|
21973
|
+
* ```ts
|
|
21974
|
+
* const audioEl = voip.getAudioElement(userId);
|
|
21975
|
+
* if (audioEl) {
|
|
21976
|
+
* const audioCtx = new AudioContext();
|
|
21977
|
+
* const source = audioCtx.createMediaElementSource(audioEl);
|
|
21978
|
+
* const panner = audioCtx.createPanner();
|
|
21979
|
+
* source.connect(panner).connect(audioCtx.destination);
|
|
21980
|
+
* }
|
|
21981
|
+
* ```
|
|
21982
|
+
*/
|
|
21983
|
+
getAudioElement(userId: string): HTMLAudioElement | undefined;
|
|
21984
|
+
/**
|
|
21985
|
+
* Get all active incoming audio streams as a Map of userId → HTMLAudioElement.
|
|
21986
|
+
* Useful for iterating over all connected voice users.
|
|
21987
|
+
*/
|
|
21988
|
+
get incomingStreams(): ReadonlyMap<string, HTMLAudioElement>;
|
|
21989
|
+
/**
|
|
21990
|
+
* Threshold for speaking detection (0–255). When a user's audio amplitude exceeds this,
|
|
21991
|
+
* they are considered "speaking". Default is 30.
|
|
21992
|
+
*/
|
|
21993
|
+
speakingThreshold: number;
|
|
21994
|
+
/**
|
|
21995
|
+
* Event fired when a user's speaking state changes.
|
|
21996
|
+
* Passes `{ userId: string, isSpeaking: boolean, volume: number }`.
|
|
21997
|
+
*/
|
|
21998
|
+
onSpeakingChanged: EventList;
|
|
21999
|
+
private _speakingStates;
|
|
22000
|
+
private _analysers;
|
|
21444
22001
|
private _net?;
|
|
21445
22002
|
private _menubutton?;
|
|
21446
22003
|
/* Excluded from this release type: awake */
|
|
@@ -21473,6 +22030,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21473
22030
|
private onJoinedRoom;
|
|
21474
22031
|
private onLeftRoom;
|
|
21475
22032
|
private _incomingStreams;
|
|
22033
|
+
/* Excluded from this release type: update */
|
|
22034
|
+
private setupAnalyser;
|
|
22035
|
+
private cleanupAnalyser;
|
|
21476
22036
|
private onReceiveStream;
|
|
21477
22037
|
private onStreamEnded;
|
|
21478
22038
|
private onEnabledChanged;
|
|
@@ -21482,6 +22042,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21482
22042
|
/** [Volume](https://engine.needle.tools/docs/api/Volume) The Volume/PostprocessingManager component is responsible for managing post processing effects.
|
|
21483
22043
|
* Add this component to any object in your scene to enable post processing effects.
|
|
21484
22044
|
*
|
|
22045
|
+
* Effects added to this Volume (via profile or code) are pushed to `context.postprocessing` when the Volume is enabled,
|
|
22046
|
+
* and removed when it is disabled.
|
|
22047
|
+
*
|
|
21485
22048
|
* @example Add bloom
|
|
21486
22049
|
* ```ts
|
|
21487
22050
|
* const volume = new Volume();
|
|
@@ -21507,11 +22070,14 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21507
22070
|
* @summary Manage Post-Processing Effects
|
|
21508
22071
|
* @category Rendering
|
|
21509
22072
|
* @category Effects
|
|
22073
|
+
* @see {@link VolumeProfile} for profile-based effect management
|
|
22074
|
+
* @see {@link PostProcessingEffect} for creating custom effects
|
|
22075
|
+
* @see {@link PostProcessing} for core Needle Engine postprocessing control, also accessible via `context.postprocessing`
|
|
21510
22076
|
* @group Components
|
|
21511
22077
|
*/
|
|
21512
22078
|
declare class Volume extends Component implements IEditorModification, IPostProcessingManager {
|
|
21513
22079
|
get isPostProcessingManager(): boolean;
|
|
21514
|
-
/** Currently active postprocessing effects */
|
|
22080
|
+
/** Currently active postprocessing effects managed by this Volume */
|
|
21515
22081
|
get effects(): PostProcessingEffect[];
|
|
21516
22082
|
get dirty(): boolean;
|
|
21517
22083
|
set dirty(value: boolean);
|
|
@@ -21519,6 +22085,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21519
22085
|
/**
|
|
21520
22086
|
* Set multisampling to "auto" to automatically adjust the multisampling level based on performance.
|
|
21521
22087
|
* Set to a number to manually set the multisampling level.
|
|
22088
|
+
* Pushed to `context.postprocessing.multisampling` when this Volume is active.
|
|
21522
22089
|
* @default "auto"
|
|
21523
22090
|
* @min 0
|
|
21524
22091
|
* @max renderer.capabilities.maxSamples
|
|
@@ -21527,21 +22094,21 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21527
22094
|
/** When enabled, the device pixel ratio will be gradually reduced when FPS is low
|
|
21528
22095
|
* and restored when performance recovers. This helps maintain smooth frame rates
|
|
21529
22096
|
* on devices where full retina resolution is too expensive for postprocessing.
|
|
22097
|
+
* Pushed to `context.postprocessing.adaptiveResolution` when this Volume is active.
|
|
21530
22098
|
* Disable this if you need a fixed resolution and prefer consistent quality over frame rate.
|
|
21531
22099
|
* @default true
|
|
21532
22100
|
*/
|
|
21533
22101
|
adaptiveResolution: boolean;
|
|
21534
22102
|
/**
|
|
21535
|
-
* Add a post processing effect to
|
|
22103
|
+
* Add a post processing effect to this Volume and push it to the core postprocessing stack.
|
|
21536
22104
|
*/
|
|
21537
22105
|
addEffect<T extends PostProcessingEffect | Effect>(effect: T & {
|
|
21538
22106
|
order?: number;
|
|
21539
22107
|
}): T;
|
|
21540
22108
|
/**
|
|
21541
|
-
* Remove a post processing effect from
|
|
22109
|
+
* Remove a post processing effect from this Volume and the core postprocessing stack.
|
|
21542
22110
|
*/
|
|
21543
22111
|
removeEffect<T extends PostProcessingEffect | Effect>(effect: T): T;
|
|
21544
|
-
private _postprocessing?;
|
|
21545
22112
|
private readonly _activeEffects;
|
|
21546
22113
|
private readonly _effects;
|
|
21547
22114
|
/**
|
|
@@ -21549,17 +22116,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21549
22116
|
*/
|
|
21550
22117
|
markDirty(): void;
|
|
21551
22118
|
/* Excluded from this release type: awake */
|
|
21552
|
-
private
|
|
21553
|
-
private _multisampleAutoChangeTime;
|
|
21554
|
-
private _multisampleAutoDecreaseTime;
|
|
22119
|
+
private _isDirty;
|
|
21555
22120
|
/* Excluded from this release type: onEnable */
|
|
21556
22121
|
/* Excluded from this release type: onDisable */
|
|
21557
22122
|
/* Excluded from this release type: onBeforeRender */
|
|
21558
22123
|
/* Excluded from this release type: onDestroy */
|
|
21559
|
-
|
|
21560
|
-
private
|
|
21561
|
-
|
|
21562
|
-
private
|
|
22124
|
+
/** Collect active effects from profile + code and push them to context.postprocessing */
|
|
22125
|
+
private pushEffectsToCore;
|
|
22126
|
+
/** Remove all effects this Volume contributed from the core stack */
|
|
22127
|
+
private removeEffectsFromCore;
|
|
22128
|
+
/** Push multisampling and adaptiveResolution config to the core stack */
|
|
22129
|
+
private syncConfigToCore;
|
|
21563
22130
|
private _applyPostQueue;
|
|
21564
22131
|
/** called from needle editor sync package if its active */
|
|
21565
22132
|
onEditorModification(modification: EditorModification): void | boolean | undefined;
|