@needle-tools/engine 5.0.2 → 5.1.0-canary.525aa82

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.
Files changed (176) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +6 -7
  3. package/SKILL.md +39 -21
  4. package/components.needle.json +1 -1
  5. package/dist/needle-engine.bundle-DPag02s9.min.js +1732 -0
  6. package/dist/needle-engine.bundle-IPMzQpe1.umd.cjs +1732 -0
  7. package/dist/{needle-engine.bundle-BoTyA-Le.js → needle-engine.bundle-qa_NEunk.js} +8881 -8148
  8. package/dist/needle-engine.d.ts +633 -61
  9. package/dist/needle-engine.js +576 -565
  10. package/dist/needle-engine.min.js +1 -1
  11. package/dist/needle-engine.umd.cjs +1 -1
  12. package/dist/{vendor-vHLk8sXu.js → vendor-CAcsI0eU.js} +116 -115
  13. package/dist/{vendor-CntUvmJu.umd.cjs → vendor-CEM38hLE.umd.cjs} +2 -2
  14. package/dist/{vendor-DPbfJJ4d.min.js → vendor-HRlxIBga.min.js} +2 -2
  15. package/lib/engine/api.d.ts +2 -0
  16. package/lib/engine/api.js +2 -0
  17. package/lib/engine/api.js.map +1 -1
  18. package/lib/engine/engine_addressables.js +5 -1
  19. package/lib/engine/engine_addressables.js.map +1 -1
  20. package/lib/engine/engine_animation.d.ts +14 -7
  21. package/lib/engine/engine_animation.js +49 -9
  22. package/lib/engine/engine_animation.js.map +1 -1
  23. package/lib/engine/engine_components.js +33 -4
  24. package/lib/engine/engine_components.js.map +1 -1
  25. package/lib/engine/engine_context.d.ts +7 -2
  26. package/lib/engine/engine_context.js +10 -2
  27. package/lib/engine/engine_context.js.map +1 -1
  28. package/lib/engine/engine_gameobject.d.ts +4 -0
  29. package/lib/engine/engine_gameobject.js.map +1 -1
  30. package/lib/engine/engine_init.js +4 -0
  31. package/lib/engine/engine_init.js.map +1 -1
  32. package/lib/engine/engine_input.js +4 -1
  33. package/lib/engine/engine_input.js.map +1 -1
  34. package/lib/engine/engine_materialpropertyblock.js +1 -20
  35. package/lib/engine/engine_materialpropertyblock.js.map +1 -1
  36. package/lib/engine/engine_networking.d.ts +11 -8
  37. package/lib/engine/engine_networking.js +43 -26
  38. package/lib/engine/engine_networking.js.map +1 -1
  39. package/lib/engine/engine_networking_instantiate.d.ts +100 -5
  40. package/lib/engine/engine_networking_instantiate.js +150 -16
  41. package/lib/engine/engine_networking_instantiate.js.map +1 -1
  42. package/lib/engine/engine_networking_prefabs.d.ts +59 -0
  43. package/lib/engine/engine_networking_prefabs.js +67 -0
  44. package/lib/engine/engine_networking_prefabs.js.map +1 -0
  45. package/lib/engine/engine_physics_rapier.d.ts +3 -0
  46. package/lib/engine/engine_physics_rapier.js +13 -9
  47. package/lib/engine/engine_physics_rapier.js.map +1 -1
  48. package/lib/engine/postprocessing/api.d.ts +2 -0
  49. package/lib/engine/postprocessing/api.js +2 -0
  50. package/lib/engine/postprocessing/api.js.map +1 -0
  51. package/lib/engine/postprocessing/index.d.ts +2 -0
  52. package/lib/engine/postprocessing/index.js +2 -0
  53. package/lib/engine/postprocessing/index.js.map +1 -0
  54. package/lib/engine/postprocessing/postprocessing.d.ts +83 -0
  55. package/lib/engine/postprocessing/postprocessing.js +280 -0
  56. package/lib/engine/postprocessing/postprocessing.js.map +1 -0
  57. package/lib/engine/postprocessing/types.d.ts +39 -0
  58. package/lib/engine/postprocessing/types.js +2 -0
  59. package/lib/engine/postprocessing/types.js.map +1 -0
  60. package/lib/engine/webcomponents/WebXRButtons.js +17 -3
  61. package/lib/engine/webcomponents/WebXRButtons.js.map +1 -1
  62. package/lib/engine/webcomponents/icons.js +3 -1
  63. package/lib/engine/webcomponents/icons.js.map +1 -1
  64. package/lib/engine/xr/NeedleXRSession.d.ts +1 -0
  65. package/lib/engine/xr/NeedleXRSession.js +43 -10
  66. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  67. package/lib/engine/xr/init.d.ts +4 -0
  68. package/lib/engine/xr/init.js +49 -0
  69. package/lib/engine/xr/init.js.map +1 -0
  70. package/lib/engine-components/AnimationUtils.d.ts +4 -1
  71. package/lib/engine-components/AnimationUtils.js +7 -19
  72. package/lib/engine-components/AnimationUtils.js.map +1 -1
  73. package/lib/engine-components/AnimatorController.d.ts +135 -2
  74. package/lib/engine-components/AnimatorController.js +216 -13
  75. package/lib/engine-components/AnimatorController.js.map +1 -1
  76. package/lib/engine-components/GroundProjection.d.ts +1 -0
  77. package/lib/engine-components/GroundProjection.js +184 -48
  78. package/lib/engine-components/GroundProjection.js.map +1 -1
  79. package/lib/engine-components/OrbitControls.d.ts +4 -0
  80. package/lib/engine-components/OrbitControls.js +5 -1
  81. package/lib/engine-components/OrbitControls.js.map +1 -1
  82. package/lib/engine-components/SeeThrough.d.ts +0 -2
  83. package/lib/engine-components/SeeThrough.js +0 -89
  84. package/lib/engine-components/SeeThrough.js.map +1 -1
  85. package/lib/engine-components/SyncedRoom.d.ts +4 -0
  86. package/lib/engine-components/SyncedRoom.js +23 -8
  87. package/lib/engine-components/SyncedRoom.js.map +1 -1
  88. package/lib/engine-components/SyncedTransform.js +5 -5
  89. package/lib/engine-components/SyncedTransform.js.map +1 -1
  90. package/lib/engine-components/Voip.d.ts +46 -0
  91. package/lib/engine-components/Voip.js +126 -2
  92. package/lib/engine-components/Voip.js.map +1 -1
  93. package/lib/engine-components/api.d.ts +1 -0
  94. package/lib/engine-components/api.js +1 -0
  95. package/lib/engine-components/api.js.map +1 -1
  96. package/lib/engine-components/codegen/components.d.ts +1 -0
  97. package/lib/engine-components/codegen/components.js +1 -0
  98. package/lib/engine-components/codegen/components.js.map +1 -1
  99. package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +5 -2
  100. package/lib/engine-components/postprocessing/Effects/Tonemapping.js +11 -18
  101. package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
  102. package/lib/engine-components/postprocessing/PostProcessingEffect.d.ts +3 -4
  103. package/lib/engine-components/postprocessing/PostProcessingEffect.js +6 -15
  104. package/lib/engine-components/postprocessing/PostProcessingEffect.js.map +1 -1
  105. package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +2 -1
  106. package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
  107. package/lib/engine-components/postprocessing/Volume.d.ts +18 -11
  108. package/lib/engine-components/postprocessing/Volume.js +61 -140
  109. package/lib/engine-components/postprocessing/Volume.js.map +1 -1
  110. package/lib/engine-components/postprocessing/index.d.ts +1 -0
  111. package/lib/engine-components/postprocessing/index.js +1 -0
  112. package/lib/engine-components/postprocessing/index.js.map +1 -1
  113. package/lib/engine-components/postprocessing/utils.d.ts +2 -0
  114. package/lib/engine-components/postprocessing/utils.js +2 -0
  115. package/lib/engine-components/postprocessing/utils.js.map +1 -1
  116. package/lib/engine-components/ui/Canvas.js +2 -2
  117. package/lib/engine-components/ui/Canvas.js.map +1 -1
  118. package/lib/engine-components/ui/Graphic.d.ts +3 -3
  119. package/lib/engine-components/ui/Graphic.js +6 -2
  120. package/lib/engine-components/ui/Graphic.js.map +1 -1
  121. package/lib/engine-components/ui/Text.d.ts +64 -11
  122. package/lib/engine-components/ui/Text.js +154 -45
  123. package/lib/engine-components/ui/Text.js.map +1 -1
  124. package/lib/engine-components/ui/index.d.ts +1 -0
  125. package/lib/engine-components/ui/index.js +1 -0
  126. package/lib/engine-components/ui/index.js.map +1 -1
  127. package/lib/engine-components-experimental/networking/PlayerSync.d.ts +25 -3
  128. package/lib/engine-components-experimental/networking/PlayerSync.js +60 -11
  129. package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
  130. package/package.json +6 -5
  131. package/plugins/vite/ai.d.ts +11 -10
  132. package/plugins/vite/ai.js +305 -31
  133. package/src/engine/api.ts +3 -0
  134. package/src/engine/engine_addressables.ts +4 -1
  135. package/src/engine/engine_animation.ts +47 -9
  136. package/src/engine/engine_components.ts +36 -7
  137. package/src/engine/engine_context.ts +11 -2
  138. package/src/engine/engine_gameobject.ts +5 -0
  139. package/src/engine/engine_init.ts +4 -0
  140. package/src/engine/engine_input.ts +2 -1
  141. package/src/engine/engine_materialpropertyblock.ts +1 -20
  142. package/src/engine/engine_networking.ts +46 -23
  143. package/src/engine/engine_networking_instantiate.ts +160 -18
  144. package/src/engine/engine_networking_prefabs.ts +80 -0
  145. package/src/engine/engine_physics_rapier.ts +14 -9
  146. package/src/engine/postprocessing/api.ts +2 -0
  147. package/src/engine/postprocessing/index.ts +2 -0
  148. package/src/engine/postprocessing/postprocessing.ts +322 -0
  149. package/src/engine/postprocessing/types.ts +43 -0
  150. package/src/engine/webcomponents/WebXRButtons.ts +21 -4
  151. package/src/engine/webcomponents/icons.ts +5 -3
  152. package/src/engine/xr/NeedleXRSession.ts +50 -15
  153. package/src/engine/xr/init.ts +56 -0
  154. package/src/engine-components/AnimationUtils.ts +7 -17
  155. package/src/engine-components/AnimatorController.ts +288 -18
  156. package/src/engine-components/GroundProjection.ts +226 -52
  157. package/src/engine-components/OrbitControls.ts +5 -1
  158. package/src/engine-components/SeeThrough.ts +0 -116
  159. package/src/engine-components/SyncedRoom.ts +28 -9
  160. package/src/engine-components/SyncedTransform.ts +5 -5
  161. package/src/engine-components/Voip.ts +129 -2
  162. package/src/engine-components/api.ts +1 -0
  163. package/src/engine-components/codegen/components.ts +1 -0
  164. package/src/engine-components/postprocessing/Effects/Tonemapping.ts +16 -24
  165. package/src/engine-components/postprocessing/PostProcessingEffect.ts +9 -16
  166. package/src/engine-components/postprocessing/PostProcessingHandler.ts +2 -1
  167. package/src/engine-components/postprocessing/Volume.ts +72 -163
  168. package/src/engine-components/postprocessing/index.ts +1 -0
  169. package/src/engine-components/postprocessing/utils.ts +2 -0
  170. package/src/engine-components/ui/Canvas.ts +2 -2
  171. package/src/engine-components/ui/Graphic.ts +7 -3
  172. package/src/engine-components/ui/Text.ts +170 -52
  173. package/src/engine-components/ui/index.ts +2 -1
  174. package/src/engine-components-experimental/networking/PlayerSync.ts +64 -11
  175. package/dist/needle-engine.bundle-B3ywqx5o.min.js +0 -1654
  176. package/dist/needle-engine.bundle-CzOPcOui.umd.cjs +0 -1654
@@ -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 class AnimationUtils {
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
- static testIfRootCanAnimate(action: AnimationAction, allowLog?: boolean): boolean;
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
- static tryGetActionsFromMixer(mixer: AnimationMixer): Array<AnimationAction> | null;
661
- static tryGetAnimationClipsFromObjectHierarchy(obj: Object3D, target?: Array<AnimationClip>): Array<AnimationClip>;
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
- static autoplayAnimations(file: Object3D | Pick<Model, "animations" | "scene">): Array<IAnimationComponent> | null;
668
- static emptyClip(): AnimationClip;
669
- static createScaleClip(options?: ScaleClipOptions): AnimationClip;
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 the static method {@link AnimatorController.createFromClips} to create
913
- * an animator controller from a set of animation clips.
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 can be used to render postprocessing effects. If assigned then it will automatically render the scene every frame.
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;
@@ -7503,6 +7619,7 @@ export declare class GroundProjectedEnv extends Component {
7503
7619
  updateProjection(): void;
7504
7620
  private _blurrynessShader;
7505
7621
  private _lastBlurriness;
7622
+ private updateProjectionMaterial;
7506
7623
  private updateBlurriness;
7507
7624
  }
7508
7625
 
@@ -7631,7 +7748,7 @@ declare abstract class HorizontalOrVerticalLayoutGroup extends LayoutGroup {
7631
7748
  protected onCalculateLayout(rect: RectTransform): void;
7632
7749
  }
7633
7750
 
7634
- declare enum HorizontalWrapMode {
7751
+ export declare enum HorizontalWrapMode {
7635
7752
  Wrap = 0,
7636
7753
  Overflow = 1
7637
7754
  }
@@ -8040,7 +8157,11 @@ export declare interface IInputEventArgs {
8040
8157
  stopImmediatePropagation?(): void;
8041
8158
  }
8042
8159
 
8160
+ /**
8161
+ * Options for instantiating a GameObject, used in {@link instantiate} and {@link syncInstantiate}
8162
+ */
8043
8163
  export declare type IInstantiateOptions = {
8164
+ /** The ID provider for generating unique IDs / guids */
8044
8165
  idProvider?: UIDProvider;
8045
8166
  parent?: string | Object3D;
8046
8167
  /** position in local space. Set `keepWorldPosition` to true if this is world space */
@@ -8284,6 +8405,10 @@ export declare class InheritVelocityModule {
8284
8405
  applyCurrent(vel: Vector3 | Vector3_2, t01: number, lerpFactor: number): void;
8285
8406
  }
8286
8407
 
8408
+ /** Register the Rapier physics backend. Called from {@link initEngine}
8409
+ * to ensure it runs regardless of tree-shaking. */
8410
+ export declare function initPhysics(): void;
8411
+
8287
8412
  /**
8288
8413
  * Handles all input events including mouse, touch, keyboard, and XR controllers.
8289
8414
  * Access via `this.context.input` from any component.
@@ -9195,6 +9320,32 @@ export declare interface IPointerUpHandler {
9195
9320
  onPointerUp?(args: PointerEventData): any;
9196
9321
  }
9197
9322
 
9323
+ /**
9324
+ * Minimal interface for a postprocessing effect as seen by the core stack.
9325
+ * Implemented by `PostProcessingEffect` in engine-components.
9326
+ */
9327
+ export declare interface IPostProcessingEffect {
9328
+ readonly active: boolean;
9329
+ readonly enabled: boolean;
9330
+ /** When true, this effect is a tonemapping effect. The core stack uses this to detect tonemapping-only scenarios. */
9331
+ readonly isToneMapping?: boolean;
9332
+ }
9333
+
9334
+ /**
9335
+ * Interface for the pipeline builder that manages the EffectComposer.
9336
+ * Implemented by `PostProcessingHandler` in engine-components.
9337
+ */
9338
+ export declare interface IPostProcessingHandler {
9339
+ readonly composer: EffectComposer | EffectComposer_3 | null;
9340
+ readonly hasSmaaEffect: boolean;
9341
+ multisampling: number;
9342
+ adaptivePixelRatio: boolean;
9343
+ apply(effects: IPostProcessingEffect[]): Promise<void>;
9344
+ unapply(dispose?: boolean): void;
9345
+ updateAdaptivePixelRatio(): void;
9346
+ dispose(): void;
9347
+ }
9348
+
9198
9349
  declare type IPostProcessingManager = IComponent & {
9199
9350
  get isPostProcessingManager(): boolean;
9200
9351
  get dirty(): boolean;
@@ -9450,6 +9601,19 @@ export declare interface ITimelineAnimationOverride {
9450
9601
  onTimelinePosition?(director: PlayableDirector, target: Object3D, time: number, position: Vector3): any;
9451
9602
  }
9452
9603
 
9604
+ /**
9605
+ * Extended interface for tonemapping effects.
9606
+ * When ONLY tonemapping effects are in the stack, the core applies tonemapping
9607
+ * directly to the renderer instead of creating a full postprocessing pipeline.
9608
+ */
9609
+ export declare interface ITonemappingEffect extends IPostProcessingEffect {
9610
+ readonly isToneMapping: true;
9611
+ /** The three.js ToneMapping enum value to apply to the renderer */
9612
+ readonly threeToneMapping: ToneMapping;
9613
+ /** The exposure value to apply to the renderer */
9614
+ readonly toneMappingExposure: number;
9615
+ }
9616
+
9453
9617
  declare interface ITypeInformation {
9454
9618
  type?: ConstructorConcrete<any>;
9455
9619
  }
@@ -9580,7 +9744,7 @@ declare abstract class LayoutGroup extends Component implements ILayoutGroup {
9580
9744
  get isDirty(): boolean;
9581
9745
  get isLayoutGroup(): boolean;
9582
9746
  updateLayout(): void;
9583
- childAlignment: TextAnchor;
9747
+ childAlignment: TextAnchor_2;
9584
9748
  reverseArrangement: boolean;
9585
9749
  spacing: number;
9586
9750
  padding: Padding;
@@ -11801,6 +11965,7 @@ export declare class NeedleXRSession implements INeedleXRSession {
11801
11965
  * @returns true if the browser supports the given XRSessionMode
11802
11966
  */
11803
11967
  static isSessionSupported(mode: XRSessionMode): Promise<boolean>;
11968
+ private static _sessionSupportedCache;
11804
11969
  private static _currentSessionRequest?;
11805
11970
  private static _activeSession;
11806
11971
  /** Register to listen to XRSession start events. Unsubscribe with `offXRSessionStart` */
@@ -13107,6 +13272,41 @@ export declare type OnRenderCallback = (renderer: WebGLRenderer, scene: Scene, c
13107
13272
  * */
13108
13273
  export declare function onStart(cb: LifecycleMethod, opts?: LifecycleMethodOptions): () => void;
13109
13274
 
13275
+ /**
13276
+ * Register a callback that fires when a remote `syncDestroy` event is received.
13277
+ * The callback receives the guid and the resolved Object3D (or null if not found in the scene).
13278
+ * The callback fires **before** the object is destroyed, so you can still access its state.
13279
+ * @param callback Called with the guid and the Object3D about to be destroyed
13280
+ * @returns An unsubscribe function
13281
+ * @category Networking
13282
+ * @example
13283
+ * ```ts
13284
+ * const unsub = onSyncDestroy((guid, obj) => {
13285
+ * console.log("Remote object destroyed:", guid, obj?.name);
13286
+ * });
13287
+ * // later: unsub();
13288
+ * ```
13289
+ */
13290
+ export declare function onSyncDestroy(callback: SyncDestroyCallback): () => void;
13291
+
13292
+ /**
13293
+ * Register a callback that fires when a remote `syncInstantiate` object is created on this client.
13294
+ * Use this to get references to objects spawned by other users.
13295
+ * @param callback Called with the instantiated Object3D, the network model data, and the Needle Engine context in which the instantiate event was received
13296
+ * @returns An unsubscribe function
13297
+ * @category Networking
13298
+ * @example
13299
+ * ```ts
13300
+ * const unsub = onSyncInstantiate((instance, model, context) => {
13301
+ * console.log("Remote object created:", instance.name, model.originalGuid, context);
13302
+ * });
13303
+ * // later: unsub();
13304
+ * ```
13305
+ * @see {@link syncInstantiate} - Instantiate objects across the network
13306
+ * @see {@link syncDestroy} - Destroy objects across the network
13307
+ */
13308
+ export declare function onSyncInstantiate(callback: SyncInstantiateCallback): () => void;
13309
+
13110
13310
  /** Register a callback in the engine update event
13111
13311
  * This is called every frame
13112
13312
  * @param cb The callback to be called
@@ -13370,6 +13570,10 @@ export declare class OrbitControls extends Component implements ICameraControlle
13370
13570
  get targetLerpDuration(): number;
13371
13571
  set targetLerpDuration(v: number);
13372
13572
  private _lookTargetLerpDuration;
13573
+ /**
13574
+ * 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.
13575
+ * @default null
13576
+ */
13373
13577
  targetBounds: Object3D | null;
13374
13578
  /**
13375
13579
  * Rotate the camera left (or right) by the specified angle in radians.
@@ -13625,6 +13829,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
13625
13829
  private _gainSubscription;
13626
13830
  private _lostSubscription;
13627
13831
  private _hasOwnerResponse;
13832
+ private _pendingOwnershipResolve;
13628
13833
  constructor(connection: NetworkConnection, guid: string);
13629
13834
  private _isWaitingForOwnershipResponseCallback;
13630
13835
  /**
@@ -13646,21 +13851,23 @@ export declare class OrbitControls extends Component implements ICameraControlle
13646
13851
  * @throws Rejects with "Timeout" if ownership is not gained within ~1 second
13647
13852
  * @example
13648
13853
  * ```ts
13649
- * try {
13650
- * await ownership.requestOwnershipAsync();
13854
+ * const owned = await ownership.requestOwnership();
13855
+ * if (owned) {
13651
13856
  * // Ownership granted, safe to modify object
13652
- * } catch(e) {
13653
- * console.warn("Could not gain ownership:", e);
13654
13857
  * }
13655
13858
  * ```
13656
13859
  */
13657
- requestOwnershipAsync(): Promise<OwnershipModel>;
13658
13860
  /**
13659
13861
  * Requests ownership of this object from the networking server.
13660
- * Ownership may not be granted immediately - check `hasOwnership` property or use `requestOwnershipAsync()`.
13661
- * @returns this OwnershipModel instance for method chaining
13862
+ * Returns a Promise that resolves with `true` when ownership is granted, or `false` on timeout/failure.
13863
+ * If ownership is already held, resolves immediately with `true`.
13864
+ * @returns Promise that resolves with `true` if ownership was gained, `false` otherwise
13865
+ */
13866
+ requestOwnership(): Promise<boolean>;
13867
+ /**
13868
+ * @deprecated Use `requestOwnership()` instead for a more reliable way to gain ownership
13662
13869
  */
13663
- requestOwnership(): OwnershipModel;
13870
+ requestOwnershipAsync(): Promise<OwnershipModel>;
13664
13871
  /**
13665
13872
  * Releases ownership of this object, allowing others to take control.
13666
13873
  * Call this when you're done modifying an object to allow other users to interact with it.
@@ -14709,7 +14916,25 @@ export declare class OrbitControls extends Component implements ICameraControlle
14709
14916
  * scene.add(res.gameObject);
14710
14917
  * ```
14711
14918
  */
14712
- static setupFrom(url: string, init?: Omit<ComponentInit<PlayerSync>, "asset">): Promise<PlayerSyncWithAsset>;
14919
+ /**
14920
+ * This API is experimental and may change or be removed in the future.
14921
+ * Creates a PlayerSync instance at runtime from a given URL or Object3D and sets it up for networking.
14922
+ * @param urlOrObject Path to the asset that should be instantiated for each player, or a pre-created Object3D to use as the player prefab
14923
+ * @param init Optional initialization parameters for the PlayerSync component
14924
+ * @returns Promise resolving to a PlayerSync instance with a guaranteed asset property
14925
+ * @example
14926
+ * ```typescript
14927
+ * // From a GLB URL:
14928
+ * const res = await PlayerSync.setupFrom("/assets/demo.glb");
14929
+ *
14930
+ * // From a runtime-created Object3D:
14931
+ * const avatar = ObjectUtils.createPrimitive("Sphere");
14932
+ * const res = await PlayerSync.setupFrom(avatar);
14933
+ * ```
14934
+ */
14935
+ static setupFrom(urlOrObject: string | Object3D, init?: Omit<ComponentInit<PlayerSync>, "asset"> & {
14936
+ guid?: string;
14937
+ }): Promise<PlayerSyncWithAsset>;
14713
14938
  /**
14714
14939
  * When enabled, PlayerSync will automatically load and instantiate the assigned asset when joining a networked room
14715
14940
  */
@@ -14719,11 +14944,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
14719
14944
  */
14720
14945
  asset?: AssetReference;
14721
14946
  /**
14722
- * Event invoked when a player instance is spawned with the spawned {@link Object3D} as parameter
14947
+ * Event invoked when ANY player instance is spawned both local and remote.
14948
+ * The event argument is a {@link PlayerSpawnedEventArgs} with the player Object3D and whether it's the local player.
14949
+ * For backward compatibility, the first argument is also the Object3D directly.
14723
14950
  * @serializable
14724
14951
  */
14725
- onPlayerSpawned?: EventList<Object3D>;
14952
+ onPlayerSpawned: EventList<Object3D>;
14726
14953
  private _localInstance?;
14954
+ private _unsubSyncInstantiate?;
14955
+ constructor();
14727
14956
  awake(): void;
14728
14957
  onEnable(): void;
14729
14958
  onDisable(): void;
@@ -14927,6 +15156,84 @@ export declare class OrbitControls extends Component implements ICameraControlle
14927
15156
  */
14928
15157
  export declare function postprocessFBXMaterials(obj: Mesh, material: Material | Material[], index?: number, array?: Material[]): boolean;
14929
15158
 
15159
+ /**
15160
+ * Core postprocessing stack accessible via `context.postprocessing`.
15161
+ * Manages the effect pipeline independently of any specific component.
15162
+ *
15163
+ * Volumes and individual PostProcessingEffect components add/remove effects
15164
+ * to this stack. The stack builds the EffectComposer pipeline when dirty.
15165
+ *
15166
+ * @example Add an effect directly
15167
+ * ```ts
15168
+ * const bloom = new BloomEffect({ intensity: 3 });
15169
+ * this.context.postprocessing.addEffect(bloom);
15170
+ * ```
15171
+ *
15172
+ * @example Remove an effect
15173
+ * ```ts
15174
+ * this.context.postprocessing.removeEffect(bloom);
15175
+ * ```
15176
+ */
15177
+ export declare class PostProcessing {
15178
+ private readonly _context;
15179
+ private _handler;
15180
+ private readonly _effects;
15181
+ private _isDirty;
15182
+ /** Currently active postprocessing effects in the stack */
15183
+ get effects(): readonly IPostProcessingEffect[];
15184
+ get dirty(): boolean;
15185
+ set dirty(value: boolean);
15186
+ /** The internal PostProcessingHandler that manages the EffectComposer pipeline */
15187
+ get handler(): IPostProcessingHandler | null;
15188
+ /**
15189
+ * The effect composer used to render postprocessing effects.
15190
+ * This is set internally by the PostProcessingHandler when effects are applied.
15191
+ */
15192
+ get composer(): EffectComposer | EffectComposer_3 | null;
15193
+ set composer(value: EffectComposer | EffectComposer_3 | null);
15194
+ private _composer;
15195
+ /**
15196
+ * Set multisampling to "auto" to automatically adjust the multisampling level based on performance.
15197
+ * Set to a number to manually set the multisampling level.
15198
+ * @default "auto"
15199
+ */
15200
+ multisampling: "auto" | number;
15201
+ /** When enabled, the device pixel ratio will be gradually reduced when FPS is low
15202
+ * and restored when performance recovers.
15203
+ * @default true
15204
+ */
15205
+ adaptiveResolution: boolean;
15206
+ constructor(context: Context);
15207
+ /**
15208
+ * Add a post processing effect to the stack.
15209
+ * The effect stack will be rebuilt on the next update.
15210
+ */
15211
+ addEffect(effect: IPostProcessingEffect): void;
15212
+ /**
15213
+ * Remove a post processing effect from the stack.
15214
+ * The effect stack will be rebuilt on the next update.
15215
+ */
15216
+ removeEffect(effect: IPostProcessingEffect): void;
15217
+ /** Mark the stack as dirty so the effects are rebuilt on the next update */
15218
+ markDirty(): void;
15219
+ private _enabledTime;
15220
+ private _multisampleAutoChangeTime;
15221
+ private _multisampleAutoDecreaseTime;
15222
+ /* Excluded from this release type: update */
15223
+ private _lastApplyTime?;
15224
+ private _rapidApplyCount;
15225
+ /** When true, tonemapping is applied directly to the renderer (no full pipeline) */
15226
+ private _tonemappingOnlyActive;
15227
+ private _previousToneMapping?;
15228
+ private _previousToneMappingExposure?;
15229
+ private apply;
15230
+ /** Restore renderer tonemapping to previous values when leaving tonemapping-only mode */
15231
+ private restoreTonemapping;
15232
+ /** Lazily creates the PostProcessingHandler to avoid loading the postprocessing library until actually needed */
15233
+ private ensureHandler;
15234
+ /* Excluded from this release type: dispose */
15235
+ }
15236
+
14930
15237
  /**
14931
15238
  * PostProcessingEffect is a base class for post processing effects that can be applied to the scene.
14932
15239
  * 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 +15262,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
14955
15262
  *
14956
15263
  * @category Effects
14957
15264
  * @group Components
15265
+ * @see {@link PostProcessing} for core Needle Engine postprocessing control, also accessible via `context.postprocessing`
14958
15266
  */
14959
- export declare abstract class PostProcessingEffect extends Component implements IEffectProvider, IEditorModification {
15267
+ export declare abstract class PostProcessingEffect extends Component implements IPostProcessingEffect, IEffectProvider, IEditorModification {
14960
15268
  get isPostProcessingEffect(): boolean;
14961
15269
  /**
14962
15270
  * The order of this effect. The higher the order the later the effect will be applied in the post processing stack.
@@ -14983,10 +15291,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
14983
15291
  * @deprecated
14984
15292
  */
14985
15293
  active: boolean;
14986
- private _manager;
14987
15294
  onEnable(): void;
14988
15295
  onDisable(): void;
14989
- protected onEffectEnabled(manager?: IPostProcessingManager): void;
14990
15296
  /** override to initialize bindings on parameters */
14991
15297
  init(): void;
14992
15298
  /** previously created effect (if any) */
@@ -15048,7 +15354,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
15048
15354
  /**
15049
15355
  * [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
15356
  */
15051
- export declare class PostProcessingHandler {
15357
+ export declare class PostProcessingHandler implements IPostProcessingHandler {
15052
15358
  private _composer;
15053
15359
  private _lastVolumeComponents?;
15054
15360
  private readonly _effects;
@@ -15101,8 +15407,65 @@ export declare class OrbitControls extends Component implements ICameraControlle
15101
15407
  private _onCreateEffectsDebug;
15102
15408
  }
15103
15409
 
15410
+ /**
15411
+ * Callback type for prefab providers.
15412
+ * @param guid The guid of the prefab to resolve
15413
+ * @returns The prefab Object3D, or null if not found
15414
+ */
15104
15415
  export declare type PrefabProviderCallback = (guid: string) => Promise<Object3D | null>;
15105
15416
 
15417
+ /**
15418
+ * Prefab registry for networked instantiation.
15419
+ *
15420
+ * When a remote {@link syncInstantiate} event is received, the engine looks up the prefab
15421
+ * by its guid using this registry. Both GLB-loaded objects and runtime-created objects
15422
+ * can be registered here.
15423
+ *
15424
+ * Note: {@link syncInstantiate} auto-registers prefabs if no provider exists for their guid,
15425
+ * so manual registration is only needed for custom resolution logic.
15426
+ *
15427
+ * @example
15428
+ * ```ts
15429
+ * import { Prefabs, ObjectUtils } from "@needle-tools/engine";
15430
+ *
15431
+ * const cookie = ObjectUtils.createPrimitive("Cube", { color: 0xff8c00 });
15432
+ * cookie.guid = "cookie-prefab";
15433
+ * Prefabs.register("cookie-prefab", async () => cookie);
15434
+ *
15435
+ * console.log(Prefabs.list()); // ["cookie-prefab"]
15436
+ * Prefabs.unregister("cookie-prefab");
15437
+ * ```
15438
+ *
15439
+ * @category Networking
15440
+ */
15441
+ export declare const Prefabs: {
15442
+ /**
15443
+ * Register a prefab provider that resolves objects by guid for networked instantiation.
15444
+ * When a remote `syncInstantiate` event is received, the engine uses this to find the prefab
15445
+ * to clone on the receiving client.
15446
+ *
15447
+ * @param key The guid to register the provider for
15448
+ * @param fn Callback that returns the prefab Object3D for the given guid
15449
+ */
15450
+ readonly register: (key: string, fn: PrefabProviderCallback) => void;
15451
+ /**
15452
+ * Unregister a previously registered prefab provider.
15453
+ * @param key The guid to unregister
15454
+ */
15455
+ readonly unregister: (key: string) => void;
15456
+ /**
15457
+ * Returns a list of all registered prefab provider keys (guids).
15458
+ * Useful for debugging to see which prefabs are available for networked instantiation.
15459
+ */
15460
+ readonly list: () => string[];
15461
+ /**
15462
+ * Check if a prefab provider is registered for the given guid.
15463
+ * @param key The guid to check
15464
+ */
15465
+ readonly has: (key: string) => boolean;
15466
+ /* Excluded from this release type: resolve */
15467
+ };
15468
+
15106
15469
  export declare type Prefix = (...args: any[]) => any;
15107
15470
 
15108
15471
  /** Experimental attribute
@@ -15818,7 +16181,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
15818
16181
 
15819
16182
  export declare function registerLoader<T extends INeedleGltfLoader>(loader: ConstructorConcrete<T>): void;
15820
16183
 
15821
- export declare function registerPrefabProvider(key: string, fn: PrefabProviderCallback): void;
16184
+ /**
16185
+ * Register a prefab provider. Forwards to {@link Prefabs.register}.
16186
+ * @category Networking
16187
+ */
16188
+ export declare function registerPrefabProvider(key: string, fn: (guid: string) => Promise<Object3D | null>): void;
15822
16189
 
15823
16190
  /* Excluded from this release type: registerPrototypeExtensions */
15824
16191
 
@@ -17627,7 +17994,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
17627
17994
  private _needsUpdate;
17628
17995
  private _id;
17629
17996
  /* Excluded from this release type: onEnable */
17630
- /* Excluded from this release type: onDisable */
17631
17997
  /* Excluded from this release type: update */
17632
17998
  private updateDirection;
17633
17999
  /**
@@ -19356,6 +19722,24 @@ export declare class OrbitControls extends Component implements ICameraControlle
19356
19722
  instance?: StateMachineBehaviour;
19357
19723
  };
19358
19724
 
19725
+ /**
19726
+ * Configuration for an animation state in the builder
19727
+ */
19728
+ export declare type StateOptions = {
19729
+ /** The animation clip for this state */
19730
+ clip: AnimationClip;
19731
+ /** Whether the animation should loop (default: false) */
19732
+ loop?: boolean;
19733
+ /** Base speed multiplier (default: 1) */
19734
+ speed?: number;
19735
+ /** Name of a float parameter to multiply with speed */
19736
+ speedParameter?: string;
19737
+ /** Normalized cycle offset 0-1 (default: 0) */
19738
+ cycleOffset?: number;
19739
+ /** Name of a float parameter to use as cycle offset */
19740
+ cycleOffsetParameter?: string;
19741
+ };
19742
+
19359
19743
  declare type StickName = "xr-standard-thumbstick" | "xr-standard-touchpad";
19360
19744
 
19361
19745
  export declare class StreamEndedEvent {
@@ -19405,6 +19789,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
19405
19789
  */
19406
19790
  export declare function syncDestroy(obj: IGameObject | IComponent, con: INetworkConnection, recursive?: boolean, opts?: SyncDestroyOptions): void;
19407
19791
 
19792
+ declare type SyncDestroyCallback = (guid: string, object: Object3D) => void;
19793
+
19408
19794
  declare type SyncDestroyOptions = {
19409
19795
  /** When true the state will be saved in the networking backend */
19410
19796
  saveInRoom?: boolean;
@@ -19521,7 +19907,10 @@ export declare class OrbitControls extends Component implements ICameraControlle
19521
19907
  get roomPrefix(): string;
19522
19908
  private _roomPrefix;
19523
19909
  /* Excluded from this release type: awake */
19910
+ private _hasConnectedBefore;
19524
19911
  /* Excluded from this release type: onEnable */
19912
+ /* Excluded from this release type: start */
19913
+ private _connectToRoom;
19525
19914
  /* Excluded from this release type: onDisable */
19526
19915
  /* Excluded from this release type: onDestroy */
19527
19916
  /** Will generate a random room name, set it as an URL parameter and attempt to join the room */
@@ -19714,13 +20103,67 @@ export declare class OrbitControls extends Component implements ICameraControlle
19714
20103
  }) => void;
19715
20104
 
19716
20105
  /**
19717
- * Instantiate an object across the network. See also {@link syncDestroy}.
20106
+ * Instantiate an object across the network. The object is cloned locally and a network message
20107
+ * is sent so all connected clients create the same clone. Late joiners receive the message
20108
+ * via room state replay (unless `deleteOnDisconnect` is set or `save` is false).
20109
+ *
20110
+ * ## How it works internally
20111
+ * 1. The prefab is cloned locally using a seeded {@link InstantiateIdProvider}
20112
+ * 2. The seed ensures all clients generate **identical deterministic guids** for the clone
20113
+ * and all its children — no need to send individual guids over the network
20114
+ * 3. A {@link NewInstanceModel} message is sent containing the prefab's `originalGuid`,
20115
+ * the clone's `guid`, the `seed`, and transform data
20116
+ * 4. On receiving clients, the prefab is resolved via {@link registerPrefabProvider} or
20117
+ * by searching the scene for an object with matching guid, then cloned with the same seed
20118
+ *
20119
+ * ## Runtime-created prefabs (no GLB)
20120
+ * If the object has a `guid` but no prefab provider is registered for it, `syncInstantiate`
20121
+ * will **auto-register** the object as a prefab provider. This means for code-only prefabs
20122
+ * you just need to set a `guid` — no manual `registerPrefabProvider` call needed, as long as
20123
+ * all clients run the same setup code that creates the same prefab with the same guid.
20124
+ *
20125
+ * @param object The object to instantiate. Must have a `guid` property (set one for runtime objects).
20126
+ * @param opts Options for the instantiation, including the network context to send the instantiate event to
20127
+ * @param hostData Optional data about a file to download when this object is instantiated (e.g. when instantiated via file drop)
20128
+ * @param save When false, the state of this instance will not be saved in the networking backend. Default is true.
20129
+ * @returns The instantiated object, or null if instantiation failed (e.g. missing guid or network context)
20130
+ * @see {@link syncDestroy} - Destroy objects across the network
20131
+ * @see {@link onSyncInstantiate} - Register a callback to get references to remotely instantiated objects
20132
+ * @see {@link registerPrefabProvider} - Manually register a prefab provider (auto-registered by syncInstantiate)
20133
+ * @see {@link unregisterPrefabProvider} - Remove a registered prefab provider
19718
20134
  * @category Networking
20135
+ *
20136
+ * @example Basic usage with a runtime-created prefab
20137
+ * ```ts
20138
+ * const cookie = ObjectUtils.createPrimitive("Cube", { color: 0xff8c00 });
20139
+ * cookie.guid = "cookie-prefab";
20140
+ * // No need to call registerPrefabProvider — syncInstantiate auto-registers it
20141
+ * syncInstantiate(cookie, { parent: ctx.scene, deleteOnDisconnect: false });
20142
+ * ```
20143
+ *
20144
+ * @example With deterministic seed (advanced)
20145
+ * ```ts
20146
+ * const idProvider = new InstantiateIdProvider("my-seed");
20147
+ * const instance = syncInstantiate(prefab, { context, idProvider });
20148
+ * ```
20149
+ * The seed generates deterministic guids via UUID v5, so all clients produce identical
20150
+ * identifiers for the clone and its children without sending them over the network.
19719
20151
  */
19720
20152
  export declare function syncInstantiate(object: IGameObject | Object3D, opts: SyncInstantiateOptions, hostData?: HostData, save?: boolean): IGameObject | null;
19721
20153
 
20154
+ /**
20155
+ * Callback type for {@link onSyncInstantiate}
20156
+ * @param instance The instantiated object
20157
+ * @param model The network model data sent with the instantiate event
20158
+ * @param context The network context in which the instantiate event was received
20159
+ * @category Networking
20160
+ */
20161
+ declare type SyncInstantiateCallback = (instance: IGameObject, model: NewInstanceModel, context: IContext) => void;
20162
+
19722
20163
  /**
19723
20164
  * Instantiation options for {@link syncInstantiate}
20165
+ * @category Networking
20166
+ * @see {@link syncInstantiate} - Instantiate objects across the network
19724
20167
  */
19725
20168
  export declare type SyncInstantiateOptions = IInstantiateOptions & Pick<IModel, "deleteOnDisconnect">;
19726
20169
 
@@ -19803,19 +20246,75 @@ export declare class OrbitControls extends Component implements ICameraControlle
19803
20246
  * @see {@link FontStyle} for bold/italic styles
19804
20247
  */
19805
20248
  declare class Text_2 extends Graphic implements IHasAlphaFactor, ICanvasEventReceiver {
19806
- alignment: TextAnchor_2;
19807
- verticalOverflow: VerticalWrapMode;
19808
- horizontalOverflow: HorizontalWrapMode;
19809
- lineSpacing: number;
19810
- supportRichText: boolean;
19811
- font?: string;
19812
- fontStyle: FontStyle;
20249
+ /**
20250
+ * 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.
20251
+ */
20252
+ set alignment(val: TextAnchor);
20253
+ get alignment(): TextAnchor;
20254
+ private _alignment;
20255
+ /**
20256
+ * 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.
20257
+ * @default VerticalWrapMode.Truncate
20258
+ */
20259
+ set verticalOverflow(val: VerticalWrapMode);
20260
+ get verticalOverflow(): VerticalWrapMode;
20261
+ private _verticalOverflow;
20262
+ /**
20263
+ * 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.
20264
+ * @default HorizontalWrapMode.Wrap
20265
+ */
20266
+ set horizontalOverflow(val: HorizontalWrapMode);
20267
+ get horizontalOverflow(): HorizontalWrapMode;
20268
+ private _horizontalOverflow;
20269
+ /**
20270
+ * 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.
20271
+ * @default 1
20272
+ */
20273
+ set lineSpacing(val: number);
20274
+ get lineSpacing(): number;
20275
+ private _lineSpacing;
20276
+ /**
20277
+ * The style of the font, which can be normal, bold, italic, or bold and italic.
20278
+ *
20279
+ * 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.
20280
+ *
20281
+ * @default FontStyle.Normal
20282
+ */
20283
+ set fontStyle(val: FontStyle);
20284
+ get fontStyle(): FontStyle;
20285
+ private _fontStyle;
20286
+ /**
20287
+ * The font to use for the text, specified as a URL to a font file.
20288
+ *
20289
+ * 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.
20290
+ *
20291
+ * @default "https://cdn.needle.tools/static/fonts/msdf/arial/arial"
20292
+ */
20293
+ set font(val: string | null);
20294
+ get font(): string | null;
20295
+ private _font;
20296
+ /**
20297
+ * 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>`
20298
+ * @default false
20299
+ */
20300
+ set supportRichText(val: boolean);
20301
+ get supportRichText(): boolean;
20302
+ private _supportRichText;
20303
+ /**
20304
+ * Set the alpha factor for the text, which multiplies with the color's alpha to determine overall transparency.
20305
+ */
19813
20306
  setAlphaFactor(factor: number): void;
20307
+ /**
20308
+ * The text content to display. Supports basic rich text tags like `<b>`, `<i>`, and `<color=hex>` if `supportRichText` is enabled.
20309
+ * @default ""
20310
+ */
19814
20311
  get text(): string;
19815
20312
  set text(val: string);
20313
+ private _text;
19816
20314
  private set_text;
19817
20315
  get fontSize(): number;
19818
20316
  set fontSize(val: number);
20317
+ private _fontSize;
19819
20318
  private sRGBTextColor;
19820
20319
  protected onColorChanged(): void;
19821
20320
  onParentRectTransformChanged(): void;
@@ -19823,8 +20322,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
19823
20322
  private updateOverflow;
19824
20323
  protected onCreate(_opts: any): void;
19825
20324
  onAfterAddedToScene(): void;
19826
- private _text;
19827
- private _fontSize;
19828
20325
  private _textMeshUi;
19829
20326
  private getTextOpts;
19830
20327
  onEnable(): void;
@@ -19851,7 +20348,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
19851
20348
  }
19852
20349
  export { Text_2 as Text }
19853
20350
 
19854
- declare enum TextAnchor {
20351
+ export declare enum TextAnchor {
19855
20352
  UpperLeft = 0,
19856
20353
  UpperCenter = 1,
19857
20354
  UpperRight = 2,
@@ -19860,8 +20357,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
19860
20357
  MiddleRight = 5,
19861
20358
  LowerLeft = 6,
19862
20359
  LowerCenter = 7,
19863
- LowerRight = 8,
19864
- Custom = 9
20360
+ LowerRight = 8
19865
20361
  }
19866
20362
 
19867
20363
  declare enum TextAnchor_2 {
@@ -19873,7 +20369,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
19873
20369
  MiddleRight = 5,
19874
20370
  LowerLeft = 6,
19875
20371
  LowerCenter = 7,
19876
- LowerRight = 8
20372
+ LowerRight = 8,
20373
+ Custom = 9
19877
20374
  }
19878
20375
 
19879
20376
  export declare class TextBuilder {
@@ -20077,10 +20574,12 @@ export declare class OrbitControls extends Component implements ICameraControlle
20077
20574
  /** Set the tonemapping mode to e.g. "agx" */
20078
20575
  setMode(mode: NEToneMappingModeNames): this;
20079
20576
  get isToneMapping(): boolean;
20080
- onEffectEnabled(): void;
20577
+ /** The three.js ToneMapping enum value resolved from the current mode */
20578
+ get threeToneMapping(): ToneMapping;
20579
+ /** The exposure value to apply */
20580
+ get toneMappingExposure(): number;
20081
20581
  private _tonemappingEffect;
20082
20582
  onCreateEffect(): EffectProviderResult | undefined;
20083
- onBeforeRender(): void;
20084
20583
  }
20085
20584
 
20086
20585
  export declare function toSourceId(src: string | null): SourceIdentifier | undefined;
@@ -20339,6 +20838,22 @@ export declare class OrbitControls extends Component implements ICameraControlle
20339
20838
  Animation = 3
20340
20839
  }
20341
20840
 
20841
+ /**
20842
+ * Configuration for a transition in the builder
20843
+ */
20844
+ export declare type TransitionOptions = {
20845
+ /** Duration of the crossfade in seconds (default: 0) */
20846
+ duration?: number;
20847
+ /** Normalized exit time 0-1 (default: 1). Only used when hasExitTime is true */
20848
+ exitTime?: number;
20849
+ /** Whether the transition waits for exitTime before transitioning (default: false) */
20850
+ hasExitTime?: boolean;
20851
+ /** Normalized offset into the destination state's animation (default: 0) */
20852
+ offset?: number;
20853
+ /** Whether duration is in seconds (true) or normalized (false) (default: false) */
20854
+ hasFixedDuration?: boolean;
20855
+ };
20856
+
20342
20857
  export declare class TriggerBuilder {
20343
20858
  private static __sceneStartTrigger?;
20344
20859
  static sceneStartTrigger(): TriggerModel;
@@ -20474,6 +20989,12 @@ export declare class OrbitControls extends Component implements ICameraControlle
20474
20989
 
20475
20990
  /* Excluded from this release type: unregisterHotReloadType */
20476
20991
 
20992
+ /**
20993
+ * Unregister a prefab provider. Forwards to {@link Prefabs.unregister}.
20994
+ * @category Networking
20995
+ */
20996
+ export declare function unregisterPrefabProvider(key: string): void;
20997
+
20477
20998
  export declare function unwatchWrite(vec: Vector_2, cb: Function): void;
20478
20999
 
20479
21000
  export declare class UriSerializer extends TypeSerializer {
@@ -20982,7 +21503,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
20982
21503
  protected get primaryAxis(): Axis;
20983
21504
  }
20984
21505
 
20985
- declare enum VerticalWrapMode {
21506
+ export declare enum VerticalWrapMode {
20986
21507
  Truncate = 0,
20987
21508
  Overflow = 1
20988
21509
  }
@@ -21441,6 +21962,47 @@ export declare class OrbitControls extends Component implements ICameraControlle
21441
21962
  * 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
21963
  */
21443
21964
  debug: boolean;
21965
+ private _volume;
21966
+ /**
21967
+ * Volume for incoming audio streams (0 = silent, 1 = full volume).
21968
+ * Changes apply immediately to all active incoming streams.
21969
+ */
21970
+ get volume(): number;
21971
+ set volume(val: number);
21972
+ /**
21973
+ * Get the incoming audio element for a specific user.
21974
+ * Use this to route audio through the Web Audio API for spatial audio, effects, or analysis.
21975
+ * @param userId The connection ID of the remote user
21976
+ * @returns The HTMLAudioElement for this user's stream, or undefined if not connected
21977
+ * @example
21978
+ * ```ts
21979
+ * const audioEl = voip.getAudioElement(userId);
21980
+ * if (audioEl) {
21981
+ * const audioCtx = new AudioContext();
21982
+ * const source = audioCtx.createMediaElementSource(audioEl);
21983
+ * const panner = audioCtx.createPanner();
21984
+ * source.connect(panner).connect(audioCtx.destination);
21985
+ * }
21986
+ * ```
21987
+ */
21988
+ getAudioElement(userId: string): HTMLAudioElement | undefined;
21989
+ /**
21990
+ * Get all active incoming audio streams as a Map of userId → HTMLAudioElement.
21991
+ * Useful for iterating over all connected voice users.
21992
+ */
21993
+ get incomingStreams(): ReadonlyMap<string, HTMLAudioElement>;
21994
+ /**
21995
+ * Threshold for speaking detection (0–255). When a user's audio amplitude exceeds this,
21996
+ * they are considered "speaking". Default is 30.
21997
+ */
21998
+ speakingThreshold: number;
21999
+ /**
22000
+ * Event fired when a user's speaking state changes.
22001
+ * Passes `{ userId: string, isSpeaking: boolean, volume: number }`.
22002
+ */
22003
+ onSpeakingChanged: EventList;
22004
+ private _speakingStates;
22005
+ private _analysers;
21444
22006
  private _net?;
21445
22007
  private _menubutton?;
21446
22008
  /* Excluded from this release type: awake */
@@ -21473,6 +22035,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
21473
22035
  private onJoinedRoom;
21474
22036
  private onLeftRoom;
21475
22037
  private _incomingStreams;
22038
+ /* Excluded from this release type: update */
22039
+ private setupAnalyser;
22040
+ private cleanupAnalyser;
21476
22041
  private onReceiveStream;
21477
22042
  private onStreamEnded;
21478
22043
  private onEnabledChanged;
@@ -21482,6 +22047,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
21482
22047
  /** [Volume](https://engine.needle.tools/docs/api/Volume) The Volume/PostprocessingManager component is responsible for managing post processing effects.
21483
22048
  * Add this component to any object in your scene to enable post processing effects.
21484
22049
  *
22050
+ * Effects added to this Volume (via profile or code) are pushed to `context.postprocessing` when the Volume is enabled,
22051
+ * and removed when it is disabled.
22052
+ *
21485
22053
  * @example Add bloom
21486
22054
  * ```ts
21487
22055
  * const volume = new Volume();
@@ -21507,11 +22075,14 @@ export declare class OrbitControls extends Component implements ICameraControlle
21507
22075
  * @summary Manage Post-Processing Effects
21508
22076
  * @category Rendering
21509
22077
  * @category Effects
22078
+ * @see {@link VolumeProfile} for profile-based effect management
22079
+ * @see {@link PostProcessingEffect} for creating custom effects
22080
+ * @see {@link PostProcessing} for core Needle Engine postprocessing control, also accessible via `context.postprocessing`
21510
22081
  * @group Components
21511
22082
  */
21512
22083
  declare class Volume extends Component implements IEditorModification, IPostProcessingManager {
21513
22084
  get isPostProcessingManager(): boolean;
21514
- /** Currently active postprocessing effects */
22085
+ /** Currently active postprocessing effects managed by this Volume */
21515
22086
  get effects(): PostProcessingEffect[];
21516
22087
  get dirty(): boolean;
21517
22088
  set dirty(value: boolean);
@@ -21519,6 +22090,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
21519
22090
  /**
21520
22091
  * Set multisampling to "auto" to automatically adjust the multisampling level based on performance.
21521
22092
  * Set to a number to manually set the multisampling level.
22093
+ * Pushed to `context.postprocessing.multisampling` when this Volume is active.
21522
22094
  * @default "auto"
21523
22095
  * @min 0
21524
22096
  * @max renderer.capabilities.maxSamples
@@ -21527,21 +22099,21 @@ export declare class OrbitControls extends Component implements ICameraControlle
21527
22099
  /** When enabled, the device pixel ratio will be gradually reduced when FPS is low
21528
22100
  * and restored when performance recovers. This helps maintain smooth frame rates
21529
22101
  * on devices where full retina resolution is too expensive for postprocessing.
22102
+ * Pushed to `context.postprocessing.adaptiveResolution` when this Volume is active.
21530
22103
  * Disable this if you need a fixed resolution and prefer consistent quality over frame rate.
21531
22104
  * @default true
21532
22105
  */
21533
22106
  adaptiveResolution: boolean;
21534
22107
  /**
21535
- * Add a post processing effect to the stack and schedules the effect stack to be re-created.
22108
+ * Add a post processing effect to this Volume and push it to the core postprocessing stack.
21536
22109
  */
21537
22110
  addEffect<T extends PostProcessingEffect | Effect>(effect: T & {
21538
22111
  order?: number;
21539
22112
  }): T;
21540
22113
  /**
21541
- * Remove a post processing effect from the stack and schedules the effect stack to be re-created.
22114
+ * Remove a post processing effect from this Volume and the core postprocessing stack.
21542
22115
  */
21543
22116
  removeEffect<T extends PostProcessingEffect | Effect>(effect: T): T;
21544
- private _postprocessing?;
21545
22117
  private readonly _activeEffects;
21546
22118
  private readonly _effects;
21547
22119
  /**
@@ -21549,17 +22121,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
21549
22121
  */
21550
22122
  markDirty(): void;
21551
22123
  /* Excluded from this release type: awake */
21552
- private _componentEnabledTime;
21553
- private _multisampleAutoChangeTime;
21554
- private _multisampleAutoDecreaseTime;
22124
+ private _isDirty;
21555
22125
  /* Excluded from this release type: onEnable */
21556
22126
  /* Excluded from this release type: onDisable */
21557
22127
  /* Excluded from this release type: onBeforeRender */
21558
22128
  /* Excluded from this release type: onDestroy */
21559
- private _lastApplyTime?;
21560
- private _rapidApplyCount;
21561
- private _isDirty;
21562
- private apply;
22129
+ /** Collect active effects from profile + code and push them to context.postprocessing */
22130
+ private pushEffectsToCore;
22131
+ /** Remove all effects this Volume contributed from the core stack */
22132
+ private removeEffectsFromCore;
22133
+ /** Push multisampling and adaptiveResolution config to the core stack */
22134
+ private syncConfigToCore;
21563
22135
  private _applyPostQueue;
21564
22136
  /** called from needle editor sync package if its active */
21565
22137
  onEditorModification(modification: EditorModification): void | boolean | undefined;