@needle-tools/engine 5.1.10 → 5.1.12

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