@babylonjs/lite-compat 1.31.1-preview → 1.33.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.
@@ -1390,6 +1390,31 @@ var Observable = class {
1390
1390
  }
1391
1391
  for (const observer of this._observers.slice()) if ((observer.mask & mask) !== 0) observer.callback(eventData);
1392
1392
  }
1393
+ /** @internal Notify every matching observer and capture the first thrown value. */
1394
+ _notifyObserversSafely(eventData, mask = -1) {
1395
+ if (this.notifyIfTriggered) {
1396
+ this._hasNotified = true;
1397
+ this._lastNotifiedValue = eventData;
1398
+ this._lastNotifiedMask = mask;
1399
+ }
1400
+ let hasError = false;
1401
+ let firstError;
1402
+ for (const observer of this._observers.slice()) {
1403
+ if ((observer.mask & mask) === 0) continue;
1404
+ try {
1405
+ observer.callback(eventData);
1406
+ } catch (error) {
1407
+ if (!hasError) {
1408
+ hasError = true;
1409
+ firstError = error;
1410
+ }
1411
+ }
1412
+ }
1413
+ return {
1414
+ hasError,
1415
+ error: firstError
1416
+ };
1417
+ }
1393
1418
  hasObservers() {
1394
1419
  return this._observers.length > 0;
1395
1420
  }
@@ -1551,15 +1576,49 @@ var Node = class {
1551
1576
  _disposeSelf(_doNotRecurse) {}
1552
1577
  /** @internal Dispose this compat wrapper tree in post-order. */
1553
1578
  _disposeWrapperTree(doNotRecurse = false) {
1579
+ this._disposeWrapperTreeInternal(doNotRecurse, true);
1580
+ }
1581
+ /**
1582
+ * @internal Retire a loader-owned wrapper without disposing its Lite node.
1583
+ * Asset-container teardown removes the native nodes as one ownership unit.
1584
+ */
1585
+ _disposeWrapperOnly() {
1586
+ this._disposeWrapperTreeInternal(true, false);
1587
+ }
1588
+ /** @internal Shared wrapper lifecycle for ordinary and container-owned disposal. */
1589
+ _disposeWrapperTreeInternal(doNotRecurse, disposeSelf) {
1554
1590
  if (this._disposed) return;
1555
1591
  if (doNotRecurse) for (const child of [...this._children]) child.parent = null;
1556
- else for (const child of [...this._children]) child._disposeWrapperTree();
1557
- this._disposeSelf(doNotRecurse);
1592
+ else for (const child of [...this._children]) child._disposeWrapperTreeInternal(false, disposeSelf);
1593
+ if (disposeSelf) this._disposeSelf(doNotRecurse);
1558
1594
  this._disposed = true;
1559
- this.onDisposeObservable.notifyObservers(this);
1560
- this.onDisposeObservable.clear();
1561
- this._linkParent(null);
1562
- this._scene?._unregisterNode(this);
1595
+ let hasError = false;
1596
+ let firstError;
1597
+ try {
1598
+ this.onDisposeObservable.notifyObservers(this);
1599
+ } catch (error) {
1600
+ hasError = true;
1601
+ firstError = error;
1602
+ } finally {
1603
+ this.onDisposeObservable.clear();
1604
+ }
1605
+ try {
1606
+ this._linkParent(null);
1607
+ } catch (error) {
1608
+ if (!hasError) {
1609
+ hasError = true;
1610
+ firstError = error;
1611
+ }
1612
+ }
1613
+ try {
1614
+ this._scene?._unregisterNode(this);
1615
+ } catch (error) {
1616
+ if (!hasError) {
1617
+ hasError = true;
1618
+ firstError = error;
1619
+ }
1620
+ }
1621
+ if (hasError) throw firstError;
1563
1622
  }
1564
1623
  /** @internal Hook for subclasses to wire the parent link into the Lite scene graph. */
1565
1624
  _applyParent(_parent) {}
@@ -3105,6 +3164,14 @@ var Mesh = class Mesh extends AbstractMesh {
3105
3164
  tessellation
3106
3165
  }, scene);
3107
3166
  }
3167
+ /** Legacy `Mesh.CreatePolygon(name, shape, scene, holes?, updatable?, sideOrientation?, earcutInjection?)`. */
3168
+ static CreatePolygon(_name, _shape, _scene, _holes, _updatable, _sideOrientation, _earcutInjection) {
3169
+ return unsupported("Mesh.CreatePolygon", "Polygon creation requires a triangulation dependency plus hole, side-orientation, UV, and normal-generation policies that Babylon Lite does not model; adding that geometry subsystem is not a small mechanical Lite extension.");
3170
+ }
3171
+ /** Legacy `Mesh.ExtrudePolygon(name, shape, depth, scene, holes?, updatable?, sideOrientation?, earcutInjection?)`. */
3172
+ static ExtrudePolygon(_name, _shape, _depth, _scene, _holes, _updatable, _sideOrientation, _earcutInjection) {
3173
+ return unsupported("Mesh.ExtrudePolygon", "Polygon extrusion requires a triangulation dependency plus hole, cap, side-wall, UV, and smoothing policies that Babylon Lite does not model; adding that geometry subsystem is not a small mechanical Lite extension.");
3174
+ }
3108
3175
  /** Hardware-instanced copy — unsupported. Use native thin instances instead. */
3109
3176
  createInstance() {
3110
3177
  return unsupported("Mesh.createInstance", "Babylon Lite has no hardware-instance object. Use the native thin-instance API (`setThinInstances`).");
@@ -3384,6 +3451,10 @@ var VertexData = class {
3384
3451
  uvs = null;
3385
3452
  colors = null;
3386
3453
  indices = null;
3454
+ /** Deprecated Babylon.js polygon vertex-data entry point. */
3455
+ static CreatePolygon(polygon, sideOrientation, faceUV, faceColors, frontUVs, backUVs, wrap) {
3456
+ return CreatePolygonVertexData(polygon, sideOrientation, faceUV, faceColors, frontUVs, backUVs, wrap);
3457
+ }
3387
3458
  /**
3388
3459
  * Babylon.js `VertexData.applyToMesh(mesh)` — upload this CPU geometry onto a
3389
3460
  * mesh (typically one created via `new Mesh(name, scene)`). Replaces the Lite
@@ -3586,6 +3657,12 @@ var MeshBuilder = {
3586
3657
  },
3587
3658
  CreateTiledPlane(_name, _options, _scene) {
3588
3659
  return unsupported("MeshBuilder.CreateTiledPlane", "Tiled plane geometry is not implemented in Babylon Lite. Its per-tile UV layout (tile size, alignment, per-tile flip/rotate patterns) is a non-trivial vertex-data generator with pattern design choices — not a mechanical addition — so it needs a Lite core mesh-builder decision.");
3660
+ },
3661
+ CreatePolygon(_name, _options, _scene, _earcutInjection) {
3662
+ return unsupported("MeshBuilder.CreatePolygon", "Polygon creation requires a triangulation dependency plus hole, side-orientation, UV, and normal-generation policies that Babylon Lite does not model; adding that geometry subsystem is not a small mechanical Lite extension.");
3663
+ },
3664
+ ExtrudePolygon(_name, _options, _scene, _earcutInjection) {
3665
+ return unsupported("MeshBuilder.ExtrudePolygon", "Polygon extrusion requires a triangulation dependency plus hole, cap, side-wall, UV, and smoothing policies that Babylon Lite does not model; adding that geometry subsystem is not a small mechanical Lite extension.");
3589
3666
  }
3590
3667
  };
3591
3668
  /** Babylon.js `CreateBox(name, options, scene)` (boxBuilder). */
@@ -3636,7 +3713,29 @@ function CreateTiledBox(name, options, scene) {
3636
3713
  function CreateTiledPlane(name, options, scene) {
3637
3714
  return MeshBuilder.CreateTiledPlane(name, options, scene);
3638
3715
  }
3716
+ /** Babylon.js `CreatePolygon(name, options, scene?, earcutInjection?)` — throwing stub (see `MeshBuilder.CreatePolygon`). */
3717
+ function CreatePolygon(name, options, scene, earcutInjection) {
3718
+ return MeshBuilder.CreatePolygon(name, options, scene, earcutInjection);
3719
+ }
3720
+ /** Babylon.js `ExtrudePolygon(name, options, scene?, earcutInjection?)` — throwing stub (see `MeshBuilder.ExtrudePolygon`). */
3721
+ function ExtrudePolygon(name, options, scene, earcutInjection) {
3722
+ return MeshBuilder.ExtrudePolygon(name, options, scene, earcutInjection);
3723
+ }
3724
+ /** Babylon.js `CreatePolygonVertexData` — the polygon geometry generator requires the unsupported polygon subsystem. */
3725
+ function CreatePolygonVertexData(_polygon, _sideOrientation, _faceUV, _faceColors, _frontUVs, _backUVs, _wrap) {
3726
+ return unsupported("CreatePolygonVertexData", "Polygon vertex generation requires triangulated polygon topology and its cap, side-wall, UV, and normal policies; Babylon Lite has no polygon geometry subsystem to supply that input.");
3727
+ }
3728
+ /** Babylon.js polygon-builder namespace object. */
3729
+ var PolygonBuilder = {
3730
+ ExtrudePolygon,
3731
+ CreatePolygon
3732
+ };
3733
+ /**
3734
+ * Babylon.js side-effect registration shim. Compat defines the corresponding
3735
+ * methods directly, so importing or calling this function requires no mutation.
3736
+ */
3737
+ function RegisterPolygonBuilder() {}
3639
3738
  //#endregion
3640
- export { PBRSpecularGlossinessMaterial as A, transformCoordinates as B, Material as C, PBRMaterial as D, PBRIridescenceConfiguration as E, Observable as F, liteBackedColor3 as G, Quaternion as H, BoundingBox as I, Vector4 as J, Vector2 as K, BoundingInfo as L, StandardMaterial as M, attachMaterialToScene as N, PBRMetallicRoughnessMaterial as O, Node as P, BoundingSphere as R, registerMeshAtStart as S, PBRClearCoatConfiguration as T, Color3 as U, transformNormal as V, Color4 as W, LiteCompatError as X, liteBackedVector3 as Y, unsupported as Z, Mesh as _, CreateDisc as a, VertexBuffer as b, CreateLines as c, CreateTiledBox as d, CreateTiledPlane as f, LinesMesh as g, InstancedMesh as h, CreateDashedLines as i, PushMaterial as j, PBRSheenConfiguration as k, CreatePlane as l, GroundMesh as m, CreateBox as n, CreateGround as o, CreateTorus as p, Vector3 as q, CreateCylinder as r, CreateLineSystem as s, AbstractMesh as t, CreateSphere as u, MeshBuilder as v, PBRAnisotropicConfiguration as w, VertexData as x, TransformNode as y, Matrix as z };
3739
+ export { Vector4 as $, PBRClearCoatConfiguration as A, Observable as B, RegisterPolygonBuilder as C, registerMeshAtStart as D, VertexData as E, PBRSpecularGlossinessMaterial as F, transformCoordinates as G, BoundingInfo as H, PushMaterial as I, Color3 as J, transformNormal as K, StandardMaterial as L, PBRMaterial as M, PBRMetallicRoughnessMaterial as N, Material as O, PBRSheenConfiguration as P, Vector3 as Q, attachMaterialToScene as R, PolygonBuilder as S, VertexBuffer as T, BoundingSphere as U, BoundingBox as V, Matrix as W, liteBackedColor3 as X, Color4 as Y, Vector2 as Z, GroundMesh as _, CreateDisc as a, Mesh as b, CreateLines as c, CreatePolygonVertexData as d, liteBackedVector3 as et, CreateSphere as f, ExtrudePolygon as g, CreateTorus as h, CreateDashedLines as i, PBRIridescenceConfiguration as j, PBRAnisotropicConfiguration as k, CreatePlane as l, CreateTiledPlane as m, CreateBox as n, unsupported as nt, CreateGround as o, CreateTiledBox as p, Quaternion as q, CreateCylinder as r, CreateLineSystem as s, AbstractMesh as t, LiteCompatError as tt, CreatePolygon as u, InstancedMesh as v, TransformNode as w, MeshBuilder as x, LinesMesh as y, Node as z };
3641
3740
 
3642
- //# sourceMappingURL=meshes-Fu955h5M.js.map
3741
+ //# sourceMappingURL=meshes-BLcUDvXV.js.map