@babylonjs/lite-compat 1.24.0-preview → 1.25.0-preview

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,9 +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, C as Color3, S as StandardMaterial, a as Color4, b as Mesh, T as TransformNode, l as liteBackedVector3, Q as Quaternion } from "./meshes-CidWpEh8.js";
5
- import { A, B, c, d, e, f, g, h, i, j, k, m, n, o, p, q, G, I, r, s, t, P, v, w, x, y, z, D, E, F, H, J, K, O, R } from "./meshes-CidWpEh8.js";
6
- import { sampleHermiteSpline, sampleCatmullRomSpline, 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, createClusteredLightContainer, createClusteredPointLight, removeFromScene, addClusteredLightContainer, markClusteredLightContainerDirty, 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, startParticleSystem, animateParticleSystem, stopParticleSystem, createParticleBillboard, syncParticleBillboard, parseNodeParticleSetFromSnippet, registerNodeParticleSet } from "@babylonjs/lite";
4
+ import { V as Vector3, a as Vector2, u as unsupported, O as Observable, L as LiteCompatError, N as Node, M as Matrix, C as Color3, S as StandardMaterial, b as Color4, A as AbstractMesh, c as Mesh, T as TransformNode, l as liteBackedVector3, Q as Quaternion } from "./meshes-nWGELV98.js";
5
+ import { B, d, e, f, g, h, i, j, k, m, n, o, p, q, r, G, I, s, t, v, P, w, x, y, z, D, E, F, H, J, K, R, U } from "./meshes-nWGELV98.js";
6
+ import { addPolarToRef, subtractPolarToRef, multiplyPolarToRef, dividePolarToRef, scalePolarToRef, polarToVec2ToRef, polarFromVec2ToRef, addSphericalToRef, subtractSphericalToRef, multiplySphericalToRef, divideSphericalToRef, scaleSphericalToRef, sphericalToVec3ToRef, sphericalFromVec3ToRef, sampleHermiteSpline, sampleCatmullRomSpline, VERSION, createEngine, onBeforeRender, stopEngine, resizeEngine, setEngineSize, disposeEngine, uploadImageToArrayLayer, enableMirroredMeshes, registerSceneWithShadowSupport, registerScene, startEngine, createNullEngine, stepScene, setPhysicsTimestep, setPhysicsGravity, disposePhysics, createHavokWorld, createPhysicsShape, createPhysicsAggregate, createPhysicsBody, setPhysicsBodyPrestepType, PhysicsPrestepType as PhysicsPrestepType$1, PhysicsMotionType as PhysicsMotionType$1, setPhysicsBodyShape, setPhysicsBodyMotionType, setPhysicsBodyMassProperties, setPhysicsBodyLinearVelocity, getPhysicsBodyLinearVelocity, setPhysicsBodyAngularVelocity, getPhysicsBodyAngularVelocity, applyPhysicsBodyImpulse, applyPhysicsBodyForce, removePhysicsBody, PhysicsShapeType as PhysicsShapeType$1, setPhysicsShapeFilterMembershipMask, setPhysicsShapeFilterCollideMask, setPhysicsShapeMaterial, setPhysicsShapeIsTrigger, releasePhysicsShape, 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, pickMeshesWithRay, createAnimationManager, enableAnimationBlending, addAnimationGroup, disposeScene, createDirectionalLight, createPointLight, createSpotLight, createClusteredLightContainer, createClusteredPointLight, removeFromScene, addClusteredLightContainer, markClusteredLightContainerDirty, 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, setBonePosition, setBoneRotationQuaternion, setBoneScaling, clearBoneOverride, getBoneByName, enableBoneControlForSkinnedAssets, 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, startParticleSystem, animateParticleSystem, stopParticleSystem, createParticleBillboard, syncParticleBillboard, parseNodeParticleSetFromSnippet, registerNodeParticleSet } from "@babylonjs/lite";
7
7
  const Epsilon = 1e-3;
8
8
  const ToRadians = Math.PI / 180;
9
9
  const ToDegrees = 180 / Math.PI;
@@ -54,11 +54,11 @@ var Space = /* @__PURE__ */ ((Space2) => {
54
54
  return Space2;
55
55
  })(Space || {});
56
56
  class Plane {
57
- constructor(a, b, c2, d2) {
57
+ constructor(a, b, c, d2) {
58
58
  /** Normal x/y/z and signed distance `d` from the origin (`normal · p + d = 0`). */
59
59
  __publicField(this, "normal");
60
60
  __publicField(this, "d");
61
- this.normal = new Vector3(a, b, c2);
61
+ this.normal = new Vector3(a, b, c);
62
62
  this.d = d2;
63
63
  }
64
64
  asArray() {
@@ -173,8 +173,8 @@ const Frustum = {
173
173
  set(planes[5], m2[3] - m2[2], m2[7] - m2[6], m2[11] - m2[10], m2[15] - m2[14]);
174
174
  }
175
175
  };
176
- function set(plane, a, b, c2, d2) {
177
- plane.normal.set(a, b, c2);
176
+ function set(plane, a, b, c, d2) {
177
+ plane.normal.set(a, b, c);
178
178
  plane.d = d2;
179
179
  plane.normalize();
180
180
  }
@@ -214,6 +214,220 @@ class Viewport {
214
214
  return new Viewport(this.x, this.y, this.width, this.height);
215
215
  }
216
216
  }
217
+ class Polar {
218
+ constructor(radius, theta) {
219
+ this.radius = radius;
220
+ this.theta = theta;
221
+ }
222
+ getClassName() {
223
+ return "Polar";
224
+ }
225
+ toString() {
226
+ return JSON.stringify(this);
227
+ }
228
+ asArray() {
229
+ return [this.radius, this.theta];
230
+ }
231
+ addToRef(polar, ref) {
232
+ return addPolarToRef(this, polar, ref);
233
+ }
234
+ add(polar) {
235
+ return this.addToRef(polar, new Polar(0, 0));
236
+ }
237
+ addInPlace(polar) {
238
+ this.addToRef(polar, this);
239
+ return this;
240
+ }
241
+ addInPlaceFromFloats(radius, theta) {
242
+ return this.addInPlace(new Polar(radius, theta));
243
+ }
244
+ subtractToRef(polar, ref) {
245
+ return subtractPolarToRef(this, polar, ref);
246
+ }
247
+ subtract(polar) {
248
+ return this.subtractToRef(polar, new Polar(0, 0));
249
+ }
250
+ subtractInPlace(polar) {
251
+ this.subtractToRef(polar, this);
252
+ return this;
253
+ }
254
+ subtractFromFloatsToRef(radius, theta, ref) {
255
+ return this.subtractToRef(new Polar(radius, theta), ref);
256
+ }
257
+ subtractFromFloats(radius, theta) {
258
+ return this.subtractFromFloatsToRef(radius, theta, new Polar(0, 0));
259
+ }
260
+ multiplyToRef(polar, ref) {
261
+ return multiplyPolarToRef(this, polar, ref);
262
+ }
263
+ multiply(polar) {
264
+ return this.multiplyToRef(polar, new Polar(0, 0));
265
+ }
266
+ multiplyInPlace(polar) {
267
+ this.multiplyToRef(polar, this);
268
+ return this;
269
+ }
270
+ divideToRef(polar, ref) {
271
+ return dividePolarToRef(this, polar, ref);
272
+ }
273
+ divide(polar) {
274
+ return this.divideToRef(polar, new Polar(0, 0));
275
+ }
276
+ divideInPlace(polar) {
277
+ this.divideToRef(polar, this);
278
+ return this;
279
+ }
280
+ clone() {
281
+ return new Polar(this.radius, this.theta);
282
+ }
283
+ copyFrom(source) {
284
+ return this.copyFromFloats(source.radius, source.theta);
285
+ }
286
+ copyFromFloats(radius, theta) {
287
+ this.radius = radius;
288
+ this.theta = theta;
289
+ return this;
290
+ }
291
+ scaleToRef(scale, ref) {
292
+ return scalePolarToRef(this, scale, ref);
293
+ }
294
+ scale(scale) {
295
+ return this.scaleToRef(scale, new Polar(0, 0));
296
+ }
297
+ scaleInPlace(scale) {
298
+ this.scaleToRef(scale, this);
299
+ return this;
300
+ }
301
+ set(radius, theta) {
302
+ return this.copyFromFloats(radius, theta);
303
+ }
304
+ setAll(value) {
305
+ return this.set(value, value);
306
+ }
307
+ toVector2ToRef(ref) {
308
+ return polarToVec2ToRef(this, ref);
309
+ }
310
+ toVector2() {
311
+ return this.toVector2ToRef(new Vector2());
312
+ }
313
+ static FromVector2ToRef(vector, ref) {
314
+ return polarFromVec2ToRef(vector, ref);
315
+ }
316
+ static FromVector2(vector) {
317
+ return Polar.FromVector2ToRef(vector, new Polar(0, 0));
318
+ }
319
+ static FromArray(array) {
320
+ return new Polar(array[0], array[1]);
321
+ }
322
+ }
323
+ class Spherical {
324
+ constructor(radius, theta, phi) {
325
+ this.radius = radius;
326
+ this.theta = theta;
327
+ this.phi = phi;
328
+ }
329
+ getClassName() {
330
+ return "Spherical";
331
+ }
332
+ toString() {
333
+ return JSON.stringify(this);
334
+ }
335
+ asArray() {
336
+ return [this.radius, this.theta, this.phi];
337
+ }
338
+ addToRef(spherical, ref) {
339
+ return addSphericalToRef(this, spherical, ref);
340
+ }
341
+ add(spherical) {
342
+ return this.addToRef(spherical, new Spherical(0, 0, 0));
343
+ }
344
+ addInPlace(spherical) {
345
+ this.addToRef(spherical, this);
346
+ return this;
347
+ }
348
+ addInPlaceFromFloats(radius, theta, phi) {
349
+ return this.addInPlace(new Spherical(radius, theta, phi));
350
+ }
351
+ subtractToRef(spherical, ref) {
352
+ return subtractSphericalToRef(this, spherical, ref);
353
+ }
354
+ subtract(spherical) {
355
+ return this.subtractToRef(spherical, new Spherical(0, 0, 0));
356
+ }
357
+ subtractInPlace(spherical) {
358
+ this.subtractToRef(spherical, this);
359
+ return this;
360
+ }
361
+ subtractFromFloatsToRef(radius, theta, phi, ref) {
362
+ return this.subtractToRef(new Spherical(radius, theta, phi), ref);
363
+ }
364
+ subtractFromFloats(radius, theta, phi) {
365
+ return this.subtractFromFloatsToRef(radius, theta, phi, new Spherical(0, 0, 0));
366
+ }
367
+ multiplyToRef(spherical, ref) {
368
+ return multiplySphericalToRef(this, spherical, ref);
369
+ }
370
+ multiply(spherical) {
371
+ return this.multiplyToRef(spherical, new Spherical(0, 0, 0));
372
+ }
373
+ multiplyInPlace(spherical) {
374
+ this.multiplyToRef(spherical, this);
375
+ return this;
376
+ }
377
+ divideToRef(spherical, ref) {
378
+ return divideSphericalToRef(this, spherical, ref);
379
+ }
380
+ divide(spherical) {
381
+ return this.divideToRef(spherical, new Spherical(0, 0, 0));
382
+ }
383
+ divideInPlace(spherical) {
384
+ this.divideToRef(spherical, this);
385
+ return this;
386
+ }
387
+ clone() {
388
+ return new Spherical(this.radius, this.theta, this.phi);
389
+ }
390
+ copyFrom(source) {
391
+ return this.copyFromFloats(source.radius, source.theta, source.phi);
392
+ }
393
+ copyFromFloats(radius, theta, phi) {
394
+ this.radius = radius;
395
+ this.theta = theta;
396
+ this.phi = phi;
397
+ return this;
398
+ }
399
+ scaleToRef(scale, ref) {
400
+ return scaleSphericalToRef(this, scale, ref);
401
+ }
402
+ scale(scale) {
403
+ return this.scaleToRef(scale, new Spherical(0, 0, 0));
404
+ }
405
+ scaleInPlace(scale) {
406
+ this.scaleToRef(scale, this);
407
+ return this;
408
+ }
409
+ set(radius, theta, phi) {
410
+ return this.copyFromFloats(radius, theta, phi);
411
+ }
412
+ setAll(value) {
413
+ return this.set(value, value, value);
414
+ }
415
+ toVector3ToRef(ref) {
416
+ return sphericalToVec3ToRef(this, ref);
417
+ }
418
+ toVector3() {
419
+ return this.toVector3ToRef(new Vector3());
420
+ }
421
+ static FromVector3ToRef(vector, ref) {
422
+ return sphericalFromVec3ToRef(vector, ref);
423
+ }
424
+ static FromVector3(vector) {
425
+ return Spherical.FromVector3ToRef(vector, new Spherical(0, 0, 0));
426
+ }
427
+ static FromArray(array) {
428
+ return new Spherical(array[0], array[1], array[2]);
429
+ }
430
+ }
217
431
  class Angle {
218
432
  constructor(_radians) {
219
433
  this._radians = _radians;
@@ -317,6 +531,55 @@ class Path3D {
317
531
  return this._distances;
318
532
  }
319
533
  }
534
+ class PickingInfo {
535
+ constructor() {
536
+ __publicField(this, "hit", false);
537
+ __publicField(this, "distance", 0);
538
+ __publicField(this, "pickedPoint", null);
539
+ __publicField(this, "pickedMesh", null);
540
+ __publicField(this, "bu", 0);
541
+ __publicField(this, "bv", 0);
542
+ __publicField(this, "faceId", -1);
543
+ __publicField(this, "subMeshFaceId", -1);
544
+ __publicField(this, "subMeshId", 0);
545
+ __publicField(this, "pickedSprite", null);
546
+ __publicField(this, "thinInstanceIndex", -1);
547
+ __publicField(this, "ray", null);
548
+ __publicField(this, "originMesh", null);
549
+ __publicField(this, "aimTransform", null);
550
+ __publicField(this, "gripTransform", null);
551
+ __publicField(this, "_normal", null);
552
+ __publicField(this, "_worldNormal", null);
553
+ }
554
+ /** @internal Create a compat result from Lite's synchronous CPU-picking result. */
555
+ static _fromLite(info, pickedMesh, ray) {
556
+ const result = new PickingInfo();
557
+ result.hit = info.hit && pickedMesh !== null;
558
+ result.distance = info.distance;
559
+ result.pickedPoint = result.hit && info.pickedPoint ? Vector3.FromArray(info.pickedPoint) : null;
560
+ result.pickedMesh = result.hit ? pickedMesh : null;
561
+ result.bu = info.bu;
562
+ result.bv = info.bv;
563
+ result.faceId = info.faceId;
564
+ result.subMeshFaceId = info.faceId;
565
+ result.subMeshId = info.subMeshId;
566
+ result.thinInstanceIndex = info.thinInstanceIndex;
567
+ result.ray = ray;
568
+ result._normal = info.pickedNormal ? Vector3.FromArray(info.pickedNormal) : null;
569
+ result._worldNormal = info.pickedNormalWorld ? Vector3.FromArray(info.pickedNormalWorld) : null;
570
+ return result;
571
+ }
572
+ getNormal(useWorldCoordinates = false, _useVerticesNormals = true) {
573
+ var _a, _b;
574
+ return useWorldCoordinates ? ((_a = this._worldNormal) == null ? void 0 : _a.clone()) ?? null : ((_b = this._normal) == null ? void 0 : _b.clone()) ?? null;
575
+ }
576
+ getTextureCoordinates(_uvSet) {
577
+ return unsupported(
578
+ "PickingInfo.getTextureCoordinates",
579
+ "Lite's synchronous CPU picker currently exposes AABB intersections only, so barycentric UV coordinates are unavailable."
580
+ );
581
+ }
582
+ }
320
583
  class SmartArray {
321
584
  constructor(capacity) {
322
585
  __publicField(this, "data");
@@ -515,63 +778,6 @@ const PrecisionDate = {
515
778
  return now();
516
779
  }
517
780
  };
518
- class Observable {
519
- constructor(_onObserverAdded, notifyIfTriggered = false) {
520
- __publicField(this, "_observers", []);
521
- __publicField(this, "_hasNotified", false);
522
- __publicField(this, "_lastNotifiedValue");
523
- this._onObserverAdded = _onObserverAdded;
524
- this.notifyIfTriggered = notifyIfTriggered;
525
- }
526
- add(callback) {
527
- var _a;
528
- this._observers.push(callback);
529
- (_a = this._onObserverAdded) == null ? void 0 : _a.call(this, callback);
530
- if (this._hasNotified && this.notifyIfTriggered && this._lastNotifiedValue !== void 0) {
531
- callback(this._lastNotifiedValue);
532
- }
533
- return callback;
534
- }
535
- addOnce(callback) {
536
- const wrapper = (eventData) => {
537
- this.removeCallback(wrapper);
538
- callback(eventData);
539
- };
540
- return this.add(wrapper);
541
- }
542
- remove(callback) {
543
- return callback ? this.removeCallback(callback) : false;
544
- }
545
- removeCallback(callback) {
546
- const index = this._observers.indexOf(callback);
547
- if (index !== -1) {
548
- this._observers.splice(index, 1);
549
- return true;
550
- }
551
- return false;
552
- }
553
- notifyObservers(eventData) {
554
- if (this.notifyIfTriggered) {
555
- this._hasNotified = true;
556
- this._lastNotifiedValue = eventData;
557
- }
558
- for (const observer of this._observers.slice()) {
559
- observer(eventData);
560
- }
561
- }
562
- hasObservers() {
563
- return this._observers.length > 0;
564
- }
565
- clear() {
566
- this._observers = [];
567
- this._onObserverAdded = void 0;
568
- this.cleanLastNotifiedState();
569
- }
570
- cleanLastNotifiedState() {
571
- this._hasNotified = false;
572
- this._lastNotifiedValue = void 0;
573
- }
574
- }
575
781
  async function runLateWork(work) {
576
782
  try {
577
783
  await work();
@@ -752,8 +958,8 @@ class AbstractEngine {
752
958
  }
753
959
  /** Babylon.js `engine.getRenderingCanvasClientRect()` — the canvas client rect, or `null` for offscreen canvases. */
754
960
  getRenderingCanvasClientRect() {
755
- const c2 = this._canvas;
756
- return typeof c2.getBoundingClientRect === "function" ? c2.getBoundingClientRect() : null;
961
+ const c = this._canvas;
962
+ return typeof c.getBoundingClientRect === "function" ? c.getBoundingClientRect() : null;
757
963
  }
758
964
  /**
759
965
  * Babylon.js `engine.clear(color?, backBuffer?, depth?, stencil?)`. Babylon
@@ -1107,11 +1313,11 @@ class AbstractScene {
1107
1313
  }
1108
1314
  /** Babylon.js `scene.getCameraByName(name)` — first camera with a matching name, else `null`. */
1109
1315
  getCameraByName(name) {
1110
- return this._cameras.find((c2) => c2.name === name) ?? null;
1316
+ return this._cameras.find((c) => c.name === name) ?? null;
1111
1317
  }
1112
1318
  /** Babylon.js `scene.getCameraById(id)` — first camera whose `id` matches, else `null`. */
1113
1319
  getCameraById(id) {
1114
- return this._cameras.find((c2) => c2.id === id) ?? null;
1320
+ return this._cameras.find((c) => c.id === id) ?? null;
1115
1321
  }
1116
1322
  /** Babylon.js `scene.getLightByName(name)` — first light with a matching name, else `null`. */
1117
1323
  getLightByName(name) {
@@ -1147,12 +1353,12 @@ class AbstractScene {
1147
1353
  }
1148
1354
  /** Babylon.js `scene.getNodeByName(name)` — searches meshes, cameras, and lights. */
1149
1355
  getNodeByName(name) {
1150
- return this.meshes.find((m2) => m2.name === name) ?? this._cameras.find((c2) => c2.name === name) ?? this._lights.find((l) => l.name === name) ?? null;
1356
+ return this.meshes.find((m2) => m2.name === name) ?? this._cameras.find((c) => c.name === name) ?? this._lights.find((l) => l.name === name) ?? null;
1151
1357
  }
1152
1358
  /** Babylon.js `scene.getNodeById(id)` — searches meshes, cameras, and lights by `id`. */
1153
1359
  getNodeById(id) {
1154
1360
  const byId = (n2) => n2.id === id;
1155
- return this.meshes.find((m2) => byId(m2)) ?? this._cameras.find((c2) => byId(c2)) ?? this._lights.find((l) => byId(l)) ?? null;
1361
+ return this.meshes.find((m2) => byId(m2)) ?? this._cameras.find((c) => byId(c)) ?? this._lights.find((l) => byId(l)) ?? null;
1156
1362
  }
1157
1363
  }
1158
1364
  var PhysicsShapeType = /* @__PURE__ */ ((PhysicsShapeType2) => {
@@ -1188,6 +1394,383 @@ var PhysicsConstraintType = /* @__PURE__ */ ((PhysicsConstraintType2) => {
1188
1394
  PhysicsConstraintType2[PhysicsConstraintType2["SIX_DOF"] = 7] = "SIX_DOF";
1189
1395
  return PhysicsConstraintType2;
1190
1396
  })(PhysicsConstraintType || {});
1397
+ function requirePhysicsWorld(scene) {
1398
+ var _a;
1399
+ const world = (_a = scene == null ? void 0 : scene.getPhysicsEngine()) == null ? void 0 : _a.getPhysicsPlugin().world;
1400
+ if (!world) {
1401
+ return unsupported("Physics", "Call `scene.enablePhysics(...)` with a ready HavokPlugin before creating physics bodies or shapes.");
1402
+ }
1403
+ return world;
1404
+ }
1405
+ function liteShapeType(type) {
1406
+ switch (type) {
1407
+ case 0:
1408
+ return PhysicsShapeType$1.SPHERE;
1409
+ case 1:
1410
+ return PhysicsShapeType$1.CAPSULE;
1411
+ case 2:
1412
+ return PhysicsShapeType$1.CYLINDER;
1413
+ case 3:
1414
+ return PhysicsShapeType$1.BOX;
1415
+ case 4:
1416
+ return PhysicsShapeType$1.CONVEX_HULL;
1417
+ case 5:
1418
+ return PhysicsShapeType$1.CONTAINER;
1419
+ case 6:
1420
+ return PhysicsShapeType$1.MESH;
1421
+ case 7:
1422
+ return PhysicsShapeType$1.HEIGHTFIELD;
1423
+ default:
1424
+ throw new Error(`Invalid PhysicsShapeType value: ${type}`);
1425
+ }
1426
+ }
1427
+ function liteMotionType(type) {
1428
+ switch (type) {
1429
+ case 0:
1430
+ return PhysicsMotionType$1.STATIC;
1431
+ case 1:
1432
+ return PhysicsMotionType$1.ANIMATED;
1433
+ case 2:
1434
+ return PhysicsMotionType$1.DYNAMIC;
1435
+ default:
1436
+ throw new Error(`Invalid PhysicsMotionType value: ${type}`);
1437
+ }
1438
+ }
1439
+ function litePrestepType(type) {
1440
+ switch (type) {
1441
+ case 0:
1442
+ return PhysicsPrestepType$1.DISABLED;
1443
+ case 1:
1444
+ return PhysicsPrestepType$1.TELEPORT;
1445
+ case 2:
1446
+ return PhysicsPrestepType$1.ACTION;
1447
+ default:
1448
+ throw new Error(`Invalid PhysicsPrestepType value: ${type}`);
1449
+ }
1450
+ }
1451
+ class PhysicsShape {
1452
+ constructor(options, scene) {
1453
+ /** @internal */
1454
+ __publicField(this, "_lite");
1455
+ /** @internal */
1456
+ __publicField(this, "_world");
1457
+ /** @internal */
1458
+ __publicField(this, "_material", {});
1459
+ /** @internal */
1460
+ __publicField(this, "_membershipMask", 4294967295);
1461
+ /** @internal */
1462
+ __publicField(this, "_collideMask", 4294967295);
1463
+ /** @internal */
1464
+ __publicField(this, "_isTrigger", false);
1465
+ /** @internal */
1466
+ __publicField(this, "_disposed", false);
1467
+ this._world = requirePhysicsWorld(scene);
1468
+ if (options.pluginData) {
1469
+ this._lite = options.pluginData;
1470
+ } else if (options.type !== void 0) {
1471
+ this._lite = createPhysicsShape(this._world, { type: liteShapeType(options.type), parameters: options.parameters });
1472
+ } else {
1473
+ return unsupported("PhysicsShape", "Specify either `type` or a native Lite shape as `pluginData`.");
1474
+ }
1475
+ }
1476
+ /** @internal */
1477
+ static _fromLite(shape, world) {
1478
+ const wrapper = Object.create(PhysicsShape.prototype);
1479
+ Object.defineProperties(wrapper, {
1480
+ _lite: { value: shape, enumerable: true },
1481
+ _world: { value: world },
1482
+ _material: { value: {}, writable: true },
1483
+ _membershipMask: { value: 4294967295, writable: true },
1484
+ _collideMask: { value: 4294967295, writable: true },
1485
+ _isTrigger: { value: false, writable: true },
1486
+ _disposed: { value: false, writable: true }
1487
+ });
1488
+ return wrapper;
1489
+ }
1490
+ getClassName() {
1491
+ return "PhysicsShape";
1492
+ }
1493
+ get type() {
1494
+ switch (this._lite._type) {
1495
+ case PhysicsShapeType$1.SPHERE:
1496
+ return 0;
1497
+ case PhysicsShapeType$1.CAPSULE:
1498
+ return 1;
1499
+ case PhysicsShapeType$1.CYLINDER:
1500
+ return 2;
1501
+ case PhysicsShapeType$1.BOX:
1502
+ return 3;
1503
+ case PhysicsShapeType$1.CONVEX_HULL:
1504
+ return 4;
1505
+ case PhysicsShapeType$1.CONTAINER:
1506
+ return 5;
1507
+ case PhysicsShapeType$1.MESH:
1508
+ return 6;
1509
+ case PhysicsShapeType$1.HEIGHTFIELD:
1510
+ return 7;
1511
+ default:
1512
+ throw new Error(`Invalid Lite PhysicsShapeType value: ${this._lite._type}`);
1513
+ }
1514
+ }
1515
+ set filterMembershipMask(value) {
1516
+ this._membershipMask = value;
1517
+ setPhysicsShapeFilterMembershipMask(this._world, this._lite, value);
1518
+ }
1519
+ get filterMembershipMask() {
1520
+ return this._membershipMask;
1521
+ }
1522
+ set filterCollideMask(value) {
1523
+ this._collideMask = value;
1524
+ setPhysicsShapeFilterCollideMask(this._world, this._lite, value);
1525
+ }
1526
+ get filterCollideMask() {
1527
+ return this._collideMask;
1528
+ }
1529
+ set material(value) {
1530
+ this._material = value;
1531
+ const friction = value.friction ?? 0.5;
1532
+ setPhysicsShapeMaterial(this._world, this._lite, friction, value.restitution ?? 0, value.staticFriction ?? friction);
1533
+ }
1534
+ get material() {
1535
+ return this._material;
1536
+ }
1537
+ set isTrigger(value) {
1538
+ this._isTrigger = value;
1539
+ setPhysicsShapeIsTrigger(this._world, this._lite, value);
1540
+ }
1541
+ get isTrigger() {
1542
+ return this._isTrigger;
1543
+ }
1544
+ dispose() {
1545
+ if (!this._disposed) {
1546
+ releasePhysicsShape(this._world, this._lite);
1547
+ this._disposed = true;
1548
+ }
1549
+ }
1550
+ }
1551
+ class PhysicsBody {
1552
+ constructor(transformNode, motionType, startsAsleep, scene) {
1553
+ /** @internal */
1554
+ __publicField(this, "_lite");
1555
+ /** @internal */
1556
+ __publicField(this, "_world");
1557
+ /** @internal */
1558
+ __publicField(this, "_shape", null);
1559
+ /** @internal */
1560
+ __publicField(this, "_disposed", false);
1561
+ /** @internal */
1562
+ __publicField(this, "_nodeDisposeObserver", null);
1563
+ __publicField(this, "transformNode");
1564
+ __publicField(this, "_disableSync", false);
1565
+ __publicField(this, "startAsleep");
1566
+ assertPhysicsNodeSupported(transformNode);
1567
+ this.transformNode = transformNode;
1568
+ this.startAsleep = startsAsleep;
1569
+ this._world = requirePhysicsWorld(scene);
1570
+ this._lite = createPhysicsBody(this._world, transformNode._node, liteMotionType(motionType), startsAsleep);
1571
+ setPhysicsBodyPrestepType(this._lite, PhysicsPrestepType$1.DISABLED);
1572
+ this._attachToNode();
1573
+ }
1574
+ /** @internal */
1575
+ static _fromLite(body, transformNode, world, startsAsleep = false) {
1576
+ const wrapper = Object.create(PhysicsBody.prototype);
1577
+ Object.defineProperties(wrapper, {
1578
+ _lite: { value: body, enumerable: true },
1579
+ _world: { value: world },
1580
+ _shape: { value: null, writable: true },
1581
+ _disposed: { value: false, writable: true },
1582
+ _nodeDisposeObserver: { value: null, writable: true },
1583
+ transformNode: { value: transformNode, enumerable: true },
1584
+ _disableSync: { value: false, writable: true },
1585
+ startAsleep: { value: startsAsleep, enumerable: true }
1586
+ });
1587
+ setPhysicsBodyPrestepType(wrapper._lite, PhysicsPrestepType$1.DISABLED);
1588
+ wrapper._attachToNode();
1589
+ return wrapper;
1590
+ }
1591
+ getClassName() {
1592
+ return "PhysicsBody";
1593
+ }
1594
+ get disablePreStep() {
1595
+ return this._lite._prestepType === PhysicsPrestepType$1.DISABLED;
1596
+ }
1597
+ set disablePreStep(value) {
1598
+ setPhysicsBodyPrestepType(this._lite, value ? PhysicsPrestepType$1.DISABLED : PhysicsPrestepType$1.TELEPORT);
1599
+ }
1600
+ get disableSync() {
1601
+ return this._disableSync;
1602
+ }
1603
+ set disableSync(value) {
1604
+ if (value) {
1605
+ unsupported(
1606
+ "PhysicsBody.disableSync",
1607
+ "Babylon Lite's shared physics step always synchronizes dynamic bodies; opting out would require changing that existing hot-path module and every physics scene bundle."
1608
+ );
1609
+ }
1610
+ this._disableSync = false;
1611
+ }
1612
+ get motionType() {
1613
+ switch (this._lite.motionType) {
1614
+ case PhysicsMotionType$1.STATIC:
1615
+ return 0;
1616
+ case PhysicsMotionType$1.ANIMATED:
1617
+ return 1;
1618
+ case PhysicsMotionType$1.DYNAMIC:
1619
+ return 2;
1620
+ default:
1621
+ throw new Error(`Invalid Lite PhysicsMotionType value: ${this._lite.motionType}`);
1622
+ }
1623
+ }
1624
+ set shape(value) {
1625
+ if (!value) {
1626
+ unsupported("PhysicsBody.shape", "Babylon Lite cannot detach a shape from a live body; assign another PhysicsShape or dispose the body.");
1627
+ }
1628
+ this._shape = value;
1629
+ setPhysicsBodyShape(this._world, this._lite, value._lite);
1630
+ }
1631
+ get shape() {
1632
+ return this._shape;
1633
+ }
1634
+ setMotionType(value) {
1635
+ setPhysicsBodyMotionType(this._world, this._lite, liteMotionType(value));
1636
+ }
1637
+ getMotionType() {
1638
+ return this.motionType;
1639
+ }
1640
+ setPrestepType(value) {
1641
+ setPhysicsBodyPrestepType(this._lite, litePrestepType(value));
1642
+ }
1643
+ getPrestepType() {
1644
+ switch (this._lite._prestepType) {
1645
+ case PhysicsPrestepType$1.DISABLED:
1646
+ return 0;
1647
+ case PhysicsPrestepType$1.TELEPORT:
1648
+ return 1;
1649
+ case PhysicsPrestepType$1.ACTION:
1650
+ return 2;
1651
+ default:
1652
+ throw new Error(`Invalid Lite PhysicsPrestepType value: ${this._lite._prestepType}`);
1653
+ }
1654
+ }
1655
+ setMassProperties(properties) {
1656
+ setPhysicsBodyMassProperties(this._world, this._lite, properties);
1657
+ }
1658
+ setLinearVelocity(value) {
1659
+ setPhysicsBodyLinearVelocity(this._world, this._lite, value);
1660
+ }
1661
+ getLinearVelocity() {
1662
+ const value = getPhysicsBodyLinearVelocity(this._world, this._lite);
1663
+ return new Vector3(value.x, value.y, value.z);
1664
+ }
1665
+ getLinearVelocityToRef(result) {
1666
+ const value = getPhysicsBodyLinearVelocity(this._world, this._lite);
1667
+ result.set(value.x, value.y, value.z);
1668
+ }
1669
+ setAngularVelocity(value) {
1670
+ setPhysicsBodyAngularVelocity(this._world, this._lite, value);
1671
+ }
1672
+ getAngularVelocity() {
1673
+ const value = getPhysicsBodyAngularVelocity(this._world, this._lite);
1674
+ return new Vector3(value.x, value.y, value.z);
1675
+ }
1676
+ getAngularVelocityToRef(result) {
1677
+ const value = getPhysicsBodyAngularVelocity(this._world, this._lite);
1678
+ result.set(value.x, value.y, value.z);
1679
+ }
1680
+ applyImpulse(impulse, location) {
1681
+ applyPhysicsBodyImpulse(this._lite, impulse, location);
1682
+ }
1683
+ applyForce(force, location) {
1684
+ applyPhysicsBodyForce(this._world, this._lite, force, location);
1685
+ }
1686
+ dispose() {
1687
+ if (!this._disposed) {
1688
+ this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);
1689
+ this._nodeDisposeObserver = null;
1690
+ removePhysicsBody(this._world, this._lite);
1691
+ if (this.transformNode.physicsBody === this) {
1692
+ this.transformNode.physicsBody = null;
1693
+ }
1694
+ this._disposed = true;
1695
+ }
1696
+ }
1697
+ /** @internal */
1698
+ _adoptShape(shape) {
1699
+ this._shape = shape;
1700
+ }
1701
+ /** @internal */
1702
+ _attachToNode() {
1703
+ this.transformNode.physicsBody = this;
1704
+ this._nodeDisposeObserver = this.transformNode.onDisposeObservable.add(() => this.dispose());
1705
+ }
1706
+ }
1707
+ class PhysicsAggregate {
1708
+ constructor(transformNode, type, options = { mass: 0 }, scene) {
1709
+ __publicField(this, "transformNode");
1710
+ __publicField(this, "type");
1711
+ __publicField(this, "body");
1712
+ __publicField(this, "shape");
1713
+ __publicField(this, "material");
1714
+ /** @internal */
1715
+ __publicField(this, "_disposed", false);
1716
+ /** @internal */
1717
+ __publicField(this, "_disposeShapeWhenDisposed");
1718
+ /** @internal */
1719
+ __publicField(this, "_nodeDisposeObserver", null);
1720
+ assertPhysicsNodeSupported(transformNode);
1721
+ this.transformNode = transformNode;
1722
+ this.type = type;
1723
+ const resolvedScene = scene ?? transformNode.getScene();
1724
+ const world = requirePhysicsWorld(resolvedScene);
1725
+ const nativeType = type instanceof PhysicsShape ? type._lite._type : liteShapeType(type);
1726
+ let suppliedShape = type instanceof PhysicsShape ? type : void 0;
1727
+ this._disposeShapeWhenDisposed = !suppliedShape;
1728
+ if (!suppliedShape && (type === 6 || type === 4)) {
1729
+ suppliedShape = PhysicsShape._fromLite(createPhysicsShape(world, { type: nativeType, mesh: (options.mesh ?? transformNode)._node }), world);
1730
+ }
1731
+ const aggregate = createPhysicsAggregate(world, transformNode._node, nativeType, {
1732
+ ...options,
1733
+ shape: suppliedShape == null ? void 0 : suppliedShape._lite
1734
+ });
1735
+ this.material = {
1736
+ friction: options.friction ?? 0.2,
1737
+ staticFriction: options.staticFriction,
1738
+ restitution: options.restitution ?? 0.2
1739
+ };
1740
+ this.shape = suppliedShape ?? PhysicsShape._fromLite(aggregate.shape, world);
1741
+ this.shape.material = this.material;
1742
+ if (options.isTriggerShape !== void 0) {
1743
+ this.shape.isTrigger = options.isTriggerShape;
1744
+ }
1745
+ this.body = PhysicsBody._fromLite(aggregate.body, transformNode, world, options.startAsleep);
1746
+ this.body._adoptShape(this.shape);
1747
+ this._nodeDisposeObserver = transformNode.onDisposeObservable.add(() => this.dispose());
1748
+ }
1749
+ dispose() {
1750
+ if (!this._disposed) {
1751
+ this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);
1752
+ this._nodeDisposeObserver = null;
1753
+ this.body.dispose();
1754
+ if (this._disposeShapeWhenDisposed) {
1755
+ this.shape.dispose();
1756
+ }
1757
+ this._disposed = true;
1758
+ }
1759
+ }
1760
+ }
1761
+ function assertPhysicsNodeSupported(transformNode) {
1762
+ var _a;
1763
+ if (transformNode.physicsBody) {
1764
+ unsupported("PhysicsBody", "Babylon Lite synchronizes one physics body per scene node; dispose the existing TransformNode.physicsBody before attaching another.");
1765
+ }
1766
+ if (transformNode.parent || transformNode._node.parent) {
1767
+ unsupported("PhysicsBody", "Babylon Lite physics bodies currently consume local transforms, so parented TransformNodes cannot be synchronized in Babylon.js world space.");
1768
+ }
1769
+ const mesh = transformNode._node;
1770
+ if ((_a = mesh.thinInstances) == null ? void 0 : _a.count) {
1771
+ unsupported("PhysicsBody", "Babylon Lite exposes one physics body per scene node and has no per-thin-instance body representation.");
1772
+ }
1773
+ }
1191
1774
  class HavokPlugin {
1192
1775
  constructor(useDeltaForWorldStep = true, hpInjection) {
1193
1776
  /** Name of the plugin. */
@@ -1562,8 +2145,8 @@ class GeospatialCamera extends Camera {
1562
2145
  }
1563
2146
  /** Anchored surface point the camera orbits (ECEF coordinates). */
1564
2147
  get center() {
1565
- const c2 = this._lite.center;
1566
- return new Vector3(c2.x, c2.y, c2.z);
2148
+ const c = this._lite.center;
2149
+ return new Vector3(c.x, c.y, c.z);
1567
2150
  }
1568
2151
  set center(value) {
1569
2152
  setGeospatialOrientation(this._lite, { center: { x: value.x, y: value.y, z: value.z } });
@@ -2091,8 +2674,8 @@ class AnimationGroup {
2091
2674
  normalizer = holder.total;
2092
2675
  final = zeroLike(holder.contributions[0].value);
2093
2676
  }
2094
- for (const c2 of holder.contributions) {
2095
- final = addValue(final, scaleValue(c2.value, c2.weight / normalizer));
2677
+ for (const c of holder.contributions) {
2678
+ final = addValue(final, scaleValue(c.value, c.weight / normalizer));
2096
2679
  }
2097
2680
  }
2098
2681
  applyAnimatedValue(holder.target, holder.path, final);
@@ -2413,8 +2996,8 @@ const _Scene = class _Scene extends AbstractScene {
2413
2996
  this._defaultMaterial = value;
2414
2997
  }
2415
2998
  get clearColor() {
2416
- const c2 = this._lite.clearColor;
2417
- return new Color4(c2.r, c2.g, c2.b, c2.a ?? 1);
2999
+ const c = this._lite.clearColor;
3000
+ return new Color4(c.r, c.g, c.b, c.a ?? 1);
2418
3001
  }
2419
3002
  set clearColor(value) {
2420
3003
  this._lite.clearColor = { r: value.r, g: value.g, b: value.b, a: value.a ?? 1 };
@@ -2720,9 +3303,48 @@ const _Scene = class _Scene extends AbstractScene {
2720
3303
  "Babylon Lite uses asynchronous GPU picking. Use the compat `GPUPicker` class (Babylon.js parity) or the native `createGpuPicker` + `pickAsync` API."
2721
3304
  );
2722
3305
  }
2723
- /** Synchronous ray picking — unsupported. */
2724
- pickWithRay() {
2725
- return unsupported("Scene.pickWithRay", "Synchronous CPU ray-mesh intersection is not implemented in Babylon Lite.");
3306
+ /** Synchronous CPU ray picking over Babylon Lite's scene-mesh picker. */
3307
+ pickWithRay(ray, predicate, fastCheck = false, trianglePredicate) {
3308
+ if (fastCheck || trianglePredicate) {
3309
+ return unsupported(
3310
+ "Scene.pickWithRay",
3311
+ "Babylon Lite's synchronous picker returns the nearest bounding-box hit and does not expose fast-first-hit or per-triangle predicate modes."
3312
+ );
3313
+ }
3314
+ const candidates = new Set(this._lite.meshes);
3315
+ for (const wrapper of this.meshes) {
3316
+ if (wrapper instanceof AbstractMesh) {
3317
+ candidates.add(wrapper._lite);
3318
+ }
3319
+ }
3320
+ const wrappers = /* @__PURE__ */ new Map();
3321
+ for (const candidate of candidates) {
3322
+ if (candidate.thinInstances && candidate.thinInstances.count > 0) {
3323
+ return unsupported(
3324
+ "Scene.pickWithRay",
3325
+ "Thin-instance transforms are not represented by Lite's AABB ray picker; pick the source mesh before adding thin instances or use Lite's GPU picker."
3326
+ );
3327
+ }
3328
+ const registered = this._meshWrappers.get(candidate);
3329
+ const wrapper = registered instanceof AbstractMesh ? registered : Mesh._fromLite(candidate, void 0, this);
3330
+ wrappers.set(candidate, wrapper);
3331
+ }
3332
+ const info = pickMeshesWithRay(
3333
+ candidates,
3334
+ {
3335
+ origin: ray.origin.asArray(),
3336
+ direction: ray.direction.asArray(),
3337
+ length: ray.length
3338
+ },
3339
+ {
3340
+ predicate: (mesh) => {
3341
+ const wrapper = wrappers.get(mesh);
3342
+ return !!wrapper && (predicate ? predicate(wrapper) : wrapper.isEnabled() && wrapper.isVisible && wrapper.isPickable);
3343
+ },
3344
+ skipPickableCheck: !!predicate
3345
+ }
3346
+ );
3347
+ return PickingInfo._fromLite(info, info.pickedMesh ? wrappers.get(info.pickedMesh) ?? null : null, ray);
2726
3348
  }
2727
3349
  /**
2728
3350
  * Babylon.js `scene.enablePhysics(gravity, plugin)`. Wires the given Havok V2
@@ -3808,14 +4430,14 @@ const _Texture = class _Texture extends BaseTexture {
3808
4430
  * handle (tracked against the same scene so it is ready at build).
3809
4431
  */
3810
4432
  clone() {
3811
- const c2 = new _Texture(this.name, this._source, this._noMipmap, this._invertY, this.samplingMode);
3812
- c2.uScale = this.uScale;
3813
- c2.vScale = this.vScale;
3814
- c2.uOffset = this.uOffset;
3815
- c2.vOffset = this.vOffset;
3816
- c2.hasAlpha = this.hasAlpha;
3817
- c2.coordinatesIndex = this.coordinatesIndex;
3818
- return c2;
4433
+ const c = new _Texture(this.name, this._source, this._noMipmap, this._invertY, this.samplingMode);
4434
+ c.uScale = this.uScale;
4435
+ c.vScale = this.vScale;
4436
+ c.uOffset = this.uOffset;
4437
+ c.vOffset = this.vOffset;
4438
+ c.hasAlpha = this.hasAlpha;
4439
+ c.coordinatesIndex = this.coordinatesIndex;
4440
+ return c;
3819
4441
  }
3820
4442
  whenReadyAsync() {
3821
4443
  return this._ready;
@@ -4284,6 +4906,96 @@ function collectLoadedMeshes(container, registry, scene) {
4284
4906
  }
4285
4907
  return result;
4286
4908
  }
4909
+ class Skeleton {
4910
+ constructor(_name, _id, _scene) {
4911
+ __publicField(this, "name");
4912
+ __publicField(this, "id");
4913
+ __publicField(this, "bones");
4914
+ /** @internal Underlying loader-produced Babylon Lite skeleton. */
4915
+ __publicField(this, "_lite");
4916
+ return unsupported(
4917
+ "Skeleton",
4918
+ "Babylon Lite exposes loader-produced skeletons but has no public API for manually constructing a skeleton. Load a skinned glTF and use the returned skeleton."
4919
+ );
4920
+ }
4921
+ /** @internal Wrap a loader-produced Babylon Lite skeleton. */
4922
+ static _fromLite(lite, index) {
4923
+ const skeleton = Object.create(Skeleton.prototype);
4924
+ Object.defineProperties(skeleton, {
4925
+ name: { value: `skeleton${index}`, enumerable: true },
4926
+ id: { value: `skeleton${index}`, enumerable: true },
4927
+ _lite: { value: lite },
4928
+ bones: { value: lite.bones.map((bone) => Bone._fromLite(bone, skeleton)) }
4929
+ });
4930
+ return skeleton;
4931
+ }
4932
+ getBoneIndexByName(name) {
4933
+ const bone = getBoneByName(this._lite, name);
4934
+ return bone ? this._lite.bones.indexOf(bone) : -1;
4935
+ }
4936
+ getBoneByName(name) {
4937
+ const index = this.getBoneIndexByName(name);
4938
+ return index < 0 ? null : this.bones[index];
4939
+ }
4940
+ }
4941
+ class Bone {
4942
+ constructor(_name, _skeleton) {
4943
+ __publicField(this, "_enabled", true);
4944
+ __publicField(this, "name");
4945
+ /** @internal Underlying loader-produced Babylon Lite bone. */
4946
+ __publicField(this, "_lite");
4947
+ /** @internal Owning compat skeleton. */
4948
+ __publicField(this, "_skeleton");
4949
+ return unsupported(
4950
+ "Bone",
4951
+ "Babylon Lite exposes loader-produced bones but has no public API for manually constructing a bone. Use Skeleton.bones from a loaded skinned glTF."
4952
+ );
4953
+ }
4954
+ /** @internal Wrap a loader-produced Babylon Lite bone. */
4955
+ static _fromLite(lite, skeleton) {
4956
+ const bone = Object.create(Bone.prototype);
4957
+ Object.defineProperties(bone, {
4958
+ name: { value: lite.name, enumerable: true },
4959
+ _lite: { value: lite },
4960
+ _skeleton: { value: skeleton },
4961
+ _enabled: { value: true, writable: true }
4962
+ });
4963
+ return bone;
4964
+ }
4965
+ getName() {
4966
+ return this.name;
4967
+ }
4968
+ getSkeleton() {
4969
+ return this._skeleton;
4970
+ }
4971
+ setPosition(position, space = 0) {
4972
+ if (space !== 0) {
4973
+ return unsupported("Bone.setPosition", "Babylon Lite's bone-control API currently exposes local-space position overrides only.");
4974
+ }
4975
+ setBonePosition(this._skeleton._lite, this._lite, position.x, position.y, position.z);
4976
+ return this;
4977
+ }
4978
+ setRotationQuaternion(rotation, space = 0) {
4979
+ if (space !== 0) {
4980
+ return unsupported("Bone.setRotationQuaternion", "Babylon Lite's bone-control API currently exposes local-space rotation overrides only.");
4981
+ }
4982
+ setBoneRotationQuaternion(this._skeleton._lite, this._lite, rotation.x, rotation.y, rotation.z, rotation.w);
4983
+ return this;
4984
+ }
4985
+ setScale(scale) {
4986
+ setBoneScaling(this._skeleton._lite, this._lite, scale.x, scale.y, scale.z);
4987
+ return this;
4988
+ }
4989
+ setEnabled(value) {
4990
+ this._enabled = value;
4991
+ }
4992
+ isEnabled() {
4993
+ return this._enabled;
4994
+ }
4995
+ returnToRest() {
4996
+ clearBoneOverride(this._skeleton._lite, this._lite);
4997
+ }
4998
+ }
4287
4999
  function urlPath(url) {
4288
5000
  return url.split(/[?#]/)[0];
4289
5001
  }
@@ -4306,6 +5018,8 @@ class AssetContainer {
4306
5018
  __publicField(this, "_meshRegistry", /* @__PURE__ */ new Map());
4307
5019
  /** @internal The compat scene this container was added to, if any (drives scene-aware wrappers). */
4308
5020
  __publicField(this, "_scene");
5021
+ /** @internal Canonical loaded-skeleton wrappers. */
5022
+ __publicField(this, "_skeletons");
4309
5023
  this._lite = lite;
4310
5024
  }
4311
5025
  get animationGroups() {
@@ -4320,6 +5034,9 @@ class AssetContainer {
4320
5034
  get meshes() {
4321
5035
  return collectLoadedMeshes(this._lite, this._meshRegistry, this._scene);
4322
5036
  }
5037
+ get skeletons() {
5038
+ return this._skeletons ?? (this._skeletons = (this._lite.skeletons ?? []).map((skeleton, index) => Skeleton._fromLite(skeleton, index)));
5039
+ }
4323
5040
  /** Add every entity, animation group, camera, and clear colour to the scene. */
4324
5041
  addAllToScene(scene) {
4325
5042
  addToScene(scene._lite, this._lite);
@@ -4347,6 +5064,9 @@ function joinUrl(rootUrl, fileName) {
4347
5064
  async function load(rootUrl, fileName, scene) {
4348
5065
  const url = joinUrl(rootUrl, fileName);
4349
5066
  const engine = scene.getEngine()._lite;
5067
+ if (!isBabylonUrl(url)) {
5068
+ enableBoneControlForSkinnedAssets();
5069
+ }
4350
5070
  const lite = isBabylonUrl(url) ? await loadBabylon(engine, url) : await loadGltf(engine, url);
4351
5071
  return new AssetContainer(lite);
4352
5072
  }
@@ -4362,7 +5082,7 @@ const SceneLoader = {
4362
5082
  return {
4363
5083
  meshes: container.meshes,
4364
5084
  particleSystems: [],
4365
- skeletons: [],
5085
+ skeletons: container.skeletons,
4366
5086
  animationGroups: container.animationGroups,
4367
5087
  transformNodes: [],
4368
5088
  lights: [],
@@ -4401,7 +5121,7 @@ async function ImportMeshAsync(source, scene, _options) {
4401
5121
  return {
4402
5122
  meshes: container.meshes,
4403
5123
  particleSystems: [],
4404
- skeletons: [],
5124
+ skeletons: container.skeletons,
4405
5125
  animationGroups: container.animationGroups,
4406
5126
  transformNodes: [],
4407
5127
  lights: [],
@@ -4422,6 +5142,9 @@ async function LoadAssetContainerAsync(source, scene, _options) {
4422
5142
  }
4423
5143
  async function loadFromSource(source, scene) {
4424
5144
  const engine = scene.getEngine()._lite;
5145
+ if (!isBabylonUrl(source)) {
5146
+ enableBoneControlForSkinnedAssets();
5147
+ }
4425
5148
  const lite = isBabylonUrl(source) ? await loadBabylon(engine, source) : await loadGltf(engine, source);
4426
5149
  return new AssetContainer(lite);
4427
5150
  }
@@ -5930,9 +6653,9 @@ class BounceEase extends EasingFunction {
5930
6653
  }
5931
6654
  }
5932
6655
  function RandomGUID() {
5933
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => {
6656
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
5934
6657
  const r2 = Math.random() * 16 | 0;
5935
- const v2 = c2 === "x" ? r2 : r2 & 3 | 8;
6658
+ const v2 = c === "x" ? r2 : r2 & 3 | 8;
5936
6659
  return v2.toString(16);
5937
6660
  });
5938
6661
  }
@@ -7635,16 +8358,6 @@ const SceneSerializer = {
7635
8358
  return unsupported("SceneSerializer.SerializeMesh", "Babylon Lite does not implement mesh serialization.");
7636
8359
  }
7637
8360
  };
7638
- class Skeleton {
7639
- constructor() {
7640
- unsupported("Skeleton", "Skeletons are produced by the glTF loader in Babylon Lite and driven by `createAnimationController`; they are not constructed manually.");
7641
- }
7642
- }
7643
- class Bone {
7644
- constructor() {
7645
- unsupported("Bone", "Bones are produced by the glTF loader in Babylon Lite; manual bone construction is not wrapped.");
7646
- }
7647
- }
7648
8361
  class ReflectionProbe {
7649
8362
  constructor() {
7650
8363
  unsupported("ReflectionProbe", "Dynamic reflection probes are not implemented in Babylon Lite.");
@@ -7741,21 +8454,6 @@ class PointsCloudSystem {
7741
8454
  unsupported("PointsCloudSystem", "Point-cloud systems are not implemented in Babylon Lite. For Gaussian splats use the native splat loaders.");
7742
8455
  }
7743
8456
  }
7744
- class PhysicsAggregate {
7745
- constructor() {
7746
- unsupported("PhysicsAggregate", "Use the native `createPhysicsAggregate` API instead of the Babylon.js PhysicsAggregate class.");
7747
- }
7748
- }
7749
- class PhysicsBody {
7750
- constructor() {
7751
- unsupported("PhysicsBody", "Use the native `createPhysicsBody` API.");
7752
- }
7753
- }
7754
- class PhysicsShape {
7755
- constructor() {
7756
- unsupported("PhysicsShape", "Use the native `createPhysicsShape` API.");
7757
- }
7758
- }
7759
8457
  class CannonJSPlugin {
7760
8458
  constructor() {
7761
8459
  unsupported("CannonJSPlugin", "Babylon Lite physics is Havok-V2 only.");
@@ -8147,7 +8845,7 @@ export {
8147
8845
  AbstractAudioNode,
8148
8846
  AbstractAudioOutNode,
8149
8847
  AbstractEngine,
8150
- A as AbstractMesh,
8848
+ AbstractMesh,
8151
8849
  AbstractNamedAudioNode,
8152
8850
  AbstractScene,
8153
8851
  AbstractSound,
@@ -8196,8 +8894,8 @@ export {
8196
8894
  B as BoundingBox,
8197
8895
  BoundingBoxGizmo,
8198
8896
  BoundingBoxRenderer,
8199
- c as BoundingInfo,
8200
- d as BoundingSphere,
8897
+ d as BoundingInfo,
8898
+ e as BoundingSphere,
8201
8899
  CSG,
8202
8900
  CSG2,
8203
8901
  Camera,
@@ -8217,28 +8915,28 @@ export {
8217
8915
  Constants,
8218
8916
  CreateAudioBusAsync,
8219
8917
  CreateAudioEngineAsync,
8220
- e as CreateBox,
8221
- f as CreateCylinder,
8222
- g as CreateDashedLines,
8223
- h as CreateDisc,
8918
+ f as CreateBox,
8919
+ g as CreateCylinder,
8920
+ h as CreateDashedLines,
8921
+ i as CreateDisc,
8224
8922
  CreateGreasedLine,
8225
8923
  CreateGreasedLineMaterial,
8226
- i as CreateGround,
8227
- j as CreateLineSystem,
8228
- k as CreateLines,
8924
+ j as CreateGround,
8925
+ k as CreateLineSystem,
8926
+ m as CreateLines,
8229
8927
  CreateMainAudioBusAsync,
8230
8928
  CreateMicrophoneSoundSourceAsync,
8231
- m as CreatePlane,
8929
+ n as CreatePlane,
8232
8930
  CreateSoundAsync,
8233
8931
  CreateSoundBufferAsync,
8234
8932
  CreateSoundSourceAsync,
8235
- n as CreateSphere,
8933
+ o as CreateSphere,
8236
8934
  CreateStreamingSoundAsync,
8237
8935
  CreateTexture2DArrayFromImageUrlsAsync,
8238
8936
  CreateTexture2DArrayFromKTX2Async,
8239
- o as CreateTiledBox,
8240
- p as CreateTiledPlane,
8241
- q as CreateTorus,
8937
+ p as CreateTiledBox,
8938
+ q as CreateTiledPlane,
8939
+ r as CreateTorus,
8242
8940
  CubeTexture,
8243
8941
  CubicEase,
8244
8942
  Curve3,
@@ -8321,17 +9019,17 @@ export {
8321
9019
  Layer,
8322
9020
  Light,
8323
9021
  LightGizmo,
8324
- r as LinesMesh,
9022
+ s as LinesMesh,
8325
9023
  LiteCompatError,
8326
9024
  LoadAssetContainerAsync,
8327
9025
  LoadImageToTexture2DArrayLayerAsync,
8328
9026
  Logger,
8329
9027
  MainAudioBus,
8330
- s as Material,
9028
+ t as Material,
8331
9029
  MaterialGreasedLineDefines,
8332
9030
  Matrix,
8333
9031
  Mesh,
8334
- t as MeshBuilder,
9032
+ v as MeshBuilder,
8335
9033
  MeshoptCompression,
8336
9034
  MirrorTexture,
8337
9035
  MorphTarget,
@@ -8347,12 +9045,12 @@ export {
8347
9045
  OnAudioEngineV2CreatedObservable,
8348
9046
  OutlineRenderer,
8349
9047
  P as PBRAnisotropicConfiguration,
8350
- v as PBRClearCoatConfiguration,
8351
- w as PBRIridescenceConfiguration,
8352
- x as PBRMaterial,
8353
- y as PBRMetallicRoughnessMaterial,
8354
- z as PBRSheenConfiguration,
8355
- D as PBRSpecularGlossinessMaterial,
9048
+ w as PBRClearCoatConfiguration,
9049
+ x as PBRIridescenceConfiguration,
9050
+ y as PBRMaterial,
9051
+ z as PBRMetallicRoughnessMaterial,
9052
+ D as PBRSheenConfiguration,
9053
+ E as PBRSpecularGlossinessMaterial,
8356
9054
  ParticleHelper,
8357
9055
  ParticleSystem,
8358
9056
  ParticleSystemSet,
@@ -8366,17 +9064,19 @@ export {
8366
9064
  PhysicsPrestepType,
8367
9065
  PhysicsShape,
8368
9066
  PhysicsShapeType,
9067
+ PickingInfo,
8369
9068
  Plane,
8370
9069
  PlaneDragGizmo,
8371
9070
  PlaneRotationGizmo,
8372
9071
  PointLight,
8373
9072
  PointerDragBehavior,
8374
9073
  PointsCloudSystem,
9074
+ Polar,
8375
9075
  PositionGizmo,
8376
9076
  PostProcess,
8377
9077
  PrecisionDate,
8378
9078
  PredicateCondition,
8379
- E as PushMaterial,
9079
+ F as PushMaterial,
8380
9080
  QuadraticEase,
8381
9081
  QuarticEase,
8382
9082
  Quaternion,
@@ -8416,6 +9116,7 @@ export {
8416
9116
  SoundState,
8417
9117
  Space,
8418
9118
  SpatialAudioAttachmentType,
9119
+ Spherical,
8419
9120
  SpotLight,
8420
9121
  Sprite,
8421
9122
  SpriteManager,
@@ -8447,7 +9148,7 @@ export {
8447
9148
  UtilityLayerRenderer,
8448
9149
  ValueCondition,
8449
9150
  ValueConditionOperators,
8450
- F as Vector2,
9151
+ Vector2,
8451
9152
  Vector3,
8452
9153
  H as Vector4,
8453
9154
  J as VertexBuffer,
@@ -8457,8 +9158,8 @@ export {
8457
9158
  WebGPUEngine,
8458
9159
  WebXRCamera,
8459
9160
  WeightedSound,
8460
- O as transformCoordinates,
8461
- R as transformNormal,
9161
+ R as transformCoordinates,
9162
+ U as transformNormal,
8462
9163
  unsupported
8463
9164
  };
8464
9165
  //# sourceMappingURL=index.js.map