@babylonjs/lite-compat 1.8.0-preview → 1.9.0-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
@@ -6,6 +6,7 @@ import { Mesh } from '@babylonjs/lite';
6
6
  import { NavCrowd } from '@babylonjs/lite';
7
7
  import { NavigationPlugin } from '@babylonjs/lite';
8
8
  import { ObstacleHandle } from '@babylonjs/lite';
9
+ import { PhysicsWorld } from '@babylonjs/lite';
9
10
  import { RenderCanvas } from '@babylonjs/lite';
10
11
  import { SceneNode } from '@babylonjs/lite';
11
12
  import { SheenProps } from '@babylonjs/lite';
@@ -488,8 +489,7 @@ declare class CubeTexture {
488
489
  coordinatesMode: number;
489
490
  name: string;
490
491
  gammaSpace: boolean;
491
- level: number;
492
- /** Fires when the cube map is "ready" (resolved on a microtask in this compat layer). */
492
+ level: number;
493
493
  /** Fires when the cube map is "ready" (resolved on a microtask in this compat layer). */
494
494
  readonly onLoadObservable: Observable<CubeTexture>;
495
495
  private _ready;
496
496
  constructor(url: string, _scene?: unknown, _extensions?: unknown, _noMipmap?: boolean, _files?: unknown, onLoad?: (() => void) | null, _onError?: unknown, _format?: unknown, _prefiltered?: boolean);
@@ -548,6 +548,75 @@ declare class GridMaterial {
548
548
  getClassName(): string;
549
549
  dispose(): void;
550
550
  }
551
551
 
552
+ /**
553
+ * Babylon.js-shaped Havok V2 physics plugin, backed by Babylon Lite's native
554
+ * `createHavokWorld` API.
555
+ *
556
+ * Construct it exactly as in Babylon.js and pass it to {@link Scene.enablePhysics}:
557
+ * ```ts
558
+ * const hknp = await HavokPhysics();
559
+ * scene.enablePhysics(new Vector3(0, -9.81, 0), new HavokPlugin(true, hknp));
560
+ * ```
561
+ *
562
+ * The first constructor argument, `useDeltaForWorldStep` (default `true`,
563
+ * matching Babylon.js), selects delta-driven stepping: the world advances by the
564
+ * elapsed real time each frame, so the simulation runs at the same real-time
565
+ * speed regardless of the display refresh rate (issue #332). Pass `false` for the
566
+ * legacy fixed `1/60`-per-frame behaviour.
567
+ *
568
+ * Bodies are still created with the native `createPhysicsAggregate` /
569
+ * `createPhysicsBody` API against {@link world}; the Babylon.js `PhysicsAggregate`
570
+ * class is not wrapped.
571
+ */
572
+ declare class HavokPlugin {
573
+ /** Name of the plugin. */
574
+ readonly name: string;
552
575
  /** The native Lite physics world, created when the plugin is attached to a scene. */
576
+ world: PhysicsWorld | null;
553
577
  constructor(useDeltaForWorldStep?: boolean, hpInjection?: unknown);
578
+ /** Whether the plugin has a usable Havok module. */
579
+ isSupported(): boolean;
580
+ /** Babylon.js physics plugin version (Havok is V2). */
581
+ getPluginVersion(): number;
582
+ /** Set the fixed timestep used when delta stepping is disabled. Matches Babylon.js. */
583
+ setTimeStep(timeStep: number): void;
584
+ /** Get the fixed timestep. Matches Babylon.js. */
585
+ getTimeStep(): number;
586
+ /** Set the world gravity. */
587
+ setGravity(gravity: Vec3Like_2, worldPosition?: Vec3Like_2): void;
588
+ /**
589
+ * Manual single-step entry point. Babylon Lite drives world stepping
590
+ * internally (once per rendered frame, via the scene's before-render hook),
591
+ * so calling this directly is unsupported — use {@link Scene.enablePhysics}.
592
+ */
593
+ executeStep(): never;
594
+ /** Release the native physics world. */
595
+ dispose(): void;
596
+
597
+ /**
598
+ * Babylon.js `HDRCubeTexture` — a Radiance `.hdr` (RGBE) equirectangular panorama
599
+ * used as an environment / IBL source. Like {@link CubeTexture} this is a
600
+ * lightweight handle that records the `.hdr` URL; the actual GPU work (equirect →
601
+ * prefiltered cubemap + irradiance SH + BRDF LUT) happens when it is assigned to
602
+ * `scene.environmentTexture` and the engine starts, at which point the scene
603
+ * routes it through Babylon Lite's native `loadHdrEnvironment`.
604
+ */
605
+ declare class HDRCubeTexture {
606
+ /** Source URL of the `.hdr` panorama. */
607
+ readonly url: string;
608
+ /** Requested cubemap face size (BJS `size`); forwarded to Lite's `faceSize`. */
609
+ readonly size: number;
610
+ /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */
611
+ coordinatesMode: number;
612
+ name: string;
613
+ gammaSpace: boolean;
614
+ level: number;
554
615
  /** Fires when the HDR environment is "ready" (resolved on a microtask). */
616
+ readonly onLoadObservable: Observable<HDRCubeTexture>;
617
+ private _ready;
618
+ constructor(url: string, _sceneOrEngine?: unknown, size?: number, _noMipmap?: boolean, _generateHarmonics?: boolean, _gammaSpace?: boolean, _prefilterOnLoad?: boolean, onLoad?: (() => void) | null);
619
+ /** Babylon.js `BaseTexture.isReady()`. */
620
+ isReady(): boolean;
621
+ dispose(): void;
622
+ }
623
+
555
624
  declare interface IAnimationKey {
556
625
  frame: number;
557
626
  value: number | number[];
@@ -897,10 +966,10 @@ declare class PBRMaterial extends PushMaterial {
897
966
  constructor(name: string, s
898
967
  * environment assigned to a material is routed to the owning scene's
899
968
  * environment (the dominant single-IBL case Babylon.js scenes use).
900
969
  */
901
- get environmentTexture(): CubeTexture | null;
902
- set environmentTexture(value: CubeTexture | null);
903
- get reflectionTexture(): CubeTexture | null;
904
- set reflectionTexture(value: CubeTexture | null);
970
+ get environmentTexture(): CubeTexture | HDRCubeTexture | null;
971
+ set environmentTexture(value: CubeTexture | HDRCubeTexture | null);
972
+ get reflectionTexture(): CubeTexture | HDRCubeTexture | null;
973
+ set reflectionTexture(value: CubeTexture | HDRCubeTexture | null);
905
974
 
906
975
  /** Babylon.js `PBRSheenConfiguration` — the `pbr.sheen` sub-object over Lite `SheenProps`. */
907
976
  declare class PBRSheenConfiguration {
@@ -921,6 +990,28 @@ declare class PBRSheenConfiguration {
921
990
  } | null);
922
991
  }
923
992
 
993
+ /**
994
+ * Babylon.js-shaped Physics V2 engine wrapper returned by
995
+ * {@link Scene.getPhysicsEngine}. Holds the active {@link HavokPlugin} and the
996
+ * world gravity, exposing the common Babylon.js `IPhysicsEngine` surface.
997
+ */
998
+ declare class PhysicsEngine {
924
999
  /** Current world gravity. */
1000
+ gravity: Vec3Like_2;
1001
+ constructor(plugin: HavokPlugin, gravity: Vec3Like_2);
1002
+ /** The underlying physics plugin. */
1003
+ getPhysicsPlugin(): HavokPlugin;
1004
+ /** Physics engine plugin version (Havok is V2). */
1005
+ getPluginVersion(): number;
1006
+ /** Set the world gravity. */
1007
+ setGravity(gravity: Vec3Like_2): void;
1008
+ /** Set the fixed timestep. */
1009
+ setTimeStep(newTimeStep: number): void;
1010
+ /** Get the fixed timestep. */
1011
+ getTimeStep(): number;
1012
+ /** Release the underlying physics world. */
1013
+ dispose(): void;
1014
+ }
1015
+
925
1016
  declare class Plane {
926
1017
  /** Normal x/y/z and signed distance `d` from the origin (`normal · p + d = 0`). */
927
1018
  normal: Vector3;
@@ -1155,8 +1246,8 @@ declare class Scene extends AbstractScene {
1155
1246
  /** Babylon.js fog-mode constant
1156
1247
  */
1157
1248
  get clipPlane(): Plane | null;
1158
1249
  set clipPlane(value: Plane | null);
1159
- get environmentTexture(): CubeTexture | null;
1160
- set environmentTexture(value: CubeTexture | null);
1250
+ get environmentTexture(): CubeTexture | HDRCubeTexture | null;
1251
+ set environmentTexture(value: CubeTexture | HDRCubeTexture | null);
1161
1252
  /**
1162
1253
  * Babylon.js `scene.createDefaultEnvironment` — adds an IBL skybox and ground.
1163
1254
  * Babylon Lite performs this through `loadEnvironment` (deferred to engine start),
@@ -1172,7 +1263,7 @@ declare class Scene extends AbstractScene {
1172
1263
  /** Babylon.js fog-mode constant
1173
1264
  * loaded `.env` specular cubemap as an HDR skybox, so this records the env URL (if
1174
1265
  * not already set) and flags a skybox-from-environment load at engine start.
1175
1266
  */
1176
- createDefaultSkybox(texture?: CubeTexture, _pbr?: boolean, scale?: number, _blur?: number, _setGlobalEnv?: boolean): {
1267
+ createDefaultSkybox(texture?: CubeTexture | HDRCubeTexture, _pbr?: boolean, scale?: number, _blur?: number, _setGlobalEnv?: boolean): {
1177
1268
  dispose(): void;
1178
1269
  };
1179
1270
  /** Create and activate a default arc-rotate camera framing the scene. */
1180
1271
  createDefaultCamera(_createArcRotateCamera?: boolean, _replace?: boolean, _attachControl?: boolean): Camera;
@@ -1191,7 +1282,28 @@ declare class Scene extends AbstractScene {
1191
1282
  /** Babylon.js fog-mode constant
1192
1283
  /** Synchronous CPU picking — unsupported. Babylon Lite uses async GPU picking. */
1193
1284
  pick(): never;
1194
1285
  /** Synchronous ray picking — unsupported. */
1195
- pickWithRay(): never;
1286
+ pickWithRay(): never;
1196
1287
  /**
1288
+ * Babylon.js `scene.enablePhysics(gravity, plugin)`. Wires the given Havok V2
1289
+ * {@link HavokPlugin} to this scene, creating the native Lite physics world and
1290
+ * registering per-frame stepping. The plugin's `useDeltaForWorldStep` flag
1291
+ * controls whether the world advances by elapsed frame time (refresh-rate
1292
+ * independent — issue #332) or a fixed `1/60` step.
1293
+ *
1294
+ * Bodies are created with the native `createPhysicsAggregate` /
1295
+ * `createPhysicsBody` API against `scene.getPhysicsEngine().getPhysicsPlugin().world`.
1296
+ * @returns `true` once physics is enabled.
1297
+ */
1298
+ enablePhysics(gravity?: {
1299
+ x: number;
1300
+ y: number;
1301
+ z: number;
1302
+ } | null, plugin?: HavokPlugin): boolean;
1303
+ /** Babylon.js `scene.getPhysicsEngine()` — the active Physics V2 engine, or `null`. */
1304
+ getPhysicsEngine(): PhysicsEngine | null;
1305
+ /** Babylon.js `scene.isPhysicsEnabled()`. */
1306
+ isPhysicsEnabled(): boolean;
1307
+ /** Babylon.js `scene.disablePhysicsEngine()` — release the active physics world. */
1308
+ disablePhysicsEngine(): void;
1197
1309
  /**
1198
1310
  * Babylon.js `scene.beginDirectAnimation(target, animations, from, to, loop, speedRatio?)`.
1199
1311
  * Drives the given `Animation`s on the CPU each frame, writing onto the target's
@@ -1286,6 +1398,13 @@ declare interface Vec3Like {
1286
1398
  z: number;
1287
1399
  }
1288
1400
 
1401
+ /** Minimal `{x, y, z}` view shared by the compat `Vector3` and Lite's `Vec3`. */
1402
+ declare interface Vec3Like_2 {
1403
+ x: number;
1404
+ y: number;
1405
+ z: number;
1406
+ }
1407
+
1289
1408
  declare class Vector3 {
1290
1409
  x: number;
1291
1410
  y: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs/lite-compat",
3
- "version": "1.8.0-preview",
3
+ "version": "1.9.0-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": "55784",
51
- "sourceVersion": "202de479c36ada33c0385d2f0036a859948f66a5",
52
- "builtAgainstLite": "1.8.0"
50
+ "azureBuildId": "56026",
51
+ "sourceVersion": "da4d41119ede97c25b437a49e18074fe2d86a181",
52
+ "builtAgainstLite": "1.9.0"
53
53
  }
54
54
  }