@babylonjs/lite-compat 1.16.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/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, Q as Quaternion } from "./meshes-DduMsRJk.js";
5
- import { A, B, b, c, C, d, e, f, g, h, i, j, k, G, I, m, n, o, p, q, t, r } from "./meshes-DduMsRJk.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, markMaterialUboDirty, rebuildMaterial, createPbrMaterial, createSolidTexture2D, createStandardMaterial, 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";
7
- class Color3 {
8
- constructor(r2 = 0, g2 = 0, b2 = 0) {
9
- this.r = r2;
10
- this.g = g2;
11
- this.b = b2;
12
- }
13
- set(r2, g2, b2) {
14
- this.r = r2;
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(r2, g2, b2) {
77
- return new Color3(r2 / 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 r2 = 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(r2, 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(r2 = 0, g2 = 0, b2 = 0, a = 1) {
94
- this.r = r2;
95
- this.g = g2;
96
- this.b = b2;
97
- this.a = a;
98
- }
99
- set(r2, g2, b2, a) {
100
- this.r = r2;
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(r2, g2, b2, a) {
132
- return new Color4(r2 / 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, b2, value) {
150
- return a === b2 ? 0 : (value - a) / (b2 - 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, b2, epsilon = 1401298e-51) {
159
- return Math.abs(a - b2) <= epsilon;
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, b2, c2, d2) {
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, b2, c2);
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 x = this.normal.x;
232
- const y = this.normal.y;
233
- const z = this.normal.z;
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 = x * m2[0] + y * m2[1] + z * m2[2] + d2 * m2[3];
236
- const ny = x * m2[4] + y * m2[5] + z * m2[6] + d2 * m2[7];
237
- const nz = x * m2[8] + y * m2[9] + z * m2[10] + d2 * m2[11];
238
- const nd = x * m2[12] + y * m2[13] + z * m2[14] + d2 * m2[15];
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 x = spherePosition.x - this.origin.x;
266
- const y = spherePosition.y - this.origin.y;
267
- const z = spherePosition.z - this.origin.z;
268
- const pyth = x * x + y * y + z * z;
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 = x * this.direction.x + y * this.direction.y + z * this.direction.z;
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(x, y, z, dx, dy, dz, length = Number.MAX_VALUE) {
284
- return new Ray(new Vector3(x, y, z), new Vector3(dx, dy, dz), length);
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, b2, c2, d2) {
309
- plane.normal.set(a, b2, c2);
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(x, y, width, height) {
336
- this.x = x;
337
- this.y = 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 x = u * u * v0.x + 2 * u * t2 * v1.x + t2 * t2 * v2.x;
398
- const y = u * u * v0.y + 2 * u * t2 * v1.y + t2 * t2 * v2.y;
399
- const z = u * u * v0.z + 2 * u * t2 * v1.z + t2 * t2 * v2.z;
400
- points.push(new Vector3(x, y, z));
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
  }
@@ -572,7 +440,7 @@ class PerformanceMonitor {
572
440
  if (this._samples.length === 0) {
573
441
  return 0;
574
442
  }
575
- return this._samples.reduce((a, b2) => a + b2, 0) / this._samples.length;
443
+ return this._samples.reduce((a, b) => a + b, 0) / this._samples.length;
576
444
  }
577
445
  get averageFPS() {
578
446
  const avg = this.averageFrameTime;
@@ -1001,7 +869,7 @@ class AbstractEngine {
1001
869
  }
1002
870
  async _startCore() {
1003
871
  if (this._startupWork.length > 0) {
1004
- await Promise.all(this._startupWork.map((w) => w()));
872
+ await Promise.all(this._startupWork.map((w2) => w2()));
1005
873
  this._startupWork.length = 0;
1006
874
  }
1007
875
  for (const scene of this._scenes) {
@@ -1463,9 +1331,9 @@ class Camera extends Node {
1463
1331
  _aspectRatio() {
1464
1332
  const scene = this._scene;
1465
1333
  const canvas = scene == null ? void 0 : scene.getEngine().getRenderingCanvas();
1466
- const w = (canvas == null ? void 0 : canvas.width) ?? 1;
1334
+ const w2 = (canvas == null ? void 0 : canvas.width) ?? 1;
1467
1335
  const h2 = (canvas == null ? void 0 : canvas.height) ?? 1;
1468
- return h2 !== 0 ? w / h2 : 1;
1336
+ return h2 !== 0 ? w2 / h2 : 1;
1469
1337
  }
1470
1338
  detachControl() {
1471
1339
  if (this._detach) {
@@ -1661,10 +1529,10 @@ class FollowCamera extends TargetCamera {
1661
1529
  return;
1662
1530
  }
1663
1531
  const radians = this.rotationOffset * Math.PI / 180;
1664
- const x = target.position.x + this.radius * Math.sin(radians);
1665
- const z = target.position.z + this.radius * Math.cos(radians);
1666
- const y = target.position.y + this.heightOffset;
1667
- this._lite.position.set(x, y, z);
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);
1668
1536
  this.setTarget(new Vector3(target.position.x, target.position.y, target.position.z));
1669
1537
  }
1670
1538
  }
@@ -1730,720 +1598,6 @@ class AnaglyphArcRotateCamera {
1730
1598
  unsupported("AnaglyphArcRotateCamera", "Stereoscopic camera rigs are not implemented in Babylon Lite. (An anaglyph post-process exists separately.)");
1731
1599
  }
1732
1600
  }
1733
- class Material {
1734
- constructor(name, scene) {
1735
- __publicField(this, "name");
1736
- /** Common transparency mode flag (Babylon.js `Material.transparencyMode`). */
1737
- __publicField(this, "transparencyMode", null);
1738
- /** Back-face culling toggle (Babylon.js `Material.backFaceCulling`). */
1739
- __publicField(this, "_backFaceCulling", true);
1740
- /** Wireframe rendering toggle (not honoured by all Lite materials). */
1741
- __publicField(this, "wireframe", false);
1742
- /** @internal Owning compat scene, when constructed against one. */
1743
- __publicField(this, "_scene");
1744
- this.name = name;
1745
- this._scene = scene;
1746
- scene == null ? void 0 : scene._registerMaterial(this);
1747
- }
1748
- get backFaceCulling() {
1749
- return this._backFaceCulling;
1750
- }
1751
- set backFaceCulling(value) {
1752
- this._backFaceCulling = value;
1753
- this._applyBackFaceCulling(value);
1754
- this._markDirty();
1755
- }
1756
- /** @internal Per-material hook to push culling onto the Lite props (Standard vs PBR differ). */
1757
- _applyBackFaceCulling(_value) {
1758
- }
1759
- getClassName() {
1760
- return "Material";
1761
- }
1762
- /**
1763
- * @internal Copy the shared base + Lite data-property state onto a freshly
1764
- * constructed clone. The clone keeps the `_buildGroup`/UBO its own factory
1765
- * created (internal `_`-prefixed fields are never copied), so only the observable
1766
- * data properties — colours, scalars, and shared texture references — carry over.
1767
- */
1768
- _cloneBaseInto(target) {
1769
- copyLiteMaterialData(this._lite, target._lite);
1770
- target.transparencyMode = this.transparencyMode;
1771
- target.wireframe = this.wireframe;
1772
- target.backFaceCulling = this._backFaceCulling;
1773
- }
1774
- /** The scene this material was constructed against (Babylon.js `Material.getScene`). */
1775
- getScene() {
1776
- return this._scene;
1777
- }
1778
- /**
1779
- * The textures currently bound to this material (Babylon.js
1780
- * `Material.getActiveTextures`). The base material owns no texture slots, so
1781
- * this returns an empty array; each subclass overrides it to enumerate its own
1782
- * slots and those of its extensions.
1783
- */
1784
- getActiveTextures() {
1785
- return [];
1786
- }
1787
- _markDirty() {
1788
- markMaterialUboDirty(this._lite);
1789
- }
1790
- /**
1791
- * @internal Finalize GPU-facing resources before the mesh is registered.
1792
- * Base materials need nothing; PBR overrides this to synthesize the solid
1793
- * textures Babylon Lite's PBR pipeline requires from factor-only materials.
1794
- */
1795
- _ensureRenderable(_engine) {
1796
- }
1797
- /**
1798
- * @internal Adopt an owning scene discovered when the material is first assigned
1799
- * to a mesh (Babylon.js allows `new StandardMaterial(name)` with no scene, then
1800
- * `mesh.material = mat`). Needed so the texture-readiness path can reconcile the
1801
- * material into the running scene. Registers with the scene the first time.
1802
- */
1803
- _adoptScene(scene) {
1804
- if (!this._scene) {
1805
- this._scene = scene;
1806
- scene._registerMaterial(this);
1807
- }
1808
- }
1809
- /**
1810
- * @internal Reconcile this material into its scene when the scene is already
1811
- * live: finalize GPU-facing resources ({@link _ensureRenderable}) and rebuild
1812
- * the renderables of every mesh using it. A no-op before engine start (the
1813
- * boot-time build handles those meshes) or when the material has no scene.
1814
- * Shared by the mesh `material` setter and the texture-readiness callback.
1815
- */
1816
- _refreshInScene() {
1817
- const scene = this._scene;
1818
- if (!(scene == null ? void 0 : scene._hasStarted)) {
1819
- return;
1820
- }
1821
- this._ensureRenderable(scene.getEngine()._lite);
1822
- rebuildMaterial(scene._lite, this._lite);
1823
- }
1824
- /**
1825
- * @internal Rebind + rebuild this material once an asynchronously loaded texture
1826
- * assigned to it becomes GPU-ready. Babylon.js `Texture`s load in the background,
1827
- * so a texture assigned to a material (or a material assigned to a mesh) before
1828
- * the load resolves must go back through the rebuild path once the handle exists.
1829
- * Fires immediately when the texture is already ready (then gated by scene state).
1830
- */
1831
- _watchTexture(texture) {
1832
- var _a;
1833
- (_a = texture == null ? void 0 : texture._onReady) == null ? void 0 : _a.call(texture, () => this._refreshInScene());
1834
- }
1835
- dispose() {
1836
- var _a;
1837
- (_a = this._scene) == null ? void 0 : _a._unregisterMaterial(this);
1838
- this._scene = void 0;
1839
- }
1840
- }
1841
- class PushMaterial extends Material {
1842
- getClassName() {
1843
- return "PushMaterial";
1844
- }
1845
- }
1846
- function readColor3(tuple) {
1847
- return tuple ? new Color3(tuple[0], tuple[1], tuple[2]) : new Color3(0, 0, 0);
1848
- }
1849
- function copyLiteMaterialData(src, dst) {
1850
- const s = src;
1851
- const d2 = dst;
1852
- for (const key of Object.keys(s)) {
1853
- if (key.startsWith("_")) {
1854
- continue;
1855
- }
1856
- const value = s[key];
1857
- d2[key] = Array.isArray(value) ? value.slice() : value;
1858
- }
1859
- }
1860
- class StandardMaterial extends PushMaterial {
1861
- constructor(name, scene) {
1862
- super(name, scene);
1863
- /** @internal Underlying Babylon Lite standard-material props. */
1864
- __publicField(this, "_lite");
1865
- /**
1866
- * Babylon.js `StandardMaterial.useAlphaFromDiffuseTexture`. Babylon Lite's
1867
- * alpha test already samples the diffuse texture's alpha (enabled via
1868
- * `alphaCutOff`), so this is accepted for parity.
1869
- */
1870
- __publicField(this, "useAlphaFromDiffuseTexture", false);
1871
- __publicField(this, "_diffuseTexture", null);
1872
- __publicField(this, "_bumpTexture", null);
1873
- __publicField(this, "_emissiveTexture", null);
1874
- this._lite = createStandardMaterial();
1875
- }
1876
- getClassName() {
1877
- return "StandardMaterial";
1878
- }
1879
- get diffuseColor() {
1880
- return readColor3(this._lite.diffuseColor);
1881
- }
1882
- set diffuseColor(value) {
1883
- this._lite.diffuseColor = [value.r, value.g, value.b];
1884
- this._markDirty();
1885
- }
1886
- get specularColor() {
1887
- return readColor3(this._lite.specularColor);
1888
- }
1889
- set specularColor(value) {
1890
- this._lite.specularColor = [value.r, value.g, value.b];
1891
- this._markDirty();
1892
- }
1893
- get emissiveColor() {
1894
- return readColor3(this._lite.emissiveColor);
1895
- }
1896
- set emissiveColor(value) {
1897
- this._lite.emissiveColor = [value.r, value.g, value.b];
1898
- this._markDirty();
1899
- }
1900
- get ambientColor() {
1901
- return readColor3(this._lite.ambientColor);
1902
- }
1903
- set ambientColor(value) {
1904
- this._lite.ambientColor = [value.r, value.g, value.b];
1905
- this._markDirty();
1906
- }
1907
- get disableLighting() {
1908
- return this._lite.disableLighting;
1909
- }
1910
- set disableLighting(value) {
1911
- this._lite.disableLighting = value;
1912
- this._markDirty();
1913
- }
1914
- _applyBackFaceCulling(value) {
1915
- this._lite.backFaceCulling = value;
1916
- }
1917
- get alpha() {
1918
- return this._lite.alpha;
1919
- }
1920
- set alpha(value) {
1921
- this._lite.alpha = value;
1922
- this._markDirty();
1923
- }
1924
- get diffuseTexture() {
1925
- return this._diffuseTexture;
1926
- }
1927
- set diffuseTexture(texture) {
1928
- this._diffuseTexture = texture;
1929
- this._lite.diffuseTexture = (texture == null ? void 0 : texture._lite) ?? null;
1930
- this._watchTexture(texture);
1931
- this._markDirty();
1932
- }
1933
- /**
1934
- * Babylon.js `StandardMaterial.alphaCutOff` — alpha-test threshold. Fragments
1935
- * whose diffuse-texture alpha is below this value are discarded. Babylon Lite's
1936
- * Standard pipeline alpha-tests against the diffuse texture's alpha when
1937
- * `alphaCutOff > 0`, so this is wired directly.
1938
- */
1939
- get alphaCutOff() {
1940
- return this._lite.alphaCutOff;
1941
- }
1942
- set alphaCutOff(value) {
1943
- this._lite.alphaCutOff = value;
1944
- this._markDirty();
1945
- }
1946
- get bumpTexture() {
1947
- return this._bumpTexture;
1948
- }
1949
- set bumpTexture(texture) {
1950
- this._bumpTexture = texture;
1951
- this._lite.bumpTexture = (texture == null ? void 0 : texture._lite) ?? null;
1952
- this._watchTexture(texture);
1953
- this._markDirty();
1954
- }
1955
- get emissiveTexture() {
1956
- return this._emissiveTexture;
1957
- }
1958
- set emissiveTexture(texture) {
1959
- this._emissiveTexture = texture;
1960
- this._lite.emissiveTexture = (texture == null ? void 0 : texture._lite) ?? null;
1961
- this._watchTexture(texture);
1962
- this._markDirty();
1963
- }
1964
- /** Enumerate the standard-material texture slots that are bound (Babylon.js `getActiveTextures`). */
1965
- getActiveTextures() {
1966
- const textures = [];
1967
- if (this._diffuseTexture) {
1968
- textures.push(this._diffuseTexture);
1969
- }
1970
- if (this._bumpTexture) {
1971
- textures.push(this._bumpTexture);
1972
- }
1973
- if (this._emissiveTexture) {
1974
- textures.push(this._emissiveTexture);
1975
- }
1976
- return textures;
1977
- }
1978
- /**
1979
- * @internal Re-bind texture maps to the Lite material. Babylon.js `Texture`s
1980
- * load asynchronously, so when `material.diffuseTexture = new Texture(url)` ran
1981
- * the Lite handle was still undefined. By engine-start the scene has awaited the
1982
- * loads, so copy the now-resolved handles (and UV tiling) onto the Lite props.
1983
- */
1984
- _ensureRenderable(_engine) {
1985
- const diff = this._diffuseTexture;
1986
- if (diff == null ? void 0 : diff._lite) {
1987
- this._lite.diffuseTexture = diff._lite;
1988
- if (diff.uScale !== void 0 && diff.vScale !== void 0) {
1989
- this._lite.uvScale = [diff.uScale, diff.vScale];
1990
- }
1991
- }
1992
- const bump = this._bumpTexture;
1993
- if (bump == null ? void 0 : bump._lite) {
1994
- this._lite.bumpTexture = bump._lite;
1995
- }
1996
- const emissive = this._emissiveTexture;
1997
- if (emissive == null ? void 0 : emissive._lite) {
1998
- this._lite.emissiveTexture = emissive._lite;
1999
- }
2000
- this._markDirty();
2001
- }
2002
- /**
2003
- * Babylon.js `StandardMaterial.clone(name)`. Copies the diffuse/specular/emissive/
2004
- * ambient colours and scalars, shares the diffuse/bump/emissive texture references,
2005
- * and gives the clone its own Lite standard-material renderable.
2006
- */
2007
- clone(name) {
2008
- const cloned = new StandardMaterial(name, this._scene);
2009
- this._cloneBaseInto(cloned);
2010
- cloned.useAlphaFromDiffuseTexture = this.useAlphaFromDiffuseTexture;
2011
- cloned._diffuseTexture = this._diffuseTexture;
2012
- cloned._bumpTexture = this._bumpTexture;
2013
- cloned._emissiveTexture = this._emissiveTexture;
2014
- return cloned;
2015
- }
2016
- }
2017
- class PBRClearCoatConfiguration {
2018
- constructor(_props, _markDirty) {
2019
- this._props = _props;
2020
- this._markDirty = _markDirty;
2021
- }
2022
- get isEnabled() {
2023
- return this._props.isEnabled ?? false;
2024
- }
2025
- set isEnabled(value) {
2026
- this._props.isEnabled = value;
2027
- this._markDirty();
2028
- }
2029
- get intensity() {
2030
- return this._props.intensity ?? 1;
2031
- }
2032
- set intensity(value) {
2033
- this._props.intensity = value;
2034
- this._markDirty();
2035
- }
2036
- get roughness() {
2037
- return this._props.roughness ?? 0;
2038
- }
2039
- set roughness(value) {
2040
- this._props.roughness = value;
2041
- this._markDirty();
2042
- }
2043
- get indexOfRefraction() {
2044
- return this._props.indexOfRefraction ?? 1.5;
2045
- }
2046
- set indexOfRefraction(value) {
2047
- this._props.indexOfRefraction = value;
2048
- this._markDirty();
2049
- }
2050
- }
2051
- class PBRSheenConfiguration {
2052
- constructor(_props, _markDirty) {
2053
- __publicField(this, "_texture", null);
2054
- this._props = _props;
2055
- this._markDirty = _markDirty;
2056
- }
2057
- get isEnabled() {
2058
- return this._props.isEnabled;
2059
- }
2060
- set isEnabled(value) {
2061
- this._props.isEnabled = value;
2062
- this._markDirty();
2063
- }
2064
- get intensity() {
2065
- return this._props.intensity ?? 1;
2066
- }
2067
- set intensity(value) {
2068
- this._props.intensity = value;
2069
- this._markDirty();
2070
- }
2071
- get roughness() {
2072
- return this._props.roughness ?? 0;
2073
- }
2074
- set roughness(value) {
2075
- this._props.roughness = value;
2076
- this._markDirty();
2077
- }
2078
- get color() {
2079
- const c2 = this._props.color ?? [1, 1, 1];
2080
- return new Color3(c2[0], c2[1], c2[2]);
2081
- }
2082
- set color(value) {
2083
- this._props.color = [value.r, value.g, value.b];
2084
- this._markDirty();
2085
- }
2086
- /** Babylon.js `sheen.texture`. Retains the wrapper and binds the Lite handle if the texture has resolved. */
2087
- get texture() {
2088
- return this._texture;
2089
- }
2090
- set texture(value) {
2091
- this._texture = value;
2092
- if (value == null ? void 0 : value._lite) {
2093
- this._props.texture = value._lite;
2094
- } else {
2095
- delete this._props.texture;
2096
- }
2097
- this._markDirty();
2098
- }
2099
- /** Enumerate the sheen texture slot for `Material.getActiveTextures`. */
2100
- getActiveTextures() {
2101
- return this._texture ? [this._texture] : [];
2102
- }
2103
- }
2104
- class PBRAnisotropicConfiguration {
2105
- constructor(_props, _markDirty) {
2106
- this._props = _props;
2107
- this._markDirty = _markDirty;
2108
- }
2109
- get isEnabled() {
2110
- return this._props.isEnabled;
2111
- }
2112
- set isEnabled(value) {
2113
- this._props.isEnabled = value;
2114
- this._markDirty();
2115
- }
2116
- get intensity() {
2117
- return this._props.intensity ?? 1;
2118
- }
2119
- set intensity(value) {
2120
- this._props.intensity = value;
2121
- this._markDirty();
2122
- }
2123
- get direction() {
2124
- const d2 = this._props.direction ?? [1, 0];
2125
- return { x: d2[0], y: d2[1] };
2126
- }
2127
- set direction(value) {
2128
- this._props.direction = [value.x, value.y];
2129
- this._markDirty();
2130
- }
2131
- }
2132
- class PBRIridescenceConfiguration {
2133
- constructor(_props, _markDirty) {
2134
- this._props = _props;
2135
- this._markDirty = _markDirty;
2136
- }
2137
- get isEnabled() {
2138
- return this._props.isEnabled ?? false;
2139
- }
2140
- set isEnabled(value) {
2141
- this._props.isEnabled = value;
2142
- this._markDirty();
2143
- }
2144
- get intensity() {
2145
- return this._props.intensity ?? 1;
2146
- }
2147
- set intensity(value) {
2148
- this._props.intensity = value;
2149
- this._markDirty();
2150
- }
2151
- get indexOfRefraction() {
2152
- return this._props.indexOfRefraction ?? 1.3;
2153
- }
2154
- set indexOfRefraction(value) {
2155
- this._props.indexOfRefraction = value;
2156
- this._markDirty();
2157
- }
2158
- get minimumThickness() {
2159
- return this._props.minimumThickness ?? 100;
2160
- }
2161
- set minimumThickness(value) {
2162
- this._props.minimumThickness = value;
2163
- this._markDirty();
2164
- }
2165
- get maximumThickness() {
2166
- return this._props.maximumThickness ?? 400;
2167
- }
2168
- set maximumThickness(value) {
2169
- this._props.maximumThickness = value;
2170
- this._markDirty();
2171
- }
2172
- }
2173
- class PBRMaterial extends PushMaterial {
2174
- constructor(name, scene) {
2175
- super(name, scene);
2176
- /** @internal Underlying Babylon Lite PBR-material props. */
2177
- __publicField(this, "_lite");
2178
- __publicField(this, "_albedoFactor", [1, 1, 1, 1]);
2179
- __publicField(this, "_albedoTexture", null);
2180
- /**
2181
- * Babylon.js `material.forceIrradianceInFragment`. Babylon Lite computes
2182
- * irradiance in the fragment stage already, so this is accepted for parity.
2183
- */
2184
- __publicField(this, "forceIrradianceInFragment", false);
2185
- __publicField(this, "_clearCoat");
2186
- __publicField(this, "_sheen");
2187
- __publicField(this, "_anisotropy");
2188
- __publicField(this, "_iridescence");
2189
- __publicField(this, "_environmentTexture", null);
2190
- this._lite = createPbrMaterial();
2191
- if (!this._lite.baseColorFactor) {
2192
- this._lite.baseColorFactor = [1, 1, 1, 1];
2193
- }
2194
- }
2195
- getClassName() {
2196
- return "PBRMaterial";
2197
- }
2198
- get albedoColor() {
2199
- return new Color3(this._albedoFactor[0], this._albedoFactor[1], this._albedoFactor[2]);
2200
- }
2201
- set albedoColor(value) {
2202
- this._albedoFactor = [value.r, value.g, value.b, this._albedoFactor[3]];
2203
- this._lite.baseColorFactor = [...this._albedoFactor];
2204
- this._markDirty();
2205
- }
2206
- /**
2207
- * Babylon.js `pbr.albedoTexture` (glTF base-color map). The texture loads
2208
- * asynchronously, so the resolved Lite handle (+ sRGB flag) is bound in
2209
- * {@link _ensureRenderable} at engine start rather than here.
2210
- */
2211
- get albedoTexture() {
2212
- return this._albedoTexture;
2213
- }
2214
- set albedoTexture(texture) {
2215
- this._albedoTexture = texture;
2216
- this._watchTexture(texture);
2217
- this._markDirty();
2218
- }
2219
- /**
2220
- * Enumerate every bound PBR texture slot, including extension sub-configurations
2221
- * (Babylon.js `PBRMaterial.getActiveTextures`).
2222
- */
2223
- getActiveTextures() {
2224
- const textures = [];
2225
- if (this._albedoTexture) {
2226
- textures.push(this._albedoTexture);
2227
- }
2228
- const environmentTexture = this.environmentTexture;
2229
- if (environmentTexture) {
2230
- textures.push(environmentTexture);
2231
- }
2232
- if (this._sheen) {
2233
- textures.push(...this._sheen.getActiveTextures());
2234
- }
2235
- return textures;
2236
- }
2237
- get metallic() {
2238
- return this._lite.metallicFactor ?? 1;
2239
- }
2240
- set metallic(value) {
2241
- this._lite.metallicFactor = value;
2242
- this._markDirty();
2243
- }
2244
- get roughness() {
2245
- return this._lite.roughnessFactor ?? 1;
2246
- }
2247
- set roughness(value) {
2248
- this._lite.roughnessFactor = value;
2249
- this._markDirty();
2250
- }
2251
- get emissiveColor() {
2252
- return readColor3(this._lite.emissiveColor);
2253
- }
2254
- set emissiveColor(value) {
2255
- this._lite.emissiveColor = [value.r, value.g, value.b];
2256
- this._markDirty();
2257
- }
2258
- /**
2259
- * Babylon.js `pbr.usePhysicalLightFalloff`. When false, point/spot lights use
2260
- * Standard-style linear range falloff instead of physical inverse-square.
2261
- * Default true (matches Babylon.js PBRMaterial).
2262
- */
2263
- get usePhysicalLightFalloff() {
2264
- return this._lite.usePhysicalLightFalloff ?? true;
2265
- }
2266
- set usePhysicalLightFalloff(value) {
2267
- this._lite.usePhysicalLightFalloff = value;
2268
- this._markDirty();
2269
- }
2270
- get alpha() {
2271
- return this._lite.alpha ?? 1;
2272
- }
2273
- set alpha(value) {
2274
- this._lite.alpha = value;
2275
- this._markDirty();
2276
- }
2277
- _applyBackFaceCulling(value) {
2278
- this._lite.doubleSided = !value;
2279
- }
2280
- /**
2281
- * Babylon.js `pbr.clearCoat` sub-configuration. Lazily allocates the Lite
2282
- * `clearCoat` props on first access and proxies the common fields
2283
- * (`isEnabled`, `intensity`, `roughness`, `indexOfRefraction`) onto them.
2284
- */
2285
- get clearCoat() {
2286
- if (!this._clearCoat) {
2287
- if (!this._lite.clearCoat) {
2288
- this._lite.clearCoat = { isEnabled: false };
2289
- }
2290
- this._clearCoat = new PBRClearCoatConfiguration(this._lite.clearCoat, () => this._markDirty());
2291
- }
2292
- return this._clearCoat;
2293
- }
2294
- /** Babylon.js `pbr.sheen` sub-configuration (Lite `SheenProps`). */
2295
- get sheen() {
2296
- if (!this._sheen) {
2297
- if (!this._lite.sheen) {
2298
- this._lite.sheen = { isEnabled: false };
2299
- }
2300
- this._sheen = new PBRSheenConfiguration(this._lite.sheen, () => this._markDirty());
2301
- }
2302
- return this._sheen;
2303
- }
2304
- /** Babylon.js `pbr.anisotropy` sub-configuration (Lite `AnisotropyProps`). */
2305
- get anisotropy() {
2306
- if (!this._anisotropy) {
2307
- if (!this._lite.anisotropy) {
2308
- this._lite.anisotropy = { isEnabled: false };
2309
- }
2310
- this._anisotropy = new PBRAnisotropicConfiguration(this._lite.anisotropy, () => this._markDirty());
2311
- }
2312
- return this._anisotropy;
2313
- }
2314
- /** Babylon.js `pbr.iridescence` sub-configuration (Lite `IridescenceProps`). */
2315
- get iridescence() {
2316
- if (!this._iridescence) {
2317
- if (!this._lite.iridescence) {
2318
- this._lite.iridescence = { isEnabled: false };
2319
- }
2320
- this._iridescence = new PBRIridescenceConfiguration(this._lite.iridescence, () => this._markDirty());
2321
- }
2322
- return this._iridescence;
2323
- }
2324
- /**
2325
- * Babylon.js `material.environmentTexture` / `reflectionTexture`. Babylon Lite
2326
- * applies image-based lighting scene-wide rather than per-material, so a cube
2327
- * environment assigned to a material is routed to the owning scene's
2328
- * environment (the dominant single-IBL case Babylon.js scenes use).
2329
- */
2330
- get environmentTexture() {
2331
- var _a;
2332
- return this._environmentTexture ?? ((_a = this._scene) == null ? void 0 : _a.environmentTexture) ?? null;
2333
- }
2334
- set environmentTexture(value) {
2335
- this._environmentTexture = value;
2336
- if (this._scene) {
2337
- this._scene.environmentTexture = value;
2338
- }
2339
- }
2340
- get reflectionTexture() {
2341
- return this.environmentTexture;
2342
- }
2343
- set reflectionTexture(value) {
2344
- this.environmentTexture = value;
2345
- }
2346
- /** @internal Bind resolved textures and synthesize the solid textures Babylon Lite's PBR pipeline requires from a factor-only material. */
2347
- _ensureRenderable(engine) {
2348
- const lite = this._lite;
2349
- const albedo = this._albedoTexture;
2350
- if (albedo == null ? void 0 : albedo._lite) {
2351
- lite.baseColorTexture = albedo._lite;
2352
- lite.baseColorFactor = [...this._albedoFactor];
2353
- lite.gammaAlbedo = albedo.gammaSpace ?? true;
2354
- }
2355
- if (!lite.baseColorTexture) {
2356
- const f2 = this._albedoFactor;
2357
- lite.baseColorTexture = createSolidTexture2D(engine, f2[0], f2[1], f2[2], f2[3]);
2358
- lite.baseColorFactor = [1, 1, 1, 1];
2359
- }
2360
- if (!lite.ormTexture) {
2361
- const rough = lite.roughnessFactor ?? 1;
2362
- const metal = lite.metallicFactor ?? 1;
2363
- lite.ormTexture = createSolidTexture2D(engine, 1, rough, metal);
2364
- lite.roughnessFactor = 1;
2365
- lite.metallicFactor = 1;
2366
- }
2367
- }
2368
- /**
2369
- * Babylon.js `PBRMaterial.clone(name)`. Copies the albedo/metallic/roughness/
2370
- * emissive state, shares the albedo texture reference, gives the clone independent
2371
- * clearcoat/sheen/anisotropy/iridescence sub-configurations (sharing any nested
2372
- * texture), and a fresh Lite PBR renderable.
2373
- */
2374
- clone(name) {
2375
- const cloned = new PBRMaterial(name, this._scene);
2376
- this._clonePbrInto(cloned);
2377
- return cloned;
2378
- }
2379
- /**
2380
- * @internal Copy PBR-specific compat + Lite state onto a freshly constructed PBR
2381
- * clone (used by every `PBRMaterial` subclass so each returns its own concrete
2382
- * type). The base `_cloneBaseInto` shares the sub-config objects by reference; this
2383
- * re-copies them so the clone's `clearCoat`/`sheen`/… mutate independently while
2384
- * still sharing any nested texture handle.
2385
- */
2386
- _clonePbrInto(target) {
2387
- this._cloneBaseInto(target);
2388
- target.forceIrradianceInFragment = this.forceIrradianceInFragment;
2389
- target._albedoFactor = [...this._albedoFactor];
2390
- target._albedoTexture = this._albedoTexture;
2391
- const src = this._lite;
2392
- const dst = target._lite;
2393
- if (src.clearCoat) {
2394
- dst.clearCoat = { ...src.clearCoat };
2395
- }
2396
- if (src.sheen) {
2397
- dst.sheen = { ...src.sheen };
2398
- }
2399
- if (src.anisotropy) {
2400
- dst.anisotropy = { ...src.anisotropy };
2401
- }
2402
- if (src.iridescence) {
2403
- dst.iridescence = { ...src.iridescence };
2404
- }
2405
- }
2406
- }
2407
- class PBRMetallicRoughnessMaterial extends PBRMaterial {
2408
- getClassName() {
2409
- return "PBRMetallicRoughnessMaterial";
2410
- }
2411
- /** Alias of `albedoColor` (glTF "base color"). */
2412
- get baseColor() {
2413
- return this.albedoColor;
2414
- }
2415
- set baseColor(value) {
2416
- this.albedoColor = value;
2417
- }
2418
- clone(name) {
2419
- const cloned = new PBRMetallicRoughnessMaterial(name, this._scene);
2420
- this._clonePbrInto(cloned);
2421
- return cloned;
2422
- }
2423
- }
2424
- class PBRSpecularGlossinessMaterial extends PBRMaterial {
2425
- getClassName() {
2426
- return "PBRSpecularGlossinessMaterial";
2427
- }
2428
- get diffuseColor() {
2429
- return this.albedoColor;
2430
- }
2431
- set diffuseColor(value) {
2432
- this.albedoColor = value;
2433
- }
2434
- /** Maps glossiness → (1 - roughness). */
2435
- get glossiness() {
2436
- return 1 - this.roughness;
2437
- }
2438
- set glossiness(value) {
2439
- this.roughness = 1 - value;
2440
- }
2441
- clone(name) {
2442
- const cloned = new PBRSpecularGlossinessMaterial(name, this._scene);
2443
- this._clonePbrInto(cloned);
2444
- return cloned;
2445
- }
2446
- }
2447
1601
  const AnimationKeyInterpolation = {
2448
1602
  NONE: 0,
2449
1603
  STEP: 1
@@ -2472,7 +1626,7 @@ const _Animation = class _Animation {
2472
1626
  this.loopMode = loopMode;
2473
1627
  }
2474
1628
  setKeys(keys) {
2475
- this._keys = keys.slice().sort((a, b2) => a.frame - b2.frame);
1629
+ this._keys = keys.slice().sort((a, b) => a.frame - b.frame);
2476
1630
  }
2477
1631
  getKeys() {
2478
1632
  return this._keys;
@@ -2494,13 +1648,13 @@ const _Animation = class _Animation {
2494
1648
  }
2495
1649
  for (let i2 = 0; i2 < keys.length - 1; i2++) {
2496
1650
  const a = keys[i2];
2497
- const b2 = keys[i2 + 1];
2498
- if (frame >= a.frame && frame < b2.frame) {
1651
+ const b = keys[i2 + 1];
1652
+ if (frame >= a.frame && frame < b.frame) {
2499
1653
  if (a.interpolation === AnimationKeyInterpolation.STEP) {
2500
1654
  return a.value;
2501
1655
  }
2502
- const t2 = (frame - a.frame) / (b2.frame - a.frame);
2503
- return lerpValue(a.value, b2.value, t2);
1656
+ const t2 = (frame - a.frame) / (b.frame - a.frame);
1657
+ return lerpValue(a.value, b.value, t2);
2504
1658
  }
2505
1659
  }
2506
1660
  return keys[keys.length - 1].value;
@@ -2524,24 +1678,24 @@ __publicField(_Animation, "ANIMATIONLOOPMODE_RELATIVE", AnimationLoopModes.ANIMA
2524
1678
  __publicField(_Animation, "ANIMATIONLOOPMODE_CYCLE", AnimationLoopModes.ANIMATIONLOOPMODE_CYCLE);
2525
1679
  __publicField(_Animation, "ANIMATIONLOOPMODE_CONSTANT", AnimationLoopModes.ANIMATIONLOOPMODE_CONSTANT);
2526
1680
  let Animation = _Animation;
2527
- function lerpValue(a, b2, t2) {
2528
- if (typeof a === "number" && typeof b2 === "number") {
2529
- return a + (b2 - a) * t2;
1681
+ function lerpValue(a, b, t2) {
1682
+ if (typeof a === "number" && typeof b === "number") {
1683
+ return a + (b - a) * t2;
2530
1684
  }
2531
1685
  const av = a;
2532
- const bv = b2;
1686
+ const bv = b;
2533
1687
  return av.map((value, i2) => value + ((bv[i2] ?? value) - value) * t2);
2534
1688
  }
2535
1689
  function scaleValue(value, scale) {
2536
- return typeof value === "number" ? value * scale : value.map((v) => v * scale);
1690
+ return typeof value === "number" ? value * scale : value.map((v2) => v2 * scale);
2537
1691
  }
2538
1692
  function addValue(acc, value) {
2539
1693
  if (typeof acc === "number" && typeof value === "number") {
2540
1694
  return acc + value;
2541
1695
  }
2542
1696
  const a = acc;
2543
- const v = value;
2544
- return a.map((x, i2) => x + (v[i2] ?? 0));
1697
+ const v2 = value;
1698
+ return a.map((x2, i2) => x2 + (v2[i2] ?? 0));
2545
1699
  }
2546
1700
  function zeroLike(value) {
2547
1701
  return typeof value === "number" ? 0 : value.map(() => 0);
@@ -4276,7 +3430,7 @@ class GaussianSplattingMesh extends TransformNode {
4276
3430
  }
4277
3431
  /** @internal Babylon.js's worker-throttle flag; ported scenes poll it to detect the first sort. */
4278
3432
  get _canPostToWorker() {
4279
- return this._gs ? this._gs._canPostToWorker : false;
3433
+ return this._gs ? this._gs._orderPool.length === 2 : false;
4280
3434
  }
4281
3435
  /** @internal The loaded Lite splat node, for the GPU picker's result mapping (undefined until loaded). */
4282
3436
  get _pickLiteNode() {
@@ -4571,7 +3725,7 @@ class DynamicTexture extends BaseTexture {
4571
3725
  return { width: this._width, height: this._height };
4572
3726
  }
4573
3727
  /** Draw `text` and refresh the GPU texture. */
4574
- drawText(text, x, y, font, color, clearColor) {
3728
+ drawText(text, x2, y2, font, color, clearColor) {
4575
3729
  const ctx = this._context;
4576
3730
  if (clearColor) {
4577
3731
  ctx.fillStyle = clearColor;
@@ -4579,7 +3733,7 @@ class DynamicTexture extends BaseTexture {
4579
3733
  }
4580
3734
  ctx.font = font;
4581
3735
  ctx.fillStyle = color;
4582
- ctx.fillText(text, x, y);
3736
+ ctx.fillText(text, x2, y2);
4583
3737
  this.update();
4584
3738
  }
4585
3739
  /**
@@ -4595,13 +3749,13 @@ class DynamicTexture extends BaseTexture {
4595
3749
  return Promise.resolve();
4596
3750
  }
4597
3751
  }
4598
- class CubeTexture {
3752
+ class CubeTexture extends BaseTexture {
4599
3753
  constructor(url, _scene, _extensions, _noMipmap, _files, onLoad, _onError, _format, _prefiltered) {
3754
+ super();
4600
3755
  /** Source URL of the (prefiltered) environment. */
4601
3756
  __publicField(this, "url");
4602
3757
  /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */
4603
3758
  __publicField(this, "coordinatesMode", 0);
4604
- __publicField(this, "name");
4605
3759
  __publicField(this, "gammaSpace", true);
4606
3760
  __publicField(this, "level", 1);
4607
3761
  /**
@@ -4614,20 +3768,30 @@ class CubeTexture {
4614
3768
  /** Fires when the cube map is "ready" (resolved on a microtask in this compat layer). */
4615
3769
  __publicField(this, "onLoadObservable", new Observable());
4616
3770
  __publicField(this, "_ready", false);
3771
+ __publicField(this, "_readyPromise");
4617
3772
  this.url = url;
4618
3773
  this.name = url;
4619
- queueMicrotask(() => {
4620
- this._ready = true;
4621
- if (onLoad) {
4622
- onLoad();
4623
- }
4624
- this.onLoadObservable.notifyObservers(this);
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
+ });
4625
3783
  });
4626
3784
  }
3785
+ getClassName() {
3786
+ return "CubeTexture";
3787
+ }
4627
3788
  /** Babylon.js `BaseTexture.isReady()`. */
4628
3789
  isReady() {
4629
3790
  return this._ready;
4630
3791
  }
3792
+ whenReadyAsync() {
3793
+ return this._readyPromise;
3794
+ }
4631
3795
  /** Babylon.js `CubeTexture.CreateFromPrefilteredData(url, scene)`. */
4632
3796
  static CreateFromPrefilteredData(url, scene) {
4633
3797
  return new CubeTexture(url, scene);
@@ -4635,15 +3799,15 @@ class CubeTexture {
4635
3799
  dispose() {
4636
3800
  }
4637
3801
  }
4638
- class HDRCubeTexture {
3802
+ class HDRCubeTexture extends BaseTexture {
4639
3803
  constructor(url, _sceneOrEngine, size = 256, _noMipmap, _generateHarmonics, _gammaSpace, _prefilterOnLoad, onLoad) {
3804
+ super();
4640
3805
  /** Source URL of the `.hdr` panorama. */
4641
3806
  __publicField(this, "url");
4642
3807
  /** Requested cubemap face size (BJS `size`); forwarded to Lite's `faceSize`. */
4643
3808
  __publicField(this, "size");
4644
3809
  /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */
4645
3810
  __publicField(this, "coordinatesMode", 0);
4646
- __publicField(this, "name");
4647
3811
  __publicField(this, "gammaSpace", true);
4648
3812
  __publicField(this, "level", 1);
4649
3813
  /** @internal Selects Lite's `loadHdrEnvironment` in the scene's env loader. */
@@ -4651,21 +3815,31 @@ class HDRCubeTexture {
4651
3815
  /** Fires when the HDR environment is "ready" (resolved on a microtask). */
4652
3816
  __publicField(this, "onLoadObservable", new Observable());
4653
3817
  __publicField(this, "_ready", false);
3818
+ __publicField(this, "_readyPromise");
4654
3819
  this.url = url;
4655
3820
  this.size = size;
4656
3821
  this.name = url;
4657
- queueMicrotask(() => {
4658
- this._ready = true;
4659
- if (onLoad) {
4660
- onLoad();
4661
- }
4662
- this.onLoadObservable.notifyObservers(this);
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
+ });
4663
3831
  });
4664
3832
  }
3833
+ getClassName() {
3834
+ return "HDRCubeTexture";
3835
+ }
4665
3836
  /** Babylon.js `BaseTexture.isReady()`. */
4666
3837
  isReady() {
4667
3838
  return this._ready;
4668
3839
  }
3840
+ whenReadyAsync() {
3841
+ return this._readyPromise;
3842
+ }
4669
3843
  dispose() {
4670
3844
  }
4671
3845
  }
@@ -5190,13 +4364,13 @@ class GPUPicker {
5190
4364
  this._pickable = /* @__PURE__ */ new Set();
5191
4365
  }
5192
4366
  /** Pick the mesh at canvas coordinates `(x, y)`. Resolves to `null` on a miss. */
5193
- async pickAsync(x, y, disposeWhenDone = false) {
4367
+ async pickAsync(x2, y2, disposeWhenDone = false) {
5194
4368
  if (this._inProgress || !this._picker || this._liteToCompat.size === 0) {
5195
4369
  return null;
5196
4370
  }
5197
4371
  this._inProgress = true;
5198
4372
  try {
5199
- const info = await pickAsync(this._picker, x, y, { filter: (mesh2) => this._pickable.has(mesh2) });
4373
+ const info = await pickAsync(this._picker, x2, y2, { filter: (mesh2) => this._pickable.has(mesh2) });
5200
4374
  if (!info.hit || !info.pickedMesh) {
5201
4375
  return null;
5202
4376
  }
@@ -5467,8 +4641,8 @@ class LightGizmo {
5467
4641
  get position() {
5468
4642
  return root.position;
5469
4643
  },
5470
- set position(v) {
5471
- root.position.set(v.x, v.y, v.z);
4644
+ set position(v2) {
4645
+ root.position.set(v2.x, v2.y, v2.z);
5472
4646
  }
5473
4647
  };
5474
4648
  }
@@ -6032,8 +5206,8 @@ class SpriteRenderer {
6032
5206
  const canvasHeight = this._engine.getRenderingCanvas().height;
6033
5207
  if (!this._built) {
6034
5208
  const layer2 = createSprite2DLayer(this._atlas, { capacity: this._capacity, depth: "none", blendMode: this._blend() });
6035
- for (const s of this._sprites) {
6036
- this._indices.push(addSprite2DIndex(layer2, this._spriteProps(s, canvasHeight)));
5209
+ for (const s2 of this._sprites) {
5210
+ this._indices.push(addSprite2DIndex(layer2, this._spriteProps(s2, canvasHeight)));
6037
5211
  }
6038
5212
  this._layer = layer2;
6039
5213
  const renderer = createSpriteRenderer(this._engine._lite, {
@@ -6055,16 +5229,16 @@ class SpriteRenderer {
6055
5229
  }
6056
5230
  }
6057
5231
  /** @internal Convert a BJS `ThinSprite` to Lite `Sprite2DProps` (Y-flip + rotation negate). */
6058
- _spriteProps(s, canvasHeight) {
5232
+ _spriteProps(s2, canvasHeight) {
6059
5233
  return {
6060
- positionPx: [s.position.x, canvasHeight - s.position.y],
6061
- sizePx: [s.width, s.height],
6062
- frame: s.cellIndex,
6063
- rotation: -s.angle,
6064
- color: [s.color.r, s.color.g, s.color.b, s.color.a],
6065
- flipX: s.invertU,
6066
- flipY: s.invertV,
6067
- visible: s.isVisible
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
6068
5242
  };
6069
5243
  }
6070
5244
  }
@@ -6523,8 +5697,8 @@ const Tools = {
6523
5697
  RandomId() {
6524
5698
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => {
6525
5699
  const r2 = Math.random() * 16 | 0;
6526
- const v = c2 === "x" ? r2 : r2 & 3 | 8;
6527
- return v.toString(16);
5700
+ const v2 = c2 === "x" ? r2 : r2 & 3 | 8;
5701
+ return v2.toString(16);
6528
5702
  });
6529
5703
  }
6530
5704
  };
@@ -7891,11 +7065,6 @@ class GlowLayer {
7891
7065
  unsupported("GlowLayer", "Effect layers are not implemented in Babylon Lite. For a bloom-style glow, use the native bloom post-process task.");
7892
7066
  }
7893
7067
  }
7894
- class LinesMesh {
7895
- constructor() {
7896
- unsupported("LinesMesh", "Line meshes are not implemented in Babylon Lite.");
7897
- }
7898
- }
7899
7068
  class GreasedLineMesh {
7900
7069
  constructor() {
7901
7070
  unsupported("GreasedLineMesh", "Greased-line meshes are not implemented in Babylon Lite.");
@@ -8381,8 +7550,8 @@ export {
8381
7550
  B as BoundingBox,
8382
7551
  BoundingBoxGizmo,
8383
7552
  BoundingBoxRenderer,
8384
- b as BoundingInfo,
8385
- c as BoundingSphere,
7553
+ c as BoundingInfo,
7554
+ d as BoundingSphere,
8386
7555
  CSG,
8387
7556
  CSG2,
8388
7557
  Camera,
@@ -8400,23 +7569,25 @@ export {
8400
7569
  Constants,
8401
7570
  CreateAudioBusAsync,
8402
7571
  CreateAudioEngineAsync,
8403
- C as CreateBox,
8404
- d as CreateCylinder,
8405
- e as CreateDisc,
8406
- f as CreateGround,
7572
+ e as CreateBox,
7573
+ f as CreateCylinder,
7574
+ g as CreateDisc,
7575
+ h as CreateGround,
7576
+ i as CreateLineSystem,
7577
+ j as CreateLines,
8407
7578
  CreateMainAudioBusAsync,
8408
7579
  CreateMicrophoneSoundSourceAsync,
8409
- g as CreatePlane,
7580
+ k as CreatePlane,
8410
7581
  CreateSoundAsync,
8411
7582
  CreateSoundBufferAsync,
8412
7583
  CreateSoundSourceAsync,
8413
- h as CreateSphere,
7584
+ m as CreateSphere,
8414
7585
  CreateStreamingSoundAsync,
8415
7586
  CreateTexture2DArrayFromImageUrlsAsync,
8416
7587
  CreateTexture2DArrayFromKTX2Async,
8417
- i as CreateTiledBox,
8418
- j as CreateTiledPlane,
8419
- k as CreateTorus,
7588
+ n as CreateTiledBox,
7589
+ o as CreateTiledPlane,
7590
+ p as CreateTorus,
8420
7591
  CubeTexture,
8421
7592
  CubicEase,
8422
7593
  Curve3,
@@ -8483,16 +7654,16 @@ export {
8483
7654
  Layer,
8484
7655
  Light,
8485
7656
  LightGizmo,
8486
- LinesMesh,
7657
+ q as LinesMesh,
8487
7658
  LiteCompatError,
8488
7659
  LoadAssetContainerAsync,
8489
7660
  LoadImageToTexture2DArrayLayerAsync,
8490
7661
  Logger,
8491
7662
  MainAudioBus,
8492
- Material,
7663
+ r as Material,
8493
7664
  Matrix,
8494
7665
  Mesh,
8495
- m as MeshBuilder,
7666
+ s as MeshBuilder,
8496
7667
  MeshoptCompression,
8497
7668
  MirrorTexture,
8498
7669
  MorphTarget,
@@ -8507,13 +7678,13 @@ export {
8507
7678
  Observable,
8508
7679
  OnAudioEngineV2CreatedObservable,
8509
7680
  OutlineRenderer,
8510
- PBRAnisotropicConfiguration,
8511
- PBRClearCoatConfiguration,
8512
- PBRIridescenceConfiguration,
8513
- PBRMaterial,
8514
- PBRMetallicRoughnessMaterial,
8515
- PBRSheenConfiguration,
8516
- 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,
8517
7688
  ParticleHelper,
8518
7689
  ParticleSystem,
8519
7690
  ParticleSystemSet,
@@ -8537,7 +7708,7 @@ export {
8537
7708
  PostProcess,
8538
7709
  PrecisionDate,
8539
7710
  PredicateCondition,
8540
- PushMaterial,
7711
+ D as PushMaterial,
8541
7712
  QuadraticEase,
8542
7713
  QuarticEase,
8543
7714
  Quaternion,
@@ -8604,18 +7775,18 @@ export {
8604
7775
  UtilityLayerRenderer,
8605
7776
  ValueCondition,
8606
7777
  ValueConditionOperators,
8607
- n as Vector2,
7778
+ E as Vector2,
8608
7779
  Vector3,
8609
- o as Vector4,
8610
- p as VertexBuffer,
8611
- q as VertexData,
7780
+ F as Vector4,
7781
+ H as VertexBuffer,
7782
+ J as VertexData,
8612
7783
  Viewport,
8613
7784
  VirtualJoystick,
8614
7785
  WebGPUEngine,
8615
7786
  WebXRCamera,
8616
7787
  WeightedSound,
8617
- t as transformCoordinates,
8618
- r as transformNormal,
7788
+ K as transformCoordinates,
7789
+ O as transformNormal,
8619
7790
  unsupported
8620
7791
  };
8621
7792
  //# sourceMappingURL=index.js.map