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