@needle-tools/engine 4.14.0-next.31f837e → 4.14.0-next.b2e3b1a

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 (95) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/components.needle.json +1 -1
  3. package/dist/{generateMeshBVH.worker-DFcS3P04.js → generateMeshBVH.worker-DiCnZlf3.js} +1 -1
  4. package/dist/{gltf-progressive-8voIgNp_.js → gltf-progressive-Bm_6aEi4.js} +4 -4
  5. package/dist/{gltf-progressive-BRRBj-nY.umd.cjs → gltf-progressive-BttGBXw6.umd.cjs} +3 -3
  6. package/dist/{gltf-progressive-Dkh3tG4-.min.js → gltf-progressive-T5WKTux5.min.js} +1 -1
  7. package/dist/{loader.worker-C6cXDgR1.js → loader.worker-BqODMeeW.js} +1 -1
  8. package/dist/{materialx-Dx8st96L.min.js → materialx-CJyQZtjt.min.js} +1 -1
  9. package/dist/{materialx-D66rYPqe.js → materialx-DMs1E08Z.js} +2 -2
  10. package/dist/{materialx-CxlgposR.umd.cjs → materialx-DaKKOoVk.umd.cjs} +1 -1
  11. package/dist/{needle-engine.bundle-BQXG5qbQ.umd.cjs → needle-engine.bundle-BC1QDiuv.umd.cjs} +139 -139
  12. package/dist/{needle-engine.bundle-D7w0XD7M.min.js → needle-engine.bundle-Bhgt3W8p.min.js} +134 -134
  13. package/dist/{needle-engine.bundle-Byl5i6zJ.js → needle-engine.bundle-CeQXs7Hh.js} +5966 -5880
  14. package/dist/needle-engine.d.ts +552 -31
  15. package/dist/needle-engine.js +4 -4
  16. package/dist/needle-engine.min.js +1 -1
  17. package/dist/needle-engine.umd.cjs +1 -1
  18. package/dist/{postprocessing-Ce5-UWiA.min.js → postprocessing-06AXuvdv.min.js} +2 -2
  19. package/dist/{postprocessing-BkSpxpYB.js → postprocessing-CI2x8Cln.js} +4 -4
  20. package/dist/{postprocessing-DFVElmAh.umd.cjs → postprocessing-CPDcA21P.umd.cjs} +2 -2
  21. package/dist/{three-Bad8p1pf.umd.cjs → three-BjYim-vL.umd.cjs} +47 -47
  22. package/dist/{three-DFV1-P9z.js → three-Bvk2VKbF.js} +2 -2
  23. package/dist/{three-CWn13_u1.min.js → three-IG2qPafA.min.js} +2 -2
  24. package/dist/{three-examples-CO-tx3Sp.umd.cjs → three-examples-BMmNgNCN.umd.cjs} +1 -1
  25. package/dist/{three-examples-43yqn3mL.js → three-examples-CMYCd5nH.js} +1 -1
  26. package/dist/{three-examples-DKuJVGT4.min.js → three-examples-CQl1fFZp.min.js} +1 -1
  27. package/dist/{three-mesh-ui-DyEA5HQF.min.js → three-mesh-ui-5HVE2RV-.min.js} +1 -1
  28. package/dist/{three-mesh-ui-fSAQJxdI.js → three-mesh-ui-BlakAItG.js} +1 -1
  29. package/dist/{three-mesh-ui-ChzVOraf.umd.cjs → three-mesh-ui-D828VbQp.umd.cjs} +1 -1
  30. package/dist/{vendor-pe19S9r5.min.js → vendor-BxK0WKmT.min.js} +1 -1
  31. package/dist/{vendor-B51YffMU.umd.cjs → vendor-CIDkyBaO.umd.cjs} +1 -1
  32. package/dist/{vendor-CgpZ5ivC.js → vendor-ixwD-vv2.js} +1 -1
  33. package/lib/engine/api.d.ts +1 -1
  34. package/lib/engine/api.js +1 -1
  35. package/lib/engine/api.js.map +1 -1
  36. package/lib/engine/engine_components.d.ts +1 -1
  37. package/lib/engine/engine_components.js +7 -3
  38. package/lib/engine/engine_components.js.map +1 -1
  39. package/lib/engine/engine_context.d.ts +12 -0
  40. package/lib/engine/engine_context.js +29 -0
  41. package/lib/engine/engine_context.js.map +1 -1
  42. package/lib/engine/engine_gltf_builtin_components.js +16 -1
  43. package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
  44. package/lib/engine/engine_materialpropertyblock.d.ts +223 -11
  45. package/lib/engine/engine_materialpropertyblock.js +303 -33
  46. package/lib/engine/engine_materialpropertyblock.js.map +1 -1
  47. package/lib/engine-components/Camera.js.map +1 -1
  48. package/lib/engine-components/DropListener.js.map +1 -1
  49. package/lib/engine-components/Duplicatable.js.map +1 -1
  50. package/lib/engine-components/GroundProjection.js.map +1 -1
  51. package/lib/engine-components/NeedleMenu.js.map +1 -1
  52. package/lib/engine-components/NestedGltf.js.map +1 -1
  53. package/lib/engine-components/ReflectionProbe.d.ts +32 -3
  54. package/lib/engine-components/ReflectionProbe.js +57 -26
  55. package/lib/engine-components/ReflectionProbe.js.map +1 -1
  56. package/lib/engine-components/Renderer.d.ts +2 -0
  57. package/lib/engine-components/Renderer.js +30 -6
  58. package/lib/engine-components/Renderer.js.map +1 -1
  59. package/lib/engine-components/RendererLightmap.js +2 -3
  60. package/lib/engine-components/RendererLightmap.js.map +1 -1
  61. package/lib/engine-components/SeeThrough.d.ts +0 -2
  62. package/lib/engine-components/SeeThrough.js +114 -88
  63. package/lib/engine-components/SeeThrough.js.map +1 -1
  64. package/lib/engine-components/SmoothFollow.js.map +1 -1
  65. package/lib/engine-components/ui/Button.js.map +1 -1
  66. package/lib/engine-components/ui/Raycaster.js.map +1 -1
  67. package/lib/engine-components/web/ViewBox.d.ts +2 -2
  68. package/lib/engine-components/web/ViewBox.js +2 -2
  69. package/lib/engine-components/web/ViewBox.js.map +1 -1
  70. package/lib/engine-components/webxr/WebXRPlaneTracking.js.map +1 -1
  71. package/lib/engine-components/webxr/controllers/XRControllerFollow.js.map +1 -1
  72. package/lib/engine-components/webxr/controllers/XRControllerMovement.js.map +1 -1
  73. package/package.json +4 -4
  74. package/src/engine/api.ts +1 -1
  75. package/src/engine/engine_components.ts +7 -3
  76. package/src/engine/engine_context.ts +28 -2
  77. package/src/engine/engine_gltf_builtin_components.ts +17 -1
  78. package/src/engine/engine_materialpropertyblock.ts +405 -39
  79. package/src/engine-components/Camera.ts +2 -2
  80. package/src/engine-components/DropListener.ts +1 -1
  81. package/src/engine-components/Duplicatable.ts +1 -1
  82. package/src/engine-components/GroundProjection.ts +3 -0
  83. package/src/engine-components/NeedleMenu.ts +3 -0
  84. package/src/engine-components/NestedGltf.ts +1 -1
  85. package/src/engine-components/ReflectionProbe.ts +61 -30
  86. package/src/engine-components/Renderer.ts +34 -6
  87. package/src/engine-components/RendererLightmap.ts +2 -3
  88. package/src/engine-components/SeeThrough.ts +122 -107
  89. package/src/engine-components/SmoothFollow.ts +2 -2
  90. package/src/engine-components/ui/Button.ts +1 -1
  91. package/src/engine-components/ui/Raycaster.ts +1 -1
  92. package/src/engine-components/web/ViewBox.ts +9 -2
  93. package/src/engine-components/webxr/WebXRPlaneTracking.ts +3 -3
  94. package/src/engine-components/webxr/controllers/XRControllerFollow.ts +1 -1
  95. package/src/engine-components/webxr/controllers/XRControllerMovement.ts +4 -4
@@ -193,7 +193,7 @@ export declare function addComponent<T extends IComponent>(obj: Object3D, compon
193
193
  /** Register callbacks for registering custom gltf importer or exporter plugins */
194
194
  export declare function addCustomExtensionPlugin(ext: INeedleGLTFExtensionPlugin): void;
195
195
 
196
- export declare function addNewComponent<T extends IComponent>(obj: Object3D, componentInstance: T, callAwake?: boolean): T;
196
+ export declare function addNewComponent<T extends IComponent>(obj: Object3D, componentInstance: T, callAwake?: boolean, register?: boolean): T;
197
197
 
198
198
  /**
199
199
  * Use patcher for patching properties insteadof calling Object.defineProperty individually
@@ -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
  /**
@@ -4324,6 +4324,18 @@ export declare class Context implements IContext {
4324
4324
  * Update the camera aspect ratio or orthorgraphic camera size. This is automatically called when a DOM size change is detected.
4325
4325
  */
4326
4326
  updateAspect(camera: PerspectiveCamera | OrthographicCamera, width?: number, height?: number): void;
4327
+ /**
4328
+ * Registers all uninitialized components found in the scene hierarchy with this context.
4329
+ * Components that have been added to objects (e.g. via `addComponent`) but are not yet registered
4330
+ * with a context will be collected and queued for initialization.
4331
+ * On the next frame, these components will go through the full lifecycle: `awake` → `onEnable` → `start` → `update`.
4332
+ *
4333
+ * This is useful when components are created outside of the normal glTF loading pipeline,
4334
+ * for example in an editor that adds components during edit mode and then needs to activate them for play mode.
4335
+ * @param root The root object to search for components. Defaults to the context's scene.
4336
+ * @returns The number of components that were newly registered.
4337
+ */
4338
+ registerSceneComponents(root?: Object3D): number;
4327
4339
  /** This will recreate the whole needle engine context and dispose the whole scene content
4328
4340
  * All content will be reloaded (loading times might be faster due to browser caches)
4329
4341
  * All scripts will be recreated */
@@ -8725,7 +8737,7 @@ export declare namespace InternalScreenshotUtils {
8725
8737
  [key: string]: boolean | number;
8726
8738
  };
8727
8739
  }): FullscreenPlane;
8728
- export {};
8740
+ {};
8729
8741
  }
8730
8742
 
8731
8743
  /* Excluded from this release type: invokeLoadedImportPluginHooks */
@@ -10056,39 +10068,214 @@ export declare class MaskableGraphic extends Graphic {
10056
10068
  protected onAfterCreated(): void;
10057
10069
  }
10058
10070
 
10071
+ /**
10072
+ * MaterialPropertyBlock allows per-object material property overrides without creating new material instances.
10073
+ * This is useful for rendering multiple objects with the same base material but different properties
10074
+ * (e.g., different colors, textures, or shader parameters).
10075
+ *
10076
+ * The property block system works by:
10077
+ * - Temporarily applying overrides in onBeforeRender
10078
+ * - Restoring original values in onAfterRender
10079
+ * - Managing shader defines and program cache keys for correct shader compilation
10080
+ * - Supporting texture coordinate transforms per object
10081
+ *
10082
+ * Common use cases:
10083
+ * - **Lightmaps**: Apply unique lightmap textures to individual objects sharing the same material
10084
+ * - **Reflection Probes**: Apply different environment maps per object for localized reflections
10085
+ * - **See-through effects**: Temporarily override transparency/transmission properties for X-ray effects
10086
+ *
10087
+ * ## Getting a MaterialPropertyBlock
10088
+ *
10089
+ * **Important**: Do not use the constructor directly. Instead, use the static {@link MaterialPropertyBlock.get} method:
10090
+ *
10091
+ * ```typescript
10092
+ * const block = MaterialPropertyBlock.get(myMesh);
10093
+ * ```
10094
+ *
10095
+ * This method will either return an existing property block or create a new one if it doesn't exist.
10096
+ * It automatically:
10097
+ * - Creates the property block instance
10098
+ * - Registers it in the internal registry
10099
+ * - Attaches the necessary render callbacks to the object
10100
+ * - Handles Groups by applying overrides to all child meshes
10101
+ *
10102
+ * @example Basic usage
10103
+ * ```typescript
10104
+ * // Get or create a property block for an object
10105
+ * const block = MaterialPropertyBlock.get(myMesh);
10106
+ *
10107
+ * // Override the color property
10108
+ * block.setOverride("color", new Color(1, 0, 0));
10109
+ *
10110
+ * // Override a texture with custom UV transform (useful for lightmaps)
10111
+ * block.setOverride("lightMap", myLightmapTexture, {
10112
+ * offset: new Vector2(0.5, 0.5),
10113
+ * repeat: new Vector2(2, 2)
10114
+ * });
10115
+ *
10116
+ * // Set a shader define
10117
+ * block.setDefine("USE_CUSTOM_FEATURE", 1);
10118
+ * ```
10119
+ *
10120
+ * @example Lightmap usage
10121
+ * ```typescript
10122
+ * const block = MaterialPropertyBlock.get(mesh);
10123
+ * block.setOverride("lightMap", lightmapTexture);
10124
+ * block.setOverride("lightMapIntensity", 1.5);
10125
+ * ```
10126
+ *
10127
+ * @example See-through effect
10128
+ * ```typescript
10129
+ * const block = MaterialPropertyBlock.get(mesh);
10130
+ * block.setOverride("transparent", true);
10131
+ * block.setOverride("opacity", 0.3);
10132
+ * ```
10133
+ *
10134
+ * @template T The material type this property block is associated with
10135
+ */
10059
10136
  export declare class MaterialPropertyBlock<T extends Material = Material> {
10060
10137
  private _overrides;
10061
10138
  private _defines;
10062
10139
  private _object;
10140
+ /** The object this property block is attached to */
10063
10141
  get object(): Object3D | null;
10064
- constructor(object?: Object3D | null);
10142
+ /**
10143
+ * Creates a new MaterialPropertyBlock
10144
+ * @param object The object this property block is for (optional)
10145
+ */
10146
+ protected constructor(object?: Object3D | null);
10147
+ /**
10148
+ * Gets or creates a MaterialPropertyBlock for the given object.
10149
+ * This is the recommended way to obtain a property block instance.
10150
+ *
10151
+ * @template T The material type
10152
+ * @param object The object to get/create a property block for
10153
+ * @returns The MaterialPropertyBlock associated with this object
10154
+ *
10155
+ * @example
10156
+ * ```typescript
10157
+ * const block = MaterialPropertyBlock.get(myMesh);
10158
+ * block.setOverride("roughness", 0.5);
10159
+ * ```
10160
+ */
10065
10161
  static get<T extends Material = Material>(object: Object3D): MaterialPropertyBlock<T>;
10162
+ /**
10163
+ * Checks if an object has any property overrides
10164
+ * @param object The object to check
10165
+ * @returns True if the object has a property block with overrides
10166
+ */
10167
+ static hasOverrides(object: Object3D): boolean;
10168
+ /**
10169
+ * Disposes this property block and cleans up associated resources.
10170
+ * After calling dispose, this property block should not be used.
10171
+ */
10066
10172
  dispose(): void;
10173
+ /**
10174
+ * Sets or updates a material property override.
10175
+ * The override will be applied to the material during rendering.
10176
+ *
10177
+ * @param name The name of the material property to override (e.g., "color", "map", "roughness")
10178
+ * @param value The value to set
10179
+ * @param textureTransform Optional UV transform (only used when value is a Texture)
10180
+ *
10181
+ * @example
10182
+ * ```typescript
10183
+ * // Override a simple property
10184
+ * block.setOverride("roughness", 0.8);
10185
+ *
10186
+ * // Override a color
10187
+ * block.setOverride("color", new Color(0xff0000));
10188
+ *
10189
+ * // Override a texture with UV transform
10190
+ * block.setOverride("map", texture, {
10191
+ * offset: new Vector2(0, 0),
10192
+ * repeat: new Vector2(2, 2)
10193
+ * });
10194
+ * ```
10195
+ */
10067
10196
  setOverride<K extends NonFunctionPropertyNames<T>>(name: K, value: T[K], textureTransform?: TextureTransform): void;
10068
10197
  setOverride(name: string, value: MaterialPropertyType, textureTransform?: TextureTransform): void;
10069
- getOverride(name: string): PropertyBlockOverride | undefined;
10070
- clearOverride(name: string): void;
10198
+ /**
10199
+ * Gets the override for a specific property with type-safe value inference
10200
+ * @param name The property name to get
10201
+ * @returns The PropertyBlockOverride with correctly typed value if it exists, undefined otherwise
10202
+ *
10203
+ * @example
10204
+ * ```typescript
10205
+ * const block = MaterialPropertyBlock.get<MeshStandardMaterial>(mesh);
10206
+ *
10207
+ * // Value is inferred as number | undefined
10208
+ * const roughness = block.getOverride("roughness")?.value;
10209
+ *
10210
+ * // Value is inferred as Color | undefined
10211
+ * const color = block.getOverride("color")?.value;
10212
+ *
10213
+ * // Value is inferred as Texture | null | undefined
10214
+ * const map = block.getOverride("map")?.value;
10215
+ *
10216
+ * // Explicitly specify the type for properties not on the base material type
10217
+ * const transmission = block.getOverride<number>("transmission")?.value;
10218
+ *
10219
+ * // Or use a more specific material type
10220
+ * const physicalBlock = block as MaterialPropertyBlock<MeshPhysicalMaterial>;
10221
+ * const transmissionTyped = physicalBlock.getOverride("transmission")?.value; // number
10222
+ * ```
10223
+ */
10224
+ getOverride<K extends NonFunctionPropertyNames<T>>(name: K): PropertyBlockOverride<T[K] & MaterialPropertyType> | undefined;
10225
+ getOverride<V extends MaterialPropertyType = MaterialPropertyType>(name: string): PropertyBlockOverride<V> | undefined;
10226
+ /**
10227
+ * Removes a specific property override
10228
+ * @param name The property name to clear
10229
+ */
10230
+ removeOveride<K extends NonFunctionPropertyNames<T>>(name: K | ({} & string)): void;
10231
+ /**
10232
+ * Removes all property overrides from this block
10233
+ */
10071
10234
  clearAllOverrides(): void;
10072
- removeOverride(name: string): void;
10073
- get overrides(): PropertyBlockOverride[];
10235
+ /**
10236
+ * Gets all property overrides as a readonly array
10237
+ * @returns Array of all property overrides
10238
+ */
10239
+ get overrides(): readonly PropertyBlockOverride[];
10240
+ /**
10241
+ * Checks if this property block has any overrides
10242
+ * @returns True if there are any overrides set
10243
+ */
10074
10244
  hasOverrides(): boolean;
10075
10245
  /**
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
10246
+ * Set a shader define that will be included in the program cache key.
10247
+ * This allows different objects sharing the same material to have different shader programs.
10248
+ *
10249
+ * Defines affect shader compilation and are useful for enabling/disabling features per-object.
10250
+ *
10251
+ * @param name The define name (e.g., "USE_LIGHTMAP", "ENABLE_REFLECTIONS")
10252
+ * @param value The define value (typically a boolean, number, or string)
10253
+ *
10254
+ * @example
10255
+ * ```typescript
10256
+ * // Enable a feature for this specific object
10257
+ * block.setDefine("USE_CUSTOM_SHADER", true);
10258
+ * block.setDefine("QUALITY_LEVEL", 2);
10259
+ * ```
10078
10260
  */
10079
10261
  setDefine(name: string, value: string | number | boolean): void;
10080
10262
  /**
10081
10263
  * Remove a shader define
10264
+ * @param name The define name to remove
10082
10265
  */
10083
10266
  clearDefine(name: string): void;
10084
10267
  /**
10085
10268
  * Get all defines set on this property block
10269
+ * @returns A readonly record of all defines
10086
10270
  */
10087
10271
  getDefines(): Readonly<Record<string, string | number | boolean>>;
10088
- getCacheKey(): string;
10272
+ /* Excluded from this release type: getCacheKey */
10089
10273
  }
10090
10274
 
10091
- declare type MaterialPropertyType = number | number[] | Color | Texture | Vector2 | Vector3 | Vector4 | null;
10275
+ /**
10276
+ * Valid types that can be used as material property overrides
10277
+ */
10278
+ declare type MaterialPropertyType = number | number[] | Color | Texture | Vector2 | Vector3 | Vector4 | null | Euler;
10092
10279
 
10093
10280
  export declare namespace MaterialX {
10094
10281
  /**
@@ -10535,7 +10722,7 @@ export declare namespace NeedleEngineModelLoader {
10535
10722
  *
10536
10723
  */
10537
10724
  export function onDetermineModelMimetype(callback: MimetypeCallback): (() => void);
10538
- export {};
10725
+ {};
10539
10726
  }
10540
10727
 
10541
10728
  /**
@@ -12218,6 +12405,10 @@ export declare class NoiseModule {
12218
12405
  apply(_index: number, pos: Vec3, vel: Vec3, _deltaTime: number, age: number, life: number): void;
12219
12406
  }
12220
12407
 
12408
+ /**
12409
+ * Utility type that extracts only non-function property names from a type
12410
+ * @template T The type to extract property names from
12411
+ */
12221
12412
  declare type NonFunctionPropertyNames<T> = {
12222
12413
  [K in keyof T]: T[K] extends Function ? never : K;
12223
12414
  }[keyof T];
@@ -14691,9 +14882,16 @@ export declare class OrbitControls extends Component implements ICameraControlle
14691
14882
  constructor(reason: string);
14692
14883
  }
14693
14884
 
14694
- declare interface PropertyBlockOverride {
14885
+ /**
14886
+ * Represents a single material property override with optional texture transformation
14887
+ * @template T The type of the property value
14888
+ */
14889
+ declare interface PropertyBlockOverride<T extends MaterialPropertyType = MaterialPropertyType> {
14890
+ /** The name of the material property to override (e.g., "color", "map", "roughness") */
14695
14891
  name: string;
14696
- value: MaterialPropertyType;
14892
+ /** The value to set for this property */
14893
+ value: T;
14894
+ /** Optional texture coordinate transformation (only used when value is a Texture) */
14697
14895
  textureTransform?: TextureTransform;
14698
14896
  }
14699
14897
 
@@ -15115,20 +15313,49 @@ export declare class OrbitControls extends Component implements ICameraControlle
15115
15313
  export declare class ReflectionProbe extends Component {
15116
15314
  private static _probes;
15117
15315
  static isUsingReflectionProbe(material: Material): boolean;
15316
+ /**
15317
+ * 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.
15318
+ */
15319
+ static readonly onEnabled: EventList<ReflectionProbe>;
15320
+ static readonly onDisabled: EventList<ReflectionProbe>;
15321
+ /**
15322
+ * 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.
15323
+ *
15324
+ * 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.
15325
+ * Note: Volume-based automatic assignment is not fully supported yet, so explicit assignment is recommended for now.
15326
+ *
15327
+ * @param object The object to find a reflection probe for
15328
+ * @param context The context to search within
15329
+ * @param isAnchor If true, only return a probe if the object is the anchor of that probe
15330
+ * @param anchor Optional anchor object to match against probes
15331
+ */
15118
15332
  static get(object: Object3D | null | undefined, context: Context, isAnchor: boolean, anchor?: Object3D): ReflectionProbe | null;
15119
15333
  private _texture;
15120
15334
  set texture(tex: Texture);
15121
15335
  get texture(): Texture;
15336
+ intensity: number;
15337
+ /**
15338
+ * Defines the center and size of the reflection probe's influence area.
15339
+ */
15122
15340
  center?: Vector3;
15341
+ /**
15342
+ * Defines the size of the reflection probe's influence area. Objects within this box will be affected by the probe's reflections.
15343
+ */
15123
15344
  size?: Vector3;
15345
+ /**
15346
+ * 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.
15347
+ */
15348
+ __lightmapIntensityScale: boolean;
15124
15349
  private _boxHelper?;
15125
15350
  private isInBox;
15126
15351
  constructor();
15127
15352
  awake(): void;
15353
+ onEnable(): void;
15354
+ onDisable(): void;
15128
15355
  start(): void;
15129
15356
  onDestroy(): void;
15130
- onSet(_rend: IRenderer): void;
15131
- onUnset(_rend: IRenderer): void;
15357
+ apply(object: Object3D): void;
15358
+ unapply(obj: Object3D): void;
15132
15359
  }
15133
15360
 
15134
15361
  declare enum ReflectionProbeUsage {
@@ -15450,6 +15677,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
15450
15677
  onEnable(): void;
15451
15678
  onDisable(): void;
15452
15679
  onDestroy(): void;
15680
+ private readonly onReflectionProbeEnabled;
15681
+ private onReflectionProbeDisabled;
15453
15682
  onBeforeRender(): void;
15454
15683
  private onBeforeRenderThree;
15455
15684
  onAfterRender(): void;
@@ -16991,8 +17220,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
16991
17220
  /* Excluded from this release type: onEnable */
16992
17221
  /* Excluded from this release type: onDisable */
16993
17222
  /* Excluded from this release type: update */
16994
- private readonly rendererMaterials;
16995
- private readonly rendererMaterialsOriginal;
16996
17223
  private updateDirection;
16997
17224
  /**
16998
17225
  * Update the alpha of the object's materials towards the target alpha over the given duration.
@@ -19318,8 +19545,13 @@ export declare class OrbitControls extends Component implements ICameraControlle
19318
19545
  /**@obsolete use Graphics.textureToCanvas */
19319
19546
  export declare function textureToCanvas(texture: Texture, force?: boolean): HTMLCanvasElement | null;
19320
19547
 
19548
+ /**
19549
+ * Defines offset and repeat transformations for texture coordinates
19550
+ */
19321
19551
  declare interface TextureTransform {
19552
+ /** UV offset applied to the texture */
19322
19553
  offset?: Vector2;
19554
+ /** UV repeat/scale applied to the texture */
19323
19555
  repeat?: Vector2;
19324
19556
  }
19325
19557
 
@@ -20588,7 +20820,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
20588
20820
  * scene.add(viewBox);
20589
20821
  * ```
20590
20822
  *
20591
- * @see {@link Camera} - The camera component that ViewBox controls
20823
+ * @see {@link CameraComponent} - The camera component that ViewBox controls
20592
20824
  * @see {@link OrbitControls} - Camera controls that work alongside ViewBox
20593
20825
  * @see {@link DragControls} - Alternative camera controls compatible with ViewBox
20594
20826
  * @see {@link LookAtConstraint} - Another way to control camera targeting
@@ -20623,7 +20855,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
20623
20855
  * as they would appear with that field of view. Setting it to a wider FOV (e.g., 90) makes objects appear
20624
20856
  * smaller, while a narrower FOV (e.g., 30) makes them appear larger.
20625
20857
  *
20626
- * @see {@link Camera} for the camera component and its FOV property
20858
+ * @see {@link CameraComponent} for the camera component and its FOV property
20627
20859
  * @default -1 (automatically uses the camera's FOV on the first frame)
20628
20860
  */
20629
20861
  referenceFieldOfView: number;
@@ -22154,6 +22386,127 @@ export declare class OrbitControls extends Component implements ICameraControlle
22154
22386
  export { }
22155
22387
 
22156
22388
 
22389
+ declare global {
22390
+ interface HTMLElementTagNameMap {
22391
+ "needle-engine": NeedleEngineWebComponent;
22392
+ }
22393
+ }
22394
+
22395
+
22396
+ declare global {
22397
+ interface Navigator {
22398
+ userActivation?: {
22399
+ isActive: boolean;
22400
+ };
22401
+ }
22402
+ }
22403
+
22404
+
22405
+ declare module 'three/examples/jsm/controls/OrbitControls.js' {
22406
+ interface OrbitControls {
22407
+ _sphericalDelta: import("three").Spherical;
22408
+ _rotateLeft: (angleInRadians: number) => void;
22409
+ _rotateUp: (angleInRadians: number) => void;
22410
+ _pan: (dx: number, dy: number) => void;
22411
+ _dollyIn: (dollyScale: number) => void;
22412
+ _dollyOut: (dollyScale: number) => void;
22413
+ }
22414
+ interface OrbitControlsEventMap {
22415
+ endMovement: Event;
22416
+ }
22417
+ }
22418
+
22419
+
22420
+ declare global {
22421
+ interface ViewTimeline {
22422
+ axis: 'block' | 'inline';
22423
+ currentTime: {
22424
+ unit: 'seconds' | 'percent';
22425
+ value: number;
22426
+ };
22427
+ duration: {
22428
+ unit: 'seconds' | 'percent';
22429
+ value: number;
22430
+ };
22431
+ source: Element | null;
22432
+ startOffset: {
22433
+ unit: 'px';
22434
+ value: number;
22435
+ };
22436
+ endOffset: {
22437
+ unit: 'px';
22438
+ value: number;
22439
+ };
22440
+ }
22441
+ }
22442
+
22443
+ export declare namespace NEEDLE_ENGINE_FEATURE_FLAGS {
22444
+ let experimentalSmartHierarchyUpdate: boolean;
22445
+ }
22446
+
22447
+ /**
22448
+ * 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.
22449
+ *
22450
+ * Use the `ready` function to wait for the module to be loaded if you do not wand to trigger a load.
22451
+ *
22452
+ * If a module is already loaded it's also available in the `MODULE` variable.
22453
+ */
22454
+ export declare namespace MODULES {
22455
+ namespace MaterialX {
22456
+ type TYPE = typeof import("@needle-tools/materialx");
22457
+ let MODULE: TYPE;
22458
+ let MAYBEMODULE: TYPE | null;
22459
+ /** Wait for the module to be loaded (doesn't trigger a load) */
22460
+ function ready(): Promise<TYPE>;
22461
+ /** Load the module */
22462
+ function load(): Promise<TYPE>;
22463
+ }
22464
+ namespace RAPIER_PHYSICS {
22465
+ type TYPE = typeof import("@dimforge/rapier3d-compat");
22466
+ let MODULE: TYPE;
22467
+ let MAYBEMODULE: TYPE | null;
22468
+ /** Wait for the module to be loaded (doesn't trigger a load) */
22469
+ function ready(): Promise<TYPE>;
22470
+ /** Load the module */
22471
+ function load(): Promise<TYPE>;
22472
+ }
22473
+ namespace POSTPROCESSING {
22474
+ type TYPE = typeof import("postprocessing");
22475
+ let MODULE: TYPE;
22476
+ let MAYBEMODULE: TYPE | null;
22477
+ /** Wait for the module to be loaded (doesn't trigger a load) */
22478
+ function ready(): Promise<TYPE>;
22479
+ /** Load the module */
22480
+ function load(): Promise<TYPE>;
22481
+ }
22482
+ namespace POSTPROCESSING_AO {
22483
+ type TYPE = typeof import("n8ao");
22484
+ let MODULE: TYPE;
22485
+ let MAYBEMODULE: TYPE | null;
22486
+ /** Wait for the module to be loaded (doesn't trigger a load) */
22487
+ function ready(): Promise<TYPE>;
22488
+ /** Load the module */
22489
+ function load(): Promise<TYPE>;
22490
+ }
22491
+ }
22492
+
22493
+
22494
+ export declare namespace PreviewHelper {
22495
+ type PreviewInfo = {
22496
+ position?: Vector3Like | Vec3;
22497
+ size?: Vector3Like | Vec3;
22498
+ };
22499
+ function addPreview(params: {
22500
+ parent: Object3D;
22501
+ guid: string;
22502
+ } & PreviewInfo): {
22503
+ object: Object3D;
22504
+ onProgress: (downloadProgress: number) => void;
22505
+ };
22506
+ function removePreview(guid: string): void;
22507
+ }
22508
+
22509
+
22157
22510
  declare module 'three' {
22158
22511
  interface SkinnedMesh {
22159
22512
  staticGenerator?: StaticGeometryGenerator;
@@ -22176,21 +22529,161 @@ declare module 'three' {
22176
22529
  }
22177
22530
 
22178
22531
 
22179
- declare module 'three/examples/jsm/controls/OrbitControls.js' {
22180
- interface OrbitControls {
22181
- _sphericalDelta: import("three").Spherical;
22182
- _rotateLeft: (angleInRadians: number) => void;
22183
- _rotateUp: (angleInRadians: number) => void;
22184
- _pan: (dx: number, dy: number) => void;
22185
- _dollyIn: (dollyScale: number) => void;
22186
- _dollyOut: (dollyScale: number) => void;
22532
+ declare global {
22533
+ interface NavigatorUAData {
22534
+ platform: string;
22187
22535
  }
22188
- interface OrbitControlsEventMap {
22189
- endMovement: Event;
22536
+ interface Navigator {
22537
+ userAgentData?: NavigatorUAData;
22538
+ }
22539
+ }
22540
+
22541
+
22542
+ /**
22543
+ * Utility functions to detect certain device types (mobile, desktop), browsers, or capabilities.
22544
+ * @category Utilities
22545
+ */
22546
+ export declare namespace DeviceUtilities {
22547
+ /** @returns `true` for MacOS or Windows devices. `false` for Hololens and other headsets. */
22548
+ function isDesktop(): boolean;
22549
+ /** @returns `true` if it's a phone or tablet */
22550
+ function isMobileDevice(): boolean;
22551
+ /** @deprecated use {@link isiPad} instead */
22552
+ function isIPad(): boolean;
22553
+ /** @returns `true` if we're currently on an iPad */
22554
+ function isiPad(): boolean;
22555
+ /** @returns `true` if we're currently on an Android device */
22556
+ function isAndroidDevice(): boolean;
22557
+ /** @returns `true` if we're currently using the Mozilla XR Browser (only available for iOS) */
22558
+ function isMozillaXR(): boolean;
22559
+ /** @returns `true` if we're currently in the Needle App Clip */
22560
+ function isNeedleAppClip(): boolean;
22561
+ /** @returns `true` for MacOS devices */
22562
+ function isMacOS(): boolean;
22563
+ /** @returns `true` for VisionOS devices */
22564
+ function isVisionOS(): boolean;
22565
+ /** @returns `true` for mobile Apple devices like iPad, iPhone, iPod, Vision Pro, ... */
22566
+ function isiOS(): boolean;
22567
+ /** @returns `true` if we're currently on safari */
22568
+ function isSafari(): boolean;
22569
+ /** @returns `true` for Meta Quest devices and browser. */
22570
+ function isQuest(): boolean;
22571
+ /** @returns `true` if the browser has `<a rel="ar">` support, which indicates USDZ QuickLook support. */
22572
+ function supportsQuickLookAR(): boolean;
22573
+ /** @returns `true` if the user allowed to use the microphone */
22574
+ function microphonePermissionsGranted(): Promise<boolean>;
22575
+ function getiOSVersion(): string | null;
22576
+ function getChromeVersion(): string | null;
22577
+ function getSafariVersion(): string | null;
22578
+ }
22579
+
22580
+
22581
+ declare global {
22582
+ interface Window {
22583
+ SPECTOR?: {
22584
+ Spector: new () => Spector;
22585
+ };
22586
+ }
22587
+ interface Spector {
22588
+ displayUI: () => void;
22589
+ setCanvas: (canvas: HTMLCanvasElement) => void;
22590
+ spyCanvases: boolean;
22591
+ startCaptureOnNextFrame: () => void;
22592
+ captureCanvas: (canvas: HTMLCanvasElement) => any;
22593
+ }
22594
+ }
22595
+
22596
+
22597
+ declare global {
22598
+ interface HTMLElementTagNameMap {
22599
+ "needle-logo-element": NeedleLogoElement;
22190
22600
  }
22191
22601
  }
22192
22602
 
22193
22603
 
22604
+ export declare namespace MaterialX {
22605
+ /**
22606
+ * 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.
22607
+ */
22608
+ function loadFromUrl(urlOrXML: string, opts?: {
22609
+ url?: string;
22610
+ loadingManager?: LoadingManager;
22611
+ materialNameOrIndex?: number | string;
22612
+ }): Promise<import("three").Material | null>;
22613
+ }
22614
+
22615
+ declare global {
22616
+ interface HTMLElementTagNameMap {
22617
+ "needle-button": NeedleButtonElement;
22618
+ }
22619
+ }
22620
+
22621
+ /**
22622
+ * @internal
22623
+ */
22624
+ export declare namespace InternalAttributeUtils {
22625
+ /**
22626
+ * Checks if the given value is considered "falsey" in the context of HTML attributes.
22627
+ * A value is considered falsey if it is "0" or "false" (case-insensitive).
22628
+ *
22629
+ * @param value - The attribute value to check.
22630
+ * @returns True if the value is falsey, otherwise false.
22631
+ */
22632
+ function isFalsey(value: string | null): boolean;
22633
+ /**
22634
+ * Retrieves the value of the specified attribute from the given element.
22635
+ * If the attribute value is considered falsey, it returns null.
22636
+ * @returns The attribute value or null if falsey.
22637
+ */
22638
+ function getAttributeValueIfNotFalsey(element: Element, attributeName: string, opts?: {
22639
+ onAttribute: (value: string) => void;
22640
+ }): string | null;
22641
+ /**
22642
+ * Retrieves the value of the specified attribute from the given element.
22643
+ * If the attribute value is considered falsey, it returns false.
22644
+ * If the attribute is not set at all, it returns null.
22645
+ * @returns The attribute value, false if falsey, or null if not set.
22646
+ *
22647
+ * @example
22648
+ * ```typescript
22649
+ * const result = HTMLAttributeUtils.getAttributeAndCheckFalsey(element, 'data-example', {
22650
+ * onAttribute: (value, falsey) => {
22651
+ * console.log(`Attribute value: ${value}
22652
+ * , Is falsey: ${falsey}`);
22653
+ * }
22654
+ * });
22655
+ *
22656
+ * if (result === false) {
22657
+ * console.log('The attribute is set to a falsey value.');
22658
+ * } else if (result === null) {
22659
+ * console.log('The attribute is not set.');
22660
+ * } else {
22661
+ * console.log(`The attribute value is: ${result}`);
22662
+ * }
22663
+ * ```
22664
+ */
22665
+ function getAttributeAndCheckFalsey(element: Element, attributeName: string, opts?: {
22666
+ onAttribute: (value: string, falsey: boolean) => void;
22667
+ }): false | string | null;
22668
+ }
22669
+
22670
+
22671
+ /**
22672
+ * @category Splines
22673
+ * @see {@link SplineContainer} for the main spline component that defines the path and knots
22674
+ */
22675
+ export declare namespace SplineUtils {
22676
+ /**
22677
+ * Creates a SplineContainer from an array of points.
22678
+ * @param positions The positions of the knots.
22679
+ * @param closed Whether the spline is closed (the last knot connects to the first).
22680
+ * @param tension The tension of the spline. 0 is no tension, 1 is high tension (straight lines between knots). Default is 0.75.
22681
+ * @return The created SplineContainer component - add it to an Object3D to use it.
22682
+ */
22683
+ function createFromPoints(positions: Vector3[], closed?: boolean, tension?: number): SplineContainer;
22684
+ }
22685
+
22686
+
22194
22687
  declare module 'three' {
22195
22688
  interface Object3D {
22196
22689
  get guid(): string | undefined;
@@ -22330,9 +22823,37 @@ declare module 'three' {
22330
22823
  }
22331
22824
  }
22332
22825
 
22826
+ declare global {
22827
+ interface HTMLElementTagNameMap {
22828
+ "needle-logo-element": NeedleLogoElement;
22829
+ }
22830
+ }
22831
+
22832
+
22833
+ /**
22834
+ * Internal registry for USDZ exporters. This is used by NeedleXRSession.start("immersive-ar")
22835
+ */
22836
+ export declare namespace InternalUSDZRegistry {
22837
+ function exportAndOpen(): boolean;
22838
+ function registerExporter(exporter: USDZExporter): void;
22839
+ function unregisterExporter(exporter: USDZExporter): void;
22840
+ }
22841
+
22333
22842
 
22334
22843
  declare module 'three' {
22335
22844
  interface Vector3 {
22336
22845
  slerp(end: Vector3, t: number): Vector3;
22337
22846
  }
22338
22847
  }
22848
+
22849
+ export declare namespace LCP {
22850
+ function observe(): void;
22851
+ }
22852
+
22853
+ /**
22854
+ * @param args - The arguments to initialize the performance analytics with.
22855
+ */
22856
+ export declare module NeedleEnginePerformanceAnalytics {
22857
+ function init(...args: Array<"lcp">): void;
22858
+ }
22859
+