@babylonjs/lite-compat 1.26.0-preview → 1.27.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/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { V as Vector3, a as Vector2, u as unsupported, O as Observable, L as LiteCompatError, N as Node, M as Matrix, C as Color3, S as StandardMaterial, b as Color4, A as AbstractMesh, c as Mesh, T as TransformNode, l as liteBackedVector3, Q as Quaternion } from "./meshes-nWGELV98.js";
5
- import { B, d, e, f, g, h, i, j, k, m, n, o, p, q, r, G, I, s, t, v, P, w, x, y, z, D, E, F, H, J, K, R, U } from "./meshes-nWGELV98.js";
6
- import { addPolarToRef, subtractPolarToRef, multiplyPolarToRef, dividePolarToRef, scalePolarToRef, polarToVec2ToRef, polarFromVec2ToRef, addSphericalToRef, subtractSphericalToRef, multiplySphericalToRef, divideSphericalToRef, scaleSphericalToRef, sphericalToVec3ToRef, sphericalFromVec3ToRef, sampleHermiteSpline, sampleCatmullRomSpline, VERSION, createEngine, onBeforeRender, stopEngine, resizeEngine, setEngineSize, disposeEngine, uploadImageToArrayLayer, enableMirroredMeshes, registerSceneWithShadowSupport, registerScene, startEngine, createNullEngine, stepScene, setPhysicsTimestep, setPhysicsGravity, disposePhysics, createHavokWorld, createPhysicsShape, createPhysicsAggregate, createPhysicsBody, setPhysicsBodyPrestepType, PhysicsPrestepType as PhysicsPrestepType$1, PhysicsMotionType as PhysicsMotionType$1, setPhysicsBodyShape, setPhysicsBodyMotionType, setPhysicsBodyMassProperties, setPhysicsBodyLinearVelocity, getPhysicsBodyLinearVelocity, setPhysicsBodyAngularVelocity, getPhysicsBodyAngularVelocity, applyPhysicsBodyImpulse, applyPhysicsBodyForce, removePhysicsBody, createPhysicsCharacterController, calculatePhysicsCharacterMovementToRef, PhysicsShapeType as PhysicsShapeType$1, setPhysicsShapeFilterMembershipMask, setPhysicsShapeFilterCollideMask, setPhysicsShapeMaterial, setPhysicsShapeIsTrigger, releasePhysicsShape, createArcRotateCamera, attachControl, getCameraPosition, getViewMatrix, getProjectionMatrix, createGeospatialCamera, setGeospatialOrientation, attachGeospatialControls, createFreeCamera, attachFreeControl, setAnimationAdditive, playAnimation, pauseAnimation, goToFrame, stopAnimation, createSceneContext, updateAnimationManager, setFog, setClipPlane, loadHdrEnvironment, loadDdsEnvironment, loadEnvironment, createDefaultCamera, addToScene, createHemisphericLight, pickMeshesWithRay, createAnimationManager, enableAnimationBlending, addAnimationGroup, disposeScene, createDirectionalLight, createPointLight, createSpotLight, createClusteredLightContainer, createClusteredPointLight, removeFromScene, addClusteredLightContainer, markClusteredLightContainerDirty, createCsgFromMesh, csgSubtract, csgIntersect, csgUnion, createMeshFromCsg, createCsg2FromMesh, csg2Subtract, csg2Intersect, csg2Add, createMeshesFromCsg2, disposeCsg2, initializeCsg2Async, createMorphTargets, setMorphTargetWeights, createTransformNode, bakeCurrentTransformIntoVertices, loadSOG, loadSPZ, loadSplat, createDynamicTexture, updateDynamicTexture, createTexture2DFromPixels, updateTexture2DFromPixels, createTexture3DFromPixels, loadBasisTexture2D, loadKtxTexture2D, loadTexture2D, createTexture2DArrayFromUrls, createTexture2DArrayFromKtx2, loadImageToArrayLayer, createTexture2DArray, createTexture2DArrayFromPixels, updateTexture2DArrayFromPixels, setBonePosition, setBoneRotationQuaternion, setBoneScaling, clearBoneOverride, getBoneByName, enableBoneControlForSkinnedAssets, loadBabylon, loadGltf, resetVariant, getVariantNames, selectVariant, disposePicker, createGpuPicker, pickAsync, createAxisDragGizmo, attachAxisDragGizmoToNode, disposeAxisDragGizmo, createAxisScaleGizmo, attachAxisScaleGizmoToNode, disposeAxisScaleGizmo, createBoundingBoxGizmo, attachBoundingBoxGizmoToNode, disposeBoundingBoxGizmo, createCameraGizmo, attachCameraGizmoToCamera, disposeCameraGizmo, createLightGizmo, attachLightGizmoToLight, disposeLightGizmo, createPlaneDragGizmo, attachPlaneDragGizmoToNode, disposePlaneDragGizmo, createPlaneRotationGizmo, attachPlaneRotationGizmoToNode, disposePlaneRotationGizmo, createPositionGizmo, setPositionGizmoLocalCoordinates, attachPositionGizmoToNode, disposePositionGizmo, createRotationGizmo, setRotationGizmoLocalCoordinates, attachRotationGizmoToNode, disposeRotationGizmo, createScaleGizmo, setScaleGizmoLocalCoordinates, attachScaleGizmoToNode, disposeScaleGizmo, createUtilityLayer, registerUtilityLayer, disposeUtilityLayer, addBillboardSpriteIndex, updateBillboardSpriteIndex, loadSpriteAtlas, createFacingBillboardSystem, addFacingBillboardSystem, billboardBlendAdditive, billboardBlendAlpha, spriteBlendPremultiplied, spriteBlendAdditive, spriteBlendAlpha, createSprite2DLayer, addSprite2DIndex, createSpriteRenderer, registerSpriteRenderer, updateSprite2DIndex, createPcfSpotlightShadowGenerator, createPcfDirectionalShadowGenerator, createEsmDirectionalShadowGenerator, setShadowTaskCasterMeshes, parseNodeMaterialFromSnippet, createGridMaterial, getByteFrequencyData, getFloatFrequencyData, getByteTimeDomainData, getFloatTimeDomainData, enableAnalyzer, setSpatialPosition, setSpatialOrientation, enableSpatial, setSpatialListenerPosition, setSpatialListener, updateSpatialAudio, enableStereo, setStereoPan, disposeAudioBus, setBusVolume, getMasterVolume, setMasterVolume, unlockAudioEngineAsync, createSoundAsync, createSoundBufferAsync, createStreamingSoundAsync, createAudioBusAsync, createSoundSourceAsync, createMicrophoneSoundSourceAsync, disposeAudioEngine, createAudioEngineAsync, disposeSoundSource, setSoundSourceVolume, playSound, pauseSound, resumeSound, stopSound, disposeSound, setSoundVolume, playStreamingSound, pauseStreamingSound, resumeStreamingSound, stopStreamingSound, preloadStreamingInstanceAsync, preloadStreamingInstancesAsync, disposeStreamingSound, setStreamingSoundVolume, startParticleSystem, animateParticleSystem, stopParticleSystem, createParticleBillboard, syncParticleBillboard, parseNodeParticleSetFromSnippet, registerNodeParticleSet } from "@babylonjs/lite";
4
+ import { V as Vector3, a as Vector2, u as unsupported, O as Observable, L as LiteCompatError, N as Node, M as Matrix, l as liteBackedVector3, C as Color3, S as StandardMaterial, b as Color4, A as AbstractMesh, c as Mesh, T as TransformNode, Q as Quaternion, P as PushMaterial } from "./meshes-CgaKo90D.js";
5
+ import { B, d, e, f, g, h, i, j, k, m, n, o, p, q, r, G, I, s, t, v, w, x, y, z, D, E, F, H, J, K, R, U } from "./meshes-CgaKo90D.js";
6
+ import { addPolarToRef, subtractPolarToRef, multiplyPolarToRef, dividePolarToRef, scalePolarToRef, polarToVec2ToRef, polarFromVec2ToRef, addSphericalToRef, subtractSphericalToRef, multiplySphericalToRef, divideSphericalToRef, scaleSphericalToRef, sphericalToVec3ToRef, sphericalFromVec3ToRef, sampleHermiteSpline, sampleCatmullRomSpline, VERSION, createEngine, onBeforeRender, stopEngine, resizeEngine, setEngineSize, disposeEngine, uploadImageToArrayLayer, enableMirroredMeshes, registerSceneWithShadowSupport, registerScene, startEngine, createNullEngine, stepScene, setPhysicsTimestep, setPhysicsGravity, disposePhysics, createHavokWorld, createPhysicsShape, createPhysicsAggregate, createPhysicsBody, setPhysicsBodyPrestepType, PhysicsPrestepType as PhysicsPrestepType$1, PhysicsMotionType as PhysicsMotionType$1, setPhysicsBodyShape, setPhysicsBodyMotionType, setPhysicsBodyMassProperties, setPhysicsBodyLinearVelocity, getPhysicsBodyLinearVelocity, setPhysicsBodyAngularVelocity, getPhysicsBodyAngularVelocity, applyPhysicsBodyImpulse, applyPhysicsBodyForce, removePhysicsBody, createPhysicsCharacterController, calculatePhysicsCharacterMovementToRef, createPhysicsConstraint, releasePhysicsConstraint, PhysicsShapeType as PhysicsShapeType$1, setPhysicsShapeFilterMembershipMask, setPhysicsShapeFilterCollideMask, setPhysicsShapeMaterial, setPhysicsShapeIsTrigger, releasePhysicsShape, CharacterSupportedState as CharacterSupportedState$1, PhysicsConstraintType as PhysicsConstraintType$1, PhysicsConstraintAxis as PhysicsConstraintAxis$1, createArcRotateCamera, attachControl, getCameraPosition, getViewMatrix, getProjectionMatrix, createBankedFreeCamera, createGeospatialCamera, setGeospatialOrientation, attachGeospatialControls, createFreeCamera, attachFreeControl, setAnimationAdditive, playAnimation, pauseAnimation, goToFrame, stopAnimation, createSceneContext, updateAnimationManager, setFog, setClipPlane, loadHdrEnvironment, loadDdsEnvironment, loadEnvironment, createDefaultCamera, addToScene, createHemisphericLight, pickMeshesWithRay, createAnimationManager, enableAnimationBlending, addAnimationGroup, disposeScene, createDirectionalLight, createPointLight, createSpotLight, createClusteredLightContainer, createClusteredPointLight, removeFromScene, addClusteredLightContainer, markClusteredLightContainerDirty, createCsgFromMesh, csgSubtract, csgIntersect, csgUnion, createMeshFromCsg, createCsg2FromMesh, csg2Subtract, csg2Intersect, csg2Add, createMeshesFromCsg2, disposeCsg2, initializeCsg2Async, createMorphTargets, setMorphTargetWeights, createTransformNode, bakeCurrentTransformIntoVertices, loadSOG, loadSPZ, loadSplat, createDynamicTexture, updateDynamicTexture, createTexture2DFromPixels, updateTexture2DFromPixels, createTexture3DFromPixels, loadBasisTexture2D, loadKtxTexture2D, loadTexture2D, createTexture2DArrayFromUrls, createTexture2DArrayFromKtx2, loadImageToArrayLayer, createTexture2DArray, createTexture2DArrayFromPixels, updateTexture2DArrayFromPixels, setBonePosition, setBoneRotationQuaternion, setBoneScaling, clearBoneOverride, getBoneByName, enableBoneControlForSkinnedAssets, loadBabylon, loadGltf, resetVariant, getVariantNames, selectVariant, disposePicker, createGpuPicker, pickAsync, createAxisDragGizmo, attachAxisDragGizmoToNode, disposeAxisDragGizmo, createAxisScaleGizmo, attachAxisScaleGizmoToNode, disposeAxisScaleGizmo, createBoundingBoxGizmo, attachBoundingBoxGizmoToNode, disposeBoundingBoxGizmo, createCameraGizmo, attachCameraGizmoToCamera, disposeCameraGizmo, createLightGizmo, attachLightGizmoToLight, disposeLightGizmo, createPlaneDragGizmo, attachPlaneDragGizmoToNode, disposePlaneDragGizmo, createPlaneRotationGizmo, attachPlaneRotationGizmoToNode, disposePlaneRotationGizmo, createPositionGizmo, setPositionGizmoLocalCoordinates, attachPositionGizmoToNode, disposePositionGizmo, createRotationGizmo, setRotationGizmoLocalCoordinates, attachRotationGizmoToNode, disposeRotationGizmo, createScaleGizmo, setScaleGizmoLocalCoordinates, attachScaleGizmoToNode, disposeScaleGizmo, createUtilityLayer, registerUtilityLayer, disposeUtilityLayer, addBillboardSpriteIndex, updateBillboardSpriteIndex, loadSpriteAtlas, createFacingBillboardSystem, addFacingBillboardSystem, billboardBlendAdditive, billboardBlendAlpha, spriteBlendPremultiplied, spriteBlendAdditive, spriteBlendAlpha, createSprite2DLayer, addSprite2DIndex, createSpriteRenderer, registerSpriteRenderer, updateSprite2DIndex, createCsmDirectionalShadowGenerator, createPcfSpotlightShadowGenerator, createPcfDirectionalShadowGenerator, createEsmDirectionalShadowGenerator, setShadowTaskCasterMeshes, parseNodeMaterialFromSnippet, createGridMaterial, getByteFrequencyData, getFloatFrequencyData, getByteTimeDomainData, getFloatTimeDomainData, enableAnalyzer, setSpatialPosition, setSpatialOrientation, enableSpatial, setSpatialListenerPosition, setSpatialListener, updateSpatialAudio, enableStereo, setStereoPan, disposeAudioBus, setBusVolume, getMasterVolume, setMasterVolume, unlockAudioEngineAsync, createSoundAsync, createSoundBufferAsync, createStreamingSoundAsync, createAudioBusAsync, createSoundSourceAsync, createMicrophoneSoundSourceAsync, disposeAudioEngine, createAudioEngineAsync, disposeSoundSource, setSoundSourceVolume, playSound, pauseSound, resumeSound, stopSound, disposeSound, setSoundVolume, playStreamingSound, pauseStreamingSound, resumeStreamingSound, stopStreamingSound, preloadStreamingInstanceAsync, preloadStreamingInstancesAsync, disposeStreamingSound, setStreamingSoundVolume, startParticleSystem, animateParticleSystem, stopParticleSystem, createParticleBillboard, syncParticleBillboard, parseNodeParticleSetFromSnippet, registerNodeParticleSet } from "@babylonjs/lite";
7
7
  const Epsilon = 1e-3;
8
8
  const ToRadians = Math.PI / 180;
9
9
  const ToDegrees = 180 / Math.PI;
@@ -828,8 +828,15 @@ class AbstractEngine {
828
828
  */
829
829
  __publicField(this, "_lateWork", []);
830
830
  this._canvas = canvas;
831
- const opts = typeof options === "object" ? { ...options } : void 0;
832
- if (opts && opts.useLargeWorldRendering) {
831
+ const opts = typeof options === "object" ? { ...options } : options === false ? { msaaSamples: 1 } : void 0;
832
+ if (opts) {
833
+ const antialias = opts.antialias;
834
+ delete opts.antialias;
835
+ if (antialias === false) {
836
+ opts.msaaSamples = 1;
837
+ }
838
+ }
839
+ if (opts == null ? void 0 : opts.useLargeWorldRendering) {
833
840
  delete opts.useLargeWorldRendering;
834
841
  opts.useHighPrecisionMatrix = true;
835
842
  opts.useFloatingOrigin = true;
@@ -1046,27 +1053,29 @@ class AbstractEngine {
1046
1053
  endFrame() {
1047
1054
  return unsupported("WebGPUEngine.endFrame", "Babylon Lite's frame graph owns the frame loop; drive rendering with `runRenderLoop`.");
1048
1055
  }
1049
- /**
1050
- * Babylon.js `engine.currentSampleCount` — the MSAA sample count of the current render target.
1051
- * Babylon Lite manages MSAA internally and exposes no public sample-count accessor, so this
1052
- * needs a tree-shakeable Lite core addition before it can report a real value.
1053
- */
1056
+ /** Babylon.js `engine.currentSampleCount` — the active surface's MSAA sample count. */
1054
1057
  get currentSampleCount() {
1055
- return unsupported("AbstractEngine.currentSampleCount", "Babylon Lite manages MSAA internally and exposes no public sample-count accessor.");
1058
+ return this._headless ? 1 : this._lite.msaaSamples;
1056
1059
  }
1057
1060
  /**
1058
- * Babylon.js `engine.getAlphaToCoverage()` — alpha-to-coverage state. Babylon Lite does not
1059
- * expose an engine-level alpha-to-coverage toggle, so this is unsupported.
1061
+ * Babylon.js `engine.getAlphaToCoverage()` — alpha-to-coverage state. Lite's API is scoped to
1062
+ * individual material/sprite/text pipeline owners, not the engine-wide state BJS exposes.
1060
1063
  */
1061
1064
  getAlphaToCoverage() {
1062
- return unsupported("AbstractEngine.getAlphaToCoverage", "Babylon Lite does not expose an engine-level alpha-to-coverage toggle.");
1065
+ return unsupported(
1066
+ "AbstractEngine.getAlphaToCoverage",
1067
+ "Lite's alpha-to-coverage API is target-scoped; mapping BJS's engine-wide state requires a pipeline-owner lifecycle policy."
1068
+ );
1063
1069
  }
1064
1070
  /**
1065
- * Babylon.js `engine.setAlphaToCoverage(enable)` — toggle alpha-to-coverage. Babylon Lite does
1066
- * not expose an engine-level alpha-to-coverage toggle, so this is unsupported.
1071
+ * Babylon.js `engine.setAlphaToCoverage(enable)` — toggle alpha-to-coverage. Lite's target-
1072
+ * scoped API cannot reproduce the engine-wide state without a pipeline-owner lifecycle policy.
1067
1073
  */
1068
1074
  setAlphaToCoverage(_enable) {
1069
- return unsupported("AbstractEngine.setAlphaToCoverage", "Babylon Lite does not expose an engine-level alpha-to-coverage toggle.");
1075
+ return unsupported(
1076
+ "AbstractEngine.setAlphaToCoverage",
1077
+ "Lite's alpha-to-coverage API is target-scoped; mapping BJS's engine-wide state requires a pipeline-owner lifecycle policy."
1078
+ );
1070
1079
  }
1071
1080
  /**
1072
1081
  * Babylon.js `engine.updateTextureArrayLayerFromImageSource(texture, source, layer, invertY, premultiplyAlpha)`
@@ -1398,12 +1407,31 @@ var PhysicsConstraintType = /* @__PURE__ */ ((PhysicsConstraintType2) => {
1398
1407
  PhysicsConstraintType2[PhysicsConstraintType2["SIX_DOF"] = 7] = "SIX_DOF";
1399
1408
  return PhysicsConstraintType2;
1400
1409
  })(PhysicsConstraintType || {});
1410
+ var PhysicsConstraintAxis = /* @__PURE__ */ ((PhysicsConstraintAxis2) => {
1411
+ PhysicsConstraintAxis2[PhysicsConstraintAxis2["LINEAR_X"] = 0] = "LINEAR_X";
1412
+ PhysicsConstraintAxis2[PhysicsConstraintAxis2["LINEAR_Y"] = 1] = "LINEAR_Y";
1413
+ PhysicsConstraintAxis2[PhysicsConstraintAxis2["LINEAR_Z"] = 2] = "LINEAR_Z";
1414
+ PhysicsConstraintAxis2[PhysicsConstraintAxis2["ANGULAR_X"] = 3] = "ANGULAR_X";
1415
+ PhysicsConstraintAxis2[PhysicsConstraintAxis2["ANGULAR_Y"] = 4] = "ANGULAR_Y";
1416
+ PhysicsConstraintAxis2[PhysicsConstraintAxis2["ANGULAR_Z"] = 5] = "ANGULAR_Z";
1417
+ PhysicsConstraintAxis2[PhysicsConstraintAxis2["LINEAR_DISTANCE"] = 6] = "LINEAR_DISTANCE";
1418
+ return PhysicsConstraintAxis2;
1419
+ })(PhysicsConstraintAxis || {});
1401
1420
  var CharacterSupportedState = /* @__PURE__ */ ((CharacterSupportedState2) => {
1402
1421
  CharacterSupportedState2[CharacterSupportedState2["UNSUPPORTED"] = 0] = "UNSUPPORTED";
1403
1422
  CharacterSupportedState2[CharacterSupportedState2["SLIDING"] = 1] = "SLIDING";
1404
1423
  CharacterSupportedState2[CharacterSupportedState2["SUPPORTED"] = 2] = "SUPPORTED";
1405
1424
  return CharacterSupportedState2;
1406
1425
  })(CharacterSupportedState || {});
1426
+ class Physics6DoFLimit {
1427
+ constructor() {
1428
+ __publicField(this, "axis");
1429
+ __publicField(this, "minLimit");
1430
+ __publicField(this, "maxLimit");
1431
+ __publicField(this, "stiffness");
1432
+ __publicField(this, "damping");
1433
+ }
1434
+ }
1407
1435
  function requirePhysicsWorld(scene) {
1408
1436
  var _a;
1409
1437
  const world = (_a = scene == null ? void 0 : scene.getPhysicsEngine()) == null ? void 0 : _a.getPhysicsPlugin().world;
@@ -1458,6 +1486,70 @@ function litePrestepType(type) {
1458
1486
  throw new Error(`Invalid PhysicsPrestepType value: ${type}`);
1459
1487
  }
1460
1488
  }
1489
+ function liteConstraintType(type) {
1490
+ switch (type) {
1491
+ case 1:
1492
+ return PhysicsConstraintType$1.BALL_AND_SOCKET;
1493
+ case 2:
1494
+ return PhysicsConstraintType$1.DISTANCE;
1495
+ case 3:
1496
+ return PhysicsConstraintType$1.HINGE;
1497
+ case 4:
1498
+ return PhysicsConstraintType$1.SLIDER;
1499
+ case 5:
1500
+ return PhysicsConstraintType$1.LOCK;
1501
+ case 6:
1502
+ return PhysicsConstraintType$1.PRISMATIC;
1503
+ case 7:
1504
+ return PhysicsConstraintType$1.SIX_DOF;
1505
+ default:
1506
+ throw new Error(`Invalid PhysicsConstraintType value: ${type}`);
1507
+ }
1508
+ }
1509
+ function liteConstraintAxis(axis) {
1510
+ switch (axis) {
1511
+ case 0:
1512
+ return PhysicsConstraintAxis$1.LINEAR_X;
1513
+ case 1:
1514
+ return PhysicsConstraintAxis$1.LINEAR_Y;
1515
+ case 2:
1516
+ return PhysicsConstraintAxis$1.LINEAR_Z;
1517
+ case 3:
1518
+ return PhysicsConstraintAxis$1.ANGULAR_X;
1519
+ case 4:
1520
+ return PhysicsConstraintAxis$1.ANGULAR_Y;
1521
+ case 5:
1522
+ return PhysicsConstraintAxis$1.ANGULAR_Z;
1523
+ case 6:
1524
+ return PhysicsConstraintAxis$1.LINEAR_DISTANCE;
1525
+ default:
1526
+ throw new Error(`Invalid PhysicsConstraintAxis value: ${axis}`);
1527
+ }
1528
+ }
1529
+ function liteCharacterSupportedState(state) {
1530
+ switch (state) {
1531
+ case 0:
1532
+ return CharacterSupportedState$1.UNSUPPORTED;
1533
+ case 1:
1534
+ return CharacterSupportedState$1.SLIDING;
1535
+ case 2:
1536
+ return CharacterSupportedState$1.SUPPORTED;
1537
+ default:
1538
+ throw new Error(`Invalid CharacterSupportedState value: ${state}`);
1539
+ }
1540
+ }
1541
+ function compatCharacterSupportedState(state) {
1542
+ switch (state) {
1543
+ case CharacterSupportedState$1.UNSUPPORTED:
1544
+ return 0;
1545
+ case CharacterSupportedState$1.SLIDING:
1546
+ return 1;
1547
+ case CharacterSupportedState$1.SUPPORTED:
1548
+ return 2;
1549
+ default:
1550
+ throw new Error(`Invalid Lite CharacterSupportedState value: ${state}`);
1551
+ }
1552
+ }
1461
1553
  class PhysicsShape {
1462
1554
  constructor(options, scene) {
1463
1555
  /** @internal */
@@ -1708,6 +1800,12 @@ class PhysicsBody {
1708
1800
  applyForce(force, location) {
1709
1801
  applyPhysicsBodyForce(this._world, this._lite, force, location);
1710
1802
  }
1803
+ addConstraint(childBody, constraint) {
1804
+ if (childBody._world !== this._world) {
1805
+ throw new Error("PhysicsBody.addConstraint requires both bodies to belong to the same scene");
1806
+ }
1807
+ constraint._bind(this._world, this._lite, childBody._lite);
1808
+ }
1711
1809
  dispose() {
1712
1810
  if (!this._disposed) {
1713
1811
  this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);
@@ -1730,6 +1828,94 @@ class PhysicsBody {
1730
1828
  this._nodeDisposeObserver = this.transformNode.onDisposeObservable.add(() => this.dispose());
1731
1829
  }
1732
1830
  }
1831
+ class PhysicsConstraint {
1832
+ constructor(type, _options, _scene, _limits = []) {
1833
+ __publicField(this, "_lite", []);
1834
+ __publicField(this, "_world");
1835
+ this.type = type;
1836
+ this._options = _options;
1837
+ this._scene = _scene;
1838
+ this._limits = _limits;
1839
+ this._world = requirePhysicsWorld(_scene);
1840
+ }
1841
+ get options() {
1842
+ return this._options;
1843
+ }
1844
+ getClassName() {
1845
+ return "PhysicsConstraint";
1846
+ }
1847
+ /** @internal */
1848
+ _bind(world, bodyA, bodyB) {
1849
+ if (this._world !== world) {
1850
+ throw new Error("PhysicsConstraint and PhysicsBody must belong to the same scene");
1851
+ }
1852
+ this._lite.push(
1853
+ createPhysicsConstraint(
1854
+ world,
1855
+ bodyA,
1856
+ bodyB,
1857
+ liteConstraintType(this.type),
1858
+ this._options,
1859
+ this._limits.map((limit) => ({ ...limit, axis: liteConstraintAxis(limit.axis) }))
1860
+ )
1861
+ );
1862
+ }
1863
+ dispose() {
1864
+ var _a;
1865
+ if (this._lite.length > 0) {
1866
+ if (((_a = this._scene.getPhysicsEngine()) == null ? void 0 : _a.getPhysicsPlugin().world) === this._world) {
1867
+ for (const constraint of this._lite) {
1868
+ releasePhysicsConstraint(this._world, constraint);
1869
+ }
1870
+ }
1871
+ this._lite.length = 0;
1872
+ }
1873
+ }
1874
+ }
1875
+ class HingeConstraint extends PhysicsConstraint {
1876
+ constructor(pivotA, pivotB, axisA, axisB, scene) {
1877
+ super(3, { pivotA, pivotB, axisA, axisB }, scene);
1878
+ }
1879
+ getClassName() {
1880
+ return "HingeConstraint";
1881
+ }
1882
+ }
1883
+ class BallAndSocketConstraint extends PhysicsConstraint {
1884
+ constructor(pivotA, pivotB, axisA, axisB, scene) {
1885
+ super(1, { pivotA, pivotB, axisA, axisB }, scene);
1886
+ }
1887
+ }
1888
+ class DistanceConstraint extends PhysicsConstraint {
1889
+ constructor(maxDistance, scene) {
1890
+ super(2, { maxDistance }, scene);
1891
+ }
1892
+ }
1893
+ class SliderConstraint extends PhysicsConstraint {
1894
+ constructor(pivotA, pivotB, axisA, axisB, scene) {
1895
+ super(4, { pivotA, pivotB, axisA, axisB }, scene);
1896
+ }
1897
+ }
1898
+ class LockConstraint extends PhysicsConstraint {
1899
+ constructor(pivotA, pivotB, axisA, axisB, scene) {
1900
+ super(5, { pivotA, pivotB, axisA, axisB }, scene);
1901
+ }
1902
+ }
1903
+ class PrismaticConstraint extends PhysicsConstraint {
1904
+ constructor(pivotA, pivotB, axisA, axisB, scene) {
1905
+ super(6, { pivotA, pivotB, axisA, axisB }, scene);
1906
+ }
1907
+ }
1908
+ class Physics6DoFConstraint extends PhysicsConstraint {
1909
+ constructor(constraintParams, limits, scene) {
1910
+ super(7, constraintParams, scene, limits);
1911
+ this.limits = limits;
1912
+ }
1913
+ }
1914
+ class SpringConstraint extends Physics6DoFConstraint {
1915
+ constructor(pivotA, pivotB, axisA, axisB, minDistance, maxDistance, stiffness, damping, scene) {
1916
+ super({ pivotA, pivotB, axisA, axisB }, [{ axis: 6, minLimit: minDistance, maxLimit: maxDistance, stiffness, damping }], scene);
1917
+ }
1918
+ }
1733
1919
  function vectorFromLite(value) {
1734
1920
  return new Vector3(value.x, value.y, value.z);
1735
1921
  }
@@ -1742,7 +1928,7 @@ function vectorFromLiteOwned(value) {
1742
1928
  function surfaceInfoFromLite(value) {
1743
1929
  return {
1744
1930
  isSurfaceDynamic: value.isSurfaceDynamic,
1745
- supportedState: Number(value.supportedState),
1931
+ supportedState: compatCharacterSupportedState(value.supportedState),
1746
1932
  averageSurfaceNormal: vectorFromLite(value.averageSurfaceNormal),
1747
1933
  averageSurfaceVelocity: vectorFromLite(value.averageSurfaceVelocity),
1748
1934
  averageAngularSurfaceVelocity: vectorFromLite(value.averageAngularSurfaceVelocity)
@@ -1818,7 +2004,7 @@ class PhysicsCharacterController {
1818
2004
  this._lite.moveWithCollisions(displacement);
1819
2005
  }
1820
2006
  integrate(deltaTime, surfaceInfo, gravity) {
1821
- this._lite.integrate(deltaTime, { ...surfaceInfo, supportedState: Number(surfaceInfo.supportedState) }, gravity);
2007
+ this._lite.integrate(deltaTime, { ...surfaceInfo, supportedState: liteCharacterSupportedState(surfaceInfo.supportedState) }, gravity);
1822
2008
  }
1823
2009
  checkSupport(deltaTime, direction) {
1824
2010
  return surfaceInfoFromLite(this._lite.checkSupport(deltaTime, direction));
@@ -1826,7 +2012,7 @@ class PhysicsCharacterController {
1826
2012
  checkSupportToRef(deltaTime, direction, result) {
1827
2013
  const value = this._lite.checkSupport(deltaTime, direction);
1828
2014
  result.isSurfaceDynamic = value.isSurfaceDynamic;
1829
- result.supportedState = Number(value.supportedState);
2015
+ result.supportedState = compatCharacterSupportedState(value.supportedState);
1830
2016
  result.averageSurfaceNormal.set(value.averageSurfaceNormal.x, value.averageSurfaceNormal.y, value.averageSurfaceNormal.z);
1831
2017
  result.averageSurfaceVelocity.set(value.averageSurfaceVelocity.x, value.averageSurfaceVelocity.y, value.averageSurfaceVelocity.z);
1832
2018
  result.averageAngularSurfaceVelocity.set(value.averageAngularSurfaceVelocity.x, value.averageAngularSurfaceVelocity.y, value.averageAngularSurfaceVelocity.z);
@@ -2357,6 +2543,19 @@ class GamepadCamera extends UniversalCamera {
2357
2543
  }
2358
2544
  }
2359
2545
  class FlyCamera extends TargetCamera {
2546
+ constructor(name, position, scene) {
2547
+ const lite = createBankedFreeCamera({ x: position.x, y: position.y, z: position.z }, { x: position.x, y: position.y, z: position.z - 1 });
2548
+ super(name, position, scene, lite);
2549
+ /** @internal Underlying banked Babylon Lite free camera. */
2550
+ __publicField(this, "_lite");
2551
+ this._lite = lite;
2552
+ }
2553
+ get upVector() {
2554
+ return liteBackedVector3(this._lite.upVector);
2555
+ }
2556
+ set upVector(value) {
2557
+ this._lite.upVector.set(value.x, value.y, value.z);
2558
+ }
2360
2559
  getClassName() {
2361
2560
  return "FlyCamera";
2362
2561
  }
@@ -5305,6 +5504,15 @@ class AssetContainer {
5305
5504
  dispose() {
5306
5505
  }
5307
5506
  }
5507
+ function validateGltfOptions(source, options) {
5508
+ var _a, _b;
5509
+ if (!isBabylonUrl(source) && !isSplatUrl(source) && ((_b = (_a = options == null ? void 0 : options.pluginOptions) == null ? void 0 : _a.gltf) == null ? void 0 : _b.preprocessUrlAsync)) {
5510
+ unsupported(
5511
+ "ISceneLoaderOptions.pluginOptions.gltf.preprocessUrlAsync",
5512
+ "Supporting per-resource URL preprocessing requires a loader-wide callback/context contract across Lite's core glTF loader and lazy extension modules, which cannot be added as an independent tree-shakeable export."
5513
+ );
5514
+ }
5515
+ }
5308
5516
  async function loadSplatResult(url, scene) {
5309
5517
  const gs = new GaussianSplattingMesh(baseName(url), null, scene);
5310
5518
  await gs.loadFileAsync(url);
@@ -5370,11 +5578,13 @@ const SceneLoader = {
5370
5578
  );
5371
5579
  }
5372
5580
  };
5373
- async function ImportMeshAsync(source, scene, _options) {
5374
- if (isSplatUrl(source)) {
5375
- return loadSplatResult(source, scene);
5581
+ async function ImportMeshAsync(source, scene, options) {
5582
+ const url = joinUrl((options == null ? void 0 : options.rootUrl) ?? "", source);
5583
+ if (isSplatUrl(url)) {
5584
+ return loadSplatResult(url, scene);
5376
5585
  }
5377
- const container = await loadFromSource(source, scene);
5586
+ validateGltfOptions(url, options);
5587
+ const container = await loadFromSource(url, scene);
5378
5588
  container.addAllToScene(scene);
5379
5589
  return {
5380
5590
  meshes: container.meshes,
@@ -5386,17 +5596,21 @@ async function ImportMeshAsync(source, scene, _options) {
5386
5596
  container
5387
5597
  };
5388
5598
  }
5389
- async function AppendSceneAsync(source, scene, _options) {
5390
- if (isSplatUrl(source)) {
5391
- await loadSplatResult(source, scene);
5599
+ async function AppendSceneAsync(source, scene, options) {
5600
+ const url = joinUrl((options == null ? void 0 : options.rootUrl) ?? "", source);
5601
+ if (isSplatUrl(url)) {
5602
+ await loadSplatResult(url, scene);
5392
5603
  return scene;
5393
5604
  }
5394
- const container = await loadFromSource(source, scene);
5605
+ validateGltfOptions(url, options);
5606
+ const container = await loadFromSource(url, scene);
5395
5607
  container.addAllToScene(scene);
5396
5608
  return scene;
5397
5609
  }
5398
- async function LoadAssetContainerAsync(source, scene, _options) {
5399
- return loadFromSource(source, scene);
5610
+ async function LoadAssetContainerAsync(source, scene, options) {
5611
+ const url = joinUrl((options == null ? void 0 : options.rootUrl) ?? "", source);
5612
+ validateGltfOptions(url, options);
5613
+ return loadFromSource(url, scene);
5400
5614
  }
5401
5615
  async function loadFromSource(source, scene) {
5402
5616
  const engine = scene.getEngine()._lite;
@@ -6546,7 +6760,19 @@ class ShadowGenerator {
6546
6760
  const className = this._light.getClassName();
6547
6761
  const usePcf = this.usePercentageCloserFiltering || this.useContactHardeningShadow || this.usePoissonSampling;
6548
6762
  let liteGen;
6549
- if (className === "SpotLight") {
6763
+ if (this instanceof CascadedShadowGenerator) {
6764
+ liteGen = createCsmDirectionalShadowGenerator(engine, liteLight, {
6765
+ mapSize: this._mapSize,
6766
+ numCascades: this.numCascades,
6767
+ lambda: this.lambda,
6768
+ cascadeBlendPercentage: this.cascadeBlendPercentage,
6769
+ stabilizeCascades: this.stabilizeCascades,
6770
+ shadowMaxZ: this.shadowMaxZ,
6771
+ bias: this.bias,
6772
+ darkness: this.darkness,
6773
+ frustumEdgeFalloff: this.frustumEdgeFalloff
6774
+ });
6775
+ } else if (className === "SpotLight") {
6550
6776
  liteGen = createPcfSpotlightShadowGenerator(engine, liteLight, {
6551
6777
  mapSize: this._mapSize,
6552
6778
  bias: this.bias,
@@ -6582,14 +6808,25 @@ class ShadowGenerator {
6582
6808
  }
6583
6809
  }
6584
6810
  class CascadedShadowGenerator extends ShadowGenerator {
6585
- constructor() {
6586
- super(...arguments);
6587
- __publicField(this, "numCascades", 4);
6811
+ constructor(mapSize, light) {
6812
+ if (!(light instanceof DirectionalLight)) {
6813
+ throw new TypeError("CascadedShadowGenerator requires a DirectionalLight");
6814
+ }
6815
+ super(mapSize, light);
6816
+ __publicField(this, "_numCascades", 4);
6588
6817
  __publicField(this, "lambda", 0.5);
6818
+ __publicField(this, "cascadeBlendPercentage", 0.1);
6589
6819
  __publicField(this, "stabilizeCascades", false);
6820
+ __publicField(this, "shadowMaxZ");
6590
6821
  __publicField(this, "depthClamp", true);
6591
6822
  __publicField(this, "autoCalcDepthBounds", false);
6592
6823
  }
6824
+ get numCascades() {
6825
+ return this._numCascades;
6826
+ }
6827
+ set numCascades(value) {
6828
+ this._numCascades = Math.min(Math.max(value, 2), 4);
6829
+ }
6593
6830
  getClassName() {
6594
6831
  return "CascadedShadowGenerator";
6595
6832
  }
@@ -8263,6 +8500,50 @@ class BackgroundMaterial {
8263
8500
  unsupported("BackgroundMaterial", "Standalone BackgroundMaterial is not wrapped. Use the compat `Scene` environment helpers / native `loadEnvironment` instead.");
8264
8501
  }
8265
8502
  }
8503
+ class OpenPBRMaterial extends PushMaterial {
8504
+ /** @internal Unsupported stubs never expose a backing Lite material. */
8505
+ get _lite() {
8506
+ return unsupported(
8507
+ "OpenPBRMaterial._lite",
8508
+ "OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design."
8509
+ );
8510
+ }
8511
+ constructor(_name, _scene, _forceGLSL = false) {
8512
+ super(_name);
8513
+ unsupported(
8514
+ "OpenPBRMaterial",
8515
+ "OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design."
8516
+ );
8517
+ }
8518
+ clone(_name, _cloneTexturesOnlyOnce = true, _rootUrl = "") {
8519
+ return unsupported(
8520
+ "OpenPBRMaterial.clone",
8521
+ "OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design."
8522
+ );
8523
+ }
8524
+ }
8525
+ class OpenPBRMaterialDefines {
8526
+ constructor(_externalProperties) {
8527
+ unsupported(
8528
+ "OpenPBRMaterialDefines",
8529
+ "OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design."
8530
+ );
8531
+ }
8532
+ }
8533
+ function RegisterOpenpbrMaterial() {
8534
+ unsupported(
8535
+ "RegisterOpenpbrMaterial",
8536
+ "OpenPBR registration would install a material parser and shader subsystem that Babylon Lite does not define; adding that subsystem needs Lite maintainer design."
8537
+ );
8538
+ }
8539
+ class OpenPBRMaterialLoadingAdapter {
8540
+ constructor(_material) {
8541
+ unsupported(
8542
+ "OpenPBRMaterialLoadingAdapter",
8543
+ "The adapter translates glTF material data into OpenPBRMaterial, whose shader/material subsystem requires Lite maintainer design."
8544
+ );
8545
+ }
8546
+ }
8266
8547
  class RectAreaLight {
8267
8548
  constructor() {
8268
8549
  unsupported("RectAreaLight", "Area lights are not implemented in Babylon Lite. Use Point/Spot/Directional/Hemispheric lights.");
@@ -8616,6 +8897,10 @@ const SceneSerializer = {
8616
8897
  return unsupported("SceneSerializer.SerializeMesh", "Babylon Lite does not implement mesh serialization.");
8617
8898
  }
8618
8899
  };
8900
+ const gltf2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8901
+ __proto__: null,
8902
+ OpenPBRMaterialLoadingAdapter
8903
+ }, Symbol.toStringTag, { value: "Module" }));
8619
8904
  class ReflectionProbe {
8620
8905
  constructor() {
8621
8906
  unsupported("ReflectionProbe", "Dynamic reflection probes are not implemented in Babylon Lite.");
@@ -9141,6 +9426,7 @@ export {
9141
9426
  BVHFileLoader,
9142
9427
  BackEase,
9143
9428
  BackgroundMaterial,
9429
+ BallAndSocketConstraint,
9144
9430
  BaseSixDofDragBehavior,
9145
9431
  BaseTexture,
9146
9432
  BlackAndWhitePostProcess,
@@ -9205,6 +9491,7 @@ export {
9205
9491
  DepthRenderer,
9206
9492
  DeviceOrientationCamera,
9207
9493
  DirectionalLight,
9494
+ DistanceConstraint,
9208
9495
  DynamicTexture,
9209
9496
  EASINGMODE_EASEIN,
9210
9497
  EASINGMODE_EASEINOUT,
@@ -9228,6 +9515,7 @@ export {
9228
9515
  FreeCamera,
9229
9516
  Frustum,
9230
9517
  FxaaPostProcess,
9518
+ gltf2 as GLTF2,
9231
9519
  GPUParticleSystem,
9232
9520
  GPUPicker,
9233
9521
  GUID,
@@ -9261,6 +9549,7 @@ export {
9261
9549
  HavokPlugin,
9262
9550
  HemisphericLight,
9263
9551
  HighlightLayer,
9552
+ HingeConstraint,
9264
9553
  HtmlInteractionManager,
9265
9554
  HtmlRaycastInteractionManager,
9266
9555
  HtmlTexture,
@@ -9282,6 +9571,7 @@ export {
9282
9571
  LiteCompatError,
9283
9572
  LoadAssetContainerAsync,
9284
9573
  LoadImageToTexture2DArrayLayerAsync,
9574
+ LockConstraint,
9285
9575
  Logger,
9286
9576
  MainAudioBus,
9287
9577
  t as Material,
@@ -9302,22 +9592,29 @@ export {
9302
9592
  OBJFileLoader,
9303
9593
  Observable,
9304
9594
  OnAudioEngineV2CreatedObservable,
9595
+ OpenPBRMaterial,
9596
+ OpenPBRMaterialDefines,
9597
+ OpenPBRMaterialLoadingAdapter,
9305
9598
  OutlineRenderer,
9306
- P as PBRAnisotropicConfiguration,
9307
- w as PBRClearCoatConfiguration,
9308
- x as PBRIridescenceConfiguration,
9309
- y as PBRMaterial,
9310
- z as PBRMetallicRoughnessMaterial,
9311
- D as PBRSheenConfiguration,
9312
- E as PBRSpecularGlossinessMaterial,
9599
+ w as PBRAnisotropicConfiguration,
9600
+ x as PBRClearCoatConfiguration,
9601
+ y as PBRIridescenceConfiguration,
9602
+ z as PBRMaterial,
9603
+ D as PBRMetallicRoughnessMaterial,
9604
+ E as PBRSheenConfiguration,
9605
+ F as PBRSpecularGlossinessMaterial,
9313
9606
  ParticleHelper,
9314
9607
  ParticleSystem,
9315
9608
  ParticleSystemSet,
9316
9609
  Path3D,
9317
9610
  PerformanceMonitor,
9611
+ Physics6DoFConstraint,
9612
+ Physics6DoFLimit,
9318
9613
  PhysicsAggregate,
9319
9614
  PhysicsBody,
9320
9615
  PhysicsCharacterController,
9616
+ PhysicsConstraint,
9617
+ PhysicsConstraintAxis,
9321
9618
  PhysicsConstraintType,
9322
9619
  PhysicsEngine,
9323
9620
  PhysicsMotionType,
@@ -9336,7 +9633,8 @@ export {
9336
9633
  PostProcess,
9337
9634
  PrecisionDate,
9338
9635
  PredicateCondition,
9339
- F as PushMaterial,
9636
+ PrismaticConstraint,
9637
+ PushMaterial,
9340
9638
  QuadraticEase,
9341
9639
  QuarticEase,
9342
9640
  Quaternion,
@@ -9350,6 +9648,7 @@ export {
9350
9648
  RectAreaLight,
9351
9649
  ReflectionProbe,
9352
9650
  RegisterGreasedLinePluginMaterial,
9651
+ RegisterOpenpbrMaterial,
9353
9652
  RenderTargetTexture,
9354
9653
  RotationGizmo,
9355
9654
  SSAO2RenderingPipeline,
@@ -9369,6 +9668,7 @@ export {
9369
9668
  SixDofDragBehavior,
9370
9669
  Size,
9371
9670
  Skeleton,
9671
+ SliderConstraint,
9372
9672
  SmartArray,
9373
9673
  SolidParticleSystem,
9374
9674
  Sound,
@@ -9378,6 +9678,7 @@ export {
9378
9678
  SpatialAudioAttachmentType,
9379
9679
  Spherical,
9380
9680
  SpotLight,
9681
+ SpringConstraint,
9381
9682
  Sprite,
9382
9683
  SpriteManager,
9383
9684
  SpriteMap,