@babylonjs/lite-compat 1.25.0-preview → 1.27.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 +27 -26
- package/index.d.ts +237 -34
- package/index.js +604 -43
- package/index.js.map +1 -1
- package/{meshes-nWGELV98.js → meshes-CgaKo90D.js} +10 -10
- package/meshes-CgaKo90D.js.map +1 -0
- package/navigation.d.ts +61 -10
- package/navigation.js +1 -1
- package/package.json +4 -4
- package/meshes-nWGELV98.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, 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,
|
|
5
|
-
import { B, d, e, f, g, h, i, j, k, m, n, o, p, q, r, G, I, s, t, v,
|
|
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";
|
|
4
|
+
import { V as Vector3, a as Vector2, u as unsupported, O as Observable, L as LiteCompatError, N as Node, M as Matrix, l as liteBackedVector3, C as Color3, S as StandardMaterial, b as Color4, A as AbstractMesh, c as Mesh, T as TransformNode, Q as Quaternion, P as PushMaterial } from "./meshes-CgaKo90D.js";
|
|
5
|
+
import { B, d, e, f, g, h, i, j, k, m, n, o, p, q, r, G, I, s, t, v, w, x, y, z, D, E, F, H, J, K, R, U } from "./meshes-CgaKo90D.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, createPhysicsCharacterController, calculatePhysicsCharacterMovementToRef, createPhysicsConstraint, releasePhysicsConstraint, PhysicsShapeType as PhysicsShapeType$1, setPhysicsShapeFilterMembershipMask, setPhysicsShapeFilterCollideMask, setPhysicsShapeMaterial, setPhysicsShapeIsTrigger, releasePhysicsShape, CharacterSupportedState as CharacterSupportedState$1, PhysicsConstraintType as PhysicsConstraintType$1, PhysicsConstraintAxis as PhysicsConstraintAxis$1, createArcRotateCamera, attachControl, getCameraPosition, getViewMatrix, getProjectionMatrix, createBankedFreeCamera, 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, createCsmDirectionalShadowGenerator, 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;
|
|
@@ -828,8 +828,15 @@ class AbstractEngine {
|
|
|
828
828
|
*/
|
|
829
829
|
__publicField(this, "_lateWork", []);
|
|
830
830
|
this._canvas = canvas;
|
|
831
|
-
const opts = typeof options === "object" ? { ...options } : void 0;
|
|
832
|
-
if (opts
|
|
831
|
+
const opts = typeof options === "object" ? { ...options } : options === false ? { msaaSamples: 1 } : void 0;
|
|
832
|
+
if (opts) {
|
|
833
|
+
const antialias = opts.antialias;
|
|
834
|
+
delete opts.antialias;
|
|
835
|
+
if (antialias === false) {
|
|
836
|
+
opts.msaaSamples = 1;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
if (opts == null ? void 0 : opts.useLargeWorldRendering) {
|
|
833
840
|
delete opts.useLargeWorldRendering;
|
|
834
841
|
opts.useHighPrecisionMatrix = true;
|
|
835
842
|
opts.useFloatingOrigin = true;
|
|
@@ -1046,27 +1053,29 @@ class AbstractEngine {
|
|
|
1046
1053
|
endFrame() {
|
|
1047
1054
|
return unsupported("WebGPUEngine.endFrame", "Babylon Lite's frame graph owns the frame loop; drive rendering with `runRenderLoop`.");
|
|
1048
1055
|
}
|
|
1049
|
-
/**
|
|
1050
|
-
* Babylon.js `engine.currentSampleCount` — the MSAA sample count of the current render target.
|
|
1051
|
-
* Babylon Lite manages MSAA internally and exposes no public sample-count accessor, so this
|
|
1052
|
-
* needs a tree-shakeable Lite core addition before it can report a real value.
|
|
1053
|
-
*/
|
|
1056
|
+
/** Babylon.js `engine.currentSampleCount` — the active surface's MSAA sample count. */
|
|
1054
1057
|
get currentSampleCount() {
|
|
1055
|
-
return
|
|
1058
|
+
return this._headless ? 1 : this._lite.msaaSamples;
|
|
1056
1059
|
}
|
|
1057
1060
|
/**
|
|
1058
|
-
* Babylon.js `engine.getAlphaToCoverage()` — alpha-to-coverage state.
|
|
1059
|
-
*
|
|
1061
|
+
* Babylon.js `engine.getAlphaToCoverage()` — alpha-to-coverage state. Lite's API is scoped to
|
|
1062
|
+
* individual material/sprite/text pipeline owners, not the engine-wide state BJS exposes.
|
|
1060
1063
|
*/
|
|
1061
1064
|
getAlphaToCoverage() {
|
|
1062
|
-
return unsupported(
|
|
1065
|
+
return unsupported(
|
|
1066
|
+
"AbstractEngine.getAlphaToCoverage",
|
|
1067
|
+
"Lite's alpha-to-coverage API is target-scoped; mapping BJS's engine-wide state requires a pipeline-owner lifecycle policy."
|
|
1068
|
+
);
|
|
1063
1069
|
}
|
|
1064
1070
|
/**
|
|
1065
|
-
* Babylon.js `engine.setAlphaToCoverage(enable)` — toggle alpha-to-coverage.
|
|
1066
|
-
*
|
|
1071
|
+
* Babylon.js `engine.setAlphaToCoverage(enable)` — toggle alpha-to-coverage. Lite's target-
|
|
1072
|
+
* scoped API cannot reproduce the engine-wide state without a pipeline-owner lifecycle policy.
|
|
1067
1073
|
*/
|
|
1068
1074
|
setAlphaToCoverage(_enable) {
|
|
1069
|
-
return unsupported(
|
|
1075
|
+
return unsupported(
|
|
1076
|
+
"AbstractEngine.setAlphaToCoverage",
|
|
1077
|
+
"Lite's alpha-to-coverage API is target-scoped; mapping BJS's engine-wide state requires a pipeline-owner lifecycle policy."
|
|
1078
|
+
);
|
|
1070
1079
|
}
|
|
1071
1080
|
/**
|
|
1072
1081
|
* Babylon.js `engine.updateTextureArrayLayerFromImageSource(texture, source, layer, invertY, premultiplyAlpha)`
|
|
@@ -1361,6 +1370,10 @@ class AbstractScene {
|
|
|
1361
1370
|
return this.meshes.find((m2) => byId(m2)) ?? this._cameras.find((c) => byId(c)) ?? this._lights.find((l) => byId(l)) ?? null;
|
|
1362
1371
|
}
|
|
1363
1372
|
}
|
|
1373
|
+
let physicsBodyWrappers = null;
|
|
1374
|
+
function getPhysicsBodyWrappers() {
|
|
1375
|
+
return physicsBodyWrappers ?? (physicsBodyWrappers = /* @__PURE__ */ new WeakMap());
|
|
1376
|
+
}
|
|
1364
1377
|
var PhysicsShapeType = /* @__PURE__ */ ((PhysicsShapeType2) => {
|
|
1365
1378
|
PhysicsShapeType2[PhysicsShapeType2["SPHERE"] = 0] = "SPHERE";
|
|
1366
1379
|
PhysicsShapeType2[PhysicsShapeType2["CAPSULE"] = 1] = "CAPSULE";
|
|
@@ -1394,6 +1407,31 @@ var PhysicsConstraintType = /* @__PURE__ */ ((PhysicsConstraintType2) => {
|
|
|
1394
1407
|
PhysicsConstraintType2[PhysicsConstraintType2["SIX_DOF"] = 7] = "SIX_DOF";
|
|
1395
1408
|
return PhysicsConstraintType2;
|
|
1396
1409
|
})(PhysicsConstraintType || {});
|
|
1410
|
+
var PhysicsConstraintAxis = /* @__PURE__ */ ((PhysicsConstraintAxis2) => {
|
|
1411
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["LINEAR_X"] = 0] = "LINEAR_X";
|
|
1412
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["LINEAR_Y"] = 1] = "LINEAR_Y";
|
|
1413
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["LINEAR_Z"] = 2] = "LINEAR_Z";
|
|
1414
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["ANGULAR_X"] = 3] = "ANGULAR_X";
|
|
1415
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["ANGULAR_Y"] = 4] = "ANGULAR_Y";
|
|
1416
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["ANGULAR_Z"] = 5] = "ANGULAR_Z";
|
|
1417
|
+
PhysicsConstraintAxis2[PhysicsConstraintAxis2["LINEAR_DISTANCE"] = 6] = "LINEAR_DISTANCE";
|
|
1418
|
+
return PhysicsConstraintAxis2;
|
|
1419
|
+
})(PhysicsConstraintAxis || {});
|
|
1420
|
+
var CharacterSupportedState = /* @__PURE__ */ ((CharacterSupportedState2) => {
|
|
1421
|
+
CharacterSupportedState2[CharacterSupportedState2["UNSUPPORTED"] = 0] = "UNSUPPORTED";
|
|
1422
|
+
CharacterSupportedState2[CharacterSupportedState2["SLIDING"] = 1] = "SLIDING";
|
|
1423
|
+
CharacterSupportedState2[CharacterSupportedState2["SUPPORTED"] = 2] = "SUPPORTED";
|
|
1424
|
+
return CharacterSupportedState2;
|
|
1425
|
+
})(CharacterSupportedState || {});
|
|
1426
|
+
class Physics6DoFLimit {
|
|
1427
|
+
constructor() {
|
|
1428
|
+
__publicField(this, "axis");
|
|
1429
|
+
__publicField(this, "minLimit");
|
|
1430
|
+
__publicField(this, "maxLimit");
|
|
1431
|
+
__publicField(this, "stiffness");
|
|
1432
|
+
__publicField(this, "damping");
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1397
1435
|
function requirePhysicsWorld(scene) {
|
|
1398
1436
|
var _a;
|
|
1399
1437
|
const world = (_a = scene == null ? void 0 : scene.getPhysicsEngine()) == null ? void 0 : _a.getPhysicsPlugin().world;
|
|
@@ -1448,6 +1486,70 @@ function litePrestepType(type) {
|
|
|
1448
1486
|
throw new Error(`Invalid PhysicsPrestepType value: ${type}`);
|
|
1449
1487
|
}
|
|
1450
1488
|
}
|
|
1489
|
+
function liteConstraintType(type) {
|
|
1490
|
+
switch (type) {
|
|
1491
|
+
case 1:
|
|
1492
|
+
return PhysicsConstraintType$1.BALL_AND_SOCKET;
|
|
1493
|
+
case 2:
|
|
1494
|
+
return PhysicsConstraintType$1.DISTANCE;
|
|
1495
|
+
case 3:
|
|
1496
|
+
return PhysicsConstraintType$1.HINGE;
|
|
1497
|
+
case 4:
|
|
1498
|
+
return PhysicsConstraintType$1.SLIDER;
|
|
1499
|
+
case 5:
|
|
1500
|
+
return PhysicsConstraintType$1.LOCK;
|
|
1501
|
+
case 6:
|
|
1502
|
+
return PhysicsConstraintType$1.PRISMATIC;
|
|
1503
|
+
case 7:
|
|
1504
|
+
return PhysicsConstraintType$1.SIX_DOF;
|
|
1505
|
+
default:
|
|
1506
|
+
throw new Error(`Invalid PhysicsConstraintType value: ${type}`);
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
function liteConstraintAxis(axis) {
|
|
1510
|
+
switch (axis) {
|
|
1511
|
+
case 0:
|
|
1512
|
+
return PhysicsConstraintAxis$1.LINEAR_X;
|
|
1513
|
+
case 1:
|
|
1514
|
+
return PhysicsConstraintAxis$1.LINEAR_Y;
|
|
1515
|
+
case 2:
|
|
1516
|
+
return PhysicsConstraintAxis$1.LINEAR_Z;
|
|
1517
|
+
case 3:
|
|
1518
|
+
return PhysicsConstraintAxis$1.ANGULAR_X;
|
|
1519
|
+
case 4:
|
|
1520
|
+
return PhysicsConstraintAxis$1.ANGULAR_Y;
|
|
1521
|
+
case 5:
|
|
1522
|
+
return PhysicsConstraintAxis$1.ANGULAR_Z;
|
|
1523
|
+
case 6:
|
|
1524
|
+
return PhysicsConstraintAxis$1.LINEAR_DISTANCE;
|
|
1525
|
+
default:
|
|
1526
|
+
throw new Error(`Invalid PhysicsConstraintAxis value: ${axis}`);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
function liteCharacterSupportedState(state) {
|
|
1530
|
+
switch (state) {
|
|
1531
|
+
case 0:
|
|
1532
|
+
return CharacterSupportedState$1.UNSUPPORTED;
|
|
1533
|
+
case 1:
|
|
1534
|
+
return CharacterSupportedState$1.SLIDING;
|
|
1535
|
+
case 2:
|
|
1536
|
+
return CharacterSupportedState$1.SUPPORTED;
|
|
1537
|
+
default:
|
|
1538
|
+
throw new Error(`Invalid CharacterSupportedState value: ${state}`);
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
function compatCharacterSupportedState(state) {
|
|
1542
|
+
switch (state) {
|
|
1543
|
+
case CharacterSupportedState$1.UNSUPPORTED:
|
|
1544
|
+
return 0;
|
|
1545
|
+
case CharacterSupportedState$1.SLIDING:
|
|
1546
|
+
return 1;
|
|
1547
|
+
case CharacterSupportedState$1.SUPPORTED:
|
|
1548
|
+
return 2;
|
|
1549
|
+
default:
|
|
1550
|
+
throw new Error(`Invalid Lite CharacterSupportedState value: ${state}`);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1451
1553
|
class PhysicsShape {
|
|
1452
1554
|
constructor(options, scene) {
|
|
1453
1555
|
/** @internal */
|
|
@@ -1464,6 +1566,8 @@ class PhysicsShape {
|
|
|
1464
1566
|
__publicField(this, "_isTrigger", false);
|
|
1465
1567
|
/** @internal */
|
|
1466
1568
|
__publicField(this, "_disposed", false);
|
|
1569
|
+
/** @internal Whether this wrapper is responsible for releasing the native shape. */
|
|
1570
|
+
__publicField(this, "_ownsLiteShape", true);
|
|
1467
1571
|
this._world = requirePhysicsWorld(scene);
|
|
1468
1572
|
if (options.pluginData) {
|
|
1469
1573
|
this._lite = options.pluginData;
|
|
@@ -1474,19 +1578,28 @@ class PhysicsShape {
|
|
|
1474
1578
|
}
|
|
1475
1579
|
}
|
|
1476
1580
|
/** @internal */
|
|
1477
|
-
static _fromLite(shape, world) {
|
|
1581
|
+
static _fromLite(shape, world, ownsLiteShape = true) {
|
|
1478
1582
|
const wrapper = Object.create(PhysicsShape.prototype);
|
|
1479
1583
|
Object.defineProperties(wrapper, {
|
|
1480
|
-
_lite: { value: shape, enumerable: true },
|
|
1584
|
+
_lite: { value: shape, enumerable: true, writable: true },
|
|
1481
1585
|
_world: { value: world },
|
|
1482
1586
|
_material: { value: {}, writable: true },
|
|
1483
1587
|
_membershipMask: { value: 4294967295, writable: true },
|
|
1484
1588
|
_collideMask: { value: 4294967295, writable: true },
|
|
1485
1589
|
_isTrigger: { value: false, writable: true },
|
|
1486
|
-
_disposed: { value: false, writable: true }
|
|
1590
|
+
_disposed: { value: false, writable: true },
|
|
1591
|
+
_ownsLiteShape: { value: ownsLiteShape }
|
|
1487
1592
|
});
|
|
1488
1593
|
return wrapper;
|
|
1489
1594
|
}
|
|
1595
|
+
/** @internal */
|
|
1596
|
+
_replaceLiteShape(shape) {
|
|
1597
|
+
this._lite = shape;
|
|
1598
|
+
this.material = this._material;
|
|
1599
|
+
this.filterMembershipMask = this._membershipMask;
|
|
1600
|
+
this.filterCollideMask = this._collideMask;
|
|
1601
|
+
this.isTrigger = this._isTrigger;
|
|
1602
|
+
}
|
|
1490
1603
|
getClassName() {
|
|
1491
1604
|
return "PhysicsShape";
|
|
1492
1605
|
}
|
|
@@ -1543,7 +1656,9 @@ class PhysicsShape {
|
|
|
1543
1656
|
}
|
|
1544
1657
|
dispose() {
|
|
1545
1658
|
if (!this._disposed) {
|
|
1546
|
-
|
|
1659
|
+
if (this._ownsLiteShape) {
|
|
1660
|
+
releasePhysicsShape(this._world, this._lite);
|
|
1661
|
+
}
|
|
1547
1662
|
this._disposed = true;
|
|
1548
1663
|
}
|
|
1549
1664
|
}
|
|
@@ -1568,6 +1683,7 @@ class PhysicsBody {
|
|
|
1568
1683
|
this.startAsleep = startsAsleep;
|
|
1569
1684
|
this._world = requirePhysicsWorld(scene);
|
|
1570
1685
|
this._lite = createPhysicsBody(this._world, transformNode._node, liteMotionType(motionType), startsAsleep);
|
|
1686
|
+
getPhysicsBodyWrappers().set(this._lite, this);
|
|
1571
1687
|
setPhysicsBodyPrestepType(this._lite, PhysicsPrestepType$1.DISABLED);
|
|
1572
1688
|
this._attachToNode();
|
|
1573
1689
|
}
|
|
@@ -1585,6 +1701,7 @@ class PhysicsBody {
|
|
|
1585
1701
|
startAsleep: { value: startsAsleep, enumerable: true }
|
|
1586
1702
|
});
|
|
1587
1703
|
setPhysicsBodyPrestepType(wrapper._lite, PhysicsPrestepType$1.DISABLED);
|
|
1704
|
+
getPhysicsBodyWrappers().set(wrapper._lite, wrapper);
|
|
1588
1705
|
wrapper._attachToNode();
|
|
1589
1706
|
return wrapper;
|
|
1590
1707
|
}
|
|
@@ -1683,11 +1800,18 @@ class PhysicsBody {
|
|
|
1683
1800
|
applyForce(force, location) {
|
|
1684
1801
|
applyPhysicsBodyForce(this._world, this._lite, force, location);
|
|
1685
1802
|
}
|
|
1803
|
+
addConstraint(childBody, constraint) {
|
|
1804
|
+
if (childBody._world !== this._world) {
|
|
1805
|
+
throw new Error("PhysicsBody.addConstraint requires both bodies to belong to the same scene");
|
|
1806
|
+
}
|
|
1807
|
+
constraint._bind(this._world, this._lite, childBody._lite);
|
|
1808
|
+
}
|
|
1686
1809
|
dispose() {
|
|
1687
1810
|
if (!this._disposed) {
|
|
1688
1811
|
this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);
|
|
1689
1812
|
this._nodeDisposeObserver = null;
|
|
1690
1813
|
removePhysicsBody(this._world, this._lite);
|
|
1814
|
+
getPhysicsBodyWrappers().delete(this._lite);
|
|
1691
1815
|
if (this.transformNode.physicsBody === this) {
|
|
1692
1816
|
this.transformNode.physicsBody = null;
|
|
1693
1817
|
}
|
|
@@ -1704,6 +1828,326 @@ class PhysicsBody {
|
|
|
1704
1828
|
this._nodeDisposeObserver = this.transformNode.onDisposeObservable.add(() => this.dispose());
|
|
1705
1829
|
}
|
|
1706
1830
|
}
|
|
1831
|
+
class PhysicsConstraint {
|
|
1832
|
+
constructor(type, _options, _scene, _limits = []) {
|
|
1833
|
+
__publicField(this, "_lite", []);
|
|
1834
|
+
__publicField(this, "_world");
|
|
1835
|
+
this.type = type;
|
|
1836
|
+
this._options = _options;
|
|
1837
|
+
this._scene = _scene;
|
|
1838
|
+
this._limits = _limits;
|
|
1839
|
+
this._world = requirePhysicsWorld(_scene);
|
|
1840
|
+
}
|
|
1841
|
+
get options() {
|
|
1842
|
+
return this._options;
|
|
1843
|
+
}
|
|
1844
|
+
getClassName() {
|
|
1845
|
+
return "PhysicsConstraint";
|
|
1846
|
+
}
|
|
1847
|
+
/** @internal */
|
|
1848
|
+
_bind(world, bodyA, bodyB) {
|
|
1849
|
+
if (this._world !== world) {
|
|
1850
|
+
throw new Error("PhysicsConstraint and PhysicsBody must belong to the same scene");
|
|
1851
|
+
}
|
|
1852
|
+
this._lite.push(
|
|
1853
|
+
createPhysicsConstraint(
|
|
1854
|
+
world,
|
|
1855
|
+
bodyA,
|
|
1856
|
+
bodyB,
|
|
1857
|
+
liteConstraintType(this.type),
|
|
1858
|
+
this._options,
|
|
1859
|
+
this._limits.map((limit) => ({ ...limit, axis: liteConstraintAxis(limit.axis) }))
|
|
1860
|
+
)
|
|
1861
|
+
);
|
|
1862
|
+
}
|
|
1863
|
+
dispose() {
|
|
1864
|
+
var _a;
|
|
1865
|
+
if (this._lite.length > 0) {
|
|
1866
|
+
if (((_a = this._scene.getPhysicsEngine()) == null ? void 0 : _a.getPhysicsPlugin().world) === this._world) {
|
|
1867
|
+
for (const constraint of this._lite) {
|
|
1868
|
+
releasePhysicsConstraint(this._world, constraint);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
this._lite.length = 0;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
class HingeConstraint extends PhysicsConstraint {
|
|
1876
|
+
constructor(pivotA, pivotB, axisA, axisB, scene) {
|
|
1877
|
+
super(3, { pivotA, pivotB, axisA, axisB }, scene);
|
|
1878
|
+
}
|
|
1879
|
+
getClassName() {
|
|
1880
|
+
return "HingeConstraint";
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
class BallAndSocketConstraint extends PhysicsConstraint {
|
|
1884
|
+
constructor(pivotA, pivotB, axisA, axisB, scene) {
|
|
1885
|
+
super(1, { pivotA, pivotB, axisA, axisB }, scene);
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
class DistanceConstraint extends PhysicsConstraint {
|
|
1889
|
+
constructor(maxDistance, scene) {
|
|
1890
|
+
super(2, { maxDistance }, scene);
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
class SliderConstraint extends PhysicsConstraint {
|
|
1894
|
+
constructor(pivotA, pivotB, axisA, axisB, scene) {
|
|
1895
|
+
super(4, { pivotA, pivotB, axisA, axisB }, scene);
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
class LockConstraint extends PhysicsConstraint {
|
|
1899
|
+
constructor(pivotA, pivotB, axisA, axisB, scene) {
|
|
1900
|
+
super(5, { pivotA, pivotB, axisA, axisB }, scene);
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
class PrismaticConstraint extends PhysicsConstraint {
|
|
1904
|
+
constructor(pivotA, pivotB, axisA, axisB, scene) {
|
|
1905
|
+
super(6, { pivotA, pivotB, axisA, axisB }, scene);
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
class Physics6DoFConstraint extends PhysicsConstraint {
|
|
1909
|
+
constructor(constraintParams, limits, scene) {
|
|
1910
|
+
super(7, constraintParams, scene, limits);
|
|
1911
|
+
this.limits = limits;
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
class SpringConstraint extends Physics6DoFConstraint {
|
|
1915
|
+
constructor(pivotA, pivotB, axisA, axisB, minDistance, maxDistance, stiffness, damping, scene) {
|
|
1916
|
+
super({ pivotA, pivotB, axisA, axisB }, [{ axis: 6, minLimit: minDistance, maxLimit: maxDistance, stiffness, damping }], scene);
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
function vectorFromLite(value) {
|
|
1920
|
+
return new Vector3(value.x, value.y, value.z);
|
|
1921
|
+
}
|
|
1922
|
+
function vectorFromLiteOwned(value) {
|
|
1923
|
+
if (!(value instanceof Vector3)) {
|
|
1924
|
+
Object.setPrototypeOf(value, Vector3.prototype);
|
|
1925
|
+
}
|
|
1926
|
+
return value;
|
|
1927
|
+
}
|
|
1928
|
+
function surfaceInfoFromLite(value) {
|
|
1929
|
+
return {
|
|
1930
|
+
isSurfaceDynamic: value.isSurfaceDynamic,
|
|
1931
|
+
supportedState: compatCharacterSupportedState(value.supportedState),
|
|
1932
|
+
averageSurfaceNormal: vectorFromLite(value.averageSurfaceNormal),
|
|
1933
|
+
averageSurfaceVelocity: vectorFromLite(value.averageSurfaceVelocity),
|
|
1934
|
+
averageAngularSurfaceVelocity: vectorFromLite(value.averageAngularSurfaceVelocity)
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
class PhysicsCharacterController {
|
|
1938
|
+
constructor(position, characterShapeOptions, scene) {
|
|
1939
|
+
/** @internal */
|
|
1940
|
+
__publicField(this, "_lite");
|
|
1941
|
+
__publicField(this, "onTriggerCollisionObservable", new Observable());
|
|
1942
|
+
__publicField(this, "_shape");
|
|
1943
|
+
__publicField(this, "_up");
|
|
1944
|
+
__publicField(this, "_maxStepHeight", 0);
|
|
1945
|
+
__publicField(this, "_footOffset");
|
|
1946
|
+
__publicField(this, "_disposed", false);
|
|
1947
|
+
if (characterShapeOptions.shape) {
|
|
1948
|
+
unsupported(
|
|
1949
|
+
"PhysicsCharacterController custom shapes",
|
|
1950
|
+
"Lite's controller owns and rebuilds a capsule internally; exposing caller-owned shape replacement requires an ownership/lifetime design in Lite."
|
|
1951
|
+
);
|
|
1952
|
+
}
|
|
1953
|
+
const world = requirePhysicsWorld(scene);
|
|
1954
|
+
this._lite = createPhysicsCharacterController(world, position, {
|
|
1955
|
+
capsuleHeight: characterShapeOptions.capsuleHeight ?? 1.8,
|
|
1956
|
+
capsuleRadius: characterShapeOptions.capsuleRadius ?? 0.6
|
|
1957
|
+
});
|
|
1958
|
+
this._up = vectorFromLite(this._lite.up);
|
|
1959
|
+
this._lite.up = this._up;
|
|
1960
|
+
this._footOffset = (characterShapeOptions.capsuleHeight ?? 1.8) * 0.5;
|
|
1961
|
+
const liteShape = this._lite.getBody()._shape;
|
|
1962
|
+
if (!liteShape) {
|
|
1963
|
+
throw new Error("Babylon Lite character controller did not create a collision shape.");
|
|
1964
|
+
}
|
|
1965
|
+
this._shape = PhysicsShape._fromLite(liteShape, world, false);
|
|
1966
|
+
this._lite.onTriggerCollisionObservable.add((event) => this._notifyCollision(event));
|
|
1967
|
+
}
|
|
1968
|
+
get shape() {
|
|
1969
|
+
return this._shape;
|
|
1970
|
+
}
|
|
1971
|
+
set shape(_value) {
|
|
1972
|
+
unsupported("PhysicsCharacterController.shape", "Lite's controller owns its cast shape; replacing it requires an explicit Lite ownership/lifetime contract.");
|
|
1973
|
+
}
|
|
1974
|
+
get shapeOptions() {
|
|
1975
|
+
const { capsuleHeight, capsuleRadius } = this._lite.shapeOptions;
|
|
1976
|
+
return { capsuleHeight, capsuleRadius };
|
|
1977
|
+
}
|
|
1978
|
+
setShapeOptions(options, preserveFootPosition = true) {
|
|
1979
|
+
if (options.shape) {
|
|
1980
|
+
this.shape = options.shape;
|
|
1981
|
+
return;
|
|
1982
|
+
}
|
|
1983
|
+
this._lite.setShapeOptions({ capsuleHeight: options.capsuleHeight ?? 1.8, capsuleRadius: options.capsuleRadius ?? 0.6 }, preserveFootPosition);
|
|
1984
|
+
const liteShape = this._lite.getBody()._shape;
|
|
1985
|
+
if (!liteShape) {
|
|
1986
|
+
throw new Error("Babylon Lite character controller did not rebuild its collision shape.");
|
|
1987
|
+
}
|
|
1988
|
+
this._shape._replaceLiteShape(liteShape);
|
|
1989
|
+
this._footOffset = (options.capsuleHeight ?? 1.8) * 0.5;
|
|
1990
|
+
}
|
|
1991
|
+
getPosition() {
|
|
1992
|
+
return vectorFromLiteOwned(this._lite.getPosition());
|
|
1993
|
+
}
|
|
1994
|
+
setPosition(position) {
|
|
1995
|
+
this._lite.setPosition(position);
|
|
1996
|
+
}
|
|
1997
|
+
getVelocity() {
|
|
1998
|
+
return vectorFromLiteOwned(this._lite.getVelocity());
|
|
1999
|
+
}
|
|
2000
|
+
setVelocity(velocity) {
|
|
2001
|
+
this._lite.setVelocity(velocity);
|
|
2002
|
+
}
|
|
2003
|
+
moveWithCollisions(displacement) {
|
|
2004
|
+
this._lite.moveWithCollisions(displacement);
|
|
2005
|
+
}
|
|
2006
|
+
integrate(deltaTime, surfaceInfo, gravity) {
|
|
2007
|
+
this._lite.integrate(deltaTime, { ...surfaceInfo, supportedState: liteCharacterSupportedState(surfaceInfo.supportedState) }, gravity);
|
|
2008
|
+
}
|
|
2009
|
+
checkSupport(deltaTime, direction) {
|
|
2010
|
+
return surfaceInfoFromLite(this._lite.checkSupport(deltaTime, direction));
|
|
2011
|
+
}
|
|
2012
|
+
checkSupportToRef(deltaTime, direction, result) {
|
|
2013
|
+
const value = this._lite.checkSupport(deltaTime, direction);
|
|
2014
|
+
result.isSurfaceDynamic = value.isSurfaceDynamic;
|
|
2015
|
+
result.supportedState = compatCharacterSupportedState(value.supportedState);
|
|
2016
|
+
result.averageSurfaceNormal.set(value.averageSurfaceNormal.x, value.averageSurfaceNormal.y, value.averageSurfaceNormal.z);
|
|
2017
|
+
result.averageSurfaceVelocity.set(value.averageSurfaceVelocity.x, value.averageSurfaceVelocity.y, value.averageSurfaceVelocity.z);
|
|
2018
|
+
result.averageAngularSurfaceVelocity.set(value.averageAngularSurfaceVelocity.x, value.averageAngularSurfaceVelocity.y, value.averageAngularSurfaceVelocity.z);
|
|
2019
|
+
}
|
|
2020
|
+
calculateMovement(deltaTime, forwardWorld, surfaceNormal, currentVelocity, surfaceVelocity, desiredVelocity, upWorld) {
|
|
2021
|
+
return vectorFromLite(this._lite.calculateMovement(deltaTime, forwardWorld, surfaceNormal, currentVelocity, surfaceVelocity, desiredVelocity, upWorld));
|
|
2022
|
+
}
|
|
2023
|
+
calculateMovementToRef(deltaTime, forwardWorld, surfaceNormal, currentVelocity, surfaceVelocity, desiredVelocity, upWorld, result) {
|
|
2024
|
+
return calculatePhysicsCharacterMovementToRef(this._lite, deltaTime, forwardWorld, surfaceNormal, currentVelocity, surfaceVelocity, desiredVelocity, upWorld, result);
|
|
2025
|
+
}
|
|
2026
|
+
dispose() {
|
|
2027
|
+
if (!this._disposed) {
|
|
2028
|
+
this._lite.dispose();
|
|
2029
|
+
this.onTriggerCollisionObservable.clear();
|
|
2030
|
+
this._disposed = true;
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
get up() {
|
|
2034
|
+
return this._up;
|
|
2035
|
+
}
|
|
2036
|
+
set up(value) {
|
|
2037
|
+
this._up = value;
|
|
2038
|
+
this._lite.up = value;
|
|
2039
|
+
}
|
|
2040
|
+
get maxStepHeight() {
|
|
2041
|
+
return this._maxStepHeight;
|
|
2042
|
+
}
|
|
2043
|
+
set maxStepHeight(value) {
|
|
2044
|
+
if (value !== 0) {
|
|
2045
|
+
unsupported(
|
|
2046
|
+
"PhysicsCharacterController.maxStepHeight",
|
|
2047
|
+
"Step-up needs a substantial additional sweep/manifold policy in Lite's controller and cannot be implemented as compat translation."
|
|
2048
|
+
);
|
|
2049
|
+
}
|
|
2050
|
+
this._maxStepHeight = 0;
|
|
2051
|
+
}
|
|
2052
|
+
get footOffset() {
|
|
2053
|
+
return this._footOffset;
|
|
2054
|
+
}
|
|
2055
|
+
set footOffset(value) {
|
|
2056
|
+
if (value !== this._footOffset) {
|
|
2057
|
+
unsupported(
|
|
2058
|
+
"PhysicsCharacterController.footOffset",
|
|
2059
|
+
"Lite derives the character foot from capsule height and does not expose the custom-shape foot-offset policy used by Babylon.js."
|
|
2060
|
+
);
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
_notifyCollision(event) {
|
|
2064
|
+
const collider = getPhysicsBodyWrappers().get(event.collider);
|
|
2065
|
+
if (!collider) {
|
|
2066
|
+
unsupported(
|
|
2067
|
+
"PhysicsCharacterController collision body mapping",
|
|
2068
|
+
"The contacted Lite body was not created through the compat physics API and has no Babylon.js TransformNode wrapper."
|
|
2069
|
+
);
|
|
2070
|
+
}
|
|
2071
|
+
this.onTriggerCollisionObservable.notifyObservers({
|
|
2072
|
+
collider,
|
|
2073
|
+
colliderIndex: 0,
|
|
2074
|
+
impulse: vectorFromLite(event.impulse),
|
|
2075
|
+
impulsePosition: vectorFromLite(event.impulsePosition)
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
get keepDistance() {
|
|
2079
|
+
return this._lite.keepDistance;
|
|
2080
|
+
}
|
|
2081
|
+
set keepDistance(value) {
|
|
2082
|
+
this._lite.keepDistance = value;
|
|
2083
|
+
}
|
|
2084
|
+
get keepContactTolerance() {
|
|
2085
|
+
return this._lite.keepContactTolerance;
|
|
2086
|
+
}
|
|
2087
|
+
set keepContactTolerance(value) {
|
|
2088
|
+
this._lite.keepContactTolerance = value;
|
|
2089
|
+
}
|
|
2090
|
+
get maxCastIterations() {
|
|
2091
|
+
return this._lite.maxCastIterations;
|
|
2092
|
+
}
|
|
2093
|
+
set maxCastIterations(value) {
|
|
2094
|
+
this._lite.maxCastIterations = value;
|
|
2095
|
+
}
|
|
2096
|
+
get penetrationRecoverySpeed() {
|
|
2097
|
+
return this._lite.penetrationRecoverySpeed;
|
|
2098
|
+
}
|
|
2099
|
+
set penetrationRecoverySpeed(value) {
|
|
2100
|
+
this._lite.penetrationRecoverySpeed = value;
|
|
2101
|
+
}
|
|
2102
|
+
get staticFriction() {
|
|
2103
|
+
return this._lite.staticFriction;
|
|
2104
|
+
}
|
|
2105
|
+
set staticFriction(value) {
|
|
2106
|
+
this._lite.staticFriction = value;
|
|
2107
|
+
}
|
|
2108
|
+
get dynamicFriction() {
|
|
2109
|
+
return this._lite.dynamicFriction;
|
|
2110
|
+
}
|
|
2111
|
+
set dynamicFriction(value) {
|
|
2112
|
+
this._lite.dynamicFriction = value;
|
|
2113
|
+
}
|
|
2114
|
+
get maxSlopeCosine() {
|
|
2115
|
+
return this._lite.maxSlopeCosine;
|
|
2116
|
+
}
|
|
2117
|
+
set maxSlopeCosine(value) {
|
|
2118
|
+
this._lite.maxSlopeCosine = value;
|
|
2119
|
+
}
|
|
2120
|
+
get maxCharacterSpeedForSolver() {
|
|
2121
|
+
return this._lite.maxCharacterSpeedForSolver;
|
|
2122
|
+
}
|
|
2123
|
+
set maxCharacterSpeedForSolver(value) {
|
|
2124
|
+
this._lite.maxCharacterSpeedForSolver = value;
|
|
2125
|
+
}
|
|
2126
|
+
get characterStrength() {
|
|
2127
|
+
return this._lite.characterStrength;
|
|
2128
|
+
}
|
|
2129
|
+
set characterStrength(value) {
|
|
2130
|
+
this._lite.characterStrength = value;
|
|
2131
|
+
}
|
|
2132
|
+
get acceleration() {
|
|
2133
|
+
return this._lite.acceleration;
|
|
2134
|
+
}
|
|
2135
|
+
set acceleration(value) {
|
|
2136
|
+
this._lite.acceleration = value;
|
|
2137
|
+
}
|
|
2138
|
+
get maxAcceleration() {
|
|
2139
|
+
return this._lite.maxAcceleration;
|
|
2140
|
+
}
|
|
2141
|
+
set maxAcceleration(value) {
|
|
2142
|
+
this._lite.maxAcceleration = value;
|
|
2143
|
+
}
|
|
2144
|
+
get characterMass() {
|
|
2145
|
+
return this._lite.characterMass;
|
|
2146
|
+
}
|
|
2147
|
+
set characterMass(value) {
|
|
2148
|
+
this._lite.characterMass = value;
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
1707
2151
|
class PhysicsAggregate {
|
|
1708
2152
|
constructor(transformNode, type, options = { mass: 0 }, scene) {
|
|
1709
2153
|
__publicField(this, "transformNode");
|
|
@@ -2099,6 +2543,19 @@ class GamepadCamera extends UniversalCamera {
|
|
|
2099
2543
|
}
|
|
2100
2544
|
}
|
|
2101
2545
|
class FlyCamera extends TargetCamera {
|
|
2546
|
+
constructor(name, position, scene) {
|
|
2547
|
+
const lite = createBankedFreeCamera({ x: position.x, y: position.y, z: position.z }, { x: position.x, y: position.y, z: position.z - 1 });
|
|
2548
|
+
super(name, position, scene, lite);
|
|
2549
|
+
/** @internal Underlying banked Babylon Lite free camera. */
|
|
2550
|
+
__publicField(this, "_lite");
|
|
2551
|
+
this._lite = lite;
|
|
2552
|
+
}
|
|
2553
|
+
get upVector() {
|
|
2554
|
+
return liteBackedVector3(this._lite.upVector);
|
|
2555
|
+
}
|
|
2556
|
+
set upVector(value) {
|
|
2557
|
+
this._lite.upVector.set(value.x, value.y, value.z);
|
|
2558
|
+
}
|
|
2102
2559
|
getClassName() {
|
|
2103
2560
|
return "FlyCamera";
|
|
2104
2561
|
}
|
|
@@ -5047,6 +5504,15 @@ class AssetContainer {
|
|
|
5047
5504
|
dispose() {
|
|
5048
5505
|
}
|
|
5049
5506
|
}
|
|
5507
|
+
function validateGltfOptions(source, options) {
|
|
5508
|
+
var _a, _b;
|
|
5509
|
+
if (!isBabylonUrl(source) && !isSplatUrl(source) && ((_b = (_a = options == null ? void 0 : options.pluginOptions) == null ? void 0 : _a.gltf) == null ? void 0 : _b.preprocessUrlAsync)) {
|
|
5510
|
+
unsupported(
|
|
5511
|
+
"ISceneLoaderOptions.pluginOptions.gltf.preprocessUrlAsync",
|
|
5512
|
+
"Supporting per-resource URL preprocessing requires a loader-wide callback/context contract across Lite's core glTF loader and lazy extension modules, which cannot be added as an independent tree-shakeable export."
|
|
5513
|
+
);
|
|
5514
|
+
}
|
|
5515
|
+
}
|
|
5050
5516
|
async function loadSplatResult(url, scene) {
|
|
5051
5517
|
const gs = new GaussianSplattingMesh(baseName(url), null, scene);
|
|
5052
5518
|
await gs.loadFileAsync(url);
|
|
@@ -5112,11 +5578,13 @@ const SceneLoader = {
|
|
|
5112
5578
|
);
|
|
5113
5579
|
}
|
|
5114
5580
|
};
|
|
5115
|
-
async function ImportMeshAsync(source, scene,
|
|
5116
|
-
|
|
5117
|
-
|
|
5581
|
+
async function ImportMeshAsync(source, scene, options) {
|
|
5582
|
+
const url = joinUrl((options == null ? void 0 : options.rootUrl) ?? "", source);
|
|
5583
|
+
if (isSplatUrl(url)) {
|
|
5584
|
+
return loadSplatResult(url, scene);
|
|
5118
5585
|
}
|
|
5119
|
-
|
|
5586
|
+
validateGltfOptions(url, options);
|
|
5587
|
+
const container = await loadFromSource(url, scene);
|
|
5120
5588
|
container.addAllToScene(scene);
|
|
5121
5589
|
return {
|
|
5122
5590
|
meshes: container.meshes,
|
|
@@ -5128,17 +5596,21 @@ async function ImportMeshAsync(source, scene, _options) {
|
|
|
5128
5596
|
container
|
|
5129
5597
|
};
|
|
5130
5598
|
}
|
|
5131
|
-
async function AppendSceneAsync(source, scene,
|
|
5132
|
-
|
|
5133
|
-
|
|
5599
|
+
async function AppendSceneAsync(source, scene, options) {
|
|
5600
|
+
const url = joinUrl((options == null ? void 0 : options.rootUrl) ?? "", source);
|
|
5601
|
+
if (isSplatUrl(url)) {
|
|
5602
|
+
await loadSplatResult(url, scene);
|
|
5134
5603
|
return scene;
|
|
5135
5604
|
}
|
|
5136
|
-
|
|
5605
|
+
validateGltfOptions(url, options);
|
|
5606
|
+
const container = await loadFromSource(url, scene);
|
|
5137
5607
|
container.addAllToScene(scene);
|
|
5138
5608
|
return scene;
|
|
5139
5609
|
}
|
|
5140
|
-
async function LoadAssetContainerAsync(source, scene,
|
|
5141
|
-
|
|
5610
|
+
async function LoadAssetContainerAsync(source, scene, options) {
|
|
5611
|
+
const url = joinUrl((options == null ? void 0 : options.rootUrl) ?? "", source);
|
|
5612
|
+
validateGltfOptions(url, options);
|
|
5613
|
+
return loadFromSource(url, scene);
|
|
5142
5614
|
}
|
|
5143
5615
|
async function loadFromSource(source, scene) {
|
|
5144
5616
|
const engine = scene.getEngine()._lite;
|
|
@@ -6288,7 +6760,19 @@ class ShadowGenerator {
|
|
|
6288
6760
|
const className = this._light.getClassName();
|
|
6289
6761
|
const usePcf = this.usePercentageCloserFiltering || this.useContactHardeningShadow || this.usePoissonSampling;
|
|
6290
6762
|
let liteGen;
|
|
6291
|
-
if (
|
|
6763
|
+
if (this instanceof CascadedShadowGenerator) {
|
|
6764
|
+
liteGen = createCsmDirectionalShadowGenerator(engine, liteLight, {
|
|
6765
|
+
mapSize: this._mapSize,
|
|
6766
|
+
numCascades: this.numCascades,
|
|
6767
|
+
lambda: this.lambda,
|
|
6768
|
+
cascadeBlendPercentage: this.cascadeBlendPercentage,
|
|
6769
|
+
stabilizeCascades: this.stabilizeCascades,
|
|
6770
|
+
shadowMaxZ: this.shadowMaxZ,
|
|
6771
|
+
bias: this.bias,
|
|
6772
|
+
darkness: this.darkness,
|
|
6773
|
+
frustumEdgeFalloff: this.frustumEdgeFalloff
|
|
6774
|
+
});
|
|
6775
|
+
} else if (className === "SpotLight") {
|
|
6292
6776
|
liteGen = createPcfSpotlightShadowGenerator(engine, liteLight, {
|
|
6293
6777
|
mapSize: this._mapSize,
|
|
6294
6778
|
bias: this.bias,
|
|
@@ -6324,14 +6808,25 @@ class ShadowGenerator {
|
|
|
6324
6808
|
}
|
|
6325
6809
|
}
|
|
6326
6810
|
class CascadedShadowGenerator extends ShadowGenerator {
|
|
6327
|
-
constructor() {
|
|
6328
|
-
|
|
6329
|
-
|
|
6811
|
+
constructor(mapSize, light) {
|
|
6812
|
+
if (!(light instanceof DirectionalLight)) {
|
|
6813
|
+
throw new TypeError("CascadedShadowGenerator requires a DirectionalLight");
|
|
6814
|
+
}
|
|
6815
|
+
super(mapSize, light);
|
|
6816
|
+
__publicField(this, "_numCascades", 4);
|
|
6330
6817
|
__publicField(this, "lambda", 0.5);
|
|
6818
|
+
__publicField(this, "cascadeBlendPercentage", 0.1);
|
|
6331
6819
|
__publicField(this, "stabilizeCascades", false);
|
|
6820
|
+
__publicField(this, "shadowMaxZ");
|
|
6332
6821
|
__publicField(this, "depthClamp", true);
|
|
6333
6822
|
__publicField(this, "autoCalcDepthBounds", false);
|
|
6334
6823
|
}
|
|
6824
|
+
get numCascades() {
|
|
6825
|
+
return this._numCascades;
|
|
6826
|
+
}
|
|
6827
|
+
set numCascades(value) {
|
|
6828
|
+
this._numCascades = Math.min(Math.max(value, 2), 4);
|
|
6829
|
+
}
|
|
6335
6830
|
getClassName() {
|
|
6336
6831
|
return "CascadedShadowGenerator";
|
|
6337
6832
|
}
|
|
@@ -8005,6 +8500,50 @@ class BackgroundMaterial {
|
|
|
8005
8500
|
unsupported("BackgroundMaterial", "Standalone BackgroundMaterial is not wrapped. Use the compat `Scene` environment helpers / native `loadEnvironment` instead.");
|
|
8006
8501
|
}
|
|
8007
8502
|
}
|
|
8503
|
+
class OpenPBRMaterial extends PushMaterial {
|
|
8504
|
+
/** @internal Unsupported stubs never expose a backing Lite material. */
|
|
8505
|
+
get _lite() {
|
|
8506
|
+
return unsupported(
|
|
8507
|
+
"OpenPBRMaterial._lite",
|
|
8508
|
+
"OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design."
|
|
8509
|
+
);
|
|
8510
|
+
}
|
|
8511
|
+
constructor(_name, _scene, _forceGLSL = false) {
|
|
8512
|
+
super(_name);
|
|
8513
|
+
unsupported(
|
|
8514
|
+
"OpenPBRMaterial",
|
|
8515
|
+
"OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design."
|
|
8516
|
+
);
|
|
8517
|
+
}
|
|
8518
|
+
clone(_name, _cloneTexturesOnlyOnce = true, _rootUrl = "") {
|
|
8519
|
+
return unsupported(
|
|
8520
|
+
"OpenPBRMaterial.clone",
|
|
8521
|
+
"OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design."
|
|
8522
|
+
);
|
|
8523
|
+
}
|
|
8524
|
+
}
|
|
8525
|
+
class OpenPBRMaterialDefines {
|
|
8526
|
+
constructor(_externalProperties) {
|
|
8527
|
+
unsupported(
|
|
8528
|
+
"OpenPBRMaterialDefines",
|
|
8529
|
+
"OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design."
|
|
8530
|
+
);
|
|
8531
|
+
}
|
|
8532
|
+
}
|
|
8533
|
+
function RegisterOpenpbrMaterial() {
|
|
8534
|
+
unsupported(
|
|
8535
|
+
"RegisterOpenpbrMaterial",
|
|
8536
|
+
"OpenPBR registration would install a material parser and shader subsystem that Babylon Lite does not define; adding that subsystem needs Lite maintainer design."
|
|
8537
|
+
);
|
|
8538
|
+
}
|
|
8539
|
+
class OpenPBRMaterialLoadingAdapter {
|
|
8540
|
+
constructor(_material) {
|
|
8541
|
+
unsupported(
|
|
8542
|
+
"OpenPBRMaterialLoadingAdapter",
|
|
8543
|
+
"The adapter translates glTF material data into OpenPBRMaterial, whose shader/material subsystem requires Lite maintainer design."
|
|
8544
|
+
);
|
|
8545
|
+
}
|
|
8546
|
+
}
|
|
8008
8547
|
class RectAreaLight {
|
|
8009
8548
|
constructor() {
|
|
8010
8549
|
unsupported("RectAreaLight", "Area lights are not implemented in Babylon Lite. Use Point/Spot/Directional/Hemispheric lights.");
|
|
@@ -8358,6 +8897,10 @@ const SceneSerializer = {
|
|
|
8358
8897
|
return unsupported("SceneSerializer.SerializeMesh", "Babylon Lite does not implement mesh serialization.");
|
|
8359
8898
|
}
|
|
8360
8899
|
};
|
|
8900
|
+
const gltf2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8901
|
+
__proto__: null,
|
|
8902
|
+
OpenPBRMaterialLoadingAdapter
|
|
8903
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
8361
8904
|
class ReflectionProbe {
|
|
8362
8905
|
constructor() {
|
|
8363
8906
|
unsupported("ReflectionProbe", "Dynamic reflection probes are not implemented in Babylon Lite.");
|
|
@@ -8883,6 +9426,7 @@ export {
|
|
|
8883
9426
|
BVHFileLoader,
|
|
8884
9427
|
BackEase,
|
|
8885
9428
|
BackgroundMaterial,
|
|
9429
|
+
BallAndSocketConstraint,
|
|
8886
9430
|
BaseSixDofDragBehavior,
|
|
8887
9431
|
BaseTexture,
|
|
8888
9432
|
BlackAndWhitePostProcess,
|
|
@@ -8902,6 +9446,7 @@ export {
|
|
|
8902
9446
|
CameraGizmo,
|
|
8903
9447
|
CannonJSPlugin,
|
|
8904
9448
|
CascadedShadowGenerator,
|
|
9449
|
+
CharacterSupportedState,
|
|
8905
9450
|
ChromaticAberrationPostProcess,
|
|
8906
9451
|
CircleEase,
|
|
8907
9452
|
ClusteredLightContainer,
|
|
@@ -8946,6 +9491,7 @@ export {
|
|
|
8946
9491
|
DepthRenderer,
|
|
8947
9492
|
DeviceOrientationCamera,
|
|
8948
9493
|
DirectionalLight,
|
|
9494
|
+
DistanceConstraint,
|
|
8949
9495
|
DynamicTexture,
|
|
8950
9496
|
EASINGMODE_EASEIN,
|
|
8951
9497
|
EASINGMODE_EASEINOUT,
|
|
@@ -8969,6 +9515,7 @@ export {
|
|
|
8969
9515
|
FreeCamera,
|
|
8970
9516
|
Frustum,
|
|
8971
9517
|
FxaaPostProcess,
|
|
9518
|
+
gltf2 as GLTF2,
|
|
8972
9519
|
GPUParticleSystem,
|
|
8973
9520
|
GPUPicker,
|
|
8974
9521
|
GUID,
|
|
@@ -9002,6 +9549,7 @@ export {
|
|
|
9002
9549
|
HavokPlugin,
|
|
9003
9550
|
HemisphericLight,
|
|
9004
9551
|
HighlightLayer,
|
|
9552
|
+
HingeConstraint,
|
|
9005
9553
|
HtmlInteractionManager,
|
|
9006
9554
|
HtmlRaycastInteractionManager,
|
|
9007
9555
|
HtmlTexture,
|
|
@@ -9023,6 +9571,7 @@ export {
|
|
|
9023
9571
|
LiteCompatError,
|
|
9024
9572
|
LoadAssetContainerAsync,
|
|
9025
9573
|
LoadImageToTexture2DArrayLayerAsync,
|
|
9574
|
+
LockConstraint,
|
|
9026
9575
|
Logger,
|
|
9027
9576
|
MainAudioBus,
|
|
9028
9577
|
t as Material,
|
|
@@ -9043,21 +9592,29 @@ export {
|
|
|
9043
9592
|
OBJFileLoader,
|
|
9044
9593
|
Observable,
|
|
9045
9594
|
OnAudioEngineV2CreatedObservable,
|
|
9595
|
+
OpenPBRMaterial,
|
|
9596
|
+
OpenPBRMaterialDefines,
|
|
9597
|
+
OpenPBRMaterialLoadingAdapter,
|
|
9046
9598
|
OutlineRenderer,
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9599
|
+
w as PBRAnisotropicConfiguration,
|
|
9600
|
+
x as PBRClearCoatConfiguration,
|
|
9601
|
+
y as PBRIridescenceConfiguration,
|
|
9602
|
+
z as PBRMaterial,
|
|
9603
|
+
D as PBRMetallicRoughnessMaterial,
|
|
9604
|
+
E as PBRSheenConfiguration,
|
|
9605
|
+
F as PBRSpecularGlossinessMaterial,
|
|
9054
9606
|
ParticleHelper,
|
|
9055
9607
|
ParticleSystem,
|
|
9056
9608
|
ParticleSystemSet,
|
|
9057
9609
|
Path3D,
|
|
9058
9610
|
PerformanceMonitor,
|
|
9611
|
+
Physics6DoFConstraint,
|
|
9612
|
+
Physics6DoFLimit,
|
|
9059
9613
|
PhysicsAggregate,
|
|
9060
9614
|
PhysicsBody,
|
|
9615
|
+
PhysicsCharacterController,
|
|
9616
|
+
PhysicsConstraint,
|
|
9617
|
+
PhysicsConstraintAxis,
|
|
9061
9618
|
PhysicsConstraintType,
|
|
9062
9619
|
PhysicsEngine,
|
|
9063
9620
|
PhysicsMotionType,
|
|
@@ -9076,7 +9633,8 @@ export {
|
|
|
9076
9633
|
PostProcess,
|
|
9077
9634
|
PrecisionDate,
|
|
9078
9635
|
PredicateCondition,
|
|
9079
|
-
|
|
9636
|
+
PrismaticConstraint,
|
|
9637
|
+
PushMaterial,
|
|
9080
9638
|
QuadraticEase,
|
|
9081
9639
|
QuarticEase,
|
|
9082
9640
|
Quaternion,
|
|
@@ -9090,6 +9648,7 @@ export {
|
|
|
9090
9648
|
RectAreaLight,
|
|
9091
9649
|
ReflectionProbe,
|
|
9092
9650
|
RegisterGreasedLinePluginMaterial,
|
|
9651
|
+
RegisterOpenpbrMaterial,
|
|
9093
9652
|
RenderTargetTexture,
|
|
9094
9653
|
RotationGizmo,
|
|
9095
9654
|
SSAO2RenderingPipeline,
|
|
@@ -9109,6 +9668,7 @@ export {
|
|
|
9109
9668
|
SixDofDragBehavior,
|
|
9110
9669
|
Size,
|
|
9111
9670
|
Skeleton,
|
|
9671
|
+
SliderConstraint,
|
|
9112
9672
|
SmartArray,
|
|
9113
9673
|
SolidParticleSystem,
|
|
9114
9674
|
Sound,
|
|
@@ -9118,6 +9678,7 @@ export {
|
|
|
9118
9678
|
SpatialAudioAttachmentType,
|
|
9119
9679
|
Spherical,
|
|
9120
9680
|
SpotLight,
|
|
9681
|
+
SpringConstraint,
|
|
9121
9682
|
Sprite,
|
|
9122
9683
|
SpriteManager,
|
|
9123
9684
|
SpriteMap,
|