@needle-tools/engine 4.14.0-next.31f837e → 4.14.0-next.52fdb13
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 +9 -0
- package/components.needle.json +1 -1
- package/dist/{generateMeshBVH.worker-DFcS3P04.js → generateMeshBVH.worker-DiCnZlf3.js} +1 -1
- package/dist/{gltf-progressive-8voIgNp_.js → gltf-progressive-Bm_6aEi4.js} +4 -4
- package/dist/{gltf-progressive-BRRBj-nY.umd.cjs → gltf-progressive-BttGBXw6.umd.cjs} +3 -3
- package/dist/{gltf-progressive-Dkh3tG4-.min.js → gltf-progressive-T5WKTux5.min.js} +1 -1
- package/dist/{loader.worker-C6cXDgR1.js → loader.worker-BqODMeeW.js} +1 -1
- package/dist/{materialx-Dx8st96L.min.js → materialx-CJyQZtjt.min.js} +1 -1
- package/dist/{materialx-D66rYPqe.js → materialx-DMs1E08Z.js} +2 -2
- package/dist/{materialx-CxlgposR.umd.cjs → materialx-DaKKOoVk.umd.cjs} +1 -1
- package/dist/{needle-engine.bundle-D7w0XD7M.min.js → needle-engine.bundle-BwfaInTa.min.js} +156 -148
- package/dist/{needle-engine.bundle-BQXG5qbQ.umd.cjs → needle-engine.bundle-DJE-Bjpa.umd.cjs} +141 -133
- package/dist/{needle-engine.bundle-Byl5i6zJ.js → needle-engine.bundle-TmE5-_na.js} +6741 -6449
- package/dist/needle-engine.d.ts +896 -51
- package/dist/needle-engine.js +571 -570
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-Ce5-UWiA.min.js → postprocessing-06AXuvdv.min.js} +2 -2
- package/dist/{postprocessing-BkSpxpYB.js → postprocessing-CI2x8Cln.js} +4 -4
- package/dist/{postprocessing-DFVElmAh.umd.cjs → postprocessing-CPDcA21P.umd.cjs} +2 -2
- package/dist/{three-Bad8p1pf.umd.cjs → three-BjYim-vL.umd.cjs} +47 -47
- package/dist/{three-DFV1-P9z.js → three-Bvk2VKbF.js} +2 -2
- package/dist/{three-CWn13_u1.min.js → three-IG2qPafA.min.js} +2 -2
- package/dist/{three-examples-CO-tx3Sp.umd.cjs → three-examples-BMmNgNCN.umd.cjs} +1 -1
- package/dist/{three-examples-43yqn3mL.js → three-examples-CMYCd5nH.js} +1 -1
- package/dist/{three-examples-DKuJVGT4.min.js → three-examples-CQl1fFZp.min.js} +1 -1
- package/dist/{three-mesh-ui-DyEA5HQF.min.js → three-mesh-ui-5HVE2RV-.min.js} +1 -1
- package/dist/{three-mesh-ui-fSAQJxdI.js → three-mesh-ui-BlakAItG.js} +1 -1
- package/dist/{three-mesh-ui-ChzVOraf.umd.cjs → three-mesh-ui-D828VbQp.umd.cjs} +1 -1
- package/dist/{vendor-pe19S9r5.min.js → vendor-BxK0WKmT.min.js} +1 -1
- package/dist/{vendor-B51YffMU.umd.cjs → vendor-CIDkyBaO.umd.cjs} +1 -1
- package/dist/{vendor-CgpZ5ivC.js → vendor-ixwD-vv2.js} +1 -1
- package/lib/engine/api.d.ts +203 -18
- package/lib/engine/api.js +271 -18
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/engine_accessibility.d.ts +58 -0
- package/lib/engine/engine_accessibility.js +143 -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 +309 -11
- package/lib/engine/engine_materialpropertyblock.js +396 -36
- 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/Camera.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/DropListener.js.map +1 -1
- package/lib/engine-components/Duplicatable.js.map +1 -1
- package/lib/engine-components/GroundProjection.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/NestedGltf.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 +33 -3
- package/lib/engine-components/ReflectionProbe.js +76 -27
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/Renderer.d.ts +2 -0
- package/lib/engine-components/Renderer.js +30 -6
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/RendererLightmap.js +2 -3
- package/lib/engine-components/RendererLightmap.js.map +1 -1
- package/lib/engine-components/SeeThrough.d.ts +0 -2
- package/lib/engine-components/SeeThrough.js +114 -88
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/SmoothFollow.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +107 -13
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +167 -30
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +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/Raycaster.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/lib/engine-components/web/ViewBox.d.ts +2 -2
- package/lib/engine-components/web/ViewBox.js +2 -2
- package/lib/engine-components/web/ViewBox.js.map +1 -1
- package/lib/engine-components/webxr/WebXRPlaneTracking.js.map +1 -1
- package/lib/engine-components/webxr/controllers/XRControllerFollow.js.map +1 -1
- package/lib/engine-components/webxr/controllers/XRControllerMovement.js.map +1 -1
- package/package.json +4 -4
- package/src/engine/api.ts +371 -19
- package/src/engine/engine_accessibility.ts +178 -0
- package/src/engine/engine_context.ts +9 -0
- package/src/engine/engine_materialpropertyblock.ts +499 -42
- 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/Camera.ts +2 -2
- package/src/engine-components/Component.ts +1 -3
- package/src/engine-components/DragControls.ts +29 -4
- package/src/engine-components/DropListener.ts +1 -1
- package/src/engine-components/Duplicatable.ts +1 -1
- package/src/engine-components/GroundProjection.ts +3 -0
- package/src/engine-components/NeedleMenu.ts +8 -3
- package/src/engine-components/NestedGltf.ts +1 -1
- package/src/engine-components/Networking.ts +29 -4
- package/src/engine-components/ReflectionProbe.ts +81 -31
- package/src/engine-components/Renderer.ts +34 -6
- package/src/engine-components/RendererLightmap.ts +2 -3
- package/src/engine-components/SeeThrough.ts +122 -107
- package/src/engine-components/SmoothFollow.ts +2 -2
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +198 -65
- package/src/engine-components/ui/Button.ts +13 -1
- package/src/engine-components/ui/Raycaster.ts +1 -1
- package/src/engine-components/ui/Text.ts +13 -0
- package/src/engine-components/web/ViewBox.ts +9 -2
- package/src/engine-components/webxr/WebXRPlaneTracking.ts +3 -3
- package/src/engine-components/webxr/controllers/XRControllerFollow.ts +1 -1
- package/src/engine-components/webxr/controllers/XRControllerMovement.ts +4 -4
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,62 @@ 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
|
+
declare class AccessibilityManager {
|
|
143
|
+
private readonly context;
|
|
144
|
+
private static readonly _managers;
|
|
145
|
+
/** Returns the {@link AccessibilityManager} associated with the given context or component. */
|
|
146
|
+
static get(obj: Context | IComponent): AccessibilityManager | undefined;
|
|
147
|
+
constructor(context: Context);
|
|
148
|
+
private _enabled;
|
|
149
|
+
/** Enables or disables the accessibility overlay. When disabled, the overlay DOM is removed. */
|
|
150
|
+
set enabled(value: boolean);
|
|
151
|
+
/** Removes all tracked accessibility elements, keeping only the live region. */
|
|
152
|
+
clear(): void;
|
|
153
|
+
/** Removes the overlay from the DOM and unregisters this manager from the context. */
|
|
154
|
+
dispose(): void;
|
|
155
|
+
private readonly root;
|
|
156
|
+
private readonly liveRegion;
|
|
157
|
+
private readonly treeElements;
|
|
158
|
+
/**
|
|
159
|
+
* Creates or updates the accessible DOM element for a 3D object or component.
|
|
160
|
+
* @param obj - The scene object or component to represent.
|
|
161
|
+
* @param data - Partial accessibility data (role, label, hidden, busy) to apply.
|
|
162
|
+
*/
|
|
163
|
+
updateElement<T extends Object3D | IComponent>(obj: T, data: Partial<AccessibilityData>): void;
|
|
164
|
+
/** Moves keyboard focus to the accessible element representing the given object. */
|
|
165
|
+
focus<T extends Object3D | IComponent>(obj: T): void;
|
|
166
|
+
/** Removes keyboard focus from the accessible element representing the given object. */
|
|
167
|
+
unfocus<T extends Object3D | IComponent>(obj: T): void;
|
|
168
|
+
/**
|
|
169
|
+
* Announces a hover event to screen readers via the ARIA live region.
|
|
170
|
+
* @param obj - The hovered object (used to look up its label if `text` is not provided).
|
|
171
|
+
* @param text - Optional text to announce. Falls back to the element's `aria-label`.
|
|
172
|
+
*/
|
|
173
|
+
hover<T extends Object3D | IComponent>(obj: T, text?: string): void;
|
|
174
|
+
/** Removes the accessible DOM element for the given object and stops tracking it. */
|
|
175
|
+
removeElement(obj: Object3D | IComponent): void;
|
|
176
|
+
private set liveRegionMode(value);
|
|
177
|
+
}
|
|
178
|
+
|
|
123
179
|
export declare class ActionBuilder {
|
|
124
180
|
static sequence(...params: IBehaviorElement[]): GroupActionModel;
|
|
125
181
|
static parallel(...params: IBehaviorElement[]): GroupActionModel;
|
|
@@ -2029,7 +2085,7 @@ export declare namespace BlobStorage {
|
|
|
2029
2085
|
export function upload(file: File, opts?: UploadOptions): Promise<Upload_Result | null>;
|
|
2030
2086
|
export function getBlobUrlForKey(key: string): string;
|
|
2031
2087
|
export function download(url: string, progressCallback?: (prog: ProgressEvent) => void): Promise<Uint8Array | null>;
|
|
2032
|
-
|
|
2088
|
+
{};
|
|
2033
2089
|
}
|
|
2034
2090
|
|
|
2035
2091
|
/**
|
|
@@ -2267,6 +2323,7 @@ export declare class Button extends Component implements IPointerEventHandler {
|
|
|
2267
2323
|
awake(): void;
|
|
2268
2324
|
start(): void;
|
|
2269
2325
|
onEnable(): void;
|
|
2326
|
+
onDisable(): void;
|
|
2270
2327
|
onDestroy(): void;
|
|
2271
2328
|
private _requestedAnimatorTrigger?;
|
|
2272
2329
|
private setAnimatorTriggerAtEndOfFrame;
|
|
@@ -2815,7 +2872,15 @@ export declare class CapsuleCollider extends Collider {
|
|
|
2815
2872
|
}
|
|
2816
2873
|
|
|
2817
2874
|
/**
|
|
2818
|
-
*
|
|
2875
|
+
* Switches the material of objects in the scene when clicked.
|
|
2876
|
+
* Works in the browser and in USDZ/QuickLook (Everywhere Actions).
|
|
2877
|
+
*
|
|
2878
|
+
* Finds all objects in the scene that use `materialToSwitch` and replaces it with `variantMaterial`.
|
|
2879
|
+
* Multiple `ChangeMaterialOnClick` components using the same `materialToSwitch` can be combined to create a material selection UI.
|
|
2880
|
+
*
|
|
2881
|
+
* @see {@link SetActiveOnClick} to toggle visibility of objects when clicked
|
|
2882
|
+
* @see {@link PlayAnimationOnClick} to play animations when clicked
|
|
2883
|
+
* @see [Everywhere Actions](https://engine.needle.tools/docs/everywhere-actions)
|
|
2819
2884
|
* @summary Changes the material of objects when clicked
|
|
2820
2885
|
* @category Everywhere Actions
|
|
2821
2886
|
* @group Components
|
|
@@ -2835,6 +2900,9 @@ export declare class ChangeMaterialOnClick extends Component implements IPointer
|
|
|
2835
2900
|
*/
|
|
2836
2901
|
fadeDuration: number;
|
|
2837
2902
|
start(): void;
|
|
2903
|
+
onEnable(): void;
|
|
2904
|
+
onDisable(): void;
|
|
2905
|
+
onDestroy(): void;
|
|
2838
2906
|
onPointerEnter(_args: PointerEventData): void;
|
|
2839
2907
|
onPointerExit(_: PointerEventData): void;
|
|
2840
2908
|
onPointerClick(args: PointerEventData): void;
|
|
@@ -2856,21 +2924,32 @@ export declare class ChangeMaterialOnClick extends Component implements IPointer
|
|
|
2856
2924
|
}
|
|
2857
2925
|
|
|
2858
2926
|
/**
|
|
2859
|
-
*
|
|
2927
|
+
* Moves an object to the target object's transform when clicked.
|
|
2928
|
+
* Works in the browser and in USDZ/QuickLook (Everywhere Actions).
|
|
2929
|
+
*
|
|
2930
|
+
* @see {@link SetActiveOnClick}to toggle visibility of objects when clicked
|
|
2931
|
+
* @see {@link PlayAnimationOnClick} to play animations when clicked
|
|
2932
|
+
* @see [Everywhere Actions](https://engine.needle.tools/docs/everywhere-actions)
|
|
2860
2933
|
* @summary Moves an object to a target transform upon click
|
|
2861
2934
|
* @category Everywhere Actions
|
|
2862
2935
|
* @group Components
|
|
2863
2936
|
*/
|
|
2864
2937
|
export declare class ChangeTransformOnClick extends Component implements IPointerClickHandler, UsdzBehaviour {
|
|
2938
|
+
/** The object to move. */
|
|
2865
2939
|
object?: Object3D;
|
|
2940
|
+
/** The target object whose transform to move to. */
|
|
2866
2941
|
target?: Object3D;
|
|
2942
|
+
/** The duration of the movement animation in seconds. */
|
|
2867
2943
|
duration: number;
|
|
2944
|
+
/** If true, the motion is relative to the object's current transform instead of moving to the target's absolute position. */
|
|
2868
2945
|
relativeMotion: boolean;
|
|
2869
2946
|
private coroutine;
|
|
2870
2947
|
private targetPos;
|
|
2871
2948
|
private targetRot;
|
|
2872
2949
|
private targetScale;
|
|
2873
|
-
|
|
2950
|
+
onEnable(): void;
|
|
2951
|
+
onDisable(): void;
|
|
2952
|
+
onDestroy(): void;
|
|
2874
2953
|
onPointerEnter(): void;
|
|
2875
2954
|
onPointerExit(): void;
|
|
2876
2955
|
onPointerClick(args: PointerEventData): void;
|
|
@@ -4276,6 +4355,7 @@ export declare class Context implements IContext {
|
|
|
4276
4355
|
readonly lodsManager: LODsManager;
|
|
4277
4356
|
/** Access the needle menu to add or remove buttons to the menu element */
|
|
4278
4357
|
readonly menu: NeedleMenu_2;
|
|
4358
|
+
readonly accessibility: AccessibilityManager;
|
|
4279
4359
|
/**
|
|
4280
4360
|
* Checks if the context is fully created and ready
|
|
4281
4361
|
* @returns true if the context is fully created and ready
|
|
@@ -5266,6 +5346,7 @@ export declare class DragControls extends Component implements IPointerEventHand
|
|
|
5266
5346
|
/* Excluded from this release type: start */
|
|
5267
5347
|
/* Excluded from this release type: onEnable */
|
|
5268
5348
|
/* Excluded from this release type: onDisable */
|
|
5349
|
+
onDestroy(): void;
|
|
5269
5350
|
/**
|
|
5270
5351
|
* Checks if editing is allowed for the current networking connection.
|
|
5271
5352
|
* @param _obj Optional object to check edit permissions for
|
|
@@ -5638,15 +5719,28 @@ export declare class EmissionModule {
|
|
|
5638
5719
|
/* Excluded from this release type: EmphasizeActionMotionType */
|
|
5639
5720
|
|
|
5640
5721
|
/**
|
|
5641
|
-
*
|
|
5722
|
+
* Applies an emphasis animation to a target object when this object is clicked.
|
|
5723
|
+
* Works in USDZ/QuickLook (Everywhere Actions).
|
|
5724
|
+
*
|
|
5725
|
+
* The emphasis effect can be a bounce, jiggle, or other motion type defined by `motionType`.
|
|
5726
|
+
*
|
|
5727
|
+
* @see {@link PlayAnimationOnClick} to play animations when clicked
|
|
5728
|
+
* @see {@link SetActiveOnClick} to toggle visibility when clicked
|
|
5729
|
+
* @see [Everywhere Actions](https://engine.needle.tools/docs/everywhere-actions)
|
|
5642
5730
|
* @summary Emphasizes the target object when clicked
|
|
5643
5731
|
* @category Everywhere Actions
|
|
5644
5732
|
* @group Components
|
|
5645
5733
|
*/
|
|
5646
5734
|
export declare class EmphasizeOnClick extends Component implements UsdzBehaviour {
|
|
5735
|
+
/** The target object to emphasize. */
|
|
5647
5736
|
target?: Object3D;
|
|
5737
|
+
/** The duration of the emphasis animation in seconds. */
|
|
5648
5738
|
duration: number;
|
|
5739
|
+
/** The type of motion to use for the emphasis effect (e.g. `"bounce"`, `"jiggle"`). */
|
|
5649
5740
|
motionType: EmphasizeActionMotionType;
|
|
5741
|
+
onEnable(): void;
|
|
5742
|
+
onDisable(): void;
|
|
5743
|
+
onDestroy(): void;
|
|
5650
5744
|
beforeCreateDocument(): void;
|
|
5651
5745
|
createBehaviours(ext: any, model: any, _context: any): void;
|
|
5652
5746
|
afterCreateDocument(_ext: any, _context: any): void;
|
|
@@ -7398,7 +7492,13 @@ export declare enum HideFlags {
|
|
|
7398
7492
|
}
|
|
7399
7493
|
|
|
7400
7494
|
/**
|
|
7401
|
-
* Hides the object
|
|
7495
|
+
* Hides the object when the scene starts.
|
|
7496
|
+
* Works in the browser and in USDZ/QuickLook (Everywhere Actions).
|
|
7497
|
+
*
|
|
7498
|
+
* Useful for setting up objects that should initially be hidden and shown later via a {@link SetActiveOnClick} component.
|
|
7499
|
+
*
|
|
7500
|
+
* @see {@link SetActiveOnClick} to show or hide objects on click
|
|
7501
|
+
* @see [Everywhere Actions](https://engine.needle.tools/docs/everywhere-actions)
|
|
7402
7502
|
* @summary Hides the object on scene start
|
|
7403
7503
|
* @category Everywhere Actions
|
|
7404
7504
|
* @group Components
|
|
@@ -7744,6 +7844,7 @@ export declare type ICollisionContext = {
|
|
|
7744
7844
|
|
|
7745
7845
|
export declare interface IComponent extends IHasGuid {
|
|
7746
7846
|
get isComponent(): boolean;
|
|
7847
|
+
get [$componentName](): string | undefined;
|
|
7747
7848
|
/** the object this component is attached to */
|
|
7748
7849
|
gameObject: IGameObject;
|
|
7749
7850
|
enabled: boolean;
|
|
@@ -8725,7 +8826,7 @@ export declare namespace InternalScreenshotUtils {
|
|
|
8725
8826
|
[key: string]: boolean | number;
|
|
8726
8827
|
};
|
|
8727
8828
|
}): FullscreenPlane;
|
|
8728
|
-
|
|
8829
|
+
{};
|
|
8729
8830
|
}
|
|
8730
8831
|
|
|
8731
8832
|
/* Excluded from this release type: invokeLoadedImportPluginHooks */
|
|
@@ -10056,39 +10157,300 @@ export declare class MaskableGraphic extends Graphic {
|
|
|
10056
10157
|
protected onAfterCreated(): void;
|
|
10057
10158
|
}
|
|
10058
10159
|
|
|
10160
|
+
/**
|
|
10161
|
+
* MaterialPropertyBlock allows per-object material property overrides without creating new material instances.
|
|
10162
|
+
* This is useful for rendering multiple objects with the same base material but different properties
|
|
10163
|
+
* (e.g., different colors, textures, or shader parameters).
|
|
10164
|
+
*
|
|
10165
|
+
* ## How Property Blocks Work
|
|
10166
|
+
*
|
|
10167
|
+
* **Important**: Overrides are registered on the **Object3D**, not on the material.
|
|
10168
|
+
* This means:
|
|
10169
|
+
* - If you change the object's material, the overrides will still be applied to the new material
|
|
10170
|
+
* - Multiple objects can share the same material but have different property overrides
|
|
10171
|
+
* - If you don't want overrides applied after changing a material, you must remove them using {@link removeOveride}, {@link clearAllOverrides}, or {@link dispose}
|
|
10172
|
+
*
|
|
10173
|
+
* The property block system works by:
|
|
10174
|
+
* - Temporarily applying overrides in onBeforeRender
|
|
10175
|
+
* - Restoring original values in onAfterRender
|
|
10176
|
+
* - Managing shader defines and program cache keys for correct shader compilation
|
|
10177
|
+
* - Supporting texture coordinate transforms per object
|
|
10178
|
+
*
|
|
10179
|
+
* ## Common Use Cases
|
|
10180
|
+
*
|
|
10181
|
+
* - **Lightmaps**: Apply unique lightmap textures to individual objects sharing the same material
|
|
10182
|
+
* - **Reflection Probes**: Apply different environment maps per object for localized reflections
|
|
10183
|
+
* - **See-through effects**: Temporarily override transparency/transmission properties for X-ray effects
|
|
10184
|
+
*
|
|
10185
|
+
* ## Getting a MaterialPropertyBlock
|
|
10186
|
+
*
|
|
10187
|
+
* **Important**: Do not use the constructor directly. Instead, use the static {@link MaterialPropertyBlock.get} method:
|
|
10188
|
+
*
|
|
10189
|
+
* ```typescript
|
|
10190
|
+
* const block = MaterialPropertyBlock.get(myMesh);
|
|
10191
|
+
* ```
|
|
10192
|
+
*
|
|
10193
|
+
* This method will either return an existing property block or create a new one if it doesn't exist.
|
|
10194
|
+
* It automatically:
|
|
10195
|
+
* - Creates the property block instance
|
|
10196
|
+
* - Registers it in the internal registry
|
|
10197
|
+
* - Attaches the necessary render callbacks to the object
|
|
10198
|
+
* - Handles Groups by applying overrides to all child meshes
|
|
10199
|
+
*
|
|
10200
|
+
* @example Basic usage
|
|
10201
|
+
* ```typescript
|
|
10202
|
+
* // Get or create a property block for an object
|
|
10203
|
+
* const block = MaterialPropertyBlock.get(myMesh);
|
|
10204
|
+
*
|
|
10205
|
+
* // Override the color property
|
|
10206
|
+
* block.setOverride("color", new Color(1, 0, 0));
|
|
10207
|
+
*
|
|
10208
|
+
* // Override a texture with custom UV transform (useful for lightmaps)
|
|
10209
|
+
* block.setOverride("lightMap", myLightmapTexture, {
|
|
10210
|
+
* offset: new Vector2(0.5, 0.5),
|
|
10211
|
+
* repeat: new Vector2(2, 2)
|
|
10212
|
+
* });
|
|
10213
|
+
*
|
|
10214
|
+
* // Set a shader define
|
|
10215
|
+
* block.setDefine("USE_CUSTOM_FEATURE", 1);
|
|
10216
|
+
* ```
|
|
10217
|
+
*
|
|
10218
|
+
* @example Material swapping behavior
|
|
10219
|
+
* ```typescript
|
|
10220
|
+
* const mesh = new Mesh(geometry, materialA);
|
|
10221
|
+
* const block = MaterialPropertyBlock.get(mesh);
|
|
10222
|
+
* block.setOverride("color", new Color(1, 0, 0));
|
|
10223
|
+
*
|
|
10224
|
+
* // The color override is red for materialA
|
|
10225
|
+
*
|
|
10226
|
+
* // Swap the material - overrides persist and apply to the new material!
|
|
10227
|
+
* mesh.material = materialB;
|
|
10228
|
+
* // The color override is now red for materialB too
|
|
10229
|
+
*
|
|
10230
|
+
* // If you don't want overrides on the new material, remove them:
|
|
10231
|
+
* block.clearAllOverrides(); // Remove all overrides
|
|
10232
|
+
* // or
|
|
10233
|
+
* block.removeOveride("color"); // Remove specific override
|
|
10234
|
+
* // or
|
|
10235
|
+
* block.dispose(); // Remove the entire property block
|
|
10236
|
+
* ```
|
|
10237
|
+
*
|
|
10238
|
+
* @example Lightmap usage
|
|
10239
|
+
* ```typescript
|
|
10240
|
+
* const block = MaterialPropertyBlock.get(mesh);
|
|
10241
|
+
* block.setOverride("lightMap", lightmapTexture);
|
|
10242
|
+
* block.setOverride("lightMapIntensity", 1.5);
|
|
10243
|
+
* ```
|
|
10244
|
+
*
|
|
10245
|
+
* @example See-through effect
|
|
10246
|
+
* ```typescript
|
|
10247
|
+
* const block = MaterialPropertyBlock.get(mesh);
|
|
10248
|
+
* block.setOverride("transparent", true);
|
|
10249
|
+
* block.setOverride("opacity", 0.3);
|
|
10250
|
+
* ```
|
|
10251
|
+
*
|
|
10252
|
+
* @template T The material type this property block is associated with
|
|
10253
|
+
*/
|
|
10059
10254
|
export declare class MaterialPropertyBlock<T extends Material = Material> {
|
|
10060
10255
|
private _overrides;
|
|
10061
10256
|
private _defines;
|
|
10062
10257
|
private _object;
|
|
10258
|
+
/** The object this property block is attached to */
|
|
10063
10259
|
get object(): Object3D | null;
|
|
10064
|
-
|
|
10260
|
+
/**
|
|
10261
|
+
* Creates a new MaterialPropertyBlock
|
|
10262
|
+
* @param object The object this property block is for (optional)
|
|
10263
|
+
*/
|
|
10264
|
+
protected constructor(object?: Object3D | null);
|
|
10265
|
+
/**
|
|
10266
|
+
* Gets or creates a MaterialPropertyBlock for the given object.
|
|
10267
|
+
* This is the recommended way to obtain a property block instance.
|
|
10268
|
+
*
|
|
10269
|
+
* @template T The material type
|
|
10270
|
+
* @param object The object to get/create a property block for
|
|
10271
|
+
* @returns The MaterialPropertyBlock associated with this object
|
|
10272
|
+
*
|
|
10273
|
+
* @example
|
|
10274
|
+
* ```typescript
|
|
10275
|
+
* const block = MaterialPropertyBlock.get(myMesh);
|
|
10276
|
+
* block.setOverride("roughness", 0.5);
|
|
10277
|
+
* ```
|
|
10278
|
+
*/
|
|
10065
10279
|
static get<T extends Material = Material>(object: Object3D): MaterialPropertyBlock<T>;
|
|
10280
|
+
/**
|
|
10281
|
+
* Checks if an object has any property overrides
|
|
10282
|
+
* @param object The object to check
|
|
10283
|
+
* @returns True if the object has a property block with overrides
|
|
10284
|
+
*/
|
|
10285
|
+
static hasOverrides(object: Object3D): boolean;
|
|
10286
|
+
/**
|
|
10287
|
+
* Disposes this property block and cleans up associated resources.
|
|
10288
|
+
* After calling dispose, this property block should not be used.
|
|
10289
|
+
*/
|
|
10066
10290
|
dispose(): void;
|
|
10291
|
+
/**
|
|
10292
|
+
* Sets or updates a material property override.
|
|
10293
|
+
* The override will be applied to the material during rendering.
|
|
10294
|
+
*
|
|
10295
|
+
* @param name The name of the material property to override (e.g., "color", "map", "roughness")
|
|
10296
|
+
* @param value The value to set
|
|
10297
|
+
* @param textureTransform Optional UV transform (only used when value is a Texture)
|
|
10298
|
+
*
|
|
10299
|
+
* @example
|
|
10300
|
+
* ```typescript
|
|
10301
|
+
* // Override a simple property
|
|
10302
|
+
* block.setOverride("roughness", 0.8);
|
|
10303
|
+
*
|
|
10304
|
+
* // Override a color
|
|
10305
|
+
* block.setOverride("color", new Color(0xff0000));
|
|
10306
|
+
*
|
|
10307
|
+
* // Override a texture with UV transform
|
|
10308
|
+
* block.setOverride("map", texture, {
|
|
10309
|
+
* offset: new Vector2(0, 0),
|
|
10310
|
+
* repeat: new Vector2(2, 2)
|
|
10311
|
+
* });
|
|
10312
|
+
* ```
|
|
10313
|
+
*/
|
|
10067
10314
|
setOverride<K extends NonFunctionPropertyNames<T>>(name: K, value: T[K], textureTransform?: TextureTransform): void;
|
|
10068
10315
|
setOverride(name: string, value: MaterialPropertyType, textureTransform?: TextureTransform): void;
|
|
10069
|
-
|
|
10070
|
-
|
|
10316
|
+
/**
|
|
10317
|
+
* Gets the override for a specific property with type-safe value inference
|
|
10318
|
+
* @param name The property name to get
|
|
10319
|
+
* @returns The PropertyBlockOverride with correctly typed value if it exists, undefined otherwise
|
|
10320
|
+
*
|
|
10321
|
+
* @example
|
|
10322
|
+
* ```typescript
|
|
10323
|
+
* const block = MaterialPropertyBlock.get<MeshStandardMaterial>(mesh);
|
|
10324
|
+
*
|
|
10325
|
+
* // Value is inferred as number | undefined
|
|
10326
|
+
* const roughness = block.getOverride("roughness")?.value;
|
|
10327
|
+
*
|
|
10328
|
+
* // Value is inferred as Color | undefined
|
|
10329
|
+
* const color = block.getOverride("color")?.value;
|
|
10330
|
+
*
|
|
10331
|
+
* // Value is inferred as Texture | null | undefined
|
|
10332
|
+
* const map = block.getOverride("map")?.value;
|
|
10333
|
+
*
|
|
10334
|
+
* // Explicitly specify the type for properties not on the base material type
|
|
10335
|
+
* const transmission = block.getOverride<number>("transmission")?.value;
|
|
10336
|
+
*
|
|
10337
|
+
* // Or use a more specific material type
|
|
10338
|
+
* const physicalBlock = block as MaterialPropertyBlock<MeshPhysicalMaterial>;
|
|
10339
|
+
* const transmissionTyped = physicalBlock.getOverride("transmission")?.value; // number
|
|
10340
|
+
* ```
|
|
10341
|
+
*/
|
|
10342
|
+
getOverride<K extends NonFunctionPropertyNames<T>>(name: K): PropertyBlockOverride<T[K] & MaterialPropertyType> | undefined;
|
|
10343
|
+
getOverride<V extends MaterialPropertyType = MaterialPropertyType>(name: string): PropertyBlockOverride<V> | undefined;
|
|
10344
|
+
/**
|
|
10345
|
+
* Removes a specific property override.
|
|
10346
|
+
* After removal, the material will use its original property value for this property.
|
|
10347
|
+
*
|
|
10348
|
+
* @param name The property name to remove the override for
|
|
10349
|
+
*
|
|
10350
|
+
* @example
|
|
10351
|
+
* ```typescript
|
|
10352
|
+
* const block = MaterialPropertyBlock.get(mesh);
|
|
10353
|
+
*
|
|
10354
|
+
* // Set some overrides
|
|
10355
|
+
* block.setOverride("color", new Color(1, 0, 0));
|
|
10356
|
+
* block.setOverride("roughness", 0.5);
|
|
10357
|
+
* block.setOverride("lightMap", lightmapTexture);
|
|
10358
|
+
*
|
|
10359
|
+
* // Remove a specific override - the material will now use its original color
|
|
10360
|
+
* block.removeOveride("color");
|
|
10361
|
+
*
|
|
10362
|
+
* // Other overrides (roughness, lightMap) remain active
|
|
10363
|
+
* ```
|
|
10364
|
+
*/
|
|
10365
|
+
removeOveride<K extends NonFunctionPropertyNames<T>>(name: K | ({} & string)): void;
|
|
10366
|
+
/**
|
|
10367
|
+
* Removes all property overrides from this block.
|
|
10368
|
+
* After calling this, the material will use its original values for all properties.
|
|
10369
|
+
*
|
|
10370
|
+
* **Note**: This does NOT remove shader defines. Use {@link clearDefine} or {@link dispose} for that.
|
|
10371
|
+
*
|
|
10372
|
+
* @example Remove all overrides but keep the property block
|
|
10373
|
+
* ```typescript
|
|
10374
|
+
* const block = MaterialPropertyBlock.get(mesh);
|
|
10375
|
+
*
|
|
10376
|
+
* // Set multiple overrides
|
|
10377
|
+
* block.setOverride("color", new Color(1, 0, 0));
|
|
10378
|
+
* block.setOverride("roughness", 0.5);
|
|
10379
|
+
* block.setOverride("lightMap", lightmapTexture);
|
|
10380
|
+
*
|
|
10381
|
+
* // Later, remove all overrides at once
|
|
10382
|
+
* block.clearAllOverrides();
|
|
10383
|
+
*
|
|
10384
|
+
* // The material now uses its original values
|
|
10385
|
+
* // The property block still exists and can be reused with new overrides
|
|
10386
|
+
* ```
|
|
10387
|
+
*
|
|
10388
|
+
* @example Temporarily disable all overrides
|
|
10389
|
+
* ```typescript
|
|
10390
|
+
* const block = MaterialPropertyBlock.get(mesh);
|
|
10391
|
+
*
|
|
10392
|
+
* // Save current overrides if you want to restore them later
|
|
10393
|
+
* const savedOverrides = [...block.overrides];
|
|
10394
|
+
*
|
|
10395
|
+
* // Clear all overrides temporarily
|
|
10396
|
+
* block.clearAllOverrides();
|
|
10397
|
+
*
|
|
10398
|
+
* // Do some rendering without overrides...
|
|
10399
|
+
*
|
|
10400
|
+
* // Restore overrides
|
|
10401
|
+
* savedOverrides.forEach(override => {
|
|
10402
|
+
* block.setOverride(override.name, override.value, override.textureTransform);
|
|
10403
|
+
* });
|
|
10404
|
+
* ```
|
|
10405
|
+
*
|
|
10406
|
+
* @see {@link removeOveride} - To remove a single override
|
|
10407
|
+
* @see {@link dispose} - To completely remove the property block and clean up resources
|
|
10408
|
+
*/
|
|
10071
10409
|
clearAllOverrides(): void;
|
|
10072
|
-
|
|
10073
|
-
|
|
10410
|
+
/**
|
|
10411
|
+
* Gets all property overrides as a readonly array
|
|
10412
|
+
* @returns Array of all property overrides
|
|
10413
|
+
*/
|
|
10414
|
+
get overrides(): readonly PropertyBlockOverride[];
|
|
10415
|
+
/**
|
|
10416
|
+
* Checks if this property block has any overrides
|
|
10417
|
+
* @returns True if there are any overrides set
|
|
10418
|
+
*/
|
|
10074
10419
|
hasOverrides(): boolean;
|
|
10075
10420
|
/**
|
|
10076
|
-
* Set a shader define that will be included in the program cache key
|
|
10077
|
-
* This allows different objects sharing the same material to have different shader programs
|
|
10421
|
+
* Set a shader define that will be included in the program cache key.
|
|
10422
|
+
* This allows different objects sharing the same material to have different shader programs.
|
|
10423
|
+
*
|
|
10424
|
+
* Defines affect shader compilation and are useful for enabling/disabling features per-object.
|
|
10425
|
+
*
|
|
10426
|
+
* @param name The define name (e.g., "USE_LIGHTMAP", "ENABLE_REFLECTIONS")
|
|
10427
|
+
* @param value The define value (typically a boolean, number, or string)
|
|
10428
|
+
*
|
|
10429
|
+
* @example
|
|
10430
|
+
* ```typescript
|
|
10431
|
+
* // Enable a feature for this specific object
|
|
10432
|
+
* block.setDefine("USE_CUSTOM_SHADER", true);
|
|
10433
|
+
* block.setDefine("QUALITY_LEVEL", 2);
|
|
10434
|
+
* ```
|
|
10078
10435
|
*/
|
|
10079
10436
|
setDefine(name: string, value: string | number | boolean): void;
|
|
10080
10437
|
/**
|
|
10081
10438
|
* Remove a shader define
|
|
10439
|
+
* @param name The define name to remove
|
|
10082
10440
|
*/
|
|
10083
10441
|
clearDefine(name: string): void;
|
|
10084
10442
|
/**
|
|
10085
10443
|
* Get all defines set on this property block
|
|
10444
|
+
* @returns A readonly record of all defines
|
|
10086
10445
|
*/
|
|
10087
10446
|
getDefines(): Readonly<Record<string, string | number | boolean>>;
|
|
10088
|
-
|
|
10447
|
+
/* Excluded from this release type: getCacheKey */
|
|
10089
10448
|
}
|
|
10090
10449
|
|
|
10091
|
-
|
|
10450
|
+
/**
|
|
10451
|
+
* Valid types that can be used as material property overrides
|
|
10452
|
+
*/
|
|
10453
|
+
declare type MaterialPropertyType = number | number[] | Color | Texture | Vector2 | Vector3 | Vector4 | null | Euler;
|
|
10092
10454
|
|
|
10093
10455
|
export declare namespace MaterialX {
|
|
10094
10456
|
/**
|
|
@@ -10443,32 +10805,58 @@ export declare namespace NEEDLE_ENGINE_MODULES {
|
|
|
10443
10805
|
export { NEEDLE_progressive }
|
|
10444
10806
|
|
|
10445
10807
|
/**
|
|
10446
|
-
*
|
|
10447
|
-
*
|
|
10808
|
+
* [<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.
|
|
10809
|
+
*
|
|
10810
|
+
* The button automatically handles session management and displays appropriate UI based on device capabilities.
|
|
10811
|
+
* It comes with default styling (glassmorphism design) but can be fully customized with CSS.
|
|
10812
|
+
*
|
|
10813
|
+
* **Supported button types:**
|
|
10814
|
+
* - `ar` - WebXR AR session button
|
|
10815
|
+
* - `vr` - WebXR VR session button
|
|
10816
|
+
* - `quicklook` - Apple AR Quick Look button (iOS only)
|
|
10817
|
+
* - `qrcode` - QR code sharing button
|
|
10818
|
+
*
|
|
10819
|
+
* @example Basic AR/VR buttons
|
|
10448
10820
|
* ```html
|
|
10821
|
+
* <needle-engine src="scene.glb"></needle-engine>
|
|
10449
10822
|
* <needle-button ar></needle-button>
|
|
10450
10823
|
* <needle-button vr></needle-button>
|
|
10451
10824
|
* <needle-button quicklook></needle-button>
|
|
10452
10825
|
* ```
|
|
10453
10826
|
*
|
|
10454
|
-
* @example
|
|
10827
|
+
* @example Custom button labels
|
|
10455
10828
|
* ```html
|
|
10456
|
-
* <needle-button ar>Start AR</needle-button>
|
|
10457
|
-
* <needle-button vr>
|
|
10829
|
+
* <needle-button ar>Start AR Experience</needle-button>
|
|
10830
|
+
* <needle-button vr>Enter VR Mode</needle-button>
|
|
10458
10831
|
* <needle-button quicklook>View in AR</needle-button>
|
|
10459
10832
|
* ```
|
|
10460
10833
|
*
|
|
10461
|
-
* @example
|
|
10834
|
+
* @example Custom styling
|
|
10462
10835
|
* ```html
|
|
10463
|
-
* <!-- You can either style the element directly or use a CSS stylesheet -->
|
|
10464
10836
|
* <style>
|
|
10465
|
-
*
|
|
10466
|
-
*
|
|
10467
|
-
*
|
|
10468
|
-
*
|
|
10837
|
+
* needle-button {
|
|
10838
|
+
* background-color: #ff6b6b;
|
|
10839
|
+
* color: white;
|
|
10840
|
+
* border-radius: 8px;
|
|
10841
|
+
* padding: 1rem 2rem;
|
|
10842
|
+
* }
|
|
10843
|
+
* needle-button:hover {
|
|
10844
|
+
* background-color: #ff5252;
|
|
10845
|
+
* }
|
|
10469
10846
|
* </style>
|
|
10470
10847
|
* <needle-button ar>Start AR</needle-button>
|
|
10471
10848
|
* ```
|
|
10849
|
+
*
|
|
10850
|
+
* @example Unstyled button (for complete custom styling)
|
|
10851
|
+
* ```html
|
|
10852
|
+
* <needle-button ar unstyled>
|
|
10853
|
+
* <span class="my-icon">🥽</span>
|
|
10854
|
+
* Launch AR
|
|
10855
|
+
* </needle-button>
|
|
10856
|
+
* ```
|
|
10857
|
+
*
|
|
10858
|
+
* @see {@link NeedleEngineWebComponent} for the main <needle-engine> element
|
|
10859
|
+
* @see {@link NeedleMenu} for the built-in menu component that can display similar buttons
|
|
10472
10860
|
*/
|
|
10473
10861
|
export declare class NeedleButtonElement extends HTMLElement {
|
|
10474
10862
|
#private;
|
|
@@ -10535,7 +10923,7 @@ export declare namespace NeedleEngineModelLoader {
|
|
|
10535
10923
|
*
|
|
10536
10924
|
*/
|
|
10537
10925
|
export function onDetermineModelMimetype(callback: MimetypeCallback): (() => void);
|
|
10538
|
-
|
|
10926
|
+
{};
|
|
10539
10927
|
}
|
|
10540
10928
|
|
|
10541
10929
|
/**
|
|
@@ -10545,10 +10933,18 @@ export declare namespace NeedleEngineModelLoader {
|
|
|
10545
10933
|
* The context is accessible from the `<needle-engine>` element: `document.querySelector("needle-engine").context`.
|
|
10546
10934
|
* See {@link https://engine.needle.tools/docs/reference/needle-engine-attributes}
|
|
10547
10935
|
*
|
|
10548
|
-
* @example
|
|
10936
|
+
* @example Basic usage
|
|
10937
|
+
* ```html
|
|
10549
10938
|
* <needle-engine src="https://example.com/scene.glb"></needle-engine>
|
|
10550
|
-
*
|
|
10939
|
+
* ```
|
|
10940
|
+
*
|
|
10941
|
+
* @example With camera controls disabled
|
|
10942
|
+
* ```html
|
|
10551
10943
|
* <needle-engine src="https://example.com/scene.glb" camera-controls="false"></needle-engine>
|
|
10944
|
+
* ```
|
|
10945
|
+
*
|
|
10946
|
+
* @see {@link NeedleButtonElement} for adding AR/VR/Quicklook buttons via <needle-button>
|
|
10947
|
+
* @see {@link NeedleMenu} for the built-in menu configuration component
|
|
10552
10948
|
*/
|
|
10553
10949
|
export declare class NeedleEngineWebComponent extends HTMLElement implements INeedleEngineComponent {
|
|
10554
10950
|
static get observedAttributes(): string[];
|
|
@@ -10875,6 +11271,8 @@ declare class NeedleGamepadButton {
|
|
|
10875
11271
|
* @category User Interface
|
|
10876
11272
|
* @group Components
|
|
10877
11273
|
* @see {@link Context.menu} for programmatic menu control
|
|
11274
|
+
* @see {@link NeedleButtonElement} for standalone <needle-button> web component
|
|
11275
|
+
* @see {@link NeedleEngineWebComponent} for the main <needle-engine> element
|
|
10878
11276
|
* @see {@link Voip} adds a microphone button to the menu
|
|
10879
11277
|
* @see {@link ScreenCapture} adds a screen sharing button
|
|
10880
11278
|
**/
|
|
@@ -12096,10 +12494,34 @@ export declare class NetworkedStreams extends EventDispatcher<any> {
|
|
|
12096
12494
|
}
|
|
12097
12495
|
|
|
12098
12496
|
/**
|
|
12099
|
-
* Provides configuration
|
|
12100
|
-
*
|
|
12101
|
-
* It implements the {@link INetworkingWebsocketUrlProvider} interface.
|
|
12497
|
+
* Provides websocket URL configuration for the built-in networking system.
|
|
12498
|
+
* Add this component to override the default networking backend URL used by {@link NetworkConnection} (`this.context.connection`).
|
|
12102
12499
|
*
|
|
12500
|
+
* The component registers itself as a URL provider on `awake()`. When the networking system connects,
|
|
12501
|
+
* it queries this provider for the websocket URL to use instead of the default Needle networking backend.
|
|
12502
|
+
*
|
|
12503
|
+
* **URL resolution order:**
|
|
12504
|
+
* 1. If `urlParameterName` is set and the corresponding URL parameter exists in the browser URL, that value is used
|
|
12505
|
+
* 2. If running on a local network and `localhost` is set, the `localhost` URL is used
|
|
12506
|
+
* 3. Otherwise, the `url` field is used
|
|
12507
|
+
*
|
|
12508
|
+
* Without this component, the default backend URL `wss://networking-2.needle.tools/socket` is used.
|
|
12509
|
+
*
|
|
12510
|
+
* **Note:** This component only configures the websocket URL. To actually join a networked room,
|
|
12511
|
+
* use a `SyncedRoom` component or call `this.context.connection.joinRoom("room-name")` directly.
|
|
12512
|
+
*
|
|
12513
|
+
* @example Overriding the URL via browser parameter
|
|
12514
|
+
* ```ts
|
|
12515
|
+
* // With urlParameterName="server", visiting:
|
|
12516
|
+
* // https://myapp.com/?server=wss://my-server.com/socket
|
|
12517
|
+
* // will connect to that server instead
|
|
12518
|
+
* ```
|
|
12519
|
+
*
|
|
12520
|
+
* @see {@link NetworkConnection} for the main networking API (`this.context.connection`)
|
|
12521
|
+
* @see {@link SyncedRoom} for automatic room joining
|
|
12522
|
+
* @see {@link OwnershipModel} for networked object ownership
|
|
12523
|
+
* @see {@link RoomEvents} for room lifecycle events
|
|
12524
|
+
* @link https://engine.needle.tools/docs/how-to-guides/networking/
|
|
12103
12525
|
* @summary Networking configuration
|
|
12104
12526
|
* @category Networking
|
|
12105
12527
|
* @group Components
|
|
@@ -12108,6 +12530,7 @@ export declare class Networking extends Component implements INetworkingWebsocke
|
|
|
12108
12530
|
/**
|
|
12109
12531
|
* The websocket URL to connect to for networking functionality.
|
|
12110
12532
|
* Can be a complete URL or a relative path that will be resolved against the current origin.
|
|
12533
|
+
* @default null
|
|
12111
12534
|
*/
|
|
12112
12535
|
url: string | null;
|
|
12113
12536
|
/**
|
|
@@ -12218,6 +12641,10 @@ export declare class NoiseModule {
|
|
|
12218
12641
|
apply(_index: number, pos: Vec3, vel: Vec3, _deltaTime: number, age: number, life: number): void;
|
|
12219
12642
|
}
|
|
12220
12643
|
|
|
12644
|
+
/**
|
|
12645
|
+
* Utility type that extracts only non-function property names from a type
|
|
12646
|
+
* @template T The type to extract property names from
|
|
12647
|
+
*/
|
|
12221
12648
|
declare type NonFunctionPropertyNames<T> = {
|
|
12222
12649
|
[K in keyof T]: T[K] extends Function ? never : K;
|
|
12223
12650
|
}[keyof T];
|
|
@@ -12477,7 +12904,40 @@ export declare function onClear(cb: LifecycleMethod, opts?: LifecycleMethodOptio
|
|
|
12477
12904
|
export declare function onDestroy(cb: LifecycleMethod, opts?: LifecycleMethodOptions): () => void;
|
|
12478
12905
|
|
|
12479
12906
|
/**
|
|
12480
|
-
* OneEuroFilter is a
|
|
12907
|
+
* [OneEuroFilter](https://engine.needle.tools/docs/api/OneEuroFilter) is a low-pass filter designed to reduce jitter in noisy signals while maintaining low latency.
|
|
12908
|
+
* 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.
|
|
12909
|
+
*
|
|
12910
|
+
* The filter automatically adapts its smoothing strength based on the signal's velocity:
|
|
12911
|
+
* - When the signal moves slowly, it applies strong smoothing to reduce jitter
|
|
12912
|
+
* - When the signal moves quickly, it reduces smoothing to maintain responsiveness
|
|
12913
|
+
*
|
|
12914
|
+
* Based on the research paper: [1€ Filter: A Simple Speed-based Low-pass Filter for Noisy Input](http://cristal.univ-lille.fr/~casiez/1euro/)
|
|
12915
|
+
*
|
|
12916
|
+
* @example Basic usage with timestamp
|
|
12917
|
+
* ```ts
|
|
12918
|
+
* const filter = new OneEuroFilter(120, 1.0, 0.0);
|
|
12919
|
+
*
|
|
12920
|
+
* // In your update loop:
|
|
12921
|
+
* const smoothedValue = filter.filter(noisyValue, this.context.time.time);
|
|
12922
|
+
* ```
|
|
12923
|
+
*
|
|
12924
|
+
* @example Without timestamps (using frequency estimate)
|
|
12925
|
+
* ```ts
|
|
12926
|
+
* // Assuming 60 FPS update rate
|
|
12927
|
+
* const filter = new OneEuroFilter(60, 1.0, 0.5);
|
|
12928
|
+
*
|
|
12929
|
+
* // Call without timestamp - uses the frequency estimate
|
|
12930
|
+
* const smoothedValue = filter.filter(noisyValue);
|
|
12931
|
+
* ```
|
|
12932
|
+
*
|
|
12933
|
+
* @example Smoothing 3D positions
|
|
12934
|
+
* ```ts
|
|
12935
|
+
* const posFilter = new OneEuroFilterXYZ(90, 0.5, 0.0);
|
|
12936
|
+
*
|
|
12937
|
+
* posFilter.filter(trackedPosition, smoothedPosition, this.context.time.time);
|
|
12938
|
+
* ```
|
|
12939
|
+
*
|
|
12940
|
+
* @see {@link OneEuroFilterXYZ} for filtering 3D vectors
|
|
12481
12941
|
*/
|
|
12482
12942
|
export declare class OneEuroFilter {
|
|
12483
12943
|
/**
|
|
@@ -13963,18 +14423,34 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
13963
14423
|
/* Excluded from this release type: PlayAction */
|
|
13964
14424
|
|
|
13965
14425
|
/**
|
|
13966
|
-
* Plays an animation when clicked.
|
|
14426
|
+
* Plays an animation state when this object is clicked.
|
|
14427
|
+
* Works in the browser and in USDZ/QuickLook (Everywhere Actions).
|
|
14428
|
+
*
|
|
14429
|
+
* Assign an {@link Animator} and a `stateName` to play a specific animation state,
|
|
14430
|
+
* or assign an {@link Animation} component to play a legacy animation clip.
|
|
14431
|
+
*
|
|
14432
|
+
* For USDZ export, the component follows animator state transitions automatically, including looping states.
|
|
14433
|
+
*
|
|
14434
|
+
* @see {@link Animator}for playing animator state machine animations
|
|
14435
|
+
* @see {@link Animation} for playing legacy animation clips
|
|
14436
|
+
* @see {@link PlayAudioOnClick} to play audio when clicked
|
|
14437
|
+
* @see {@link SetActiveOnClick} to toggle visibility when clicked
|
|
14438
|
+
* @see [Everywhere Actions](https://engine.needle.tools/docs/everywhere-actions)
|
|
13967
14439
|
* @summary Plays an animation when clicked
|
|
13968
14440
|
* @category Everywhere Actions
|
|
13969
14441
|
* @group Components
|
|
13970
14442
|
*/
|
|
13971
14443
|
export declare class PlayAnimationOnClick extends Component implements IPointerClickHandler, UsdzBehaviour, UsdzAnimation {
|
|
14444
|
+
/** The {@link Animator} component whose state to play when clicked. */
|
|
13972
14445
|
animator?: Animator;
|
|
14446
|
+
/** The name of the animation state to play. Required when using an {@link Animator}. */
|
|
13973
14447
|
stateName?: string;
|
|
13974
14448
|
trigger: "tap" | "start";
|
|
13975
14449
|
animation?: Animation_2;
|
|
13976
14450
|
private get target();
|
|
13977
|
-
|
|
14451
|
+
onEnable(): void;
|
|
14452
|
+
onDisable(): void;
|
|
14453
|
+
onDestroy(): void;
|
|
13978
14454
|
onPointerEnter(): void;
|
|
13979
14455
|
onPointerExit(): void;
|
|
13980
14456
|
onPointerClick(args: PointerEventData): void;
|
|
@@ -13998,18 +14474,32 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
13998
14474
|
}
|
|
13999
14475
|
|
|
14000
14476
|
/**
|
|
14001
|
-
* Plays an audio clip when clicked.
|
|
14477
|
+
* Plays an audio clip when this object is clicked.
|
|
14478
|
+
* Works in the browser and in USDZ/QuickLook (Everywhere Actions).
|
|
14479
|
+
*
|
|
14480
|
+
* Assign a `target` {@link AudioSource} to use its spatial audio settings, or assign a `clip` URL directly.
|
|
14481
|
+
* If no `target` is assigned, an {@link AudioSource} will be created automatically on this object.
|
|
14482
|
+
*
|
|
14483
|
+
* @see {@link AudioSource}for spatial audio settings
|
|
14484
|
+
* @see {@link PlayAnimationOnClick} to play animations when clicked
|
|
14485
|
+
* @see {@link SetActiveOnClick} to toggle visibility when clicked
|
|
14486
|
+
* @see [Everywhere Actions](https://engine.needle.tools/docs/everywhere-actions)
|
|
14002
14487
|
* @summary Plays an audio clip when clicked
|
|
14003
14488
|
* @category Everywhere Actions
|
|
14004
14489
|
* @group Components
|
|
14005
14490
|
*/
|
|
14006
14491
|
export declare class PlayAudioOnClick extends Component implements IPointerClickHandler, UsdzBehaviour {
|
|
14492
|
+
/** The {@link AudioSource} to use for playback. If not set, one will be created automatically on this object. */
|
|
14007
14493
|
target?: AudioSource;
|
|
14494
|
+
/** URL of the audio clip to play. If not set, the clip assigned to `target` is used. */
|
|
14008
14495
|
clip: string;
|
|
14496
|
+
/** If true, clicking again while the audio is playing will stop it. */
|
|
14009
14497
|
toggleOnClick: boolean;
|
|
14010
14498
|
trigger: "tap" | "start";
|
|
14011
|
-
start(): void;
|
|
14012
14499
|
ensureAudioSource(): void;
|
|
14500
|
+
onEnable(): void;
|
|
14501
|
+
onDisable(): void;
|
|
14502
|
+
onDestroy(): void;
|
|
14013
14503
|
onPointerEnter(): void;
|
|
14014
14504
|
onPointerExit(): void;
|
|
14015
14505
|
onPointerClick(args: PointerEventData): void;
|
|
@@ -14691,9 +15181,16 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14691
15181
|
constructor(reason: string);
|
|
14692
15182
|
}
|
|
14693
15183
|
|
|
14694
|
-
|
|
15184
|
+
/**
|
|
15185
|
+
* Represents a single material property override with optional texture transformation
|
|
15186
|
+
* @template T The type of the property value
|
|
15187
|
+
*/
|
|
15188
|
+
declare interface PropertyBlockOverride<T extends MaterialPropertyType = MaterialPropertyType> {
|
|
15189
|
+
/** The name of the material property to override (e.g., "color", "map", "roughness") */
|
|
14695
15190
|
name: string;
|
|
14696
|
-
value
|
|
15191
|
+
/** The value to set for this property */
|
|
15192
|
+
value: T;
|
|
15193
|
+
/** Optional texture coordinate transformation (only used when value is a Texture) */
|
|
14697
15194
|
textureTransform?: TextureTransform;
|
|
14698
15195
|
}
|
|
14699
15196
|
|
|
@@ -15115,20 +15612,50 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15115
15612
|
export declare class ReflectionProbe extends Component {
|
|
15116
15613
|
private static _probes;
|
|
15117
15614
|
static isUsingReflectionProbe(material: Material): boolean;
|
|
15615
|
+
/**
|
|
15616
|
+
* Event invoked when a reflection probe is enabled. Used internally by Renderer components to update probes when they become active. Not recommended to call this directly in most cases.
|
|
15617
|
+
*/
|
|
15618
|
+
static readonly onEnabled: EventList<ReflectionProbe>;
|
|
15619
|
+
static readonly onDisabled: EventList<ReflectionProbe>;
|
|
15620
|
+
/**
|
|
15621
|
+
* Gets the active reflection probe for the given object and context. If `isAnchor` is true, it will only return a probe if the object is the anchor of that probe. Otherwise, it checks if the object is within the probe's influence area.
|
|
15622
|
+
*
|
|
15623
|
+
* Note: This method is used internally by the Renderer component to determine which reflection probe to apply. It is not recommended to call this method directly in most cases. Instead, assign probes to renderers using the "anchor" property or rely on automatic assignment when supported.
|
|
15624
|
+
* Note: Volume-based automatic assignment is not fully supported yet, so explicit assignment is recommended for now.
|
|
15625
|
+
*
|
|
15626
|
+
* @param object The object to find a reflection probe for
|
|
15627
|
+
* @param context The context to search within
|
|
15628
|
+
* @param isAnchor If true, only return a probe if the object is the anchor of that probe
|
|
15629
|
+
* @param anchor Optional anchor object to match against probes
|
|
15630
|
+
*/
|
|
15118
15631
|
static get(object: Object3D | null | undefined, context: Context, isAnchor: boolean, anchor?: Object3D): ReflectionProbe | null;
|
|
15119
15632
|
private _texture;
|
|
15633
|
+
private _textureUrlInFlight?;
|
|
15120
15634
|
set texture(tex: Texture);
|
|
15121
15635
|
get texture(): Texture;
|
|
15636
|
+
intensity: number;
|
|
15637
|
+
/**
|
|
15638
|
+
* Defines the center and size of the reflection probe's influence area.
|
|
15639
|
+
*/
|
|
15122
15640
|
center?: Vector3;
|
|
15641
|
+
/**
|
|
15642
|
+
* Defines the size of the reflection probe's influence area. Objects within this box will be affected by the probe's reflections.
|
|
15643
|
+
*/
|
|
15123
15644
|
size?: Vector3;
|
|
15645
|
+
/**
|
|
15646
|
+
* Workaround for lightmap. Compensates for the fact that lightmaps are pre-multiplied by intensity, while reflection probes are not. This means that if you use both lightmaps and reflection probes, you may need to adjust this value to get the correct balance between them. The default value of `Math.PI` is a good starting point for most cases, but you may need to tweak it based on your specific lighting setup and artistic needs.
|
|
15647
|
+
*/
|
|
15648
|
+
__lightmapIntensityScale: boolean;
|
|
15124
15649
|
private _boxHelper?;
|
|
15125
15650
|
private isInBox;
|
|
15126
15651
|
constructor();
|
|
15127
15652
|
awake(): void;
|
|
15653
|
+
onEnable(): void;
|
|
15654
|
+
onDisable(): void;
|
|
15128
15655
|
start(): void;
|
|
15129
15656
|
onDestroy(): void;
|
|
15130
|
-
|
|
15131
|
-
|
|
15657
|
+
apply(object: Object3D): void;
|
|
15658
|
+
unapply(obj: Object3D): void;
|
|
15132
15659
|
}
|
|
15133
15660
|
|
|
15134
15661
|
declare enum ReflectionProbeUsage {
|
|
@@ -15450,6 +15977,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15450
15977
|
onEnable(): void;
|
|
15451
15978
|
onDisable(): void;
|
|
15452
15979
|
onDestroy(): void;
|
|
15980
|
+
private readonly onReflectionProbeEnabled;
|
|
15981
|
+
private onReflectionProbeDisabled;
|
|
15453
15982
|
onBeforeRender(): void;
|
|
15454
15983
|
private onBeforeRenderThree;
|
|
15455
15984
|
onAfterRender(): void;
|
|
@@ -16991,8 +17520,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
16991
17520
|
/* Excluded from this release type: onEnable */
|
|
16992
17521
|
/* Excluded from this release type: onDisable */
|
|
16993
17522
|
/* Excluded from this release type: update */
|
|
16994
|
-
private readonly rendererMaterials;
|
|
16995
|
-
private readonly rendererMaterialsOriginal;
|
|
16996
17523
|
private updateDirection;
|
|
16997
17524
|
/**
|
|
16998
17525
|
* Update the alpha of the object's materials towards the target alpha over the given duration.
|
|
@@ -17088,17 +17615,28 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
17088
17615
|
export declare function setActive(go: Object3D, active: boolean | number): boolean;
|
|
17089
17616
|
|
|
17090
17617
|
/**
|
|
17091
|
-
*
|
|
17618
|
+
* Shows or hides a target object when this object is clicked.
|
|
17619
|
+
* Works in the browser and in USDZ/QuickLook (Everywhere Actions).
|
|
17620
|
+
*
|
|
17621
|
+
* Optionally hides itself after being clicked (`hideSelf`), or toggles the target's visibility on each click (`toggleOnClick`).
|
|
17622
|
+
*
|
|
17623
|
+
* @see {@link HideOnStart}to hide an object when the scene starts
|
|
17624
|
+
* @see {@link PlayAnimationOnClick} to play animations when clicked
|
|
17625
|
+
* @see {@link ChangeMaterialOnClick} to change material when clicked
|
|
17626
|
+
* @see [Everywhere Actions](https://engine.needle.tools/docs/everywhere-actions)
|
|
17092
17627
|
* @summary Sets the active state of an object when clicked
|
|
17093
17628
|
* @category Everywhere Actions
|
|
17094
17629
|
* @group Components
|
|
17095
17630
|
*/
|
|
17096
17631
|
export declare class SetActiveOnClick extends Component implements IPointerClickHandler, UsdzBehaviour {
|
|
17632
|
+
/** The target object to show or hide. */
|
|
17097
17633
|
target?: Object3D;
|
|
17634
|
+
/** If true, the target's visibility will be toggled on each click. When enabled, `hideSelf` and `targetState` are ignored. */
|
|
17098
17635
|
toggleOnClick: boolean;
|
|
17636
|
+
/** The visibility state to apply to the target when clicked. Only used when `toggleOnClick` is false. */
|
|
17099
17637
|
targetState: boolean;
|
|
17638
|
+
/** If true, this object will hide itself after being clicked. Only used when `toggleOnClick` is false. */
|
|
17100
17639
|
hideSelf: boolean;
|
|
17101
|
-
start(): void;
|
|
17102
17640
|
onPointerEnter(): void;
|
|
17103
17641
|
onPointerExit(): void;
|
|
17104
17642
|
onPointerClick(args: PointerEventData): void;
|
|
@@ -19078,7 +19616,12 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19078
19616
|
export declare type SyncInstantiateOptions = IInstantiateOptions & Pick<IModel, "deleteOnDisconnect">;
|
|
19079
19617
|
|
|
19080
19618
|
/**
|
|
19081
|
-
* Triggers
|
|
19619
|
+
* Triggers a {@link PreliminaryAction} (such as {@link VisibilityAction}) when the object is tapped or clicked.
|
|
19620
|
+
* Works in the browser and in USDZ/QuickLook (Everywhere Actions).
|
|
19621
|
+
*
|
|
19622
|
+
* @see {@link VisibilityAction} for controlling object visibility on tap
|
|
19623
|
+
* @see {@link SetActiveOnClick} for a combined trigger and action component
|
|
19624
|
+
* @see [Everywhere Actions](https://engine.needle.tools/docs/everywhere-actions)
|
|
19082
19625
|
* @summary Triggers an action when the object is tapped/clicked
|
|
19083
19626
|
* @category Everywhere Actions
|
|
19084
19627
|
* @group Components
|
|
@@ -19201,6 +19744,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19201
19744
|
private getTextOpts;
|
|
19202
19745
|
onEnable(): void;
|
|
19203
19746
|
onDisable(): void;
|
|
19747
|
+
onDestroy(): void;
|
|
19204
19748
|
private getAlignment;
|
|
19205
19749
|
private feedText;
|
|
19206
19750
|
private _didHandleTextRenderOnTop;
|
|
@@ -19318,8 +19862,13 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19318
19862
|
/**@obsolete use Graphics.textureToCanvas */
|
|
19319
19863
|
export declare function textureToCanvas(texture: Texture, force?: boolean): HTMLCanvasElement | null;
|
|
19320
19864
|
|
|
19865
|
+
/**
|
|
19866
|
+
* Defines offset and repeat transformations for texture coordinates
|
|
19867
|
+
*/
|
|
19321
19868
|
declare interface TextureTransform {
|
|
19869
|
+
/** UV offset applied to the texture */
|
|
19322
19870
|
offset?: Vector2;
|
|
19871
|
+
/** UV repeat/scale applied to the texture */
|
|
19323
19872
|
repeat?: Vector2;
|
|
19324
19873
|
}
|
|
19325
19874
|
|
|
@@ -20588,7 +21137,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20588
21137
|
* scene.add(viewBox);
|
|
20589
21138
|
* ```
|
|
20590
21139
|
*
|
|
20591
|
-
* @see {@link
|
|
21140
|
+
* @see {@link CameraComponent} - The camera component that ViewBox controls
|
|
20592
21141
|
* @see {@link OrbitControls} - Camera controls that work alongside ViewBox
|
|
20593
21142
|
* @see {@link DragControls} - Alternative camera controls compatible with ViewBox
|
|
20594
21143
|
* @see {@link LookAtConstraint} - Another way to control camera targeting
|
|
@@ -20623,7 +21172,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20623
21172
|
* as they would appear with that field of view. Setting it to a wider FOV (e.g., 90) makes objects appear
|
|
20624
21173
|
* smaller, while a narrower FOV (e.g., 30) makes them appear larger.
|
|
20625
21174
|
*
|
|
20626
|
-
* @see {@link
|
|
21175
|
+
* @see {@link CameraComponent} for the camera component and its FOV property
|
|
20627
21176
|
* @default -1 (automatically uses the camera's FOV on the first frame)
|
|
20628
21177
|
*/
|
|
20629
21178
|
referenceFieldOfView: number;
|
|
@@ -20712,13 +21261,20 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20712
21261
|
}
|
|
20713
21262
|
|
|
20714
21263
|
/**
|
|
20715
|
-
*
|
|
21264
|
+
* Action to show or hide an object.
|
|
21265
|
+
* Use together with a {@link TapGestureTrigger} to show or hide objects when tapped or clicked.
|
|
21266
|
+
*
|
|
21267
|
+
* @see {@link TapGestureTrigger} to trigger actions on tap/click
|
|
21268
|
+
* @see {@link SetActiveOnClick} for a combined trigger and action component
|
|
21269
|
+
* @see [Everywhere Actions](https://engine.needle.tools/docs/everywhere-actions)
|
|
20716
21270
|
* @summary Hides or shows the object when clicked
|
|
20717
21271
|
* @category Everywhere Actions
|
|
20718
21272
|
* @group Components
|
|
20719
21273
|
*/
|
|
20720
21274
|
export declare class VisibilityAction extends PreliminaryAction {
|
|
21275
|
+
/** The type of visibility action to apply. */
|
|
20721
21276
|
type: VisibilityActionType;
|
|
21277
|
+
/** The duration of the fade animation in seconds. */
|
|
20722
21278
|
duration: number;
|
|
20723
21279
|
getType(): "show" | "hide";
|
|
20724
21280
|
getDuration(): number;
|
|
@@ -22154,6 +22710,88 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22154
22710
|
export { }
|
|
22155
22711
|
|
|
22156
22712
|
|
|
22713
|
+
declare global {
|
|
22714
|
+
interface HTMLElementTagNameMap {
|
|
22715
|
+
"needle-engine": NeedleEngineWebComponent;
|
|
22716
|
+
}
|
|
22717
|
+
}
|
|
22718
|
+
|
|
22719
|
+
|
|
22720
|
+
declare global {
|
|
22721
|
+
interface Navigator {
|
|
22722
|
+
userActivation?: {
|
|
22723
|
+
isActive: boolean;
|
|
22724
|
+
};
|
|
22725
|
+
}
|
|
22726
|
+
}
|
|
22727
|
+
|
|
22728
|
+
export declare namespace NEEDLE_ENGINE_FEATURE_FLAGS {
|
|
22729
|
+
let experimentalSmartHierarchyUpdate: boolean;
|
|
22730
|
+
}
|
|
22731
|
+
|
|
22732
|
+
/**
|
|
22733
|
+
* External dependencies that are loaded on demand either by the engine automatically when needed or they can be loaded manually by calling the `load` function.
|
|
22734
|
+
*
|
|
22735
|
+
* Use the `ready` function to wait for the module to be loaded if you do not wand to trigger a load.
|
|
22736
|
+
*
|
|
22737
|
+
* If a module is already loaded it's also available in the `MODULE` variable.
|
|
22738
|
+
*/
|
|
22739
|
+
export declare namespace MODULES {
|
|
22740
|
+
namespace MaterialX {
|
|
22741
|
+
type TYPE = typeof import("@needle-tools/materialx");
|
|
22742
|
+
let MODULE: TYPE;
|
|
22743
|
+
let MAYBEMODULE: TYPE | null;
|
|
22744
|
+
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
22745
|
+
function ready(): Promise<TYPE>;
|
|
22746
|
+
/** Load the module */
|
|
22747
|
+
function load(): Promise<TYPE>;
|
|
22748
|
+
}
|
|
22749
|
+
namespace RAPIER_PHYSICS {
|
|
22750
|
+
type TYPE = typeof import("@dimforge/rapier3d-compat");
|
|
22751
|
+
let MODULE: TYPE;
|
|
22752
|
+
let MAYBEMODULE: TYPE | null;
|
|
22753
|
+
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
22754
|
+
function ready(): Promise<TYPE>;
|
|
22755
|
+
/** Load the module */
|
|
22756
|
+
function load(): Promise<TYPE>;
|
|
22757
|
+
}
|
|
22758
|
+
namespace POSTPROCESSING {
|
|
22759
|
+
type TYPE = typeof import("postprocessing");
|
|
22760
|
+
let MODULE: TYPE;
|
|
22761
|
+
let MAYBEMODULE: TYPE | null;
|
|
22762
|
+
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
22763
|
+
function ready(): Promise<TYPE>;
|
|
22764
|
+
/** Load the module */
|
|
22765
|
+
function load(): Promise<TYPE>;
|
|
22766
|
+
}
|
|
22767
|
+
namespace POSTPROCESSING_AO {
|
|
22768
|
+
type TYPE = typeof import("n8ao");
|
|
22769
|
+
let MODULE: TYPE;
|
|
22770
|
+
let MAYBEMODULE: TYPE | null;
|
|
22771
|
+
/** Wait for the module to be loaded (doesn't trigger a load) */
|
|
22772
|
+
function ready(): Promise<TYPE>;
|
|
22773
|
+
/** Load the module */
|
|
22774
|
+
function load(): Promise<TYPE>;
|
|
22775
|
+
}
|
|
22776
|
+
}
|
|
22777
|
+
|
|
22778
|
+
|
|
22779
|
+
export declare namespace PreviewHelper {
|
|
22780
|
+
type PreviewInfo = {
|
|
22781
|
+
position?: Vector3Like | Vec3;
|
|
22782
|
+
size?: Vector3Like | Vec3;
|
|
22783
|
+
};
|
|
22784
|
+
function addPreview(params: {
|
|
22785
|
+
parent: Object3D;
|
|
22786
|
+
guid: string;
|
|
22787
|
+
} & PreviewInfo): {
|
|
22788
|
+
object: Object3D;
|
|
22789
|
+
onProgress: (downloadProgress: number) => void;
|
|
22790
|
+
};
|
|
22791
|
+
function removePreview(guid: string): void;
|
|
22792
|
+
}
|
|
22793
|
+
|
|
22794
|
+
|
|
22157
22795
|
declare module 'three' {
|
|
22158
22796
|
interface SkinnedMesh {
|
|
22159
22797
|
staticGenerator?: StaticGeometryGenerator;
|
|
@@ -22176,6 +22814,55 @@ declare module 'three' {
|
|
|
22176
22814
|
}
|
|
22177
22815
|
|
|
22178
22816
|
|
|
22817
|
+
declare global {
|
|
22818
|
+
interface NavigatorUAData {
|
|
22819
|
+
platform: string;
|
|
22820
|
+
}
|
|
22821
|
+
interface Navigator {
|
|
22822
|
+
userAgentData?: NavigatorUAData;
|
|
22823
|
+
}
|
|
22824
|
+
}
|
|
22825
|
+
|
|
22826
|
+
|
|
22827
|
+
/**
|
|
22828
|
+
* Utility functions to detect certain device types (mobile, desktop), browsers, or capabilities.
|
|
22829
|
+
* @category Utilities
|
|
22830
|
+
*/
|
|
22831
|
+
export declare namespace DeviceUtilities {
|
|
22832
|
+
/** @returns `true` for MacOS or Windows devices. `false` for Hololens and other headsets. */
|
|
22833
|
+
function isDesktop(): boolean;
|
|
22834
|
+
/** @returns `true` if it's a phone or tablet */
|
|
22835
|
+
function isMobileDevice(): boolean;
|
|
22836
|
+
/** @deprecated use {@link isiPad} instead */
|
|
22837
|
+
function isIPad(): boolean;
|
|
22838
|
+
/** @returns `true` if we're currently on an iPad */
|
|
22839
|
+
function isiPad(): boolean;
|
|
22840
|
+
/** @returns `true` if we're currently on an Android device */
|
|
22841
|
+
function isAndroidDevice(): boolean;
|
|
22842
|
+
/** @returns `true` if we're currently using the Mozilla XR Browser (only available for iOS) */
|
|
22843
|
+
function isMozillaXR(): boolean;
|
|
22844
|
+
/** @returns `true` if we're currently in the Needle App Clip */
|
|
22845
|
+
function isNeedleAppClip(): boolean;
|
|
22846
|
+
/** @returns `true` for MacOS devices */
|
|
22847
|
+
function isMacOS(): boolean;
|
|
22848
|
+
/** @returns `true` for VisionOS devices */
|
|
22849
|
+
function isVisionOS(): boolean;
|
|
22850
|
+
/** @returns `true` for mobile Apple devices like iPad, iPhone, iPod, Vision Pro, ... */
|
|
22851
|
+
function isiOS(): boolean;
|
|
22852
|
+
/** @returns `true` if we're currently on safari */
|
|
22853
|
+
function isSafari(): boolean;
|
|
22854
|
+
/** @returns `true` for Meta Quest devices and browser. */
|
|
22855
|
+
function isQuest(): boolean;
|
|
22856
|
+
/** @returns `true` if the browser has `<a rel="ar">` support, which indicates USDZ QuickLook support. */
|
|
22857
|
+
function supportsQuickLookAR(): boolean;
|
|
22858
|
+
/** @returns `true` if the user allowed to use the microphone */
|
|
22859
|
+
function microphonePermissionsGranted(): Promise<boolean>;
|
|
22860
|
+
function getiOSVersion(): string | null;
|
|
22861
|
+
function getChromeVersion(): string | null;
|
|
22862
|
+
function getSafariVersion(): string | null;
|
|
22863
|
+
}
|
|
22864
|
+
|
|
22865
|
+
|
|
22179
22866
|
declare module 'three/examples/jsm/controls/OrbitControls.js' {
|
|
22180
22867
|
interface OrbitControls {
|
|
22181
22868
|
_sphericalDelta: import("three").Spherical;
|
|
@@ -22191,6 +22878,120 @@ declare module 'three/examples/jsm/controls/OrbitControls.js' {
|
|
|
22191
22878
|
}
|
|
22192
22879
|
|
|
22193
22880
|
|
|
22881
|
+
declare global {
|
|
22882
|
+
interface ViewTimeline {
|
|
22883
|
+
axis: 'block' | 'inline';
|
|
22884
|
+
currentTime: {
|
|
22885
|
+
unit: 'seconds' | 'percent';
|
|
22886
|
+
value: number;
|
|
22887
|
+
};
|
|
22888
|
+
duration: {
|
|
22889
|
+
unit: 'seconds' | 'percent';
|
|
22890
|
+
value: number;
|
|
22891
|
+
};
|
|
22892
|
+
source: Element | null;
|
|
22893
|
+
startOffset: {
|
|
22894
|
+
unit: 'px';
|
|
22895
|
+
value: number;
|
|
22896
|
+
};
|
|
22897
|
+
endOffset: {
|
|
22898
|
+
unit: 'px';
|
|
22899
|
+
value: number;
|
|
22900
|
+
};
|
|
22901
|
+
}
|
|
22902
|
+
}
|
|
22903
|
+
|
|
22904
|
+
|
|
22905
|
+
declare global {
|
|
22906
|
+
interface Window {
|
|
22907
|
+
SPECTOR?: {
|
|
22908
|
+
Spector: new () => Spector;
|
|
22909
|
+
};
|
|
22910
|
+
}
|
|
22911
|
+
interface Spector {
|
|
22912
|
+
displayUI: () => void;
|
|
22913
|
+
setCanvas: (canvas: HTMLCanvasElement) => void;
|
|
22914
|
+
spyCanvases: boolean;
|
|
22915
|
+
startCaptureOnNextFrame: () => void;
|
|
22916
|
+
captureCanvas: (canvas: HTMLCanvasElement) => any;
|
|
22917
|
+
}
|
|
22918
|
+
}
|
|
22919
|
+
|
|
22920
|
+
|
|
22921
|
+
declare global {
|
|
22922
|
+
interface HTMLElementTagNameMap {
|
|
22923
|
+
"needle-logo-element": NeedleLogoElement;
|
|
22924
|
+
}
|
|
22925
|
+
}
|
|
22926
|
+
|
|
22927
|
+
|
|
22928
|
+
export declare namespace MaterialX {
|
|
22929
|
+
/**
|
|
22930
|
+
* Utility function to load a MaterialX material from a URL. This can be used in your own code to load MaterialX materials outside of the glTF loading process. The URL should point to a MaterialX XML file.
|
|
22931
|
+
*/
|
|
22932
|
+
function loadFromUrl(urlOrXML: string, opts?: {
|
|
22933
|
+
url?: string;
|
|
22934
|
+
loadingManager?: LoadingManager;
|
|
22935
|
+
materialNameOrIndex?: number | string;
|
|
22936
|
+
}): Promise<import("three").Material | null>;
|
|
22937
|
+
}
|
|
22938
|
+
|
|
22939
|
+
/**
|
|
22940
|
+
* @internal
|
|
22941
|
+
*/
|
|
22942
|
+
export declare namespace InternalAttributeUtils {
|
|
22943
|
+
/**
|
|
22944
|
+
* Checks if the given value is considered "falsey" in the context of HTML attributes.
|
|
22945
|
+
* A value is considered falsey if it is "0" or "false" (case-insensitive).
|
|
22946
|
+
*
|
|
22947
|
+
* @param value - The attribute value to check.
|
|
22948
|
+
* @returns True if the value is falsey, otherwise false.
|
|
22949
|
+
*/
|
|
22950
|
+
function isFalsey(value: string | null): boolean;
|
|
22951
|
+
/**
|
|
22952
|
+
* Retrieves the value of the specified attribute from the given element.
|
|
22953
|
+
* If the attribute value is considered falsey, it returns null.
|
|
22954
|
+
* @returns The attribute value or null if falsey.
|
|
22955
|
+
*/
|
|
22956
|
+
function getAttributeValueIfNotFalsey(element: Element, attributeName: string, opts?: {
|
|
22957
|
+
onAttribute: (value: string) => void;
|
|
22958
|
+
}): string | null;
|
|
22959
|
+
/**
|
|
22960
|
+
* Retrieves the value of the specified attribute from the given element.
|
|
22961
|
+
* If the attribute value is considered falsey, it returns false.
|
|
22962
|
+
* If the attribute is not set at all, it returns null.
|
|
22963
|
+
* @returns The attribute value, false if falsey, or null if not set.
|
|
22964
|
+
*
|
|
22965
|
+
* @example
|
|
22966
|
+
* ```typescript
|
|
22967
|
+
* const result = HTMLAttributeUtils.getAttributeAndCheckFalsey(element, 'data-example', {
|
|
22968
|
+
* onAttribute: (value, falsey) => {
|
|
22969
|
+
* console.log(`Attribute value: ${value}
|
|
22970
|
+
* , Is falsey: ${falsey}`);
|
|
22971
|
+
* }
|
|
22972
|
+
* });
|
|
22973
|
+
*
|
|
22974
|
+
* if (result === false) {
|
|
22975
|
+
* console.log('The attribute is set to a falsey value.');
|
|
22976
|
+
* } else if (result === null) {
|
|
22977
|
+
* console.log('The attribute is not set.');
|
|
22978
|
+
* } else {
|
|
22979
|
+
* console.log(`The attribute value is: ${result}`);
|
|
22980
|
+
* }
|
|
22981
|
+
* ```
|
|
22982
|
+
*/
|
|
22983
|
+
function getAttributeAndCheckFalsey(element: Element, attributeName: string, opts?: {
|
|
22984
|
+
onAttribute: (value: string, falsey: boolean) => void;
|
|
22985
|
+
}): false | string | null;
|
|
22986
|
+
}
|
|
22987
|
+
|
|
22988
|
+
declare global {
|
|
22989
|
+
interface HTMLElementTagNameMap {
|
|
22990
|
+
"needle-button": NeedleButtonElement;
|
|
22991
|
+
}
|
|
22992
|
+
}
|
|
22993
|
+
|
|
22994
|
+
|
|
22194
22995
|
declare module 'three' {
|
|
22195
22996
|
interface Object3D {
|
|
22196
22997
|
get guid(): string | undefined;
|
|
@@ -22331,8 +23132,52 @@ declare module 'three' {
|
|
|
22331
23132
|
}
|
|
22332
23133
|
|
|
22333
23134
|
|
|
23135
|
+
/**
|
|
23136
|
+
* @category Splines
|
|
23137
|
+
* @see {@link SplineContainer} for the main spline component that defines the path and knots
|
|
23138
|
+
*/
|
|
23139
|
+
export declare namespace SplineUtils {
|
|
23140
|
+
/**
|
|
23141
|
+
* Creates a SplineContainer from an array of points.
|
|
23142
|
+
* @param positions The positions of the knots.
|
|
23143
|
+
* @param closed Whether the spline is closed (the last knot connects to the first).
|
|
23144
|
+
* @param tension The tension of the spline. 0 is no tension, 1 is high tension (straight lines between knots). Default is 0.75.
|
|
23145
|
+
* @return The created SplineContainer component - add it to an Object3D to use it.
|
|
23146
|
+
*/
|
|
23147
|
+
function createFromPoints(positions: Vector3[], closed?: boolean, tension?: number): SplineContainer;
|
|
23148
|
+
}
|
|
23149
|
+
|
|
23150
|
+
declare global {
|
|
23151
|
+
interface HTMLElementTagNameMap {
|
|
23152
|
+
"needle-logo-element": NeedleLogoElement;
|
|
23153
|
+
}
|
|
23154
|
+
}
|
|
23155
|
+
|
|
23156
|
+
|
|
23157
|
+
/**
|
|
23158
|
+
* Internal registry for USDZ exporters. This is used by NeedleXRSession.start("immersive-ar")
|
|
23159
|
+
*/
|
|
23160
|
+
export declare namespace InternalUSDZRegistry {
|
|
23161
|
+
function exportAndOpen(): boolean;
|
|
23162
|
+
function registerExporter(exporter: USDZExporter): void;
|
|
23163
|
+
function unregisterExporter(exporter: USDZExporter): void;
|
|
23164
|
+
}
|
|
23165
|
+
|
|
23166
|
+
|
|
22334
23167
|
declare module 'three' {
|
|
22335
23168
|
interface Vector3 {
|
|
22336
23169
|
slerp(end: Vector3, t: number): Vector3;
|
|
22337
23170
|
}
|
|
22338
23171
|
}
|
|
23172
|
+
|
|
23173
|
+
export declare namespace LCP {
|
|
23174
|
+
function observe(): void;
|
|
23175
|
+
}
|
|
23176
|
+
|
|
23177
|
+
/**
|
|
23178
|
+
* @param args - The arguments to initialize the performance analytics with.
|
|
23179
|
+
*/
|
|
23180
|
+
export declare module NeedleEnginePerformanceAnalytics {
|
|
23181
|
+
function init(...args: Array<"lcp">): void;
|
|
23182
|
+
}
|
|
23183
|
+
|