@babylonjs/lite-compat 1.23.0-preview → 1.25.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 +1 -1
- package/index.d.ts +212 -24
- package/index.js +851 -144
- package/index.js.map +1 -1
- package/{meshes-CidWpEh8.js → meshes-nWGELV98.js} +141 -37
- package/meshes-nWGELV98.js.map +1 -0
- package/navigation.d.ts +156 -5
- package/navigation.js +1 -1
- package/package.json +4 -4
- package/meshes-CidWpEh8.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 { quatFromRotationMatrix, mat4FromQuatInto, markMaterialUboDirty, rebuildMaterial, createPbrMaterial, setPbrEmissive, setPbrClearCoat, setPbrSheen, setPbrAnisotropy, setPbrIridescence, setPbrGammaAlbedo, createSolidTexture2D, createStandardMaterial, setStandardBumpTexture, setStandardEmissiveTexture, createMeshFromData, setMeshVisible, computeAabb, resizeMeshGeometry, removeFromScene, 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 } from "@babylonjs/lite";
|
|
4
|
+
import { normalizeVec2ToRef, quatFromRotationMatrix, mat4FromQuatInto, maximizeMat4InPlace, scaleBoundsFromCenterToRef, markMaterialUboDirty, rebuildMaterial, createPbrMaterial, setPbrEmissive, setPbrClearCoat, setPbrSheen, setPbrAnisotropy, setPbrIridescence, setPbrGammaAlbedo, createSolidTexture2D, createStandardMaterial, setStandardBumpTexture, setStandardEmissiveTexture, createMeshFromData, setMeshVisible, computeAabb, resizeMeshGeometry, removeFromScene, 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 } 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.`);
|
|
@@ -57,12 +57,10 @@ class Vector2 {
|
|
|
57
57
|
return this.x * this.x + this.y * this.y;
|
|
58
58
|
}
|
|
59
59
|
normalize() {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
return this;
|
|
60
|
+
return this.normalizeToRef(this);
|
|
61
|
+
}
|
|
62
|
+
normalizeToRef(result) {
|
|
63
|
+
return normalizeVec2ToRef(this, result);
|
|
66
64
|
}
|
|
67
65
|
clone() {
|
|
68
66
|
return new Vector2(this.x, this.y);
|
|
@@ -696,6 +694,7 @@ class Quaternion {
|
|
|
696
694
|
return new Quaternion(num3 * left.x + num2 * right.x, num3 * left.y + num2 * right.y, num3 * left.z + num2 * right.z, num3 * left.w + num2 * right.w);
|
|
697
695
|
}
|
|
698
696
|
}
|
|
697
|
+
let matrixMaximizeValues;
|
|
699
698
|
class Matrix {
|
|
700
699
|
constructor() {
|
|
701
700
|
__publicField(this, "m");
|
|
@@ -709,6 +708,31 @@ class Matrix {
|
|
|
709
708
|
this.m.set(source.m);
|
|
710
709
|
return this;
|
|
711
710
|
}
|
|
711
|
+
maximizeInPlace(other) {
|
|
712
|
+
maximizeMat4InPlace(this.m, other.m);
|
|
713
|
+
return this.markAsUpdated();
|
|
714
|
+
}
|
|
715
|
+
maximizeInPlaceFromFloats(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15) {
|
|
716
|
+
const values = matrixMaximizeValues ?? (matrixMaximizeValues = new Float32Array(16));
|
|
717
|
+
values[0] = m0;
|
|
718
|
+
values[1] = m1;
|
|
719
|
+
values[2] = m2;
|
|
720
|
+
values[3] = m3;
|
|
721
|
+
values[4] = m4;
|
|
722
|
+
values[5] = m5;
|
|
723
|
+
values[6] = m6;
|
|
724
|
+
values[7] = m7;
|
|
725
|
+
values[8] = m8;
|
|
726
|
+
values[9] = m9;
|
|
727
|
+
values[10] = m10;
|
|
728
|
+
values[11] = m11;
|
|
729
|
+
values[12] = m12;
|
|
730
|
+
values[13] = m13;
|
|
731
|
+
values[14] = m14;
|
|
732
|
+
values[15] = m15;
|
|
733
|
+
maximizeMat4InPlace(this.m, values);
|
|
734
|
+
return this.markAsUpdated();
|
|
735
|
+
}
|
|
712
736
|
clone() {
|
|
713
737
|
const result = new Matrix();
|
|
714
738
|
result.m.set(this.m);
|
|
@@ -1004,6 +1028,8 @@ function transformNormal(vector, transformation) {
|
|
|
1004
1028
|
const z = vector.z;
|
|
1005
1029
|
return new Vector3(x * m[0] + y * m[4] + z * m[8], x * m[1] + y * m[5] + z * m[9], x * m[2] + y * m[6] + z * m[10]);
|
|
1006
1030
|
}
|
|
1031
|
+
let boundingSphereScaleMinimum;
|
|
1032
|
+
let boundingSphereScaleMaximum;
|
|
1007
1033
|
class BoundingSphere {
|
|
1008
1034
|
constructor(min, max, worldMatrix) {
|
|
1009
1035
|
__publicField(this, "center", new Vector3());
|
|
@@ -1028,6 +1054,13 @@ class BoundingSphere {
|
|
|
1028
1054
|
getWorldMatrix() {
|
|
1029
1055
|
return this._worldMatrix;
|
|
1030
1056
|
}
|
|
1057
|
+
scale(factor) {
|
|
1058
|
+
const minimum = boundingSphereScaleMinimum ?? (boundingSphereScaleMinimum = new Vector3());
|
|
1059
|
+
const maximum = boundingSphereScaleMaximum ?? (boundingSphereScaleMaximum = new Vector3());
|
|
1060
|
+
scaleBoundsFromCenterToRef(this.minimum, this.maximum, this.center, factor, minimum, maximum);
|
|
1061
|
+
this.reConstruct(minimum, maximum, this._worldMatrix);
|
|
1062
|
+
return this;
|
|
1063
|
+
}
|
|
1031
1064
|
/** @internal */
|
|
1032
1065
|
_update(worldMatrix) {
|
|
1033
1066
|
Vector3.TransformCoordinatesToRef(this.center, worldMatrix, this.centerWorld);
|
|
@@ -1145,6 +1178,63 @@ class BoundingInfo {
|
|
|
1145
1178
|
this.boundingSphere.reConstruct(min, max, worldMatrix);
|
|
1146
1179
|
}
|
|
1147
1180
|
}
|
|
1181
|
+
class Observable {
|
|
1182
|
+
constructor(_onObserverAdded, notifyIfTriggered = false) {
|
|
1183
|
+
__publicField(this, "_observers", []);
|
|
1184
|
+
__publicField(this, "_hasNotified", false);
|
|
1185
|
+
__publicField(this, "_lastNotifiedValue");
|
|
1186
|
+
this._onObserverAdded = _onObserverAdded;
|
|
1187
|
+
this.notifyIfTriggered = notifyIfTriggered;
|
|
1188
|
+
}
|
|
1189
|
+
add(callback) {
|
|
1190
|
+
var _a;
|
|
1191
|
+
this._observers.push(callback);
|
|
1192
|
+
(_a = this._onObserverAdded) == null ? void 0 : _a.call(this, callback);
|
|
1193
|
+
if (this._hasNotified && this.notifyIfTriggered && this._lastNotifiedValue !== void 0) {
|
|
1194
|
+
callback(this._lastNotifiedValue);
|
|
1195
|
+
}
|
|
1196
|
+
return callback;
|
|
1197
|
+
}
|
|
1198
|
+
addOnce(callback) {
|
|
1199
|
+
const wrapper = (eventData) => {
|
|
1200
|
+
this.removeCallback(wrapper);
|
|
1201
|
+
callback(eventData);
|
|
1202
|
+
};
|
|
1203
|
+
return this.add(wrapper);
|
|
1204
|
+
}
|
|
1205
|
+
remove(callback) {
|
|
1206
|
+
return callback ? this.removeCallback(callback) : false;
|
|
1207
|
+
}
|
|
1208
|
+
removeCallback(callback) {
|
|
1209
|
+
const index = this._observers.indexOf(callback);
|
|
1210
|
+
if (index !== -1) {
|
|
1211
|
+
this._observers.splice(index, 1);
|
|
1212
|
+
return true;
|
|
1213
|
+
}
|
|
1214
|
+
return false;
|
|
1215
|
+
}
|
|
1216
|
+
notifyObservers(eventData) {
|
|
1217
|
+
if (this.notifyIfTriggered) {
|
|
1218
|
+
this._hasNotified = true;
|
|
1219
|
+
this._lastNotifiedValue = eventData;
|
|
1220
|
+
}
|
|
1221
|
+
for (const observer of this._observers.slice()) {
|
|
1222
|
+
observer(eventData);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
hasObservers() {
|
|
1226
|
+
return this._observers.length > 0;
|
|
1227
|
+
}
|
|
1228
|
+
clear() {
|
|
1229
|
+
this._observers = [];
|
|
1230
|
+
this._onObserverAdded = void 0;
|
|
1231
|
+
this.cleanLastNotifiedState();
|
|
1232
|
+
}
|
|
1233
|
+
cleanLastNotifiedState() {
|
|
1234
|
+
this._hasNotified = false;
|
|
1235
|
+
this._lastNotifiedValue = void 0;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1148
1238
|
let _uniqueIdCounter = 0;
|
|
1149
1239
|
class Node {
|
|
1150
1240
|
constructor(name, scene) {
|
|
@@ -1155,6 +1245,7 @@ class Node {
|
|
|
1155
1245
|
__publicField(this, "uniqueId");
|
|
1156
1246
|
/** Free-form user data slot (Babylon.js `Node.metadata`). */
|
|
1157
1247
|
__publicField(this, "metadata", null);
|
|
1248
|
+
__publicField(this, "onDisposeObservable", new Observable());
|
|
1158
1249
|
/** @internal Owning compat scene, when constructed against one. */
|
|
1159
1250
|
__publicField(this, "_scene");
|
|
1160
1251
|
/** @internal */
|
|
@@ -1281,12 +1372,17 @@ class Node {
|
|
|
1281
1372
|
/** @internal Dispose compat wrapper state without touching Lite resources. */
|
|
1282
1373
|
_disposeWrapperTree(doNotRecurse = false) {
|
|
1283
1374
|
var _a;
|
|
1375
|
+
if (this._disposed) {
|
|
1376
|
+
return;
|
|
1377
|
+
}
|
|
1284
1378
|
if (!doNotRecurse) {
|
|
1285
1379
|
for (const child of [...this._children]) {
|
|
1286
1380
|
child._disposeWrapperTree();
|
|
1287
1381
|
}
|
|
1288
1382
|
}
|
|
1289
1383
|
this._disposed = true;
|
|
1384
|
+
this.onDisposeObservable.notifyObservers(this);
|
|
1385
|
+
this.onDisposeObservable.clear();
|
|
1290
1386
|
this._linkParent(null);
|
|
1291
1387
|
(_a = this._scene) == null ? void 0 : _a._unregisterNode(this);
|
|
1292
1388
|
}
|
|
@@ -2188,6 +2284,7 @@ class TransformNode extends Node {
|
|
|
2188
2284
|
super(name, scene);
|
|
2189
2285
|
/** @internal The Lite scene node that carries this transform. */
|
|
2190
2286
|
__publicField(this, "_node");
|
|
2287
|
+
__publicField(this, "physicsBody", null);
|
|
2191
2288
|
/**
|
|
2192
2289
|
* @internal The Lite asset container this node was loaded from, when produced
|
|
2193
2290
|
* by a loader. Used by the `KHR_materials_variants` helpers (which key off the
|
|
@@ -2331,6 +2428,12 @@ class AbstractMesh extends TransformNode {
|
|
|
2331
2428
|
this._visible = value;
|
|
2332
2429
|
this._syncVisibility(this.isEnabled());
|
|
2333
2430
|
}
|
|
2431
|
+
get isPickable() {
|
|
2432
|
+
return this._lite.pickable !== false;
|
|
2433
|
+
}
|
|
2434
|
+
set isPickable(value) {
|
|
2435
|
+
this._lite.pickable = value;
|
|
2436
|
+
}
|
|
2334
2437
|
get receiveShadows() {
|
|
2335
2438
|
return this._lite.receiveShadows;
|
|
2336
2439
|
}
|
|
@@ -3316,9 +3419,9 @@ export {
|
|
|
3316
3419
|
AbstractMesh as A,
|
|
3317
3420
|
BoundingBox as B,
|
|
3318
3421
|
Color3 as C,
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3422
|
+
PBRSheenConfiguration as D,
|
|
3423
|
+
PBRSpecularGlossinessMaterial as E,
|
|
3424
|
+
PushMaterial as F,
|
|
3322
3425
|
GroundMesh as G,
|
|
3323
3426
|
Vector4 as H,
|
|
3324
3427
|
InstancedMesh as I,
|
|
@@ -3327,38 +3430,39 @@ export {
|
|
|
3327
3430
|
LiteCompatError as L,
|
|
3328
3431
|
Matrix as M,
|
|
3329
3432
|
Node as N,
|
|
3330
|
-
|
|
3433
|
+
Observable as O,
|
|
3331
3434
|
PBRAnisotropicConfiguration as P,
|
|
3332
3435
|
Quaternion as Q,
|
|
3333
|
-
|
|
3436
|
+
transformCoordinates as R,
|
|
3334
3437
|
StandardMaterial as S,
|
|
3335
3438
|
TransformNode as T,
|
|
3439
|
+
transformNormal as U,
|
|
3336
3440
|
Vector3 as V,
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3441
|
+
Vector2 as a,
|
|
3442
|
+
Color4 as b,
|
|
3443
|
+
Mesh as c,
|
|
3444
|
+
BoundingInfo as d,
|
|
3445
|
+
BoundingSphere as e,
|
|
3446
|
+
CreateBox as f,
|
|
3447
|
+
CreateCylinder as g,
|
|
3448
|
+
CreateDashedLines as h,
|
|
3449
|
+
CreateDisc as i,
|
|
3450
|
+
CreateGround as j,
|
|
3451
|
+
CreateLineSystem as k,
|
|
3348
3452
|
liteBackedVector3 as l,
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3453
|
+
CreateLines as m,
|
|
3454
|
+
CreatePlane as n,
|
|
3455
|
+
CreateSphere as o,
|
|
3456
|
+
CreateTiledBox as p,
|
|
3457
|
+
CreateTiledPlane as q,
|
|
3458
|
+
CreateTorus as r,
|
|
3459
|
+
LinesMesh as s,
|
|
3460
|
+
Material as t,
|
|
3357
3461
|
unsupported as u,
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3462
|
+
MeshBuilder as v,
|
|
3463
|
+
PBRClearCoatConfiguration as w,
|
|
3464
|
+
PBRIridescenceConfiguration as x,
|
|
3465
|
+
PBRMaterial as y,
|
|
3466
|
+
PBRMetallicRoughnessMaterial as z
|
|
3363
3467
|
};
|
|
3364
|
-
//# sourceMappingURL=meshes-
|
|
3468
|
+
//# sourceMappingURL=meshes-nWGELV98.js.map
|