@babylonjs/lite-compat 1.37.0-preview → 1.37.2-preview

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as Vector4, A as PBRClearCoatConfiguration, B as Observable, C as RegisterPolygonBuilder, D as registerMeshAtStart, E as VertexData, F as PBRSpecularGlossinessMaterial, G as transformCoordinates, H as BoundingInfo, I as PushMaterial, J as Color3, K as transformNormal, L as StandardMaterial, M as PBRMaterial, N as PBRMetallicRoughnessMaterial, O as Material, P as PBRSheenConfiguration, Q as Vector3, R as attachMaterialToScene, S as PolygonBuilder, T as VertexBuffer, U as BoundingSphere, V as BoundingBox, W as Matrix, X as liteBackedColor3, Y as Color4, Z as Vector2, _ as GroundMesh, a as CreateDisc, b as Mesh, c as CreateLines, d as CreatePolygonVertexData, et as liteBackedVector3, f as CreateSphere, g as ExtrudePolygon, h as CreateTorus, i as CreateDashedLines, j as PBRIridescenceConfiguration, k as PBRAnisotropicConfiguration, l as CreatePlane, m as CreateTiledPlane, n as CreateBox, nt as unsupported, o as CreateGround, p as CreateTiledBox, q as Quaternion, r as CreateCylinder, s as CreateLineSystem, t as AbstractMesh, tt as LiteCompatError, u as CreatePolygon, v as InstancedMesh, w as TransformNode, x as MeshBuilder, y as LinesMesh, z as Node } from "./meshes-zeNif9yt.js";
2
- import { CharacterSupportedState as CharacterSupportedState$1, GAUSSIAN_SPLATTING_MAX_PART_COUNT, MaxTintMagnitude, MinTemperatureKelvin, PhysicsConstraintAxis as PhysicsConstraintAxis$1, PhysicsConstraintType as PhysicsConstraintType$1, PhysicsMotionType as PhysicsMotionType$1, PhysicsPrestepType as PhysicsPrestepType$1, PhysicsShapeType as PhysicsShapeType$1, VERSION, _getGaussianPointSplattingPackedShBytesPerSplat, _hasGaussianPointSplattingProjectedDepth, 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, createExternalTexture, 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, encodeIdToColor, exponentialEase, getBoneByName, getByteFrequencyData, getByteTimeDomainData, getCameraPosition, getFloatFrequencyData, getFloatTimeDomainData, getGaussianSplattingMaxPartCount, getGaussianSplattingPartIndexVaryingDeclaration, getMasterVolume, getPhysicsBodyAngularVelocity, getPhysicsBodyLinearVelocity, getPickedUV, getProjectionMatrix, getVariantNames, getViewMatrix, getWhiteBalanceMatrix, goToFrame, hasDefaultInteractivityFlowInput, initializeCsg2Async, inverseLerp, invertMat4, isExternalTextureReady, loadBabylon, loadBasisTexture2D, loadDdsEnvironment, loadEnvironment, loadGltf, loadHdrEnvironment, loadImageToArrayLayer, loadKtxTexture2D, loadSOG, loadSPZ, loadSplat, loadSpriteAtlas, loadTexture2D, loadUsd, markClusteredLightContainerDirty, multiplyMat4, multiplyPolarToRef, multiplySphericalToRef, normalizeInteractivityEventDataConfiguration, normalizeKhrInteractivityRuntimeValue, onBeforeRender, onEngineDeviceLost, onPhysicsAfterStep, packMeshBlendingTag, parseNodeMaterialFromSnippet, parseNodeParticleSetFromSnippet, pauseAnimation, pauseSound, pauseStreamingSound, physicsRaycast, pickAsync, pickMeshesWithRayPrecise, 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";
1
+ import { $ as Vector4, A as PBRClearCoatConfiguration, B as Observable, C as RegisterPolygonBuilder, D as registerMeshAtStart, E as VertexData, F as PBRSpecularGlossinessMaterial, G as transformCoordinates, H as BoundingInfo, I as PushMaterial, J as Color3, K as transformNormal, L as StandardMaterial, M as PBRMaterial, N as PBRMetallicRoughnessMaterial, O as Material, P as PBRSheenConfiguration, Q as Vector3, R as attachMaterialToScene, S as PolygonBuilder, T as VertexBuffer, U as BoundingSphere, V as BoundingBox, W as Matrix, X as liteBackedColor3, Y as Color4, Z as Vector2, _ as GroundMesh, a as CreateDisc, b as Mesh, c as CreateLines, d as CreatePolygonVertexData, et as liteBackedVector3, f as CreateSphere, g as ExtrudePolygon, h as CreateTorus, i as CreateDashedLines, j as PBRIridescenceConfiguration, k as PBRAnisotropicConfiguration, l as CreatePlane, m as CreateTiledPlane, n as CreateBox, nt as unsupported, o as CreateGround, p as CreateTiledBox, q as Quaternion, r as CreateCylinder, s as CreateLineSystem, t as AbstractMesh, tt as LiteCompatError, u as CreatePolygon, v as InstancedMesh, w as TransformNode, x as MeshBuilder, y as LinesMesh, z as Node } from "./meshes-sOWGK4P8.js";
2
+ import { CharacterSupportedState as CharacterSupportedState$1, GAUSSIAN_SPLATTING_MAX_PART_COUNT, MaxTintMagnitude, MinTemperatureKelvin, PhysicsConstraintAxis as PhysicsConstraintAxis$1, PhysicsConstraintType as PhysicsConstraintType$1, PhysicsMotionType as PhysicsMotionType$1, PhysicsPrestepType as PhysicsPrestepType$1, PhysicsShapeType as PhysicsShapeType$1, VERSION, _getGaussianPointSplattingPackedShBytesPerSplat, _hasGaussianPointSplattingProjectedDepth, 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, createExternalTexture, 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, createRectAreaLight, 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, disableGaussianPointSplatting, 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, enableGaussianPointSplatting, enableHavokThinInstancePhysicsSync, enableMirroredMeshes, enableOrthographicCamera, enableRectAreaLights, enableSpatial, enableStereo, encodeIdToColor, exponentialEase, getBoneByName, getByteFrequencyData, getByteTimeDomainData, getCameraPosition, getFloatFrequencyData, getFloatTimeDomainData, getGaussianSplattingMaxPartCount, getGaussianSplattingPartIndexVaryingDeclaration, getMasterVolume, getPhysicsBodyAngularVelocity, getPhysicsBodyLinearVelocity, getPickedUV, getProjectionMatrix, getVariantNames, getViewMatrix, getWhiteBalanceMatrix, goToFrame, hasDefaultInteractivityFlowInput, initializeCsg2Async, inverseLerp, invertMat4, isExternalTextureReady, loadBabylon, loadBasisTexture2D, loadDdsEnvironment, loadEnvironment, loadGltf, loadHdrEnvironment, loadImageToArrayLayer, loadKtxTexture2D, loadSOG, loadSPZ, loadSplat, loadSpriteAtlas, loadTexture2D, loadUsd, markClusteredLightContainerDirty, multiplyMat4, multiplyPolarToRef, multiplySphericalToRef, normalizeInteractivityEventDataConfiguration, normalizeKhrInteractivityRuntimeValue, onBeforeRender, onEngineDeviceLost, onPhysicsAfterStep, packMeshBlendingTag, parseNodeMaterialFromSnippet, parseNodeParticleSetFromSnippet, pauseAnimation, pauseSound, pauseStreamingSound, physicsRaycast, pickAsync, pickMeshesWithRayPrecise, playAnimation, playSound, playStreamingSound, polarFromVec2ToRef, polarToVec2ToRef, powerEase, preloadStreamingInstanceAsync, preloadStreamingInstancesAsync, processAreaLightTexture, quadraticEase, quarticEase, quinticEase, readStorageBufferAfterFrame, rebuildSceneRenderables, registerNodeParticleSet, registerScene, registerSceneWithShadowSupport, registerSpriteRenderer, registerUtilityLayer, releasePhysicsConstraint, releasePhysicsShape, releaseTexture, removeAnimationGroup, removeFromScene, removePhysicsBody, requestHtmlTextureUpdate, resetVariant, resizeEngine, resolveCameraViewport, resumeSound, resumeStreamingSound, sampleCatmullRomSpline, sampleHermiteSpline, scalePolarToRef, scaleSphericalToRef, selectVariant, setAnimationAdditive, setBonePosition, setBoneRotationQuaternion, setBoneScaling, setBusVolume, setClipPlane, setEngineSize, setEnvironmentLightingRotation, setEnvironmentSkyboxRotation, 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) => {
@@ -888,6 +888,7 @@ var AbstractEngine = class {
888
888
  _scenes = [];
889
889
  _loopCallbacks = [];
890
890
  _initialized = false;
891
+ _disposed = false;
891
892
  _startupComplete = false;
892
893
  _startPromise = null;
893
894
  /** @internal Whether scene registration and the first engine start have completed. */
@@ -930,15 +931,25 @@ var AbstractEngine = class {
930
931
  * not block engine startup.
931
932
  */
932
933
  _lateWork = [];
934
+ /** @internal Number of scene mutations currently holding the Lite render loop paused. */
935
+ _sceneMutationPauseCount = 0;
936
+ /** @internal Whether the render loop was active when the outermost scene mutation paused it. */
937
+ _shouldResumeAfterSceneMutation = false;
938
+ /** @internal Changes whenever a caller explicitly stops the render loop. */
939
+ _renderLoopStopRevision = 0;
940
+ /** @internal Stop revision captured by the outermost scene mutation pause. */
941
+ _sceneMutationPauseRevision = 0;
933
942
  constructor(canvas, options) {
934
943
  this._canvas = canvas;
935
944
  const opts = typeof options === "object" ? { ...options } : options === false ? { msaaSamples: 1 } : void 0;
945
+ this.useReverseDepthBuffer = opts?.useReverseDepthBuffer ?? false;
936
946
  if (opts) {
937
947
  if (opts.canvasToneMapping !== void 0 || opts.canvasColorSpace !== void 0) unsupported("WebGPUEngineOptions.canvasToneMapping/canvasColorSpace", "Supporting WebGPU canvas presentation options requires changing Lite's existing surface configuration hot path; it cannot be added as an independently tree-shakeable compat capability.");
938
948
  const antialias = opts.antialias;
939
949
  delete opts.antialias;
940
950
  delete opts.canvasToneMapping;
941
951
  delete opts.canvasColorSpace;
952
+ delete opts.useReverseDepthBuffer;
942
953
  if (antialias === false) opts.msaaSamples = 1;
943
954
  }
944
955
  if (opts?.useLargeWorldRendering) {
@@ -951,8 +962,14 @@ var AbstractEngine = class {
951
962
  /** Acquire the GPU device and build the Lite engine context. */
952
963
  async initAsync() {
953
964
  if (this._initialized) return;
954
- this._lite = await createEngine(this._canvas, this._options);
955
- this._unsubscribeDeviceLost = onEngineDeviceLost(this._lite, () => this.onContextLostObservable.notifyObservers(this));
965
+ if (this._disposed) throw new LiteCompatError(`${this.constructor.name}.initAsync`, "The engine has been disposed.");
966
+ const lite = await createEngine(this._canvas, this._options);
967
+ if (this._disposed) {
968
+ disposeEngine(lite);
969
+ throw new LiteCompatError(`${this.constructor.name}.initAsync`, "The engine was disposed during initialization.");
970
+ }
971
+ this._lite = lite;
972
+ this._unsubscribeDeviceLost = onEngineDeviceLost(lite, () => this.onContextLostObservable.notifyObservers(this));
956
973
  this._initialized = true;
957
974
  }
958
975
  getRenderingCanvas() {
@@ -1074,6 +1091,21 @@ var AbstractEngine = class {
1074
1091
  }
1075
1092
  this._lateWork.push(work);
1076
1093
  }
1094
+ /** @internal Pause rendering across an asynchronous scene topology/resource mutation. */
1095
+ _pauseForSceneMutation() {
1096
+ if (this._disposed) return;
1097
+ if (this._sceneMutationPauseCount++ > 0) return;
1098
+ this._sceneMutationPauseRevision = this._renderLoopStopRevision;
1099
+ this._shouldResumeAfterSceneMutation = this._initialized && !this._headless && this._lite._animFrameId !== 0;
1100
+ if (this._shouldResumeAfterSceneMutation) stopEngine(this._lite);
1101
+ }
1102
+ /** @internal Release a scene-mutation pause, resuming only if the caller did not stop rendering. */
1103
+ async _resumeAfterSceneMutation() {
1104
+ if (this._sceneMutationPauseCount === 0 || --this._sceneMutationPauseCount > 0) return;
1105
+ const shouldResume = !this._disposed && this._shouldResumeAfterSceneMutation && this._sceneMutationPauseRevision === this._renderLoopStopRevision;
1106
+ this._shouldResumeAfterSceneMutation = false;
1107
+ if (shouldResume) await startEngine(this._lite);
1108
+ }
1077
1109
  /** @internal Scenes register themselves on construction. */
1078
1110
  _registerScene(scene) {
1079
1111
  this._scenes.push(scene);
@@ -1094,6 +1126,8 @@ var AbstractEngine = class {
1094
1126
  });
1095
1127
  }
1096
1128
  stopRenderLoop() {
1129
+ this._renderLoopStopRevision++;
1130
+ this._shouldResumeAfterSceneMutation = false;
1097
1131
  if (this._rafId !== null && typeof cancelAnimationFrame === "function") {
1098
1132
  cancelAnimationFrame(this._rafId);
1099
1133
  this._rafId = null;
@@ -1111,6 +1145,10 @@ var AbstractEngine = class {
1111
1145
  this.onResizeObservable.notifyObservers(this);
1112
1146
  }
1113
1147
  dispose() {
1148
+ if (this._disposed) return;
1149
+ this._disposed = true;
1150
+ this._renderLoopStopRevision++;
1151
+ this._shouldResumeAfterSceneMutation = false;
1114
1152
  if (this._rafId !== null && typeof cancelAnimationFrame === "function") {
1115
1153
  cancelAnimationFrame(this._rafId);
1116
1154
  this._rafId = null;
@@ -1187,6 +1225,7 @@ var AbstractEngine = class {
1187
1225
  scene._buildClusteredContainers();
1188
1226
  await scene._enableMaterialPlugins();
1189
1227
  await scene._loadPendingEnvironment();
1228
+ if (scene._lite.lights.some((light) => light.lightType === "rectArea")) await enableRectAreaLights(scene._lite);
1190
1229
  await enableMirroredMeshes(scene._lite);
1191
1230
  if (scene._hasShadows()) await registerSceneWithShadowSupport(scene._lite);
1192
1231
  else await registerScene(scene._lite);
@@ -1219,7 +1258,23 @@ var ThinEngine = class extends AbstractEngine {};
1219
1258
  * Babylon Lite is WebGPU-only, so a compat `Engine` is still backed by the same
1220
1259
  * Lite WebGPU context; this class exists to mirror Babylon.js's name + hierarchy.
1221
1260
  */
1222
- var Engine = class extends ThinEngine {};
1261
+ var Engine = class extends ThinEngine {
1262
+ constructor(canvas, antialiasOrOptions, options, adaptToDeviceRatio) {
1263
+ if (typeof antialiasOrOptions === "object") {
1264
+ super(canvas, antialiasOrOptions);
1265
+ return;
1266
+ }
1267
+ if (!options && adaptToDeviceRatio === void 0) {
1268
+ super(canvas, antialiasOrOptions);
1269
+ return;
1270
+ }
1271
+ super(canvas, {
1272
+ ...options,
1273
+ antialias: antialiasOrOptions ?? options?.antialias,
1274
+ ...adaptToDeviceRatio === void 0 ? {} : { adaptToDeviceRatio }
1275
+ });
1276
+ }
1277
+ };
1223
1278
  /**
1224
1279
  * Babylon.js's WebGPU engine. In Babylon.js `WebGPUEngine extends AbstractEngine`
1225
1280
  * (sibling to {@link Engine}). This is the natural engine for the compat layer
@@ -3286,16 +3341,15 @@ var ArcRotateCamera = class ArcRotateCamera extends Camera {
3286
3341
  set radius(value) {
3287
3342
  this._lite.radius = value;
3288
3343
  }
3344
+ /** Live, as in Babylon.js: `camera.target.x = …` and in-place vector math move the target. */
3289
3345
  get target() {
3290
- const t = this._lite.target;
3291
- return new Vector3(t.x, t.y, t.z);
3346
+ return liteBackedVector3(this._lite.target);
3292
3347
  }
3293
3348
  set target(value) {
3294
- this._lite.target = {
3295
- x: value.x,
3296
- y: value.y,
3297
- z: value.z
3298
- };
3349
+ const target = this._lite.target;
3350
+ target.x = value.x;
3351
+ target.y = value.y;
3352
+ target.z = value.z;
3299
3353
  }
3300
3354
  /** Babylon.js `setTarget` — point the arc-rotate camera at a world-space target. */
3301
3355
  setTarget(target) {
@@ -4555,12 +4609,19 @@ var PointerInfo = class {
4555
4609
  type;
4556
4610
  event;
4557
4611
  _pickInfo;
4558
- constructor(type, event, _pickInfo) {
4612
+ _pick;
4613
+ constructor(type, event, _pickInfo, _pick = null) {
4559
4614
  this.type = type;
4560
4615
  this.event = event;
4561
4616
  this._pickInfo = _pickInfo;
4617
+ this._pick = _pick;
4562
4618
  }
4619
+ /** Like Babylon.js lazy picking: without a precomputed pick, `_pick` runs on the first read only. */
4563
4620
  get pickInfo() {
4621
+ if (!this._pickInfo && this._pick) {
4622
+ this._pickInfo = this._pick();
4623
+ this._pick = null;
4624
+ }
4564
4625
  return this._pickInfo;
4565
4626
  }
4566
4627
  };
@@ -4647,6 +4708,9 @@ var Scene = class Scene extends AbstractScene {
4647
4708
  _engine;
4648
4709
  _activeCamera = null;
4649
4710
  cameraToUseForPointers = null;
4711
+ /** Babylon.js `scene.pointerX` / `pointerY`: the last pointer position in CSS pixels relative to the canvas. */
4712
+ pointerX = 0;
4713
+ pointerY = 0;
4650
4714
  _defaultMaterial = null;
4651
4715
  _fogMode = 0;
4652
4716
  _fogStart = 0;
@@ -4663,6 +4727,8 @@ var Scene = class Scene extends AbstractScene {
4663
4727
  _pendingAdds = [];
4664
4728
  _started = false;
4665
4729
  _envTexture = null;
4730
+ /** Environment lighting rotation last forwarded to Lite. */
4731
+ _envRotation = 0;
4666
4732
  _brdfTexture = null;
4667
4733
  _defaultEnvOptions = null;
4668
4734
  _shadowGenerators = [];
@@ -4725,7 +4791,16 @@ var Scene = class Scene extends AbstractScene {
4725
4791
  break;
4726
4792
  default: return;
4727
4793
  }
4728
- this.onPointerObservable.notifyObservers(new PointerInfo(type, event, null), type);
4794
+ const pointerEvent = event;
4795
+ const rect = this._engine.getRenderingCanvasClientRect();
4796
+ if (rect && typeof pointerEvent.clientX === "number") {
4797
+ this.pointerX = pointerEvent.clientX - rect.x;
4798
+ this.pointerY = pointerEvent.clientY - rect.y;
4799
+ }
4800
+ const x = this.pointerX;
4801
+ const y = this.pointerY;
4802
+ const camera = this.cameraToUseForPointers;
4803
+ this.onPointerObservable.notifyObservers(new PointerInfo(type, pointerEvent, null, () => this.pick(x, y, void 0, false, camera)), type);
4729
4804
  };
4730
4805
  for (const type of [
4731
4806
  "pointerdown",
@@ -4764,6 +4839,7 @@ var Scene = class Scene extends AbstractScene {
4764
4839
  this._renderedAFrame = true;
4765
4840
  this.onBeforeRenderObservable.notifyObservers(this);
4766
4841
  for (const callback of this._beforeRenderFlushCallbacks) callback();
4842
+ this._syncEnvironmentRotation();
4767
4843
  }
4768
4844
  /** @internal Register work that must observe all compat before-render mutations before Lite renders. */
4769
4845
  _registerBeforeRenderFlush(callback) {
@@ -5151,6 +5227,20 @@ var Scene = class Scene extends AbstractScene {
5151
5227
  }
5152
5228
  set environmentTexture(value) {
5153
5229
  this._envTexture = value;
5230
+ this._syncEnvironmentRotation();
5231
+ }
5232
+ /**
5233
+ * Forward the environment texture's `rotationY` to the image-based lighting only. As in Babylon.js, a skybox keeps the
5234
+ * orientation it was created with (see {@link createDefaultSkybox}) and the `createDefaultEnvironment` background never
5235
+ * turns. Also runs every frame, so the texture needs no link back to the scenes that use it. A scene whose
5236
+ * environment is never rotated never calls Lite.
5237
+ */
5238
+ _syncEnvironmentRotation() {
5239
+ const rotation = this._envTexture?.rotationY ?? 0;
5240
+ if (rotation !== this._envRotation) {
5241
+ this._envRotation = rotation;
5242
+ setEnvironmentLightingRotation(this._lite, rotation);
5243
+ }
5154
5244
  }
5155
5245
  /**
5156
5246
  * Babylon.js `scene.environmentBRDFTexture` — the BRDF lookup used by PBR materials.
@@ -5209,7 +5299,9 @@ var Scene = class Scene extends AbstractScene {
5209
5299
  * not already set) and flags a skybox-from-environment load at engine start.
5210
5300
  */
5211
5301
  createDefaultSkybox(texture, _pbr, scale, _blur, _setGlobalEnv) {
5212
- if (texture) this._envTexture = texture;
5302
+ if (texture) this.environmentTexture = texture;
5303
+ const skyboxRotation = (texture ?? this._envTexture)?.rotationY ?? 0;
5304
+ if (skyboxRotation) setEnvironmentSkyboxRotation(this._lite, skyboxRotation);
5213
5305
  this._defaultEnvOptions = {
5214
5306
  ...this._defaultEnvOptions ?? {},
5215
5307
  createSkybox: true,
@@ -5476,6 +5568,173 @@ var Scene = class Scene extends AbstractScene {
5476
5568
  }
5477
5569
  };
5478
5570
  //#endregion
5571
+ //#region src/events/device-input.ts
5572
+ var DEVICE_SOURCE_BLOCKER = "Lite's standalone keyboard, pointer, and gamepad helpers expose application-owned state snapshots. Babylon.js DeviceSourceManager additionally defines multi-device slot classification, connect/disconnect lifecycles, numeric polling indices, and normalized per-input event payloads; matching that contract requires a new Lite-owned input-management subsystem and lifecycle design.";
5573
+ var DeviceType = /* @__PURE__ */ function(DeviceType) {
5574
+ DeviceType[DeviceType["Generic"] = 0] = "Generic";
5575
+ DeviceType[DeviceType["Keyboard"] = 1] = "Keyboard";
5576
+ DeviceType[DeviceType["Mouse"] = 2] = "Mouse";
5577
+ DeviceType[DeviceType["Touch"] = 3] = "Touch";
5578
+ DeviceType[DeviceType["DualShock"] = 4] = "DualShock";
5579
+ DeviceType[DeviceType["Xbox"] = 5] = "Xbox";
5580
+ DeviceType[DeviceType["Switch"] = 6] = "Switch";
5581
+ DeviceType[DeviceType["DualSense"] = 7] = "DualSense";
5582
+ return DeviceType;
5583
+ }({});
5584
+ var PointerInput = /* @__PURE__ */ function(PointerInput) {
5585
+ PointerInput[PointerInput["Horizontal"] = 0] = "Horizontal";
5586
+ PointerInput[PointerInput["Vertical"] = 1] = "Vertical";
5587
+ PointerInput[PointerInput["LeftClick"] = 2] = "LeftClick";
5588
+ PointerInput[PointerInput["MiddleClick"] = 3] = "MiddleClick";
5589
+ PointerInput[PointerInput["RightClick"] = 4] = "RightClick";
5590
+ PointerInput[PointerInput["BrowserBack"] = 5] = "BrowserBack";
5591
+ PointerInput[PointerInput["BrowserForward"] = 6] = "BrowserForward";
5592
+ PointerInput[PointerInput["MouseWheelX"] = 7] = "MouseWheelX";
5593
+ PointerInput[PointerInput["MouseWheelY"] = 8] = "MouseWheelY";
5594
+ PointerInput[PointerInput["MouseWheelZ"] = 9] = "MouseWheelZ";
5595
+ PointerInput[PointerInput["Move"] = 12] = "Move";
5596
+ return PointerInput;
5597
+ }({});
5598
+ var DeviceInputEventType = /* @__PURE__ */ function(DeviceInputEventType) {
5599
+ DeviceInputEventType[DeviceInputEventType["PointerMove"] = 0] = "PointerMove";
5600
+ DeviceInputEventType[DeviceInputEventType["PointerDown"] = 1] = "PointerDown";
5601
+ DeviceInputEventType[DeviceInputEventType["PointerUp"] = 2] = "PointerUp";
5602
+ return DeviceInputEventType;
5603
+ }({});
5604
+ var EventConstants = class {
5605
+ static DOM_DELTA_PIXEL = 0;
5606
+ static DOM_DELTA_LINE = 1;
5607
+ static DOM_DELTA_PAGE = 2;
5608
+ };
5609
+ var DualShockInput = /* @__PURE__ */ function(DualShockInput) {
5610
+ DualShockInput[DualShockInput["Cross"] = 0] = "Cross";
5611
+ DualShockInput[DualShockInput["Circle"] = 1] = "Circle";
5612
+ DualShockInput[DualShockInput["Square"] = 2] = "Square";
5613
+ DualShockInput[DualShockInput["Triangle"] = 3] = "Triangle";
5614
+ DualShockInput[DualShockInput["L1"] = 4] = "L1";
5615
+ DualShockInput[DualShockInput["R1"] = 5] = "R1";
5616
+ DualShockInput[DualShockInput["L2"] = 6] = "L2";
5617
+ DualShockInput[DualShockInput["R2"] = 7] = "R2";
5618
+ DualShockInput[DualShockInput["Share"] = 8] = "Share";
5619
+ DualShockInput[DualShockInput["Options"] = 9] = "Options";
5620
+ DualShockInput[DualShockInput["L3"] = 10] = "L3";
5621
+ DualShockInput[DualShockInput["R3"] = 11] = "R3";
5622
+ DualShockInput[DualShockInput["DPadUp"] = 12] = "DPadUp";
5623
+ DualShockInput[DualShockInput["DPadDown"] = 13] = "DPadDown";
5624
+ DualShockInput[DualShockInput["DPadLeft"] = 14] = "DPadLeft";
5625
+ DualShockInput[DualShockInput["DPadRight"] = 15] = "DPadRight";
5626
+ DualShockInput[DualShockInput["Home"] = 16] = "Home";
5627
+ DualShockInput[DualShockInput["TouchPad"] = 17] = "TouchPad";
5628
+ DualShockInput[DualShockInput["LStickXAxis"] = 18] = "LStickXAxis";
5629
+ DualShockInput[DualShockInput["LStickYAxis"] = 19] = "LStickYAxis";
5630
+ DualShockInput[DualShockInput["RStickXAxis"] = 20] = "RStickXAxis";
5631
+ DualShockInput[DualShockInput["RStickYAxis"] = 21] = "RStickYAxis";
5632
+ return DualShockInput;
5633
+ }({});
5634
+ var DualSenseInput = /* @__PURE__ */ function(DualSenseInput) {
5635
+ DualSenseInput[DualSenseInput["Cross"] = 0] = "Cross";
5636
+ DualSenseInput[DualSenseInput["Circle"] = 1] = "Circle";
5637
+ DualSenseInput[DualSenseInput["Square"] = 2] = "Square";
5638
+ DualSenseInput[DualSenseInput["Triangle"] = 3] = "Triangle";
5639
+ DualSenseInput[DualSenseInput["L1"] = 4] = "L1";
5640
+ DualSenseInput[DualSenseInput["R1"] = 5] = "R1";
5641
+ DualSenseInput[DualSenseInput["L2"] = 6] = "L2";
5642
+ DualSenseInput[DualSenseInput["R2"] = 7] = "R2";
5643
+ DualSenseInput[DualSenseInput["Create"] = 8] = "Create";
5644
+ DualSenseInput[DualSenseInput["Options"] = 9] = "Options";
5645
+ DualSenseInput[DualSenseInput["L3"] = 10] = "L3";
5646
+ DualSenseInput[DualSenseInput["R3"] = 11] = "R3";
5647
+ DualSenseInput[DualSenseInput["DPadUp"] = 12] = "DPadUp";
5648
+ DualSenseInput[DualSenseInput["DPadDown"] = 13] = "DPadDown";
5649
+ DualSenseInput[DualSenseInput["DPadLeft"] = 14] = "DPadLeft";
5650
+ DualSenseInput[DualSenseInput["DPadRight"] = 15] = "DPadRight";
5651
+ DualSenseInput[DualSenseInput["Home"] = 16] = "Home";
5652
+ DualSenseInput[DualSenseInput["TouchPad"] = 17] = "TouchPad";
5653
+ DualSenseInput[DualSenseInput["LStickXAxis"] = 18] = "LStickXAxis";
5654
+ DualSenseInput[DualSenseInput["LStickYAxis"] = 19] = "LStickYAxis";
5655
+ DualSenseInput[DualSenseInput["RStickXAxis"] = 20] = "RStickXAxis";
5656
+ DualSenseInput[DualSenseInput["RStickYAxis"] = 21] = "RStickYAxis";
5657
+ return DualSenseInput;
5658
+ }({});
5659
+ var XboxInput = /* @__PURE__ */ function(XboxInput) {
5660
+ XboxInput[XboxInput["A"] = 0] = "A";
5661
+ XboxInput[XboxInput["B"] = 1] = "B";
5662
+ XboxInput[XboxInput["X"] = 2] = "X";
5663
+ XboxInput[XboxInput["Y"] = 3] = "Y";
5664
+ XboxInput[XboxInput["LB"] = 4] = "LB";
5665
+ XboxInput[XboxInput["RB"] = 5] = "RB";
5666
+ XboxInput[XboxInput["LT"] = 6] = "LT";
5667
+ XboxInput[XboxInput["RT"] = 7] = "RT";
5668
+ XboxInput[XboxInput["Back"] = 8] = "Back";
5669
+ XboxInput[XboxInput["Start"] = 9] = "Start";
5670
+ XboxInput[XboxInput["LS"] = 10] = "LS";
5671
+ XboxInput[XboxInput["RS"] = 11] = "RS";
5672
+ XboxInput[XboxInput["DPadUp"] = 12] = "DPadUp";
5673
+ XboxInput[XboxInput["DPadDown"] = 13] = "DPadDown";
5674
+ XboxInput[XboxInput["DPadLeft"] = 14] = "DPadLeft";
5675
+ XboxInput[XboxInput["DPadRight"] = 15] = "DPadRight";
5676
+ XboxInput[XboxInput["Home"] = 16] = "Home";
5677
+ XboxInput[XboxInput["LStickXAxis"] = 17] = "LStickXAxis";
5678
+ XboxInput[XboxInput["LStickYAxis"] = 18] = "LStickYAxis";
5679
+ XboxInput[XboxInput["RStickXAxis"] = 19] = "RStickXAxis";
5680
+ XboxInput[XboxInput["RStickYAxis"] = 20] = "RStickYAxis";
5681
+ return XboxInput;
5682
+ }({});
5683
+ var SwitchInput = /* @__PURE__ */ function(SwitchInput) {
5684
+ SwitchInput[SwitchInput["B"] = 0] = "B";
5685
+ SwitchInput[SwitchInput["A"] = 1] = "A";
5686
+ SwitchInput[SwitchInput["Y"] = 2] = "Y";
5687
+ SwitchInput[SwitchInput["X"] = 3] = "X";
5688
+ SwitchInput[SwitchInput["L"] = 4] = "L";
5689
+ SwitchInput[SwitchInput["R"] = 5] = "R";
5690
+ SwitchInput[SwitchInput["ZL"] = 6] = "ZL";
5691
+ SwitchInput[SwitchInput["ZR"] = 7] = "ZR";
5692
+ SwitchInput[SwitchInput["Minus"] = 8] = "Minus";
5693
+ SwitchInput[SwitchInput["Plus"] = 9] = "Plus";
5694
+ SwitchInput[SwitchInput["LS"] = 10] = "LS";
5695
+ SwitchInput[SwitchInput["RS"] = 11] = "RS";
5696
+ SwitchInput[SwitchInput["DPadUp"] = 12] = "DPadUp";
5697
+ SwitchInput[SwitchInput["DPadDown"] = 13] = "DPadDown";
5698
+ SwitchInput[SwitchInput["DPadLeft"] = 14] = "DPadLeft";
5699
+ SwitchInput[SwitchInput["DPadRight"] = 15] = "DPadRight";
5700
+ SwitchInput[SwitchInput["Home"] = 16] = "Home";
5701
+ SwitchInput[SwitchInput["Capture"] = 17] = "Capture";
5702
+ SwitchInput[SwitchInput["LStickXAxis"] = 18] = "LStickXAxis";
5703
+ SwitchInput[SwitchInput["LStickYAxis"] = 19] = "LStickYAxis";
5704
+ SwitchInput[SwitchInput["RStickXAxis"] = 20] = "RStickXAxis";
5705
+ SwitchInput[SwitchInput["RStickYAxis"] = 21] = "RStickYAxis";
5706
+ return SwitchInput;
5707
+ }({});
5708
+ var DeviceSource = class {
5709
+ deviceType;
5710
+ deviceSlot;
5711
+ onInputChangedObservable = new Observable();
5712
+ constructor(_deviceInputSystem, deviceType, deviceSlot = 0) {
5713
+ this.deviceType = deviceType;
5714
+ this.deviceSlot = deviceSlot;
5715
+ unsupported("DeviceSource", DEVICE_SOURCE_BLOCKER);
5716
+ }
5717
+ getInput(_inputIndex) {
5718
+ return unsupported("DeviceSource.getInput", DEVICE_SOURCE_BLOCKER);
5719
+ }
5720
+ };
5721
+ var DeviceSourceManager = class {
5722
+ onDeviceConnectedObservable = new Observable();
5723
+ onDeviceDisconnectedObservable = new Observable();
5724
+ constructor(_engine) {
5725
+ unsupported("DeviceSourceManager", DEVICE_SOURCE_BLOCKER);
5726
+ }
5727
+ getDeviceSource(_deviceType, _deviceSlot) {
5728
+ return unsupported("DeviceSourceManager.getDeviceSource", DEVICE_SOURCE_BLOCKER);
5729
+ }
5730
+ getDeviceSources(_deviceType) {
5731
+ return unsupported("DeviceSourceManager.getDeviceSources", DEVICE_SOURCE_BLOCKER);
5732
+ }
5733
+ dispose() {
5734
+ unsupported("DeviceSourceManager.dispose", DEVICE_SOURCE_BLOCKER);
5735
+ }
5736
+ };
5737
+ //#endregion
5479
5738
  //#region src/lights/lights.ts
5480
5739
  /**
5481
5740
  * Babylon.js-compatible light classes implemented over the Babylon Lite light
@@ -5491,6 +5750,49 @@ var Scene = class Scene extends AbstractScene {
5491
5750
  * position are proxies over Lite's observable vectors; colours are proxies over the Lite colour
5492
5751
  * tuples, and every colour write bumps the light version so it reaches the lights UBO.
5493
5752
  */
5753
+ var rectAreaLightReconcileStates = null;
5754
+ function requestRectAreaLightReconcile(scene, mutation) {
5755
+ const states = rectAreaLightReconcileStates ??= /* @__PURE__ */ new WeakMap();
5756
+ let state = states.get(scene);
5757
+ if (!state) {
5758
+ state = {
5759
+ revision: 0,
5760
+ scheduled: false,
5761
+ mutations: []
5762
+ };
5763
+ states.set(scene, state);
5764
+ }
5765
+ if (mutation) state.mutations.push(mutation);
5766
+ state.revision++;
5767
+ if (state.scheduled) return;
5768
+ state.scheduled = true;
5769
+ const engine = scene.getEngine();
5770
+ const schedule = () => {
5771
+ engine._registerLateWork(async () => {
5772
+ engine._pauseForSceneMutation();
5773
+ try {
5774
+ let reconciledRevision = 0;
5775
+ while (reconciledRevision !== state.revision) {
5776
+ const requestedRevision = state.revision;
5777
+ const mutations = state.mutations.splice(0);
5778
+ for (const apply of mutations) apply();
5779
+ try {
5780
+ await enableRectAreaLights(scene._lite);
5781
+ await rebuildSceneRenderables(scene._lite);
5782
+ reconciledRevision = requestedRevision;
5783
+ } catch (error) {
5784
+ if (requestedRevision === state.revision) throw error;
5785
+ }
5786
+ }
5787
+ } finally {
5788
+ state.scheduled = false;
5789
+ await engine._resumeAfterSceneMutation();
5790
+ }
5791
+ });
5792
+ };
5793
+ if (engine._lite?._currentEncoder) queueMicrotask(schedule);
5794
+ else schedule();
5795
+ }
5494
5796
  /** Babylon.js `Light` — base class for all lights (derives from `Node`). */
5495
5797
  var Light = class extends Node {
5496
5798
  /**
@@ -5506,9 +5808,9 @@ var Light = class extends Node {
5506
5808
  * including before its deferred Lite generator is built.
5507
5809
  */
5508
5810
  _shadowGenerator = null;
5509
- constructor(name, scene) {
5811
+ constructor(name, scene, dontAddToScene = false) {
5510
5812
  super(name, scene);
5511
- scene?._registerLight(this);
5813
+ if (!dontAddToScene) scene?._registerLight(this);
5512
5814
  }
5513
5815
  getClassName() {
5514
5816
  return "Light";
@@ -5588,8 +5890,17 @@ var Light = class extends Node {
5588
5890
  }
5589
5891
  /** @internal Detach Lite-owned state when this node is disposed directly or through an ancestor. */
5590
5892
  _disposeSelf(_doNotRecurse) {
5591
- if (this._scene) removeFromScene(this._scene._lite, this._lite);
5592
- else this._lite.shadowGenerator = void 0;
5893
+ const scene = this._scene;
5894
+ if (scene) {
5895
+ if (scene._hasStarted && (this._lite.lightType === "rectArea" || scene._lite.lights.some((light) => light.lightType === "rectArea" && light.emissionTexture !== null))) {
5896
+ const parent = this._lite.parent;
5897
+ if (parent) {
5898
+ const index = parent.children.indexOf(this._lite);
5899
+ if (index !== -1) parent.children.splice(index, 1);
5900
+ }
5901
+ requestRectAreaLightReconcile(scene, () => removeFromScene(scene._lite, this._lite));
5902
+ } else removeFromScene(scene._lite, this._lite);
5903
+ } else this._lite.shadowGenerator = void 0;
5593
5904
  }
5594
5905
  };
5595
5906
  /**
@@ -5784,6 +6095,96 @@ var SpotLight = class extends Light {
5784
6095
  this._writeColor(this._lite.specular, value);
5785
6096
  }
5786
6097
  };
6098
+ /** Babylon.js `AreaLight` hierarchy node shared by rectangular area lights. */
6099
+ var AreaLight = class extends Light {
6100
+ constructor(name, scene, dontAddToScene = false) {
6101
+ super(name, scene, dontAddToScene);
6102
+ }
6103
+ };
6104
+ /** Babylon.js `RectAreaLight` over Lite's native LTC-backed rectangular emitter. */
6105
+ var RectAreaLight = class extends AreaLight {
6106
+ /** @internal Underlying Babylon Lite rectangular area light. */
6107
+ _lite;
6108
+ /** @internal Caller-visible texture wrapper assigned through `emissionTexture`. */
6109
+ _emissionTexture = null;
6110
+ constructor(name, position, width, height, scene, dontAddToScene = false) {
6111
+ super(name, scene, dontAddToScene);
6112
+ this._lite = createRectAreaLight(position.asArray(), width, height);
6113
+ this._lite.name = name;
6114
+ if (scene && !dontAddToScene) {
6115
+ if (scene._hasStarted) requestRectAreaLightReconcile(scene, () => addToScene(scene._lite, this._lite));
6116
+ else addToScene(scene._lite, this._lite);
6117
+ }
6118
+ }
6119
+ getClassName() {
6120
+ return "RectAreaLight";
6121
+ }
6122
+ getTypeID() {
6123
+ return 4;
6124
+ }
6125
+ get position() {
6126
+ return liteBackedVector3(this._lite.position);
6127
+ }
6128
+ set position(value) {
6129
+ this._lite.position.set(value.x, value.y, value.z);
6130
+ }
6131
+ get width() {
6132
+ return this._lite.width;
6133
+ }
6134
+ set width(value) {
6135
+ this._lite.width = value;
6136
+ }
6137
+ get height() {
6138
+ return this._lite.height;
6139
+ }
6140
+ set height(value) {
6141
+ this._lite.height = value;
6142
+ }
6143
+ get diffuse() {
6144
+ return this._liveColor(this._lite.diffuse);
6145
+ }
6146
+ set diffuse(value) {
6147
+ this._writeColor(this._lite.diffuse, value);
6148
+ }
6149
+ get specular() {
6150
+ return this._liveColor(this._lite.specular);
6151
+ }
6152
+ set specular(value) {
6153
+ this._writeColor(this._lite.specular, value);
6154
+ }
6155
+ get emissionTexture() {
6156
+ return this._emissionTexture;
6157
+ }
6158
+ set emissionTexture(value) {
6159
+ this._emissionTexture = value;
6160
+ const apply = () => {
6161
+ if (this._emissionTexture === value) {
6162
+ const texture = value?._lite ?? null;
6163
+ if (this._lite.emissionTexture !== texture) {
6164
+ const scene = this._scene;
6165
+ if (scene?._hasStarted) requestRectAreaLightReconcile(scene, () => {
6166
+ if (this._emissionTexture === value) this._lite.emissionTexture = texture;
6167
+ });
6168
+ else this._lite.emissionTexture = texture;
6169
+ }
6170
+ }
6171
+ };
6172
+ if (value) value._onReady(apply);
6173
+ else apply();
6174
+ }
6175
+ /** @internal Preserve Babylon.js local-transform parenting on the Lite light node. */
6176
+ _applyParent(parent) {
6177
+ const source = parent;
6178
+ const next = source?._node ?? source?._lite ?? null;
6179
+ const previous = this._lite.parent;
6180
+ if (previous && previous !== next) {
6181
+ const index = previous.children.indexOf(this._lite);
6182
+ if (index !== -1) previous.children.splice(index, 1);
6183
+ }
6184
+ this._lite.parent = next;
6185
+ if (next && !next.children.includes(this._lite)) next.children.push(this._lite);
6186
+ }
6187
+ };
5787
6188
  //#endregion
5788
6189
  //#region src/lights/clustered-light-container.ts
5789
6190
  /**
@@ -5991,1124 +6392,1233 @@ var ClusteredLightContainer = class extends Light {
5991
6392
  }
5992
6393
  };
5993
6394
  //#endregion
5994
- //#region src/meshes/csg.ts
6395
+ //#region src/textures/textures.ts
5995
6396
  /**
5996
- * Babylon.js `CSG` (legacy) and `CSG2` (Manifold-based) constructive solid
5997
- * geometry, wrapped over Babylon Lite's native CSG API.
5998
- *
5999
- * Babylon.js exposes two object-oriented CSG surfaces:
6000
- * - `CSG.FromMesh(mesh)` → `.subtract` / `.intersect` / `.union` → `.toMesh(name, material, scene)`
6001
- * - `CSG2.FromMesh(mesh)` → `.subtract` / `.intersect` / `.add` → `.toMesh(name, scene)` (+ `.dispose()`),
6002
- * after `await InitializeCSG2Async()`.
6003
- *
6004
- * Babylon Lite ships the equivalent as standalone functions
6005
- * (`createCsgFromMesh` / `csgSubtract` / … / `createMeshFromCsg`, and the CSG2
6006
- * `createCsg2FromMesh` / `csg2Subtract` / … / `createMeshesFromCsg2`). These
6007
- * classes adapt the function API to Babylon.js's method-chaining shape.
6397
+ * Babylon.js-compatible texture wrappers over Babylon Lite's `loadTexture2D`.
6008
6398
  *
6009
- * CSG (legacy) `toMesh` takes an explicit material and produces a single mesh.
6010
- * CSG2 preserves per-source materials: each `FromMesh` records its source mesh's
6011
- * material against a unique slot, operations union those slot→material maps, and
6012
- * `toMesh` triangulates into one Lite mesh per slot (`createMeshesFromCsg2`),
6013
- * returning a single compat `Mesh` with the remaining sub-meshes parented under it
6014
- * so positioning the result moves them together — matching Babylon.js's single
6015
- * multi-material `toMesh` return.
6399
+ * Babylon.js's `Texture` constructor is synchronous and loads in the background.
6400
+ * Babylon Lite loads textures asynchronously. The compat `Texture` kicks off the
6401
+ * load in its constructor and resolves `_lite` when ready; assign the texture to
6402
+ * a material after `await texture.whenReadyAsync()` (or construct via
6403
+ * `Texture.LoadAsync`) so the GPU handle is present when the material binds.
6016
6404
  */
6405
+ /** Compression suffix → `loadKtxTexture2D` token, recognised in a pre-resolved KTX URL. */
6406
+ var KTX_SUFFIX_RE = /(-astc|-dxt|-etc2|-pvrtc)\.ktx(\?.*)?$/i;
6017
6407
  /**
6018
- * Babylon.js `CSG` — legacy constructive solid geometry. Build from a mesh with
6019
- * {@link FromMesh}, combine with {@link subtract} / {@link intersect} /
6020
- * {@link union}, then materialize with {@link toMesh}.
6408
+ * @internal Recognise a pre-resolved compressed KTX URL and split it into the
6409
+ * `{ baseUrl, suffix }` pair Babylon Lite's `loadKtxTexture2D` expects (which
6410
+ * takes a base image URL plus a format suffix and reconstructs the KTX URL
6411
+ * itself), or `null` when the URL is not a compressed KTX.
6412
+ *
6413
+ * Babylon.js code selects the format via `engine.getCaps()` and hands `Texture`
6414
+ * a single fully-qualified `.ktx` URL (e.g. `…/grid-dxt.ktx`), so the base is the
6415
+ * `.png` fallback (`…/grid.png`) and the suffix is `-dxt.ktx`. Any query string
6416
+ * (auth / cache-busting / signed-URL params) is preserved on the base URL so it
6417
+ * survives onto both the KTX fetch and the `.png` fallback.
6021
6418
  */
6022
- var CSG = class CSG {
6023
- _lite;
6024
- constructor(_lite) {
6025
- this._lite = _lite;
6026
- }
6027
- /** Babylon.js `CSG.FromMesh(mesh)`. */
6028
- static FromMesh(mesh) {
6029
- return new CSG(createCsgFromMesh(mesh._lite));
6030
- }
6031
- /** Babylon.js `csg.subtract(other)` — `this − other`. */
6032
- subtract(other) {
6033
- return new CSG(csgSubtract(this._lite, other._lite));
6034
- }
6035
- /** Babylon.js `csg.intersect(other)`. */
6036
- intersect(other) {
6037
- return new CSG(csgIntersect(this._lite, other._lite));
6038
- }
6039
- /** Babylon.js `csg.union(other)`. */
6040
- union(other) {
6041
- return new CSG(csgUnion(this._lite, other._lite));
6042
- }
6043
- /** Babylon.js `csg.toMesh(name, material, scene)` — triangulate into a single mesh. */
6044
- toMesh(name, material, scene) {
6045
- const engine = scene.getEngine()._lite;
6046
- const lite = createMeshFromCsg(engine, this._lite, name);
6047
- const mesh = new Mesh(name, lite, scene);
6048
- if (material) mesh.material = material;
6049
- return registerMeshAtStart(mesh, scene);
6050
- }
6051
- };
6052
- /** Module-wide unique material-slot counter for CSG2 (`MATERIAL_ID_RESERVE_COUNT` = 65536). */
6053
- var nextCsg2Slot = 0;
6419
+ function resolveKtxUrl(url) {
6420
+ const ktx = url.match(KTX_SUFFIX_RE);
6421
+ if (!ktx) return null;
6422
+ return {
6423
+ baseUrl: url.replace(KTX_SUFFIX_RE, ".png$2"),
6424
+ suffix: ktx[1] + ".ktx"
6425
+ };
6426
+ }
6054
6427
  /**
6055
- * Babylon.js `CSG2` — Manifold-based constructive solid geometry that preserves
6056
- * per-source-mesh materials. Call `await InitializeCSG2Async()` once before use.
6428
+ * Pick the right Babylon Lite loader for a texture URL:
6429
+ * - `.basis` → `loadBasisTexture2D` (GPU-format transcode; manages its own V-flip).
6430
+ * - a pre-resolved compressed KTX (`…-dxt.ktx` etc.) → `loadKtxTexture2D` (see
6431
+ * {@link resolveKtxUrl}), which re-checks device support and falls back to the
6432
+ * base image.
6433
+ * - everything else → the raster `loadTexture2D`.
6434
+ *
6435
+ * The basis/KTX loaders manage their own V-orientation, so the raster-only
6436
+ * `invertY` / `mipMaps` options are ignored there — passing the same opts is safe.
6057
6437
  */
6058
- var CSG2 = class CSG2 {
6438
+ function loadCompatTexture(engine, url, opts) {
6439
+ if (url.split(/[?#]/)[0].toLowerCase().endsWith(".basis")) return loadBasisTexture2D(engine, url, opts);
6440
+ const ktx = resolveKtxUrl(url);
6441
+ if (ktx) return loadKtxTexture2D(engine, ktx.baseUrl, [ktx.suffix], opts);
6442
+ return loadTexture2D(engine, url, opts);
6443
+ }
6444
+ var BaseTexture = class {
6445
+ name = "";
6446
+ /** @internal The underlying Lite texture handle. Undefined until the async load resolves. */
6059
6447
  _lite;
6060
- _materials;
6061
- constructor(_lite, _materials) {
6062
- this._lite = _lite;
6063
- this._materials = _materials;
6064
- }
6065
- /** Babylon.js `CSG2.FromMesh(mesh)` — records the mesh's material against a unique slot. */
6066
- static FromMesh(mesh) {
6067
- const slot = nextCsg2Slot++;
6068
- const materials = /* @__PURE__ */ new Map();
6069
- if (mesh.material) materials.set(slot, mesh.material);
6070
- return new CSG2(createCsg2FromMesh(mesh._lite, slot), materials);
6071
- }
6072
- _combine(lite, other) {
6073
- const materials = new Map(this._materials);
6074
- for (const [slot, material] of other._materials) materials.set(slot, material);
6075
- return new CSG2(lite, materials);
6076
- }
6077
- /** Babylon.js `csg.subtract(other)` — `this − other`. */
6078
- subtract(other) {
6079
- return this._combine(csg2Subtract(this._lite, other._lite), other);
6448
+ /** @internal One-shot listeners fired when the GPU handle first resolves (see {@link _onReady}). */
6449
+ _readyListeners;
6450
+ getClassName() {
6451
+ return "BaseTexture";
6080
6452
  }
6081
- /** Babylon.js `csg.intersect(other)`. */
6082
- intersect(other) {
6083
- return this._combine(csg2Intersect(this._lite, other._lite), other);
6453
+ /**
6454
+ * @internal Register a callback fired once this texture's GPU handle resolves.
6455
+ * Owning compat materials use it to rebind and rebuild once an asynchronously
6456
+ * loaded texture becomes available. Fires immediately if the handle already
6457
+ * exists; otherwise queues until {@link _notifyReady}. One-shot per listener.
6458
+ */
6459
+ _onReady(listener) {
6460
+ if (this._lite) {
6461
+ listener();
6462
+ return;
6463
+ }
6464
+ (this._readyListeners ??= []).push(listener);
6084
6465
  }
6085
- /** Babylon.js `csg.add(other)` — union. */
6086
- add(other) {
6087
- return this._combine(csg2Add(this._lite, other._lite), other);
6466
+ /** @internal Fire and clear the readiness listeners (called by subclasses once `_lite` resolves). */
6467
+ _notifyReady() {
6468
+ const listeners = this._readyListeners;
6469
+ if (listeners) {
6470
+ this._readyListeners = void 0;
6471
+ for (const listener of listeners) listener();
6472
+ }
6088
6473
  }
6089
6474
  /**
6090
- * Babylon.js `csg.toMesh(name, scene)` — triangulate into a single mesh,
6091
- * preserving each source mesh's material across the result's faces.
6475
+ * Babylon.js `BaseTexture.getInternalTexture()` — the backend texture handle. Babylon.js
6476
+ * returns an `InternalTexture`; the compat layer's equivalent is the Lite texture handle,
6477
+ * which is what the compat engine's texture methods accept.
6092
6478
  */
6093
- toMesh(name, scene) {
6094
- const engine = scene.getEngine()._lite;
6095
- const materials = [];
6096
- for (const [slot, material] of this._materials) {
6097
- attachMaterialToScene(material, scene);
6098
- materials[slot] = material._lite;
6099
- }
6100
- const liteMeshes = createMeshesFromCsg2(engine, this._lite, materials, name);
6101
- const savedMaterials = liteMeshes.map((m) => m.material);
6102
- const root = new Mesh(name, liteMeshes[0], scene);
6103
- const wrapped = root.material;
6104
- root._lite.material = savedMaterials[0];
6105
- scene._deferAdd(() => {
6106
- const assigned = root.material;
6107
- if (assigned && assigned !== wrapped) {
6108
- attachMaterialToScene(assigned, scene);
6109
- root._lite.material = assigned._lite;
6110
- }
6111
- addToScene(scene._lite, root._lite);
6112
- });
6113
- for (let i = 1; i < liteMeshes.length; i++) {
6114
- const sub = liteMeshes[i];
6115
- sub.material = savedMaterials[i];
6116
- sub.parent = root._lite;
6117
- scene._deferAdd(() => addToScene(scene._lite, sub));
6118
- }
6119
- return root;
6120
- }
6121
- /** Babylon.js `csg.dispose()` — release the underlying Manifold solid. */
6122
- dispose() {
6123
- disposeCsg2(this._lite);
6124
- }
6125
- };
6126
- /** Babylon.js `InitializeCSG2Async()` — load the Manifold runtime before any `CSG2` use. */
6127
- async function InitializeCSG2Async() {
6128
- await initializeCsg2Async();
6129
- }
6130
- //#endregion
6131
- //#region src/meshes/compression.ts
6132
- /**
6133
- * Babylon.js `MeshoptCompression` (`@babylonjs/core/Meshes/Compression/meshoptCompression`).
6134
- *
6135
- * In Babylon.js this singleton owns the meshopt decoder used by the glTF
6136
- * `EXT_meshopt_compression` loader extension, and apps configure its decoder URL
6137
- * via the static `Configuration`. Babylon Lite decodes meshopt-compressed buffers
6138
- * itself inside its glTF loader feature (`gltf-feature-meshopt`), so no external
6139
- * decoder needs wiring. This compat shim therefore accepts the `Configuration`
6140
- * assignment ported code performs (a no-op here) so the import resolves and the
6141
- * asset still loads — the actual decode happens in Lite.
6142
- */
6143
- var MeshoptCompression = class MeshoptCompression {
6144
- /**
6145
- * Babylon.js `MeshoptCompression.Configuration` — the decoder location. Stored
6146
- * for API parity but unused: Babylon Lite's glTF loader carries its own meshopt
6147
- * decoder, so setting this has no effect on decoding.
6148
- */
6149
- static Configuration = { decoder: { url: "" } };
6150
- static _default = null;
6151
- /** Babylon.js `MeshoptCompression.Default` — the lazily-created shared instance. */
6152
- static get Default() {
6153
- if (!MeshoptCompression._default) MeshoptCompression._default = new MeshoptCompression();
6154
- return MeshoptCompression._default;
6479
+ getInternalTexture() {
6480
+ return this._lite ?? null;
6155
6481
  }
6482
+ dispose() {}
6156
6483
  };
6157
- //#endregion
6158
- //#region src/morph/morph.ts
6159
- /**
6160
- * Babylon.js-compatible `MorphTarget` / `MorphTargetManager` over the Babylon
6161
- * Lite native morph API (`createMorphTargets` / `setMorphTargetWeights`).
6162
- *
6163
- * Babylon.js morph targets carry **absolute** vertex positions/normals
6164
- * (`target.setPositions(abs)`); Babylon Lite's `createMorphTargets` consumes
6165
- * per-target **deltas** (target − base). The manager defers building the Lite
6166
- * morph until engine start (when the owning mesh's base CPU geometry exists),
6167
- * computes the deltas, and assigns the resulting `MorphTargetData` onto the
6168
- * Lite mesh so the Standard/NME pipelines sample it. Weight changes
6169
- * (`target.influence = …`) re-upload via `setMorphTargetWeights`.
6170
- */
6171
- /** Babylon.js `MorphTarget` — a single named morph influence with absolute target geometry. */
6172
- var MorphTarget = class {
6173
- name;
6174
- /** @internal Absolute target positions (Babylon.js `setPositions`). */
6175
- _positions = null;
6176
- /** @internal Absolute target normals (Babylon.js `setNormals`). */
6177
- _normals = null;
6178
- /** @internal Owning manager, set on `addTarget`, used to push weight updates. */
6179
- _manager;
6180
- _influence;
6181
- constructor(name, influence = 0, _scene) {
6484
+ /** Babylon.js `HtmlTexture`, forwarding DOM capture and updates to Babylon Lite. */
6485
+ var HtmlTexture = class extends BaseTexture {
6486
+ element;
6487
+ host;
6488
+ onLoadObservable = new Observable(void 0, true);
6489
+ _engine;
6490
+ _textureMatrix = Matrix.Identity();
6491
+ _ready;
6492
+ _htmlTexture;
6493
+ _disposed = false;
6494
+ constructor(name, element, options) {
6495
+ super();
6182
6496
  this.name = name;
6183
- this._influence = influence;
6497
+ this.element = element;
6498
+ this._engine = options.scene?.getEngine() ?? options.engine ?? null;
6499
+ this.host = this._engine?.getRenderingCanvas() ?? null;
6500
+ if (!this._engine || !element) {
6501
+ this._ready = Promise.reject(/* @__PURE__ */ new Error("HtmlTexture requires an engine and HTML element."));
6502
+ this._ready.catch(() => void 0);
6503
+ return;
6504
+ }
6505
+ if (options.format !== void 0 && options.format !== 5) unsupported("HtmlTexture.format", "Babylon Lite HTML textures use RGBA8; alternate Babylon.js texture formats require a new native upload/storage contract.");
6506
+ const nearest = options.samplingMode === Texture.NEAREST_SAMPLINGMODE || options.samplingMode === Texture.NEAREST_NEAREST;
6507
+ const htmlTexture = createHtmlTexture(this._engine._lite, element, {
6508
+ width: options.width,
6509
+ height: options.height,
6510
+ mipMaps: options.generateMipMaps ?? false,
6511
+ autoUpdate: options.autoUpdate ?? true,
6512
+ useSvgFallback: options.useSvgFallback ?? true,
6513
+ minFilter: nearest ? "nearest" : "linear",
6514
+ magFilter: nearest ? "nearest" : "linear",
6515
+ invertY: true
6516
+ });
6517
+ this._htmlTexture = htmlTexture;
6518
+ this._ready = whenHtmlTextureReady(htmlTexture).then(() => {
6519
+ if (this._disposed) throw new Error("HtmlTexture was disposed before its first upload completed.");
6520
+ this._lite = htmlTexture;
6521
+ try {
6522
+ this.onLoadObservable.notifyObservers(this);
6523
+ } finally {
6524
+ this._notifyReady();
6525
+ }
6526
+ });
6527
+ this._ready.catch(() => void 0);
6184
6528
  }
6185
- get influence() {
6186
- return this._influence;
6529
+ getTextureMatrix() {
6530
+ return this._textureMatrix;
6187
6531
  }
6188
- set influence(value) {
6189
- this._influence = value;
6190
- this._manager?._syncWeights();
6532
+ requestUpdate() {
6533
+ if (this._engine && this._htmlTexture) requestHtmlTextureUpdate(this._engine._lite, this._htmlTexture);
6191
6534
  }
6192
- /** Babylon.js `MorphTarget.setPositions(data)` — absolute target positions. */
6193
- setPositions(data) {
6194
- this._positions = data ? data instanceof Float32Array ? data : Float32Array.from(data) : null;
6535
+ update(invertY = true) {
6536
+ if (this._engine && this._htmlTexture) updateHtmlTexture(this._engine._lite, this._htmlTexture, invertY);
6195
6537
  }
6196
- /** Babylon.js `MorphTarget.getPositions()`. */
6197
- getPositions() {
6198
- return this._positions;
6538
+ getClassName() {
6539
+ return "HtmlTexture";
6199
6540
  }
6200
- /** Babylon.js `MorphTarget.setNormals(data)` — absolute target normals. */
6201
- setNormals(data) {
6202
- this._normals = data ? data instanceof Float32Array ? data : Float32Array.from(data) : null;
6541
+ whenReadyAsync() {
6542
+ return this._ready;
6203
6543
  }
6204
- /** Babylon.js `MorphTarget.getNormals()`. */
6205
- getNormals() {
6206
- return this._normals;
6544
+ dispose() {
6545
+ this._disposed = true;
6546
+ if (this._htmlTexture) {
6547
+ disposeHtmlTexture(this._htmlTexture);
6548
+ this._htmlTexture = void 0;
6549
+ }
6550
+ this._lite = void 0;
6551
+ this.onLoadObservable.clear();
6552
+ this.onLoadObservable.cleanLastNotifiedState();
6207
6553
  }
6208
6554
  };
6209
- /** Babylon.js `MorphTargetManager` — owns a mesh's morph targets (Babylon Lite supports up to 4). */
6210
- var MorphTargetManager = class {
6211
- /** @internal */
6212
- _engine;
6213
- /** @internal Built Lite morph data (created at engine start). */
6214
- _lite;
6215
- _targets = [];
6216
- constructor(_scene) {}
6217
- get numTargets() {
6218
- return this._targets.length;
6219
- }
6220
- getTarget(index) {
6221
- return this._targets[index];
6555
+ var Texture = class Texture extends BaseTexture {
6556
+ _ready;
6557
+ _onLoadObservable;
6558
+ /** Babylon.js sampling-mode constants (numeric parity). */
6559
+ static NEAREST_SAMPLINGMODE = 1;
6560
+ static BILINEAR_SAMPLINGMODE = 2;
6561
+ static TRILINEAR_SAMPLINGMODE = 3;
6562
+ static NEAREST_NEAREST = 8;
6563
+ static LINEAR_LINEAR = 11;
6564
+ /** Babylon.js coordinate-mode constants (numeric parity). */
6565
+ static CLAMP_ADDRESSMODE = 0;
6566
+ static WRAP_ADDRESSMODE = 1;
6567
+ static MIRROR_ADDRESSMODE = 2;
6568
+ /** Babylon.js texture UV tiling (applied to the Lite material at bind time). */
6569
+ uScale = 1;
6570
+ vScale = 1;
6571
+ uOffset = 0;
6572
+ vOffset = 0;
6573
+ hasAlpha = false;
6574
+ coordinatesIndex = 0;
6575
+ /** Babylon.js sampling mode passed at construction (`NEAREST_SAMPLINGMODE` = 1, etc.). */
6576
+ samplingMode;
6577
+ /** @internal The Scene or engine this texture was created against (for `clone`). */
6578
+ _source;
6579
+ constructor(url, sceneOrEngine, noMipmapOrOptions, invertY, _samplingMode, onLoad) {
6580
+ super();
6581
+ this.name = url;
6582
+ let noMipmap = false;
6583
+ let invertYOpt = invertY;
6584
+ let samplingMode = _samplingMode;
6585
+ if (typeof noMipmapOrOptions === "boolean") noMipmap = noMipmapOrOptions;
6586
+ else if (noMipmapOrOptions && typeof noMipmapOrOptions === "object") {
6587
+ const o = noMipmapOrOptions;
6588
+ noMipmap = o.noMipmap ?? false;
6589
+ invertYOpt = invertYOpt ?? o.invertY;
6590
+ samplingMode = samplingMode ?? o.samplingMode;
6591
+ }
6592
+ this._invertY = invertYOpt ?? true;
6593
+ this._noMipmap = noMipmap;
6594
+ this.samplingMode = samplingMode ?? Texture.BILINEAR_SAMPLINGMODE;
6595
+ this._source = sceneOrEngine;
6596
+ const scene = sceneOrEngine.getEngine ? sceneOrEngine : void 0;
6597
+ const engineWrapper = scene ? void 0 : sceneOrEngine;
6598
+ const engine = scene ? scene.getEngine()._lite : engineWrapper._lite;
6599
+ const filterOpts = this.samplingMode === Texture.NEAREST_SAMPLINGMODE || this.samplingMode === Texture.NEAREST_NEAREST ? {
6600
+ minFilter: "nearest",
6601
+ magFilter: "nearest"
6602
+ } : {};
6603
+ const loadOpts = scene ? {
6604
+ invertY: this._invertY,
6605
+ mipMaps: !this._noMipmap,
6606
+ ...filterOpts
6607
+ } : {};
6608
+ this._ready = loadCompatTexture(engine, url, loadOpts).then((tex) => {
6609
+ this._lite = tex;
6610
+ try {
6611
+ this._notifyLoadObservable();
6612
+ if (onLoad) onLoad();
6613
+ } finally {
6614
+ this._notifyReady();
6615
+ }
6616
+ });
6617
+ scene?._trackTextureLoad(this._ready);
6618
+ engineWrapper?._registerStartupWork?.(() => this._ready);
6222
6619
  }
6223
- /** Babylon.js `MorphTargetManager.addTarget(target)`. */
6224
- addTarget(target) {
6225
- target._manager = this;
6226
- this._targets.push(target);
6620
+ /** @internal Upload-time vertical flip / mipmap flags, preserved across `clone`. */
6621
+ _invertY;
6622
+ _noMipmap;
6623
+ getClassName() {
6624
+ return "Texture";
6227
6625
  }
6228
6626
  /**
6229
- * @internal Build the Lite morph data from the mesh's base CPU geometry and
6230
- * each target's absolute positions/normals (converted to deltas), then assign
6231
- * it onto the Lite mesh. Called by the engine at start, once geometry exists.
6627
+ * Babylon.js `texture.clone()` — a new `Texture` over the same source URL.
6628
+ * UV tiling/offset and sampling are copied; the clone re-resolves the GPU
6629
+ * handle (tracked against the same scene so it is ready at build).
6232
6630
  */
6233
- _build(mesh, engine) {
6234
- const lite = mesh._lite;
6235
- const base = lite._cpuPositions;
6236
- if (!base) return;
6237
- this._engine = engine;
6238
- const vertexCount = base.length / 3;
6239
- const baseNormals = lite._cpuNormals;
6240
- const targets = this._targets.slice(0, 4).map((t) => {
6241
- const abs = t._positions;
6242
- const positions = new Float32Array(base.length);
6243
- if (abs) for (let i = 0; i < base.length; i++) positions[i] = (abs[i] ?? 0) - base[i];
6244
- let normals = null;
6245
- if (t._normals && baseNormals) {
6246
- normals = new Float32Array(baseNormals.length);
6247
- for (let i = 0; i < baseNormals.length; i++) normals[i] = (t._normals[i] ?? 0) - baseNormals[i];
6248
- }
6249
- return {
6250
- positions,
6251
- normals
6252
- };
6253
- });
6254
- const weights = this._targets.slice(0, 4).map((t) => t.influence);
6255
- this._lite = createMorphTargets(engine, targets, vertexCount, weights);
6256
- lite.morphTargets = this._lite;
6257
- }
6258
- /** @internal Re-upload current target influences to the GPU weights buffer. */
6259
- _syncWeights() {
6260
- if (!this._lite || !this._engine) return;
6261
- const weights = this._targets.slice(0, 4).map((t) => t.influence);
6262
- setMorphTargetWeights(this._engine, this._lite, weights);
6263
- }
6264
- };
6265
- //#endregion
6266
- //#region src/meshes/gaussian-splatting.ts
6267
- /**
6268
- * Babylon.js-compatible `GaussianSplattingMesh` over Babylon Lite's splat loaders.
6269
- *
6270
- * Babylon Lite fully backs Gaussian Splatting: `loadSplat` (`.ply` / `.splat` /
6271
- * compressed-PLY), `loadSOG`, and `loadSPZ` each return a `GaussianSplattingMesh`
6272
- * (a `SceneNode` carrying the splat cloud), with `splatsData` / `updateData` for
6273
- * in-place edits and `bakeCurrentTransformIntoVertices` to fold the node transform
6274
- * into the splat data. This wrapper exposes that through the Babylon.js
6275
- * `GaussianSplattingMesh` shape so ported scenes (`new GaussianSplattingMesh(...)` +
6276
- * `loadFileAsync`, or `ImportMeshAsync` of a splat URL) run unchanged.
6277
- *
6278
- * Babylon.js constructs the mesh synchronously and populates it via
6279
- * `loadFileAsync`; Babylon Lite loads atomically. We bridge this by holding a
6280
- * lightweight placeholder transform node until the splat loads, buffering any
6281
- * transforms set in the meantime, then adopting the loaded Lite node.
6282
- */
6283
- var GAUSSIAN_POINT_SPLATTING_UNSUPPORTED$1 = "Babylon.js Gaussian Point Splatting is a separate stochastic WebGPU compute-renderer subsystem with accumulation, Hi-Z culling, depth-pass integration, and fullscreen compositing lifecycles. Lite's sorted-splat renderer has no equivalent compute or pass-ownership model, and adding one requires broad engine design rather than a small mechanical export.";
6284
- function _HasGaussianPointSplattingProjectedDepth(projection) {
6285
- return _hasGaussianPointSplattingProjectedDepth(projection.m);
6286
- }
6287
- function _GetPackedShBytesPerSplat(shDegree) {
6288
- return _getGaussianPointSplattingPackedShBytesPerSplat(shDegree);
6289
- }
6290
- /** Lite loader chosen by file extension (mirrors the BJS splat plugin dispatch). */
6291
- function liteLoaderFor(url) {
6292
- const lower = url.split("?")[0].toLowerCase();
6293
- if (lower.endsWith(".sog") || lower.endsWith(".zip")) return loadSOG;
6294
- if (lower.endsWith(".spz")) return loadSPZ;
6295
- return loadSplat;
6296
- }
6297
- /** `.splat` row stride: position(3f) + scale(3f) + rgba(4×u8) + rot(4×u8) = 32 bytes. */
6298
- var SPLAT_ROW_BYTES = 32;
6299
- var SPLAT_ROW_FLOATS = SPLAT_ROW_BYTES / 4;
6300
- var SPLAT_Y_FLOAT_INDEX = 1;
6301
- /**
6302
- * @internal Return a copy of a `.splat` buffer with every row's centre Y negated
6303
- * (the position-space half of Babylon.js's `flipY`). Used to reproduce
6304
- * `updateData(..., { flipY: false })`. Only the 32-byte `.splat` row layout is
6305
- * handled; other buffers are returned unchanged.
6306
- */
6307
- function mirrorSplatRowY(buffer) {
6308
- if (buffer.byteLength % SPLAT_ROW_BYTES !== 0) return buffer;
6309
- const copy = buffer.slice(0);
6310
- const floats = new Float32Array(copy);
6311
- for (let f = SPLAT_Y_FLOAT_INDEX; f < floats.length; f += SPLAT_ROW_FLOATS) floats[f] = -floats[f];
6312
- return copy;
6313
- }
6314
- /**
6315
- * Babylon.js `GaussianSplattingMesh`. Derives from `TransformNode` so the loaded
6316
- * cloud's `position` / `rotation` / `scaling` proxy onto the Lite splat node.
6317
- */
6318
- var GaussianSplattingMesh = class GaussianSplattingMesh extends TransformNode {
6319
- /** @internal The loaded Lite splat node (undefined until `loadFileAsync` resolves). */
6320
- _gs;
6321
- /** @internal The constructor's deferred URL, loaded by `loadFileAsync()` with no argument. */
6322
- _ctorUrl;
6323
- /** @internal Optional Lite shader-fragment plugins applied at load (scene 126). */
6324
- _fragments;
6325
- /** @internal Point-splatting configuration retained for BJS state parity while the unsupported mode is disabled. */
6326
- _pointSplattingRenderScale = "auto";
6327
- /** @internal Point-splatting configuration retained for BJS state parity while the unsupported mode is disabled. */
6328
- _pointSplattingOcclusionCulling = false;
6329
- /** @internal Point-splatting configuration retained for BJS state parity while the unsupported mode is disabled. */
6330
- _pointSplattingScale = 1;
6331
- /**
6332
- * Babylon.js `gs.safeOrbitCameraLimits` — safe-orbit camera limits parsed from the source
6333
- * file's metadata (Adobe safe-orbit extension), or `null` when the file carries none.
6334
- *
6335
- * Babylon Lite's splat loaders (`loadSplat` / `loadSOG` / `loadSPZ`) do not parse the Adobe
6336
- * safe-orbit metadata block, so this stays `null` — matching BJS's own default for a file
6337
- * without the extension. Populating it from real metadata needs a (non-tree-shakeable) change
6338
- * to Lite's splat loaders; the field is exposed here for shape parity so ported reads resolve.
6339
- */
6340
- safeOrbitCameraLimits = null;
6341
- get pointSplattingRenderScale() {
6342
- return this._pointSplattingRenderScale;
6343
- }
6344
- set pointSplattingRenderScale(value) {
6345
- this._pointSplattingRenderScale = value;
6346
- }
6347
- get pointSplattingOcclusionCulling() {
6348
- return this._pointSplattingOcclusionCulling;
6349
- }
6350
- set pointSplattingOcclusionCulling(value) {
6351
- this._pointSplattingOcclusionCulling = value;
6352
- }
6353
- get pointSplattingRenderMode() {
6354
- return false;
6355
- }
6356
- set pointSplattingRenderMode(value) {
6357
- if (value) unsupported("GaussianSplattingMesh.pointSplattingRenderMode", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED$1);
6631
+ clone() {
6632
+ const c = new Texture(this.name, this._source, this._noMipmap, this._invertY, this.samplingMode);
6633
+ c.uScale = this.uScale;
6634
+ c.vScale = this.vScale;
6635
+ c.uOffset = this.uOffset;
6636
+ c.vOffset = this.vOffset;
6637
+ c.hasAlpha = this.hasAlpha;
6638
+ c.coordinatesIndex = this.coordinatesIndex;
6639
+ return c;
6358
6640
  }
6359
- get pointSplattingDepthRenderMode() {
6360
- return false;
6641
+ whenReadyAsync() {
6642
+ return this._ready;
6361
6643
  }
6362
- set pointSplattingDepthRenderMode(value) {
6363
- if (value) unsupported("GaussianSplattingMesh.pointSplattingDepthRenderMode", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED$1);
6644
+ /** Babylon.js `Texture.onLoadObservable`, allocated only when code subscribes. */
6645
+ get onLoadObservable() {
6646
+ let observable = this._onLoadObservable;
6647
+ if (!observable) {
6648
+ observable = new Observable(void 0, true);
6649
+ this._onLoadObservable = observable;
6650
+ if (this.isReady()) observable.notifyObservers(this);
6651
+ }
6652
+ return observable;
6364
6653
  }
6365
- get pointSplattingProgress() {
6366
- return null;
6654
+ _notifyLoadObservable() {
6655
+ if (this._onLoadObservable) this._onLoadObservable.notifyObservers(this);
6367
6656
  }
6368
- get pointSplattingScale() {
6369
- return this._pointSplattingScale;
6657
+ /** Babylon.js `BaseTexture.isReady()` — true once the GPU handle has resolved. */
6658
+ isReady() {
6659
+ return this._lite !== void 0;
6370
6660
  }
6371
- set pointSplattingScale(value) {
6372
- this._pointSplattingScale = value;
6661
+ /** Load a texture and resolve once its GPU handle is available. */
6662
+ static async LoadAsync(url, scene) {
6663
+ const texture = new Texture(url, scene);
6664
+ await texture.whenReadyAsync();
6665
+ return texture;
6373
6666
  }
6374
- constructor(name, url, scene, _keepInRam) {
6375
- super(name, scene, createTransformNode(name));
6376
- this._ctorUrl = url ?? null;
6667
+ };
6668
+ /**
6669
+ * Babylon.js `RawTexture` — a texture created from raw pixel bytes. Backed by
6670
+ * Babylon Lite's `createTexture2DFromPixels`; the GPU handle is available
6671
+ * synchronously after construction.
6672
+ */
6673
+ var RawTexture = class RawTexture extends BaseTexture {
6674
+ _scene;
6675
+ constructor(data, width, height, scene) {
6676
+ super();
6677
+ this._scene = scene;
6678
+ this._lite = createTexture2DFromPixels(scene.getEngine()._lite, data, width, height);
6377
6679
  }
6378
6680
  getClassName() {
6379
- return "GaussianSplattingMesh";
6380
- }
6381
- /** @internal The wrapper's transform node; the loaded cloud is parented beneath it during deferred adoption. */
6382
- get _xform() {
6383
- return this._gs?.parent === this._node ? this._node : this._gs ?? this._node;
6681
+ return "RawTexture";
6384
6682
  }
6385
- /** @internal Accessibility metadata belongs to the loaded cloud, or its placeholder before loading. */
6386
- _accessibilitySource() {
6387
- return this._gs ?? this._node;
6683
+ /** Replace the texture's pixel contents. */
6684
+ update(data) {
6685
+ if (this._lite) updateTexture2DFromPixels(this._scene.getEngine()._lite, this._lite, data);
6388
6686
  }
6389
- get position() {
6390
- return liteBackedVector3(this._xform.position);
6687
+ whenReadyAsync() {
6688
+ return Promise.resolve();
6391
6689
  }
6392
- set position(value) {
6393
- this._xform.position.set(value.x, value.y, value.z);
6690
+ static CreateRGBATexture(data, width, height, scene) {
6691
+ return new RawTexture(data, width, height, scene);
6394
6692
  }
6395
- get rotation() {
6396
- return liteBackedVector3(this._xform.rotation);
6693
+ };
6694
+ /**
6695
+ * Babylon.js `RawTexture3D` — a volumetric texture created from raw RGBA8 pixel
6696
+ * bytes (the common case being a colour-grading LUT / colour cube). Backed by
6697
+ * Babylon Lite's `createTexture3DFromPixels`; the GPU handle is available
6698
+ * synchronously after construction.
6699
+ *
6700
+ * Babylon Lite's 3D-texture path is RGBA8-only, so the `format` argument is
6701
+ * recorded for API parity but the upload always treats `data` as tightly-packed
6702
+ * `width * height * depth * 4` RGBA bytes (x fastest, then y, then z).
6703
+ */
6704
+ var RawTexture3D = class extends BaseTexture {
6705
+ format;
6706
+ _scene;
6707
+ /** Babylon.js `RawTexture3D.is3D` — always true for a 3D texture. */
6708
+ is3D = true;
6709
+ constructor(data, width, height, depth, format, scene, generateMipMaps = true, _invertY = false, _samplingMode = 3, _textureType, _creationFlags) {
6710
+ super();
6711
+ this.format = format;
6712
+ if (generateMipMaps) unsupported("RawTexture3D(generateMipMaps)", "Babylon.js 3D mip generation renders every depth slice of every level and requires a mip-capable 3D allocation plus a dedicated shader/pipeline. Babylon Lite's public 3D texture factory allocates only one level; adding this GPU subsystem is not a small mechanical extension. Pass false to create a base-level texture.");
6713
+ this._scene = scene;
6714
+ const bytes = toRgbaBytes(data, width, height, depth);
6715
+ this._lite = createTexture3DFromPixels(scene.getEngine()._lite, bytes, width, height, depth);
6397
6716
  }
6398
- set rotation(value) {
6399
- this._xform.rotation.set(value.x, value.y, value.z);
6717
+ getClassName() {
6718
+ return "RawTexture3D";
6400
6719
  }
6401
- get scaling() {
6402
- return liteBackedVector3(this._xform.scaling);
6720
+ /** Gets the width of the texture. */
6721
+ get width() {
6722
+ return this._lite?.width ?? 0;
6403
6723
  }
6404
- set scaling(value) {
6405
- this._xform.scaling.set(value.x, value.y, value.z);
6724
+ /** Gets the height of the texture. */
6725
+ get height() {
6726
+ return this._lite?.height ?? 0;
6406
6727
  }
6407
- /** @internal Set the Lite shader-fragment plugins applied on the next load (compat material-plugin path). */
6408
- _setFragments(fragments) {
6409
- this._fragments = fragments;
6728
+ /** Gets the depth of the texture. */
6729
+ get depth() {
6730
+ return this._lite?.depth ?? 0;
6410
6731
  }
6411
6732
  /**
6412
- * Babylon.js `gs.loadFileAsync(url?)` — fetch + parse a splat asset and adopt
6413
- * the resulting Lite node. With no argument, loads the constructor URL.
6733
+ * Replace the texture's pixel contents. Babylon Lite has no in-place 3D update,
6734
+ * so the volume is re-uploaded (a fresh Lite 3D texture handle).
6414
6735
  */
6415
- async loadFileAsync(url) {
6416
- const target = url ?? this._ctorUrl;
6417
- if (!target) throw new Error("GaussianSplattingMesh.loadFileAsync: no URL provided (and none given to the constructor).");
6418
- const scene = this._scene;
6419
- if (!scene) throw new Error("GaussianSplattingMesh.loadFileAsync requires a scene (pass one to the constructor).");
6420
- const lite = await liteLoaderFor(target)(scene._lite, target, this._fragments);
6421
- this._adopt(lite);
6422
- return this;
6736
+ update(data) {
6737
+ const bytes = toRgbaBytes(data, this.width, this.height, this.depth);
6738
+ this._lite = createTexture3DFromPixels(this._scene.getEngine()._lite, bytes, this.width, this.height, this.depth);
6423
6739
  }
6424
- /**
6425
- * @internal Adopt a loaded Lite splat node from either the mesh or loader-plugin API.
6426
- * Parenting preserves the loader's format-specific local transform while composing it
6427
- * with transforms applied to the wrapper before loading.
6428
- */
6429
- _adopt(lite) {
6430
- const placeholder = this._node;
6431
- const previousAccessibilitySource = this._accessibilitySource();
6432
- lite.parent = placeholder;
6433
- placeholder.children.push(lite);
6434
- lite.name = this.name;
6435
- this._gs = lite;
6436
- this._syncAccessibilityTag(previousAccessibilitySource);
6437
- this._scene?._registerMesh(this);
6740
+ whenReadyAsync() {
6741
+ return Promise.resolve();
6438
6742
  }
6439
- /** @internal Wrap an already-loaded Lite splat node (used by the loader's `ImportMeshAsync` path). */
6440
- static _fromLite(lite, scene) {
6441
- const mesh = new GaussianSplattingMesh(lite.name, null, scene);
6442
- mesh._gs = lite;
6443
- scene._registerMesh(mesh);
6444
- return mesh;
6743
+ };
6744
+ /**
6745
+ * @internal Coerce a raw `ArrayBufferView` (or a bare `Uint8Array`) into the tightly
6746
+ * packed `width * height * depth * 4` RGBA8 `Uint8Array` Babylon Lite's raw-pixel
6747
+ * texture factories expect (`createTexture3DFromPixels`,
6748
+ * `createTexture2DArrayFromPixels`). Babylon.js allows a `null` data argument
6749
+ * (an empty texture); Lite requires bytes, so `null` becomes a zero-filled volume.
6750
+ * For a 2D array, `depth` is the layer count.
6751
+ */
6752
+ function toRgbaBytes(data, width, height, depth) {
6753
+ const expected = width * height * depth * 4;
6754
+ if (data === null) return new Uint8Array(expected);
6755
+ const bytes = data instanceof Uint8Array ? data : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
6756
+ return bytes.byteLength > expected ? bytes.subarray(0, expected) : bytes;
6757
+ }
6758
+ /**
6759
+ * Babylon.js `DynamicTexture` — a canvas-backed texture. Draw into
6760
+ * `getContext()`, then call `update()` to upload the canvas pixels to the GPU.
6761
+ * Backed by Babylon Lite's `createDynamicTexture` / `updateDynamicTexture`, which
6762
+ * blit the canvas straight to the GPU via `copyExternalImageToTexture` (no
6763
+ * `getImageData` CPU readback).
6764
+ */
6765
+ var DynamicTexture = class extends BaseTexture {
6766
+ _scene;
6767
+ _canvas;
6768
+ _context;
6769
+ _width;
6770
+ _height;
6771
+ /** @internal Branded Lite dynamic texture; aliases `_lite` and is the only
6772
+ * handle `updateDynamicTexture` accepts. */
6773
+ _dyn;
6774
+ constructor(name, options, scene) {
6775
+ super();
6776
+ this.name = name;
6777
+ this._scene = scene;
6778
+ this._width = options.width;
6779
+ this._height = options.height;
6780
+ this._canvas = document.createElement("canvas");
6781
+ this._canvas.width = options.width;
6782
+ this._canvas.height = options.height;
6783
+ const ctx = this._canvas.getContext("2d");
6784
+ if (!ctx) throw new Error("DynamicTexture: 2D canvas context unavailable.");
6785
+ this._context = ctx;
6786
+ this._dyn = createDynamicTexture(scene.getEngine()._lite, options.width, options.height);
6787
+ this._lite = this._dyn;
6445
6788
  }
6446
- /** Babylon.js `gs.splatsData` — the raw 32-byte/splat row buffer (for inspection / `updateData`). */
6447
- get splatsData() {
6448
- return this._gs ? this._gs.splatsData : null;
6789
+ getClassName() {
6790
+ return "DynamicTexture";
6449
6791
  }
6450
- /**
6451
- * Babylon.js `gs.updateData(buffer, sh?, options?)` — replace the splat data in
6452
- * place. Babylon Lite always applies its loader's Y convention on update; the
6453
- * `sh` argument is accepted for signature parity and ignored.
6454
- *
6455
- * `options.flipY === false` is honoured: Babylon.js's `.splat` loader flips Y
6456
- * on load by default, so `flipY:false` re-uploads the buffer **without** that
6457
- * flip — i.e. mirrored relative to the default-loaded pose, which ported scenes
6458
- * then correct with `scaling.y = -1`. Lite has no per-call flip flag and always
6459
- * applies its (flip-on-load-equivalent) convention, so we mirror the row Y here
6460
- * to reproduce the `flipY:false` pose before handing the buffer to Lite.
6461
- */
6462
- updateData(splatBuffer, _sh, options) {
6463
- const buffer = options?.flipY === false ? mirrorSplatRowY(splatBuffer) : splatBuffer;
6464
- this._gs?.updateData(buffer);
6792
+ getContext() {
6793
+ return this._context;
6465
6794
  }
6466
- /** Babylon.js `gs.bakeCurrentTransformIntoVertices()` — fold the node transform into the splat data. */
6467
- bakeCurrentTransformIntoVertices() {
6468
- if (this._gs) {
6469
- bakeCurrentTransformIntoVertices(this._gs);
6470
- if (this._gs.parent === this._node) {
6471
- const userChildren = this._node.children.filter((child) => child !== this._gs && child.parent === this._node);
6472
- 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);
6473
- for (const child of userChildren) setParent(child, null);
6474
- this._node.position.set(0, 0, 0);
6475
- this._node.rotation.set(0, 0, 0);
6476
- this._node.scaling.set(1, 1, 1);
6477
- for (const child of userChildren) setParent(child, this._node);
6478
- }
6795
+ getSize() {
6796
+ return {
6797
+ width: this._width,
6798
+ height: this._height
6799
+ };
6800
+ }
6801
+ /** Draw `text` and refresh the GPU texture. */
6802
+ drawText(text, x, y, font, color, clearColor) {
6803
+ const ctx = this._context;
6804
+ if (clearColor) {
6805
+ ctx.fillStyle = clearColor;
6806
+ ctx.fillRect(0, 0, this._width, this._height);
6479
6807
  }
6808
+ ctx.font = font;
6809
+ ctx.fillStyle = color;
6810
+ ctx.fillText(text, x, y);
6811
+ this.update();
6480
6812
  }
6481
- /** @internal Babylon.js's worker-throttle flag; ported scenes poll it to detect the first sort. */
6482
- get _canPostToWorker() {
6483
- return this._gs ? this._gs._orderPool.length === 2 : false;
6813
+ /**
6814
+ * Blit the current canvas pixels straight to the GPU texture (no CPU readback).
6815
+ * @param invertY - Flip V so a top-down canvas samples upright. Default `true` (Babylon.js parity).
6816
+ * @param premulAlpha - Treat the upload as premultiplied alpha. Default `false`.
6817
+ * @param _allowGPUOptimization - Accepted for Babylon.js signature parity; the blit is already GPU-direct, so this is a no-op.
6818
+ */
6819
+ update(invertY = true, premulAlpha = false, _allowGPUOptimization = false) {
6820
+ updateDynamicTexture(this._scene.getEngine()._lite, this._dyn, this._canvas, {
6821
+ invertY,
6822
+ premultiplyAlpha: premulAlpha
6823
+ });
6484
6824
  }
6485
- /** @internal The loaded Lite splat node, for the GPU picker's result mapping (undefined until loaded). */
6486
- get _pickLiteNode() {
6487
- return this._gs;
6825
+ whenReadyAsync() {
6826
+ return Promise.resolve();
6488
6827
  }
6489
6828
  };
6490
- //#endregion
6491
- //#region src/meshes/mesh-blending.ts
6492
- var MeshBlendingRadiusClass = /* @__PURE__ */ function(MeshBlendingRadiusClass) {
6493
- MeshBlendingRadiusClass[MeshBlendingRadiusClass["Small"] = 0] = "Small";
6494
- MeshBlendingRadiusClass[MeshBlendingRadiusClass["Medium"] = 1] = "Medium";
6495
- MeshBlendingRadiusClass[MeshBlendingRadiusClass["Large"] = 2] = "Large";
6496
- MeshBlendingRadiusClass[MeshBlendingRadiusClass["ExtraLarge"] = 3] = "ExtraLarge";
6497
- return MeshBlendingRadiusClass;
6498
- }({});
6499
- function PackMeshBlendingTag(groupId, radiusClass) {
6500
- return packMeshBlendingTag(groupId, radiusClass);
6501
- }
6502
- function UnpackMeshBlendingTag(tag) {
6503
- const unpacked = unpackMeshBlendingTag(tag);
6504
- return {
6505
- groupId: unpacked.groupId,
6506
- radiusClass: unpacked.radiusClass
6507
- };
6508
- }
6509
- var MeshBlendQuality = /* @__PURE__ */ function(MeshBlendQuality) {
6510
- MeshBlendQuality[MeshBlendQuality["Low"] = 0] = "Low";
6511
- MeshBlendQuality[MeshBlendQuality["Medium"] = 1] = "Medium";
6512
- MeshBlendQuality[MeshBlendQuality["High"] = 2] = "High";
6513
- MeshBlendQuality[MeshBlendQuality["Cinematic"] = 3] = "Cinematic";
6514
- return MeshBlendQuality;
6515
- }({});
6516
- var MeshBlendDebugMode = /* @__PURE__ */ function(MeshBlendDebugMode) {
6517
- MeshBlendDebugMode[MeshBlendDebugMode["Off"] = 0] = "Off";
6518
- MeshBlendDebugMode[MeshBlendDebugMode["PackedTag"] = 1] = "PackedTag";
6519
- MeshBlendDebugMode[MeshBlendDebugMode["CandidateDirectionDistance"] = 2] = "CandidateDirectionDistance";
6520
- MeshBlendDebugMode[MeshBlendDebugMode["SeamFade"] = 3] = "SeamFade";
6521
- MeshBlendDebugMode[MeshBlendDebugMode["RejectionReason"] = 4] = "RejectionReason";
6522
- MeshBlendDebugMode[MeshBlendDebugMode["StageWork"] = 5] = "StageWork";
6523
- MeshBlendDebugMode[MeshBlendDebugMode["Continuation"] = 6] = "Continuation";
6524
- MeshBlendDebugMode[MeshBlendDebugMode["TinyObject"] = 7] = "TinyObject";
6525
- MeshBlendDebugMode[MeshBlendDebugMode["MultiTarget"] = 8] = "MultiTarget";
6526
- MeshBlendDebugMode[MeshBlendDebugMode["TargetColor"] = 9] = "TargetColor";
6527
- MeshBlendDebugMode[MeshBlendDebugMode["ShadowAttenuation"] = 10] = "ShadowAttenuation";
6528
- MeshBlendDebugMode[MeshBlendDebugMode["ColorInterpolation"] = 11] = "ColorInterpolation";
6529
- MeshBlendDebugMode[MeshBlendDebugMode["WorldPosition"] = 12] = "WorldPosition";
6530
- return MeshBlendDebugMode;
6531
- }({});
6532
- var MeshBlendDepthType = /* @__PURE__ */ function(MeshBlendDepthType) {
6533
- MeshBlendDepthType[MeshBlendDepthType["View"] = 0] = "View";
6534
- MeshBlendDepthType[MeshBlendDepthType["Screen"] = 1] = "Screen";
6535
- return MeshBlendDepthType;
6536
- }({});
6537
- function CreateDefaultMeshBlendRadiusDefinitions() {
6538
- return createDefaultMeshBlendRadiusDefinitions();
6539
- }
6540
- var MESH_BLENDING_BLOCKER = "Babylon Lite supports mesh blending through its native createMeshBlendingPostProcessTask API; the Babylon.js post-process, frame-graph, and node-render-graph wrapper classes are not implemented by the compat layer.";
6541
- var ThinMeshBlendingPostProcess = class {
6542
- constructor(..._args) {
6543
- unsupported("ThinMeshBlendingPostProcess", MESH_BLENDING_BLOCKER);
6829
+ /**
6830
+ * Babylon.js `CubeTexture` — environment/skybox cube map. Babylon Lite loads
6831
+ * environments through `loadEnvironment` (IBL + skybox registered on the scene)
6832
+ * rather than as a standalone GPU texture object. This compat `CubeTexture`
6833
+ * therefore acts as a lightweight handle that records the environment URL; the
6834
+ * actual GPU work happens when it is assigned to `scene.environmentTexture` and
6835
+ * the engine starts (see `Scene` env handling). It still extends
6836
+ * {@link BaseTexture} to match the Babylon.js class hierarchy, so it can appear
6837
+ * in `BaseTexture[]` surfaces such as `Material.getActiveTextures()`; because the
6838
+ * environment has no standalone Lite handle, `getInternalTexture()` stays `null`.
6839
+ */
6840
+ var CubeTexture = class CubeTexture extends BaseTexture {
6841
+ /** Source URL of the (prefiltered) environment. */
6842
+ url;
6843
+ /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */
6844
+ coordinatesMode = 0;
6845
+ gammaSpace = true;
6846
+ level = 1;
6847
+ /**
6848
+ * @internal Which Lite environment loader the scene should route this handle
6849
+ * through at engine start. Plain `.env`/`.dds` cube maps load via
6850
+ * `loadEnvironment`/`loadDdsEnvironment`; `HDRCubeTexture` overrides this to
6851
+ * `"hdr"` so the scene picks `loadHdrEnvironment`.
6852
+ */
6853
+ _envLoaderKind = "cube";
6854
+ /** Fires when the cube map is "ready" (resolved on a microtask in this compat layer). */
6855
+ onLoadObservable = new Observable();
6856
+ /**
6857
+ * Babylon.js `CubeTexture.rotationY` — rotation of the environment around the Y axis, in radians. A scene that uses the
6858
+ * texture as its `environmentTexture` turns its image-based lighting with it (see `Scene.environmentTexture`).
6859
+ */
6860
+ rotationY = 0;
6861
+ _ready = false;
6862
+ _readyPromise;
6863
+ constructor(url, _scene, _extensions, _noMipmap, _files, onLoad, _onError, _format, _prefiltered) {
6864
+ super();
6865
+ this.url = url;
6866
+ this.name = url;
6867
+ this._readyPromise = new Promise((resolve) => {
6868
+ queueMicrotask(() => {
6869
+ this._ready = true;
6870
+ if (onLoad) onLoad();
6871
+ this.onLoadObservable.notifyObservers(this);
6872
+ resolve();
6873
+ });
6874
+ });
6544
6875
  }
6545
- };
6546
- var MeshBlendingPostProcess = class {
6547
- constructor(..._args) {
6548
- unsupported("MeshBlendingPostProcess", MESH_BLENDING_BLOCKER);
6876
+ getClassName() {
6877
+ return "CubeTexture";
6549
6878
  }
6550
- };
6551
- var FrameGraphMeshBlendingTask = class {
6552
- constructor(..._args) {
6553
- unsupported("FrameGraphMeshBlendingTask", MESH_BLENDING_BLOCKER);
6879
+ /** Babylon.js `BaseTexture.isReady()`. */
6880
+ isReady() {
6881
+ return this._ready;
6554
6882
  }
6555
- };
6556
- var NodeRenderGraphMeshBlendingPostProcessBlock = class {
6557
- constructor(..._args) {
6558
- unsupported("NodeRenderGraphMeshBlendingPostProcessBlock", MESH_BLENDING_BLOCKER);
6883
+ whenReadyAsync() {
6884
+ return this._readyPromise;
6885
+ }
6886
+ /** Babylon.js `CubeTexture.CreateFromPrefilteredData(url, scene)`. */
6887
+ static CreateFromPrefilteredData(url, scene) {
6888
+ return new CubeTexture(url, scene);
6559
6889
  }
6890
+ dispose() {}
6560
6891
  };
6561
- function RegisterMeshBlendingPostProcessBlock() {
6562
- return unsupported("RegisterMeshBlendingPostProcessBlock", MESH_BLENDING_BLOCKER);
6563
- }
6564
- //#endregion
6565
- //#region src/textures/textures.ts
6566
- /**
6567
- * Babylon.js-compatible texture wrappers over Babylon Lite's `loadTexture2D`.
6568
- *
6569
- * Babylon.js's `Texture` constructor is synchronous and loads in the background.
6570
- * Babylon Lite loads textures asynchronously. The compat `Texture` kicks off the
6571
- * load in its constructor and resolves `_lite` when ready; assign the texture to
6572
- * a material after `await texture.whenReadyAsync()` (or construct via
6573
- * `Texture.LoadAsync`) so the GPU handle is present when the material binds.
6574
- */
6575
- /** Compression suffix → `loadKtxTexture2D` token, recognised in a pre-resolved KTX URL. */
6576
- var KTX_SUFFIX_RE = /(-astc|-dxt|-etc2|-pvrtc)\.ktx(\?.*)?$/i;
6577
- /**
6578
- * @internal Recognise a pre-resolved compressed KTX URL and split it into the
6579
- * `{ baseUrl, suffix }` pair Babylon Lite's `loadKtxTexture2D` expects (which
6580
- * takes a base image URL plus a format suffix and reconstructs the KTX URL
6581
- * itself), or `null` when the URL is not a compressed KTX.
6582
- *
6583
- * Babylon.js code selects the format via `engine.getCaps()` and hands `Texture`
6584
- * a single fully-qualified `.ktx` URL (e.g. `…/grid-dxt.ktx`), so the base is the
6585
- * `.png` fallback (`…/grid.png`) and the suffix is `-dxt.ktx`. Any query string
6586
- * (auth / cache-busting / signed-URL params) is preserved on the base URL so it
6587
- * survives onto both the KTX fetch and the `.png` fallback.
6588
- */
6589
- function resolveKtxUrl(url) {
6590
- const ktx = url.match(KTX_SUFFIX_RE);
6591
- if (!ktx) return null;
6592
- return {
6593
- baseUrl: url.replace(KTX_SUFFIX_RE, ".png$2"),
6594
- suffix: ktx[1] + ".ktx"
6595
- };
6596
- }
6597
6892
  /**
6598
- * Pick the right Babylon Lite loader for a texture URL:
6599
- * - `.basis` → `loadBasisTexture2D` (GPU-format transcode; manages its own V-flip).
6600
- * - a pre-resolved compressed KTX (`…-dxt.ktx` etc.) → `loadKtxTexture2D` (see
6601
- * {@link resolveKtxUrl}), which re-checks device support and falls back to the
6602
- * base image.
6603
- * - everything else → the raster `loadTexture2D`.
6604
- *
6605
- * The basis/KTX loaders manage their own V-orientation, so the raster-only
6606
- * `invertY` / `mipMaps` options are ignored there — passing the same opts is safe.
6893
+ * Babylon.js `HDRCubeTexture` — a Radiance `.hdr` (RGBE) equirectangular panorama
6894
+ * used as an environment / IBL source. Like {@link CubeTexture} this is a
6895
+ * lightweight handle that records the `.hdr` URL; the actual GPU work (equirect →
6896
+ * prefiltered cubemap + irradiance SH + BRDF LUT) happens when it is assigned to
6897
+ * `scene.environmentTexture` and the engine starts, at which point the scene
6898
+ * routes it through Babylon Lite's native `loadHdrEnvironment`.
6607
6899
  */
6608
- function loadCompatTexture(engine, url, opts) {
6609
- if (url.split(/[?#]/)[0].toLowerCase().endsWith(".basis")) return loadBasisTexture2D(engine, url, opts);
6610
- const ktx = resolveKtxUrl(url);
6611
- if (ktx) return loadKtxTexture2D(engine, ktx.baseUrl, [ktx.suffix], opts);
6612
- return loadTexture2D(engine, url, opts);
6613
- }
6614
- var BaseTexture = class {
6615
- name = "";
6616
- /** @internal The underlying Lite texture handle. Undefined until the async load resolves. */
6617
- _lite;
6618
- /** @internal One-shot listeners fired when the GPU handle first resolves (see {@link _onReady}). */
6619
- _readyListeners;
6620
- getClassName() {
6621
- return "BaseTexture";
6622
- }
6900
+ var HDRCubeTexture = class extends BaseTexture {
6901
+ /** Source URL of the `.hdr` panorama. */
6902
+ url;
6903
+ /** Requested cubemap face size (BJS `size`); forwarded to Lite's `faceSize`. */
6904
+ size;
6905
+ /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */
6906
+ coordinatesMode = 0;
6907
+ gammaSpace = true;
6908
+ level = 1;
6909
+ /** @internal Selects Lite's `loadHdrEnvironment` in the scene's env loader. */
6910
+ _envLoaderKind = "hdr";
6911
+ /** Fires when the HDR environment is "ready" (resolved on a microtask). */
6912
+ onLoadObservable = new Observable();
6623
6913
  /**
6624
- * @internal Register a callback fired once this texture's GPU handle resolves.
6625
- * Owning compat materials use it to rebind and rebuild once an asynchronously
6626
- * loaded texture becomes available. Fires immediately if the handle already
6627
- * exists; otherwise queues until {@link _notifyReady}. One-shot per listener.
6914
+ * Babylon.js `HDRCubeTexture.rotationY` — rotation of the environment around the Y axis, in radians. A scene that uses the
6915
+ * texture as its `environmentTexture` turns its image-based lighting with it (see `Scene.environmentTexture`).
6628
6916
  */
6629
- _onReady(listener) {
6630
- if (this._lite) {
6631
- listener();
6632
- return;
6633
- }
6634
- (this._readyListeners ??= []).push(listener);
6917
+ rotationY = 0;
6918
+ _ready = false;
6919
+ _readyPromise;
6920
+ constructor(url, _sceneOrEngine, size = 256, _noMipmap, _generateHarmonics, _gammaSpace, _prefilterOnLoad, onLoad) {
6921
+ super();
6922
+ this.url = url;
6923
+ this.size = size;
6924
+ this.name = url;
6925
+ this._readyPromise = new Promise((resolve) => {
6926
+ queueMicrotask(() => {
6927
+ this._ready = true;
6928
+ if (onLoad) onLoad();
6929
+ this.onLoadObservable.notifyObservers(this);
6930
+ resolve();
6931
+ });
6932
+ });
6635
6933
  }
6636
- /** @internal Fire and clear the readiness listeners (called by subclasses once `_lite` resolves). */
6637
- _notifyReady() {
6638
- const listeners = this._readyListeners;
6639
- if (listeners) {
6640
- this._readyListeners = void 0;
6641
- for (const listener of listeners) listener();
6642
- }
6934
+ getClassName() {
6935
+ return "HDRCubeTexture";
6643
6936
  }
6644
- /**
6645
- * Babylon.js `BaseTexture.getInternalTexture()` — the backend texture handle. Babylon.js
6646
- * returns an `InternalTexture`; the compat layer's equivalent is the Lite texture handle,
6647
- * which is what the compat engine's texture methods accept.
6648
- */
6649
- getInternalTexture() {
6650
- return this._lite ?? null;
6937
+ /** Babylon.js `BaseTexture.isReady()`. */
6938
+ isReady() {
6939
+ return this._ready;
6940
+ }
6941
+ whenReadyAsync() {
6942
+ return this._readyPromise;
6651
6943
  }
6652
6944
  dispose() {}
6653
6945
  };
6654
- /** Babylon.js `HtmlTexture`, forwarding DOM capture and updates to Babylon Lite. */
6655
- var HtmlTexture = class extends BaseTexture {
6656
- element;
6657
- host;
6658
- onLoadObservable = new Observable(void 0, true);
6659
- _engine;
6660
- _textureMatrix = Matrix.Identity();
6661
- _ready;
6662
- _htmlTexture;
6663
- _disposed = false;
6664
- constructor(name, element, options) {
6946
+ /** Babylon.js `RenderTargetTexture` — offscreen render target. Use the native frame-graph RTT APIs. */
6947
+ var RenderTargetTexture = class {
6948
+ constructor() {
6949
+ unsupported("RenderTargetTexture", "Offscreen rendering uses Babylon Lite's frame-graph render-target APIs (`createRenderTargetTexture` / render tasks).");
6950
+ }
6951
+ };
6952
+ //#endregion
6953
+ //#region src/lights/area-light-texture-tools.ts
6954
+ var ProcessedAreaLightTexture = class extends BaseTexture {
6955
+ constructor(texture) {
6665
6956
  super();
6666
- this.name = name;
6667
- this.element = element;
6668
- this._engine = options.scene?.getEngine() ?? options.engine ?? null;
6669
- this.host = this._engine?.getRenderingCanvas() ?? null;
6670
- if (!this._engine || !element) {
6671
- this._ready = Promise.reject(/* @__PURE__ */ new Error("HtmlTexture requires an engine and HTML element."));
6672
- this._ready.catch(() => void 0);
6673
- return;
6674
- }
6675
- if (options.format !== void 0 && options.format !== 5) unsupported("HtmlTexture.format", "Babylon Lite HTML textures use RGBA8; alternate Babylon.js texture formats require a new native upload/storage contract.");
6676
- const nearest = options.samplingMode === Texture.NEAREST_SAMPLINGMODE || options.samplingMode === Texture.NEAREST_NEAREST;
6677
- const htmlTexture = createHtmlTexture(this._engine._lite, element, {
6678
- width: options.width,
6679
- height: options.height,
6680
- mipMaps: options.generateMipMaps ?? false,
6681
- autoUpdate: options.autoUpdate ?? true,
6682
- useSvgFallback: options.useSvgFallback ?? true,
6683
- minFilter: nearest ? "nearest" : "linear",
6684
- magFilter: nearest ? "nearest" : "linear",
6685
- invertY: true
6686
- });
6687
- this._htmlTexture = htmlTexture;
6688
- this._ready = whenHtmlTextureReady(htmlTexture).then(() => {
6689
- if (this._disposed) throw new Error("HtmlTexture was disposed before its first upload completed.");
6690
- this._lite = htmlTexture;
6691
- try {
6692
- this.onLoadObservable.notifyObservers(this);
6693
- } finally {
6694
- this._notifyReady();
6695
- }
6696
- });
6697
- this._ready.catch(() => void 0);
6957
+ this._lite = texture;
6698
6958
  }
6699
- getTextureMatrix() {
6700
- return this._textureMatrix;
6959
+ whenReadyAsync() {
6960
+ return Promise.resolve();
6701
6961
  }
6702
- requestUpdate() {
6703
- if (this._engine && this._htmlTexture) requestHtmlTextureUpdate(this._engine._lite, this._htmlTexture);
6962
+ dispose() {
6963
+ if (this._lite) {
6964
+ releaseTexture(this._lite);
6965
+ this._lite = void 0;
6966
+ }
6704
6967
  }
6705
- update(invertY = true) {
6706
- if (this._engine && this._htmlTexture) updateHtmlTexture(this._engine._lite, this._htmlTexture, invertY);
6968
+ };
6969
+ /** Babylon.js `AreaLightTextureTools` forwarding to Lite's native emission-image processor. */
6970
+ var AreaLightTextureTools = class {
6971
+ /** @internal Underlying compat engine whose Lite handle performs the processing. */
6972
+ _engine;
6973
+ /** @internal BJS reports GLSL until the WebGPU processing effect is initialized. */
6974
+ _shaderLanguage = ShaderLanguage.GLSL;
6975
+ /** @internal Whether the Lite processor has completed at least once. */
6976
+ _ready = false;
6977
+ constructor(engine) {
6978
+ this._engine = engine;
6707
6979
  }
6708
- getClassName() {
6709
- return "HtmlTexture";
6980
+ get shaderLanguage() {
6981
+ return this._shaderLanguage;
6710
6982
  }
6711
- whenReadyAsync() {
6983
+ isReady() {
6712
6984
  return this._ready;
6713
6985
  }
6714
- dispose() {
6715
- this._disposed = true;
6716
- if (this._htmlTexture) {
6717
- disposeHtmlTexture(this._htmlTexture);
6718
- this._htmlTexture = void 0;
6719
- }
6720
- this._lite = void 0;
6721
- this.onLoadObservable.clear();
6722
- this.onLoadObservable.cleanLastNotifiedState();
6986
+ async processAsync(source) {
6987
+ await source.whenReadyAsync();
6988
+ if (!source._lite) return null;
6989
+ const processed = await processAreaLightTexture(this._engine._lite, source._lite);
6990
+ this._shaderLanguage = ShaderLanguage.WGSL;
6991
+ this._ready = true;
6992
+ return new ProcessedAreaLightTexture(processed);
6723
6993
  }
6994
+ dispose() {}
6724
6995
  };
6725
- var Texture = class Texture extends BaseTexture {
6726
- _ready;
6727
- _onLoadObservable;
6728
- /** Babylon.js sampling-mode constants (numeric parity). */
6729
- static NEAREST_SAMPLINGMODE = 1;
6730
- static BILINEAR_SAMPLINGMODE = 2;
6731
- static TRILINEAR_SAMPLINGMODE = 3;
6732
- static NEAREST_NEAREST = 8;
6733
- static LINEAR_LINEAR = 11;
6734
- /** Babylon.js coordinate-mode constants (numeric parity). */
6735
- static CLAMP_ADDRESSMODE = 0;
6736
- static WRAP_ADDRESSMODE = 1;
6737
- static MIRROR_ADDRESSMODE = 2;
6738
- /** Babylon.js texture UV tiling (applied to the Lite material at bind time). */
6739
- uScale = 1;
6740
- vScale = 1;
6741
- uOffset = 0;
6742
- vOffset = 0;
6743
- hasAlpha = false;
6744
- coordinatesIndex = 0;
6745
- /** Babylon.js sampling mode passed at construction (`NEAREST_SAMPLINGMODE` = 1, etc.). */
6746
- samplingMode;
6747
- /** @internal The Scene or engine this texture was created against (for `clone`). */
6748
- _source;
6749
- constructor(url, sceneOrEngine, noMipmapOrOptions, invertY, _samplingMode, onLoad) {
6750
- super();
6751
- this.name = url;
6752
- let noMipmap = false;
6753
- let invertYOpt = invertY;
6754
- let samplingMode = _samplingMode;
6755
- if (typeof noMipmapOrOptions === "boolean") noMipmap = noMipmapOrOptions;
6756
- else if (noMipmapOrOptions && typeof noMipmapOrOptions === "object") {
6757
- const o = noMipmapOrOptions;
6758
- noMipmap = o.noMipmap ?? false;
6759
- invertYOpt = invertYOpt ?? o.invertY;
6760
- samplingMode = samplingMode ?? o.samplingMode;
6761
- }
6762
- this._invertY = invertYOpt ?? true;
6763
- this._noMipmap = noMipmap;
6764
- this.samplingMode = samplingMode ?? Texture.BILINEAR_SAMPLINGMODE;
6765
- this._source = sceneOrEngine;
6766
- const scene = sceneOrEngine.getEngine ? sceneOrEngine : void 0;
6767
- const engineWrapper = scene ? void 0 : sceneOrEngine;
6768
- const engine = scene ? scene.getEngine()._lite : engineWrapper._lite;
6769
- const filterOpts = this.samplingMode === Texture.NEAREST_SAMPLINGMODE || this.samplingMode === Texture.NEAREST_NEAREST ? {
6770
- minFilter: "nearest",
6771
- magFilter: "nearest"
6772
- } : {};
6773
- const loadOpts = scene ? {
6774
- invertY: this._invertY,
6775
- mipMaps: !this._noMipmap,
6776
- ...filterOpts
6777
- } : {};
6778
- this._ready = loadCompatTexture(engine, url, loadOpts).then((tex) => {
6779
- this._lite = tex;
6780
- try {
6781
- this._notifyLoadObservable();
6782
- if (onLoad) onLoad();
6783
- } finally {
6784
- this._notifyReady();
6996
+ //#endregion
6997
+ //#region src/meshes/csg.ts
6998
+ /**
6999
+ * Babylon.js `CSG` (legacy) and `CSG2` (Manifold-based) constructive solid
7000
+ * geometry, wrapped over Babylon Lite's native CSG API.
7001
+ *
7002
+ * Babylon.js exposes two object-oriented CSG surfaces:
7003
+ * - `CSG.FromMesh(mesh)` → `.subtract` / `.intersect` / `.union` → `.toMesh(name, material, scene)`
7004
+ * - `CSG2.FromMesh(mesh)` → `.subtract` / `.intersect` / `.add` → `.toMesh(name, scene)` (+ `.dispose()`),
7005
+ * after `await InitializeCSG2Async()`.
7006
+ *
7007
+ * Babylon Lite ships the equivalent as standalone functions
7008
+ * (`createCsgFromMesh` / `csgSubtract` / … / `createMeshFromCsg`, and the CSG2
7009
+ * `createCsg2FromMesh` / `csg2Subtract` / … / `createMeshesFromCsg2`). These
7010
+ * classes adapt the function API to Babylon.js's method-chaining shape.
7011
+ *
7012
+ * CSG (legacy) `toMesh` takes an explicit material and produces a single mesh.
7013
+ * CSG2 preserves per-source materials: each `FromMesh` records its source mesh's
7014
+ * material against a unique slot, operations union those slot→material maps, and
7015
+ * `toMesh` triangulates into one Lite mesh per slot (`createMeshesFromCsg2`),
7016
+ * returning a single compat `Mesh` with the remaining sub-meshes parented under it
7017
+ * so positioning the result moves them together — matching Babylon.js's single
7018
+ * multi-material `toMesh` return.
7019
+ */
7020
+ /**
7021
+ * Babylon.js `CSG` — legacy constructive solid geometry. Build from a mesh with
7022
+ * {@link FromMesh}, combine with {@link subtract} / {@link intersect} /
7023
+ * {@link union}, then materialize with {@link toMesh}.
7024
+ */
7025
+ var CSG = class CSG {
7026
+ _lite;
7027
+ constructor(_lite) {
7028
+ this._lite = _lite;
7029
+ }
7030
+ /** Babylon.js `CSG.FromMesh(mesh)`. */
7031
+ static FromMesh(mesh) {
7032
+ return new CSG(createCsgFromMesh(mesh._lite));
7033
+ }
7034
+ /** Babylon.js `csg.subtract(other)` — `this − other`. */
7035
+ subtract(other) {
7036
+ return new CSG(csgSubtract(this._lite, other._lite));
7037
+ }
7038
+ /** Babylon.js `csg.intersect(other)`. */
7039
+ intersect(other) {
7040
+ return new CSG(csgIntersect(this._lite, other._lite));
7041
+ }
7042
+ /** Babylon.js `csg.union(other)`. */
7043
+ union(other) {
7044
+ return new CSG(csgUnion(this._lite, other._lite));
7045
+ }
7046
+ /** Babylon.js `csg.toMesh(name, material, scene)` — triangulate into a single mesh. */
7047
+ toMesh(name, material, scene) {
7048
+ const engine = scene.getEngine()._lite;
7049
+ const lite = createMeshFromCsg(engine, this._lite, name);
7050
+ const mesh = new Mesh(name, lite, scene);
7051
+ if (material) mesh.material = material;
7052
+ return registerMeshAtStart(mesh, scene);
7053
+ }
7054
+ };
7055
+ /** Module-wide unique material-slot counter for CSG2 (`MATERIAL_ID_RESERVE_COUNT` = 65536). */
7056
+ var nextCsg2Slot = 0;
7057
+ /**
7058
+ * Babylon.js `CSG2` — Manifold-based constructive solid geometry that preserves
7059
+ * per-source-mesh materials. Call `await InitializeCSG2Async()` once before use.
7060
+ */
7061
+ var CSG2 = class CSG2 {
7062
+ _lite;
7063
+ _materials;
7064
+ constructor(_lite, _materials) {
7065
+ this._lite = _lite;
7066
+ this._materials = _materials;
7067
+ }
7068
+ /** Babylon.js `CSG2.FromMesh(mesh)` — records the mesh's material against a unique slot. */
7069
+ static FromMesh(mesh) {
7070
+ const slot = nextCsg2Slot++;
7071
+ const materials = /* @__PURE__ */ new Map();
7072
+ if (mesh.material) materials.set(slot, mesh.material);
7073
+ return new CSG2(createCsg2FromMesh(mesh._lite, slot), materials);
7074
+ }
7075
+ _combine(lite, other) {
7076
+ const materials = new Map(this._materials);
7077
+ for (const [slot, material] of other._materials) materials.set(slot, material);
7078
+ return new CSG2(lite, materials);
7079
+ }
7080
+ /** Babylon.js `csg.subtract(other)` — `this − other`. */
7081
+ subtract(other) {
7082
+ return this._combine(csg2Subtract(this._lite, other._lite), other);
7083
+ }
7084
+ /** Babylon.js `csg.intersect(other)`. */
7085
+ intersect(other) {
7086
+ return this._combine(csg2Intersect(this._lite, other._lite), other);
7087
+ }
7088
+ /** Babylon.js `csg.add(other)` — union. */
7089
+ add(other) {
7090
+ return this._combine(csg2Add(this._lite, other._lite), other);
7091
+ }
7092
+ /**
7093
+ * Babylon.js `csg.toMesh(name, scene)` — triangulate into a single mesh,
7094
+ * preserving each source mesh's material across the result's faces.
7095
+ */
7096
+ toMesh(name, scene) {
7097
+ const engine = scene.getEngine()._lite;
7098
+ const materials = [];
7099
+ for (const [slot, material] of this._materials) {
7100
+ attachMaterialToScene(material, scene);
7101
+ materials[slot] = material._lite;
7102
+ }
7103
+ const liteMeshes = createMeshesFromCsg2(engine, this._lite, materials, name);
7104
+ const savedMaterials = liteMeshes.map((m) => m.material);
7105
+ const root = new Mesh(name, liteMeshes[0], scene);
7106
+ const wrapped = root.material;
7107
+ root._lite.material = savedMaterials[0];
7108
+ scene._deferAdd(() => {
7109
+ const assigned = root.material;
7110
+ if (assigned && assigned !== wrapped) {
7111
+ attachMaterialToScene(assigned, scene);
7112
+ root._lite.material = assigned._lite;
6785
7113
  }
7114
+ addToScene(scene._lite, root._lite);
6786
7115
  });
6787
- scene?._trackTextureLoad(this._ready);
6788
- engineWrapper?._registerStartupWork?.(() => this._ready);
7116
+ for (let i = 1; i < liteMeshes.length; i++) {
7117
+ const sub = liteMeshes[i];
7118
+ sub.material = savedMaterials[i];
7119
+ sub.parent = root._lite;
7120
+ scene._deferAdd(() => addToScene(scene._lite, sub));
7121
+ }
7122
+ return root;
6789
7123
  }
6790
- /** @internal Upload-time vertical flip / mipmap flags, preserved across `clone`. */
6791
- _invertY;
6792
- _noMipmap;
6793
- getClassName() {
6794
- return "Texture";
7124
+ /** Babylon.js `csg.dispose()` — release the underlying Manifold solid. */
7125
+ dispose() {
7126
+ disposeCsg2(this._lite);
6795
7127
  }
7128
+ };
7129
+ /** Babylon.js `InitializeCSG2Async()` — load the Manifold runtime before any `CSG2` use. */
7130
+ async function InitializeCSG2Async() {
7131
+ await initializeCsg2Async();
7132
+ }
7133
+ //#endregion
7134
+ //#region src/meshes/compression.ts
7135
+ /**
7136
+ * Babylon.js `MeshoptCompression` (`@babylonjs/core/Meshes/Compression/meshoptCompression`).
7137
+ *
7138
+ * In Babylon.js this singleton owns the meshopt decoder used by the glTF
7139
+ * `EXT_meshopt_compression` loader extension, and apps configure its decoder URL
7140
+ * via the static `Configuration`. Babylon Lite decodes meshopt-compressed buffers
7141
+ * itself inside its glTF loader feature (`gltf-feature-meshopt`), so no external
7142
+ * decoder needs wiring. This compat shim therefore accepts the `Configuration`
7143
+ * assignment ported code performs (a no-op here) so the import resolves and the
7144
+ * asset still loads — the actual decode happens in Lite.
7145
+ */
7146
+ var MeshoptCompression = class MeshoptCompression {
7147
+ /**
7148
+ * Babylon.js `MeshoptCompression.Configuration` — the decoder location. Stored
7149
+ * for API parity but unused: Babylon Lite's glTF loader carries its own meshopt
7150
+ * decoder, so setting this has no effect on decoding.
7151
+ */
7152
+ static Configuration = { decoder: { url: "" } };
7153
+ static _default = null;
7154
+ /** Babylon.js `MeshoptCompression.Default` — the lazily-created shared instance. */
7155
+ static get Default() {
7156
+ if (!MeshoptCompression._default) MeshoptCompression._default = new MeshoptCompression();
7157
+ return MeshoptCompression._default;
7158
+ }
7159
+ };
7160
+ //#endregion
7161
+ //#region src/morph/morph.ts
7162
+ /**
7163
+ * Babylon.js-compatible `MorphTarget` / `MorphTargetManager` over the Babylon
7164
+ * Lite native morph API (`createMorphTargets` / `setMorphTargetWeights`).
7165
+ *
7166
+ * Babylon.js morph targets carry **absolute** vertex positions/normals
7167
+ * (`target.setPositions(abs)`); Babylon Lite's `createMorphTargets` consumes
7168
+ * per-target **deltas** (target − base). The manager defers building the Lite
7169
+ * morph until engine start (when the owning mesh's base CPU geometry exists),
7170
+ * computes the deltas, and assigns the resulting `MorphTargetData` onto the
7171
+ * Lite mesh so the Standard/NME pipelines sample it. Weight changes
7172
+ * (`target.influence = …`) re-upload via `setMorphTargetWeights`.
7173
+ */
7174
+ /** Babylon.js `MorphTarget` — a single named morph influence with absolute target geometry. */
7175
+ var MorphTarget = class {
7176
+ name;
7177
+ /** @internal Absolute target positions (Babylon.js `setPositions`). */
7178
+ _positions = null;
7179
+ /** @internal Absolute target normals (Babylon.js `setNormals`). */
7180
+ _normals = null;
7181
+ /** @internal Owning manager, set on `addTarget`, used to push weight updates. */
7182
+ _manager;
7183
+ _influence;
7184
+ constructor(name, influence = 0, _scene) {
7185
+ this.name = name;
7186
+ this._influence = influence;
7187
+ }
7188
+ get influence() {
7189
+ return this._influence;
7190
+ }
7191
+ set influence(value) {
7192
+ this._influence = value;
7193
+ this._manager?._syncWeights();
7194
+ }
7195
+ /** Babylon.js `MorphTarget.setPositions(data)` — absolute target positions. */
7196
+ setPositions(data) {
7197
+ this._positions = data ? data instanceof Float32Array ? data : Float32Array.from(data) : null;
7198
+ }
7199
+ /** Babylon.js `MorphTarget.getPositions()`. */
7200
+ getPositions() {
7201
+ return this._positions;
7202
+ }
7203
+ /** Babylon.js `MorphTarget.setNormals(data)` — absolute target normals. */
7204
+ setNormals(data) {
7205
+ this._normals = data ? data instanceof Float32Array ? data : Float32Array.from(data) : null;
7206
+ }
7207
+ /** Babylon.js `MorphTarget.getNormals()`. */
7208
+ getNormals() {
7209
+ return this._normals;
7210
+ }
7211
+ };
7212
+ /** Babylon.js `MorphTargetManager` — owns a mesh's morph targets (Babylon Lite supports up to 4). */
7213
+ var MorphTargetManager = class {
7214
+ /** @internal */
7215
+ _engine;
7216
+ /** @internal Built Lite morph data (created at engine start). */
7217
+ _lite;
7218
+ _targets = [];
7219
+ constructor(_scene) {}
7220
+ get numTargets() {
7221
+ return this._targets.length;
7222
+ }
7223
+ getTarget(index) {
7224
+ return this._targets[index];
7225
+ }
7226
+ /** Babylon.js `MorphTargetManager.addTarget(target)`. */
7227
+ addTarget(target) {
7228
+ target._manager = this;
7229
+ this._targets.push(target);
7230
+ }
7231
+ /**
7232
+ * @internal Build the Lite morph data from the mesh's base CPU geometry and
7233
+ * each target's absolute positions/normals (converted to deltas), then assign
7234
+ * it onto the Lite mesh. Called by the engine at start, once geometry exists.
7235
+ */
7236
+ _build(mesh, engine) {
7237
+ const lite = mesh._lite;
7238
+ const base = lite._cpuPositions;
7239
+ if (!base) return;
7240
+ this._engine = engine;
7241
+ const vertexCount = base.length / 3;
7242
+ const baseNormals = lite._cpuNormals;
7243
+ const targets = this._targets.slice(0, 4).map((t) => {
7244
+ const abs = t._positions;
7245
+ const positions = new Float32Array(base.length);
7246
+ if (abs) for (let i = 0; i < base.length; i++) positions[i] = (abs[i] ?? 0) - base[i];
7247
+ let normals = null;
7248
+ if (t._normals && baseNormals) {
7249
+ normals = new Float32Array(baseNormals.length);
7250
+ for (let i = 0; i < baseNormals.length; i++) normals[i] = (t._normals[i] ?? 0) - baseNormals[i];
7251
+ }
7252
+ return {
7253
+ positions,
7254
+ normals
7255
+ };
7256
+ });
7257
+ const weights = this._targets.slice(0, 4).map((t) => t.influence);
7258
+ this._lite = createMorphTargets(engine, targets, vertexCount, weights);
7259
+ lite.morphTargets = this._lite;
7260
+ }
7261
+ /** @internal Re-upload current target influences to the GPU weights buffer. */
7262
+ _syncWeights() {
7263
+ if (!this._lite || !this._engine) return;
7264
+ const weights = this._targets.slice(0, 4).map((t) => t.influence);
7265
+ setMorphTargetWeights(this._engine, this._lite, weights);
7266
+ }
7267
+ };
7268
+ //#endregion
7269
+ //#region src/meshes/gaussian-splatting.ts
7270
+ /**
7271
+ * Babylon.js-compatible `GaussianSplattingMesh` over Babylon Lite's splat loaders.
7272
+ *
7273
+ * Babylon Lite fully backs Gaussian Splatting: `loadSplat` (`.ply` / `.splat` /
7274
+ * compressed-PLY), `loadSOG`, and `loadSPZ` each return a `GaussianSplattingMesh`
7275
+ * (a `SceneNode` carrying the splat cloud), with `splatsData` / `updateData` for
7276
+ * in-place edits and `bakeCurrentTransformIntoVertices` to fold the node transform
7277
+ * into the splat data. This wrapper exposes that through the Babylon.js
7278
+ * `GaussianSplattingMesh` shape so ported scenes (`new GaussianSplattingMesh(...)` +
7279
+ * `loadFileAsync`, or `ImportMeshAsync` of a splat URL) run unchanged.
7280
+ *
7281
+ * Babylon.js constructs the mesh synchronously and populates it via
7282
+ * `loadFileAsync`; Babylon Lite loads atomically. We bridge this by holding a
7283
+ * lightweight placeholder transform node until the splat loads, buffering any
7284
+ * transforms set in the meantime, then adopting the loaded Lite node.
7285
+ */
7286
+ function _HasGaussianPointSplattingProjectedDepth(projection) {
7287
+ return _hasGaussianPointSplattingProjectedDepth(projection.m);
7288
+ }
7289
+ function _GetPackedShBytesPerSplat(shDegree) {
7290
+ return _getGaussianPointSplattingPackedShBytesPerSplat(shDegree);
7291
+ }
7292
+ /** Lite loader chosen by file extension (mirrors the BJS splat plugin dispatch). */
7293
+ function liteLoaderFor(url) {
7294
+ const lower = url.split("?")[0].toLowerCase();
7295
+ if (lower.endsWith(".sog") || lower.endsWith(".zip")) return loadSOG;
7296
+ if (lower.endsWith(".spz")) return loadSPZ;
7297
+ return loadSplat;
7298
+ }
7299
+ /** Translate Babylon.js's resolution multiplier into Lite's integer downsampling factor. */
7300
+ function litePointSplattingRenderScale(value) {
7301
+ if (value === "auto") return value;
7302
+ const divisor = 1 / value;
7303
+ if (!Number.isFinite(divisor) || !Number.isInteger(divisor) || divisor < 1 || divisor > 8) throw new RangeError("GaussianSplattingMesh.pointSplattingRenderScale must be 'auto' or the reciprocal of an integer from 1 through 8.");
7304
+ return divisor;
7305
+ }
7306
+ /** `.splat` row stride: position(3f) + scale(3f) + rgba(4×u8) + rot(4×u8) = 32 bytes. */
7307
+ var SPLAT_ROW_BYTES = 32;
7308
+ var SPLAT_ROW_FLOATS = SPLAT_ROW_BYTES / 4;
7309
+ var SPLAT_Y_FLOAT_INDEX = 1;
7310
+ /**
7311
+ * @internal Return a copy of a `.splat` buffer with every row's centre Y negated
7312
+ * (the position-space half of Babylon.js's `flipY`). Used to reproduce
7313
+ * `updateData(..., { flipY: false })`. Only the 32-byte `.splat` row layout is
7314
+ * handled; other buffers are returned unchanged.
7315
+ */
7316
+ function mirrorSplatRowY(buffer) {
7317
+ if (buffer.byteLength % SPLAT_ROW_BYTES !== 0) return buffer;
7318
+ const copy = buffer.slice(0);
7319
+ const floats = new Float32Array(copy);
7320
+ for (let f = SPLAT_Y_FLOAT_INDEX; f < floats.length; f += SPLAT_ROW_FLOATS) floats[f] = -floats[f];
7321
+ return copy;
7322
+ }
7323
+ /**
7324
+ * Babylon.js `GaussianSplattingMesh`. Derives from `TransformNode` so the loaded
7325
+ * cloud's `position` / `rotation` / `scaling` proxy onto the Lite splat node.
7326
+ */
7327
+ var GaussianSplattingMesh = class GaussianSplattingMesh extends TransformNode {
7328
+ /** @internal The loaded Lite splat node (undefined until `loadFileAsync` resolves). */
7329
+ _gs;
7330
+ /** @internal The constructor's deferred URL, loaded by `loadFileAsync()` with no argument. */
7331
+ _ctorUrl;
7332
+ /** @internal Optional Lite shader-fragment plugins applied at load (scene 126). */
7333
+ _fragments;
7334
+ /** @internal Point-splatting configuration retained before the native renderer is enabled. */
7335
+ _pointSplattingRenderScale = "auto";
7336
+ /** @internal Point-splatting configuration retained before the native renderer is enabled. */
7337
+ _pointSplattingOcclusionCulling = false;
7338
+ /** @internal Point-splatting configuration retained before the native renderer is enabled. */
7339
+ _pointSplattingScale = 1;
7340
+ /** @internal Native point renderer enabled for this loaded splat, if any. */
7341
+ _pointSplatting = null;
7342
+ /** @internal Requested BJS color-pass ownership, retained before the splat loads. */
7343
+ _pointSplattingRenderMode = false;
7344
+ /** @internal Requested BJS depth-pass ownership, retained before the splat loads. */
7345
+ _pointSplattingDepthRenderMode = false;
6796
7346
  /**
6797
- * Babylon.js `texture.clone()` — a new `Texture` over the same source URL.
6798
- * UV tiling/offset and sampling are copied; the clone re-resolves the GPU
6799
- * handle (tracked against the same scene so it is ready at build).
7347
+ * Babylon.js `gs.safeOrbitCameraLimits` — safe-orbit camera limits parsed from the source
7348
+ * file's metadata (Adobe safe-orbit extension), or `null` when the file carries none.
7349
+ *
7350
+ * Babylon Lite's splat loaders (`loadSplat` / `loadSOG` / `loadSPZ`) do not parse the Adobe
7351
+ * safe-orbit metadata block, so this stays `null` — matching BJS's own default for a file
7352
+ * without the extension. Populating it from real metadata needs a (non-tree-shakeable) change
7353
+ * to Lite's splat loaders; the field is exposed here for shape parity so ported reads resolve.
6800
7354
  */
6801
- clone() {
6802
- const c = new Texture(this.name, this._source, this._noMipmap, this._invertY, this.samplingMode);
6803
- c.uScale = this.uScale;
6804
- c.vScale = this.vScale;
6805
- c.uOffset = this.uOffset;
6806
- c.vOffset = this.vOffset;
6807
- c.hasAlpha = this.hasAlpha;
6808
- c.coordinatesIndex = this.coordinatesIndex;
6809
- return c;
7355
+ safeOrbitCameraLimits = null;
7356
+ get pointSplattingRenderScale() {
7357
+ return this._pointSplattingRenderScale;
6810
7358
  }
6811
- whenReadyAsync() {
6812
- return this._ready;
7359
+ set pointSplattingRenderScale(value) {
7360
+ const liteValue = litePointSplattingRenderScale(value);
7361
+ this._pointSplattingRenderScale = value;
7362
+ if (this._pointSplatting) this._pointSplatting.renderScale = liteValue;
6813
7363
  }
6814
- /** Babylon.js `Texture.onLoadObservable`, allocated only when code subscribes. */
6815
- get onLoadObservable() {
6816
- let observable = this._onLoadObservable;
6817
- if (!observable) {
6818
- observable = new Observable(void 0, true);
6819
- this._onLoadObservable = observable;
6820
- if (this.isReady()) observable.notifyObservers(this);
6821
- }
6822
- return observable;
7364
+ get pointSplattingOcclusionCulling() {
7365
+ return this._pointSplattingOcclusionCulling;
6823
7366
  }
6824
- _notifyLoadObservable() {
6825
- if (this._onLoadObservable) this._onLoadObservable.notifyObservers(this);
7367
+ set pointSplattingOcclusionCulling(value) {
7368
+ this._pointSplattingOcclusionCulling = value;
7369
+ if (this._pointSplatting) this._pointSplatting.occlusionCulling = value;
6826
7370
  }
6827
- /** Babylon.js `BaseTexture.isReady()` — true once the GPU handle has resolved. */
6828
- isReady() {
6829
- return this._lite !== void 0;
7371
+ get pointSplattingRenderMode() {
7372
+ return this._pointSplattingRenderMode;
6830
7373
  }
6831
- /** Load a texture and resolve once its GPU handle is available. */
6832
- static async LoadAsync(url, scene) {
6833
- const texture = new Texture(url, scene);
6834
- await texture.whenReadyAsync();
6835
- return texture;
7374
+ set pointSplattingRenderMode(value) {
7375
+ if (value === this._pointSplattingRenderMode) return;
7376
+ this._pointSplattingRenderMode = value;
7377
+ this._syncPointSplatting();
6836
7378
  }
6837
- };
6838
- /**
6839
- * Babylon.js `RawTexture` — a texture created from raw pixel bytes. Backed by
6840
- * Babylon Lite's `createTexture2DFromPixels`; the GPU handle is available
6841
- * synchronously after construction.
6842
- */
6843
- var RawTexture = class RawTexture extends BaseTexture {
6844
- _scene;
6845
- constructor(data, width, height, scene) {
6846
- super();
6847
- this._scene = scene;
6848
- this._lite = createTexture2DFromPixels(scene.getEngine()._lite, data, width, height);
7379
+ get pointSplattingDepthRenderMode() {
7380
+ return this._pointSplattingDepthRenderMode;
6849
7381
  }
6850
- getClassName() {
6851
- return "RawTexture";
7382
+ set pointSplattingDepthRenderMode(value) {
7383
+ if (value === this._pointSplattingDepthRenderMode) return;
7384
+ this._pointSplattingDepthRenderMode = value;
7385
+ this._syncPointSplatting();
6852
7386
  }
6853
- /** Replace the texture's pixel contents. */
6854
- update(data) {
6855
- if (this._lite) updateTexture2DFromPixels(this._scene.getEngine()._lite, this._lite, data);
7387
+ get pointSplattingProgress() {
7388
+ const progress = this._pointSplatting?.progress;
7389
+ return progress ? {
7390
+ renderedFrameCount: progress.renderedFrameCount,
7391
+ accumulationVersion: progress.accumulationVersion,
7392
+ pixelCycleLength: progress.pixelCycleLength
7393
+ } : null;
6856
7394
  }
6857
- whenReadyAsync() {
6858
- return Promise.resolve();
7395
+ get pointSplattingScale() {
7396
+ return this._pointSplattingScale;
6859
7397
  }
6860
- static CreateRGBATexture(data, width, height, scene) {
6861
- return new RawTexture(data, width, height, scene);
7398
+ set pointSplattingScale(value) {
7399
+ this._pointSplattingScale = value;
7400
+ if (this._pointSplatting) this._pointSplatting.pointScale = value;
6862
7401
  }
6863
- };
6864
- /**
6865
- * Babylon.js `RawTexture3D` — a volumetric texture created from raw RGBA8 pixel
6866
- * bytes (the common case being a colour-grading LUT / colour cube). Backed by
6867
- * Babylon Lite's `createTexture3DFromPixels`; the GPU handle is available
6868
- * synchronously after construction.
6869
- *
6870
- * Babylon Lite's 3D-texture path is RGBA8-only, so the `format` argument is
6871
- * recorded for API parity but the upload always treats `data` as tightly-packed
6872
- * `width * height * depth * 4` RGBA bytes (x fastest, then y, then z).
6873
- */
6874
- var RawTexture3D = class extends BaseTexture {
6875
- format;
6876
- _scene;
6877
- /** Babylon.js `RawTexture3D.is3D` — always true for a 3D texture. */
6878
- is3D = true;
6879
- constructor(data, width, height, depth, format, scene, generateMipMaps = true, _invertY = false, _samplingMode = 3, _textureType, _creationFlags) {
6880
- super();
6881
- this.format = format;
6882
- if (generateMipMaps) unsupported("RawTexture3D(generateMipMaps)", "Babylon.js 3D mip generation renders every depth slice of every level and requires a mip-capable 3D allocation plus a dedicated shader/pipeline. Babylon Lite's public 3D texture factory allocates only one level; adding this GPU subsystem is not a small mechanical extension. Pass false to create a base-level texture.");
6883
- this._scene = scene;
6884
- const bytes = toRgbaBytes(data, width, height, depth);
6885
- this._lite = createTexture3DFromPixels(scene.getEngine()._lite, bytes, width, height, depth);
7402
+ constructor(name, url, scene, _keepInRam) {
7403
+ super(name, scene, createTransformNode(name));
7404
+ this._ctorUrl = url ?? null;
6886
7405
  }
6887
7406
  getClassName() {
6888
- return "RawTexture3D";
7407
+ return "GaussianSplattingMesh";
6889
7408
  }
6890
- /** Gets the width of the texture. */
6891
- get width() {
6892
- return this._lite?.width ?? 0;
7409
+ /** @internal The wrapper's transform node; the loaded cloud is parented beneath it during deferred adoption. */
7410
+ get _xform() {
7411
+ return this._gs?.parent === this._node ? this._node : this._gs ?? this._node;
6893
7412
  }
6894
- /** Gets the height of the texture. */
6895
- get height() {
6896
- return this._lite?.height ?? 0;
7413
+ /** @internal Accessibility metadata belongs to the loaded cloud, or its placeholder before loading. */
7414
+ _accessibilitySource() {
7415
+ return this._gs ?? this._node;
6897
7416
  }
6898
- /** Gets the depth of the texture. */
6899
- get depth() {
6900
- return this._lite?.depth ?? 0;
7417
+ get position() {
7418
+ return liteBackedVector3(this._xform.position);
6901
7419
  }
6902
- /**
6903
- * Replace the texture's pixel contents. Babylon Lite has no in-place 3D update,
6904
- * so the volume is re-uploaded (a fresh Lite 3D texture handle).
6905
- */
6906
- update(data) {
6907
- const bytes = toRgbaBytes(data, this.width, this.height, this.depth);
6908
- this._lite = createTexture3DFromPixels(this._scene.getEngine()._lite, bytes, this.width, this.height, this.depth);
7420
+ set position(value) {
7421
+ this._xform.position.set(value.x, value.y, value.z);
6909
7422
  }
6910
- whenReadyAsync() {
6911
- return Promise.resolve();
7423
+ get rotation() {
7424
+ return liteBackedVector3(this._xform.rotation);
6912
7425
  }
6913
- };
6914
- /**
6915
- * @internal Coerce a raw `ArrayBufferView` (or a bare `Uint8Array`) into the tightly
6916
- * packed `width * height * depth * 4` RGBA8 `Uint8Array` Babylon Lite's raw-pixel
6917
- * texture factories expect (`createTexture3DFromPixels`,
6918
- * `createTexture2DArrayFromPixels`). Babylon.js allows a `null` data argument
6919
- * (an empty texture); Lite requires bytes, so `null` becomes a zero-filled volume.
6920
- * For a 2D array, `depth` is the layer count.
6921
- */
6922
- function toRgbaBytes(data, width, height, depth) {
6923
- const expected = width * height * depth * 4;
6924
- if (data === null) return new Uint8Array(expected);
6925
- const bytes = data instanceof Uint8Array ? data : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
6926
- return bytes.byteLength > expected ? bytes.subarray(0, expected) : bytes;
6927
- }
6928
- /**
6929
- * Babylon.js `DynamicTexture` — a canvas-backed texture. Draw into
6930
- * `getContext()`, then call `update()` to upload the canvas pixels to the GPU.
6931
- * Backed by Babylon Lite's `createDynamicTexture` / `updateDynamicTexture`, which
6932
- * blit the canvas straight to the GPU via `copyExternalImageToTexture` (no
6933
- * `getImageData` CPU readback).
6934
- */
6935
- var DynamicTexture = class extends BaseTexture {
6936
- _scene;
6937
- _canvas;
6938
- _context;
6939
- _width;
6940
- _height;
6941
- /** @internal Branded Lite dynamic texture; aliases `_lite` and is the only
6942
- * handle `updateDynamicTexture` accepts. */
6943
- _dyn;
6944
- constructor(name, options, scene) {
6945
- super();
6946
- this.name = name;
6947
- this._scene = scene;
6948
- this._width = options.width;
6949
- this._height = options.height;
6950
- this._canvas = document.createElement("canvas");
6951
- this._canvas.width = options.width;
6952
- this._canvas.height = options.height;
6953
- const ctx = this._canvas.getContext("2d");
6954
- if (!ctx) throw new Error("DynamicTexture: 2D canvas context unavailable.");
6955
- this._context = ctx;
6956
- this._dyn = createDynamicTexture(scene.getEngine()._lite, options.width, options.height);
6957
- this._lite = this._dyn;
7426
+ set rotation(value) {
7427
+ this._xform.rotation.set(value.x, value.y, value.z);
6958
7428
  }
6959
- getClassName() {
6960
- return "DynamicTexture";
7429
+ get scaling() {
7430
+ return liteBackedVector3(this._xform.scaling);
6961
7431
  }
6962
- getContext() {
6963
- return this._context;
7432
+ set scaling(value) {
7433
+ this._xform.scaling.set(value.x, value.y, value.z);
6964
7434
  }
6965
- getSize() {
6966
- return {
6967
- width: this._width,
6968
- height: this._height
6969
- };
7435
+ /** @internal Set the Lite shader-fragment plugins applied on the next load (compat material-plugin path). */
7436
+ _setFragments(fragments) {
7437
+ this._fragments = fragments;
6970
7438
  }
6971
- /** Draw `text` and refresh the GPU texture. */
6972
- drawText(text, x, y, font, color, clearColor) {
6973
- const ctx = this._context;
6974
- if (clearColor) {
6975
- ctx.fillStyle = clearColor;
6976
- ctx.fillRect(0, 0, this._width, this._height);
6977
- }
6978
- ctx.font = font;
6979
- ctx.fillStyle = color;
6980
- ctx.fillText(text, x, y);
6981
- this.update();
7439
+ /**
7440
+ * Babylon.js `gs.loadFileAsync(url?)` — fetch + parse a splat asset and adopt
7441
+ * the resulting Lite node. With no argument, loads the constructor URL.
7442
+ */
7443
+ async loadFileAsync(url) {
7444
+ const target = url ?? this._ctorUrl;
7445
+ if (!target) throw new Error("GaussianSplattingMesh.loadFileAsync: no URL provided (and none given to the constructor).");
7446
+ const scene = this._scene;
7447
+ if (!scene) throw new Error("GaussianSplattingMesh.loadFileAsync requires a scene (pass one to the constructor).");
7448
+ const lite = await liteLoaderFor(target)(scene._lite, target, this._fragments);
7449
+ this._adopt(lite);
7450
+ return this;
6982
7451
  }
6983
7452
  /**
6984
- * Blit the current canvas pixels straight to the GPU texture (no CPU readback).
6985
- * @param invertY - Flip V so a top-down canvas samples upright. Default `true` (Babylon.js parity).
6986
- * @param premulAlpha - Treat the upload as premultiplied alpha. Default `false`.
6987
- * @param _allowGPUOptimization - Accepted for Babylon.js signature parity; the blit is already GPU-direct, so this is a no-op.
7453
+ * @internal Adopt a loaded Lite splat node from either the mesh or loader-plugin API.
7454
+ * Parenting preserves the loader's format-specific local transform while composing it
7455
+ * with transforms applied to the wrapper before loading.
6988
7456
  */
6989
- update(invertY = true, premulAlpha = false, _allowGPUOptimization = false) {
6990
- updateDynamicTexture(this._scene.getEngine()._lite, this._dyn, this._canvas, {
6991
- invertY,
6992
- premultiplyAlpha: premulAlpha
7457
+ _adopt(lite) {
7458
+ const placeholder = this._node;
7459
+ const previousAccessibilitySource = this._accessibilitySource();
7460
+ this._disablePointSplatting();
7461
+ lite.parent = placeholder;
7462
+ placeholder.children.push(lite);
7463
+ lite.name = this.name;
7464
+ this._gs = lite;
7465
+ this._syncPointSplatting();
7466
+ this._syncAccessibilityTag(previousAccessibilitySource);
7467
+ this._scene?._registerMesh(this);
7468
+ }
7469
+ /** @internal Wrap an already-loaded Lite splat node (used by the loader's `ImportMeshAsync` path). */
7470
+ static _fromLite(lite, scene) {
7471
+ const mesh = new GaussianSplattingMesh(lite.name, null, scene);
7472
+ mesh._gs = lite;
7473
+ mesh._syncPointSplatting();
7474
+ scene._registerMesh(mesh);
7475
+ return mesh;
7476
+ }
7477
+ /** @internal Reconcile BJS point-mode state with Lite's opt-in renderer. */
7478
+ _syncPointSplatting() {
7479
+ if (!this._gs || !this._scene) return;
7480
+ if (!this._pointSplattingRenderMode && !this._pointSplattingDepthRenderMode) {
7481
+ this._disablePointSplatting();
7482
+ return;
7483
+ }
7484
+ this._pointSplatting = enableGaussianPointSplatting(this._scene._lite, this._gs, {
7485
+ colorRenderMode: this._pointSplattingRenderMode,
7486
+ depthRenderMode: this._pointSplattingDepthRenderMode,
7487
+ pointScale: this._pointSplattingScale,
7488
+ renderScale: litePointSplattingRenderScale(this._pointSplattingRenderScale),
7489
+ occlusionCulling: this._pointSplattingOcclusionCulling
6993
7490
  });
6994
7491
  }
6995
- whenReadyAsync() {
6996
- return Promise.resolve();
7492
+ /** @internal Release the point renderer owned by the currently adopted splat. */
7493
+ _disablePointSplatting() {
7494
+ if (this._pointSplatting && this._scene) {
7495
+ disableGaussianPointSplatting(this._scene._lite, this._pointSplatting);
7496
+ this._pointSplatting = null;
7497
+ }
7498
+ }
7499
+ /** Babylon.js `gs.splatsData` — the raw 32-byte/splat row buffer (for inspection / `updateData`). */
7500
+ get splatsData() {
7501
+ return this._gs ? this._gs.splatsData : null;
6997
7502
  }
6998
- };
6999
- /**
7000
- * Babylon.js `CubeTexture` — environment/skybox cube map. Babylon Lite loads
7001
- * environments through `loadEnvironment` (IBL + skybox registered on the scene)
7002
- * rather than as a standalone GPU texture object. This compat `CubeTexture`
7003
- * therefore acts as a lightweight handle that records the environment URL; the
7004
- * actual GPU work happens when it is assigned to `scene.environmentTexture` and
7005
- * the engine starts (see `Scene` env handling). It still extends
7006
- * {@link BaseTexture} to match the Babylon.js class hierarchy, so it can appear
7007
- * in `BaseTexture[]` surfaces such as `Material.getActiveTextures()`; because the
7008
- * environment has no standalone Lite handle, `getInternalTexture()` stays `null`.
7009
- */
7010
- var CubeTexture = class CubeTexture extends BaseTexture {
7011
- /** Source URL of the (prefiltered) environment. */
7012
- url;
7013
- /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */
7014
- coordinatesMode = 0;
7015
- gammaSpace = true;
7016
- level = 1;
7017
7503
  /**
7018
- * @internal Which Lite environment loader the scene should route this handle
7019
- * through at engine start. Plain `.env`/`.dds` cube maps load via
7020
- * `loadEnvironment`/`loadDdsEnvironment`; `HDRCubeTexture` overrides this to
7021
- * `"hdr"` so the scene picks `loadHdrEnvironment`.
7504
+ * Babylon.js `gs.updateData(buffer, sh?, options?)` — replace the splat data in
7505
+ * place. Babylon Lite always applies its loader's Y convention on update; the
7506
+ * `sh` argument is accepted for signature parity and ignored.
7507
+ *
7508
+ * `options.flipY === false` is honoured: Babylon.js's `.splat` loader flips Y
7509
+ * on load by default, so `flipY:false` re-uploads the buffer **without** that
7510
+ * flip — i.e. mirrored relative to the default-loaded pose, which ported scenes
7511
+ * then correct with `scaling.y = -1`. Lite has no per-call flip flag and always
7512
+ * applies its (flip-on-load-equivalent) convention, so we mirror the row Y here
7513
+ * to reproduce the `flipY:false` pose before handing the buffer to Lite.
7022
7514
  */
7023
- _envLoaderKind = "cube";
7024
- /** Fires when the cube map is "ready" (resolved on a microtask in this compat layer). */
7025
- onLoadObservable = new Observable();
7026
- _ready = false;
7027
- _readyPromise;
7028
- constructor(url, _scene, _extensions, _noMipmap, _files, onLoad, _onError, _format, _prefiltered) {
7029
- super();
7030
- this.url = url;
7031
- this.name = url;
7032
- this._readyPromise = new Promise((resolve) => {
7033
- queueMicrotask(() => {
7034
- this._ready = true;
7035
- if (onLoad) onLoad();
7036
- this.onLoadObservable.notifyObservers(this);
7037
- resolve();
7038
- });
7039
- });
7515
+ updateData(splatBuffer, _sh, options) {
7516
+ const buffer = options?.flipY === false ? mirrorSplatRowY(splatBuffer) : splatBuffer;
7517
+ this._gs?.updateData(buffer);
7040
7518
  }
7041
- getClassName() {
7042
- return "CubeTexture";
7519
+ /** Babylon.js `gs.bakeCurrentTransformIntoVertices()` — fold the node transform into the splat data. */
7520
+ bakeCurrentTransformIntoVertices() {
7521
+ if (this._gs) {
7522
+ bakeCurrentTransformIntoVertices(this._gs);
7523
+ if (this._gs.parent === this._node) {
7524
+ const userChildren = this._node.children.filter((child) => child !== this._gs && child.parent === this._node);
7525
+ 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);
7526
+ for (const child of userChildren) setParent(child, null);
7527
+ this._node.position.set(0, 0, 0);
7528
+ this._node.rotation.set(0, 0, 0);
7529
+ this._node.scaling.set(1, 1, 1);
7530
+ for (const child of userChildren) setParent(child, this._node);
7531
+ }
7532
+ }
7043
7533
  }
7044
- /** Babylon.js `BaseTexture.isReady()`. */
7045
- isReady() {
7046
- return this._ready;
7534
+ /** @internal Babylon.js's worker-throttle flag; ported scenes poll it to detect the first sort. */
7535
+ get _canPostToWorker() {
7536
+ return this._gs ? this._gs._orderPool.length === 2 : false;
7047
7537
  }
7048
- whenReadyAsync() {
7049
- return this._readyPromise;
7538
+ /** @internal The loaded Lite splat node, for the GPU picker's result mapping (undefined until loaded). */
7539
+ get _pickLiteNode() {
7540
+ return this._gs;
7050
7541
  }
7051
- /** Babylon.js `CubeTexture.CreateFromPrefilteredData(url, scene)`. */
7052
- static CreateFromPrefilteredData(url, scene) {
7053
- return new CubeTexture(url, scene);
7542
+ /** @internal Release the opt-in point renderer before removing the splat node. */
7543
+ _disposeSelf(doNotRecurse) {
7544
+ this._disablePointSplatting();
7545
+ super._disposeSelf(doNotRecurse);
7054
7546
  }
7055
- dispose() {}
7056
7547
  };
7057
- /**
7058
- * Babylon.js `HDRCubeTexture` — a Radiance `.hdr` (RGBE) equirectangular panorama
7059
- * used as an environment / IBL source. Like {@link CubeTexture} this is a
7060
- * lightweight handle that records the `.hdr` URL; the actual GPU work (equirect →
7061
- * prefiltered cubemap + irradiance SH + BRDF LUT) happens when it is assigned to
7062
- * `scene.environmentTexture` and the engine starts, at which point the scene
7063
- * routes it through Babylon Lite's native `loadHdrEnvironment`.
7064
- */
7065
- var HDRCubeTexture = class extends BaseTexture {
7066
- /** Source URL of the `.hdr` panorama. */
7067
- url;
7068
- /** Requested cubemap face size (BJS `size`); forwarded to Lite's `faceSize`. */
7069
- size;
7070
- /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */
7071
- coordinatesMode = 0;
7072
- gammaSpace = true;
7073
- level = 1;
7074
- /** @internal Selects Lite's `loadHdrEnvironment` in the scene's env loader. */
7075
- _envLoaderKind = "hdr";
7076
- /** Fires when the HDR environment is "ready" (resolved on a microtask). */
7077
- onLoadObservable = new Observable();
7078
- _ready = false;
7079
- _readyPromise;
7080
- constructor(url, _sceneOrEngine, size = 256, _noMipmap, _generateHarmonics, _gammaSpace, _prefilterOnLoad, onLoad) {
7081
- super();
7082
- this.url = url;
7083
- this.size = size;
7084
- this.name = url;
7085
- this._readyPromise = new Promise((resolve) => {
7086
- queueMicrotask(() => {
7087
- this._ready = true;
7088
- if (onLoad) onLoad();
7089
- this.onLoadObservable.notifyObservers(this);
7090
- resolve();
7091
- });
7092
- });
7093
- }
7094
- getClassName() {
7095
- return "HDRCubeTexture";
7548
+ //#endregion
7549
+ //#region src/meshes/mesh-blending.ts
7550
+ var MeshBlendingRadiusClass = /* @__PURE__ */ function(MeshBlendingRadiusClass) {
7551
+ MeshBlendingRadiusClass[MeshBlendingRadiusClass["Small"] = 0] = "Small";
7552
+ MeshBlendingRadiusClass[MeshBlendingRadiusClass["Medium"] = 1] = "Medium";
7553
+ MeshBlendingRadiusClass[MeshBlendingRadiusClass["Large"] = 2] = "Large";
7554
+ MeshBlendingRadiusClass[MeshBlendingRadiusClass["ExtraLarge"] = 3] = "ExtraLarge";
7555
+ return MeshBlendingRadiusClass;
7556
+ }({});
7557
+ function PackMeshBlendingTag(groupId, radiusClass) {
7558
+ return packMeshBlendingTag(groupId, radiusClass);
7559
+ }
7560
+ function UnpackMeshBlendingTag(tag) {
7561
+ const unpacked = unpackMeshBlendingTag(tag);
7562
+ return {
7563
+ groupId: unpacked.groupId,
7564
+ radiusClass: unpacked.radiusClass
7565
+ };
7566
+ }
7567
+ var MeshBlendQuality = /* @__PURE__ */ function(MeshBlendQuality) {
7568
+ MeshBlendQuality[MeshBlendQuality["Low"] = 0] = "Low";
7569
+ MeshBlendQuality[MeshBlendQuality["Medium"] = 1] = "Medium";
7570
+ MeshBlendQuality[MeshBlendQuality["High"] = 2] = "High";
7571
+ MeshBlendQuality[MeshBlendQuality["Cinematic"] = 3] = "Cinematic";
7572
+ return MeshBlendQuality;
7573
+ }({});
7574
+ var MeshBlendDebugMode = /* @__PURE__ */ function(MeshBlendDebugMode) {
7575
+ MeshBlendDebugMode[MeshBlendDebugMode["Off"] = 0] = "Off";
7576
+ MeshBlendDebugMode[MeshBlendDebugMode["PackedTag"] = 1] = "PackedTag";
7577
+ MeshBlendDebugMode[MeshBlendDebugMode["CandidateDirectionDistance"] = 2] = "CandidateDirectionDistance";
7578
+ MeshBlendDebugMode[MeshBlendDebugMode["SeamFade"] = 3] = "SeamFade";
7579
+ MeshBlendDebugMode[MeshBlendDebugMode["RejectionReason"] = 4] = "RejectionReason";
7580
+ MeshBlendDebugMode[MeshBlendDebugMode["StageWork"] = 5] = "StageWork";
7581
+ MeshBlendDebugMode[MeshBlendDebugMode["Continuation"] = 6] = "Continuation";
7582
+ MeshBlendDebugMode[MeshBlendDebugMode["TinyObject"] = 7] = "TinyObject";
7583
+ MeshBlendDebugMode[MeshBlendDebugMode["MultiTarget"] = 8] = "MultiTarget";
7584
+ MeshBlendDebugMode[MeshBlendDebugMode["TargetColor"] = 9] = "TargetColor";
7585
+ MeshBlendDebugMode[MeshBlendDebugMode["ShadowAttenuation"] = 10] = "ShadowAttenuation";
7586
+ MeshBlendDebugMode[MeshBlendDebugMode["ColorInterpolation"] = 11] = "ColorInterpolation";
7587
+ MeshBlendDebugMode[MeshBlendDebugMode["WorldPosition"] = 12] = "WorldPosition";
7588
+ return MeshBlendDebugMode;
7589
+ }({});
7590
+ var MeshBlendDepthType = /* @__PURE__ */ function(MeshBlendDepthType) {
7591
+ MeshBlendDepthType[MeshBlendDepthType["View"] = 0] = "View";
7592
+ MeshBlendDepthType[MeshBlendDepthType["Screen"] = 1] = "Screen";
7593
+ return MeshBlendDepthType;
7594
+ }({});
7595
+ function CreateDefaultMeshBlendRadiusDefinitions() {
7596
+ return createDefaultMeshBlendRadiusDefinitions();
7597
+ }
7598
+ var MESH_BLENDING_BLOCKER = "Babylon Lite supports mesh blending through its native createMeshBlendingPostProcessTask API; the Babylon.js post-process, frame-graph, and node-render-graph wrapper classes are not implemented by the compat layer.";
7599
+ var ThinMeshBlendingPostProcess = class {
7600
+ constructor(..._args) {
7601
+ unsupported("ThinMeshBlendingPostProcess", MESH_BLENDING_BLOCKER);
7096
7602
  }
7097
- /** Babylon.js `BaseTexture.isReady()`. */
7098
- isReady() {
7099
- return this._ready;
7603
+ };
7604
+ var MeshBlendingPostProcess = class {
7605
+ constructor(..._args) {
7606
+ unsupported("MeshBlendingPostProcess", MESH_BLENDING_BLOCKER);
7100
7607
  }
7101
- whenReadyAsync() {
7102
- return this._readyPromise;
7608
+ };
7609
+ var FrameGraphMeshBlendingTask = class {
7610
+ constructor(..._args) {
7611
+ unsupported("FrameGraphMeshBlendingTask", MESH_BLENDING_BLOCKER);
7103
7612
  }
7104
- dispose() {}
7105
7613
  };
7106
- /** Babylon.js `RenderTargetTexture` — offscreen render target. Use the native frame-graph RTT APIs. */
7107
- var RenderTargetTexture = class {
7108
- constructor() {
7109
- unsupported("RenderTargetTexture", "Offscreen rendering uses Babylon Lite's frame-graph render-target APIs (`createRenderTargetTexture` / render tasks).");
7614
+ var NodeRenderGraphMeshBlendingPostProcessBlock = class {
7615
+ constructor(..._args) {
7616
+ unsupported("NodeRenderGraphMeshBlendingPostProcessBlock", MESH_BLENDING_BLOCKER);
7110
7617
  }
7111
7618
  };
7619
+ function RegisterMeshBlendingPostProcessBlock() {
7620
+ return unsupported("RegisterMeshBlendingPostProcessBlock", MESH_BLENDING_BLOCKER);
7621
+ }
7112
7622
  //#endregion
7113
7623
  //#region src/textures/external-texture.ts
7114
7624
  var nextUniqueId = 0;
@@ -8350,14 +8860,19 @@ var PositionGizmo = class extends GizmoBase {
8350
8860
  return this._attached;
8351
8861
  }
8352
8862
  set attachedMesh(value) {
8353
- this._attached = value;
8354
- attachPositionGizmoToNode(this._lite, value?._lite ?? null);
8863
+ this.attachedNode = value;
8355
8864
  }
8865
+ /**
8866
+ * Babylon.js `attachedNode` — a mesh, a `TransformNode` (whose Lite node is `_node` rather than `_lite`) or a light.
8867
+ * Cameras throw a `LiteCompatError`: see {@link transformTargetLite}.
8868
+ */
8356
8869
  get attachedNode() {
8357
8870
  return this._attached;
8358
8871
  }
8359
8872
  set attachedNode(value) {
8360
- this.attachedMesh = value;
8873
+ const target = transformTargetLite(value, "PositionGizmo.attachedNode");
8874
+ this._attached = value;
8875
+ attachPositionGizmoToNode(this._lite, target);
8361
8876
  }
8362
8877
  dispose() {
8363
8878
  disposePositionGizmo(this._lite, this._layer._lite);
@@ -8407,14 +8922,19 @@ var RotationGizmo = class extends GizmoBase {
8407
8922
  return this._attached;
8408
8923
  }
8409
8924
  set attachedMesh(value) {
8410
- this._attached = value;
8411
- attachRotationGizmoToNode(this._lite, value?._lite ?? null);
8925
+ this.attachedNode = value;
8412
8926
  }
8927
+ /**
8928
+ * Babylon.js `attachedNode` — a mesh, a `TransformNode` (whose Lite node is `_node` rather than `_lite`) or a light.
8929
+ * Cameras throw a `LiteCompatError`: see {@link transformTargetLite}.
8930
+ */
8413
8931
  get attachedNode() {
8414
8932
  return this._attached;
8415
8933
  }
8416
8934
  set attachedNode(value) {
8417
- this.attachedMesh = value;
8935
+ const target = transformTargetLite(value, "RotationGizmo.attachedNode");
8936
+ this._attached = value;
8937
+ attachRotationGizmoToNode(this._lite, target);
8418
8938
  }
8419
8939
  dispose() {
8420
8940
  disposeRotationGizmo(this._lite, this._layer._lite);
@@ -8455,14 +8975,19 @@ var ScaleGizmo = class extends GizmoBase {
8455
8975
  return this._attached;
8456
8976
  }
8457
8977
  set attachedMesh(value) {
8458
- this._attached = value;
8459
- attachScaleGizmoToNode(this._lite, value?._lite ?? null);
8978
+ this.attachedNode = value;
8460
8979
  }
8980
+ /**
8981
+ * Babylon.js `attachedNode` — a mesh, a `TransformNode` (whose Lite node is `_node` rather than `_lite`) or a light.
8982
+ * Cameras throw a `LiteCompatError`: see {@link transformTargetLite}.
8983
+ */
8461
8984
  get attachedNode() {
8462
8985
  return this._attached;
8463
8986
  }
8464
8987
  set attachedNode(value) {
8465
- this.attachedMesh = value;
8988
+ const target = transformTargetLite(value, "ScaleGizmo.attachedNode");
8989
+ this._attached = value;
8990
+ attachScaleGizmoToNode(this._lite, target);
8466
8991
  }
8467
8992
  dispose() {
8468
8993
  disposeScaleGizmo(this._lite, this._layer._lite);
@@ -8578,6 +9103,16 @@ function nodeLite(value) {
8578
9103
  return n._lite ?? n._node ?? null;
8579
9104
  }
8580
9105
  /**
9106
+ * Lite node for a composite gizmo target. The native gizmos edit the target's `position`, `rotationQuaternion` and
9107
+ * `scaling`. Meshes, transform nodes and lights have them; Lite cameras do not (an orbit camera has none, a free camera
9108
+ * only `position`), so a camera is rejected before attachment instead of failing on the first drag.
9109
+ */
9110
+ function transformTargetLite(value, api) {
9111
+ const lite = nodeLite(value);
9112
+ if (lite && !(lite.position && lite.rotationQuaternion && lite.scaling)) unsupported(api, `A ${value.getClassName()} has no editable transform in Babylon Lite. Attach the gizmo to a mesh, transform node or light.`);
9113
+ return lite;
9114
+ }
9115
+ /**
8581
9116
  * @internal Build a single-axis/plane gizmo wrapper around a Lite sub-gizmo that
8582
9117
  * a composite already created, without re-running the public constructor (which
8583
9118
  * would build a second Lite gizmo). Used by the composite `xGizmo`/`yGizmo`/`zGizmo`
@@ -11488,7 +12023,7 @@ var MaterialPluginBase = class MaterialPluginBase {
11488
12023
  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.";
11489
12024
  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.";
11490
12025
  var GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED = "Lite's Gaussian-splat renderable fixes shader fragments and render state at load time and exposes no post-load material replacement or pipeline-rebuild lifecycle. Supporting Babylon.js GaussianSplattingMaterial plugins requires an opt-in Lite splat-material lifecycle design.";
11491
- var GAUSSIAN_POINT_SPLATTING_UNSUPPORTED = "Babylon.js Gaussian Point Splatting is a separate stochastic WebGPU compute-renderer subsystem with accumulation, Hi-Z culling, depth-pass integration, and fullscreen compositing lifecycles. Lite's sorted-splat renderer has no equivalent compute or pass-ownership model, and adding one requires broad engine design rather than a small mechanical export.";
12026
+ var GAUSSIAN_POINT_SPLATTING_UNSUPPORTED = "Lite exposes Gaussian Point Splatting through a scene-integrated high-level handle. Babylon.js's standalone renderer and blit-material classes expose manual accumulation/depth buffers and pass-level GPU control, which cannot be adapted without exposing raw GPU resources forbidden by Lite's public API.";
11492
12027
  var SHADER_MATERIAL_UNSUPPORTED = "Lite accepts standalone WGSL, but Babylon.js ShaderMaterial sources rely on the Effect shader-store/preprocessor dialect (attribute/varying declarations and injected VertexInputs/FragmentInputs); adapting it requires a shader preprocessing subsystem.";
11493
12028
  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.";
11494
12029
  var FlowGraphValidationSeverity = /* @__PURE__ */ function(FlowGraphValidationSeverity) {
@@ -11502,6 +12037,12 @@ function ValidateFlowGraph(_flowGraph) {
11502
12037
  function ValidateFlowGraphWithBlockList(_flowGraph, _allKnownBlocks) {
11503
12038
  return unsupported("ValidateFlowGraphWithBlockList", FLOW_GRAPH_UNSUPPORTED);
11504
12039
  }
12040
+ function RemoveFlowGraphAnimationGroupObservers(_context, _animationGroup) {
12041
+ return unsupported("RemoveFlowGraphAnimationGroupObservers", FLOW_GRAPH_UNSUPPORTED);
12042
+ }
12043
+ function defaultValueParseFunction(_key, _serializationObject, _assetsContainer, _scene) {
12044
+ return unsupported("defaultValueParseFunction", FLOW_GRAPH_UNSUPPORTED);
12045
+ }
11505
12046
  var FluidRenderingObject = class {
11506
12047
  static UsePerParticleSizeAttribute = false;
11507
12048
  constructor(_scene, _shaderLanguage) {
@@ -11996,11 +12537,6 @@ var OpenPBRMaterialLoadingAdapter = class {
11996
12537
  unsupported("OpenPBRMaterialLoadingAdapter", "The adapter translates glTF material data into OpenPBRMaterial, whose shader/material subsystem requires Lite maintainer design.");
11997
12538
  }
11998
12539
  };
11999
- var RectAreaLight = class {
12000
- constructor() {
12001
- unsupported("RectAreaLight", "Area lights are not implemented in Babylon Lite. Use Point/Spot/Directional/Hemispheric lights.");
12002
- }
12003
- };
12004
12540
  var GPUParticleSystem = class {
12005
12541
  constructor() {
12006
12542
  unsupported("GPUParticleSystem", "Babylon Lite has no GPU-compute particle path. Its node-particle runtime (`NodeParticleSystemSet`) is a CPU struct-of-arrays simulation; use `NodeParticleSystemSet.ParseFromSnippetAsync` → `buildAsync` instead.");
@@ -12411,6 +12947,18 @@ var gltfTypeToBabylonType = {
12411
12947
  elementType: "any"
12412
12948
  }
12413
12949
  };
12950
+ var FlowGraphDelayReferenceBlock = class {
12951
+ config;
12952
+ input;
12953
+ value;
12954
+ constructor(config) {
12955
+ this.config = config;
12956
+ unsupported("GLTF2.FlowGraphDelayReferenceBlock", KHR_INTERACTIVITY_UNSUPPORTED);
12957
+ }
12958
+ getClassName() {
12959
+ return "FlowGraphDelayReferenceBlock";
12960
+ }
12961
+ };
12414
12962
  var FlowGraphEventReferenceBlock = class {
12415
12963
  config;
12416
12964
  constructor(config) {
@@ -12519,6 +13067,7 @@ var gltf2_exports = /* @__PURE__ */ __exportAll({
12519
13067
  CreateKHRInteractivityDocument: () => CreateKHRInteractivityDocument,
12520
13068
  CreateKHRInteractivityExportPlan: () => CreateKHRInteractivityExportPlan,
12521
13069
  CreateKHRInteractivityGraphModel: () => CreateKHRInteractivityGraphModel,
13070
+ FlowGraphDelayReferenceBlock: () => FlowGraphDelayReferenceBlock,
12522
13071
  FlowGraphEventReferenceBlock: () => FlowGraphEventReferenceBlock,
12523
13072
  FlowGraphGLTFDataProvider: () => FlowGraphGLTFDataProvider,
12524
13073
  FlowGraphObjectReferenceBlock: () => FlowGraphObjectReferenceBlock,
@@ -12726,6 +13275,18 @@ var GaussianSplattingStream = class extends GaussianSplattingMesh {
12726
13275
  evaluateOptimalLods(_camera = null) {
12727
13276
  return unsupported("GaussianSplattingStream.evaluateOptimalLods", STREAM_BLOCKER);
12728
13277
  }
13278
+ getSourceRange(_fileId) {
13279
+ return unsupported("GaussianSplattingStream.getSourceRange", STREAM_BLOCKER);
13280
+ }
13281
+ isSplitPage(_fileId) {
13282
+ return unsupported("GaussianSplattingStream.isSplitPage", STREAM_BLOCKER);
13283
+ }
13284
+ cancelRangeLoads(_files, _keepSources = []) {
13285
+ unsupported("GaussianSplattingStream.cancelRangeLoads", STREAM_BLOCKER);
13286
+ }
13287
+ get rangeResidencyStats() {
13288
+ return unsupported("GaussianSplattingStream.rangeResidencyStats", STREAM_BLOCKER);
13289
+ }
12729
13290
  };
12730
13291
  function AddGaussianSplattingStreamPart(_compound, _name, _metadata, _rootUrl, _options = {}) {
12731
13292
  return unsupported("AddGaussianSplattingStreamPart", COMPOUND_BLOCKER);
@@ -13356,6 +13917,6 @@ var NodeParticleSystemSet = class NodeParticleSystemSet {
13356
13917
  }
13357
13918
  };
13358
13919
  //#endregion
13359
- 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, CreatePolygon, CreatePolygonVertexData, 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, Effect, EffectLayer, EffectWrapper, ElasticEase, Engine, Epsilon, ExecuteCodeAction, ExponentialEase, ExternalTexture, ExtrudePolygon, FBXConstraintBehavior, FBXConstraintSolver, FBXFileLoader, FBXFileLoaderMetadata, FSR1RenderingPipeline, FactorGradient, FadeInOutBehavior, FlowGraphValidationSeverity, FluidRenderer, FluidRendererSceneComponent, FluidRenderingObject, FluidRenderingObjectCustomParticles, FluidRenderingObjectParticleSystem, FluidRenderingTargetRenderer, FlyCamera, FollowBehavior, FollowCamera, FrameGraphMeshBlendingTask, FrameGraphMinMaxReducerTask, FramingBehavior, FreeCamera, Frustum, FxaaPostProcess, gltf1_exports as GLTF1, gltf2_exports as GLTF2, GPUParticleSystem, GPUPicker, GUID, GamepadCamera, GaussianPointSplattingBlitMaterial, GaussianPointSplattingDepthBlitMaterial, GaussianPointSplattingRenderer, GaussianSplattingDebugMaterialPlugin, GaussianSplattingGpuPickingMaterialPlugin, GaussianSplattingMaterial, GaussianSplattingMaxPartCount, GaussianSplattingMesh, GaussianSplattingOverdrawMaterialPlugin, GaussianSplattingPartProxyMesh, GaussianSplattingSizeMaterialPlugin, GaussianSplattingSolidColorMaterialPlugin, GaussianSplattingStream, GeometryBufferRenderer, GeospatialCamera, GeospatialClippingBehavior, GetElementPixelFromUv, GetGaussianSplattingMaxPartCount, GetPartIndexVaryingDeclaration, 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, NodeRenderGraphMinMaxReducerBlock, 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, PolygonBuilder, PositionGizmo, PostProcess, PowerEase, PrecisionDate, PredicateCondition, PrismaticConstraint, PushMaterial, QuadraticEase, QuarticEase, Quaternion, QuinticEase, RandomGUID, RawTexture, RawTexture2DArray, RawTexture3D, Ray, RecastJSPlugin, RectAreaLight, ReflectionProbe, RegisterAbstractEngineTextureLoaders, RegisterComputeShader, RegisterEnginesExtensionsEngineTexture2DArrayImageSource, RegisterEnginesWebGPUExtensionsEngineTexture2DArrayImageSource, RegisterFluidRenderer, RegisterGaussianSplattingDebugMaterialPlugin, RegisterGaussianSplattingGpuPickingMaterialPlugin, RegisterGaussianSplattingMaterial, RegisterGaussianSplattingOverdrawMaterialPlugin, RegisterGaussianSplattingSizeMaterialPlugin, RegisterGaussianSplattingSolidColorMaterialPlugin, RegisterGreasedLinePluginMaterial, RegisterImageProcessingConfiguration, RegisterMeshBlendingPostProcessBlock, RegisterMinMaxReducerBlock, RegisterOpenpbrMaterial, RegisterPolygonBuilder, 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, _GetPackedShBytesPerSplat, _HasGaussianPointSplattingProjectedDepth, _RegisterUSDLoaderDependencies, registerBuiltInLoaders, transformCoordinates, transformNormal, unsupported };
13920
+ 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, AreaLight, AreaLightTextureTools, 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, CreatePolygon, CreatePolygonVertexData, CreateSoundAsync, CreateSoundBufferAsync, CreateSoundSourceAsync, CreateSphere, CreateStreamingSoundAsync, CreateTexture2DArrayFromImageUrlsAsync, CreateTexture2DArrayFromKTX2Async, CreateTiledBox, CreateTiledPlane, CreateTorus, CubeTexture, CubicEase, Curve3, CustomAssetTask, DefaultRenderingPipeline, DepthOfFieldEffect, DepthRenderer, DeviceInputEventType, DeviceOrientationCamera, DeviceSource, DeviceSourceManager, DeviceType, DirectionalLight, DistanceConstraint, DitheredTileFadeMaterialPlugin, DualSenseInput, DualShockInput, DynamicTexture, EASINGMODE_EASEIN, EASINGMODE_EASEINOUT, EASINGMODE_EASEOUT, EasingFunction, EdgesRenderer, Effect, EffectLayer, EffectWrapper, ElasticEase, Engine, Epsilon, EventConstants, ExecuteCodeAction, ExponentialEase, ExternalTexture, ExtrudePolygon, FBXConstraintBehavior, FBXConstraintSolver, FBXFileLoader, FBXFileLoaderMetadata, FSR1RenderingPipeline, FactorGradient, FadeInOutBehavior, FlowGraphValidationSeverity, FluidRenderer, FluidRendererSceneComponent, FluidRenderingObject, FluidRenderingObjectCustomParticles, FluidRenderingObjectParticleSystem, FluidRenderingTargetRenderer, FlyCamera, FollowBehavior, FollowCamera, FrameGraphMeshBlendingTask, FrameGraphMinMaxReducerTask, FramingBehavior, FreeCamera, Frustum, FxaaPostProcess, gltf1_exports as GLTF1, gltf2_exports as GLTF2, GPUParticleSystem, GPUPicker, GUID, GamepadCamera, GaussianPointSplattingBlitMaterial, GaussianPointSplattingDepthBlitMaterial, GaussianPointSplattingRenderer, GaussianSplattingDebugMaterialPlugin, GaussianSplattingGpuPickingMaterialPlugin, GaussianSplattingMaterial, GaussianSplattingMaxPartCount, GaussianSplattingMesh, GaussianSplattingOverdrawMaterialPlugin, GaussianSplattingPartProxyMesh, GaussianSplattingSizeMaterialPlugin, GaussianSplattingSolidColorMaterialPlugin, GaussianSplattingStream, GeometryBufferRenderer, GeospatialCamera, GeospatialClippingBehavior, GetElementPixelFromUv, GetGaussianSplattingMaxPartCount, GetPartIndexVaryingDeclaration, 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, NodeRenderGraphMinMaxReducerBlock, 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, PointerInput, PointsCloudSystem, Polar, PolygonBuilder, PositionGizmo, PostProcess, PowerEase, PrecisionDate, PredicateCondition, PrismaticConstraint, PushMaterial, QuadraticEase, QuarticEase, Quaternion, QuinticEase, RandomGUID, RawTexture, RawTexture2DArray, RawTexture3D, Ray, RecastJSPlugin, RectAreaLight, ReflectionProbe, RegisterAbstractEngineTextureLoaders, RegisterComputeShader, RegisterEnginesExtensionsEngineTexture2DArrayImageSource, RegisterEnginesWebGPUExtensionsEngineTexture2DArrayImageSource, RegisterFluidRenderer, RegisterGaussianSplattingDebugMaterialPlugin, RegisterGaussianSplattingGpuPickingMaterialPlugin, RegisterGaussianSplattingMaterial, RegisterGaussianSplattingOverdrawMaterialPlugin, RegisterGaussianSplattingSizeMaterialPlugin, RegisterGaussianSplattingSolidColorMaterialPlugin, RegisterGreasedLinePluginMaterial, RegisterImageProcessingConfiguration, RegisterMeshBlendingPostProcessBlock, RegisterMinMaxReducerBlock, RegisterOpenpbrMaterial, RegisterPolygonBuilder, RegisterSPLATFileLoader, RegisterUSDFileLoader, RemoveFlowGraphAnimationGroupObservers, 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, SwitchInput, 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, XboxInput, _GetPackedShBytesPerSplat, _HasGaussianPointSplattingProjectedDepth, _RegisterUSDLoaderDependencies, defaultValueParseFunction, registerBuiltInLoaders, transformCoordinates, transformNormal, unsupported };
13360
13921
 
13361
13922
  //# sourceMappingURL=index.js.map