@babylonjs/lite-compat 1.30.0-preview → 1.31.1-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/navigation.d.ts CHANGED
@@ -127,6 +127,11 @@ declare abstract class AbstractEngine {
127
127
  * scoped API cannot reproduce the engine-wide state without a pipeline-owner lifecycle policy.
128
128
  */
129
129
  setAlphaToCoverage(_enable: boolean): never;
130
+ /**
131
+ * Babylon.js `engine.isOcclusionQueryVisible(query)` — Lite does not expose
132
+ * occlusion-query allocation, render-pass encoding, or asynchronous result state.
133
+ */
134
+ isOcclusionQueryVisible(_query: unknown): never;
130
135
  /**
131
136
  * Babylon.js `engine.updateTextureArrayLayerFromImageSource(texture, source, layer, invertY, premultiplyAlpha)`
132
137
  * — the engine extension that uploads a decoded image source into one layer of a 2D array
@@ -148,6 +153,7 @@ declare abstract class AbstractEngine {
148
153
  * visibility, and shadow-receipt. Concrete meshes derive from this.
149
154
  */
150
155
  declare class AbstractMesh extends TransformNode {
151
156
  private _material;
157
+ private _meshBlendingTag;
152
158
  protected _visible: boolean;
153
159
  constructor(name: string, lite: Mesh, scene?: Scene);
154
160
  getClassName(): string;
155
161
  get material(): CompatMaterial | null;
@@ -158,6 +164,8 @@ declare class AbstractMesh extends TransformNode {
158
164
  private _material;
159
165
  set isPickable(value: boolean);
160
166
  get receiveShadows(): boolean;
161
167
  set receiveShadows(value: boolean);
168
+ get meshBlendingTag(): number;
169
+ set meshBlendingTag(value: number);
162
170
  protected _onEffectiveEnabledStateChanged(enabled: boolean): void;
163
171
  /**
164
172
  * Babylon.js `mesh.getBoundingInfo()` — the mesh's AABB. `minimum`/`maximum`
165
173
  * are the local-space bounds; the returned `BoundingInfo`'s world members
@@ -292,9 +300,8 @@ declare interface AgentTransform {
292
300
  }
293
301
 
294
302
  /**
295
- * Babylon.js `Animatable` — a running animation on a target, driven per-frame on
296
- * the CPU by evaluating each `Animation`'s keyframes and writing the result onto
297
- * the target's (dotted) property path.
303
+ * Babylon.js `Animatable` facade. Supported direct-animation tracks delegate to a
304
+ * native Lite property group; unsupported tracks retain the compat CPU evaluator.
298
305
  */
299
306
  declare class Animatable_2 {
300
307
  private readonly _target;
@@ -302,16 +309,26 @@ declare class Animatable_2 {
302
309
  private readonly _from;
303
310
  private readonly _to;
304
311
  private readonly _loop;
305
- masterFrame: number;
306
- speedRatio: number;
312
+ masterFrame: number;
307
313
  private _speedRatio;
308
314
  private _paused;
309
315
  private _stopped;
310
- constructor(_target: unknown, _animations: Animation_2[], _from: number, _to: number, _loop: boolean, speedRatio: number);
311
316
  goToFrame(frame: number): void;
317
+ private readonly _nativeManager;
318
+ private readonly _fallbackAnimations;
319
+ private readonly _fallbackFrames;
320
+ private readonly _fallbackElapsedFrames;
321
+ private readonly _fallbackRepeatCounts;
322
+ private readonly _completedFallbackAnimations;
323
+ constructor(target: unknown, animations: Animation_2[], from: number, to: number, loop: boolean, speedRatio: number);
312
324
  get speedRatio(): number;
325
+ set speedRatio(value: number);
313
326
  goToFrame(frame: number): void;
314
327
  pause(): void;
315
328
  restart(): void;
316
329
  stop(): void;
317
330
  get animationStarted(): boolean;
318
- private _apply;
331
+ private _applyFallback;
332
+ private _advanceFallback;
333
+ private _resetFallbackAnimation;
334
+ private _attachLite;
335
+ private _detachLite;
319
336
  }
320
337
 
321
338
  declare class Animation_2 {
@@ -325,16 +342,29 @@ declare class Animation_2 {
325
342
  static readonly ANIMATIONTYPE_QUATERNION: 2;
326
343
  static readonly ANIMATIONTYPE_MATRIX: 3;
327
344
  static readonly ANIMATIONTYPE_COLOR3: 4;
345
+ static readonly ANIMATIONTYPE_VECTOR2: 5;
346
+ static readonly ANIMATIONTYPE_COLOR4: 6;
328
347
  static readonly ANIMATIONLOOPMODE_RELATIVE: 0;
329
348
  static readonly ANIMATIONLOOPMODE_CYCLE: 1;
330
349
  static readonly ANIMATIONLOOPMODE_CONSTANT: 2;
331
350
  private _keys;
351
+ private _easingFunction;
332
352
  constructor(name: string, targetProperty: string, framePerSecond: number, dataType?: number, loopMode?: number);
333
353
  setKeys(keys: IAnimationKey[]): void;
334
354
  getKeys(): IAnimationKey[];
335
355
  getHighestFrame(): number;
336
- /** Linearly evaluate the animated value at `frame` (clamped to the key range). */
337
- evaluate(frame: number): number | number[];
356
+ /**
357
+ * Assigns the easing function used to transform each non-STEP segment's normalized progress.
358
+ * @param easingFunction - A Babylon.js-shaped easing object, or `null` to restore linear progress.
359
+ */
360
+ setEasingFunction(easingFunction: IEasingFunction | null): void;
361
+ /**
362
+ * Gets the easing function currently assigned to this animation.
363
+ * @returns The assigned easing object, or `null` when interpolation uses linear progress.
364
+ */
365
+ getEasingFunction(): IEasingFunction | null;
366
+ /** Evaluate the animated value at `frame`, clamped to the key range. */
367
+ evaluate(frame: number): AnimationValue;
338
368
  /** Babylon.js helper: build a one-shot float animation between two values. */
339
369
  static CreateAndStartAnimation(name: string, _target: unknown, targetProperty: string, framePerSecond: number, totalFrame: number, from: number, to: number): Animation_2;
340
370
  }
@@ -417,6 +447,8 @@ declare class AnimationGroup {
417
447
 
418
448
  declare type AnimationGroupState = "init" | "playing" | "paused" | "stopped";
419
449
 
450
+ declare type AnimationValue = number | number[] | IAnimationVectorValue;
451
+
420
452
  declare abstract class BaseTexture {
421
453
  name: string;
422
454
  getClassName(): string;
423
455
  /**
424
456
  * Babylon.js `BaseTexture.getInternalTexture()` — the backend texture handle. Babylon.js
@@ -759,11 +791,35 @@ declare class HDRCubeTexture extends BaseTexture {
759
791
 
760
792
  declare interface IAnimationKey {
761
793
  frame: number;
762
- value: number | number[];
794
+ value: AnimationValue;
763
795
  /** Babylon.js per-key interpolation hint (`AnimationKeyInterpolation`). */
764
796
  interpolation?: number;
765
797
  }
766
798
 
799
+ /** Structural vector/quaternion value accepted by Babylon.js animation keys. */
800
+ declare interface IAnimationVectorValue {
801
+ readonly x: number;
802
+ readonly y: number;
803
+ readonly z?: number;
804
+ readonly w?: number;
805
+ clone(): IAnimationVectorValue;
806
+ asArray(): number[];
807
+ }
808
+
809
+ /**
810
+ * Contract implemented by Babylon.js easing functions.
811
+ *
812
+ * Custom easing objects only need to transform a normalized segment gradient.
813
+ */
814
+ declare interface IEasingFunction {
815
+ /**
816
+ * Transform a segment-local gradient.
817
+ * @param gradient - Linear progress through the current keyframe segment.
818
+ * @returns The progress used for interpolation. Values are not clamped.
819
+ */
820
+ ease(gradient: number): number;
821
+ }
822
+
767
823
  /**
768
824
  * Minimal Babylon.js `ImageProcessingConfiguration` facade over Lite's image
769
825
  * processing state.
@@ -813,7 +869,8 @@ declare class LinesMaterial extends Material {
813
869
 
814
870
  /** Babylon.js `Material` — base class for all materials. */
815
871
  declare abstract class Material {
816
- name: string;
872
+ name: string;
817
873
  /** Babylon.js plugin manager, created lazily by the first `MaterialPluginBase`. */
874
+ pluginManager: MaterialPluginManager | undefined;
818
875
  /** Common transparency mode flag (Babylon.js `Material.transparencyMode`). */
819
876
  transparencyMode: number | null;
820
877
  /** Back-face culling toggle (Babylon.js `Material.backFaceCulling`). */
@@ -841,6 +898,75 @@ declare abstract class Material {
841
898
  protected _markDirty(): void;
842
899
  dispose(): void;
843
900
  }
844
901
 
902
+ /**
903
+ * Babylon.js `MaterialPluginBase` adapter over Lite's opt-in material-plugin
904
+ * bridge. Subclasses keep the Babylon.js override shape while Lite receives a
905
+ * plain plugin descriptor.
906
+ */
907
+ declare class MaterialPluginBase {
908
+ private _name;
909
+ private _priority;
910
+ private _resolveIncludes;
911
+ readonly markAllDefinesAsDirty: () => void;
912
+ registerForExtraEvents: boolean;
913
+ doNotSerialize: boolean;
914
+ protected readonly _material: Material;
915
+ protected readonly _pluginManager: MaterialPluginManager;
916
+ protected readonly _pluginDefineNames?: MaterialPluginDefines;
845
917
  constructor(material: Material, name: string, priority: number, defines?: MaterialPluginDefines, addToPluginList?: boolean, enable?: boolean, resolveIncludes?: boolean);
918
+ get name(): string;
919
+ set name(value: string);
920
+ get priority(): number;
921
+ set priority(value: number);
922
+ get resolveIncludes(): boolean;
923
+ set resolveIncludes(value: boolean);
846
924
  protected _enable(enable: boolean): void;
847
925
  private _assertSupportedExecution;
926
+ isCompatible(_shaderLanguage: ShaderLanguage): boolean;
927
+ getCustomCode(_shaderType: string, _shaderLanguage?: ShaderLanguage): MaterialPluginCustomCode | null;
928
+ isReadyForSubMesh(_defines: object, _scene: Scene, _engine: object, _subMesh: object): boolean;
929
+ hardBindForSubMesh(_uniformBuffer: object, _scene: Scene, _engine: object, _subMesh: object): void;
930
+ bindForSubMesh(_uniformBuffer: object, _scene: Scene, _engine: object, _subMesh: object): void;
931
+ collectDefines(defines: Record<string, {
932
+ type: string;
933
+ default: unknown;
934
+ }>): void;
935
+ prepareDefinesBeforeAttributes(_defines: object, _scene: Scene, _mesh: AbstractMesh): void;
936
+ prepareDefines(_defines: object, _scene: Scene, _mesh: AbstractMesh): void;
937
+ hasTexture(_texture: BaseTexture): boolean;
938
+ hasRenderTargetTextures(): boolean;
939
+ fillRenderTargetTextures(_renderTargets: SmartArray<RenderTargetTexture>): void;
940
+ getActiveTextures(_activeTextures: BaseTexture[]): void;
941
+ getAnimatables(_animatables: object[]): void;
942
+ addFallbacks(_defines: object, _fallbacks: object, currentRank: number): number;
943
+ getSamplers(_samplers: string[]): void;
944
+ getAttributes(_attributes: string[], _scene: Scene, _mesh: AbstractMesh): void;
945
+ getUniformBuffersNames(_ubos: string[]): void;
946
+ getUniforms(_shaderLanguage?: ShaderLanguage): {
947
+ ubo?: Array<{
948
+ name: string;
949
+ size?: number;
950
+ type?: string;
951
+ arraySize?: number;
952
+ }>;
953
+ vertex?: string;
954
+ fragment?: string;
955
+ externalUniforms?: string[];
956
+ };
957
+ getClassName(): string;
958
+ copyTo(plugin: MaterialPluginBase): void;
959
+ serialize(): Record<string, unknown>;
960
+ parse(source: Record<string, unknown>, _scene: Scene, _rootUrl: string): void;
961
+ dispose(_forceDisposeTextures?: boolean): void;
962
+ }
963
+
964
+ declare type MaterialPluginCustomCode = Record<string, string>;
965
+
966
+ declare type MaterialPluginDefines = Record<string, unknown>;
967
+
968
+ /** Babylon.js-shaped manager for the adapter-visible material plugin list. */
969
+ declare class MaterialPluginManager {
970
+ private readonly _plugins;
971
+ constructor(material: Material);
848
972
  getPlugin<T = MaterialPluginBase>(name: string): T | null;
973
+ }
974
+
849
975
  declare class Matrix {
850
976
  readonly m: Float32Array;
851
977
  constructor();
@@ -1036,6 +1162,14 @@ declare abstract class Node_2 {
1036
1162
  * descendant nodes that are meshes (all descendants by default).
1037
1163
  */
1038
1164
  getChildMeshes(directDescendantsOnly?: boolean, predicate?: (node: Node_2) => boolean): Node_2[];
1165
+ /**
1166
+ * Babylon.js `node.getHierarchyBoundingVectors(includeDescendants?, predicate?)`
1167
+ * — world-space bounds spanning this mesh and eligible descendant meshes.
1168
+ */
1169
+ getHierarchyBoundingVectors(includeDescendants?: boolean, predicate?: ((mesh: AbstractMesh) => boolean) | null): {
1170
+ min: Vector3;
1171
+ max: Vector3;
1172
+ };
1039
1173
  isEnabled(checkAncestors?: boolean): boolean;
1040
1174
  setEnabled(value: boolean): void;
1041
1175
  isDisposed(): boolean;
1042
1176
  dispose(doNotRecurse?: boolean): void;
@@ -1595,6 +1729,11 @@ export declare class RecastNavigationJSPluginV2 {
1595
1729
  /**
1596
1730
  createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): RecastJSCrowd;
1597
1731
  }
1598
1732
 
1733
+ /** Babylon.js `RenderTargetTexture` — offscreen render target. Use the native frame-graph RTT APIs. */
1734
+ declare class RenderTargetTexture {
1735
+ constructor();
1736
+ }
1737
+
1599
1738
  declare class Scene extends AbstractScene {
1600
1739
  /** Babylon.js fog-mode constants. */
1601
1740
  static readonly FOGMODE_NONE = 0;
1602
1741
  static readonly FOGMODE_EXP = 1;
@@ -1615,8 +1754,8 @@ declare class Scene extends AbstractScene {
1615
1754
  /** Babylon.js fog-mode constant
1616
1755
  * Babylon.js `scene.animationGroups` / `scene.animatables`. Loaded glTF /
1617
1756
  * `.babylon` animation clips live on the Lite scene; `animationGroups` returns
1618
1757
  * BJS-shaped `AnimationGroup`s over them (so scenes can `goToFrame`/`pause`/`stop`
1619
- * to freeze a model at a deterministic frame). `animatables` surfaces the running
1620
- * CPU `Animatable`s started via `beginDirectAnimation`.
1758
+ * to freeze a model at a deterministic frame). `animatables` surfaces the
1759
+ * native-backed and fallback `Animatable`s started through the scene.
1621
1760
  */
1622
1761
  get animationGroups(): AnimationGroup[];
1623
1762
  /** Babylon.js `scene.getAnimationGroupByName(name)` — first loaded animation group with a matching name, else `null`. */
@@ -1638,8 +1777,9 @@ declare class Scene extends AbstractScene {
1638
1777
  /** Babylon.js fog-mode constant
1639
1778
  private readonly _pendingTextures;
1640
1779
  private readonly _pendingGroundBakes;
1641
1780
  private readonly _pendingMorphBuilds;
1642
- private readonly _runningAnimatables;
1643
- private readonly _animationGroupCache;
1644
1781
  private _ambientColor;
1782
+ private _materialPluginsRequested;
1783
+ private readonly _pendingMaterialPluginReconciliations;
1784
+ private readonly _runningAnimatables;
1645
1785
  private readonly _animationGroupCache;
1646
1786
  private _ambientColor;
1647
1787
  private _environmentIntensity;
1648
1788
  private _imageProcessingConfiguration;
1649
1789
  /** Babylon.js `scene.uniqueId` — a process-unique numeric id. */
1650
1790
  readonly uniqueId: number;
@@ -1801,8 +1941,9 @@ declare class Scene extends AbstractScene {
1801
1941
  /** Babylon.js fog-mode constant
1802
1942
  disablePhysicsEngine(): void;
1803
1943
  /**
1804
1944
  * Babylon.js `scene.beginDirectAnimation(target, animations, from, to, loop, speedRatio?)`.
1805
- * Drives the given `Animation`s on the CPU each frame, writing onto the target's
1806
- * (dotted) property path. Returns an `Animatable` with `goToFrame`/`pause`/`stop`.
1945
+ * Delegates supported tracks to Babylon Lite property animation and retains
1946
+ * explicit compat evaluation only for unsupported tracks. Returns one facade
1947
+ * coordinating both subsets.
1807
1948
  */
1808
1949
  beginDirectAnimation(target: unknown, animations: Animation_2[], from: number, to: number, loop?: boolean, speedRatio?: number): Animatable_2;
1809
1950
  /**
1810
1951
  * Babylon.js `scene.beginAnimation(target, from, to, loop, speedRatio?)`. Runs
@@ -1814,7 +1955,47 @@ declare class Scene extends AbstractScene {
1814
1955
  /** Babylon.js fog-mode constant
1815
1956
  dispose(): void;
1816
1957
  }
1817
1958
 
1818
- declare class StandardMaterial extends PushMaterial {
1819
1959
  constructor(name: string, scene?: Scene);
1960
+ /**
1961
+ * Babylon.js `ShaderLanguage` — the shader-source language selector. Babylon Lite
1962
+ * is WGSL-only, but the enum is surfaced (with Babylon.js's numeric values) so
1963
+ * scenes that import it to author `WGSL` shaders resolve the symbol; a `GLSL`
1964
+ * `ShaderMaterial`/`EffectWrapper` still fails loudly at construction.
1965
+ */
1966
+ declare enum ShaderLanguage {
1967
+ GLSL = 0,
1968
+ WGSL = 1
1969
+ }
1970
+
1971
+ /**
1972
+ * Babylon.js-compatible Misc utilities — the pure-JS subset that has no Babylon
1973
+ * Lite or GPU dependency: `SmartArray`, `StringDictionary`, `Tags`,
1974
+ * `PerformanceMonitor`, and `ColorGradient`/`FactorGradient`.
1975
+ */
1976
+ /** A pre-sized, reusable array that tracks a logical `length` separately from capacity. */
1977
+ declare class SmartArray<T> {
1978
+ data: Array<T | undefined>;
1979
+ length: number;
1980
+ constructor(capacity: number);
1981
+ push(value: T): void;
1982
+ reset(): void;
1983
+ concat(array: {
1984
+ length: number;
1985
+ data: Array<T | undefined>;
1986
+ }): void;
1987
+ dispose(): void;
1988
+ }
1989
+
1990
+ declare class StandardMaterial extends PushMaterial {
1820
1991
  /** Diffuse colour as the app set it. Kept apart from `_lite.diffuseColor`, which is forced to white
1992
+ * while the material is unlit (see `_syncDiffuse`). */
1993
+ private _diffuse;
1994
+ constructor(name: string, scene?: Scene);
1995
+ /**
1996
+ * Babylon.js shades an unlit StandardMaterial as `emissive + ambient`: the diffuse colour only scales
1997
+ * the accumulated light, and there is none. Lite's unlit path is `emissive × diffuse`, so the usual
1998
+ * "unlit colour" setup (black diffuse, colour in emissive) rendered black. Hand Lite a neutral white
1999
+ * diffuse while lighting is disabled and the app's own colour otherwise.
2000
+ */
2001
+ private _syncDiffuse;
1821
2002
  getClassName(): string;
1822
2003
  get diffuseColor(): Color3;
1823
2004
  set diffuseColor(value: Color3);
package/navigation.js CHANGED
@@ -1,5 +1,5 @@
1
- import { W as Vector3, _ as Mesh } from "./meshes-DJ46g22_.js";
2
- import { addAgent, addBoxObstacle, addCylinderObstacle, addToScene, agentGoto, computePath, createDebugNavMeshGeometry, createMeshFromData, createNavCrowd, createNavMesh, createNavigationPluginAsync, getAgentPosition, getClosestPoint, raycast, removeObstacle, updateNavCrowd, updateNavMeshObstacles } from "@babylonjs/lite";
1
+ import { S as registerMeshAtStart, _ as Mesh, q as Vector3 } from "./meshes-Fu955h5M.js";
2
+ import { addAgent, addBoxObstacle, addCylinderObstacle, agentGoto, computePath, createDebugNavMeshGeometry, createMeshFromData, createNavCrowd, createNavMesh, createNavigationPluginAsync, getAgentPosition, getClosestPoint, raycast, removeObstacle, updateNavCrowd, updateNavMeshObstacles } from "@babylonjs/lite";
3
3
  //#region src/navigation/navigation.ts
4
4
  /**
5
5
  * Babylon.js `@babylonjs/addons/navigation` compatibility wrapper over Babylon
@@ -119,14 +119,7 @@ var RecastNavigationJSPluginV2 = class {
119
119
  const geo = createDebugNavMeshGeometry(this._lite);
120
120
  const engine = scene.getEngine()._lite;
121
121
  const lite = createMeshFromData(engine, "navDebugMesh", geo.positions, geo.normals, geo.indices);
122
- const mesh = new Mesh("navDebugMesh", lite, scene);
123
- scene._deferAdd(() => {
124
- const mat = mesh.material;
125
- mat?._ensureRenderable(engine);
126
- if (mat?._lite) mesh._lite.material = mat._lite;
127
- addToScene(scene._lite, mesh._lite);
128
- });
129
- return mesh;
122
+ return registerMeshAtStart(new Mesh("navDebugMesh", lite, scene), scene);
130
123
  }
131
124
  /** Babylon.js `plugin.getClosestPoint(position)` — snap to the navmesh. */
132
125
  getClosestPoint(position) {
package/navigation.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.js","names":[],"sources":["../src/navigation/navigation.ts"],"sourcesContent":["/**\n * Babylon.js `@babylonjs/addons/navigation` compatibility wrapper over Babylon\n * Lite's native navigation API (`createNavigationPluginAsync` / `createNavMesh` /\n * `createDebugNavMeshGeometry` / `createNavCrowd` / …).\n *\n * The Babylon.js navigation addon (`RecastNavigationJSPluginV2`, created via\n * `CreateNavigationPluginAsync`) is a thin wrapper around `recast-navigation-js`.\n * Babylon Lite ships its own Recast V2 integration with the same capabilities, so\n * this module mirrors the addon's public plugin/crowd surface and delegates to\n * Lite. The Recast instance the scene injects via `{ instance }` is ignored —\n * Lite loads its own Recast wasm (served at `/recast-navigation.wasm`).\n *\n * Only the surface exercised by ported scenes is implemented (`createNavMesh`,\n * `createDebugNavMesh`, `getClosestPoint`, `createCrowd` + `addAgent`); the rest\n * of the addon API is intentionally omitted.\n */\n\nimport {\n createNavigationPluginAsync as liteCreateNavigationPluginAsync,\n createNavMesh as liteCreateNavMesh,\n createDebugNavMeshGeometry as liteCreateDebugNavMeshGeometry,\n getClosestPoint as liteGetClosestPoint,\n computePath as liteComputePath,\n raycast as liteRaycast,\n createNavCrowd as liteCreateNavCrowd,\n addAgent as liteAddAgent,\n getAgentPosition as liteGetAgentPosition,\n agentGoto as liteAgentGoto,\n updateNavCrowd as liteUpdateNavCrowd,\n addBoxObstacle as liteAddBoxObstacle,\n addCylinderObstacle as liteAddCylinderObstacle,\n removeObstacle as liteRemoveObstacle,\n updateNavMeshObstacles as liteUpdateNavMeshObstacles,\n createMeshFromData,\n addToScene,\n type NavigationPlugin as LiteNavigationPlugin,\n type NavCrowd as LiteNavCrowd,\n type Mesh as LiteMesh,\n type ObstacleHandle as LiteObstacleHandle,\n} from \"babylon-lite\";\n\nimport { Mesh } from \"../meshes/meshes.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\ninterface Vec3Like {\n x: number;\n y: number;\n z: number;\n}\n\ninterface AgentTransform {\n position: { set(x: number, y: number, z: number): unknown };\n}\n\n/**\n * Result of {@link RecastNavigationJSPluginV2.createNavMesh}. Babylon.js's\n * tile-cache navmesh build returns `{ navMesh, tileCache }`; here both reference\n * the plugin so {@link WaitForFullTileCacheUpdate} can reach it.\n */\ninterface NavMeshResult {\n navMesh: RecastNavigationJSPluginV2;\n tileCache: RecastNavigationJSPluginV2;\n}\n\n/** Babylon.js `IAgentParameters` subset accepted by `RecastJSCrowd.addAgent`. */\ninterface AgentParameters {\n radius: number;\n height: number;\n maxAcceleration: number;\n maxSpeed: number;\n collisionQueryRange: number;\n pathOptimizationRange: number;\n separationWeight: number;\n reachRadius?: number;\n}\n\n/**\n * Babylon.js `RecastJSCrowd` (subset) — owns crowd agents and syncs each agent's\n * Babylon transform to the simulated position every frame, exactly like the addon.\n */\nclass RecastJSCrowd {\n /** @internal */ public readonly _lite: LiteNavCrowd;\n private readonly _transforms = new Map<number, AgentTransform>();\n private readonly _plugin: RecastNavigationJSPluginV2;\n\n public constructor(lite: LiteNavCrowd, plugin: RecastNavigationJSPluginV2, scene: Scene) {\n this._lite = lite;\n this._plugin = plugin;\n // Babylon.js' crowd advances the simulation and writes back agent transforms\n // on the scene's before-render tick; mirror that over Lite's manual crowd update.\n // The plugin's `timeFactor` scales the step (0 freezes the crowd — used by parity\n // tests via `?freeze=1`).\n scene.onBeforeRenderObservable.add(() => {\n liteUpdateNavCrowd(this._lite, (1 / 60) * this._plugin.timeFactor);\n for (const [index, transform] of this._transforms) {\n const p = liteGetAgentPosition(this._lite, index);\n transform.position.set(p.x, p.y, p.z);\n }\n });\n }\n\n /** Babylon.js `crowd.addAgent(pos, parameters, transform)` — returns the agent index. */\n public addAgent(pos: Vec3Like, parameters: AgentParameters, transform: AgentTransform): number {\n const index = liteAddAgent(this._lite, { x: pos.x, y: pos.y, z: pos.z }, parameters);\n this._transforms.set(index, transform);\n return index;\n }\n\n /** Babylon.js `crowd.getAgentPosition(index)`. */\n public getAgentPosition(index: number): Vector3 {\n const p = liteGetAgentPosition(this._lite, index);\n return new Vector3(p.x, p.y, p.z);\n }\n\n /** Babylon.js `crowd.agentGoto(index, destination)` — request the agent to move toward a target. */\n public agentGoto(index: number, destination: Vec3Like): void {\n liteAgentGoto(this._lite, index, { x: destination.x, y: destination.y, z: destination.z });\n }\n}\n\n/**\n * Babylon.js `RecastNavigationJSPluginV2` (subset) over Babylon Lite navigation.\n */\nclass RecastNavigationJSPluginV2 {\n /** @internal */ public readonly _lite: LiteNavigationPlugin;\n /**\n * Babylon.js `plugin.timeFactor` — multiplier applied to each crowd update step.\n * `0` pauses crowd movement (used by parity tests); default `1`.\n */\n public timeFactor = 1;\n\n public constructor(lite: LiteNavigationPlugin) {\n this._lite = lite;\n }\n\n /**\n * Babylon.js `plugin.createNavMesh(meshes, parameters)`. Returns a\n * `{ navMesh, tileCache }` handle (both reference this plugin) so scenes using\n * the tile-cache obstacle API can pass them to {@link WaitForFullTileCacheUpdate}.\n * Scenes that ignore the return (the non-obstacle navmesh scenes) are unaffected.\n */\n public createNavMesh(meshes: Array<{ _lite: LiteMesh }>, parameters: Record<string, unknown>): NavMeshResult {\n liteCreateNavMesh(\n this._lite,\n meshes.map((m) => m._lite),\n parameters as never\n );\n return { navMesh: this, tileCache: this };\n }\n\n /** Babylon.js `plugin.addCylinderObstacle(position, radius, height)` — tile-cache obstacle. */\n public addCylinderObstacle(position: Vec3Like, radius: number, height: number): LiteObstacleHandle | null {\n return liteAddCylinderObstacle(this._lite, { x: position.x, y: position.y, z: position.z }, radius, height);\n }\n\n /** Babylon.js `plugin.addBoxObstacle(position, extent, angle)` — tile-cache obstacle (`extent` = half-extents). */\n public addBoxObstacle(position: Vec3Like, extent: Vec3Like, angle: number): LiteObstacleHandle | null {\n return liteAddBoxObstacle(this._lite, { x: position.x, y: position.y, z: position.z }, { x: extent.x, y: extent.y, z: extent.z }, angle);\n }\n\n /** Babylon.js `plugin.removeObstacle(obstacle)` — remove a previously-added tile-cache obstacle. */\n public removeObstacle(obstacle: LiteObstacleHandle): void {\n liteRemoveObstacle(this._lite, obstacle);\n }\n\n /** @internal Apply pending tile-cache obstacle updates (drives {@link WaitForFullTileCacheUpdate}). */\n public _updateObstacles(): void {\n liteUpdateNavMeshObstacles(this._lite);\n }\n\n /** Babylon.js `plugin.createDebugNavMesh(scene)` — builds a renderable debug mesh. */\n public createDebugNavMesh(scene: Scene): Mesh {\n const geo = liteCreateDebugNavMeshGeometry(this._lite);\n const engine = scene.getEngine()._lite;\n const lite = createMeshFromData(engine, \"navDebugMesh\", geo.positions, geo.normals, geo.indices);\n const mesh = new Mesh(\"navDebugMesh\", lite, scene);\n scene._deferAdd(() => {\n const mat = mesh.material;\n mat?._ensureRenderable(engine);\n if (mat?._lite) {\n mesh._lite.material = mat._lite as never;\n }\n addToScene(scene._lite, mesh._lite);\n });\n return mesh;\n }\n\n /** Babylon.js `plugin.getClosestPoint(position)` — snap to the navmesh. */\n public getClosestPoint(position: Vec3Like): Vector3 {\n const p = liteGetClosestPoint(this._lite, { x: position.x, y: position.y, z: position.z });\n return new Vector3(p.x, p.y, p.z);\n }\n\n /** Babylon.js `plugin.computePath(start, end)` — navmesh-snapped path as world points. */\n public computePath(start: Vec3Like, end: Vec3Like): Vector3[] {\n const points = liteComputePath(this._lite, { x: start.x, y: start.y, z: start.z }, { x: end.x, y: end.y, z: end.z });\n return points.map((p) => new Vector3(p.x, p.y, p.z));\n }\n\n /** Babylon.js `plugin.computePathSmooth(start, end)` — alias of {@link computePath} (Lite smooths internally). */\n public computePathSmooth(start: Vec3Like, end: Vec3Like): Vector3[] {\n return this.computePath(start, end);\n }\n\n /**\n * Babylon.js `plugin.raycast(start, end)` — walkability raycast on the navmesh.\n * Returns `{ hit, hitPoint? }` (`hitPoint` is a `Vector3` when `hit`).\n */\n public raycast(start: Vec3Like, end: Vec3Like): { hit: boolean; hitPoint?: Vector3 } {\n const r = liteRaycast(this._lite, { x: start.x, y: start.y, z: start.z }, { x: end.x, y: end.y, z: end.z });\n return r.hit && r.hitPoint ? { hit: true, hitPoint: new Vector3(r.hitPoint.x, r.hitPoint.y, r.hitPoint.z) } : { hit: false };\n }\n\n /** Babylon.js `plugin.createCrowd(maxAgents, maxAgentRadius, scene)`. */\n public createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): RecastJSCrowd {\n const crowd = liteCreateNavCrowd(this._lite, maxAgents, maxAgentRadius);\n return new RecastJSCrowd(crowd, this, scene);\n }\n}\n\n/**\n * Babylon.js `@babylonjs/addons/navigation` `CreateNavigationPluginAsync`. The\n * injected Recast `instance` (if any) is ignored — Babylon Lite loads its own\n * Recast wasm from `/recast-navigation.wasm`.\n */\nexport async function CreateNavigationPluginAsync(_options?: { version?: string; instance?: unknown }): Promise<RecastNavigationJSPluginV2> {\n const lite = await liteCreateNavigationPluginAsync({ locateFile: () => \"/recast-navigation.wasm\" });\n return new RecastNavigationJSPluginV2(lite);\n}\n\nexport { RecastNavigationJSPluginV2, RecastJSCrowd };\n\n/**\n * Babylon.js `@babylonjs/addons/navigation/common/tile-cache`\n * `WaitForFullTileCacheUpdate(navMesh, tileCache)` — block until pending\n * tile-cache obstacle updates are applied. The addon takes the raw navMesh /\n * tileCache; here `navMesh` is the compat plugin (returned from `createNavMesh`),\n * so this delegates to Babylon Lite's `updateNavMeshObstacles`.\n */\nexport function WaitForFullTileCacheUpdate(navMesh: unknown, _tileCache?: unknown): void {\n const plugin = navMesh as RecastNavigationJSPluginV2 | undefined;\n if (plugin && typeof plugin._updateObstacles === \"function\") {\n plugin._updateObstacles();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiFA,IAAM,gBAAN,MAAoB;kBACC;CACjB,8BAA+B,IAAI,IAA4B;CAC/D;CAEA,YAAmB,MAAoB,QAAoC,OAAc;EACrF,KAAK,QAAQ;EACb,KAAK,UAAU;EAKf,MAAM,yBAAyB,UAAU;GACrC,eAAmB,KAAK,OAAQ,IAAI,KAAM,KAAK,QAAQ,UAAU;GACjE,KAAK,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G;GAAE,GAAG,IAAI;GAAG,GAAG,IAAI;GAAG,GAAG,IAAI;EAAE,CAAC;EAC1G,OAAO,EAAE,OAAO,EAAE,WAAW;GAAE,KAAK;GAAM,UAAU,IAAI,QAAQ,EAAE,SAAS,GAAG,EAAE,SAAS,GAAG,EAAE,SAAS,CAAC;EAAE,IAAI,EAAE,KAAK,MAAM;CAC/H;;CAGA,YAAmB,WAAmB,gBAAwB,OAA6B;EAEvF,OAAO,IAAI,cADG,eAAmB,KAAK,OAAO,WAAW,cAC/B,GAAO,MAAM,KAAK;CAC/C;AACJ;;;;;;AAOA,eAAsB,4BAA4B,UAA0F;CAExI,OAAO,IAAI,2BAA2B,MADnB,4BAAgC,EAAE,kBAAkB,0BAA0B,CAAC,CACxD;AAC9C;;;;;;;;AAWA,SAAgB,2BAA2B,SAAkB,YAA4B;CACrF,MAAM,SAAS;CACf,IAAI,UAAU,OAAO,OAAO,qBAAqB,YAC7C,OAAO,iBAAiB;AAEhC"}
1
+ {"version":3,"file":"navigation.js","names":[],"sources":["../src/navigation/navigation.ts"],"sourcesContent":["/**\n * Babylon.js `@babylonjs/addons/navigation` compatibility wrapper over Babylon\n * Lite's native navigation API (`createNavigationPluginAsync` / `createNavMesh` /\n * `createDebugNavMeshGeometry` / `createNavCrowd` / …).\n *\n * The Babylon.js navigation addon (`RecastNavigationJSPluginV2`, created via\n * `CreateNavigationPluginAsync`) is a thin wrapper around `recast-navigation-js`.\n * Babylon Lite ships its own Recast V2 integration with the same capabilities, so\n * this module mirrors the addon's public plugin/crowd surface and delegates to\n * Lite. The Recast instance the scene injects via `{ instance }` is ignored —\n * Lite loads its own Recast wasm (served at `/recast-navigation.wasm`).\n *\n * Only the surface exercised by ported scenes is implemented (`createNavMesh`,\n * `createDebugNavMesh`, `getClosestPoint`, `createCrowd` + `addAgent`); the rest\n * of the addon API is intentionally omitted.\n */\n\nimport {\n createNavigationPluginAsync as liteCreateNavigationPluginAsync,\n createNavMesh as liteCreateNavMesh,\n createDebugNavMeshGeometry as liteCreateDebugNavMeshGeometry,\n getClosestPoint as liteGetClosestPoint,\n computePath as liteComputePath,\n raycast as liteRaycast,\n createNavCrowd as liteCreateNavCrowd,\n addAgent as liteAddAgent,\n getAgentPosition as liteGetAgentPosition,\n agentGoto as liteAgentGoto,\n updateNavCrowd as liteUpdateNavCrowd,\n addBoxObstacle as liteAddBoxObstacle,\n addCylinderObstacle as liteAddCylinderObstacle,\n removeObstacle as liteRemoveObstacle,\n updateNavMeshObstacles as liteUpdateNavMeshObstacles,\n createMeshFromData,\n type NavigationPlugin as LiteNavigationPlugin,\n type NavCrowd as LiteNavCrowd,\n type Mesh as LiteMesh,\n type ObstacleHandle as LiteObstacleHandle,\n} from \"babylon-lite\";\n\nimport { Mesh, registerMeshAtStart } from \"../meshes/meshes.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\ninterface Vec3Like {\n x: number;\n y: number;\n z: number;\n}\n\ninterface AgentTransform {\n position: { set(x: number, y: number, z: number): unknown };\n}\n\n/**\n * Result of {@link RecastNavigationJSPluginV2.createNavMesh}. Babylon.js's\n * tile-cache navmesh build returns `{ navMesh, tileCache }`; here both reference\n * the plugin so {@link WaitForFullTileCacheUpdate} can reach it.\n */\ninterface NavMeshResult {\n navMesh: RecastNavigationJSPluginV2;\n tileCache: RecastNavigationJSPluginV2;\n}\n\n/** Babylon.js `IAgentParameters` subset accepted by `RecastJSCrowd.addAgent`. */\ninterface AgentParameters {\n radius: number;\n height: number;\n maxAcceleration: number;\n maxSpeed: number;\n collisionQueryRange: number;\n pathOptimizationRange: number;\n separationWeight: number;\n reachRadius?: number;\n}\n\n/**\n * Babylon.js `RecastJSCrowd` (subset) — owns crowd agents and syncs each agent's\n * Babylon transform to the simulated position every frame, exactly like the addon.\n */\nclass RecastJSCrowd {\n /** @internal */ public readonly _lite: LiteNavCrowd;\n private readonly _transforms = new Map<number, AgentTransform>();\n private readonly _plugin: RecastNavigationJSPluginV2;\n\n public constructor(lite: LiteNavCrowd, plugin: RecastNavigationJSPluginV2, scene: Scene) {\n this._lite = lite;\n this._plugin = plugin;\n // Babylon.js' crowd advances the simulation and writes back agent transforms\n // on the scene's before-render tick; mirror that over Lite's manual crowd update.\n // The plugin's `timeFactor` scales the step (0 freezes the crowd — used by parity\n // tests via `?freeze=1`).\n scene.onBeforeRenderObservable.add(() => {\n liteUpdateNavCrowd(this._lite, (1 / 60) * this._plugin.timeFactor);\n for (const [index, transform] of this._transforms) {\n const p = liteGetAgentPosition(this._lite, index);\n transform.position.set(p.x, p.y, p.z);\n }\n });\n }\n\n /** Babylon.js `crowd.addAgent(pos, parameters, transform)` — returns the agent index. */\n public addAgent(pos: Vec3Like, parameters: AgentParameters, transform: AgentTransform): number {\n const index = liteAddAgent(this._lite, { x: pos.x, y: pos.y, z: pos.z }, parameters);\n this._transforms.set(index, transform);\n return index;\n }\n\n /** Babylon.js `crowd.getAgentPosition(index)`. */\n public getAgentPosition(index: number): Vector3 {\n const p = liteGetAgentPosition(this._lite, index);\n return new Vector3(p.x, p.y, p.z);\n }\n\n /** Babylon.js `crowd.agentGoto(index, destination)` — request the agent to move toward a target. */\n public agentGoto(index: number, destination: Vec3Like): void {\n liteAgentGoto(this._lite, index, { x: destination.x, y: destination.y, z: destination.z });\n }\n}\n\n/**\n * Babylon.js `RecastNavigationJSPluginV2` (subset) over Babylon Lite navigation.\n */\nclass RecastNavigationJSPluginV2 {\n /** @internal */ public readonly _lite: LiteNavigationPlugin;\n /**\n * Babylon.js `plugin.timeFactor` — multiplier applied to each crowd update step.\n * `0` pauses crowd movement (used by parity tests); default `1`.\n */\n public timeFactor = 1;\n\n public constructor(lite: LiteNavigationPlugin) {\n this._lite = lite;\n }\n\n /**\n * Babylon.js `plugin.createNavMesh(meshes, parameters)`. Returns a\n * `{ navMesh, tileCache }` handle (both reference this plugin) so scenes using\n * the tile-cache obstacle API can pass them to {@link WaitForFullTileCacheUpdate}.\n * Scenes that ignore the return (the non-obstacle navmesh scenes) are unaffected.\n */\n public createNavMesh(meshes: Array<{ _lite: LiteMesh }>, parameters: Record<string, unknown>): NavMeshResult {\n liteCreateNavMesh(\n this._lite,\n meshes.map((m) => m._lite),\n parameters as never\n );\n return { navMesh: this, tileCache: this };\n }\n\n /** Babylon.js `plugin.addCylinderObstacle(position, radius, height)` — tile-cache obstacle. */\n public addCylinderObstacle(position: Vec3Like, radius: number, height: number): LiteObstacleHandle | null {\n return liteAddCylinderObstacle(this._lite, { x: position.x, y: position.y, z: position.z }, radius, height);\n }\n\n /** Babylon.js `plugin.addBoxObstacle(position, extent, angle)` — tile-cache obstacle (`extent` = half-extents). */\n public addBoxObstacle(position: Vec3Like, extent: Vec3Like, angle: number): LiteObstacleHandle | null {\n return liteAddBoxObstacle(this._lite, { x: position.x, y: position.y, z: position.z }, { x: extent.x, y: extent.y, z: extent.z }, angle);\n }\n\n /** Babylon.js `plugin.removeObstacle(obstacle)` — remove a previously-added tile-cache obstacle. */\n public removeObstacle(obstacle: LiteObstacleHandle): void {\n liteRemoveObstacle(this._lite, obstacle);\n }\n\n /** @internal Apply pending tile-cache obstacle updates (drives {@link WaitForFullTileCacheUpdate}). */\n public _updateObstacles(): void {\n liteUpdateNavMeshObstacles(this._lite);\n }\n\n /** Babylon.js `plugin.createDebugNavMesh(scene)` — builds a renderable debug mesh. */\n public createDebugNavMesh(scene: Scene): Mesh {\n const geo = liteCreateDebugNavMeshGeometry(this._lite);\n const engine = scene.getEngine()._lite;\n const lite = createMeshFromData(engine, \"navDebugMesh\", geo.positions, geo.normals, geo.indices);\n return registerMeshAtStart(new Mesh(\"navDebugMesh\", lite, scene), scene);\n }\n\n /** Babylon.js `plugin.getClosestPoint(position)` — snap to the navmesh. */\n public getClosestPoint(position: Vec3Like): Vector3 {\n const p = liteGetClosestPoint(this._lite, { x: position.x, y: position.y, z: position.z });\n return new Vector3(p.x, p.y, p.z);\n }\n\n /** Babylon.js `plugin.computePath(start, end)` — navmesh-snapped path as world points. */\n public computePath(start: Vec3Like, end: Vec3Like): Vector3[] {\n const points = liteComputePath(this._lite, { x: start.x, y: start.y, z: start.z }, { x: end.x, y: end.y, z: end.z });\n return points.map((p) => new Vector3(p.x, p.y, p.z));\n }\n\n /** Babylon.js `plugin.computePathSmooth(start, end)` — alias of {@link computePath} (Lite smooths internally). */\n public computePathSmooth(start: Vec3Like, end: Vec3Like): Vector3[] {\n return this.computePath(start, end);\n }\n\n /**\n * Babylon.js `plugin.raycast(start, end)` — walkability raycast on the navmesh.\n * Returns `{ hit, hitPoint? }` (`hitPoint` is a `Vector3` when `hit`).\n */\n public raycast(start: Vec3Like, end: Vec3Like): { hit: boolean; hitPoint?: Vector3 } {\n const r = liteRaycast(this._lite, { x: start.x, y: start.y, z: start.z }, { x: end.x, y: end.y, z: end.z });\n return r.hit && r.hitPoint ? { hit: true, hitPoint: new Vector3(r.hitPoint.x, r.hitPoint.y, r.hitPoint.z) } : { hit: false };\n }\n\n /** Babylon.js `plugin.createCrowd(maxAgents, maxAgentRadius, scene)`. */\n public createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): RecastJSCrowd {\n const crowd = liteCreateNavCrowd(this._lite, maxAgents, maxAgentRadius);\n return new RecastJSCrowd(crowd, this, scene);\n }\n}\n\n/**\n * Babylon.js `@babylonjs/addons/navigation` `CreateNavigationPluginAsync`. The\n * injected Recast `instance` (if any) is ignored — Babylon Lite loads its own\n * Recast wasm from `/recast-navigation.wasm`.\n */\nexport async function CreateNavigationPluginAsync(_options?: { version?: string; instance?: unknown }): Promise<RecastNavigationJSPluginV2> {\n const lite = await liteCreateNavigationPluginAsync({ locateFile: () => \"/recast-navigation.wasm\" });\n return new RecastNavigationJSPluginV2(lite);\n}\n\nexport { RecastNavigationJSPluginV2, RecastJSCrowd };\n\n/**\n * Babylon.js `@babylonjs/addons/navigation/common/tile-cache`\n * `WaitForFullTileCacheUpdate(navMesh, tileCache)` — block until pending\n * tile-cache obstacle updates are applied. The addon takes the raw navMesh /\n * tileCache; here `navMesh` is the compat plugin (returned from `createNavMesh`),\n * so this delegates to Babylon Lite's `updateNavMeshObstacles`.\n */\nexport function WaitForFullTileCacheUpdate(navMesh: unknown, _tileCache?: unknown): void {\n const plugin = navMesh as RecastNavigationJSPluginV2 | undefined;\n if (plugin && typeof plugin._updateObstacles === \"function\") {\n plugin._updateObstacles();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgFA,IAAM,gBAAN,MAAoB;kBACC;CACjB,8BAA+B,IAAI,IAA4B;CAC/D;CAEA,YAAmB,MAAoB,QAAoC,OAAc;EACrF,KAAK,QAAQ;EACb,KAAK,UAAU;EAKf,MAAM,yBAAyB,UAAU;GACrC,eAAmB,KAAK,OAAQ,IAAI,KAAM,KAAK,QAAQ,UAAU;GACjE,KAAK,MAAM,CAAC,OAAO,cAAc,KAAK,aAAa;IAC/C,MAAM,IAAI,iBAAqB,KAAK,OAAO,KAAK;IAChD,UAAU,SAAS,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;GACxC;EACJ,CAAC;CACL;;CAGA,SAAgB,KAAe,YAA6B,WAAmC;EAC3F,MAAM,QAAQ,SAAa,KAAK,OAAO;GAAE,GAAG,IAAI;GAAG,GAAG,IAAI;GAAG,GAAG,IAAI;EAAE,GAAG,UAAU;EACnF,KAAK,YAAY,IAAI,OAAO,SAAS;EACrC,OAAO;CACX;;CAGA,iBAAwB,OAAwB;EAC5C,MAAM,IAAI,iBAAqB,KAAK,OAAO,KAAK;EAChD,OAAO,IAAI,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;CACpC;;CAGA,UAAiB,OAAe,aAA6B;EACzD,UAAc,KAAK,OAAO,OAAO;GAAE,GAAG,YAAY;GAAG,GAAG,YAAY;GAAG,GAAG,YAAY;EAAE,CAAC;CAC7F;AACJ;;;;AAKA,IAAM,6BAAN,MAAiC;kBACZ;;;;;CAKjB,aAAoB;CAEpB,YAAmB,MAA4B;EAC3C,KAAK,QAAQ;C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,GAAG,IAAI;GAAG,GAAG,IAAI;EAAE,CAC3G,CAAA,CAAO,KAAK,MAAM,IAAI,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;CACvD;;CAGA,kBAAyB,OAAiB,KAA0B;EAChE,OAAO,KAAK,YAAY,OAAO,GAAG;CACtC;;;;;CAMA,QAAe,OAAiB,KAAqD;EACjF,MAAM,IAAI,QAAY,KAAK,OAAO;GAAE,GAAG,MAAM;GAAG,GAAG,MAAM;GAAG,GAAG,MAAM;EAAE,GAAG;GAAE,GAAG,IAAI;GAAG,GAAG,IAAI;GAAG,GAAG,IAAI;EAAE,CAAC;EAC1G,OAAO,EAAE,OAAO,EAAE,WAAW;GAAE,KAAK;GAAM,UAAU,IAAI,QAAQ,EAAE,SAAS,GAAG,EAAE,SAAS,GAAG,EAAE,SAAS,CAAC;EAAE,IAAI,EAAE,KAAK,MAAM;CAC/H;;CAGA,YAAmB,WAAmB,gBAAwB,OAA6B;EAEvF,OAAO,IAAI,cADG,eAAmB,KAAK,OAAO,WAAW,cAC/B,GAAO,MAAM,KAAK;CAC/C;AACJ;;;;;;AAOA,eAAsB,4BAA4B,UAA0F;CAExI,OAAO,IAAI,2BAA2B,MADnB,4BAAgC,EAAE,kBAAkB,0BAA0B,CAAC,CACxD;AAC9C;;;;;;;;AAWA,SAAgB,2BAA2B,SAAkB,YAA4B;CACrF,MAAM,SAAS;CACf,IAAI,UAAU,OAAO,OAAO,qBAAqB,YAC7C,OAAO,iBAAiB;AAEhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs/lite-compat",
3
- "version": "1.30.0-preview",
3
+ "version": "1.31.1-preview",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Opt-in Babylon.js-shaped compatibility layer implemented on top of the Babylon Lite public API. Provides a migration runway from Babylon.js to Babylon Lite.",
@@ -47,8 +47,8 @@
47
47
  }
48
48
  },
49
49
  "babylonLiteRelease": {
50
- "azureBuildId": "59501",
51
- "sourceVersion": "4de3381838686541b50c6b7984794963de33f83a",
52
- "builtAgainstLite": "1.30.0"
50
+ "azureBuildId": "59978",
51
+ "sourceVersion": "7d66215c1c897734a3c2f25bdd15d0e7062ed8f4",
52
+ "builtAgainstLite": "1.31.1"
53
53
  }
54
54
  }