@babylonjs/lite-compat 1.28.0-preview → 1.29.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 +24 -22
- package/index.d.ts +293 -39
- package/index.js +737 -78
- package/index.js.map +1 -1
- package/{meshes-CgaKo90D.js → meshes-C1K63hzW.js} +60 -25
- package/meshes-C1K63hzW.js.map +1 -0
- package/navigation.d.ts +149 -26
- package/navigation.js +1 -1
- package/package.json +4 -4
- package/meshes-CgaKo90D.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
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 { normalizeVec2ToRef,
|
|
4
|
+
import { normalizeVec2ToRef, projectPointToViewportToRef, createQuatFromRotationMat4, writeMat4FromQuatIntoBuffer, setMat4Translation, maximizeMat4InPlace, scaleBoundsFromCenterToRef, markMaterialUboDirty, rebuildMaterial, createPbrMaterial, setPbrEmissive, setPbrClearCoat, setPbrSheen, setPbrAnisotropy, setPbrIridescence, setPbrGammaAlbedo, createSolidTexture2D, createStandardMaterial, setStandardBumpTexture, setStandardEmissiveTexture, createMeshFromData, setMeshVisible, computeAabb, resizeMeshGeometry, createLineSystem, createLineMaterial, setLineMaterialColor, setThinInstances, setThinInstanceColors, cloneTransformNode, updateDashedLines, createDashedLines, updateLineSystem, createExtrudeShape, createTube, createRibbon, createPolyhedron, createDisc, createTorusKnot, createTorus, createCylinder, createPlane, createGroundFromHeightMap, updateMeshUvs, createGround, createSphere, createBox, createTransformNode, addToScene, setParent, removeFromScene } from "@babylonjs/lite";
|
|
5
5
|
class LiteCompatError extends Error {
|
|
6
6
|
constructor(api, detail) {
|
|
7
7
|
super(detail ? `'${api}' is not supported by the Babylon Lite compat layer. ${detail}` : `'${api}' is not supported by the Babylon Lite compat layer.`);
|
|
@@ -298,6 +298,14 @@ class Vector3 {
|
|
|
298
298
|
static Maximize(a, b) {
|
|
299
299
|
return a.clone().maximizeInPlace(b);
|
|
300
300
|
}
|
|
301
|
+
/** Project a world-space point into a Babylon.js viewport. */
|
|
302
|
+
static Project(vector, world, transform, viewport) {
|
|
303
|
+
return Vector3.ProjectToRef(vector, world, transform, viewport, new Vector3());
|
|
304
|
+
}
|
|
305
|
+
/** Project a world-space point into a Babylon.js viewport, writing into `result`. */
|
|
306
|
+
static ProjectToRef(vector, world, transform, viewport, result) {
|
|
307
|
+
return projectPointToViewportToRef(vector, world.m, transform.m, viewport, result);
|
|
308
|
+
}
|
|
301
309
|
/** Transform a coordinate (point) by a matrix using the row-vector convention. */
|
|
302
310
|
static TransformCoordinates(vector, transformation) {
|
|
303
311
|
return Vector3.TransformCoordinatesToRef(vector, transformation, new Vector3());
|
|
@@ -569,10 +577,10 @@ class Quaternion {
|
|
|
569
577
|
}
|
|
570
578
|
/**
|
|
571
579
|
* Babylon.js `Quaternion.fromRotationMatrix` — update this quaternion in place
|
|
572
|
-
* from the rotation part of `matrix`. Backed by Lite's `
|
|
580
|
+
* from the rotation part of `matrix`. Backed by Lite's `createQuatFromRotationMat4`.
|
|
573
581
|
*/
|
|
574
582
|
fromRotationMatrix(matrix) {
|
|
575
|
-
const q =
|
|
583
|
+
const q = createQuatFromRotationMat4(matrix.m);
|
|
576
584
|
this.x = q.x;
|
|
577
585
|
this.y = q.y;
|
|
578
586
|
this.z = q.z;
|
|
@@ -584,7 +592,7 @@ class Quaternion {
|
|
|
584
592
|
* into `result`.
|
|
585
593
|
*/
|
|
586
594
|
toRotationMatrix(result) {
|
|
587
|
-
|
|
595
|
+
writeMat4FromQuatIntoBuffer(result.m, this.x, this.y, this.z, this.w);
|
|
588
596
|
return result;
|
|
589
597
|
}
|
|
590
598
|
clone() {
|
|
@@ -628,7 +636,7 @@ class Quaternion {
|
|
|
628
636
|
}
|
|
629
637
|
/**
|
|
630
638
|
* Babylon.js `Quaternion.FromRotationMatrix` — create a new quaternion from the
|
|
631
|
-
* rotation part of `matrix`. Backed by Lite's `
|
|
639
|
+
* rotation part of `matrix`. Backed by Lite's `createQuatFromRotationMat4`.
|
|
632
640
|
*/
|
|
633
641
|
static FromRotationMatrix(matrix) {
|
|
634
642
|
const result = new Quaternion();
|
|
@@ -637,10 +645,10 @@ class Quaternion {
|
|
|
637
645
|
}
|
|
638
646
|
/**
|
|
639
647
|
* Babylon.js `Quaternion.FromRotationMatrixToRef` — write the rotation part of
|
|
640
|
-
* `matrix` into `result`. Backed by Lite's `
|
|
648
|
+
* `matrix` into `result`. Backed by Lite's `createQuatFromRotationMat4`.
|
|
641
649
|
*/
|
|
642
650
|
static FromRotationMatrixToRef(matrix, result) {
|
|
643
|
-
const q =
|
|
651
|
+
const q = createQuatFromRotationMat4(matrix.m);
|
|
644
652
|
result.x = q.x;
|
|
645
653
|
result.y = q.y;
|
|
646
654
|
result.z = q.z;
|
|
@@ -708,6 +716,11 @@ class Matrix {
|
|
|
708
716
|
this.m.set(source.m);
|
|
709
717
|
return this;
|
|
710
718
|
}
|
|
719
|
+
/** Set only this matrix's translation components. */
|
|
720
|
+
setTranslationFromFloats(x, y, z) {
|
|
721
|
+
setMat4Translation(this.m, x, y, z);
|
|
722
|
+
return this;
|
|
723
|
+
}
|
|
711
724
|
maximizeInPlace(other) {
|
|
712
725
|
maximizeMat4InPlace(this.m, other.m);
|
|
713
726
|
return this.markAsUpdated();
|
|
@@ -792,7 +805,7 @@ class Matrix {
|
|
|
792
805
|
* TRS matrix into its scale, rotation (quaternion), and translation parts,
|
|
793
806
|
* writing into any provided out-params. Returns `false` (matching BJS) when a
|
|
794
807
|
* scale axis is zero. The rotation extraction is backed by Lite's
|
|
795
|
-
* `
|
|
808
|
+
* `createQuatFromRotationMat4` (via `Quaternion.FromRotationMatrixToRef`); the
|
|
796
809
|
* negative-determinant `scale.y` flip matches Babylon.js exactly.
|
|
797
810
|
*/
|
|
798
811
|
decompose(scale, rotation, translation) {
|
|
@@ -1183,43 +1196,47 @@ class Observable {
|
|
|
1183
1196
|
__publicField(this, "_observers", []);
|
|
1184
1197
|
__publicField(this, "_hasNotified", false);
|
|
1185
1198
|
__publicField(this, "_lastNotifiedValue");
|
|
1199
|
+
__publicField(this, "_lastNotifiedMask", -1);
|
|
1186
1200
|
this._onObserverAdded = _onObserverAdded;
|
|
1187
1201
|
this.notifyIfTriggered = notifyIfTriggered;
|
|
1188
1202
|
}
|
|
1189
|
-
add(callback) {
|
|
1203
|
+
add(callback, mask = -1) {
|
|
1190
1204
|
var _a;
|
|
1191
|
-
this._observers.push(callback);
|
|
1205
|
+
this._observers.push({ callback, mask });
|
|
1192
1206
|
(_a = this._onObserverAdded) == null ? void 0 : _a.call(this, callback);
|
|
1193
|
-
if (this._hasNotified && this.notifyIfTriggered) {
|
|
1207
|
+
if (this._hasNotified && this.notifyIfTriggered && (mask & this._lastNotifiedMask) !== 0) {
|
|
1194
1208
|
callback(this._lastNotifiedValue);
|
|
1195
1209
|
}
|
|
1196
1210
|
return callback;
|
|
1197
1211
|
}
|
|
1198
|
-
addOnce(callback) {
|
|
1212
|
+
addOnce(callback, mask = -1) {
|
|
1199
1213
|
const wrapper = (eventData) => {
|
|
1200
1214
|
this.removeCallback(wrapper);
|
|
1201
1215
|
callback(eventData);
|
|
1202
1216
|
};
|
|
1203
|
-
return this.add(wrapper);
|
|
1217
|
+
return this.add(wrapper, mask);
|
|
1204
1218
|
}
|
|
1205
1219
|
remove(callback) {
|
|
1206
1220
|
return callback ? this.removeCallback(callback) : false;
|
|
1207
1221
|
}
|
|
1208
1222
|
removeCallback(callback) {
|
|
1209
|
-
const index = this._observers.
|
|
1223
|
+
const index = this._observers.findIndex((observer) => observer.callback === callback);
|
|
1210
1224
|
if (index !== -1) {
|
|
1211
1225
|
this._observers.splice(index, 1);
|
|
1212
1226
|
return true;
|
|
1213
1227
|
}
|
|
1214
1228
|
return false;
|
|
1215
1229
|
}
|
|
1216
|
-
notifyObservers(eventData) {
|
|
1230
|
+
notifyObservers(eventData, mask = -1) {
|
|
1217
1231
|
if (this.notifyIfTriggered) {
|
|
1218
1232
|
this._hasNotified = true;
|
|
1219
1233
|
this._lastNotifiedValue = eventData;
|
|
1234
|
+
this._lastNotifiedMask = mask;
|
|
1220
1235
|
}
|
|
1221
1236
|
for (const observer of this._observers.slice()) {
|
|
1222
|
-
observer
|
|
1237
|
+
if ((observer.mask & mask) !== 0) {
|
|
1238
|
+
observer.callback(eventData);
|
|
1239
|
+
}
|
|
1223
1240
|
}
|
|
1224
1241
|
}
|
|
1225
1242
|
hasObservers() {
|
|
@@ -1233,6 +1250,7 @@ class Observable {
|
|
|
1233
1250
|
cleanLastNotifiedState() {
|
|
1234
1251
|
this._hasNotified = false;
|
|
1235
1252
|
this._lastNotifiedValue = void 0;
|
|
1253
|
+
this._lastNotifiedMask = -1;
|
|
1236
1254
|
}
|
|
1237
1255
|
}
|
|
1238
1256
|
let _uniqueIdCounter = 0;
|
|
@@ -1369,17 +1387,25 @@ class Node {
|
|
|
1369
1387
|
dispose(doNotRecurse = false) {
|
|
1370
1388
|
this._disposeWrapperTree(doNotRecurse);
|
|
1371
1389
|
}
|
|
1372
|
-
/** @internal Dispose
|
|
1390
|
+
/** @internal Dispose this node's subclass-owned resources. */
|
|
1391
|
+
_disposeSelf(_doNotRecurse) {
|
|
1392
|
+
}
|
|
1393
|
+
/** @internal Dispose this compat wrapper tree in post-order. */
|
|
1373
1394
|
_disposeWrapperTree(doNotRecurse = false) {
|
|
1374
1395
|
var _a;
|
|
1375
1396
|
if (this._disposed) {
|
|
1376
1397
|
return;
|
|
1377
1398
|
}
|
|
1378
|
-
if (
|
|
1399
|
+
if (doNotRecurse) {
|
|
1400
|
+
for (const child of [...this._children]) {
|
|
1401
|
+
child.parent = null;
|
|
1402
|
+
}
|
|
1403
|
+
} else {
|
|
1379
1404
|
for (const child of [...this._children]) {
|
|
1380
1405
|
child._disposeWrapperTree();
|
|
1381
1406
|
}
|
|
1382
1407
|
}
|
|
1408
|
+
this._disposeSelf(doNotRecurse);
|
|
1383
1409
|
this._disposed = true;
|
|
1384
1410
|
this.onDisposeObservable.notifyObservers(this);
|
|
1385
1411
|
this.onDisposeObservable.clear();
|
|
@@ -2374,6 +2400,21 @@ class TransformNode extends Node {
|
|
|
2374
2400
|
_applyParent(parent) {
|
|
2375
2401
|
this._node.parent = liteNodeOf(parent);
|
|
2376
2402
|
}
|
|
2403
|
+
/** @internal Remove this wrapper's node without letting Lite recurse for `dispose(true)`. */
|
|
2404
|
+
_disposeSelf(doNotRecurse) {
|
|
2405
|
+
if (!this._scene) {
|
|
2406
|
+
return;
|
|
2407
|
+
}
|
|
2408
|
+
if (!doNotRecurse) {
|
|
2409
|
+
removeFromScene(this._scene._lite, this._node);
|
|
2410
|
+
return;
|
|
2411
|
+
}
|
|
2412
|
+
for (const child of this._node.children) {
|
|
2413
|
+
child.parent = null;
|
|
2414
|
+
}
|
|
2415
|
+
this._node.children.length = 0;
|
|
2416
|
+
removeFromScene(this._scene._lite, this._node);
|
|
2417
|
+
}
|
|
2377
2418
|
}
|
|
2378
2419
|
class AbstractMesh extends TransformNode {
|
|
2379
2420
|
constructor(name, lite, scene) {
|
|
@@ -2723,12 +2764,6 @@ class AbstractMesh extends TransformNode {
|
|
|
2723
2764
|
this._bakeMatrix(transform);
|
|
2724
2765
|
return this;
|
|
2725
2766
|
}
|
|
2726
|
-
dispose() {
|
|
2727
|
-
if (this._scene) {
|
|
2728
|
-
removeFromScene(this._scene._lite, this._lite);
|
|
2729
|
-
}
|
|
2730
|
-
super.dispose();
|
|
2731
|
-
}
|
|
2732
2767
|
}
|
|
2733
2768
|
class Mesh extends AbstractMesh {
|
|
2734
2769
|
constructor(name, sceneOrLite, scene) {
|
|
@@ -3465,4 +3500,4 @@ export {
|
|
|
3465
3500
|
PBRIridescenceConfiguration as y,
|
|
3466
3501
|
PBRMaterial as z
|
|
3467
3502
|
};
|
|
3468
|
-
//# sourceMappingURL=meshes-
|
|
3503
|
+
//# sourceMappingURL=meshes-C1K63hzW.js.map
|