@babylonjs/lite-compat 1.37.1-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-BqMDWl4h.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, 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";
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,6 +931,14 @@ 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;
@@ -953,8 +962,14 @@ var AbstractEngine = class {
953
962
  /** Acquire the GPU device and build the Lite engine context. */
954
963
  async initAsync() {
955
964
  if (this._initialized) return;
956
- this._lite = await createEngine(this._canvas, this._options);
957
- 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));
958
973
  this._initialized = true;
959
974
  }
960
975
  getRenderingCanvas() {
@@ -1076,6 +1091,21 @@ var AbstractEngine = class {
1076
1091
  }
1077
1092
  this._lateWork.push(work);
1078
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
+ }
1079
1109
  /** @internal Scenes register themselves on construction. */
1080
1110
  _registerScene(scene) {
1081
1111
  this._scenes.push(scene);
@@ -1096,6 +1126,8 @@ var AbstractEngine = class {
1096
1126
  });
1097
1127
  }
1098
1128
  stopRenderLoop() {
1129
+ this._renderLoopStopRevision++;
1130
+ this._shouldResumeAfterSceneMutation = false;
1099
1131
  if (this._rafId !== null && typeof cancelAnimationFrame === "function") {
1100
1132
  cancelAnimationFrame(this._rafId);
1101
1133
  this._rafId = null;
@@ -1113,6 +1145,10 @@ var AbstractEngine = class {
1113
1145
  this.onResizeObservable.notifyObservers(this);
1114
1146
  }
1115
1147
  dispose() {
1148
+ if (this._disposed) return;
1149
+ this._disposed = true;
1150
+ this._renderLoopStopRevision++;
1151
+ this._shouldResumeAfterSceneMutation = false;
1116
1152
  if (this._rafId !== null && typeof cancelAnimationFrame === "function") {
1117
1153
  cancelAnimationFrame(this._rafId);
1118
1154
  this._rafId = null;
@@ -1189,6 +1225,7 @@ var AbstractEngine = class {
1189
1225
  scene._buildClusteredContainers();
1190
1226
  await scene._enableMaterialPlugins();
1191
1227
  await scene._loadPendingEnvironment();
1228
+ if (scene._lite.lights.some((light) => light.lightType === "rectArea")) await enableRectAreaLights(scene._lite);
1192
1229
  await enableMirroredMeshes(scene._lite);
1193
1230
  if (scene._hasShadows()) await registerSceneWithShadowSupport(scene._lite);
1194
1231
  else await registerScene(scene._lite);
@@ -5531,6 +5568,173 @@ var Scene = class Scene extends AbstractScene {
5531
5568
  }
5532
5569
  };
5533
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
5534
5738
  //#region src/lights/lights.ts
5535
5739
  /**
5536
5740
  * Babylon.js-compatible light classes implemented over the Babylon Lite light
@@ -5546,6 +5750,49 @@ var Scene = class Scene extends AbstractScene {
5546
5750
  * position are proxies over Lite's observable vectors; colours are proxies over the Lite colour
5547
5751
  * tuples, and every colour write bumps the light version so it reaches the lights UBO.
5548
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
+ }
5549
5796
  /** Babylon.js `Light` — base class for all lights (derives from `Node`). */
5550
5797
  var Light = class extends Node {
5551
5798
  /**
@@ -5561,9 +5808,9 @@ var Light = class extends Node {
5561
5808
  * including before its deferred Lite generator is built.
5562
5809
  */
5563
5810
  _shadowGenerator = null;
5564
- constructor(name, scene) {
5811
+ constructor(name, scene, dontAddToScene = false) {
5565
5812
  super(name, scene);
5566
- scene?._registerLight(this);
5813
+ if (!dontAddToScene) scene?._registerLight(this);
5567
5814
  }
5568
5815
  getClassName() {
5569
5816
  return "Light";
@@ -5643,8 +5890,17 @@ var Light = class extends Node {
5643
5890
  }
5644
5891
  /** @internal Detach Lite-owned state when this node is disposed directly or through an ancestor. */
5645
5892
  _disposeSelf(_doNotRecurse) {
5646
- if (this._scene) removeFromScene(this._scene._lite, this._lite);
5647
- 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;
5648
5904
  }
5649
5905
  };
5650
5906
  /**
@@ -5839,6 +6095,96 @@ var SpotLight = class extends Light {
5839
6095
  this._writeColor(this._lite.specular, value);
5840
6096
  }
5841
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
+ };
5842
6188
  //#endregion
5843
6189
  //#region src/lights/clustered-light-container.ts
5844
6190
  /**
@@ -6046,1134 +6392,1233 @@ var ClusteredLightContainer = class extends Light {
6046
6392
  }
6047
6393
  };
6048
6394
  //#endregion
6049
- //#region src/meshes/csg.ts
6395
+ //#region src/textures/textures.ts
6050
6396
  /**
6051
- * Babylon.js `CSG` (legacy) and `CSG2` (Manifold-based) constructive solid
6052
- * geometry, wrapped over Babylon Lite's native CSG API.
6053
- *
6054
- * Babylon.js exposes two object-oriented CSG surfaces:
6055
- * - `CSG.FromMesh(mesh)` → `.subtract` / `.intersect` / `.union` → `.toMesh(name, material, scene)`
6056
- * - `CSG2.FromMesh(mesh)` → `.subtract` / `.intersect` / `.add` → `.toMesh(name, scene)` (+ `.dispose()`),
6057
- * after `await InitializeCSG2Async()`.
6058
- *
6059
- * Babylon Lite ships the equivalent as standalone functions
6060
- * (`createCsgFromMesh` / `csgSubtract` / … / `createMeshFromCsg`, and the CSG2
6061
- * `createCsg2FromMesh` / `csg2Subtract` / … / `createMeshesFromCsg2`). These
6062
- * classes adapt the function API to Babylon.js's method-chaining shape.
6397
+ * Babylon.js-compatible texture wrappers over Babylon Lite's `loadTexture2D`.
6063
6398
  *
6064
- * CSG (legacy) `toMesh` takes an explicit material and produces a single mesh.
6065
- * CSG2 preserves per-source materials: each `FromMesh` records its source mesh's
6066
- * material against a unique slot, operations union those slot→material maps, and
6067
- * `toMesh` triangulates into one Lite mesh per slot (`createMeshesFromCsg2`),
6068
- * returning a single compat `Mesh` with the remaining sub-meshes parented under it
6069
- * so positioning the result moves them together — matching Babylon.js's single
6070
- * 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.
6071
6404
  */
6405
+ /** Compression suffix → `loadKtxTexture2D` token, recognised in a pre-resolved KTX URL. */
6406
+ var KTX_SUFFIX_RE = /(-astc|-dxt|-etc2|-pvrtc)\.ktx(\?.*)?$/i;
6072
6407
  /**
6073
- * Babylon.js `CSG` — legacy constructive solid geometry. Build from a mesh with
6074
- * {@link FromMesh}, combine with {@link subtract} / {@link intersect} /
6075
- * {@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.
6076
6418
  */
6077
- var CSG = class CSG {
6078
- _lite;
6079
- constructor(_lite) {
6080
- this._lite = _lite;
6081
- }
6082
- /** Babylon.js `CSG.FromMesh(mesh)`. */
6083
- static FromMesh(mesh) {
6084
- return new CSG(createCsgFromMesh(mesh._lite));
6085
- }
6086
- /** Babylon.js `csg.subtract(other)` — `this − other`. */
6087
- subtract(other) {
6088
- return new CSG(csgSubtract(this._lite, other._lite));
6089
- }
6090
- /** Babylon.js `csg.intersect(other)`. */
6091
- intersect(other) {
6092
- return new CSG(csgIntersect(this._lite, other._lite));
6093
- }
6094
- /** Babylon.js `csg.union(other)`. */
6095
- union(other) {
6096
- return new CSG(csgUnion(this._lite, other._lite));
6097
- }
6098
- /** Babylon.js `csg.toMesh(name, material, scene)` — triangulate into a single mesh. */
6099
- toMesh(name, material, scene) {
6100
- const engine = scene.getEngine()._lite;
6101
- const lite = createMeshFromCsg(engine, this._lite, name);
6102
- const mesh = new Mesh(name, lite, scene);
6103
- if (material) mesh.material = material;
6104
- return registerMeshAtStart(mesh, scene);
6105
- }
6106
- };
6107
- /** Module-wide unique material-slot counter for CSG2 (`MATERIAL_ID_RESERVE_COUNT` = 65536). */
6108
- 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
+ }
6109
6427
  /**
6110
- * Babylon.js `CSG2` — Manifold-based constructive solid geometry that preserves
6111
- * 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.
6112
6437
  */
6113
- 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. */
6114
6447
  _lite;
6115
- _materials;
6116
- constructor(_lite, _materials) {
6117
- this._lite = _lite;
6118
- this._materials = _materials;
6119
- }
6120
- /** Babylon.js `CSG2.FromMesh(mesh)` — records the mesh's material against a unique slot. */
6121
- static FromMesh(mesh) {
6122
- const slot = nextCsg2Slot++;
6123
- const materials = /* @__PURE__ */ new Map();
6124
- if (mesh.material) materials.set(slot, mesh.material);
6125
- return new CSG2(createCsg2FromMesh(mesh._lite, slot), materials);
6126
- }
6127
- _combine(lite, other) {
6128
- const materials = new Map(this._materials);
6129
- for (const [slot, material] of other._materials) materials.set(slot, material);
6130
- return new CSG2(lite, materials);
6131
- }
6132
- /** Babylon.js `csg.subtract(other)` — `this − other`. */
6133
- subtract(other) {
6134
- return this._combine(csg2Subtract(this._lite, other._lite), other);
6135
- }
6136
- /** Babylon.js `csg.intersect(other)`. */
6137
- intersect(other) {
6138
- return this._combine(csg2Intersect(this._lite, other._lite), other);
6139
- }
6140
- /** Babylon.js `csg.add(other)` — union. */
6141
- add(other) {
6142
- return this._combine(csg2Add(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";
6143
6452
  }
6144
6453
  /**
6145
- * Babylon.js `csg.toMesh(name, scene)` — triangulate into a single mesh,
6146
- * preserving each source mesh's material across the result's faces.
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.
6147
6458
  */
6148
- toMesh(name, scene) {
6149
- const engine = scene.getEngine()._lite;
6150
- const materials = [];
6151
- for (const [slot, material] of this._materials) {
6152
- attachMaterialToScene(material, scene);
6153
- materials[slot] = material._lite;
6154
- }
6155
- const liteMeshes = createMeshesFromCsg2(engine, this._lite, materials, name);
6156
- const savedMaterials = liteMeshes.map((m) => m.material);
6157
- const root = new Mesh(name, liteMeshes[0], scene);
6158
- const wrapped = root.material;
6159
- root._lite.material = savedMaterials[0];
6160
- scene._deferAdd(() => {
6161
- const assigned = root.material;
6162
- if (assigned && assigned !== wrapped) {
6163
- attachMaterialToScene(assigned, scene);
6164
- root._lite.material = assigned._lite;
6165
- }
6166
- addToScene(scene._lite, root._lite);
6167
- });
6168
- for (let i = 1; i < liteMeshes.length; i++) {
6169
- const sub = liteMeshes[i];
6170
- sub.material = savedMaterials[i];
6171
- sub.parent = root._lite;
6172
- scene._deferAdd(() => addToScene(scene._lite, sub));
6459
+ _onReady(listener) {
6460
+ if (this._lite) {
6461
+ listener();
6462
+ return;
6173
6463
  }
6174
- return root;
6464
+ (this._readyListeners ??= []).push(listener);
6175
6465
  }
6176
- /** Babylon.js `csg.dispose()` — release the underlying Manifold solid. */
6177
- dispose() {
6178
- disposeCsg2(this._lite);
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
+ }
6179
6473
  }
6180
- };
6181
- /** Babylon.js `InitializeCSG2Async()` — load the Manifold runtime before any `CSG2` use. */
6182
- async function InitializeCSG2Async() {
6183
- await initializeCsg2Async();
6184
- }
6185
- //#endregion
6186
- //#region src/meshes/compression.ts
6187
- /**
6188
- * Babylon.js `MeshoptCompression` (`@babylonjs/core/Meshes/Compression/meshoptCompression`).
6189
- *
6190
- * In Babylon.js this singleton owns the meshopt decoder used by the glTF
6191
- * `EXT_meshopt_compression` loader extension, and apps configure its decoder URL
6192
- * via the static `Configuration`. Babylon Lite decodes meshopt-compressed buffers
6193
- * itself inside its glTF loader feature (`gltf-feature-meshopt`), so no external
6194
- * decoder needs wiring. This compat shim therefore accepts the `Configuration`
6195
- * assignment ported code performs (a no-op here) so the import resolves and the
6196
- * asset still loads — the actual decode happens in Lite.
6197
- */
6198
- var MeshoptCompression = class MeshoptCompression {
6199
6474
  /**
6200
- * Babylon.js `MeshoptCompression.Configuration` — the decoder location. Stored
6201
- * for API parity but unused: Babylon Lite's glTF loader carries its own meshopt
6202
- * decoder, so setting this has no effect on decoding.
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.
6203
6478
  */
6204
- static Configuration = { decoder: { url: "" } };
6205
- static _default = null;
6206
- /** Babylon.js `MeshoptCompression.Default` — the lazily-created shared instance. */
6207
- static get Default() {
6208
- if (!MeshoptCompression._default) MeshoptCompression._default = new MeshoptCompression();
6209
- return MeshoptCompression._default;
6479
+ getInternalTexture() {
6480
+ return this._lite ?? null;
6210
6481
  }
6482
+ dispose() {}
6211
6483
  };
6212
- //#endregion
6213
- //#region src/morph/morph.ts
6214
- /**
6215
- * Babylon.js-compatible `MorphTarget` / `MorphTargetManager` over the Babylon
6216
- * Lite native morph API (`createMorphTargets` / `setMorphTargetWeights`).
6217
- *
6218
- * Babylon.js morph targets carry **absolute** vertex positions/normals
6219
- * (`target.setPositions(abs)`); Babylon Lite's `createMorphTargets` consumes
6220
- * per-target **deltas** (target − base). The manager defers building the Lite
6221
- * morph until engine start (when the owning mesh's base CPU geometry exists),
6222
- * computes the deltas, and assigns the resulting `MorphTargetData` onto the
6223
- * Lite mesh so the Standard/NME pipelines sample it. Weight changes
6224
- * (`target.influence = …`) re-upload via `setMorphTargetWeights`.
6225
- */
6226
- /** Babylon.js `MorphTarget` — a single named morph influence with absolute target geometry. */
6227
- var MorphTarget = class {
6228
- name;
6229
- /** @internal Absolute target positions (Babylon.js `setPositions`). */
6230
- _positions = null;
6231
- /** @internal Absolute target normals (Babylon.js `setNormals`). */
6232
- _normals = null;
6233
- /** @internal Owning manager, set on `addTarget`, used to push weight updates. */
6234
- _manager;
6235
- _influence;
6236
- 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();
6237
6496
  this.name = name;
6238
- 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);
6239
6528
  }
6240
- get influence() {
6241
- return this._influence;
6529
+ getTextureMatrix() {
6530
+ return this._textureMatrix;
6242
6531
  }
6243
- set influence(value) {
6244
- this._influence = value;
6245
- this._manager?._syncWeights();
6532
+ requestUpdate() {
6533
+ if (this._engine && this._htmlTexture) requestHtmlTextureUpdate(this._engine._lite, this._htmlTexture);
6246
6534
  }
6247
- /** Babylon.js `MorphTarget.setPositions(data)` — absolute target positions. */
6248
- setPositions(data) {
6249
- 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);
6250
6537
  }
6251
- /** Babylon.js `MorphTarget.getPositions()`. */
6252
- getPositions() {
6253
- return this._positions;
6538
+ getClassName() {
6539
+ return "HtmlTexture";
6254
6540
  }
6255
- /** Babylon.js `MorphTarget.setNormals(data)` — absolute target normals. */
6256
- setNormals(data) {
6257
- this._normals = data ? data instanceof Float32Array ? data : Float32Array.from(data) : null;
6541
+ whenReadyAsync() {
6542
+ return this._ready;
6258
6543
  }
6259
- /** Babylon.js `MorphTarget.getNormals()`. */
6260
- getNormals() {
6261
- 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();
6262
6553
  }
6263
6554
  };
6264
- /** Babylon.js `MorphTargetManager` — owns a mesh's morph targets (Babylon Lite supports up to 4). */
6265
- var MorphTargetManager = class {
6266
- /** @internal */
6267
- _engine;
6268
- /** @internal Built Lite morph data (created at engine start). */
6269
- _lite;
6270
- _targets = [];
6271
- constructor(_scene) {}
6272
- get numTargets() {
6273
- return this._targets.length;
6274
- }
6275
- getTarget(index) {
6276
- 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);
6277
6619
  }
6278
- /** Babylon.js `MorphTargetManager.addTarget(target)`. */
6279
- addTarget(target) {
6280
- target._manager = this;
6281
- this._targets.push(target);
6620
+ /** @internal Upload-time vertical flip / mipmap flags, preserved across `clone`. */
6621
+ _invertY;
6622
+ _noMipmap;
6623
+ getClassName() {
6624
+ return "Texture";
6282
6625
  }
6283
6626
  /**
6284
- * @internal Build the Lite morph data from the mesh's base CPU geometry and
6285
- * each target's absolute positions/normals (converted to deltas), then assign
6286
- * 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).
6287
6630
  */
6288
- _build(mesh, engine) {
6289
- const lite = mesh._lite;
6290
- const base = lite._cpuPositions;
6291
- if (!base) return;
6292
- this._engine = engine;
6293
- const vertexCount = base.length / 3;
6294
- const baseNormals = lite._cpuNormals;
6295
- const targets = this._targets.slice(0, 4).map((t) => {
6296
- const abs = t._positions;
6297
- const positions = new Float32Array(base.length);
6298
- if (abs) for (let i = 0; i < base.length; i++) positions[i] = (abs[i] ?? 0) - base[i];
6299
- let normals = null;
6300
- if (t._normals && baseNormals) {
6301
- normals = new Float32Array(baseNormals.length);
6302
- for (let i = 0; i < baseNormals.length; i++) normals[i] = (t._normals[i] ?? 0) - baseNormals[i];
6303
- }
6304
- return {
6305
- positions,
6306
- normals
6307
- };
6308
- });
6309
- const weights = this._targets.slice(0, 4).map((t) => t.influence);
6310
- this._lite = createMorphTargets(engine, targets, vertexCount, weights);
6311
- lite.morphTargets = this._lite;
6312
- }
6313
- /** @internal Re-upload current target influences to the GPU weights buffer. */
6314
- _syncWeights() {
6315
- if (!this._lite || !this._engine) return;
6316
- const weights = this._targets.slice(0, 4).map((t) => t.influence);
6317
- setMorphTargetWeights(this._engine, this._lite, weights);
6318
- }
6319
- };
6320
- //#endregion
6321
- //#region src/meshes/gaussian-splatting.ts
6322
- /**
6323
- * Babylon.js-compatible `GaussianSplattingMesh` over Babylon Lite's splat loaders.
6324
- *
6325
- * Babylon Lite fully backs Gaussian Splatting: `loadSplat` (`.ply` / `.splat` /
6326
- * compressed-PLY), `loadSOG`, and `loadSPZ` each return a `GaussianSplattingMesh`
6327
- * (a `SceneNode` carrying the splat cloud), with `splatsData` / `updateData` for
6328
- * in-place edits and `bakeCurrentTransformIntoVertices` to fold the node transform
6329
- * into the splat data. This wrapper exposes that through the Babylon.js
6330
- * `GaussianSplattingMesh` shape so ported scenes (`new GaussianSplattingMesh(...)` +
6331
- * `loadFileAsync`, or `ImportMeshAsync` of a splat URL) run unchanged.
6332
- *
6333
- * Babylon.js constructs the mesh synchronously and populates it via
6334
- * `loadFileAsync`; Babylon Lite loads atomically. We bridge this by holding a
6335
- * lightweight placeholder transform node until the splat loads, buffering any
6336
- * transforms set in the meantime, then adopting the loaded Lite node.
6337
- */
6338
- 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.";
6339
- function _HasGaussianPointSplattingProjectedDepth(projection) {
6340
- return _hasGaussianPointSplattingProjectedDepth(projection.m);
6341
- }
6342
- function _GetPackedShBytesPerSplat(shDegree) {
6343
- return _getGaussianPointSplattingPackedShBytesPerSplat(shDegree);
6344
- }
6345
- /** Lite loader chosen by file extension (mirrors the BJS splat plugin dispatch). */
6346
- function liteLoaderFor(url) {
6347
- const lower = url.split("?")[0].toLowerCase();
6348
- if (lower.endsWith(".sog") || lower.endsWith(".zip")) return loadSOG;
6349
- if (lower.endsWith(".spz")) return loadSPZ;
6350
- return loadSplat;
6351
- }
6352
- /** `.splat` row stride: position(3f) + scale(3f) + rgba(4×u8) + rot(4×u8) = 32 bytes. */
6353
- var SPLAT_ROW_BYTES = 32;
6354
- var SPLAT_ROW_FLOATS = SPLAT_ROW_BYTES / 4;
6355
- var SPLAT_Y_FLOAT_INDEX = 1;
6356
- /**
6357
- * @internal Return a copy of a `.splat` buffer with every row's centre Y negated
6358
- * (the position-space half of Babylon.js's `flipY`). Used to reproduce
6359
- * `updateData(..., { flipY: false })`. Only the 32-byte `.splat` row layout is
6360
- * handled; other buffers are returned unchanged.
6361
- */
6362
- function mirrorSplatRowY(buffer) {
6363
- if (buffer.byteLength % SPLAT_ROW_BYTES !== 0) return buffer;
6364
- const copy = buffer.slice(0);
6365
- const floats = new Float32Array(copy);
6366
- for (let f = SPLAT_Y_FLOAT_INDEX; f < floats.length; f += SPLAT_ROW_FLOATS) floats[f] = -floats[f];
6367
- return copy;
6368
- }
6369
- /**
6370
- * Babylon.js `GaussianSplattingMesh`. Derives from `TransformNode` so the loaded
6371
- * cloud's `position` / `rotation` / `scaling` proxy onto the Lite splat node.
6372
- */
6373
- var GaussianSplattingMesh = class GaussianSplattingMesh extends TransformNode {
6374
- /** @internal The loaded Lite splat node (undefined until `loadFileAsync` resolves). */
6375
- _gs;
6376
- /** @internal The constructor's deferred URL, loaded by `loadFileAsync()` with no argument. */
6377
- _ctorUrl;
6378
- /** @internal Optional Lite shader-fragment plugins applied at load (scene 126). */
6379
- _fragments;
6380
- /** @internal Point-splatting configuration retained for BJS state parity while the unsupported mode is disabled. */
6381
- _pointSplattingRenderScale = "auto";
6382
- /** @internal Point-splatting configuration retained for BJS state parity while the unsupported mode is disabled. */
6383
- _pointSplattingOcclusionCulling = false;
6384
- /** @internal Point-splatting configuration retained for BJS state parity while the unsupported mode is disabled. */
6385
- _pointSplattingScale = 1;
6386
- /**
6387
- * Babylon.js `gs.safeOrbitCameraLimits` — safe-orbit camera limits parsed from the source
6388
- * file's metadata (Adobe safe-orbit extension), or `null` when the file carries none.
6389
- *
6390
- * Babylon Lite's splat loaders (`loadSplat` / `loadSOG` / `loadSPZ`) do not parse the Adobe
6391
- * safe-orbit metadata block, so this stays `null` — matching BJS's own default for a file
6392
- * without the extension. Populating it from real metadata needs a (non-tree-shakeable) change
6393
- * to Lite's splat loaders; the field is exposed here for shape parity so ported reads resolve.
6394
- */
6395
- safeOrbitCameraLimits = null;
6396
- get pointSplattingRenderScale() {
6397
- return this._pointSplattingRenderScale;
6398
- }
6399
- set pointSplattingRenderScale(value) {
6400
- this._pointSplattingRenderScale = value;
6401
- }
6402
- get pointSplattingOcclusionCulling() {
6403
- return this._pointSplattingOcclusionCulling;
6404
- }
6405
- set pointSplattingOcclusionCulling(value) {
6406
- this._pointSplattingOcclusionCulling = value;
6407
- }
6408
- get pointSplattingRenderMode() {
6409
- return false;
6410
- }
6411
- set pointSplattingRenderMode(value) {
6412
- 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;
6413
6640
  }
6414
- get pointSplattingDepthRenderMode() {
6415
- return false;
6641
+ whenReadyAsync() {
6642
+ return this._ready;
6416
6643
  }
6417
- set pointSplattingDepthRenderMode(value) {
6418
- 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;
6419
6653
  }
6420
- get pointSplattingProgress() {
6421
- return null;
6654
+ _notifyLoadObservable() {
6655
+ if (this._onLoadObservable) this._onLoadObservable.notifyObservers(this);
6422
6656
  }
6423
- get pointSplattingScale() {
6424
- return this._pointSplattingScale;
6657
+ /** Babylon.js `BaseTexture.isReady()` — true once the GPU handle has resolved. */
6658
+ isReady() {
6659
+ return this._lite !== void 0;
6425
6660
  }
6426
- set pointSplattingScale(value) {
6427
- 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;
6428
6666
  }
6429
- constructor(name, url, scene, _keepInRam) {
6430
- super(name, scene, createTransformNode(name));
6431
- 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);
6432
6679
  }
6433
6680
  getClassName() {
6434
- return "GaussianSplattingMesh";
6435
- }
6436
- /** @internal The wrapper's transform node; the loaded cloud is parented beneath it during deferred adoption. */
6437
- get _xform() {
6438
- return this._gs?.parent === this._node ? this._node : this._gs ?? this._node;
6439
- }
6440
- /** @internal Accessibility metadata belongs to the loaded cloud, or its placeholder before loading. */
6441
- _accessibilitySource() {
6442
- return this._gs ?? this._node;
6681
+ return "RawTexture";
6443
6682
  }
6444
- get position() {
6445
- return liteBackedVector3(this._xform.position);
6683
+ /** Replace the texture's pixel contents. */
6684
+ update(data) {
6685
+ if (this._lite) updateTexture2DFromPixels(this._scene.getEngine()._lite, this._lite, data);
6446
6686
  }
6447
- set position(value) {
6448
- this._xform.position.set(value.x, value.y, value.z);
6687
+ whenReadyAsync() {
6688
+ return Promise.resolve();
6449
6689
  }
6450
- get rotation() {
6451
- return liteBackedVector3(this._xform.rotation);
6690
+ static CreateRGBATexture(data, width, height, scene) {
6691
+ return new RawTexture(data, width, height, scene);
6452
6692
  }
6453
- set rotation(value) {
6454
- this._xform.rotation.set(value.x, value.y, value.z);
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);
6455
6716
  }
6456
- get scaling() {
6457
- return liteBackedVector3(this._xform.scaling);
6717
+ getClassName() {
6718
+ return "RawTexture3D";
6458
6719
  }
6459
- set scaling(value) {
6460
- this._xform.scaling.set(value.x, value.y, value.z);
6720
+ /** Gets the width of the texture. */
6721
+ get width() {
6722
+ return this._lite?.width ?? 0;
6461
6723
  }
6462
- /** @internal Set the Lite shader-fragment plugins applied on the next load (compat material-plugin path). */
6463
- _setFragments(fragments) {
6464
- this._fragments = fragments;
6724
+ /** Gets the height of the texture. */
6725
+ get height() {
6726
+ return this._lite?.height ?? 0;
6465
6727
  }
6466
- /**
6467
- * Babylon.js `gs.loadFileAsync(url?)` — fetch + parse a splat asset and adopt
6468
- * the resulting Lite node. With no argument, loads the constructor URL.
6469
- */
6470
- async loadFileAsync(url) {
6471
- const target = url ?? this._ctorUrl;
6472
- if (!target) throw new Error("GaussianSplattingMesh.loadFileAsync: no URL provided (and none given to the constructor).");
6473
- const scene = this._scene;
6474
- if (!scene) throw new Error("GaussianSplattingMesh.loadFileAsync requires a scene (pass one to the constructor).");
6475
- const lite = await liteLoaderFor(target)(scene._lite, target, this._fragments);
6476
- this._adopt(lite);
6477
- return this;
6728
+ /** Gets the depth of the texture. */
6729
+ get depth() {
6730
+ return this._lite?.depth ?? 0;
6478
6731
  }
6479
6732
  /**
6480
- * @internal Adopt a loaded Lite splat node from either the mesh or loader-plugin API.
6481
- * Parenting preserves the loader's format-specific local transform while composing it
6482
- * with transforms applied to the wrapper before loading.
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).
6483
6735
  */
6484
- _adopt(lite) {
6485
- const placeholder = this._node;
6486
- const previousAccessibilitySource = this._accessibilitySource();
6487
- lite.parent = placeholder;
6488
- placeholder.children.push(lite);
6489
- lite.name = this.name;
6490
- this._gs = lite;
6491
- this._syncAccessibilityTag(previousAccessibilitySource);
6492
- this._scene?._registerMesh(this);
6493
- }
6494
- /** @internal Wrap an already-loaded Lite splat node (used by the loader's `ImportMeshAsync` path). */
6495
- static _fromLite(lite, scene) {
6496
- const mesh = new GaussianSplattingMesh(lite.name, null, scene);
6497
- mesh._gs = lite;
6498
- scene._registerMesh(mesh);
6499
- return mesh;
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);
6500
6739
  }
6501
- /** Babylon.js `gs.splatsData` — the raw 32-byte/splat row buffer (for inspection / `updateData`). */
6502
- get splatsData() {
6503
- return this._gs ? this._gs.splatsData : null;
6740
+ whenReadyAsync() {
6741
+ return Promise.resolve();
6742
+ }
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;
6788
+ }
6789
+ getClassName() {
6790
+ return "DynamicTexture";
6791
+ }
6792
+ getContext() {
6793
+ return this._context;
6794
+ }
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);
6807
+ }
6808
+ ctx.font = font;
6809
+ ctx.fillStyle = color;
6810
+ ctx.fillText(text, x, y);
6811
+ this.update();
6504
6812
  }
6505
6813
  /**
6506
- * Babylon.js `gs.updateData(buffer, sh?, options?)` — replace the splat data in
6507
- * place. Babylon Lite always applies its loader's Y convention on update; the
6508
- * `sh` argument is accepted for signature parity and ignored.
6509
- *
6510
- * `options.flipY === false` is honoured: Babylon.js's `.splat` loader flips Y
6511
- * on load by default, so `flipY:false` re-uploads the buffer **without** that
6512
- * flip — i.e. mirrored relative to the default-loaded pose, which ported scenes
6513
- * then correct with `scaling.y = -1`. Lite has no per-call flip flag and always
6514
- * applies its (flip-on-load-equivalent) convention, so we mirror the row Y here
6515
- * to reproduce the `flipY:false` pose before handing the buffer to Lite.
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.
6516
6818
  */
6517
- updateData(splatBuffer, _sh, options) {
6518
- const buffer = options?.flipY === false ? mirrorSplatRowY(splatBuffer) : splatBuffer;
6519
- this._gs?.updateData(buffer);
6819
+ update(invertY = true, premulAlpha = false, _allowGPUOptimization = false) {
6820
+ updateDynamicTexture(this._scene.getEngine()._lite, this._dyn, this._canvas, {
6821
+ invertY,
6822
+ premultiplyAlpha: premulAlpha
6823
+ });
6520
6824
  }
6521
- /** Babylon.js `gs.bakeCurrentTransformIntoVertices()` — fold the node transform into the splat data. */
6522
- bakeCurrentTransformIntoVertices() {
6523
- if (this._gs) {
6524
- bakeCurrentTransformIntoVertices(this._gs);
6525
- if (this._gs.parent === this._node) {
6526
- const userChildren = this._node.children.filter((child) => child !== this._gs && child.parent === this._node);
6527
- 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);
6528
- for (const child of userChildren) setParent(child, null);
6529
- this._node.position.set(0, 0, 0);
6530
- this._node.rotation.set(0, 0, 0);
6531
- this._node.scaling.set(1, 1, 1);
6532
- for (const child of userChildren) setParent(child, this._node);
6533
- }
6534
- }
6825
+ whenReadyAsync() {
6826
+ return Promise.resolve();
6535
6827
  }
6536
- /** @internal Babylon.js's worker-throttle flag; ported scenes poll it to detect the first sort. */
6537
- get _canPostToWorker() {
6538
- return this._gs ? this._gs._orderPool.length === 2 : false;
6828
+ };
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
+ });
6539
6875
  }
6540
- /** @internal The loaded Lite splat node, for the GPU picker's result mapping (undefined until loaded). */
6541
- get _pickLiteNode() {
6542
- return this._gs;
6876
+ getClassName() {
6877
+ return "CubeTexture";
6878
+ }
6879
+ /** Babylon.js `BaseTexture.isReady()`. */
6880
+ isReady() {
6881
+ return this._ready;
6882
+ }
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);
6543
6889
  }
6890
+ dispose() {}
6544
6891
  };
6545
- //#endregion
6546
- //#region src/meshes/mesh-blending.ts
6547
- var MeshBlendingRadiusClass = /* @__PURE__ */ function(MeshBlendingRadiusClass) {
6548
- MeshBlendingRadiusClass[MeshBlendingRadiusClass["Small"] = 0] = "Small";
6549
- MeshBlendingRadiusClass[MeshBlendingRadiusClass["Medium"] = 1] = "Medium";
6550
- MeshBlendingRadiusClass[MeshBlendingRadiusClass["Large"] = 2] = "Large";
6551
- MeshBlendingRadiusClass[MeshBlendingRadiusClass["ExtraLarge"] = 3] = "ExtraLarge";
6552
- return MeshBlendingRadiusClass;
6553
- }({});
6554
- function PackMeshBlendingTag(groupId, radiusClass) {
6555
- return packMeshBlendingTag(groupId, radiusClass);
6556
- }
6557
- function UnpackMeshBlendingTag(tag) {
6558
- const unpacked = unpackMeshBlendingTag(tag);
6559
- return {
6560
- groupId: unpacked.groupId,
6561
- radiusClass: unpacked.radiusClass
6562
- };
6563
- }
6564
- var MeshBlendQuality = /* @__PURE__ */ function(MeshBlendQuality) {
6565
- MeshBlendQuality[MeshBlendQuality["Low"] = 0] = "Low";
6566
- MeshBlendQuality[MeshBlendQuality["Medium"] = 1] = "Medium";
6567
- MeshBlendQuality[MeshBlendQuality["High"] = 2] = "High";
6568
- MeshBlendQuality[MeshBlendQuality["Cinematic"] = 3] = "Cinematic";
6569
- return MeshBlendQuality;
6570
- }({});
6571
- var MeshBlendDebugMode = /* @__PURE__ */ function(MeshBlendDebugMode) {
6572
- MeshBlendDebugMode[MeshBlendDebugMode["Off"] = 0] = "Off";
6573
- MeshBlendDebugMode[MeshBlendDebugMode["PackedTag"] = 1] = "PackedTag";
6574
- MeshBlendDebugMode[MeshBlendDebugMode["CandidateDirectionDistance"] = 2] = "CandidateDirectionDistance";
6575
- MeshBlendDebugMode[MeshBlendDebugMode["SeamFade"] = 3] = "SeamFade";
6576
- MeshBlendDebugMode[MeshBlendDebugMode["RejectionReason"] = 4] = "RejectionReason";
6577
- MeshBlendDebugMode[MeshBlendDebugMode["StageWork"] = 5] = "StageWork";
6578
- MeshBlendDebugMode[MeshBlendDebugMode["Continuation"] = 6] = "Continuation";
6579
- MeshBlendDebugMode[MeshBlendDebugMode["TinyObject"] = 7] = "TinyObject";
6580
- MeshBlendDebugMode[MeshBlendDebugMode["MultiTarget"] = 8] = "MultiTarget";
6581
- MeshBlendDebugMode[MeshBlendDebugMode["TargetColor"] = 9] = "TargetColor";
6582
- MeshBlendDebugMode[MeshBlendDebugMode["ShadowAttenuation"] = 10] = "ShadowAttenuation";
6583
- MeshBlendDebugMode[MeshBlendDebugMode["ColorInterpolation"] = 11] = "ColorInterpolation";
6584
- MeshBlendDebugMode[MeshBlendDebugMode["WorldPosition"] = 12] = "WorldPosition";
6585
- return MeshBlendDebugMode;
6586
- }({});
6587
- var MeshBlendDepthType = /* @__PURE__ */ function(MeshBlendDepthType) {
6588
- MeshBlendDepthType[MeshBlendDepthType["View"] = 0] = "View";
6589
- MeshBlendDepthType[MeshBlendDepthType["Screen"] = 1] = "Screen";
6590
- return MeshBlendDepthType;
6591
- }({});
6592
- function CreateDefaultMeshBlendRadiusDefinitions() {
6593
- return createDefaultMeshBlendRadiusDefinitions();
6594
- }
6595
- 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.";
6596
- var ThinMeshBlendingPostProcess = class {
6597
- constructor(..._args) {
6598
- unsupported("ThinMeshBlendingPostProcess", MESH_BLENDING_BLOCKER);
6892
+ /**
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`.
6899
+ */
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();
6913
+ /**
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`).
6916
+ */
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
+ });
6933
+ }
6934
+ getClassName() {
6935
+ return "HDRCubeTexture";
6599
6936
  }
6937
+ /** Babylon.js `BaseTexture.isReady()`. */
6938
+ isReady() {
6939
+ return this._ready;
6940
+ }
6941
+ whenReadyAsync() {
6942
+ return this._readyPromise;
6943
+ }
6944
+ dispose() {}
6600
6945
  };
6601
- var MeshBlendingPostProcess = class {
6602
- constructor(..._args) {
6603
- unsupported("MeshBlendingPostProcess", MESH_BLENDING_BLOCKER);
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).");
6604
6950
  }
6605
6951
  };
6606
- var FrameGraphMeshBlendingTask = class {
6607
- constructor(..._args) {
6608
- unsupported("FrameGraphMeshBlendingTask", MESH_BLENDING_BLOCKER);
6952
+ //#endregion
6953
+ //#region src/lights/area-light-texture-tools.ts
6954
+ var ProcessedAreaLightTexture = class extends BaseTexture {
6955
+ constructor(texture) {
6956
+ super();
6957
+ this._lite = texture;
6958
+ }
6959
+ whenReadyAsync() {
6960
+ return Promise.resolve();
6961
+ }
6962
+ dispose() {
6963
+ if (this._lite) {
6964
+ releaseTexture(this._lite);
6965
+ this._lite = void 0;
6966
+ }
6609
6967
  }
6610
6968
  };
6611
- var NodeRenderGraphMeshBlendingPostProcessBlock = class {
6612
- constructor(..._args) {
6613
- unsupported("NodeRenderGraphMeshBlendingPostProcessBlock", MESH_BLENDING_BLOCKER);
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;
6979
+ }
6980
+ get shaderLanguage() {
6981
+ return this._shaderLanguage;
6982
+ }
6983
+ isReady() {
6984
+ return this._ready;
6614
6985
  }
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);
6993
+ }
6994
+ dispose() {}
6615
6995
  };
6616
- function RegisterMeshBlendingPostProcessBlock() {
6617
- return unsupported("RegisterMeshBlendingPostProcessBlock", MESH_BLENDING_BLOCKER);
6618
- }
6619
6996
  //#endregion
6620
- //#region src/textures/textures.ts
6997
+ //#region src/meshes/csg.ts
6621
6998
  /**
6622
- * Babylon.js-compatible texture wrappers over Babylon Lite's `loadTexture2D`.
6999
+ * Babylon.js `CSG` (legacy) and `CSG2` (Manifold-based) constructive solid
7000
+ * geometry, wrapped over Babylon Lite's native CSG API.
6623
7001
  *
6624
- * Babylon.js's `Texture` constructor is synchronous and loads in the background.
6625
- * Babylon Lite loads textures asynchronously. The compat `Texture` kicks off the
6626
- * load in its constructor and resolves `_lite` when ready; assign the texture to
6627
- * a material after `await texture.whenReadyAsync()` (or construct via
6628
- * `Texture.LoadAsync`) so the GPU handle is present when the material binds.
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.
6629
7019
  */
6630
- /** Compression suffix → `loadKtxTexture2D` token, recognised in a pre-resolved KTX URL. */
6631
- var KTX_SUFFIX_RE = /(-astc|-dxt|-etc2|-pvrtc)\.ktx(\?.*)?$/i;
6632
7020
  /**
6633
- * @internal Recognise a pre-resolved compressed KTX URL and split it into the
6634
- * `{ baseUrl, suffix }` pair Babylon Lite's `loadKtxTexture2D` expects (which
6635
- * takes a base image URL plus a format suffix and reconstructs the KTX URL
6636
- * itself), or `null` when the URL is not a compressed KTX.
6637
- *
6638
- * Babylon.js code selects the format via `engine.getCaps()` and hands `Texture`
6639
- * a single fully-qualified `.ktx` URL (e.g. `…/grid-dxt.ktx`), so the base is the
6640
- * `.png` fallback (`…/grid.png`) and the suffix is `-dxt.ktx`. Any query string
6641
- * (auth / cache-busting / signed-URL params) is preserved on the base URL so it
6642
- * survives onto both the KTX fetch and the `.png` fallback.
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}.
6643
7024
  */
6644
- function resolveKtxUrl(url) {
6645
- const ktx = url.match(KTX_SUFFIX_RE);
6646
- if (!ktx) return null;
6647
- return {
6648
- baseUrl: url.replace(KTX_SUFFIX_RE, ".png$2"),
6649
- suffix: ktx[1] + ".ktx"
6650
- };
6651
- }
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;
6652
7057
  /**
6653
- * Pick the right Babylon Lite loader for a texture URL:
6654
- * - `.basis` → `loadBasisTexture2D` (GPU-format transcode; manages its own V-flip).
6655
- * - a pre-resolved compressed KTX (`…-dxt.ktx` etc.) → `loadKtxTexture2D` (see
6656
- * {@link resolveKtxUrl}), which re-checks device support and falls back to the
6657
- * base image.
6658
- * - everything else → the raster `loadTexture2D`.
6659
- *
6660
- * The basis/KTX loaders manage their own V-orientation, so the raster-only
6661
- * `invertY` / `mipMaps` options are ignored there — passing the same opts is safe.
7058
+ * Babylon.js `CSG2` — Manifold-based constructive solid geometry that preserves
7059
+ * per-source-mesh materials. Call `await InitializeCSG2Async()` once before use.
6662
7060
  */
6663
- function loadCompatTexture(engine, url, opts) {
6664
- if (url.split(/[?#]/)[0].toLowerCase().endsWith(".basis")) return loadBasisTexture2D(engine, url, opts);
6665
- const ktx = resolveKtxUrl(url);
6666
- if (ktx) return loadKtxTexture2D(engine, ktx.baseUrl, [ktx.suffix], opts);
6667
- return loadTexture2D(engine, url, opts);
6668
- }
6669
- var BaseTexture = class {
6670
- name = "";
6671
- /** @internal The underlying Lite texture handle. Undefined until the async load resolves. */
7061
+ var CSG2 = class CSG2 {
6672
7062
  _lite;
6673
- /** @internal One-shot listeners fired when the GPU handle first resolves (see {@link _onReady}). */
6674
- _readyListeners;
6675
- getClassName() {
6676
- return "BaseTexture";
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);
6677
7091
  }
6678
7092
  /**
6679
- * @internal Register a callback fired once this texture's GPU handle resolves.
6680
- * Owning compat materials use it to rebind and rebuild once an asynchronously
6681
- * loaded texture becomes available. Fires immediately if the handle already
6682
- * exists; otherwise queues until {@link _notifyReady}. One-shot per listener.
7093
+ * Babylon.js `csg.toMesh(name, scene)` — triangulate into a single mesh,
7094
+ * preserving each source mesh's material across the result's faces.
6683
7095
  */
6684
- _onReady(listener) {
6685
- if (this._lite) {
6686
- listener();
6687
- return;
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;
6688
7102
  }
6689
- (this._readyListeners ??= []).push(listener);
6690
- }
6691
- /** @internal Fire and clear the readiness listeners (called by subclasses once `_lite` resolves). */
6692
- _notifyReady() {
6693
- const listeners = this._readyListeners;
6694
- if (listeners) {
6695
- this._readyListeners = void 0;
6696
- for (const listener of listeners) listener();
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;
7113
+ }
7114
+ addToScene(scene._lite, root._lite);
7115
+ });
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));
6697
7121
  }
7122
+ return root;
7123
+ }
7124
+ /** Babylon.js `csg.dispose()` — release the underlying Manifold solid. */
7125
+ dispose() {
7126
+ disposeCsg2(this._lite);
6698
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 {
6699
7147
  /**
6700
- * Babylon.js `BaseTexture.getInternalTexture()` — the backend texture handle. Babylon.js
6701
- * returns an `InternalTexture`; the compat layer's equivalent is the Lite texture handle,
6702
- * which is what the compat engine's texture methods accept.
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.
6703
7151
  */
6704
- getInternalTexture() {
6705
- return this._lite ?? null;
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;
6706
7158
  }
6707
- dispose() {}
6708
7159
  };
6709
- /** Babylon.js `HtmlTexture`, forwarding DOM capture and updates to Babylon Lite. */
6710
- var HtmlTexture = class extends BaseTexture {
6711
- element;
6712
- host;
6713
- onLoadObservable = new Observable(void 0, true);
6714
- _engine;
6715
- _textureMatrix = Matrix.Identity();
6716
- _ready;
6717
- _htmlTexture;
6718
- _disposed = false;
6719
- constructor(name, element, options) {
6720
- super();
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) {
6721
7185
  this.name = name;
6722
- this.element = element;
6723
- this._engine = options.scene?.getEngine() ?? options.engine ?? null;
6724
- this.host = this._engine?.getRenderingCanvas() ?? null;
6725
- if (!this._engine || !element) {
6726
- this._ready = Promise.reject(/* @__PURE__ */ new Error("HtmlTexture requires an engine and HTML element."));
6727
- this._ready.catch(() => void 0);
6728
- return;
6729
- }
6730
- 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.");
6731
- const nearest = options.samplingMode === Texture.NEAREST_SAMPLINGMODE || options.samplingMode === Texture.NEAREST_NEAREST;
6732
- const htmlTexture = createHtmlTexture(this._engine._lite, element, {
6733
- width: options.width,
6734
- height: options.height,
6735
- mipMaps: options.generateMipMaps ?? false,
6736
- autoUpdate: options.autoUpdate ?? true,
6737
- useSvgFallback: options.useSvgFallback ?? true,
6738
- minFilter: nearest ? "nearest" : "linear",
6739
- magFilter: nearest ? "nearest" : "linear",
6740
- invertY: true
6741
- });
6742
- this._htmlTexture = htmlTexture;
6743
- this._ready = whenHtmlTextureReady(htmlTexture).then(() => {
6744
- if (this._disposed) throw new Error("HtmlTexture was disposed before its first upload completed.");
6745
- this._lite = htmlTexture;
6746
- try {
6747
- this.onLoadObservable.notifyObservers(this);
6748
- } finally {
6749
- this._notifyReady();
6750
- }
6751
- });
6752
- this._ready.catch(() => void 0);
7186
+ this._influence = influence;
6753
7187
  }
6754
- getTextureMatrix() {
6755
- return this._textureMatrix;
7188
+ get influence() {
7189
+ return this._influence;
6756
7190
  }
6757
- requestUpdate() {
6758
- if (this._engine && this._htmlTexture) requestHtmlTextureUpdate(this._engine._lite, this._htmlTexture);
7191
+ set influence(value) {
7192
+ this._influence = value;
7193
+ this._manager?._syncWeights();
6759
7194
  }
6760
- update(invertY = true) {
6761
- if (this._engine && this._htmlTexture) updateHtmlTexture(this._engine._lite, this._htmlTexture, invertY);
7195
+ /** Babylon.js `MorphTarget.setPositions(data)` — absolute target positions. */
7196
+ setPositions(data) {
7197
+ this._positions = data ? data instanceof Float32Array ? data : Float32Array.from(data) : null;
6762
7198
  }
6763
- getClassName() {
6764
- return "HtmlTexture";
7199
+ /** Babylon.js `MorphTarget.getPositions()`. */
7200
+ getPositions() {
7201
+ return this._positions;
6765
7202
  }
6766
- whenReadyAsync() {
6767
- return this._ready;
7203
+ /** Babylon.js `MorphTarget.setNormals(data)` — absolute target normals. */
7204
+ setNormals(data) {
7205
+ this._normals = data ? data instanceof Float32Array ? data : Float32Array.from(data) : null;
6768
7206
  }
6769
- dispose() {
6770
- this._disposed = true;
6771
- if (this._htmlTexture) {
6772
- disposeHtmlTexture(this._htmlTexture);
6773
- this._htmlTexture = void 0;
6774
- }
6775
- this._lite = void 0;
6776
- this.onLoadObservable.clear();
6777
- this.onLoadObservable.cleanLastNotifiedState();
7207
+ /** Babylon.js `MorphTarget.getNormals()`. */
7208
+ getNormals() {
7209
+ return this._normals;
6778
7210
  }
6779
7211
  };
6780
- var Texture = class Texture extends BaseTexture {
6781
- _ready;
6782
- _onLoadObservable;
6783
- /** Babylon.js sampling-mode constants (numeric parity). */
6784
- static NEAREST_SAMPLINGMODE = 1;
6785
- static BILINEAR_SAMPLINGMODE = 2;
6786
- static TRILINEAR_SAMPLINGMODE = 3;
6787
- static NEAREST_NEAREST = 8;
6788
- static LINEAR_LINEAR = 11;
6789
- /** Babylon.js coordinate-mode constants (numeric parity). */
6790
- static CLAMP_ADDRESSMODE = 0;
6791
- static WRAP_ADDRESSMODE = 1;
6792
- static MIRROR_ADDRESSMODE = 2;
6793
- /** Babylon.js texture UV tiling (applied to the Lite material at bind time). */
6794
- uScale = 1;
6795
- vScale = 1;
6796
- uOffset = 0;
6797
- vOffset = 0;
6798
- hasAlpha = false;
6799
- coordinatesIndex = 0;
6800
- /** Babylon.js sampling mode passed at construction (`NEAREST_SAMPLINGMODE` = 1, etc.). */
6801
- samplingMode;
6802
- /** @internal The Scene or engine this texture was created against (for `clone`). */
6803
- _source;
6804
- constructor(url, sceneOrEngine, noMipmapOrOptions, invertY, _samplingMode, onLoad) {
6805
- super();
6806
- this.name = url;
6807
- let noMipmap = false;
6808
- let invertYOpt = invertY;
6809
- let samplingMode = _samplingMode;
6810
- if (typeof noMipmapOrOptions === "boolean") noMipmap = noMipmapOrOptions;
6811
- else if (noMipmapOrOptions && typeof noMipmapOrOptions === "object") {
6812
- const o = noMipmapOrOptions;
6813
- noMipmap = o.noMipmap ?? false;
6814
- invertYOpt = invertYOpt ?? o.invertY;
6815
- samplingMode = samplingMode ?? o.samplingMode;
6816
- }
6817
- this._invertY = invertYOpt ?? true;
6818
- this._noMipmap = noMipmap;
6819
- this.samplingMode = samplingMode ?? Texture.BILINEAR_SAMPLINGMODE;
6820
- this._source = sceneOrEngine;
6821
- const scene = sceneOrEngine.getEngine ? sceneOrEngine : void 0;
6822
- const engineWrapper = scene ? void 0 : sceneOrEngine;
6823
- const engine = scene ? scene.getEngine()._lite : engineWrapper._lite;
6824
- const filterOpts = this.samplingMode === Texture.NEAREST_SAMPLINGMODE || this.samplingMode === Texture.NEAREST_NEAREST ? {
6825
- minFilter: "nearest",
6826
- magFilter: "nearest"
6827
- } : {};
6828
- const loadOpts = scene ? {
6829
- invertY: this._invertY,
6830
- mipMaps: !this._noMipmap,
6831
- ...filterOpts
6832
- } : {};
6833
- this._ready = loadCompatTexture(engine, url, loadOpts).then((tex) => {
6834
- this._lite = tex;
6835
- try {
6836
- this._notifyLoadObservable();
6837
- if (onLoad) onLoad();
6838
- } finally {
6839
- this._notifyReady();
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];
6840
7251
  }
7252
+ return {
7253
+ positions,
7254
+ normals
7255
+ };
6841
7256
  });
6842
- scene?._trackTextureLoad(this._ready);
6843
- engineWrapper?._registerStartupWork?.(() => this._ready);
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;
6844
7260
  }
6845
- /** @internal Upload-time vertical flip / mipmap flags, preserved across `clone`. */
6846
- _invertY;
6847
- _noMipmap;
6848
- getClassName() {
6849
- return "Texture";
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);
6850
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;
6851
7346
  /**
6852
- * Babylon.js `texture.clone()` — a new `Texture` over the same source URL.
6853
- * UV tiling/offset and sampling are copied; the clone re-resolves the GPU
6854
- * 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.
6855
7354
  */
6856
- clone() {
6857
- const c = new Texture(this.name, this._source, this._noMipmap, this._invertY, this.samplingMode);
6858
- c.uScale = this.uScale;
6859
- c.vScale = this.vScale;
6860
- c.uOffset = this.uOffset;
6861
- c.vOffset = this.vOffset;
6862
- c.hasAlpha = this.hasAlpha;
6863
- c.coordinatesIndex = this.coordinatesIndex;
6864
- return c;
7355
+ safeOrbitCameraLimits = null;
7356
+ get pointSplattingRenderScale() {
7357
+ return this._pointSplattingRenderScale;
6865
7358
  }
6866
- whenReadyAsync() {
6867
- return this._ready;
7359
+ set pointSplattingRenderScale(value) {
7360
+ const liteValue = litePointSplattingRenderScale(value);
7361
+ this._pointSplattingRenderScale = value;
7362
+ if (this._pointSplatting) this._pointSplatting.renderScale = liteValue;
6868
7363
  }
6869
- /** Babylon.js `Texture.onLoadObservable`, allocated only when code subscribes. */
6870
- get onLoadObservable() {
6871
- let observable = this._onLoadObservable;
6872
- if (!observable) {
6873
- observable = new Observable(void 0, true);
6874
- this._onLoadObservable = observable;
6875
- if (this.isReady()) observable.notifyObservers(this);
6876
- }
6877
- return observable;
7364
+ get pointSplattingOcclusionCulling() {
7365
+ return this._pointSplattingOcclusionCulling;
6878
7366
  }
6879
- _notifyLoadObservable() {
6880
- if (this._onLoadObservable) this._onLoadObservable.notifyObservers(this);
7367
+ set pointSplattingOcclusionCulling(value) {
7368
+ this._pointSplattingOcclusionCulling = value;
7369
+ if (this._pointSplatting) this._pointSplatting.occlusionCulling = value;
6881
7370
  }
6882
- /** Babylon.js `BaseTexture.isReady()` — true once the GPU handle has resolved. */
6883
- isReady() {
6884
- return this._lite !== void 0;
7371
+ get pointSplattingRenderMode() {
7372
+ return this._pointSplattingRenderMode;
6885
7373
  }
6886
- /** Load a texture and resolve once its GPU handle is available. */
6887
- static async LoadAsync(url, scene) {
6888
- const texture = new Texture(url, scene);
6889
- await texture.whenReadyAsync();
6890
- return texture;
7374
+ set pointSplattingRenderMode(value) {
7375
+ if (value === this._pointSplattingRenderMode) return;
7376
+ this._pointSplattingRenderMode = value;
7377
+ this._syncPointSplatting();
6891
7378
  }
6892
- };
6893
- /**
6894
- * Babylon.js `RawTexture` — a texture created from raw pixel bytes. Backed by
6895
- * Babylon Lite's `createTexture2DFromPixels`; the GPU handle is available
6896
- * synchronously after construction.
6897
- */
6898
- var RawTexture = class RawTexture extends BaseTexture {
6899
- _scene;
6900
- constructor(data, width, height, scene) {
6901
- super();
6902
- this._scene = scene;
6903
- this._lite = createTexture2DFromPixels(scene.getEngine()._lite, data, width, height);
7379
+ get pointSplattingDepthRenderMode() {
7380
+ return this._pointSplattingDepthRenderMode;
6904
7381
  }
6905
- getClassName() {
6906
- return "RawTexture";
7382
+ set pointSplattingDepthRenderMode(value) {
7383
+ if (value === this._pointSplattingDepthRenderMode) return;
7384
+ this._pointSplattingDepthRenderMode = value;
7385
+ this._syncPointSplatting();
6907
7386
  }
6908
- /** Replace the texture's pixel contents. */
6909
- update(data) {
6910
- 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;
6911
7394
  }
6912
- whenReadyAsync() {
6913
- return Promise.resolve();
7395
+ get pointSplattingScale() {
7396
+ return this._pointSplattingScale;
6914
7397
  }
6915
- static CreateRGBATexture(data, width, height, scene) {
6916
- return new RawTexture(data, width, height, scene);
7398
+ set pointSplattingScale(value) {
7399
+ this._pointSplattingScale = value;
7400
+ if (this._pointSplatting) this._pointSplatting.pointScale = value;
6917
7401
  }
6918
- };
6919
- /**
6920
- * Babylon.js `RawTexture3D` — a volumetric texture created from raw RGBA8 pixel
6921
- * bytes (the common case being a colour-grading LUT / colour cube). Backed by
6922
- * Babylon Lite's `createTexture3DFromPixels`; the GPU handle is available
6923
- * synchronously after construction.
6924
- *
6925
- * Babylon Lite's 3D-texture path is RGBA8-only, so the `format` argument is
6926
- * recorded for API parity but the upload always treats `data` as tightly-packed
6927
- * `width * height * depth * 4` RGBA bytes (x fastest, then y, then z).
6928
- */
6929
- var RawTexture3D = class extends BaseTexture {
6930
- format;
6931
- _scene;
6932
- /** Babylon.js `RawTexture3D.is3D` — always true for a 3D texture. */
6933
- is3D = true;
6934
- constructor(data, width, height, depth, format, scene, generateMipMaps = true, _invertY = false, _samplingMode = 3, _textureType, _creationFlags) {
6935
- super();
6936
- this.format = format;
6937
- 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.");
6938
- this._scene = scene;
6939
- const bytes = toRgbaBytes(data, width, height, depth);
6940
- 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;
6941
7405
  }
6942
7406
  getClassName() {
6943
- return "RawTexture3D";
6944
- }
6945
- /** Gets the width of the texture. */
6946
- get width() {
6947
- return this._lite?.width ?? 0;
6948
- }
6949
- /** Gets the height of the texture. */
6950
- get height() {
6951
- return this._lite?.height ?? 0;
6952
- }
6953
- /** Gets the depth of the texture. */
6954
- get depth() {
6955
- return this._lite?.depth ?? 0;
7407
+ return "GaussianSplattingMesh";
6956
7408
  }
6957
- /**
6958
- * Replace the texture's pixel contents. Babylon Lite has no in-place 3D update,
6959
- * so the volume is re-uploaded (a fresh Lite 3D texture handle).
6960
- */
6961
- update(data) {
6962
- const bytes = toRgbaBytes(data, this.width, this.height, this.depth);
6963
- this._lite = createTexture3DFromPixels(this._scene.getEngine()._lite, bytes, this.width, this.height, this.depth);
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;
6964
7412
  }
6965
- whenReadyAsync() {
6966
- return Promise.resolve();
7413
+ /** @internal Accessibility metadata belongs to the loaded cloud, or its placeholder before loading. */
7414
+ _accessibilitySource() {
7415
+ return this._gs ?? this._node;
6967
7416
  }
6968
- };
6969
- /**
6970
- * @internal Coerce a raw `ArrayBufferView` (or a bare `Uint8Array`) into the tightly
6971
- * packed `width * height * depth * 4` RGBA8 `Uint8Array` Babylon Lite's raw-pixel
6972
- * texture factories expect (`createTexture3DFromPixels`,
6973
- * `createTexture2DArrayFromPixels`). Babylon.js allows a `null` data argument
6974
- * (an empty texture); Lite requires bytes, so `null` becomes a zero-filled volume.
6975
- * For a 2D array, `depth` is the layer count.
6976
- */
6977
- function toRgbaBytes(data, width, height, depth) {
6978
- const expected = width * height * depth * 4;
6979
- if (data === null) return new Uint8Array(expected);
6980
- const bytes = data instanceof Uint8Array ? data : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
6981
- return bytes.byteLength > expected ? bytes.subarray(0, expected) : bytes;
6982
- }
6983
- /**
6984
- * Babylon.js `DynamicTexture` — a canvas-backed texture. Draw into
6985
- * `getContext()`, then call `update()` to upload the canvas pixels to the GPU.
6986
- * Backed by Babylon Lite's `createDynamicTexture` / `updateDynamicTexture`, which
6987
- * blit the canvas straight to the GPU via `copyExternalImageToTexture` (no
6988
- * `getImageData` CPU readback).
6989
- */
6990
- var DynamicTexture = class extends BaseTexture {
6991
- _scene;
6992
- _canvas;
6993
- _context;
6994
- _width;
6995
- _height;
6996
- /** @internal Branded Lite dynamic texture; aliases `_lite` and is the only
6997
- * handle `updateDynamicTexture` accepts. */
6998
- _dyn;
6999
- constructor(name, options, scene) {
7000
- super();
7001
- this.name = name;
7002
- this._scene = scene;
7003
- this._width = options.width;
7004
- this._height = options.height;
7005
- this._canvas = document.createElement("canvas");
7006
- this._canvas.width = options.width;
7007
- this._canvas.height = options.height;
7008
- const ctx = this._canvas.getContext("2d");
7009
- if (!ctx) throw new Error("DynamicTexture: 2D canvas context unavailable.");
7010
- this._context = ctx;
7011
- this._dyn = createDynamicTexture(scene.getEngine()._lite, options.width, options.height);
7012
- this._lite = this._dyn;
7417
+ get position() {
7418
+ return liteBackedVector3(this._xform.position);
7013
7419
  }
7014
- getClassName() {
7015
- return "DynamicTexture";
7420
+ set position(value) {
7421
+ this._xform.position.set(value.x, value.y, value.z);
7016
7422
  }
7017
- getContext() {
7018
- return this._context;
7423
+ get rotation() {
7424
+ return liteBackedVector3(this._xform.rotation);
7019
7425
  }
7020
- getSize() {
7021
- return {
7022
- width: this._width,
7023
- height: this._height
7024
- };
7426
+ set rotation(value) {
7427
+ this._xform.rotation.set(value.x, value.y, value.z);
7025
7428
  }
7026
- /** Draw `text` and refresh the GPU texture. */
7027
- drawText(text, x, y, font, color, clearColor) {
7028
- const ctx = this._context;
7029
- if (clearColor) {
7030
- ctx.fillStyle = clearColor;
7031
- ctx.fillRect(0, 0, this._width, this._height);
7032
- }
7033
- ctx.font = font;
7034
- ctx.fillStyle = color;
7035
- ctx.fillText(text, x, y);
7036
- this.update();
7429
+ get scaling() {
7430
+ return liteBackedVector3(this._xform.scaling);
7037
7431
  }
7038
- /**
7039
- * Blit the current canvas pixels straight to the GPU texture (no CPU readback).
7040
- * @param invertY - Flip V so a top-down canvas samples upright. Default `true` (Babylon.js parity).
7041
- * @param premulAlpha - Treat the upload as premultiplied alpha. Default `false`.
7042
- * @param _allowGPUOptimization - Accepted for Babylon.js signature parity; the blit is already GPU-direct, so this is a no-op.
7043
- */
7044
- update(invertY = true, premulAlpha = false, _allowGPUOptimization = false) {
7045
- updateDynamicTexture(this._scene.getEngine()._lite, this._dyn, this._canvas, {
7046
- invertY,
7047
- premultiplyAlpha: premulAlpha
7048
- });
7432
+ set scaling(value) {
7433
+ this._xform.scaling.set(value.x, value.y, value.z);
7049
7434
  }
7050
- whenReadyAsync() {
7051
- return Promise.resolve();
7435
+ /** @internal Set the Lite shader-fragment plugins applied on the next load (compat material-plugin path). */
7436
+ _setFragments(fragments) {
7437
+ this._fragments = fragments;
7052
7438
  }
7053
- };
7054
- /**
7055
- * Babylon.js `CubeTexture` — environment/skybox cube map. Babylon Lite loads
7056
- * environments through `loadEnvironment` (IBL + skybox registered on the scene)
7057
- * rather than as a standalone GPU texture object. This compat `CubeTexture`
7058
- * therefore acts as a lightweight handle that records the environment URL; the
7059
- * actual GPU work happens when it is assigned to `scene.environmentTexture` and
7060
- * the engine starts (see `Scene` env handling). It still extends
7061
- * {@link BaseTexture} to match the Babylon.js class hierarchy, so it can appear
7062
- * in `BaseTexture[]` surfaces such as `Material.getActiveTextures()`; because the
7063
- * environment has no standalone Lite handle, `getInternalTexture()` stays `null`.
7064
- */
7065
- var CubeTexture = class CubeTexture extends BaseTexture {
7066
- /** Source URL of the (prefiltered) environment. */
7067
- url;
7068
- /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */
7069
- coordinatesMode = 0;
7070
- gammaSpace = true;
7071
- level = 1;
7072
7439
  /**
7073
- * @internal Which Lite environment loader the scene should route this handle
7074
- * through at engine start. Plain `.env`/`.dds` cube maps load via
7075
- * `loadEnvironment`/`loadDdsEnvironment`; `HDRCubeTexture` overrides this to
7076
- * `"hdr"` so the scene picks `loadHdrEnvironment`.
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.
7077
7442
  */
7078
- _envLoaderKind = "cube";
7079
- /** Fires when the cube map is "ready" (resolved on a microtask in this compat layer). */
7080
- onLoadObservable = new Observable();
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;
7451
+ }
7081
7452
  /**
7082
- * Babylon.js `CubeTexture.rotationY` — rotation of the environment around the Y axis, in radians. A scene that uses the
7083
- * texture as its `environmentTexture` turns its image-based lighting with it (see `Scene.environmentTexture`).
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.
7084
7456
  */
7085
- rotationY = 0;
7086
- _ready = false;
7087
- _readyPromise;
7088
- constructor(url, _scene, _extensions, _noMipmap, _files, onLoad, _onError, _format, _prefiltered) {
7089
- super();
7090
- this.url = url;
7091
- this.name = url;
7092
- this._readyPromise = new Promise((resolve) => {
7093
- queueMicrotask(() => {
7094
- this._ready = true;
7095
- if (onLoad) onLoad();
7096
- this.onLoadObservable.notifyObservers(this);
7097
- resolve();
7098
- });
7099
- });
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);
7100
7468
  }
7101
- getClassName() {
7102
- return "CubeTexture";
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;
7103
7476
  }
7104
- /** Babylon.js `BaseTexture.isReady()`. */
7105
- isReady() {
7106
- return this._ready;
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
7490
+ });
7107
7491
  }
7108
- whenReadyAsync() {
7109
- return this._readyPromise;
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
+ }
7110
7498
  }
7111
- /** Babylon.js `CubeTexture.CreateFromPrefilteredData(url, scene)`. */
7112
- static CreateFromPrefilteredData(url, scene) {
7113
- return new CubeTexture(url, scene);
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;
7114
7502
  }
7115
- dispose() {}
7116
- };
7117
- /**
7118
- * Babylon.js `HDRCubeTexture` — a Radiance `.hdr` (RGBE) equirectangular panorama
7119
- * used as an environment / IBL source. Like {@link CubeTexture} this is a
7120
- * lightweight handle that records the `.hdr` URL; the actual GPU work (equirect →
7121
- * prefiltered cubemap + irradiance SH + BRDF LUT) happens when it is assigned to
7122
- * `scene.environmentTexture` and the engine starts, at which point the scene
7123
- * routes it through Babylon Lite's native `loadHdrEnvironment`.
7124
- */
7125
- var HDRCubeTexture = class extends BaseTexture {
7126
- /** Source URL of the `.hdr` panorama. */
7127
- url;
7128
- /** Requested cubemap face size (BJS `size`); forwarded to Lite's `faceSize`. */
7129
- size;
7130
- /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */
7131
- coordinatesMode = 0;
7132
- gammaSpace = true;
7133
- level = 1;
7134
- /** @internal Selects Lite's `loadHdrEnvironment` in the scene's env loader. */
7135
- _envLoaderKind = "hdr";
7136
- /** Fires when the HDR environment is "ready" (resolved on a microtask). */
7137
- onLoadObservable = new Observable();
7138
7503
  /**
7139
- * Babylon.js `HDRCubeTexture.rotationY` — rotation of the environment around the Y axis, in radians. A scene that uses the
7140
- * texture as its `environmentTexture` turns its image-based lighting with it (see `Scene.environmentTexture`).
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.
7141
7514
  */
7142
- rotationY = 0;
7143
- _ready = false;
7144
- _readyPromise;
7145
- constructor(url, _sceneOrEngine, size = 256, _noMipmap, _generateHarmonics, _gammaSpace, _prefilterOnLoad, onLoad) {
7146
- super();
7147
- this.url = url;
7148
- this.size = size;
7149
- this.name = url;
7150
- this._readyPromise = new Promise((resolve) => {
7151
- queueMicrotask(() => {
7152
- this._ready = true;
7153
- if (onLoad) onLoad();
7154
- this.onLoadObservable.notifyObservers(this);
7155
- resolve();
7156
- });
7157
- });
7515
+ updateData(splatBuffer, _sh, options) {
7516
+ const buffer = options?.flipY === false ? mirrorSplatRowY(splatBuffer) : splatBuffer;
7517
+ this._gs?.updateData(buffer);
7158
7518
  }
7159
- getClassName() {
7160
- return "HDRCubeTexture";
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
+ }
7161
7533
  }
7162
- /** Babylon.js `BaseTexture.isReady()`. */
7163
- isReady() {
7164
- 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;
7165
7537
  }
7166
- whenReadyAsync() {
7167
- 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;
7541
+ }
7542
+ /** @internal Release the opt-in point renderer before removing the splat node. */
7543
+ _disposeSelf(doNotRecurse) {
7544
+ this._disablePointSplatting();
7545
+ super._disposeSelf(doNotRecurse);
7168
7546
  }
7169
- dispose() {}
7170
7547
  };
7171
- /** Babylon.js `RenderTargetTexture` — offscreen render target. Use the native frame-graph RTT APIs. */
7172
- var RenderTargetTexture = class {
7173
- constructor() {
7174
- unsupported("RenderTargetTexture", "Offscreen rendering uses Babylon Lite's frame-graph render-target APIs (`createRenderTargetTexture` / render tasks).");
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);
7602
+ }
7603
+ };
7604
+ var MeshBlendingPostProcess = class {
7605
+ constructor(..._args) {
7606
+ unsupported("MeshBlendingPostProcess", MESH_BLENDING_BLOCKER);
7175
7607
  }
7176
7608
  };
7609
+ var FrameGraphMeshBlendingTask = class {
7610
+ constructor(..._args) {
7611
+ unsupported("FrameGraphMeshBlendingTask", MESH_BLENDING_BLOCKER);
7612
+ }
7613
+ };
7614
+ var NodeRenderGraphMeshBlendingPostProcessBlock = class {
7615
+ constructor(..._args) {
7616
+ unsupported("NodeRenderGraphMeshBlendingPostProcessBlock", MESH_BLENDING_BLOCKER);
7617
+ }
7618
+ };
7619
+ function RegisterMeshBlendingPostProcessBlock() {
7620
+ return unsupported("RegisterMeshBlendingPostProcessBlock", MESH_BLENDING_BLOCKER);
7621
+ }
7177
7622
  //#endregion
7178
7623
  //#region src/textures/external-texture.ts
7179
7624
  var nextUniqueId = 0;
@@ -11578,7 +12023,7 @@ var MaterialPluginBase = class MaterialPluginBase {
11578
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.";
11579
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.";
11580
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.";
11581
- 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.";
11582
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.";
11583
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.";
11584
12029
  var FlowGraphValidationSeverity = /* @__PURE__ */ function(FlowGraphValidationSeverity) {
@@ -12092,11 +12537,6 @@ var OpenPBRMaterialLoadingAdapter = class {
12092
12537
  unsupported("OpenPBRMaterialLoadingAdapter", "The adapter translates glTF material data into OpenPBRMaterial, whose shader/material subsystem requires Lite maintainer design.");
12093
12538
  }
12094
12539
  };
12095
- var RectAreaLight = class {
12096
- constructor() {
12097
- unsupported("RectAreaLight", "Area lights are not implemented in Babylon Lite. Use Point/Spot/Directional/Hemispheric lights.");
12098
- }
12099
- };
12100
12540
  var GPUParticleSystem = class {
12101
12541
  constructor() {
12102
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.");
@@ -13477,6 +13917,6 @@ var NodeParticleSystemSet = class NodeParticleSystemSet {
13477
13917
  }
13478
13918
  };
13479
13919
  //#endregion
13480
- 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, 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, 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, defaultValueParseFunction, 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 };
13481
13921
 
13482
13922
  //# sourceMappingURL=index.js.map