@needle-tools/engine 5.1.10 → 5.1.11

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 (56) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/SKILL.md +2 -0
  3. package/components.needle.json +1 -1
  4. package/dist/{needle-engine.bundle-DZD-GG7l.min.js → needle-engine.bundle-d-dLyN3s.min.js} +127 -127
  5. package/dist/{needle-engine.bundle-Dv5TidOk.umd.cjs → needle-engine.bundle-n5YALNtc.umd.cjs} +113 -113
  6. package/dist/{needle-engine.bundle-DP--RGAU.js → needle-engine.bundle-ue2Lw4bF.js} +3798 -3755
  7. package/dist/needle-engine.d.ts +52 -13
  8. package/dist/needle-engine.js +534 -534
  9. package/dist/needle-engine.min.js +1 -1
  10. package/dist/needle-engine.umd.cjs +1 -1
  11. package/lib/engine/api.d.ts +1 -1
  12. package/lib/engine/api.js +1 -1
  13. package/lib/engine/api.js.map +1 -1
  14. package/lib/engine/engine_init.js +2 -2
  15. package/lib/engine/engine_license.d.ts +7 -7
  16. package/lib/engine/engine_license.js +71 -71
  17. package/lib/engine/engine_license.js.map +1 -1
  18. package/lib/engine/engine_math.d.ts +13 -0
  19. package/lib/engine/engine_math.js +17 -0
  20. package/lib/engine/engine_math.js.map +1 -1
  21. package/lib/engine/engine_networking_blob.js +3 -3
  22. package/lib/engine/engine_utils_qrcode.js +2 -2
  23. package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
  24. package/lib/engine/webcomponents/needle menu/needle-menu.js +5 -5
  25. package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
  26. package/lib/engine/webcomponents/needle-engine.js +2 -2
  27. package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
  28. package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
  29. package/lib/engine/xr/TempXRContext.js +2 -2
  30. package/lib/engine-components/DragControls.d.ts +0 -5
  31. package/lib/engine-components/DragControls.js +0 -8
  32. package/lib/engine-components/DragControls.js.map +1 -1
  33. package/lib/engine-components/RendererInstancing.d.ts +34 -3
  34. package/lib/engine-components/RendererInstancing.js +92 -11
  35. package/lib/engine-components/RendererInstancing.js.map +1 -1
  36. package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
  37. package/lib/engine-components/splines/SplineWalker.js +9 -3
  38. package/lib/engine-components/splines/SplineWalker.js.map +1 -1
  39. package/package.json +1 -1
  40. package/plugins/common/license.js +4 -4
  41. package/plugins/vite/license.js +4 -4
  42. package/src/engine/api.ts +1 -1
  43. package/src/engine/engine_init.ts +2 -2
  44. package/src/engine/engine_license.ts +68 -68
  45. package/src/engine/engine_math.ts +17 -0
  46. package/src/engine/engine_networking_blob.ts +3 -3
  47. package/src/engine/engine_utils_qrcode.ts +2 -2
  48. package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
  49. package/src/engine/webcomponents/needle menu/needle-menu.ts +5 -5
  50. package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
  51. package/src/engine/webcomponents/needle-engine.ts +2 -2
  52. package/src/engine/xr/TempXRContext.ts +2 -2
  53. package/src/engine-components/DragControls.ts +0 -7
  54. package/src/engine-components/RendererInstancing.ts +92 -11
  55. package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
  56. package/src/engine-components/splines/SplineWalker.ts +9 -3
@@ -116,10 +116,6 @@ import { XRHandSpace } from 'three';
116
116
 
117
117
  export declare const $componentName: unique symbol;
118
118
 
119
- /* Excluded from this release type: $fHATZ */
120
-
121
- /* Excluded from this release type: $Ljyi */
122
-
123
119
  export declare const $physicsKey: unique symbol;
124
120
 
125
121
  export declare class __Ignore {
@@ -127,7 +123,9 @@ export declare class __Ignore {
127
123
 
128
124
  export declare function __internalNotifyObjectDestroyed(obj: Object3D): void;
129
125
 
130
- /* Excluded from this release type: __KODK */
126
+ /* Excluded from this release type: __nlZsk */
127
+
128
+ /* Excluded from this release type: __zrAx */
131
129
 
132
130
  /** Data describing the accessible semantics for a 3D object or component. */
133
131
  declare type AccessibilityData = {
@@ -5904,11 +5902,6 @@ export declare class DragControls extends Component implements IPointerEventHand
5904
5902
  * This is similar to mouse acceleration on a screen.
5905
5903
  */
5906
5904
  xrDistanceDragFactor: number;
5907
- /**
5908
- * When enabled, draws a visual line from the dragged object downwards to the next raycast hit,
5909
- * providing visual feedback about the object's position relative to surfaces below it.
5910
- */
5911
- showGizmo: boolean;
5912
5905
  /** Drag profile for screen / touch / mouse input. Reads live from the flat serialized fields. */
5913
5906
  readonly screenProfile: DragProfile;
5914
5907
  /** Drag profile for XR tracked-pointer and transient-pointer input. Reads live from the flat `xr*` serialized fields. */
@@ -9494,11 +9487,30 @@ export declare class InputField extends Component implements IPointerEventHandle
9494
9487
  private processInputOniOS;
9495
9488
  }
9496
9489
 
9490
+ /**
9491
+ * Renders one geometry+material combination for many objects using a
9492
+ * {@link https://threejs.org/docs/#api/en/objects/BatchedMesh | BatchedMesh}.
9493
+ *
9494
+ * The BatchedMesh belongs to this class: it is created here, parented directly to the untransformed
9495
+ * `context.scene` and never moved, so its transform is whatever {@link applyBatchTransform} puts
9496
+ * there and nothing else.
9497
+ *
9498
+ * **Mirroring:** three flips the winding for a mirrored transform per *draw call*, from
9499
+ * `object.matrixWorld.determinant()` - and for a batch that object is the BatchedMesh, not the
9500
+ * instance. So mirrored instances get their own batch, which carries the mirror on its own
9501
+ * transform (`scale.z = -1`); otherwise their front faces would be culled.
9502
+ *
9503
+ * That mirror is the one transform the shader's `modelMatrix * batchingMatrix` would otherwise apply
9504
+ * twice, so a mirrored batch stores its instance matrices with it undone. Every other batch is
9505
+ * untransformed and stores world matrices as they are.
9506
+ */
9497
9507
  declare class InstancedMeshRenderer {
9498
9508
  /** The three instanced mesh
9499
9509
  * @link https://threejs.org/docs/#api/en/objects/InstancedMesh
9500
9510
  */
9501
9511
  get batchedMesh(): BatchedMesh;
9512
+ /** True if this batch renders mirrored objects. A batch only holds one or the other. */
9513
+ get mirrored(): boolean;
9502
9514
  get visible(): boolean;
9503
9515
  set visible(val: boolean);
9504
9516
  get castShadow(): boolean;
@@ -9521,6 +9533,7 @@ declare class InstancedMeshRenderer {
9521
9533
  updateBounds(box?: boolean, sphere?: boolean): void;
9522
9534
  private _context;
9523
9535
  private _batchedMesh;
9536
+ private readonly _mirrored;
9524
9537
  private _handles;
9525
9538
  private _geometryIds;
9526
9539
  private _maxInstanceCount;
@@ -9529,25 +9542,33 @@ declare class InstancedMeshRenderer {
9529
9542
  private _currentIndexCount;
9530
9543
  private _maxVertexCount;
9531
9544
  private _maxIndexCount;
9532
- private static nullMatrix;
9545
+ private static instanceMatrix;
9533
9546
  private static lodProjectionScreenMatrix;
9547
+ private static debugBoundsSphere;
9534
9548
  private static debugLODColor;
9535
9549
  private static lodSelectionResult;
9536
9550
  /** Check if the geometry can be added to this instancer
9537
9551
  * @param geometry The geometry to check
9538
9552
  * @param material The material of the geometry
9553
+ * @param mirrored Whether the object's world matrix has a negative determinant
9539
9554
  * @returns true if the geometry can be added
9540
9555
  */
9541
- canAdd(geometry: BufferGeometry, material: Material): boolean;
9556
+ canAdd(geometry: BufferGeometry, material: Material, mirrored: boolean): boolean;
9542
9557
  private _needUpdateBounds;
9543
9558
  private _debugMaterial;
9544
9559
  private getBatchedMeshName;
9545
- constructor(name: string, geo: BufferGeometry, material: Material, initialMaxCount: number, context: Context);
9560
+ constructor(name: string, geo: BufferGeometry, material: Material, initialMaxCount: number, context: Context, mirrored?: boolean);
9546
9561
  dispose(): void;
9547
9562
  addInstance(obj: Mesh, geometry?: BufferGeometry): InstanceHandle | null;
9548
9563
  add(handle: InstanceHandle): boolean;
9549
9564
  remove(handle: InstanceHandle, delete_: boolean): void;
9550
9565
  updateInstance(mat: Matrix4, index: number): void;
9566
+ /** The batch's own transform. This class owns it: the mirror is the only thing that ever goes
9567
+ * here, and the batch is never reparented away from the untransformed scene root. */
9568
+ private applyBatchTransform;
9569
+ /** Writes a *world* matrix to an instance slot, converted into the batch's local space.
9570
+ * All instance matrix writes go through here. */
9571
+ private setInstanceMatrix;
9551
9572
  updateGeometry(geo: BufferGeometry, geometryIndex: number): boolean;
9552
9573
  private onBeforeRender;
9553
9574
  private updateProgressiveMeshLODs;
@@ -9605,6 +9626,9 @@ export declare class InstanceHandle {
9605
9626
  updateMeshInformation(): boolean;
9606
9627
  /** Updates the matrix from the rendered object. Will also call updateWorldMatrix internally */
9607
9628
  updateInstanceMatrix(updateChildren?: boolean, updateMatrix?: boolean): void;
9629
+ private _didWarnAboutMirroringChange;
9630
+ /** Batches are bucketed by mirroring at setup time and an instance can not move between them. */
9631
+ private assertMirroringUnchanged;
9608
9632
  /** Updates the matrix of the instance */
9609
9633
  setMatrix(matrix: Matrix4): void;
9610
9634
  /** Can be used to change the geometry of this instance */
@@ -11630,6 +11654,19 @@ declare class MathHelper {
11630
11654
  * @returns Value clamped to [0, 1]
11631
11655
  */
11632
11656
  clamp01(value: number): number;
11657
+ /**
11658
+ * Loops a value so that it never exceeds `length` and never goes below 0 — the modulo you
11659
+ * usually want for wrapping. Note that JavaScript's `%` operator is a *remainder*: it keeps the
11660
+ * sign of the dividend, so `-0.25 % 1` is `-0.25`, not `0.75`. This returns `0.75`.
11661
+ * @param value Value to wrap
11662
+ * @param length Length of the range to wrap into (defaults to 1)
11663
+ * @returns Value wrapped into [0, length)
11664
+ * @example ```javascript
11665
+ * Mathf.repeat(1.5, 1); // 0.5
11666
+ * Mathf.repeat(-0.25, 1); // 0.75
11667
+ * ```
11668
+ */
11669
+ repeat(value: number, length?: number): number;
11633
11670
  /**
11634
11671
  * Linearly interpolates between two values.
11635
11672
  * @param value1 Start value (returned when t=0)
@@ -14061,6 +14098,8 @@ export declare function offXRSessionEnd(fn: (evt: XRSessionEventArgs) => void):
14061
14098
  */
14062
14099
  export declare function offXRSessionStart(fn: (evt: XRSessionEventArgs) => void): void;
14063
14100
 
14101
+ /* Excluded from this release type: oMxKl */
14102
+
14064
14103
  /**
14065
14104
  * @experimental
14066
14105
  * Subscribe to a DOM event on any {@link EventTarget} (window, document, HTML elements, etc.)