@babylonjs/lite-compat 1.15.0-preview → 1.17.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 +10 -8
- package/brdf-lut-data-BFfYlW71.js +5 -0
- package/brdf-lut-data-BFfYlW71.js.map +1 -0
- package/index.d.ts +564 -106
- package/index.js +1189 -1238
- package/index.js.map +1 -1
- package/meshes-0TVZfbq3.js +3339 -0
- package/meshes-0TVZfbq3.js.map +1 -0
- package/navigation.d.ts +281 -83
- package/navigation.js +1 -1
- package/package.json +4 -4
- package/meshes-CPZtn6G5.js +0 -1709
- package/meshes-CPZtn6G5.js.map +0 -1
package/index.js
CHANGED
|
@@ -1,141 +1,9 @@
|
|
|
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 { V as Vector3, u as unsupported, L as LiteCompatError, N as Node, M as Matrix, a as Mesh, T as TransformNode, l as liteBackedVector3,
|
|
5
|
-
import { A,
|
|
6
|
-
import { VERSION, createEngine, onBeforeRender, stopEngine, resizeEngine, setEngineSize, disposeEngine, registerSceneWithShadowSupport, registerScene, startEngine, createNullEngine, stepScene, setPhysicsTimestep, setPhysicsGravity, disposePhysics, createHavokWorld, createArcRotateCamera, attachControl, getCameraPosition, getViewMatrix, getProjectionMatrix, createGeospatialCamera, setGeospatialOrientation, attachGeospatialControls, createFreeCamera, attachFreeControl,
|
|
7
|
-
class Color3 {
|
|
8
|
-
constructor(r = 0, g2 = 0, b2 = 0) {
|
|
9
|
-
this.r = r;
|
|
10
|
-
this.g = g2;
|
|
11
|
-
this.b = b2;
|
|
12
|
-
}
|
|
13
|
-
set(r, g2, b2) {
|
|
14
|
-
this.r = r;
|
|
15
|
-
this.g = g2;
|
|
16
|
-
this.b = b2;
|
|
17
|
-
return this;
|
|
18
|
-
}
|
|
19
|
-
copyFrom(source) {
|
|
20
|
-
this.r = source.r;
|
|
21
|
-
this.g = source.g;
|
|
22
|
-
this.b = source.b;
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
scale(scale) {
|
|
26
|
-
return new Color3(this.r * scale, this.g * scale, this.b * scale);
|
|
27
|
-
}
|
|
28
|
-
scaleInPlace(scale) {
|
|
29
|
-
this.r *= scale;
|
|
30
|
-
this.g *= scale;
|
|
31
|
-
this.b *= scale;
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
multiply(other) {
|
|
35
|
-
return new Color3(this.r * other.r, this.g * other.g, this.b * other.b);
|
|
36
|
-
}
|
|
37
|
-
add(other) {
|
|
38
|
-
return new Color3(this.r + other.r, this.g + other.g, this.b + other.b);
|
|
39
|
-
}
|
|
40
|
-
clone() {
|
|
41
|
-
return new Color3(this.r, this.g, this.b);
|
|
42
|
-
}
|
|
43
|
-
equals(other) {
|
|
44
|
-
return this.r === other.r && this.g === other.g && this.b === other.b;
|
|
45
|
-
}
|
|
46
|
-
asArray() {
|
|
47
|
-
return [this.r, this.g, this.b];
|
|
48
|
-
}
|
|
49
|
-
toColor4(alpha = 1) {
|
|
50
|
-
return new Color4(this.r, this.g, this.b, alpha);
|
|
51
|
-
}
|
|
52
|
-
toHexString() {
|
|
53
|
-
const intR = Math.round(Math.min(Math.max(this.r, 0), 1) * 255);
|
|
54
|
-
const intG = Math.round(Math.min(Math.max(this.g, 0), 1) * 255);
|
|
55
|
-
const intB = Math.round(Math.min(Math.max(this.b, 0), 1) * 255);
|
|
56
|
-
return "#" + toHex(intR) + toHex(intG) + toHex(intB);
|
|
57
|
-
}
|
|
58
|
-
static Black() {
|
|
59
|
-
return new Color3(0, 0, 0);
|
|
60
|
-
}
|
|
61
|
-
static White() {
|
|
62
|
-
return new Color3(1, 1, 1);
|
|
63
|
-
}
|
|
64
|
-
static Red() {
|
|
65
|
-
return new Color3(1, 0, 0);
|
|
66
|
-
}
|
|
67
|
-
static Green() {
|
|
68
|
-
return new Color3(0, 1, 0);
|
|
69
|
-
}
|
|
70
|
-
static Blue() {
|
|
71
|
-
return new Color3(0, 0, 1);
|
|
72
|
-
}
|
|
73
|
-
static FromArray(array, offset = 0) {
|
|
74
|
-
return new Color3(array[offset] ?? 0, array[offset + 1] ?? 0, array[offset + 2] ?? 0);
|
|
75
|
-
}
|
|
76
|
-
static FromInts(r, g2, b2) {
|
|
77
|
-
return new Color3(r / 255, g2 / 255, b2 / 255);
|
|
78
|
-
}
|
|
79
|
-
static FromHexString(hex) {
|
|
80
|
-
if (hex.charAt(0) !== "#" || hex.length < 7) {
|
|
81
|
-
return new Color3(0, 0, 0);
|
|
82
|
-
}
|
|
83
|
-
const r = parseInt(hex.substring(1, 3), 16);
|
|
84
|
-
const g2 = parseInt(hex.substring(3, 5), 16);
|
|
85
|
-
const b2 = parseInt(hex.substring(5, 7), 16);
|
|
86
|
-
return Color3.FromInts(r, g2, b2);
|
|
87
|
-
}
|
|
88
|
-
static Lerp(start, end, amount) {
|
|
89
|
-
return new Color3(start.r + (end.r - start.r) * amount, start.g + (end.g - start.g) * amount, start.b + (end.b - start.b) * amount);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
class Color4 {
|
|
93
|
-
constructor(r = 0, g2 = 0, b2 = 0, a = 1) {
|
|
94
|
-
this.r = r;
|
|
95
|
-
this.g = g2;
|
|
96
|
-
this.b = b2;
|
|
97
|
-
this.a = a;
|
|
98
|
-
}
|
|
99
|
-
set(r, g2, b2, a) {
|
|
100
|
-
this.r = r;
|
|
101
|
-
this.g = g2;
|
|
102
|
-
this.b = b2;
|
|
103
|
-
this.a = a;
|
|
104
|
-
return this;
|
|
105
|
-
}
|
|
106
|
-
copyFrom(source) {
|
|
107
|
-
this.r = source.r;
|
|
108
|
-
this.g = source.g;
|
|
109
|
-
this.b = source.b;
|
|
110
|
-
this.a = source.a;
|
|
111
|
-
return this;
|
|
112
|
-
}
|
|
113
|
-
scale(scale) {
|
|
114
|
-
return new Color4(this.r * scale, this.g * scale, this.b * scale, this.a * scale);
|
|
115
|
-
}
|
|
116
|
-
add(other) {
|
|
117
|
-
return new Color4(this.r + other.r, this.g + other.g, this.b + other.b, this.a + other.a);
|
|
118
|
-
}
|
|
119
|
-
clone() {
|
|
120
|
-
return new Color4(this.r, this.g, this.b, this.a);
|
|
121
|
-
}
|
|
122
|
-
equals(other) {
|
|
123
|
-
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
|
|
124
|
-
}
|
|
125
|
-
asArray() {
|
|
126
|
-
return [this.r, this.g, this.b, this.a];
|
|
127
|
-
}
|
|
128
|
-
static FromArray(array, offset = 0) {
|
|
129
|
-
return new Color4(array[offset] ?? 0, array[offset + 1] ?? 0, array[offset + 2] ?? 0, array[offset + 3] ?? 1);
|
|
130
|
-
}
|
|
131
|
-
static FromInts(r, g2, b2, a) {
|
|
132
|
-
return new Color4(r / 255, g2 / 255, b2 / 255, a / 255);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
function toHex(value) {
|
|
136
|
-
const hex = value.toString(16).toUpperCase();
|
|
137
|
-
return hex.length === 1 ? "0" + hex : hex;
|
|
138
|
-
}
|
|
4
|
+
import { V as Vector3, u as unsupported, L as LiteCompatError, N as Node, M as Matrix, C as Color3, S as StandardMaterial, a as Color4, b as Mesh, T as TransformNode, l as liteBackedVector3, Q as Quaternion } from "./meshes-0TVZfbq3.js";
|
|
5
|
+
import { A, B, c, d, e, f, g, h, i, j, k, m, n, o, p, G, I, q, r, s, P, t, v, w, x, y, z, D, E, F, H, J, K, O } from "./meshes-0TVZfbq3.js";
|
|
6
|
+
import { VERSION, createEngine, onBeforeRender, stopEngine, resizeEngine, setEngineSize, disposeEngine, uploadImageToArrayLayer, enableMirroredMeshes, registerSceneWithShadowSupport, registerScene, startEngine, createNullEngine, stepScene, setPhysicsTimestep, setPhysicsGravity, disposePhysics, createHavokWorld, createArcRotateCamera, attachControl, getCameraPosition, getViewMatrix, getProjectionMatrix, createGeospatialCamera, setGeospatialOrientation, attachGeospatialControls, createFreeCamera, attachFreeControl, setAnimationAdditive, playAnimation, pauseAnimation, goToFrame, stopAnimation, createSceneContext, updateAnimationManager, setFog, setClipPlane, loadHdrEnvironment, loadDdsEnvironment, loadEnvironment, createDefaultCamera, addToScene, createHemisphericLight, createAnimationManager, enableAnimationBlending, addAnimationGroup, disposeScene, createDirectionalLight, createPointLight, createSpotLight, createCsgFromMesh, csgSubtract, csgIntersect, csgUnion, createMeshFromCsg, createCsg2FromMesh, csg2Subtract, csg2Intersect, csg2Add, createMeshesFromCsg2, disposeCsg2, initializeCsg2Async, createMorphTargets, setMorphTargetWeights, createTransformNode, bakeCurrentTransformIntoVertices, loadSOG, loadSPZ, loadSplat, createDynamicTexture, updateDynamicTexture, createTexture2DFromPixels, updateTexture2DFromPixels, createTexture3DFromPixels, loadBasisTexture2D, loadKtxTexture2D, loadTexture2D, createTexture2DArrayFromUrls, createTexture2DArrayFromKtx2, loadImageToArrayLayer, createTexture2DArray, createTexture2DArrayFromPixels, updateTexture2DArrayFromPixels, loadBabylon, loadGltf, resetVariant, getVariantNames, selectVariant, disposePicker, createGpuPicker, pickAsync, createAxisDragGizmo, attachAxisDragGizmoToNode, disposeAxisDragGizmo, createAxisScaleGizmo, attachAxisScaleGizmoToNode, disposeAxisScaleGizmo, createBoundingBoxGizmo, attachBoundingBoxGizmoToNode, disposeBoundingBoxGizmo, createCameraGizmo, attachCameraGizmoToCamera, disposeCameraGizmo, createLightGizmo, attachLightGizmoToLight, disposeLightGizmo, createPlaneDragGizmo, attachPlaneDragGizmoToNode, disposePlaneDragGizmo, createPlaneRotationGizmo, attachPlaneRotationGizmoToNode, disposePlaneRotationGizmo, createPositionGizmo, setPositionGizmoLocalCoordinates, attachPositionGizmoToNode, disposePositionGizmo, createRotationGizmo, setRotationGizmoLocalCoordinates, attachRotationGizmoToNode, disposeRotationGizmo, createScaleGizmo, setScaleGizmoLocalCoordinates, attachScaleGizmoToNode, disposeScaleGizmo, createUtilityLayer, registerUtilityLayer, disposeUtilityLayer, addBillboardSpriteIndex, updateBillboardSpriteIndex, loadSpriteAtlas, createFacingBillboardSystem, addFacingBillboardSystem, billboardBlendAdditive, billboardBlendAlpha, spriteBlendPremultiplied, spriteBlendAdditive, spriteBlendAlpha, createSprite2DLayer, addSprite2DIndex, createSpriteRenderer, registerSpriteRenderer, updateSprite2DIndex, createPcfSpotlightShadowGenerator, createPcfDirectionalShadowGenerator, createEsmDirectionalShadowGenerator, setShadowTaskCasterMeshes, parseNodeMaterialFromSnippet, createGridMaterial, getByteFrequencyData, getFloatFrequencyData, getByteTimeDomainData, getFloatTimeDomainData, enableAnalyzer, setSpatialPosition, setSpatialOrientation, enableSpatial, setSpatialListenerPosition, setSpatialListener, updateSpatialAudio, enableStereo, setStereoPan, disposeAudioBus, setBusVolume, getMasterVolume, setMasterVolume, unlockAudioEngineAsync, createSoundAsync, createSoundBufferAsync, createStreamingSoundAsync, createAudioBusAsync, createSoundSourceAsync, createMicrophoneSoundSourceAsync, disposeAudioEngine, createAudioEngineAsync, disposeSoundSource, setSoundSourceVolume, playSound, pauseSound, resumeSound, stopSound, disposeSound, setSoundVolume, playStreamingSound, pauseStreamingSound, resumeStreamingSound, stopStreamingSound, preloadStreamingInstanceAsync, preloadStreamingInstancesAsync, disposeStreamingSound, setStreamingSoundVolume, parseNodeParticleSetFromSnippet, registerNodeParticleSet, stopParticleSystem } from "@babylonjs/lite";
|
|
139
7
|
const Epsilon = 1e-3;
|
|
140
8
|
const ToRadians = Math.PI / 180;
|
|
141
9
|
const ToDegrees = 180 / Math.PI;
|
|
@@ -146,8 +14,8 @@ const Scalar = {
|
|
|
146
14
|
Lerp(start, end, amount) {
|
|
147
15
|
return start + (end - start) * amount;
|
|
148
16
|
},
|
|
149
|
-
InverseLerp(a,
|
|
150
|
-
return a ===
|
|
17
|
+
InverseLerp(a, b, value) {
|
|
18
|
+
return a === b ? 0 : (value - a) / (b - a);
|
|
151
19
|
},
|
|
152
20
|
DegreesToRadians(degrees) {
|
|
153
21
|
return degrees * ToRadians;
|
|
@@ -155,8 +23,8 @@ const Scalar = {
|
|
|
155
23
|
RadiansToDegrees(radians) {
|
|
156
24
|
return radians * ToDegrees;
|
|
157
25
|
},
|
|
158
|
-
WithinEpsilon(a,
|
|
159
|
-
return Math.abs(a -
|
|
26
|
+
WithinEpsilon(a, b, epsilon = 1401298e-51) {
|
|
27
|
+
return Math.abs(a - b) <= epsilon;
|
|
160
28
|
},
|
|
161
29
|
Normalize(value, min, max) {
|
|
162
30
|
return (value - min) / (max - min);
|
|
@@ -186,11 +54,11 @@ var Space = /* @__PURE__ */ ((Space2) => {
|
|
|
186
54
|
return Space2;
|
|
187
55
|
})(Space || {});
|
|
188
56
|
class Plane {
|
|
189
|
-
constructor(a,
|
|
57
|
+
constructor(a, b, c2, d2) {
|
|
190
58
|
/** Normal x/y/z and signed distance `d` from the origin (`normal · p + d = 0`). */
|
|
191
59
|
__publicField(this, "normal");
|
|
192
60
|
__publicField(this, "d");
|
|
193
|
-
this.normal = new Vector3(a,
|
|
61
|
+
this.normal = new Vector3(a, b, c2);
|
|
194
62
|
this.d = d2;
|
|
195
63
|
}
|
|
196
64
|
asArray() {
|
|
@@ -228,14 +96,14 @@ class Plane {
|
|
|
228
96
|
/** Transform a copy of this plane by the transpose of the inverse of `transformation`. */
|
|
229
97
|
transform(transformation) {
|
|
230
98
|
const m2 = transformation.m;
|
|
231
|
-
const
|
|
232
|
-
const
|
|
233
|
-
const
|
|
99
|
+
const x2 = this.normal.x;
|
|
100
|
+
const y2 = this.normal.y;
|
|
101
|
+
const z2 = this.normal.z;
|
|
234
102
|
const d2 = this.d;
|
|
235
|
-
const nx =
|
|
236
|
-
const ny =
|
|
237
|
-
const nz =
|
|
238
|
-
const nd =
|
|
103
|
+
const nx = x2 * m2[0] + y2 * m2[1] + z2 * m2[2] + d2 * m2[3];
|
|
104
|
+
const ny = x2 * m2[4] + y2 * m2[5] + z2 * m2[6] + d2 * m2[7];
|
|
105
|
+
const nz = x2 * m2[8] + y2 * m2[9] + z2 * m2[10] + d2 * m2[11];
|
|
106
|
+
const nd = x2 * m2[12] + y2 * m2[13] + z2 * m2[14] + d2 * m2[15];
|
|
239
107
|
return new Plane(nx, ny, nz, nd);
|
|
240
108
|
}
|
|
241
109
|
}
|
|
@@ -262,15 +130,15 @@ class Ray {
|
|
|
262
130
|
}
|
|
263
131
|
/** True if this ray passes within `sphereRadius` of `spherePosition`. */
|
|
264
132
|
intersectsSphere(spherePosition, sphereRadius) {
|
|
265
|
-
const
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
const pyth =
|
|
133
|
+
const x2 = spherePosition.x - this.origin.x;
|
|
134
|
+
const y2 = spherePosition.y - this.origin.y;
|
|
135
|
+
const z2 = spherePosition.z - this.origin.z;
|
|
136
|
+
const pyth = x2 * x2 + y2 * y2 + z2 * z2;
|
|
269
137
|
const rr = sphereRadius * sphereRadius;
|
|
270
138
|
if (pyth <= rr) {
|
|
271
139
|
return true;
|
|
272
140
|
}
|
|
273
|
-
const dot =
|
|
141
|
+
const dot = x2 * this.direction.x + y2 * this.direction.y + z2 * this.direction.z;
|
|
274
142
|
if (dot < 0) {
|
|
275
143
|
return false;
|
|
276
144
|
}
|
|
@@ -280,8 +148,8 @@ class Ray {
|
|
|
280
148
|
static Zero() {
|
|
281
149
|
return new Ray(Vector3.Zero(), new Vector3(0, 0, 1), Number.MAX_VALUE);
|
|
282
150
|
}
|
|
283
|
-
static CreateNew(
|
|
284
|
-
return new Ray(new Vector3(
|
|
151
|
+
static CreateNew(x2, y2, z2, dx, dy, dz, length = Number.MAX_VALUE) {
|
|
152
|
+
return new Ray(new Vector3(x2, y2, z2), new Vector3(dx, dy, dz), length);
|
|
285
153
|
}
|
|
286
154
|
}
|
|
287
155
|
const Frustum = {
|
|
@@ -305,8 +173,8 @@ const Frustum = {
|
|
|
305
173
|
set(planes[5], m2[3] - m2[2], m2[7] - m2[6], m2[11] - m2[10], m2[15] - m2[14]);
|
|
306
174
|
}
|
|
307
175
|
};
|
|
308
|
-
function set(plane, a,
|
|
309
|
-
plane.normal.set(a,
|
|
176
|
+
function set(plane, a, b, c2, d2) {
|
|
177
|
+
plane.normal.set(a, b, c2);
|
|
310
178
|
plane.d = d2;
|
|
311
179
|
plane.normalize();
|
|
312
180
|
}
|
|
@@ -332,9 +200,9 @@ class Size {
|
|
|
332
200
|
}
|
|
333
201
|
}
|
|
334
202
|
class Viewport {
|
|
335
|
-
constructor(
|
|
336
|
-
this.x =
|
|
337
|
-
this.y =
|
|
203
|
+
constructor(x2, y2, width, height) {
|
|
204
|
+
this.x = x2;
|
|
205
|
+
this.y = y2;
|
|
338
206
|
this.width = width;
|
|
339
207
|
this.height = height;
|
|
340
208
|
}
|
|
@@ -394,10 +262,10 @@ class Curve3 {
|
|
|
394
262
|
for (let i2 = 0; i2 <= count; i2++) {
|
|
395
263
|
const t2 = i2 / count;
|
|
396
264
|
const u = 1 - t2;
|
|
397
|
-
const
|
|
398
|
-
const
|
|
399
|
-
const
|
|
400
|
-
points.push(new Vector3(
|
|
265
|
+
const x2 = u * u * v0.x + 2 * u * t2 * v1.x + t2 * t2 * v2.x;
|
|
266
|
+
const y2 = u * u * v0.y + 2 * u * t2 * v1.y + t2 * t2 * v2.y;
|
|
267
|
+
const z2 = u * u * v0.z + 2 * u * t2 * v1.z + t2 * t2 * v2.z;
|
|
268
|
+
points.push(new Vector3(x2, y2, z2));
|
|
401
269
|
}
|
|
402
270
|
return new Curve3(points);
|
|
403
271
|
}
|
|
@@ -443,12 +311,219 @@ class Path3D {
|
|
|
443
311
|
return this._distances;
|
|
444
312
|
}
|
|
445
313
|
}
|
|
446
|
-
class
|
|
314
|
+
class SmartArray {
|
|
315
|
+
constructor(capacity) {
|
|
316
|
+
__publicField(this, "data");
|
|
317
|
+
__publicField(this, "length", 0);
|
|
318
|
+
this.data = new Array(capacity);
|
|
319
|
+
}
|
|
320
|
+
push(value) {
|
|
321
|
+
this.data[this.length++] = value;
|
|
322
|
+
if (this.length > this.data.length) {
|
|
323
|
+
this.data.length = this.length;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
reset() {
|
|
327
|
+
this.length = 0;
|
|
328
|
+
}
|
|
329
|
+
concat(array) {
|
|
330
|
+
for (let i2 = 0; i2 < array.length; i2++) {
|
|
331
|
+
this.push(array.data[i2]);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
dispose() {
|
|
335
|
+
this.reset();
|
|
336
|
+
this.data.length = 0;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
class StringDictionary {
|
|
447
340
|
constructor() {
|
|
341
|
+
__publicField(this, "_store", {});
|
|
342
|
+
}
|
|
343
|
+
get count() {
|
|
344
|
+
return Object.keys(this._store).length;
|
|
345
|
+
}
|
|
346
|
+
add(key, value) {
|
|
347
|
+
if (key in this._store) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
this._store[key] = value;
|
|
351
|
+
return true;
|
|
352
|
+
}
|
|
353
|
+
set(key, value) {
|
|
354
|
+
if (!(key in this._store)) {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
this._store[key] = value;
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
get(key) {
|
|
361
|
+
return this._store[key];
|
|
362
|
+
}
|
|
363
|
+
getOrAddWithFactory(key, factory) {
|
|
364
|
+
let value = this._store[key];
|
|
365
|
+
if (value === void 0) {
|
|
366
|
+
value = factory(key);
|
|
367
|
+
this._store[key] = value;
|
|
368
|
+
}
|
|
369
|
+
return value;
|
|
370
|
+
}
|
|
371
|
+
contains(key) {
|
|
372
|
+
return key in this._store;
|
|
373
|
+
}
|
|
374
|
+
remove(key) {
|
|
375
|
+
if (key in this._store) {
|
|
376
|
+
delete this._store[key];
|
|
377
|
+
return true;
|
|
378
|
+
}
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
clear() {
|
|
382
|
+
this._store = {};
|
|
383
|
+
}
|
|
384
|
+
forEach(callback) {
|
|
385
|
+
for (const key of Object.keys(this._store)) {
|
|
386
|
+
callback(key, this._store[key]);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
const Tags = {
|
|
391
|
+
EnableFor(obj) {
|
|
392
|
+
obj._tags ?? (obj._tags = {});
|
|
393
|
+
},
|
|
394
|
+
HasTags(obj) {
|
|
395
|
+
return !!obj._tags && Object.keys(obj._tags).length > 0;
|
|
396
|
+
},
|
|
397
|
+
AddTagsTo(obj, tags) {
|
|
398
|
+
obj._tags ?? (obj._tags = {});
|
|
399
|
+
for (const tag of tags.split(/\s+/).filter(Boolean)) {
|
|
400
|
+
obj._tags[tag] = true;
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
RemoveTagsFrom(obj, tags) {
|
|
404
|
+
if (!obj._tags) {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
for (const tag of tags.split(/\s+/).filter(Boolean)) {
|
|
408
|
+
delete obj._tags[tag];
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
MatchesQuery(obj, tag) {
|
|
412
|
+
return !!obj._tags && obj._tags[tag] === true;
|
|
413
|
+
},
|
|
414
|
+
GetTags(obj) {
|
|
415
|
+
return obj._tags ? Object.keys(obj._tags) : [];
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
class PerformanceMonitor {
|
|
419
|
+
constructor(frameSampleSize = 30) {
|
|
420
|
+
__publicField(this, "_samples", []);
|
|
421
|
+
__publicField(this, "_max");
|
|
422
|
+
__publicField(this, "_lastTime", null);
|
|
423
|
+
__publicField(this, "_enabled", true);
|
|
424
|
+
this._max = frameSampleSize;
|
|
425
|
+
}
|
|
426
|
+
sampleFrame(timeMs = now()) {
|
|
427
|
+
if (!this._enabled) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (this._lastTime !== null) {
|
|
431
|
+
const delta = timeMs - this._lastTime;
|
|
432
|
+
this._samples.push(delta);
|
|
433
|
+
if (this._samples.length > this._max) {
|
|
434
|
+
this._samples.shift();
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
this._lastTime = timeMs;
|
|
438
|
+
}
|
|
439
|
+
get averageFrameTime() {
|
|
440
|
+
if (this._samples.length === 0) {
|
|
441
|
+
return 0;
|
|
442
|
+
}
|
|
443
|
+
return this._samples.reduce((a, b) => a + b, 0) / this._samples.length;
|
|
444
|
+
}
|
|
445
|
+
get averageFPS() {
|
|
446
|
+
const avg = this.averageFrameTime;
|
|
447
|
+
return avg > 0 ? 1e3 / avg : 0;
|
|
448
|
+
}
|
|
449
|
+
get isSaturated() {
|
|
450
|
+
return this._samples.length >= this._max;
|
|
451
|
+
}
|
|
452
|
+
enable() {
|
|
453
|
+
this._enabled = true;
|
|
454
|
+
}
|
|
455
|
+
disable() {
|
|
456
|
+
this._enabled = false;
|
|
457
|
+
}
|
|
458
|
+
reset() {
|
|
459
|
+
this._samples = [];
|
|
460
|
+
this._lastTime = null;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
class FactorGradient {
|
|
464
|
+
constructor(gradient, factor1, factor2 = factor1) {
|
|
465
|
+
this.gradient = gradient;
|
|
466
|
+
this.factor1 = factor1;
|
|
467
|
+
this.factor2 = factor2;
|
|
468
|
+
}
|
|
469
|
+
getFactor() {
|
|
470
|
+
return this.factor1;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
class ColorGradient {
|
|
474
|
+
constructor(gradient, color1, color2) {
|
|
475
|
+
this.gradient = gradient;
|
|
476
|
+
this.color1 = color1;
|
|
477
|
+
this.color2 = color2;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
function now() {
|
|
481
|
+
return typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
482
|
+
}
|
|
483
|
+
const Logger = {
|
|
484
|
+
NoneLogLevel: 0,
|
|
485
|
+
MessageLogLevel: 1,
|
|
486
|
+
WarningLogLevel: 2,
|
|
487
|
+
ErrorLogLevel: 4,
|
|
488
|
+
AllLogLevel: 7,
|
|
489
|
+
/** Current log-level bitmask. */
|
|
490
|
+
LogLevels: 7,
|
|
491
|
+
Log(message) {
|
|
492
|
+
if (this.LogLevels & this.MessageLogLevel) {
|
|
493
|
+
console.log("BJS - " + message);
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
Warn(message) {
|
|
497
|
+
if (this.LogLevels & this.WarningLogLevel) {
|
|
498
|
+
console.warn("BJS - " + message);
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
Error(message) {
|
|
502
|
+
if (this.LogLevels & this.ErrorLogLevel) {
|
|
503
|
+
console.error("BJS - " + message);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
const PrecisionDate = {
|
|
508
|
+
get Now() {
|
|
509
|
+
return now();
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
class Observable {
|
|
513
|
+
constructor(_onObserverAdded, notifyIfTriggered = false) {
|
|
448
514
|
__publicField(this, "_observers", []);
|
|
515
|
+
__publicField(this, "_hasNotified", false);
|
|
516
|
+
__publicField(this, "_lastNotifiedValue");
|
|
517
|
+
this._onObserverAdded = _onObserverAdded;
|
|
518
|
+
this.notifyIfTriggered = notifyIfTriggered;
|
|
449
519
|
}
|
|
450
520
|
add(callback) {
|
|
521
|
+
var _a;
|
|
451
522
|
this._observers.push(callback);
|
|
523
|
+
(_a = this._onObserverAdded) == null ? void 0 : _a.call(this, callback);
|
|
524
|
+
if (this._hasNotified && this.notifyIfTriggered && this._lastNotifiedValue !== void 0) {
|
|
525
|
+
callback(this._lastNotifiedValue);
|
|
526
|
+
}
|
|
452
527
|
return callback;
|
|
453
528
|
}
|
|
454
529
|
addOnce(callback) {
|
|
@@ -456,8 +531,7 @@ class Observable {
|
|
|
456
531
|
this.removeCallback(wrapper);
|
|
457
532
|
callback(eventData);
|
|
458
533
|
};
|
|
459
|
-
this.
|
|
460
|
-
return wrapper;
|
|
534
|
+
return this.add(wrapper);
|
|
461
535
|
}
|
|
462
536
|
remove(callback) {
|
|
463
537
|
return callback ? this.removeCallback(callback) : false;
|
|
@@ -471,6 +545,10 @@ class Observable {
|
|
|
471
545
|
return false;
|
|
472
546
|
}
|
|
473
547
|
notifyObservers(eventData) {
|
|
548
|
+
if (this.notifyIfTriggered) {
|
|
549
|
+
this._hasNotified = true;
|
|
550
|
+
this._lastNotifiedValue = eventData;
|
|
551
|
+
}
|
|
474
552
|
for (const observer of this._observers.slice()) {
|
|
475
553
|
observer(eventData);
|
|
476
554
|
}
|
|
@@ -480,6 +558,19 @@ class Observable {
|
|
|
480
558
|
}
|
|
481
559
|
clear() {
|
|
482
560
|
this._observers = [];
|
|
561
|
+
this._onObserverAdded = void 0;
|
|
562
|
+
this.cleanLastNotifiedState();
|
|
563
|
+
}
|
|
564
|
+
cleanLastNotifiedState() {
|
|
565
|
+
this._hasNotified = false;
|
|
566
|
+
this._lastNotifiedValue = void 0;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
async function runLateWork(work) {
|
|
570
|
+
try {
|
|
571
|
+
await work();
|
|
572
|
+
} catch (error) {
|
|
573
|
+
Logger.Error(`Late engine work failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
483
574
|
}
|
|
484
575
|
}
|
|
485
576
|
class AbstractEngine {
|
|
@@ -497,7 +588,8 @@ class AbstractEngine {
|
|
|
497
588
|
__publicField(this, "_scenes", []);
|
|
498
589
|
__publicField(this, "_loopCallbacks", []);
|
|
499
590
|
__publicField(this, "_initialized", false);
|
|
500
|
-
__publicField(this, "
|
|
591
|
+
__publicField(this, "_startupComplete", false);
|
|
592
|
+
__publicField(this, "_startPromise", null);
|
|
501
593
|
/** @internal Active `requestAnimationFrame` id for the scene-less loop, if any. */
|
|
502
594
|
__publicField(this, "_rafId", null);
|
|
503
595
|
/**
|
|
@@ -518,10 +610,9 @@ class AbstractEngine {
|
|
|
518
610
|
/** @internal Deferred startup work (thunks) awaited before the engine starts — e.g. sprite-atlas loads. */
|
|
519
611
|
__publicField(this, "_startupWork", []);
|
|
520
612
|
/**
|
|
521
|
-
* @internal Deferred work awaited
|
|
522
|
-
*
|
|
523
|
-
*
|
|
524
|
-
* registered (Babylon Lite's `registerUtilityLayer` ordering).
|
|
613
|
+
* @internal Deferred work awaited after the main engine renders its first frame
|
|
614
|
+
* — e.g. utility-layer registration, which must follow the main scene but must
|
|
615
|
+
* not block engine startup.
|
|
525
616
|
*/
|
|
526
617
|
__publicField(this, "_lateWork", []);
|
|
527
618
|
this._canvas = canvas;
|
|
@@ -668,8 +759,12 @@ class AbstractEngine {
|
|
|
668
759
|
_registerStartupWork(work) {
|
|
669
760
|
this._startupWork.push(work);
|
|
670
761
|
}
|
|
671
|
-
/** @internal Register
|
|
762
|
+
/** @internal Register work that must run after the main scene is rendering. */
|
|
672
763
|
_registerLateWork(work) {
|
|
764
|
+
if (this._startupComplete) {
|
|
765
|
+
void runLateWork(work);
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
673
768
|
this._lateWork.push(work);
|
|
674
769
|
}
|
|
675
770
|
/** @internal Scenes register themselves on construction. */
|
|
@@ -733,13 +828,48 @@ class AbstractEngine {
|
|
|
733
828
|
endFrame() {
|
|
734
829
|
return unsupported("WebGPUEngine.endFrame", "Babylon Lite's frame graph owns the frame loop; drive rendering with `runRenderLoop`.");
|
|
735
830
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
831
|
+
/**
|
|
832
|
+
* Babylon.js `engine.currentSampleCount` — the MSAA sample count of the current render target.
|
|
833
|
+
* Babylon Lite manages MSAA internally and exposes no public sample-count accessor, so this
|
|
834
|
+
* needs a tree-shakeable Lite core addition before it can report a real value.
|
|
835
|
+
*/
|
|
836
|
+
get currentSampleCount() {
|
|
837
|
+
return unsupported("AbstractEngine.currentSampleCount", "Babylon Lite manages MSAA internally and exposes no public sample-count accessor.");
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* Babylon.js `engine.getAlphaToCoverage()` — alpha-to-coverage state. Babylon Lite does not
|
|
841
|
+
* expose an engine-level alpha-to-coverage toggle, so this is unsupported.
|
|
842
|
+
*/
|
|
843
|
+
getAlphaToCoverage() {
|
|
844
|
+
return unsupported("AbstractEngine.getAlphaToCoverage", "Babylon Lite does not expose an engine-level alpha-to-coverage toggle.");
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Babylon.js `engine.setAlphaToCoverage(enable)` — toggle alpha-to-coverage. Babylon Lite does
|
|
848
|
+
* not expose an engine-level alpha-to-coverage toggle, so this is unsupported.
|
|
849
|
+
*/
|
|
850
|
+
setAlphaToCoverage(_enable) {
|
|
851
|
+
return unsupported("AbstractEngine.setAlphaToCoverage", "Babylon Lite does not expose an engine-level alpha-to-coverage toggle.");
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* Babylon.js `engine.updateTextureArrayLayerFromImageSource(texture, source, layer, invertY, premultiplyAlpha)`
|
|
855
|
+
* — the engine extension that uploads a decoded image source into one layer of a 2D array
|
|
856
|
+
* texture. Forwards to Babylon Lite's `uploadImageToArrayLayer`.
|
|
857
|
+
*
|
|
858
|
+
* Babylon.js passes an `InternalTexture`; the compat layer's equivalent handle is the Lite
|
|
859
|
+
* `Texture2DArray` returned by `RawTexture2DArray.getInternalTexture()`, so ported code that
|
|
860
|
+
* goes through `UploadImageToTexture2DArrayLayer` (which is exactly what Babylon.js's helper
|
|
861
|
+
* does) works unchanged.
|
|
862
|
+
*/
|
|
863
|
+
updateTextureArrayLayerFromImageSource(texture, source, layer, invertY = false, premultiplyAlpha = false) {
|
|
864
|
+
uploadImageToArrayLayer(this._lite, texture, layer, source, { invertY, premultiplyAlpha });
|
|
865
|
+
}
|
|
866
|
+
_start() {
|
|
867
|
+
this._startPromise ?? (this._startPromise = this._startCore());
|
|
868
|
+
return this._startPromise;
|
|
869
|
+
}
|
|
870
|
+
async _startCore() {
|
|
741
871
|
if (this._startupWork.length > 0) {
|
|
742
|
-
await Promise.all(this._startupWork.map((
|
|
872
|
+
await Promise.all(this._startupWork.map((w2) => w2()));
|
|
743
873
|
this._startupWork.length = 0;
|
|
744
874
|
}
|
|
745
875
|
for (const scene of this._scenes) {
|
|
@@ -750,17 +880,19 @@ class AbstractEngine {
|
|
|
750
880
|
scene._flushPendingAdds();
|
|
751
881
|
scene._buildMorphTargets();
|
|
752
882
|
await scene._loadPendingEnvironment();
|
|
883
|
+
await enableMirroredMeshes(scene._lite);
|
|
753
884
|
if (scene._hasShadows()) {
|
|
754
885
|
await registerSceneWithShadowSupport(scene._lite);
|
|
755
886
|
} else {
|
|
756
887
|
await registerScene(scene._lite);
|
|
757
888
|
}
|
|
758
889
|
}
|
|
890
|
+
await startEngine(this._lite);
|
|
891
|
+
this._startupComplete = true;
|
|
759
892
|
if (this._lateWork.length > 0) {
|
|
760
|
-
await Promise.all(this._lateWork.map(
|
|
893
|
+
await Promise.all(this._lateWork.map(runLateWork));
|
|
761
894
|
this._lateWork.length = 0;
|
|
762
895
|
}
|
|
763
|
-
await startEngine(this._lite);
|
|
764
896
|
}
|
|
765
897
|
_ensureInitialized(api) {
|
|
766
898
|
if (!this._initialized) {
|
|
@@ -821,8 +953,22 @@ class NullEngine extends WebGPUEngine {
|
|
|
821
953
|
}
|
|
822
954
|
class AbstractScene {
|
|
823
955
|
constructor() {
|
|
824
|
-
/**
|
|
825
|
-
|
|
956
|
+
/**
|
|
957
|
+
* @internal Canonical compat mesh-wrapper registry, keyed by the Lite node each
|
|
958
|
+
* wrapper carries. Kept in sync with the Lite-core-owned scene list: a wrapper is
|
|
959
|
+
* registered when its mesh is constructed against the scene and dropped on dispose,
|
|
960
|
+
* mirroring the core `addToScene` / `removeFromScene` it drives. `scene.meshes` is
|
|
961
|
+
* derived from this so **every** compat mesh is enumerable — ordinary primitives
|
|
962
|
+
* (which register straight with the Lite scene) as well as the loader-surfaced
|
|
963
|
+
* Gaussian-Splatting meshes, which the old array only ever held.
|
|
964
|
+
*/
|
|
965
|
+
__publicField(this, "_meshWrappers", /* @__PURE__ */ new Map());
|
|
966
|
+
/** @internal Stable Babylon.js-compatible array returned by `scene.meshes`. */
|
|
967
|
+
__publicField(this, "_meshes", []);
|
|
968
|
+
/** @internal Reused scratch array for reconciling Lite-core mesh order. */
|
|
969
|
+
__publicField(this, "_orderedCoreMeshes", []);
|
|
970
|
+
/** @internal Reused membership set for linear-time mesh-order reconciliation. */
|
|
971
|
+
__publicField(this, "_orderedCoreMeshSet", /* @__PURE__ */ new Set());
|
|
826
972
|
/** @internal Cameras constructed against this scene (`scene.cameras`). */
|
|
827
973
|
__publicField(this, "_cameras", []);
|
|
828
974
|
/** @internal Lights constructed against this scene (`scene.lights`). */
|
|
@@ -831,13 +977,45 @@ class AbstractScene {
|
|
|
831
977
|
__publicField(this, "_materials", []);
|
|
832
978
|
}
|
|
833
979
|
/**
|
|
834
|
-
*
|
|
835
|
-
*
|
|
836
|
-
*
|
|
837
|
-
*
|
|
980
|
+
* @internal The Lite-core-owned mesh list backing `scene.meshes`. The concrete
|
|
981
|
+
* {@link Scene} overrides this to return its Lite `SceneContext.meshes` (the
|
|
982
|
+
* authoritative list); the abstract base owns no Lite scene, so it returns none.
|
|
983
|
+
* Returning the core meshes directly is not an option (they are Lite `Mesh`
|
|
984
|
+
* objects, not compat wrappers) — they only provide the authoritative membership
|
|
985
|
+
* and order that {@link meshes} maps back onto canonical wrappers.
|
|
986
|
+
*/
|
|
987
|
+
_coreMeshList() {
|
|
988
|
+
return [];
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* Babylon.js `scene.meshes` — the compat mesh wrappers in the scene. Backed by the
|
|
992
|
+
* canonical {@link _meshWrappers} registry and kept in sync with the Lite-core-owned
|
|
993
|
+
* list: the core list ({@link _coreMeshList}) supplies authoritative membership and
|
|
994
|
+
* ordering, mapped back to each mesh's canonical wrapper so the returned handles are
|
|
995
|
+
* the right type and keep wrapper identity. Wrappers not yet mirrored into the core
|
|
996
|
+
* list (transform-only loader roots, primitives whose scene-add is deferred to engine
|
|
997
|
+
* start, and Gaussian-Splatting meshes that register their renderables outside
|
|
998
|
+
* `scene.meshes`) retain their registration positions.
|
|
838
999
|
*/
|
|
839
1000
|
get meshes() {
|
|
840
|
-
|
|
1001
|
+
const orderedCore = this._orderedCoreMeshes;
|
|
1002
|
+
const orderedCoreSet = this._orderedCoreMeshSet;
|
|
1003
|
+
orderedCore.length = 0;
|
|
1004
|
+
orderedCoreSet.clear();
|
|
1005
|
+
for (const core of this._coreMeshList()) {
|
|
1006
|
+
const wrapper = this._meshWrappers.get(core);
|
|
1007
|
+
if (wrapper && !orderedCoreSet.has(wrapper)) {
|
|
1008
|
+
orderedCore.push(wrapper);
|
|
1009
|
+
orderedCoreSet.add(wrapper);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
let orderedIndex = 0;
|
|
1013
|
+
for (let i2 = 0; i2 < this._meshes.length; i2++) {
|
|
1014
|
+
if (orderedCoreSet.has(this._meshes[i2])) {
|
|
1015
|
+
this._meshes[i2] = orderedCore[orderedIndex++];
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
return this._meshes;
|
|
841
1019
|
}
|
|
842
1020
|
/** Babylon.js `scene.cameras` — every camera constructed against this scene. */
|
|
843
1021
|
get cameras() {
|
|
@@ -851,10 +1029,22 @@ class AbstractScene {
|
|
|
851
1029
|
get materials() {
|
|
852
1030
|
return this._materials;
|
|
853
1031
|
}
|
|
854
|
-
/**
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
1032
|
+
/**
|
|
1033
|
+
* @internal Register a compat mesh wrapper so it appears in `scene.meshes`. Keyed
|
|
1034
|
+
* by the Lite node the wrapper carries (`liteKey`) so it can be reconciled with the
|
|
1035
|
+
* core-owned list — pass an `AbstractMesh`'s `_lite`; loader-surfaced meshes whose
|
|
1036
|
+
* Lite node is not a core scene mesh (Gaussian Splatting) key by the wrapper itself.
|
|
1037
|
+
*/
|
|
1038
|
+
_registerMesh(mesh, liteKey = mesh) {
|
|
1039
|
+
const registered = this._meshWrappers.get(liteKey);
|
|
1040
|
+
if (registered && registered !== mesh) {
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
1043
|
+
if (!registered) {
|
|
1044
|
+
this._meshWrappers.set(liteKey, mesh);
|
|
1045
|
+
}
|
|
1046
|
+
if (!this._meshes.includes(mesh)) {
|
|
1047
|
+
this._meshes.push(mesh);
|
|
858
1048
|
}
|
|
859
1049
|
}
|
|
860
1050
|
/** @internal Register a camera so it appears in `scene.cameras`. */
|
|
@@ -885,9 +1075,14 @@ class AbstractScene {
|
|
|
885
1075
|
if (li !== -1) {
|
|
886
1076
|
this._lights.splice(li, 1);
|
|
887
1077
|
}
|
|
888
|
-
const
|
|
1078
|
+
for (const [key, wrapper] of this._meshWrappers) {
|
|
1079
|
+
if (wrapper === node) {
|
|
1080
|
+
this._meshWrappers.delete(key);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
const mi = this._meshes.indexOf(node);
|
|
889
1084
|
if (mi !== -1) {
|
|
890
|
-
this.
|
|
1085
|
+
this._meshes.splice(mi, 1);
|
|
891
1086
|
}
|
|
892
1087
|
}
|
|
893
1088
|
/** @internal Remove a material from `scene.materials` on dispose. */
|
|
@@ -922,30 +1117,29 @@ class AbstractScene {
|
|
|
922
1117
|
return this._materials.find((m2) => m2.id === id) ?? null;
|
|
923
1118
|
}
|
|
924
1119
|
/**
|
|
925
|
-
* Babylon.js `scene.getMeshByName(name)
|
|
926
|
-
*
|
|
927
|
-
* (
|
|
928
|
-
* when not found, matching Babylon.js.
|
|
1120
|
+
* Babylon.js `scene.getMeshByName(name)` — first mesh in {@link meshes} with a
|
|
1121
|
+
* matching name, else `null`. Enumerates the full canonical mesh registry
|
|
1122
|
+
* (primitives + loader-surfaced meshes), not just the loader-surfaced subset.
|
|
929
1123
|
*/
|
|
930
1124
|
getMeshByName(name) {
|
|
931
|
-
return this.
|
|
1125
|
+
return this.meshes.find((m2) => m2.name === name) ?? null;
|
|
932
1126
|
}
|
|
933
|
-
/** Babylon.js `scene.getMeshById(id)` — first
|
|
1127
|
+
/** Babylon.js `scene.getMeshById(id)` — first mesh whose `id` matches, else `null`. */
|
|
934
1128
|
getMeshById(id) {
|
|
935
|
-
return this.
|
|
1129
|
+
return this.meshes.find((m2) => m2.id === id) ?? null;
|
|
936
1130
|
}
|
|
937
1131
|
/** Babylon.js legacy `scene.getMeshByID(id)` — alias of {@link getMeshById}. */
|
|
938
1132
|
getMeshByID(id) {
|
|
939
1133
|
return this.getMeshById(id);
|
|
940
1134
|
}
|
|
941
|
-
/** Babylon.js `scene.getNodeByName(name)` — searches
|
|
1135
|
+
/** Babylon.js `scene.getNodeByName(name)` — searches meshes, cameras, and lights. */
|
|
942
1136
|
getNodeByName(name) {
|
|
943
|
-
return this.
|
|
1137
|
+
return this.meshes.find((m2) => m2.name === name) ?? this._cameras.find((c2) => c2.name === name) ?? this._lights.find((l) => l.name === name) ?? null;
|
|
944
1138
|
}
|
|
945
|
-
/** Babylon.js `scene.getNodeById(id)` — searches
|
|
1139
|
+
/** Babylon.js `scene.getNodeById(id)` — searches meshes, cameras, and lights by `id`. */
|
|
946
1140
|
getNodeById(id) {
|
|
947
1141
|
const byId = (n2) => n2.id === id;
|
|
948
|
-
return this.
|
|
1142
|
+
return this.meshes.find((m2) => byId(m2)) ?? this._cameras.find((c2) => byId(c2)) ?? this._lights.find((l) => byId(l)) ?? null;
|
|
949
1143
|
}
|
|
950
1144
|
}
|
|
951
1145
|
var PhysicsShapeType = /* @__PURE__ */ ((PhysicsShapeType2) => {
|
|
@@ -1137,9 +1331,9 @@ class Camera extends Node {
|
|
|
1137
1331
|
_aspectRatio() {
|
|
1138
1332
|
const scene = this._scene;
|
|
1139
1333
|
const canvas = scene == null ? void 0 : scene.getEngine().getRenderingCanvas();
|
|
1140
|
-
const
|
|
1334
|
+
const w2 = (canvas == null ? void 0 : canvas.width) ?? 1;
|
|
1141
1335
|
const h2 = (canvas == null ? void 0 : canvas.height) ?? 1;
|
|
1142
|
-
return h2 !== 0 ?
|
|
1336
|
+
return h2 !== 0 ? w2 / h2 : 1;
|
|
1143
1337
|
}
|
|
1144
1338
|
detachControl() {
|
|
1145
1339
|
if (this._detach) {
|
|
@@ -1211,6 +1405,34 @@ class ArcRotateCamera extends Camera {
|
|
|
1211
1405
|
set upperRadiusLimit(value) {
|
|
1212
1406
|
this._lite.upperRadiusLimit = value;
|
|
1213
1407
|
}
|
|
1408
|
+
// These input-tuning fields delegate straight through to the underlying Lite
|
|
1409
|
+
// camera so that Babylon.js-style code — which may set them either before or
|
|
1410
|
+
// AFTER attachControl — takes effect. Lite's attachControl reads these live on
|
|
1411
|
+
// every input event, so a post-attach write (as Babylon.js allows) is honored.
|
|
1412
|
+
// Without these accessors a write would land on the wrapper instance and never
|
|
1413
|
+
// reach _lite, leaving zoom/orbit/pan at the Lite defaults (e.g. wheel zoom
|
|
1414
|
+
// running far too fast because a raised wheelPrecision was silently dropped).
|
|
1415
|
+
/** Wheel-zoom sensitivity (HIGHER = slower zoom). Babylon default 3. */
|
|
1416
|
+
get wheelPrecision() {
|
|
1417
|
+
return this._lite.wheelPrecision;
|
|
1418
|
+
}
|
|
1419
|
+
set wheelPrecision(value) {
|
|
1420
|
+
this._lite.wheelPrecision = value;
|
|
1421
|
+
}
|
|
1422
|
+
/** Mouse-drag orbit sensitivity (HIGHER = slower rotation). Babylon default 1000. */
|
|
1423
|
+
get angularSensibility() {
|
|
1424
|
+
return this._lite.angularSensibility;
|
|
1425
|
+
}
|
|
1426
|
+
set angularSensibility(value) {
|
|
1427
|
+
this._lite.angularSensibility = value;
|
|
1428
|
+
}
|
|
1429
|
+
/** Right-drag panning sensitivity in pixels-per-unit (LOWER = faster pan). Babylon default 50. */
|
|
1430
|
+
get panningSensibility() {
|
|
1431
|
+
return this._lite.panningSensibility;
|
|
1432
|
+
}
|
|
1433
|
+
set panningSensibility(value) {
|
|
1434
|
+
this._lite.panningSensibility = value;
|
|
1435
|
+
}
|
|
1214
1436
|
attachControl(canvas, _noPreventDefault) {
|
|
1215
1437
|
var _a;
|
|
1216
1438
|
const detach = attachControl(this._lite, canvas, (_a = this._scene) == null ? void 0 : _a._lite);
|
|
@@ -1307,10 +1529,10 @@ class FollowCamera extends TargetCamera {
|
|
|
1307
1529
|
return;
|
|
1308
1530
|
}
|
|
1309
1531
|
const radians = this.rotationOffset * Math.PI / 180;
|
|
1310
|
-
const
|
|
1311
|
-
const
|
|
1312
|
-
const
|
|
1313
|
-
this._lite.position.set(
|
|
1532
|
+
const x2 = target.position.x + this.radius * Math.sin(radians);
|
|
1533
|
+
const z2 = target.position.z + this.radius * Math.cos(radians);
|
|
1534
|
+
const y2 = target.position.y + this.heightOffset;
|
|
1535
|
+
this._lite.position.set(x2, y2, z2);
|
|
1314
1536
|
this.setTarget(new Vector3(target.position.x, target.position.y, target.position.z));
|
|
1315
1537
|
}
|
|
1316
1538
|
}
|
|
@@ -1376,533 +1598,6 @@ class AnaglyphArcRotateCamera {
|
|
|
1376
1598
|
unsupported("AnaglyphArcRotateCamera", "Stereoscopic camera rigs are not implemented in Babylon Lite. (An anaglyph post-process exists separately.)");
|
|
1377
1599
|
}
|
|
1378
1600
|
}
|
|
1379
|
-
class Material {
|
|
1380
|
-
constructor(name, scene) {
|
|
1381
|
-
__publicField(this, "name");
|
|
1382
|
-
/** Common transparency mode flag (Babylon.js `Material.transparencyMode`). */
|
|
1383
|
-
__publicField(this, "transparencyMode", null);
|
|
1384
|
-
/** Back-face culling toggle (Babylon.js `Material.backFaceCulling`). */
|
|
1385
|
-
__publicField(this, "_backFaceCulling", true);
|
|
1386
|
-
/** Wireframe rendering toggle (not honoured by all Lite materials). */
|
|
1387
|
-
__publicField(this, "wireframe", false);
|
|
1388
|
-
/** @internal Owning compat scene, when constructed against one. */
|
|
1389
|
-
__publicField(this, "_scene");
|
|
1390
|
-
this.name = name;
|
|
1391
|
-
this._scene = scene;
|
|
1392
|
-
scene == null ? void 0 : scene._registerMaterial(this);
|
|
1393
|
-
}
|
|
1394
|
-
get backFaceCulling() {
|
|
1395
|
-
return this._backFaceCulling;
|
|
1396
|
-
}
|
|
1397
|
-
set backFaceCulling(value) {
|
|
1398
|
-
this._backFaceCulling = value;
|
|
1399
|
-
this._applyBackFaceCulling(value);
|
|
1400
|
-
this._markDirty();
|
|
1401
|
-
}
|
|
1402
|
-
/** @internal Per-material hook to push culling onto the Lite props (Standard vs PBR differ). */
|
|
1403
|
-
_applyBackFaceCulling(_value) {
|
|
1404
|
-
}
|
|
1405
|
-
getClassName() {
|
|
1406
|
-
return "Material";
|
|
1407
|
-
}
|
|
1408
|
-
_markDirty() {
|
|
1409
|
-
markMaterialUboDirty(this._lite);
|
|
1410
|
-
}
|
|
1411
|
-
/**
|
|
1412
|
-
* @internal Finalize GPU-facing resources before the mesh is registered.
|
|
1413
|
-
* Base materials need nothing; PBR overrides this to synthesize the solid
|
|
1414
|
-
* textures Babylon Lite's PBR pipeline requires from factor-only materials.
|
|
1415
|
-
*/
|
|
1416
|
-
_ensureRenderable(_engine) {
|
|
1417
|
-
}
|
|
1418
|
-
dispose() {
|
|
1419
|
-
var _a;
|
|
1420
|
-
(_a = this._scene) == null ? void 0 : _a._unregisterMaterial(this);
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
class PushMaterial extends Material {
|
|
1424
|
-
getClassName() {
|
|
1425
|
-
return "PushMaterial";
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
function readColor3(tuple) {
|
|
1429
|
-
return tuple ? new Color3(tuple[0], tuple[1], tuple[2]) : new Color3(0, 0, 0);
|
|
1430
|
-
}
|
|
1431
|
-
class StandardMaterial extends PushMaterial {
|
|
1432
|
-
constructor(name, scene) {
|
|
1433
|
-
super(name, scene);
|
|
1434
|
-
/** @internal Underlying Babylon Lite standard-material props. */
|
|
1435
|
-
__publicField(this, "_lite");
|
|
1436
|
-
/**
|
|
1437
|
-
* Babylon.js `StandardMaterial.useAlphaFromDiffuseTexture`. Babylon Lite's
|
|
1438
|
-
* alpha test already samples the diffuse texture's alpha (enabled via
|
|
1439
|
-
* `alphaCutOff`), so this is accepted for parity.
|
|
1440
|
-
*/
|
|
1441
|
-
__publicField(this, "useAlphaFromDiffuseTexture", false);
|
|
1442
|
-
__publicField(this, "_diffuseTexture", null);
|
|
1443
|
-
__publicField(this, "_bumpTexture", null);
|
|
1444
|
-
__publicField(this, "_emissiveTexture", null);
|
|
1445
|
-
this._lite = createStandardMaterial();
|
|
1446
|
-
}
|
|
1447
|
-
getClassName() {
|
|
1448
|
-
return "StandardMaterial";
|
|
1449
|
-
}
|
|
1450
|
-
get diffuseColor() {
|
|
1451
|
-
return readColor3(this._lite.diffuseColor);
|
|
1452
|
-
}
|
|
1453
|
-
set diffuseColor(value) {
|
|
1454
|
-
this._lite.diffuseColor = [value.r, value.g, value.b];
|
|
1455
|
-
this._markDirty();
|
|
1456
|
-
}
|
|
1457
|
-
get specularColor() {
|
|
1458
|
-
return readColor3(this._lite.specularColor);
|
|
1459
|
-
}
|
|
1460
|
-
set specularColor(value) {
|
|
1461
|
-
this._lite.specularColor = [value.r, value.g, value.b];
|
|
1462
|
-
this._markDirty();
|
|
1463
|
-
}
|
|
1464
|
-
get emissiveColor() {
|
|
1465
|
-
return readColor3(this._lite.emissiveColor);
|
|
1466
|
-
}
|
|
1467
|
-
set emissiveColor(value) {
|
|
1468
|
-
this._lite.emissiveColor = [value.r, value.g, value.b];
|
|
1469
|
-
this._markDirty();
|
|
1470
|
-
}
|
|
1471
|
-
get ambientColor() {
|
|
1472
|
-
return readColor3(this._lite.ambientColor);
|
|
1473
|
-
}
|
|
1474
|
-
set ambientColor(value) {
|
|
1475
|
-
this._lite.ambientColor = [value.r, value.g, value.b];
|
|
1476
|
-
this._markDirty();
|
|
1477
|
-
}
|
|
1478
|
-
get disableLighting() {
|
|
1479
|
-
return this._lite.disableLighting;
|
|
1480
|
-
}
|
|
1481
|
-
set disableLighting(value) {
|
|
1482
|
-
this._lite.disableLighting = value;
|
|
1483
|
-
this._markDirty();
|
|
1484
|
-
}
|
|
1485
|
-
_applyBackFaceCulling(value) {
|
|
1486
|
-
this._lite.backFaceCulling = value;
|
|
1487
|
-
}
|
|
1488
|
-
get alpha() {
|
|
1489
|
-
return this._lite.alpha;
|
|
1490
|
-
}
|
|
1491
|
-
set alpha(value) {
|
|
1492
|
-
this._lite.alpha = value;
|
|
1493
|
-
this._markDirty();
|
|
1494
|
-
}
|
|
1495
|
-
get diffuseTexture() {
|
|
1496
|
-
return this._diffuseTexture;
|
|
1497
|
-
}
|
|
1498
|
-
set diffuseTexture(texture) {
|
|
1499
|
-
this._diffuseTexture = texture;
|
|
1500
|
-
this._lite.diffuseTexture = (texture == null ? void 0 : texture._lite) ?? null;
|
|
1501
|
-
this._markDirty();
|
|
1502
|
-
}
|
|
1503
|
-
/**
|
|
1504
|
-
* Babylon.js `StandardMaterial.alphaCutOff` — alpha-test threshold. Fragments
|
|
1505
|
-
* whose diffuse-texture alpha is below this value are discarded. Babylon Lite's
|
|
1506
|
-
* Standard pipeline alpha-tests against the diffuse texture's alpha when
|
|
1507
|
-
* `alphaCutOff > 0`, so this is wired directly.
|
|
1508
|
-
*/
|
|
1509
|
-
get alphaCutOff() {
|
|
1510
|
-
return this._lite.alphaCutOff;
|
|
1511
|
-
}
|
|
1512
|
-
set alphaCutOff(value) {
|
|
1513
|
-
this._lite.alphaCutOff = value;
|
|
1514
|
-
this._markDirty();
|
|
1515
|
-
}
|
|
1516
|
-
get bumpTexture() {
|
|
1517
|
-
return this._bumpTexture;
|
|
1518
|
-
}
|
|
1519
|
-
set bumpTexture(texture) {
|
|
1520
|
-
this._bumpTexture = texture;
|
|
1521
|
-
this._lite.bumpTexture = (texture == null ? void 0 : texture._lite) ?? null;
|
|
1522
|
-
this._markDirty();
|
|
1523
|
-
}
|
|
1524
|
-
get emissiveTexture() {
|
|
1525
|
-
return this._emissiveTexture;
|
|
1526
|
-
}
|
|
1527
|
-
set emissiveTexture(texture) {
|
|
1528
|
-
this._emissiveTexture = texture;
|
|
1529
|
-
this._lite.emissiveTexture = (texture == null ? void 0 : texture._lite) ?? null;
|
|
1530
|
-
this._markDirty();
|
|
1531
|
-
}
|
|
1532
|
-
/**
|
|
1533
|
-
* @internal Re-bind texture maps to the Lite material. Babylon.js `Texture`s
|
|
1534
|
-
* load asynchronously, so when `material.diffuseTexture = new Texture(url)` ran
|
|
1535
|
-
* the Lite handle was still undefined. By engine-start the scene has awaited the
|
|
1536
|
-
* loads, so copy the now-resolved handles (and UV tiling) onto the Lite props.
|
|
1537
|
-
*/
|
|
1538
|
-
_ensureRenderable(_engine) {
|
|
1539
|
-
const diff = this._diffuseTexture;
|
|
1540
|
-
if (diff == null ? void 0 : diff._lite) {
|
|
1541
|
-
this._lite.diffuseTexture = diff._lite;
|
|
1542
|
-
if (diff.uScale !== void 0 && diff.vScale !== void 0) {
|
|
1543
|
-
this._lite.uvScale = [diff.uScale, diff.vScale];
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
const bump = this._bumpTexture;
|
|
1547
|
-
if (bump == null ? void 0 : bump._lite) {
|
|
1548
|
-
this._lite.bumpTexture = bump._lite;
|
|
1549
|
-
}
|
|
1550
|
-
const emissive = this._emissiveTexture;
|
|
1551
|
-
if (emissive == null ? void 0 : emissive._lite) {
|
|
1552
|
-
this._lite.emissiveTexture = emissive._lite;
|
|
1553
|
-
}
|
|
1554
|
-
this._markDirty();
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
class PBRClearCoatConfiguration {
|
|
1558
|
-
constructor(_props, _markDirty) {
|
|
1559
|
-
this._props = _props;
|
|
1560
|
-
this._markDirty = _markDirty;
|
|
1561
|
-
}
|
|
1562
|
-
get isEnabled() {
|
|
1563
|
-
return this._props.isEnabled ?? false;
|
|
1564
|
-
}
|
|
1565
|
-
set isEnabled(value) {
|
|
1566
|
-
this._props.isEnabled = value;
|
|
1567
|
-
this._markDirty();
|
|
1568
|
-
}
|
|
1569
|
-
get intensity() {
|
|
1570
|
-
return this._props.intensity ?? 1;
|
|
1571
|
-
}
|
|
1572
|
-
set intensity(value) {
|
|
1573
|
-
this._props.intensity = value;
|
|
1574
|
-
this._markDirty();
|
|
1575
|
-
}
|
|
1576
|
-
get roughness() {
|
|
1577
|
-
return this._props.roughness ?? 0;
|
|
1578
|
-
}
|
|
1579
|
-
set roughness(value) {
|
|
1580
|
-
this._props.roughness = value;
|
|
1581
|
-
this._markDirty();
|
|
1582
|
-
}
|
|
1583
|
-
get indexOfRefraction() {
|
|
1584
|
-
return this._props.indexOfRefraction ?? 1.5;
|
|
1585
|
-
}
|
|
1586
|
-
set indexOfRefraction(value) {
|
|
1587
|
-
this._props.indexOfRefraction = value;
|
|
1588
|
-
this._markDirty();
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
class PBRSheenConfiguration {
|
|
1592
|
-
constructor(_props, _markDirty) {
|
|
1593
|
-
this._props = _props;
|
|
1594
|
-
this._markDirty = _markDirty;
|
|
1595
|
-
}
|
|
1596
|
-
get isEnabled() {
|
|
1597
|
-
return this._props.isEnabled;
|
|
1598
|
-
}
|
|
1599
|
-
set isEnabled(value) {
|
|
1600
|
-
this._props.isEnabled = value;
|
|
1601
|
-
this._markDirty();
|
|
1602
|
-
}
|
|
1603
|
-
get intensity() {
|
|
1604
|
-
return this._props.intensity ?? 1;
|
|
1605
|
-
}
|
|
1606
|
-
set intensity(value) {
|
|
1607
|
-
this._props.intensity = value;
|
|
1608
|
-
this._markDirty();
|
|
1609
|
-
}
|
|
1610
|
-
get roughness() {
|
|
1611
|
-
return this._props.roughness ?? 0;
|
|
1612
|
-
}
|
|
1613
|
-
set roughness(value) {
|
|
1614
|
-
this._props.roughness = value;
|
|
1615
|
-
this._markDirty();
|
|
1616
|
-
}
|
|
1617
|
-
get color() {
|
|
1618
|
-
const c2 = this._props.color ?? [1, 1, 1];
|
|
1619
|
-
return new Color3(c2[0], c2[1], c2[2]);
|
|
1620
|
-
}
|
|
1621
|
-
set color(value) {
|
|
1622
|
-
this._props.color = [value.r, value.g, value.b];
|
|
1623
|
-
this._markDirty();
|
|
1624
|
-
}
|
|
1625
|
-
/** Babylon.js `sheen.texture`. Binds the Lite handle if the texture has resolved. */
|
|
1626
|
-
set texture(value) {
|
|
1627
|
-
if (value == null ? void 0 : value._lite) {
|
|
1628
|
-
this._props.texture = value._lite;
|
|
1629
|
-
this._markDirty();
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
class PBRAnisotropicConfiguration {
|
|
1634
|
-
constructor(_props, _markDirty) {
|
|
1635
|
-
this._props = _props;
|
|
1636
|
-
this._markDirty = _markDirty;
|
|
1637
|
-
}
|
|
1638
|
-
get isEnabled() {
|
|
1639
|
-
return this._props.isEnabled;
|
|
1640
|
-
}
|
|
1641
|
-
set isEnabled(value) {
|
|
1642
|
-
this._props.isEnabled = value;
|
|
1643
|
-
this._markDirty();
|
|
1644
|
-
}
|
|
1645
|
-
get intensity() {
|
|
1646
|
-
return this._props.intensity ?? 1;
|
|
1647
|
-
}
|
|
1648
|
-
set intensity(value) {
|
|
1649
|
-
this._props.intensity = value;
|
|
1650
|
-
this._markDirty();
|
|
1651
|
-
}
|
|
1652
|
-
get direction() {
|
|
1653
|
-
const d2 = this._props.direction ?? [1, 0];
|
|
1654
|
-
return { x: d2[0], y: d2[1] };
|
|
1655
|
-
}
|
|
1656
|
-
set direction(value) {
|
|
1657
|
-
this._props.direction = [value.x, value.y];
|
|
1658
|
-
this._markDirty();
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
class PBRIridescenceConfiguration {
|
|
1662
|
-
constructor(_props, _markDirty) {
|
|
1663
|
-
this._props = _props;
|
|
1664
|
-
this._markDirty = _markDirty;
|
|
1665
|
-
}
|
|
1666
|
-
get isEnabled() {
|
|
1667
|
-
return this._props.isEnabled ?? false;
|
|
1668
|
-
}
|
|
1669
|
-
set isEnabled(value) {
|
|
1670
|
-
this._props.isEnabled = value;
|
|
1671
|
-
this._markDirty();
|
|
1672
|
-
}
|
|
1673
|
-
get intensity() {
|
|
1674
|
-
return this._props.intensity ?? 1;
|
|
1675
|
-
}
|
|
1676
|
-
set intensity(value) {
|
|
1677
|
-
this._props.intensity = value;
|
|
1678
|
-
this._markDirty();
|
|
1679
|
-
}
|
|
1680
|
-
get indexOfRefraction() {
|
|
1681
|
-
return this._props.indexOfRefraction ?? 1.3;
|
|
1682
|
-
}
|
|
1683
|
-
set indexOfRefraction(value) {
|
|
1684
|
-
this._props.indexOfRefraction = value;
|
|
1685
|
-
this._markDirty();
|
|
1686
|
-
}
|
|
1687
|
-
get minimumThickness() {
|
|
1688
|
-
return this._props.minimumThickness ?? 100;
|
|
1689
|
-
}
|
|
1690
|
-
set minimumThickness(value) {
|
|
1691
|
-
this._props.minimumThickness = value;
|
|
1692
|
-
this._markDirty();
|
|
1693
|
-
}
|
|
1694
|
-
get maximumThickness() {
|
|
1695
|
-
return this._props.maximumThickness ?? 400;
|
|
1696
|
-
}
|
|
1697
|
-
set maximumThickness(value) {
|
|
1698
|
-
this._props.maximumThickness = value;
|
|
1699
|
-
this._markDirty();
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
class PBRMaterial extends PushMaterial {
|
|
1703
|
-
constructor(name, scene) {
|
|
1704
|
-
super(name, scene);
|
|
1705
|
-
/** @internal Underlying Babylon Lite PBR-material props. */
|
|
1706
|
-
__publicField(this, "_lite");
|
|
1707
|
-
__publicField(this, "_albedoTexture", null);
|
|
1708
|
-
/**
|
|
1709
|
-
* Babylon.js `material.forceIrradianceInFragment`. Babylon Lite computes
|
|
1710
|
-
* irradiance in the fragment stage already, so this is accepted for parity.
|
|
1711
|
-
*/
|
|
1712
|
-
__publicField(this, "forceIrradianceInFragment", false);
|
|
1713
|
-
__publicField(this, "_clearCoat");
|
|
1714
|
-
__publicField(this, "_sheen");
|
|
1715
|
-
__publicField(this, "_anisotropy");
|
|
1716
|
-
__publicField(this, "_iridescence");
|
|
1717
|
-
this._lite = createPbrMaterial();
|
|
1718
|
-
if (!this._lite.baseColorFactor) {
|
|
1719
|
-
this._lite.baseColorFactor = [1, 1, 1, 1];
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
getClassName() {
|
|
1723
|
-
return "PBRMaterial";
|
|
1724
|
-
}
|
|
1725
|
-
get albedoColor() {
|
|
1726
|
-
const f2 = this._lite.baseColorFactor;
|
|
1727
|
-
return f2 ? new Color3(f2[0], f2[1], f2[2]) : new Color3(1, 1, 1);
|
|
1728
|
-
}
|
|
1729
|
-
set albedoColor(value) {
|
|
1730
|
-
const f2 = this._lite.baseColorFactor ?? [1, 1, 1, 1];
|
|
1731
|
-
this._lite.baseColorFactor = [value.r, value.g, value.b, f2[3]];
|
|
1732
|
-
this._markDirty();
|
|
1733
|
-
}
|
|
1734
|
-
/**
|
|
1735
|
-
* Babylon.js `pbr.albedoTexture` (glTF base-color map). The texture loads
|
|
1736
|
-
* asynchronously, so the resolved Lite handle (+ sRGB flag) is bound in
|
|
1737
|
-
* {@link _ensureRenderable} at engine start rather than here.
|
|
1738
|
-
*/
|
|
1739
|
-
get albedoTexture() {
|
|
1740
|
-
return this._albedoTexture;
|
|
1741
|
-
}
|
|
1742
|
-
set albedoTexture(texture) {
|
|
1743
|
-
this._albedoTexture = texture;
|
|
1744
|
-
this._markDirty();
|
|
1745
|
-
}
|
|
1746
|
-
get metallic() {
|
|
1747
|
-
return this._lite.metallicFactor ?? 1;
|
|
1748
|
-
}
|
|
1749
|
-
set metallic(value) {
|
|
1750
|
-
this._lite.metallicFactor = value;
|
|
1751
|
-
this._markDirty();
|
|
1752
|
-
}
|
|
1753
|
-
get roughness() {
|
|
1754
|
-
return this._lite.roughnessFactor ?? 1;
|
|
1755
|
-
}
|
|
1756
|
-
set roughness(value) {
|
|
1757
|
-
this._lite.roughnessFactor = value;
|
|
1758
|
-
this._markDirty();
|
|
1759
|
-
}
|
|
1760
|
-
get emissiveColor() {
|
|
1761
|
-
return readColor3(this._lite.emissiveColor);
|
|
1762
|
-
}
|
|
1763
|
-
set emissiveColor(value) {
|
|
1764
|
-
this._lite.emissiveColor = [value.r, value.g, value.b];
|
|
1765
|
-
this._markDirty();
|
|
1766
|
-
}
|
|
1767
|
-
/**
|
|
1768
|
-
* Babylon.js `pbr.usePhysicalLightFalloff`. When false, point/spot lights use
|
|
1769
|
-
* Standard-style linear range falloff instead of physical inverse-square.
|
|
1770
|
-
* Default true (matches Babylon.js PBRMaterial).
|
|
1771
|
-
*/
|
|
1772
|
-
get usePhysicalLightFalloff() {
|
|
1773
|
-
return this._lite.usePhysicalLightFalloff ?? true;
|
|
1774
|
-
}
|
|
1775
|
-
set usePhysicalLightFalloff(value) {
|
|
1776
|
-
this._lite.usePhysicalLightFalloff = value;
|
|
1777
|
-
this._markDirty();
|
|
1778
|
-
}
|
|
1779
|
-
get alpha() {
|
|
1780
|
-
return this._lite.alpha ?? 1;
|
|
1781
|
-
}
|
|
1782
|
-
set alpha(value) {
|
|
1783
|
-
this._lite.alpha = value;
|
|
1784
|
-
this._markDirty();
|
|
1785
|
-
}
|
|
1786
|
-
_applyBackFaceCulling(value) {
|
|
1787
|
-
this._lite.doubleSided = !value;
|
|
1788
|
-
}
|
|
1789
|
-
/**
|
|
1790
|
-
* Babylon.js `pbr.clearCoat` sub-configuration. Lazily allocates the Lite
|
|
1791
|
-
* `clearCoat` props on first access and proxies the common fields
|
|
1792
|
-
* (`isEnabled`, `intensity`, `roughness`, `indexOfRefraction`) onto them.
|
|
1793
|
-
*/
|
|
1794
|
-
get clearCoat() {
|
|
1795
|
-
if (!this._clearCoat) {
|
|
1796
|
-
if (!this._lite.clearCoat) {
|
|
1797
|
-
this._lite.clearCoat = { isEnabled: false };
|
|
1798
|
-
}
|
|
1799
|
-
this._clearCoat = new PBRClearCoatConfiguration(this._lite.clearCoat, () => this._markDirty());
|
|
1800
|
-
}
|
|
1801
|
-
return this._clearCoat;
|
|
1802
|
-
}
|
|
1803
|
-
/** Babylon.js `pbr.sheen` sub-configuration (Lite `SheenProps`). */
|
|
1804
|
-
get sheen() {
|
|
1805
|
-
if (!this._sheen) {
|
|
1806
|
-
if (!this._lite.sheen) {
|
|
1807
|
-
this._lite.sheen = { isEnabled: false };
|
|
1808
|
-
}
|
|
1809
|
-
this._sheen = new PBRSheenConfiguration(this._lite.sheen, () => this._markDirty());
|
|
1810
|
-
}
|
|
1811
|
-
return this._sheen;
|
|
1812
|
-
}
|
|
1813
|
-
/** Babylon.js `pbr.anisotropy` sub-configuration (Lite `AnisotropyProps`). */
|
|
1814
|
-
get anisotropy() {
|
|
1815
|
-
if (!this._anisotropy) {
|
|
1816
|
-
if (!this._lite.anisotropy) {
|
|
1817
|
-
this._lite.anisotropy = { isEnabled: false };
|
|
1818
|
-
}
|
|
1819
|
-
this._anisotropy = new PBRAnisotropicConfiguration(this._lite.anisotropy, () => this._markDirty());
|
|
1820
|
-
}
|
|
1821
|
-
return this._anisotropy;
|
|
1822
|
-
}
|
|
1823
|
-
/** Babylon.js `pbr.iridescence` sub-configuration (Lite `IridescenceProps`). */
|
|
1824
|
-
get iridescence() {
|
|
1825
|
-
if (!this._iridescence) {
|
|
1826
|
-
if (!this._lite.iridescence) {
|
|
1827
|
-
this._lite.iridescence = { isEnabled: false };
|
|
1828
|
-
}
|
|
1829
|
-
this._iridescence = new PBRIridescenceConfiguration(this._lite.iridescence, () => this._markDirty());
|
|
1830
|
-
}
|
|
1831
|
-
return this._iridescence;
|
|
1832
|
-
}
|
|
1833
|
-
/**
|
|
1834
|
-
* Babylon.js `material.environmentTexture` / `reflectionTexture`. Babylon Lite
|
|
1835
|
-
* applies image-based lighting scene-wide rather than per-material, so a cube
|
|
1836
|
-
* environment assigned to a material is routed to the owning scene's
|
|
1837
|
-
* environment (the dominant single-IBL case Babylon.js scenes use).
|
|
1838
|
-
*/
|
|
1839
|
-
get environmentTexture() {
|
|
1840
|
-
var _a;
|
|
1841
|
-
return ((_a = this._scene) == null ? void 0 : _a.environmentTexture) ?? null;
|
|
1842
|
-
}
|
|
1843
|
-
set environmentTexture(value) {
|
|
1844
|
-
if (this._scene) {
|
|
1845
|
-
this._scene.environmentTexture = value;
|
|
1846
|
-
}
|
|
1847
|
-
}
|
|
1848
|
-
get reflectionTexture() {
|
|
1849
|
-
return this.environmentTexture;
|
|
1850
|
-
}
|
|
1851
|
-
set reflectionTexture(value) {
|
|
1852
|
-
this.environmentTexture = value;
|
|
1853
|
-
}
|
|
1854
|
-
/** @internal Bind resolved textures and synthesize the solid textures Babylon Lite's PBR pipeline requires from a factor-only material. */
|
|
1855
|
-
_ensureRenderable(engine) {
|
|
1856
|
-
const lite = this._lite;
|
|
1857
|
-
const albedo = this._albedoTexture;
|
|
1858
|
-
if (albedo == null ? void 0 : albedo._lite) {
|
|
1859
|
-
lite.baseColorTexture = albedo._lite;
|
|
1860
|
-
lite.gammaAlbedo = albedo.gammaSpace ?? true;
|
|
1861
|
-
}
|
|
1862
|
-
if (!lite.baseColorTexture) {
|
|
1863
|
-
const f2 = lite.baseColorFactor ?? [1, 1, 1, 1];
|
|
1864
|
-
lite.baseColorTexture = createSolidTexture2D(engine, f2[0], f2[1], f2[2], f2[3]);
|
|
1865
|
-
lite.baseColorFactor = [1, 1, 1, 1];
|
|
1866
|
-
}
|
|
1867
|
-
if (!lite.ormTexture) {
|
|
1868
|
-
const rough = lite.roughnessFactor ?? 1;
|
|
1869
|
-
const metal = lite.metallicFactor ?? 1;
|
|
1870
|
-
lite.ormTexture = createSolidTexture2D(engine, 1, rough, metal);
|
|
1871
|
-
lite.roughnessFactor = 1;
|
|
1872
|
-
lite.metallicFactor = 1;
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1875
|
-
}
|
|
1876
|
-
class PBRMetallicRoughnessMaterial extends PBRMaterial {
|
|
1877
|
-
getClassName() {
|
|
1878
|
-
return "PBRMetallicRoughnessMaterial";
|
|
1879
|
-
}
|
|
1880
|
-
/** Alias of `albedoColor` (glTF "base color"). */
|
|
1881
|
-
get baseColor() {
|
|
1882
|
-
return this.albedoColor;
|
|
1883
|
-
}
|
|
1884
|
-
set baseColor(value) {
|
|
1885
|
-
this.albedoColor = value;
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
class PBRSpecularGlossinessMaterial extends PBRMaterial {
|
|
1889
|
-
getClassName() {
|
|
1890
|
-
return "PBRSpecularGlossinessMaterial";
|
|
1891
|
-
}
|
|
1892
|
-
get diffuseColor() {
|
|
1893
|
-
return this.albedoColor;
|
|
1894
|
-
}
|
|
1895
|
-
set diffuseColor(value) {
|
|
1896
|
-
this.albedoColor = value;
|
|
1897
|
-
}
|
|
1898
|
-
/** Maps glossiness → (1 - roughness). */
|
|
1899
|
-
get glossiness() {
|
|
1900
|
-
return 1 - this.roughness;
|
|
1901
|
-
}
|
|
1902
|
-
set glossiness(value) {
|
|
1903
|
-
this.roughness = 1 - value;
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
1601
|
const AnimationKeyInterpolation = {
|
|
1907
1602
|
NONE: 0,
|
|
1908
1603
|
STEP: 1
|
|
@@ -1931,7 +1626,7 @@ const _Animation = class _Animation {
|
|
|
1931
1626
|
this.loopMode = loopMode;
|
|
1932
1627
|
}
|
|
1933
1628
|
setKeys(keys) {
|
|
1934
|
-
this._keys = keys.slice().sort((a,
|
|
1629
|
+
this._keys = keys.slice().sort((a, b) => a.frame - b.frame);
|
|
1935
1630
|
}
|
|
1936
1631
|
getKeys() {
|
|
1937
1632
|
return this._keys;
|
|
@@ -1953,13 +1648,13 @@ const _Animation = class _Animation {
|
|
|
1953
1648
|
}
|
|
1954
1649
|
for (let i2 = 0; i2 < keys.length - 1; i2++) {
|
|
1955
1650
|
const a = keys[i2];
|
|
1956
|
-
const
|
|
1957
|
-
if (frame >= a.frame && frame <
|
|
1651
|
+
const b = keys[i2 + 1];
|
|
1652
|
+
if (frame >= a.frame && frame < b.frame) {
|
|
1958
1653
|
if (a.interpolation === AnimationKeyInterpolation.STEP) {
|
|
1959
1654
|
return a.value;
|
|
1960
1655
|
}
|
|
1961
|
-
const t2 = (frame - a.frame) / (
|
|
1962
|
-
return lerpValue(a.value,
|
|
1656
|
+
const t2 = (frame - a.frame) / (b.frame - a.frame);
|
|
1657
|
+
return lerpValue(a.value, b.value, t2);
|
|
1963
1658
|
}
|
|
1964
1659
|
}
|
|
1965
1660
|
return keys[keys.length - 1].value;
|
|
@@ -1983,24 +1678,24 @@ __publicField(_Animation, "ANIMATIONLOOPMODE_RELATIVE", AnimationLoopModes.ANIMA
|
|
|
1983
1678
|
__publicField(_Animation, "ANIMATIONLOOPMODE_CYCLE", AnimationLoopModes.ANIMATIONLOOPMODE_CYCLE);
|
|
1984
1679
|
__publicField(_Animation, "ANIMATIONLOOPMODE_CONSTANT", AnimationLoopModes.ANIMATIONLOOPMODE_CONSTANT);
|
|
1985
1680
|
let Animation = _Animation;
|
|
1986
|
-
function lerpValue(a,
|
|
1987
|
-
if (typeof a === "number" && typeof
|
|
1988
|
-
return a + (
|
|
1681
|
+
function lerpValue(a, b, t2) {
|
|
1682
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
1683
|
+
return a + (b - a) * t2;
|
|
1989
1684
|
}
|
|
1990
1685
|
const av = a;
|
|
1991
|
-
const bv =
|
|
1686
|
+
const bv = b;
|
|
1992
1687
|
return av.map((value, i2) => value + ((bv[i2] ?? value) - value) * t2);
|
|
1993
1688
|
}
|
|
1994
1689
|
function scaleValue(value, scale) {
|
|
1995
|
-
return typeof value === "number" ? value * scale : value.map((
|
|
1690
|
+
return typeof value === "number" ? value * scale : value.map((v2) => v2 * scale);
|
|
1996
1691
|
}
|
|
1997
1692
|
function addValue(acc, value) {
|
|
1998
1693
|
if (typeof acc === "number" && typeof value === "number") {
|
|
1999
1694
|
return acc + value;
|
|
2000
1695
|
}
|
|
2001
1696
|
const a = acc;
|
|
2002
|
-
const
|
|
2003
|
-
return a.map((
|
|
1697
|
+
const v2 = value;
|
|
1698
|
+
return a.map((x2, i2) => x2 + (v2[i2] ?? 0));
|
|
2004
1699
|
}
|
|
2005
1700
|
function zeroLike(value) {
|
|
2006
1701
|
return typeof value === "number" ? 0 : value.map(() => 0);
|
|
@@ -2394,8 +2089,10 @@ class AnimationGroup {
|
|
|
2394
2089
|
}
|
|
2395
2090
|
const DEFAULT_SKYBOX_URL = "https://assets.babylonjs.com/core/environments/backgroundSkybox.dds";
|
|
2396
2091
|
const DEFAULT_GROUND_URL = "https://assets.babylonjs.com/core/environments/backgroundGround.png";
|
|
2397
|
-
const DEFAULT_BRDF_URL = "/brdf-lut.png";
|
|
2398
2092
|
const DEFAULT_ENV_URL = "https://assets.babylonjs.com/environments/environmentSpecular.env";
|
|
2093
|
+
async function getBrdfLutUrl() {
|
|
2094
|
+
return (await import("./brdf-lut-data-BFfYlW71.js")).BRDF_LUT_DATA_URL;
|
|
2095
|
+
}
|
|
2399
2096
|
const _Scene = class _Scene extends AbstractScene {
|
|
2400
2097
|
constructor(engine) {
|
|
2401
2098
|
super();
|
|
@@ -2427,6 +2124,7 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2427
2124
|
__publicField(this, "_pendingAdds", []);
|
|
2428
2125
|
__publicField(this, "_started", false);
|
|
2429
2126
|
__publicField(this, "_envTexture", null);
|
|
2127
|
+
__publicField(this, "_brdfTexture", null);
|
|
2430
2128
|
__publicField(this, "_defaultEnvOptions", null);
|
|
2431
2129
|
__publicField(this, "_shadowGenerators", []);
|
|
2432
2130
|
__publicField(this, "_pendingTextures", []);
|
|
@@ -2520,6 +2218,16 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2520
2218
|
this._renderedAFrame = true;
|
|
2521
2219
|
this.onBeforeRenderObservable.notifyObservers(this);
|
|
2522
2220
|
}
|
|
2221
|
+
/**
|
|
2222
|
+
* @internal The Lite-core-owned mesh list backing `scene.meshes`. Babylon Lite's
|
|
2223
|
+
* `SceneContext` owns the authoritative array of scene meshes; the base
|
|
2224
|
+
* `AbstractScene.meshes` maps it back onto the canonical compat wrappers. Guarded
|
|
2225
|
+
* for prototype-only instances that have no `_lite` (GPU-free unit tests).
|
|
2226
|
+
*/
|
|
2227
|
+
_coreMeshList() {
|
|
2228
|
+
var _a;
|
|
2229
|
+
return ((_a = this._lite) == null ? void 0 : _a.meshes) ?? [];
|
|
2230
|
+
}
|
|
2523
2231
|
getEngine() {
|
|
2524
2232
|
return this._engine;
|
|
2525
2233
|
}
|
|
@@ -2532,8 +2240,18 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2532
2240
|
return this.uniqueId;
|
|
2533
2241
|
}
|
|
2534
2242
|
/**
|
|
2535
|
-
* @internal
|
|
2536
|
-
*
|
|
2243
|
+
* @internal Whether the engine has started, i.e. deferred mesh adds have been
|
|
2244
|
+
* flushed and meshes are live in the Lite scene. Used by the mesh `material`
|
|
2245
|
+
* setter and texture-readiness path to decide whether a material change must be
|
|
2246
|
+
* reconciled into the running scene (ensure renderable + rebuild) or is still
|
|
2247
|
+
* safely handled by the boot-time build.
|
|
2248
|
+
*/
|
|
2249
|
+
get _hasStarted() {
|
|
2250
|
+
return this._started;
|
|
2251
|
+
}
|
|
2252
|
+
/**
|
|
2253
|
+
* @internal Add a mesh to the Lite scene, deferring until engine start if the
|
|
2254
|
+
* engine has not started yet (so a later `mesh.material = …` is captured in the
|
|
2537
2255
|
* correct render group). After start, adds happen immediately and Lite's
|
|
2538
2256
|
* material-swap path handles re-routing.
|
|
2539
2257
|
*/
|
|
@@ -2613,8 +2331,15 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2613
2331
|
}
|
|
2614
2332
|
/** @internal Register a `NodeMaterial` whose parse the engine drives after shadow build. */
|
|
2615
2333
|
_registerNodeMaterial(material) {
|
|
2334
|
+
if (this._started) {
|
|
2335
|
+
this._engine._registerLateWork(() => material._parse(this._engine._lite, this._liteShadowGenerators()));
|
|
2336
|
+
return;
|
|
2337
|
+
}
|
|
2616
2338
|
this._nodeMaterials.push(material);
|
|
2617
2339
|
}
|
|
2340
|
+
_liteShadowGenerators() {
|
|
2341
|
+
return this._shadowGenerators.map((g2) => g2._liteGen).filter((g2) => g2 !== void 0);
|
|
2342
|
+
}
|
|
2618
2343
|
/**
|
|
2619
2344
|
* @internal Parse all registered `NodeMaterial`s, passing the scene's built Lite
|
|
2620
2345
|
* shadow generators so NME shadow-receiver blocks sample them (Babylon.js wires
|
|
@@ -2626,7 +2351,7 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2626
2351
|
return;
|
|
2627
2352
|
}
|
|
2628
2353
|
const engine = this._engine._lite;
|
|
2629
|
-
const liteGens = this.
|
|
2354
|
+
const liteGens = this._liteShadowGenerators();
|
|
2630
2355
|
await Promise.all(this._nodeMaterials.map((m2) => m2._parse(engine, liteGens)));
|
|
2631
2356
|
this._nodeMaterials.length = 0;
|
|
2632
2357
|
}
|
|
@@ -2791,6 +2516,47 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2791
2516
|
set environmentTexture(value) {
|
|
2792
2517
|
this._envTexture = value;
|
|
2793
2518
|
}
|
|
2519
|
+
/**
|
|
2520
|
+
* Babylon.js `scene.environmentBRDFTexture` — the BRDF lookup used by PBR materials.
|
|
2521
|
+
* Babylon.js defaults this to an embedded Base64 LUT and lets apps swap in one of the
|
|
2522
|
+
* published variants (e.g. `https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png`).
|
|
2523
|
+
*
|
|
2524
|
+
* Two deliberate divergences: the getter returns `null` while unset (Babylon.js
|
|
2525
|
+
* populates it with the decoded default once a PBR material is created, whereas Lite
|
|
2526
|
+
* keeps the default as an embedded data URL and never materialises a texture object),
|
|
2527
|
+
* and the assigned texture's own GPU upload goes unused because Babylon Lite decodes
|
|
2528
|
+
* the LUT itself, from the URL, as part of building the environment.
|
|
2529
|
+
*/
|
|
2530
|
+
get environmentBRDFTexture() {
|
|
2531
|
+
return this._brdfTexture;
|
|
2532
|
+
}
|
|
2533
|
+
set environmentBRDFTexture(value) {
|
|
2534
|
+
this._brdfTexture = value;
|
|
2535
|
+
}
|
|
2536
|
+
/**
|
|
2537
|
+
* Resolve the BRDF LUT URL for the environment loaders: an app-supplied
|
|
2538
|
+
* `environmentBRDFTexture`, else the embedded Babylon.js-style default.
|
|
2539
|
+
*/
|
|
2540
|
+
async _resolveBrdfUrl() {
|
|
2541
|
+
const override = this._brdfTexture;
|
|
2542
|
+
if (!override) {
|
|
2543
|
+
return await getBrdfLutUrl();
|
|
2544
|
+
}
|
|
2545
|
+
const url = (override.url ?? override.name).trim();
|
|
2546
|
+
if (!url) {
|
|
2547
|
+
Logger.Warn(
|
|
2548
|
+
`scene.environmentBRDFTexture: the assigned ${override.getClassName()} has no source URL, so the built-in LUT is used instead. Assign a \`Texture\` created from a URL to override it.`
|
|
2549
|
+
);
|
|
2550
|
+
return await getBrdfLutUrl();
|
|
2551
|
+
}
|
|
2552
|
+
if (url.split(/[?#]/)[0].toLowerCase().endsWith(".dds")) {
|
|
2553
|
+
Logger.Warn(
|
|
2554
|
+
`scene.environmentBRDFTexture '${url}': Babylon Lite decodes the BRDF LUT from an RGBD-encoded PNG and cannot read DDS, so the built-in LUT is used instead. Use the PNG variant (e.g. https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png) to silence this.`
|
|
2555
|
+
);
|
|
2556
|
+
return await getBrdfLutUrl();
|
|
2557
|
+
}
|
|
2558
|
+
return url;
|
|
2559
|
+
}
|
|
2794
2560
|
/**
|
|
2795
2561
|
* Babylon.js `scene.createDefaultEnvironment` — adds an IBL skybox and ground.
|
|
2796
2562
|
* Babylon Lite performs this through `loadEnvironment` (deferred to engine start),
|
|
@@ -2855,13 +2621,13 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2855
2621
|
});
|
|
2856
2622
|
} else if (envUrl.toLowerCase().endsWith(".dds")) {
|
|
2857
2623
|
await loadDdsEnvironment(this._lite, envUrl, {
|
|
2858
|
-
brdfUrl:
|
|
2624
|
+
brdfUrl: await this._resolveBrdfUrl(),
|
|
2859
2625
|
skipSkybox: !(opts == null ? void 0 : opts.createSkybox),
|
|
2860
2626
|
skipGround: !(opts == null ? void 0 : opts.createGround)
|
|
2861
2627
|
});
|
|
2862
2628
|
} else {
|
|
2863
2629
|
await loadEnvironment(this._lite, envUrl, {
|
|
2864
|
-
brdfUrl:
|
|
2630
|
+
brdfUrl: await this._resolveBrdfUrl(),
|
|
2865
2631
|
skyboxUrl,
|
|
2866
2632
|
skipSkybox: !(opts == null ? void 0 : opts.createSkybox),
|
|
2867
2633
|
groundTextureUrl: (opts == null ? void 0 : opts.createGround) ? DEFAULT_GROUND_URL : void 0,
|
|
@@ -3025,10 +2791,10 @@ class Light extends Node {
|
|
|
3025
2791
|
constructor(name, scene) {
|
|
3026
2792
|
super(name, scene);
|
|
3027
2793
|
/**
|
|
3028
|
-
* @internal When the light is disabled
|
|
3029
|
-
*
|
|
3030
|
-
*
|
|
3031
|
-
*
|
|
2794
|
+
* @internal When the light is effectively disabled, its Lite intensity is
|
|
2795
|
+
* forced to `0` (zero contribution) and the caller-visible intensity is
|
|
2796
|
+
* parked here so {@link intensity} keeps reporting the real value and
|
|
2797
|
+
* re-enabling restores it. `null` means the light is effectively enabled.
|
|
3032
2798
|
*/
|
|
3033
2799
|
__publicField(this, "_disabledIntensity", null);
|
|
3034
2800
|
/**
|
|
@@ -3074,23 +2840,17 @@ class Light extends Node {
|
|
|
3074
2840
|
this._liteIntensity = value;
|
|
3075
2841
|
}
|
|
3076
2842
|
}
|
|
3077
|
-
/**
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
* re-enable). The logical intensity value is preserved across the toggle.
|
|
3082
|
-
*/
|
|
3083
|
-
setEnabled(value) {
|
|
3084
|
-
if (value !== this.isEnabled()) {
|
|
3085
|
-
if (!value) {
|
|
2843
|
+
/** @internal Materialize local and inherited enabled state in Babylon Lite. */
|
|
2844
|
+
_onEffectiveEnabledStateChanged(enabled) {
|
|
2845
|
+
if (!enabled) {
|
|
2846
|
+
if (this._disabledIntensity === null) {
|
|
3086
2847
|
this._disabledIntensity = this._liteIntensity;
|
|
3087
2848
|
this._liteIntensity = 0;
|
|
3088
|
-
} else if (this._disabledIntensity !== null) {
|
|
3089
|
-
this._liteIntensity = this._disabledIntensity;
|
|
3090
|
-
this._disabledIntensity = null;
|
|
3091
2849
|
}
|
|
2850
|
+
} else if (this._disabledIntensity !== null) {
|
|
2851
|
+
this._liteIntensity = this._disabledIntensity;
|
|
2852
|
+
this._disabledIntensity = null;
|
|
3092
2853
|
}
|
|
3093
|
-
super.setEnabled(value);
|
|
3094
2854
|
}
|
|
3095
2855
|
/** Detach this light's shadow generator (compat for `light.shadowEnabled = false`). */
|
|
3096
2856
|
set shadowEnabled(enabled) {
|
|
@@ -3565,6 +3325,16 @@ class GaussianSplattingMesh extends TransformNode {
|
|
|
3565
3325
|
__publicField(this, "_ctorUrl");
|
|
3566
3326
|
/** @internal Optional Lite shader-fragment plugins applied at load (scene 126). */
|
|
3567
3327
|
__publicField(this, "_fragments");
|
|
3328
|
+
/**
|
|
3329
|
+
* Babylon.js `gs.safeOrbitCameraLimits` — safe-orbit camera limits parsed from the source
|
|
3330
|
+
* file's metadata (Adobe safe-orbit extension), or `null` when the file carries none.
|
|
3331
|
+
*
|
|
3332
|
+
* Babylon Lite's splat loaders (`loadSplat` / `loadSOG` / `loadSPZ`) do not parse the Adobe
|
|
3333
|
+
* safe-orbit metadata block, so this stays `null` — matching BJS's own default for a file
|
|
3334
|
+
* without the extension. Populating it from real metadata needs a (non-tree-shakeable) change
|
|
3335
|
+
* to Lite's splat loaders; the field is exposed here for shape parity so ported reads resolve.
|
|
3336
|
+
*/
|
|
3337
|
+
__publicField(this, "safeOrbitCameraLimits", null);
|
|
3568
3338
|
this._ctorUrl = url ?? null;
|
|
3569
3339
|
}
|
|
3570
3340
|
getClassName() {
|
|
@@ -3660,7 +3430,7 @@ class GaussianSplattingMesh extends TransformNode {
|
|
|
3660
3430
|
}
|
|
3661
3431
|
/** @internal Babylon.js's worker-throttle flag; ported scenes poll it to detect the first sort. */
|
|
3662
3432
|
get _canPostToWorker() {
|
|
3663
|
-
return this._gs ? this._gs.
|
|
3433
|
+
return this._gs ? this._gs._orderPool.length === 2 : false;
|
|
3664
3434
|
}
|
|
3665
3435
|
/** @internal The loaded Lite splat node, for the GPU picker's result mapping (undefined until loaded). */
|
|
3666
3436
|
get _pickLiteNode() {
|
|
@@ -3691,10 +3461,43 @@ class BaseTexture {
|
|
|
3691
3461
|
__publicField(this, "name", "");
|
|
3692
3462
|
/** @internal The underlying Lite texture handle. Undefined until the async load resolves. */
|
|
3693
3463
|
__publicField(this, "_lite");
|
|
3464
|
+
/** @internal One-shot listeners fired when the GPU handle first resolves (see {@link _onReady}). */
|
|
3465
|
+
__publicField(this, "_readyListeners");
|
|
3694
3466
|
}
|
|
3695
3467
|
getClassName() {
|
|
3696
3468
|
return "BaseTexture";
|
|
3697
3469
|
}
|
|
3470
|
+
/**
|
|
3471
|
+
* @internal Register a callback fired once this texture's GPU handle resolves.
|
|
3472
|
+
* Owning compat materials use it to rebind and rebuild once an asynchronously
|
|
3473
|
+
* loaded texture becomes available. Fires immediately if the handle already
|
|
3474
|
+
* exists; otherwise queues until {@link _notifyReady}. One-shot per listener.
|
|
3475
|
+
*/
|
|
3476
|
+
_onReady(listener) {
|
|
3477
|
+
if (this._lite) {
|
|
3478
|
+
listener();
|
|
3479
|
+
return;
|
|
3480
|
+
}
|
|
3481
|
+
(this._readyListeners ?? (this._readyListeners = [])).push(listener);
|
|
3482
|
+
}
|
|
3483
|
+
/** @internal Fire and clear the readiness listeners (called by subclasses once `_lite` resolves). */
|
|
3484
|
+
_notifyReady() {
|
|
3485
|
+
const listeners = this._readyListeners;
|
|
3486
|
+
if (listeners) {
|
|
3487
|
+
this._readyListeners = void 0;
|
|
3488
|
+
for (const listener of listeners) {
|
|
3489
|
+
listener();
|
|
3490
|
+
}
|
|
3491
|
+
}
|
|
3492
|
+
}
|
|
3493
|
+
/**
|
|
3494
|
+
* Babylon.js `BaseTexture.getInternalTexture()` — the backend texture handle. Babylon.js
|
|
3495
|
+
* returns an `InternalTexture`; the compat layer's equivalent is the Lite texture handle,
|
|
3496
|
+
* which is what the compat engine's texture methods accept.
|
|
3497
|
+
*/
|
|
3498
|
+
getInternalTexture() {
|
|
3499
|
+
return this._lite ?? null;
|
|
3500
|
+
}
|
|
3698
3501
|
dispose() {
|
|
3699
3502
|
}
|
|
3700
3503
|
}
|
|
@@ -3703,6 +3506,7 @@ const _Texture = class _Texture extends BaseTexture {
|
|
|
3703
3506
|
var _a;
|
|
3704
3507
|
super();
|
|
3705
3508
|
__publicField(this, "_ready");
|
|
3509
|
+
__publicField(this, "_onLoadObservable");
|
|
3706
3510
|
/** Babylon.js texture UV tiling (applied to the Lite material at bind time). */
|
|
3707
3511
|
__publicField(this, "uScale", 1);
|
|
3708
3512
|
__publicField(this, "vScale", 1);
|
|
@@ -3741,8 +3545,13 @@ const _Texture = class _Texture extends BaseTexture {
|
|
|
3741
3545
|
const loadOpts = scene ? { invertY: this._invertY, mipMaps: !this._noMipmap, ...filterOpts } : {};
|
|
3742
3546
|
this._ready = loadCompatTexture(engine, url, loadOpts).then((tex) => {
|
|
3743
3547
|
this._lite = tex;
|
|
3744
|
-
|
|
3745
|
-
|
|
3548
|
+
try {
|
|
3549
|
+
this._notifyLoadObservable();
|
|
3550
|
+
if (onLoad) {
|
|
3551
|
+
onLoad();
|
|
3552
|
+
}
|
|
3553
|
+
} finally {
|
|
3554
|
+
this._notifyReady();
|
|
3746
3555
|
}
|
|
3747
3556
|
});
|
|
3748
3557
|
scene == null ? void 0 : scene._trackTextureLoad(this._ready);
|
|
@@ -3769,6 +3578,23 @@ const _Texture = class _Texture extends BaseTexture {
|
|
|
3769
3578
|
whenReadyAsync() {
|
|
3770
3579
|
return this._ready;
|
|
3771
3580
|
}
|
|
3581
|
+
/** Babylon.js `Texture.onLoadObservable`, allocated only when code subscribes. */
|
|
3582
|
+
get onLoadObservable() {
|
|
3583
|
+
let observable = this._onLoadObservable;
|
|
3584
|
+
if (!observable) {
|
|
3585
|
+
observable = new Observable(void 0, true);
|
|
3586
|
+
this._onLoadObservable = observable;
|
|
3587
|
+
if (this.isReady()) {
|
|
3588
|
+
observable.notifyObservers(this);
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
return observable;
|
|
3592
|
+
}
|
|
3593
|
+
_notifyLoadObservable() {
|
|
3594
|
+
if (this._onLoadObservable) {
|
|
3595
|
+
this._onLoadObservable.notifyObservers(this);
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3772
3598
|
/** Babylon.js `BaseTexture.isReady()` — true once the GPU handle has resolved. */
|
|
3773
3599
|
isReady() {
|
|
3774
3600
|
return this._lite !== void 0;
|
|
@@ -3899,7 +3725,7 @@ class DynamicTexture extends BaseTexture {
|
|
|
3899
3725
|
return { width: this._width, height: this._height };
|
|
3900
3726
|
}
|
|
3901
3727
|
/** Draw `text` and refresh the GPU texture. */
|
|
3902
|
-
drawText(text,
|
|
3728
|
+
drawText(text, x2, y2, font, color, clearColor) {
|
|
3903
3729
|
const ctx = this._context;
|
|
3904
3730
|
if (clearColor) {
|
|
3905
3731
|
ctx.fillStyle = clearColor;
|
|
@@ -3907,7 +3733,7 @@ class DynamicTexture extends BaseTexture {
|
|
|
3907
3733
|
}
|
|
3908
3734
|
ctx.font = font;
|
|
3909
3735
|
ctx.fillStyle = color;
|
|
3910
|
-
ctx.fillText(text,
|
|
3736
|
+
ctx.fillText(text, x2, y2);
|
|
3911
3737
|
this.update();
|
|
3912
3738
|
}
|
|
3913
3739
|
/**
|
|
@@ -3923,13 +3749,13 @@ class DynamicTexture extends BaseTexture {
|
|
|
3923
3749
|
return Promise.resolve();
|
|
3924
3750
|
}
|
|
3925
3751
|
}
|
|
3926
|
-
class CubeTexture {
|
|
3752
|
+
class CubeTexture extends BaseTexture {
|
|
3927
3753
|
constructor(url, _scene, _extensions, _noMipmap, _files, onLoad, _onError, _format, _prefiltered) {
|
|
3754
|
+
super();
|
|
3928
3755
|
/** Source URL of the (prefiltered) environment. */
|
|
3929
3756
|
__publicField(this, "url");
|
|
3930
3757
|
/** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */
|
|
3931
3758
|
__publicField(this, "coordinatesMode", 0);
|
|
3932
|
-
__publicField(this, "name");
|
|
3933
3759
|
__publicField(this, "gammaSpace", true);
|
|
3934
3760
|
__publicField(this, "level", 1);
|
|
3935
3761
|
/**
|
|
@@ -3942,20 +3768,30 @@ class CubeTexture {
|
|
|
3942
3768
|
/** Fires when the cube map is "ready" (resolved on a microtask in this compat layer). */
|
|
3943
3769
|
__publicField(this, "onLoadObservable", new Observable());
|
|
3944
3770
|
__publicField(this, "_ready", false);
|
|
3771
|
+
__publicField(this, "_readyPromise");
|
|
3945
3772
|
this.url = url;
|
|
3946
3773
|
this.name = url;
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
onLoad
|
|
3951
|
-
|
|
3952
|
-
|
|
3774
|
+
this._readyPromise = new Promise((resolve) => {
|
|
3775
|
+
queueMicrotask(() => {
|
|
3776
|
+
this._ready = true;
|
|
3777
|
+
if (onLoad) {
|
|
3778
|
+
onLoad();
|
|
3779
|
+
}
|
|
3780
|
+
this.onLoadObservable.notifyObservers(this);
|
|
3781
|
+
resolve();
|
|
3782
|
+
});
|
|
3953
3783
|
});
|
|
3954
3784
|
}
|
|
3785
|
+
getClassName() {
|
|
3786
|
+
return "CubeTexture";
|
|
3787
|
+
}
|
|
3955
3788
|
/** Babylon.js `BaseTexture.isReady()`. */
|
|
3956
3789
|
isReady() {
|
|
3957
3790
|
return this._ready;
|
|
3958
3791
|
}
|
|
3792
|
+
whenReadyAsync() {
|
|
3793
|
+
return this._readyPromise;
|
|
3794
|
+
}
|
|
3959
3795
|
/** Babylon.js `CubeTexture.CreateFromPrefilteredData(url, scene)`. */
|
|
3960
3796
|
static CreateFromPrefilteredData(url, scene) {
|
|
3961
3797
|
return new CubeTexture(url, scene);
|
|
@@ -3963,15 +3799,15 @@ class CubeTexture {
|
|
|
3963
3799
|
dispose() {
|
|
3964
3800
|
}
|
|
3965
3801
|
}
|
|
3966
|
-
class HDRCubeTexture {
|
|
3802
|
+
class HDRCubeTexture extends BaseTexture {
|
|
3967
3803
|
constructor(url, _sceneOrEngine, size = 256, _noMipmap, _generateHarmonics, _gammaSpace, _prefilterOnLoad, onLoad) {
|
|
3804
|
+
super();
|
|
3968
3805
|
/** Source URL of the `.hdr` panorama. */
|
|
3969
3806
|
__publicField(this, "url");
|
|
3970
3807
|
/** Requested cubemap face size (BJS `size`); forwarded to Lite's `faceSize`. */
|
|
3971
3808
|
__publicField(this, "size");
|
|
3972
3809
|
/** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */
|
|
3973
3810
|
__publicField(this, "coordinatesMode", 0);
|
|
3974
|
-
__publicField(this, "name");
|
|
3975
3811
|
__publicField(this, "gammaSpace", true);
|
|
3976
3812
|
__publicField(this, "level", 1);
|
|
3977
3813
|
/** @internal Selects Lite's `loadHdrEnvironment` in the scene's env loader. */
|
|
@@ -3979,21 +3815,31 @@ class HDRCubeTexture {
|
|
|
3979
3815
|
/** Fires when the HDR environment is "ready" (resolved on a microtask). */
|
|
3980
3816
|
__publicField(this, "onLoadObservable", new Observable());
|
|
3981
3817
|
__publicField(this, "_ready", false);
|
|
3818
|
+
__publicField(this, "_readyPromise");
|
|
3982
3819
|
this.url = url;
|
|
3983
3820
|
this.size = size;
|
|
3984
3821
|
this.name = url;
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
onLoad
|
|
3989
|
-
|
|
3990
|
-
|
|
3822
|
+
this._readyPromise = new Promise((resolve) => {
|
|
3823
|
+
queueMicrotask(() => {
|
|
3824
|
+
this._ready = true;
|
|
3825
|
+
if (onLoad) {
|
|
3826
|
+
onLoad();
|
|
3827
|
+
}
|
|
3828
|
+
this.onLoadObservable.notifyObservers(this);
|
|
3829
|
+
resolve();
|
|
3830
|
+
});
|
|
3991
3831
|
});
|
|
3992
3832
|
}
|
|
3833
|
+
getClassName() {
|
|
3834
|
+
return "HDRCubeTexture";
|
|
3835
|
+
}
|
|
3993
3836
|
/** Babylon.js `BaseTexture.isReady()`. */
|
|
3994
3837
|
isReady() {
|
|
3995
3838
|
return this._ready;
|
|
3996
3839
|
}
|
|
3840
|
+
whenReadyAsync() {
|
|
3841
|
+
return this._readyPromise;
|
|
3842
|
+
}
|
|
3997
3843
|
dispose() {
|
|
3998
3844
|
}
|
|
3999
3845
|
}
|
|
@@ -4002,55 +3848,197 @@ class RenderTargetTexture {
|
|
|
4002
3848
|
unsupported("RenderTargetTexture", "Offscreen rendering uses Babylon Lite's frame-graph render-target APIs (`createRenderTargetTexture` / render tasks).");
|
|
4003
3849
|
}
|
|
4004
3850
|
}
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
3851
|
+
var ScenePerformancePriority = /* @__PURE__ */ ((ScenePerformancePriority2) => {
|
|
3852
|
+
ScenePerformancePriority2[ScenePerformancePriority2["BackwardCompatible"] = 0] = "BackwardCompatible";
|
|
3853
|
+
ScenePerformancePriority2[ScenePerformancePriority2["Intermediate"] = 1] = "Intermediate";
|
|
3854
|
+
ScenePerformancePriority2[ScenePerformancePriority2["Aggressive"] = 2] = "Aggressive";
|
|
3855
|
+
return ScenePerformancePriority2;
|
|
3856
|
+
})(ScenePerformancePriority || {});
|
|
3857
|
+
var ShaderLanguage = /* @__PURE__ */ ((ShaderLanguage2) => {
|
|
3858
|
+
ShaderLanguage2[ShaderLanguage2["GLSL"] = 0] = "GLSL";
|
|
3859
|
+
ShaderLanguage2[ShaderLanguage2["WGSL"] = 1] = "WGSL";
|
|
3860
|
+
return ShaderLanguage2;
|
|
3861
|
+
})(ShaderLanguage || {});
|
|
3862
|
+
class ImageProcessingConfiguration {
|
|
3863
|
+
}
|
|
3864
|
+
__publicField(ImageProcessingConfiguration, "TONEMAPPING_STANDARD", 0);
|
|
3865
|
+
__publicField(ImageProcessingConfiguration, "TONEMAPPING_ACES", 1);
|
|
3866
|
+
__publicField(ImageProcessingConfiguration, "TONEMAPPING_KHR_PBR_NEUTRAL", 2);
|
|
3867
|
+
const Constants = {
|
|
3868
|
+
MATERIAL_ClockWiseSideOrientation: 0,
|
|
3869
|
+
MATERIAL_CounterClockWiseSideOrientation: 1,
|
|
3870
|
+
MATERIAL_TriangleFillMode: 0,
|
|
3871
|
+
MATERIAL_WireFrameFillMode: 1,
|
|
3872
|
+
MATERIAL_PointFillMode: 2,
|
|
3873
|
+
ALPHA_DISABLE: 0,
|
|
3874
|
+
ALPHA_ADD: 1,
|
|
3875
|
+
ALPHA_COMBINE: 2,
|
|
3876
|
+
ALPHA_ONEONE: 6,
|
|
3877
|
+
ALPHA_PREMULTIPLIED: 7,
|
|
3878
|
+
ALPHA_REPLACE_COLOR: 21,
|
|
3879
|
+
MATERIAL_OPAQUE: 0,
|
|
3880
|
+
MATERIAL_ALPHATEST: 1,
|
|
3881
|
+
MATERIAL_ALPHABLEND: 2,
|
|
3882
|
+
TEXTURE_CLAMP_ADDRESSMODE: 0,
|
|
3883
|
+
TEXTURE_WRAP_ADDRESSMODE: 1,
|
|
3884
|
+
TEXTURE_MIRROR_ADDRESSMODE: 2,
|
|
3885
|
+
TEXTURE_NEAREST_SAMPLINGMODE: 1,
|
|
3886
|
+
TEXTURE_BILINEAR_SAMPLINGMODE: 2,
|
|
3887
|
+
TEXTURE_TRILINEAR_SAMPLINGMODE: 3,
|
|
3888
|
+
TEXTUREFORMAT_RGBA: 5,
|
|
3889
|
+
TEXTURETYPE_UNSIGNED_BYTE: 0
|
|
3890
|
+
};
|
|
3891
|
+
class RawTexture2DArray extends BaseTexture {
|
|
3892
|
+
constructor(data, width, height, depth, format, scene, generateMipMaps = true, _invertY = false, _samplingMode = 3, _textureType, _creationFlags, _mipLevelCount) {
|
|
3893
|
+
super();
|
|
3894
|
+
/** @internal The underlying Lite 2D-array handle (aliases `_lite`). */
|
|
3895
|
+
__publicField(this, "_liteArray");
|
|
3896
|
+
/** Babylon.js `RawTexture2DArray.is2DArray` — always true. */
|
|
3897
|
+
__publicField(this, "is2DArray", true);
|
|
3898
|
+
/** @internal Owning compat scene. */
|
|
3899
|
+
__publicField(this, "_sceneRef");
|
|
3900
|
+
this.format = format;
|
|
3901
|
+
this._sceneRef = scene;
|
|
3902
|
+
const engine = scene.getEngine()._lite;
|
|
3903
|
+
const tex = data === null ? createTexture2DArray(engine, width, height, depth, { mipMaps: generateMipMaps }) : createTexture2DArrayFromPixels(engine, toRgbaBytes(data, width, height, depth), width, height, depth, { mipMaps: generateMipMaps });
|
|
3904
|
+
this._liteArray = tex;
|
|
3905
|
+
this._lite = tex;
|
|
3906
|
+
}
|
|
3907
|
+
getClassName() {
|
|
3908
|
+
return "RawTexture2DArray";
|
|
3909
|
+
}
|
|
3910
|
+
/** Babylon.js `RawTexture2DArray.depth` — the number of array layers. */
|
|
3911
|
+
get depth() {
|
|
3912
|
+
var _a;
|
|
3913
|
+
return ((_a = this._liteArray) == null ? void 0 : _a.layers) ?? 0;
|
|
4022
3914
|
}
|
|
4023
|
-
/**
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
3915
|
+
/** The scene this texture belongs to (Babylon.js `ThinTexture.getScene`). */
|
|
3916
|
+
getScene() {
|
|
3917
|
+
return this._sceneRef;
|
|
3918
|
+
}
|
|
3919
|
+
/**
|
|
3920
|
+
* Babylon.js `RawTexture2DArray.getInternalTexture()` — the backend handle the compat
|
|
3921
|
+
* engine's texture methods accept (Lite's `Texture2DArray`).
|
|
3922
|
+
*/
|
|
3923
|
+
getInternalTexture() {
|
|
3924
|
+
return this._liteArray ?? null;
|
|
3925
|
+
}
|
|
3926
|
+
/** Babylon.js `RawTexture2DArray.update(data)` — replace the base mip of every layer. */
|
|
3927
|
+
update(data) {
|
|
3928
|
+
this.updateMipLevel(data, 0);
|
|
3929
|
+
}
|
|
3930
|
+
/**
|
|
3931
|
+
* Babylon.js `RawTexture2DArray.updateMipLevel(data, mipLevel)` — replace one mip level of
|
|
3932
|
+
* every layer. Level dimensions are `max(1, size >> mipLevel)`; writing level 0 of a
|
|
3933
|
+
* mipmapped array regenerates the rest of the chain, exactly as Babylon.js does.
|
|
3934
|
+
*/
|
|
3935
|
+
updateMipLevel(data, mipLevel) {
|
|
3936
|
+
const array = this._liteArray;
|
|
3937
|
+
if (!array) {
|
|
3938
|
+
return;
|
|
4029
3939
|
}
|
|
4030
|
-
|
|
3940
|
+
const width = Math.max(1, array.width >> mipLevel);
|
|
3941
|
+
const height = Math.max(1, array.height >> mipLevel);
|
|
3942
|
+
updateTexture2DArrayFromPixels(this._sceneRef.getEngine()._lite, array, toRgbaBytes(data, width, height, array.layers), mipLevel);
|
|
4031
3943
|
}
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
const positions = this._mesh._cpuPositions;
|
|
4035
|
-
return kind === "position" ? positions ?? null : null;
|
|
3944
|
+
whenReadyAsync() {
|
|
3945
|
+
return Promise.resolve();
|
|
4036
3946
|
}
|
|
4037
|
-
/**
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
3947
|
+
/**
|
|
3948
|
+
* @internal Reconcile the image-URL construction path
|
|
3949
|
+
* ({@link CreateTexture2DArrayFromImageUrlsAsync}) into the single BJS-named
|
|
3950
|
+
* class without re-running the allocating constructor.
|
|
3951
|
+
*/
|
|
3952
|
+
static _fromLite(liteArray, format, scene) {
|
|
3953
|
+
const tex = Object.create(RawTexture2DArray.prototype);
|
|
3954
|
+
tex.name = "";
|
|
3955
|
+
tex.is2DArray = true;
|
|
3956
|
+
tex.format = format;
|
|
3957
|
+
tex._sceneRef = scene;
|
|
3958
|
+
tex._liteArray = liteArray;
|
|
3959
|
+
tex._lite = liteArray;
|
|
3960
|
+
return tex;
|
|
3961
|
+
}
|
|
3962
|
+
/** Babylon.js `RawTexture2DArray.CreateRGBATexture` — RGBA raw-bytes factory. */
|
|
3963
|
+
static CreateRGBATexture(data, width, height, depth, scene, generateMipMaps = true, invertY = false, samplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE, type = Constants.TEXTURETYPE_UNSIGNED_BYTE) {
|
|
3964
|
+
return new RawTexture2DArray(data, width, height, depth, Constants.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode, type);
|
|
3965
|
+
}
|
|
3966
|
+
}
|
|
3967
|
+
async function CreateTexture2DArrayFromKTX2Async(scene, data, options) {
|
|
3968
|
+
let buffer;
|
|
3969
|
+
if (typeof data === "string") {
|
|
3970
|
+
const response = await fetch(data);
|
|
3971
|
+
if (!response.ok) {
|
|
3972
|
+
throw new Error(`Failed to fetch KTX2 file "${data}": ${response.status} ${response.statusText}`);
|
|
3973
|
+
}
|
|
3974
|
+
buffer = new Uint8Array(await response.arrayBuffer());
|
|
3975
|
+
} else {
|
|
3976
|
+
buffer = data;
|
|
3977
|
+
}
|
|
3978
|
+
const samplingMode = (options == null ? void 0 : options.samplingMode) ?? Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;
|
|
3979
|
+
const nearest = samplingMode === Constants.TEXTURE_NEAREST_SAMPLINGMODE;
|
|
3980
|
+
const bilinear = samplingMode === Constants.TEXTURE_BILINEAR_SAMPLINGMODE;
|
|
3981
|
+
const liteArray = await createTexture2DArrayFromKtx2(scene.getEngine()._lite, buffer, {
|
|
3982
|
+
generateMipMaps: (options == null ? void 0 : options.generateMipMaps) ?? true,
|
|
3983
|
+
invertY: (options == null ? void 0 : options.invertY) ?? false,
|
|
3984
|
+
minFilter: nearest ? "nearest" : "linear",
|
|
3985
|
+
magFilter: nearest ? "nearest" : "linear",
|
|
3986
|
+
mipmapFilter: nearest || bilinear ? "nearest" : "linear"
|
|
3987
|
+
});
|
|
3988
|
+
return RawTexture2DArray._fromLite(liteArray, Constants.TEXTUREFORMAT_RGBA, scene);
|
|
3989
|
+
}
|
|
3990
|
+
function liteArrayOf(texture) {
|
|
3991
|
+
const array = texture.getInternalTexture();
|
|
3992
|
+
if (!array) {
|
|
3993
|
+
throw new Error("Cannot upload to a 2D array texture that has no internal texture.");
|
|
3994
|
+
}
|
|
3995
|
+
return array;
|
|
3996
|
+
}
|
|
3997
|
+
function UploadImageToTexture2DArrayLayer(texture, source, layer, options) {
|
|
3998
|
+
const array = liteArrayOf(texture);
|
|
3999
|
+
if (!Number.isInteger(layer) || layer < 0 || layer >= texture.depth) {
|
|
4000
|
+
throw new Error(`Layer ${layer} is out of range for a 2D array texture with ${texture.depth} layers.`);
|
|
4041
4001
|
}
|
|
4002
|
+
texture.getScene().getEngine().updateTextureArrayLayerFromImageSource(array, source, layer, (options == null ? void 0 : options.invertY) ?? false, (options == null ? void 0 : options.premultiplyAlpha) ?? false);
|
|
4003
|
+
}
|
|
4004
|
+
async function LoadImageToTexture2DArrayLayerAsync(texture, url, layer, options) {
|
|
4005
|
+
const array = liteArrayOf(texture);
|
|
4006
|
+
await loadImageToArrayLayer(texture.getScene().getEngine()._lite, array, layer, url, {
|
|
4007
|
+
invertY: (options == null ? void 0 : options.invertY) ?? false,
|
|
4008
|
+
premultiplyAlpha: (options == null ? void 0 : options.premultiplyAlpha) ?? false
|
|
4009
|
+
});
|
|
4042
4010
|
}
|
|
4043
|
-
function
|
|
4044
|
-
const
|
|
4011
|
+
async function CreateTexture2DArrayFromImageUrlsAsync(scene, urls, options) {
|
|
4012
|
+
const liteArray = await createTexture2DArrayFromUrls(scene.getEngine()._lite, urls, {
|
|
4013
|
+
mipMaps: (options == null ? void 0 : options.generateMipMaps) ?? true,
|
|
4014
|
+
invertY: (options == null ? void 0 : options.invertY) ?? false,
|
|
4015
|
+
premultiplyAlpha: (options == null ? void 0 : options.premultiplyAlpha) ?? false
|
|
4016
|
+
});
|
|
4017
|
+
return RawTexture2DArray._fromLite(liteArray, Constants.TEXTUREFORMAT_RGBA, scene);
|
|
4018
|
+
}
|
|
4019
|
+
function collectLoadedMeshes(container, registry, scene) {
|
|
4045
4020
|
const result = [];
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
if (
|
|
4049
|
-
|
|
4021
|
+
const visited = /* @__PURE__ */ new Set();
|
|
4022
|
+
const visit = (node, parent) => {
|
|
4023
|
+
if (visited.has(node)) {
|
|
4024
|
+
return;
|
|
4050
4025
|
}
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4026
|
+
const lite = node;
|
|
4027
|
+
if (!lite._gpu && !Array.isArray(lite.children)) {
|
|
4028
|
+
return;
|
|
4029
|
+
}
|
|
4030
|
+
visited.add(node);
|
|
4031
|
+
let wrapper = registry.get(node);
|
|
4032
|
+
if (!wrapper || scene && wrapper.getScene() !== scene) {
|
|
4033
|
+
wrapper = Mesh._fromLiteHierarchy(node, container, scene, registry, parent);
|
|
4034
|
+
}
|
|
4035
|
+
result.push(wrapper);
|
|
4036
|
+
for (const child of lite.children ?? []) {
|
|
4037
|
+
visit(child, wrapper);
|
|
4038
|
+
}
|
|
4039
|
+
};
|
|
4040
|
+
for (const entity of container.entities) {
|
|
4041
|
+
visit(entity, null);
|
|
4054
4042
|
}
|
|
4055
4043
|
return result;
|
|
4056
4044
|
}
|
|
@@ -4072,18 +4060,29 @@ class AssetContainer {
|
|
|
4072
4060
|
constructor(lite) {
|
|
4073
4061
|
/** @internal Underlying Babylon Lite asset container. */
|
|
4074
4062
|
__publicField(this, "_lite");
|
|
4063
|
+
/** @internal Canonical loaded-mesh wrappers, cached per Lite node for stable identity. */
|
|
4064
|
+
__publicField(this, "_meshRegistry", /* @__PURE__ */ new Map());
|
|
4065
|
+
/** @internal The compat scene this container was added to, if any (drives scene-aware wrappers). */
|
|
4066
|
+
__publicField(this, "_scene");
|
|
4075
4067
|
this._lite = lite;
|
|
4076
4068
|
}
|
|
4077
4069
|
get animationGroups() {
|
|
4078
4070
|
return this._lite.animationGroups ?? [];
|
|
4079
4071
|
}
|
|
4080
|
-
/**
|
|
4072
|
+
/**
|
|
4073
|
+
* Flat list of the loaded meshes as canonical, stable-identity compat `Mesh`
|
|
4074
|
+
* handles (`__root__` at index 0, matching Babylon.js). Repeated reads return
|
|
4075
|
+
* the same wrapper objects, and — once the container is added to a scene — the
|
|
4076
|
+
* same handles `scene.meshes` exposes.
|
|
4077
|
+
*/
|
|
4081
4078
|
get meshes() {
|
|
4082
|
-
return collectLoadedMeshes(this._lite);
|
|
4079
|
+
return collectLoadedMeshes(this._lite, this._meshRegistry, this._scene);
|
|
4083
4080
|
}
|
|
4084
4081
|
/** Add every entity, animation group, camera, and clear colour to the scene. */
|
|
4085
4082
|
addAllToScene(scene) {
|
|
4086
4083
|
addToScene(scene._lite, this._lite);
|
|
4084
|
+
this._scene = scene;
|
|
4085
|
+
collectLoadedMeshes(this._lite, this._meshRegistry, scene);
|
|
4087
4086
|
scene._surfaceLoadedCamera();
|
|
4088
4087
|
}
|
|
4089
4088
|
dispose() {
|
|
@@ -4365,13 +4364,13 @@ class GPUPicker {
|
|
|
4365
4364
|
this._pickable = /* @__PURE__ */ new Set();
|
|
4366
4365
|
}
|
|
4367
4366
|
/** Pick the mesh at canvas coordinates `(x, y)`. Resolves to `null` on a miss. */
|
|
4368
|
-
async pickAsync(
|
|
4367
|
+
async pickAsync(x2, y2, disposeWhenDone = false) {
|
|
4369
4368
|
if (this._inProgress || !this._picker || this._liteToCompat.size === 0) {
|
|
4370
4369
|
return null;
|
|
4371
4370
|
}
|
|
4372
4371
|
this._inProgress = true;
|
|
4373
4372
|
try {
|
|
4374
|
-
const info = await pickAsync(this._picker,
|
|
4373
|
+
const info = await pickAsync(this._picker, x2, y2, { filter: (mesh2) => this._pickable.has(mesh2) });
|
|
4375
4374
|
if (!info.hit || !info.pickedMesh) {
|
|
4376
4375
|
return null;
|
|
4377
4376
|
}
|
|
@@ -4642,8 +4641,8 @@ class LightGizmo {
|
|
|
4642
4641
|
get position() {
|
|
4643
4642
|
return root.position;
|
|
4644
4643
|
},
|
|
4645
|
-
set position(
|
|
4646
|
-
root.position.set(
|
|
4644
|
+
set position(v2) {
|
|
4645
|
+
root.position.set(v2.x, v2.y, v2.z);
|
|
4647
4646
|
}
|
|
4648
4647
|
};
|
|
4649
4648
|
}
|
|
@@ -5207,8 +5206,8 @@ class SpriteRenderer {
|
|
|
5207
5206
|
const canvasHeight = this._engine.getRenderingCanvas().height;
|
|
5208
5207
|
if (!this._built) {
|
|
5209
5208
|
const layer2 = createSprite2DLayer(this._atlas, { capacity: this._capacity, depth: "none", blendMode: this._blend() });
|
|
5210
|
-
for (const
|
|
5211
|
-
this._indices.push(addSprite2DIndex(layer2, this._spriteProps(
|
|
5209
|
+
for (const s2 of this._sprites) {
|
|
5210
|
+
this._indices.push(addSprite2DIndex(layer2, this._spriteProps(s2, canvasHeight)));
|
|
5212
5211
|
}
|
|
5213
5212
|
this._layer = layer2;
|
|
5214
5213
|
const renderer = createSpriteRenderer(this._engine._lite, {
|
|
@@ -5230,16 +5229,16 @@ class SpriteRenderer {
|
|
|
5230
5229
|
}
|
|
5231
5230
|
}
|
|
5232
5231
|
/** @internal Convert a BJS `ThinSprite` to Lite `Sprite2DProps` (Y-flip + rotation negate). */
|
|
5233
|
-
_spriteProps(
|
|
5232
|
+
_spriteProps(s2, canvasHeight) {
|
|
5234
5233
|
return {
|
|
5235
|
-
positionPx: [
|
|
5236
|
-
sizePx: [
|
|
5237
|
-
frame:
|
|
5238
|
-
rotation: -
|
|
5239
|
-
color: [
|
|
5240
|
-
flipX:
|
|
5241
|
-
flipY:
|
|
5242
|
-
visible:
|
|
5234
|
+
positionPx: [s2.position.x, canvasHeight - s2.position.y],
|
|
5235
|
+
sizePx: [s2.width, s2.height],
|
|
5236
|
+
frame: s2.cellIndex,
|
|
5237
|
+
rotation: -s2.angle,
|
|
5238
|
+
color: [s2.color.r, s2.color.g, s2.color.b, s2.color.a],
|
|
5239
|
+
flipX: s2.invertU,
|
|
5240
|
+
flipY: s2.invertV,
|
|
5241
|
+
visible: s2.isVisible
|
|
5243
5242
|
};
|
|
5244
5243
|
}
|
|
5245
5244
|
}
|
|
@@ -5385,19 +5384,39 @@ class NodeMaterialBlockProxy {
|
|
|
5385
5384
|
}
|
|
5386
5385
|
}
|
|
5387
5386
|
class NodeMaterial {
|
|
5388
|
-
constructor(name,
|
|
5387
|
+
constructor(name, scene, json = {}) {
|
|
5389
5388
|
__publicField(this, "name");
|
|
5390
5389
|
__publicField(this, "backFaceCulling", true);
|
|
5391
5390
|
/** @internal The compiled Lite node material. Undefined until the async parse resolves. */
|
|
5392
5391
|
__publicField(this, "_lite");
|
|
5393
5392
|
__publicField(this, "_json");
|
|
5394
5393
|
__publicField(this, "_textureOverrides", {});
|
|
5394
|
+
__publicField(this, "_scene");
|
|
5395
|
+
__publicField(this, "_pendingBindings", /* @__PURE__ */ new Map());
|
|
5396
|
+
__publicField(this, "_parsed", false);
|
|
5395
5397
|
this.name = name;
|
|
5398
|
+
this._scene = scene;
|
|
5396
5399
|
this._json = json;
|
|
5397
5400
|
}
|
|
5398
5401
|
getClassName() {
|
|
5399
5402
|
return "NodeMaterial";
|
|
5400
5403
|
}
|
|
5404
|
+
/**
|
|
5405
|
+
* Babylon.js `NodeMaterial.clone(name)`. Reuses the same NME source graph and the
|
|
5406
|
+
* captured per-block texture overrides (textures shared by reference, as
|
|
5407
|
+
* Babylon.js does), registering the clone with the scene so it parses/compiles its
|
|
5408
|
+
* own Lite node material (own renderable) at engine start.
|
|
5409
|
+
*/
|
|
5410
|
+
clone(name) {
|
|
5411
|
+
const cloned = new NodeMaterial(name, this._scene, this._json);
|
|
5412
|
+
for (const [block, tex] of Object.entries(this._textureOverrides)) {
|
|
5413
|
+
cloned._textureOverrides[block] = tex;
|
|
5414
|
+
}
|
|
5415
|
+
cloned.backFaceCulling = this.backFaceCulling;
|
|
5416
|
+
cloned._lite = this._lite;
|
|
5417
|
+
this._scene._registerNodeMaterial(cloned);
|
|
5418
|
+
return cloned;
|
|
5419
|
+
}
|
|
5401
5420
|
/** Babylon.js `getBlockByName(name)` — returns a proxy that captures texture overrides. */
|
|
5402
5421
|
getBlockByName(name) {
|
|
5403
5422
|
return new NodeMaterialBlockProxy(this, name);
|
|
@@ -5420,6 +5439,15 @@ class NodeMaterial {
|
|
|
5420
5439
|
/** @internal Parse already happened via the scene-tracked promise; nothing to finalize. */
|
|
5421
5440
|
_ensureRenderable(_engine) {
|
|
5422
5441
|
}
|
|
5442
|
+
/** @internal Bind a mesh immediately and refresh it if still assigned when parsing finishes. */
|
|
5443
|
+
_bindMesh(mesh, isCurrent) {
|
|
5444
|
+
if (!this._parsed) {
|
|
5445
|
+
this._pendingBindings.set(mesh, isCurrent);
|
|
5446
|
+
}
|
|
5447
|
+
if (this._lite) {
|
|
5448
|
+
mesh.material = this._lite;
|
|
5449
|
+
}
|
|
5450
|
+
}
|
|
5423
5451
|
dispose() {
|
|
5424
5452
|
}
|
|
5425
5453
|
/** @internal Resolve override textures, then parse + compile the NME graph. */
|
|
@@ -5436,14 +5464,24 @@ class NodeMaterial {
|
|
|
5436
5464
|
textures[blockName] = tex._lite;
|
|
5437
5465
|
}
|
|
5438
5466
|
}
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5467
|
+
try {
|
|
5468
|
+
this._lite = await parseNodeMaterialFromSnippet(engine, "", {
|
|
5469
|
+
json: this._json,
|
|
5470
|
+
...overrides.length ? { textures } : {},
|
|
5471
|
+
// Babylon.js wires shadows into the scene globally; Babylon Lite takes them
|
|
5472
|
+
// at NME parse time, so NME shadow-receiver blocks sample the scene's
|
|
5473
|
+
// generators (e.g. ground `receiveShadows` in scenes 65/66).
|
|
5474
|
+
...shadowGenerators.length ? { shadowGenerators } : {}
|
|
5475
|
+
});
|
|
5476
|
+
this._parsed = true;
|
|
5477
|
+
for (const [mesh, isCurrent] of this._pendingBindings) {
|
|
5478
|
+
if (isCurrent()) {
|
|
5479
|
+
mesh.material = this._lite;
|
|
5480
|
+
}
|
|
5481
|
+
}
|
|
5482
|
+
} finally {
|
|
5483
|
+
this._pendingBindings.clear();
|
|
5484
|
+
}
|
|
5447
5485
|
}
|
|
5448
5486
|
/**
|
|
5449
5487
|
* Babylon.js `NodeMaterial.Parse(source, scene, rootUrl?)` — parse an NME graph
|
|
@@ -5540,362 +5578,130 @@ class EasingFunction {
|
|
|
5540
5578
|
case EASINGMODE_EASEOUT:
|
|
5541
5579
|
return 1 - this.easeInCore(1 - gradient);
|
|
5542
5580
|
default:
|
|
5543
|
-
return gradient >= 0.5 ? 1 - this.easeInCore((1 - gradient) * 2) * 0.5 : this.easeInCore(gradient * 2) * 0.5;
|
|
5544
|
-
}
|
|
5545
|
-
}
|
|
5546
|
-
}
|
|
5547
|
-
__publicField(EasingFunction, "EASINGMODE_EASEIN", EASINGMODE_EASEIN);
|
|
5548
|
-
__publicField(EasingFunction, "EASINGMODE_EASEOUT", EASINGMODE_EASEOUT);
|
|
5549
|
-
__publicField(EasingFunction, "EASINGMODE_EASEINOUT", EASINGMODE_EASEINOUT);
|
|
5550
|
-
class CircleEase extends EasingFunction {
|
|
5551
|
-
easeInCore(gradient) {
|
|
5552
|
-
const g2 = Math.max(0, Math.min(1, gradient));
|
|
5553
|
-
return 1 - Math.sqrt(1 - g2 * g2);
|
|
5554
|
-
}
|
|
5555
|
-
}
|
|
5556
|
-
class QuadraticEase extends EasingFunction {
|
|
5557
|
-
easeInCore(gradient) {
|
|
5558
|
-
return gradient * gradient;
|
|
5559
|
-
}
|
|
5560
|
-
}
|
|
5561
|
-
class CubicEase extends EasingFunction {
|
|
5562
|
-
easeInCore(gradient) {
|
|
5563
|
-
return gradient * gradient * gradient;
|
|
5564
|
-
}
|
|
5565
|
-
}
|
|
5566
|
-
class QuarticEase extends EasingFunction {
|
|
5567
|
-
easeInCore(gradient) {
|
|
5568
|
-
return gradient * gradient * gradient * gradient;
|
|
5569
|
-
}
|
|
5570
|
-
}
|
|
5571
|
-
class QuinticEase extends EasingFunction {
|
|
5572
|
-
easeInCore(gradient) {
|
|
5573
|
-
return gradient * gradient * gradient * gradient * gradient;
|
|
5574
|
-
}
|
|
5575
|
-
}
|
|
5576
|
-
class SineEase extends EasingFunction {
|
|
5577
|
-
easeInCore(gradient) {
|
|
5578
|
-
return 1 - Math.sin(Math.PI / 2 * (1 - gradient));
|
|
5579
|
-
}
|
|
5580
|
-
}
|
|
5581
|
-
class ExponentialEase extends EasingFunction {
|
|
5582
|
-
constructor(exponent = 2) {
|
|
5583
|
-
super();
|
|
5584
|
-
this.exponent = exponent;
|
|
5585
|
-
}
|
|
5586
|
-
easeInCore(gradient) {
|
|
5587
|
-
if (this.exponent <= 0) {
|
|
5588
|
-
return gradient;
|
|
5589
|
-
}
|
|
5590
|
-
return (Math.exp(this.exponent * gradient) - 1) / (Math.exp(this.exponent) - 1);
|
|
5591
|
-
}
|
|
5592
|
-
}
|
|
5593
|
-
class BackEase extends EasingFunction {
|
|
5594
|
-
constructor(amplitude = 1) {
|
|
5595
|
-
super();
|
|
5596
|
-
this.amplitude = amplitude;
|
|
5597
|
-
}
|
|
5598
|
-
easeInCore(gradient) {
|
|
5599
|
-
const num = Math.max(0, this.amplitude);
|
|
5600
|
-
return Math.pow(gradient, 3) - gradient * num * Math.sin(Math.PI * gradient);
|
|
5601
|
-
}
|
|
5602
|
-
}
|
|
5603
|
-
class ElasticEase extends EasingFunction {
|
|
5604
|
-
constructor(oscillations = 3, springiness = 3) {
|
|
5605
|
-
super();
|
|
5606
|
-
this.oscillations = oscillations;
|
|
5607
|
-
this.springiness = springiness;
|
|
5608
|
-
}
|
|
5609
|
-
easeInCore(gradient) {
|
|
5610
|
-
const num2 = Math.max(0, this.oscillations);
|
|
5611
|
-
const num3 = Math.max(0, this.springiness);
|
|
5612
|
-
const num = num3 === 0 ? gradient : (Math.exp(num3 * gradient) - 1) / (Math.exp(num3) - 1);
|
|
5613
|
-
return num * Math.sin((2 * Math.PI * num2 + Math.PI / 2) * gradient);
|
|
5614
|
-
}
|
|
5615
|
-
}
|
|
5616
|
-
class BounceEase extends EasingFunction {
|
|
5617
|
-
constructor(bounces = 3, bounciness = 2) {
|
|
5618
|
-
super();
|
|
5619
|
-
this.bounces = bounces;
|
|
5620
|
-
this.bounciness = bounciness;
|
|
5621
|
-
}
|
|
5622
|
-
easeInCore(gradient) {
|
|
5623
|
-
const num = Math.max(0, this.bounces);
|
|
5624
|
-
let bounciness = this.bounciness;
|
|
5625
|
-
if (bounciness <= 1) {
|
|
5626
|
-
bounciness = 1.001;
|
|
5627
|
-
}
|
|
5628
|
-
const num2 = Math.pow(bounciness, num);
|
|
5629
|
-
const num3 = 1 - bounciness;
|
|
5630
|
-
const num4 = (1 - num2) / num3 + num2 * 0.5;
|
|
5631
|
-
const num5 = gradient * num4;
|
|
5632
|
-
const num6 = Math.log(-num5 * (1 - bounciness) + 1) / Math.log(bounciness);
|
|
5633
|
-
const num7 = Math.floor(num6);
|
|
5634
|
-
const num8 = num7 + 1;
|
|
5635
|
-
const num9 = (1 - Math.pow(bounciness, num7)) / (num3 * num4);
|
|
5636
|
-
const num10 = (1 - Math.pow(bounciness, num8)) / (num3 * num4);
|
|
5637
|
-
const num11 = (num9 + num10) * 0.5;
|
|
5638
|
-
const num12 = gradient - num11;
|
|
5639
|
-
const num13 = num11 - num9;
|
|
5640
|
-
return -Math.pow(1 / bounciness, num - num7) / (num13 * num13) * (num12 - num13) * (num12 + num13);
|
|
5641
|
-
}
|
|
5642
|
-
}
|
|
5643
|
-
const Tools = {
|
|
5644
|
-
/** High-resolution timestamp in milliseconds. */
|
|
5645
|
-
Now() {
|
|
5646
|
-
return typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
5647
|
-
},
|
|
5648
|
-
ToRadians(degrees) {
|
|
5649
|
-
return degrees * Math.PI / 180;
|
|
5650
|
-
},
|
|
5651
|
-
ToDegrees(radians) {
|
|
5652
|
-
return radians * 180 / Math.PI;
|
|
5653
|
-
},
|
|
5654
|
-
/** Clamp `value` into the inclusive `[min, max]` range. */
|
|
5655
|
-
Clamp(value, min = 0, max = 1) {
|
|
5656
|
-
return Math.min(max, Math.max(min, value));
|
|
5657
|
-
},
|
|
5658
|
-
/** Generate an RFC4122 v4 UUID (used by Babylon.js for unique ids). */
|
|
5659
|
-
RandomId() {
|
|
5660
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => {
|
|
5661
|
-
const r = Math.random() * 16 | 0;
|
|
5662
|
-
const v = c2 === "x" ? r : r & 3 | 8;
|
|
5663
|
-
return v.toString(16);
|
|
5664
|
-
});
|
|
5665
|
-
}
|
|
5666
|
-
};
|
|
5667
|
-
class SmartArray {
|
|
5668
|
-
constructor(capacity) {
|
|
5669
|
-
__publicField(this, "data");
|
|
5670
|
-
__publicField(this, "length", 0);
|
|
5671
|
-
this.data = new Array(capacity);
|
|
5672
|
-
}
|
|
5673
|
-
push(value) {
|
|
5674
|
-
this.data[this.length++] = value;
|
|
5675
|
-
if (this.length > this.data.length) {
|
|
5676
|
-
this.data.length = this.length;
|
|
5677
|
-
}
|
|
5678
|
-
}
|
|
5679
|
-
reset() {
|
|
5680
|
-
this.length = 0;
|
|
5681
|
-
}
|
|
5682
|
-
concat(array) {
|
|
5683
|
-
for (let i2 = 0; i2 < array.length; i2++) {
|
|
5684
|
-
this.push(array.data[i2]);
|
|
5685
|
-
}
|
|
5686
|
-
}
|
|
5687
|
-
dispose() {
|
|
5688
|
-
this.reset();
|
|
5689
|
-
this.data.length = 0;
|
|
5690
|
-
}
|
|
5691
|
-
}
|
|
5692
|
-
class StringDictionary {
|
|
5693
|
-
constructor() {
|
|
5694
|
-
__publicField(this, "_store", {});
|
|
5695
|
-
}
|
|
5696
|
-
get count() {
|
|
5697
|
-
return Object.keys(this._store).length;
|
|
5698
|
-
}
|
|
5699
|
-
add(key, value) {
|
|
5700
|
-
if (key in this._store) {
|
|
5701
|
-
return false;
|
|
5702
|
-
}
|
|
5703
|
-
this._store[key] = value;
|
|
5704
|
-
return true;
|
|
5705
|
-
}
|
|
5706
|
-
set(key, value) {
|
|
5707
|
-
if (!(key in this._store)) {
|
|
5708
|
-
return false;
|
|
5709
|
-
}
|
|
5710
|
-
this._store[key] = value;
|
|
5711
|
-
return true;
|
|
5712
|
-
}
|
|
5713
|
-
get(key) {
|
|
5714
|
-
return this._store[key];
|
|
5715
|
-
}
|
|
5716
|
-
getOrAddWithFactory(key, factory) {
|
|
5717
|
-
let value = this._store[key];
|
|
5718
|
-
if (value === void 0) {
|
|
5719
|
-
value = factory(key);
|
|
5720
|
-
this._store[key] = value;
|
|
5721
|
-
}
|
|
5722
|
-
return value;
|
|
5723
|
-
}
|
|
5724
|
-
contains(key) {
|
|
5725
|
-
return key in this._store;
|
|
5726
|
-
}
|
|
5727
|
-
remove(key) {
|
|
5728
|
-
if (key in this._store) {
|
|
5729
|
-
delete this._store[key];
|
|
5730
|
-
return true;
|
|
5731
|
-
}
|
|
5732
|
-
return false;
|
|
5733
|
-
}
|
|
5734
|
-
clear() {
|
|
5735
|
-
this._store = {};
|
|
5736
|
-
}
|
|
5737
|
-
forEach(callback) {
|
|
5738
|
-
for (const key of Object.keys(this._store)) {
|
|
5739
|
-
callback(key, this._store[key]);
|
|
5740
|
-
}
|
|
5741
|
-
}
|
|
5742
|
-
}
|
|
5743
|
-
const Tags = {
|
|
5744
|
-
EnableFor(obj) {
|
|
5745
|
-
obj._tags ?? (obj._tags = {});
|
|
5746
|
-
},
|
|
5747
|
-
HasTags(obj) {
|
|
5748
|
-
return !!obj._tags && Object.keys(obj._tags).length > 0;
|
|
5749
|
-
},
|
|
5750
|
-
AddTagsTo(obj, tags) {
|
|
5751
|
-
obj._tags ?? (obj._tags = {});
|
|
5752
|
-
for (const tag of tags.split(/\s+/).filter(Boolean)) {
|
|
5753
|
-
obj._tags[tag] = true;
|
|
5754
|
-
}
|
|
5755
|
-
},
|
|
5756
|
-
RemoveTagsFrom(obj, tags) {
|
|
5757
|
-
if (!obj._tags) {
|
|
5758
|
-
return;
|
|
5759
|
-
}
|
|
5760
|
-
for (const tag of tags.split(/\s+/).filter(Boolean)) {
|
|
5761
|
-
delete obj._tags[tag];
|
|
5762
|
-
}
|
|
5763
|
-
},
|
|
5764
|
-
MatchesQuery(obj, tag) {
|
|
5765
|
-
return !!obj._tags && obj._tags[tag] === true;
|
|
5766
|
-
},
|
|
5767
|
-
GetTags(obj) {
|
|
5768
|
-
return obj._tags ? Object.keys(obj._tags) : [];
|
|
5769
|
-
}
|
|
5770
|
-
};
|
|
5771
|
-
class PerformanceMonitor {
|
|
5772
|
-
constructor(frameSampleSize = 30) {
|
|
5773
|
-
__publicField(this, "_samples", []);
|
|
5774
|
-
__publicField(this, "_max");
|
|
5775
|
-
__publicField(this, "_lastTime", null);
|
|
5776
|
-
__publicField(this, "_enabled", true);
|
|
5777
|
-
this._max = frameSampleSize;
|
|
5778
|
-
}
|
|
5779
|
-
sampleFrame(timeMs = now()) {
|
|
5780
|
-
if (!this._enabled) {
|
|
5781
|
-
return;
|
|
5782
|
-
}
|
|
5783
|
-
if (this._lastTime !== null) {
|
|
5784
|
-
const delta = timeMs - this._lastTime;
|
|
5785
|
-
this._samples.push(delta);
|
|
5786
|
-
if (this._samples.length > this._max) {
|
|
5787
|
-
this._samples.shift();
|
|
5788
|
-
}
|
|
5581
|
+
return gradient >= 0.5 ? 1 - this.easeInCore((1 - gradient) * 2) * 0.5 : this.easeInCore(gradient * 2) * 0.5;
|
|
5789
5582
|
}
|
|
5790
|
-
this._lastTime = timeMs;
|
|
5791
5583
|
}
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5584
|
+
}
|
|
5585
|
+
__publicField(EasingFunction, "EASINGMODE_EASEIN", EASINGMODE_EASEIN);
|
|
5586
|
+
__publicField(EasingFunction, "EASINGMODE_EASEOUT", EASINGMODE_EASEOUT);
|
|
5587
|
+
__publicField(EasingFunction, "EASINGMODE_EASEINOUT", EASINGMODE_EASEINOUT);
|
|
5588
|
+
class CircleEase extends EasingFunction {
|
|
5589
|
+
easeInCore(gradient) {
|
|
5590
|
+
const g2 = Math.max(0, Math.min(1, gradient));
|
|
5591
|
+
return 1 - Math.sqrt(1 - g2 * g2);
|
|
5797
5592
|
}
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5593
|
+
}
|
|
5594
|
+
class QuadraticEase extends EasingFunction {
|
|
5595
|
+
easeInCore(gradient) {
|
|
5596
|
+
return gradient * gradient;
|
|
5801
5597
|
}
|
|
5802
|
-
|
|
5803
|
-
|
|
5598
|
+
}
|
|
5599
|
+
class CubicEase extends EasingFunction {
|
|
5600
|
+
easeInCore(gradient) {
|
|
5601
|
+
return gradient * gradient * gradient;
|
|
5804
5602
|
}
|
|
5805
|
-
|
|
5806
|
-
|
|
5603
|
+
}
|
|
5604
|
+
class QuarticEase extends EasingFunction {
|
|
5605
|
+
easeInCore(gradient) {
|
|
5606
|
+
return gradient * gradient * gradient * gradient;
|
|
5807
5607
|
}
|
|
5808
|
-
|
|
5809
|
-
|
|
5608
|
+
}
|
|
5609
|
+
class QuinticEase extends EasingFunction {
|
|
5610
|
+
easeInCore(gradient) {
|
|
5611
|
+
return gradient * gradient * gradient * gradient * gradient;
|
|
5810
5612
|
}
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5613
|
+
}
|
|
5614
|
+
class SineEase extends EasingFunction {
|
|
5615
|
+
easeInCore(gradient) {
|
|
5616
|
+
return 1 - Math.sin(Math.PI / 2 * (1 - gradient));
|
|
5814
5617
|
}
|
|
5815
5618
|
}
|
|
5816
|
-
class
|
|
5817
|
-
constructor(
|
|
5818
|
-
|
|
5819
|
-
this.
|
|
5820
|
-
this.factor2 = factor2;
|
|
5619
|
+
class ExponentialEase extends EasingFunction {
|
|
5620
|
+
constructor(exponent = 2) {
|
|
5621
|
+
super();
|
|
5622
|
+
this.exponent = exponent;
|
|
5821
5623
|
}
|
|
5822
|
-
|
|
5823
|
-
|
|
5624
|
+
easeInCore(gradient) {
|
|
5625
|
+
if (this.exponent <= 0) {
|
|
5626
|
+
return gradient;
|
|
5627
|
+
}
|
|
5628
|
+
return (Math.exp(this.exponent * gradient) - 1) / (Math.exp(this.exponent) - 1);
|
|
5824
5629
|
}
|
|
5825
5630
|
}
|
|
5826
|
-
class
|
|
5827
|
-
constructor(
|
|
5828
|
-
|
|
5829
|
-
this.
|
|
5830
|
-
|
|
5631
|
+
class BackEase extends EasingFunction {
|
|
5632
|
+
constructor(amplitude = 1) {
|
|
5633
|
+
super();
|
|
5634
|
+
this.amplitude = amplitude;
|
|
5635
|
+
}
|
|
5636
|
+
easeInCore(gradient) {
|
|
5637
|
+
const num = Math.max(0, this.amplitude);
|
|
5638
|
+
return Math.pow(gradient, 3) - gradient * num * Math.sin(Math.PI * gradient);
|
|
5831
5639
|
}
|
|
5832
5640
|
}
|
|
5833
|
-
|
|
5834
|
-
|
|
5641
|
+
class ElasticEase extends EasingFunction {
|
|
5642
|
+
constructor(oscillations = 3, springiness = 3) {
|
|
5643
|
+
super();
|
|
5644
|
+
this.oscillations = oscillations;
|
|
5645
|
+
this.springiness = springiness;
|
|
5646
|
+
}
|
|
5647
|
+
easeInCore(gradient) {
|
|
5648
|
+
const num2 = Math.max(0, this.oscillations);
|
|
5649
|
+
const num3 = Math.max(0, this.springiness);
|
|
5650
|
+
const num = num3 === 0 ? gradient : (Math.exp(num3 * gradient) - 1) / (Math.exp(num3) - 1);
|
|
5651
|
+
return num * Math.sin((2 * Math.PI * num2 + Math.PI / 2) * gradient);
|
|
5652
|
+
}
|
|
5835
5653
|
}
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
if (
|
|
5846
|
-
|
|
5654
|
+
class BounceEase extends EasingFunction {
|
|
5655
|
+
constructor(bounces = 3, bounciness = 2) {
|
|
5656
|
+
super();
|
|
5657
|
+
this.bounces = bounces;
|
|
5658
|
+
this.bounciness = bounciness;
|
|
5659
|
+
}
|
|
5660
|
+
easeInCore(gradient) {
|
|
5661
|
+
const num = Math.max(0, this.bounces);
|
|
5662
|
+
let bounciness = this.bounciness;
|
|
5663
|
+
if (bounciness <= 1) {
|
|
5664
|
+
bounciness = 1.001;
|
|
5847
5665
|
}
|
|
5666
|
+
const num2 = Math.pow(bounciness, num);
|
|
5667
|
+
const num3 = 1 - bounciness;
|
|
5668
|
+
const num4 = (1 - num2) / num3 + num2 * 0.5;
|
|
5669
|
+
const num5 = gradient * num4;
|
|
5670
|
+
const num6 = Math.log(-num5 * (1 - bounciness) + 1) / Math.log(bounciness);
|
|
5671
|
+
const num7 = Math.floor(num6);
|
|
5672
|
+
const num8 = num7 + 1;
|
|
5673
|
+
const num9 = (1 - Math.pow(bounciness, num7)) / (num3 * num4);
|
|
5674
|
+
const num10 = (1 - Math.pow(bounciness, num8)) / (num3 * num4);
|
|
5675
|
+
const num11 = (num9 + num10) * 0.5;
|
|
5676
|
+
const num12 = gradient - num11;
|
|
5677
|
+
const num13 = num11 - num9;
|
|
5678
|
+
return -Math.pow(1 / bounciness, num - num7) / (num13 * num13) * (num12 - num13) * (num12 + num13);
|
|
5679
|
+
}
|
|
5680
|
+
}
|
|
5681
|
+
const Tools = {
|
|
5682
|
+
/** High-resolution timestamp in milliseconds. */
|
|
5683
|
+
Now() {
|
|
5684
|
+
return typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
5848
5685
|
},
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
console.warn("BJS - " + message);
|
|
5852
|
-
}
|
|
5686
|
+
ToRadians(degrees) {
|
|
5687
|
+
return degrees * Math.PI / 180;
|
|
5853
5688
|
},
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5689
|
+
ToDegrees(radians) {
|
|
5690
|
+
return radians * 180 / Math.PI;
|
|
5691
|
+
},
|
|
5692
|
+
/** Clamp `value` into the inclusive `[min, max]` range. */
|
|
5693
|
+
Clamp(value, min = 0, max = 1) {
|
|
5694
|
+
return Math.min(max, Math.max(min, value));
|
|
5695
|
+
},
|
|
5696
|
+
/** Generate an RFC4122 v4 UUID (used by Babylon.js for unique ids). */
|
|
5697
|
+
RandomId() {
|
|
5698
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => {
|
|
5699
|
+
const r2 = Math.random() * 16 | 0;
|
|
5700
|
+
const v2 = c2 === "x" ? r2 : r2 & 3 | 8;
|
|
5701
|
+
return v2.toString(16);
|
|
5702
|
+
});
|
|
5863
5703
|
}
|
|
5864
5704
|
};
|
|
5865
|
-
var ScenePerformancePriority = /* @__PURE__ */ ((ScenePerformancePriority2) => {
|
|
5866
|
-
ScenePerformancePriority2[ScenePerformancePriority2["BackwardCompatible"] = 0] = "BackwardCompatible";
|
|
5867
|
-
ScenePerformancePriority2[ScenePerformancePriority2["Intermediate"] = 1] = "Intermediate";
|
|
5868
|
-
ScenePerformancePriority2[ScenePerformancePriority2["Aggressive"] = 2] = "Aggressive";
|
|
5869
|
-
return ScenePerformancePriority2;
|
|
5870
|
-
})(ScenePerformancePriority || {});
|
|
5871
|
-
var ShaderLanguage = /* @__PURE__ */ ((ShaderLanguage2) => {
|
|
5872
|
-
ShaderLanguage2[ShaderLanguage2["GLSL"] = 0] = "GLSL";
|
|
5873
|
-
ShaderLanguage2[ShaderLanguage2["WGSL"] = 1] = "WGSL";
|
|
5874
|
-
return ShaderLanguage2;
|
|
5875
|
-
})(ShaderLanguage || {});
|
|
5876
|
-
class ImageProcessingConfiguration {
|
|
5877
|
-
}
|
|
5878
|
-
__publicField(ImageProcessingConfiguration, "TONEMAPPING_STANDARD", 0);
|
|
5879
|
-
__publicField(ImageProcessingConfiguration, "TONEMAPPING_ACES", 1);
|
|
5880
|
-
__publicField(ImageProcessingConfiguration, "TONEMAPPING_KHR_PBR_NEUTRAL", 2);
|
|
5881
|
-
const Constants = {
|
|
5882
|
-
MATERIAL_ClockWiseSideOrientation: 0,
|
|
5883
|
-
MATERIAL_CounterClockWiseSideOrientation: 1,
|
|
5884
|
-
MATERIAL_TriangleFillMode: 0,
|
|
5885
|
-
MATERIAL_WireFrameFillMode: 1,
|
|
5886
|
-
MATERIAL_PointFillMode: 2,
|
|
5887
|
-
ALPHA_DISABLE: 0,
|
|
5888
|
-
ALPHA_ADD: 1,
|
|
5889
|
-
ALPHA_COMBINE: 2,
|
|
5890
|
-
ALPHA_ONEONE: 6,
|
|
5891
|
-
ALPHA_PREMULTIPLIED: 7,
|
|
5892
|
-
MATERIAL_OPAQUE: 0,
|
|
5893
|
-
MATERIAL_ALPHATEST: 1,
|
|
5894
|
-
MATERIAL_ALPHABLEND: 2,
|
|
5895
|
-
TEXTURE_CLAMP_ADDRESSMODE: 0,
|
|
5896
|
-
TEXTURE_WRAP_ADDRESSMODE: 1,
|
|
5897
|
-
TEXTURE_MIRROR_ADDRESSMODE: 2
|
|
5898
|
-
};
|
|
5899
5705
|
const ActionManagerTriggers = {
|
|
5900
5706
|
NothingTrigger: 0,
|
|
5901
5707
|
OnPickTrigger: 1,
|
|
@@ -7227,17 +7033,26 @@ class ClusteredLightContainer {
|
|
|
7227
7033
|
}
|
|
7228
7034
|
class ParticleSystem {
|
|
7229
7035
|
constructor() {
|
|
7230
|
-
unsupported(
|
|
7036
|
+
unsupported(
|
|
7037
|
+
"ParticleSystem",
|
|
7038
|
+
"Babylon Lite backs serialized Node Particle Editor graphs via `NodeParticleSystemSet` (`Parse`/`ParseFromSnippetAsync` → `buildAsync` → `start`), not the imperative classic `ParticleSystem` construction API (emitters, over-lifetime gradients, `minEmitBox`)."
|
|
7039
|
+
);
|
|
7231
7040
|
}
|
|
7232
7041
|
}
|
|
7233
7042
|
class GPUParticleSystem {
|
|
7234
7043
|
constructor() {
|
|
7235
|
-
unsupported(
|
|
7044
|
+
unsupported(
|
|
7045
|
+
"GPUParticleSystem",
|
|
7046
|
+
"Babylon Lite has no GPU-compute particle path. Its node-particle runtime (`NodeParticleSystemSet`) is a CPU struct-of-arrays simulation; use `NodeParticleSystemSet.ParseFromSnippetAsync` → `buildAsync` instead."
|
|
7047
|
+
);
|
|
7236
7048
|
}
|
|
7237
7049
|
}
|
|
7238
7050
|
class SolidParticleSystem {
|
|
7239
7051
|
constructor() {
|
|
7240
|
-
unsupported(
|
|
7052
|
+
unsupported(
|
|
7053
|
+
"SolidParticleSystem",
|
|
7054
|
+
"Solid particle systems (per-particle mesh copies) are not backed by Babylon Lite. Consider native thin instances for many-copies use cases; node-particle billboards are available via `NodeParticleSystemSet`."
|
|
7055
|
+
);
|
|
7241
7056
|
}
|
|
7242
7057
|
}
|
|
7243
7058
|
class HighlightLayer {
|
|
@@ -7250,11 +7065,6 @@ class GlowLayer {
|
|
|
7250
7065
|
unsupported("GlowLayer", "Effect layers are not implemented in Babylon Lite. For a bloom-style glow, use the native bloom post-process task.");
|
|
7251
7066
|
}
|
|
7252
7067
|
}
|
|
7253
|
-
class LinesMesh {
|
|
7254
|
-
constructor() {
|
|
7255
|
-
unsupported("LinesMesh", "Line meshes are not implemented in Babylon Lite.");
|
|
7256
|
-
}
|
|
7257
|
-
}
|
|
7258
7068
|
class GreasedLineMesh {
|
|
7259
7069
|
constructor() {
|
|
7260
7070
|
unsupported("GreasedLineMesh", "Greased-line meshes are not implemented in Babylon Lite.");
|
|
@@ -7462,12 +7272,10 @@ class SSAO2RenderingPipeline {
|
|
|
7462
7272
|
}
|
|
7463
7273
|
class ParticleHelper {
|
|
7464
7274
|
constructor() {
|
|
7465
|
-
unsupported(
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
constructor() {
|
|
7470
|
-
unsupported("ParticleSystemSet", "Particle systems are not implemented in Babylon Lite.");
|
|
7275
|
+
unsupported(
|
|
7276
|
+
"ParticleHelper",
|
|
7277
|
+
"The imperative particle-preset helper is not backed. Babylon Lite renders serialized Node Particle Editor graphs (`NodeParticleSystemSet.ParseFromSnippetAsync` → `buildAsync`), not preset-driven imperative `ParticleSystem`s."
|
|
7278
|
+
);
|
|
7471
7279
|
}
|
|
7472
7280
|
}
|
|
7473
7281
|
class PointsCloudSystem {
|
|
@@ -7555,6 +7363,139 @@ class SceneOptimizer {
|
|
|
7555
7363
|
unsupported("SceneOptimizer", "Automatic scene optimisation is not implemented in the compat layer.");
|
|
7556
7364
|
}
|
|
7557
7365
|
}
|
|
7366
|
+
class ParticleSystemSet {
|
|
7367
|
+
constructor() {
|
|
7368
|
+
/** @internal The built Lite node-particle set (null for a directly-constructed empty set). */
|
|
7369
|
+
__publicField(this, "_lite", null);
|
|
7370
|
+
/** @internal The compat scene the set was built against (set by `buildAsync`). */
|
|
7371
|
+
__publicField(this, "_scene", null);
|
|
7372
|
+
__publicField(this, "_started", false);
|
|
7373
|
+
}
|
|
7374
|
+
getClassName() {
|
|
7375
|
+
return "ParticleSystemSet";
|
|
7376
|
+
}
|
|
7377
|
+
/**
|
|
7378
|
+
* Babylon.js `ParticleSystemSet.systems` — the array of per-system
|
|
7379
|
+
* `ParticleSystem` handles. Not backed: Lite's node-particle runtime is a fused
|
|
7380
|
+
* struct-of-arrays simulation with no per-system BJS `ParticleSystem` object to
|
|
7381
|
+
* expose. Drive the set as a whole via {@link start} instead.
|
|
7382
|
+
*/
|
|
7383
|
+
get systems() {
|
|
7384
|
+
return unsupported(
|
|
7385
|
+
"ParticleSystemSet.systems",
|
|
7386
|
+
"Babylon Lite's node-particle runtime is a fused struct-of-arrays simulation and exposes no per-system BJS ParticleSystem handle. Start/stop the whole set via `set.start()` / `set.dispose()`."
|
|
7387
|
+
);
|
|
7388
|
+
}
|
|
7389
|
+
/**
|
|
7390
|
+
* Babylon.js `ParticleSystemSet.start()` — begin all systems. Forwards to Lite
|
|
7391
|
+
* `registerNodeParticleSet`, which renders each system as a camera-facing
|
|
7392
|
+
* billboard and advances it once per frame. Idempotent.
|
|
7393
|
+
*/
|
|
7394
|
+
start() {
|
|
7395
|
+
if (this._started || !this._lite || !this._scene) {
|
|
7396
|
+
return;
|
|
7397
|
+
}
|
|
7398
|
+
this._started = true;
|
|
7399
|
+
registerNodeParticleSet(this._scene._lite, this._lite, { autoStart: true });
|
|
7400
|
+
}
|
|
7401
|
+
/**
|
|
7402
|
+
* Babylon.js `ParticleSystemSet.dispose()` — stop the systems. Lite exposes no
|
|
7403
|
+
* unregister for an already-registered billboard system, so this stops emission
|
|
7404
|
+
* on every built system (via `stopParticleSystem`); the last-emitted particles
|
|
7405
|
+
* finish their lifetime.
|
|
7406
|
+
*/
|
|
7407
|
+
dispose() {
|
|
7408
|
+
if (!this._lite) {
|
|
7409
|
+
return;
|
|
7410
|
+
}
|
|
7411
|
+
for (const system of this._lite.systems) {
|
|
7412
|
+
stopParticleSystem(system);
|
|
7413
|
+
}
|
|
7414
|
+
}
|
|
7415
|
+
}
|
|
7416
|
+
class NodeParticleSystemSet {
|
|
7417
|
+
constructor(name = "") {
|
|
7418
|
+
__publicField(this, "name");
|
|
7419
|
+
/** @internal Inline serialized graph (from `Parse` / `ParseFromFileAsync`); null when built from a snippet id. */
|
|
7420
|
+
__publicField(this, "_source", null);
|
|
7421
|
+
/** @internal Snippet id (from `ParseFromSnippetAsync`); null when built from inline JSON. */
|
|
7422
|
+
__publicField(this, "_snippetId", null);
|
|
7423
|
+
this.name = name;
|
|
7424
|
+
}
|
|
7425
|
+
getClassName() {
|
|
7426
|
+
return "NodeParticleSystemSet";
|
|
7427
|
+
}
|
|
7428
|
+
/**
|
|
7429
|
+
* Babylon.js `NodeParticleSystemSet.buildAsync(scene)` — compile the graph into
|
|
7430
|
+
* a live {@link ParticleSystemSet}. Forwards to Lite
|
|
7431
|
+
* `parseNodeParticleSetFromSnippet`, which parses and builds in one shot (from
|
|
7432
|
+
* the recorded snippet id or inline JSON).
|
|
7433
|
+
*/
|
|
7434
|
+
async buildAsync(scene, _verbose = false) {
|
|
7435
|
+
const engine = scene.getEngine()._lite;
|
|
7436
|
+
const liteSet = this._snippetId !== null ? await parseNodeParticleSetFromSnippet(engine, scene._lite, this._snippetId, {}) : await parseNodeParticleSetFromSnippet(engine, scene._lite, "", { json: this._source ?? {} });
|
|
7437
|
+
const set2 = new ParticleSystemSet();
|
|
7438
|
+
set2._lite = liteSet;
|
|
7439
|
+
set2._scene = scene;
|
|
7440
|
+
return set2;
|
|
7441
|
+
}
|
|
7442
|
+
/** Babylon.js `NodeParticleSystemSet.Parse(source)` — deserialize an inline graph. */
|
|
7443
|
+
static Parse(source) {
|
|
7444
|
+
const name = (source == null ? void 0 : source.name) ?? "";
|
|
7445
|
+
const set2 = new NodeParticleSystemSet(name);
|
|
7446
|
+
set2._source = source;
|
|
7447
|
+
return set2;
|
|
7448
|
+
}
|
|
7449
|
+
/**
|
|
7450
|
+
* Babylon.js `NodeParticleSystemSet.ParseFromSnippetAsync(snippetId)` — load a
|
|
7451
|
+
* graph from the snippet server. The network fetch is deferred to `buildAsync`
|
|
7452
|
+
* (Lite fuses fetch+parse+build), so this resolves immediately with the id.
|
|
7453
|
+
*/
|
|
7454
|
+
static ParseFromSnippetAsync(snippetId, nodeParticleSet) {
|
|
7455
|
+
const set2 = nodeParticleSet ?? new NodeParticleSystemSet();
|
|
7456
|
+
set2._snippetId = snippetId;
|
|
7457
|
+
set2.name = snippetId;
|
|
7458
|
+
return Promise.resolve(set2);
|
|
7459
|
+
}
|
|
7460
|
+
/**
|
|
7461
|
+
* Babylon.js `NodeParticleSystemSet.ParseFromFileAsync(name, url)` — load a
|
|
7462
|
+
* serialized graph from a URL, then behave like {@link Parse}.
|
|
7463
|
+
*/
|
|
7464
|
+
static async ParseFromFileAsync(name, url, nodeParticleSet) {
|
|
7465
|
+
const response = await fetch(url);
|
|
7466
|
+
const source = await response.json();
|
|
7467
|
+
const set2 = nodeParticleSet ?? new NodeParticleSystemSet(name);
|
|
7468
|
+
set2.name = name;
|
|
7469
|
+
set2._source = source;
|
|
7470
|
+
return set2;
|
|
7471
|
+
}
|
|
7472
|
+
/** Babylon.js `NodeParticleSystemSet.CreateDefault(name)`. Requires programmatic block authoring — not backed. */
|
|
7473
|
+
static CreateDefault(_name) {
|
|
7474
|
+
return unsupported(
|
|
7475
|
+
"NodeParticleSystemSet.CreateDefault",
|
|
7476
|
+
"Babylon Lite consumes a serialized node-particle graph (snippet id or JSON); it has no programmatic block-authoring API to assemble a default graph. Load a graph via `Parse` / `ParseFromSnippetAsync` instead."
|
|
7477
|
+
);
|
|
7478
|
+
}
|
|
7479
|
+
get attachedBlocks() {
|
|
7480
|
+
return unsupported(
|
|
7481
|
+
"NodeParticleSystemSet.attachedBlocks",
|
|
7482
|
+
"Babylon Lite consumes a serialized node-particle graph and exposes no programmatic block graph. Load and build a graph via `Parse` / `ParseFromSnippetAsync` + `buildAsync`."
|
|
7483
|
+
);
|
|
7484
|
+
}
|
|
7485
|
+
getBlockByName(_name) {
|
|
7486
|
+
return unsupported("NodeParticleSystemSet.getBlockByName", "Babylon Lite exposes no programmatic node-particle block graph to query.");
|
|
7487
|
+
}
|
|
7488
|
+
serialize() {
|
|
7489
|
+
return unsupported("NodeParticleSystemSet.serialize", "Babylon Lite exposes no programmatic node-particle block graph to serialize.");
|
|
7490
|
+
}
|
|
7491
|
+
editAsync() {
|
|
7492
|
+
return unsupported("NodeParticleSystemSet.editAsync", "The Node Particle Editor UI is not part of the Babylon Lite compat layer.");
|
|
7493
|
+
}
|
|
7494
|
+
dispose() {
|
|
7495
|
+
this._source = null;
|
|
7496
|
+
this._snippetId = null;
|
|
7497
|
+
}
|
|
7498
|
+
}
|
|
7558
7499
|
export {
|
|
7559
7500
|
AbstractAssetTask,
|
|
7560
7501
|
AbstractAudioAnalyzer,
|
|
@@ -7606,11 +7547,11 @@ export {
|
|
|
7606
7547
|
Bone,
|
|
7607
7548
|
BounceEase,
|
|
7608
7549
|
BouncingBehavior,
|
|
7609
|
-
|
|
7550
|
+
B as BoundingBox,
|
|
7610
7551
|
BoundingBoxGizmo,
|
|
7611
7552
|
BoundingBoxRenderer,
|
|
7612
|
-
BoundingInfo,
|
|
7613
|
-
|
|
7553
|
+
c as BoundingInfo,
|
|
7554
|
+
d as BoundingSphere,
|
|
7614
7555
|
CSG,
|
|
7615
7556
|
CSG2,
|
|
7616
7557
|
Camera,
|
|
@@ -7628,19 +7569,25 @@ export {
|
|
|
7628
7569
|
Constants,
|
|
7629
7570
|
CreateAudioBusAsync,
|
|
7630
7571
|
CreateAudioEngineAsync,
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7572
|
+
e as CreateBox,
|
|
7573
|
+
f as CreateCylinder,
|
|
7574
|
+
g as CreateDisc,
|
|
7575
|
+
h as CreateGround,
|
|
7576
|
+
i as CreateLineSystem,
|
|
7577
|
+
j as CreateLines,
|
|
7635
7578
|
CreateMainAudioBusAsync,
|
|
7636
7579
|
CreateMicrophoneSoundSourceAsync,
|
|
7637
|
-
|
|
7580
|
+
k as CreatePlane,
|
|
7638
7581
|
CreateSoundAsync,
|
|
7639
7582
|
CreateSoundBufferAsync,
|
|
7640
7583
|
CreateSoundSourceAsync,
|
|
7641
|
-
|
|
7584
|
+
m as CreateSphere,
|
|
7642
7585
|
CreateStreamingSoundAsync,
|
|
7643
|
-
|
|
7586
|
+
CreateTexture2DArrayFromImageUrlsAsync,
|
|
7587
|
+
CreateTexture2DArrayFromKTX2Async,
|
|
7588
|
+
n as CreateTiledBox,
|
|
7589
|
+
o as CreateTiledPlane,
|
|
7590
|
+
p as CreateTorus,
|
|
7644
7591
|
CubeTexture,
|
|
7645
7592
|
CubicEase,
|
|
7646
7593
|
Curve3,
|
|
@@ -7707,15 +7654,16 @@ export {
|
|
|
7707
7654
|
Layer,
|
|
7708
7655
|
Light,
|
|
7709
7656
|
LightGizmo,
|
|
7710
|
-
LinesMesh,
|
|
7657
|
+
q as LinesMesh,
|
|
7711
7658
|
LiteCompatError,
|
|
7712
7659
|
LoadAssetContainerAsync,
|
|
7660
|
+
LoadImageToTexture2DArrayLayerAsync,
|
|
7713
7661
|
Logger,
|
|
7714
7662
|
MainAudioBus,
|
|
7715
|
-
Material,
|
|
7663
|
+
r as Material,
|
|
7716
7664
|
Matrix,
|
|
7717
7665
|
Mesh,
|
|
7718
|
-
|
|
7666
|
+
s as MeshBuilder,
|
|
7719
7667
|
MeshoptCompression,
|
|
7720
7668
|
MirrorTexture,
|
|
7721
7669
|
MorphTarget,
|
|
@@ -7724,18 +7672,19 @@ export {
|
|
|
7724
7672
|
MultiPointerScaleBehavior,
|
|
7725
7673
|
Node,
|
|
7726
7674
|
NodeMaterial,
|
|
7675
|
+
NodeParticleSystemSet,
|
|
7727
7676
|
NullEngine,
|
|
7728
7677
|
OBJFileLoader,
|
|
7729
7678
|
Observable,
|
|
7730
7679
|
OnAudioEngineV2CreatedObservable,
|
|
7731
7680
|
OutlineRenderer,
|
|
7732
|
-
PBRAnisotropicConfiguration,
|
|
7733
|
-
PBRClearCoatConfiguration,
|
|
7734
|
-
PBRIridescenceConfiguration,
|
|
7735
|
-
PBRMaterial,
|
|
7736
|
-
PBRMetallicRoughnessMaterial,
|
|
7737
|
-
PBRSheenConfiguration,
|
|
7738
|
-
PBRSpecularGlossinessMaterial,
|
|
7681
|
+
P as PBRAnisotropicConfiguration,
|
|
7682
|
+
t as PBRClearCoatConfiguration,
|
|
7683
|
+
v as PBRIridescenceConfiguration,
|
|
7684
|
+
w as PBRMaterial,
|
|
7685
|
+
x as PBRMetallicRoughnessMaterial,
|
|
7686
|
+
y as PBRSheenConfiguration,
|
|
7687
|
+
z as PBRSpecularGlossinessMaterial,
|
|
7739
7688
|
ParticleHelper,
|
|
7740
7689
|
ParticleSystem,
|
|
7741
7690
|
ParticleSystemSet,
|
|
@@ -7759,12 +7708,13 @@ export {
|
|
|
7759
7708
|
PostProcess,
|
|
7760
7709
|
PrecisionDate,
|
|
7761
7710
|
PredicateCondition,
|
|
7762
|
-
PushMaterial,
|
|
7711
|
+
D as PushMaterial,
|
|
7763
7712
|
QuadraticEase,
|
|
7764
7713
|
QuarticEase,
|
|
7765
7714
|
Quaternion,
|
|
7766
7715
|
QuinticEase,
|
|
7767
7716
|
RawTexture,
|
|
7717
|
+
RawTexture2DArray,
|
|
7768
7718
|
RawTexture3D,
|
|
7769
7719
|
Ray,
|
|
7770
7720
|
RecastJSPlugin,
|
|
@@ -7821,21 +7771,22 @@ export {
|
|
|
7821
7771
|
UninstallHtmlInCanvasPolyfill,
|
|
7822
7772
|
UniversalCamera,
|
|
7823
7773
|
UploadHtmlElementToTexture,
|
|
7774
|
+
UploadImageToTexture2DArrayLayer,
|
|
7824
7775
|
UtilityLayerRenderer,
|
|
7825
7776
|
ValueCondition,
|
|
7826
7777
|
ValueConditionOperators,
|
|
7827
|
-
|
|
7778
|
+
E as Vector2,
|
|
7828
7779
|
Vector3,
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7780
|
+
F as Vector4,
|
|
7781
|
+
H as VertexBuffer,
|
|
7782
|
+
J as VertexData,
|
|
7832
7783
|
Viewport,
|
|
7833
7784
|
VirtualJoystick,
|
|
7834
7785
|
WebGPUEngine,
|
|
7835
7786
|
WebXRCamera,
|
|
7836
7787
|
WeightedSound,
|
|
7837
|
-
|
|
7838
|
-
|
|
7788
|
+
K as transformCoordinates,
|
|
7789
|
+
O as transformNormal,
|
|
7839
7790
|
unsupported
|
|
7840
7791
|
};
|
|
7841
7792
|
//# sourceMappingURL=index.js.map
|