@babylonjs/lite-compat 1.31.0-preview → 1.32.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 +13 -12
- package/index.d.ts +480 -63
- package/index.js +1612 -125
- package/index.js.map +1 -1
- package/{meshes-Fu955h5M.js → meshes-Ds66ewr9.js} +66 -7
- package/meshes-Ds66ewr9.js.map +1 -0
- package/navigation.d.ts +70 -18
- package/navigation.js +1 -1
- package/package.json +4 -4
- package/meshes-Fu955h5M.js.map +0 -1
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as PBRSpecularGlossinessMaterial, B as transformCoordinates, C as Material, D as PBRMaterial, E as PBRIridescenceConfiguration, F as Observable, G as liteBackedColor3, H as Quaternion, I as BoundingBox, J as Vector4, K as Vector2, L as BoundingInfo, M as StandardMaterial, N as attachMaterialToScene, O as PBRMetallicRoughnessMaterial, P as Node, R as BoundingSphere, S as registerMeshAtStart, T as PBRClearCoatConfiguration, U as Color3, V as transformNormal, W as Color4, X as LiteCompatError, Y as liteBackedVector3, Z as unsupported, _ as Mesh, a as CreateDisc, b as VertexBuffer, c as CreateLines, d as CreateTiledBox, f as CreateTiledPlane, g as LinesMesh, h as InstancedMesh, i as CreateDashedLines, j as PushMaterial, k as PBRSheenConfiguration, l as CreatePlane, m as GroundMesh, n as CreateBox, o as CreateGround, p as CreateTorus, q as Vector3, r as CreateCylinder, s as CreateLineSystem, t as AbstractMesh, u as CreateSphere, v as MeshBuilder, w as PBRAnisotropicConfiguration, x as VertexData, y as TransformNode, z as Matrix } from "./meshes-
|
|
2
|
-
import { CharacterSupportedState as CharacterSupportedState$1, MaxTintMagnitude, MinTemperatureKelvin, PhysicsConstraintAxis as PhysicsConstraintAxis$1, PhysicsConstraintType as PhysicsConstraintType$1, PhysicsMotionType as PhysicsMotionType$1, PhysicsPrestepType as PhysicsPrestepType$1, PhysicsShapeType as PhysicsShapeType$1, VERSION, addAnimationGroup, addBillboardSpriteIndex, addClusteredLightContainer, addFacingBillboardSystem, addPolarToRef, addSphericalToRef, addSprite2DIndex, addToScene, animateParticleSystem, applyPhysicsBodyForce, applyPhysicsBodyImpulse, attachAxisDragGizmoToNode, attachAxisScaleGizmoToNode, attachBoundingBoxGizmoToNode, attachCameraGizmoToCamera, attachControl, attachFreeControl, attachGeospatialControls, attachLightGizmoToLight, attachPlaneDragGizmoToNode, attachPlaneRotationGizmoToNode, attachPositionGizmoToNode, attachRotationGizmoToNode, attachScaleGizmoToNode, bakeCurrentTransformIntoVertices, billboardBlendAdditive, billboardBlendAlpha, calculatePhysicsCharacterMovementToRef, clearBoneOverride, createAnimationManager, createArcRotateCamera, createAudioBusAsync, createAudioEngineAsync, createAxisDragGizmo, createAxisScaleGizmo, createBankedFreeCamera, createBoundingBoxGizmo, createCameraGizmo, createClusteredLightContainer, createClusteredPointLight, createCsg2FromMesh, createCsgFromMesh, createCsmDirectionalShadowGenerator, createDefaultCamera, createDefaultMeshBlendRadiusDefinitions, createDirectionalLight, createDynamicTexture, createEngine, createEsmDirectionalShadowGenerator, createFacingBillboardSystem, createFreeCamera, createGeospatialCamera, createGpuPicker, createGridMaterial, createHavokWorld, createHemisphericLight, createHtmlTexture, createKhrInteractivityRuntimeValueSnapshot, createLightGizmo, createMeshFromCsg, createMeshesFromCsg2, createMicrophoneSoundSourceAsync, createMorphTargets, createNullEngine, createParticleBillboard, createPcfDirectionalShadowGenerator, createPcfSpotlightShadowGenerator, createPhysicsAggregate, createPhysicsBody, createPhysicsCharacterController, createPhysicsConstraint, createPhysicsShape, createPickingRay, createPlaneDragGizmo, createPlaneRotationGizmo, createPointLight, createPositionGizmo, createRotationGizmo, createScaleGizmo, createSceneContext, createSoundAsync, createSoundBufferAsync, createSoundSourceAsync, createSpotLight, createSprite2DLayer, createSpriteRenderer, createStreamingSoundAsync, createTexture2DArray, createTexture2DArrayFromKtx2, createTexture2DArrayFromPixels, createTexture2DArrayFromUrls, createTexture2DFromPixels, createTexture3DFromPixels, createTransformNode, createUtilityLayer, csg2Add, csg2Intersect, csg2Subtract, csgIntersect, csgSubtract, csgUnion, disableOrthographicCamera, disposeAudioBus, disposeAudioEngine, disposeAxisDragGizmo, disposeAxisScaleGizmo, disposeBoundingBoxGizmo, disposeCameraGizmo, disposeCsg2, disposeEngine, disposeHtmlTexture, disposeLightGizmo, disposePhysics, disposePicker, disposePlaneDragGizmo, disposePlaneRotationGizmo, disposePositionGizmo, disposeRotationGizmo, disposeScaleGizmo, disposeScene, disposeSound, disposeSoundSource, disposeStreamingSound, disposeUtilityLayer, dividePolarToRef, divideSphericalToRef, enableAnalyzer, enableAnimationBlending, enableArcRotateKeyboardControls, enableBoneControlForSkinnedAssets, enableHavokThinInstancePhysicsSync, enableMirroredMeshes, enableOrthographicCamera, enableSpatial, enableStereo, getBoneByName, getByteFrequencyData, getByteTimeDomainData, getCameraPosition, getFloatFrequencyData, getFloatTimeDomainData, getMasterVolume, getPhysicsBodyAngularVelocity, getPhysicsBodyLinearVelocity, getProjectionMatrix, getVariantNames, getViewMatrix, getWhiteBalanceMatrix, goToFrame, hasDefaultInteractivityFlowInput, initializeCsg2Async, invertMat4, loadBabylon, loadBasisTexture2D, loadDdsEnvironment, loadEnvironment, loadGltf, loadHdrEnvironment, loadImageToArrayLayer, loadKtxTexture2D, loadSOG, loadSPZ, loadSplat, loadSpriteAtlas, loadTexture2D, markClusteredLightContainerDirty, multiplyMat4, multiplyPolarToRef, multiplySphericalToRef, normalizeInteractivityEventDataConfiguration, normalizeKhrInteractivityRuntimeValue, onBeforeRender, onPhysicsAfterStep, packMeshBlendingTag, parseNodeMaterialFromSnippet, parseNodeParticleSetFromSnippet, pauseAnimation, pauseSound, pauseStreamingSound, physicsRaycast, pickAsync, pickMeshesWithRay, playAnimation, playSound, playStreamingSound, polarFromVec2ToRef, polarToVec2ToRef, preloadStreamingInstanceAsync, preloadStreamingInstancesAsync, registerNodeParticleSet, registerScene, registerSceneWithShadowSupport, registerSpriteRenderer, registerUtilityLayer, releasePhysicsConstraint, releasePhysicsShape, removeFromScene, removePhysicsBody, requestHtmlTextureUpdate, resetVariant, resizeEngine, resolveCameraViewport, resumeSound, resumeStreamingSound, sampleCatmullRomSpline, sampleHermiteSpline, scalePolarToRef, scaleSphericalToRef, selectVariant, setAnimationAdditive, setBonePosition, setBoneRotationQuaternion, setBoneScaling, setBusVolume, setClipPlane, setEngineSize, setFog, setGeospatialOrientation, setMasterVolume, setMorphTargetWeights, setPhysicsBodyAngularVelocity, setPhysicsBodyLinearVelocity, setPhysicsBodyMassProperties, setPhysicsBodyMotionType, setPhysicsBodyPrestepType, setPhysicsBodyShape, setPhysicsGravity, setPhysicsShapeFilterCollideMask, setPhysicsShapeFilterMembershipMask, setPhysicsShapeIsTrigger, setPhysicsShapeMaterial, setPhysicsTimestep, setPositionGizmoLocalCoordinates, setRotationGizmoLocalCoordinates, setScaleGizmoLocalCoordinates, setShadowTaskCasterMeshes, setSoundSourceVolume, setSoundVolume, setSpatialListener, setSpatialListenerPosition, setSpatialOrientation, setSpatialPosition, setStereoPan, setStreamingSoundVolume, sphericalFromVec3ToRef, sphericalToVec3ToRef, spriteBlendAdditive, spriteBlendAlpha, spriteBlendPremultiplied, startEngine, startParticleSystem, stepScene, stopAnimation, stopEngine, stopParticleSystem, stopSound, stopStreamingSound, subtractPolarToRef, subtractSphericalToRef, syncParticleBillboard, temperatureTintToXyz, unlockAudioEngineAsync, unpackMeshBlendingTag, updateAnimationManager, updateBillboardSpriteIndex, updateDynamicTexture, updateHtmlTexture, updateSpatialAudio, updateSprite2DIndex, updateTexture2DArrayFromPixels, updateTexture2DFromPixels, uploadImageToArrayLayer, whenHtmlTextureReady } from "@babylonjs/lite";
|
|
1
|
+
import { A as PBRSpecularGlossinessMaterial, B as transformCoordinates, C as Material, D as PBRMaterial, E as PBRIridescenceConfiguration, F as Observable, G as liteBackedColor3, H as Quaternion, I as BoundingBox, J as Vector4, K as Vector2, L as BoundingInfo, M as StandardMaterial, N as attachMaterialToScene, O as PBRMetallicRoughnessMaterial, P as Node, R as BoundingSphere, S as registerMeshAtStart, T as PBRClearCoatConfiguration, U as Color3, V as transformNormal, W as Color4, X as LiteCompatError, Y as liteBackedVector3, Z as unsupported, _ as Mesh, a as CreateDisc, b as VertexBuffer, c as CreateLines, d as CreateTiledBox, f as CreateTiledPlane, g as LinesMesh, h as InstancedMesh, i as CreateDashedLines, j as PushMaterial, k as PBRSheenConfiguration, l as CreatePlane, m as GroundMesh, n as CreateBox, o as CreateGround, p as CreateTorus, q as Vector3, r as CreateCylinder, s as CreateLineSystem, t as AbstractMesh, u as CreateSphere, v as MeshBuilder, w as PBRAnisotropicConfiguration, x as VertexData, y as TransformNode, z as Matrix } from "./meshes-Ds66ewr9.js";
|
|
2
|
+
import { CharacterSupportedState as CharacterSupportedState$1, MaxTintMagnitude, MinTemperatureKelvin, PhysicsConstraintAxis as PhysicsConstraintAxis$1, PhysicsConstraintType as PhysicsConstraintType$1, PhysicsMotionType as PhysicsMotionType$1, PhysicsPrestepType as PhysicsPrestepType$1, PhysicsShapeType as PhysicsShapeType$1, VERSION, addAnimationGroup, addBillboardSpriteIndex, addClusteredLightContainer, addComputeDispatch, addFacingBillboardSystem, addPolarToRef, addSphericalToRef, addSprite2DIndex, addToScene, animateParticleSystem, applyPhysicsBodyForce, applyPhysicsBodyImpulse, attachAxisDragGizmoToNode, attachAxisScaleGizmoToNode, attachBoundingBoxGizmoToNode, attachCameraGizmoToCamera, attachControl, attachFreeControl, attachGeospatialControls, attachLightGizmoToLight, attachPlaneDragGizmoToNode, attachPlaneRotationGizmoToNode, attachPositionGizmoToNode, attachRotationGizmoToNode, attachScaleGizmoToNode, backEase, bakeCurrentTransformIntoVertices, bezierCurveEase, billboardBlendAdditive, billboardBlendAlpha, bounceEase, calculatePhysicsCharacterMovementToRef, circleEase, clearAnimationManager, clearBoneOverride, clearStorageBuffer, computeStorageBufferBinding, computeUniformBufferBinding, createAnimationManager, createArcRotateCamera, createAudioBusAsync, createAudioEngineAsync, createAxisDragGizmo, createAxisScaleGizmo, createBankedFreeCamera, createBoundingBoxGizmo, createCameraGizmo, createClusteredLightContainer, createClusteredPointLight, createComputeBindingSet, createComputeDispatch, createComputeIndirectDispatch, createComputeShader, createComputeTask, createCsg2FromMesh, createCsgFromMesh, createCsmDirectionalShadowGenerator, createDefaultCamera, createDefaultMeshBlendRadiusDefinitions, createDirectionalLight, createDynamicTexture, createEngine, createEsmDirectionalShadowGenerator, createFacingBillboardSystem, createFreeCamera, createGeospatialCamera, createGpuPicker, createGridMaterial, createHavokWorld, createHemisphericLight, createHtmlTexture, createKhrInteractivityRuntimeValueSnapshot, createLightGizmo, createMeshFromCsg, createMeshesFromCsg2, createMicrophoneSoundSourceAsync, createMorphTargets, createNullEngine, createParticleBillboard, createPcfDirectionalShadowGenerator, createPcfSpotlightShadowGenerator, createPhysicsAggregate, createPhysicsBody, createPhysicsCharacterController, createPhysicsConstraint, createPhysicsShape, createPickingRay, createPlaneDragGizmo, createPlaneRotationGizmo, createPointLight, createPositionGizmo, createPropertyAnimationClip, createPropertyAnimationGroup, createRotationGizmo, createScaleGizmo, createSceneContext, createSoundAsync, createSoundBufferAsync, createSoundSourceAsync, createSpotLight, createSprite2DLayer, createSpriteRenderer, createStorageBuffer, createStreamingSoundAsync, createTexture2DArray, createTexture2DArrayFromKtx2, createTexture2DArrayFromPixels, createTexture2DArrayFromUrls, createTexture2DFromPixels, createTexture3DFromPixels, createTransformNode, createUniformBuffer, createUtilityLayer, csg2Add, csg2Intersect, csg2Subtract, csgIntersect, csgSubtract, csgUnion, cubicEase, disableOrthographicCamera, disposeAudioBus, disposeAudioEngine, disposeAxisDragGizmo, disposeAxisScaleGizmo, disposeBoundingBoxGizmo, disposeCameraGizmo, disposeComputeBindingSet, disposeComputeShader, disposeCsg2, disposeEngine, disposeHtmlTexture, disposeLightGizmo, disposePhysics, disposePicker, disposePlaneDragGizmo, disposePlaneRotationGizmo, disposePositionGizmo, disposeRotationGizmo, disposeScaleGizmo, disposeScene, disposeSound, disposeSoundSource, disposeStorageBuffer, disposeStreamingSound, disposeUniformBuffer, disposeUsd, disposeUtilityLayer, dividePolarToRef, divideSphericalToRef, elasticEase, enableAnalyzer, enableAnimationBlending, enableArcRotateKeyboardControls, enableBoneControlForSkinnedAssets, enableHavokThinInstancePhysicsSync, enableMirroredMeshes, enableOrthographicCamera, enableSpatial, enableStereo, exponentialEase, getBoneByName, getByteFrequencyData, getByteTimeDomainData, getCameraPosition, getFloatFrequencyData, getFloatTimeDomainData, getMasterVolume, getPhysicsBodyAngularVelocity, getPhysicsBodyLinearVelocity, getProjectionMatrix, getVariantNames, getViewMatrix, getWhiteBalanceMatrix, goToFrame, hasDefaultInteractivityFlowInput, initializeCsg2Async, invertMat4, loadBabylon, loadBasisTexture2D, loadDdsEnvironment, loadEnvironment, loadGltf, loadHdrEnvironment, loadImageToArrayLayer, loadKtxTexture2D, loadSOG, loadSPZ, loadSplat, loadSpriteAtlas, loadTexture2D, loadUsd, markClusteredLightContainerDirty, multiplyMat4, multiplyPolarToRef, multiplySphericalToRef, normalizeInteractivityEventDataConfiguration, normalizeKhrInteractivityRuntimeValue, onBeforeRender, onPhysicsAfterStep, packMeshBlendingTag, parseNodeMaterialFromSnippet, parseNodeParticleSetFromSnippet, pauseAnimation, pauseSound, pauseStreamingSound, physicsRaycast, pickAsync, pickMeshesWithRay, playAnimation, playSound, playStreamingSound, polarFromVec2ToRef, polarToVec2ToRef, powerEase, preloadStreamingInstanceAsync, preloadStreamingInstancesAsync, quadraticEase, quarticEase, quinticEase, readStorageBufferAfterFrame, registerNodeParticleSet, registerScene, registerSceneWithShadowSupport, registerSpriteRenderer, registerUtilityLayer, releasePhysicsConstraint, releasePhysicsShape, removeAnimationGroup, removeFromScene, removePhysicsBody, requestHtmlTextureUpdate, resetVariant, resizeEngine, resolveCameraViewport, resumeSound, resumeStreamingSound, sampleCatmullRomSpline, sampleHermiteSpline, scalePolarToRef, scaleSphericalToRef, selectVariant, setAnimationAdditive, setBonePosition, setBoneRotationQuaternion, setBoneScaling, setBusVolume, setClipPlane, setEngineSize, setFog, setGeospatialOrientation, setMasterVolume, setMorphTargetWeights, setParent, setPhysicsBodyAngularVelocity, setPhysicsBodyLinearVelocity, setPhysicsBodyMassProperties, setPhysicsBodyMotionType, setPhysicsBodyPrestepType, setPhysicsBodyShape, setPhysicsGravity, setPhysicsShapeFilterCollideMask, setPhysicsShapeFilterMembershipMask, setPhysicsShapeIsTrigger, setPhysicsShapeMaterial, setPhysicsTimestep, setPositionGizmoLocalCoordinates, setRotationGizmoLocalCoordinates, setScaleGizmoLocalCoordinates, setShadowTaskCasterMeshes, setSoundSourceVolume, setSoundVolume, setSpatialListener, setSpatialListenerPosition, setSpatialOrientation, setSpatialPosition, setStereoPan, setStreamingSoundVolume, sineEase, sphericalFromVec3ToRef, sphericalToVec3ToRef, spriteBlendAdditive, spriteBlendAlpha, spriteBlendPremultiplied, startEngine, startParticleSystem, stepScene, stopAnimation, stopEngine, stopParticleSystem, stopSound, stopStreamingSound, submitComputeTasks, subtractPolarToRef, subtractSphericalToRef, syncParticleBillboard, temperatureTintToXyz, unlockAudioEngineAsync, unpackMeshBlendingTag, updateAnimationManager, updateBillboardSpriteIndex, updateDynamicTexture, updateHtmlTexture, updateSpatialAudio, updateSprite2DIndex, updateStorageBufferRange, updateTexture2DArrayFromPixels, updateTexture2DFromPixels, updateUniformBuffer, uploadImageToArrayLayer, whenHtmlTextureReady } from "@babylonjs/lite";
|
|
3
3
|
//#region \0rolldown/runtime.js
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -1127,6 +1127,13 @@ var AbstractEngine = class {
|
|
|
1127
1127
|
return unsupported("AbstractEngine.setAlphaToCoverage", "Lite's alpha-to-coverage API is target-scoped; mapping BJS's engine-wide state requires a pipeline-owner lifecycle policy.");
|
|
1128
1128
|
}
|
|
1129
1129
|
/**
|
|
1130
|
+
* Babylon.js `engine.isOcclusionQueryVisible(query)` — Lite does not expose
|
|
1131
|
+
* occlusion-query allocation, render-pass encoding, or asynchronous result state.
|
|
1132
|
+
*/
|
|
1133
|
+
isOcclusionQueryVisible(_query) {
|
|
1134
|
+
return unsupported("AbstractEngine.isOcclusionQueryVisible", "Lite has no occlusion-query subsystem; supporting this requires query allocation, render-pass encoding, and asynchronous result-lifetime policy.");
|
|
1135
|
+
}
|
|
1136
|
+
/**
|
|
1130
1137
|
* Babylon.js `engine.updateTextureArrayLayerFromImageSource(texture, source, layer, invertY, premultiplyAlpha)`
|
|
1131
1138
|
* — the engine extension that uploads a decoded image source into one layer of a 2D array
|
|
1132
1139
|
* texture. Forwards to Babylon Lite's `uploadImageToArrayLayer`.
|
|
@@ -1256,6 +1263,605 @@ var NullEngine = class extends WebGPUEngine {
|
|
|
1256
1263
|
}
|
|
1257
1264
|
};
|
|
1258
1265
|
//#endregion
|
|
1266
|
+
//#region src/compute/compute-shader.ts
|
|
1267
|
+
var nextComputeShaderId = 1;
|
|
1268
|
+
function sourceFrom(shaderPath) {
|
|
1269
|
+
if (typeof shaderPath === "object" && shaderPath.computeSource !== void 0) return shaderPath.computeSource;
|
|
1270
|
+
return unsupported("ComputeShader.constructor", "Lite's public compute factory accepts complete WGSL source. Babylon.js ShaderStore names, external .compute.fx paths, and DOM script-element lookup have no public Lite resolver.");
|
|
1271
|
+
}
|
|
1272
|
+
/** Babylon.js ComputeShader adapted to Lite's public buffer-backed compute graph. */
|
|
1273
|
+
var ComputeShader = class {
|
|
1274
|
+
_engine;
|
|
1275
|
+
_shaderPath;
|
|
1276
|
+
static Parse = ComputeShaderParse;
|
|
1277
|
+
uniqueId = nextComputeShaderId++;
|
|
1278
|
+
name;
|
|
1279
|
+
fastMode = false;
|
|
1280
|
+
onCompiled = null;
|
|
1281
|
+
onError = null;
|
|
1282
|
+
gpuTimeInFrame = void 0;
|
|
1283
|
+
triggerContextRebuild = false;
|
|
1284
|
+
_source;
|
|
1285
|
+
_bindings = /* @__PURE__ */ new Map();
|
|
1286
|
+
_shader = null;
|
|
1287
|
+
_bindingSet = null;
|
|
1288
|
+
_bindingsDirty = false;
|
|
1289
|
+
_shaderDirty = false;
|
|
1290
|
+
_compiled = false;
|
|
1291
|
+
constructor(name, _engine, _shaderPath, options = {}) {
|
|
1292
|
+
this._engine = _engine;
|
|
1293
|
+
this._shaderPath = _shaderPath;
|
|
1294
|
+
this.name = name;
|
|
1295
|
+
this._options = {
|
|
1296
|
+
bindingsMapping: {},
|
|
1297
|
+
defines: [],
|
|
1298
|
+
entryPoint: "main",
|
|
1299
|
+
...options
|
|
1300
|
+
};
|
|
1301
|
+
if (this._options.defines?.length) unsupported("ComputeShader.constructor(options.defines)", "Lite's public compute factory accepts final WGSL and intentionally exposes no Babylon.js shader preprocessor for #define expansion.");
|
|
1302
|
+
const source = sourceFrom(this._shaderPath);
|
|
1303
|
+
this._source = this._options.processFinalCode?.(source) ?? source;
|
|
1304
|
+
}
|
|
1305
|
+
_options;
|
|
1306
|
+
get options() {
|
|
1307
|
+
return this._options;
|
|
1308
|
+
}
|
|
1309
|
+
get shaderPath() {
|
|
1310
|
+
return this._shaderPath;
|
|
1311
|
+
}
|
|
1312
|
+
getClassName() {
|
|
1313
|
+
return "ComputeShader";
|
|
1314
|
+
}
|
|
1315
|
+
setTexture(_name, _texture, _bindSampler = true) {
|
|
1316
|
+
return unsupported("ComputeShader.setTexture", "Lite validates an existing Texture2D for compute through the asynchronous createComputeTextureResource API, which cannot preserve Babylon.js's synchronous setter and dispatch contract.");
|
|
1317
|
+
}
|
|
1318
|
+
setInternalTexture(_name, _texture) {
|
|
1319
|
+
return unsupported("ComputeShader.setInternalTexture", "Lite intentionally does not expose raw GPU texture handles, and its public compute texture adapter is asynchronous.");
|
|
1320
|
+
}
|
|
1321
|
+
setStorageTexture(_name, _texture) {
|
|
1322
|
+
return unsupported("ComputeShader.setStorageTexture", "A Babylon.js BaseTexture does not carry the storage usage, format, and access metadata required by Lite's distinct ComputeStorageTexture public resource.");
|
|
1323
|
+
}
|
|
1324
|
+
setExternalTexture(_name, _texture) {
|
|
1325
|
+
return unsupported("ComputeShader.setExternalTexture", "Lite's public compute binding API has no external-texture binding declaration or resource.");
|
|
1326
|
+
}
|
|
1327
|
+
setVideoTexture(_name, _texture) {
|
|
1328
|
+
return false;
|
|
1329
|
+
}
|
|
1330
|
+
setUniformBuffer(name, buffer) {
|
|
1331
|
+
const resource = "_getLiteBuffer" in buffer ? buffer._getLiteBuffer() : buffer;
|
|
1332
|
+
const current = this._bindings.get(name);
|
|
1333
|
+
if (current?.kind === "uniform" && current.resource === resource) return;
|
|
1334
|
+
this._bindingsDirty = true;
|
|
1335
|
+
this._shaderDirty ||= this._shader !== null && (current === void 0 || current.kind !== "uniform");
|
|
1336
|
+
this._bindings.set(name, {
|
|
1337
|
+
kind: "uniform",
|
|
1338
|
+
resource
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
setStorageBuffer(name, buffer) {
|
|
1342
|
+
const resource = "_getLiteBuffer" in buffer ? buffer._getLiteBuffer() : buffer;
|
|
1343
|
+
const current = this._bindings.get(name);
|
|
1344
|
+
if (current?.kind === "storage" && current.resource === resource) return;
|
|
1345
|
+
this._bindingsDirty = true;
|
|
1346
|
+
this._shaderDirty ||= this._shader !== null && (current === void 0 || current.kind !== "storage");
|
|
1347
|
+
this._bindings.set(name, {
|
|
1348
|
+
kind: "storage",
|
|
1349
|
+
resource
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
setTextureSampler(_name, _sampler) {
|
|
1353
|
+
return unsupported("ComputeShader.setTextureSampler", "Babylon.js TextureSampler does not expose a Lite ComputeSampler, and Lite intentionally does not accept raw GPUSampler handles.");
|
|
1354
|
+
}
|
|
1355
|
+
isReady() {
|
|
1356
|
+
if (!this._engine._lite) return false;
|
|
1357
|
+
for (const name of this._bindings.keys()) if (!this._options.bindingsMapping[name]) throw new Error(`ComputeShader ('${this.name}'): No binding mapping has been provided for the property '${name}'`);
|
|
1358
|
+
if (this._bindingsDirty) {
|
|
1359
|
+
this._invalidateBindings(this._shaderDirty);
|
|
1360
|
+
this._bindingsDirty = false;
|
|
1361
|
+
this._shaderDirty = false;
|
|
1362
|
+
}
|
|
1363
|
+
this._createGraph();
|
|
1364
|
+
return true;
|
|
1365
|
+
}
|
|
1366
|
+
dispatch(x, y = 1, z = 1) {
|
|
1367
|
+
const checkContext = !this.fastMode || this.triggerContextRebuild || !this._shader || !this._bindingSet;
|
|
1368
|
+
if (this.triggerContextRebuild) this._bindingsDirty = true;
|
|
1369
|
+
if (checkContext && !this.isReady()) return false;
|
|
1370
|
+
const graph = this._createGraph();
|
|
1371
|
+
const dispatch = createComputeDispatch(graph.shader, graph.bindings, { size: {
|
|
1372
|
+
x,
|
|
1373
|
+
y,
|
|
1374
|
+
z
|
|
1375
|
+
} });
|
|
1376
|
+
this._submit(graph, dispatch);
|
|
1377
|
+
return true;
|
|
1378
|
+
}
|
|
1379
|
+
dispatchIndirect(buffer, offset = 0) {
|
|
1380
|
+
const checkContext = !this.fastMode || this.triggerContextRebuild || !this._shader || !this._bindingSet;
|
|
1381
|
+
if (this.triggerContextRebuild) this._bindingsDirty = true;
|
|
1382
|
+
if (checkContext && !this.isReady()) return false;
|
|
1383
|
+
const resource = "_getLiteBuffer" in buffer ? buffer._getLiteBuffer() : buffer;
|
|
1384
|
+
const graph = this._createGraph();
|
|
1385
|
+
const dispatch = createComputeIndirectDispatch(graph.shader, graph.bindings, {
|
|
1386
|
+
buffer: resource,
|
|
1387
|
+
byteOffset: offset
|
|
1388
|
+
});
|
|
1389
|
+
this._submit(graph, dispatch);
|
|
1390
|
+
return true;
|
|
1391
|
+
}
|
|
1392
|
+
async dispatchWhenReady(x, y = 1, z = 1, delay = 10) {
|
|
1393
|
+
while (!this.dispatch(x, y, z)) await new Promise((resolve) => setTimeout(resolve, delay));
|
|
1394
|
+
}
|
|
1395
|
+
serialize() {
|
|
1396
|
+
return {
|
|
1397
|
+
name: this.name,
|
|
1398
|
+
fastMode: this.fastMode,
|
|
1399
|
+
options: this._options,
|
|
1400
|
+
shaderPath: this._shaderPath,
|
|
1401
|
+
bindings: {},
|
|
1402
|
+
textures: {}
|
|
1403
|
+
};
|
|
1404
|
+
}
|
|
1405
|
+
_createGraph() {
|
|
1406
|
+
const shader = this._createShader();
|
|
1407
|
+
let compiledNow = false;
|
|
1408
|
+
if (!this._compiled) {
|
|
1409
|
+
this._compiled = true;
|
|
1410
|
+
compiledNow = true;
|
|
1411
|
+
this.onCompiled?.(shader);
|
|
1412
|
+
}
|
|
1413
|
+
if (compiledNow && this._bindingsDirty) {
|
|
1414
|
+
const recreateShader = this._shaderDirty;
|
|
1415
|
+
this._invalidateBindings(recreateShader);
|
|
1416
|
+
this._bindingsDirty = false;
|
|
1417
|
+
this._shaderDirty = false;
|
|
1418
|
+
const finalShader = recreateShader ? this._createShader() : shader;
|
|
1419
|
+
this._compiled = true;
|
|
1420
|
+
return {
|
|
1421
|
+
shader: finalShader,
|
|
1422
|
+
bindings: this._createBindingSet(finalShader)
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
return {
|
|
1426
|
+
shader,
|
|
1427
|
+
bindings: this._createBindingSet(shader)
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
_createShader() {
|
|
1431
|
+
const declarations = [];
|
|
1432
|
+
for (const [name, binding] of this._bindings) {
|
|
1433
|
+
const location = this._options.bindingsMapping[name];
|
|
1434
|
+
if (!location) throw new Error(`ComputeShader ('${this.name}'): No binding mapping has been provided for the property '${name}'`);
|
|
1435
|
+
declarations.push(binding.kind === "uniform" ? computeUniformBufferBinding(name, location) : computeStorageBufferBinding(name, {
|
|
1436
|
+
...location,
|
|
1437
|
+
access: this._options.useExplicitComputePipelineLayout === true ? "read-write" : "read"
|
|
1438
|
+
}));
|
|
1439
|
+
}
|
|
1440
|
+
return this._shader ??= createComputeShader(this._engine._lite, {
|
|
1441
|
+
name: this.name,
|
|
1442
|
+
computeSource: this._source,
|
|
1443
|
+
entryPoint: this._options.entryPoint,
|
|
1444
|
+
bindings: declarations,
|
|
1445
|
+
automaticLayout: this._options.useExplicitComputePipelineLayout !== true
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
_createBindingSet(shader) {
|
|
1449
|
+
if (!this._bindingSet) {
|
|
1450
|
+
const resources = {};
|
|
1451
|
+
for (const [name, binding] of this._bindings) resources[name] = binding.resource;
|
|
1452
|
+
this._bindingSet = createComputeBindingSet(shader, resources);
|
|
1453
|
+
}
|
|
1454
|
+
return this._bindingSet;
|
|
1455
|
+
}
|
|
1456
|
+
_submit(graph, dispatch) {
|
|
1457
|
+
const task = createComputeTask(this._engine._lite, this.name);
|
|
1458
|
+
addComputeDispatch(task, dispatch);
|
|
1459
|
+
task.record();
|
|
1460
|
+
try {
|
|
1461
|
+
submitComputeTasks([task]);
|
|
1462
|
+
} catch (error) {
|
|
1463
|
+
if (error instanceof Error && error.message === "submitComputeTasks cannot run while a frame is being recorded.") return unsupported("ComputeShader.dispatch", "Lite's public immediate compute submission cannot run while its frame encoder is active, and it exposes no engine-level hook equivalent to Babylon.js's in-frame compute dispatch.");
|
|
1464
|
+
this.onError?.(graph.shader, error instanceof Error ? error.message : String(error));
|
|
1465
|
+
throw error;
|
|
1466
|
+
} finally {
|
|
1467
|
+
task.dispose();
|
|
1468
|
+
this.triggerContextRebuild = false;
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
_invalidateBindings(recreateShader = false) {
|
|
1472
|
+
if (this._bindingSet) {
|
|
1473
|
+
disposeComputeBindingSet(this._bindingSet);
|
|
1474
|
+
this._bindingSet = null;
|
|
1475
|
+
}
|
|
1476
|
+
if (recreateShader && this._shader) {
|
|
1477
|
+
disposeComputeShader(this._shader);
|
|
1478
|
+
this._shader = null;
|
|
1479
|
+
this._compiled = false;
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
};
|
|
1483
|
+
function ComputeShaderParse(source, scene, _rootUrl) {
|
|
1484
|
+
if (source.textures && Object.keys(source.textures).length > 0) return unsupported("ComputeShader.Parse", "Serialized Babylon.js textures require its texture parser, while Lite's public compute texture adapter is asynchronous and has no serialization registry.");
|
|
1485
|
+
const computeShader = new ComputeShader(String(source.name ?? ""), scene.getEngine(), source.shaderPath, source.options ?? {});
|
|
1486
|
+
computeShader.fastMode = source.fastMode === true;
|
|
1487
|
+
return computeShader;
|
|
1488
|
+
}
|
|
1489
|
+
function RegisterComputeShader() {}
|
|
1490
|
+
//#endregion
|
|
1491
|
+
//#region src/buffers/storage-buffer.ts
|
|
1492
|
+
function asBytes(data, byteLength) {
|
|
1493
|
+
let bytes;
|
|
1494
|
+
if (Array.isArray(data)) bytes = new Uint8Array(new Float32Array(data).buffer);
|
|
1495
|
+
else if (ArrayBuffer.isView(data)) bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
1496
|
+
else bytes = new Uint8Array(data);
|
|
1497
|
+
if (byteLength === void 0) return bytes;
|
|
1498
|
+
if (!Number.isSafeInteger(byteLength) || byteLength < 0 || byteLength > bytes.byteLength) throw new RangeError(`StorageBuffer byteLength must be between 0 and ${bytes.byteLength}; received ${byteLength}.`);
|
|
1499
|
+
return bytes.subarray(0, byteLength);
|
|
1500
|
+
}
|
|
1501
|
+
/** Babylon.js-shaped wrapper over Lite's public opaque storage allocation. */
|
|
1502
|
+
var StorageBuffer = class {
|
|
1503
|
+
_engine;
|
|
1504
|
+
/** @internal */
|
|
1505
|
+
_lite;
|
|
1506
|
+
_copyReadable;
|
|
1507
|
+
_copyWritable;
|
|
1508
|
+
constructor(_engine, size, creationFlags = 3, label) {
|
|
1509
|
+
this._engine = _engine;
|
|
1510
|
+
if ((creationFlags & 4) !== 0) unsupported("StorageBuffer.constructor", "Babylon.js can combine storage and uniform usage on one DataBuffer, while Babylon Lite intentionally exposes distinct opaque StorageBuffer and UniformBuffer allocations.");
|
|
1511
|
+
this._copyReadable = (creationFlags & 1) !== 0;
|
|
1512
|
+
this._copyWritable = (creationFlags & 2) !== 0;
|
|
1513
|
+
this._lite = createStorageBuffer(_engine._lite, size, {
|
|
1514
|
+
label,
|
|
1515
|
+
writable: true,
|
|
1516
|
+
vertex: (creationFlags & 8) !== 0,
|
|
1517
|
+
index: (creationFlags & 16) !== 0,
|
|
1518
|
+
indirect: (creationFlags & 64) !== 0
|
|
1519
|
+
});
|
|
1520
|
+
}
|
|
1521
|
+
/** @internal Lite owns device-loss resource rebuilding. */
|
|
1522
|
+
_rebuild() {}
|
|
1523
|
+
getBuffer() {
|
|
1524
|
+
return this._lite;
|
|
1525
|
+
}
|
|
1526
|
+
clear(byteOffset = 0, byteLength = this._requireBuffer().byteLength - byteOffset) {
|
|
1527
|
+
this._assertCopyWritable("clear");
|
|
1528
|
+
const buffer = this._requireBuffer();
|
|
1529
|
+
if (!Number.isSafeInteger(byteOffset) || byteOffset < 0 || !Number.isSafeInteger(byteLength) || byteLength < 0 || byteOffset + byteLength > buffer.byteLength) throw new RangeError(`StorageBuffer.clear range [${byteOffset}, ${byteOffset + byteLength}) exceeds the ${buffer.byteLength}-byte buffer.`);
|
|
1530
|
+
clearStorageBuffer(this._engine._lite, buffer, byteOffset, byteLength);
|
|
1531
|
+
}
|
|
1532
|
+
update(data, byteOffset = 0, byteLength) {
|
|
1533
|
+
if (!this._lite) return;
|
|
1534
|
+
this._assertCopyWritable("update");
|
|
1535
|
+
updateStorageBufferRange(this._engine._lite, this._lite, asBytes(data, byteLength), byteOffset);
|
|
1536
|
+
}
|
|
1537
|
+
async read(offset = 0, size = this._requireBuffer().byteLength - offset, buffer, noDelay = false) {
|
|
1538
|
+
if (!this._copyReadable) throw new Error("StorageBuffer.read requires Constants.BUFFER_CREATIONFLAG_READ.");
|
|
1539
|
+
const result = await readStorageBufferAfterFrame(this._requireBuffer(), offset, size, noDelay);
|
|
1540
|
+
const bytes = new Uint8Array(result);
|
|
1541
|
+
if (!buffer) return bytes;
|
|
1542
|
+
if (buffer.byteLength < bytes.byteLength) throw new RangeError(`StorageBuffer.read target has ${buffer.byteLength} bytes but ${bytes.byteLength} bytes were requested.`);
|
|
1543
|
+
new Uint8Array(buffer.buffer, buffer.byteOffset, bytes.byteLength).set(bytes);
|
|
1544
|
+
return buffer;
|
|
1545
|
+
}
|
|
1546
|
+
dispose() {
|
|
1547
|
+
if (this._lite) {
|
|
1548
|
+
disposeStorageBuffer(this._lite);
|
|
1549
|
+
this._lite = null;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
/** @internal */
|
|
1553
|
+
_getLiteBuffer() {
|
|
1554
|
+
return this._requireBuffer();
|
|
1555
|
+
}
|
|
1556
|
+
_requireBuffer() {
|
|
1557
|
+
if (!this._lite) throw new Error("StorageBuffer has been disposed.");
|
|
1558
|
+
return this._lite;
|
|
1559
|
+
}
|
|
1560
|
+
_assertCopyWritable(operation) {
|
|
1561
|
+
if (!this._copyWritable) throw new Error(`StorageBuffer.${operation} requires Constants.BUFFER_CREATIONFLAG_WRITE.`);
|
|
1562
|
+
}
|
|
1563
|
+
};
|
|
1564
|
+
//#endregion
|
|
1565
|
+
//#region src/materials/uniform-buffer.ts
|
|
1566
|
+
/** Minimum Babylon.js UniformBuffer surface needed to author compute bindings. */
|
|
1567
|
+
var UniformBuffer = class {
|
|
1568
|
+
_engine;
|
|
1569
|
+
_data;
|
|
1570
|
+
_dynamic;
|
|
1571
|
+
_uniformLocations = /* @__PURE__ */ new Map();
|
|
1572
|
+
_uniformSizes = /* @__PURE__ */ new Map();
|
|
1573
|
+
_uniformArraySizes = /* @__PURE__ */ new Map();
|
|
1574
|
+
_uniformNames = [];
|
|
1575
|
+
_uniformLocationPointer = 0;
|
|
1576
|
+
_bufferData = null;
|
|
1577
|
+
_buffer = null;
|
|
1578
|
+
_needSync = false;
|
|
1579
|
+
_name;
|
|
1580
|
+
constructor(_engine, data = [], dynamic = false, name = "no-name", forceNoUniformBuffer = false, _trackUBOsInFrame) {
|
|
1581
|
+
this._engine = _engine;
|
|
1582
|
+
if (forceNoUniformBuffer) unsupported("UniformBuffer.constructor", "A forceNoUniformBuffer instance falls back to Effect setters in Babylon.js and therefore has no GPU uniform allocation that Lite compute bindings can consume.");
|
|
1583
|
+
this._data = data;
|
|
1584
|
+
this._dynamic = dynamic;
|
|
1585
|
+
this._name = name;
|
|
1586
|
+
}
|
|
1587
|
+
updateMatrix3x3 = (name, matrix) => {
|
|
1588
|
+
const aligned = /* @__PURE__ */ new Float32Array(12);
|
|
1589
|
+
for (let column = 0; column < 3; column++) aligned.set(matrix.subarray(column * 3, column * 3 + 3), column * 4);
|
|
1590
|
+
this.updateUniform(name, aligned, 12);
|
|
1591
|
+
};
|
|
1592
|
+
updateMatrix2x2 = (name, matrix) => {
|
|
1593
|
+
const aligned = /* @__PURE__ */ new Float32Array(8);
|
|
1594
|
+
for (let column = 0; column < 2; column++) aligned.set(matrix.subarray(column * 2, column * 2 + 2), column * 4);
|
|
1595
|
+
this.updateUniform(name, aligned, 8);
|
|
1596
|
+
};
|
|
1597
|
+
updateFloat = (name, x, _suffix) => this.updateUniform(name, [x], 1);
|
|
1598
|
+
updateFloat2 = (name, x, y, _suffix) => this.updateUniform(name, [x, y], 2);
|
|
1599
|
+
updateFloat3 = (name, x, y, z, _suffix) => this.updateUniform(name, [
|
|
1600
|
+
x,
|
|
1601
|
+
y,
|
|
1602
|
+
z
|
|
1603
|
+
], 3);
|
|
1604
|
+
updateFloat4 = (name, x, y, z, w, _suffix) => this.updateUniform(name, [
|
|
1605
|
+
x,
|
|
1606
|
+
y,
|
|
1607
|
+
z,
|
|
1608
|
+
w
|
|
1609
|
+
], 4);
|
|
1610
|
+
updateFloatArray = (name, array, _suffix) => this.updateUniformArray(name, array, array.length);
|
|
1611
|
+
updateArray = (name, array) => this.updateUniformArray(name, array, array.length);
|
|
1612
|
+
updateIntArray = (name, array) => this._updateIntegerUniformArray(name, array, false);
|
|
1613
|
+
updateUIntArray = (name, array) => this._updateIntegerUniformArray(name, array, true);
|
|
1614
|
+
updateMatrix = (name, matrix) => this.updateUniform(name, Array.from(matrix.asArray()), 16);
|
|
1615
|
+
updateMatrices = (name, matrices) => this.updateUniform(name, matrices, matrices.length);
|
|
1616
|
+
updateVector3 = (name, vector) => this.updateFloat3(name, vector.x, vector.y, vector.z);
|
|
1617
|
+
updateVector4 = (name, vector) => this.updateFloat4(name, vector.x, vector.y, vector.z, vector.w);
|
|
1618
|
+
updateColor3 = (name, color, suffix) => this.updateFloat3(name, color.r, color.g, color.b, suffix);
|
|
1619
|
+
updateColor4 = (name, color, alpha, suffix) => this.updateFloat4(name, color.r, color.g, color.b, alpha, suffix);
|
|
1620
|
+
updateDirectColor4 = (name, color, suffix) => this.updateFloat4(name, color.r, color.g, color.b, color.a, suffix);
|
|
1621
|
+
updateInt = (name, x, _suffix) => this._updateIntegerUniform(name, [x], false);
|
|
1622
|
+
updateInt2 = (name, x, y, _suffix) => this._updateIntegerUniform(name, [x, y], false);
|
|
1623
|
+
updateInt3 = (name, x, y, z, _suffix) => this._updateIntegerUniform(name, [
|
|
1624
|
+
x,
|
|
1625
|
+
y,
|
|
1626
|
+
z
|
|
1627
|
+
], false);
|
|
1628
|
+
updateInt4 = (name, x, y, z, w, _suffix) => this._updateIntegerUniform(name, [
|
|
1629
|
+
x,
|
|
1630
|
+
y,
|
|
1631
|
+
z,
|
|
1632
|
+
w
|
|
1633
|
+
], false);
|
|
1634
|
+
updateUInt = (name, x, _suffix) => this._updateIntegerUniform(name, [x], true);
|
|
1635
|
+
updateUInt2 = (name, x, y, _suffix) => this._updateIntegerUniform(name, [x, y], true);
|
|
1636
|
+
updateUInt3 = (name, x, y, z, _suffix) => this._updateIntegerUniform(name, [
|
|
1637
|
+
x,
|
|
1638
|
+
y,
|
|
1639
|
+
z
|
|
1640
|
+
], true);
|
|
1641
|
+
updateUInt4 = (name, x, y, z, w, _suffix) => this._updateIntegerUniform(name, [
|
|
1642
|
+
x,
|
|
1643
|
+
y,
|
|
1644
|
+
z,
|
|
1645
|
+
w
|
|
1646
|
+
], true);
|
|
1647
|
+
get useUbo() {
|
|
1648
|
+
return true;
|
|
1649
|
+
}
|
|
1650
|
+
get isSync() {
|
|
1651
|
+
return !this._needSync;
|
|
1652
|
+
}
|
|
1653
|
+
isDynamic() {
|
|
1654
|
+
return this._dynamic;
|
|
1655
|
+
}
|
|
1656
|
+
getData() {
|
|
1657
|
+
return this._bufferData ?? new Float32Array(this._data);
|
|
1658
|
+
}
|
|
1659
|
+
getBuffer() {
|
|
1660
|
+
return this._buffer;
|
|
1661
|
+
}
|
|
1662
|
+
getUniformNames() {
|
|
1663
|
+
return this._uniformNames.slice();
|
|
1664
|
+
}
|
|
1665
|
+
addUniform(name, sizeOrData, arraySize = 0) {
|
|
1666
|
+
if (this._uniformLocations.has(name)) return;
|
|
1667
|
+
if (this._buffer) throw new Error(`Cannot add uniform "${name}" after the UniformBuffer has been created.`);
|
|
1668
|
+
this._uniformNames.push(name);
|
|
1669
|
+
let size;
|
|
1670
|
+
let data;
|
|
1671
|
+
if (arraySize > 0) {
|
|
1672
|
+
if (typeof sizeOrData !== "number") throw new TypeError(`addUniform cannot use inline array data for UBO array "${name}".`);
|
|
1673
|
+
this._align(4);
|
|
1674
|
+
this._uniformArraySizes.set(name, {
|
|
1675
|
+
strideSize: sizeOrData,
|
|
1676
|
+
arraySize
|
|
1677
|
+
});
|
|
1678
|
+
size = sizeOrData === 16 ? sizeOrData * arraySize : 4 * arraySize;
|
|
1679
|
+
data = new Array(size).fill(0);
|
|
1680
|
+
} else {
|
|
1681
|
+
data = typeof sizeOrData === "number" ? new Array(sizeOrData).fill(0) : sizeOrData.slice();
|
|
1682
|
+
size = data.length;
|
|
1683
|
+
this._align(size);
|
|
1684
|
+
}
|
|
1685
|
+
this._uniformLocations.set(name, this._uniformLocationPointer);
|
|
1686
|
+
this._uniformSizes.set(name, size);
|
|
1687
|
+
this._uniformLocationPointer += size;
|
|
1688
|
+
this._data.push(...data);
|
|
1689
|
+
this._needSync = true;
|
|
1690
|
+
}
|
|
1691
|
+
addMatrix(name, matrix) {
|
|
1692
|
+
this.addUniform(name, Array.from(matrix.asArray()));
|
|
1693
|
+
}
|
|
1694
|
+
addFloat2(name, x, y) {
|
|
1695
|
+
this.addUniform(name, [x, y]);
|
|
1696
|
+
}
|
|
1697
|
+
addFloat3(name, x, y, z) {
|
|
1698
|
+
this.addUniform(name, [
|
|
1699
|
+
x,
|
|
1700
|
+
y,
|
|
1701
|
+
z
|
|
1702
|
+
]);
|
|
1703
|
+
}
|
|
1704
|
+
addColor3(name, color) {
|
|
1705
|
+
this.addUniform(name, [
|
|
1706
|
+
color.r,
|
|
1707
|
+
color.g,
|
|
1708
|
+
color.b
|
|
1709
|
+
]);
|
|
1710
|
+
}
|
|
1711
|
+
addColor4(name, color, alpha) {
|
|
1712
|
+
this.addUniform(name, [
|
|
1713
|
+
color.r,
|
|
1714
|
+
color.g,
|
|
1715
|
+
color.b,
|
|
1716
|
+
alpha
|
|
1717
|
+
]);
|
|
1718
|
+
}
|
|
1719
|
+
addVector3(name, vector) {
|
|
1720
|
+
this.addUniform(name, [
|
|
1721
|
+
vector.x,
|
|
1722
|
+
vector.y,
|
|
1723
|
+
vector.z
|
|
1724
|
+
]);
|
|
1725
|
+
}
|
|
1726
|
+
addMatrix3x3(name) {
|
|
1727
|
+
this.addUniform(name, 12);
|
|
1728
|
+
}
|
|
1729
|
+
addMatrix2x2(name) {
|
|
1730
|
+
this.addUniform(name, 8);
|
|
1731
|
+
}
|
|
1732
|
+
create() {
|
|
1733
|
+
if (this._buffer) return;
|
|
1734
|
+
this._align(4);
|
|
1735
|
+
this._bufferData = new Float32Array(this._data);
|
|
1736
|
+
this._buffer = createUniformBuffer(this._engine._lite, this._bufferData, { label: `${this._name}_UniformList:${this._uniformNames.slice(0, 10).join(",")}` });
|
|
1737
|
+
this._needSync = true;
|
|
1738
|
+
}
|
|
1739
|
+
/** @internal */
|
|
1740
|
+
_getLiteBuffer() {
|
|
1741
|
+
this.create();
|
|
1742
|
+
return this._buffer;
|
|
1743
|
+
}
|
|
1744
|
+
get name() {
|
|
1745
|
+
return this._name;
|
|
1746
|
+
}
|
|
1747
|
+
set name(value) {
|
|
1748
|
+
this._name = value;
|
|
1749
|
+
}
|
|
1750
|
+
get currentEffect() {
|
|
1751
|
+
return null;
|
|
1752
|
+
}
|
|
1753
|
+
update() {
|
|
1754
|
+
this.create();
|
|
1755
|
+
if (this._dynamic || this._needSync) {
|
|
1756
|
+
updateUniformBuffer(this._engine._lite, this._buffer, this._bufferData);
|
|
1757
|
+
this._needSync = false;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
updateUniform(uniformName, data, size) {
|
|
1761
|
+
let location = this._uniformLocations.get(uniformName);
|
|
1762
|
+
if (location === void 0) {
|
|
1763
|
+
this.addUniform(uniformName, size);
|
|
1764
|
+
location = this._uniformLocations.get(uniformName);
|
|
1765
|
+
}
|
|
1766
|
+
this.create();
|
|
1767
|
+
if (size > (this._uniformSizes.get(uniformName) ?? 0)) throw new RangeError(`Uniform "${uniformName}" has room for ${this._uniformSizes.get(uniformName)} floats, not ${size}.`);
|
|
1768
|
+
for (let i = 0; i < size; i++) {
|
|
1769
|
+
const value = Math.fround(data[i]);
|
|
1770
|
+
if (this._bufferData[location + i] !== value) {
|
|
1771
|
+
this._bufferData[location + i] = value;
|
|
1772
|
+
this._needSync = true;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
updateUniformArray(uniformName, data, size) {
|
|
1777
|
+
const location = this._uniformLocations.get(uniformName);
|
|
1778
|
+
const layout = this._uniformArraySizes.get(uniformName);
|
|
1779
|
+
if (location === void 0 || !layout) throw new Error(`Uniform array "${uniformName}" must be declared with addUniform before it can be updated.`);
|
|
1780
|
+
this.create();
|
|
1781
|
+
if (size > layout.strideSize * layout.arraySize) throw new RangeError(`Uniform array "${uniformName}" accepts at most ${layout.strideSize * layout.arraySize} values, not ${size}.`);
|
|
1782
|
+
for (let i = 0; i < size; i++) {
|
|
1783
|
+
const destination = location + Math.floor(i / layout.strideSize) * 4 + i % layout.strideSize;
|
|
1784
|
+
const value = Math.fround(data[i]);
|
|
1785
|
+
if (this._bufferData[destination] !== value) {
|
|
1786
|
+
this._bufferData[destination] = value;
|
|
1787
|
+
this._needSync = true;
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
setTexture(_name, _texture) {
|
|
1792
|
+
return unsupported("UniformBuffer.setTexture", "Lite compute uniform allocations contain bytes only and do not own Effect sampler bindings.");
|
|
1793
|
+
}
|
|
1794
|
+
setTextureArray(_name, _textures) {
|
|
1795
|
+
return unsupported("UniformBuffer.setTextureArray", "Lite compute uniform allocations contain bytes only and do not own Effect sampler bindings.");
|
|
1796
|
+
}
|
|
1797
|
+
bindTexture(_name, _texture) {
|
|
1798
|
+
return unsupported("UniformBuffer.bindTexture", "Lite compute uniform allocations contain bytes only and do not own Effect sampler bindings.");
|
|
1799
|
+
}
|
|
1800
|
+
updateUniformDirectly(uniformName, data) {
|
|
1801
|
+
const size = this._uniformSizes.get(uniformName);
|
|
1802
|
+
if (size === void 0) throw new Error(`Uniform "${uniformName}" has not been declared.`);
|
|
1803
|
+
this.updateUniform(uniformName, data, Math.min(size, data.length));
|
|
1804
|
+
this.update();
|
|
1805
|
+
}
|
|
1806
|
+
bindToEffect(_effect, _name) {
|
|
1807
|
+
return unsupported("UniformBuffer.bindToEffect", "The compute-only compat UniformBuffer forwards to Lite's opaque compute allocation; Lite has no Babylon.js Effect binding surface.");
|
|
1808
|
+
}
|
|
1809
|
+
bindUniformBuffer() {
|
|
1810
|
+
return unsupported("UniformBuffer.bindUniformBuffer", "The compute-only compat UniformBuffer is bound through ComputeShader.setUniformBuffer.");
|
|
1811
|
+
}
|
|
1812
|
+
unbindEffect() {}
|
|
1813
|
+
setDataBuffer(dataBuffer) {
|
|
1814
|
+
return this._buffer === dataBuffer;
|
|
1815
|
+
}
|
|
1816
|
+
has(name) {
|
|
1817
|
+
return this._uniformLocations.has(name);
|
|
1818
|
+
}
|
|
1819
|
+
dispose() {
|
|
1820
|
+
if (this._buffer) {
|
|
1821
|
+
disposeUniformBuffer(this._buffer);
|
|
1822
|
+
this._buffer = null;
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
_align(size) {
|
|
1826
|
+
const alignment = size <= 2 ? size : 4;
|
|
1827
|
+
if (alignment > 0 && this._uniformLocationPointer % alignment !== 0) {
|
|
1828
|
+
const padding = alignment - this._uniformLocationPointer % alignment;
|
|
1829
|
+
this._data.push(...new Array(padding).fill(0));
|
|
1830
|
+
this._uniformLocationPointer += padding;
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
_updateIntegerUniform(uniformName, data, unsigned) {
|
|
1834
|
+
let location = this._uniformLocations.get(uniformName);
|
|
1835
|
+
if (location === void 0) {
|
|
1836
|
+
this.addUniform(uniformName, data.length);
|
|
1837
|
+
location = this._uniformLocations.get(uniformName);
|
|
1838
|
+
}
|
|
1839
|
+
this.create();
|
|
1840
|
+
if (data.length > (this._uniformSizes.get(uniformName) ?? 0)) throw new RangeError(`Uniform "${uniformName}" has room for ${this._uniformSizes.get(uniformName)} values, not ${data.length}.`);
|
|
1841
|
+
const view = unsigned ? new Uint32Array(this._bufferData.buffer) : new Int32Array(this._bufferData.buffer);
|
|
1842
|
+
for (let i = 0; i < data.length; i++) this._setInteger(view, location + i, data[i], unsigned);
|
|
1843
|
+
}
|
|
1844
|
+
_updateIntegerUniformArray(uniformName, data, unsigned) {
|
|
1845
|
+
const location = this._uniformLocations.get(uniformName);
|
|
1846
|
+
const layout = this._uniformArraySizes.get(uniformName);
|
|
1847
|
+
if (location === void 0 || !layout) throw new Error(`Uniform array "${uniformName}" must be declared with addUniform before it can be updated.`);
|
|
1848
|
+
this.create();
|
|
1849
|
+
if (data.length > layout.strideSize * layout.arraySize) throw new RangeError(`Uniform array "${uniformName}" accepts at most ${layout.strideSize * layout.arraySize} values, not ${data.length}.`);
|
|
1850
|
+
const view = unsigned ? new Uint32Array(this._bufferData.buffer) : new Int32Array(this._bufferData.buffer);
|
|
1851
|
+
for (let i = 0; i < data.length; i++) {
|
|
1852
|
+
const destination = location + Math.floor(i / layout.strideSize) * 4 + i % layout.strideSize;
|
|
1853
|
+
this._setInteger(view, destination, data[i], unsigned);
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
_setInteger(view, index, input, unsigned) {
|
|
1857
|
+
const value = unsigned ? input >>> 0 : input | 0;
|
|
1858
|
+
if (view[index] !== value) {
|
|
1859
|
+
view[index] = value;
|
|
1860
|
+
this._needSync = true;
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
};
|
|
1864
|
+
//#endregion
|
|
1259
1865
|
//#region src/scene/abstract-scene.ts
|
|
1260
1866
|
var AbstractScene = class {
|
|
1261
1867
|
/**
|
|
@@ -2931,10 +3537,10 @@ var AnaglyphArcRotateCamera = class {
|
|
|
2931
3537
|
* Babylon.js-compatible `Animation` keyframe model + `AnimationGroup`.
|
|
2932
3538
|
*
|
|
2933
3539
|
* `Animation` is a pure-JS keyframe container with CPU evaluation (`evaluate`),
|
|
2934
|
-
* the Babylon.js data-type / loop-mode constants, and `setKeys`/`getKeys`.
|
|
2935
|
-
*
|
|
2936
|
-
*
|
|
2937
|
-
*
|
|
3540
|
+
* the Babylon.js data-type / loop-mode constants, and `setKeys`/`getKeys`. Common
|
|
3541
|
+
* direct-animation tracks are compiled onto Babylon Lite property groups; the CPU
|
|
3542
|
+
* evaluator remains as an explicit fallback for shapes Lite cannot yet preserve.
|
|
3543
|
+
* `AnimationGroup` provides the structural grouping/playback-state surface.
|
|
2938
3544
|
*/
|
|
2939
3545
|
/**
|
|
2940
3546
|
* Babylon.js `AnimationKeyInterpolation` — how the segment starting at a key is
|
|
@@ -2969,10 +3575,13 @@ var Animation = class Animation {
|
|
|
2969
3575
|
static ANIMATIONTYPE_QUATERNION = AnimationTypes.ANIMATIONTYPE_QUATERNION;
|
|
2970
3576
|
static ANIMATIONTYPE_MATRIX = AnimationTypes.ANIMATIONTYPE_MATRIX;
|
|
2971
3577
|
static ANIMATIONTYPE_COLOR3 = AnimationTypes.ANIMATIONTYPE_COLOR3;
|
|
3578
|
+
static ANIMATIONTYPE_VECTOR2 = AnimationTypes.ANIMATIONTYPE_VECTOR2;
|
|
3579
|
+
static ANIMATIONTYPE_COLOR4 = AnimationTypes.ANIMATIONTYPE_COLOR4;
|
|
2972
3580
|
static ANIMATIONLOOPMODE_RELATIVE = AnimationLoopModes.ANIMATIONLOOPMODE_RELATIVE;
|
|
2973
3581
|
static ANIMATIONLOOPMODE_CYCLE = AnimationLoopModes.ANIMATIONLOOPMODE_CYCLE;
|
|
2974
3582
|
static ANIMATIONLOOPMODE_CONSTANT = AnimationLoopModes.ANIMATIONLOOPMODE_CONSTANT;
|
|
2975
3583
|
_keys = [];
|
|
3584
|
+
_easingFunction = null;
|
|
2976
3585
|
constructor(name, targetProperty, framePerSecond, dataType = AnimationTypes.ANIMATIONTYPE_FLOAT, loopMode = AnimationLoopModes.ANIMATIONLOOPMODE_CYCLE) {
|
|
2977
3586
|
this.name = name;
|
|
2978
3587
|
this.targetProperty = targetProperty;
|
|
@@ -2989,7 +3598,21 @@ var Animation = class Animation {
|
|
|
2989
3598
|
getHighestFrame() {
|
|
2990
3599
|
return this._keys.length > 0 ? this._keys[this._keys.length - 1].frame : 0;
|
|
2991
3600
|
}
|
|
2992
|
-
/**
|
|
3601
|
+
/**
|
|
3602
|
+
* Assigns the easing function used to transform each non-STEP segment's normalized progress.
|
|
3603
|
+
* @param easingFunction - A Babylon.js-shaped easing object, or `null` to restore linear progress.
|
|
3604
|
+
*/
|
|
3605
|
+
setEasingFunction(easingFunction) {
|
|
3606
|
+
this._easingFunction = easingFunction;
|
|
3607
|
+
}
|
|
3608
|
+
/**
|
|
3609
|
+
* Gets the easing function currently assigned to this animation.
|
|
3610
|
+
* @returns The assigned easing object, or `null` when interpolation uses linear progress.
|
|
3611
|
+
*/
|
|
3612
|
+
getEasingFunction() {
|
|
3613
|
+
return this._easingFunction;
|
|
3614
|
+
}
|
|
3615
|
+
/** Evaluate the animated value at `frame`, clamped to the key range. */
|
|
2993
3616
|
evaluate(frame) {
|
|
2994
3617
|
const keys = this._keys;
|
|
2995
3618
|
if (keys.length === 0) return 0;
|
|
@@ -3000,8 +3623,8 @@ var Animation = class Animation {
|
|
|
3000
3623
|
const b = keys[i + 1];
|
|
3001
3624
|
if (frame >= a.frame && frame < b.frame) {
|
|
3002
3625
|
if (a.interpolation === AnimationKeyInterpolation.STEP) return a.value;
|
|
3003
|
-
const
|
|
3004
|
-
return
|
|
3626
|
+
const gradient = (frame - a.frame) / (b.frame - a.frame);
|
|
3627
|
+
return interpolateValue(a.value, b.value, this._easingFunction?.ease(gradient) ?? gradient, this.dataType);
|
|
3005
3628
|
}
|
|
3006
3629
|
}
|
|
3007
3630
|
return keys[keys.length - 1].value;
|
|
@@ -3019,23 +3642,78 @@ var Animation = class Animation {
|
|
|
3019
3642
|
return anim;
|
|
3020
3643
|
}
|
|
3021
3644
|
};
|
|
3022
|
-
function
|
|
3645
|
+
function interpolateValue(a, b, t, dataType) {
|
|
3023
3646
|
if (typeof a === "number" && typeof b === "number") return a + (b - a) * t;
|
|
3024
|
-
|
|
3025
|
-
const
|
|
3026
|
-
|
|
3647
|
+
if (typeof a === "number" || typeof b === "number") return a;
|
|
3648
|
+
const stride = supportedStride(dataType) || animationComponents(a).length;
|
|
3649
|
+
const av = readAnimationComponents(a, stride);
|
|
3650
|
+
const bv = readAnimationComponents(b, stride);
|
|
3651
|
+
if (!av || !bv) return a;
|
|
3652
|
+
return cloneAnimationValue(a, dataType === AnimationTypes.ANIMATIONTYPE_QUATERNION ? slerpQuaternion(av, bv, t) : av.map((value, i) => value + (bv[i] - value) * t));
|
|
3653
|
+
}
|
|
3654
|
+
function readAnimationComponents(value, stride) {
|
|
3655
|
+
if (typeof value === "number") return stride === 1 && Number.isFinite(value) ? [value] : void 0;
|
|
3656
|
+
const components = Array.isArray(value) ? value : value.asArray();
|
|
3657
|
+
return components.length === stride && components.every(Number.isFinite) ? components.slice() : void 0;
|
|
3658
|
+
}
|
|
3659
|
+
function animationComponents(value) {
|
|
3660
|
+
return typeof value === "number" ? [value] : Array.isArray(value) ? value : value.asArray();
|
|
3661
|
+
}
|
|
3662
|
+
function cloneAnimationValue(template, components) {
|
|
3663
|
+
if (Array.isArray(template)) return components;
|
|
3664
|
+
const clone = template.clone();
|
|
3665
|
+
const writable = clone;
|
|
3666
|
+
writable.x = components[0];
|
|
3667
|
+
writable.y = components[1];
|
|
3668
|
+
if (components.length > 2) writable.z = components[2];
|
|
3669
|
+
if (components.length > 3) writable.w = components[3];
|
|
3670
|
+
return clone;
|
|
3671
|
+
}
|
|
3672
|
+
function slerpQuaternion(a, b, gradient) {
|
|
3673
|
+
let bx = b[0];
|
|
3674
|
+
let by = b[1];
|
|
3675
|
+
let bz = b[2];
|
|
3676
|
+
let bw = b[3];
|
|
3677
|
+
let dot = a[0] * bx + a[1] * by + a[2] * bz + a[3] * bw;
|
|
3678
|
+
if (dot < 0) {
|
|
3679
|
+
bx = -bx;
|
|
3680
|
+
by = -by;
|
|
3681
|
+
bz = -bz;
|
|
3682
|
+
bw = -bw;
|
|
3683
|
+
dot = -dot;
|
|
3684
|
+
}
|
|
3685
|
+
if (dot > .999999) return [
|
|
3686
|
+
(1 - gradient) * a[0] + gradient * bx,
|
|
3687
|
+
(1 - gradient) * a[1] + gradient * by,
|
|
3688
|
+
(1 - gradient) * a[2] + gradient * bz,
|
|
3689
|
+
(1 - gradient) * a[3] + gradient * bw
|
|
3690
|
+
];
|
|
3691
|
+
const angle = Math.acos(Math.min(dot, 1));
|
|
3692
|
+
const sine = Math.sin(angle);
|
|
3693
|
+
const startWeight = Math.sin((1 - gradient) * angle) / sine;
|
|
3694
|
+
const endWeight = Math.sin(gradient * angle) / sine;
|
|
3695
|
+
return [
|
|
3696
|
+
startWeight * a[0] + endWeight * bx,
|
|
3697
|
+
startWeight * a[1] + endWeight * by,
|
|
3698
|
+
startWeight * a[2] + endWeight * bz,
|
|
3699
|
+
startWeight * a[3] + endWeight * bw
|
|
3700
|
+
];
|
|
3027
3701
|
}
|
|
3028
3702
|
function scaleValue(value, scale) {
|
|
3029
|
-
|
|
3703
|
+
if (typeof value === "number") return value * scale;
|
|
3704
|
+
return animationComponents(value).map((component) => component * scale);
|
|
3030
3705
|
}
|
|
3031
3706
|
function addValue(acc, value) {
|
|
3032
3707
|
if (typeof acc === "number" && typeof value === "number") return acc + value;
|
|
3033
|
-
const a = acc;
|
|
3034
|
-
const v = value;
|
|
3035
|
-
return a.map((
|
|
3708
|
+
const a = animationComponents(acc);
|
|
3709
|
+
const v = animationComponents(value);
|
|
3710
|
+
return a.map((component, i) => component + (v[i] ?? 0));
|
|
3711
|
+
}
|
|
3712
|
+
function subtractValue(value, base) {
|
|
3713
|
+
return addValue(value, scaleValue(base, -1));
|
|
3036
3714
|
}
|
|
3037
3715
|
function zeroLike(value) {
|
|
3038
|
-
return typeof value === "number" ? 0 : value.map(() => 0);
|
|
3716
|
+
return typeof value === "number" ? 0 : animationComponents(value).map(() => 0);
|
|
3039
3717
|
}
|
|
3040
3718
|
/**
|
|
3041
3719
|
* @internal Pre-animation baseline of each blended property, captured the first
|
|
@@ -3053,7 +3731,7 @@ function readPath(target, path) {
|
|
|
3053
3731
|
obj = next;
|
|
3054
3732
|
}
|
|
3055
3733
|
const leaf = obj[parts[parts.length - 1]];
|
|
3056
|
-
return
|
|
3734
|
+
return isAnimationValue(leaf) ? leaf : 0;
|
|
3057
3735
|
}
|
|
3058
3736
|
function captureOriginal(target, path) {
|
|
3059
3737
|
let perTarget = structuralOriginals.get(target);
|
|
@@ -3061,7 +3739,11 @@ function captureOriginal(target, path) {
|
|
|
3061
3739
|
perTarget = /* @__PURE__ */ new Map();
|
|
3062
3740
|
structuralOriginals.set(target, perTarget);
|
|
3063
3741
|
}
|
|
3064
|
-
if (!perTarget.has(path)) perTarget.set(path, readPath(target, path));
|
|
3742
|
+
if (!perTarget.has(path)) perTarget.set(path, snapshotValue(readPath(target, path)));
|
|
3743
|
+
}
|
|
3744
|
+
function snapshotValue(value) {
|
|
3745
|
+
if (typeof value === "number") return value;
|
|
3746
|
+
return cloneAnimationValue(value, animationComponents(value));
|
|
3065
3747
|
}
|
|
3066
3748
|
/** @internal Assign an animated value to `target` following a dotted property path (e.g. `"position.x"`). */
|
|
3067
3749
|
function applyAnimatedValue(target, path, value) {
|
|
@@ -3073,75 +3755,371 @@ function applyAnimatedValue(target, path, value) {
|
|
|
3073
3755
|
obj = next;
|
|
3074
3756
|
}
|
|
3075
3757
|
const leaf = parts[parts.length - 1];
|
|
3076
|
-
if (
|
|
3758
|
+
if (typeof value !== "number") {
|
|
3759
|
+
const components = animationComponents(value);
|
|
3077
3760
|
const slot = obj[leaf];
|
|
3078
|
-
if (slot && typeof slot.set === "function") slot.set(...
|
|
3761
|
+
if (slot && typeof slot.set === "function") slot.set(...components);
|
|
3079
3762
|
else obj[leaf] = value;
|
|
3080
3763
|
} else obj[leaf] = value;
|
|
3081
3764
|
}
|
|
3765
|
+
function isAnimationValue(value) {
|
|
3766
|
+
return typeof value === "number" || Array.isArray(value) || isAnimationVectorValue(value);
|
|
3767
|
+
}
|
|
3768
|
+
function isAnimationVectorValue(value) {
|
|
3769
|
+
return (typeof value === "object" || typeof value === "function") && value !== null && typeof value.x === "number" && typeof value.y === "number" && typeof value.clone === "function" && typeof value.asArray === "function";
|
|
3770
|
+
}
|
|
3082
3771
|
/**
|
|
3083
|
-
* Babylon.js `Animatable`
|
|
3084
|
-
*
|
|
3085
|
-
* the target's (dotted) property path.
|
|
3772
|
+
* Babylon.js `Animatable` facade. Supported direct-animation tracks delegate to a
|
|
3773
|
+
* native Lite property group; unsupported tracks retain the compat CPU evaluator.
|
|
3086
3774
|
*/
|
|
3087
|
-
var Animatable = class {
|
|
3775
|
+
var Animatable = class Animatable {
|
|
3088
3776
|
_target;
|
|
3089
3777
|
_animations;
|
|
3090
3778
|
_from;
|
|
3091
3779
|
_to;
|
|
3092
3780
|
_loop;
|
|
3093
3781
|
masterFrame = 0;
|
|
3094
|
-
|
|
3782
|
+
/** @internal Lite group backing a natively-delegated property animation. */
|
|
3783
|
+
_lite;
|
|
3784
|
+
/** @internal Reason all or part of this animatable retained the compat CPU evaluator. */
|
|
3785
|
+
_nativeFallbackReason;
|
|
3786
|
+
_speedRatio;
|
|
3095
3787
|
_paused = false;
|
|
3096
3788
|
_stopped = false;
|
|
3097
|
-
|
|
3789
|
+
_nativeManager;
|
|
3790
|
+
_fallbackAnimations;
|
|
3791
|
+
_fallbackFrames = /* @__PURE__ */ new Map();
|
|
3792
|
+
_fallbackElapsedFrames = /* @__PURE__ */ new Map();
|
|
3793
|
+
_fallbackRepeatCounts = /* @__PURE__ */ new Map();
|
|
3794
|
+
_completedFallbackAnimations = /* @__PURE__ */ new Set();
|
|
3795
|
+
constructor(_target, _animations, _from, _to, _loop, speedRatio, nativeState) {
|
|
3098
3796
|
this._target = _target;
|
|
3099
3797
|
this._animations = _animations;
|
|
3100
3798
|
this._from = _from;
|
|
3101
3799
|
this._to = _to;
|
|
3102
3800
|
this._loop = _loop;
|
|
3103
|
-
this.
|
|
3801
|
+
this._speedRatio = speedRatio;
|
|
3802
|
+
this._nativeManager = nativeState?.manager;
|
|
3803
|
+
this._lite = nativeState?.group;
|
|
3804
|
+
this._fallbackAnimations = nativeState?.fallbackAnimations ?? _animations;
|
|
3805
|
+
this._nativeFallbackReason = nativeState?.fallbackReason;
|
|
3104
3806
|
this.masterFrame = _from;
|
|
3105
|
-
this.
|
|
3807
|
+
for (const animation of this._fallbackAnimations) this._resetFallbackAnimation(animation, _from);
|
|
3808
|
+
if (this._lite) {
|
|
3809
|
+
goToFrame(this._lite, _from);
|
|
3810
|
+
playAnimation(this._lite);
|
|
3811
|
+
}
|
|
3812
|
+
this._applyFallback();
|
|
3813
|
+
}
|
|
3814
|
+
/** @internal Create one facade over the native-supported and explicit fallback subsets. */
|
|
3815
|
+
static _create(getManager, target, animations, from, to, loop, speedRatio, blockedNativeBindings = []) {
|
|
3816
|
+
const partition = partitionAnimations(target, animations, from, to, speedRatio, blockedNativeBindings);
|
|
3817
|
+
const nativeManager = partition.nativeAnimations.length > 0 ? getManager() : void 0;
|
|
3818
|
+
const nativeGroup = nativeManager ? createNativeAnimationGroup(nativeManager, target, partition.nativeAnimations, from, to, loop, speedRatio) : void 0;
|
|
3819
|
+
return new Animatable(target, animations.slice(), from, to, loop, speedRatio, {
|
|
3820
|
+
manager: nativeManager,
|
|
3821
|
+
group: nativeGroup,
|
|
3822
|
+
fallbackAnimations: partition.fallbackAnimations,
|
|
3823
|
+
fallbackReason: partition.fallbackReasons.length > 0 ? partition.fallbackReasons.join("; ") : void 0
|
|
3824
|
+
});
|
|
3825
|
+
}
|
|
3826
|
+
/** @internal Return why any track cannot preserve its semantics on Lite, or undefined when all are supported. */
|
|
3827
|
+
static _getNativeFallbackReason(target, animations, from, to, speedRatio) {
|
|
3828
|
+
const reasons = partitionAnimations(target, animations, from, to, speedRatio, []).fallbackReasons;
|
|
3829
|
+
return reasons.length > 0 ? reasons.join("; ") : void 0;
|
|
3830
|
+
}
|
|
3831
|
+
/** @internal Return fallback bindings that must keep later overlapping writes on the same evaluator, including stopped animatables that may restart. */
|
|
3832
|
+
_getBlockingFallbackBindings() {
|
|
3833
|
+
return this._fallbackAnimations.map((animation) => resolveAnimationBinding(this._target, animation.targetProperty)).filter(isAnimationBinding);
|
|
3834
|
+
}
|
|
3835
|
+
get speedRatio() {
|
|
3836
|
+
return this._speedRatio;
|
|
3837
|
+
}
|
|
3838
|
+
set speedRatio(value) {
|
|
3839
|
+
if (this._lite && (!Number.isFinite(value) || value < 0)) throw new Error("Native compat property animations require a finite non-negative speedRatio");
|
|
3840
|
+
this._speedRatio = value;
|
|
3841
|
+
if (this._lite) this._lite.speedRatio = value;
|
|
3106
3842
|
}
|
|
3107
3843
|
/** @internal Advance the animation by `deltaMs`, called once per scene frame. */
|
|
3108
3844
|
_tick(deltaMs) {
|
|
3109
3845
|
if (this._paused || this._stopped) return;
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
this.
|
|
3116
|
-
} else {
|
|
3117
|
-
this.masterFrame = this._to;
|
|
3846
|
+
if (this._lite) {
|
|
3847
|
+
this.masterFrame = this._lite.currentTime * (this._animations[0]?.framePerSecond ?? 60);
|
|
3848
|
+
const fallbackRunning = this._advanceFallback(deltaMs);
|
|
3849
|
+
this._applyFallback();
|
|
3850
|
+
if (!this._loop && this._lite._stopped && !fallbackRunning) {
|
|
3851
|
+
this._detachLite();
|
|
3118
3852
|
this._stopped = true;
|
|
3119
3853
|
}
|
|
3854
|
+
return;
|
|
3120
3855
|
}
|
|
3121
|
-
this.
|
|
3856
|
+
const anyFallbackRunning = this._advanceFallback(deltaMs);
|
|
3857
|
+
this.masterFrame = this._fallbackFrames.get(this._animations[0]) ?? this._from;
|
|
3858
|
+
this._applyFallback();
|
|
3859
|
+
if (!this._loop && !anyFallbackRunning) this._stopped = true;
|
|
3122
3860
|
}
|
|
3123
3861
|
goToFrame(frame) {
|
|
3124
|
-
this.
|
|
3125
|
-
this.
|
|
3862
|
+
this._completedFallbackAnimations.clear();
|
|
3863
|
+
for (const animation of this._fallbackAnimations) this._resetFallbackAnimation(animation, frame);
|
|
3864
|
+
if (this._lite) {
|
|
3865
|
+
goToFrame(this._lite, frame);
|
|
3866
|
+
this.masterFrame = this._lite.currentTime * (this._lite.frameRate ?? 60);
|
|
3867
|
+
if (!this._paused && !this._stopped) playAnimation(this._lite);
|
|
3868
|
+
} else this.masterFrame = clampAnimationFrame(this._animations[0], frame);
|
|
3869
|
+
this._applyFallback();
|
|
3126
3870
|
}
|
|
3127
3871
|
pause() {
|
|
3128
3872
|
this._paused = true;
|
|
3873
|
+
if (this._lite) {
|
|
3874
|
+
pauseAnimation(this._lite);
|
|
3875
|
+
this._detachLite();
|
|
3876
|
+
}
|
|
3129
3877
|
}
|
|
3130
3878
|
restart() {
|
|
3879
|
+
const restartFromBeginning = this._stopped;
|
|
3131
3880
|
this._paused = false;
|
|
3132
3881
|
this._stopped = false;
|
|
3133
|
-
|
|
3882
|
+
if (restartFromBeginning) {
|
|
3883
|
+
this.masterFrame = this._from;
|
|
3884
|
+
this._completedFallbackAnimations.clear();
|
|
3885
|
+
for (const animation of this._fallbackAnimations) this._resetFallbackAnimation(animation, this._from);
|
|
3886
|
+
}
|
|
3887
|
+
if (this._lite) {
|
|
3888
|
+
if (restartFromBeginning) goToFrame(this._lite, this._from);
|
|
3889
|
+
this._attachLite();
|
|
3890
|
+
playAnimation(this._lite);
|
|
3891
|
+
}
|
|
3892
|
+
if (restartFromBeginning) this._applyFallback();
|
|
3134
3893
|
}
|
|
3135
3894
|
stop() {
|
|
3895
|
+
this._paused = false;
|
|
3136
3896
|
this._stopped = true;
|
|
3897
|
+
if (this._lite) {
|
|
3898
|
+
stopAnimation(this._lite);
|
|
3899
|
+
this._detachLite();
|
|
3900
|
+
}
|
|
3137
3901
|
}
|
|
3138
3902
|
get animationStarted() {
|
|
3139
|
-
return !this._stopped;
|
|
3903
|
+
return !this._paused && !this._stopped;
|
|
3140
3904
|
}
|
|
3141
|
-
|
|
3142
|
-
for (const anim of this.
|
|
3905
|
+
_applyFallback() {
|
|
3906
|
+
for (const anim of this._fallbackAnimations) {
|
|
3907
|
+
const frame = this._fallbackFrames.get(anim) ?? this.masterFrame;
|
|
3908
|
+
let value = anim.evaluate(frame);
|
|
3909
|
+
if (this._loop) {
|
|
3910
|
+
const repeatCount = this._fallbackRepeatCounts.get(anim) ?? 0;
|
|
3911
|
+
const [, to] = animationPlaybackRange(anim, this._from, this._to);
|
|
3912
|
+
if (anim.loopMode === AnimationLoopModes.ANIMATIONLOOPMODE_CONSTANT && repeatCount > 0) value = anim.evaluate(to);
|
|
3913
|
+
else if (anim.loopMode === AnimationLoopModes.ANIMATIONLOOPMODE_RELATIVE && repeatCount > 0) {
|
|
3914
|
+
const [from] = animationPlaybackRange(anim, this._from, this._to);
|
|
3915
|
+
value = addValue(value, scaleValue(subtractValue(anim.evaluate(to), anim.evaluate(from)), repeatCount));
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
applyAnimatedValue(this._target, anim.targetProperty, value);
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
_advanceFallback(deltaMs) {
|
|
3922
|
+
let anyRunning = false;
|
|
3923
|
+
for (const animation of this._fallbackAnimations) {
|
|
3924
|
+
if (this._completedFallbackAnimations.has(animation)) continue;
|
|
3925
|
+
const [from, to] = animationPlaybackRange(animation, this._from, this._to);
|
|
3926
|
+
const frameRange = to - from;
|
|
3927
|
+
let elapsedFrames = (this._fallbackElapsedFrames.get(animation) ?? 0) + deltaMs / 1e3 * animation.framePerSecond * this._speedRatio;
|
|
3928
|
+
const reachedEnd = frameRange >= 0 ? elapsedFrames >= frameRange : elapsedFrames <= frameRange;
|
|
3929
|
+
let repeatCount = 0;
|
|
3930
|
+
let frame;
|
|
3931
|
+
if (this._loop) {
|
|
3932
|
+
repeatCount = frameRange === 0 ? 0 : Math.max(0, Math.trunc(elapsedFrames / frameRange));
|
|
3933
|
+
frame = frameRange === 0 ? to : from + elapsedFrames % frameRange;
|
|
3934
|
+
anyRunning = true;
|
|
3935
|
+
} else if (reachedEnd) {
|
|
3936
|
+
elapsedFrames = frameRange;
|
|
3937
|
+
frame = to;
|
|
3938
|
+
this._completedFallbackAnimations.add(animation);
|
|
3939
|
+
} else {
|
|
3940
|
+
frame = from + elapsedFrames;
|
|
3941
|
+
anyRunning = true;
|
|
3942
|
+
}
|
|
3943
|
+
this._fallbackElapsedFrames.set(animation, elapsedFrames);
|
|
3944
|
+
this._fallbackRepeatCounts.set(animation, repeatCount);
|
|
3945
|
+
this._fallbackFrames.set(animation, frame);
|
|
3946
|
+
}
|
|
3947
|
+
return anyRunning;
|
|
3948
|
+
}
|
|
3949
|
+
_resetFallbackAnimation(animation, frame) {
|
|
3950
|
+
const [from] = animationPlaybackRange(animation, this._from, this._to);
|
|
3951
|
+
const clampedFrame = clampAnimationFrame(animation, frame);
|
|
3952
|
+
this._fallbackFrames.set(animation, clampedFrame);
|
|
3953
|
+
this._fallbackElapsedFrames.set(animation, clampedFrame - from);
|
|
3954
|
+
this._fallbackRepeatCounts.set(animation, 0);
|
|
3955
|
+
}
|
|
3956
|
+
_attachLite() {
|
|
3957
|
+
if (this._nativeManager && this._lite) addAnimationGroup(this._nativeManager, this._lite);
|
|
3958
|
+
}
|
|
3959
|
+
_detachLite() {
|
|
3960
|
+
if (this._nativeManager && this._lite) removeAnimationGroup(this._nativeManager, this._lite);
|
|
3143
3961
|
}
|
|
3144
3962
|
};
|
|
3963
|
+
function partitionAnimations(target, animations, from, to, speedRatio, blockedNativeBindings) {
|
|
3964
|
+
const globalReason = getGlobalNativeFallbackReason(animations, from, to, speedRatio);
|
|
3965
|
+
if (globalReason) return {
|
|
3966
|
+
nativeAnimations: [],
|
|
3967
|
+
fallbackAnimations: animations.slice(),
|
|
3968
|
+
fallbackReasons: [globalReason]
|
|
3969
|
+
};
|
|
3970
|
+
const reasons = /* @__PURE__ */ new Map();
|
|
3971
|
+
for (const animation of animations) {
|
|
3972
|
+
const reason = getTrackNativeFallbackReason(target, animation, from, to);
|
|
3973
|
+
if (reason) reasons.set(animation, reason);
|
|
3974
|
+
}
|
|
3975
|
+
let changed = true;
|
|
3976
|
+
while (changed) {
|
|
3977
|
+
changed = false;
|
|
3978
|
+
const fallbackPaths = animations.filter((animation) => reasons.has(animation)).map((animation) => animation.targetProperty);
|
|
3979
|
+
const fallbackBindings = [...blockedNativeBindings, ...animations.filter((animation) => reasons.has(animation)).map((animation) => resolveAnimationBinding(target, animation.targetProperty)).filter(isAnimationBinding)];
|
|
3980
|
+
for (const animation of animations) {
|
|
3981
|
+
const binding = resolveAnimationBinding(target, animation.targetProperty);
|
|
3982
|
+
if (!reasons.has(animation) && (fallbackPaths.some((path) => pathsOverlap(path, animation.targetProperty)) || binding !== void 0 && fallbackBindings.some((fallbackBinding) => bindingsOverlap(binding, fallbackBinding)))) {
|
|
3983
|
+
reasons.set(animation, `native property animation path "${animation.targetProperty}" overlaps a compat fallback path`);
|
|
3984
|
+
changed = true;
|
|
3985
|
+
}
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
return {
|
|
3989
|
+
nativeAnimations: animations.filter((animation) => !reasons.has(animation)),
|
|
3990
|
+
fallbackAnimations: animations.filter((animation) => reasons.has(animation)),
|
|
3991
|
+
fallbackReasons: [...new Set(reasons.values())]
|
|
3992
|
+
};
|
|
3993
|
+
}
|
|
3994
|
+
function getGlobalNativeFallbackReason(animations, from, to, speedRatio) {
|
|
3995
|
+
if (animations.length === 0) return "native property animation requires at least one Animation";
|
|
3996
|
+
if (!Number.isFinite(from) || !Number.isFinite(to) || !(to > from)) return "native property animation requires a finite forward play range";
|
|
3997
|
+
if (!Number.isFinite(speedRatio) || speedRatio < 0) return "native property animation does not delegate reverse or non-finite speed ratios";
|
|
3998
|
+
const frameRate = animations[0].framePerSecond;
|
|
3999
|
+
if (!(frameRate > 0) || !Number.isFinite(frameRate)) return "native property animation requires a finite positive frame rate";
|
|
4000
|
+
if (animations.some((animation) => animation.framePerSecond !== frameRate)) return "native property animation requires one shared frame rate";
|
|
4001
|
+
}
|
|
4002
|
+
function getTrackNativeFallbackReason(target, animation, from, to) {
|
|
4003
|
+
if (animation.loopMode !== AnimationLoopModes.ANIMATIONLOOPMODE_CYCLE) return `native property animation track "${animation.targetProperty}" requires cycle loop mode`;
|
|
4004
|
+
const stride = supportedStride(animation.dataType);
|
|
4005
|
+
if (stride === 0) return `native property animation track "${animation.targetProperty}" has an unsupported data type`;
|
|
4006
|
+
const keys = animation.getKeys();
|
|
4007
|
+
if (keys.length === 0) return `native property animation track "${animation.targetProperty}" requires at least one key`;
|
|
4008
|
+
let previousFrame = -Infinity;
|
|
4009
|
+
for (const key of keys) {
|
|
4010
|
+
if (!Number.isFinite(key.frame) || key.frame < 0 || key.frame <= previousFrame || !isSupportedKeyValue(key.value, stride)) return `native property animation track "${animation.targetProperty}" has an unsupported key frame or value`;
|
|
4011
|
+
previousFrame = key.frame;
|
|
4012
|
+
}
|
|
4013
|
+
if (from < keys[0].frame || to > keys[keys.length - 1].frame) return `native property animation track "${animation.targetProperty}" does not cover the requested play range`;
|
|
4014
|
+
if (!uniformInterpolation(keys)) return `native property animation track "${animation.targetProperty}" mixes STEP and LINEAR segments`;
|
|
4015
|
+
if (!supportsNativeBinding(target, animation.targetProperty, stride)) return `native property animation path "${animation.targetProperty}" is not writable by the native binding`;
|
|
4016
|
+
}
|
|
4017
|
+
function createNativeAnimationGroup(manager, target, animations, from, to, loop, speedRatio) {
|
|
4018
|
+
const tracks = animations.map((animation) => {
|
|
4019
|
+
const stride = supportedStride(animation.dataType);
|
|
4020
|
+
return {
|
|
4021
|
+
path: animation.targetProperty,
|
|
4022
|
+
frameRate: animation.framePerSecond,
|
|
4023
|
+
interpolation: trackInterpolation(animation.getKeys()),
|
|
4024
|
+
quaternion: animation.dataType === AnimationTypes.ANIMATIONTYPE_QUATERNION,
|
|
4025
|
+
easing: (gradient) => animation.getEasingFunction()?.ease(gradient) ?? gradient,
|
|
4026
|
+
keys: animation.getKeys().map((key) => ({
|
|
4027
|
+
frame: key.frame,
|
|
4028
|
+
value: toNativeKeyValue(key.value, stride)
|
|
4029
|
+
}))
|
|
4030
|
+
};
|
|
4031
|
+
});
|
|
4032
|
+
const clip = createPropertyAnimationClip(animations[0].name, tracks, { frameRate: animations[0].framePerSecond });
|
|
4033
|
+
return createPropertyAnimationGroup(manager, target, clip, {
|
|
4034
|
+
fromFrame: from,
|
|
4035
|
+
toFrame: to,
|
|
4036
|
+
loop,
|
|
4037
|
+
speedRatio
|
|
4038
|
+
});
|
|
4039
|
+
}
|
|
4040
|
+
function supportedStride(dataType) {
|
|
4041
|
+
switch (dataType) {
|
|
4042
|
+
case AnimationTypes.ANIMATIONTYPE_FLOAT: return 1;
|
|
4043
|
+
case AnimationTypes.ANIMATIONTYPE_VECTOR2: return 2;
|
|
4044
|
+
case AnimationTypes.ANIMATIONTYPE_VECTOR3: return 3;
|
|
4045
|
+
case AnimationTypes.ANIMATIONTYPE_QUATERNION: return 4;
|
|
4046
|
+
default: return 0;
|
|
4047
|
+
}
|
|
4048
|
+
}
|
|
4049
|
+
function isSupportedKeyValue(value, stride) {
|
|
4050
|
+
return readAnimationComponents(value, stride) !== void 0;
|
|
4051
|
+
}
|
|
4052
|
+
function toNativeKeyValue(value, stride) {
|
|
4053
|
+
if (typeof value === "number") return value;
|
|
4054
|
+
return readAnimationComponents(value, stride);
|
|
4055
|
+
}
|
|
4056
|
+
function pathsOverlap(a, b) {
|
|
4057
|
+
return a === b || a.startsWith(`${b}.`) || b.startsWith(`${a}.`);
|
|
4058
|
+
}
|
|
4059
|
+
function resolveAnimationBinding(target, path) {
|
|
4060
|
+
const parts = path.split(".");
|
|
4061
|
+
if (parts.length === 0 || parts.some((part) => part.length === 0) || typeof target !== "object" && typeof target !== "function" || target === null) return;
|
|
4062
|
+
const root = target;
|
|
4063
|
+
let owner = target;
|
|
4064
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
4065
|
+
if (typeof owner !== "object" && typeof owner !== "function" || owner === null) return;
|
|
4066
|
+
owner = owner[parts[i]];
|
|
4067
|
+
}
|
|
4068
|
+
return (typeof owner === "object" || typeof owner === "function") && owner !== null ? {
|
|
4069
|
+
root,
|
|
4070
|
+
path,
|
|
4071
|
+
target: owner,
|
|
4072
|
+
property: parts[parts.length - 1]
|
|
4073
|
+
} : void 0;
|
|
4074
|
+
}
|
|
4075
|
+
function bindingsOverlap(a, b) {
|
|
4076
|
+
return a.root === b.root && pathsOverlap(a.path, b.path) || a.target === b.target && a.property === b.property;
|
|
4077
|
+
}
|
|
4078
|
+
function isAnimationBinding(binding) {
|
|
4079
|
+
return binding !== void 0;
|
|
4080
|
+
}
|
|
4081
|
+
function clampAnimationFrame(animation, frame) {
|
|
4082
|
+
const keys = animation?.getKeys();
|
|
4083
|
+
if (!keys || keys.length === 0) return frame;
|
|
4084
|
+
return Math.min(Math.max(frame, keys[0].frame), keys[keys.length - 1].frame);
|
|
4085
|
+
}
|
|
4086
|
+
function animationPlaybackRange(animation, from, to) {
|
|
4087
|
+
const keys = animation.getKeys();
|
|
4088
|
+
if (keys.length === 0) return [from, to];
|
|
4089
|
+
const min = keys[0].frame;
|
|
4090
|
+
const max = keys[keys.length - 1].frame;
|
|
4091
|
+
return [from < min || from > max ? min : from, to < min || to > max ? max : to];
|
|
4092
|
+
}
|
|
4093
|
+
function uniformInterpolation(keys) {
|
|
4094
|
+
let mode;
|
|
4095
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
4096
|
+
const keyMode = keys[i].interpolation === AnimationKeyInterpolation.STEP ? AnimationKeyInterpolation.STEP : AnimationKeyInterpolation.NONE;
|
|
4097
|
+
mode ??= keyMode;
|
|
4098
|
+
if (mode !== keyMode) return false;
|
|
4099
|
+
}
|
|
4100
|
+
return true;
|
|
4101
|
+
}
|
|
4102
|
+
function trackInterpolation(keys) {
|
|
4103
|
+
return keys.length > 1 && keys[0].interpolation === AnimationKeyInterpolation.STEP ? "step" : "linear";
|
|
4104
|
+
}
|
|
4105
|
+
function supportsNativeBinding(target, path, stride) {
|
|
4106
|
+
const parts = path.split(".");
|
|
4107
|
+
if (parts.length === 0 || parts.some((part) => part.length === 0)) return false;
|
|
4108
|
+
let owner = target;
|
|
4109
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
4110
|
+
if (typeof owner !== "object" && typeof owner !== "function" || owner === null) return false;
|
|
4111
|
+
const record = owner;
|
|
4112
|
+
const part = parts[i];
|
|
4113
|
+
if (!(part in record)) return false;
|
|
4114
|
+
owner = record[part];
|
|
4115
|
+
}
|
|
4116
|
+
if (typeof owner !== "object" && typeof owner !== "function" || owner === null) return false;
|
|
4117
|
+
const record = owner;
|
|
4118
|
+
const property = parts[parts.length - 1];
|
|
4119
|
+
if (!(property in record)) return false;
|
|
4120
|
+
const value = record[property];
|
|
4121
|
+
return stride === 1 ? typeof value === "number" : (typeof value === "object" || typeof value === "function") && value !== null && typeof value.set === "function";
|
|
4122
|
+
}
|
|
3145
4123
|
/**
|
|
3146
4124
|
* Babylon.js `AnimationGroup` — a named collection of targeted animations with
|
|
3147
4125
|
* playback state. This is the **single** `AnimationGroup` type, matching Babylon.js;
|
|
@@ -3529,7 +4507,15 @@ var Constants = {
|
|
|
3529
4507
|
TEXTURE_BILINEAR_SAMPLINGMODE: 2,
|
|
3530
4508
|
TEXTURE_TRILINEAR_SAMPLINGMODE: 3,
|
|
3531
4509
|
TEXTUREFORMAT_RGBA: 5,
|
|
3532
|
-
TEXTURETYPE_UNSIGNED_BYTE: 0
|
|
4510
|
+
TEXTURETYPE_UNSIGNED_BYTE: 0,
|
|
4511
|
+
BUFFER_CREATIONFLAG_READ: 1,
|
|
4512
|
+
BUFFER_CREATIONFLAG_WRITE: 2,
|
|
4513
|
+
BUFFER_CREATIONFLAG_READWRITE: 3,
|
|
4514
|
+
BUFFER_CREATIONFLAG_UNIFORM: 4,
|
|
4515
|
+
BUFFER_CREATIONFLAG_VERTEX: 8,
|
|
4516
|
+
BUFFER_CREATIONFLAG_INDEX: 16,
|
|
4517
|
+
BUFFER_CREATIONFLAG_STORAGE: 32,
|
|
4518
|
+
BUFFER_CREATIONFLAG_INDIRECT: 64
|
|
3533
4519
|
};
|
|
3534
4520
|
//#endregion
|
|
3535
4521
|
//#region src/events/pointer-events.ts
|
|
@@ -3617,8 +4603,8 @@ var Scene = class Scene extends AbstractScene {
|
|
|
3617
4603
|
* Babylon.js `scene.animationGroups` / `scene.animatables`. Loaded glTF /
|
|
3618
4604
|
* `.babylon` animation clips live on the Lite scene; `animationGroups` returns
|
|
3619
4605
|
* BJS-shaped `AnimationGroup`s over them (so scenes can `goToFrame`/`pause`/`stop`
|
|
3620
|
-
* to freeze a model at a deterministic frame). `animatables` surfaces the
|
|
3621
|
-
*
|
|
4606
|
+
* to freeze a model at a deterministic frame). `animatables` surfaces the
|
|
4607
|
+
* native-backed and fallback `Animatable`s started through the scene.
|
|
3622
4608
|
*/
|
|
3623
4609
|
get animationGroups() {
|
|
3624
4610
|
return (this._lite.animationGroups ?? []).map((g) => {
|
|
@@ -3665,6 +4651,8 @@ var Scene = class Scene extends AbstractScene {
|
|
|
3665
4651
|
_materialPluginsRequested = false;
|
|
3666
4652
|
_pendingMaterialPluginReconciliations = /* @__PURE__ */ new Set();
|
|
3667
4653
|
_runningAnimatables = [];
|
|
4654
|
+
/** @internal Lite manager that owns supported compat property animations. */
|
|
4655
|
+
_propertyAnimationManager = null;
|
|
3668
4656
|
_animationGroupCache = /* @__PURE__ */ new WeakMap();
|
|
3669
4657
|
/** @internal Structural `AnimationGroup`s stepped + weight-blended each frame. */
|
|
3670
4658
|
_structuralGroups = [];
|
|
@@ -3745,6 +4733,7 @@ var Scene = class Scene extends AbstractScene {
|
|
|
3745
4733
|
this._engine._lastDeltaMs = deltaMs;
|
|
3746
4734
|
this.onBeforeAnimationsObservable.notifyObservers(this);
|
|
3747
4735
|
if (this._blendManager) updateAnimationManager(this._blendManager, deltaMs);
|
|
4736
|
+
if (this._propertyAnimationManager) updateAnimationManager(this._propertyAnimationManager, deltaMs);
|
|
3748
4737
|
for (const a of this._runningAnimatables) a._tick(deltaMs);
|
|
3749
4738
|
if (this._structuralGroups.length > 0) {
|
|
3750
4739
|
for (const g of this._structuralGroups) g._advanceStructural(deltaMs);
|
|
@@ -4377,11 +5366,18 @@ var Scene = class Scene extends AbstractScene {
|
|
|
4377
5366
|
}
|
|
4378
5367
|
/**
|
|
4379
5368
|
* Babylon.js `scene.beginDirectAnimation(target, animations, from, to, loop, speedRatio?)`.
|
|
4380
|
-
*
|
|
4381
|
-
*
|
|
5369
|
+
* Delegates supported tracks to Babylon Lite property animation and retains
|
|
5370
|
+
* explicit compat evaluation only for unsupported tracks. Returns one facade
|
|
5371
|
+
* coordinating both subsets.
|
|
4382
5372
|
*/
|
|
4383
5373
|
beginDirectAnimation(target, animations, from, to, loop = false, speedRatio = 1) {
|
|
4384
|
-
|
|
5374
|
+
if (speedRatio < 0) {
|
|
5375
|
+
[from, to] = [to, from];
|
|
5376
|
+
speedRatio = -speedRatio;
|
|
5377
|
+
}
|
|
5378
|
+
if (from > to) speedRatio = -speedRatio;
|
|
5379
|
+
const blockedNativeBindings = this._runningAnimatables.flatMap((animatable) => animatable._getBlockingFallbackBindings());
|
|
5380
|
+
const animatable = Animatable._create(() => this._propertyAnimationManager ??= createAnimationManager(), target, animations, from, to, loop, speedRatio, blockedNativeBindings);
|
|
4385
5381
|
this._runningAnimatables.push(animatable);
|
|
4386
5382
|
return animatable;
|
|
4387
5383
|
}
|
|
@@ -4426,11 +5422,32 @@ var Scene = class Scene extends AbstractScene {
|
|
|
4426
5422
|
return this.beginDirectAnimation(target, target.animations ?? [], from, to, loop, speedRatio);
|
|
4427
5423
|
}
|
|
4428
5424
|
dispose() {
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
5425
|
+
let hasError = false;
|
|
5426
|
+
let firstError;
|
|
5427
|
+
const runCleanup = (cleanup) => {
|
|
5428
|
+
try {
|
|
5429
|
+
cleanup();
|
|
5430
|
+
} catch (error) {
|
|
5431
|
+
if (!hasError) {
|
|
5432
|
+
hasError = true;
|
|
5433
|
+
firstError = error;
|
|
5434
|
+
}
|
|
5435
|
+
}
|
|
5436
|
+
};
|
|
5437
|
+
runCleanup(() => this._detachPointerEvents());
|
|
5438
|
+
const observerResult = this.onDisposeObservable._notifyObserversSafely(this);
|
|
5439
|
+
if (observerResult.hasError && !hasError) {
|
|
5440
|
+
hasError = true;
|
|
5441
|
+
firstError = observerResult.error;
|
|
5442
|
+
}
|
|
5443
|
+
runCleanup(() => this.onDisposeObservable.clear());
|
|
5444
|
+
runCleanup(() => this.onPointerObservable.clear());
|
|
5445
|
+
runCleanup(() => this._beforeRenderFlushCallbacks.clear());
|
|
5446
|
+
if (this._propertyAnimationManager) runCleanup(() => clearAnimationManager(this._propertyAnimationManager));
|
|
5447
|
+
if (this._blendManager) runCleanup(() => clearAnimationManager(this._blendManager));
|
|
5448
|
+
this._runningAnimatables.length = 0;
|
|
5449
|
+
runCleanup(() => disposeScene(this._lite));
|
|
5450
|
+
if (hasError) throw firstError;
|
|
4434
5451
|
}
|
|
4435
5452
|
};
|
|
4436
5453
|
//#endregion
|
|
@@ -5284,9 +6301,9 @@ var GaussianSplattingMesh = class GaussianSplattingMesh extends TransformNode {
|
|
|
5284
6301
|
getClassName() {
|
|
5285
6302
|
return "GaussianSplattingMesh";
|
|
5286
6303
|
}
|
|
5287
|
-
/** @internal The transform
|
|
6304
|
+
/** @internal The wrapper's transform node; the loaded cloud is parented beneath it during deferred adoption. */
|
|
5288
6305
|
get _xform() {
|
|
5289
|
-
return this._gs ?? this._node;
|
|
6306
|
+
return this._gs?.parent === this._node ? this._node : this._gs ?? this._node;
|
|
5290
6307
|
}
|
|
5291
6308
|
get position() {
|
|
5292
6309
|
return liteBackedVector3(this._xform.position);
|
|
@@ -5323,12 +6340,15 @@ var GaussianSplattingMesh = class GaussianSplattingMesh extends TransformNode {
|
|
|
5323
6340
|
this._adopt(lite);
|
|
5324
6341
|
return this;
|
|
5325
6342
|
}
|
|
5326
|
-
/**
|
|
6343
|
+
/**
|
|
6344
|
+
* @internal Adopt a loaded Lite splat node from either the mesh or loader-plugin API.
|
|
6345
|
+
* Parenting preserves the loader's format-specific local transform while composing it
|
|
6346
|
+
* with transforms applied to the wrapper before loading.
|
|
6347
|
+
*/
|
|
5327
6348
|
_adopt(lite) {
|
|
5328
6349
|
const placeholder = this._node;
|
|
5329
|
-
lite.
|
|
5330
|
-
|
|
5331
|
-
lite.rotation.set(placeholder.rotation.x, placeholder.rotation.y, placeholder.rotation.z);
|
|
6350
|
+
lite.parent = placeholder;
|
|
6351
|
+
placeholder.children.push(lite);
|
|
5332
6352
|
lite.name = this.name;
|
|
5333
6353
|
this._gs = lite;
|
|
5334
6354
|
this._scene?._registerMesh(this);
|
|
@@ -5362,7 +6382,18 @@ var GaussianSplattingMesh = class GaussianSplattingMesh extends TransformNode {
|
|
|
5362
6382
|
}
|
|
5363
6383
|
/** Babylon.js `gs.bakeCurrentTransformIntoVertices()` — fold the node transform into the splat data. */
|
|
5364
6384
|
bakeCurrentTransformIntoVertices() {
|
|
5365
|
-
if (this._gs)
|
|
6385
|
+
if (this._gs) {
|
|
6386
|
+
bakeCurrentTransformIntoVertices(this._gs);
|
|
6387
|
+
if (this._gs.parent === this._node) {
|
|
6388
|
+
const userChildren = this._node.children.filter((child) => child !== this._gs && child.parent === this._node);
|
|
6389
|
+
for (const child of this.getChildren(void 0, true)) if (child instanceof TransformNode && child._node !== this._gs && !userChildren.includes(child._node)) userChildren.push(child._node);
|
|
6390
|
+
for (const child of userChildren) setParent(child, null);
|
|
6391
|
+
this._node.position.set(0, 0, 0);
|
|
6392
|
+
this._node.rotation.set(0, 0, 0);
|
|
6393
|
+
this._node.scaling.set(1, 1, 1);
|
|
6394
|
+
for (const child of userChildren) setParent(child, this._node);
|
|
6395
|
+
}
|
|
6396
|
+
}
|
|
5366
6397
|
}
|
|
5367
6398
|
/** @internal Babylon.js's worker-throttle flag; ported scenes poll it to detect the first sort. */
|
|
5368
6399
|
get _canPostToWorker() {
|
|
@@ -6300,6 +7331,184 @@ var Bone = class Bone {
|
|
|
6300
7331
|
}
|
|
6301
7332
|
};
|
|
6302
7333
|
//#endregion
|
|
7334
|
+
//#region src/loading/splat-file-loader.ts
|
|
7335
|
+
var SPLAT_ASSET_CONTAINER_UNSUPPORTED = "Lite's splat loaders attach the GPU-backed cloud directly to a scene. They do not expose a detached Gaussian-Splatting asset-container lifecycle that can preserve the BJS mesh type.";
|
|
7336
|
+
var SPLAT_STREAMING_UNSUPPORTED = "PlayCanvas lod-meta.json requires Babylon.js's Gaussian-Splatting streaming residency, download scheduling, and GPU work-buffer subsystem, which Babylon Lite does not define.";
|
|
7337
|
+
var SPLAT_DIRECTORY_UNSUPPORTED = "Directory SOG JSON requires a loader contract for resolving and decoding external texture resources relative to rootUrl; Lite's SOG loader accepts only self-contained archives.";
|
|
7338
|
+
var SPLAT_RELOAD_UNSUPPORTED = "Lite does not expose an atomic Gaussian-Splatting replacement lifecycle that detaches the old renderable and picker while retiring its worker and GPU resources.";
|
|
7339
|
+
var SPLAT_CONCURRENT_TARGET_UNSUPPORTED = "An unloaded GaussianSplattingMesh target can only be populated by one in-flight load.";
|
|
7340
|
+
var loadingTargets;
|
|
7341
|
+
function bytesOf(data) {
|
|
7342
|
+
if (data instanceof ArrayBuffer) return new Uint8Array(data);
|
|
7343
|
+
if (ArrayBuffer.isView(data)) return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
7344
|
+
return unsupported("SPLATFileLoader", "Binary .splat, .ply, .sog, and .spz inputs must be supplied as an ArrayBuffer or ArrayBufferView.");
|
|
7345
|
+
}
|
|
7346
|
+
function loaderFor(data) {
|
|
7347
|
+
if (typeof data === "string") return unsupported("SPLATFileLoader", data.includes("\"lods\"") ? SPLAT_STREAMING_UNSUPPORTED : SPLAT_DIRECTORY_UNSUPPORTED);
|
|
7348
|
+
const bytes = bytesOf(data);
|
|
7349
|
+
if (bytes[0] === 80 && bytes[1] === 75) return loadSOG;
|
|
7350
|
+
if (bytes[0] === 31 && bytes[1] === 139 || bytes[0] === 78 && bytes[1] === 71 && bytes[2] === 83 && bytes[3] === 80) return loadSPZ;
|
|
7351
|
+
return loadSplat;
|
|
7352
|
+
}
|
|
7353
|
+
function loaderForUrl(url) {
|
|
7354
|
+
const path = url.split(/[?#]/)[0].toLowerCase();
|
|
7355
|
+
if (path.endsWith(".json")) return unsupported("SPLATFileLoader", SPLAT_STREAMING_UNSUPPORTED);
|
|
7356
|
+
if (path.endsWith(".sog")) return loadSOG;
|
|
7357
|
+
if (path.endsWith(".spz")) return loadSPZ;
|
|
7358
|
+
return loadSplat;
|
|
7359
|
+
}
|
|
7360
|
+
function binaryData(data) {
|
|
7361
|
+
return new Uint8Array(bytesOf(data)).buffer;
|
|
7362
|
+
}
|
|
7363
|
+
function validateOptions(options) {
|
|
7364
|
+
if (options.flipY === true) unsupported("SPLATLoadingOptions.flipY", "Lite's native splat parsers own their format-specific orientation conversion and do not expose a parser-level flipY override.");
|
|
7365
|
+
if (options.deflateURL !== void 0 || options.fflate !== void 0) unsupported("SPLATLoadingOptions.fflate", "Lite owns its SOG decompressor and does not expose Babylon.js's replaceable fflate loading policy.");
|
|
7366
|
+
if (options.needsRotationScaleTextures) unsupported("SPLATLoadingOptions.needsRotationScaleTextures", "Voxel IBL-shadow rotation/scale textures require Babylon.js's Gaussian-Splatting IBL shadow subsystem, which Babylon Lite does not define.");
|
|
7367
|
+
if (options.useSogTextures) unsupported("SPLATLoadingOptions.useSogTextures", "Lite's SOG loader uses its native CPU decode path and does not expose Babylon.js's raw-texture dequantization pipeline.");
|
|
7368
|
+
if (options.spzLibraryUrl !== void 0) unsupported("SPLATLoadingOptions.spzLibraryUrl", "Lite owns its SPZ decoder and does not expose a replaceable WASM-library URL policy.");
|
|
7369
|
+
}
|
|
7370
|
+
var SPLATFileLoader = class SPLATFileLoader {
|
|
7371
|
+
name = "splat";
|
|
7372
|
+
extensions = {
|
|
7373
|
+
".splat": { isBinary: true },
|
|
7374
|
+
".ply": { isBinary: true },
|
|
7375
|
+
".spz": { isBinary: true },
|
|
7376
|
+
".json": { isBinary: false },
|
|
7377
|
+
".sog": { isBinary: true }
|
|
7378
|
+
};
|
|
7379
|
+
_loadingOptions;
|
|
7380
|
+
constructor(loadingOptions = {}) {
|
|
7381
|
+
this._loadingOptions = { ...loadingOptions };
|
|
7382
|
+
validateOptions(this._loadingOptions);
|
|
7383
|
+
}
|
|
7384
|
+
createPlugin(options) {
|
|
7385
|
+
return new SPLATFileLoader(options.splat);
|
|
7386
|
+
}
|
|
7387
|
+
async importMeshAsync(_meshesNames, scene, data, _rootUrl, _onProgress, _fileName) {
|
|
7388
|
+
return {
|
|
7389
|
+
meshes: [await this._load(scene, data)],
|
|
7390
|
+
particleSystems: [],
|
|
7391
|
+
skeletons: [],
|
|
7392
|
+
animationGroups: [],
|
|
7393
|
+
transformNodes: [],
|
|
7394
|
+
geometries: [],
|
|
7395
|
+
lights: [],
|
|
7396
|
+
spriteManagers: []
|
|
7397
|
+
};
|
|
7398
|
+
}
|
|
7399
|
+
async loadAsync(scene, data, rootUrl, onProgress, fileName) {
|
|
7400
|
+
await this.importMeshAsync(null, scene, data, rootUrl, onProgress, fileName);
|
|
7401
|
+
}
|
|
7402
|
+
loadAssetContainerAsync(_scene, _data, _rootUrl) {
|
|
7403
|
+
return unsupported("SPLATFileLoader.loadAssetContainerAsync", SPLAT_ASSET_CONTAINER_UNSUPPORTED);
|
|
7404
|
+
}
|
|
7405
|
+
/** @internal Load a URL through Lite while preserving this plugin's Babylon.js options. */
|
|
7406
|
+
async _loadUrlAsync(scene, url) {
|
|
7407
|
+
return this._loadReserved(scene, () => loaderForUrl(url)(scene._lite, url));
|
|
7408
|
+
}
|
|
7409
|
+
async _load(scene, data) {
|
|
7410
|
+
return this._loadReserved(scene, async () => {
|
|
7411
|
+
const loader = loaderFor(data);
|
|
7412
|
+
const url = URL.createObjectURL(new Blob([binaryData(data)]));
|
|
7413
|
+
try {
|
|
7414
|
+
return await loader(scene._lite, url);
|
|
7415
|
+
} finally {
|
|
7416
|
+
URL.revokeObjectURL(url);
|
|
7417
|
+
}
|
|
7418
|
+
});
|
|
7419
|
+
}
|
|
7420
|
+
async _loadReserved(scene, load) {
|
|
7421
|
+
const target = this._loadingOptions.gaussianSplattingMesh;
|
|
7422
|
+
if (target?._pickLiteNode) unsupported("SPLATLoadingOptions.gaussianSplattingMesh", SPLAT_RELOAD_UNSUPPORTED);
|
|
7423
|
+
if (target) {
|
|
7424
|
+
loadingTargets ??= /* @__PURE__ */ new WeakSet();
|
|
7425
|
+
if (loadingTargets.has(target)) unsupported("SPLATLoadingOptions.gaussianSplattingMesh", SPLAT_CONCURRENT_TARGET_UNSUPPORTED);
|
|
7426
|
+
loadingTargets.add(target);
|
|
7427
|
+
}
|
|
7428
|
+
try {
|
|
7429
|
+
return this._adoptLoaded(scene, await load());
|
|
7430
|
+
} finally {
|
|
7431
|
+
if (target) loadingTargets?.delete(target);
|
|
7432
|
+
}
|
|
7433
|
+
}
|
|
7434
|
+
_adoptLoaded(scene, lite) {
|
|
7435
|
+
const target = this._loadingOptions.gaussianSplattingMesh;
|
|
7436
|
+
if (target) {
|
|
7437
|
+
target._adopt(lite);
|
|
7438
|
+
return target;
|
|
7439
|
+
}
|
|
7440
|
+
lite.name = "GaussianSplatting";
|
|
7441
|
+
return GaussianSplattingMesh._fromLite(lite, scene);
|
|
7442
|
+
}
|
|
7443
|
+
};
|
|
7444
|
+
function RegisterSPLATFileLoader() {}
|
|
7445
|
+
//#endregion
|
|
7446
|
+
//#region src/loading/usd-options.ts
|
|
7447
|
+
var USD_RUNTIME_BASE_URL = "https://cdn.babylonjs.com/babylonUsdImporter/5/";
|
|
7448
|
+
var USD_RUNTIME_NAMES = {
|
|
7449
|
+
workerUrl: "babylon-usd-importer.worker.js",
|
|
7450
|
+
glueUrl: "babylon-usd-importer.js",
|
|
7451
|
+
wasmUrl: "babylon-usd-importer.wasm",
|
|
7452
|
+
dataUrl: "babylon-usd-importer.data"
|
|
7453
|
+
};
|
|
7454
|
+
var defaultConfiguration;
|
|
7455
|
+
function getUsdDefaultConfiguration() {
|
|
7456
|
+
return defaultConfiguration ??= {
|
|
7457
|
+
glueUrl: `${USD_RUNTIME_BASE_URL}${USD_RUNTIME_NAMES.glueUrl}`,
|
|
7458
|
+
wasmUrl: `${USD_RUNTIME_BASE_URL}${USD_RUNTIME_NAMES.wasmUrl}`,
|
|
7459
|
+
dataUrl: `${USD_RUNTIME_BASE_URL}${USD_RUNTIME_NAMES.dataUrl}`,
|
|
7460
|
+
workerUrl: `${USD_RUNTIME_BASE_URL}${USD_RUNTIME_NAMES.workerUrl}`
|
|
7461
|
+
};
|
|
7462
|
+
}
|
|
7463
|
+
function setUsdDefaultConfiguration(configuration) {
|
|
7464
|
+
defaultConfiguration = configuration;
|
|
7465
|
+
}
|
|
7466
|
+
function resolveUsdOptions(options) {
|
|
7467
|
+
const configured = Object.keys(USD_RUNTIME_NAMES).filter((key) => options[key] !== void 0);
|
|
7468
|
+
if (configured.length !== 0 && configured.length !== 4) unsupported("USDFileLoaderOptions runtime URLs", "Babylon Lite loads the OpenUSD worker, glue, WASM, and data files from one runtime directory. Babylon.js runtime URL overrides can be adapted only when all four standard files are configured together.");
|
|
7469
|
+
const defaults = getUsdDefaultConfiguration();
|
|
7470
|
+
return {
|
|
7471
|
+
...defaults,
|
|
7472
|
+
...options,
|
|
7473
|
+
workerUrl: options.workerUrl ?? defaults.workerUrl,
|
|
7474
|
+
glueUrl: options.glueUrl ?? defaults.glueUrl,
|
|
7475
|
+
wasmUrl: options.wasmUrl ?? defaults.wasmUrl,
|
|
7476
|
+
dataUrl: options.dataUrl ?? defaults.dataUrl
|
|
7477
|
+
};
|
|
7478
|
+
}
|
|
7479
|
+
function toLiteUsdOptions(options, signal, onProgress) {
|
|
7480
|
+
const configured = Object.keys(USD_RUNTIME_NAMES).filter((key) => options[key] !== void 0);
|
|
7481
|
+
let runtimeBaseUrl;
|
|
7482
|
+
for (const key of configured) {
|
|
7483
|
+
const url = new URL(String(options[key]), globalThis.location?.href ?? "http://localhost/");
|
|
7484
|
+
if (url.search || url.hash) unsupported(`USDFileLoaderOptions.${key}`, "Babylon Lite reconstructs OpenUSD runtime file URLs from one directory and cannot preserve per-file query strings or hash fragments.");
|
|
7485
|
+
if (!url.pathname.endsWith(`/${USD_RUNTIME_NAMES[key]}`)) unsupported(`USDFileLoaderOptions.${key}`, `Babylon Lite loads the four OpenUSD runtime files from one directory using their standard names; '${USD_RUNTIME_NAMES[key]}' is required.`);
|
|
7486
|
+
const candidate = new URL(".", url).href;
|
|
7487
|
+
if (runtimeBaseUrl !== void 0 && candidate !== runtimeBaseUrl) unsupported("USDFileLoaderOptions runtime URLs", "Babylon Lite loads the OpenUSD worker, glue, WASM, and data files from one runtime directory; independently located runtime files cannot be adapted.");
|
|
7488
|
+
runtimeBaseUrl = candidate;
|
|
7489
|
+
}
|
|
7490
|
+
return {
|
|
7491
|
+
rootFileName: options.rootFileName,
|
|
7492
|
+
files: options.files,
|
|
7493
|
+
resolveByFileName: options.resolveByFileName ?? true,
|
|
7494
|
+
runtimeBaseUrl,
|
|
7495
|
+
signal,
|
|
7496
|
+
onProgress: (progress) => {
|
|
7497
|
+
if (progress.phase !== "fetching") options.onProgress?.({
|
|
7498
|
+
phase: progress.phase,
|
|
7499
|
+
message: progress.message
|
|
7500
|
+
});
|
|
7501
|
+
const loaded = progress.phase === "fetching" ? 0 : progress.phase === "initializing" ? 1 : progress.phase === "staging" ? 2 : progress.phase === "extracting" ? 3 : 4;
|
|
7502
|
+
onProgress?.({
|
|
7503
|
+
lengthComputable: false,
|
|
7504
|
+
loaded,
|
|
7505
|
+
total: 4
|
|
7506
|
+
});
|
|
7507
|
+
},
|
|
7508
|
+
onLog: options.onLog
|
|
7509
|
+
};
|
|
7510
|
+
}
|
|
7511
|
+
//#endregion
|
|
6303
7512
|
//#region src/loading/scene-loader.ts
|
|
6304
7513
|
/**
|
|
6305
7514
|
* Babylon.js-compatible `SceneLoader` and `AssetContainer` over Babylon Lite's
|
|
@@ -6324,16 +7533,14 @@ function urlPath(url) {
|
|
|
6324
7533
|
/** Splat asset extensions Babylon Lite can parse (`loadSplat` / `loadSOG` / `loadSPZ`). */
|
|
6325
7534
|
function isSplatUrl(url) {
|
|
6326
7535
|
const u = urlPath(url).toLowerCase();
|
|
6327
|
-
return u.endsWith(".ply") || u.endsWith(".splat") || u.endsWith(".sog") || u.endsWith(".spz");
|
|
7536
|
+
return u.endsWith(".ply") || u.endsWith(".splat") || u.endsWith(".sog") || u.endsWith(".spz") || u.endsWith(".json");
|
|
6328
7537
|
}
|
|
6329
7538
|
/** True when a URL points at a `.babylon` file, ignoring any query string or hash. */
|
|
6330
7539
|
function isBabylonUrl(url) {
|
|
6331
7540
|
return urlPath(url).toLowerCase().endsWith(".babylon");
|
|
6332
7541
|
}
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
const path = urlPath(url);
|
|
6336
|
-
return path.slice(path.lastIndexOf("/") + 1) || "splat";
|
|
7542
|
+
function isUsdUrl(url) {
|
|
7543
|
+
return /\.(?:usd|usda|usdc|usdz)$/i.test(urlPath(url));
|
|
6337
7544
|
}
|
|
6338
7545
|
var AssetContainer = class {
|
|
6339
7546
|
/** @internal Underlying Babylon Lite asset container. */
|
|
@@ -6344,8 +7551,15 @@ var AssetContainer = class {
|
|
|
6344
7551
|
_scene;
|
|
6345
7552
|
/** @internal Canonical loaded-skeleton wrappers. */
|
|
6346
7553
|
_skeletons;
|
|
6347
|
-
|
|
7554
|
+
_dispose;
|
|
7555
|
+
/** @internal Original USD mesh ownership, independent of later hierarchy changes. */
|
|
7556
|
+
_ownedMeshes;
|
|
7557
|
+
_sceneDisposeObserver;
|
|
7558
|
+
_disposed = false;
|
|
7559
|
+
constructor(lite, dispose, ownedMeshes) {
|
|
6348
7560
|
this._lite = lite;
|
|
7561
|
+
this._dispose = dispose;
|
|
7562
|
+
this._ownedMeshes = ownedMeshes ? [...ownedMeshes] : void 0;
|
|
6349
7563
|
}
|
|
6350
7564
|
get animationGroups() {
|
|
6351
7565
|
return this._lite.animationGroups ?? [];
|
|
@@ -6357,6 +7571,7 @@ var AssetContainer = class {
|
|
|
6357
7571
|
* same handles `scene.meshes` exposes.
|
|
6358
7572
|
*/
|
|
6359
7573
|
get meshes() {
|
|
7574
|
+
if (this._disposed) return [...this._meshRegistry.values()];
|
|
6360
7575
|
return collectLoadedMeshes(this._lite, this._meshRegistry, this._scene);
|
|
6361
7576
|
}
|
|
6362
7577
|
get skeletons() {
|
|
@@ -6365,21 +7580,77 @@ var AssetContainer = class {
|
|
|
6365
7580
|
/** Add every entity, animation group, camera, and clear colour to the scene. */
|
|
6366
7581
|
addAllToScene(scene) {
|
|
6367
7582
|
addToScene(scene._lite, this._lite);
|
|
7583
|
+
this._adoptScene(scene);
|
|
7584
|
+
}
|
|
7585
|
+
/** @internal Associate an already-added Lite container with its compat scene. */
|
|
7586
|
+
_adoptScene(scene) {
|
|
7587
|
+
if (this._sceneDisposeObserver && this._scene && this._scene !== scene) {
|
|
7588
|
+
this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);
|
|
7589
|
+
this._sceneDisposeObserver = void 0;
|
|
7590
|
+
}
|
|
6368
7591
|
this._scene = scene;
|
|
7592
|
+
if (this._dispose && !this._sceneDisposeObserver) this._sceneDisposeObserver = scene.onDisposeObservable.addOnce(() => {
|
|
7593
|
+
this._scene = void 0;
|
|
7594
|
+
this._sceneDisposeObserver = void 0;
|
|
7595
|
+
this._detachFromScene(scene);
|
|
7596
|
+
});
|
|
6369
7597
|
collectLoadedMeshes(this._lite, this._meshRegistry, scene);
|
|
6370
7598
|
scene._surfaceLoadedCamera();
|
|
6371
7599
|
}
|
|
6372
|
-
dispose() {
|
|
7600
|
+
dispose() {
|
|
7601
|
+
const scene = this._scene;
|
|
7602
|
+
if (scene && this._sceneDisposeObserver) {
|
|
7603
|
+
scene.onDisposeObservable.remove(this._sceneDisposeObserver);
|
|
7604
|
+
this._sceneDisposeObserver = void 0;
|
|
7605
|
+
}
|
|
7606
|
+
this._scene = void 0;
|
|
7607
|
+
if (scene) this._detachFromScene(scene);
|
|
7608
|
+
else try {
|
|
7609
|
+
this._retireMeshWrappers();
|
|
7610
|
+
} finally {
|
|
7611
|
+
this._disposeOnce();
|
|
7612
|
+
}
|
|
7613
|
+
}
|
|
7614
|
+
_detachFromScene(scene) {
|
|
7615
|
+
try {
|
|
7616
|
+
if (this._ownedMeshes) for (const mesh of this._ownedMeshes) setParent(mesh, null);
|
|
7617
|
+
removeFromScene(scene._lite, this._lite);
|
|
7618
|
+
if (this._ownedMeshes) for (const mesh of this._ownedMeshes) removeFromScene(scene._lite, mesh);
|
|
7619
|
+
} finally {
|
|
7620
|
+
try {
|
|
7621
|
+
this._retireMeshWrappers();
|
|
7622
|
+
} finally {
|
|
7623
|
+
this._disposeOnce();
|
|
7624
|
+
}
|
|
7625
|
+
}
|
|
7626
|
+
}
|
|
7627
|
+
_retireMeshWrappers() {
|
|
7628
|
+
let hasError = false;
|
|
7629
|
+
let firstError;
|
|
7630
|
+
for (const wrapper of this._meshRegistry.values()) try {
|
|
7631
|
+
wrapper._disposeWrapperOnly();
|
|
7632
|
+
} catch (error) {
|
|
7633
|
+
if (!hasError) {
|
|
7634
|
+
hasError = true;
|
|
7635
|
+
firstError = error;
|
|
7636
|
+
}
|
|
7637
|
+
}
|
|
7638
|
+
if (hasError) throw firstError;
|
|
7639
|
+
}
|
|
7640
|
+
_disposeOnce() {
|
|
7641
|
+
if (!this._disposed) {
|
|
7642
|
+
this._disposed = true;
|
|
7643
|
+
this._dispose?.();
|
|
7644
|
+
}
|
|
7645
|
+
}
|
|
6373
7646
|
};
|
|
6374
7647
|
function validateGltfOptions(source, options) {
|
|
6375
7648
|
if (!isBabylonUrl(source) && !isSplatUrl(source) && options?.pluginOptions?.gltf?.preprocessUrlAsync) unsupported("ISceneLoaderOptions.pluginOptions.gltf.preprocessUrlAsync", "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.");
|
|
6376
7649
|
}
|
|
6377
7650
|
/** @internal Load a splat URL into a `GaussianSplattingMesh` (shared by every loader entry point). */
|
|
6378
|
-
async function loadSplatResult(url, scene) {
|
|
6379
|
-
const gs = new GaussianSplattingMesh(baseName(url), null, scene);
|
|
6380
|
-
await gs.loadFileAsync(url);
|
|
7651
|
+
async function loadSplatResult(url, scene, options) {
|
|
6381
7652
|
return {
|
|
6382
|
-
meshes: [
|
|
7653
|
+
meshes: [await new SPLATFileLoader(options)._loadUrlAsync(scene, url)],
|
|
6383
7654
|
particleSystems: [],
|
|
6384
7655
|
skeletons: [],
|
|
6385
7656
|
animationGroups: [],
|
|
@@ -6392,10 +7663,11 @@ function joinUrl(rootUrl, fileName) {
|
|
|
6392
7663
|
if (/^(https?:)?\/\//.test(fileName) || fileName.startsWith("/")) return fileName;
|
|
6393
7664
|
return rootUrl.endsWith("/") || rootUrl === "" ? rootUrl + fileName : rootUrl + "/" + fileName;
|
|
6394
7665
|
}
|
|
6395
|
-
async function load(rootUrl, fileName, scene) {
|
|
7666
|
+
async function load(rootUrl, fileName, scene, usdOptions) {
|
|
6396
7667
|
const url = joinUrl(rootUrl, fileName);
|
|
6397
7668
|
const engine = scene.getEngine()._lite;
|
|
6398
|
-
if (!isBabylonUrl(url)) enableBoneControlForSkinnedAssets();
|
|
7669
|
+
if (!isBabylonUrl(url) && !isUsdUrl(url)) enableBoneControlForSkinnedAssets();
|
|
7670
|
+
if (isUsdUrl(url)) return loadUsdContainer(engine, url, usdOptions);
|
|
6399
7671
|
return new AssetContainer(isBabylonUrl(url) ? await loadBabylon(engine, url) : await loadGltf(engine, url));
|
|
6400
7672
|
}
|
|
6401
7673
|
/** Babylon.js `SceneLoader` — async glTF/.babylon loading into a compat scene. */
|
|
@@ -6428,6 +7700,7 @@ var SceneLoader = {
|
|
|
6428
7700
|
},
|
|
6429
7701
|
/** Load an asset into a container without adding it to the scene. */
|
|
6430
7702
|
async LoadAssetContainerAsync(rootUrl, sceneFilename, scene) {
|
|
7703
|
+
if (isSplatUrl(joinUrl(rootUrl, sceneFilename))) return new SPLATFileLoader().loadAssetContainerAsync(scene, "", rootUrl);
|
|
6431
7704
|
return load(rootUrl, sceneFilename, scene);
|
|
6432
7705
|
},
|
|
6433
7706
|
/** Plugin registration — out of scope (side-effectful global registry). */
|
|
@@ -6438,9 +7711,9 @@ var SceneLoader = {
|
|
|
6438
7711
|
/** Babylon.js `ImportMeshAsync(source, scene, options?)` — imports an asset into the scene. */
|
|
6439
7712
|
async function ImportMeshAsync(source, scene, options) {
|
|
6440
7713
|
const url = joinUrl(options?.rootUrl ?? "", source);
|
|
6441
|
-
if (isSplatUrl(url)) return loadSplatResult(url, scene);
|
|
7714
|
+
if (isSplatUrl(url)) return loadSplatResult(url, scene, options?.pluginOptions?.splat);
|
|
6442
7715
|
validateGltfOptions(url, options);
|
|
6443
|
-
const container = await loadFromSource(url, scene);
|
|
7716
|
+
const container = await loadFromSource(url, scene, options?.pluginOptions?.usd, options?.onProgress);
|
|
6444
7717
|
container.addAllToScene(scene);
|
|
6445
7718
|
return {
|
|
6446
7719
|
meshes: container.meshes,
|
|
@@ -6456,25 +7729,38 @@ async function ImportMeshAsync(source, scene, options) {
|
|
|
6456
7729
|
async function AppendSceneAsync(source, scene, options) {
|
|
6457
7730
|
const url = joinUrl(options?.rootUrl ?? "", source);
|
|
6458
7731
|
if (isSplatUrl(url)) {
|
|
6459
|
-
await loadSplatResult(url, scene);
|
|
7732
|
+
await loadSplatResult(url, scene, options?.pluginOptions?.splat);
|
|
6460
7733
|
return scene;
|
|
6461
7734
|
}
|
|
6462
7735
|
validateGltfOptions(url, options);
|
|
6463
|
-
(await loadFromSource(url, scene)).addAllToScene(scene);
|
|
7736
|
+
(await loadFromSource(url, scene, options?.pluginOptions?.usd, options?.onProgress)).addAllToScene(scene);
|
|
6464
7737
|
return scene;
|
|
6465
7738
|
}
|
|
6466
7739
|
/** Babylon.js `LoadAssetContainerAsync(source, scene, options?)` — loads into a container without adding. */
|
|
6467
7740
|
async function LoadAssetContainerAsync(source, scene, options) {
|
|
6468
7741
|
const url = joinUrl(options?.rootUrl ?? "", source);
|
|
7742
|
+
if (isSplatUrl(url)) return new SPLATFileLoader(options?.pluginOptions?.splat).loadAssetContainerAsync(scene, "", options?.rootUrl ?? "");
|
|
6469
7743
|
validateGltfOptions(url, options);
|
|
6470
|
-
return loadFromSource(url, scene);
|
|
7744
|
+
return loadFromSource(url, scene, options?.pluginOptions?.usd, options?.onProgress);
|
|
6471
7745
|
}
|
|
6472
7746
|
/** @internal Load a glTF/.babylon asset from a single source URL (function-loader form). */
|
|
6473
|
-
async function loadFromSource(source, scene) {
|
|
7747
|
+
async function loadFromSource(source, scene, usdOptions, onProgress) {
|
|
6474
7748
|
const engine = scene.getEngine()._lite;
|
|
6475
|
-
if (!isBabylonUrl(source)) enableBoneControlForSkinnedAssets();
|
|
7749
|
+
if (!isBabylonUrl(source) && !isUsdUrl(source)) enableBoneControlForSkinnedAssets();
|
|
7750
|
+
if (isUsdUrl(source)) return loadUsdContainer(engine, source, usdOptions, onProgress);
|
|
6476
7751
|
return new AssetContainer(isBabylonUrl(source) ? await loadBabylon(engine, source) : await loadGltf(engine, source));
|
|
6477
7752
|
}
|
|
7753
|
+
async function loadUsdContainer(engine, source, options = {}, onProgress) {
|
|
7754
|
+
const lite = await loadUsd(engine, source, toLiteUsdOptions(resolveUsdOptions(options), void 0, onProgress));
|
|
7755
|
+
const container = new AssetContainer(lite, () => disposeUsd(lite), lite._usdMeshes);
|
|
7756
|
+
try {
|
|
7757
|
+
options.onComplete?.(lite.diagnostics);
|
|
7758
|
+
return container;
|
|
7759
|
+
} catch (error) {
|
|
7760
|
+
container.dispose();
|
|
7761
|
+
throw error;
|
|
7762
|
+
}
|
|
7763
|
+
}
|
|
6478
7764
|
//#endregion
|
|
6479
7765
|
//#region src/loading/assets-manager.ts
|
|
6480
7766
|
/**
|
|
@@ -6619,6 +7905,89 @@ var KHR_materials_variants = {
|
|
|
6619
7905
|
}
|
|
6620
7906
|
};
|
|
6621
7907
|
//#endregion
|
|
7908
|
+
//#region src/loading/usd-file-loader.ts
|
|
7909
|
+
function requireBinary(data) {
|
|
7910
|
+
if (!(data instanceof ArrayBuffer) && !ArrayBuffer.isView(data)) throw new Error("USDFileLoader expects binary USD data.");
|
|
7911
|
+
return data;
|
|
7912
|
+
}
|
|
7913
|
+
var USDFileLoader = class USDFileLoader {
|
|
7914
|
+
static get DefaultConfiguration() {
|
|
7915
|
+
return getUsdDefaultConfiguration();
|
|
7916
|
+
}
|
|
7917
|
+
static set DefaultConfiguration(configuration) {
|
|
7918
|
+
setUsdDefaultConfiguration(configuration);
|
|
7919
|
+
}
|
|
7920
|
+
name = "usd";
|
|
7921
|
+
extensions = {
|
|
7922
|
+
".usd": { isBinary: true },
|
|
7923
|
+
".usda": { isBinary: true },
|
|
7924
|
+
".usdc": { isBinary: true },
|
|
7925
|
+
".usdz": { isBinary: true }
|
|
7926
|
+
};
|
|
7927
|
+
_options;
|
|
7928
|
+
_activeLoads = /* @__PURE__ */ new Set();
|
|
7929
|
+
constructor(options = {}) {
|
|
7930
|
+
this._options = {
|
|
7931
|
+
...getUsdDefaultConfiguration(),
|
|
7932
|
+
...options
|
|
7933
|
+
};
|
|
7934
|
+
}
|
|
7935
|
+
createPlugin(options) {
|
|
7936
|
+
return new USDFileLoader(options.usd);
|
|
7937
|
+
}
|
|
7938
|
+
async importMeshAsync(_meshNames, scene, data, _rootUrl, onProgress, fileName) {
|
|
7939
|
+
const container = await this._load(scene, data, onProgress, fileName, true);
|
|
7940
|
+
return {
|
|
7941
|
+
meshes: container.meshes,
|
|
7942
|
+
particleSystems: [],
|
|
7943
|
+
skeletons: container.skeletons,
|
|
7944
|
+
animationGroups: container.animationGroups,
|
|
7945
|
+
transformNodes: [],
|
|
7946
|
+
lights: []
|
|
7947
|
+
};
|
|
7948
|
+
}
|
|
7949
|
+
async loadAsync(scene, data, _rootUrl, onProgress, fileName) {
|
|
7950
|
+
await this._load(scene, data, onProgress, fileName, true);
|
|
7951
|
+
}
|
|
7952
|
+
async loadAssetContainerAsync(scene, data, _rootUrl, onProgress, fileName) {
|
|
7953
|
+
return this._load(scene, data, onProgress, fileName, false);
|
|
7954
|
+
}
|
|
7955
|
+
dispose() {
|
|
7956
|
+
const error = /* @__PURE__ */ new Error("USDFileLoader was disposed.");
|
|
7957
|
+
for (const controller of this._activeLoads) controller.abort(error);
|
|
7958
|
+
this._activeLoads.clear();
|
|
7959
|
+
}
|
|
7960
|
+
async _load(scene, data, onProgress, fileName, add) {
|
|
7961
|
+
const controller = new AbortController();
|
|
7962
|
+
this._activeLoads.add(controller);
|
|
7963
|
+
try {
|
|
7964
|
+
const lite = await loadUsd(scene.getEngine()._lite, requireBinary(data), toLiteUsdOptions(resolveUsdOptions({
|
|
7965
|
+
...this._options,
|
|
7966
|
+
rootFileName: this._options.rootFileName ?? fileName
|
|
7967
|
+
}), controller.signal, onProgress));
|
|
7968
|
+
const container = new AssetContainer(lite, () => disposeUsd(lite), lite._usdMeshes);
|
|
7969
|
+
try {
|
|
7970
|
+
controller.signal.throwIfAborted();
|
|
7971
|
+
if (add) {
|
|
7972
|
+
addToScene(scene._lite, lite);
|
|
7973
|
+
container._adoptScene(scene);
|
|
7974
|
+
}
|
|
7975
|
+
this._options.onComplete?.(lite.diagnostics);
|
|
7976
|
+
controller.signal.throwIfAborted();
|
|
7977
|
+
return container;
|
|
7978
|
+
} catch (error) {
|
|
7979
|
+
container.dispose();
|
|
7980
|
+
throw error;
|
|
7981
|
+
}
|
|
7982
|
+
} finally {
|
|
7983
|
+
this._activeLoads.delete(controller);
|
|
7984
|
+
}
|
|
7985
|
+
}
|
|
7986
|
+
};
|
|
7987
|
+
function RegisterUSDFileLoader() {}
|
|
7988
|
+
/** @internal Babylon.js pure-registration hook; Lite has no global loader dependency registry. */
|
|
7989
|
+
function _RegisterUSDLoaderDependencies() {}
|
|
7990
|
+
//#endregion
|
|
6622
7991
|
//#region src/picking/gpu-picker.ts
|
|
6623
7992
|
/**
|
|
6624
7993
|
* Babylon.js-compatible `GPUPicker` over Babylon Lite's GPU picker
|
|
@@ -7494,6 +8863,10 @@ var SpriteManager = class {
|
|
|
7494
8863
|
addFacingBillboardSystem(scene._lite, system);
|
|
7495
8864
|
});
|
|
7496
8865
|
}
|
|
8866
|
+
/** Babylon.js `SpriteManager.isReady()` — an empty manager is ready without renderer preparation. */
|
|
8867
|
+
isReady() {
|
|
8868
|
+
return this._sprites.length === 0 || this._lite !== void 0;
|
|
8869
|
+
}
|
|
7497
8870
|
/** @internal Map the Babylon.js `Constants.ALPHA_*` blend mode to a Lite billboard blend. */
|
|
7498
8871
|
_mapBlendMode() {
|
|
7499
8872
|
if (this.blendMode === ALPHA_ONEONE || this.blendMode === ALPHA_ADD) return billboardBlendAdditive;
|
|
@@ -7702,6 +9075,10 @@ var SpriteRenderer = class {
|
|
|
7702
9075
|
});
|
|
7703
9076
|
});
|
|
7704
9077
|
}
|
|
9078
|
+
/** Babylon.js `SpriteRenderer.isReady()` — the next render can build once its atlas is loaded. */
|
|
9079
|
+
isReady() {
|
|
9080
|
+
return this._atlas !== void 0;
|
|
9081
|
+
}
|
|
7705
9082
|
/** @internal Map the Babylon.js blend mode to a Lite sprite blend descriptor. */
|
|
7706
9083
|
_blend() {
|
|
7707
9084
|
if (this.blendMode === ALPHA_PREMULTIPLIED) return spriteBlendPremultiplied;
|
|
@@ -8218,10 +9595,10 @@ function GetSupportedSimultaneousLights(scene, maxSimultaneousLights) {
|
|
|
8218
9595
|
//#endregion
|
|
8219
9596
|
//#region src/animations/easing.ts
|
|
8220
9597
|
/**
|
|
8221
|
-
* Babylon.js-compatible easing functions
|
|
9598
|
+
* Babylon.js-compatible easing functions over Babylon Lite's functional curves.
|
|
8222
9599
|
*
|
|
8223
|
-
* These
|
|
8224
|
-
*
|
|
9600
|
+
* These retain Babylon.js's class hierarchy and easing modes for porting while
|
|
9601
|
+
* delegating curve math to tree-shakable native Lite functions.
|
|
8225
9602
|
*/
|
|
8226
9603
|
var EASINGMODE_EASEIN = 0;
|
|
8227
9604
|
var EASINGMODE_EASEOUT = 1;
|
|
@@ -8247,33 +9624,32 @@ var EasingFunction = class {
|
|
|
8247
9624
|
};
|
|
8248
9625
|
var CircleEase = class extends EasingFunction {
|
|
8249
9626
|
easeInCore(gradient) {
|
|
8250
|
-
|
|
8251
|
-
return 1 - Math.sqrt(1 - g * g);
|
|
9627
|
+
return circleEase(gradient);
|
|
8252
9628
|
}
|
|
8253
9629
|
};
|
|
8254
9630
|
var QuadraticEase = class extends EasingFunction {
|
|
8255
9631
|
easeInCore(gradient) {
|
|
8256
|
-
return gradient
|
|
9632
|
+
return quadraticEase(gradient);
|
|
8257
9633
|
}
|
|
8258
9634
|
};
|
|
8259
9635
|
var CubicEase = class extends EasingFunction {
|
|
8260
9636
|
easeInCore(gradient) {
|
|
8261
|
-
return gradient
|
|
9637
|
+
return cubicEase(gradient);
|
|
8262
9638
|
}
|
|
8263
9639
|
};
|
|
8264
9640
|
var QuarticEase = class extends EasingFunction {
|
|
8265
9641
|
easeInCore(gradient) {
|
|
8266
|
-
return gradient
|
|
9642
|
+
return quarticEase(gradient);
|
|
8267
9643
|
}
|
|
8268
9644
|
};
|
|
8269
9645
|
var QuinticEase = class extends EasingFunction {
|
|
8270
9646
|
easeInCore(gradient) {
|
|
8271
|
-
return gradient
|
|
9647
|
+
return quinticEase(gradient);
|
|
8272
9648
|
}
|
|
8273
9649
|
};
|
|
8274
9650
|
var SineEase = class extends EasingFunction {
|
|
8275
9651
|
easeInCore(gradient) {
|
|
8276
|
-
return
|
|
9652
|
+
return sineEase(gradient);
|
|
8277
9653
|
}
|
|
8278
9654
|
};
|
|
8279
9655
|
var ExponentialEase = class extends EasingFunction {
|
|
@@ -8283,8 +9659,7 @@ var ExponentialEase = class extends EasingFunction {
|
|
|
8283
9659
|
this.exponent = exponent;
|
|
8284
9660
|
}
|
|
8285
9661
|
easeInCore(gradient) {
|
|
8286
|
-
|
|
8287
|
-
return (Math.exp(this.exponent * gradient) - 1) / (Math.exp(this.exponent) - 1);
|
|
9662
|
+
return exponentialEase(gradient, this.exponent);
|
|
8288
9663
|
}
|
|
8289
9664
|
};
|
|
8290
9665
|
var BackEase = class extends EasingFunction {
|
|
@@ -8294,8 +9669,7 @@ var BackEase = class extends EasingFunction {
|
|
|
8294
9669
|
this.amplitude = amplitude;
|
|
8295
9670
|
}
|
|
8296
9671
|
easeInCore(gradient) {
|
|
8297
|
-
|
|
8298
|
-
return Math.pow(gradient, 3) - gradient * num * Math.sin(Math.PI * gradient);
|
|
9672
|
+
return backEase(gradient, this.amplitude);
|
|
8299
9673
|
}
|
|
8300
9674
|
};
|
|
8301
9675
|
var ElasticEase = class extends EasingFunction {
|
|
@@ -8307,9 +9681,7 @@ var ElasticEase = class extends EasingFunction {
|
|
|
8307
9681
|
this.springiness = springiness;
|
|
8308
9682
|
}
|
|
8309
9683
|
easeInCore(gradient) {
|
|
8310
|
-
|
|
8311
|
-
const num3 = Math.max(0, this.springiness);
|
|
8312
|
-
return (num3 === 0 ? gradient : (Math.exp(num3 * gradient) - 1) / (Math.exp(num3) - 1)) * Math.sin((2 * Math.PI * num2 + Math.PI / 2) * gradient);
|
|
9684
|
+
return elasticEase(gradient, this.oscillations, this.springiness);
|
|
8313
9685
|
}
|
|
8314
9686
|
};
|
|
8315
9687
|
var BounceEase = class extends EasingFunction {
|
|
@@ -8321,21 +9693,39 @@ var BounceEase = class extends EasingFunction {
|
|
|
8321
9693
|
this.bounciness = bounciness;
|
|
8322
9694
|
}
|
|
8323
9695
|
easeInCore(gradient) {
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
9696
|
+
return bounceEase(gradient, this.bounces, this.bounciness);
|
|
9697
|
+
}
|
|
9698
|
+
};
|
|
9699
|
+
/**
|
|
9700
|
+
* Babylon.js-compatible power easing class.
|
|
9701
|
+
*/
|
|
9702
|
+
var PowerEase = class extends EasingFunction {
|
|
9703
|
+
power;
|
|
9704
|
+
constructor(power = 2) {
|
|
9705
|
+
super();
|
|
9706
|
+
this.power = power;
|
|
9707
|
+
}
|
|
9708
|
+
easeInCore(gradient) {
|
|
9709
|
+
return powerEase(gradient, this.power);
|
|
9710
|
+
}
|
|
9711
|
+
};
|
|
9712
|
+
/**
|
|
9713
|
+
* Babylon.js-compatible cubic Bezier easing class.
|
|
9714
|
+
*/
|
|
9715
|
+
var BezierCurveEase = class extends EasingFunction {
|
|
9716
|
+
x1;
|
|
9717
|
+
y1;
|
|
9718
|
+
x2;
|
|
9719
|
+
y2;
|
|
9720
|
+
constructor(x1 = 0, y1 = 0, x2 = 1, y2 = 1) {
|
|
9721
|
+
super();
|
|
9722
|
+
this.x1 = x1;
|
|
9723
|
+
this.y1 = y1;
|
|
9724
|
+
this.x2 = x2;
|
|
9725
|
+
this.y2 = y2;
|
|
9726
|
+
}
|
|
9727
|
+
easeInCore(gradient) {
|
|
9728
|
+
return bezierCurveEase(gradient, this.x1, this.y1, this.x2, this.y2);
|
|
8339
9729
|
}
|
|
8340
9730
|
};
|
|
8341
9731
|
//#endregion
|
|
@@ -9977,16 +11367,7 @@ var MaterialPluginBase = class MaterialPluginBase {
|
|
|
9977
11367
|
* replaced by a real wrapper (and its `COMPAT-STATUS.md` row upgraded).
|
|
9978
11368
|
*/
|
|
9979
11369
|
var FLUID_RENDERER_UNSUPPORTED = "Fluid rendering requires dedicated depth, thickness, and diffuse passes plus render-target lifecycle and composition policies that Babylon Lite does not define.";
|
|
9980
|
-
var USD_LOADER_UNSUPPORTED = "OpenUSD loading requires an OpenUSD WebAssembly worker, virtual-file staging, command-buffer extraction, and a USD-to-Lite scene/material materializer; those form a new loader subsystem with unresolved ownership and material-mapping design.";
|
|
9981
11370
|
var DITHERED_TILE_FADE_UNSUPPORTED = "Lite's material-plugin bridge supports shared shader injection, but not Babylon.js per-draw mesh uniforms, hardware-instance bounds, or custom thin-instance attributes/varyings. Adding those requires an opt-in per-renderable plugin-data design.";
|
|
9982
|
-
var USDFileLoader = class {
|
|
9983
|
-
constructor(_options = {}) {
|
|
9984
|
-
unsupported("USDFileLoader", USD_LOADER_UNSUPPORTED);
|
|
9985
|
-
}
|
|
9986
|
-
};
|
|
9987
|
-
function RegisterUSDFileLoader() {
|
|
9988
|
-
return unsupported("RegisterUSDFileLoader", USD_LOADER_UNSUPPORTED);
|
|
9989
|
-
}
|
|
9990
11371
|
var FLOW_GRAPH_UNSUPPORTED = "Babylon Lite's flow-graph runtime does not expose Babylon.js FlowGraph blocks, connections, or contexts. Validation requires a stable cross-model graph adapter and block registry design.";
|
|
9991
11372
|
var FlowGraphValidationSeverity = /* @__PURE__ */ function(FlowGraphValidationSeverity) {
|
|
9992
11373
|
FlowGraphValidationSeverity[FlowGraphValidationSeverity["Error"] = 0] = "Error";
|
|
@@ -10033,6 +11414,112 @@ var FluidRendererSceneComponent = class {
|
|
|
10033
11414
|
function RegisterFluidRenderer() {
|
|
10034
11415
|
unsupported("RegisterFluidRenderer", FLUID_RENDERER_UNSUPPORTED);
|
|
10035
11416
|
}
|
|
11417
|
+
var ROOT_MOTION_UNSUPPORTED = "Babylon.js root motion analyzes animation hierarchies, rewrites in-place clips, journals mixer writes, and applies blended per-frame travel. Lite exposes animation playback but not that analysis and mixer-journal subsystem; its lifecycle and ownership require a Lite-level design.";
|
|
11418
|
+
var RootMotionSource = /* @__PURE__ */ function(RootMotionSource) {
|
|
11419
|
+
RootMotionSource[RootMotionSource["None"] = 0] = "None";
|
|
11420
|
+
RootMotionSource[RootMotionSource["Root"] = 1] = "Root";
|
|
11421
|
+
RootMotionSource[RootMotionSource["FootContact"] = 2] = "FootContact";
|
|
11422
|
+
return RootMotionSource;
|
|
11423
|
+
}({});
|
|
11424
|
+
var RootMotionClip = class {
|
|
11425
|
+
constructor(_animationGroup, _options = {}) {
|
|
11426
|
+
unsupported("RootMotionClip", ROOT_MOTION_UNSUPPORTED);
|
|
11427
|
+
}
|
|
11428
|
+
get sourceAnimationGroup() {
|
|
11429
|
+
return unsupported("RootMotionClip.sourceAnimationGroup", ROOT_MOTION_UNSUPPORTED);
|
|
11430
|
+
}
|
|
11431
|
+
get animationGroup() {
|
|
11432
|
+
return unsupported("RootMotionClip.animationGroup", ROOT_MOTION_UNSUPPORTED);
|
|
11433
|
+
}
|
|
11434
|
+
get controller() {
|
|
11435
|
+
return unsupported("RootMotionClip.controller", ROOT_MOTION_UNSUPPORTED);
|
|
11436
|
+
}
|
|
11437
|
+
get source() {
|
|
11438
|
+
return unsupported("RootMotionClip.source", ROOT_MOTION_UNSUPPORTED);
|
|
11439
|
+
}
|
|
11440
|
+
get rootNode() {
|
|
11441
|
+
return unsupported("RootMotionClip.rootNode", ROOT_MOTION_UNSUPPORTED);
|
|
11442
|
+
}
|
|
11443
|
+
get characterNode() {
|
|
11444
|
+
return unsupported("RootMotionClip.characterNode", ROOT_MOTION_UNSUPPORTED);
|
|
11445
|
+
}
|
|
11446
|
+
get contactNodes() {
|
|
11447
|
+
return unsupported("RootMotionClip.contactNodes", ROOT_MOTION_UNSUPPORTED);
|
|
11448
|
+
}
|
|
11449
|
+
get upAxis() {
|
|
11450
|
+
return unsupported("RootMotionClip.upAxis", ROOT_MOTION_UNSUPPORTED);
|
|
11451
|
+
}
|
|
11452
|
+
get fromFrame() {
|
|
11453
|
+
return unsupported("RootMotionClip.fromFrame", ROOT_MOTION_UNSUPPORTED);
|
|
11454
|
+
}
|
|
11455
|
+
get toFrame() {
|
|
11456
|
+
return unsupported("RootMotionClip.toFrame", ROOT_MOTION_UNSUPPORTED);
|
|
11457
|
+
}
|
|
11458
|
+
get travelDirection() {
|
|
11459
|
+
return unsupported("RootMotionClip.travelDirection", ROOT_MOTION_UNSUPPORTED);
|
|
11460
|
+
}
|
|
11461
|
+
get cycleOffset() {
|
|
11462
|
+
return unsupported("RootMotionClip.cycleOffset", ROOT_MOTION_UNSUPPORTED);
|
|
11463
|
+
}
|
|
11464
|
+
get cycleDistance() {
|
|
11465
|
+
return unsupported("RootMotionClip.cycleDistance", ROOT_MOTION_UNSUPPORTED);
|
|
11466
|
+
}
|
|
11467
|
+
get cycleRotation() {
|
|
11468
|
+
return unsupported("RootMotionClip.cycleRotation", ROOT_MOTION_UNSUPPORTED);
|
|
11469
|
+
}
|
|
11470
|
+
get extractsRotation() {
|
|
11471
|
+
return unsupported("RootMotionClip.extractsRotation", ROOT_MOTION_UNSUPPORTED);
|
|
11472
|
+
}
|
|
11473
|
+
get duration() {
|
|
11474
|
+
return unsupported("RootMotionClip.duration", ROOT_MOTION_UNSUPPORTED);
|
|
11475
|
+
}
|
|
11476
|
+
get averageSpeed() {
|
|
11477
|
+
return unsupported("RootMotionClip.averageSpeed", ROOT_MOTION_UNSUPPORTED);
|
|
11478
|
+
}
|
|
11479
|
+
get characterHeight() {
|
|
11480
|
+
return unsupported("RootMotionClip.characterHeight", ROOT_MOTION_UNSUPPORTED);
|
|
11481
|
+
}
|
|
11482
|
+
getOffsetAtFrame(_frame, _result) {
|
|
11483
|
+
return unsupported("RootMotionClip.getOffsetAtFrame", ROOT_MOTION_UNSUPPORTED);
|
|
11484
|
+
}
|
|
11485
|
+
getRotationAtFrame(_frame) {
|
|
11486
|
+
return unsupported("RootMotionClip.getRotationAtFrame", ROOT_MOTION_UNSUPPORTED);
|
|
11487
|
+
}
|
|
11488
|
+
dispose() {
|
|
11489
|
+
unsupported("RootMotionClip.dispose", ROOT_MOTION_UNSUPPORTED);
|
|
11490
|
+
}
|
|
11491
|
+
};
|
|
11492
|
+
var RootMotionController = class {
|
|
11493
|
+
applyToCharacter = true;
|
|
11494
|
+
onRootMotionObservable;
|
|
11495
|
+
constructor(_characterNode, _clips = []) {
|
|
11496
|
+
unsupported("RootMotionController", ROOT_MOTION_UNSUPPORTED);
|
|
11497
|
+
}
|
|
11498
|
+
get characterNode() {
|
|
11499
|
+
return unsupported("RootMotionController.characterNode", ROOT_MOTION_UNSUPPORTED);
|
|
11500
|
+
}
|
|
11501
|
+
get clips() {
|
|
11502
|
+
return unsupported("RootMotionController.clips", ROOT_MOTION_UNSUPPORTED);
|
|
11503
|
+
}
|
|
11504
|
+
get deltaPosition() {
|
|
11505
|
+
return unsupported("RootMotionController.deltaPosition", ROOT_MOTION_UNSUPPORTED);
|
|
11506
|
+
}
|
|
11507
|
+
get deltaRotation() {
|
|
11508
|
+
return unsupported("RootMotionController.deltaRotation", ROOT_MOTION_UNSUPPORTED);
|
|
11509
|
+
}
|
|
11510
|
+
addClip(_clip) {
|
|
11511
|
+
unsupported("RootMotionController.addClip", ROOT_MOTION_UNSUPPORTED);
|
|
11512
|
+
}
|
|
11513
|
+
removeClip(_clip) {
|
|
11514
|
+
unsupported("RootMotionController.removeClip", ROOT_MOTION_UNSUPPORTED);
|
|
11515
|
+
}
|
|
11516
|
+
reset() {
|
|
11517
|
+
unsupported("RootMotionController.reset", ROOT_MOTION_UNSUPPORTED);
|
|
11518
|
+
}
|
|
11519
|
+
dispose() {
|
|
11520
|
+
unsupported("RootMotionController.dispose", ROOT_MOTION_UNSUPPORTED);
|
|
11521
|
+
}
|
|
11522
|
+
};
|
|
10036
11523
|
var MultiMaterial = class {
|
|
10037
11524
|
constructor() {
|
|
10038
11525
|
unsupported("MultiMaterial", "Babylon Lite uses one material per renderable. Split the mesh geometry by material into separate meshes instead.");
|
|
@@ -11314,6 +12801,6 @@ var NodeParticleSystemSet = class NodeParticleSystemSet {
|
|
|
11314
12801
|
}
|
|
11315
12802
|
};
|
|
11316
12803
|
//#endregion
|
|
11317
|
-
export { AbstractAssetTask, AbstractAudioAnalyzer, AbstractAudioBus, AbstractAudioNode, AbstractAudioOutNode, AbstractEngine, AbstractMesh, AbstractNamedAudioNode, AbstractScene, AbstractSound, AbstractSoundSource, AbstractSpatialAudio, AbstractSpatialAudioListener, AbstractStereoAudio, Action, ActionManager, ActionManagerTriggers, AddGaussianSplattingStreamPart, AddGaussianSplattingStreamPartAsync, AmmoJSPlugin, AnaglyphArcRotateCamera, Angle, Animatable, Animation, AnimationGroup, AnimationKeyInterpolation, AnimationLoopModes, AnimationTypes, AppendSceneAsync, ArcRotateCamera, AssetContainer, AssetsManager, AttachToBoxBehavior, AudioBus, AudioEngine, AudioEngineV2, AudioParameterRampShape, AutoRotationBehavior, Axis, AxisDragGizmo, AxisScaleGizmo, BVHFileLoader, BackEase, BackgroundMaterial, BallAndSocketConstraint, BaseSixDofDragBehavior, BaseTexture, BlackAndWhitePostProcess, BloomEffect, BlurPostProcess, Bone, BounceEase, BouncingBehavior, BoundingBox, BoundingBoxGizmo, BoundingBoxRenderer, BoundingInfo, BoundingSphere, CSG, CSG2, Camera, CameraGizmo, CannonJSPlugin, CascadedShadowGenerator, CastingResult, CharacterSupportedState, ChromaticAberrationPostProcess, CircleEase, ClusteredLightContainer, Color3, Color4, ColorGradient, CompleteGreasedLineColorTable, CompleteGreasedLineWidthTable, ComputeOverlayCssTransform, Condition, Constants, CreateAudioBusAsync, CreateAudioEngineAsync, CreateBox, CreateCylinder, CreateDashedLines, CreateDefaultMeshBlendRadiusDefinitions, CreateDisc, CreateGreasedLine, CreateGreasedLineMaterial, CreateGround, CreateLineSystem, CreateLines, CreateMainAudioBusAsync, CreateMicrophoneSoundSourceAsync, CreatePlane, CreateSoundAsync, CreateSoundBufferAsync, CreateSoundSourceAsync, CreateSphere, CreateStreamingSoundAsync, CreateTexture2DArrayFromImageUrlsAsync, CreateTexture2DArrayFromKTX2Async, CreateTiledBox, CreateTiledPlane, CreateTorus, CubeTexture, CubicEase, Curve3, CustomAssetTask, DefaultRenderingPipeline, DepthOfFieldEffect, DepthRenderer, DeviceOrientationCamera, DirectionalLight, DistanceConstraint, DitheredTileFadeMaterialPlugin, DynamicTexture, EASINGMODE_EASEIN, EASINGMODE_EASEINOUT, EASINGMODE_EASEOUT, EasingFunction, EdgesRenderer, EffectLayer, ElasticEase, Engine, Epsilon, ExecuteCodeAction, ExponentialEase, FBXConstraintBehavior, FBXConstraintSolver, FBXFileLoader, FBXFileLoaderMetadata, FSR1RenderingPipeline, FactorGradient, FadeInOutBehavior, FlowGraphValidationSeverity, FluidRenderer, FluidRendererSceneComponent, FluidRenderingObject, FluidRenderingObjectCustomParticles, FluidRenderingObjectParticleSystem, FluidRenderingTargetRenderer, FlyCamera, FollowBehavior, FollowCamera, FrameGraphMeshBlendingTask, FramingBehavior, FreeCamera, Frustum, FxaaPostProcess, gltf1_exports as GLTF1, gltf2_exports as GLTF2, GPUParticleSystem, GPUPicker, GUID, GamepadCamera, GaussianSplattingMesh, GaussianSplattingStream, GeometryBufferRenderer, GeospatialCamera, GeospatialClippingBehavior, GetElementPixelFromUv, GetPointsCount, GetSupportedSimultaneousLights, GetWhiteBalanceMatrix, GizmoManager, GlowLayer, GreasedLineBaseMesh, GreasedLineMaterialDefaults, GreasedLineMesh, GreasedLineMeshColorDistribution, GreasedLineMeshWidthDistribution, GreasedLinePluginMaterial, GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonMesh, GreasedLineRibbonPointsMode, GreasedLineSimpleMaterial, GreasedLineTools, GridMaterial, GroundMesh, HDRCubeTexture, HandConstraintBehavior, HavokPlugin, HemisphericLight, HighlightLayer, HingeConstraint, HtmlInteractionManager, HtmlRaycastInteractionManager, HtmlTexture, ImageProcessingConfiguration, ImportMeshAsync, IncrementValueAction, InitializeCSG2Async, InstallHtmlInCanvasPolyfill, InstancedMesh, InterpolatingBehavior, IsHtmlInCanvasSupportedNatively, IsHtmlInCanvasUploadSupported, KHR_materials_variants, LastCreatedAudioEngine, Layer, Light, LightGizmo, LinesMesh, LiteCompatError, LoadAssetContainerAsync, LoadImageToTexture2DArrayLayerAsync, LockConstraint, Logger, MainAudioBus, Material, MaterialGreasedLineDefines, MaterialPluginBase, MaterialPluginManager, Matrix, MaxTintMagnitude, Mesh, MeshBlendDebugMode, MeshBlendDepthType, MeshBlendQuality, MeshBlendingPostProcess, MeshBlendingRadiusClass, MeshBuilder, MeshoptCompression, MinTemperatureKelvin, MirrorTexture, MorphTarget, MorphTargetManager, MultiMaterial, MultiPointerScaleBehavior, Node, NodeMaterial, NodeParticleSystemSet, NodeRenderGraphMeshBlendingPostProcessBlock, NullEngine, OBJFileLoader, Observable, OnAudioEngineV2CreatedObservable, OpenPBRMaterial, OpenPBRMaterialDefines, OpenPBRMaterialLoadingAdapter, OutlineRenderer, PBRAnisotropicConfiguration, PBRClearCoatConfiguration, PBRIridescenceConfiguration, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSheenConfiguration, PBRSpecularGlossinessMaterial, PackMeshBlendingTag, ParticleHelper, ParticleSystem, ParticleSystemSet, Path3D, PerformanceMonitor, Physics6DoFConstraint, Physics6DoFLimit, PhysicsAggregate, PhysicsBody, PhysicsCharacterController, PhysicsConstraint, PhysicsConstraintAxis, PhysicsConstraintType, PhysicsEngine, PhysicsMotionType, PhysicsPrestepType, PhysicsRaycastResult, PhysicsShape, PhysicsShapeType, PickingInfo, Plane, PlaneDragGizmo, PlaneRotationGizmo, PointLight, PointerDragBehavior, PointerEventTypes, PointerInfo, PointsCloudSystem, Polar, PositionGizmo, PostProcess, PrecisionDate, PredicateCondition, PrismaticConstraint, PushMaterial, QuadraticEase, QuarticEase, Quaternion, QuinticEase, RandomGUID, RawTexture, RawTexture2DArray, RawTexture3D, Ray, RecastJSPlugin, RectAreaLight, ReflectionProbe, RegisterAbstractEngineTextureLoaders, RegisterEnginesExtensionsEngineTexture2DArrayImageSource, RegisterEnginesWebGPUExtensionsEngineTexture2DArrayImageSource, RegisterFluidRenderer, RegisterGreasedLinePluginMaterial, RegisterImageProcessingConfiguration, RegisterMeshBlendingPostProcessBlock, RegisterOpenpbrMaterial, RegisterUSDFileLoader, RenderTargetTexture, RotationGizmo, SSAO2RenderingPipeline, STLFileLoader, Scalar, ScaleGizmo, Scene, SceneLoader, SceneOptimizer, ScenePerformancePriority, SceneSerializer, SetValueAction, ShaderLanguage, ShaderMaterial, ShadowGenerator, SineEase, SixDofDragBehavior, Size, Skeleton, SliderConstraint, SmartArray, SolidParticleSystem, Sound, SoundSource, SoundState, Space, SpatialAudioAttachmentType, Spherical, SpotLight, SpringConstraint, Sprite, SpriteManager, SpriteMap, SpritePackedManager, SpriteRenderer, StandardMaterial, StaticSound, StaticSoundBuffer, StreamingSound, StringDictionary, SurfaceMagnetismBehavior, Tags, TargetCamera, TemperatureTintToXyz, Texture, ThinEngine, ThinFSR1SharpenPostProcess, ThinFSR1UpscalePostProcess, ThinMeshBlendingPostProcess, ThinSprite, ToDegrees, ToRadians, Tools, TouchCamera, TransformNode, USDFileLoader, UninstallHtmlInCanvasPolyfill, UniversalCamera, UnpackMeshBlendingTag, UploadHtmlElementToTexture, UploadImageToTexture2DArrayLayer, UtilityLayerRenderer, ValidateFlowGraph, ValidateFlowGraphWithBlockList, ValueCondition, ValueConditionOperators, Vector2, Vector3, Vector4, VertexBuffer, VertexData, Viewport, VirtualJoystick, WebGPUEngine, WebXRCamera, WeightedSound, registerBuiltInLoaders, transformCoordinates, transformNormal, unsupported };
|
|
12804
|
+
export { AbstractAssetTask, AbstractAudioAnalyzer, AbstractAudioBus, AbstractAudioNode, AbstractAudioOutNode, AbstractEngine, AbstractMesh, AbstractNamedAudioNode, AbstractScene, AbstractSound, AbstractSoundSource, AbstractSpatialAudio, AbstractSpatialAudioListener, AbstractStereoAudio, Action, ActionManager, ActionManagerTriggers, AddGaussianSplattingStreamPart, AddGaussianSplattingStreamPartAsync, AmmoJSPlugin, AnaglyphArcRotateCamera, Angle, Animatable, Animation, AnimationGroup, AnimationKeyInterpolation, AnimationLoopModes, AnimationTypes, AppendSceneAsync, ArcRotateCamera, AssetContainer, AssetsManager, AttachToBoxBehavior, AudioBus, AudioEngine, AudioEngineV2, AudioParameterRampShape, AutoRotationBehavior, Axis, AxisDragGizmo, AxisScaleGizmo, BVHFileLoader, BackEase, BackgroundMaterial, BallAndSocketConstraint, BaseSixDofDragBehavior, BaseTexture, BezierCurveEase, BlackAndWhitePostProcess, BloomEffect, BlurPostProcess, Bone, BounceEase, BouncingBehavior, BoundingBox, BoundingBoxGizmo, BoundingBoxRenderer, BoundingInfo, BoundingSphere, CSG, CSG2, Camera, CameraGizmo, CannonJSPlugin, CascadedShadowGenerator, CastingResult, CharacterSupportedState, ChromaticAberrationPostProcess, CircleEase, ClusteredLightContainer, Color3, Color4, ColorGradient, CompleteGreasedLineColorTable, CompleteGreasedLineWidthTable, ComputeOverlayCssTransform, ComputeShader, ComputeShaderParse, Condition, Constants, CreateAudioBusAsync, CreateAudioEngineAsync, CreateBox, CreateCylinder, CreateDashedLines, CreateDefaultMeshBlendRadiusDefinitions, CreateDisc, CreateGreasedLine, CreateGreasedLineMaterial, CreateGround, CreateLineSystem, CreateLines, CreateMainAudioBusAsync, CreateMicrophoneSoundSourceAsync, CreatePlane, CreateSoundAsync, CreateSoundBufferAsync, CreateSoundSourceAsync, CreateSphere, CreateStreamingSoundAsync, CreateTexture2DArrayFromImageUrlsAsync, CreateTexture2DArrayFromKTX2Async, CreateTiledBox, CreateTiledPlane, CreateTorus, CubeTexture, CubicEase, Curve3, CustomAssetTask, DefaultRenderingPipeline, DepthOfFieldEffect, DepthRenderer, DeviceOrientationCamera, DirectionalLight, DistanceConstraint, DitheredTileFadeMaterialPlugin, DynamicTexture, EASINGMODE_EASEIN, EASINGMODE_EASEINOUT, EASINGMODE_EASEOUT, EasingFunction, EdgesRenderer, EffectLayer, ElasticEase, Engine, Epsilon, ExecuteCodeAction, ExponentialEase, FBXConstraintBehavior, FBXConstraintSolver, FBXFileLoader, FBXFileLoaderMetadata, FSR1RenderingPipeline, FactorGradient, FadeInOutBehavior, FlowGraphValidationSeverity, FluidRenderer, FluidRendererSceneComponent, FluidRenderingObject, FluidRenderingObjectCustomParticles, FluidRenderingObjectParticleSystem, FluidRenderingTargetRenderer, FlyCamera, FollowBehavior, FollowCamera, FrameGraphMeshBlendingTask, FramingBehavior, FreeCamera, Frustum, FxaaPostProcess, gltf1_exports as GLTF1, gltf2_exports as GLTF2, GPUParticleSystem, GPUPicker, GUID, GamepadCamera, GaussianSplattingMesh, GaussianSplattingStream, GeometryBufferRenderer, GeospatialCamera, GeospatialClippingBehavior, GetElementPixelFromUv, GetPointsCount, GetSupportedSimultaneousLights, GetWhiteBalanceMatrix, GizmoManager, GlowLayer, GreasedLineBaseMesh, GreasedLineMaterialDefaults, GreasedLineMesh, GreasedLineMeshColorDistribution, GreasedLineMeshWidthDistribution, GreasedLinePluginMaterial, GreasedLineRibbonAutoDirectionMode, GreasedLineRibbonFacesMode, GreasedLineRibbonMesh, GreasedLineRibbonPointsMode, GreasedLineSimpleMaterial, GreasedLineTools, GridMaterial, GroundMesh, HDRCubeTexture, HandConstraintBehavior, HavokPlugin, HemisphericLight, HighlightLayer, HingeConstraint, HtmlInteractionManager, HtmlRaycastInteractionManager, HtmlTexture, ImageProcessingConfiguration, ImportMeshAsync, IncrementValueAction, InitializeCSG2Async, InstallHtmlInCanvasPolyfill, InstancedMesh, InterpolatingBehavior, IsHtmlInCanvasSupportedNatively, IsHtmlInCanvasUploadSupported, KHR_materials_variants, LastCreatedAudioEngine, Layer, Light, LightGizmo, LinesMesh, LiteCompatError, LoadAssetContainerAsync, LoadImageToTexture2DArrayLayerAsync, LockConstraint, Logger, MainAudioBus, Material, MaterialGreasedLineDefines, MaterialPluginBase, MaterialPluginManager, Matrix, MaxTintMagnitude, Mesh, MeshBlendDebugMode, MeshBlendDepthType, MeshBlendQuality, MeshBlendingPostProcess, MeshBlendingRadiusClass, MeshBuilder, MeshoptCompression, MinTemperatureKelvin, MirrorTexture, MorphTarget, MorphTargetManager, MultiMaterial, MultiPointerScaleBehavior, Node, NodeMaterial, NodeParticleSystemSet, NodeRenderGraphMeshBlendingPostProcessBlock, NullEngine, OBJFileLoader, Observable, OnAudioEngineV2CreatedObservable, OpenPBRMaterial, OpenPBRMaterialDefines, OpenPBRMaterialLoadingAdapter, OutlineRenderer, PBRAnisotropicConfiguration, PBRClearCoatConfiguration, PBRIridescenceConfiguration, PBRMaterial, PBRMetallicRoughnessMaterial, PBRSheenConfiguration, PBRSpecularGlossinessMaterial, PackMeshBlendingTag, ParticleHelper, ParticleSystem, ParticleSystemSet, Path3D, PerformanceMonitor, Physics6DoFConstraint, Physics6DoFLimit, PhysicsAggregate, PhysicsBody, PhysicsCharacterController, PhysicsConstraint, PhysicsConstraintAxis, PhysicsConstraintType, PhysicsEngine, PhysicsMotionType, PhysicsPrestepType, PhysicsRaycastResult, PhysicsShape, PhysicsShapeType, PickingInfo, Plane, PlaneDragGizmo, PlaneRotationGizmo, PointLight, PointerDragBehavior, PointerEventTypes, PointerInfo, PointsCloudSystem, Polar, PositionGizmo, PostProcess, PowerEase, PrecisionDate, PredicateCondition, PrismaticConstraint, PushMaterial, QuadraticEase, QuarticEase, Quaternion, QuinticEase, RandomGUID, RawTexture, RawTexture2DArray, RawTexture3D, Ray, RecastJSPlugin, RectAreaLight, ReflectionProbe, RegisterAbstractEngineTextureLoaders, RegisterComputeShader, RegisterEnginesExtensionsEngineTexture2DArrayImageSource, RegisterEnginesWebGPUExtensionsEngineTexture2DArrayImageSource, RegisterFluidRenderer, RegisterGreasedLinePluginMaterial, RegisterImageProcessingConfiguration, RegisterMeshBlendingPostProcessBlock, RegisterOpenpbrMaterial, RegisterSPLATFileLoader, RegisterUSDFileLoader, RenderTargetTexture, RootMotionClip, RootMotionController, RootMotionSource, RotationGizmo, SPLATFileLoader, SSAO2RenderingPipeline, STLFileLoader, Scalar, ScaleGizmo, Scene, SceneLoader, SceneOptimizer, ScenePerformancePriority, SceneSerializer, SetValueAction, ShaderLanguage, ShaderMaterial, ShadowGenerator, SineEase, SixDofDragBehavior, Size, Skeleton, SliderConstraint, SmartArray, SolidParticleSystem, Sound, SoundSource, SoundState, Space, SpatialAudioAttachmentType, Spherical, SpotLight, SpringConstraint, Sprite, SpriteManager, SpriteMap, SpritePackedManager, SpriteRenderer, StandardMaterial, StaticSound, StaticSoundBuffer, StorageBuffer, StreamingSound, StringDictionary, SurfaceMagnetismBehavior, Tags, TargetCamera, TemperatureTintToXyz, Texture, ThinEngine, ThinFSR1SharpenPostProcess, ThinFSR1UpscalePostProcess, ThinMeshBlendingPostProcess, ThinSprite, ToDegrees, ToRadians, Tools, TouchCamera, TransformNode, USDFileLoader, UniformBuffer, UninstallHtmlInCanvasPolyfill, UniversalCamera, UnpackMeshBlendingTag, UploadHtmlElementToTexture, UploadImageToTexture2DArrayLayer, UtilityLayerRenderer, ValidateFlowGraph, ValidateFlowGraphWithBlockList, ValueCondition, ValueConditionOperators, Vector2, Vector3, Vector4, VertexBuffer, VertexData, Viewport, VirtualJoystick, WebGPUEngine, WebXRCamera, WeightedSound, _RegisterUSDLoaderDependencies, registerBuiltInLoaders, transformCoordinates, transformNormal, unsupported };
|
|
11318
12805
|
|
|
11319
12806
|
//# sourceMappingURL=index.js.map
|