@babylonjs/lite-compat 1.7.0-preview → 1.9.0-preview
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -20
- package/index.d.ts +314 -30
- package/index.js +472 -136
- package/index.js.map +1 -1
- package/{meshes-a59_KvbH.js → meshes-CPZtn6G5.js} +114 -16
- package/meshes-CPZtn6G5.js.map +1 -0
- package/navigation.d.ts +174 -12
- package/navigation.js +1 -1
- package/package.json +4 -4
- package/meshes-a59_KvbH.js.map +0 -1
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, a as Mesh, T as TransformNode, l as liteBackedVector3, Q as Quaternion } from "./meshes-
|
|
5
|
-
import { A,
|
|
6
|
-
import { createEngine, onBeforeRender, stopEngine, resizeEngine, setEngineSize, disposeEngine, registerSceneWithShadowSupport, registerScene, startEngine, createArcRotateCamera, attachControl, getCameraPosition, getViewMatrix, getProjectionMatrix, createGeospatialCamera, setGeospatialOrientation, attachGeospatialControls, createFreeCamera, attachFreeControl, markMaterialUboDirty, createPbrMaterial, createSolidTexture2D, createStandardMaterial, setAnimationAdditive, playAnimation, pauseAnimation, goToFrame, stopAnimation, createSceneContext, updateAnimationManager, setFog, setClipPlane, 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, createTexture2DFromPixels, updateTexture2DFromPixels, loadBasisTexture2D, loadKtxTexture2D, loadTexture2D, getContainerMeshes, 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 } from "@babylonjs/lite";
|
|
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, B as BoundingInfo, Q as Quaternion } from "./meshes-CPZtn6G5.js";
|
|
5
|
+
import { A, b, c, C, d, e, f, g, h, i, G, I, j, k, m, n, o, t, p } from "./meshes-CPZtn6G5.js";
|
|
6
|
+
import { createEngine, onBeforeRender, stopEngine, resizeEngine, setEngineSize, disposeEngine, registerSceneWithShadowSupport, registerScene, startEngine, createNullEngine, stepScene, setPhysicsTimestep, setPhysicsGravity, disposePhysics, createHavokWorld, createArcRotateCamera, attachControl, getCameraPosition, getViewMatrix, getProjectionMatrix, createGeospatialCamera, setGeospatialOrientation, attachGeospatialControls, createFreeCamera, attachFreeControl, markMaterialUboDirty, 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, createTexture2DFromPixels, updateTexture2DFromPixels, createTexture3DFromPixels, loadBasisTexture2D, loadKtxTexture2D, loadTexture2D, getContainerMeshes, 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 } from "@babylonjs/lite";
|
|
7
7
|
class Color3 {
|
|
8
8
|
constructor(r = 0, g2 = 0, b2 = 0) {
|
|
9
9
|
this.r = r;
|
|
@@ -422,7 +422,7 @@ class Path3D {
|
|
|
422
422
|
__publicField(this, "_curve");
|
|
423
423
|
__publicField(this, "_distances", []);
|
|
424
424
|
__publicField(this, "_length", 0);
|
|
425
|
-
this._curve = points.map((
|
|
425
|
+
this._curve = points.map((p2) => p2.clone());
|
|
426
426
|
this._distances[0] = 0;
|
|
427
427
|
for (let i2 = 1; i2 < this._curve.length; i2++) {
|
|
428
428
|
this._length += Vector3.Distance(this._curve[i2], this._curve[i2 - 1]);
|
|
@@ -443,83 +443,6 @@ class Path3D {
|
|
|
443
443
|
return this._distances;
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
-
class BoundingSphere {
|
|
447
|
-
constructor(min, max) {
|
|
448
|
-
__publicField(this, "center");
|
|
449
|
-
__publicField(this, "radius");
|
|
450
|
-
__publicField(this, "minimum");
|
|
451
|
-
__publicField(this, "maximum");
|
|
452
|
-
this.minimum = min.clone();
|
|
453
|
-
this.maximum = max.clone();
|
|
454
|
-
this.center = Vector3.Lerp(min, max, 0.5);
|
|
455
|
-
this.radius = max.subtract(min).length() * 0.5;
|
|
456
|
-
}
|
|
457
|
-
intersectsPoint(point) {
|
|
458
|
-
return Vector3.DistanceSquared(this.center, point) <= this.radius * this.radius;
|
|
459
|
-
}
|
|
460
|
-
static Intersects(a, b2) {
|
|
461
|
-
const r = a.radius + b2.radius;
|
|
462
|
-
return Vector3.DistanceSquared(a.center, b2.center) <= r * r;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
class BoundingBox {
|
|
466
|
-
constructor(min, max) {
|
|
467
|
-
__publicField(this, "minimum");
|
|
468
|
-
__publicField(this, "maximum");
|
|
469
|
-
__publicField(this, "center");
|
|
470
|
-
__publicField(this, "extendSize");
|
|
471
|
-
/** World-space AABB corners. Equal to `minimum`/`maximum` when the box is
|
|
472
|
-
* already built in world space (as the loader's `getBoundingInfo` does). */
|
|
473
|
-
__publicField(this, "minimumWorld");
|
|
474
|
-
__publicField(this, "maximumWorld");
|
|
475
|
-
/** The 8 corner points (min/max combinations). */
|
|
476
|
-
__publicField(this, "vectors");
|
|
477
|
-
this.minimum = min.clone();
|
|
478
|
-
this.maximum = max.clone();
|
|
479
|
-
this.minimumWorld = min.clone();
|
|
480
|
-
this.maximumWorld = max.clone();
|
|
481
|
-
this.center = Vector3.Lerp(min, max, 0.5);
|
|
482
|
-
this.extendSize = max.subtract(min).scale(0.5);
|
|
483
|
-
this.vectors = [
|
|
484
|
-
new Vector3(min.x, min.y, min.z),
|
|
485
|
-
new Vector3(max.x, max.y, max.z),
|
|
486
|
-
new Vector3(max.x, min.y, min.z),
|
|
487
|
-
new Vector3(min.x, max.y, min.z),
|
|
488
|
-
new Vector3(min.x, min.y, max.z),
|
|
489
|
-
new Vector3(max.x, max.y, min.z),
|
|
490
|
-
new Vector3(min.x, max.y, max.z),
|
|
491
|
-
new Vector3(max.x, min.y, max.z)
|
|
492
|
-
];
|
|
493
|
-
}
|
|
494
|
-
intersectsPoint(point) {
|
|
495
|
-
return point.x >= this.minimum.x && point.x <= this.maximum.x && point.y >= this.minimum.y && point.y <= this.maximum.y && point.z >= this.minimum.z && point.z <= this.maximum.z;
|
|
496
|
-
}
|
|
497
|
-
static Intersects(a, b2) {
|
|
498
|
-
return a.minimum.x <= b2.maximum.x && a.maximum.x >= b2.minimum.x && a.minimum.y <= b2.maximum.y && a.maximum.y >= b2.minimum.y && a.minimum.z <= b2.maximum.z && a.maximum.z >= b2.minimum.z;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
class BoundingInfo {
|
|
502
|
-
constructor(min, max) {
|
|
503
|
-
__publicField(this, "boundingBox");
|
|
504
|
-
__publicField(this, "boundingSphere");
|
|
505
|
-
this.boundingBox = new BoundingBox(min, max);
|
|
506
|
-
this.boundingSphere = new BoundingSphere(min, max);
|
|
507
|
-
}
|
|
508
|
-
get minimum() {
|
|
509
|
-
return this.boundingBox.minimum;
|
|
510
|
-
}
|
|
511
|
-
get maximum() {
|
|
512
|
-
return this.boundingBox.maximum;
|
|
513
|
-
}
|
|
514
|
-
intersectsPoint(point) {
|
|
515
|
-
return this.boundingSphere.intersectsPoint(point) && this.boundingBox.intersectsPoint(point);
|
|
516
|
-
}
|
|
517
|
-
/** World-matrix-aware reframe is not modelled here; reframe by rebuilding from transformed corners. */
|
|
518
|
-
reConstruct(min, max, _worldMatrix) {
|
|
519
|
-
this.boundingBox = new BoundingBox(min, max);
|
|
520
|
-
this.boundingSphere = new BoundingSphere(min, max);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
446
|
class Observable {
|
|
524
447
|
constructor() {
|
|
525
448
|
__publicField(this, "_observers", []);
|
|
@@ -565,8 +488,8 @@ class AbstractEngine {
|
|
|
565
488
|
__publicField(this, "_lite");
|
|
566
489
|
/**
|
|
567
490
|
* @internal Whether this engine has no GPU device (a {@link NullEngine}). Headless
|
|
568
|
-
* engines
|
|
569
|
-
*
|
|
491
|
+
* engines build their Lite scene context with no frame-graph render task and are
|
|
492
|
+
* advanced by a pure-JS loop that steps Lite's simulation (see {@link NullEngine}).
|
|
570
493
|
*/
|
|
571
494
|
__publicField(this, "_headless", false);
|
|
572
495
|
__publicField(this, "_canvas");
|
|
@@ -844,14 +767,17 @@ class NullEngine extends WebGPUEngine {
|
|
|
844
767
|
constructor() {
|
|
845
768
|
super(NULL_CANVAS);
|
|
846
769
|
this._headless = true;
|
|
770
|
+
this._lite = createNullEngine();
|
|
847
771
|
this._initialized = true;
|
|
848
772
|
}
|
|
849
773
|
/** No GPU device to acquire. */
|
|
850
774
|
async initAsync() {
|
|
851
775
|
}
|
|
852
776
|
/**
|
|
853
|
-
* Drive a pure-JS frame loop: each tick advances every registered scene
|
|
854
|
-
*
|
|
777
|
+
* Drive a pure-JS frame loop: each tick advances every registered scene by the
|
|
778
|
+
* wall-clock delta between frames through Lite's `stepScene` (which fires the scene's before-render
|
|
779
|
+
* callbacks: CPU animations, physics, render observables), then runs the user
|
|
780
|
+
* callback(s). No GPU work is recorded or submitted.
|
|
855
781
|
*/
|
|
856
782
|
runRenderLoop(callback) {
|
|
857
783
|
this._loopCallbacks.push(callback);
|
|
@@ -865,7 +791,7 @@ class NullEngine extends WebGPUEngine {
|
|
|
865
791
|
const deltaMs = current - last;
|
|
866
792
|
last = current;
|
|
867
793
|
for (const scene of this._scenes) {
|
|
868
|
-
scene.
|
|
794
|
+
stepScene(this._lite, scene._lite, deltaMs);
|
|
869
795
|
}
|
|
870
796
|
for (const cb of this._loopCallbacks) {
|
|
871
797
|
cb();
|
|
@@ -1010,6 +936,152 @@ class AbstractScene {
|
|
|
1010
936
|
return this._trackedMeshes.find((m2) => byId(m2)) ?? this._cameras.find((c2) => byId(c2)) ?? this._lights.find((l) => byId(l)) ?? null;
|
|
1011
937
|
}
|
|
1012
938
|
}
|
|
939
|
+
var PhysicsShapeType = /* @__PURE__ */ ((PhysicsShapeType2) => {
|
|
940
|
+
PhysicsShapeType2[PhysicsShapeType2["SPHERE"] = 0] = "SPHERE";
|
|
941
|
+
PhysicsShapeType2[PhysicsShapeType2["CAPSULE"] = 1] = "CAPSULE";
|
|
942
|
+
PhysicsShapeType2[PhysicsShapeType2["CYLINDER"] = 2] = "CYLINDER";
|
|
943
|
+
PhysicsShapeType2[PhysicsShapeType2["BOX"] = 3] = "BOX";
|
|
944
|
+
PhysicsShapeType2[PhysicsShapeType2["CONVEX_HULL"] = 4] = "CONVEX_HULL";
|
|
945
|
+
PhysicsShapeType2[PhysicsShapeType2["CONTAINER"] = 5] = "CONTAINER";
|
|
946
|
+
PhysicsShapeType2[PhysicsShapeType2["MESH"] = 6] = "MESH";
|
|
947
|
+
PhysicsShapeType2[PhysicsShapeType2["HEIGHTFIELD"] = 7] = "HEIGHTFIELD";
|
|
948
|
+
return PhysicsShapeType2;
|
|
949
|
+
})(PhysicsShapeType || {});
|
|
950
|
+
var PhysicsMotionType = /* @__PURE__ */ ((PhysicsMotionType2) => {
|
|
951
|
+
PhysicsMotionType2[PhysicsMotionType2["STATIC"] = 0] = "STATIC";
|
|
952
|
+
PhysicsMotionType2[PhysicsMotionType2["ANIMATED"] = 1] = "ANIMATED";
|
|
953
|
+
PhysicsMotionType2[PhysicsMotionType2["DYNAMIC"] = 2] = "DYNAMIC";
|
|
954
|
+
return PhysicsMotionType2;
|
|
955
|
+
})(PhysicsMotionType || {});
|
|
956
|
+
var PhysicsPrestepType = /* @__PURE__ */ ((PhysicsPrestepType2) => {
|
|
957
|
+
PhysicsPrestepType2[PhysicsPrestepType2["DISABLED"] = 0] = "DISABLED";
|
|
958
|
+
PhysicsPrestepType2[PhysicsPrestepType2["TELEPORT"] = 1] = "TELEPORT";
|
|
959
|
+
PhysicsPrestepType2[PhysicsPrestepType2["ACTION"] = 2] = "ACTION";
|
|
960
|
+
return PhysicsPrestepType2;
|
|
961
|
+
})(PhysicsPrestepType || {});
|
|
962
|
+
var PhysicsConstraintType = /* @__PURE__ */ ((PhysicsConstraintType2) => {
|
|
963
|
+
PhysicsConstraintType2[PhysicsConstraintType2["BALL_AND_SOCKET"] = 1] = "BALL_AND_SOCKET";
|
|
964
|
+
PhysicsConstraintType2[PhysicsConstraintType2["DISTANCE"] = 2] = "DISTANCE";
|
|
965
|
+
PhysicsConstraintType2[PhysicsConstraintType2["HINGE"] = 3] = "HINGE";
|
|
966
|
+
PhysicsConstraintType2[PhysicsConstraintType2["SLIDER"] = 4] = "SLIDER";
|
|
967
|
+
PhysicsConstraintType2[PhysicsConstraintType2["LOCK"] = 5] = "LOCK";
|
|
968
|
+
PhysicsConstraintType2[PhysicsConstraintType2["PRISMATIC"] = 6] = "PRISMATIC";
|
|
969
|
+
PhysicsConstraintType2[PhysicsConstraintType2["SIX_DOF"] = 7] = "SIX_DOF";
|
|
970
|
+
return PhysicsConstraintType2;
|
|
971
|
+
})(PhysicsConstraintType || {});
|
|
972
|
+
class HavokPlugin {
|
|
973
|
+
constructor(useDeltaForWorldStep = true, hpInjection) {
|
|
974
|
+
/** Name of the plugin. */
|
|
975
|
+
__publicField(this, "name", "HavokPlugin");
|
|
976
|
+
/** @internal Reference to the Havok WASM module (`@babylonjs/havok`). */
|
|
977
|
+
__publicField(this, "_hknp");
|
|
978
|
+
/** The native Lite physics world, created when the plugin is attached to a scene. */
|
|
979
|
+
__publicField(this, "world", null);
|
|
980
|
+
/** @internal Fixed timestep used when delta stepping is disabled, and by force scaling. */
|
|
981
|
+
__publicField(this, "_fixedTimeStep", 1 / 60);
|
|
982
|
+
/** @internal Whether to advance the world by the elapsed frame time (vs a fixed `1/60`). */
|
|
983
|
+
__publicField(this, "_useDeltaForWorldStep");
|
|
984
|
+
/** @internal Whether the injected Havok module looks usable. */
|
|
985
|
+
__publicField(this, "_supported");
|
|
986
|
+
this._useDeltaForWorldStep = useDeltaForWorldStep;
|
|
987
|
+
this._hknp = hpInjection;
|
|
988
|
+
this._supported = hpInjection != null && typeof hpInjection !== "function";
|
|
989
|
+
}
|
|
990
|
+
/** Whether the plugin has a usable Havok module. */
|
|
991
|
+
isSupported() {
|
|
992
|
+
return this._supported;
|
|
993
|
+
}
|
|
994
|
+
/** Babylon.js physics plugin version (Havok is V2). */
|
|
995
|
+
getPluginVersion() {
|
|
996
|
+
return 2;
|
|
997
|
+
}
|
|
998
|
+
/** Set the fixed timestep used when delta stepping is disabled. Matches Babylon.js. */
|
|
999
|
+
setTimeStep(timeStep) {
|
|
1000
|
+
this._fixedTimeStep = timeStep;
|
|
1001
|
+
if (this.world && !this._useDeltaForWorldStep) {
|
|
1002
|
+
setPhysicsTimestep(this.world, timeStep);
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
/** Get the fixed timestep. Matches Babylon.js. */
|
|
1006
|
+
getTimeStep() {
|
|
1007
|
+
return this._fixedTimeStep;
|
|
1008
|
+
}
|
|
1009
|
+
/** Set the world gravity. */
|
|
1010
|
+
setGravity(gravity, worldPosition) {
|
|
1011
|
+
if (this.world) {
|
|
1012
|
+
setPhysicsGravity(this.world, gravity, worldPosition);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Manual single-step entry point. Babylon Lite drives world stepping
|
|
1017
|
+
* internally (once per rendered frame, via the scene's before-render hook),
|
|
1018
|
+
* so calling this directly is unsupported — use {@link Scene.enablePhysics}.
|
|
1019
|
+
*/
|
|
1020
|
+
executeStep() {
|
|
1021
|
+
return unsupported("HavokPlugin.executeStep", "Babylon Lite advances the world internally each frame; manual stepping is not supported.");
|
|
1022
|
+
}
|
|
1023
|
+
/** Release the native physics world. */
|
|
1024
|
+
dispose() {
|
|
1025
|
+
if (this.world) {
|
|
1026
|
+
disposePhysics(this.world);
|
|
1027
|
+
this.world = null;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* @internal Create the native Lite world for `liteScene` and select the step mode.
|
|
1032
|
+
*
|
|
1033
|
+
* Lite's native physics already steps a world by the live per-frame delta when it has no fixed
|
|
1034
|
+
* step (`createHavokWorld` leaves `_fixedDeltaMs === 0`), clamping to a tunnelling ceiling — which
|
|
1035
|
+
* is exactly Babylon.js's `useDeltaForWorldStep` behaviour. So delta stepping needs nothing extra
|
|
1036
|
+
* here; only the legacy fixed-step mode pins the world to {@link _fixedTimeStep}. The step is
|
|
1037
|
+
* driven from inside the world's own per-frame callback, so it is torn down together with the
|
|
1038
|
+
* world in {@link dispose} — nothing lingers on the scene after disposal.
|
|
1039
|
+
*/
|
|
1040
|
+
_attachToLiteScene(liteScene, gravity) {
|
|
1041
|
+
if (!this._supported) {
|
|
1042
|
+
return unsupported("HavokPlugin", "The Havok module is not ready. `await HavokPhysics()` before constructing the plugin.");
|
|
1043
|
+
}
|
|
1044
|
+
this.world = createHavokWorld(liteScene, this._hknp, gravity);
|
|
1045
|
+
if (!this._useDeltaForWorldStep) {
|
|
1046
|
+
setPhysicsTimestep(this.world, this._fixedTimeStep);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
class PhysicsEngine {
|
|
1051
|
+
constructor(plugin, gravity) {
|
|
1052
|
+
/** @internal */
|
|
1053
|
+
__publicField(this, "_plugin");
|
|
1054
|
+
/** Current world gravity. */
|
|
1055
|
+
__publicField(this, "gravity");
|
|
1056
|
+
this._plugin = plugin;
|
|
1057
|
+
this.gravity = gravity;
|
|
1058
|
+
}
|
|
1059
|
+
/** The underlying physics plugin. */
|
|
1060
|
+
getPhysicsPlugin() {
|
|
1061
|
+
return this._plugin;
|
|
1062
|
+
}
|
|
1063
|
+
/** Physics engine plugin version (Havok is V2). */
|
|
1064
|
+
getPluginVersion() {
|
|
1065
|
+
return this._plugin.getPluginVersion();
|
|
1066
|
+
}
|
|
1067
|
+
/** Set the world gravity. */
|
|
1068
|
+
setGravity(gravity) {
|
|
1069
|
+
this.gravity = gravity;
|
|
1070
|
+
this._plugin.setGravity(gravity);
|
|
1071
|
+
}
|
|
1072
|
+
/** Set the fixed timestep. */
|
|
1073
|
+
setTimeStep(newTimeStep) {
|
|
1074
|
+
this._plugin.setTimeStep(newTimeStep);
|
|
1075
|
+
}
|
|
1076
|
+
/** Get the fixed timestep. */
|
|
1077
|
+
getTimeStep() {
|
|
1078
|
+
return this._plugin.getTimeStep();
|
|
1079
|
+
}
|
|
1080
|
+
/** Release the underlying physics world. */
|
|
1081
|
+
dispose() {
|
|
1082
|
+
this._plugin.dispose();
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1013
1085
|
class Camera extends Node {
|
|
1014
1086
|
constructor(name, scene) {
|
|
1015
1087
|
super(name, scene);
|
|
@@ -1039,8 +1111,8 @@ class Camera extends Node {
|
|
|
1039
1111
|
}
|
|
1040
1112
|
/** World-space position of the camera. */
|
|
1041
1113
|
get globalPosition() {
|
|
1042
|
-
const
|
|
1043
|
-
return new Vector3(
|
|
1114
|
+
const p2 = getCameraPosition(this._lite);
|
|
1115
|
+
return new Vector3(p2.x, p2.y, p2.z);
|
|
1044
1116
|
}
|
|
1045
1117
|
/** Babylon.js `camera.getViewMatrix()` — the camera's view matrix. */
|
|
1046
1118
|
getViewMatrix() {
|
|
@@ -1149,8 +1221,8 @@ class TargetCamera extends Camera {
|
|
|
1149
1221
|
return "TargetCamera";
|
|
1150
1222
|
}
|
|
1151
1223
|
get position() {
|
|
1152
|
-
const
|
|
1153
|
-
return new Vector3(
|
|
1224
|
+
const p2 = this._lite.position;
|
|
1225
|
+
return new Vector3(p2.x, p2.y, p2.z);
|
|
1154
1226
|
}
|
|
1155
1227
|
set position(value) {
|
|
1156
1228
|
this._lite.position.set(value.x, value.y, value.z);
|
|
@@ -1177,8 +1249,8 @@ class FreeCamera extends TargetCamera {
|
|
|
1177
1249
|
}
|
|
1178
1250
|
/** @internal Wrap an already-built Lite free camera (e.g. one parsed from a `.babylon` file). */
|
|
1179
1251
|
static _adopt(name, lite, scene) {
|
|
1180
|
-
const
|
|
1181
|
-
return new FreeCamera(name, new Vector3(
|
|
1252
|
+
const p2 = lite.position;
|
|
1253
|
+
return new FreeCamera(name, new Vector3(p2.x, p2.y, p2.z), scene, lite);
|
|
1182
1254
|
}
|
|
1183
1255
|
}
|
|
1184
1256
|
class UniversalCamera extends FreeCamera {
|
|
@@ -2312,14 +2384,6 @@ const DEFAULT_SKYBOX_URL = "https://assets.babylonjs.com/core/environments/backg
|
|
|
2312
2384
|
const DEFAULT_GROUND_URL = "https://assets.babylonjs.com/core/environments/backgroundGround.png";
|
|
2313
2385
|
const DEFAULT_BRDF_URL = "/brdf-lut.png";
|
|
2314
2386
|
const DEFAULT_ENV_URL = "https://assets.babylonjs.com/environments/environmentSpecular.env";
|
|
2315
|
-
function createHeadlessLite() {
|
|
2316
|
-
return {
|
|
2317
|
-
clearColor: { r: 0, g: 0, b: 0, a: 1 },
|
|
2318
|
-
camera: null,
|
|
2319
|
-
imageProcessing: { exposure: 1, contrast: 1, toneMappingEnabled: false },
|
|
2320
|
-
animationGroups: []
|
|
2321
|
-
};
|
|
2322
|
-
}
|
|
2323
2387
|
const _Scene = class _Scene extends AbstractScene {
|
|
2324
2388
|
constructor(engine) {
|
|
2325
2389
|
super();
|
|
@@ -2364,8 +2428,6 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2364
2428
|
__publicField(this, "_blendManager", null);
|
|
2365
2429
|
__publicField(this, "_ambientColor", new Color3(0, 0, 0));
|
|
2366
2430
|
__publicField(this, "_environmentIntensity", 1);
|
|
2367
|
-
/** @internal Whether this scene is bound to a headless `NullEngine` (no GPU context). */
|
|
2368
|
-
__publicField(this, "_headless", false);
|
|
2369
2431
|
/** @internal Tracks whether at least one frame has ticked (gates `onAfterRenderObservable`). */
|
|
2370
2432
|
__publicField(this, "_renderedAFrame", false);
|
|
2371
2433
|
/** @internal `NodeMaterial`s whose async parse the engine drives after shadow generators are built. */
|
|
@@ -2382,10 +2444,12 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2382
2444
|
__publicField(this, "useRightHandedSystem", false);
|
|
2383
2445
|
// ── Clip plane (Babylon.js `scene.clipPlane`) ──
|
|
2384
2446
|
__publicField(this, "_clipPlane", null);
|
|
2447
|
+
/** @internal The active Physics V2 engine, once `enablePhysics` has wired one. */
|
|
2448
|
+
__publicField(this, "_physicsEngine", null);
|
|
2385
2449
|
this._engine = engine;
|
|
2386
2450
|
if (engine._headless) {
|
|
2387
|
-
this.
|
|
2388
|
-
this._lite
|
|
2451
|
+
this._lite = createSceneContext(engine._lite, { defaultRenderTask: false });
|
|
2452
|
+
onBeforeRender(this._lite, (deltaMs) => this._tick(deltaMs));
|
|
2389
2453
|
engine._registerScene(this);
|
|
2390
2454
|
return;
|
|
2391
2455
|
}
|
|
@@ -2758,7 +2822,7 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2758
2822
|
* exist when the scene builds.
|
|
2759
2823
|
*/
|
|
2760
2824
|
async _loadPendingEnvironment() {
|
|
2761
|
-
var _a;
|
|
2825
|
+
var _a, _b;
|
|
2762
2826
|
const envUrl = ((_a = this._envTexture) == null ? void 0 : _a.url) ?? (this._defaultEnvOptions ? DEFAULT_ENV_URL : void 0);
|
|
2763
2827
|
if (!envUrl) {
|
|
2764
2828
|
return;
|
|
@@ -2767,7 +2831,17 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2767
2831
|
const skyboxUrl = (opts == null ? void 0 : opts.skyboxFromEnv) ? envUrl : (opts == null ? void 0 : opts.createSkybox) ? DEFAULT_SKYBOX_URL : void 0;
|
|
2768
2832
|
const ip = this._lite.imageProcessing;
|
|
2769
2833
|
const ipSnapshot = { exposure: ip.exposure, contrast: ip.contrast, toneMappingEnabled: ip.toneMappingEnabled };
|
|
2770
|
-
if (
|
|
2834
|
+
if (((_b = this._envTexture) == null ? void 0 : _b._envLoaderKind) === "hdr") {
|
|
2835
|
+
await loadHdrEnvironment(this._lite, envUrl, {
|
|
2836
|
+
// Forward the BJS `HDRCubeTexture` `size` as Lite's cubemap `faceSize`
|
|
2837
|
+
// so callers that request e.g. 512 are honoured (Lite otherwise defaults
|
|
2838
|
+
// to 256). Only `HDRCubeTexture` carries `_envLoaderKind === "hdr"`.
|
|
2839
|
+
faceSize: this._envTexture.size,
|
|
2840
|
+
skyboxSize: (opts == null ? void 0 : opts.skyboxSize) ?? 1e3,
|
|
2841
|
+
useCubemapSkybox: !!skyboxUrl,
|
|
2842
|
+
skipGround: !(opts == null ? void 0 : opts.createGround)
|
|
2843
|
+
});
|
|
2844
|
+
} else if (envUrl.toLowerCase().endsWith(".dds")) {
|
|
2771
2845
|
await loadDdsEnvironment(this._lite, envUrl, {
|
|
2772
2846
|
brdfUrl: DEFAULT_BRDF_URL,
|
|
2773
2847
|
skipSkybox: !(opts == null ? void 0 : opts.createSkybox),
|
|
@@ -2830,6 +2904,44 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2830
2904
|
pickWithRay() {
|
|
2831
2905
|
return unsupported("Scene.pickWithRay", "Synchronous CPU ray-mesh intersection is not implemented in Babylon Lite.");
|
|
2832
2906
|
}
|
|
2907
|
+
/**
|
|
2908
|
+
* Babylon.js `scene.enablePhysics(gravity, plugin)`. Wires the given Havok V2
|
|
2909
|
+
* {@link HavokPlugin} to this scene, creating the native Lite physics world and
|
|
2910
|
+
* registering per-frame stepping. The plugin's `useDeltaForWorldStep` flag
|
|
2911
|
+
* controls whether the world advances by elapsed frame time (refresh-rate
|
|
2912
|
+
* independent — issue #332) or a fixed `1/60` step.
|
|
2913
|
+
*
|
|
2914
|
+
* Bodies are created with the native `createPhysicsAggregate` /
|
|
2915
|
+
* `createPhysicsBody` API against `scene.getPhysicsEngine().getPhysicsPlugin().world`.
|
|
2916
|
+
* @returns `true` once physics is enabled.
|
|
2917
|
+
*/
|
|
2918
|
+
enablePhysics(gravity, plugin) {
|
|
2919
|
+
if (this._engine._headless) {
|
|
2920
|
+
return unsupported("Scene.enablePhysics", "A headless (NullEngine) scene has no render loop to step physics.");
|
|
2921
|
+
}
|
|
2922
|
+
if (!(plugin instanceof HavokPlugin)) {
|
|
2923
|
+
return unsupported("Scene.enablePhysics", "Pass a `HavokPlugin` instance (Babylon Lite physics is Havok-V2 only).");
|
|
2924
|
+
}
|
|
2925
|
+
const g2 = gravity ?? { x: 0, y: -9.81, z: 0 };
|
|
2926
|
+
plugin._attachToLiteScene(this._lite, g2);
|
|
2927
|
+
this._physicsEngine = new PhysicsEngine(plugin, g2);
|
|
2928
|
+
return true;
|
|
2929
|
+
}
|
|
2930
|
+
/** Babylon.js `scene.getPhysicsEngine()` — the active Physics V2 engine, or `null`. */
|
|
2931
|
+
getPhysicsEngine() {
|
|
2932
|
+
return this._physicsEngine;
|
|
2933
|
+
}
|
|
2934
|
+
/** Babylon.js `scene.isPhysicsEnabled()`. */
|
|
2935
|
+
isPhysicsEnabled() {
|
|
2936
|
+
return this._physicsEngine !== null;
|
|
2937
|
+
}
|
|
2938
|
+
/** Babylon.js `scene.disablePhysicsEngine()` — release the active physics world. */
|
|
2939
|
+
disablePhysicsEngine() {
|
|
2940
|
+
if (this._physicsEngine) {
|
|
2941
|
+
this._physicsEngine.dispose();
|
|
2942
|
+
this._physicsEngine = null;
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2833
2945
|
/**
|
|
2834
2946
|
* Babylon.js `scene.beginDirectAnimation(target, animations, from, to, loop, speedRatio?)`.
|
|
2835
2947
|
* Drives the given `Animation`s on the CPU each frame, writing onto the target's
|
|
@@ -2886,9 +2998,7 @@ const _Scene = class _Scene extends AbstractScene {
|
|
|
2886
2998
|
}
|
|
2887
2999
|
dispose() {
|
|
2888
3000
|
this.onDisposeObservable.notifyObservers(this);
|
|
2889
|
-
|
|
2890
|
-
disposeScene(this._lite);
|
|
2891
|
-
}
|
|
3001
|
+
disposeScene(this._lite);
|
|
2892
3002
|
}
|
|
2893
3003
|
};
|
|
2894
3004
|
/** Babylon.js fog-mode constants. */
|
|
@@ -3538,10 +3648,10 @@ const _Texture = class _Texture extends BaseTexture {
|
|
|
3538
3648
|
if (typeof noMipmapOrOptions === "boolean") {
|
|
3539
3649
|
noMipmap = noMipmapOrOptions;
|
|
3540
3650
|
} else if (noMipmapOrOptions && typeof noMipmapOrOptions === "object") {
|
|
3541
|
-
const
|
|
3542
|
-
noMipmap =
|
|
3543
|
-
invertYOpt = invertYOpt ??
|
|
3544
|
-
samplingMode = samplingMode ??
|
|
3651
|
+
const o2 = noMipmapOrOptions;
|
|
3652
|
+
noMipmap = o2.noMipmap ?? false;
|
|
3653
|
+
invertYOpt = invertYOpt ?? o2.invertY;
|
|
3654
|
+
samplingMode = samplingMode ?? o2.samplingMode;
|
|
3545
3655
|
}
|
|
3546
3656
|
this._invertY = invertYOpt ?? true;
|
|
3547
3657
|
this._noMipmap = noMipmap;
|
|
@@ -3628,6 +3738,55 @@ class RawTexture extends BaseTexture {
|
|
|
3628
3738
|
return new RawTexture(data, width, height, scene);
|
|
3629
3739
|
}
|
|
3630
3740
|
}
|
|
3741
|
+
class RawTexture3D extends BaseTexture {
|
|
3742
|
+
constructor(data, width, height, depth, format, scene, _generateMipMaps = true, _invertY = false, _samplingMode = 3, _textureType, _creationFlags) {
|
|
3743
|
+
super();
|
|
3744
|
+
__publicField(this, "_scene");
|
|
3745
|
+
/** Babylon.js `RawTexture3D.is3D` — always true for a 3D texture. */
|
|
3746
|
+
__publicField(this, "is3D", true);
|
|
3747
|
+
this.format = format;
|
|
3748
|
+
this._scene = scene;
|
|
3749
|
+
const bytes = toRgbaBytes(data, width, height, depth);
|
|
3750
|
+
this._lite = createTexture3DFromPixels(scene.getEngine()._lite, bytes, width, height, depth);
|
|
3751
|
+
}
|
|
3752
|
+
getClassName() {
|
|
3753
|
+
return "RawTexture3D";
|
|
3754
|
+
}
|
|
3755
|
+
/** Gets the width of the texture. */
|
|
3756
|
+
get width() {
|
|
3757
|
+
var _a;
|
|
3758
|
+
return ((_a = this._lite) == null ? void 0 : _a.width) ?? 0;
|
|
3759
|
+
}
|
|
3760
|
+
/** Gets the height of the texture. */
|
|
3761
|
+
get height() {
|
|
3762
|
+
var _a;
|
|
3763
|
+
return ((_a = this._lite) == null ? void 0 : _a.height) ?? 0;
|
|
3764
|
+
}
|
|
3765
|
+
/** Gets the depth of the texture. */
|
|
3766
|
+
get depth() {
|
|
3767
|
+
var _a;
|
|
3768
|
+
return ((_a = this._lite) == null ? void 0 : _a.depth) ?? 0;
|
|
3769
|
+
}
|
|
3770
|
+
/**
|
|
3771
|
+
* Replace the texture's pixel contents. Babylon Lite has no in-place 3D update,
|
|
3772
|
+
* so the volume is re-uploaded (a fresh Lite 3D texture handle).
|
|
3773
|
+
*/
|
|
3774
|
+
update(data) {
|
|
3775
|
+
const bytes = toRgbaBytes(data, this.width, this.height, this.depth);
|
|
3776
|
+
this._lite = createTexture3DFromPixels(this._scene.getEngine()._lite, bytes, this.width, this.height, this.depth);
|
|
3777
|
+
}
|
|
3778
|
+
whenReadyAsync() {
|
|
3779
|
+
return Promise.resolve();
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
function toRgbaBytes(data, width, height, depth) {
|
|
3783
|
+
const expected = width * height * depth * 4;
|
|
3784
|
+
if (data === null) {
|
|
3785
|
+
return new Uint8Array(expected);
|
|
3786
|
+
}
|
|
3787
|
+
const bytes = data instanceof Uint8Array ? data : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
3788
|
+
return bytes.byteLength > expected ? bytes.subarray(0, expected) : bytes;
|
|
3789
|
+
}
|
|
3631
3790
|
class DynamicTexture extends BaseTexture {
|
|
3632
3791
|
constructor(name, options, scene) {
|
|
3633
3792
|
super();
|
|
@@ -3693,18 +3852,25 @@ class CubeTexture {
|
|
|
3693
3852
|
__publicField(this, "name");
|
|
3694
3853
|
__publicField(this, "gammaSpace", true);
|
|
3695
3854
|
__publicField(this, "level", 1);
|
|
3855
|
+
/**
|
|
3856
|
+
* @internal Which Lite environment loader the scene should route this handle
|
|
3857
|
+
* through at engine start. Plain `.env`/`.dds` cube maps load via
|
|
3858
|
+
* `loadEnvironment`/`loadDdsEnvironment`; `HDRCubeTexture` overrides this to
|
|
3859
|
+
* `"hdr"` so the scene picks `loadHdrEnvironment`.
|
|
3860
|
+
*/
|
|
3861
|
+
__publicField(this, "_envLoaderKind", "cube");
|
|
3696
3862
|
/** Fires when the cube map is "ready" (resolved on a microtask in this compat layer). */
|
|
3697
3863
|
__publicField(this, "onLoadObservable", new Observable());
|
|
3698
3864
|
__publicField(this, "_ready", false);
|
|
3699
3865
|
this.url = url;
|
|
3700
3866
|
this.name = url;
|
|
3701
|
-
|
|
3867
|
+
queueMicrotask(() => {
|
|
3702
3868
|
this._ready = true;
|
|
3703
3869
|
if (onLoad) {
|
|
3704
3870
|
onLoad();
|
|
3705
3871
|
}
|
|
3706
3872
|
this.onLoadObservable.notifyObservers(this);
|
|
3707
|
-
}
|
|
3873
|
+
});
|
|
3708
3874
|
}
|
|
3709
3875
|
/** Babylon.js `BaseTexture.isReady()`. */
|
|
3710
3876
|
isReady() {
|
|
@@ -3718,8 +3884,37 @@ class CubeTexture {
|
|
|
3718
3884
|
}
|
|
3719
3885
|
}
|
|
3720
3886
|
class HDRCubeTexture {
|
|
3721
|
-
constructor() {
|
|
3722
|
-
|
|
3887
|
+
constructor(url, _sceneOrEngine, size = 256, _noMipmap, _generateHarmonics, _gammaSpace, _prefilterOnLoad, onLoad) {
|
|
3888
|
+
/** Source URL of the `.hdr` panorama. */
|
|
3889
|
+
__publicField(this, "url");
|
|
3890
|
+
/** Requested cubemap face size (BJS `size`); forwarded to Lite's `faceSize`. */
|
|
3891
|
+
__publicField(this, "size");
|
|
3892
|
+
/** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */
|
|
3893
|
+
__publicField(this, "coordinatesMode", 0);
|
|
3894
|
+
__publicField(this, "name");
|
|
3895
|
+
__publicField(this, "gammaSpace", true);
|
|
3896
|
+
__publicField(this, "level", 1);
|
|
3897
|
+
/** @internal Selects Lite's `loadHdrEnvironment` in the scene's env loader. */
|
|
3898
|
+
__publicField(this, "_envLoaderKind", "hdr");
|
|
3899
|
+
/** Fires when the HDR environment is "ready" (resolved on a microtask). */
|
|
3900
|
+
__publicField(this, "onLoadObservable", new Observable());
|
|
3901
|
+
__publicField(this, "_ready", false);
|
|
3902
|
+
this.url = url;
|
|
3903
|
+
this.size = size;
|
|
3904
|
+
this.name = url;
|
|
3905
|
+
queueMicrotask(() => {
|
|
3906
|
+
this._ready = true;
|
|
3907
|
+
if (onLoad) {
|
|
3908
|
+
onLoad();
|
|
3909
|
+
}
|
|
3910
|
+
this.onLoadObservable.notifyObservers(this);
|
|
3911
|
+
});
|
|
3912
|
+
}
|
|
3913
|
+
/** Babylon.js `BaseTexture.isReady()`. */
|
|
3914
|
+
isReady() {
|
|
3915
|
+
return this._ready;
|
|
3916
|
+
}
|
|
3917
|
+
dispose() {
|
|
3723
3918
|
}
|
|
3724
3919
|
}
|
|
3725
3920
|
class RenderTargetTexture {
|
|
@@ -4179,9 +4374,24 @@ class PositionGizmo extends GizmoBase {
|
|
|
4179
4374
|
/** @internal */
|
|
4180
4375
|
__publicField(this, "_lite");
|
|
4181
4376
|
__publicField(this, "_attached", null);
|
|
4377
|
+
__publicField(this, "_xGizmo", null);
|
|
4378
|
+
__publicField(this, "_yGizmo", null);
|
|
4379
|
+
__publicField(this, "_zGizmo", null);
|
|
4182
4380
|
this._lite = createPositionGizmo(layer._engine, layer._lite);
|
|
4183
4381
|
setPositionGizmoLocalCoordinates(this._lite, true);
|
|
4184
4382
|
}
|
|
4383
|
+
/** Babylon.js `PositionGizmo.xGizmo/yGizmo/zGizmo` — the per-axis drag sub-gizmos.
|
|
4384
|
+
* Exposed so callers can toggle interactivity per axis (e.g. `xGizmo.isEnabled = false`
|
|
4385
|
+
* for a display-only gizmo). Wrappers are cached so identity is stable. */
|
|
4386
|
+
get xGizmo() {
|
|
4387
|
+
return this._xGizmo ?? (this._xGizmo = AxisDragGizmo._fromLite(this._lite.xGizmo, this._layer));
|
|
4388
|
+
}
|
|
4389
|
+
get yGizmo() {
|
|
4390
|
+
return this._yGizmo ?? (this._yGizmo = AxisDragGizmo._fromLite(this._lite.yGizmo, this._layer));
|
|
4391
|
+
}
|
|
4392
|
+
get zGizmo() {
|
|
4393
|
+
return this._zGizmo ?? (this._zGizmo = AxisDragGizmo._fromLite(this._lite.zGizmo, this._layer));
|
|
4394
|
+
}
|
|
4185
4395
|
/** Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` — orient widgets to the node's local axes. */
|
|
4186
4396
|
set updateGizmoRotationToMatchAttachedMesh(value) {
|
|
4187
4397
|
setPositionGizmoLocalCoordinates(this._lite, value);
|
|
@@ -4209,9 +4419,22 @@ class RotationGizmo extends GizmoBase {
|
|
|
4209
4419
|
/** @internal */
|
|
4210
4420
|
__publicField(this, "_lite");
|
|
4211
4421
|
__publicField(this, "_attached", null);
|
|
4422
|
+
__publicField(this, "_xGizmo", null);
|
|
4423
|
+
__publicField(this, "_yGizmo", null);
|
|
4424
|
+
__publicField(this, "_zGizmo", null);
|
|
4212
4425
|
this._lite = createRotationGizmo(layer._engine, layer._lite);
|
|
4213
4426
|
setRotationGizmoLocalCoordinates(this._lite, true);
|
|
4214
4427
|
}
|
|
4428
|
+
/** Babylon.js `RotationGizmo.xGizmo/yGizmo/zGizmo` — the per-plane rotation sub-gizmos. */
|
|
4429
|
+
get xGizmo() {
|
|
4430
|
+
return this._xGizmo ?? (this._xGizmo = PlaneRotationGizmo._fromLite(this._lite.xGizmo, this._layer));
|
|
4431
|
+
}
|
|
4432
|
+
get yGizmo() {
|
|
4433
|
+
return this._yGizmo ?? (this._yGizmo = PlaneRotationGizmo._fromLite(this._lite.yGizmo, this._layer));
|
|
4434
|
+
}
|
|
4435
|
+
get zGizmo() {
|
|
4436
|
+
return this._zGizmo ?? (this._zGizmo = PlaneRotationGizmo._fromLite(this._lite.zGizmo, this._layer));
|
|
4437
|
+
}
|
|
4215
4438
|
/** Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` — orient widgets to the node's local axes. */
|
|
4216
4439
|
set updateGizmoRotationToMatchAttachedMesh(value) {
|
|
4217
4440
|
setRotationGizmoLocalCoordinates(this._lite, value);
|
|
@@ -4239,9 +4462,22 @@ class ScaleGizmo extends GizmoBase {
|
|
|
4239
4462
|
/** @internal */
|
|
4240
4463
|
__publicField(this, "_lite");
|
|
4241
4464
|
__publicField(this, "_attached", null);
|
|
4465
|
+
__publicField(this, "_xGizmo", null);
|
|
4466
|
+
__publicField(this, "_yGizmo", null);
|
|
4467
|
+
__publicField(this, "_zGizmo", null);
|
|
4242
4468
|
this._lite = createScaleGizmo(layer._engine, layer._lite);
|
|
4243
4469
|
setScaleGizmoLocalCoordinates(this._lite, true);
|
|
4244
4470
|
}
|
|
4471
|
+
/** Babylon.js `ScaleGizmo.xGizmo/yGizmo/zGizmo` — the per-axis scale sub-gizmos. */
|
|
4472
|
+
get xGizmo() {
|
|
4473
|
+
return this._xGizmo ?? (this._xGizmo = AxisScaleGizmo._fromLite(this._lite.xGizmo, this._layer));
|
|
4474
|
+
}
|
|
4475
|
+
get yGizmo() {
|
|
4476
|
+
return this._yGizmo ?? (this._yGizmo = AxisScaleGizmo._fromLite(this._lite.yGizmo, this._layer));
|
|
4477
|
+
}
|
|
4478
|
+
get zGizmo() {
|
|
4479
|
+
return this._zGizmo ?? (this._zGizmo = AxisScaleGizmo._fromLite(this._lite.zGizmo, this._layer));
|
|
4480
|
+
}
|
|
4245
4481
|
/** Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` — orient widgets to the node's local axes. */
|
|
4246
4482
|
set updateGizmoRotationToMatchAttachedMesh(value) {
|
|
4247
4483
|
setScaleGizmoLocalCoordinates(this._lite, value);
|
|
@@ -4363,6 +4599,13 @@ function nodeLite(value) {
|
|
|
4363
4599
|
const n2 = value;
|
|
4364
4600
|
return n2._lite ?? n2._node ?? null;
|
|
4365
4601
|
}
|
|
4602
|
+
function wrapSubGizmo(ctor, lite, layer) {
|
|
4603
|
+
const g2 = Object.create(ctor.prototype);
|
|
4604
|
+
g2._lite = lite;
|
|
4605
|
+
g2._layer = layer;
|
|
4606
|
+
g2._attached = null;
|
|
4607
|
+
return g2;
|
|
4608
|
+
}
|
|
4366
4609
|
class AxisDragGizmo extends GizmoBase {
|
|
4367
4610
|
constructor(dragAxis, color, layer) {
|
|
4368
4611
|
super(layer);
|
|
@@ -4374,6 +4617,19 @@ class AxisDragGizmo extends GizmoBase {
|
|
|
4374
4617
|
color: [color.r, color.g, color.b]
|
|
4375
4618
|
});
|
|
4376
4619
|
}
|
|
4620
|
+
/** @internal Wrap an existing Lite axis-drag gizmo (a composite's sub-gizmo). */
|
|
4621
|
+
static _fromLite(lite, layer) {
|
|
4622
|
+
return wrapSubGizmo(AxisDragGizmo, lite, layer);
|
|
4623
|
+
}
|
|
4624
|
+
/** Babylon.js `IAxisDragGizmo.isEnabled` — when false the gizmo is non-interactive
|
|
4625
|
+
* (no drag, and no GPU hover picking), while its meshes stay visible and keep
|
|
4626
|
+
* following the attached node. Toggles the underlying Lite pointer-drag. */
|
|
4627
|
+
get isEnabled() {
|
|
4628
|
+
return this._lite.drag.enabled;
|
|
4629
|
+
}
|
|
4630
|
+
set isEnabled(value) {
|
|
4631
|
+
this._lite.drag.enabled = value;
|
|
4632
|
+
}
|
|
4377
4633
|
get attachedMesh() {
|
|
4378
4634
|
return this._attached;
|
|
4379
4635
|
}
|
|
@@ -4402,6 +4658,17 @@ class PlaneRotationGizmo extends GizmoBase {
|
|
|
4402
4658
|
color: [color.r, color.g, color.b]
|
|
4403
4659
|
});
|
|
4404
4660
|
}
|
|
4661
|
+
/** @internal Wrap an existing Lite plane-rotation gizmo (a composite's sub-gizmo). */
|
|
4662
|
+
static _fromLite(lite, layer) {
|
|
4663
|
+
return wrapSubGizmo(PlaneRotationGizmo, lite, layer);
|
|
4664
|
+
}
|
|
4665
|
+
/** Babylon.js `IPlaneRotationGizmo.isEnabled` — toggles interactivity (drag + hover pick). */
|
|
4666
|
+
get isEnabled() {
|
|
4667
|
+
return this._lite.drag.enabled;
|
|
4668
|
+
}
|
|
4669
|
+
set isEnabled(value) {
|
|
4670
|
+
this._lite.drag.enabled = value;
|
|
4671
|
+
}
|
|
4405
4672
|
get attachedMesh() {
|
|
4406
4673
|
return this._attached;
|
|
4407
4674
|
}
|
|
@@ -4430,6 +4697,17 @@ class PlaneDragGizmo extends GizmoBase {
|
|
|
4430
4697
|
color: [color.r, color.g, color.b]
|
|
4431
4698
|
});
|
|
4432
4699
|
}
|
|
4700
|
+
/** @internal Wrap an existing Lite plane-drag gizmo (a composite's sub-gizmo). */
|
|
4701
|
+
static _fromLite(lite, layer) {
|
|
4702
|
+
return wrapSubGizmo(PlaneDragGizmo, lite, layer);
|
|
4703
|
+
}
|
|
4704
|
+
/** Babylon.js `IPlaneDragGizmo.isEnabled` — toggles interactivity (drag + hover pick). */
|
|
4705
|
+
get isEnabled() {
|
|
4706
|
+
return this._lite.drag.enabled;
|
|
4707
|
+
}
|
|
4708
|
+
set isEnabled(value) {
|
|
4709
|
+
this._lite.drag.enabled = value;
|
|
4710
|
+
}
|
|
4433
4711
|
get attachedMesh() {
|
|
4434
4712
|
return this._attached;
|
|
4435
4713
|
}
|
|
@@ -4458,6 +4736,17 @@ class AxisScaleGizmo extends GizmoBase {
|
|
|
4458
4736
|
color: [color.r, color.g, color.b]
|
|
4459
4737
|
});
|
|
4460
4738
|
}
|
|
4739
|
+
/** @internal Wrap an existing Lite axis-scale gizmo (a composite's sub-gizmo). */
|
|
4740
|
+
static _fromLite(lite, layer) {
|
|
4741
|
+
return wrapSubGizmo(AxisScaleGizmo, lite, layer);
|
|
4742
|
+
}
|
|
4743
|
+
/** Babylon.js `IAxisScaleGizmo.isEnabled` — toggles interactivity (drag + hover pick). */
|
|
4744
|
+
get isEnabled() {
|
|
4745
|
+
return this._lite.drag.enabled;
|
|
4746
|
+
}
|
|
4747
|
+
set isEnabled(value) {
|
|
4748
|
+
this._lite.drag.enabled = value;
|
|
4749
|
+
}
|
|
4461
4750
|
get attachedMesh() {
|
|
4462
4751
|
return this._attached;
|
|
4463
4752
|
}
|
|
@@ -6906,6 +7195,42 @@ class MirrorTexture {
|
|
|
6906
7195
|
unsupported("MirrorTexture", "Mirror/reflection textures are not implemented in Babylon Lite. Build one from a native render-target texture + clip plane if required.");
|
|
6907
7196
|
}
|
|
6908
7197
|
}
|
|
7198
|
+
class HtmlTexture {
|
|
7199
|
+
constructor() {
|
|
7200
|
+
unsupported("HtmlTexture", "Rendering a live DOM element into a texture is a host-page/DOM feature with no Babylon Lite equivalent.");
|
|
7201
|
+
}
|
|
7202
|
+
}
|
|
7203
|
+
class HtmlInteractionManager {
|
|
7204
|
+
constructor() {
|
|
7205
|
+
unsupported("HtmlInteractionManager", "HTML overlay interaction is not part of Babylon Lite's WebGPU renderer.");
|
|
7206
|
+
}
|
|
7207
|
+
}
|
|
7208
|
+
class HtmlRaycastInteractionManager {
|
|
7209
|
+
constructor() {
|
|
7210
|
+
unsupported("HtmlRaycastInteractionManager", "HTML overlay raycast interaction is not part of Babylon Lite's WebGPU renderer.");
|
|
7211
|
+
}
|
|
7212
|
+
}
|
|
7213
|
+
function IsHtmlInCanvasUploadSupported() {
|
|
7214
|
+
return unsupported("IsHtmlInCanvasUploadSupported", "HTML-element texture upload is not supported by Babylon Lite.");
|
|
7215
|
+
}
|
|
7216
|
+
function UploadHtmlElementToTexture() {
|
|
7217
|
+
return unsupported("UploadHtmlElementToTexture", "HTML-element texture upload is not supported by Babylon Lite.");
|
|
7218
|
+
}
|
|
7219
|
+
function ComputeOverlayCssTransform() {
|
|
7220
|
+
return unsupported("ComputeOverlayCssTransform", "HTML overlay interaction is not supported by Babylon Lite.");
|
|
7221
|
+
}
|
|
7222
|
+
function GetElementPixelFromUv() {
|
|
7223
|
+
return unsupported("GetElementPixelFromUv", "HTML overlay raycast interaction is not supported by Babylon Lite.");
|
|
7224
|
+
}
|
|
7225
|
+
function IsHtmlInCanvasSupportedNatively() {
|
|
7226
|
+
return unsupported("IsHtmlInCanvasSupportedNatively", "The HTML-in-canvas feature is not supported by Babylon Lite.");
|
|
7227
|
+
}
|
|
7228
|
+
function InstallHtmlInCanvasPolyfill() {
|
|
7229
|
+
return unsupported("InstallHtmlInCanvasPolyfill", "The HTML-in-canvas polyfill is not supported by Babylon Lite.");
|
|
7230
|
+
}
|
|
7231
|
+
function UninstallHtmlInCanvasPolyfill() {
|
|
7232
|
+
return unsupported("UninstallHtmlInCanvasPolyfill", "The HTML-in-canvas polyfill is not supported by Babylon Lite.");
|
|
7233
|
+
}
|
|
6909
7234
|
class Sound {
|
|
6910
7235
|
constructor() {
|
|
6911
7236
|
unsupported("Sound", "Audio is not part of Babylon Lite. Use the Web Audio API directly.");
|
|
@@ -7012,11 +7337,6 @@ class PointsCloudSystem {
|
|
|
7012
7337
|
unsupported("PointsCloudSystem", "Point-cloud systems are not implemented in Babylon Lite. For Gaussian splats use the native splat loaders.");
|
|
7013
7338
|
}
|
|
7014
7339
|
}
|
|
7015
|
-
class HavokPlugin {
|
|
7016
|
-
constructor() {
|
|
7017
|
-
unsupported("HavokPlugin", "Use the native `createHavokWorld` API; the Babylon.js physics-plugin object is not wrapped.");
|
|
7018
|
-
}
|
|
7019
|
-
}
|
|
7020
7340
|
class PhysicsAggregate {
|
|
7021
7341
|
constructor() {
|
|
7022
7342
|
unsupported("PhysicsAggregate", "Use the native `createPhysicsAggregate` API instead of the Babylon.js PhysicsAggregate class.");
|
|
@@ -7146,11 +7466,11 @@ export {
|
|
|
7146
7466
|
Bone,
|
|
7147
7467
|
BounceEase,
|
|
7148
7468
|
BouncingBehavior,
|
|
7149
|
-
BoundingBox,
|
|
7469
|
+
b as BoundingBox,
|
|
7150
7470
|
BoundingBoxGizmo,
|
|
7151
7471
|
BoundingBoxRenderer,
|
|
7152
7472
|
BoundingInfo,
|
|
7153
|
-
BoundingSphere,
|
|
7473
|
+
c as BoundingSphere,
|
|
7154
7474
|
CSG,
|
|
7155
7475
|
CSG2,
|
|
7156
7476
|
Camera,
|
|
@@ -7163,23 +7483,24 @@ export {
|
|
|
7163
7483
|
Color3,
|
|
7164
7484
|
Color4,
|
|
7165
7485
|
ColorGradient,
|
|
7486
|
+
ComputeOverlayCssTransform,
|
|
7166
7487
|
Condition,
|
|
7167
7488
|
Constants,
|
|
7168
7489
|
CreateAudioBusAsync,
|
|
7169
7490
|
CreateAudioEngineAsync,
|
|
7170
7491
|
C as CreateBox,
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7492
|
+
d as CreateCylinder,
|
|
7493
|
+
e as CreateDisc,
|
|
7494
|
+
f as CreateGround,
|
|
7174
7495
|
CreateMainAudioBusAsync,
|
|
7175
7496
|
CreateMicrophoneSoundSourceAsync,
|
|
7176
|
-
|
|
7497
|
+
g as CreatePlane,
|
|
7177
7498
|
CreateSoundAsync,
|
|
7178
7499
|
CreateSoundBufferAsync,
|
|
7179
7500
|
CreateSoundSourceAsync,
|
|
7180
|
-
|
|
7501
|
+
h as CreateSphere,
|
|
7181
7502
|
CreateStreamingSoundAsync,
|
|
7182
|
-
|
|
7503
|
+
i as CreateTorus,
|
|
7183
7504
|
CubeTexture,
|
|
7184
7505
|
CubicEase,
|
|
7185
7506
|
Curve3,
|
|
@@ -7215,6 +7536,7 @@ export {
|
|
|
7215
7536
|
GaussianSplattingMesh,
|
|
7216
7537
|
GeometryBufferRenderer,
|
|
7217
7538
|
GeospatialCamera,
|
|
7539
|
+
GetElementPixelFromUv,
|
|
7218
7540
|
GizmoManager,
|
|
7219
7541
|
GlowLayer,
|
|
7220
7542
|
GreasedLineMesh,
|
|
@@ -7224,11 +7546,17 @@ export {
|
|
|
7224
7546
|
HavokPlugin,
|
|
7225
7547
|
HemisphericLight,
|
|
7226
7548
|
HighlightLayer,
|
|
7549
|
+
HtmlInteractionManager,
|
|
7550
|
+
HtmlRaycastInteractionManager,
|
|
7551
|
+
HtmlTexture,
|
|
7227
7552
|
ImageProcessingConfiguration,
|
|
7228
7553
|
ImportMeshAsync,
|
|
7229
7554
|
IncrementValueAction,
|
|
7230
7555
|
InitializeCSG2Async,
|
|
7556
|
+
InstallHtmlInCanvasPolyfill,
|
|
7231
7557
|
I as InstancedMesh,
|
|
7558
|
+
IsHtmlInCanvasSupportedNatively,
|
|
7559
|
+
IsHtmlInCanvasUploadSupported,
|
|
7232
7560
|
KHR_materials_variants,
|
|
7233
7561
|
LastCreatedAudioEngine,
|
|
7234
7562
|
Layer,
|
|
@@ -7242,7 +7570,7 @@ export {
|
|
|
7242
7570
|
Material,
|
|
7243
7571
|
Matrix,
|
|
7244
7572
|
Mesh,
|
|
7245
|
-
|
|
7573
|
+
j as MeshBuilder,
|
|
7246
7574
|
MeshoptCompression,
|
|
7247
7575
|
MirrorTexture,
|
|
7248
7576
|
MorphTarget,
|
|
@@ -7269,7 +7597,12 @@ export {
|
|
|
7269
7597
|
PerformanceMonitor,
|
|
7270
7598
|
PhysicsAggregate,
|
|
7271
7599
|
PhysicsBody,
|
|
7600
|
+
PhysicsConstraintType,
|
|
7601
|
+
PhysicsEngine,
|
|
7602
|
+
PhysicsMotionType,
|
|
7603
|
+
PhysicsPrestepType,
|
|
7272
7604
|
PhysicsShape,
|
|
7605
|
+
PhysicsShapeType,
|
|
7273
7606
|
Plane,
|
|
7274
7607
|
PlaneDragGizmo,
|
|
7275
7608
|
PlaneRotationGizmo,
|
|
@@ -7285,6 +7618,7 @@ export {
|
|
|
7285
7618
|
Quaternion,
|
|
7286
7619
|
QuinticEase,
|
|
7287
7620
|
RawTexture,
|
|
7621
|
+
RawTexture3D,
|
|
7288
7622
|
Ray,
|
|
7289
7623
|
RecastJSPlugin,
|
|
7290
7624
|
RectAreaLight,
|
|
@@ -7335,22 +7669,24 @@ export {
|
|
|
7335
7669
|
Tools,
|
|
7336
7670
|
TouchCamera,
|
|
7337
7671
|
TransformNode,
|
|
7672
|
+
UninstallHtmlInCanvasPolyfill,
|
|
7338
7673
|
UniversalCamera,
|
|
7674
|
+
UploadHtmlElementToTexture,
|
|
7339
7675
|
UtilityLayerRenderer,
|
|
7340
7676
|
ValueCondition,
|
|
7341
7677
|
ValueConditionOperators,
|
|
7342
|
-
|
|
7678
|
+
k as Vector2,
|
|
7343
7679
|
Vector3,
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7680
|
+
m as Vector4,
|
|
7681
|
+
n as VertexBuffer,
|
|
7682
|
+
o as VertexData,
|
|
7347
7683
|
Viewport,
|
|
7348
7684
|
VirtualJoystick,
|
|
7349
7685
|
WebGPUEngine,
|
|
7350
7686
|
WebXRCamera,
|
|
7351
7687
|
WeightedSound,
|
|
7352
7688
|
t as transformCoordinates,
|
|
7353
|
-
|
|
7689
|
+
p as transformNormal,
|
|
7354
7690
|
unsupported
|
|
7355
7691
|
};
|
|
7356
7692
|
//# sourceMappingURL=index.js.map
|