@needle-tools/engine 4.14.0 → 4.15.0-next.cecd8e7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/components.needle.json +1 -1
- package/dist/{needle-engine.bundle-NolzHLqO.min.js → needle-engine.bundle-CuAiLb-d.min.js} +137 -129
- package/dist/{needle-engine.bundle-COL2Bar3.umd.cjs → needle-engine.bundle-JQGIFVRm.umd.cjs} +128 -120
- package/dist/{needle-engine.bundle-Z_gAD7Kg.js → needle-engine.bundle-VZVrVbc3.js} +5497 -5252
- package/dist/needle-engine.d.ts +318 -42
- package/dist/needle-engine.js +570 -569
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/engine_accessibility.d.ts +77 -0
- package/lib/engine/engine_accessibility.js +162 -0
- package/lib/engine/engine_accessibility.js.map +1 -0
- package/lib/engine/engine_context.d.ts +2 -0
- package/lib/engine/engine_context.js +7 -0
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_materialpropertyblock.d.ts +90 -4
- package/lib/engine/engine_materialpropertyblock.js +97 -7
- package/lib/engine/engine_materialpropertyblock.js.map +1 -1
- package/lib/engine/engine_math.d.ts +34 -1
- package/lib/engine/engine_math.js +34 -1
- package/lib/engine/engine_math.js.map +1 -1
- package/lib/engine/engine_networking.js +1 -1
- package/lib/engine/engine_networking.js.map +1 -1
- package/lib/engine/engine_types.d.ts +2 -0
- package/lib/engine/engine_types.js +2 -0
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine/webcomponents/icons.js +3 -0
- package/lib/engine/webcomponents/icons.js.map +1 -1
- package/lib/engine/webcomponents/logo-element.d.ts +1 -0
- package/lib/engine/webcomponents/logo-element.js +3 -1
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle-button.d.ts +37 -11
- package/lib/engine/webcomponents/needle-button.js +42 -11
- package/lib/engine/webcomponents/needle-button.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +10 -2
- package/lib/engine/webcomponents/needle-engine.js +13 -3
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine-components/Component.d.ts +1 -2
- package/lib/engine-components/Component.js +1 -2
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/DragControls.d.ts +1 -0
- package/lib/engine-components/DragControls.js +21 -0
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/NeedleMenu.d.ts +2 -0
- package/lib/engine-components/NeedleMenu.js +2 -0
- package/lib/engine-components/NeedleMenu.js.map +1 -1
- package/lib/engine-components/Networking.d.ts +28 -3
- package/lib/engine-components/Networking.js +28 -3
- package/lib/engine-components/Networking.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.d.ts +1 -0
- package/lib/engine-components/ReflectionProbe.js +20 -2
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +15 -0
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +77 -0
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +1 -1
- package/lib/engine-components/ui/Button.d.ts +1 -0
- package/lib/engine-components/ui/Button.js +11 -0
- package/lib/engine-components/ui/Button.js.map +1 -1
- package/lib/engine-components/ui/Text.d.ts +1 -0
- package/lib/engine-components/ui/Text.js +11 -0
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/package.json +2 -2
- package/src/engine/engine_accessibility.ts +198 -0
- package/src/engine/engine_context.ts +9 -0
- package/src/engine/engine_materialpropertyblock.ts +102 -11
- package/src/engine/engine_math.ts +34 -1
- package/src/engine/engine_networking.ts +1 -1
- package/src/engine/engine_types.ts +5 -0
- package/src/engine/webcomponents/icons.ts +3 -0
- package/src/engine/webcomponents/logo-element.ts +4 -1
- package/src/engine/webcomponents/needle-button.ts +44 -13
- package/src/engine/webcomponents/needle-engine.ts +18 -7
- package/src/engine-components/Component.ts +1 -3
- package/src/engine-components/DragControls.ts +29 -4
- package/src/engine-components/NeedleMenu.ts +5 -3
- package/src/engine-components/Networking.ts +29 -4
- package/src/engine-components/ReflectionProbe.ts +21 -2
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +108 -32
- package/src/engine-components/ui/Button.ts +12 -0
- package/src/engine-components/ui/Text.ts +13 -0
package/dist/needle-engine.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ import { XRControllerModelFactory } from 'three/examples/jsm/webxr/XRControllerM
|
|
|
111
111
|
import { XRHandMeshModel } from 'three/examples/jsm/webxr/XRHandMeshModel.js';
|
|
112
112
|
import { XRHandSpace } from 'three';
|
|
113
113
|
|
|
114
|
-
declare const $componentName: unique symbol;
|
|
114
|
+
export declare const $componentName: unique symbol;
|
|
115
115
|
|
|
116
116
|
export declare const $physicsKey: unique symbol;
|
|
117
117
|
|
|
@@ -120,6 +120,81 @@ export declare class __Ignore {
|
|
|
120
120
|
|
|
121
121
|
export declare function __internalNotifyObjectDestroyed(obj: Object3D): void;
|
|
122
122
|
|
|
123
|
+
/** Data describing the accessible semantics for a 3D object or component. */
|
|
124
|
+
declare type AccessibilityData = {
|
|
125
|
+
/** ARIA role (e.g. `"button"`, `"img"`, `"region"`). */
|
|
126
|
+
role: string;
|
|
127
|
+
/** Human-readable label announced by screen readers. */
|
|
128
|
+
label: string;
|
|
129
|
+
/** When `true`, the element is hidden from the accessibility tree. */
|
|
130
|
+
hidden?: boolean;
|
|
131
|
+
/** When `true`, indicates the element's content is being updated. */
|
|
132
|
+
busy?: boolean;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Manages an accessible, screen-reader-friendly overlay for a Needle Engine {@link Context}.
|
|
137
|
+
*
|
|
138
|
+
* The manager maintains a visually-hidden DOM tree that mirrors relevant 3D scene objects
|
|
139
|
+
* with appropriate ARIA roles and labels. It also provides a live region so that hover
|
|
140
|
+
* events in the 3D scene can be announced to assistive technology without stealing focus.
|
|
141
|
+
*
|
|
142
|
+
* ## Automatic integration
|
|
143
|
+
* Several built-in components register accessible elements automatically:
|
|
144
|
+
* - {@link DragControls} — announces draggable objects and drag state
|
|
145
|
+
* - {@link Button} — exposes UI buttons to the accessibility tree
|
|
146
|
+
* - {@link Text} — exposes UI text content to screen readers
|
|
147
|
+
* - {@link ChangeTransformOnClick} — announces clickable transform actions
|
|
148
|
+
* - {@link ChangeMaterialOnClick} — announces clickable material changes
|
|
149
|
+
* - {@link EmphasizeOnClick} — announces clickable emphasis effects
|
|
150
|
+
* - {@link PlayAudioOnClick} — announces clickable audio playback
|
|
151
|
+
* - {@link PlayAnimationOnClick} — announces clickable animation triggers
|
|
152
|
+
*
|
|
153
|
+
* ## What this unlocks
|
|
154
|
+
* - Hovering over buttons and interactive objects with the cursor announces them to screen readers via an ARIA live region — no focus steal required
|
|
155
|
+
* - Screen readers can discover and navigate interactive 3D objects in the scene
|
|
156
|
+
* - Drag operations update the accessibility state (busy, label changes) in real time
|
|
157
|
+
* - Custom components can participate by calling {@link updateElement}, {@link focus}, and {@link hover}
|
|
158
|
+
*
|
|
159
|
+
* Access the manager via `this.context.accessibility` from any component.
|
|
160
|
+
*/
|
|
161
|
+
declare class AccessibilityManager {
|
|
162
|
+
private readonly context;
|
|
163
|
+
private static readonly _managers;
|
|
164
|
+
/** Returns the {@link AccessibilityManager} associated with the given context or component. */
|
|
165
|
+
static get(obj: Context | IComponent): AccessibilityManager | undefined;
|
|
166
|
+
constructor(context: Context);
|
|
167
|
+
private _enabled;
|
|
168
|
+
/** Enables or disables the accessibility overlay. When disabled, the overlay DOM is removed. */
|
|
169
|
+
set enabled(value: boolean);
|
|
170
|
+
/** Removes all tracked accessibility elements, keeping only the live region. */
|
|
171
|
+
clear(): void;
|
|
172
|
+
/** Removes the overlay from the DOM and unregisters this manager from the context. */
|
|
173
|
+
dispose(): void;
|
|
174
|
+
private readonly root;
|
|
175
|
+
private readonly liveRegion;
|
|
176
|
+
private readonly treeElements;
|
|
177
|
+
/**
|
|
178
|
+
* Creates or updates the accessible DOM element for a 3D object or component.
|
|
179
|
+
* @param obj - The scene object or component to represent.
|
|
180
|
+
* @param data - Partial accessibility data (role, label, hidden, busy) to apply.
|
|
181
|
+
*/
|
|
182
|
+
updateElement<T extends Object3D | IComponent>(obj: T, data: Partial<AccessibilityData>): void;
|
|
183
|
+
/** Moves keyboard focus to the accessible element representing the given object. */
|
|
184
|
+
focus<T extends Object3D | IComponent>(obj: T): void;
|
|
185
|
+
/** Removes keyboard focus from the accessible element representing the given object. */
|
|
186
|
+
unfocus<T extends Object3D | IComponent>(obj: T): void;
|
|
187
|
+
/**
|
|
188
|
+
* Announces a hover event to screen readers via the ARIA live region.
|
|
189
|
+
* @param obj - The hovered object (used to look up its label if `text` is not provided).
|
|
190
|
+
* @param text - Optional text to announce. Falls back to the element's `aria-label`.
|
|
191
|
+
*/
|
|
192
|
+
hover<T extends Object3D | IComponent>(obj: T, text?: string): void;
|
|
193
|
+
/** Removes the accessible DOM element for the given object and stops tracking it. */
|
|
194
|
+
removeElement(obj: Object3D | IComponent): void;
|
|
195
|
+
private set liveRegionMode(value);
|
|
196
|
+
}
|
|
197
|
+
|
|
123
198
|
export declare class ActionBuilder {
|
|
124
199
|
static sequence(...params: IBehaviorElement[]): GroupActionModel;
|
|
125
200
|
static parallel(...params: IBehaviorElement[]): GroupActionModel;
|
|
@@ -2267,6 +2342,7 @@ export declare class Button extends Component implements IPointerEventHandler {
|
|
|
2267
2342
|
awake(): void;
|
|
2268
2343
|
start(): void;
|
|
2269
2344
|
onEnable(): void;
|
|
2345
|
+
onDisable(): void;
|
|
2270
2346
|
onDestroy(): void;
|
|
2271
2347
|
private _requestedAnimatorTrigger?;
|
|
2272
2348
|
private setAnimatorTriggerAtEndOfFrame;
|
|
@@ -2843,6 +2919,9 @@ export declare class ChangeMaterialOnClick extends Component implements IPointer
|
|
|
2843
2919
|
*/
|
|
2844
2920
|
fadeDuration: number;
|
|
2845
2921
|
start(): void;
|
|
2922
|
+
onEnable(): void;
|
|
2923
|
+
onDisable(): void;
|
|
2924
|
+
onDestroy(): void;
|
|
2846
2925
|
onPointerEnter(_args: PointerEventData): void;
|
|
2847
2926
|
onPointerExit(_: PointerEventData): void;
|
|
2848
2927
|
onPointerClick(args: PointerEventData): void;
|
|
@@ -2887,6 +2966,9 @@ export declare class ChangeTransformOnClick extends Component implements IPointe
|
|
|
2887
2966
|
private targetPos;
|
|
2888
2967
|
private targetRot;
|
|
2889
2968
|
private targetScale;
|
|
2969
|
+
onEnable(): void;
|
|
2970
|
+
onDisable(): void;
|
|
2971
|
+
onDestroy(): void;
|
|
2890
2972
|
onPointerEnter(): void;
|
|
2891
2973
|
onPointerExit(): void;
|
|
2892
2974
|
onPointerClick(args: PointerEventData): void;
|
|
@@ -4292,6 +4374,7 @@ export declare class Context implements IContext {
|
|
|
4292
4374
|
readonly lodsManager: LODsManager;
|
|
4293
4375
|
/** Access the needle menu to add or remove buttons to the menu element */
|
|
4294
4376
|
readonly menu: NeedleMenu_2;
|
|
4377
|
+
readonly accessibility: AccessibilityManager;
|
|
4295
4378
|
/**
|
|
4296
4379
|
* Checks if the context is fully created and ready
|
|
4297
4380
|
* @returns true if the context is fully created and ready
|
|
@@ -5282,6 +5365,7 @@ export declare class DragControls extends Component implements IPointerEventHand
|
|
|
5282
5365
|
/* Excluded from this release type: start */
|
|
5283
5366
|
/* Excluded from this release type: onEnable */
|
|
5284
5367
|
/* Excluded from this release type: onDisable */
|
|
5368
|
+
onDestroy(): void;
|
|
5285
5369
|
/**
|
|
5286
5370
|
* Checks if editing is allowed for the current networking connection.
|
|
5287
5371
|
* @param _obj Optional object to check edit permissions for
|
|
@@ -5673,6 +5757,9 @@ export declare class EmphasizeOnClick extends Component implements UsdzBehaviour
|
|
|
5673
5757
|
duration: number;
|
|
5674
5758
|
/** The type of motion to use for the emphasis effect (e.g. `"bounce"`, `"jiggle"`). */
|
|
5675
5759
|
motionType: EmphasizeActionMotionType;
|
|
5760
|
+
onEnable(): void;
|
|
5761
|
+
onDisable(): void;
|
|
5762
|
+
onDestroy(): void;
|
|
5676
5763
|
beforeCreateDocument(): void;
|
|
5677
5764
|
createBehaviours(ext: any, model: any, _context: any): void;
|
|
5678
5765
|
afterCreateDocument(_ext: any, _context: any): void;
|
|
@@ -7776,6 +7863,7 @@ export declare type ICollisionContext = {
|
|
|
7776
7863
|
|
|
7777
7864
|
export declare interface IComponent extends IHasGuid {
|
|
7778
7865
|
get isComponent(): boolean;
|
|
7866
|
+
get [$componentName](): string | undefined;
|
|
7779
7867
|
/** the object this component is attached to */
|
|
7780
7868
|
gameObject: IGameObject;
|
|
7781
7869
|
enabled: boolean;
|
|
@@ -10093,13 +10181,22 @@ export declare class MaskableGraphic extends Graphic {
|
|
|
10093
10181
|
* This is useful for rendering multiple objects with the same base material but different properties
|
|
10094
10182
|
* (e.g., different colors, textures, or shader parameters).
|
|
10095
10183
|
*
|
|
10184
|
+
* ## How Property Blocks Work
|
|
10185
|
+
*
|
|
10186
|
+
* **Important**: Overrides are registered on the **Object3D**, not on the material.
|
|
10187
|
+
* This means:
|
|
10188
|
+
* - If you change the object's material, the overrides will still be applied to the new material
|
|
10189
|
+
* - Multiple objects can share the same material but have different property overrides
|
|
10190
|
+
* - If you don't want overrides applied after changing a material, you must remove them using {@link removeOveride}, {@link clearAllOverrides}, or {@link dispose}
|
|
10191
|
+
*
|
|
10096
10192
|
* The property block system works by:
|
|
10097
10193
|
* - Temporarily applying overrides in onBeforeRender
|
|
10098
10194
|
* - Restoring original values in onAfterRender
|
|
10099
10195
|
* - Managing shader defines and program cache keys for correct shader compilation
|
|
10100
10196
|
* - Supporting texture coordinate transforms per object
|
|
10101
10197
|
*
|
|
10102
|
-
* Common
|
|
10198
|
+
* ## Common Use Cases
|
|
10199
|
+
*
|
|
10103
10200
|
* - **Lightmaps**: Apply unique lightmap textures to individual objects sharing the same material
|
|
10104
10201
|
* - **Reflection Probes**: Apply different environment maps per object for localized reflections
|
|
10105
10202
|
* - **See-through effects**: Temporarily override transparency/transmission properties for X-ray effects
|
|
@@ -10137,6 +10234,26 @@ export declare class MaskableGraphic extends Graphic {
|
|
|
10137
10234
|
* block.setDefine("USE_CUSTOM_FEATURE", 1);
|
|
10138
10235
|
* ```
|
|
10139
10236
|
*
|
|
10237
|
+
* @example Material swapping behavior
|
|
10238
|
+
* ```typescript
|
|
10239
|
+
* const mesh = new Mesh(geometry, materialA);
|
|
10240
|
+
* const block = MaterialPropertyBlock.get(mesh);
|
|
10241
|
+
* block.setOverride("color", new Color(1, 0, 0));
|
|
10242
|
+
*
|
|
10243
|
+
* // The color override is red for materialA
|
|
10244
|
+
*
|
|
10245
|
+
* // Swap the material - overrides persist and apply to the new material!
|
|
10246
|
+
* mesh.material = materialB;
|
|
10247
|
+
* // The color override is now red for materialB too
|
|
10248
|
+
*
|
|
10249
|
+
* // If you don't want overrides on the new material, remove them:
|
|
10250
|
+
* block.clearAllOverrides(); // Remove all overrides
|
|
10251
|
+
* // or
|
|
10252
|
+
* block.removeOveride("color"); // Remove specific override
|
|
10253
|
+
* // or
|
|
10254
|
+
* block.dispose(); // Remove the entire property block
|
|
10255
|
+
* ```
|
|
10256
|
+
*
|
|
10140
10257
|
* @example Lightmap usage
|
|
10141
10258
|
* ```typescript
|
|
10142
10259
|
* const block = MaterialPropertyBlock.get(mesh);
|
|
@@ -10244,12 +10361,69 @@ export declare class MaterialPropertyBlock<T extends Material = Material> {
|
|
|
10244
10361
|
getOverride<K extends NonFunctionPropertyNames<T>>(name: K): PropertyBlockOverride<T[K] & MaterialPropertyType> | undefined;
|
|
10245
10362
|
getOverride<V extends MaterialPropertyType = MaterialPropertyType>(name: string): PropertyBlockOverride<V> | undefined;
|
|
10246
10363
|
/**
|
|
10247
|
-
* Removes a specific property override
|
|
10248
|
-
*
|
|
10364
|
+
* Removes a specific property override.
|
|
10365
|
+
* After removal, the material will use its original property value for this property.
|
|
10366
|
+
*
|
|
10367
|
+
* @param name The property name to remove the override for
|
|
10368
|
+
*
|
|
10369
|
+
* @example
|
|
10370
|
+
* ```typescript
|
|
10371
|
+
* const block = MaterialPropertyBlock.get(mesh);
|
|
10372
|
+
*
|
|
10373
|
+
* // Set some overrides
|
|
10374
|
+
* block.setOverride("color", new Color(1, 0, 0));
|
|
10375
|
+
* block.setOverride("roughness", 0.5);
|
|
10376
|
+
* block.setOverride("lightMap", lightmapTexture);
|
|
10377
|
+
*
|
|
10378
|
+
* // Remove a specific override - the material will now use its original color
|
|
10379
|
+
* block.removeOveride("color");
|
|
10380
|
+
*
|
|
10381
|
+
* // Other overrides (roughness, lightMap) remain active
|
|
10382
|
+
* ```
|
|
10249
10383
|
*/
|
|
10250
10384
|
removeOveride<K extends NonFunctionPropertyNames<T>>(name: K | ({} & string)): void;
|
|
10251
10385
|
/**
|
|
10252
|
-
* Removes all property overrides from this block
|
|
10386
|
+
* Removes all property overrides from this block.
|
|
10387
|
+
* After calling this, the material will use its original values for all properties.
|
|
10388
|
+
*
|
|
10389
|
+
* **Note**: This does NOT remove shader defines. Use {@link clearDefine} or {@link dispose} for that.
|
|
10390
|
+
*
|
|
10391
|
+
* @example Remove all overrides but keep the property block
|
|
10392
|
+
* ```typescript
|
|
10393
|
+
* const block = MaterialPropertyBlock.get(mesh);
|
|
10394
|
+
*
|
|
10395
|
+
* // Set multiple overrides
|
|
10396
|
+
* block.setOverride("color", new Color(1, 0, 0));
|
|
10397
|
+
* block.setOverride("roughness", 0.5);
|
|
10398
|
+
* block.setOverride("lightMap", lightmapTexture);
|
|
10399
|
+
*
|
|
10400
|
+
* // Later, remove all overrides at once
|
|
10401
|
+
* block.clearAllOverrides();
|
|
10402
|
+
*
|
|
10403
|
+
* // The material now uses its original values
|
|
10404
|
+
* // The property block still exists and can be reused with new overrides
|
|
10405
|
+
* ```
|
|
10406
|
+
*
|
|
10407
|
+
* @example Temporarily disable all overrides
|
|
10408
|
+
* ```typescript
|
|
10409
|
+
* const block = MaterialPropertyBlock.get(mesh);
|
|
10410
|
+
*
|
|
10411
|
+
* // Save current overrides if you want to restore them later
|
|
10412
|
+
* const savedOverrides = [...block.overrides];
|
|
10413
|
+
*
|
|
10414
|
+
* // Clear all overrides temporarily
|
|
10415
|
+
* block.clearAllOverrides();
|
|
10416
|
+
*
|
|
10417
|
+
* // Do some rendering without overrides...
|
|
10418
|
+
*
|
|
10419
|
+
* // Restore overrides
|
|
10420
|
+
* savedOverrides.forEach(override => {
|
|
10421
|
+
* block.setOverride(override.name, override.value, override.textureTransform);
|
|
10422
|
+
* });
|
|
10423
|
+
* ```
|
|
10424
|
+
*
|
|
10425
|
+
* @see {@link removeOveride} - To remove a single override
|
|
10426
|
+
* @see {@link dispose} - To completely remove the property block and clean up resources
|
|
10253
10427
|
*/
|
|
10254
10428
|
clearAllOverrides(): void;
|
|
10255
10429
|
/**
|
|
@@ -10650,32 +10824,58 @@ export declare namespace NEEDLE_ENGINE_MODULES {
|
|
|
10650
10824
|
export { NEEDLE_progressive }
|
|
10651
10825
|
|
|
10652
10826
|
/**
|
|
10653
|
-
*
|
|
10654
|
-
*
|
|
10827
|
+
* [<needle-button>](https://engine.needle.tools/docs/api/NeedleButtonElement) is a web component for easily adding AR, VR, Quicklook, or QR code buttons to your website without writing JavaScript code.
|
|
10828
|
+
*
|
|
10829
|
+
* The button automatically handles session management and displays appropriate UI based on device capabilities.
|
|
10830
|
+
* It comes with default styling (glassmorphism design) but can be fully customized with CSS.
|
|
10831
|
+
*
|
|
10832
|
+
* **Supported button types:**
|
|
10833
|
+
* - `ar` - WebXR AR session button
|
|
10834
|
+
* - `vr` - WebXR VR session button
|
|
10835
|
+
* - `quicklook` - Apple AR Quick Look button (iOS only)
|
|
10836
|
+
* - `qrcode` - QR code sharing button
|
|
10837
|
+
*
|
|
10838
|
+
* @example Basic AR/VR buttons
|
|
10655
10839
|
* ```html
|
|
10840
|
+
* <needle-engine src="scene.glb"></needle-engine>
|
|
10656
10841
|
* <needle-button ar></needle-button>
|
|
10657
10842
|
* <needle-button vr></needle-button>
|
|
10658
10843
|
* <needle-button quicklook></needle-button>
|
|
10659
10844
|
* ```
|
|
10660
10845
|
*
|
|
10661
|
-
* @example
|
|
10846
|
+
* @example Custom button labels
|
|
10662
10847
|
* ```html
|
|
10663
|
-
* <needle-button ar>Start AR</needle-button>
|
|
10664
|
-
* <needle-button vr>
|
|
10848
|
+
* <needle-button ar>Start AR Experience</needle-button>
|
|
10849
|
+
* <needle-button vr>Enter VR Mode</needle-button>
|
|
10665
10850
|
* <needle-button quicklook>View in AR</needle-button>
|
|
10666
10851
|
* ```
|
|
10667
10852
|
*
|
|
10668
|
-
* @example
|
|
10853
|
+
* @example Custom styling
|
|
10669
10854
|
* ```html
|
|
10670
|
-
* <!-- You can either style the element directly or use a CSS stylesheet -->
|
|
10671
10855
|
* <style>
|
|
10672
|
-
*
|
|
10673
|
-
*
|
|
10674
|
-
*
|
|
10675
|
-
*
|
|
10856
|
+
* needle-button {
|
|
10857
|
+
* background-color: #ff6b6b;
|
|
10858
|
+
* color: white;
|
|
10859
|
+
* border-radius: 8px;
|
|
10860
|
+
* padding: 1rem 2rem;
|
|
10861
|
+
* }
|
|
10862
|
+
* needle-button:hover {
|
|
10863
|
+
* background-color: #ff5252;
|
|
10864
|
+
* }
|
|
10676
10865
|
* </style>
|
|
10677
10866
|
* <needle-button ar>Start AR</needle-button>
|
|
10678
10867
|
* ```
|
|
10868
|
+
*
|
|
10869
|
+
* @example Unstyled button (for complete custom styling)
|
|
10870
|
+
* ```html
|
|
10871
|
+
* <needle-button ar unstyled>
|
|
10872
|
+
* <span class="my-icon">🥽</span>
|
|
10873
|
+
* Launch AR
|
|
10874
|
+
* </needle-button>
|
|
10875
|
+
* ```
|
|
10876
|
+
*
|
|
10877
|
+
* @see {@link NeedleEngineWebComponent} for the main <needle-engine> element
|
|
10878
|
+
* @see {@link NeedleMenu} for the built-in menu component that can display similar buttons
|
|
10679
10879
|
*/
|
|
10680
10880
|
export declare class NeedleButtonElement extends HTMLElement {
|
|
10681
10881
|
#private;
|
|
@@ -10752,10 +10952,18 @@ export declare namespace NeedleEngineModelLoader {
|
|
|
10752
10952
|
* The context is accessible from the `<needle-engine>` element: `document.querySelector("needle-engine").context`.
|
|
10753
10953
|
* See {@link https://engine.needle.tools/docs/reference/needle-engine-attributes}
|
|
10754
10954
|
*
|
|
10755
|
-
* @example
|
|
10955
|
+
* @example Basic usage
|
|
10956
|
+
* ```html
|
|
10756
10957
|
* <needle-engine src="https://example.com/scene.glb"></needle-engine>
|
|
10757
|
-
*
|
|
10958
|
+
* ```
|
|
10959
|
+
*
|
|
10960
|
+
* @example With camera controls disabled
|
|
10961
|
+
* ```html
|
|
10758
10962
|
* <needle-engine src="https://example.com/scene.glb" camera-controls="false"></needle-engine>
|
|
10963
|
+
* ```
|
|
10964
|
+
*
|
|
10965
|
+
* @see {@link NeedleButtonElement} for adding AR/VR/Quicklook buttons via <needle-button>
|
|
10966
|
+
* @see {@link NeedleMenu} for the built-in menu configuration component
|
|
10759
10967
|
*/
|
|
10760
10968
|
export declare class NeedleEngineWebComponent extends HTMLElement implements INeedleEngineComponent {
|
|
10761
10969
|
static get observedAttributes(): string[];
|
|
@@ -11082,6 +11290,8 @@ declare class NeedleGamepadButton {
|
|
|
11082
11290
|
* @category User Interface
|
|
11083
11291
|
* @group Components
|
|
11084
11292
|
* @see {@link Context.menu} for programmatic menu control
|
|
11293
|
+
* @see {@link NeedleButtonElement} for standalone <needle-button> web component
|
|
11294
|
+
* @see {@link NeedleEngineWebComponent} for the main <needle-engine> element
|
|
11085
11295
|
* @see {@link Voip} adds a microphone button to the menu
|
|
11086
11296
|
* @see {@link ScreenCapture} adds a screen sharing button
|
|
11087
11297
|
**/
|
|
@@ -12303,10 +12513,34 @@ export declare class NetworkedStreams extends EventDispatcher<any> {
|
|
|
12303
12513
|
}
|
|
12304
12514
|
|
|
12305
12515
|
/**
|
|
12306
|
-
* Provides configuration
|
|
12307
|
-
*
|
|
12308
|
-
*
|
|
12516
|
+
* Provides websocket URL configuration for the built-in networking system.
|
|
12517
|
+
* Add this component to override the default networking backend URL used by {@link NetworkConnection} (`this.context.connection`).
|
|
12518
|
+
*
|
|
12519
|
+
* The component registers itself as a URL provider on `awake()`. When the networking system connects,
|
|
12520
|
+
* it queries this provider for the websocket URL to use instead of the default Needle networking backend.
|
|
12521
|
+
*
|
|
12522
|
+
* **URL resolution order:**
|
|
12523
|
+
* 1. If `urlParameterName` is set and the corresponding URL parameter exists in the browser URL, that value is used
|
|
12524
|
+
* 2. If running on a local network and `localhost` is set, the `localhost` URL is used
|
|
12525
|
+
* 3. Otherwise, the `url` field is used
|
|
12526
|
+
*
|
|
12527
|
+
* Without this component, the default backend URL `wss://networking-2.needle.tools/socket` is used.
|
|
12309
12528
|
*
|
|
12529
|
+
* **Note:** This component only configures the websocket URL. To actually join a networked room,
|
|
12530
|
+
* use a `SyncedRoom` component or call `this.context.connection.joinRoom("room-name")` directly.
|
|
12531
|
+
*
|
|
12532
|
+
* @example Overriding the URL via browser parameter
|
|
12533
|
+
* ```ts
|
|
12534
|
+
* // With urlParameterName="server", visiting:
|
|
12535
|
+
* // https://myapp.com/?server=wss://my-server.com/socket
|
|
12536
|
+
* // will connect to that server instead
|
|
12537
|
+
* ```
|
|
12538
|
+
*
|
|
12539
|
+
* @see {@link NetworkConnection} for the main networking API (`this.context.connection`)
|
|
12540
|
+
* @see {@link SyncedRoom} for automatic room joining
|
|
12541
|
+
* @see {@link OwnershipModel} for networked object ownership
|
|
12542
|
+
* @see {@link RoomEvents} for room lifecycle events
|
|
12543
|
+
* @link https://engine.needle.tools/docs/how-to-guides/networking/
|
|
12310
12544
|
* @summary Networking configuration
|
|
12311
12545
|
* @category Networking
|
|
12312
12546
|
* @group Components
|
|
@@ -12315,6 +12549,7 @@ export declare class Networking extends Component implements INetworkingWebsocke
|
|
|
12315
12549
|
/**
|
|
12316
12550
|
* The websocket URL to connect to for networking functionality.
|
|
12317
12551
|
* Can be a complete URL or a relative path that will be resolved against the current origin.
|
|
12552
|
+
* @default null
|
|
12318
12553
|
*/
|
|
12319
12554
|
url: string | null;
|
|
12320
12555
|
/**
|
|
@@ -12688,7 +12923,40 @@ export declare function onClear(cb: LifecycleMethod, opts?: LifecycleMethodOptio
|
|
|
12688
12923
|
export declare function onDestroy(cb: LifecycleMethod, opts?: LifecycleMethodOptions): () => void;
|
|
12689
12924
|
|
|
12690
12925
|
/**
|
|
12691
|
-
* OneEuroFilter is a
|
|
12926
|
+
* [OneEuroFilter](https://engine.needle.tools/docs/api/OneEuroFilter) is a low-pass filter designed to reduce jitter in noisy signals while maintaining low latency.
|
|
12927
|
+
* It's particularly useful for smoothing tracking data from XR controllers, hand tracking, or other input devices where the signal contains noise but responsiveness is important.
|
|
12928
|
+
*
|
|
12929
|
+
* The filter automatically adapts its smoothing strength based on the signal's velocity:
|
|
12930
|
+
* - When the signal moves slowly, it applies strong smoothing to reduce jitter
|
|
12931
|
+
* - When the signal moves quickly, it reduces smoothing to maintain responsiveness
|
|
12932
|
+
*
|
|
12933
|
+
* Based on the research paper: [1€ Filter: A Simple Speed-based Low-pass Filter for Noisy Input](http://cristal.univ-lille.fr/~casiez/1euro/)
|
|
12934
|
+
*
|
|
12935
|
+
* @example Basic usage with timestamp
|
|
12936
|
+
* ```ts
|
|
12937
|
+
* const filter = new OneEuroFilter(120, 1.0, 0.0);
|
|
12938
|
+
*
|
|
12939
|
+
* // In your update loop:
|
|
12940
|
+
* const smoothedValue = filter.filter(noisyValue, this.context.time.time);
|
|
12941
|
+
* ```
|
|
12942
|
+
*
|
|
12943
|
+
* @example Without timestamps (using frequency estimate)
|
|
12944
|
+
* ```ts
|
|
12945
|
+
* // Assuming 60 FPS update rate
|
|
12946
|
+
* const filter = new OneEuroFilter(60, 1.0, 0.5);
|
|
12947
|
+
*
|
|
12948
|
+
* // Call without timestamp - uses the frequency estimate
|
|
12949
|
+
* const smoothedValue = filter.filter(noisyValue);
|
|
12950
|
+
* ```
|
|
12951
|
+
*
|
|
12952
|
+
* @example Smoothing 3D positions
|
|
12953
|
+
* ```ts
|
|
12954
|
+
* const posFilter = new OneEuroFilterXYZ(90, 0.5, 0.0);
|
|
12955
|
+
*
|
|
12956
|
+
* posFilter.filter(trackedPosition, smoothedPosition, this.context.time.time);
|
|
12957
|
+
* ```
|
|
12958
|
+
*
|
|
12959
|
+
* @see {@link OneEuroFilterXYZ} for filtering 3D vectors
|
|
12692
12960
|
*/
|
|
12693
12961
|
export declare class OneEuroFilter {
|
|
12694
12962
|
/**
|
|
@@ -14199,6 +14467,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14199
14467
|
trigger: "tap" | "start";
|
|
14200
14468
|
animation?: Animation_2;
|
|
14201
14469
|
private get target();
|
|
14470
|
+
onEnable(): void;
|
|
14471
|
+
onDisable(): void;
|
|
14472
|
+
onDestroy(): void;
|
|
14202
14473
|
onPointerEnter(): void;
|
|
14203
14474
|
onPointerExit(): void;
|
|
14204
14475
|
onPointerClick(args: PointerEventData): void;
|
|
@@ -14245,6 +14516,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14245
14516
|
toggleOnClick: boolean;
|
|
14246
14517
|
trigger: "tap" | "start";
|
|
14247
14518
|
ensureAudioSource(): void;
|
|
14519
|
+
onEnable(): void;
|
|
14520
|
+
onDisable(): void;
|
|
14521
|
+
onDestroy(): void;
|
|
14248
14522
|
onPointerEnter(): void;
|
|
14249
14523
|
onPointerExit(): void;
|
|
14250
14524
|
onPointerClick(args: PointerEventData): void;
|
|
@@ -15375,6 +15649,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15375
15649
|
*/
|
|
15376
15650
|
static get(object: Object3D | null | undefined, context: Context, isAnchor: boolean, anchor?: Object3D): ReflectionProbe | null;
|
|
15377
15651
|
private _texture;
|
|
15652
|
+
private _textureUrlInFlight?;
|
|
15378
15653
|
set texture(tex: Texture);
|
|
15379
15654
|
get texture(): Texture;
|
|
15380
15655
|
intensity: number;
|
|
@@ -19488,6 +19763,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19488
19763
|
private getTextOpts;
|
|
19489
19764
|
onEnable(): void;
|
|
19490
19765
|
onDisable(): void;
|
|
19766
|
+
onDestroy(): void;
|
|
19491
19767
|
private getAlignment;
|
|
19492
19768
|
private feedText;
|
|
19493
19769
|
private _didHandleTextRenderOnTop;
|
|
@@ -22679,12 +22955,6 @@ export declare namespace MaterialX {
|
|
|
22679
22955
|
}): Promise<import("three").Material | null>;
|
|
22680
22956
|
}
|
|
22681
22957
|
|
|
22682
|
-
declare global {
|
|
22683
|
-
interface HTMLElementTagNameMap {
|
|
22684
|
-
"needle-button": NeedleButtonElement;
|
|
22685
|
-
}
|
|
22686
|
-
}
|
|
22687
|
-
|
|
22688
22958
|
/**
|
|
22689
22959
|
* @internal
|
|
22690
22960
|
*/
|
|
@@ -22734,20 +23004,10 @@ export declare namespace InternalAttributeUtils {
|
|
|
22734
23004
|
}): false | string | null;
|
|
22735
23005
|
}
|
|
22736
23006
|
|
|
22737
|
-
|
|
22738
|
-
|
|
22739
|
-
|
|
22740
|
-
|
|
22741
|
-
*/
|
|
22742
|
-
export declare namespace SplineUtils {
|
|
22743
|
-
/**
|
|
22744
|
-
* Creates a SplineContainer from an array of points.
|
|
22745
|
-
* @param positions The positions of the knots.
|
|
22746
|
-
* @param closed Whether the spline is closed (the last knot connects to the first).
|
|
22747
|
-
* @param tension The tension of the spline. 0 is no tension, 1 is high tension (straight lines between knots). Default is 0.75.
|
|
22748
|
-
* @return The created SplineContainer component - add it to an Object3D to use it.
|
|
22749
|
-
*/
|
|
22750
|
-
function createFromPoints(positions: Vector3[], closed?: boolean, tension?: number): SplineContainer;
|
|
23007
|
+
declare global {
|
|
23008
|
+
interface HTMLElementTagNameMap {
|
|
23009
|
+
"needle-button": NeedleButtonElement;
|
|
23010
|
+
}
|
|
22751
23011
|
}
|
|
22752
23012
|
|
|
22753
23013
|
|
|
@@ -22890,6 +23150,22 @@ declare module 'three' {
|
|
|
22890
23150
|
}
|
|
22891
23151
|
}
|
|
22892
23152
|
|
|
23153
|
+
|
|
23154
|
+
/**
|
|
23155
|
+
* @category Splines
|
|
23156
|
+
* @see {@link SplineContainer} for the main spline component that defines the path and knots
|
|
23157
|
+
*/
|
|
23158
|
+
export declare namespace SplineUtils {
|
|
23159
|
+
/**
|
|
23160
|
+
* Creates a SplineContainer from an array of points.
|
|
23161
|
+
* @param positions The positions of the knots.
|
|
23162
|
+
* @param closed Whether the spline is closed (the last knot connects to the first).
|
|
23163
|
+
* @param tension The tension of the spline. 0 is no tension, 1 is high tension (straight lines between knots). Default is 0.75.
|
|
23164
|
+
* @return The created SplineContainer component - add it to an Object3D to use it.
|
|
23165
|
+
*/
|
|
23166
|
+
function createFromPoints(positions: Vector3[], closed?: boolean, tension?: number): SplineContainer;
|
|
23167
|
+
}
|
|
23168
|
+
|
|
22893
23169
|
declare global {
|
|
22894
23170
|
interface HTMLElementTagNameMap {
|
|
22895
23171
|
"needle-logo-element": NeedleLogoElement;
|