@babylonjs/lite-compat 1.37.0-preview → 1.37.2-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 +113 -4
- package/index.d.ts +397 -19
- package/index.js +1584 -1023
- package/index.js.map +1 -1
- package/{meshes-zeNif9yt.js → meshes-sOWGK4P8.js} +40 -13
- package/meshes-sOWGK4P8.js.map +1 -0
- package/navigation.d.ts +42 -9
- package/navigation.js +1 -1
- package/package.json +4 -4
- package/meshes-zeNif9yt.js.map +0 -1
|
@@ -682,8 +682,9 @@ var Quaternion = class Quaternion {
|
|
|
682
682
|
this.w = source.w;
|
|
683
683
|
return this;
|
|
684
684
|
}
|
|
685
|
+
/** Babylon.js `multiply`: the product `this · other` as a new quaternion. */
|
|
685
686
|
multiply(other) {
|
|
686
|
-
return new Quaternion(
|
|
687
|
+
return new Quaternion(this.x * other.w + this.y * other.z - this.z * other.y + this.w * other.x, -this.x * other.z + this.y * other.w + this.z * other.x + this.w * other.y, this.x * other.y - this.y * other.x + this.z * other.w + this.w * other.z, -this.x * other.x - this.y * other.y - this.z * other.z + this.w * other.w);
|
|
687
688
|
}
|
|
688
689
|
length() {
|
|
689
690
|
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
|
|
@@ -794,7 +795,7 @@ var Quaternion = class Quaternion {
|
|
|
794
795
|
/** Babylon.js `Quaternion.FromLookDirectionLHToRef(forward, up, result)`. */
|
|
795
796
|
static FromLookDirectionLHToRef(forward, up, result) {
|
|
796
797
|
const matrix = lookDirectionRotationScratch ??= /* @__PURE__ */ new Float32Array(16);
|
|
797
|
-
|
|
798
|
+
writeMat4FromLookDirectionRHIntoBuffer(matrix, forward, up);
|
|
798
799
|
return Quaternion._FromRotationStorageToRef(matrix, result);
|
|
799
800
|
}
|
|
800
801
|
/** Babylon.js `Quaternion.FromLookDirectionRH(forward, up)`. */
|
|
@@ -804,7 +805,7 @@ var Quaternion = class Quaternion {
|
|
|
804
805
|
/** Babylon.js `Quaternion.FromLookDirectionRHToRef(forward, up, result)`. */
|
|
805
806
|
static FromLookDirectionRHToRef(forward, up, result) {
|
|
806
807
|
const matrix = lookDirectionRotationScratch ??= /* @__PURE__ */ new Float32Array(16);
|
|
807
|
-
|
|
808
|
+
writeMat4FromLookDirectionLHIntoBuffer(matrix, forward, up);
|
|
808
809
|
return Quaternion._FromRotationStorageToRef(matrix, result);
|
|
809
810
|
}
|
|
810
811
|
static _FromRotationStorageToRef(matrix, result) {
|
|
@@ -940,10 +941,9 @@ var Matrix = class Matrix {
|
|
|
940
941
|
determinant() {
|
|
941
942
|
return determinant(this.m);
|
|
942
943
|
}
|
|
944
|
+
/** Babylon.js `invert`: inverts this matrix in place and returns it. */
|
|
943
945
|
invert() {
|
|
944
|
-
|
|
945
|
-
this.invertToRef(result);
|
|
946
|
-
return result;
|
|
946
|
+
return this.invertToRef(this);
|
|
947
947
|
}
|
|
948
948
|
invertToRef(result) {
|
|
949
949
|
const inv = invertValues(this.m);
|
|
@@ -1076,7 +1076,7 @@ var Matrix = class Matrix {
|
|
|
1076
1076
|
}
|
|
1077
1077
|
/** Babylon.js `Matrix.LookDirectionLHToRef(forward, up, result)`. */
|
|
1078
1078
|
static LookDirectionLHToRef(forward, up, result) {
|
|
1079
|
-
|
|
1079
|
+
writeMat4FromLookDirectionRHIntoBuffer(result.m, forward, up);
|
|
1080
1080
|
return result.markAsUpdated();
|
|
1081
1081
|
}
|
|
1082
1082
|
/** Babylon.js `Matrix.LookDirectionRH(forward, up)` orientation matrix. */
|
|
@@ -1085,7 +1085,7 @@ var Matrix = class Matrix {
|
|
|
1085
1085
|
}
|
|
1086
1086
|
/** Babylon.js `Matrix.LookDirectionRHToRef(forward, up, result)`. */
|
|
1087
1087
|
static LookDirectionRHToRef(forward, up, result) {
|
|
1088
|
-
|
|
1088
|
+
writeMat4FromLookDirectionLHIntoBuffer(result.m, forward, up);
|
|
1089
1089
|
return result.markAsUpdated();
|
|
1090
1090
|
}
|
|
1091
1091
|
/** Babylon.js `Matrix.OrthoOffCenterLH(left, right, bottom, top, znear, zfar, halfZRange?)` — LH ortho projection. */
|
|
@@ -1407,7 +1407,10 @@ var Observable = class {
|
|
|
1407
1407
|
return callback;
|
|
1408
1408
|
}
|
|
1409
1409
|
addOnce(callback, mask = -1) {
|
|
1410
|
+
let consumed = false;
|
|
1410
1411
|
const wrapper = (eventData) => {
|
|
1412
|
+
if (consumed) return;
|
|
1413
|
+
consumed = true;
|
|
1411
1414
|
this.removeCallback(wrapper);
|
|
1412
1415
|
callback(eventData);
|
|
1413
1416
|
};
|
|
@@ -1941,6 +1944,13 @@ var StandardMaterial = class StandardMaterial extends PushMaterial {
|
|
|
1941
1944
|
];
|
|
1942
1945
|
this._markDirty();
|
|
1943
1946
|
}
|
|
1947
|
+
get roughness() {
|
|
1948
|
+
return this._lite.roughness ?? 0;
|
|
1949
|
+
}
|
|
1950
|
+
set roughness(value) {
|
|
1951
|
+
this._lite.roughness = value;
|
|
1952
|
+
this._markDirty();
|
|
1953
|
+
}
|
|
1944
1954
|
get emissiveColor() {
|
|
1945
1955
|
return readColor3(this._lite.emissiveColor);
|
|
1946
1956
|
}
|
|
@@ -2845,7 +2855,15 @@ var TransformNode = class extends Node {
|
|
|
2845
2855
|
return this;
|
|
2846
2856
|
}
|
|
2847
2857
|
_applyParent(parent) {
|
|
2848
|
-
this._node
|
|
2858
|
+
const node = this._node;
|
|
2859
|
+
const liteParent = liteNodeOf(parent);
|
|
2860
|
+
const previous = node.parent;
|
|
2861
|
+
if (previous && previous !== liteParent) {
|
|
2862
|
+
const siblings = previous.children;
|
|
2863
|
+
const index = siblings ? siblings.indexOf(node) : -1;
|
|
2864
|
+
if (index !== -1) siblings.splice(index, 1);
|
|
2865
|
+
}
|
|
2866
|
+
node.parent = liteParent;
|
|
2849
2867
|
}
|
|
2850
2868
|
/** @internal Remove this wrapper's node without letting Lite recurse for `dispose(true)`. */
|
|
2851
2869
|
_disposeSelf(doNotRecurse) {
|
|
@@ -2867,6 +2885,12 @@ var AbstractMesh = class extends TransformNode {
|
|
|
2867
2885
|
/** @internal Underlying Babylon Lite mesh. */
|
|
2868
2886
|
_lite;
|
|
2869
2887
|
_material = null;
|
|
2888
|
+
/**
|
|
2889
|
+
* @internal The mesh renders a material that exists only on its Lite node: a natively loaded glTF
|
|
2890
|
+
* material has no compat wrapper, so `material` reads `null`. Clones keep that Lite material, and the
|
|
2891
|
+
* deferred registration does not replace it with `scene.defaultMaterial`. Any `material` assignment clears it.
|
|
2892
|
+
*/
|
|
2893
|
+
_liteOnlyMaterial = false;
|
|
2870
2894
|
_meshBlendingTag = 0;
|
|
2871
2895
|
_visible = true;
|
|
2872
2896
|
constructor(name, lite, scene) {
|
|
@@ -2890,6 +2914,7 @@ var AbstractMesh = class extends TransformNode {
|
|
|
2890
2914
|
}
|
|
2891
2915
|
set material(value) {
|
|
2892
2916
|
this._material = value;
|
|
2917
|
+
this._liteOnlyMaterial = false;
|
|
2893
2918
|
const scene = this._scene;
|
|
2894
2919
|
const renderMaterial = value ?? scene?.defaultMaterial;
|
|
2895
2920
|
if (renderMaterial && scene) {
|
|
@@ -3094,7 +3119,7 @@ var AbstractMesh = class extends TransformNode {
|
|
|
3094
3119
|
let newNormals;
|
|
3095
3120
|
const normals = lite._cpuNormals;
|
|
3096
3121
|
if (normals) {
|
|
3097
|
-
const nm = matrix.
|
|
3122
|
+
const nm = matrix.invertToRef(new Matrix()).transpose().m;
|
|
3098
3123
|
newNormals = new Float32Array(normals.length);
|
|
3099
3124
|
for (let i = 0; i < normals.length; i += 3) {
|
|
3100
3125
|
const x = normals[i], y = normals[i + 1], z = normals[i + 2];
|
|
@@ -3188,6 +3213,7 @@ var Mesh = class Mesh extends AbstractMesh {
|
|
|
3188
3213
|
static _fromLite(lite, container, scene) {
|
|
3189
3214
|
const mesh = new Mesh(lite.name ?? "", lite);
|
|
3190
3215
|
mesh._container = container;
|
|
3216
|
+
mesh._liteOnlyMaterial = !!lite.material;
|
|
3191
3217
|
mesh._visible = lite.visible !== false;
|
|
3192
3218
|
if (scene) mesh._bindLoadedScene(scene);
|
|
3193
3219
|
return mesh;
|
|
@@ -3317,7 +3343,8 @@ var Mesh = class Mesh extends AbstractMesh {
|
|
|
3317
3343
|
wrapper.metadata = source.metadata;
|
|
3318
3344
|
wrapper.setEnabled(source.isEnabled(false));
|
|
3319
3345
|
if (wrapper instanceof Mesh && source instanceof Mesh) {
|
|
3320
|
-
wrapper.
|
|
3346
|
+
if (source._liteOnlyMaterial) wrapper._liteOnlyMaterial = true;
|
|
3347
|
+
else wrapper.material = source.material;
|
|
3321
3348
|
wrapper.isVisible = source.isVisible;
|
|
3322
3349
|
wrapper.meshBlendingTag = source.meshBlendingTag;
|
|
3323
3350
|
}
|
|
@@ -3606,7 +3633,7 @@ function addPrimitive(mesh, scene, afterAdd) {
|
|
|
3606
3633
|
function registerMeshAtStart(mesh, scene, afterAdd) {
|
|
3607
3634
|
scene._deferAdd(() => {
|
|
3608
3635
|
if (mesh.isDisposed()) return;
|
|
3609
|
-
const mat = mesh.material ?? scene.defaultMaterial;
|
|
3636
|
+
const mat = mesh.material ?? (mesh._liteOnlyMaterial ? null : scene.defaultMaterial);
|
|
3610
3637
|
if (mat) attachMaterialToScene(mat, scene);
|
|
3611
3638
|
if (mat?._lite) mesh._lite.material = mat._lite;
|
|
3612
3639
|
addToScene(scene._lite, mesh._lite);
|
|
@@ -3832,4 +3859,4 @@ function RegisterPolygonBuilder() {}
|
|
|
3832
3859
|
//#endregion
|
|
3833
3860
|
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 };
|
|
3834
3861
|
|
|
3835
|
-
//# sourceMappingURL=meshes-
|
|
3862
|
+
//# sourceMappingURL=meshes-sOWGK4P8.js.map
|