@needle-tools/engine 4.13.1 → 4.14.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/components.needle.json +1 -1
  3. package/dist/generateMeshBVH.worker-DiCnZlf3.js +21 -0
  4. package/dist/gltf-progressive-Bm_6aEi4.js +1528 -0
  5. package/dist/gltf-progressive-BttGBXw6.umd.cjs +10 -0
  6. package/dist/gltf-progressive-T5WKTux5.min.js +10 -0
  7. package/dist/loader.worker-BqODMeeW.js +23 -0
  8. package/dist/{materialx-B9ddsHcF.min.js → materialx-CJyQZtjt.min.js} +1 -1
  9. package/dist/{materialx-fkoFuRh3.js → materialx-DMs1E08Z.js} +2 -2
  10. package/dist/{materialx-BF23AVE8.umd.cjs → materialx-DaKKOoVk.umd.cjs} +1 -1
  11. package/dist/needle-engine.bundle-BW2VusZV.min.js +1646 -0
  12. package/dist/{needle-engine.bundle-tjI5Fq2c.umd.cjs → needle-engine.bundle-Cb5bKEqa.umd.cjs} +152 -159
  13. package/dist/{needle-engine.bundle-DauZUYl7.js → needle-engine.bundle-D9VPvp5o.js} +7798 -7497
  14. package/dist/needle-engine.d.ts +779 -42
  15. package/dist/needle-engine.js +416 -415
  16. package/dist/needle-engine.min.js +1 -1
  17. package/dist/needle-engine.umd.cjs +1 -1
  18. package/dist/{postprocessing-BVNrgYZK.min.js → postprocessing-CctM1XIO.min.js} +1 -1
  19. package/dist/{postprocessing-DdM-tz1j.js → postprocessing-DGm6qJ-I.js} +2 -2
  20. package/dist/{postprocessing-CI2TjWpu.umd.cjs → postprocessing-Dbl2PJpd.umd.cjs} +1 -1
  21. package/dist/{three-BW2s1Yl-.umd.cjs → three-BjYim-vL.umd.cjs} +4 -4
  22. package/dist/{three-VvRoMeIN.js → three-Bvk2VKbF.js} +4210 -4210
  23. package/dist/{three-I__hSXzr.min.js → three-IG2qPafA.min.js} +33 -33
  24. package/dist/{three-examples-Bpfu6ke_.umd.cjs → three-examples-BMmNgNCN.umd.cjs} +1 -1
  25. package/dist/{three-examples-BhfOE7NG.js → three-examples-CMYCd5nH.js} +1 -1
  26. package/dist/{three-examples-D8zAE_7t.min.js → three-examples-CQl1fFZp.min.js} +1 -1
  27. package/dist/{three-mesh-ui-C3QbemOV.min.js → three-mesh-ui-5HVE2RV-.min.js} +1 -1
  28. package/dist/{three-mesh-ui-CcMp-FQm.js → three-mesh-ui-BlakAItG.js} +1 -1
  29. package/dist/{three-mesh-ui-BU55xDxJ.umd.cjs → three-mesh-ui-D828VbQp.umd.cjs} +1 -1
  30. package/dist/{vendor-DW7zqjuT.min.js → vendor-BxK0WKmT.min.js} +1 -1
  31. package/dist/{vendor-COVQl0b8.umd.cjs → vendor-CIDkyBaO.umd.cjs} +1 -1
  32. package/dist/{vendor-BiyIZ61v.js → vendor-ixwD-vv2.js} +1 -1
  33. package/lib/engine/api.d.ts +1 -0
  34. package/lib/engine/api.js +1 -0
  35. package/lib/engine/api.js.map +1 -1
  36. package/lib/engine/engine_context.js +12 -2
  37. package/lib/engine/engine_context.js.map +1 -1
  38. package/lib/engine/engine_lightdata.js +8 -6
  39. package/lib/engine/engine_lightdata.js.map +1 -1
  40. package/lib/engine/engine_materialpropertyblock.d.ts +259 -0
  41. package/lib/engine/engine_materialpropertyblock.js +682 -0
  42. package/lib/engine/engine_materialpropertyblock.js.map +1 -0
  43. package/lib/engine/engine_utils.d.ts +1 -0
  44. package/lib/engine/engine_utils.js +1 -0
  45. package/lib/engine/engine_utils.js.map +1 -1
  46. package/lib/engine/engine_utils_screenshot.d.ts +171 -14
  47. package/lib/engine/engine_utils_screenshot.js +65 -0
  48. package/lib/engine/engine_utils_screenshot.js.map +1 -1
  49. package/lib/engine/engine_utils_screenshot.xr.d.ts +1 -1
  50. package/lib/engine/engine_utils_screenshot.xr.js +1 -1
  51. package/lib/engine/extensions/NEEDLE_techniques_webgl.js +3 -0
  52. package/lib/engine/extensions/NEEDLE_techniques_webgl.js.map +1 -1
  53. package/lib/engine/xr/NeedleXRSession.d.ts +5 -0
  54. package/lib/engine/xr/NeedleXRSession.js +5 -0
  55. package/lib/engine/xr/NeedleXRSession.js.map +1 -1
  56. package/lib/engine-components/Camera.js.map +1 -1
  57. package/lib/engine-components/DropListener.js.map +1 -1
  58. package/lib/engine-components/Duplicatable.js.map +1 -1
  59. package/lib/engine-components/GroundProjection.js.map +1 -1
  60. package/lib/engine-components/NeedleMenu.js.map +1 -1
  61. package/lib/engine-components/NestedGltf.js.map +1 -1
  62. package/lib/engine-components/ReflectionProbe.d.ts +32 -4
  63. package/lib/engine-components/ReflectionProbe.js +58 -88
  64. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  65. package/lib/engine-components/Renderer.d.ts +2 -0
  66. package/lib/engine-components/Renderer.js +30 -6
  67. package/lib/engine-components/Renderer.js.map +1 -1
  68. package/lib/engine-components/RendererLightmap.d.ts +13 -9
  69. package/lib/engine-components/RendererLightmap.js +67 -81
  70. package/lib/engine-components/RendererLightmap.js.map +1 -1
  71. package/lib/engine-components/SeeThrough.d.ts +0 -2
  72. package/lib/engine-components/SeeThrough.js +114 -88
  73. package/lib/engine-components/SeeThrough.js.map +1 -1
  74. package/lib/engine-components/SmoothFollow.js.map +1 -1
  75. package/lib/engine-components/VideoPlayer.js +6 -0
  76. package/lib/engine-components/VideoPlayer.js.map +1 -1
  77. package/lib/engine-components/ui/Button.js.map +1 -1
  78. package/lib/engine-components/ui/Raycaster.js.map +1 -1
  79. package/lib/engine-components/utils/OpenURL.d.ts +1 -0
  80. package/lib/engine-components/utils/OpenURL.js +1 -0
  81. package/lib/engine-components/utils/OpenURL.js.map +1 -1
  82. package/lib/engine-components/web/CursorFollow.d.ts +1 -0
  83. package/lib/engine-components/web/CursorFollow.js +1 -0
  84. package/lib/engine-components/web/CursorFollow.js.map +1 -1
  85. package/lib/engine-components/web/ScrollFollow.d.ts +1 -0
  86. package/lib/engine-components/web/ScrollFollow.js +1 -0
  87. package/lib/engine-components/web/ScrollFollow.js.map +1 -1
  88. package/lib/engine-components/web/ViewBox.d.ts +2 -2
  89. package/lib/engine-components/web/ViewBox.js +2 -2
  90. package/lib/engine-components/web/ViewBox.js.map +1 -1
  91. package/lib/engine-components/webxr/WebARCameraBackground.d.ts +9 -0
  92. package/lib/engine-components/webxr/WebARCameraBackground.js +9 -0
  93. package/lib/engine-components/webxr/WebARCameraBackground.js.map +1 -1
  94. package/lib/engine-components/webxr/WebXR.d.ts +1 -0
  95. package/lib/engine-components/webxr/WebXR.js +1 -0
  96. package/lib/engine-components/webxr/WebXR.js.map +1 -1
  97. package/lib/engine-components/webxr/WebXRPlaneTracking.js.map +1 -1
  98. package/lib/engine-components/webxr/controllers/XRControllerFollow.js.map +1 -1
  99. package/lib/engine-components/webxr/controllers/XRControllerMovement.js.map +1 -1
  100. package/package.json +5 -5
  101. package/plugins/vite/build-pipeline.js +16 -2
  102. package/src/engine/api.ts +1 -0
  103. package/src/engine/engine_context.ts +17 -3
  104. package/src/engine/engine_lightdata.ts +8 -6
  105. package/src/engine/engine_materialpropertyblock.ts +866 -0
  106. package/src/engine/engine_utils.ts +1 -0
  107. package/src/engine/engine_utils_screenshot.ts +241 -17
  108. package/src/engine/engine_utils_screenshot.xr.ts +1 -1
  109. package/src/engine/extensions/NEEDLE_techniques_webgl.ts +3 -0
  110. package/src/engine/xr/NeedleXRSession.ts +5 -0
  111. package/src/engine-components/Camera.ts +2 -2
  112. package/src/engine-components/ContactShadows.ts +1 -1
  113. package/src/engine-components/DropListener.ts +1 -1
  114. package/src/engine-components/Duplicatable.ts +1 -1
  115. package/src/engine-components/GroundProjection.ts +3 -0
  116. package/src/engine-components/NeedleMenu.ts +3 -0
  117. package/src/engine-components/NestedGltf.ts +1 -1
  118. package/src/engine-components/ReflectionProbe.ts +64 -105
  119. package/src/engine-components/Renderer.ts +34 -6
  120. package/src/engine-components/RendererLightmap.ts +75 -87
  121. package/src/engine-components/SeeThrough.ts +124 -109
  122. package/src/engine-components/SmoothFollow.ts +2 -2
  123. package/src/engine-components/VideoPlayer.ts +6 -0
  124. package/src/engine-components/ui/Button.ts +1 -1
  125. package/src/engine-components/ui/Raycaster.ts +1 -1
  126. package/src/engine-components/utils/OpenURL.ts +1 -0
  127. package/src/engine-components/web/CursorFollow.ts +1 -0
  128. package/src/engine-components/web/ScrollFollow.ts +1 -0
  129. package/src/engine-components/web/ViewBox.ts +9 -2
  130. package/src/engine-components/webxr/WebARCameraBackground.ts +12 -3
  131. package/src/engine-components/webxr/WebXR.ts +1 -0
  132. package/src/engine-components/webxr/WebXRPlaneTracking.ts +3 -3
  133. package/src/engine-components/webxr/controllers/XRControllerFollow.ts +1 -1
  134. package/src/engine-components/webxr/controllers/XRControllerMovement.ts +4 -4
  135. package/dist/generateMeshBVH.worker-iyfPIK6R.js +0 -21
  136. package/dist/gltf-progressive-BURrJW0U.umd.cjs +0 -8
  137. package/dist/gltf-progressive-DHLDFNvQ.min.js +0 -8
  138. package/dist/gltf-progressive-eiJCrjLb.js +0 -1400
  139. package/dist/loader.worker-C1GG9A7C.js +0 -23
  140. package/dist/needle-engine.bundle-BNIUpreS.min.js +0 -1653
  141. package/src/include/three/DragControls.js +0 -232
@@ -2029,7 +2029,7 @@ export declare namespace BlobStorage {
2029
2029
  export function upload(file: File, opts?: UploadOptions): Promise<Upload_Result | null>;
2030
2030
  export function getBlobUrlForKey(key: string): string;
2031
2031
  export function download(url: string, progressCallback?: (prog: ProgressEvent) => void): Promise<Uint8Array | null>;
2032
- export {};
2032
+ {};
2033
2033
  }
2034
2034
 
2035
2035
  /**
@@ -4684,6 +4684,7 @@ export declare function createMotion(name: string, id?: InstantiateIdProvider):
4684
4684
  *
4685
4685
  * @summary Makes objects follow the cursor/touch position in 3D space
4686
4686
  * @category Interactivity
4687
+ * @category Web
4687
4688
  * @group Components
4688
4689
  * @component
4689
4690
  */
@@ -5081,6 +5082,7 @@ declare enum DeviceType {
5081
5082
 
5082
5083
  /**
5083
5084
  * Utility functions to detect certain device types (mobile, desktop), browsers, or capabilities.
5085
+ * @category Utilities
5084
5086
  */
5085
5087
  export declare namespace DeviceUtilities {
5086
5088
  /** @returns `true` for MacOS or Windows devices. `false` for Hololens and other headsets. */
@@ -8723,7 +8725,7 @@ export declare namespace InternalScreenshotUtils {
8723
8725
  [key: string]: boolean | number;
8724
8726
  };
8725
8727
  }): FullscreenPlane;
8726
- export {};
8728
+ {};
8727
8729
  }
8728
8730
 
8729
8731
  /* Excluded from this release type: invokeLoadedImportPluginHooks */
@@ -10054,6 +10056,215 @@ export declare class MaskableGraphic extends Graphic {
10054
10056
  protected onAfterCreated(): void;
10055
10057
  }
10056
10058
 
10059
+ /**
10060
+ * MaterialPropertyBlock allows per-object material property overrides without creating new material instances.
10061
+ * This is useful for rendering multiple objects with the same base material but different properties
10062
+ * (e.g., different colors, textures, or shader parameters).
10063
+ *
10064
+ * The property block system works by:
10065
+ * - Temporarily applying overrides in onBeforeRender
10066
+ * - Restoring original values in onAfterRender
10067
+ * - Managing shader defines and program cache keys for correct shader compilation
10068
+ * - Supporting texture coordinate transforms per object
10069
+ *
10070
+ * Common use cases:
10071
+ * - **Lightmaps**: Apply unique lightmap textures to individual objects sharing the same material
10072
+ * - **Reflection Probes**: Apply different environment maps per object for localized reflections
10073
+ * - **See-through effects**: Temporarily override transparency/transmission properties for X-ray effects
10074
+ *
10075
+ * ## Getting a MaterialPropertyBlock
10076
+ *
10077
+ * **Important**: Do not use the constructor directly. Instead, use the static {@link MaterialPropertyBlock.get} method:
10078
+ *
10079
+ * ```typescript
10080
+ * const block = MaterialPropertyBlock.get(myMesh);
10081
+ * ```
10082
+ *
10083
+ * This method will either return an existing property block or create a new one if it doesn't exist.
10084
+ * It automatically:
10085
+ * - Creates the property block instance
10086
+ * - Registers it in the internal registry
10087
+ * - Attaches the necessary render callbacks to the object
10088
+ * - Handles Groups by applying overrides to all child meshes
10089
+ *
10090
+ * @example Basic usage
10091
+ * ```typescript
10092
+ * // Get or create a property block for an object
10093
+ * const block = MaterialPropertyBlock.get(myMesh);
10094
+ *
10095
+ * // Override the color property
10096
+ * block.setOverride("color", new Color(1, 0, 0));
10097
+ *
10098
+ * // Override a texture with custom UV transform (useful for lightmaps)
10099
+ * block.setOverride("lightMap", myLightmapTexture, {
10100
+ * offset: new Vector2(0.5, 0.5),
10101
+ * repeat: new Vector2(2, 2)
10102
+ * });
10103
+ *
10104
+ * // Set a shader define
10105
+ * block.setDefine("USE_CUSTOM_FEATURE", 1);
10106
+ * ```
10107
+ *
10108
+ * @example Lightmap usage
10109
+ * ```typescript
10110
+ * const block = MaterialPropertyBlock.get(mesh);
10111
+ * block.setOverride("lightMap", lightmapTexture);
10112
+ * block.setOverride("lightMapIntensity", 1.5);
10113
+ * ```
10114
+ *
10115
+ * @example See-through effect
10116
+ * ```typescript
10117
+ * const block = MaterialPropertyBlock.get(mesh);
10118
+ * block.setOverride("transparent", true);
10119
+ * block.setOverride("opacity", 0.3);
10120
+ * ```
10121
+ *
10122
+ * @template T The material type this property block is associated with
10123
+ */
10124
+ export declare class MaterialPropertyBlock<T extends Material = Material> {
10125
+ private _overrides;
10126
+ private _defines;
10127
+ private _object;
10128
+ /** The object this property block is attached to */
10129
+ get object(): Object3D | null;
10130
+ /**
10131
+ * Creates a new MaterialPropertyBlock
10132
+ * @param object The object this property block is for (optional)
10133
+ */
10134
+ protected constructor(object?: Object3D | null);
10135
+ /**
10136
+ * Gets or creates a MaterialPropertyBlock for the given object.
10137
+ * This is the recommended way to obtain a property block instance.
10138
+ *
10139
+ * @template T The material type
10140
+ * @param object The object to get/create a property block for
10141
+ * @returns The MaterialPropertyBlock associated with this object
10142
+ *
10143
+ * @example
10144
+ * ```typescript
10145
+ * const block = MaterialPropertyBlock.get(myMesh);
10146
+ * block.setOverride("roughness", 0.5);
10147
+ * ```
10148
+ */
10149
+ static get<T extends Material = Material>(object: Object3D): MaterialPropertyBlock<T>;
10150
+ /**
10151
+ * Checks if an object has any property overrides
10152
+ * @param object The object to check
10153
+ * @returns True if the object has a property block with overrides
10154
+ */
10155
+ static hasOverrides(object: Object3D): boolean;
10156
+ /**
10157
+ * Disposes this property block and cleans up associated resources.
10158
+ * After calling dispose, this property block should not be used.
10159
+ */
10160
+ dispose(): void;
10161
+ /**
10162
+ * Sets or updates a material property override.
10163
+ * The override will be applied to the material during rendering.
10164
+ *
10165
+ * @param name The name of the material property to override (e.g., "color", "map", "roughness")
10166
+ * @param value The value to set
10167
+ * @param textureTransform Optional UV transform (only used when value is a Texture)
10168
+ *
10169
+ * @example
10170
+ * ```typescript
10171
+ * // Override a simple property
10172
+ * block.setOverride("roughness", 0.8);
10173
+ *
10174
+ * // Override a color
10175
+ * block.setOverride("color", new Color(0xff0000));
10176
+ *
10177
+ * // Override a texture with UV transform
10178
+ * block.setOverride("map", texture, {
10179
+ * offset: new Vector2(0, 0),
10180
+ * repeat: new Vector2(2, 2)
10181
+ * });
10182
+ * ```
10183
+ */
10184
+ setOverride<K extends NonFunctionPropertyNames<T>>(name: K, value: T[K], textureTransform?: TextureTransform): void;
10185
+ setOverride(name: string, value: MaterialPropertyType, textureTransform?: TextureTransform): void;
10186
+ /**
10187
+ * Gets the override for a specific property with type-safe value inference
10188
+ * @param name The property name to get
10189
+ * @returns The PropertyBlockOverride with correctly typed value if it exists, undefined otherwise
10190
+ *
10191
+ * @example
10192
+ * ```typescript
10193
+ * const block = MaterialPropertyBlock.get<MeshStandardMaterial>(mesh);
10194
+ *
10195
+ * // Value is inferred as number | undefined
10196
+ * const roughness = block.getOverride("roughness")?.value;
10197
+ *
10198
+ * // Value is inferred as Color | undefined
10199
+ * const color = block.getOverride("color")?.value;
10200
+ *
10201
+ * // Value is inferred as Texture | null | undefined
10202
+ * const map = block.getOverride("map")?.value;
10203
+ *
10204
+ * // Explicitly specify the type for properties not on the base material type
10205
+ * const transmission = block.getOverride<number>("transmission")?.value;
10206
+ *
10207
+ * // Or use a more specific material type
10208
+ * const physicalBlock = block as MaterialPropertyBlock<MeshPhysicalMaterial>;
10209
+ * const transmissionTyped = physicalBlock.getOverride("transmission")?.value; // number
10210
+ * ```
10211
+ */
10212
+ getOverride<K extends NonFunctionPropertyNames<T>>(name: K): PropertyBlockOverride<T[K] & MaterialPropertyType> | undefined;
10213
+ getOverride<V extends MaterialPropertyType = MaterialPropertyType>(name: string): PropertyBlockOverride<V> | undefined;
10214
+ /**
10215
+ * Removes a specific property override
10216
+ * @param name The property name to clear
10217
+ */
10218
+ removeOveride<K extends NonFunctionPropertyNames<T>>(name: K | ({} & string)): void;
10219
+ /**
10220
+ * Removes all property overrides from this block
10221
+ */
10222
+ clearAllOverrides(): void;
10223
+ /**
10224
+ * Gets all property overrides as a readonly array
10225
+ * @returns Array of all property overrides
10226
+ */
10227
+ get overrides(): readonly PropertyBlockOverride[];
10228
+ /**
10229
+ * Checks if this property block has any overrides
10230
+ * @returns True if there are any overrides set
10231
+ */
10232
+ hasOverrides(): boolean;
10233
+ /**
10234
+ * Set a shader define that will be included in the program cache key.
10235
+ * This allows different objects sharing the same material to have different shader programs.
10236
+ *
10237
+ * Defines affect shader compilation and are useful for enabling/disabling features per-object.
10238
+ *
10239
+ * @param name The define name (e.g., "USE_LIGHTMAP", "ENABLE_REFLECTIONS")
10240
+ * @param value The define value (typically a boolean, number, or string)
10241
+ *
10242
+ * @example
10243
+ * ```typescript
10244
+ * // Enable a feature for this specific object
10245
+ * block.setDefine("USE_CUSTOM_SHADER", true);
10246
+ * block.setDefine("QUALITY_LEVEL", 2);
10247
+ * ```
10248
+ */
10249
+ setDefine(name: string, value: string | number | boolean): void;
10250
+ /**
10251
+ * Remove a shader define
10252
+ * @param name The define name to remove
10253
+ */
10254
+ clearDefine(name: string): void;
10255
+ /**
10256
+ * Get all defines set on this property block
10257
+ * @returns A readonly record of all defines
10258
+ */
10259
+ getDefines(): Readonly<Record<string, string | number | boolean>>;
10260
+ /* Excluded from this release type: getCacheKey */
10261
+ }
10262
+
10263
+ /**
10264
+ * Valid types that can be used as material property overrides
10265
+ */
10266
+ declare type MaterialPropertyType = number | number[] | Color | Texture | Vector2 | Vector3 | Vector4 | null | Euler;
10267
+
10057
10268
  export declare namespace MaterialX {
10058
10269
  /**
10059
10270
  * 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.
@@ -10499,7 +10710,7 @@ export declare namespace NeedleEngineModelLoader {
10499
10710
  *
10500
10711
  */
10501
10712
  export function onDetermineModelMimetype(callback: MimetypeCallback): (() => void);
10502
- export {};
10713
+ {};
10503
10714
  }
10504
10715
 
10505
10716
  /**
@@ -11319,7 +11530,12 @@ export declare type NeedleXRHitTestResult = {
11319
11530
  * The XRRig can be accessed via the `rig` property
11320
11531
  * Set a custom XRRig via `NeedleXRSession.addRig(...)` or `NeedleXRSession.removeRig(...)`
11321
11532
  * By default the active XRRig with the highest priority in the scene is used
11533
+ *
11534
+ * ### Screenshots in XR
11535
+ * Screenshots work automatically during XR sessions, including AR camera feed compositing. See {@link screenshot2} for more information.
11536
+ *
11322
11537
  * @category XR
11538
+ * @see {@link screenshot2} for taking screenshots in XR sessions
11323
11539
  */
11324
11540
  export declare class NeedleXRSession implements INeedleXRSession {
11325
11541
  private static _sync;
@@ -12177,6 +12393,14 @@ export declare class NoiseModule {
12177
12393
  apply(_index: number, pos: Vec3, vel: Vec3, _deltaTime: number, age: number, life: number): void;
12178
12394
  }
12179
12395
 
12396
+ /**
12397
+ * Utility type that extracts only non-function property names from a type
12398
+ * @template T The type to extract property names from
12399
+ */
12400
+ declare type NonFunctionPropertyNames<T> = {
12401
+ [K in keyof T]: T[K] extends Function ? never : K;
12402
+ }[keyof T];
12403
+
12180
12404
  /** Removes all undefined functions */
12181
12405
  declare type NoUndefinedNoFunctions<T> = FilterTypes<T, Function | undefined | null>;
12182
12406
 
@@ -12592,6 +12816,7 @@ export declare function onXRSessionStart(fn: (evt: XRSessionEventArgs) => void):
12592
12816
  * OpenURL behaviour opens a URL in a new tab or window when the object (or any if it's children) is clicked.
12593
12817
  *
12594
12818
  * @category Interactivity
12819
+ * @category Web
12595
12820
  * @group Components
12596
12821
  */
12597
12822
  export declare class OpenURL extends Component implements IPointerClickHandler {
@@ -14645,6 +14870,19 @@ export declare class OrbitControls extends Component implements ICameraControlle
14645
14870
  constructor(reason: string);
14646
14871
  }
14647
14872
 
14873
+ /**
14874
+ * Represents a single material property override with optional texture transformation
14875
+ * @template T The type of the property value
14876
+ */
14877
+ declare interface PropertyBlockOverride<T extends MaterialPropertyType = MaterialPropertyType> {
14878
+ /** The name of the material property to override (e.g., "color", "map", "roughness") */
14879
+ name: string;
14880
+ /** The value to set for this property */
14881
+ value: T;
14882
+ /** Optional texture coordinate transformation (only used when value is a Texture) */
14883
+ textureTransform?: TextureTransform;
14884
+ }
14885
+
14648
14886
  export declare const PUBLIC_KEY: string;
14649
14887
 
14650
14888
  /** Adds an entry to the browser history. Internally uses `window.history.pushState` */
@@ -15063,21 +15301,49 @@ export declare class OrbitControls extends Component implements ICameraControlle
15063
15301
  export declare class ReflectionProbe extends Component {
15064
15302
  private static _probes;
15065
15303
  static isUsingReflectionProbe(material: Material): boolean;
15304
+ /**
15305
+ * 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.
15306
+ */
15307
+ static readonly onEnabled: EventList<ReflectionProbe>;
15308
+ static readonly onDisabled: EventList<ReflectionProbe>;
15309
+ /**
15310
+ * 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.
15311
+ *
15312
+ * 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.
15313
+ * Note: Volume-based automatic assignment is not fully supported yet, so explicit assignment is recommended for now.
15314
+ *
15315
+ * @param object The object to find a reflection probe for
15316
+ * @param context The context to search within
15317
+ * @param isAnchor If true, only return a probe if the object is the anchor of that probe
15318
+ * @param anchor Optional anchor object to match against probes
15319
+ */
15066
15320
  static get(object: Object3D | null | undefined, context: Context, isAnchor: boolean, anchor?: Object3D): ReflectionProbe | null;
15067
15321
  private _texture;
15068
15322
  set texture(tex: Texture);
15069
15323
  get texture(): Texture;
15324
+ intensity: number;
15325
+ /**
15326
+ * Defines the center and size of the reflection probe's influence area.
15327
+ */
15070
15328
  center?: Vector3;
15329
+ /**
15330
+ * Defines the size of the reflection probe's influence area. Objects within this box will be affected by the probe's reflections.
15331
+ */
15071
15332
  size?: Vector3;
15333
+ /**
15334
+ * 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.
15335
+ */
15336
+ __lightmapIntensityScale: boolean;
15072
15337
  private _boxHelper?;
15073
15338
  private isInBox;
15074
15339
  constructor();
15075
15340
  awake(): void;
15341
+ onEnable(): void;
15342
+ onDisable(): void;
15076
15343
  start(): void;
15077
15344
  onDestroy(): void;
15078
- private static _rendererMaterialsCache;
15079
- onSet(_rend: IRenderer): void;
15080
- onUnset(_rend: IRenderer): void;
15345
+ apply(object: Object3D): void;
15346
+ unapply(obj: Object3D): void;
15081
15347
  }
15082
15348
 
15083
15349
  declare enum ReflectionProbeUsage {
@@ -15399,6 +15665,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
15399
15665
  onEnable(): void;
15400
15666
  onDisable(): void;
15401
15667
  onDestroy(): void;
15668
+ private readonly onReflectionProbeEnabled;
15669
+ private onReflectionProbeDisabled;
15402
15670
  onBeforeRender(): void;
15403
15671
  private onBeforeRenderThree;
15404
15672
  onAfterRender(): void;
@@ -15477,23 +15745,27 @@ export declare class OrbitControls extends Component implements ICameraControlle
15477
15745
  private lightmapIndex;
15478
15746
  private lightmapScaleOffset;
15479
15747
  private readonly renderer;
15480
- private readonly clonedMaterials;
15748
+ private _isApplied;
15481
15749
  private get context();
15482
15750
  private get gameObject();
15483
15751
  private lightmapTexture;
15484
- private lightmapScaleOffsetUniform;
15485
- private lightmapUniform;
15486
15752
  constructor(renderer: Renderer);
15487
15753
  init(lightmapIndex: number, lightmapScaleOffset: Vector4, lightmapTexture: Texture): void;
15488
- updateLightmapUniforms(material: Material): void;
15754
+ updateLightmapUniforms(_material: any): void;
15489
15755
  /**
15490
- * Apply the lightmap to the object. This will clone the material and set the lightmap texture and scale/offset
15756
+ * Apply the lightmap to the object using MaterialPropertyBlock instead of cloning materials.
15757
+ * The lightmap texture and its per-object UV transform are set as overrides via PropertyBlock.
15758
+ * Three.js reads material.lightMap to determine shader defines and upload uniforms,
15759
+ * and uses texture.offset/repeat to compute lightMapTransform in the vertex shader.
15491
15760
  */
15492
15761
  applyLightmap(): void;
15762
+ /** Update the lightMap override on all property blocks (e.g. after LOD swap) */
15763
+ private updatePropertyBlockTexture;
15764
+ /**
15765
+ * Remove the lightmap from the object
15766
+ */
15767
+ onUnset(): void;
15493
15768
  private ensureLightmapUvs;
15494
- private ensureLightmapMaterial;
15495
- private assignLightmapTexture;
15496
- private onBeforeCompile;
15497
15769
  private setLightmapDebugMaterial;
15498
15770
  }
15499
15771
 
@@ -16327,40 +16599,179 @@ export declare class OrbitControls extends Component implements ICameraControlle
16327
16599
  * const dataUrl = screenshot();
16328
16600
  * saveImage(dataUrl, "screenshot.png");
16329
16601
  * ```
16602
+ *
16330
16603
  */
16331
16604
  export declare function screenshot(context?: Context, width?: number, height?: number, mimeType?: ScreenshotImageMimeType, camera?: Camera_2 | null): string | null;
16332
16605
 
16333
16606
  /**
16334
- * Take a screenshot from the current scene and return a {@link Texture}. This can applied to a surface in 3D space.
16607
+ * Take a screenshot from the current scene and return a {@link Texture}. This can be applied to a surface in 3D space.
16335
16608
  * @param opts Provide `{ type: "texture" }` to get a texture instead of a data url.
16336
16609
  * @returns The texture of the screenshot. Returns null if the screenshot could not be taken.
16610
+ * @category Utilities
16611
+ * @example
16612
+ * ```ts
16613
+ * // Create a texture from the current view
16614
+ * const screenshotTexture = screenshot2({ type: "texture", width: 512, height: 512 });
16615
+ * if (screenshotTexture) {
16616
+ * myMaterial.map = screenshotTexture;
16617
+ * myMaterial.needsUpdate = true;
16618
+ * }
16619
+ *
16620
+ * // Update an existing texture
16621
+ * const existingTexture = new Texture();
16622
+ * screenshot2({ type: "texture", target: existingTexture, transparent: true });
16623
+ * ```
16337
16624
  */
16338
16625
  export declare function screenshot2(opts: ScreenshotOptionsTexture): Texture | null;
16339
16626
 
16340
16627
  /**
16341
- * Take a screenshot from the current scene.
16342
- * @param opts
16343
- * @returns The data url of the screenshot. Returns null if the screenshot could not be taken.
16628
+ * Take a screenshot from the current scene and return a data URL string.
16629
+ *
16630
+ * @param opts Screenshot options. All properties are optional.
16631
+ * @returns The data URL of the screenshot (e.g., "data:image/png;base64,..."). Returns null if the screenshot could not be taken.
16632
+ * @category Utilities
16633
+ *
16634
+ * @example Basic screenshot
16344
16635
  * ```ts
16345
- * const res = screenshot2({
16346
- * width: 1024,
16636
+ * // Take a simple screenshot with default settings
16637
+ * const dataUrl = screenshot2({});
16638
+ * console.log(dataUrl); // "data:image/webp;base64,..."
16639
+ * ```
16640
+ *
16641
+ * @example High-resolution screenshot with transparent background
16642
+ * ```ts
16643
+ * const dataUrl = screenshot2({
16644
+ * width: 2048,
16645
+ * height: 2048,
16646
+ * mimeType: "image/png",
16647
+ * transparent: true,
16648
+ * trim: true, // Remove transparent edges
16649
+ * });
16650
+ * ```
16651
+ *
16652
+ * @example Screenshot with custom background color
16653
+ * ```ts
16654
+ * import { Color } from "three";
16655
+ *
16656
+ * const dataUrl = screenshot2({
16657
+ * width: 1024,
16347
16658
  * height: 1024,
16348
- * mimeType: "image/webp",
16349
- * transparent: true,
16350
- * })
16351
- * // use saveImage to download the image
16352
- * saveImage(res, "screenshot.webp");
16659
+ * background: new Color(0x00ff00), // Green background
16660
+ * });
16661
+ * ```
16662
+ *
16663
+ * @example Download screenshot automatically
16664
+ * ```ts
16665
+ * screenshot2({
16666
+ * width: 1920,
16667
+ * height: 1080,
16668
+ * mimeType: "image/jpeg",
16669
+ * download_filename: "my-scene.jpg",
16670
+ * });
16671
+ * ```
16672
+ *
16673
+ * @example Manual download using saveImage
16674
+ * ```ts
16675
+ * const dataUrl = screenshot2({
16676
+ * width: 1024,
16677
+ * height: 1024,
16678
+ * mimeType: "image/webp",
16679
+ * transparent: true,
16680
+ * });
16681
+ * if (dataUrl) {
16682
+ * saveImage(dataUrl, "screenshot.webp");
16683
+ * }
16684
+ * ```
16685
+ *
16686
+ * @example Screenshot from specific camera
16687
+ * ```ts
16688
+ * const myCamera = this.gameObject.getComponent(Camera);
16689
+ * const dataUrl = screenshot2({
16690
+ * camera: myCamera,
16691
+ * width: 1024,
16692
+ * height: 1024,
16693
+ * });
16353
16694
  * ```
16354
16695
  */
16355
16696
  export declare function screenshot2(opts: ScreenshotOptionsDataUrl): string | null;
16356
16697
 
16357
16698
  /**
16358
- * Take a screenshot asynchronously from the current scene.
16359
- * @returns A promise that resolves with the blob of the screenshot. Returns null if the screenshot could not be taken.
16360
- * @param {ScreenshotOptionsBlob} opts Set `{ type: "blob" }` to get a blob instead of a data url.
16699
+ * Take a screenshot asynchronously and return a Blob. This is useful when you need to process or upload the image data.
16700
+ *
16701
+ * @param opts Set `{ type: "blob" }` to get a blob instead of a data url. All other {@link ScreenshotOptions} are also available.
16702
+ * @returns A Promise that resolves with the Blob of the screenshot. Returns null if the screenshot could not be taken.
16703
+ * @category Utilities
16704
+ *
16705
+ * @example Upload screenshot to server
16706
+ * ```ts
16707
+ * const blob = await screenshot2({ type: "blob", mimeType: "image/png" });
16708
+ * if (blob) {
16709
+ * const formData = new FormData();
16710
+ * formData.append("screenshot", blob, "screenshot.png");
16711
+ * await fetch("/api/upload", { method: "POST", body: formData });
16712
+ * }
16713
+ * ```
16714
+ *
16715
+ * @example Save blob to file (browser download)
16716
+ * ```ts
16717
+ * const blob = await screenshot2({
16718
+ * type: "blob",
16719
+ * width: 1920,
16720
+ * height: 1080,
16721
+ * transparent: true
16722
+ * });
16723
+ * if (blob) {
16724
+ * const url = URL.createObjectURL(blob);
16725
+ * saveImage(url, "screenshot.png");
16726
+ * URL.revokeObjectURL(url); // Clean up
16727
+ * }
16728
+ * ```
16361
16729
  */
16362
16730
  export declare function screenshot2(opts: ScreenshotOptionsBlob): Promise<Blob | null>;
16363
16731
 
16732
+ /**
16733
+ * Take a screenshot and share it using the Web Share API (mobile-friendly).
16734
+ *
16735
+ * **Note**: The Web Share API is only available in secure contexts (HTTPS) and may not be supported on all platforms/browsers.
16736
+ *
16737
+ * @param opts Set `{ type: "share" }` to share the screenshot. Additional options like `filename`, `title`, `text`, and `url` can be provided.
16738
+ * @returns A Promise that resolves with an object containing the blob and whether it was successfully shared.
16739
+ * @category Utilities
16740
+ *
16741
+ * @example Share screenshot on mobile
16742
+ * ```ts
16743
+ * const result = await screenshot2({
16744
+ * type: "share",
16745
+ * filename: "my-creation.png",
16746
+ * title: "Check out my 3D scene!",
16747
+ * text: "I created this with Needle Engine",
16748
+ * url: "https://engine.needle.tools",
16749
+ * mimeType: "image/png",
16750
+ * });
16751
+ *
16752
+ * if (result.shared) {
16753
+ * console.log("Screenshot shared successfully!");
16754
+ * } else {
16755
+ * console.log("User cancelled or sharing not supported");
16756
+ * }
16757
+ * ```
16758
+ *
16759
+ * @example Share with fallback
16760
+ * ```ts
16761
+ * const result = await screenshot2({
16762
+ * type: "share",
16763
+ * filename: "screenshot.webp",
16764
+ * file_type: "image/webp",
16765
+ * });
16766
+ *
16767
+ * if (!result.shared && result.blob) {
16768
+ * // Fallback: download the image instead
16769
+ * const url = URL.createObjectURL(result.blob);
16770
+ * saveImage(url, "screenshot.webp");
16771
+ * URL.revokeObjectURL(url);
16772
+ * }
16773
+ * ```
16774
+ */
16364
16775
  export declare function screenshot2(opts: ScreenshotOptionsShare): Promise<ScreenshotOptionsShareReturnType>;
16365
16776
 
16366
16777
  declare type ScreenshotImageMimeType = "image/webp" | "image/png" | "image/jpeg";
@@ -16422,11 +16833,29 @@ export declare class OrbitControls extends Component implements ICameraControlle
16422
16833
  };
16423
16834
 
16424
16835
  export declare type ScreenshotOptionsShare = ScreenshotOptions & {
16836
+ /**
16837
+ * Set `{ type: "share" }` to share the screenshot using the Web Share API. The promise will resolve with the blob of the screenshot and whether it was shared successfully or not. Note that the Web Share API is only available in secure contexts (HTTPS) and on some platforms.
16838
+ */
16425
16839
  type: "share";
16840
+ /**
16841
+ * The filename to use when sharing the screenshot. If not provided, a default filename will be used.
16842
+ */
16426
16843
  filename?: string;
16844
+ /**
16845
+ * The mime type of the shared file. If not provided, the mime type will be inferred from the screenshot options or default to "image/png".
16846
+ */
16427
16847
  file_type?: ScreenshotImageMimeType;
16848
+ /**
16849
+ * The title to use when sharing the screenshot. This is optional and may not be supported by all platforms.
16850
+ */
16428
16851
  title?: string;
16852
+ /**
16853
+ * The text to use when sharing the screenshot. This is optional and may not be supported by all platforms.
16854
+ */
16429
16855
  text?: string;
16856
+ /**
16857
+ * The URL to use when sharing the screenshot. This is optional and may not be supported by all platforms.
16858
+ */
16430
16859
  url?: string;
16431
16860
  };
16432
16861
 
@@ -16568,6 +16997,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
16568
16997
  *
16569
16998
  * @summary Links scroll position to target objects
16570
16999
  * @category Web
17000
+ * @category Interaction
16571
17001
  * @group Components
16572
17002
  * @component
16573
17003
  */
@@ -16778,8 +17208,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
16778
17208
  /* Excluded from this release type: onEnable */
16779
17209
  /* Excluded from this release type: onDisable */
16780
17210
  /* Excluded from this release type: update */
16781
- private readonly rendererMaterials;
16782
- private readonly rendererMaterialsOriginal;
16783
17211
  private updateDirection;
16784
17212
  /**
16785
17213
  * Update the alpha of the object's materials towards the target alpha over the given duration.
@@ -19105,6 +19533,16 @@ export declare class OrbitControls extends Component implements ICameraControlle
19105
19533
  /**@obsolete use Graphics.textureToCanvas */
19106
19534
  export declare function textureToCanvas(texture: Texture, force?: boolean): HTMLCanvasElement | null;
19107
19535
 
19536
+ /**
19537
+ * Defines offset and repeat transformations for texture coordinates
19538
+ */
19539
+ declare interface TextureTransform {
19540
+ /** UV offset applied to the texture */
19541
+ offset?: Vector2;
19542
+ /** UV repeat/scale applied to the texture */
19543
+ repeat?: Vector2;
19544
+ }
19545
+
19108
19546
  declare enum TextWrapMode {
19109
19547
  singleLine = "singleLine",
19110
19548
  hardBreaks = "hardBreaks",
@@ -20370,7 +20808,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
20370
20808
  * scene.add(viewBox);
20371
20809
  * ```
20372
20810
  *
20373
- * @see {@link Camera} - The camera component that ViewBox controls
20811
+ * @see {@link CameraComponent} - The camera component that ViewBox controls
20374
20812
  * @see {@link OrbitControls} - Camera controls that work alongside ViewBox
20375
20813
  * @see {@link DragControls} - Alternative camera controls compatible with ViewBox
20376
20814
  * @see {@link LookAtConstraint} - Another way to control camera targeting
@@ -20405,7 +20843,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
20405
20843
  * as they would appear with that field of view. Setting it to a wider FOV (e.g., 90) makes objects appear
20406
20844
  * smaller, while a narrower FOV (e.g., 30) makes them appear larger.
20407
20845
  *
20408
- * @see {@link Camera} for the camera component and its FOV property
20846
+ * @see {@link CameraComponent} for the camera component and its FOV property
20409
20847
  * @default -1 (automatically uses the camera's FOV on the first frame)
20410
20848
  */
20411
20849
  referenceFieldOfView: number;
@@ -20779,11 +21217,20 @@ export declare class OrbitControls extends Component implements ICameraControlle
20779
21217
  /**
20780
21218
  * WebARCameraBackground is a component that allows to display the camera feed as a background in an AR session to more easily blend the real world with the virtual world or applying effects to the camera feed.
20781
21219
  *
21220
+ * This component automatically requests `camera-access` permission when entering AR mode, which is required to:
21221
+ * - Display the real-world camera feed as a background
21222
+ * - Include the camera feed in AR screenshots taken with {@link screenshot2}
21223
+ *
21224
+ * **Note**: If you want to take AR screenshots with the camera feed but don't need to display it as a background,
21225
+ * you can still add this component to your scene (it will request camera access) or manually request the
21226
+ * `camera-access` feature in your `onBeforeXR` method.
21227
+ *
20782
21228
  * - Example: https://samples.needle.tools/ar-camera-background
20783
21229
  *
20784
21230
  * @summary Displays the camera feed as background in WebAR sessions
20785
21231
  * @category XR
20786
21232
  * @group Components
21233
+ * @see {@link screenshot2} for taking screenshots in AR (requires camera access for camera feed compositing)
20787
21234
  */
20788
21235
  export declare class WebARCameraBackground extends Component {
20789
21236
  /* Excluded from this release type: onBeforeXR */
@@ -20942,6 +21389,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
20942
21389
  * @see {@link XRControllerMovement} for VR locomotion
20943
21390
  * @see {@link WebARSessionRoot} for AR session configuration
20944
21391
  * @see {@link Avatar} for networked user avatars
21392
+ * @see {@link screenshot2} for taking screenshots in XR (including AR camera feed compositing)
20945
21393
  * @link https://engine.needle.tools/docs/xr.html
20946
21394
  * @link https://engine.needle.tools/samples/?overlay=samples&tag=xr
20947
21395
  * @link https://engine.needle.tools/samples/collaborative-sandbox
@@ -21926,6 +22374,127 @@ export declare class OrbitControls extends Component implements ICameraControlle
21926
22374
  export { }
21927
22375
 
21928
22376
 
22377
+ declare global {
22378
+ interface HTMLElementTagNameMap {
22379
+ "needle-engine": NeedleEngineWebComponent;
22380
+ }
22381
+ }
22382
+
22383
+
22384
+ declare global {
22385
+ interface Navigator {
22386
+ userActivation?: {
22387
+ isActive: boolean;
22388
+ };
22389
+ }
22390
+ }
22391
+
22392
+
22393
+ declare module 'three/examples/jsm/controls/OrbitControls.js' {
22394
+ interface OrbitControls {
22395
+ _sphericalDelta: import("three").Spherical;
22396
+ _rotateLeft: (angleInRadians: number) => void;
22397
+ _rotateUp: (angleInRadians: number) => void;
22398
+ _pan: (dx: number, dy: number) => void;
22399
+ _dollyIn: (dollyScale: number) => void;
22400
+ _dollyOut: (dollyScale: number) => void;
22401
+ }
22402
+ interface OrbitControlsEventMap {
22403
+ endMovement: Event;
22404
+ }
22405
+ }
22406
+
22407
+
22408
+ declare global {
22409
+ interface ViewTimeline {
22410
+ axis: 'block' | 'inline';
22411
+ currentTime: {
22412
+ unit: 'seconds' | 'percent';
22413
+ value: number;
22414
+ };
22415
+ duration: {
22416
+ unit: 'seconds' | 'percent';
22417
+ value: number;
22418
+ };
22419
+ source: Element | null;
22420
+ startOffset: {
22421
+ unit: 'px';
22422
+ value: number;
22423
+ };
22424
+ endOffset: {
22425
+ unit: 'px';
22426
+ value: number;
22427
+ };
22428
+ }
22429
+ }
22430
+
22431
+ export declare namespace NEEDLE_ENGINE_FEATURE_FLAGS {
22432
+ let experimentalSmartHierarchyUpdate: boolean;
22433
+ }
22434
+
22435
+ /**
22436
+ * 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.
22437
+ *
22438
+ * Use the `ready` function to wait for the module to be loaded if you do not wand to trigger a load.
22439
+ *
22440
+ * If a module is already loaded it's also available in the `MODULE` variable.
22441
+ */
22442
+ export declare namespace MODULES {
22443
+ namespace MaterialX {
22444
+ type TYPE = typeof import("@needle-tools/materialx");
22445
+ let MODULE: TYPE;
22446
+ let MAYBEMODULE: TYPE | null;
22447
+ /** Wait for the module to be loaded (doesn't trigger a load) */
22448
+ function ready(): Promise<TYPE>;
22449
+ /** Load the module */
22450
+ function load(): Promise<TYPE>;
22451
+ }
22452
+ namespace RAPIER_PHYSICS {
22453
+ type TYPE = typeof import("@dimforge/rapier3d-compat");
22454
+ let MODULE: TYPE;
22455
+ let MAYBEMODULE: TYPE | null;
22456
+ /** Wait for the module to be loaded (doesn't trigger a load) */
22457
+ function ready(): Promise<TYPE>;
22458
+ /** Load the module */
22459
+ function load(): Promise<TYPE>;
22460
+ }
22461
+ namespace POSTPROCESSING {
22462
+ type TYPE = typeof import("postprocessing");
22463
+ let MODULE: TYPE;
22464
+ let MAYBEMODULE: TYPE | null;
22465
+ /** Wait for the module to be loaded (doesn't trigger a load) */
22466
+ function ready(): Promise<TYPE>;
22467
+ /** Load the module */
22468
+ function load(): Promise<TYPE>;
22469
+ }
22470
+ namespace POSTPROCESSING_AO {
22471
+ type TYPE = typeof import("n8ao");
22472
+ let MODULE: TYPE;
22473
+ let MAYBEMODULE: TYPE | null;
22474
+ /** Wait for the module to be loaded (doesn't trigger a load) */
22475
+ function ready(): Promise<TYPE>;
22476
+ /** Load the module */
22477
+ function load(): Promise<TYPE>;
22478
+ }
22479
+ }
22480
+
22481
+
22482
+ export declare namespace PreviewHelper {
22483
+ type PreviewInfo = {
22484
+ position?: Vector3Like | Vec3;
22485
+ size?: Vector3Like | Vec3;
22486
+ };
22487
+ function addPreview(params: {
22488
+ parent: Object3D;
22489
+ guid: string;
22490
+ } & PreviewInfo): {
22491
+ object: Object3D;
22492
+ onProgress: (downloadProgress: number) => void;
22493
+ };
22494
+ function removePreview(guid: string): void;
22495
+ }
22496
+
22497
+
21929
22498
  declare module 'three' {
21930
22499
  interface SkinnedMesh {
21931
22500
  staticGenerator?: StaticGeometryGenerator;
@@ -21948,21 +22517,161 @@ declare module 'three' {
21948
22517
  }
21949
22518
 
21950
22519
 
21951
- declare module 'three/examples/jsm/controls/OrbitControls.js' {
21952
- interface OrbitControls {
21953
- _sphericalDelta: import("three").Spherical;
21954
- _rotateLeft: (angleInRadians: number) => void;
21955
- _rotateUp: (angleInRadians: number) => void;
21956
- _pan: (dx: number, dy: number) => void;
21957
- _dollyIn: (dollyScale: number) => void;
21958
- _dollyOut: (dollyScale: number) => void;
22520
+ declare global {
22521
+ interface NavigatorUAData {
22522
+ platform: string;
21959
22523
  }
21960
- interface OrbitControlsEventMap {
21961
- endMovement: Event;
22524
+ interface Navigator {
22525
+ userAgentData?: NavigatorUAData;
21962
22526
  }
21963
22527
  }
21964
22528
 
21965
22529
 
22530
+ /**
22531
+ * Utility functions to detect certain device types (mobile, desktop), browsers, or capabilities.
22532
+ * @category Utilities
22533
+ */
22534
+ export declare namespace DeviceUtilities {
22535
+ /** @returns `true` for MacOS or Windows devices. `false` for Hololens and other headsets. */
22536
+ function isDesktop(): boolean;
22537
+ /** @returns `true` if it's a phone or tablet */
22538
+ function isMobileDevice(): boolean;
22539
+ /** @deprecated use {@link isiPad} instead */
22540
+ function isIPad(): boolean;
22541
+ /** @returns `true` if we're currently on an iPad */
22542
+ function isiPad(): boolean;
22543
+ /** @returns `true` if we're currently on an Android device */
22544
+ function isAndroidDevice(): boolean;
22545
+ /** @returns `true` if we're currently using the Mozilla XR Browser (only available for iOS) */
22546
+ function isMozillaXR(): boolean;
22547
+ /** @returns `true` if we're currently in the Needle App Clip */
22548
+ function isNeedleAppClip(): boolean;
22549
+ /** @returns `true` for MacOS devices */
22550
+ function isMacOS(): boolean;
22551
+ /** @returns `true` for VisionOS devices */
22552
+ function isVisionOS(): boolean;
22553
+ /** @returns `true` for mobile Apple devices like iPad, iPhone, iPod, Vision Pro, ... */
22554
+ function isiOS(): boolean;
22555
+ /** @returns `true` if we're currently on safari */
22556
+ function isSafari(): boolean;
22557
+ /** @returns `true` for Meta Quest devices and browser. */
22558
+ function isQuest(): boolean;
22559
+ /** @returns `true` if the browser has `<a rel="ar">` support, which indicates USDZ QuickLook support. */
22560
+ function supportsQuickLookAR(): boolean;
22561
+ /** @returns `true` if the user allowed to use the microphone */
22562
+ function microphonePermissionsGranted(): Promise<boolean>;
22563
+ function getiOSVersion(): string | null;
22564
+ function getChromeVersion(): string | null;
22565
+ function getSafariVersion(): string | null;
22566
+ }
22567
+
22568
+
22569
+ declare global {
22570
+ interface Window {
22571
+ SPECTOR?: {
22572
+ Spector: new () => Spector;
22573
+ };
22574
+ }
22575
+ interface Spector {
22576
+ displayUI: () => void;
22577
+ setCanvas: (canvas: HTMLCanvasElement) => void;
22578
+ spyCanvases: boolean;
22579
+ startCaptureOnNextFrame: () => void;
22580
+ captureCanvas: (canvas: HTMLCanvasElement) => any;
22581
+ }
22582
+ }
22583
+
22584
+
22585
+ declare global {
22586
+ interface HTMLElementTagNameMap {
22587
+ "needle-logo-element": NeedleLogoElement;
22588
+ }
22589
+ }
22590
+
22591
+
22592
+ export declare namespace MaterialX {
22593
+ /**
22594
+ * 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.
22595
+ */
22596
+ function loadFromUrl(urlOrXML: string, opts?: {
22597
+ url?: string;
22598
+ loadingManager?: LoadingManager;
22599
+ materialNameOrIndex?: number | string;
22600
+ }): Promise<import("three").Material | null>;
22601
+ }
22602
+
22603
+ declare global {
22604
+ interface HTMLElementTagNameMap {
22605
+ "needle-button": NeedleButtonElement;
22606
+ }
22607
+ }
22608
+
22609
+ /**
22610
+ * @internal
22611
+ */
22612
+ export declare namespace InternalAttributeUtils {
22613
+ /**
22614
+ * Checks if the given value is considered "falsey" in the context of HTML attributes.
22615
+ * A value is considered falsey if it is "0" or "false" (case-insensitive).
22616
+ *
22617
+ * @param value - The attribute value to check.
22618
+ * @returns True if the value is falsey, otherwise false.
22619
+ */
22620
+ function isFalsey(value: string | null): boolean;
22621
+ /**
22622
+ * Retrieves the value of the specified attribute from the given element.
22623
+ * If the attribute value is considered falsey, it returns null.
22624
+ * @returns The attribute value or null if falsey.
22625
+ */
22626
+ function getAttributeValueIfNotFalsey(element: Element, attributeName: string, opts?: {
22627
+ onAttribute: (value: string) => void;
22628
+ }): string | null;
22629
+ /**
22630
+ * Retrieves the value of the specified attribute from the given element.
22631
+ * If the attribute value is considered falsey, it returns false.
22632
+ * If the attribute is not set at all, it returns null.
22633
+ * @returns The attribute value, false if falsey, or null if not set.
22634
+ *
22635
+ * @example
22636
+ * ```typescript
22637
+ * const result = HTMLAttributeUtils.getAttributeAndCheckFalsey(element, 'data-example', {
22638
+ * onAttribute: (value, falsey) => {
22639
+ * console.log(`Attribute value: ${value}
22640
+ * , Is falsey: ${falsey}`);
22641
+ * }
22642
+ * });
22643
+ *
22644
+ * if (result === false) {
22645
+ * console.log('The attribute is set to a falsey value.');
22646
+ * } else if (result === null) {
22647
+ * console.log('The attribute is not set.');
22648
+ * } else {
22649
+ * console.log(`The attribute value is: ${result}`);
22650
+ * }
22651
+ * ```
22652
+ */
22653
+ function getAttributeAndCheckFalsey(element: Element, attributeName: string, opts?: {
22654
+ onAttribute: (value: string, falsey: boolean) => void;
22655
+ }): false | string | null;
22656
+ }
22657
+
22658
+
22659
+ /**
22660
+ * @category Splines
22661
+ * @see {@link SplineContainer} for the main spline component that defines the path and knots
22662
+ */
22663
+ export declare namespace SplineUtils {
22664
+ /**
22665
+ * Creates a SplineContainer from an array of points.
22666
+ * @param positions The positions of the knots.
22667
+ * @param closed Whether the spline is closed (the last knot connects to the first).
22668
+ * @param tension The tension of the spline. 0 is no tension, 1 is high tension (straight lines between knots). Default is 0.75.
22669
+ * @return The created SplineContainer component - add it to an Object3D to use it.
22670
+ */
22671
+ function createFromPoints(positions: Vector3[], closed?: boolean, tension?: number): SplineContainer;
22672
+ }
22673
+
22674
+
21966
22675
  declare module 'three' {
21967
22676
  interface Object3D {
21968
22677
  get guid(): string | undefined;
@@ -22102,9 +22811,37 @@ declare module 'three' {
22102
22811
  }
22103
22812
  }
22104
22813
 
22814
+ declare global {
22815
+ interface HTMLElementTagNameMap {
22816
+ "needle-logo-element": NeedleLogoElement;
22817
+ }
22818
+ }
22819
+
22820
+
22821
+ /**
22822
+ * Internal registry for USDZ exporters. This is used by NeedleXRSession.start("immersive-ar")
22823
+ */
22824
+ export declare namespace InternalUSDZRegistry {
22825
+ function exportAndOpen(): boolean;
22826
+ function registerExporter(exporter: USDZExporter): void;
22827
+ function unregisterExporter(exporter: USDZExporter): void;
22828
+ }
22829
+
22105
22830
 
22106
22831
  declare module 'three' {
22107
22832
  interface Vector3 {
22108
22833
  slerp(end: Vector3, t: number): Vector3;
22109
22834
  }
22110
22835
  }
22836
+
22837
+ export declare namespace LCP {
22838
+ function observe(): void;
22839
+ }
22840
+
22841
+ /**
22842
+ * @param args - The arguments to initialize the performance analytics with.
22843
+ */
22844
+ export declare module NeedleEnginePerformanceAnalytics {
22845
+ function init(...args: Array<"lcp">): void;
22846
+ }
22847
+