@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/README.md +64 -32
- 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 +89 -16
- package/index.js +377 -158
- package/index.js.map +1 -1
- package/{meshes-sOWGK4P8.js → meshes-Bt_UAqXU.js} +168 -56
- package/meshes-Bt_UAqXU.js.map +1 -0
- package/navigation.d.ts +85 -15
- package/navigation.js +2 -3
- package/navigation.js.map +1 -1
- package/package.json +4 -4
- package/recast-shim.js +1 -2
- package/rollup.js +2 -3
- package/vite.js +2 -3
- package/webpack.js +2 -3
- package/meshes-sOWGK4P8.js.map +0 -1
package/navigation.d.ts
CHANGED
|
@@ -162,12 +162,19 @@ declare interface AbstractEngineOptions extends EngineOptions {
|
|
|
162
162
|
* visibility, and shadow-receipt. Concrete meshes derive from this.
|
|
163
163
|
*/
|
|
164
164
|
declare class AbstractMesh extends TransformNode {
|
|
165
165
|
private _material;
|
|
166
166
|
private _meshBlendingTag;
|
|
167
|
+
protected _visibilityValue: number;
|
|
167
168
|
protected _visible: boolean;
|
|
168
169
|
constructor(name: string, lite: Mesh, scene?: Scene);
|
|
169
170
|
getClassName(): string;
|
|
170
171
|
get material(): CompatMaterial | null;
|
|
171
172
|
set material(value: CompatMaterial | null);
|
|
172
173
|
get isVisible(): boolean;
|
|
173
174
|
set isVisible(value: boolean);
|
|
175
|
+
/** Raw finite Babylon visibility; rendering clamps it to [0, 1]. Independent of isVisible. */
|
|
176
|
+
get visibility(): number;
|
|
177
|
+
set visibility(value: number);
|
|
178
|
+
private _validateCompatOpacityMaterial;
|
|
179
|
+
/** A glTF node owns its immediate primitive meshes, never a child glTF node's primitives. */
|
|
180
|
+
private _opacityTargets;
|
|
174
181
|
get isPickable(): boolean;
|
|
175
182
|
set isPickable(value: boolean);
|
|
176
183
|
get receiveShadows(): boolean;
|
|
@@ -200,8 +207,8 @@ declare class AbstractMesh extends TransformNode {
|
|
|
200
207
|
private _material;
|
|
201
208
|
pr
|
|
202
209
|
getVerticesData(kind: string): Float32Array | null;
|
|
203
210
|
/**
|
|
204
211
|
* Babylon.js `mesh.setVerticesData(kind, data)` — replace a vertex attribute.
|
|
205
|
-
* `position` / `normal` / `uv` / `color` / `tangent` re-upload the geometry
|
|
206
|
-
*
|
|
212
|
+
* `position` / `normal` / `uv` / `color` / `tangent` re-upload the geometry, into the
|
|
213
|
+
* existing GPU buffers when its layout is unchanged (`writeMeshGeometry`); the last-set `color`/`tangent` buffers are retained so successive calls
|
|
207
214
|
* (e.g. set tangent then set color) keep both. Skinning/morph attributes
|
|
208
215
|
* (`matricesIndices`, etc.) are accepted but not applied (Babylon Lite drives
|
|
209
216
|
* skinning through its own loaded-skeleton path).
|
|
@@ -216,8 +223,8 @@ declare class AbstractMesh extends TransformNode {
|
|
|
216
223
|
private _material;
|
|
217
224
|
pr
|
|
218
225
|
getIndices(_copyWhenShared?: boolean, forceCopy?: boolean): Uint32Array | null;
|
|
219
226
|
/**
|
|
220
227
|
* 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
|
|
228
|
+
* buffer. The geometry is re-uploaded through `writeMeshGeometry` (into the existing
|
|
229
|
+
* buffers when the index count is unchanged), keeping the existing position/normal/uv/tangent/color attributes and swapping
|
|
223
230
|
* only the indices. Returns the mesh for chaining.
|
|
224
231
|
*/
|
|
225
232
|
setIndices(indices: number[] | Uint16Array | Uint32Array | Int32Array, _totalVertices?: number | null, _updatable?: boolean): this;
|
|
226
233
|
private _lastTangents;
|
|
@@ -283,6 +290,8 @@ declare abstract class AbstractScene {
|
|
|
283
290
|
/**
|
|
284
291
|
getMeshById(id: string): TransformNode | null;
|
|
285
292
|
/** Babylon.js legacy `scene.getMeshByID(id)` — alias of {@link getMeshById}. */
|
|
286
293
|
getMeshByID(id: string): TransformNode | null;
|
|
294
|
+
/** Babylon.js `scene.getMeshByUniqueId(uniqueId)` — the mesh with that auto-generated `uniqueId`, else `null`. */
|
|
295
|
+
getMeshByUniqueId(uniqueId: number): TransformNode | null;
|
|
287
296
|
/** Babylon.js `scene.getNodeByName(name)` — searches meshes, cameras, and lights. */
|
|
288
297
|
getNodeByName(name: string): Node_2 | null;
|
|
289
298
|
/** Babylon.js `scene.getNodeById(id)` — searches meshes, cameras, and lights by `id`. */
|
|
@@ -321,10 +330,16 @@ declare class Animatable_2 {
|
|
|
321
330
|
private readonly _from;
|
|
322
331
|
private readonly _to;
|
|
323
332
|
private readonly _loop;
|
|
324
|
-
masterFrame: number;
|
|
325
333
|
private _speedRatio;
|
|
334
|
+
masterFrame: number;
|
|
335
|
+
/** Babylon.js `onAnimationEnd`: called when the animatable ends, on its own or through `stop()`. */
|
|
336
|
+
onAnimationEnd: (() => void) | null;
|
|
337
|
+
/** Babylon.js `onAnimationEndObservable`: notified right after `onAnimationEnd`. */
|
|
338
|
+
readonly onAnimationEndObservable: Observable<Animatable_2>;
|
|
339
|
+
/** Babylon.js `disposeOnEnd`: when the animatable completes on its own, its end callback and observers are cleared once
|
|
340
|
+
* they ran (default true). Unlike Babylon.js, compat keeps it in `scene.animatables`. */
|
|
341
|
+
disposeOnEnd: boolean;
|
|
326
342
|
private _speedRatio;
|
|
327
343
|
private _paused;
|
|
328
|
-
private _stopped;
|
|
329
|
-
private readonly _nativeManager;
|
|
344
|
+
private _stopped;
|
|
330
345
|
private readonly _nativeManager;
|
|
331
346
|
private readonly _fallbackAnimations;
|
|
332
347
|
private readonly _fallbackFrames;
|
|
333
348
|
private readonly _fallbackElapsedFrames;
|
|
@@ -334,8 +349,15 @@ declare class Animatable_2 {
|
|
|
334
349
|
set speedRatio(value: number);
|
|
335
350
|
goToFrame(frame: number): void;
|
|
336
351
|
pause(): void;
|
|
337
352
|
restart(): void;
|
|
338
|
-
|
|
339
|
-
|
|
353
|
+
/**
|
|
354
|
+
* Babylon.js `stop(animationName?, targetMask?, useGlobalSplice?, skipOnAnimationEnd?)`: stops the animatable and raises
|
|
355
|
+
* its end unless `skipOnAnimationEnd`. Stopping only the tracks matching `animationName` or `targetMask` is not supported.
|
|
356
|
+
*/
|
|
357
|
+
stop(animationName?: string, targetMask?: (target: unknown) => boolean, _useGlobalSplice?: boolean, skipOnAnimationEnd?: boolean): void;
|
|
358
|
+
/** Babylon.js `waitAsync()`: resolves with this animatable when it next ends. */
|
|
359
|
+
waitAsync(): Promise<Animatable_2>;
|
|
340
360
|
get animationStarted(): boolean;
|
|
361
|
+
private _raiseOnAnimationEnd;
|
|
362
|
+
private _raiseOnCompletion;
|
|
341
363
|
private _applyFallback;
|
|
342
364
|
private _advanceFallback;
|
|
343
365
|
private _resetFallbackAnimation;
|
|
@@ -560,6 +582,11 @@ declare abstract class Camera extends Node_2 {
|
|
|
560
582
|
get globalPosition(): Vector3;
|
|
561
583
|
/** Babylon.js `camera.getViewMatrix()` — the camera's view matrix. */
|
|
562
584
|
getViewMatrix(): Matrix;
|
|
585
|
+
/** Babylon.js `camera.getDirection(localAxis)`: `localAxis` in world space, without translation. */
|
|
586
|
+
getDirection(localAxis: Vector3): Vector3;
|
|
587
|
+
/** Babylon.js `camera.getDirectionToRef(localAxis, result)`: `localAxis` turned by the camera's world matrix, which Lite
|
|
588
|
+
* keeps current. `result` may be `localAxis`. */
|
|
589
|
+
getDirectionToRef(localAxis: Vector3, result: Vector3): void;
|
|
563
590
|
/** Babylon.js `camera.getProjectionMatrix()` — the camera's projection matrix. */
|
|
564
591
|
getProjectionMatrix(): Matrix;
|
|
565
592
|
private _aspectRatio;
|
|
@@ -892,7 +919,20 @@ declare abstract class Light extends Node_2 {
|
|
|
892
919
|
protected constructor(name: st
|
|
893
920
|
* carries `0`, but the getter still returns the logical value the caller set.
|
|
894
921
|
*/
|
|
895
922
|
get intensity(): number;
|
|
896
|
-
set intensity(value: number);
|
|
897
923
|
/** Detach this light's shadow generator (compat for `light.shadowEnabled = false`). */
|
|
924
|
+
set intensity(value: number);
|
|
898
925
|
private _excludedMeshes;
|
|
926
|
+
private _includedOnlyMeshes;
|
|
927
|
+
private _meshListSyncScheduled;
|
|
928
|
+
private _meshListSceneRelease;
|
|
929
|
+
/**
|
|
930
|
+
* Meshes this light does not light. Babylon.js hands out the light's own array, and
|
|
931
|
+
* `push` / `splice` on it are observed (those are the two methods Babylon.js hooks), so both
|
|
932
|
+
* `light.excludedMeshes = [...]` and `light.excludedMeshes.push(mesh)` reach the Lite light.
|
|
933
|
+
*/
|
|
934
|
+
get excludedMeshes(): AbstractMesh[];
|
|
935
|
+
set excludedMeshes(value: AbstractMesh[]);
|
|
936
|
+
/** Meshes this light lights exclusively. Live in the same way as {@link excludedMeshes}. */
|
|
937
|
+
get includedOnlyMeshes(): AbstractMesh[];
|
|
938
|
+
set includedOnlyMeshes(value: AbstractMesh[]);
|
|
899
939
|
private _spliceMeshOut;
|
|
900
940
|
/** Detach this light's shadow generator (compat for `light.shadowEnabled = false`). */
|
|
901
941
|
set shadowEnabled(enabled: boolean);
|
|
902
942
|
|
|
903
943
|
declare class LinesMaterial extends Material {
|
|
@@ -1036,6 +1076,10 @@ declare class Matrix {
|
|
|
1036
1076
|
decompose(scale?: Vector3, rotation?: Quaternion, translation?: Vector3): boolean;
|
|
1037
1077
|
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
1078
|
static FromArray(array: ArrayLike<number>, offset?: number): Matrix;
|
|
1079
|
+
/** Babylon.js `Matrix.Invert(source)`: a new matrix holding the inverse of `source`, which is left as it is. */
|
|
1080
|
+
static Invert(source: Matrix): Matrix;
|
|
1081
|
+
/** Babylon.js `Matrix.FromXYZAxesToRef(xaxis, yaxis, zaxis, result)`: the axes as the first three rows. */
|
|
1082
|
+
static FromXYZAxesToRef<T extends Matrix>(xaxis: Vector3, yaxis: Vector3, zaxis: Vector3, result: T): T;
|
|
1039
1083
|
static Identity(): Matrix;
|
|
1040
1084
|
static Zero(): Matrix;
|
|
1041
1085
|
static Translation(x: number, y: number, z: number): Matrix;
|
|
@@ -1718,7 +1762,18 @@ declare class Quaternion {
|
|
|
1718
1762
|
static FromLookDirectionRHToRef<T extends Quaternion>(forward: Vector3, up: Vector3, result: T): T;
|
|
1719
1763
|
private static _FromRotationStorageToRef;
|
|
1720
1764
|
static FromEulerAngles(x: number, y: number, z: number): Quaternion;
|
|
1765
|
+
/** Babylon.js `Quaternion.FromEulerVector(vec)`: `vec` holds pitch (x), yaw (y) and roll (z). */
|
|
1766
|
+
static FromEulerVector(vec: Vector3): Quaternion;
|
|
1767
|
+
/** Babylon.js `Quaternion.FromEulerVectorToRef(vec, result)`. */
|
|
1768
|
+
static FromEulerVectorToRef<T extends Quaternion>(vec: Vector3, result: T): T;
|
|
1769
|
+
/** Babylon.js `Quaternion.RotationQuaternionFromAxis(axis1, axis2, axis3)`: the rotation of the XYZ system onto these axes. */
|
|
1770
|
+
static RotationQuaternionFromAxis(axis1: Vector3, axis2: Vector3, axis3: Vector3): Quaternion;
|
|
1771
|
+
/** Babylon.js `Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, ref)`. Like Babylon.js, it normalizes
|
|
1772
|
+
* copies of the axes and uses them as the rows of a rotation matrix (`Matrix.FromXYZAxesToRef`); the axes are left as they are. */
|
|
1773
|
+
static RotationQuaternionFromAxisToRef<T extends Quaternion>(axis1: Vector3, axis2: Vector3, axis3: Vector3, ref: T): T;
|
|
1721
1774
|
static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion;
|
|
1775
|
+
/** Babylon.js `Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, result)`. */
|
|
1776
|
+
static RotationYawPitchRollToRef<T extends Quaternion>(yaw: number, pitch: number, roll: number, result: T): T;
|
|
1722
1777
|
static RotationAxis(axis: Vector3, angle: number): Quaternion;
|
|
1723
1778
|
static Slerp(left: Quaternion, right: Quaternion, amount: number): Quaternion;
|
|
1724
1779
|
}
|
|
@@ -2018,18 +2073,24 @@ declare class Scene extends AbstractScene {
|
|
|
2018
2073
|
/** Babylon.js fog-mode constant
|
|
2019
2074
|
/** Babylon.js `scene.disablePhysicsEngine()` — release the active physics world. */
|
|
2020
2075
|
disablePhysicsEngine(): void;
|
|
2021
2076
|
/**
|
|
2022
|
-
* Babylon.js `scene.beginDirectAnimation(target, animations, from, to, loop, speedRatio?)`.
|
|
2077
|
+
* Babylon.js `scene.beginDirectAnimation(target, animations, from, to, loop, speedRatio?, onAnimationEnd?)`.
|
|
2023
2078
|
* Delegates supported tracks to Babylon Lite property animation and retains
|
|
2024
2079
|
* explicit compat evaluation only for unsupported tracks. Returns one facade
|
|
2025
2080
|
* coordinating both subsets.
|
|
2026
2081
|
*/
|
|
2027
|
-
beginDirectAnimation(target: unknown, animations: Animation_2[], from: number, to: number, loop?: boolean, speedRatio?: number): Animatable_2;
|
|
2028
2082
|
/**
|
|
2029
|
-
|
|
2030
|
-
* the animations already attached to `target.animations`.
|
|
2083
|
+
beginDirectAnimation(target: unknown, animations: Animation_2[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Animatable_2;
|
|
2031
2084
|
/**
|
|
2085
|
+
* Babylon.js `scene.beginAnimation(target, from, to, loop, speedRatio?, onAnimationEnd?, animatable?, stopCurrent?)`.
|
|
2086
|
+
* Runs the animations already attached to `target.animations`. As in Babylon.js, the target's running animatables
|
|
2087
|
+
* are stopped first unless `stopCurrent` is false. Appending to an existing `animatable` is not supported.
|
|
2032
2088
|
*/
|
|
2033
2089
|
beginAnimation(target: {
|
|
2034
2090
|
animations?: Animation_2[];
|
|
2035
|
-
}, from: number, to: number, loop?: boolean, speedRatio?: number): Animatable_2;
|
|
2091
|
+
}, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable_2 | null, stopCurrent?: boolean): Animatable_2;
|
|
2092
|
+
/**
|
|
2093
|
+
* Babylon.js `scene.stopAnimation(target)`: stops every running animatable of `target`, which raises their
|
|
2094
|
+
* `onAnimationEnd`. Stopping only the tracks matching `animationName` or `targetMask` is not supported.
|
|
2095
|
+
*/
|
|
2096
|
+
stopAnimation(target: unknown, animationName?: string, targetMask?: (target: unknown) => boolean): void;
|
|
2036
2097
|
dispose(): void;
|
|
2037
2098
|
}
|
|
2038
2099
|
|
|
@@ -2147,6 +2208,11 @@ declare class TransformNode extends Node_2 {
|
|
|
2147
2208
|
physicsBody: PhysicsBody | null
|
|
2148
2209
|
*/
|
|
2149
2210
|
get rotationQuaternion(): Quaternion | null;
|
|
2150
2211
|
set rotationQuaternion(value: Quaternion | null);
|
|
2212
|
+
/**
|
|
2213
|
+
* Babylon.js `getChildTransformNodes(directDescendantsOnly?, predicate?)` — the descendants that are transform nodes
|
|
2214
|
+
* (meshes included). As in Babylon.js, `predicate` is called on every evaluated descendant.
|
|
2215
|
+
*/
|
|
2216
|
+
getChildTransformNodes(directDescendantsOnly?: boolean, predicate?: (node: Node_2) => boolean): TransformNode[];
|
|
2151
2217
|
/**
|
|
2152
2218
|
* Babylon.js `setParent(node)` — reparent while **preserving world position**
|
|
2153
2219
|
* (the child's local transform is recomputed). Distinct from the `parent`
|
|
@@ -2190,6 +2256,8 @@ declare class Vector2 {
|
|
|
2190
2256
|
y: number;
|
|
2191
2257
|
}>(result: T): T;
|
|
2192
2258
|
clone(): Vector2;
|
|
2259
|
+
/** Babylon.js `dot(otherVector)`. */
|
|
2260
|
+
dot(otherVector: Vector2): number;
|
|
2193
2261
|
equals(other: Vector2): boolean;
|
|
2194
2262
|
asArray(): [number, number];
|
|
2195
2263
|
static Zero(): Vector2;
|
|
@@ -2223,6 +2291,8 @@ declare class Vector3 {
|
|
|
2223
2291
|
lengthSquared(): number;
|
|
2224
2292
|
normalize(): this;
|
|
2225
2293
|
clone(): Vector3;
|
|
2294
|
+
/** Babylon.js `dot(otherVector)`. */
|
|
2295
|
+
dot(otherVector: Vector3): number;
|
|
2226
2296
|
equals(other: Vector3): boolean;
|
|
2227
2297
|
equalsWithEpsilon(other: Vector3, epsilon?: number): boolean;
|
|
2228
2298
|
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-Bt_UAqXU.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,UA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mB,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,IAAI,OAAO,SAAS;EACrC,OAAO;CACX;;CAGA,iBAAwB,OAAwB;EAC5C,MAAM,IAAID,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,MAAM,EAAE,KAAK,GACzB,UACJ;EAC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GAAG,EAAE,CAAC,CAAC;CACvD;;CAGA,kBAAyB,OAAiB,KAA0B;EAChE,OAAO,KAAK,YAAY,OAAO,GAAG;CACtC;;;;;CAMA,QAAe,OAAiB,KAAqD;EACjF,MAAM,IAAIC,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,cADGC,eAAmB,KAAK,OAAO,WAAW,cAC/B,GAAO,MAAM,KAAK;CAC/C;AACJ;;;;;;AAOA,eAAsB,4BAA4B,UAA0F;CAExI,OAAO,IAAI,2BAA2B,MADnBC,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.38.
|
|
3
|
+
"version": "1.38.2-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": "
|
|
51
|
-
"sourceVersion": "
|
|
52
|
-
"builtAgainstLite": "1.38.
|
|
50
|
+
"azureBuildId": "62175",
|
|
51
|
+
"sourceVersion": "bc317f91a55b2af616abf487812ac6d4888151f7",
|
|
52
|
+
"builtAgainstLite": "1.38.2"
|
|
53
53
|
}
|
|
54
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
|