@babylonjs/lite-compat 1.38.0-alpha-preview → 1.38.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/{brdf-lut-data-BRUnY8c5.js → brdf-lut-data-CIJtJXN2.js} +2 -3
- package/{brdf-lut-data-BRUnY8c5.js.map → brdf-lut-data-CIJtJXN2.js.map} +1 -1
- package/{bundler-resolve-CVkl7m-0.js → bundler-resolve-DLIJhtfD.js} +2 -3
- package/{bundler-resolve-CVkl7m-0.js.map → bundler-resolve-DLIJhtfD.js.map} +1 -1
- package/esbuild.js +2 -3
- package/index.d.ts +82 -16
- package/index.js +377 -158
- package/index.js.map +1 -1
- package/{meshes-sOWGK4P8.js → meshes-CTqDBeGc.js} +132 -54
- package/meshes-CTqDBeGc.js.map +1 -0
- package/navigation.d.ts +78 -15
- package/navigation.js +2 -3
- package/navigation.js.map +1 -1
- package/package.json +5 -8
- package/recast-shim.js +1 -2
- package/rollup.js +2 -3
- package/vite.js +2 -3
- package/webpack.js +2 -3
- package/CHANGELOG.md +0 -1669
- package/meshes-sOWGK4P8.js.map +0 -1
package/navigation.d.ts
CHANGED
|
@@ -200,8 +200,8 @@ declare class AbstractMesh extends TransformNode {
|
|
|
200
200
|
private _material;
|
|
201
201
|
pr
|
|
202
202
|
getVerticesData(kind: string): Float32Array | null;
|
|
203
203
|
/**
|
|
204
204
|
* Babylon.js `mesh.setVerticesData(kind, data)` — replace a vertex attribute.
|
|
205
|
-
* `position` / `normal` / `uv` / `color` / `tangent` re-upload the geometry
|
|
206
|
-
*
|
|
205
|
+
* `position` / `normal` / `uv` / `color` / `tangent` re-upload the geometry, into the
|
|
206
|
+
* existing GPU buffers when its layout is unchanged (`writeMeshGeometry`); the last-set `color`/`tangent` buffers are retained so successive calls
|
|
207
207
|
* (e.g. set tangent then set color) keep both. Skinning/morph attributes
|
|
208
208
|
* (`matricesIndices`, etc.) are accepted but not applied (Babylon Lite drives
|
|
209
209
|
* skinning through its own loaded-skeleton path).
|
|
@@ -216,8 +216,8 @@ declare class AbstractMesh extends TransformNode {
|
|
|
216
216
|
private _material;
|
|
217
217
|
pr
|
|
218
218
|
getIndices(_copyWhenShared?: boolean, forceCopy?: boolean): Uint32Array | null;
|
|
219
219
|
/**
|
|
220
220
|
* Babylon.js `mesh.setIndices(indices)` — replace the mesh's index (topology)
|
|
221
|
-
* buffer.
|
|
222
|
-
* keeping the existing position/normal/uv/tangent/color attributes and swapping
|
|
221
|
+
* buffer. The geometry is re-uploaded through `writeMeshGeometry` (into the existing
|
|
222
|
+
* buffers when the index count is unchanged), keeping the existing position/normal/uv/tangent/color attributes and swapping
|
|
223
223
|
* only the indices. Returns the mesh for chaining.
|
|
224
224
|
*/
|
|
225
225
|
setIndices(indices: number[] | Uint16Array | Uint32Array | Int32Array, _totalVertices?: number | null, _updatable?: boolean): this;
|
|
226
226
|
private _lastTangents;
|
|
@@ -283,6 +283,8 @@ declare abstract class AbstractScene {
|
|
|
283
283
|
/**
|
|
284
284
|
getMeshById(id: string): TransformNode | null;
|
|
285
285
|
/** Babylon.js legacy `scene.getMeshByID(id)` — alias of {@link getMeshById}. */
|
|
286
286
|
getMeshByID(id: string): TransformNode | null;
|
|
287
|
+
/** Babylon.js `scene.getMeshByUniqueId(uniqueId)` — the mesh with that auto-generated `uniqueId`, else `null`. */
|
|
288
|
+
getMeshByUniqueId(uniqueId: number): TransformNode | null;
|
|
287
289
|
/** Babylon.js `scene.getNodeByName(name)` — searches meshes, cameras, and lights. */
|
|
288
290
|
getNodeByName(name: string): Node_2 | null;
|
|
289
291
|
/** Babylon.js `scene.getNodeById(id)` — searches meshes, cameras, and lights by `id`. */
|
|
@@ -321,10 +323,16 @@ declare class Animatable_2 {
|
|
|
321
323
|
private readonly _from;
|
|
322
324
|
private readonly _to;
|
|
323
325
|
private readonly _loop;
|
|
324
|
-
masterFrame: number;
|
|
325
326
|
private _speedRatio;
|
|
327
|
+
masterFrame: number;
|
|
328
|
+
/** Babylon.js `onAnimationEnd`: called when the animatable ends, on its own or through `stop()`. */
|
|
329
|
+
onAnimationEnd: (() => void) | null;
|
|
330
|
+
/** Babylon.js `onAnimationEndObservable`: notified right after `onAnimationEnd`. */
|
|
331
|
+
readonly onAnimationEndObservable: Observable<Animatable_2>;
|
|
332
|
+
/** Babylon.js `disposeOnEnd`: when the animatable completes on its own, its end callback and observers are cleared once
|
|
333
|
+
* they ran (default true). Unlike Babylon.js, compat keeps it in `scene.animatables`. */
|
|
334
|
+
disposeOnEnd: boolean;
|
|
326
335
|
private _speedRatio;
|
|
327
336
|
private _paused;
|
|
328
|
-
private _stopped;
|
|
329
|
-
private readonly _nativeManager;
|
|
337
|
+
private _stopped;
|
|
330
338
|
private readonly _nativeManager;
|
|
331
339
|
private readonly _fallbackAnimations;
|
|
332
340
|
private readonly _fallbackFrames;
|
|
333
341
|
private readonly _fallbackElapsedFrames;
|
|
@@ -334,8 +342,15 @@ declare class Animatable_2 {
|
|
|
334
342
|
set speedRatio(value: number);
|
|
335
343
|
goToFrame(frame: number): void;
|
|
336
344
|
pause(): void;
|
|
337
345
|
restart(): void;
|
|
338
|
-
|
|
339
|
-
|
|
346
|
+
/**
|
|
347
|
+
* Babylon.js `stop(animationName?, targetMask?, useGlobalSplice?, skipOnAnimationEnd?)`: stops the animatable and raises
|
|
348
|
+
* its end unless `skipOnAnimationEnd`. Stopping only the tracks matching `animationName` or `targetMask` is not supported.
|
|
349
|
+
*/
|
|
350
|
+
stop(animationName?: string, targetMask?: (target: unknown) => boolean, _useGlobalSplice?: boolean, skipOnAnimationEnd?: boolean): void;
|
|
351
|
+
/** Babylon.js `waitAsync()`: resolves with this animatable when it next ends. */
|
|
352
|
+
waitAsync(): Promise<Animatable_2>;
|
|
340
353
|
get animationStarted(): boolean;
|
|
354
|
+
private _raiseOnAnimationEnd;
|
|
355
|
+
private _raiseOnCompletion;
|
|
341
356
|
private _applyFallback;
|
|
342
357
|
private _advanceFallback;
|
|
343
358
|
private _resetFallbackAnimation;
|
|
@@ -560,6 +575,11 @@ declare abstract class Camera extends Node_2 {
|
|
|
560
575
|
get globalPosition(): Vector3;
|
|
561
576
|
/** Babylon.js `camera.getViewMatrix()` — the camera's view matrix. */
|
|
562
577
|
getViewMatrix(): Matrix;
|
|
578
|
+
/** Babylon.js `camera.getDirection(localAxis)`: `localAxis` in world space, without translation. */
|
|
579
|
+
getDirection(localAxis: Vector3): Vector3;
|
|
580
|
+
/** Babylon.js `camera.getDirectionToRef(localAxis, result)`: `localAxis` turned by the camera's world matrix, which Lite
|
|
581
|
+
* keeps current. `result` may be `localAxis`. */
|
|
582
|
+
getDirectionToRef(localAxis: Vector3, result: Vector3): void;
|
|
563
583
|
/** Babylon.js `camera.getProjectionMatrix()` — the camera's projection matrix. */
|
|
564
584
|
getProjectionMatrix(): Matrix;
|
|
565
585
|
private _aspectRatio;
|
|
@@ -892,7 +912,20 @@ declare abstract class Light extends Node_2 {
|
|
|
892
912
|
protected constructor(name: st
|
|
893
913
|
* carries `0`, but the getter still returns the logical value the caller set.
|
|
894
914
|
*/
|
|
895
915
|
get intensity(): number;
|
|
896
|
-
set intensity(value: number);
|
|
897
916
|
/** Detach this light's shadow generator (compat for `light.shadowEnabled = false`). */
|
|
917
|
+
set intensity(value: number);
|
|
898
918
|
private _excludedMeshes;
|
|
919
|
+
private _includedOnlyMeshes;
|
|
920
|
+
private _meshListSyncScheduled;
|
|
921
|
+
private _meshListSceneRelease;
|
|
922
|
+
/**
|
|
923
|
+
* Meshes this light does not light. Babylon.js hands out the light's own array, and
|
|
924
|
+
* `push` / `splice` on it are observed (those are the two methods Babylon.js hooks), so both
|
|
925
|
+
* `light.excludedMeshes = [...]` and `light.excludedMeshes.push(mesh)` reach the Lite light.
|
|
926
|
+
*/
|
|
927
|
+
get excludedMeshes(): AbstractMesh[];
|
|
928
|
+
set excludedMeshes(value: AbstractMesh[]);
|
|
929
|
+
/** Meshes this light lights exclusively. Live in the same way as {@link excludedMeshes}. */
|
|
930
|
+
get includedOnlyMeshes(): AbstractMesh[];
|
|
931
|
+
set includedOnlyMeshes(value: AbstractMesh[]);
|
|
899
932
|
private _spliceMeshOut;
|
|
900
933
|
/** Detach this light's shadow generator (compat for `light.shadowEnabled = false`). */
|
|
901
934
|
set shadowEnabled(enabled: boolean);
|
|
902
935
|
|
|
903
936
|
declare class LinesMaterial extends Material {
|
|
@@ -1036,6 +1069,10 @@ declare class Matrix {
|
|
|
1036
1069
|
decompose(scale?: Vector3, rotation?: Quaternion, translation?: Vector3): boolean;
|
|
1037
1070
|
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;
|
|
1038
1071
|
static FromArray(array: ArrayLike<number>, offset?: number): Matrix;
|
|
1072
|
+
/** Babylon.js `Matrix.Invert(source)`: a new matrix holding the inverse of `source`, which is left as it is. */
|
|
1073
|
+
static Invert(source: Matrix): Matrix;
|
|
1074
|
+
/** Babylon.js `Matrix.FromXYZAxesToRef(xaxis, yaxis, zaxis, result)`: the axes as the first three rows. */
|
|
1075
|
+
static FromXYZAxesToRef<T extends Matrix>(xaxis: Vector3, yaxis: Vector3, zaxis: Vector3, result: T): T;
|
|
1039
1076
|
static Identity(): Matrix;
|
|
1040
1077
|
static Zero(): Matrix;
|
|
1041
1078
|
static Translation(x: number, y: number, z: number): Matrix;
|
|
@@ -1718,7 +1755,18 @@ declare class Quaternion {
|
|
|
1718
1755
|
static FromLookDirectionRHToRef<T extends Quaternion>(forward: Vector3, up: Vector3, result: T): T;
|
|
1719
1756
|
private static _FromRotationStorageToRef;
|
|
1720
1757
|
static FromEulerAngles(x: number, y: number, z: number): Quaternion;
|
|
1758
|
+
/** Babylon.js `Quaternion.FromEulerVector(vec)`: `vec` holds pitch (x), yaw (y) and roll (z). */
|
|
1759
|
+
static FromEulerVector(vec: Vector3): Quaternion;
|
|
1760
|
+
/** Babylon.js `Quaternion.FromEulerVectorToRef(vec, result)`. */
|
|
1761
|
+
static FromEulerVectorToRef<T extends Quaternion>(vec: Vector3, result: T): T;
|
|
1762
|
+
/** Babylon.js `Quaternion.RotationQuaternionFromAxis(axis1, axis2, axis3)`: the rotation of the XYZ system onto these axes. */
|
|
1763
|
+
static RotationQuaternionFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Quaternion;
|
|
1764
|
+
/** Babylon.js `Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, ref)`. Like Babylon.js, it normalizes
|
|
1765
|
+
* copies of the axes and uses them as the rows of a rotation matrix (`Matrix.FromXYZAxesToRef`); the axes are left as they are. */
|
|
1766
|
+
static RotationQuaternionFromAxisToRef<T extends Quaternion>(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: T): T;
|
|
1721
1767
|
static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
|
|
1768
|
+
/** Babylon.js `Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, result)`. */
|
|
1769
|
+
static RotationYawPitchRollToRef<T extends Quaternion>(yaw: number, pitch: number, roll: number, result: T): T;
|
|
1722
1770
|
static RotationAxis(axis: Vector3, angle: number): Quaternion;
|
|
1723
1771
|
static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
|
|
1724
1772
|
}
|
|
@@ -2018,18 +2066,24 @@ declare class Scene extends AbstractScene {
|
|
|
2018
2066
|
/** Babylon.js fog-mode constant
|
|
2019
2067
|
/** Babylon.js `scene.disablePhysicsEngine()` — release the active physics world. */
|
|
2020
2068
|
disablePhysicsEngine(): void;
|
|
2021
2069
|
/**
|
|
2022
|
-
* Babylon.js `scene.beginDirectAnimation(target, animations, from, to, loop, speedRatio?)`.
|
|
2070
|
+
* Babylon.js `scene.beginDirectAnimation(target, animations, from, to, loop, speedRatio?, onAnimationEnd?)`.
|
|
2023
2071
|
* Delegates supported tracks to Babylon Lite property animation and retains
|
|
2024
2072
|
* explicit compat evaluation only for unsupported tracks. Returns one facade
|
|
2025
2073
|
* coordinating both subsets.
|
|
2026
2074
|
*/
|
|
2027
|
-
beginDirectAnimation(target: unknown, animations: Animation_2[], from: number, to: number, loop?: boolean, speedRatio?: number): Animatable_2;
|
|
2028
2075
|
/**
|
|
2029
|
-
|
|
2030
|
-
* the animations already attached to `target.animations`.
|
|
2076
|
+
beginDirectAnimation(target: unknown, animations: Animation_2[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable_2;
|
|
2031
2077
|
/**
|
|
2078
|
+
* Babylon.js `scene.beginAnimation(target, from, to, loop, speedRatio?, onAnimationEnd?, animatable?, stopCurrent?)`.
|
|
2079
|
+
* Runs the animations already attached to `target.animations`. As in Babylon.js, the target's running animatables
|
|
2080
|
+
* are stopped first unless `stopCurrent` is false. Appending to an existing `animatable` is not supported.
|
|
2032
2081
|
*/
|
|
2033
2082
|
beginAnimation(target: {
|
|
2034
2083
|
animations?: Animation_2[];
|
|
2035
|
-
}, from: number, to: number, loop?: boolean, speedRatio?: number): Animatable_2;
|
|
2084
|
+
}, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable_2 | null, stopCurrent?: boolean): Animatable_2;
|
|
2085
|
+
/**
|
|
2086
|
+
* Babylon.js `scene.stopAnimation(target)`: stops every running animatable of `target`, which raises their
|
|
2087
|
+
* `onAnimationEnd`. Stopping only the tracks matching `animationName` or `targetMask` is not supported.
|
|
2088
|
+
*/
|
|
2089
|
+
stopAnimation(target: unknown, animationName?: string, targetMask?: (target: unknown) => boolean): void;
|
|
2036
2090
|
dispose(): void;
|
|
2037
2091
|
}
|
|
2038
2092
|
|
|
@@ -2147,6 +2201,11 @@ declare class TransformNode extends Node_2 {
|
|
|
2147
2201
|
physicsBody: PhysicsBody | null
|
|
2148
2202
|
*/
|
|
2149
2203
|
get rotationQuaternion(): Quaternion | null;
|
|
2150
2204
|
set rotationQuaternion(value: Quaternion | null);
|
|
2205
|
+
/**
|
|
2206
|
+
* Babylon.js `getChildTransformNodes(directDescendantsOnly?, predicate?)` — the descendants that are transform nodes
|
|
2207
|
+
* (meshes included). As in Babylon.js, `predicate` is called on every evaluated descendant.
|
|
2208
|
+
*/
|
|
2209
|
+
getChildTransformNodes(directDescendantsOnly?: boolean, predicate?: (node: Node_2) => boolean): TransformNode[];
|
|
2151
2210
|
/**
|
|
2152
2211
|
* Babylon.js `setParent(node)` — reparent while **preserving world position**
|
|
2153
2212
|
* (the child's local transform is recomputed). Distinct from the `parent`
|
|
@@ -2190,6 +2249,8 @@ declare class Vector2 {
|
|
|
2190
2249
|
y: number;
|
|
2191
2250
|
}>(result: T): T;
|
|
2192
2251
|
clone(): Vector2;
|
|
2252
|
+
/** Babylon.js `dot(otherVector)`. */
|
|
2253
|
+
dot(otherVector: Vector2): number;
|
|
2193
2254
|
equals(other: Vector2): boolean;
|
|
2194
2255
|
asArray(): [number, number];
|
|
2195
2256
|
static Zero(): Vector2;
|
|
@@ -2223,6 +2284,8 @@ declare class Vector3 {
|
|
|
2223
2284
|
lengthSquared(): number;
|
|
2224
2285
|
normalize(): this;
|
|
2225
2286
|
clone(): Vector3;
|
|
2287
|
+
/** Babylon.js `dot(otherVector)`. */
|
|
2288
|
+
dot(otherVector: Vector3): number;
|
|
2226
2289
|
equals(other: Vector3): boolean;
|
|
2227
2290
|
equalsWithEpsilon(other: Vector3, epsilon?: number): boolean;
|
|
2228
2291
|
asArray(): [number, number, number];
|
package/navigation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as registerMeshAtStart, Q as Vector3, b as Mesh } from "./meshes-
|
|
1
|
+
import { D as registerMeshAtStart, Q as Vector3, b as Mesh } from "./meshes-CTqDBeGc.js";
|
|
2
2
|
import { addAgent, addBoxObstacle, addCylinderObstacle, agentGoto, computePath, createDebugNavMeshGeometry, createMeshFromData, createNavCrowd, createNavMesh, createNavigationPluginAsync, getAgentPosition, getClosestPoint, raycast, removeObstacle, updateNavCrowd, updateNavMeshObstacles } from "@babylonjs/lite";
|
|
3
|
-
|
|
3
|
+
// src/navigation/navigation.ts
|
|
4
4
|
/**
|
|
5
5
|
* Babylon.js `@babylonjs/addons/navigation` compatibility wrapper over Babylon
|
|
6
6
|
* Lite's native navigation API (`createNavigationPluginAsync` / `createNavMesh` /
|
|
@@ -189,7 +189,6 @@ function WaitForFullTileCacheUpdate(navMesh, _tileCache) {
|
|
|
189
189
|
const plugin = navMesh;
|
|
190
190
|
if (plugin && typeof plugin._updateObstacles === "function") plugin._updateObstacles();
|
|
191
191
|
}
|
|
192
|
-
//#endregion
|
|
193
192
|
export { CreateNavigationPluginAsync, RecastJSCrowd, RecastNavigationJSPluginV2, WaitForFullTileCacheUpdate };
|
|
194
193
|
|
|
195
194
|
//# sourceMappingURL=navigation.js.map
|
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 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;CACjB;;;;;;;CAQA,cAAqB,QAAoC,YAAoD;EACzG,cACI,KAAK,OACL,OAAO,KAAK,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,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"}
|
|
1
|
+
{"version":3,"file":"navigation.js","names":["liteGetAgentPosition","liteAddAgent","liteAddCylinderObstacle","liteAddBoxObstacle","liteCreateDebugNavMeshGeometry","liteGetClosestPoint","liteComputePath","liteRaycast","liteCreateNavCrowd","liteCreateNavigationPluginAsync"],"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,IAAIA,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,QAAQC,SAAa,KAAK,OAAO;GAAE,GAAG,IAAI;GAAG,GAAG,IAAI;GAAG,GAAG,IAAI;EAAE,GAAG,UAAU;EACnF,KAAK,YAAY,I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;;;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.38.
|
|
3
|
+
"version": "1.38.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.",
|
|
@@ -39,19 +39,16 @@
|
|
|
39
39
|
},
|
|
40
40
|
"sideEffects": false,
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@babylonjs/lite": "
|
|
42
|
+
"@babylonjs/lite": "*"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"vite": {
|
|
46
46
|
"optional": true
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
|
-
"publishConfig": {
|
|
50
|
-
"tag": "preview"
|
|
51
|
-
},
|
|
52
49
|
"babylonLiteRelease": {
|
|
53
|
-
"azureBuildId": "
|
|
54
|
-
"sourceVersion": "
|
|
55
|
-
"builtAgainstLite": "1.38.
|
|
50
|
+
"azureBuildId": "62063",
|
|
51
|
+
"sourceVersion": "454a69495947d41f7298f2aed09f8d5f26c5d7cb",
|
|
52
|
+
"builtAgainstLite": "1.38.1"
|
|
56
53
|
}
|
|
57
54
|
}
|
package/recast-shim.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/navigation/recast-shim.ts
|
|
2
2
|
/**
|
|
3
3
|
* No-op stand-in for `@recast-navigation/core` / `@recast-navigation/generators`
|
|
4
4
|
* inside the compat (`?compat`) subtree.
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
*/
|
|
14
14
|
/** Babylon.js scenes call `await RecastCore.init()`; Lite loads Recast itself, so no-op. */
|
|
15
15
|
async function init() {}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { init };
|
|
18
17
|
|
|
19
18
|
//# sourceMappingURL=recast-shim.js.map
|
package/rollup.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as resolveCompatSpecifier } from "./bundler-resolve-
|
|
2
|
-
|
|
1
|
+
import { n as resolveCompatSpecifier } from "./bundler-resolve-DLIJhtfD.js";
|
|
2
|
+
// src/rollup.ts
|
|
3
3
|
/**
|
|
4
4
|
* A reusable Rollup plugin that lets an existing Babylon.js project run on
|
|
5
5
|
* Babylon Lite **without changing its import statements**. It rewrites
|
|
@@ -35,7 +35,6 @@ function liteCompat() {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
//#endregion
|
|
39
38
|
export { liteCompat };
|
|
40
39
|
|
|
41
40
|
//# sourceMappingURL=rollup.js.map
|
package/vite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as resolveCompatSpecifier } from "./bundler-resolve-
|
|
2
|
-
|
|
1
|
+
import { n as resolveCompatSpecifier } from "./bundler-resolve-DLIJhtfD.js";
|
|
2
|
+
// src/vite.ts
|
|
3
3
|
/**
|
|
4
4
|
* Create the Babylon Lite compat Vite plugin. Add it to your config's `plugins`
|
|
5
5
|
* array and keep your Babylon.js imports exactly as they are — they resolve to
|
|
@@ -19,7 +19,6 @@ function liteCompat() {
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { liteCompat };
|
|
24
23
|
|
|
25
24
|
//# sourceMappingURL=vite.js.map
|
package/webpack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as resolveCompatSpecifier, t as COMPAT_SOURCE_FILTER } from "./bundler-resolve-
|
|
2
|
-
|
|
1
|
+
import { n as resolveCompatSpecifier, t as COMPAT_SOURCE_FILTER } from "./bundler-resolve-DLIJhtfD.js";
|
|
2
|
+
// src/webpack.ts
|
|
3
3
|
/**
|
|
4
4
|
* A reusable Webpack plugin that lets an existing Babylon.js project run on
|
|
5
5
|
* Babylon Lite **without changing its import statements**. It rewrites
|
|
@@ -39,7 +39,6 @@ var LiteCompatPlugin = class {
|
|
|
39
39
|
}).apply(compiler);
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
//#endregion
|
|
43
42
|
export { LiteCompatPlugin };
|
|
44
43
|
|
|
45
44
|
//# sourceMappingURL=webpack.js.map
|