@babylonjs/lite-compat 1.38.0-preview → 1.38.2-preview

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -257,12 +257,19 @@ export declare interface AbstractEngineOptions extends EngineOptions_2 {
257
257
  * visibility, and shadow-receipt. Concrete meshes derive from this.
258
258
  */
259
259
  export declare class AbstractMesh extends TransformNode {
260
260
  private _material;
261
261
  private _meshBlendingTag;
262
+ protected _visibilityValue: number;
262
263
  protected _visible: boolean;
263
264
  constructor(name: string, lite: Mesh_2, scene?: Scene);
264
265
  getClassName(): string;
265
266
  get material(): CompatMaterial | null;
266
267
  set material(value: CompatMaterial | null);
267
268
  get isVisible(): boolean;
268
269
  set isVisible(value: boolean);
270
+ /** Raw finite Babylon visibility; rendering clamps it to [0, 1]. Independent of isVisible. */
271
+ get visibility(): number;
272
+ set visibility(value: number);
273
+ private _validateCompatOpacityMaterial;
274
+ /** A glTF node owns its immediate primitive meshes, never a child glTF node's primitives. */
275
+ private _opacityTargets;
269
276
  get isPickable(): boolean;
270
277
  set isPickable(value: boolean);
271
278
  get receiveShadows(): boolean;
@@ -295,8 +302,8 @@ export declare class AbstractMesh extends TransformNode {
295
302
  private _material;
296
303
  getVerticesData(kind: string): Float32Array | null;
297
304
  /**
298
305
  * Babylon.js `mesh.setVerticesData(kind, data)` — replace a vertex attribute.
299
- * `position` / `normal` / `uv` / `color` / `tangent` re-upload the geometry in
300
- * place; the last-set `color`/`tangent` buffers are retained so successive calls
306
+ * `position` / `normal` / `uv` / `color` / `tangent` re-upload the geometry, into the
307
+ * existing GPU buffers when its layout is unchanged (`writeMeshGeometry`); the last-set `color`/`tangent` buffers are retained so successive calls
301
308
  * (e.g. set tangent then set color) keep both. Skinning/morph attributes
302
309
  * (`matricesIndices`, etc.) are accepted but not applied (Babylon Lite drives
303
310
  * skinning through its own loaded-skeleton path).
@@ -311,8 +318,8 @@ export declare class AbstractMesh extends TransformNode {
311
318
  private _material;
312
319
  getIndices(_copyWhenShared?: boolean, forceCopy?: boolean): Uint32Array | null;
313
320
  /**
314
321
  * Babylon.js `mesh.setIndices(indices)` — replace the mesh's index (topology)
315
- * buffer. Babylon Lite re-uploads the geometry in place via `resizeMeshGeometry`,
316
- * keeping the existing position/normal/uv/tangent/color attributes and swapping
322
+ * buffer. The geometry is re-uploaded through `writeMeshGeometry` (into the existing
323
+ * buffers when the index count is unchanged), keeping the existing position/normal/uv/tangent/color attributes and swapping
317
324
  * only the indices. Returns the mesh for chaining.
318
325
  */
319
326
  setIndices(indices: number[] | Uint16Array | Uint32Array | Int32Array, _totalVertices?: number | null, _updatable?: boolean): this;
320
327
  private _lastTangents;
@@ -390,6 +397,8 @@ export declare abstract class AbstractScene {
390
397
  /**
391
398
  getMeshById(id: string): TransformNode | null;
392
399
  /** Babylon.js legacy `scene.getMeshByID(id)` — alias of {@link getMeshById}. */
393
400
  getMeshByID(id: string): TransformNode | null;
401
+ /** Babylon.js `scene.getMeshByUniqueId(uniqueId)` — the mesh with that auto-generated `uniqueId`, else `null`. */
402
+ getMeshByUniqueId(uniqueId: number): TransformNode | null;
394
403
  /** Babylon.js `scene.getNodeByName(name)` — searches meshes, cameras, and lights. */
395
404
  getNodeByName(name: string): Node_2 | null;
396
405
  /** Babylon.js `scene.getNodeById(id)` — searches meshes, cameras, and lights by `id`. */
@@ -639,10 +648,16 @@ declare class Animatable_2 {
639
648
  private readonly _from;
640
649
  private readonly _to;
641
650
  private readonly _loop;
642
- masterFrame: number;
643
651
  private _speedRatio;
652
+ masterFrame: number;
653
+ /** Babylon.js `onAnimationEnd`: called when the animatable ends, on its own or through `stop()`. */
654
+ onAnimationEnd: (() => void) | null;
655
+ /** Babylon.js `onAnimationEndObservable`: notified right after `onAnimationEnd`. */
656
+ readonly onAnimationEndObservable: Observable<Animatable_2>;
657
+ /** Babylon.js `disposeOnEnd`: when the animatable completes on its own, its end callback and observers are cleared once
658
+ * they ran (default true). Unlike Babylon.js, compat keeps it in `scene.animatables`. */
659
+ disposeOnEnd: boolean;
644
660
  private _speedRatio;
645
661
  private _paused;
646
- private _stopped;
647
- private readonly _nativeManager;
662
+ private _stopped;
648
663
  private readonly _nativeManager;
649
664
  private readonly _fallbackAnimations;
650
665
  private readonly _fallbackFrames;
651
666
  private readonly _fallbackElapsedFrames;
@@ -652,8 +667,15 @@ declare class Animatable_2 {
652
667
  set speedRatio(value: number);
653
668
  goToFrame(frame: number): void;
654
669
  pause(): void;
655
670
  restart(): void;
656
- stop(): void;
657
- get animationStarted(): boolean;
671
+ /**
672
+ * Babylon.js `stop(animationName?, targetMask?, useGlobalSplice?, skipOnAnimationEnd?)`: stops the animatable and raises
673
+ * its end unless `skipOnAnimationEnd`. Stopping only the tracks matching `animationName` or `targetMask` is not supported.
674
+ */
675
+ stop(animationName?: string, targetMask?: (target: unknown) => boolean, _useGlobalSplice?: boolean, skipOnAnimationEnd?: boolean): void;
676
+ /** Babylon.js `waitAsync()`: resolves with this animatable when it next ends. */
677
+ waitAsync(): Promise<Animatable_2>;
658
678
  get animationStarted(): boolean;
679
+ private _raiseOnAnimationEnd;
680
+ private _raiseOnCompletion;
659
681
  private _applyFallback;
660
682
  private _advanceFallback;
661
683
  private _resetFallbackAnimation;
@@ -1251,6 +1273,11 @@ export declare abstract class Camera extends Node_2 {
1251
1273
  get globalPosition(): Vector3;
1252
1274
  /** Babylon.js `camera.getViewMatrix()` — the camera's view matrix. */
1253
1275
  getViewMatrix(): Matrix;
1276
+ /** Babylon.js `camera.getDirection(localAxis)`: `localAxis` in world space, without translation. */
1277
+ getDirection(localAxis: Vector3): Vector3;
1278
+ /** Babylon.js `camera.getDirectionToRef(localAxis, result)`: `localAxis` turned by the camera's world matrix, which Lite
1279
+ * keeps current. `result` may be `localAxis`. */
1280
+ getDirectionToRef(localAxis: Vector3, result: Vector3): void;
1254
1281
  /** Babylon.js `camera.getProjectionMatrix()` — the camera's projection matrix. */
1255
1282
  getProjectionMatrix(): Matrix;
1256
1283
  private _aspectRatio;
@@ -3835,7 +3862,20 @@ export declare abstract class Light extends Node_2 {
3835
3862
  protected constructor(n
3836
3863
  * carries `0`, but the getter still returns the logical value the caller set.
3837
3864
  */
3838
3865
  get intensity(): number;
3839
- set intensity(value: number);
3840
3866
  /** Detach this light's shadow generator (compat for `light.shadowEnabled = false`). */
3867
+ set intensity(value: number);
3841
3868
  private _excludedMeshes;
3869
+ private _includedOnlyMeshes;
3870
+ private _meshListSyncScheduled;
3871
+ private _meshListSceneRelease;
3872
+ /**
3873
+ * Meshes this light does not light. Babylon.js hands out the light's own array, and
3874
+ * `push` / `splice` on it are observed (those are the two methods Babylon.js hooks), so both
3875
+ * `light.excludedMeshes = [...]` and `light.excludedMeshes.push(mesh)` reach the Lite light.
3876
+ */
3877
+ get excludedMeshes(): AbstractMesh[];
3878
+ set excludedMeshes(value: AbstractMesh[]);
3879
+ /** Meshes this light lights exclusively. Live in the same way as {@link excludedMeshes}. */
3880
+ get includedOnlyMeshes(): AbstractMesh[];
3881
+ set includedOnlyMeshes(value: AbstractMesh[]);
3842
3882
  private _spliceMeshOut;
3843
3883
  /** Detach this light's shadow generator (compat for `light.shadowEnabled = false`). */
3844
3884
  set shadowEnabled(enabled: boolean);
3845
3885
 
3846
3886
  export declare class LightGizmo {
3847
3887
  private _attached;
@@ -4094,6 +4134,10 @@ export declare class Matrix {
4094
4134
  decompose(scale?: Vector3, rotation?: Quaternion, translation?: Vector3): boolean;
4095
4135
  static FromValues(m0: number, m1: number, m2: number, m3: number, m4: number, m5: number, m6: number, m7: number, m8: number, m9: number, m10: number, m11: number, m12: number, m13: number, m14: number, m15: number): Matrix;
4096
4136
  static FromArray(array: ArrayLike<number>, offset?: number): Matrix;
4137
+ /** Babylon.js `Matrix.Invert(source)`: a new matrix holding the inverse of `source`, which is left as it is. */
4138
+ static Invert(source: Matrix): Matrix;
4139
+ /** Babylon.js `Matrix.FromXYZAxesToRef(xaxis, yaxis, zaxis, result)`: the axes as the first three rows. */
4140
+ static FromXYZAxesToRef<T extends Matrix>(xaxis: Vector3, yaxis: Vector3, zaxis: Vector3, result: T): T;
4097
4141
  static Identity(): Matrix;
4098
4142
  static Zero(): Matrix;
4099
4143
  static Translation(x: number, y: number, z: number): Matrix;
@@ -5472,7 +5516,18 @@ export declare class Quaternion {
5472
5516
  static FromLookDirectionRHToRef<T extends Quaternion>(forward: Vector3, up: Vector3, result: T): T;
5473
5517
  private static _FromRotationStorageToRef;
5474
5518
  static FromEulerAngles(x: number, y: number, z: number): Quaternion;
5519
+ /** Babylon.js `Quaternion.FromEulerVector(vec)`: `vec` holds pitch (x), yaw (y) and roll (z). */
5520
+ static FromEulerVector(vec: Vector3): Quaternion;
5521
+ /** Babylon.js `Quaternion.FromEulerVectorToRef(vec, result)`. */
5522
+ static FromEulerVectorToRef<T extends Quaternion>(vec: Vector3, result: T): T;
5523
+ /** Babylon.js `Quaternion.RotationQuaternionFromAxis(axis1, axis2, axis3)`: the rotation of the XYZ system onto these axes. */
5524
+ static RotationQuaternionFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Quaternion;
5525
+ /** Babylon.js `Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, ref)`. Like Babylon.js, it normalizes
5526
+ * copies of the axes and uses them as the rows of a rotation matrix (`Matrix.FromXYZAxesToRef`); the axes are left as they are. */
5527
+ static RotationQuaternionFromAxisToRef<T extends Quaternion>(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: T): T;
5475
5528
  static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
5529
+ /** Babylon.js `Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, result)`. */
5530
+ static RotationYawPitchRollToRef<T extends Quaternion>(yaw: number, pitch: number, roll: number, result: T): T;
5476
5531
  static RotationAxis(axis: Vector3, angle: number): Quaternion;
5477
5532
  static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
5478
5533
  }
@@ -6010,18 +6065,24 @@ export declare class Scene extends AbstractScene {
6010
6065
  /** Babylon.js fog-mode c
6011
6066
  /** Babylon.js `scene.disablePhysicsEngine()` — release the active physics world. */
6012
6067
  disablePhysicsEngine(): void;
6013
6068
  /**
6014
- * Babylon.js `scene.beginDirectAnimation(target, animations, from, to, loop, speedRatio?)`.
6069
+ * Babylon.js `scene.beginDirectAnimation(target, animations, from, to, loop, speedRatio?, onAnimationEnd?)`.
6015
6070
  * Delegates supported tracks to Babylon Lite property animation and retains
6016
6071
  * explicit compat evaluation only for unsupported tracks. Returns one facade
6017
6072
  * coordinating both subsets.
6018
6073
  */
6019
- beginDirectAnimation(target: unknown, animations: Animation_2[], from: number, to: number, loop?: boolean, speedRatio?: number): Animatable_2;
6020
6074
  /**
6021
- * Babylon.js `scene.beginAnimation(target, from, to, loop, speedRatio?)`. Runs
6022
- * the animations already attached to `target.animations`.
6075
+ beginDirectAnimation(target: unknown, animations: Animation_2[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable_2;
6023
6076
  /**
6077
+ * Babylon.js `scene.beginAnimation(target, from, to, loop, speedRatio?, onAnimationEnd?, animatable?, stopCurrent?)`.
6078
+ * Runs the animations already attached to `target.animations`. As in Babylon.js, the target's running animatables
6079
+ * are stopped first unless `stopCurrent` is false. Appending to an existing `animatable` is not supported.
6024
6080
  */
6025
6081
  beginAnimation(target: {
6026
6082
  animations?: Animation_2[];
6027
- }, from: number, to: number, loop?: boolean, speedRatio?: number): Animatable_2;
6083
+ }, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable_2 | null, stopCurrent?: boolean): Animatable_2;
6084
+ /**
6085
+ * Babylon.js `scene.stopAnimation(target)`: stops every running animatable of `target`, which raises their
6086
+ * `onAnimationEnd`. Stopping only the tracks matching `animationName` or `targetMask` is not supported.
6087
+ */
6088
+ stopAnimation(target: unknown, animationName?: string, targetMask?: (target: unknown) => boolean): void;
6028
6089
  dispose(): void;
6029
6090
  }
6030
6091
 
@@ -6915,6 +6976,11 @@ export declare class TransformNode extends Node_2 {
6915
6976
  physicsBody: PhysicsBody
6916
6977
  */
6917
6978
  get rotationQuaternion(): Quaternion | null;
6918
6979
  set rotationQuaternion(value: Quaternion | null);
6980
+ /**
6981
+ * Babylon.js `getChildTransformNodes(directDescendantsOnly?, predicate?)` — the descendants that are transform nodes
6982
+ * (meshes included). As in Babylon.js, `predicate` is called on every evaluated descendant.
6983
+ */
6984
+ getChildTransformNodes(directDescendantsOnly?: boolean, predicate?: (node: Node_2) => boolean): TransformNode[];
6919
6985
  /**
6920
6986
  * Babylon.js `setParent(node)` — reparent while **preserving world position**
6921
6987
  * (the child's local transform is recomputed). Distinct from the `parent`
@@ -7148,6 +7214,8 @@ export declare class Vector2 {
7148
7214
  y: number;
7149
7215
  }>(result: T): T;
7150
7216
  clone(): Vector2;
7217
+ /** Babylon.js `dot(otherVector)`. */
7218
+ dot(otherVector: Vector2): number;
7151
7219
  equals(other: Vector2): boolean;
7152
7220
  asArray(): [number, number];
7153
7221
  static Zero(): Vector2;
@@ -7181,6 +7249,8 @@ export declare class Vector3 {
7181
7249
  lengthSquared(): number;
7182
7250
  normalize(): this;
7183
7251
  clone(): Vector3;
7252
+ /** Babylon.js `dot(otherVector)`. */
7253
+ dot(otherVector: Vector3): number;
7184
7254
  equals(other: Vector3): boolean;
7185
7255
  equalsWithEpsilon(other: Vector3, epsilon?: number): boolean;
7186
7256
  asArray(): [number, number, number];
@@ -7243,6 +7313,8 @@ export declare class Vector4 {
7243
7313
  scale(scale: number): Vector4;
7244
7314
  length(): number;
7245
7315
  clone(): Vector4;
7316
+ /** Babylon.js `dot(otherVector)`. */
7317
+ dot(otherVector: Vector4): number;
7246
7318
  equals(other: Vector4): boolean;
7247
7319
  asArray(): [number, number, number, number];
7248
7320
  static Zero(): Vector4;
@@ -7283,7 +7355,8 @@ export declare class VertexData {
7283
7355
  /**
7284
7356
  * Babylon.js `VertexData.applyToMesh(mesh)` — upload this CPU geometry onto a
7285
7357
  * mesh (typically one created via `new Mesh(name, scene)`). Replaces the Lite
7286
- * mesh's geometry in place via `resizeMeshGeometry`. Normals are computed flat
7358
+ * mesh's geometry through `writeMeshGeometry` (into the existing buffers when the
7359
+ * layout is unchanged, new ones otherwise). Normals are computed flat
7287
7360
  * if omitted (Babylon Lite requires a normals buffer).
7288
7361
  */
7289
7362
  applyToMesh(mesh: Mesh): void;