@babylonjs/lite-compat 1.34.0-preview → 1.35.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/README.md +4 -4
- package/index.d.ts +107 -6
- package/index.js +175 -37
- package/index.js.map +1 -1
- package/{meshes-BLcUDvXV.js → meshes-zeNif9yt.js} +96 -2
- package/meshes-zeNif9yt.js.map +1 -0
- package/navigation.d.ts +36 -2
- package/navigation.js +1 -1
- package/package.json +4 -4
- package/meshes-BLcUDvXV.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addToScene, cloneTransformNode, computeAabb, createBox, createCylinder, createDashedLines, createDisc, createExtrudeShape, createGround, createGroundFromHeightMap, createLineMaterial, createLineSystem, createMeshFromData, createPbrMaterial, createPlane, createPolyhedron, createQuatFromRotationMat4, createRibbon, createSolidTexture2D, createSphere, createStandardMaterial, createTorus, createTorusKnot, createTransformNode, createTube, markMaterialUboDirty, maximizeMat4InPlace, normalizeVec2ToRef, projectPointToViewportToRef, rebuildMaterial, removeFromScene, resizeMeshGeometry, scaleBoundsFromCenterToRef, setLineMaterialColor, setMat4Translation, setMeshVisible, setParent, setPbrAnisotropy, setPbrClearCoat, setPbrEmissive, setPbrGammaAlbedo, setPbrIridescence, setPbrSheen, setStandardBumpTexture, setStandardEmissiveTexture, setThinInstanceColors, setThinInstances, updateDashedLines, updateLineSystem, updateMeshUvs, writeMat4FromQuatIntoBuffer } from "@babylonjs/lite";
|
|
1
|
+
import { addToScene, cloneTransformNode, computeAabb, createBox, createCylinder, createDashedLines, createDisc, createExtrudeShape, createGround, createGroundFromHeightMap, createLineMaterial, createLineSystem, createMeshFromData, createPbrMaterial, createPlane, createPolyhedron, createQuatFromRotationMat4, createRibbon, createSolidTexture2D, createSphere, createStandardMaterial, createTorus, createTorusKnot, createTransformNode, createTube, markMaterialUboDirty, maximizeMat4InPlace, normalizeVec2ToRef, projectPointToViewportToRef, rebuildMaterial, removeFromScene, resizeMeshGeometry, scaleBoundsFromCenterToRef, setAccessibilityTag, setLineMaterialColor, setMat4Translation, setMeshVisible, setParent, setPbrAnisotropy, setPbrClearCoat, setPbrEmissive, setPbrGammaAlbedo, setPbrIridescence, setPbrSheen, setStandardBumpTexture, setStandardEmissiveTexture, setThinInstanceColors, setThinInstances, updateDashedLines, updateLineSystem, updateMeshUvs, writeMat4FromLookDirectionLHIntoBuffer, writeMat4FromLookDirectionRHIntoBuffer, writeMat4FromQuatIntoBuffer, writeQuatFromRotationMat4IntoRef } from "@babylonjs/lite";
|
|
2
2
|
//#region src/error.ts
|
|
3
3
|
/**
|
|
4
4
|
* Error thrown when Babylon.js code reaches an API surface that the Babylon Lite
|
|
@@ -656,6 +656,7 @@ function toHex(value) {
|
|
|
656
656
|
* Mutable, backed by `x`/`y`/`z`/`w` fields. Structurally compatible with the
|
|
657
657
|
* Babylon Lite `{ x, y, z, w }` quaternion shape used on transform nodes.
|
|
658
658
|
*/
|
|
659
|
+
var lookDirectionRotationScratch;
|
|
659
660
|
var Quaternion = class Quaternion {
|
|
660
661
|
x;
|
|
661
662
|
y;
|
|
@@ -786,6 +787,29 @@ var Quaternion = class Quaternion {
|
|
|
786
787
|
result.w = q.w;
|
|
787
788
|
return result;
|
|
788
789
|
}
|
|
790
|
+
/** Babylon.js `Quaternion.FromLookDirectionLH(forward, up)`. */
|
|
791
|
+
static FromLookDirectionLH(forward, up) {
|
|
792
|
+
return Quaternion.FromLookDirectionLHToRef(forward, up, new Quaternion());
|
|
793
|
+
}
|
|
794
|
+
/** Babylon.js `Quaternion.FromLookDirectionLHToRef(forward, up, result)`. */
|
|
795
|
+
static FromLookDirectionLHToRef(forward, up, result) {
|
|
796
|
+
const matrix = lookDirectionRotationScratch ??= /* @__PURE__ */ new Float32Array(16);
|
|
797
|
+
writeMat4FromLookDirectionLHIntoBuffer(matrix, forward, up);
|
|
798
|
+
return Quaternion._FromRotationStorageToRef(matrix, result);
|
|
799
|
+
}
|
|
800
|
+
/** Babylon.js `Quaternion.FromLookDirectionRH(forward, up)`. */
|
|
801
|
+
static FromLookDirectionRH(forward, up) {
|
|
802
|
+
return Quaternion.FromLookDirectionRHToRef(forward, up, new Quaternion());
|
|
803
|
+
}
|
|
804
|
+
/** Babylon.js `Quaternion.FromLookDirectionRHToRef(forward, up, result)`. */
|
|
805
|
+
static FromLookDirectionRHToRef(forward, up, result) {
|
|
806
|
+
const matrix = lookDirectionRotationScratch ??= /* @__PURE__ */ new Float32Array(16);
|
|
807
|
+
writeMat4FromLookDirectionRHIntoBuffer(matrix, forward, up);
|
|
808
|
+
return Quaternion._FromRotationStorageToRef(matrix, result);
|
|
809
|
+
}
|
|
810
|
+
static _FromRotationStorageToRef(matrix, result) {
|
|
811
|
+
return writeQuatFromRotationMat4IntoRef(matrix, result);
|
|
812
|
+
}
|
|
789
813
|
static FromEulerAngles(x, y, z) {
|
|
790
814
|
return Quaternion.RotationYawPitchRoll(y, x, z);
|
|
791
815
|
}
|
|
@@ -1046,6 +1070,24 @@ var Matrix = class Matrix {
|
|
|
1046
1070
|
const ez = -(zx * eye.x + zy * eye.y + zz * eye.z);
|
|
1047
1071
|
return Matrix.FromValues(xx, yx, zx, 0, xy, yy, zy, 0, xz, yz, zz, 0, ex, ey, ez, 1);
|
|
1048
1072
|
}
|
|
1073
|
+
/** Babylon.js `Matrix.LookDirectionLH(forward, up)` orientation matrix. */
|
|
1074
|
+
static LookDirectionLH(forward, up) {
|
|
1075
|
+
return Matrix.LookDirectionLHToRef(forward, up, new Matrix());
|
|
1076
|
+
}
|
|
1077
|
+
/** Babylon.js `Matrix.LookDirectionLHToRef(forward, up, result)`. */
|
|
1078
|
+
static LookDirectionLHToRef(forward, up, result) {
|
|
1079
|
+
writeMat4FromLookDirectionLHIntoBuffer(result.m, forward, up);
|
|
1080
|
+
return result.markAsUpdated();
|
|
1081
|
+
}
|
|
1082
|
+
/** Babylon.js `Matrix.LookDirectionRH(forward, up)` orientation matrix. */
|
|
1083
|
+
static LookDirectionRH(forward, up) {
|
|
1084
|
+
return Matrix.LookDirectionRHToRef(forward, up, new Matrix());
|
|
1085
|
+
}
|
|
1086
|
+
/** Babylon.js `Matrix.LookDirectionRHToRef(forward, up, result)`. */
|
|
1087
|
+
static LookDirectionRHToRef(forward, up, result) {
|
|
1088
|
+
writeMat4FromLookDirectionRHIntoBuffer(result.m, forward, up);
|
|
1089
|
+
return result.markAsUpdated();
|
|
1090
|
+
}
|
|
1049
1091
|
/** Babylon.js `Matrix.OrthoOffCenterLH(left, right, bottom, top, znear, zfar, halfZRange?)` — LH ortho projection. */
|
|
1050
1092
|
static OrthoOffCenterLH(left, right, bottom, top, znear, zfar, _halfZRange) {
|
|
1051
1093
|
const a = 2 / (right - left);
|
|
@@ -1431,6 +1473,23 @@ var Observable = class {
|
|
|
1431
1473
|
};
|
|
1432
1474
|
//#endregion
|
|
1433
1475
|
//#region src/node/node.ts
|
|
1476
|
+
/**
|
|
1477
|
+
* Babylon.js-compatible `Node` — the base of the scene-graph class hierarchy.
|
|
1478
|
+
*
|
|
1479
|
+
* In Babylon.js every scene object derives from `Node`
|
|
1480
|
+
* (`Mesh → AbstractMesh → TransformNode → Node`, `Camera → Node`,
|
|
1481
|
+
* `Light → Node`). The compat layer mirrors that chain so `instanceof` checks and
|
|
1482
|
+
* inherited members (`getScene`, `parent`, `getClassName`, `dispose`, …) behave as
|
|
1483
|
+
* ported code expects, even where intermediate classes are only partial.
|
|
1484
|
+
*
|
|
1485
|
+
* `Node` itself holds the cross-cutting state every scene object shares: name/id,
|
|
1486
|
+
* a unique id, an owning scene, a parent link, and enabled/disposed flags.
|
|
1487
|
+
*/
|
|
1488
|
+
function toLiteAriaValue(value) {
|
|
1489
|
+
if (value === null || value === void 0 || typeof value === "string" || typeof value === "boolean") return value;
|
|
1490
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
1491
|
+
return String(value);
|
|
1492
|
+
}
|
|
1434
1493
|
var _uniqueIdCounter = 0;
|
|
1435
1494
|
var Node = class {
|
|
1436
1495
|
name;
|
|
@@ -1441,6 +1500,7 @@ var Node = class {
|
|
|
1441
1500
|
/** Free-form user data slot (Babylon.js `Node.metadata`). */
|
|
1442
1501
|
metadata = null;
|
|
1443
1502
|
onDisposeObservable = new Observable();
|
|
1503
|
+
onAccessibilityTagChangedObservable = new Observable();
|
|
1444
1504
|
/** @internal Owning compat scene, when constructed against one. */
|
|
1445
1505
|
_scene;
|
|
1446
1506
|
/** @internal */
|
|
@@ -1453,6 +1513,10 @@ var Node = class {
|
|
|
1453
1513
|
_parentEnabled = true;
|
|
1454
1514
|
/** @internal */
|
|
1455
1515
|
_disposed = false;
|
|
1516
|
+
/** @internal Babylon.js preserves the assigned tag object rather than returning Lite's immutable snapshot. */
|
|
1517
|
+
_accessibilityTag = null;
|
|
1518
|
+
/** @internal Monotonic guard preventing a re-entrant observer assignment from being overwritten in Lite. */
|
|
1519
|
+
_accessibilityTagAssignment = 0;
|
|
1456
1520
|
constructor(name, scene) {
|
|
1457
1521
|
this.name = name;
|
|
1458
1522
|
this.id = name;
|
|
@@ -1471,6 +1535,36 @@ var Node = class {
|
|
|
1471
1535
|
getEngine() {
|
|
1472
1536
|
return this._scene?.getEngine();
|
|
1473
1537
|
}
|
|
1538
|
+
get accessibilityTag() {
|
|
1539
|
+
return this._accessibilityTag;
|
|
1540
|
+
}
|
|
1541
|
+
set accessibilityTag(value) {
|
|
1542
|
+
if (value?.eventHandler && Object.keys(value.eventHandler).length) unsupported("Node.accessibilityTag.eventHandler", "Lite's HTML-twin renderer does not expose an event-listener registration and disposal seam; adding one requires changing its existing DOM lifecycle.");
|
|
1543
|
+
const assignment = ++this._accessibilityTagAssignment;
|
|
1544
|
+
this._accessibilityTag = value;
|
|
1545
|
+
this.onAccessibilityTagChangedObservable.notifyObservers(value);
|
|
1546
|
+
if (assignment === this._accessibilityTagAssignment) this._syncAccessibilityTag();
|
|
1547
|
+
}
|
|
1548
|
+
/** @internal Resolve the plain Lite scene object owned by the concrete wrapper. */
|
|
1549
|
+
_accessibilitySource() {
|
|
1550
|
+
const wrapper = this;
|
|
1551
|
+
return wrapper._node ?? wrapper._lite ?? null;
|
|
1552
|
+
}
|
|
1553
|
+
/** @internal Forward the current tag when a deferred wrapper acquires or changes its Lite source. */
|
|
1554
|
+
_syncAccessibilityTag(previousSource) {
|
|
1555
|
+
const source = this._accessibilitySource();
|
|
1556
|
+
if (previousSource && previousSource !== source) setAccessibilityTag(previousSource, null);
|
|
1557
|
+
if (source) setAccessibilityTag(source, this._accessibilityTag ? this._toLiteAccessibilityTag(this._accessibilityTag) : null);
|
|
1558
|
+
}
|
|
1559
|
+
/** @internal Translate the Babylon.js tag into Lite's metadata-only shape. */
|
|
1560
|
+
_toLiteAccessibilityTag(value) {
|
|
1561
|
+
const aria = value.aria ? Object.fromEntries(Object.entries(value.aria).map(([key, entry]) => [key, toLiteAriaValue(entry)])) : void 0;
|
|
1562
|
+
return {
|
|
1563
|
+
description: value.description,
|
|
1564
|
+
role: value.role,
|
|
1565
|
+
aria
|
|
1566
|
+
};
|
|
1567
|
+
}
|
|
1474
1568
|
get parent() {
|
|
1475
1569
|
return this._parent;
|
|
1476
1570
|
}
|
|
@@ -3738,4 +3832,4 @@ function RegisterPolygonBuilder() {}
|
|
|
3738
3832
|
//#endregion
|
|
3739
3833
|
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 };
|
|
3740
3834
|
|
|
3741
|
-
//# sourceMappingURL=meshes-
|
|
3835
|
+
//# sourceMappingURL=meshes-zeNif9yt.js.map
|