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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/math/scalar.ts","../src/math/constants.ts","../src/math/plane.ts","../src/math/ray.ts","../src/math/frustum.ts","../src/math/size.ts","../src/math/polar.ts","../src/math/spherical.ts","../src/math/curve.ts","../src/math/color-temperature.ts","../src/culling/picking-info.ts","../src/misc/misc-utils.ts","../src/engine/engine.ts","../src/compute/compute-shader.ts","../src/buffers/storage-buffer.ts","../src/materials/uniform-buffer.ts","../src/scene/abstract-scene.ts","../src/physics/physics.ts","../src/cameras/cameras.ts","../src/animations/animation.ts","../src/misc/engine-constants.ts","../src/events/pointer-events.ts","../src/scene/scene.ts","../src/lights/lights.ts","../src/lights/clustered-light-container.ts","../src/meshes/csg.ts","../src/meshes/compression.ts","../src/morph/morph.ts","../src/meshes/gaussian-splatting.ts","../src/meshes/mesh-blending.ts","../src/textures/textures.ts","../src/textures/external-texture.ts","../src/textures/raw-texture-2d-array.ts","../src/loading/loaded-mesh.ts","../src/bones/skeleton.ts","../src/loading/splat-file-loader.ts","../src/loading/usd-options.ts","../src/loading/scene-loader.ts","../src/loading/assets-manager.ts","../src/loading/material-variants.ts","../src/loading/usd-file-loader.ts","../src/picking/gpu-picker.ts","../src/gizmos/gizmos.ts","../src/behaviors/behaviors.ts","../src/sprites/sprites.ts","../src/shadows/shadow-generator.ts","../src/materials/node-material.ts","../src/materials/grid-material.ts","../src/materials/material-helpers.ts","../src/animations/easing.ts","../src/misc/guid.ts","../src/misc/tools.ts","../src/actions/actions.ts","../src/audio/audio-enums.ts","../src/audio/audio.ts","../src/materials/material-plugin.ts","../src/unsupported/unsupported-apis.ts","../src/loading/unsupported-khr-interactivity.ts","../src/loading/gltf2.ts","../src/loading/gltf1.ts","../src/meshes/gaussian-splatting-stream.ts","../src/unsupported/unsupported-extended.ts","../src/particles/particle-system.ts","../src/particles/node-particle-system-set.ts"],"sourcesContent":["/** Babylon.js-compatible scalar helpers and a small set of math constants. */\n\nexport const Epsilon = 0.001;\nexport const ToRadians = Math.PI / 180;\nexport const ToDegrees = 180 / Math.PI;\n\n/** Babylon.js `Scalar` namespace — common scalar utilities. */\nexport const Scalar = {\n Clamp(value: number, min = 0, max = 1): number {\n return Math.min(max, Math.max(min, value));\n },\n Lerp(start: number, end: number, amount: number): number {\n return start + (end - start) * amount;\n },\n InverseLerp(a: number, b: number, value: number): number {\n return a === b ? 0 : (value - a) / (b - a);\n },\n DegreesToRadians(degrees: number): number {\n return degrees * ToRadians;\n },\n RadiansToDegrees(radians: number): number {\n return radians * ToDegrees;\n },\n WithinEpsilon(a: number, b: number, epsilon = 1.401298e-45): boolean {\n return Math.abs(a - b) <= epsilon;\n },\n Normalize(value: number, min: number, max: number): number {\n return (value - min) / (max - min);\n },\n Denormalize(normalized: number, min: number, max: number): number {\n return normalized * (max - min) + min;\n },\n};\n","/** Babylon.js-compatible spatial constants (`Axis`, `Space`). */\n\nimport { Vector3 } from \"./vector.js\";\n\n// Lazily-cached axis singletons: stable identity (matching Babylon.js, where\n// `Axis.X/Y/Z` are shared constants) and no allocation until first accessed.\nlet _axisX: Vector3 | undefined;\nlet _axisY: Vector3 | undefined;\nlet _axisZ: Vector3 | undefined;\n\nexport const Axis = {\n get X(): Vector3 {\n return (_axisX ??= new Vector3(1, 0, 0));\n },\n get Y(): Vector3 {\n return (_axisY ??= new Vector3(0, 1, 0));\n },\n get Z(): Vector3 {\n return (_axisZ ??= new Vector3(0, 0, 1));\n },\n};\n\nexport enum Space {\n LOCAL = 0,\n WORLD = 1,\n BONE = 2,\n}\n","/** Babylon.js-compatible `Plane` (pure JS). */\n\nimport { Vector3 } from \"./vector.js\";\nimport type { Matrix } from \"./matrix.js\";\n\nexport class Plane {\n /** Normal x/y/z and signed distance `d` from the origin (`normal · p + d = 0`). */\n public normal: Vector3;\n public d: number;\n\n public constructor(a: number, b: number, c: number, d: number) {\n this.normal = new Vector3(a, b, c);\n this.d = d;\n }\n\n public asArray(): [number, number, number, number] {\n return [this.normal.x, this.normal.y, this.normal.z, this.d];\n }\n\n public clone(): Plane {\n return new Plane(this.normal.x, this.normal.y, this.normal.z, this.d);\n }\n\n public normalize(): this {\n const norm = Math.sqrt(this.normal.x * this.normal.x + this.normal.y * this.normal.y + this.normal.z * this.normal.z);\n const inv = norm === 0 ? 0 : 1 / norm;\n this.normal.scaleInPlace(inv);\n this.d *= inv;\n return this;\n }\n\n /** Signed distance from `point` to this plane. */\n public signedDistanceTo(point: Vector3): number {\n return Vector3.Dot(point, this.normal) + this.d;\n }\n\n public dotCoordinate(point: Vector3): number {\n return this.normal.x * point.x + this.normal.y * point.y + this.normal.z * point.z + this.d;\n }\n\n public static FromArray(array: ArrayLike<number>): Plane {\n return new Plane(array[0] ?? 0, array[1] ?? 0, array[2] ?? 0, array[3] ?? 0);\n }\n\n public static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane {\n const n = normal.clone().normalize();\n const d = -(n.x * origin.x + n.y * origin.y + n.z * origin.z);\n return new Plane(n.x, n.y, n.z, d);\n }\n\n public static FromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane {\n const normal = Vector3.Cross(point2.subtract(point1), point3.subtract(point1)).normalize();\n return Plane.FromPositionAndNormal(point1, normal);\n }\n\n /** Transform a copy of this plane by the transpose of the inverse of `transformation`. */\n public transform(transformation: Matrix): Plane {\n // For a correct plane transform the caller passes the inverse-transpose;\n // here we apply the matrix directly to (normal, d) as a row-vector.\n const m = transformation.m;\n const x = this.normal.x;\n const y = this.normal.y;\n const z = this.normal.z;\n const d = this.d;\n const nx = x * m[0]! + y * m[1]! + z * m[2]! + d * m[3]!;\n const ny = x * m[4]! + y * m[5]! + z * m[6]! + d * m[7]!;\n const nz = x * m[8]! + y * m[9]! + z * m[10]! + d * m[11]!;\n const nd = x * m[12]! + y * m[13]! + z * m[14]! + d * m[15]!;\n return new Plane(nx, ny, nz, nd);\n }\n}\n","/** Babylon.js-compatible `Ray` (pure JS). */\n\nimport { Vector3 } from \"./vector.js\";\nimport type { Plane } from \"./plane.js\";\n\nexport class Ray {\n public origin: Vector3;\n public direction: Vector3;\n public length: number;\n\n public constructor(origin: Vector3, direction: Vector3, length: number = Number.MAX_VALUE) {\n this.origin = origin;\n this.direction = direction;\n this.length = length;\n }\n\n public clone(): Ray {\n return new Ray(this.origin.clone(), this.direction.clone(), this.length);\n }\n\n /** Distance at which this ray crosses `plane`, or `null` if parallel / behind. */\n public intersectsPlane(plane: Plane): number | null {\n const dot = Vector3.Dot(plane.normal, this.direction);\n if (Math.abs(dot) < 1e-9) {\n return null;\n }\n const t = -(Vector3.Dot(plane.normal, this.origin) + plane.d) / dot;\n return t < 0 ? null : t;\n }\n\n /** True if this ray passes within `sphereRadius` of `spherePosition`. */\n public intersectsSphere(spherePosition: Vector3, sphereRadius: number): boolean {\n const x = spherePosition.x - this.origin.x;\n const y = spherePosition.y - this.origin.y;\n const z = spherePosition.z - this.origin.z;\n const pyth = x * x + y * y + z * z;\n const rr = sphereRadius * sphereRadius;\n if (pyth <= rr) {\n return true;\n }\n const dot = x * this.direction.x + y * this.direction.y + z * this.direction.z;\n if (dot < 0) {\n return false;\n }\n const temp = pyth - dot * dot;\n return temp <= rr;\n }\n\n public static Zero(): Ray {\n return new Ray(Vector3.Zero(), Vector3.Zero(), Number.MAX_VALUE);\n }\n\n public static CreateNew(x: number, y: number, z: number, dx: number, dy: number, dz: number, length = Number.MAX_VALUE): Ray {\n return new Ray(new Vector3(x, y, z), new Vector3(dx, dy, dz), length);\n }\n}\n","/** Babylon.js-compatible `Frustum` (pure JS): extract clip planes from a matrix. */\n\nimport { Plane } from \"./plane.js\";\nimport type { Matrix } from \"./matrix.js\";\n\nexport const Frustum = {\n /** Extract the 6 frustum planes from a view-projection `transform`. */\n GetPlanes(transform: Matrix): Plane[] {\n const planes: Plane[] = [];\n for (let i = 0; i < 6; i++) {\n planes.push(new Plane(0, 0, 0, 0));\n }\n Frustum.GetPlanesToRef(transform, planes);\n return planes;\n },\n\n /** Extract the 6 frustum planes from `transform` into the supplied `planes` array. */\n GetPlanesToRef(transform: Matrix, planes: Plane[]): void {\n const m = transform.m;\n // Left\n set(planes[0]!, m[3]! + m[0]!, m[7]! + m[4]!, m[11]! + m[8]!, m[15]! + m[12]!);\n // Right\n set(planes[1]!, m[3]! - m[0]!, m[7]! - m[4]!, m[11]! - m[8]!, m[15]! - m[12]!);\n // Bottom\n set(planes[2]!, m[3]! + m[1]!, m[7]! + m[5]!, m[11]! + m[9]!, m[15]! + m[13]!);\n // Top\n set(planes[3]!, m[3]! - m[1]!, m[7]! - m[5]!, m[11]! - m[9]!, m[15]! - m[13]!);\n // Near\n set(planes[4]!, m[3]! + m[2]!, m[7]! + m[6]!, m[11]! + m[10]!, m[15]! + m[14]!);\n // Far\n set(planes[5]!, m[3]! - m[2]!, m[7]! - m[6]!, m[11]! - m[10]!, m[15]! - m[14]!);\n },\n};\n\nfunction set(plane: Plane, a: number, b: number, c: number, d: number): void {\n plane.normal.set(a, b, c);\n plane.d = d;\n plane.normalize();\n}\n","/** Babylon.js-compatible `Size` and `Viewport` (pure JS). */\n\nexport class Size {\n public constructor(\n public width: number = 0,\n public height: number = 0\n ) {}\n\n public get surface(): number {\n return this.width * this.height;\n }\n\n public clone(): Size {\n return new Size(this.width, this.height);\n }\n\n public equals(other: Size): boolean {\n return this.width === other.width && this.height === other.height;\n }\n\n public add(other: Size): Size {\n return new Size(this.width + other.width, this.height + other.height);\n }\n\n public static Zero(): Size {\n return new Size(0, 0);\n }\n}\n\nexport class Viewport {\n public constructor(\n public x: number,\n public y: number,\n public width: number,\n public height: number\n ) {}\n\n /** Resolve this normalized viewport to pixel coordinates for a render target. */\n public toGlobal(renderWidth: number, renderHeight: number): Viewport {\n return new Viewport(this.x * renderWidth, this.y * renderHeight, this.width * renderWidth, this.height * renderHeight);\n }\n\n public clone(): Viewport {\n return new Viewport(this.x, this.y, this.width, this.height);\n }\n}\n","import { addPolarToRef, dividePolarToRef, multiplyPolarToRef, polarFromVec2ToRef, polarToVec2ToRef, scalePolarToRef, subtractPolarToRef } from \"babylon-lite\";\n\nimport { Vector2 } from \"./vector.js\";\n\n/** Babylon.js-compatible polar-coordinate value object. */\nexport class Polar {\n public constructor(\n public radius: number,\n public theta: number\n ) {}\n\n public getClassName(): string {\n return \"Polar\";\n }\n\n public toString(): string {\n return JSON.stringify(this);\n }\n\n public asArray(): number[] {\n return [this.radius, this.theta];\n }\n\n public addToRef(polar: Polar, ref: Polar): Polar {\n return addPolarToRef(this, polar, ref);\n }\n\n public add(polar: Polar): Polar {\n return this.addToRef(polar, new Polar(0, 0));\n }\n\n public addInPlace(polar: Polar): this {\n this.addToRef(polar, this);\n return this;\n }\n\n public addInPlaceFromFloats(radius: number, theta: number): this {\n return this.addInPlace(new Polar(radius, theta));\n }\n\n public subtractToRef(polar: Polar, ref: Polar): Polar {\n return subtractPolarToRef(this, polar, ref);\n }\n\n public subtract(polar: Polar): Polar {\n return this.subtractToRef(polar, new Polar(0, 0));\n }\n\n public subtractInPlace(polar: Polar): this {\n this.subtractToRef(polar, this);\n return this;\n }\n\n public subtractFromFloatsToRef(radius: number, theta: number, ref: Polar): Polar {\n return this.subtractToRef(new Polar(radius, theta), ref);\n }\n\n public subtractFromFloats(radius: number, theta: number): Polar {\n return this.subtractFromFloatsToRef(radius, theta, new Polar(0, 0));\n }\n\n public multiplyToRef(polar: Polar, ref: Polar): Polar {\n return multiplyPolarToRef(this, polar, ref);\n }\n\n public multiply(polar: Polar): Polar {\n return this.multiplyToRef(polar, new Polar(0, 0));\n }\n\n public multiplyInPlace(polar: Polar): this {\n this.multiplyToRef(polar, this);\n return this;\n }\n\n public divideToRef(polar: Polar, ref: Polar): Polar {\n return dividePolarToRef(this, polar, ref);\n }\n\n public divide(polar: Polar): Polar {\n return this.divideToRef(polar, new Polar(0, 0));\n }\n\n public divideInPlace(polar: Polar): this {\n this.divideToRef(polar, this);\n return this;\n }\n\n public clone(): Polar {\n return new Polar(this.radius, this.theta);\n }\n\n public copyFrom(source: Polar): this {\n return this.copyFromFloats(source.radius, source.theta);\n }\n\n public copyFromFloats(radius: number, theta: number): this {\n this.radius = radius;\n this.theta = theta;\n return this;\n }\n\n public scaleToRef(scale: number, ref: Polar): Polar {\n return scalePolarToRef(this, scale, ref);\n }\n\n public scale(scale: number): Polar {\n return this.scaleToRef(scale, new Polar(0, 0));\n }\n\n public scaleInPlace(scale: number): this {\n this.scaleToRef(scale, this);\n return this;\n }\n\n public set(radius: number, theta: number): this {\n return this.copyFromFloats(radius, theta);\n }\n\n public setAll(value: number): this {\n return this.set(value, value);\n }\n\n public toVector2ToRef(ref: Vector2): Vector2 {\n return polarToVec2ToRef(this, ref);\n }\n\n public toVector2(): Vector2 {\n return this.toVector2ToRef(new Vector2());\n }\n\n public static FromVector2ToRef(vector: Vector2, ref: Polar): Polar {\n return polarFromVec2ToRef(vector, ref);\n }\n\n public static FromVector2(vector: Vector2): Polar {\n return Polar.FromVector2ToRef(vector, new Polar(0, 0));\n }\n\n public static FromArray(array: number[]): Polar {\n return new Polar(array[0]!, array[1]!);\n }\n}\n","import {\n addSphericalToRef,\n divideSphericalToRef,\n multiplySphericalToRef,\n scaleSphericalToRef,\n sphericalFromVec3ToRef,\n sphericalToVec3ToRef,\n subtractSphericalToRef,\n} from \"babylon-lite\";\n\nimport { Vector3 } from \"./vector.js\";\n\n/** Babylon.js-compatible spherical-coordinate value object. */\nexport class Spherical {\n public constructor(\n public radius: number,\n public theta: number,\n public phi: number\n ) {}\n\n public getClassName(): string {\n return \"Spherical\";\n }\n\n public toString(): string {\n return JSON.stringify(this);\n }\n\n public asArray(): number[] {\n return [this.radius, this.theta, this.phi];\n }\n\n public addToRef(spherical: Spherical, ref: Spherical): Spherical {\n return addSphericalToRef(this, spherical, ref);\n }\n\n public add(spherical: Spherical): Spherical {\n return this.addToRef(spherical, new Spherical(0, 0, 0));\n }\n\n public addInPlace(spherical: Spherical): this {\n this.addToRef(spherical, this);\n return this;\n }\n\n public addInPlaceFromFloats(radius: number, theta: number, phi: number): this {\n return this.addInPlace(new Spherical(radius, theta, phi));\n }\n\n public subtractToRef(spherical: Spherical, ref: Spherical): Spherical {\n return subtractSphericalToRef(this, spherical, ref);\n }\n\n public subtract(spherical: Spherical): Spherical {\n return this.subtractToRef(spherical, new Spherical(0, 0, 0));\n }\n\n public subtractInPlace(spherical: Spherical): this {\n this.subtractToRef(spherical, this);\n return this;\n }\n\n public subtractFromFloatsToRef(radius: number, theta: number, phi: number, ref: Spherical): Spherical {\n return this.subtractToRef(new Spherical(radius, theta, phi), ref);\n }\n\n public subtractFromFloats(radius: number, theta: number, phi: number): Spherical {\n return this.subtractFromFloatsToRef(radius, theta, phi, new Spherical(0, 0, 0));\n }\n\n public multiplyToRef(spherical: Spherical, ref: Spherical): Spherical {\n return multiplySphericalToRef(this, spherical, ref);\n }\n\n public multiply(spherical: Spherical): Spherical {\n return this.multiplyToRef(spherical, new Spherical(0, 0, 0));\n }\n\n public multiplyInPlace(spherical: Spherical): this {\n this.multiplyToRef(spherical, this);\n return this;\n }\n\n public divideToRef(spherical: Spherical, ref: Spherical): Spherical {\n return divideSphericalToRef(this, spherical, ref);\n }\n\n public divide(spherical: Spherical): Spherical {\n return this.divideToRef(spherical, new Spherical(0, 0, 0));\n }\n\n public divideInPlace(spherical: Spherical): this {\n this.divideToRef(spherical, this);\n return this;\n }\n\n public clone(): Spherical {\n return new Spherical(this.radius, this.theta, this.phi);\n }\n\n public copyFrom(source: Spherical): this {\n return this.copyFromFloats(source.radius, source.theta, source.phi);\n }\n\n public copyFromFloats(radius: number, theta: number, phi: number): this {\n this.radius = radius;\n this.theta = theta;\n this.phi = phi;\n return this;\n }\n\n public scaleToRef(scale: number, ref: Spherical): Spherical {\n return scaleSphericalToRef(this, scale, ref);\n }\n\n public scale(scale: number): Spherical {\n return this.scaleToRef(scale, new Spherical(0, 0, 0));\n }\n\n public scaleInPlace(scale: number): this {\n this.scaleToRef(scale, this);\n return this;\n }\n\n public set(radius: number, theta: number, phi: number): this {\n return this.copyFromFloats(radius, theta, phi);\n }\n\n public setAll(value: number): this {\n return this.set(value, value, value);\n }\n\n public toVector3ToRef(ref: Vector3): Vector3 {\n return sphericalToVec3ToRef(this, ref);\n }\n\n public toVector3(): Vector3 {\n return this.toVector3ToRef(new Vector3());\n }\n\n public static FromVector3ToRef(vector: Vector3, ref: Spherical): Spherical {\n return sphericalFromVec3ToRef(vector, ref);\n }\n\n public static FromVector3(vector: Vector3): Spherical {\n return Spherical.FromVector3ToRef(vector, new Spherical(0, 0, 0));\n }\n\n public static FromArray(array: number[]): Spherical {\n return new Spherical(array[0]!, array[1]!, array[2]!);\n }\n}\n","/** Babylon.js-compatible curve/path helpers: `Angle`, `Curve3`, `Path3D` (pure JS). */\n\nimport { sampleCatmullRomSpline, sampleHermiteSpline } from \"babylon-lite\";\n\nimport { Vector3 } from \"./vector.js\";\n\nexport class Angle {\n public constructor(private readonly _radians: number) {}\n\n public radians(): number {\n return this._radians;\n }\n\n public degrees(): number {\n return (this._radians * 180) / Math.PI;\n }\n\n public static FromRadians(radians: number): Angle {\n return new Angle(radians);\n }\n\n public static FromDegrees(degrees: number): Angle {\n return new Angle((degrees * Math.PI) / 180);\n }\n}\n\n/** A 3D curve built from an ordered list of points. */\nexport class Curve3 {\n public constructor(private readonly _points: Vector3[]) {}\n\n public getPoints(): Vector3[] {\n return this._points;\n }\n\n /** Total polyline length along the curve points. */\n public length(): number {\n let total = 0;\n for (let i = 1; i < this._points.length; i++) {\n total += Vector3.Distance(this._points[i]!, this._points[i - 1]!);\n }\n return total;\n }\n\n /** Concatenate another curve (dropping the duplicated join point). */\n public continue(curve: Curve3): Curve3 {\n const points = this._points.slice();\n const other = curve.getPoints();\n for (let i = 1; i < other.length; i++) {\n points.push(other[i]!.clone());\n }\n return new Curve3(points);\n }\n\n /** Quadratic Bézier from `v0` → `v2` with control `v1`, sampled `nbPoints` times. */\n public static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3 {\n const count = Math.max(nbPoints, 2);\n const points: Vector3[] = [];\n for (let i = 0; i <= count; i++) {\n const t = i / count;\n const u = 1 - t;\n const x = u * u * v0.x + 2 * u * t * v1.x + t * t * v2.x;\n const y = u * u * v0.y + 2 * u * t * v1.y + t * t * v2.y;\n const z = u * u * v0.z + 2 * u * t * v1.z + t * t * v2.z;\n points.push(new Vector3(x, y, z));\n }\n return new Curve3(points);\n }\n\n /** Cubic Bézier from `v0` → `v3` with controls `v1`, `v2`, sampled `nbPoints` times. */\n public static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3 {\n const count = Math.max(nbPoints, 2);\n const points: Vector3[] = [];\n for (let i = 0; i <= count; i++) {\n const t = i / count;\n const u = 1 - t;\n const w0 = u * u * u;\n const w1 = 3 * u * u * t;\n const w2 = 3 * u * t * t;\n const w3 = t * t * t;\n points.push(new Vector3(w0 * v0.x + w1 * v1.x + w2 * v2.x + w3 * v3.x, w0 * v0.y + w1 * v1.y + w2 * v2.y + w3 * v3.y, w0 * v0.z + w1 * v1.z + w2 * v2.z + w3 * v3.z));\n }\n return new Curve3(points);\n }\n\n public static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nSeg: number): Curve3 {\n return new Curve3(sampleHermiteSpline(p1, t1, p2, t2, nSeg).map(({ x, y, z }) => new Vector3(x, y, z)));\n }\n\n public static CreateCatmullRomSpline(points: readonly Vector3[], nbPoints: number, closed: boolean = false): Curve3 {\n return new Curve3(sampleCatmullRomSpline(points, nbPoints, closed).map(({ x, y, z }) => new Vector3(x, y, z)));\n }\n}\n\n/** A 3D path with cumulative-distance queries over its points. */\nexport class Path3D {\n private readonly _curve: Vector3[];\n private readonly _distances: number[] = [];\n private _length = 0;\n\n public constructor(points: Vector3[]) {\n this._curve = points.map((p) => p.clone());\n this._distances[0] = 0;\n for (let i = 1; i < this._curve.length; i++) {\n this._length += Vector3.Distance(this._curve[i]!, this._curve[i - 1]!);\n this._distances[i] = this._length;\n }\n }\n\n public getCurve(): Vector3[] {\n return this._curve;\n }\n\n public getPoints(): Vector3[] {\n return this._curve;\n }\n\n public length(): number {\n return this._length;\n }\n\n /** Distances of each point from the path start, normalized to [0, 1] when `length > 0`. */\n public getDistances(): number[] {\n return this._distances;\n }\n}\n","import { getWhiteBalanceMatrix, MaxTintMagnitude, MinTemperatureKelvin, temperatureTintToXyz } from \"babylon-lite\";\n\nimport { Vector3 } from \"./vector.js\";\n\nexport { MinTemperatureKelvin, MaxTintMagnitude };\n\nexport function TemperatureTintToXyz(temperatureKelvin: number, tint: number): Vector3 {\n const [x, y, z] = temperatureTintToXyz(temperatureKelvin, tint);\n return new Vector3(x, y, z);\n}\n\nexport function GetWhiteBalanceMatrix(temperatureKelvin: number, tint: number): Float32Array {\n return getWhiteBalanceMatrix(temperatureKelvin, tint);\n}\n","import { getPickedUV, type PickingInfo as LitePickingInfo } from \"babylon-lite\";\n\nimport type { TransformNode } from \"../meshes/meshes.js\";\nimport { Vector2, Vector3 } from \"../math/vector.js\";\nimport type { Ray } from \"../math/ray.js\";\n\n/** Babylon.js-compatible result of a scene pick. */\nexport class PickingInfo {\n public hit = false;\n public distance = 0;\n public pickedPoint: Vector3 | null = null;\n public pickedMesh: TransformNode | null = null;\n public bu = 0;\n public bv = 0;\n public faceId = -1;\n public subMeshFaceId = -1;\n public subMeshId = 0;\n public pickedSprite: null = null;\n public thinInstanceIndex = -1;\n public ray: Ray | null = null;\n public originMesh: TransformNode | null = null;\n public aimTransform: TransformNode | null = null;\n public gripTransform: TransformNode | null = null;\n\n private _normal: Vector3 | null = null;\n private _worldNormal: Vector3 | null = null;\n private _faceNormal: Vector3 | null = null;\n private _faceWorldNormal: Vector3 | null = null;\n private _uv: Vector2 | null = null;\n\n /** @internal Create a compat result from Lite's synchronous CPU-picking result. */\n public static _fromLite(info: LitePickingInfo, pickedMesh: TransformNode | null, ray: Ray): PickingInfo {\n const result = new PickingInfo();\n result.hit = info.hit && pickedMesh !== null;\n result.distance = info.distance;\n result.pickedPoint = result.hit && info.pickedPoint ? Vector3.FromArray(info.pickedPoint) : null;\n result.pickedMesh = result.hit ? pickedMesh : null;\n result.bu = info.bu;\n result.bv = info.bv;\n result.faceId = info.faceId;\n result.subMeshFaceId = info.faceId;\n result.subMeshId = info.subMeshId;\n result.thinInstanceIndex = info.thinInstanceIndex;\n result.ray = ray;\n result._normal = info.pickedNormal ? Vector3.FromArray(info.pickedNormal) : null;\n result._worldNormal = info.pickedNormalWorld ? Vector3.FromArray(info.pickedNormalWorld) : null;\n result._faceNormal = info.pickedFaceNormal ? Vector3.FromArray(info.pickedFaceNormal) : null;\n result._faceWorldNormal = info.pickedFaceNormalWorld ? Vector3.FromArray(info.pickedFaceNormalWorld) : null;\n const uv = getPickedUV(info);\n result._uv = uv ? new Vector2(uv[0], uv[1]) : null;\n return result;\n }\n\n public getNormal(useWorldCoordinates = false, useVerticesNormals = true): Vector3 | null {\n const normal = useVerticesNormals ? (useWorldCoordinates ? this._worldNormal : this._normal) : useWorldCoordinates ? this._faceWorldNormal : this._faceNormal;\n return normal?.clone() ?? null;\n }\n\n public getTextureCoordinates(uvSet = \"uv\"): Vector2 | null {\n return uvSet === \"uv\" ? (this._uv?.clone() ?? null) : null;\n }\n}\n","/**\n * Babylon.js-compatible Misc utilities — the pure-JS subset that has no Babylon\n * Lite or GPU dependency: `SmartArray`, `StringDictionary`, `Tags`,\n * `PerformanceMonitor`, and `ColorGradient`/`FactorGradient`.\n */\n\n/** A pre-sized, reusable array that tracks a logical `length` separately from capacity. */\nexport class SmartArray<T> {\n public data: Array<T | undefined>;\n public length = 0;\n\n public constructor(capacity: number) {\n this.data = new Array<T | undefined>(capacity);\n }\n\n public push(value: T): void {\n this.data[this.length++] = value;\n if (this.length > this.data.length) {\n this.data.length = this.length;\n }\n }\n\n public reset(): void {\n this.length = 0;\n }\n\n public concat(array: { length: number; data: Array<T | undefined> }): void {\n for (let i = 0; i < array.length; i++) {\n this.push(array.data[i] as T);\n }\n }\n\n public dispose(): void {\n this.reset();\n this.data.length = 0;\n }\n}\n\n/** A string-keyed dictionary with the Babylon.js `StringDictionary` surface. */\nexport class StringDictionary<T> {\n private _store: Record<string, T> = {};\n\n public get count(): number {\n return Object.keys(this._store).length;\n }\n\n public add(key: string, value: T): boolean {\n if (key in this._store) {\n return false;\n }\n this._store[key] = value;\n return true;\n }\n\n public set(key: string, value: T): boolean {\n if (!(key in this._store)) {\n return false;\n }\n this._store[key] = value;\n return true;\n }\n\n public get(key: string): T | undefined {\n return this._store[key];\n }\n\n public getOrAddWithFactory(key: string, factory: (key: string) => T): T {\n let value = this._store[key];\n if (value === undefined) {\n value = factory(key);\n this._store[key] = value;\n }\n return value;\n }\n\n public contains(key: string): boolean {\n return key in this._store;\n }\n\n public remove(key: string): boolean {\n if (key in this._store) {\n delete this._store[key];\n return true;\n }\n return false;\n }\n\n public clear(): void {\n this._store = {};\n }\n\n public forEach(callback: (key: string, value: T) => void): void {\n for (const key of Object.keys(this._store)) {\n callback(key, this._store[key]!);\n }\n }\n}\n\ninterface Taggable {\n _tags?: Record<string, true>;\n}\n\n/** Babylon.js `Tags` — space-separated tag strings attached to arbitrary objects. */\nexport const Tags = {\n EnableFor(obj: Taggable): void {\n obj._tags ??= {};\n },\n\n HasTags(obj: Taggable): boolean {\n return !!obj._tags && Object.keys(obj._tags).length > 0;\n },\n\n AddTagsTo(obj: Taggable, tags: string): void {\n obj._tags ??= {};\n for (const tag of tags.split(/\\s+/).filter(Boolean)) {\n obj._tags[tag] = true;\n }\n },\n\n RemoveTagsFrom(obj: Taggable, tags: string): void {\n if (!obj._tags) {\n return;\n }\n for (const tag of tags.split(/\\s+/).filter(Boolean)) {\n delete obj._tags[tag];\n }\n },\n\n MatchesQuery(obj: Taggable, tag: string): boolean {\n return !!obj._tags && obj._tags[tag] === true;\n },\n\n GetTags(obj: Taggable): string[] {\n return obj._tags ? Object.keys(obj._tags) : [];\n },\n};\n\n/** Rolling FPS/frame-time monitor (Babylon.js `PerformanceMonitor`). */\nexport class PerformanceMonitor {\n private _samples: number[] = [];\n private _max: number;\n private _lastTime: number | null = null;\n private _enabled = true;\n\n public constructor(frameSampleSize = 30) {\n this._max = frameSampleSize;\n }\n\n public sampleFrame(timeMs: number = now()): void {\n if (!this._enabled) {\n return;\n }\n if (this._lastTime !== null) {\n const delta = timeMs - this._lastTime;\n this._samples.push(delta);\n if (this._samples.length > this._max) {\n this._samples.shift();\n }\n }\n this._lastTime = timeMs;\n }\n\n public get averageFrameTime(): number {\n if (this._samples.length === 0) {\n return 0;\n }\n return this._samples.reduce((a, b) => a + b, 0) / this._samples.length;\n }\n\n public get averageFPS(): number {\n const avg = this.averageFrameTime;\n return avg > 0 ? 1000 / avg : 0;\n }\n\n public get isSaturated(): boolean {\n return this._samples.length >= this._max;\n }\n\n public enable(): void {\n this._enabled = true;\n }\n\n public disable(): void {\n this._enabled = false;\n }\n\n public reset(): void {\n this._samples = [];\n this._lastTime = null;\n }\n}\n\n/** A gradient value bound to a [0, 1] position (Babylon.js `FactorGradient`). */\nexport class FactorGradient {\n public constructor(\n public gradient: number,\n public factor1: number,\n public factor2: number = factor1\n ) {}\n\n public getFactor(): number {\n return this.factor1;\n }\n}\n\n/** An RGBA color bound to a [0, 1] position (Babylon.js `ColorGradient`). */\nexport class ColorGradient {\n public constructor(\n public gradient: number,\n public color1: [number, number, number, number],\n public color2?: [number, number, number, number]\n ) {}\n}\n\nfunction now(): number {\n return typeof performance !== \"undefined\" ? performance.now() : Date.now();\n}\n\n/** Babylon.js `Logger` — level-gated console logging. */\nexport const Logger = {\n NoneLogLevel: 0,\n MessageLogLevel: 1,\n WarningLogLevel: 2,\n ErrorLogLevel: 4,\n AllLogLevel: 7,\n\n /** Current log-level bitmask. */\n LogLevels: 7,\n\n Log(message: string): void {\n if (this.LogLevels & this.MessageLogLevel) {\n // eslint-disable-next-line no-console\n console.log(\"BJS - \" + message);\n }\n },\n\n Warn(message: string): void {\n if (this.LogLevels & this.WarningLogLevel) {\n console.warn(\"BJS - \" + message);\n }\n },\n\n Error(message: string): void {\n if (this.LogLevels & this.ErrorLogLevel) {\n console.error(\"BJS - \" + message);\n }\n },\n};\n\n/** Babylon.js `PrecisionDate` — high-resolution timestamp source. */\nexport const PrecisionDate = {\n get Now(): number {\n return now();\n },\n};\n","/**\n * Babylon.js-compatible engine wrappers.\n *\n * The class hierarchy mirrors Babylon.js exactly: `AbstractEngine` is the base,\n * `ThinEngine extends AbstractEngine`, `Engine extends ThinEngine`, and\n * `WebGPUEngine extends AbstractEngine` (so `Engine` and `WebGPUEngine` are\n * siblings, as in Babylon.js). All shared behaviour lives on `AbstractEngine`;\n * because Babylon Lite is WebGPU-only, every concrete engine is backed by the\n * same Lite WebGPU context, so `new Engine(...)` and `new WebGPUEngine(...)`\n * behave identically.\n *\n * Babylon.js exposes a synchronous constructor plus an async `initAsync()` for\n * WebGPU. Babylon Lite acquires the GPU device in an async `createEngine()`.\n * The wrapper mirrors the Babylon.js shape: construct, then `await initAsync()`.\n *\n * Because Lite drives its own render loop through `startEngine`, `runRenderLoop`\n * is implemented by registering the callback through each scene's\n * before-render hook and kicking off Lite's loop. The startup is async under the\n * hood (Lite must register scenes before the first frame); `runRenderLoop`\n * returns immediately and rendering begins on a subsequent tick.\n */\n\nimport {\n createEngine,\n startEngine,\n stopEngine,\n resizeEngine,\n setEngineSize,\n disposeEngine,\n registerScene,\n registerSceneWithShadowSupport,\n enableMirroredMeshes,\n onBeforeRender,\n createNullEngine,\n stepScene,\n uploadImageToArrayLayer,\n onEngineDeviceLost,\n VERSION,\n} from \"babylon-lite\";\nimport type { EngineContext, EngineOptions, RenderCanvas, Texture2DArray } from \"babylon-lite\";\n\nimport { LiteCompatError, unsupported } from \"../error.js\";\nimport { Logger } from \"../misc/misc-utils.js\";\nimport { Observable } from \"../misc/observable.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\n/** Babylon.js `WebGPUEngineOptions` subset accepted by the compat engine. */\nexport interface WebGPUEngineOptions extends EngineOptions {\n antialias?: boolean;\n adaptToDeviceRatio?: boolean;\n useLargeWorldRendering?: boolean;\n canvasToneMapping?: GPUCanvasToneMapping;\n canvasColorSpace?: PredefinedColorSpace;\n}\n\n/**\n * Late work (utility-layer registration) is best-effort: it must never fail engine startup, and it\n * runs from two places — folded into `_startCore` when registered before startup completes, and\n * immediately after. Both go through this helper, so neither a rejection nor a synchronous throw\n * can escape unattributed.\n */\nasync function runLateWork(work: () => Promise<void>): Promise<void> {\n // `work()` is invoked inside the try so a synchronous throw is reported the same way as a\n // rejection; a trailing `.catch` on the returned promise would never see it.\n try {\n await work();\n } catch (error) {\n Logger.Error(`Late engine work failed: ${error instanceof Error ? error.message : String(error)}`);\n }\n}\n\nexport abstract class AbstractEngine {\n /**\n * Babylon.js `AbstractEngine.Version` — reports the underlying Babylon Lite\n * runtime version (the build-time-resolved `VERSION` exported by\n * `@babylonjs/lite`), not the upstream `@babylonjs/core` release it targets.\n */\n public static get Version(): string {\n return VERSION;\n }\n\n /** Babylon.js `AbstractEngine.NpmPackage` — the npm package + version string. */\n public static get NpmPackage(): string {\n return `@babylonjs/lite-compat@${this.Version}`;\n }\n\n /** @internal The underlying Lite engine context. Populated by `initAsync()`. */\n public _lite!: EngineContext;\n\n /**\n * @internal Whether this engine has no GPU device (a {@link NullEngine}). Headless\n * engines build their Lite scene context with no frame-graph render task and are\n * advanced by a pure-JS loop that steps Lite's simulation (see {@link NullEngine}).\n */\n public _headless = false;\n\n protected readonly _canvas: RenderCanvas;\n private readonly _options: EngineOptions | undefined;\n protected readonly _scenes: Scene[] = [];\n protected readonly _loopCallbacks: Array<() => void> = [];\n protected _initialized = false;\n private _startupComplete = false;\n private _startPromise: Promise<void> | null = null;\n\n /** @internal Whether scene registration and the first engine start have completed. */\n public get _hasStarted(): boolean {\n return this._startupComplete;\n }\n /** @internal Active `requestAnimationFrame` id for the scene-less loop, if any. */\n protected _rafId: number | null = null;\n\n /**\n * Babylon.js `engine.useReverseDepthBuffer`. Babylon Lite owns its depth\n * configuration internally, so this is a settable no-op kept for API shape.\n */\n public useReverseDepthBuffer = false;\n\n /** Babylon.js `engine.onResizeObservable` — fires after `resize()` / `setSize()`. */\n public readonly onResizeObservable = new Observable<AbstractEngine>();\n /** Babylon.js context-loss signal, forwarded from Lite's device-loss subscription. */\n public readonly onContextLostObservable = new Observable<AbstractEngine>();\n /** Babylon.js context-restored signal. Lite does not expose a completed-recovery event, so this remains shape-only. */\n public readonly onContextRestoredObservable = new Observable<AbstractEngine>();\n /** @internal Device-loss unsubscriber installed by `initAsync`. */\n private _unsubscribeDeviceLost: (() => void) | null = null;\n\n /** @internal Babylon.js hardware-scaling level. Babylon Lite manages device-pixel-ratio itself; stored for parity. */\n private _hardwareScalingLevel = 1;\n\n /** @internal Latest per-frame delta in ms, updated by each scene's before-render hook. */\n public _lastDeltaMs = 16;\n\n /** @internal Last clear colour passed to `engine.clear(...)` (consumed by the scene-less sprite path). */\n public _lastClearColor: { r: number; g: number; b: number; a: number } = { r: 0, g: 0, b: 0, a: 1 };\n\n /** @internal Whether `engine.clear(...)` was ever called (sprite renderers overlay a scene if not). */\n public _clearRequested = false;\n\n /** @internal Deferred startup work (thunks) awaited before the engine starts — e.g. sprite-atlas loads. */\n private readonly _startupWork: Array<() => Promise<void>> = [];\n\n /**\n * @internal Deferred work awaited after the main engine renders its first frame\n * — e.g. utility-layer registration, which must follow the main scene but must\n * not block engine startup.\n */\n private readonly _lateWork: Array<() => Promise<void>> = [];\n\n public constructor(canvas: RenderCanvas, options?: WebGPUEngineOptions | boolean) {\n this._canvas = canvas;\n // Babylon.js's WebGPUEngine takes an options object as the second arg;\n // accept a bare boolean too (some older call sites pass `antialias`).\n const opts: WebGPUEngineOptions | undefined = typeof options === \"object\" ? { ...options } : options === false ? { msaaSamples: 1 } : undefined;\n if (opts) {\n if (opts.canvasToneMapping !== undefined || opts.canvasColorSpace !== undefined) {\n unsupported(\n \"WebGPUEngineOptions.canvasToneMapping/canvasColorSpace\",\n \"Supporting WebGPU canvas presentation options requires changing Lite's existing surface configuration hot path; it cannot be added as an independently tree-shakeable compat capability.\"\n );\n }\n const antialias = opts.antialias;\n delete opts.antialias;\n delete opts.canvasToneMapping;\n delete opts.canvasColorSpace;\n if (antialias === false) {\n opts.msaaSamples = 1;\n }\n }\n // Babylon.js exposes floating-origin / large-world rendering through a\n // single `useLargeWorldRendering` flag. Babylon Lite splits it into\n // `useHighPrecisionMatrix` + `useFloatingOrigin` (the latter requires the\n // former). Translate so compat scenes that pass the BJS flag light up LWR.\n if (opts?.useLargeWorldRendering) {\n delete opts.useLargeWorldRendering;\n opts.useHighPrecisionMatrix = true;\n opts.useFloatingOrigin = true;\n }\n this._options = opts;\n }\n\n /** Acquire the GPU device and build the Lite engine context. */\n public async initAsync(): Promise<void> {\n if (this._initialized) {\n return;\n }\n this._lite = await createEngine(this._canvas, this._options);\n this._unsubscribeDeviceLost = onEngineDeviceLost(this._lite, () => this.onContextLostObservable.notifyObservers(this));\n this._initialized = true;\n }\n\n public getRenderingCanvas(): RenderCanvas {\n return this._canvas;\n }\n\n /**\n * Babylon.js `engine.getDeltaTime()` — milliseconds elapsed since the previous\n * frame. Updated from each scene's Lite before-render hook (which receives the\n * frame delta); defaults to ~16ms before the first frame.\n */\n public getDeltaTime(): number {\n return this._lastDeltaMs;\n }\n\n /**\n * Babylon.js `engine.isNDCHalfZRange`. WebGPU's clip space uses a `[0, 1]`\n * depth range, so this is always `true` under Babylon Lite.\n */\n public get isNDCHalfZRange(): boolean {\n return true;\n }\n\n /** Babylon.js `engine.isWebGPU` — Babylon Lite is WebGPU-only, so always `true`. */\n public get isWebGPU(): boolean {\n return true;\n }\n\n /**\n * Babylon.js `engine.getCaps()` — engine capability flags. Only the\n * compressed-texture-format flags ported scenes branch on are derived (from the\n * Lite WebGPU device's enabled features); the rest report Babylon Lite's fixed\n * WebGPU baseline. A headless `NullEngine` has no device, so all flags are off.\n */\n public getCaps(): Record<string, unknown> {\n const device = (this._lite as { _device?: { features?: { has(name: string): boolean }; limits?: { maxUniformBuffersPerShaderStage?: number } } } | undefined)?._device;\n const has = (name: string): boolean => !!device?.features?.has(name);\n return {\n astc: has(\"texture-compression-astc\"),\n s3tc: has(\"texture-compression-bc\"),\n bc7: has(\"texture-compression-bc\"),\n etc2: has(\"texture-compression-etc2\"),\n // ETC1 is a distinct format family with no WebGPU feature flag — never\n // report it as available (an ETC2 device can decode ETC1 content, but\n // advertising `etc1` can steer upstream selection to a non-existent path).\n etc1: false,\n pvrtc: false,\n // WebGPU baseline capabilities Babylon Lite always provides.\n textureFloat: true,\n textureHalfFloat: true,\n textureFloatLinearFiltering: true,\n maxTextureSize: 8192,\n // Maximum uniform buffers bindable to a single shader stage. BJS reports this\n // only for engines that enforce it as a hard limit (WebGPU); Babylon Lite is\n // WebGPU-only, so it forwards the device's reported limit, and leaves it\n // undefined for a device-less NullEngine — matching BJS's \"left undefined\n // elsewhere\" contract.\n maxUniformBuffersPerShaderStage: device?.limits?.maxUniformBuffersPerShaderStage,\n instancedArrays: true,\n uintIndices: true,\n };\n }\n\n /** Babylon.js `engine.scenes` — every scene created against this engine. */\n public get scenes(): Scene[] {\n return this._scenes;\n }\n\n /** Babylon.js `engine.getRenderWidth()` — backing render-target width in pixels. */\n public getRenderWidth(): number {\n return (this._canvas as { width?: number }).width ?? 0;\n }\n\n /** Babylon.js `engine.getRenderHeight()` — backing render-target height in pixels. */\n public getRenderHeight(): number {\n return (this._canvas as { height?: number }).height ?? 0;\n }\n\n /** Babylon.js `engine.getScreenAspectRatio()` — render-target width / height. */\n public getScreenAspectRatio(): number {\n const h = this.getRenderHeight();\n return h !== 0 ? this.getRenderWidth() / h : 1;\n }\n\n /**\n * Babylon.js `engine.getAspectRatio(camera?, useScreen?)`. Babylon Lite renders\n * each scene through a single full-canvas viewport, so the camera viewport does\n * not subdivide the surface — this is the screen aspect ratio.\n */\n public getAspectRatio(_camera?: unknown, _useScreen?: boolean): number {\n return this.getScreenAspectRatio();\n }\n\n /** Babylon.js `engine.getFps()` — frames-per-second estimate from the last frame delta. */\n public getFps(): number {\n return this._lastDeltaMs > 0 ? 1000 / this._lastDeltaMs : 60;\n }\n\n /**\n * Babylon.js `engine.getHardwareScalingLevel()`. Babylon Lite manages its own\n * device-pixel-ratio scaling, so this returns the stored parity value.\n */\n public getHardwareScalingLevel(): number {\n return this._hardwareScalingLevel;\n }\n\n /** Babylon.js `engine.setHardwareScalingLevel(level)` — stored for parity (Lite self-manages DPR). */\n public setHardwareScalingLevel(level: number): void {\n this._hardwareScalingLevel = level;\n }\n\n /** Babylon.js `engine.getRenderingCanvasClientRect()` — the canvas client rect, or `null` for offscreen canvases. */\n public getRenderingCanvasClientRect(): { x: number; y: number; width: number; height: number } | null {\n const c = this._canvas as { getBoundingClientRect?: () => { x: number; y: number; width: number; height: number } };\n return typeof c.getBoundingClientRect === \"function\" ? c.getBoundingClientRect() : null;\n }\n\n /**\n * Babylon.js `engine.clear(color?, backBuffer?, depth?, stencil?)`. Babylon\n * Lite owns clearing through its render contexts (scenes / sprite renderers),\n * so this records the requested clear colour (used by the scene-less sprite\n * renderer path) and is otherwise a no-op.\n */\n public clear(color?: { r: number; g: number; b: number; a: number }, _backBuffer?: boolean, _depth?: boolean, _stencil?: boolean): void {\n this._clearRequested = true;\n if (color) {\n this._lastClearColor = { r: color.r, g: color.g, b: color.b, a: color.a ?? 1 };\n }\n }\n\n /** @internal Register deferred startup work (a thunk) awaited before the engine starts. */\n public _registerStartupWork(work: () => Promise<void>): void {\n this._startupWork.push(work);\n }\n\n /** @internal Register work that must run after the main scene is rendering. */\n public _registerLateWork(work: () => Promise<void>): void {\n // This gates on startup having completed, not on the render loop currently spinning:\n // `_lateWork` is only ever drained by `_startCore`, so once startup is past that point\n // queueing would strand the work forever — including after a `stopRenderLoop`, where the\n // registering feature (e.g. a utility layer) still needs to be wired up for the next frame.\n if (this._startupComplete) {\n // There is no startup promise left to fold this into. Surface a rejection through the\n // logger rather than letting it escape as an unhandled rejection, which is hard to\n // attribute back to the registering feature.\n void runLateWork(work);\n return;\n }\n this._lateWork.push(work);\n }\n\n /** @internal Scenes register themselves on construction. */\n public _registerScene(scene: Scene): void {\n this._scenes.push(scene);\n // Wire already-registered loop callbacks into the new scene.\n for (const cb of this._loopCallbacks) {\n onBeforeRender(scene._lite, () => cb());\n }\n }\n\n public runRenderLoop(callback: () => void): void {\n this._ensureInitialized(\"runRenderLoop\");\n this._loopCallbacks.push(callback);\n for (const scene of this._scenes) {\n onBeforeRender(scene._lite, () => callback());\n }\n void this._start().then(() => {\n // Scene-less render loops (e.g. the `SpriteRenderer` 2D path) have no\n // scene before-render hook to drive the callback. Run them on a\n // `requestAnimationFrame` loop so per-frame work (e.g. sprite-sheet\n // animation that mutates `cellIndex` each tick) actually advances.\n // Babylon Lite's own render loop draws the registered sprite renderer;\n // we just need to push the updated sprite data before each frame.\n if (this._scenes.length === 0 && this._rafId === null && typeof requestAnimationFrame === \"function\") {\n const tick = (): void => {\n for (const cb of this._loopCallbacks) {\n cb();\n }\n this._rafId = requestAnimationFrame(tick);\n };\n this._rafId = requestAnimationFrame(tick);\n }\n });\n }\n\n public stopRenderLoop(): void {\n if (this._rafId !== null && typeof cancelAnimationFrame === \"function\") {\n cancelAnimationFrame(this._rafId);\n this._rafId = null;\n }\n if (this._initialized) {\n stopEngine(this._lite);\n }\n }\n\n public resize(): void {\n this._ensureInitialized(\"resize\");\n resizeEngine(this._lite);\n this.onResizeObservable.notifyObservers(this);\n }\n\n public setSize(width: number, height: number): void {\n this._ensureInitialized(\"setSize\");\n setEngineSize(this._lite, width, height);\n this.onResizeObservable.notifyObservers(this);\n }\n\n public dispose(): void {\n if (this._rafId !== null && typeof cancelAnimationFrame === \"function\") {\n cancelAnimationFrame(this._rafId);\n this._rafId = null;\n }\n this._unsubscribeDeviceLost?.();\n this._unsubscribeDeviceLost = null;\n if (this._initialized) {\n disposeEngine(this._lite);\n }\n }\n\n /** Babylon.js manual frame-pump entry point — unsupported (Lite's frame graph owns the frame). */\n public beginFrame(): never {\n return unsupported(\"WebGPUEngine.beginFrame\", \"Babylon Lite's frame graph owns the frame loop; drive rendering with `runRenderLoop`.\");\n }\n\n /** Babylon.js manual frame-pump exit point — unsupported (Lite's frame graph owns the frame). */\n public endFrame(): never {\n return unsupported(\"WebGPUEngine.endFrame\", \"Babylon Lite's frame graph owns the frame loop; drive rendering with `runRenderLoop`.\");\n }\n\n /** Babylon.js `engine.currentSampleCount` — the active surface's MSAA sample count. */\n public get currentSampleCount(): number {\n return this._headless ? 1 : this._lite.msaaSamples;\n }\n\n /**\n * Babylon.js `engine.getAlphaToCoverage()` — alpha-to-coverage state. Lite's API is scoped to\n * individual material/sprite/text pipeline owners, not the engine-wide state BJS exposes.\n */\n public getAlphaToCoverage(): never {\n return unsupported(\n \"AbstractEngine.getAlphaToCoverage\",\n \"Lite's alpha-to-coverage API is target-scoped; mapping BJS's engine-wide state requires a pipeline-owner lifecycle policy.\"\n );\n }\n\n /**\n * Babylon.js `engine.setAlphaToCoverage(enable)` — toggle alpha-to-coverage. Lite's target-\n * scoped API cannot reproduce the engine-wide state without a pipeline-owner lifecycle policy.\n */\n public setAlphaToCoverage(_enable: boolean): never {\n return unsupported(\n \"AbstractEngine.setAlphaToCoverage\",\n \"Lite's alpha-to-coverage API is target-scoped; mapping BJS's engine-wide state requires a pipeline-owner lifecycle policy.\"\n );\n }\n\n /**\n * Babylon.js `engine.isOcclusionQueryVisible(query)` — Lite does not expose\n * occlusion-query allocation, render-pass encoding, or asynchronous result state.\n */\n public isOcclusionQueryVisible(_query: unknown): never {\n return unsupported(\n \"AbstractEngine.isOcclusionQueryVisible\",\n \"Lite has no occlusion-query subsystem; supporting this requires query allocation, render-pass encoding, and asynchronous result-lifetime policy.\"\n );\n }\n\n /**\n * Babylon.js `engine.updateTextureArrayLayerFromImageSource(texture, source, layer, invertY, premultiplyAlpha)`\n * — the engine extension that uploads a decoded image source into one layer of a 2D array\n * texture. Forwards to Babylon Lite's `uploadImageToArrayLayer`.\n *\n * Babylon.js passes an `InternalTexture`; the compat layer's equivalent handle is the Lite\n * `Texture2DArray` returned by `RawTexture2DArray.getInternalTexture()`, so ported code that\n * goes through `UploadImageToTexture2DArrayLayer` (which is exactly what Babylon.js's helper\n * does) works unchanged.\n */\n public updateTextureArrayLayerFromImageSource(texture: Texture2DArray, source: GPUCopyExternalImageSource, layer: number, invertY = false, premultiplyAlpha = false): void {\n uploadImageToArrayLayer(this._lite, texture, layer, source, { invertY, premultiplyAlpha });\n }\n\n private _start(): Promise<void> {\n this._startPromise ??= this._startCore();\n return this._startPromise;\n }\n\n private async _startCore(): Promise<void> {\n // Run deferred startup work (e.g. sprite-atlas loads) first, so any\n // resources a render context needs exist before the first frame.\n if (this._startupWork.length > 0) {\n await Promise.all(this._startupWork.map((w) => w()));\n this._startupWork.length = 0;\n }\n for (const scene of this._scenes) {\n // Build shadow generators first so NME materials can sample them at parse\n // time (Babylon Lite wires shadow receivers into the NME graph on parse).\n scene._buildShadowGenerators();\n await scene._parseNodeMaterials();\n await scene._awaitPendingTextures();\n scene._bakeGroundUvs();\n scene._flushPendingAdds();\n scene._buildMorphTargets();\n scene._buildClusteredContainers();\n await scene._enableMaterialPlugins();\n await scene._loadPendingEnvironment();\n // Babylon.js reverses triangle winding for negative-determinant (mirrored) world\n // transforms so a `scaling.x = -1` mesh renders upright rather than inside-out. Enable\n // Lite's equivalent opt-in per scene (after all assets are added, before registerScene)\n // to match that behaviour for Standard/procedural meshes; non-mirrored meshes are\n // unaffected, and the glTF loader's own load-time winding handling is not double-flipped.\n await enableMirroredMeshes(scene._lite);\n if (scene._hasShadows()) {\n await registerSceneWithShadowSupport(scene._lite);\n } else {\n await registerScene(scene._lite);\n }\n }\n // Start the main render loop before utility-layer registration. Utility\n // layers are overlays and can join on a subsequent frame; awaiting them\n // here would deadlock any registration path that depends on the first frame.\n await startEngine(this._lite);\n do {\n await Promise.all(this._scenes.map((scene) => scene._reconcilePendingMaterialPlugins()));\n } while (this._scenes.some((scene) => scene._hasPendingMaterialPluginReconciliations));\n this._startupComplete = true;\n // Late work now runs after the main render loop has started.\n // Late work is explicitly allowed to fail without taking startup with it: a rejection here\n // would otherwise poison `_startPromise` forever and resurface as an unhandled rejection\n // from `runRenderLoop`, which only does `void this._start()`.\n if (this._lateWork.length > 0) {\n await Promise.all(this._lateWork.map(runLateWork));\n this._lateWork.length = 0;\n }\n }\n\n private _ensureInitialized(api: string): void {\n if (!this._initialized) {\n throw new LiteCompatError(`${this.constructor.name}.${api}`, \"Call `await engine.initAsync()` before using the engine.\");\n }\n }\n}\n\n/**\n * Babylon.js's headless/abstract WebGL engine layer. In Babylon.js\n * `ThinEngine extends AbstractEngine` and is the lightweight (no scene-graph)\n * engine; the compat layer carries no extra behaviour over {@link AbstractEngine}\n * (everything is WebGPU-backed), so this exists purely to reproduce the class\n * name and inheritance chain.\n */\nexport class ThinEngine extends AbstractEngine {}\n\n/**\n * Babylon.js's full WebGL engine. In Babylon.js `Engine extends ThinEngine`\n * (sibling to {@link WebGPUEngine}, both rooted at {@link AbstractEngine}).\n * Babylon Lite is WebGPU-only, so a compat `Engine` is still backed by the same\n * Lite WebGPU context; this class exists to mirror Babylon.js's name + hierarchy.\n */\nexport class Engine extends ThinEngine {}\n\n/**\n * Babylon.js's WebGPU engine. In Babylon.js `WebGPUEngine extends AbstractEngine`\n * (sibling to {@link Engine}). This is the natural engine for the compat layer\n * since Babylon Lite is WebGPU-only.\n */\nexport class WebGPUEngine extends AbstractEngine {}\n\n/** A degenerate canvas stand-in for the deviceless {@link NullEngine}. */\nconst NULL_CANVAS = { width: 0, height: 0 } as unknown as RenderCanvas;\n\n/**\n * Babylon.js's `NullEngine` — a headless engine with no GPU device, used to run\n * scene logic (animations, observables, physics stepping, frame timing) without\n * rendering. Backed by Babylon Lite's real device-less headless engine\n * (`createNullEngine`): scenes constructed against it build a Lite scene context\n * with **no** frame-graph render task (`defaultRenderTask: false`), so no swapchain\n * or GPU resource is ever allocated. The compat `NullEngine` drives a pure-JS\n * `requestAnimationFrame` loop that advances each scene by the wall-clock delta\n * between frames via Lite's `stepScene` (which fires the scene's `onBeforeRender`\n * callbacks — CPU animations,\n * physics steps, user logic). Only the device-less simulation surface works; adding\n * meshes with materials (whose deferred GPU builders need a device) is unsupported,\n * matching Babylon.js's `NullEngine` limitations. Extends {@link WebGPUEngine} so it\n * is accepted everywhere a compat engine is (e.g. `new Scene(engine)`).\n */\nexport class NullEngine extends WebGPUEngine {\n public constructor() {\n super(NULL_CANVAS);\n this._headless = true;\n // Back the headless engine with Lite's real device-less engine context. No GPU\n // device to acquire — usable immediately, no `initAsync()` needed.\n this._lite = createNullEngine();\n this._initialized = true;\n }\n\n /** No GPU device to acquire. */\n public override async initAsync(): Promise<void> {\n // Headless: nothing to initialise.\n }\n\n /**\n * Drive a pure-JS frame loop: each tick advances every registered scene by the\n * wall-clock delta between frames through Lite's `stepScene` (which fires the scene's before-render\n * callbacks: CPU animations, physics, render observables), then runs the user\n * callback(s). No GPU work is recorded or submitted.\n */\n public override runRenderLoop(callback: () => void): void {\n this._loopCallbacks.push(callback);\n if (this._rafId !== null || typeof requestAnimationFrame !== \"function\") {\n return;\n }\n const now = (): number => (typeof performance !== \"undefined\" ? performance.now() : Date.now());\n let last = now();\n const tick = (): void => {\n const current = now();\n const deltaMs = current - last;\n last = current;\n for (const scene of this._scenes) {\n stepScene(this._lite, scene._lite, deltaMs);\n }\n for (const cb of this._loopCallbacks) {\n cb();\n }\n this._rafId = requestAnimationFrame(tick);\n };\n this._rafId = requestAnimationFrame(tick);\n }\n\n /** @internal Track the scene for the headless tick loop (no Lite before-render wiring). */\n public override _registerScene(scene: Scene): void {\n if (!this._scenes.includes(scene)) {\n this._scenes.push(scene);\n }\n }\n}\n","import {\n addComputeDispatch,\n computeStorageBufferBinding,\n computeUniformBufferBinding,\n createComputeBindingSet,\n createComputeDispatch,\n createComputeIndirectDispatch,\n createComputeShader,\n createComputeTask,\n disposeComputeBindingSet,\n disposeComputeShader,\n submitComputeTasks,\n} from \"babylon-lite\";\nimport type {\n ComputeBindingDecl,\n ComputeBindingResources,\n ComputeBindingSet as LiteComputeBindingSet,\n ComputeShader as LiteComputeShader,\n StorageBuffer as LiteStorageBuffer,\n UniformBuffer as LiteUniformBuffer,\n} from \"babylon-lite\";\n\nimport type { StorageBuffer } from \"../buffers/storage-buffer.js\";\nimport type { AbstractEngine } from \"../engine/engine.js\";\nimport { unsupported } from \"../error.js\";\nimport type { UniformBuffer } from \"../materials/uniform-buffer.js\";\nimport type { BaseTexture } from \"../textures/textures.js\";\n\nexport interface ComputeBindingLocation {\n group: number;\n binding: number;\n}\n\nexport type ComputeBindingMapping = Record<string, ComputeBindingLocation>;\n\nexport interface IComputeShaderPath {\n computeSource?: string;\n compute?: string;\n computeElement?: string;\n}\n\nexport interface IComputeShaderOptions {\n bindingsMapping: ComputeBindingMapping;\n defines?: string[];\n entryPoint?: string;\n processFinalCode?: ((code: string) => string) | null;\n useExplicitComputePipelineLayout?: boolean;\n}\n\ntype ComputeEffect = LiteComputeShader;\ntype BufferBinding = { readonly kind: \"uniform\"; readonly resource: LiteUniformBuffer } | { readonly kind: \"storage\"; readonly resource: LiteStorageBuffer };\nlet nextComputeShaderId = 1;\n\nfunction sourceFrom(shaderPath: IComputeShaderPath | string): string {\n if (typeof shaderPath === \"object\" && shaderPath.computeSource !== undefined) {\n return shaderPath.computeSource;\n }\n return unsupported(\n \"ComputeShader.constructor\",\n \"Lite's public compute factory accepts complete WGSL source. Babylon.js ShaderStore names, external .compute.fx paths, and DOM script-element lookup have no public Lite resolver.\"\n );\n}\n\n/** Babylon.js ComputeShader adapted to Lite's public buffer-backed compute graph. */\nexport class ComputeShader {\n public static readonly Parse = ComputeShaderParse;\n\n public readonly uniqueId = nextComputeShaderId++;\n public name: string;\n public fastMode = false;\n public onCompiled: ((effect: ComputeEffect) => void) | null = null;\n public onError: ((effect: ComputeEffect, errors: string) => void) | null = null;\n public readonly gpuTimeInFrame = undefined;\n public triggerContextRebuild = false;\n\n private readonly _source: string;\n private readonly _bindings = new Map<string, BufferBinding>();\n private _shader: LiteComputeShader | null = null;\n private _bindingSet: LiteComputeBindingSet | null = null;\n private _bindingsDirty = false;\n private _shaderDirty = false;\n private _compiled = false;\n\n public constructor(\n name: string,\n private readonly _engine: AbstractEngine,\n private readonly _shaderPath: IComputeShaderPath | string,\n options: Partial<IComputeShaderOptions> = {}\n ) {\n this.name = name;\n this._options = {\n bindingsMapping: {},\n defines: [],\n entryPoint: \"main\",\n ...options,\n };\n if (this._options.defines?.length) {\n unsupported(\n \"ComputeShader.constructor(options.defines)\",\n \"Lite's public compute factory accepts final WGSL and intentionally exposes no Babylon.js shader preprocessor for #define expansion.\"\n );\n }\n const source = sourceFrom(this._shaderPath);\n this._source = this._options.processFinalCode?.(source) ?? source;\n }\n\n private readonly _options: IComputeShaderOptions;\n\n public get options(): IComputeShaderOptions {\n return this._options;\n }\n\n public get shaderPath(): string | IComputeShaderPath {\n return this._shaderPath;\n }\n\n public getClassName(): string {\n return \"ComputeShader\";\n }\n\n public setTexture(_name: string, _texture: BaseTexture, _bindSampler = true): never {\n return unsupported(\n \"ComputeShader.setTexture\",\n \"Lite validates an existing Texture2D for compute through the asynchronous createComputeTextureResource API, which cannot preserve Babylon.js's synchronous setter and dispatch contract.\"\n );\n }\n\n public setInternalTexture(_name: string, _texture: unknown): never {\n return unsupported(\n \"ComputeShader.setInternalTexture\",\n \"Lite intentionally does not expose raw GPU texture handles, and its public compute texture adapter is asynchronous.\"\n );\n }\n\n public setStorageTexture(_name: string, _texture: BaseTexture): never {\n return unsupported(\n \"ComputeShader.setStorageTexture\",\n \"A Babylon.js BaseTexture does not carry the storage usage, format, and access metadata required by Lite's distinct ComputeStorageTexture public resource.\"\n );\n }\n\n public setExternalTexture(_name: string, _texture: unknown): never {\n return unsupported(\"ComputeShader.setExternalTexture\", \"Lite's public compute binding API has no external-texture binding declaration or resource.\");\n }\n\n public setVideoTexture(_name: string, _texture: unknown): false {\n return false;\n }\n\n public setUniformBuffer(name: string, buffer: UniformBuffer | LiteUniformBuffer): void {\n const resource = \"_getLiteBuffer\" in buffer ? buffer._getLiteBuffer() : buffer;\n const current = this._bindings.get(name);\n if (current?.kind === \"uniform\" && current.resource === resource) {\n return;\n }\n this._bindingsDirty = true;\n this._shaderDirty ||= this._shader !== null && (current === undefined || current.kind !== \"uniform\");\n this._bindings.set(name, { kind: \"uniform\", resource });\n }\n\n public setStorageBuffer(name: string, buffer: StorageBuffer | LiteStorageBuffer): void {\n const resource = \"_getLiteBuffer\" in buffer ? buffer._getLiteBuffer() : buffer;\n const current = this._bindings.get(name);\n if (current?.kind === \"storage\" && current.resource === resource) {\n return;\n }\n this._bindingsDirty = true;\n this._shaderDirty ||= this._shader !== null && (current === undefined || current.kind !== \"storage\");\n this._bindings.set(name, { kind: \"storage\", resource });\n }\n\n public setTextureSampler(_name: string, _sampler: unknown): never {\n return unsupported(\n \"ComputeShader.setTextureSampler\",\n \"Babylon.js TextureSampler does not expose a Lite ComputeSampler, and Lite intentionally does not accept raw GPUSampler handles.\"\n );\n }\n\n public isReady(): boolean {\n if (!this._engine._lite) {\n return false;\n }\n for (const name of this._bindings.keys()) {\n if (!this._options.bindingsMapping[name]) {\n throw new Error(`ComputeShader ('${this.name}'): No binding mapping has been provided for the property '${name}'`);\n }\n }\n if (this._bindingsDirty) {\n this._invalidateBindings(this._shaderDirty);\n this._bindingsDirty = false;\n this._shaderDirty = false;\n }\n this._createGraph();\n return true;\n }\n\n public dispatch(x: number, y = 1, z = 1): boolean {\n const checkContext = !this.fastMode || this.triggerContextRebuild || !this._shader || !this._bindingSet;\n if (this.triggerContextRebuild) {\n this._bindingsDirty = true;\n }\n if (checkContext && !this.isReady()) {\n return false;\n }\n const graph = this._createGraph();\n const dispatch = createComputeDispatch(graph.shader, graph.bindings, { size: { x, y, z } });\n this._submit(graph, dispatch);\n return true;\n }\n\n public dispatchIndirect(buffer: StorageBuffer | LiteStorageBuffer, offset = 0): boolean {\n const checkContext = !this.fastMode || this.triggerContextRebuild || !this._shader || !this._bindingSet;\n if (this.triggerContextRebuild) {\n this._bindingsDirty = true;\n }\n if (checkContext && !this.isReady()) {\n return false;\n }\n const resource = \"_getLiteBuffer\" in buffer ? buffer._getLiteBuffer() : buffer;\n const graph = this._createGraph();\n const dispatch = createComputeIndirectDispatch(graph.shader, graph.bindings, { buffer: resource, byteOffset: offset });\n this._submit(graph, dispatch);\n return true;\n }\n\n public async dispatchWhenReady(x: number, y = 1, z = 1, delay = 10): Promise<void> {\n while (!this.dispatch(x, y, z)) {\n await new Promise<void>((resolve) => setTimeout(resolve, delay));\n }\n }\n\n public serialize(): Record<string, unknown> {\n return {\n name: this.name,\n fastMode: this.fastMode,\n options: this._options,\n shaderPath: this._shaderPath,\n bindings: {},\n textures: {},\n };\n }\n\n private _createGraph(): { shader: LiteComputeShader; bindings: LiteComputeBindingSet } {\n const shader = this._createShader();\n let compiledNow = false;\n if (!this._compiled) {\n this._compiled = true;\n compiledNow = true;\n this.onCompiled?.(shader);\n }\n if (compiledNow && this._bindingsDirty) {\n const recreateShader = this._shaderDirty;\n this._invalidateBindings(recreateShader);\n this._bindingsDirty = false;\n this._shaderDirty = false;\n const finalShader = recreateShader ? this._createShader() : shader;\n this._compiled = true;\n return { shader: finalShader, bindings: this._createBindingSet(finalShader) };\n }\n return { shader, bindings: this._createBindingSet(shader) };\n }\n\n private _createShader(): LiteComputeShader {\n const declarations: ComputeBindingDecl[] = [];\n for (const [name, binding] of this._bindings) {\n const location = this._options.bindingsMapping[name];\n if (!location) {\n throw new Error(`ComputeShader ('${this.name}'): No binding mapping has been provided for the property '${name}'`);\n }\n declarations.push(\n binding.kind === \"uniform\"\n ? computeUniformBufferBinding(name, location)\n : computeStorageBufferBinding(name, {\n ...location,\n access: this._options.useExplicitComputePipelineLayout === true ? \"read-write\" : \"read\",\n })\n );\n }\n return (this._shader ??= createComputeShader(this._engine._lite, {\n name: this.name,\n computeSource: this._source,\n entryPoint: this._options.entryPoint,\n bindings: declarations,\n automaticLayout: this._options.useExplicitComputePipelineLayout !== true,\n }));\n }\n\n private _createBindingSet(shader: LiteComputeShader): LiteComputeBindingSet {\n if (!this._bindingSet) {\n const resources: Record<string, unknown> = {};\n for (const [name, binding] of this._bindings) {\n resources[name] = binding.resource;\n }\n this._bindingSet = createComputeBindingSet(shader, resources as ComputeBindingResources);\n }\n return this._bindingSet;\n }\n\n private _submit(graph: { shader: LiteComputeShader; bindings: LiteComputeBindingSet }, dispatch: ReturnType<typeof createComputeDispatch>): void {\n const task = createComputeTask(this._engine._lite, this.name);\n addComputeDispatch(task, dispatch);\n task.record();\n try {\n submitComputeTasks([task]);\n } catch (error) {\n if (error instanceof Error && error.message === \"submitComputeTasks cannot run while a frame is being recorded.\") {\n return unsupported(\n \"ComputeShader.dispatch\",\n \"Lite's public immediate compute submission cannot run while its frame encoder is active, and it exposes no engine-level hook equivalent to Babylon.js's in-frame compute dispatch.\"\n );\n }\n this.onError?.(graph.shader, error instanceof Error ? error.message : String(error));\n throw error;\n } finally {\n task.dispose();\n this.triggerContextRebuild = false;\n }\n }\n\n private _invalidateBindings(recreateShader = false): void {\n if (this._bindingSet) {\n disposeComputeBindingSet(this._bindingSet);\n this._bindingSet = null;\n }\n if (recreateShader && this._shader) {\n disposeComputeShader(this._shader);\n this._shader = null;\n this._compiled = false;\n }\n }\n}\n\nexport function ComputeShaderParse(source: Record<string, unknown>, scene: { getEngine(): AbstractEngine }, _rootUrl: string): ComputeShader {\n if (source.textures && Object.keys(source.textures as object).length > 0) {\n return unsupported(\n \"ComputeShader.Parse\",\n \"Serialized Babylon.js textures require its texture parser, while Lite's public compute texture adapter is asynchronous and has no serialization registry.\"\n );\n }\n const computeShader = new ComputeShader(\n String(source.name ?? \"\"),\n scene.getEngine(),\n source.shaderPath as IComputeShaderPath | string,\n (source.options ?? {}) as Partial<IComputeShaderOptions>\n );\n computeShader.fastMode = source.fastMode === true;\n return computeShader;\n}\n\nexport function RegisterComputeShader(): void {}\n","import { clearStorageBuffer, createStorageBuffer, disposeStorageBuffer, readStorageBufferAfterFrame, updateStorageBufferRange } from \"babylon-lite\";\nimport type { StorageBuffer as LiteStorageBuffer } from \"babylon-lite\";\n\nimport type { WebGPUEngine } from \"../engine/engine.js\";\nimport { unsupported } from \"../error.js\";\n\nexport type DataArray = number[] | ArrayBufferLike | ArrayBufferView;\n\nfunction asBytes(data: DataArray, byteLength?: number): Uint8Array {\n let bytes: Uint8Array;\n if (Array.isArray(data)) {\n bytes = new Uint8Array(new Float32Array(data).buffer);\n } else if (ArrayBuffer.isView(data)) {\n bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n } else {\n bytes = new Uint8Array(data);\n }\n if (byteLength === undefined) {\n return bytes;\n }\n if (!Number.isSafeInteger(byteLength) || byteLength < 0 || byteLength > bytes.byteLength) {\n throw new RangeError(`StorageBuffer byteLength must be between 0 and ${bytes.byteLength}; received ${byteLength}.`);\n }\n return bytes.subarray(0, byteLength);\n}\n\n/** Babylon.js-shaped wrapper over Lite's public opaque storage allocation. */\nexport class StorageBuffer {\n /** @internal */\n public _lite: LiteStorageBuffer | null;\n private readonly _copyReadable: boolean;\n private readonly _copyWritable: boolean;\n\n public constructor(\n private readonly _engine: WebGPUEngine,\n size: number,\n creationFlags = 3,\n label?: string\n ) {\n if ((creationFlags & 4) !== 0) {\n unsupported(\n \"StorageBuffer.constructor\",\n \"Babylon.js can combine storage and uniform usage on one DataBuffer, while Babylon Lite intentionally exposes distinct opaque StorageBuffer and UniformBuffer allocations.\"\n );\n }\n this._copyReadable = (creationFlags & 1) !== 0;\n this._copyWritable = (creationFlags & 2) !== 0;\n this._lite = createStorageBuffer(_engine._lite, size, {\n label,\n // Every BJS StorageBuffer can be declared read-only or read-write by WGSL.\n // Lite's `writable` flag enables that shader role and also supplies COPY_SRC;\n // the BJS READ flag is enforced independently by read().\n writable: true,\n vertex: (creationFlags & 8) !== 0,\n index: (creationFlags & 16) !== 0,\n indirect: (creationFlags & 64) !== 0,\n });\n }\n\n /** @internal Lite owns device-loss resource rebuilding. */\n public _rebuild(): void {}\n\n public getBuffer(): LiteStorageBuffer | null {\n return this._lite;\n }\n\n public clear(byteOffset = 0, byteLength = this._requireBuffer().byteLength - byteOffset): void {\n this._assertCopyWritable(\"clear\");\n const buffer = this._requireBuffer();\n if (!Number.isSafeInteger(byteOffset) || byteOffset < 0 || !Number.isSafeInteger(byteLength) || byteLength < 0 || byteOffset + byteLength > buffer.byteLength) {\n throw new RangeError(`StorageBuffer.clear range [${byteOffset}, ${byteOffset + byteLength}) exceeds the ${buffer.byteLength}-byte buffer.`);\n }\n clearStorageBuffer(this._engine._lite, buffer, byteOffset, byteLength);\n }\n\n public update(data: DataArray, byteOffset = 0, byteLength?: number): void {\n if (!this._lite) {\n return;\n }\n this._assertCopyWritable(\"update\");\n updateStorageBufferRange(this._engine._lite, this._lite, asBytes(data, byteLength), byteOffset);\n }\n\n public async read(offset = 0, size = this._requireBuffer().byteLength - offset, buffer?: ArrayBufferView, noDelay = false): Promise<ArrayBufferView> {\n if (!this._copyReadable) {\n throw new Error(\"StorageBuffer.read requires Constants.BUFFER_CREATIONFLAG_READ.\");\n }\n const result = await readStorageBufferAfterFrame(this._requireBuffer(), offset, size, noDelay);\n const bytes = new Uint8Array(result);\n if (!buffer) {\n return bytes;\n }\n if (buffer.byteLength < bytes.byteLength) {\n throw new RangeError(`StorageBuffer.read target has ${buffer.byteLength} bytes but ${bytes.byteLength} bytes were requested.`);\n }\n new Uint8Array(buffer.buffer, buffer.byteOffset, bytes.byteLength).set(bytes);\n return buffer;\n }\n\n public dispose(): void {\n if (this._lite) {\n disposeStorageBuffer(this._lite);\n this._lite = null;\n }\n }\n\n /** @internal */\n public _getLiteBuffer(): LiteStorageBuffer {\n return this._requireBuffer();\n }\n\n private _requireBuffer(): LiteStorageBuffer {\n if (!this._lite) {\n throw new Error(\"StorageBuffer has been disposed.\");\n }\n return this._lite;\n }\n\n private _assertCopyWritable(operation: string): void {\n if (!this._copyWritable) {\n throw new Error(`StorageBuffer.${operation} requires Constants.BUFFER_CREATIONFLAG_WRITE.`);\n }\n }\n}\n","import { createUniformBuffer, disposeUniformBuffer, updateUniformBuffer } from \"babylon-lite\";\nimport type { UniformBuffer as LiteUniformBuffer } from \"babylon-lite\";\n\nimport type { AbstractEngine } from \"../engine/engine.js\";\nimport { unsupported } from \"../error.js\";\nimport type { BaseTexture } from \"../textures/textures.js\";\n\nexport interface MatrixLike {\n asArray(): ArrayLike<number>;\n readonly updateFlag?: number;\n}\n\nexport interface Vector3Like {\n readonly x: number;\n readonly y: number;\n readonly z: number;\n}\n\nexport interface Vector4Like extends Vector3Like {\n readonly w: number;\n}\n\nexport interface Color3Like {\n readonly r: number;\n readonly g: number;\n readonly b: number;\n}\n\nexport interface Color4Like extends Color3Like {\n readonly a: number;\n}\n\ntype FloatArray = number[] | Float32Array;\n\ninterface UniformArrayLayout {\n readonly strideSize: number;\n readonly arraySize: number;\n}\n\n/** Minimum Babylon.js UniformBuffer surface needed to author compute bindings. */\nexport class UniformBuffer {\n private readonly _data: number[];\n private readonly _dynamic: boolean;\n private readonly _uniformLocations = new Map<string, number>();\n private readonly _uniformSizes = new Map<string, number>();\n private readonly _uniformArraySizes = new Map<string, UniformArrayLayout>();\n private readonly _uniformNames: string[] = [];\n private _uniformLocationPointer = 0;\n private _bufferData: Float32Array | null = null;\n private _buffer: LiteUniformBuffer | null = null;\n private _needSync = false;\n private _name: string;\n\n public constructor(\n private readonly _engine: AbstractEngine,\n data: number[] = [],\n dynamic = false,\n name = \"no-name\",\n forceNoUniformBuffer = false,\n _trackUBOsInFrame?: boolean\n ) {\n if (forceNoUniformBuffer) {\n unsupported(\n \"UniformBuffer.constructor\",\n \"A forceNoUniformBuffer instance falls back to Effect setters in Babylon.js and therefore has no GPU uniform allocation that Lite compute bindings can consume.\"\n );\n }\n this._data = data;\n this._dynamic = dynamic;\n this._name = name;\n }\n\n public readonly updateMatrix3x3 = (name: string, matrix: Float32Array): void => {\n const aligned = new Float32Array(12);\n for (let column = 0; column < 3; column++) {\n aligned.set(matrix.subarray(column * 3, column * 3 + 3), column * 4);\n }\n this.updateUniform(name, aligned, 12);\n };\n\n public readonly updateMatrix2x2 = (name: string, matrix: Float32Array): void => {\n const aligned = new Float32Array(8);\n for (let column = 0; column < 2; column++) {\n aligned.set(matrix.subarray(column * 2, column * 2 + 2), column * 4);\n }\n this.updateUniform(name, aligned, 8);\n };\n\n public readonly updateFloat = (name: string, x: number, _suffix?: string): void => this.updateUniform(name, [x], 1);\n public readonly updateFloat2 = (name: string, x: number, y: number, _suffix?: string): void => this.updateUniform(name, [x, y], 2);\n public readonly updateFloat3 = (name: string, x: number, y: number, z: number, _suffix?: string): void => this.updateUniform(name, [x, y, z], 3);\n public readonly updateFloat4 = (name: string, x: number, y: number, z: number, w: number, _suffix?: string): void => this.updateUniform(name, [x, y, z, w], 4);\n public readonly updateFloatArray = (name: string, array: Float32Array, _suffix?: string): void => this.updateUniformArray(name, array, array.length);\n public readonly updateArray = (name: string, array: number[]): void => this.updateUniformArray(name, array, array.length);\n public readonly updateIntArray = (name: string, array: Int32Array): void => this._updateIntegerUniformArray(name, array, false);\n public readonly updateUIntArray = (name: string, array: Uint32Array): void => this._updateIntegerUniformArray(name, array, true);\n public readonly updateMatrix = (name: string, matrix: MatrixLike): void => this.updateUniform(name, Array.from(matrix.asArray()), 16);\n public readonly updateMatrices = (name: string, matrices: Float32Array): void => this.updateUniform(name, matrices, matrices.length);\n public readonly updateVector3 = (name: string, vector: Vector3Like): void => this.updateFloat3(name, vector.x, vector.y, vector.z);\n public readonly updateVector4 = (name: string, vector: Vector4Like): void => this.updateFloat4(name, vector.x, vector.y, vector.z, vector.w);\n public readonly updateColor3 = (name: string, color: Color3Like, suffix?: string): void => this.updateFloat3(name, color.r, color.g, color.b, suffix);\n public readonly updateColor4 = (name: string, color: Color3Like, alpha: number, suffix?: string): void => this.updateFloat4(name, color.r, color.g, color.b, alpha, suffix);\n public readonly updateDirectColor4 = (name: string, color: Color4Like, suffix?: string): void => this.updateFloat4(name, color.r, color.g, color.b, color.a, suffix);\n public readonly updateInt = (name: string, x: number, _suffix?: string): void => this._updateIntegerUniform(name, [x], false);\n public readonly updateInt2 = (name: string, x: number, y: number, _suffix?: string): void => this._updateIntegerUniform(name, [x, y], false);\n public readonly updateInt3 = (name: string, x: number, y: number, z: number, _suffix?: string): void => this._updateIntegerUniform(name, [x, y, z], false);\n public readonly updateInt4 = (name: string, x: number, y: number, z: number, w: number, _suffix?: string): void => this._updateIntegerUniform(name, [x, y, z, w], false);\n public readonly updateUInt = (name: string, x: number, _suffix?: string): void => this._updateIntegerUniform(name, [x], true);\n public readonly updateUInt2 = (name: string, x: number, y: number, _suffix?: string): void => this._updateIntegerUniform(name, [x, y], true);\n public readonly updateUInt3 = (name: string, x: number, y: number, z: number, _suffix?: string): void => this._updateIntegerUniform(name, [x, y, z], true);\n public readonly updateUInt4 = (name: string, x: number, y: number, z: number, w: number, _suffix?: string): void => this._updateIntegerUniform(name, [x, y, z, w], true);\n\n public get useUbo(): boolean {\n return true;\n }\n\n public get isSync(): boolean {\n return !this._needSync;\n }\n\n public isDynamic(): boolean {\n return this._dynamic;\n }\n\n public getData(): Float32Array {\n return this._bufferData ?? new Float32Array(this._data);\n }\n\n public getBuffer(): LiteUniformBuffer | null {\n return this._buffer;\n }\n\n public getUniformNames(): string[] {\n return this._uniformNames.slice();\n }\n\n public addUniform(name: string, sizeOrData: number | number[], arraySize = 0): void {\n if (this._uniformLocations.has(name)) {\n return;\n }\n if (this._buffer) {\n throw new Error(`Cannot add uniform \"${name}\" after the UniformBuffer has been created.`);\n }\n this._uniformNames.push(name);\n let size: number;\n let data: number[];\n if (arraySize > 0) {\n if (typeof sizeOrData !== \"number\") {\n throw new TypeError(`addUniform cannot use inline array data for UBO array \"${name}\".`);\n }\n this._align(4);\n this._uniformArraySizes.set(name, { strideSize: sizeOrData, arraySize });\n size = sizeOrData === 16 ? sizeOrData * arraySize : 4 * arraySize;\n data = new Array<number>(size).fill(0);\n } else {\n data = typeof sizeOrData === \"number\" ? new Array<number>(sizeOrData).fill(0) : sizeOrData.slice();\n size = data.length;\n this._align(size);\n }\n this._uniformLocations.set(name, this._uniformLocationPointer);\n this._uniformSizes.set(name, size);\n this._uniformLocationPointer += size;\n this._data.push(...data);\n this._needSync = true;\n }\n\n public addMatrix(name: string, matrix: MatrixLike): void {\n this.addUniform(name, Array.from(matrix.asArray()));\n }\n\n public addFloat2(name: string, x: number, y: number): void {\n this.addUniform(name, [x, y]);\n }\n\n public addFloat3(name: string, x: number, y: number, z: number): void {\n this.addUniform(name, [x, y, z]);\n }\n\n public addColor3(name: string, color: Color3Like): void {\n this.addUniform(name, [color.r, color.g, color.b]);\n }\n\n public addColor4(name: string, color: Color3Like, alpha: number): void {\n this.addUniform(name, [color.r, color.g, color.b, alpha]);\n }\n\n public addVector3(name: string, vector: Vector3Like): void {\n this.addUniform(name, [vector.x, vector.y, vector.z]);\n }\n\n public addMatrix3x3(name: string): void {\n this.addUniform(name, 12);\n }\n\n public addMatrix2x2(name: string): void {\n this.addUniform(name, 8);\n }\n\n public create(): void {\n if (this._buffer) {\n return;\n }\n this._align(4);\n this._bufferData = new Float32Array(this._data);\n this._buffer = createUniformBuffer(this._engine._lite, this._bufferData, { label: `${this._name}_UniformList:${this._uniformNames.slice(0, 10).join(\",\")}` });\n this._needSync = true;\n }\n\n /** @internal */\n public _getLiteBuffer(): LiteUniformBuffer {\n this.create();\n return this._buffer!;\n }\n\n public get name(): string {\n return this._name;\n }\n\n public set name(value: string) {\n this._name = value;\n }\n\n public get currentEffect(): unknown | null {\n return null;\n }\n\n public update(): void {\n this.create();\n if (this._dynamic || this._needSync) {\n updateUniformBuffer(this._engine._lite, this._buffer!, this._bufferData!);\n this._needSync = false;\n }\n }\n\n public updateUniform(uniformName: string, data: FloatArray, size: number): void {\n let location = this._uniformLocations.get(uniformName);\n if (location === undefined) {\n this.addUniform(uniformName, size);\n location = this._uniformLocations.get(uniformName)!;\n }\n this.create();\n if (size > (this._uniformSizes.get(uniformName) ?? 0)) {\n throw new RangeError(`Uniform \"${uniformName}\" has room for ${this._uniformSizes.get(uniformName)} floats, not ${size}.`);\n }\n for (let i = 0; i < size; i++) {\n const value = Math.fround(data[i]!);\n if (this._bufferData![location + i] !== value) {\n this._bufferData![location + i] = value;\n this._needSync = true;\n }\n }\n }\n\n public updateUniformArray(uniformName: string, data: FloatArray, size: number): void {\n const location = this._uniformLocations.get(uniformName);\n const layout = this._uniformArraySizes.get(uniformName);\n if (location === undefined || !layout) {\n throw new Error(`Uniform array \"${uniformName}\" must be declared with addUniform before it can be updated.`);\n }\n this.create();\n if (size > layout.strideSize * layout.arraySize) {\n throw new RangeError(`Uniform array \"${uniformName}\" accepts at most ${layout.strideSize * layout.arraySize} values, not ${size}.`);\n }\n for (let i = 0; i < size; i++) {\n const destination = location + Math.floor(i / layout.strideSize) * 4 + (i % layout.strideSize);\n const value = Math.fround(data[i]!);\n if (this._bufferData![destination] !== value) {\n this._bufferData![destination] = value;\n this._needSync = true;\n }\n }\n }\n\n public setTexture(_name: string, _texture: BaseTexture | null): never {\n return unsupported(\"UniformBuffer.setTexture\", \"Lite compute uniform allocations contain bytes only and do not own Effect sampler bindings.\");\n }\n\n public setTextureArray(_name: string, _textures: BaseTexture[]): never {\n return unsupported(\"UniformBuffer.setTextureArray\", \"Lite compute uniform allocations contain bytes only and do not own Effect sampler bindings.\");\n }\n\n public bindTexture(_name: string, _texture: unknown | null): never {\n return unsupported(\"UniformBuffer.bindTexture\", \"Lite compute uniform allocations contain bytes only and do not own Effect sampler bindings.\");\n }\n\n public updateUniformDirectly(uniformName: string, data: FloatArray): void {\n const size = this._uniformSizes.get(uniformName);\n if (size === undefined) {\n throw new Error(`Uniform \"${uniformName}\" has not been declared.`);\n }\n this.updateUniform(uniformName, data, Math.min(size, data.length));\n this.update();\n }\n\n public bindToEffect(_effect: unknown, _name: string): never {\n return unsupported(\n \"UniformBuffer.bindToEffect\",\n \"The compute-only compat UniformBuffer forwards to Lite's opaque compute allocation; Lite has no Babylon.js Effect binding surface.\"\n );\n }\n\n public bindUniformBuffer(): never {\n return unsupported(\"UniformBuffer.bindUniformBuffer\", \"The compute-only compat UniformBuffer is bound through ComputeShader.setUniformBuffer.\");\n }\n\n public unbindEffect(): void {}\n\n public setDataBuffer(dataBuffer: LiteUniformBuffer): boolean {\n return this._buffer === dataBuffer;\n }\n\n public has(name: string): boolean {\n return this._uniformLocations.has(name);\n }\n\n public dispose(): void {\n if (this._buffer) {\n disposeUniformBuffer(this._buffer);\n this._buffer = null;\n }\n }\n\n private _align(size: number): void {\n const alignment = size <= 2 ? size : 4;\n if (alignment > 0 && this._uniformLocationPointer % alignment !== 0) {\n const padding = alignment - (this._uniformLocationPointer % alignment);\n this._data.push(...new Array<number>(padding).fill(0));\n this._uniformLocationPointer += padding;\n }\n }\n\n private _updateIntegerUniform(uniformName: string, data: ArrayLike<number>, unsigned: boolean): void {\n let location = this._uniformLocations.get(uniformName);\n if (location === undefined) {\n this.addUniform(uniformName, data.length);\n location = this._uniformLocations.get(uniformName)!;\n }\n this.create();\n if (data.length > (this._uniformSizes.get(uniformName) ?? 0)) {\n throw new RangeError(`Uniform \"${uniformName}\" has room for ${this._uniformSizes.get(uniformName)} values, not ${data.length}.`);\n }\n const view = unsigned ? new Uint32Array(this._bufferData!.buffer) : new Int32Array(this._bufferData!.buffer);\n for (let i = 0; i < data.length; i++) {\n this._setInteger(view, location + i, data[i]!, unsigned);\n }\n }\n\n private _updateIntegerUniformArray(uniformName: string, data: ArrayLike<number>, unsigned: boolean): void {\n const location = this._uniformLocations.get(uniformName);\n const layout = this._uniformArraySizes.get(uniformName);\n if (location === undefined || !layout) {\n throw new Error(`Uniform array \"${uniformName}\" must be declared with addUniform before it can be updated.`);\n }\n this.create();\n if (data.length > layout.strideSize * layout.arraySize) {\n throw new RangeError(`Uniform array \"${uniformName}\" accepts at most ${layout.strideSize * layout.arraySize} values, not ${data.length}.`);\n }\n const view = unsigned ? new Uint32Array(this._bufferData!.buffer) : new Int32Array(this._bufferData!.buffer);\n for (let i = 0; i < data.length; i++) {\n const destination = location + Math.floor(i / layout.strideSize) * 4 + (i % layout.strideSize);\n this._setInteger(view, destination, data[i]!, unsigned);\n }\n }\n\n private _setInteger(view: Int32Array | Uint32Array, index: number, input: number, unsigned: boolean): void {\n const value = unsigned ? input >>> 0 : input | 0;\n if (view[index] !== value) {\n view[index] = value;\n this._needSync = true;\n }\n }\n}\n","/**\n * Babylon.js-compatible `AbstractScene` — the base of the `Scene` class.\n *\n * In Babylon.js the scene class chain is `Scene extends AbstractScene`, where\n * `AbstractScene` owns the entity collections (`meshes`, `cameras`, `lights`,\n * `materials`, …) and the by-name lookups over them. The compat layer mirrors\n * that split so `instanceof AbstractScene` and the inherited collection API\n * behave as ported code expects. {@link Scene} adds the engine-backed rendering,\n * environment, animation, and lifecycle surface on top.\n */\n\nimport type { Node } from \"../node/node.js\";\nimport type { Camera } from \"../cameras/cameras.js\";\nimport type { Light } from \"../lights/lights.js\";\nimport type { TransformNode } from \"../meshes/meshes.js\";\nimport type { Material } from \"../materials/materials.js\";\n\nexport abstract class AbstractScene {\n /**\n * @internal Canonical compat mesh-wrapper registry, keyed by the Lite node each\n * wrapper carries. Kept in sync with the Lite-core-owned scene list: a wrapper is\n * registered when its mesh is constructed against the scene and dropped on dispose,\n * mirroring the core `addToScene` / `removeFromScene` it drives. `scene.meshes` is\n * derived from this so **every** compat mesh is enumerable — ordinary primitives\n * (which register straight with the Lite scene) as well as the loader-surfaced\n * Gaussian-Splatting meshes, which the old array only ever held.\n */\n protected readonly _meshWrappers = new Map<object, TransformNode>();\n /** @internal Stable Babylon.js-compatible array returned by `scene.meshes`. */\n protected readonly _meshes: TransformNode[] = [];\n /** @internal Reused scratch array for reconciling Lite-core mesh order. */\n protected readonly _orderedCoreMeshes: TransformNode[] = [];\n /** @internal Reused membership set for linear-time mesh-order reconciliation. */\n protected readonly _orderedCoreMeshSet = new Set<TransformNode>();\n /** @internal Cameras constructed against this scene (`scene.cameras`). */\n protected readonly _cameras: Camera[] = [];\n /** @internal Lights constructed against this scene (`scene.lights`). */\n protected readonly _lights: Light[] = [];\n /** @internal Materials constructed against this scene (`scene.materials`). */\n protected readonly _materials: Material[] = [];\n\n /**\n * @internal The Lite-core-owned mesh list backing `scene.meshes`. The concrete\n * {@link Scene} overrides this to return its Lite `SceneContext.meshes` (the\n * authoritative list); the abstract base owns no Lite scene, so it returns none.\n * Returning the core meshes directly is not an option (they are Lite `Mesh`\n * objects, not compat wrappers) — they only provide the authoritative membership\n * and order that {@link meshes} maps back onto canonical wrappers.\n */\n protected _coreMeshList(): readonly object[] {\n return [];\n }\n\n /**\n * Babylon.js `scene.meshes` — the compat mesh wrappers in the scene. Backed by the\n * canonical {@link _meshWrappers} registry and kept in sync with the Lite-core-owned\n * list: the core list ({@link _coreMeshList}) supplies authoritative membership and\n * ordering, mapped back to each mesh's canonical wrapper so the returned handles are\n * the right type and keep wrapper identity. Wrappers not yet mirrored into the core\n * list (transform-only loader roots, primitives whose scene-add is deferred to engine\n * start, and Gaussian-Splatting meshes that register their renderables outside\n * `scene.meshes`) retain their registration positions.\n */\n public get meshes(): TransformNode[] {\n const orderedCore = this._orderedCoreMeshes;\n const orderedCoreSet = this._orderedCoreMeshSet;\n orderedCore.length = 0;\n orderedCoreSet.clear();\n for (const core of this._coreMeshList()) {\n const wrapper = this._meshWrappers.get(core);\n if (wrapper && !orderedCoreSet.has(wrapper)) {\n orderedCore.push(wrapper);\n orderedCoreSet.add(wrapper);\n }\n }\n\n let orderedIndex = 0;\n for (let i = 0; i < this._meshes.length; i++) {\n if (orderedCoreSet.has(this._meshes[i]!)) {\n this._meshes[i] = orderedCore[orderedIndex++]!;\n }\n }\n return this._meshes;\n }\n\n /** Babylon.js `scene.cameras` — every camera constructed against this scene. */\n public get cameras(): Camera[] {\n return this._cameras;\n }\n\n /** Babylon.js `scene.lights` — every light constructed against this scene. */\n public get lights(): Light[] {\n return this._lights;\n }\n\n /** Babylon.js `scene.materials` — every material constructed against this scene. */\n public get materials(): Material[] {\n return this._materials;\n }\n\n /**\n * @internal Register a compat mesh wrapper so it appears in `scene.meshes`. Keyed\n * by the Lite node the wrapper carries (`liteKey`) so it can be reconciled with the\n * core-owned list — pass an `AbstractMesh`'s `_lite`; loader-surfaced meshes whose\n * Lite node is not a core scene mesh (Gaussian Splatting) key by the wrapper itself.\n */\n public _registerMesh(mesh: TransformNode, liteKey: object = mesh): void {\n const registered = this._meshWrappers.get(liteKey);\n if (registered && registered !== mesh) {\n return;\n }\n if (!registered) {\n this._meshWrappers.set(liteKey, mesh);\n }\n if (!this._meshes.includes(mesh)) {\n this._meshes.push(mesh);\n }\n }\n\n /** @internal Register a camera so it appears in `scene.cameras`. */\n public _registerCamera(camera: Camera): void {\n if (!this._cameras.includes(camera)) {\n this._cameras.push(camera);\n }\n }\n\n /** @internal Register a light so it appears in `scene.lights`. */\n public _registerLight(light: Light): void {\n if (!this._lights.includes(light)) {\n this._lights.push(light);\n }\n }\n\n /** @internal Register a material so it appears in `scene.materials`. */\n public _registerMaterial(material: Material): void {\n if (!this._materials.includes(material)) {\n this._materials.push(material);\n }\n }\n\n /** @internal Remove a node from the camera / light / mesh registries on dispose. */\n public _unregisterNode(node: Node): void {\n const ci = this._cameras.indexOf(node as unknown as Camera);\n if (ci !== -1) {\n this._cameras.splice(ci, 1);\n }\n const li = this._lights.indexOf(node as unknown as Light);\n if (li !== -1) {\n this._lights.splice(li, 1);\n }\n for (const [key, wrapper] of this._meshWrappers) {\n if (wrapper === (node as unknown as TransformNode)) {\n this._meshWrappers.delete(key);\n }\n }\n const mi = this._meshes.indexOf(node as unknown as TransformNode);\n if (mi !== -1) {\n this._meshes.splice(mi, 1);\n }\n }\n\n /** @internal Remove a material from `scene.materials` on dispose. */\n public _unregisterMaterial(material: Material): void {\n const i = this._materials.indexOf(material);\n if (i !== -1) {\n this._materials.splice(i, 1);\n }\n }\n\n /** Babylon.js `scene.getCameraByName(name)` — first camera with a matching name, else `null`. */\n public getCameraByName(name: string): Camera | null {\n return this._cameras.find((c) => c.name === name) ?? null;\n }\n\n /** Babylon.js `scene.getCameraById(id)` — first camera whose `id` matches, else `null`. */\n public getCameraById(id: string): Camera | null {\n return this._cameras.find((c) => (c as unknown as { id?: string }).id === id) ?? null;\n }\n\n /** Babylon.js `scene.getLightByName(name)` — first light with a matching name, else `null`. */\n public getLightByName(name: string): Light | null {\n return this._lights.find((l) => l.name === name) ?? null;\n }\n\n /** Babylon.js `scene.getLightById(id)` — first light whose `id` matches, else `null`. */\n public getLightById(id: string): Light | null {\n return this._lights.find((l) => (l as unknown as { id?: string }).id === id) ?? null;\n }\n\n /** Babylon.js `scene.getMaterialByName(name)` — first material with a matching name, else `null`. */\n public getMaterialByName(name: string): Material | null {\n return this._materials.find((m) => m.name === name) ?? null;\n }\n\n /** Babylon.js `scene.getMaterialById(id)` — first material whose `id` matches, else `null`. */\n public getMaterialById(id: string): Material | null {\n return this._materials.find((m) => (m as unknown as { id?: string }).id === id) ?? null;\n }\n\n /**\n * Babylon.js `scene.getMeshByName(name)` — first mesh in {@link meshes} with a\n * matching name, else `null`. Enumerates the full canonical mesh registry\n * (primitives + loader-surfaced meshes), not just the loader-surfaced subset.\n */\n public getMeshByName(name: string): TransformNode | null {\n return this.meshes.find((m) => m.name === name) ?? null;\n }\n\n /** Babylon.js `scene.getMeshById(id)` — first mesh whose `id` matches, else `null`. */\n public getMeshById(id: string): TransformNode | null {\n return this.meshes.find((m) => (m as unknown as { id?: string }).id === id) ?? null;\n }\n\n /** Babylon.js legacy `scene.getMeshByID(id)` — alias of {@link getMeshById}. */\n public getMeshByID(id: string): TransformNode | null {\n return this.getMeshById(id);\n }\n\n /** Babylon.js `scene.getNodeByName(name)` — searches meshes, cameras, and lights. */\n public getNodeByName(name: string): Node | null {\n return this.meshes.find((m) => m.name === name) ?? this._cameras.find((c) => c.name === name) ?? this._lights.find((l) => l.name === name) ?? null;\n }\n\n /** Babylon.js `scene.getNodeById(id)` — searches meshes, cameras, and lights by `id`. */\n public getNodeById(id: string): Node | null {\n const byId = (n: { id?: string }): boolean => n.id === id;\n return (\n this.meshes.find((m) => byId(m as unknown as { id?: string })) ??\n this._cameras.find((c) => byId(c as unknown as { id?: string })) ??\n this._lights.find((l) => byId(l as unknown as { id?: string })) ??\n null\n );\n }\n}\n","/**\n * Physics (Havok V2) compat surface.\n *\n * Babylon Lite ships a Havok-V2 physics subset through standalone factory\n * functions (`createHavokWorld`, `createPhysicsAggregate`, …). This module wraps\n * the Babylon.js class-shaped entry points on top of that native API so ported\n * `@babylonjs/core` physics code resolves and behaves correctly.\n *\n * The headline wrapper is {@link HavokPlugin}, which mirrors Babylon.js's\n * `new HavokPlugin(useDeltaForWorldStep, hpInjection)`. When\n * `useDeltaForWorldStep` is `true` (the Babylon.js default) the world is stepped\n * by the **elapsed frame time** rather than a fixed `1/60` slice, so simulation\n * speed is independent of the display refresh rate (resolves issue #332). Lite's\n * native physics does this on its own: a world with no fixed step (its\n * `_fixedDeltaMs` is `0`, the default) advances by the live per-frame delta each\n * frame (clamped to a tunnelling ceiling). The wrapper therefore just leaves the\n * world in its native frame-delta mode for delta stepping, and pins a fixed step\n * only when `useDeltaForWorldStep` is `false` — no per-frame policy of its own is\n * needed.\n */\n\nimport {\n applyPhysicsBodyForce,\n applyPhysicsBodyImpulse,\n calculatePhysicsCharacterMovementToRef,\n createPhysicsCharacterController,\n createHavokWorld,\n createPhysicsAggregate,\n createPhysicsBody,\n createPhysicsConstraint,\n createPhysicsShape,\n disposePhysics,\n enableHavokThinInstancePhysicsSync,\n getPhysicsBodyAngularVelocity,\n getPhysicsBodyLinearVelocity,\n physicsRaycast,\n CharacterSupportedState as LiteCharacterSupportedState,\n PhysicsMotionType as LitePhysicsMotionType,\n PhysicsPrestepType as LitePhysicsPrestepType,\n PhysicsConstraintAxis as LitePhysicsConstraintAxis,\n PhysicsConstraintType as LitePhysicsConstraintType,\n PhysicsShapeType as LitePhysicsShapeType,\n releasePhysicsConstraint,\n releasePhysicsShape,\n removePhysicsBody,\n setPhysicsBodyAngularVelocity,\n setPhysicsBodyLinearVelocity,\n setPhysicsBodyMassProperties,\n setPhysicsBodyMotionType,\n setPhysicsBodyPrestepType,\n setPhysicsBodyShape,\n setPhysicsGravity,\n setPhysicsShapeFilterCollideMask,\n setPhysicsShapeFilterMembershipMask,\n setPhysicsShapeIsTrigger,\n setPhysicsShapeMaterial,\n setPhysicsTimestep,\n} from \"babylon-lite\";\nimport type {\n CharacterCollisionEvent as LiteCharacterCollisionEvent,\n CharacterSurfaceInfo as LiteCharacterSurfaceInfo,\n Mesh as LiteMesh,\n PhysicsBody as LitePhysicsBody,\n PhysicsCharacterController as LitePhysicsCharacterController,\n PhysicsConstraint as LitePhysicsConstraint,\n PhysicsMassProperties,\n PhysicsShape as LitePhysicsShape,\n PhysicsShapeParameters,\n PhysicsWorld,\n RaycastQuery,\n SceneContext,\n} from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport type { Mesh, TransformNode } from \"../meshes/meshes.js\";\nimport type { ObserverCallback } from \"../misc/observable.js\";\nimport { Observable } from \"../misc/observable.js\";\nimport type { Node } from \"../node/node.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\n/** Minimal `{x, y, z}` view shared by the compat `Vector3` and Lite's `Vec3`. */\ninterface Vec3Like {\n x: number;\n y: number;\n z: number;\n}\n\nlet physicsBodyWrappers: WeakMap<LitePhysicsBody, PhysicsBody> | null = null;\n\nfunction getPhysicsBodyWrappers(): WeakMap<LitePhysicsBody, PhysicsBody> {\n return (physicsBodyWrappers ??= new WeakMap());\n}\n\n// ─── Enums (values match Babylon.js `@babylonjs/core`) ───────────────\n\n/** The type of a Havok physics collision shape. Values match Babylon.js `PhysicsShapeType`. */\nexport enum PhysicsShapeType {\n SPHERE = 0,\n CAPSULE = 1,\n CYLINDER = 2,\n BOX = 3,\n CONVEX_HULL = 4,\n CONTAINER = 5,\n MESH = 6,\n HEIGHTFIELD = 7,\n}\n\n/** How a body moves. Values match Babylon.js `PhysicsMotionType`. */\nexport enum PhysicsMotionType {\n STATIC = 0,\n ANIMATED = 1,\n DYNAMIC = 2,\n}\n\n/** How a moved transform node is propagated to its body before each step. Values match Babylon.js `PhysicsPrestepType`. */\nexport enum PhysicsPrestepType {\n DISABLED = 0,\n TELEPORT = 1,\n ACTION = 2,\n}\n\n/** Type of a Physics V2 constraint. Values match Babylon.js `PhysicsConstraintType`. */\nexport enum PhysicsConstraintType {\n BALL_AND_SOCKET = 1,\n DISTANCE = 2,\n HINGE = 3,\n SLIDER = 4,\n LOCK = 5,\n PRISMATIC = 6,\n SIX_DOF = 7,\n}\n\n/** Axis addressed by a Physics V2 constraint limit. */\nexport enum PhysicsConstraintAxis {\n LINEAR_X = 0,\n LINEAR_Y = 1,\n LINEAR_Z = 2,\n ANGULAR_X = 3,\n ANGULAR_Y = 4,\n ANGULAR_Z = 5,\n LINEAR_DISTANCE = 6,\n}\n\n/** Contact state of a physics character against its supporting surface. */\nexport enum CharacterSupportedState {\n UNSUPPORTED = 0,\n SLIDING = 1,\n SUPPORTED = 2,\n}\n\nexport interface CharacterShapeOptions {\n shape?: PhysicsShape;\n capsuleHeight?: number;\n capsuleRadius?: number;\n}\n\n/** Babylon.js raycast collision-filter options. */\nexport interface IRaycastQuery {\n membership?: number;\n collideWith?: number;\n shouldHitTriggers?: boolean;\n ignoreBody?: PhysicsBody;\n}\n\n/** Base result shared by Babylon.js physics casting queries. */\nexport class CastingResult {\n protected readonly _hitNormal = Vector3.Zero();\n protected readonly _hitPoint = Vector3.Zero();\n private _hasHit = false;\n private _triangleIndex = -1;\n\n public body?: PhysicsBody;\n public bodyIndex?: number;\n public shape?: PhysicsShape;\n\n public get hitPoint(): Vector3 {\n return this._hitPoint;\n }\n public get hitNormal(): Vector3 {\n return this._hitNormal;\n }\n public get hasHit(): boolean {\n return this._hasHit;\n }\n public get triangleIndex(): number {\n return this._triangleIndex;\n }\n\n public setHitData(hitNormal: Vec3Like, hitPoint: Vec3Like, triangleIndex?: number): void {\n this._hasHit = true;\n this._hitNormal.copyFromFloats(hitNormal.x, hitNormal.y, hitNormal.z);\n this._hitPoint.copyFromFloats(hitPoint.x, hitPoint.y, hitPoint.z);\n this._triangleIndex = triangleIndex ?? -1;\n }\n\n public reset(): void {\n this._hasHit = false;\n this._hitNormal.setAll(0);\n this._hitPoint.setAll(0);\n this._triangleIndex = -1;\n this.body = undefined;\n this.bodyIndex = undefined;\n this.shape = undefined;\n }\n}\n\n/** Babylon.js raycast result backed by Lite's native Havok query result. */\nexport class PhysicsRaycastResult extends CastingResult {\n private _hitDistance = 0;\n private readonly _rayFromWorld = Vector3.Zero();\n private readonly _rayToWorld = Vector3.Zero();\n\n public get hitDistance(): number {\n return this._hitDistance;\n }\n public get hitNormalWorld(): Vector3 {\n return this._hitNormal;\n }\n public get hitPointWorld(): Vector3 {\n return this._hitPoint;\n }\n public get rayFromWorld(): Vector3 {\n return this._rayFromWorld;\n }\n public get rayToWorld(): Vector3 {\n return this._rayToWorld;\n }\n\n public setHitDistance(distance: number): void {\n this._hitDistance = distance;\n }\n\n public calculateHitDistance(): void {\n this._hitDistance = Vector3.Distance(this._rayFromWorld, this._hitPoint);\n }\n\n public override reset(from: Vector3 = Vector3.Zero(), to: Vector3 = Vector3.Zero()): void {\n super.reset();\n this._rayFromWorld.copyFrom(from);\n this._rayToWorld.copyFrom(to);\n this._hitDistance = 0;\n }\n}\n\nexport interface CharacterSurfaceInfo {\n isSurfaceDynamic: boolean;\n supportedState: CharacterSupportedState;\n averageSurfaceNormal: Vector3;\n averageSurfaceVelocity: Vector3;\n averageAngularSurfaceVelocity: Vector3;\n}\n\nexport interface ICharacterControllerCollisionEvent {\n collider: PhysicsBody;\n colliderIndex: number;\n impulse: Vector3;\n impulsePosition: Vector3;\n}\n\nexport interface PhysicsConstraintParameters {\n pivotA?: Vec3Like;\n pivotB?: Vec3Like;\n axisA?: Vec3Like;\n axisB?: Vec3Like;\n perpAxisA?: Vec3Like;\n perpAxisB?: Vec3Like;\n maxDistance?: number;\n collision?: boolean;\n}\n\nexport class Physics6DoFLimit {\n public axis!: PhysicsConstraintAxis;\n public minLimit?: number;\n public maxLimit?: number;\n public stiffness?: number;\n public damping?: number;\n}\n\nexport interface PhysicsMaterial {\n friction?: number;\n staticFriction?: number;\n restitution?: number;\n}\n\nexport interface PhysicShapeOptions {\n type?: PhysicsShapeType;\n parameters?: PhysicsShapeParameters;\n pluginData?: LitePhysicsShape;\n}\n\nexport interface PhysicsAggregateParameters {\n mass: number;\n friction?: number;\n staticFriction?: number;\n restitution?: number;\n radius?: number;\n pointA?: Vec3Like;\n pointB?: Vec3Like;\n extents?: Vec3Like;\n rotation?: { x: number; y: number; z: number; w: number };\n center?: Vec3Like;\n mesh?: Mesh;\n startAsleep?: boolean;\n isTriggerShape?: boolean;\n}\n\nfunction requirePhysicsWorld(scene: Scene | undefined): PhysicsWorld {\n const world = scene?.getPhysicsEngine()?.getPhysicsPlugin().world;\n if (!world) {\n return unsupported(\"Physics\", \"Call `scene.enablePhysics(...)` with a ready HavokPlugin before creating physics bodies or shapes.\");\n }\n return world;\n}\n\nfunction liteShapeType(type: PhysicsShapeType): LitePhysicsShapeType {\n switch (type) {\n case PhysicsShapeType.SPHERE:\n return LitePhysicsShapeType.SPHERE;\n case PhysicsShapeType.CAPSULE:\n return LitePhysicsShapeType.CAPSULE;\n case PhysicsShapeType.CYLINDER:\n return LitePhysicsShapeType.CYLINDER;\n case PhysicsShapeType.BOX:\n return LitePhysicsShapeType.BOX;\n case PhysicsShapeType.CONVEX_HULL:\n return LitePhysicsShapeType.CONVEX_HULL;\n case PhysicsShapeType.CONTAINER:\n return LitePhysicsShapeType.CONTAINER;\n case PhysicsShapeType.MESH:\n return LitePhysicsShapeType.MESH;\n case PhysicsShapeType.HEIGHTFIELD:\n return LitePhysicsShapeType.HEIGHTFIELD;\n default:\n throw new Error(`Invalid PhysicsShapeType value: ${type}`);\n }\n}\n\nfunction liteMotionType(type: PhysicsMotionType): LitePhysicsMotionType {\n switch (type) {\n case PhysicsMotionType.STATIC:\n return LitePhysicsMotionType.STATIC;\n case PhysicsMotionType.ANIMATED:\n return LitePhysicsMotionType.ANIMATED;\n case PhysicsMotionType.DYNAMIC:\n return LitePhysicsMotionType.DYNAMIC;\n default:\n throw new Error(`Invalid PhysicsMotionType value: ${type}`);\n }\n}\n\nfunction litePrestepType(type: PhysicsPrestepType): LitePhysicsPrestepType {\n switch (type) {\n case PhysicsPrestepType.DISABLED:\n return LitePhysicsPrestepType.DISABLED;\n case PhysicsPrestepType.TELEPORT:\n return LitePhysicsPrestepType.TELEPORT;\n case PhysicsPrestepType.ACTION:\n return LitePhysicsPrestepType.ACTION;\n default:\n throw new Error(`Invalid PhysicsPrestepType value: ${type}`);\n }\n}\n\nfunction liteConstraintType(type: PhysicsConstraintType): LitePhysicsConstraintType {\n switch (type) {\n case PhysicsConstraintType.BALL_AND_SOCKET:\n return LitePhysicsConstraintType.BALL_AND_SOCKET;\n case PhysicsConstraintType.DISTANCE:\n return LitePhysicsConstraintType.DISTANCE;\n case PhysicsConstraintType.HINGE:\n return LitePhysicsConstraintType.HINGE;\n case PhysicsConstraintType.SLIDER:\n return LitePhysicsConstraintType.SLIDER;\n case PhysicsConstraintType.LOCK:\n return LitePhysicsConstraintType.LOCK;\n case PhysicsConstraintType.PRISMATIC:\n return LitePhysicsConstraintType.PRISMATIC;\n case PhysicsConstraintType.SIX_DOF:\n return LitePhysicsConstraintType.SIX_DOF;\n default:\n throw new Error(`Invalid PhysicsConstraintType value: ${type}`);\n }\n}\n\nfunction liteConstraintAxis(axis: PhysicsConstraintAxis): LitePhysicsConstraintAxis {\n switch (axis) {\n case PhysicsConstraintAxis.LINEAR_X:\n return LitePhysicsConstraintAxis.LINEAR_X;\n case PhysicsConstraintAxis.LINEAR_Y:\n return LitePhysicsConstraintAxis.LINEAR_Y;\n case PhysicsConstraintAxis.LINEAR_Z:\n return LitePhysicsConstraintAxis.LINEAR_Z;\n case PhysicsConstraintAxis.ANGULAR_X:\n return LitePhysicsConstraintAxis.ANGULAR_X;\n case PhysicsConstraintAxis.ANGULAR_Y:\n return LitePhysicsConstraintAxis.ANGULAR_Y;\n case PhysicsConstraintAxis.ANGULAR_Z:\n return LitePhysicsConstraintAxis.ANGULAR_Z;\n case PhysicsConstraintAxis.LINEAR_DISTANCE:\n return LitePhysicsConstraintAxis.LINEAR_DISTANCE;\n default:\n throw new Error(`Invalid PhysicsConstraintAxis value: ${axis}`);\n }\n}\n\nfunction liteCharacterSupportedState(state: CharacterSupportedState): LiteCharacterSupportedState {\n switch (state) {\n case CharacterSupportedState.UNSUPPORTED:\n return LiteCharacterSupportedState.UNSUPPORTED;\n case CharacterSupportedState.SLIDING:\n return LiteCharacterSupportedState.SLIDING;\n case CharacterSupportedState.SUPPORTED:\n return LiteCharacterSupportedState.SUPPORTED;\n default:\n throw new Error(`Invalid CharacterSupportedState value: ${state}`);\n }\n}\n\nfunction compatCharacterSupportedState(state: LiteCharacterSupportedState): CharacterSupportedState {\n switch (state) {\n case LiteCharacterSupportedState.UNSUPPORTED:\n return CharacterSupportedState.UNSUPPORTED;\n case LiteCharacterSupportedState.SLIDING:\n return CharacterSupportedState.SLIDING;\n case LiteCharacterSupportedState.SUPPORTED:\n return CharacterSupportedState.SUPPORTED;\n default:\n throw new Error(`Invalid Lite CharacterSupportedState value: ${state}`);\n }\n}\n\n/** Babylon.js-shaped collision shape backed by a Babylon Lite physics shape. */\nexport class PhysicsShape {\n /** @internal */\n public _lite!: LitePhysicsShape;\n /** @internal */\n private readonly _world: PhysicsWorld;\n /** @internal */\n private _material: PhysicsMaterial = {};\n /** @internal */\n private _membershipMask = 0xffffffff;\n /** @internal */\n private _collideMask = 0xffffffff;\n /** @internal */\n private _isTrigger = false;\n /** @internal */\n private _disposed = false;\n /** @internal Whether this wrapper is responsible for releasing the native shape. */\n private _ownsLiteShape = true;\n\n public constructor(options: PhysicShapeOptions, scene: Scene) {\n this._world = requirePhysicsWorld(scene);\n if (options.pluginData) {\n this._lite = options.pluginData;\n } else if (options.type !== undefined) {\n this._lite = createPhysicsShape(this._world, { type: liteShapeType(options.type), parameters: options.parameters });\n } else {\n return unsupported(\"PhysicsShape\", \"Specify either `type` or a native Lite shape as `pluginData`.\");\n }\n }\n\n /** @internal */\n public static _fromLite(shape: LitePhysicsShape, world: PhysicsWorld, ownsLiteShape = true): PhysicsShape {\n const wrapper = Object.create(PhysicsShape.prototype) as PhysicsShape;\n Object.defineProperties(wrapper, {\n _lite: { value: shape, enumerable: true, writable: true },\n _world: { value: world },\n _material: { value: {}, writable: true },\n _membershipMask: { value: 0xffffffff, writable: true },\n _collideMask: { value: 0xffffffff, writable: true },\n _isTrigger: { value: false, writable: true },\n _disposed: { value: false, writable: true },\n _ownsLiteShape: { value: ownsLiteShape },\n });\n return wrapper;\n }\n\n /** @internal */\n public _replaceLiteShape(shape: LitePhysicsShape): void {\n this._lite = shape;\n this.material = this._material;\n this.filterMembershipMask = this._membershipMask;\n this.filterCollideMask = this._collideMask;\n this.isTrigger = this._isTrigger;\n }\n\n public getClassName(): string {\n return \"PhysicsShape\";\n }\n\n public get type(): PhysicsShapeType {\n switch (this._lite._type) {\n case LitePhysicsShapeType.SPHERE:\n return PhysicsShapeType.SPHERE;\n case LitePhysicsShapeType.CAPSULE:\n return PhysicsShapeType.CAPSULE;\n case LitePhysicsShapeType.CYLINDER:\n return PhysicsShapeType.CYLINDER;\n case LitePhysicsShapeType.BOX:\n return PhysicsShapeType.BOX;\n case LitePhysicsShapeType.CONVEX_HULL:\n return PhysicsShapeType.CONVEX_HULL;\n case LitePhysicsShapeType.CONTAINER:\n return PhysicsShapeType.CONTAINER;\n case LitePhysicsShapeType.MESH:\n return PhysicsShapeType.MESH;\n case LitePhysicsShapeType.HEIGHTFIELD:\n return PhysicsShapeType.HEIGHTFIELD;\n default:\n throw new Error(`Invalid Lite PhysicsShapeType value: ${this._lite._type}`);\n }\n }\n\n public set filterMembershipMask(value: number) {\n this._membershipMask = value;\n setPhysicsShapeFilterMembershipMask(this._world, this._lite, value);\n }\n public get filterMembershipMask(): number {\n return this._membershipMask;\n }\n\n public set filterCollideMask(value: number) {\n this._collideMask = value;\n setPhysicsShapeFilterCollideMask(this._world, this._lite, value);\n }\n public get filterCollideMask(): number {\n return this._collideMask;\n }\n\n public set material(value: PhysicsMaterial) {\n this._material = value;\n const friction = value.friction ?? 0.5;\n setPhysicsShapeMaterial(this._world, this._lite, friction, value.restitution ?? 0, value.staticFriction ?? friction);\n }\n public get material(): PhysicsMaterial {\n return this._material;\n }\n\n public set isTrigger(value: boolean) {\n this._isTrigger = value;\n setPhysicsShapeIsTrigger(this._world, this._lite, value);\n }\n public get isTrigger(): boolean {\n return this._isTrigger;\n }\n\n public dispose(): void {\n if (!this._disposed) {\n if (this._ownsLiteShape) {\n releasePhysicsShape(this._world, this._lite);\n }\n this._disposed = true;\n }\n }\n}\n\n/** Babylon.js-shaped rigid body backed by a Babylon Lite physics body. */\nexport class PhysicsBody {\n /** @internal */\n public readonly _lite: LitePhysicsBody;\n /** @internal */\n private readonly _world: PhysicsWorld;\n /** @internal */\n private _shape: PhysicsShape | null = null;\n /** @internal */\n private _disposed = false;\n /** @internal */\n private _nodeDisposeObserver: ObserverCallback<Node> | null = null;\n public readonly transformNode: TransformNode;\n private _disableSync = false;\n public readonly startAsleep: boolean;\n\n public constructor(transformNode: TransformNode, motionType: PhysicsMotionType, startsAsleep: boolean, scene: Scene) {\n assertPhysicsNodeSupported(transformNode);\n this.transformNode = transformNode;\n this.startAsleep = startsAsleep;\n this._world = requirePhysicsWorld(scene);\n this._lite = createPhysicsBody(this._world, transformNode._node, liteMotionType(motionType), startsAsleep);\n getPhysicsBodyWrappers().set(this._lite, this);\n setPhysicsBodyPrestepType(this._lite, LitePhysicsPrestepType.DISABLED);\n this._attachToNode();\n }\n\n /** @internal */\n public static _fromLite(body: LitePhysicsBody, transformNode: TransformNode, world: PhysicsWorld, startsAsleep = false): PhysicsBody {\n const wrapper = Object.create(PhysicsBody.prototype) as PhysicsBody;\n Object.defineProperties(wrapper, {\n _lite: { value: body, enumerable: true },\n _world: { value: world },\n _shape: { value: null, writable: true },\n _disposed: { value: false, writable: true },\n _nodeDisposeObserver: { value: null, writable: true },\n transformNode: { value: transformNode, enumerable: true },\n _disableSync: { value: false, writable: true },\n startAsleep: { value: startsAsleep, enumerable: true },\n });\n setPhysicsBodyPrestepType(wrapper._lite, LitePhysicsPrestepType.DISABLED);\n getPhysicsBodyWrappers().set(wrapper._lite, wrapper);\n wrapper._attachToNode();\n return wrapper;\n }\n\n public getClassName(): string {\n return \"PhysicsBody\";\n }\n\n public get disablePreStep(): boolean {\n return this._lite._prestepType === LitePhysicsPrestepType.DISABLED;\n }\n public set disablePreStep(value: boolean) {\n setPhysicsBodyPrestepType(this._lite, value ? LitePhysicsPrestepType.DISABLED : LitePhysicsPrestepType.TELEPORT);\n }\n\n public get disableSync(): boolean {\n return this._disableSync;\n }\n public set disableSync(value: boolean) {\n if (value) {\n unsupported(\n \"PhysicsBody.disableSync\",\n \"Babylon Lite's shared physics step always synchronizes dynamic bodies; opting out would require changing that existing hot-path module and every physics scene bundle.\"\n );\n }\n this._disableSync = false;\n }\n\n public get motionType(): PhysicsMotionType {\n switch (this._lite.motionType) {\n case LitePhysicsMotionType.STATIC:\n return PhysicsMotionType.STATIC;\n case LitePhysicsMotionType.ANIMATED:\n return PhysicsMotionType.ANIMATED;\n case LitePhysicsMotionType.DYNAMIC:\n return PhysicsMotionType.DYNAMIC;\n default:\n throw new Error(`Invalid Lite PhysicsMotionType value: ${this._lite.motionType}`);\n }\n }\n\n public set shape(value: PhysicsShape | null) {\n if (!value) {\n unsupported(\"PhysicsBody.shape\", \"Babylon Lite cannot detach a shape from a live body; assign another PhysicsShape or dispose the body.\");\n }\n this._shape = value;\n setPhysicsBodyShape(this._world, this._lite, value._lite);\n }\n public get shape(): PhysicsShape | null {\n return this._shape;\n }\n\n public setMotionType(value: PhysicsMotionType): void {\n setPhysicsBodyMotionType(this._world, this._lite, liteMotionType(value));\n }\n public getMotionType(): PhysicsMotionType {\n return this.motionType;\n }\n public setPrestepType(value: PhysicsPrestepType): void {\n setPhysicsBodyPrestepType(this._lite, litePrestepType(value));\n }\n public getPrestepType(): PhysicsPrestepType {\n switch (this._lite._prestepType) {\n case LitePhysicsPrestepType.DISABLED:\n return PhysicsPrestepType.DISABLED;\n case LitePhysicsPrestepType.TELEPORT:\n return PhysicsPrestepType.TELEPORT;\n case LitePhysicsPrestepType.ACTION:\n return PhysicsPrestepType.ACTION;\n default:\n throw new Error(`Invalid Lite PhysicsPrestepType value: ${this._lite._prestepType}`);\n }\n }\n public setMassProperties(properties: PhysicsMassProperties): void {\n setPhysicsBodyMassProperties(this._world, this._lite, properties);\n }\n public setLinearVelocity(value: Vec3Like): void {\n setPhysicsBodyLinearVelocity(this._world, this._lite, value);\n }\n public getLinearVelocity(): Vector3 {\n const value = getPhysicsBodyLinearVelocity(this._world, this._lite);\n return new Vector3(value.x, value.y, value.z);\n }\n public getLinearVelocityToRef(result: Vector3): void {\n const value = getPhysicsBodyLinearVelocity(this._world, this._lite);\n result.set(value.x, value.y, value.z);\n }\n public setAngularVelocity(value: Vec3Like): void {\n setPhysicsBodyAngularVelocity(this._world, this._lite, value);\n }\n public getAngularVelocity(): Vector3 {\n const value = getPhysicsBodyAngularVelocity(this._world, this._lite);\n return new Vector3(value.x, value.y, value.z);\n }\n public getAngularVelocityToRef(result: Vector3): void {\n const value = getPhysicsBodyAngularVelocity(this._world, this._lite);\n result.set(value.x, value.y, value.z);\n }\n public applyImpulse(impulse: Vec3Like, location: Vec3Like): void {\n applyPhysicsBodyImpulse(this._lite, impulse, location);\n }\n public applyForce(force: Vec3Like, location: Vec3Like): void {\n applyPhysicsBodyForce(this._world, this._lite, force, location);\n }\n public addConstraint(childBody: PhysicsBody, constraint: PhysicsConstraint): void {\n if (childBody._world !== this._world) {\n throw new Error(\"PhysicsBody.addConstraint requires both bodies to belong to the same scene\");\n }\n constraint._bind(this._world, this._lite, childBody._lite);\n }\n\n public dispose(): void {\n if (!this._disposed) {\n this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);\n this._nodeDisposeObserver = null;\n removePhysicsBody(this._world, this._lite);\n getPhysicsBodyWrappers().delete(this._lite);\n if (this.transformNode.physicsBody === this) {\n this.transformNode.physicsBody = null;\n }\n this._disposed = true;\n }\n }\n\n /** @internal */\n public _adoptShape(shape: PhysicsShape): void {\n this._shape = shape;\n }\n\n /** @internal */\n private _attachToNode(): void {\n this.transformNode.physicsBody = this;\n this._nodeDisposeObserver = this.transformNode.onDisposeObservable.add(() => this.dispose());\n }\n}\n\n/** Babylon.js-shaped Physics V2 constraint backed by Lite's native constraint factory. */\nexport class PhysicsConstraint {\n private readonly _lite: LitePhysicsConstraint[] = [];\n private readonly _world: PhysicsWorld;\n\n public constructor(\n public readonly type: PhysicsConstraintType,\n protected readonly _options: PhysicsConstraintParameters,\n protected readonly _scene: Scene,\n protected readonly _limits: readonly Physics6DoFLimit[] = []\n ) {\n this._world = requirePhysicsWorld(_scene);\n }\n\n public get options(): PhysicsConstraintParameters {\n return this._options;\n }\n\n public getClassName(): string {\n return \"PhysicsConstraint\";\n }\n\n /** @internal */\n public _bind(world: PhysicsWorld, bodyA: LitePhysicsBody, bodyB: LitePhysicsBody): void {\n if (this._world !== world) {\n throw new Error(\"PhysicsConstraint and PhysicsBody must belong to the same scene\");\n }\n this._lite.push(\n createPhysicsConstraint(\n world,\n bodyA,\n bodyB,\n liteConstraintType(this.type),\n this._options,\n this._limits.map((limit) => ({ ...limit, axis: liteConstraintAxis(limit.axis) }))\n )\n );\n }\n\n public dispose(): void {\n if (this._lite.length > 0) {\n // Releasing the Havok world invalidates all of its constraint handles.\n if (this._scene.getPhysicsEngine()?.getPhysicsPlugin().world === this._world) {\n for (const constraint of this._lite) {\n releasePhysicsConstraint(this._world, constraint);\n }\n }\n this._lite.length = 0;\n }\n }\n}\n\n/** Babylon.js `HingeConstraint` adapter. */\nexport class HingeConstraint extends PhysicsConstraint {\n public constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\n super(PhysicsConstraintType.HINGE, { pivotA, pivotB, axisA, axisB }, scene);\n }\n\n public override getClassName(): string {\n return \"HingeConstraint\";\n }\n}\n\nexport class BallAndSocketConstraint extends PhysicsConstraint {\n public constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\n super(PhysicsConstraintType.BALL_AND_SOCKET, { pivotA, pivotB, axisA, axisB }, scene);\n }\n}\n\nexport class DistanceConstraint extends PhysicsConstraint {\n public constructor(maxDistance: number, scene: Scene) {\n super(PhysicsConstraintType.DISTANCE, { maxDistance }, scene);\n }\n}\n\nexport class SliderConstraint extends PhysicsConstraint {\n public constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\n super(PhysicsConstraintType.SLIDER, { pivotA, pivotB, axisA, axisB }, scene);\n }\n}\n\nexport class LockConstraint extends PhysicsConstraint {\n public constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\n super(PhysicsConstraintType.LOCK, { pivotA, pivotB, axisA, axisB }, scene);\n }\n}\n\nexport class PrismaticConstraint extends PhysicsConstraint {\n public constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\n super(PhysicsConstraintType.PRISMATIC, { pivotA, pivotB, axisA, axisB }, scene);\n }\n}\n\nexport class Physics6DoFConstraint extends PhysicsConstraint {\n public constructor(\n constraintParams: PhysicsConstraintParameters,\n public readonly limits: Physics6DoFLimit[],\n scene: Scene\n ) {\n super(PhysicsConstraintType.SIX_DOF, constraintParams, scene, limits);\n }\n}\n\nexport class SpringConstraint extends Physics6DoFConstraint {\n public constructor(\n pivotA: Vector3,\n pivotB: Vector3,\n axisA: Vector3,\n axisB: Vector3,\n minDistance: number,\n maxDistance: number,\n stiffness: number,\n damping: number,\n scene: Scene\n ) {\n super({ pivotA, pivotB, axisA, axisB }, [{ axis: PhysicsConstraintAxis.LINEAR_DISTANCE, minLimit: minDistance, maxLimit: maxDistance, stiffness, damping }], scene);\n }\n}\n\nfunction vectorFromLite(value: Vec3Like): Vector3 {\n return new Vector3(value.x, value.y, value.z);\n}\n\nfunction vectorFromLiteOwned(value: Vec3Like): Vector3 {\n if (!(value instanceof Vector3)) {\n Object.setPrototypeOf(value, Vector3.prototype);\n }\n return value as Vector3;\n}\n\nfunction surfaceInfoFromLite(value: LiteCharacterSurfaceInfo): CharacterSurfaceInfo {\n return {\n isSurfaceDynamic: value.isSurfaceDynamic,\n supportedState: compatCharacterSupportedState(value.supportedState),\n averageSurfaceNormal: vectorFromLite(value.averageSurfaceNormal),\n averageSurfaceVelocity: vectorFromLite(value.averageSurfaceVelocity),\n averageAngularSurfaceVelocity: vectorFromLite(value.averageAngularSurfaceVelocity),\n };\n}\n\n/**\n * Babylon.js-shaped character controller backed by Lite's native, tree-shakeable\n * Havok character controller.\n */\nexport class PhysicsCharacterController {\n /** @internal */\n public readonly _lite: LitePhysicsCharacterController;\n public readonly onTriggerCollisionObservable = new Observable<ICharacterControllerCollisionEvent>();\n private _shape: PhysicsShape;\n private _up: Vector3;\n private _maxStepHeight = 0;\n private _footOffset: number;\n private _disposed = false;\n\n public constructor(position: Vector3, characterShapeOptions: CharacterShapeOptions, scene: Scene) {\n if (characterShapeOptions.shape) {\n unsupported(\n \"PhysicsCharacterController custom shapes\",\n \"Lite's controller owns and rebuilds a capsule internally; exposing caller-owned shape replacement requires an ownership/lifetime design in Lite.\"\n );\n }\n const world = requirePhysicsWorld(scene);\n this._lite = createPhysicsCharacterController(world, position, {\n capsuleHeight: characterShapeOptions.capsuleHeight ?? 1.8,\n capsuleRadius: characterShapeOptions.capsuleRadius ?? 0.6,\n });\n this._up = vectorFromLite(this._lite.up);\n this._lite.up = this._up;\n this._footOffset = (characterShapeOptions.capsuleHeight ?? 1.8) * 0.5;\n const liteShape = this._lite.getBody()._shape;\n if (!liteShape) {\n throw new Error(\"Babylon Lite character controller did not create a collision shape.\");\n }\n this._shape = PhysicsShape._fromLite(liteShape, world, false);\n this._lite.onTriggerCollisionObservable.add((event) => this._notifyCollision(event));\n }\n\n public get shape(): PhysicsShape {\n return this._shape;\n }\n\n public set shape(_value: PhysicsShape) {\n unsupported(\"PhysicsCharacterController.shape\", \"Lite's controller owns its cast shape; replacing it requires an explicit Lite ownership/lifetime contract.\");\n }\n\n public get shapeOptions(): CharacterShapeOptions {\n const { capsuleHeight, capsuleRadius } = this._lite.shapeOptions;\n return { capsuleHeight, capsuleRadius };\n }\n\n public setShapeOptions(options: CharacterShapeOptions, preserveFootPosition = true): void {\n if (options.shape) {\n this.shape = options.shape;\n return;\n }\n this._lite.setShapeOptions({ capsuleHeight: options.capsuleHeight ?? 1.8, capsuleRadius: options.capsuleRadius ?? 0.6 }, preserveFootPosition);\n const liteShape = this._lite.getBody()._shape;\n if (!liteShape) {\n throw new Error(\"Babylon Lite character controller did not rebuild its collision shape.\");\n }\n this._shape._replaceLiteShape(liteShape);\n this._footOffset = (options.capsuleHeight ?? 1.8) * 0.5;\n }\n\n public getPosition(): Vector3 {\n return vectorFromLiteOwned(this._lite.getPosition());\n }\n\n public setPosition(position: Vector3): void {\n this._lite.setPosition(position);\n }\n\n public getVelocity(): Vector3 {\n return vectorFromLiteOwned(this._lite.getVelocity());\n }\n\n public setVelocity(velocity: Vector3): void {\n this._lite.setVelocity(velocity);\n }\n\n public moveWithCollisions(displacement: Vector3): void {\n this._lite.moveWithCollisions(displacement);\n }\n\n public integrate(deltaTime: number, surfaceInfo: CharacterSurfaceInfo, gravity: Vector3): void {\n this._lite.integrate(deltaTime, { ...surfaceInfo, supportedState: liteCharacterSupportedState(surfaceInfo.supportedState) }, gravity);\n }\n\n public checkSupport(deltaTime: number, direction: Vector3): CharacterSurfaceInfo {\n return surfaceInfoFromLite(this._lite.checkSupport(deltaTime, direction));\n }\n\n public checkSupportToRef(deltaTime: number, direction: Vector3, result: CharacterSurfaceInfo): void {\n const value = this._lite.checkSupport(deltaTime, direction);\n result.isSurfaceDynamic = value.isSurfaceDynamic;\n result.supportedState = compatCharacterSupportedState(value.supportedState);\n result.averageSurfaceNormal.set(value.averageSurfaceNormal.x, value.averageSurfaceNormal.y, value.averageSurfaceNormal.z);\n result.averageSurfaceVelocity.set(value.averageSurfaceVelocity.x, value.averageSurfaceVelocity.y, value.averageSurfaceVelocity.z);\n result.averageAngularSurfaceVelocity.set(value.averageAngularSurfaceVelocity.x, value.averageAngularSurfaceVelocity.y, value.averageAngularSurfaceVelocity.z);\n }\n\n public calculateMovement(\n deltaTime: number,\n forwardWorld: Vector3,\n surfaceNormal: Vector3,\n currentVelocity: Vector3,\n surfaceVelocity: Vector3,\n desiredVelocity: Vector3,\n upWorld: Vector3\n ): Vector3 {\n return vectorFromLite(this._lite.calculateMovement(deltaTime, forwardWorld, surfaceNormal, currentVelocity, surfaceVelocity, desiredVelocity, upWorld));\n }\n\n public calculateMovementToRef(\n deltaTime: number,\n forwardWorld: Vector3,\n surfaceNormal: Vector3,\n currentVelocity: Vector3,\n surfaceVelocity: Vector3,\n desiredVelocity: Vector3,\n upWorld: Vector3,\n result: Vector3\n ): boolean {\n return calculatePhysicsCharacterMovementToRef(this._lite, deltaTime, forwardWorld, surfaceNormal, currentVelocity, surfaceVelocity, desiredVelocity, upWorld, result);\n }\n\n public dispose(): void {\n if (!this._disposed) {\n this._lite.dispose();\n this.onTriggerCollisionObservable.clear();\n this._disposed = true;\n }\n }\n\n public get up(): Vector3 {\n return this._up;\n }\n\n public set up(value: Vector3) {\n this._up = value;\n this._lite.up = value;\n }\n\n public get maxStepHeight(): number {\n return this._maxStepHeight;\n }\n\n public set maxStepHeight(value: number) {\n if (value !== 0) {\n unsupported(\n \"PhysicsCharacterController.maxStepHeight\",\n \"Step-up needs a substantial additional sweep/manifold policy in Lite's controller and cannot be implemented as compat translation.\"\n );\n }\n this._maxStepHeight = 0;\n }\n\n public get footOffset(): number {\n return this._footOffset;\n }\n\n public set footOffset(value: number) {\n if (value !== this._footOffset) {\n unsupported(\n \"PhysicsCharacterController.footOffset\",\n \"Lite derives the character foot from capsule height and does not expose the custom-shape foot-offset policy used by Babylon.js.\"\n );\n }\n }\n\n private _notifyCollision(event: LiteCharacterCollisionEvent): void {\n const collider = getPhysicsBodyWrappers().get(event.collider);\n if (!collider) {\n unsupported(\n \"PhysicsCharacterController collision body mapping\",\n \"The contacted Lite body was not created through the compat physics API and has no Babylon.js TransformNode wrapper.\"\n );\n }\n this.onTriggerCollisionObservable.notifyObservers({\n collider,\n colliderIndex: 0,\n impulse: vectorFromLite(event.impulse),\n impulsePosition: vectorFromLite(event.impulsePosition),\n });\n }\n\n public get keepDistance(): number {\n return this._lite.keepDistance;\n }\n public set keepDistance(value: number) {\n this._lite.keepDistance = value;\n }\n public get keepContactTolerance(): number {\n return this._lite.keepContactTolerance;\n }\n public set keepContactTolerance(value: number) {\n this._lite.keepContactTolerance = value;\n }\n public get maxCastIterations(): number {\n return this._lite.maxCastIterations;\n }\n public set maxCastIterations(value: number) {\n this._lite.maxCastIterations = value;\n }\n public get penetrationRecoverySpeed(): number {\n return this._lite.penetrationRecoverySpeed;\n }\n public set penetrationRecoverySpeed(value: number) {\n this._lite.penetrationRecoverySpeed = value;\n }\n public get staticFriction(): number {\n return this._lite.staticFriction;\n }\n public set staticFriction(value: number) {\n this._lite.staticFriction = value;\n }\n public get dynamicFriction(): number {\n return this._lite.dynamicFriction;\n }\n public set dynamicFriction(value: number) {\n this._lite.dynamicFriction = value;\n }\n public get maxSlopeCosine(): number {\n return this._lite.maxSlopeCosine;\n }\n public set maxSlopeCosine(value: number) {\n this._lite.maxSlopeCosine = value;\n }\n public get maxCharacterSpeedForSolver(): number {\n return this._lite.maxCharacterSpeedForSolver;\n }\n public set maxCharacterSpeedForSolver(value: number) {\n this._lite.maxCharacterSpeedForSolver = value;\n }\n public get characterStrength(): number {\n return this._lite.characterStrength;\n }\n public set characterStrength(value: number) {\n this._lite.characterStrength = value;\n }\n public get acceleration(): number {\n return this._lite.acceleration;\n }\n public set acceleration(value: number) {\n this._lite.acceleration = value;\n }\n public get maxAcceleration(): number {\n return this._lite.maxAcceleration;\n }\n public set maxAcceleration(value: number) {\n this._lite.maxAcceleration = value;\n }\n public get characterMass(): number {\n return this._lite.characterMass;\n }\n public set characterMass(value: number) {\n this._lite.characterMass = value;\n }\n}\n\n/** Babylon.js aggregate convenience object backed by Lite's native aggregate factory. */\nexport class PhysicsAggregate {\n public readonly transformNode: TransformNode;\n public readonly type: PhysicsShapeType | PhysicsShape;\n public readonly body: PhysicsBody;\n public readonly shape: PhysicsShape;\n public readonly material: PhysicsMaterial;\n /** @internal */\n private _disposed = false;\n /** @internal */\n private readonly _disposeShapeWhenDisposed: boolean;\n /** @internal */\n private _nodeDisposeObserver: ObserverCallback<Node> | null = null;\n\n public constructor(transformNode: TransformNode, type: PhysicsShapeType | PhysicsShape, options: PhysicsAggregateParameters = { mass: 0 }, scene?: Scene) {\n assertPhysicsNodeSupported(transformNode);\n this.transformNode = transformNode;\n this.type = type;\n const resolvedScene = scene ?? transformNode.getScene();\n const world = requirePhysicsWorld(resolvedScene);\n const nativeType = type instanceof PhysicsShape ? type._lite._type : liteShapeType(type);\n let suppliedShape = type instanceof PhysicsShape ? type : undefined;\n this._disposeShapeWhenDisposed = !suppliedShape;\n if (!suppliedShape && (type === PhysicsShapeType.MESH || type === PhysicsShapeType.CONVEX_HULL)) {\n suppliedShape = PhysicsShape._fromLite(createPhysicsShape(world, { type: nativeType, mesh: (options.mesh ?? transformNode)._node }), world);\n }\n const aggregate = createPhysicsAggregate(world, transformNode._node as LiteMesh, nativeType, {\n ...options,\n shape: suppliedShape?._lite,\n });\n this.material = {\n friction: options.friction ?? 0.2,\n staticFriction: options.staticFriction,\n restitution: options.restitution ?? 0.2,\n };\n this.shape = suppliedShape ?? PhysicsShape._fromLite(aggregate.shape, world);\n this.shape.material = this.material;\n if (options.isTriggerShape !== undefined) {\n this.shape.isTrigger = options.isTriggerShape;\n }\n this.body = PhysicsBody._fromLite(aggregate.body, transformNode, world, options.startAsleep);\n this.body._adoptShape(this.shape);\n this._nodeDisposeObserver = transformNode.onDisposeObservable.add(() => this.dispose());\n }\n\n public dispose(): void {\n if (!this._disposed) {\n this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);\n this._nodeDisposeObserver = null;\n this.body.dispose();\n if (this._disposeShapeWhenDisposed) {\n this.shape.dispose();\n }\n\n this._disposed = true;\n }\n }\n}\n\nfunction assertPhysicsNodeSupported(transformNode: TransformNode): void {\n if (transformNode.physicsBody) {\n unsupported(\"PhysicsBody\", \"Babylon Lite synchronizes one physics body per scene node; dispose the existing TransformNode.physicsBody before attaching another.\");\n }\n if (transformNode.parent || transformNode._node.parent) {\n unsupported(\"PhysicsBody\", \"Babylon Lite physics bodies currently consume local transforms, so parented TransformNodes cannot be synchronized in Babylon.js world space.\");\n }\n}\n\n// ─── HavokPlugin ─────────────────────────────────────────────────────\n\n/**\n * Babylon.js-shaped Havok V2 physics plugin, backed by Babylon Lite's native\n * `createHavokWorld` API.\n *\n * Construct it exactly as in Babylon.js and pass it to {@link Scene.enablePhysics}:\n * ```ts\n * const hknp = await HavokPhysics();\n * scene.enablePhysics(new Vector3(0, -9.81, 0), new HavokPlugin(true, hknp));\n * ```\n *\n * The first constructor argument, `useDeltaForWorldStep` (default `true`,\n * matching Babylon.js), selects delta-driven stepping: the world advances by the\n * elapsed real time each frame, so the simulation runs at the same real-time\n * speed regardless of the display refresh rate (issue #332). Pass `false` for the\n * legacy fixed `1/60`-per-frame behaviour.\n *\n * Bodies are still created with the native `createPhysicsAggregate` /\n * `createPhysicsBody` API against {@link world}; the Babylon.js `PhysicsAggregate`\n * class is not wrapped.\n */\nexport class HavokPlugin {\n /** Name of the plugin. */\n public readonly name: string = \"HavokPlugin\";\n\n /** @internal Reference to the Havok WASM module (`@babylonjs/havok`). */\n public _hknp: unknown;\n\n /** The native Lite physics world, created when the plugin is attached to a scene. */\n public world: PhysicsWorld | null = null;\n\n /** @internal Fixed timestep used when delta stepping is disabled, and by force scaling. */\n private _fixedTimeStep: number = 1 / 60;\n\n /** @internal Whether to advance the world by the elapsed frame time (vs a fixed `1/60`). */\n private readonly _useDeltaForWorldStep: boolean;\n\n /** @internal Whether the injected Havok module looks usable. */\n private readonly _supported: boolean;\n\n public constructor(useDeltaForWorldStep: boolean = true, hpInjection?: unknown) {\n this._useDeltaForWorldStep = useDeltaForWorldStep;\n this._hknp = hpInjection;\n // Babylon.js treats a still-pending `HavokPhysics()` promise factory (a\n // function) as \"not ready\". Mirror that: a function injection is unusable.\n this._supported = hpInjection != null && typeof hpInjection !== \"function\";\n }\n\n /** Whether the plugin has a usable Havok module. */\n public isSupported(): boolean {\n return this._supported;\n }\n\n /** Babylon.js physics plugin version (Havok is V2). */\n public getPluginVersion(): number {\n return 2;\n }\n\n /** Set the fixed timestep used when delta stepping is disabled. Matches Babylon.js. */\n public setTimeStep(timeStep: number): void {\n this._fixedTimeStep = timeStep;\n // Only a fixed-step world tracks this value on the native side. In delta mode Lite steps by\n // the live frame delta, so pushing a fixed step here would disable that — leave the world be.\n if (this.world && !this._useDeltaForWorldStep) {\n setPhysicsTimestep(this.world, timeStep);\n }\n }\n\n /** Get the fixed timestep. Matches Babylon.js. */\n public getTimeStep(): number {\n return this._fixedTimeStep;\n }\n\n /** Set the world gravity. */\n public setGravity(gravity: Vec3Like, worldPosition?: Vec3Like): void {\n if (this.world) {\n setPhysicsGravity(this.world, gravity, worldPosition);\n }\n }\n\n /**\n * Manual single-step entry point. Babylon Lite drives world stepping\n * internally (once per rendered frame, via the scene's before-render hook),\n * so calling this directly is unsupported — use {@link Scene.enablePhysics}.\n */\n public executeStep(): never {\n return unsupported(\"HavokPlugin.executeStep\", \"Babylon Lite advances the world internally each frame; manual stepping is not supported.\");\n }\n\n /** Release the native physics world. */\n public dispose(): void {\n if (this.world) {\n disposePhysics(this.world);\n this.world = null;\n }\n }\n\n /**\n * @internal Create the native Lite world for `liteScene` and select the step mode.\n *\n * Lite's native physics already steps a world by the live per-frame delta when it has no fixed\n * step (`createHavokWorld` leaves `_fixedDeltaMs === 0`), clamping to a tunnelling ceiling — which\n * is exactly Babylon.js's `useDeltaForWorldStep` behaviour. So delta stepping needs nothing extra\n * here; only the legacy fixed-step mode pins the world to {@link _fixedTimeStep}. The step is\n * driven from inside the world's own per-frame callback, so it is torn down together with the\n * world in {@link dispose} — nothing lingers on the scene after disposal.\n */\n public _attachToLiteScene(liteScene: SceneContext, gravity?: Vec3Like): void {\n if (!this._supported) {\n return unsupported(\"HavokPlugin\", \"The Havok module is not ready. `await HavokPhysics()` before constructing the plugin.\");\n }\n this.world = createHavokWorld(liteScene, this._hknp, gravity);\n enableHavokThinInstancePhysicsSync(this.world);\n if (!this._useDeltaForWorldStep) {\n setPhysicsTimestep(this.world, this._fixedTimeStep);\n }\n }\n}\n\n// ─── PhysicsEngine (V2) ──────────────────────────────────────────────\n\n/**\n * Babylon.js-shaped Physics V2 engine wrapper returned by\n * {@link Scene.getPhysicsEngine}. Holds the active {@link HavokPlugin} and the\n * world gravity, exposing the common Babylon.js `IPhysicsEngine` surface.\n */\nexport class PhysicsEngine {\n /** @internal */\n private readonly _plugin: HavokPlugin;\n\n /** Current world gravity. */\n public gravity: Vec3Like;\n\n public constructor(plugin: HavokPlugin, gravity: Vec3Like) {\n this._plugin = plugin;\n this.gravity = gravity;\n }\n\n /** The underlying physics plugin. */\n public getPhysicsPlugin(): HavokPlugin {\n return this._plugin;\n }\n\n /** Physics engine plugin version (Havok is V2). */\n public getPluginVersion(): number {\n return this._plugin.getPluginVersion();\n }\n\n /** Set the world gravity. */\n public setGravity(gravity: Vec3Like): void {\n this.gravity = gravity;\n this._plugin.setGravity(gravity);\n }\n\n /** Set the fixed timestep. */\n public setTimeStep(newTimeStep: number): void {\n this._plugin.setTimeStep(newTimeStep);\n }\n\n /** Get the fixed timestep. */\n public getTimeStep(): number {\n return this._plugin.getTimeStep();\n }\n\n /** Cast a ray through the active Lite Havok world. */\n public raycast(from: Vector3, to: Vector3, query?: IRaycastQuery): PhysicsRaycastResult {\n const result = new PhysicsRaycastResult();\n this.raycastToRef(from, to, result, query);\n return result;\n }\n\n /** Cast a ray through the active Lite Havok world and write into `result`. */\n public raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult, query?: IRaycastQuery): void {\n if (query?.ignoreBody) {\n return unsupported(\n \"PhysicsEngine.raycast.ignoreBody\",\n \"Lite's public raycast query does not accept an ignored body, and adding it would modify the shared Havok query hot path already used by scene bundles.\"\n );\n }\n const world = this._plugin.world;\n if (!world) {\n return unsupported(\"PhysicsEngine.raycast\", \"Call `scene.enablePhysics(...)` before issuing physics queries.\");\n }\n const liteQuery: RaycastQuery = {\n membership: query?.membership,\n collideWith: query?.collideWith,\n shouldHitTriggers: query?.shouldHitTriggers,\n };\n const hit = physicsRaycast(world, from, to, liteQuery);\n result.reset(from, to);\n if (!hit.hasHit) {\n return;\n }\n result.setHitData(hit.hitNormal, hit.hitPoint, hit.triangleIndex);\n result.setHitDistance(hit.hitDistance);\n result.body = hit.body ? getPhysicsBodyWrappers().get(hit.body) : undefined;\n result.shape = result.body?.shape ?? undefined;\n result.bodyIndex = hit.bodyIndex;\n }\n\n /** Release the underlying physics world. */\n public dispose(): void {\n this._plugin.dispose();\n }\n}\n","/**\n * Babylon.js-compatible camera classes implemented over the Babylon Lite camera\n * factories.\n *\n * Babylon.js cameras take the scene in their constructor and become the active\n * camera; these wrappers do the same by assigning `scene.activeCamera` when a\n * scene is supplied. `attachControl()` is a method here (Lite separates it into\n * standalone functions) and returns the detach handle Lite already provides.\n */\n\nimport {\n createArcRotateCamera,\n createBankedFreeCamera,\n createFreeCamera,\n createGeospatialCamera,\n disableOrthographicCamera,\n enableArcRotateKeyboardControls,\n enableOrthographicCamera,\n setGeospatialOrientation,\n attachGeospatialControls,\n attachControl as liteAttachControl,\n attachFreeControl,\n getCameraPosition,\n getViewMatrix as liteGetViewMatrix,\n getProjectionMatrix as liteGetProjectionMatrix,\n onBeforeRender,\n} from \"babylon-lite\";\nimport type {\n ArcRotateCamera as LiteArcRotateCamera,\n BankedFreeCamera as LiteBankedFreeCamera,\n FreeCamera as LiteFreeCamera,\n GeospatialCamera as LiteGeospatialCamera,\n Camera as LiteCamera,\n} from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { liteBackedVector3, Vector3 } from \"../math/vector.js\";\nimport { Matrix } from \"../math/matrix.js\";\nimport { Viewport } from \"../math/size.js\";\nimport { Node } from \"../node/node.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\n/** Babylon.js `Camera` — base class for all cameras (derives from `Node`). */\nexport abstract class Camera extends Node {\n public static readonly PERSPECTIVE_CAMERA = 0;\n public static readonly ORTHOGRAPHIC_CAMERA = 1;\n\n /** @internal Underlying Babylon Lite camera. */\n public abstract readonly _lite: LiteCamera;\n private _detach: (() => void) | undefined;\n private _orthoLeft: number | null = null;\n private _orthoRight: number | null = null;\n private _orthoBottom: number | null = null;\n private _orthoTop: number | null = null;\n\n protected constructor(name: string, scene?: Scene) {\n super(name, scene);\n scene?._registerCamera(this);\n }\n\n public override getClassName(): string {\n return \"Camera\";\n }\n\n public get fov(): number {\n return this._lite.fov;\n }\n public set fov(value: number) {\n this._lite.fov = value;\n }\n\n public get minZ(): number {\n return this._lite.nearPlane;\n }\n public set minZ(value: number) {\n this._lite.nearPlane = value;\n }\n\n public get maxZ(): number {\n return this._lite.farPlane;\n }\n public set maxZ(value: number) {\n this._lite.farPlane = value;\n }\n\n public get orthoLeft(): number | null {\n return this._lite.ortho ? this._lite.ortho.left : this._orthoLeft;\n }\n public set orthoLeft(value: number | null) {\n this._orthoLeft = value;\n if (this._lite.ortho) {\n this._lite.ortho.left = value;\n }\n }\n\n public get orthoRight(): number | null {\n return this._lite.ortho ? this._lite.ortho.right : this._orthoRight;\n }\n public set orthoRight(value: number | null) {\n this._orthoRight = value;\n if (this._lite.ortho) {\n this._lite.ortho.right = value;\n }\n }\n\n public get orthoBottom(): number | null {\n return this._lite.ortho ? this._lite.ortho.bottom : this._orthoBottom;\n }\n public set orthoBottom(value: number | null) {\n this._orthoBottom = value;\n if (this._lite.ortho) {\n this._lite.ortho.bottom = value;\n }\n }\n\n public get orthoTop(): number | null {\n return this._lite.ortho ? this._lite.ortho.top : this._orthoTop;\n }\n public set orthoTop(value: number | null) {\n this._orthoTop = value;\n if (this._lite.ortho) {\n this._lite.ortho.top = value;\n }\n }\n\n public get mode(): number {\n return this._lite.ortho ? Camera.ORTHOGRAPHIC_CAMERA : Camera.PERSPECTIVE_CAMERA;\n }\n public set mode(value: number) {\n if (value === this.mode) {\n return;\n }\n if (value === Camera.ORTHOGRAPHIC_CAMERA) {\n enableOrthographicCamera(this._lite, {\n left: this._orthoLeft,\n right: this._orthoRight,\n bottom: this._orthoBottom,\n top: this._orthoTop,\n });\n return;\n }\n if (value === Camera.PERSPECTIVE_CAMERA) {\n this._orthoLeft = this.orthoLeft;\n this._orthoRight = this.orthoRight;\n this._orthoBottom = this.orthoBottom;\n this._orthoTop = this.orthoTop;\n disableOrthographicCamera(this._lite);\n return;\n }\n unsupported(\"Camera.mode\", `Projection mode ${value} is not supported.`);\n }\n\n public get viewport(): Viewport {\n const viewport = this._lite.viewport;\n if (viewport instanceof Viewport) {\n return viewport;\n }\n const compatViewport = viewport ? new Viewport(viewport.x, viewport.y, viewport.width, viewport.height) : new Viewport(0, 0, 1, 1);\n this._lite.viewport = compatViewport;\n return compatViewport;\n }\n public set viewport(value: Viewport) {\n this._lite.viewport = value;\n }\n\n /** World-space position of the camera. */\n public get globalPosition(): Vector3 {\n const p = getCameraPosition(this._lite);\n return new Vector3(p.x, p.y, p.z);\n }\n\n /** Babylon.js `camera.getViewMatrix()` — the camera's view matrix. */\n public getViewMatrix(): Matrix {\n return Matrix.FromArray(liteGetViewMatrix(this._lite));\n }\n\n /** Babylon.js `camera.getProjectionMatrix()` — the camera's projection matrix. */\n public getProjectionMatrix(): Matrix {\n return Matrix.FromArray(liteGetProjectionMatrix(this._lite, this._aspectRatio()));\n }\n\n private _aspectRatio(): number {\n const scene = this._scene;\n const canvas = scene?.getEngine().getRenderingCanvas() as { width?: number; height?: number } | undefined;\n const w = canvas?.width ?? 1;\n const h = canvas?.height ?? 1;\n const viewport = this._lite.viewport;\n return h !== 0 && (!viewport || viewport.height !== 0) ? (w / h) * (viewport ? viewport.width / viewport.height : 1) : 1;\n }\n\n public abstract attachControl(canvas: HTMLCanvasElement, noPreventDefault?: boolean): void;\n\n public detachControl(): void {\n if (this._detach) {\n this._detach();\n this._detach = undefined;\n }\n }\n\n /** @internal Store the detach handle returned by Lite's attach function. */\n protected _setDetach(detach: () => void): void {\n this._detach = detach;\n }\n\n protected _makeActive(scene: Scene | undefined): void {\n // Babylon.js sets `scene.activeCamera` to the **first** camera constructed\n // against a scene; later cameras are added but do not steal the active\n // slot (e.g. a `CameraGizmo`'s subject camera must not become the view).\n if (scene && !scene.activeCamera) {\n scene.activeCamera = this;\n }\n }\n}\n\nexport class ArcRotateCamera extends Camera {\n /** @internal Underlying Babylon Lite arc-rotate camera. */\n public readonly _lite: LiteArcRotateCamera;\n\n public constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene?: Scene);\n /** @internal Adopt an already-built Lite arc-rotate camera (e.g. from `createDefaultCamera`) instead of creating a new one. */\n public constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene | undefined, adoptLite: LiteArcRotateCamera);\n public constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene?: Scene, adoptLite?: LiteArcRotateCamera) {\n super(name, scene);\n this._lite = adoptLite ?? createArcRotateCamera(alpha, beta, radius, { x: target.x, y: target.y, z: target.z });\n if (!adoptLite) {\n this._makeActive(scene);\n }\n }\n\n public override getClassName(): string {\n return \"ArcRotateCamera\";\n }\n\n public get alpha(): number {\n return this._lite.alpha;\n }\n public set alpha(value: number) {\n this._lite.alpha = value;\n }\n\n public get beta(): number {\n return this._lite.beta;\n }\n public set beta(value: number) {\n this._lite.beta = value;\n }\n\n public get radius(): number {\n return this._lite.radius;\n }\n public set radius(value: number) {\n this._lite.radius = value;\n }\n\n public get target(): Vector3 {\n const t = this._lite.target;\n return new Vector3(t.x, t.y, t.z);\n }\n public set target(value: Vector3) {\n this._lite.target = { x: value.x, y: value.y, z: value.z };\n }\n\n /** Babylon.js `setTarget` — point the arc-rotate camera at a world-space target. */\n public setTarget(target: Vector3): void {\n this.target = target;\n }\n\n public get lowerRadiusLimit(): number | undefined {\n return this._lite.lowerRadiusLimit;\n }\n public set lowerRadiusLimit(value: number | undefined) {\n this._lite.lowerRadiusLimit = value;\n }\n\n public get upperRadiusLimit(): number | undefined {\n return this._lite.upperRadiusLimit;\n }\n public set upperRadiusLimit(value: number | undefined) {\n this._lite.upperRadiusLimit = value;\n }\n\n // These input-tuning fields delegate straight through to the underlying Lite\n // camera so that Babylon.js-style code — which may set them either before or\n // AFTER attachControl — takes effect. Lite's attachControl reads these live on\n // every input event, so a post-attach write (as Babylon.js allows) is honored.\n // Without these accessors a write would land on the wrapper instance and never\n // reach _lite, leaving zoom/orbit/pan at the Lite defaults (e.g. wheel zoom\n // running far too fast because a raised wheelPrecision was silently dropped).\n\n /** Wheel-zoom sensitivity (HIGHER = slower zoom). Babylon default 3. */\n public get wheelPrecision(): number {\n return this._lite.wheelPrecision;\n }\n public set wheelPrecision(value: number) {\n this._lite.wheelPrecision = value;\n }\n\n /** Mouse-drag orbit sensitivity (HIGHER = slower rotation). Babylon default 1000. */\n public get angularSensibility(): number {\n return this._lite.angularSensibility;\n }\n public set angularSensibility(value: number) {\n this._lite.angularSensibility = value;\n }\n\n /** Right-drag panning sensitivity in pixels-per-unit (LOWER = faster pan). Babylon default 50. */\n public get panningSensibility(): number {\n return this._lite.panningSensibility;\n }\n public set panningSensibility(value: number) {\n this._lite.panningSensibility = value;\n }\n\n public attachControl(canvas: HTMLCanvasElement, noPreventDefault = false): void {\n enableArcRotateKeyboardControls();\n const detach = liteAttachControl(this._lite, canvas, this._scene?._lite, { keyboard: { preventDefault: !noPreventDefault } });\n this._setDetach(detach);\n }\n\n /** @internal Wrap an already-built Lite arc-rotate camera (e.g. from `createDefaultCamera`). */\n public static _adopt(name: string, lite: LiteArcRotateCamera, scene?: Scene): ArcRotateCamera {\n return new ArcRotateCamera(name, lite.alpha, lite.beta, lite.radius, new Vector3(lite.target.x, lite.target.y, lite.target.z), scene, lite);\n }\n}\n\n/**\n * Babylon.js `TargetCamera` — a free-moving camera with a look-at target. Base\n * for `FreeCamera`/`UniversalCamera`/`TouchCamera`/`FlyCamera`/`FollowCamera`.\n */\nexport class TargetCamera extends Camera {\n /** @internal Underlying Babylon Lite free camera. */\n public readonly _lite: LiteFreeCamera;\n\n public constructor(name: string, position: Vector3, scene?: Scene);\n /** @internal Adopt an already-built Lite free camera (e.g. one parsed from a `.babylon` file) instead of creating a new one. */\n public constructor(name: string, position: Vector3, scene: Scene | undefined, adoptLite: LiteFreeCamera);\n public constructor(name: string, position: Vector3, scene?: Scene, adoptLite?: LiteFreeCamera) {\n super(name, scene);\n this._lite = adoptLite ?? createFreeCamera({ x: position.x, y: position.y, z: position.z }, { x: position.x, y: position.y, z: position.z - 1 });\n this._makeActive(scene);\n }\n\n public override getClassName(): string {\n return \"TargetCamera\";\n }\n\n public get position(): Vector3 {\n const p = this._lite.position;\n return new Vector3(p.x, p.y, p.z);\n }\n public set position(value: Vector3) {\n this._lite.position.set(value.x, value.y, value.z);\n }\n\n public get speed(): number {\n return this._lite.speed;\n }\n public set speed(value: number) {\n this._lite.speed = value;\n }\n\n /** Babylon.js `setTarget` — aim the camera at a world-space point. */\n public setTarget(target: Vector3): void {\n this._lite.target.set(target.x, target.y, target.z);\n }\n\n public attachControl(canvas: HTMLCanvasElement, _noPreventDefault?: boolean): void {\n const detach = attachFreeControl(this._lite, canvas, this._scene?._lite);\n this._setDetach(detach);\n }\n}\n\n/** Babylon.js `FreeCamera` — keyboard/mouse free camera. */\nexport class FreeCamera extends TargetCamera {\n public override getClassName(): string {\n return \"FreeCamera\";\n }\n\n /** @internal Wrap an already-built Lite free camera (e.g. one parsed from a `.babylon` file). */\n public static _adopt(name: string, lite: LiteFreeCamera, scene?: Scene): FreeCamera {\n const p = lite.position;\n return new FreeCamera(name, new Vector3(p.x, p.y, p.z), scene, lite);\n }\n}\n\n/** Babylon.js `UniversalCamera` — touch-friendly free camera. */\nexport class UniversalCamera extends FreeCamera {\n public override getClassName(): string {\n return \"UniversalCamera\";\n }\n}\n\n/** Babylon.js `TouchCamera` — touch-controlled free camera. */\nexport class TouchCamera extends FreeCamera {\n public override getClassName(): string {\n return \"TouchCamera\";\n }\n}\n\n/** Babylon.js `GamepadCamera` — gamepad-controlled free camera. */\nexport class GamepadCamera extends UniversalCamera {\n public override getClassName(): string {\n return \"GamepadCamera\";\n }\n}\n\n/** Babylon.js `FlyCamera` — 6-DOF free-flight camera. */\nexport class FlyCamera extends TargetCamera {\n /** @internal Underlying banked Babylon Lite free camera. */\n public override readonly _lite: LiteBankedFreeCamera;\n\n public constructor(name: string, position: Vector3, scene?: Scene) {\n const lite = createBankedFreeCamera({ x: position.x, y: position.y, z: position.z }, { x: position.x, y: position.y, z: position.z - 1 });\n super(name, position, scene, lite);\n this._lite = lite;\n }\n\n public get upVector(): Vector3 {\n return liteBackedVector3(this._lite.upVector);\n }\n public set upVector(value: Vector3) {\n this._lite.upVector.set(value.x, value.y, value.z);\n }\n\n public override getClassName(): string {\n return \"FlyCamera\";\n }\n}\n\ninterface LockedTarget {\n position: { x: number; y: number; z: number };\n}\n\n/**\n * Babylon.js `FollowCamera` — follows a `lockedTarget` at a fixed radius /\n * height / rotation offset, updated each frame via the scene's before-render hook.\n */\nexport class FollowCamera extends TargetCamera {\n public lockedTarget: LockedTarget | null = null;\n public radius = 12;\n public heightOffset = 4;\n /** Rotation offset around the target, in degrees. */\n public rotationOffset = 0;\n\n public constructor(name: string, position: Vector3, scene?: Scene, lockedTarget?: LockedTarget) {\n super(name, position, scene);\n this.lockedTarget = lockedTarget ?? null;\n if (scene) {\n onBeforeRender(scene._lite, () => this._follow());\n }\n }\n\n public override getClassName(): string {\n return \"FollowCamera\";\n }\n\n private _follow(): void {\n const target = this.lockedTarget;\n if (!target) {\n return;\n }\n const radians = (this.rotationOffset * Math.PI) / 180;\n const x = target.position.x + this.radius * Math.sin(radians);\n const z = target.position.z + this.radius * Math.cos(radians);\n const y = target.position.y + this.heightOffset;\n this._lite.position.set(x, y, z);\n this.setTarget(new Vector3(target.position.x, target.position.y, target.position.z));\n }\n}\n\n/**\n * Babylon.js `GeospatialCamera` — globe-orbit camera anchored to a surface\n * `center` (ECEF), orbiting at `radius` with `yaw`/`pitch`. Wraps Babylon Lite's\n * `createGeospatialCamera` + `setGeospatialOrientation` (which clamps pitch\n * against the effective max for the current radius, so each orientation field is\n * applied through Lite with the others left at their current values).\n */\nexport class GeospatialCamera extends Camera {\n /** @internal Underlying Babylon Lite geospatial camera. */\n public readonly _lite: LiteGeospatialCamera;\n\n public constructor(name: string, scene?: Scene, options?: { planetRadius: number }) {\n super(name, scene);\n this._lite = createGeospatialCamera({ planetRadius: options?.planetRadius ?? 1 });\n this._makeActive(scene);\n }\n\n public override getClassName(): string {\n return \"GeospatialCamera\";\n }\n\n /** Anchored surface point the camera orbits (ECEF coordinates). */\n public get center(): Vector3 {\n const c = this._lite.center;\n return new Vector3(c.x, c.y, c.z);\n }\n public set center(value: Vector3) {\n setGeospatialOrientation(this._lite, { center: { x: value.x, y: value.y, z: value.z } });\n }\n\n /** Distance from the camera to its centre point. */\n public get radius(): number {\n return this._lite.radius;\n }\n public set radius(value: number) {\n setGeospatialOrientation(this._lite, { radius: value });\n }\n\n /** Yaw about the geocentric up axis (0 = north, π/2 = east). */\n public get yaw(): number {\n return this._lite.yaw;\n }\n public set yaw(value: number) {\n setGeospatialOrientation(this._lite, { yaw: value });\n }\n\n /** Pitch from looking straight down (0) to the horizon (π/2). */\n public get pitch(): number {\n return this._lite.pitch;\n }\n public set pitch(value: number) {\n setGeospatialOrientation(this._lite, { pitch: value });\n }\n\n public attachControl(canvas: HTMLCanvasElement, _noPreventDefault?: boolean): void {\n if (this._scene) {\n const detach = attachGeospatialControls(this._lite, canvas, this._scene._lite);\n this._setDetach(detach);\n }\n }\n}\n\n/** Babylon.js `DeviceOrientationCamera` — device-orientation input is not available in Babylon Lite. */\nexport class DeviceOrientationCamera {\n public constructor() {\n unsupported(\"DeviceOrientationCamera\", \"Device-orientation input is not part of Babylon Lite.\");\n }\n}\n\n/** Babylon.js `WebXRCamera` — WebXR is not part of Babylon Lite. */\nexport class WebXRCamera {\n public constructor() {\n unsupported(\"WebXRCamera\", \"WebXR is not part of Babylon Lite.\");\n }\n}\n\n/** Babylon.js `AnaglyphArcRotateCamera` — stereoscopic camera rigs are not implemented in Babylon Lite. */\nexport class AnaglyphArcRotateCamera {\n public constructor() {\n unsupported(\"AnaglyphArcRotateCamera\", \"Stereoscopic camera rigs are not implemented in Babylon Lite. (An anaglyph post-process exists separately.)\");\n }\n}\n","/**\n * Babylon.js-compatible `Animation` keyframe model + `AnimationGroup`.\n *\n * `Animation` is a pure-JS keyframe container with CPU evaluation (`evaluate`),\n * the Babylon.js data-type / loop-mode constants, and `setKeys`/`getKeys`. Common\n * direct-animation tracks are compiled onto Babylon Lite property groups; the CPU\n * evaluator remains as an explicit fallback for shapes Lite cannot yet preserve.\n * `AnimationGroup` provides the structural grouping/playback-state surface.\n */\n\nimport {\n createPropertyAnimationClip,\n createPropertyAnimationGroup,\n goToFrame as liteGoToFrame,\n playAnimation,\n pauseAnimation,\n stopAnimation,\n setAnimationAdditive,\n addAnimationGroup,\n removeAnimationGroup,\n} from \"babylon-lite\";\nimport type { AnimationGroup as LiteAnimationGroup, AnimationManager, EngineContext, PropertyAnimationInterpolation, PropertyAnimationTrackOptions } from \"babylon-lite\";\n\nimport type { IEasingFunction } from \"./easing.js\";\n\n/** Structural vector/quaternion value accepted by Babylon.js animation keys. */\nexport interface IAnimationVectorValue {\n readonly x: number;\n readonly y: number;\n readonly z?: number;\n readonly w?: number;\n clone(): IAnimationVectorValue;\n asArray(): number[];\n}\n\nexport type AnimationValue = number | number[] | IAnimationVectorValue;\n\nexport interface IAnimationKey {\n frame: number;\n value: AnimationValue;\n /** Babylon.js per-key interpolation hint (`AnimationKeyInterpolation`). */\n interpolation?: number;\n}\n\n/**\n * Babylon.js `AnimationKeyInterpolation` — how the segment starting at a key is\n * interpolated. `STEP` holds the key's value until the next key (no blend).\n */\nexport const AnimationKeyInterpolation = {\n NONE: 0,\n STEP: 1,\n} as const;\n\nexport const AnimationTypes = {\n ANIMATIONTYPE_FLOAT: 0,\n ANIMATIONTYPE_VECTOR3: 1,\n ANIMATIONTYPE_QUATERNION: 2,\n ANIMATIONTYPE_MATRIX: 3,\n ANIMATIONTYPE_COLOR3: 4,\n ANIMATIONTYPE_VECTOR2: 5,\n ANIMATIONTYPE_COLOR4: 6,\n} as const;\n\nexport const AnimationLoopModes = {\n ANIMATIONLOOPMODE_RELATIVE: 0,\n ANIMATIONLOOPMODE_CYCLE: 1,\n ANIMATIONLOOPMODE_CONSTANT: 2,\n} as const;\n\nexport class Animation {\n public static readonly ANIMATIONTYPE_FLOAT = AnimationTypes.ANIMATIONTYPE_FLOAT;\n public static readonly ANIMATIONTYPE_VECTOR3 = AnimationTypes.ANIMATIONTYPE_VECTOR3;\n public static readonly ANIMATIONTYPE_QUATERNION = AnimationTypes.ANIMATIONTYPE_QUATERNION;\n public static readonly ANIMATIONTYPE_MATRIX = AnimationTypes.ANIMATIONTYPE_MATRIX;\n public static readonly ANIMATIONTYPE_COLOR3 = AnimationTypes.ANIMATIONTYPE_COLOR3;\n public static readonly ANIMATIONTYPE_VECTOR2 = AnimationTypes.ANIMATIONTYPE_VECTOR2;\n public static readonly ANIMATIONTYPE_COLOR4 = AnimationTypes.ANIMATIONTYPE_COLOR4;\n public static readonly ANIMATIONLOOPMODE_RELATIVE = AnimationLoopModes.ANIMATIONLOOPMODE_RELATIVE;\n public static readonly ANIMATIONLOOPMODE_CYCLE = AnimationLoopModes.ANIMATIONLOOPMODE_CYCLE;\n public static readonly ANIMATIONLOOPMODE_CONSTANT = AnimationLoopModes.ANIMATIONLOOPMODE_CONSTANT;\n\n private _keys: IAnimationKey[] = [];\n private _easingFunction: IEasingFunction | null = null;\n\n public constructor(\n public name: string,\n public targetProperty: string,\n public framePerSecond: number,\n public dataType: number = AnimationTypes.ANIMATIONTYPE_FLOAT,\n public loopMode: number = AnimationLoopModes.ANIMATIONLOOPMODE_CYCLE\n ) {}\n\n public setKeys(keys: IAnimationKey[]): void {\n this._keys = keys.slice().sort((a, b) => a.frame - b.frame);\n }\n\n public getKeys(): IAnimationKey[] {\n return this._keys;\n }\n\n public getHighestFrame(): number {\n return this._keys.length > 0 ? this._keys[this._keys.length - 1]!.frame : 0;\n }\n\n /**\n * Assigns the easing function used to transform each non-STEP segment's normalized progress.\n * @param easingFunction - A Babylon.js-shaped easing object, or `null` to restore linear progress.\n */\n public setEasingFunction(easingFunction: IEasingFunction | null): void {\n this._easingFunction = easingFunction;\n }\n\n /**\n * Gets the easing function currently assigned to this animation.\n * @returns The assigned easing object, or `null` when interpolation uses linear progress.\n */\n public getEasingFunction(): IEasingFunction | null {\n return this._easingFunction;\n }\n\n /** Evaluate the animated value at `frame`, clamped to the key range. */\n public evaluate(frame: number): AnimationValue {\n const keys = this._keys;\n if (keys.length === 0) {\n return 0;\n }\n if (frame <= keys[0]!.frame) {\n return keys[0]!.value;\n }\n if (frame >= keys[keys.length - 1]!.frame) {\n return keys[keys.length - 1]!.value;\n }\n for (let i = 0; i < keys.length - 1; i++) {\n const a = keys[i]!;\n const b = keys[i + 1]!;\n // Half-open `[a, b)` so an exact key frame belongs to the segment it\n // starts (matters for STEP, where the value changes _at_ the next key).\n if (frame >= a.frame && frame < b.frame) {\n // Babylon.js `AnimationKeyInterpolation.STEP` holds the start key's\n // value across the whole segment (no blend to the next key).\n if (a.interpolation === AnimationKeyInterpolation.STEP) {\n return a.value;\n }\n const gradient = (frame - a.frame) / (b.frame - a.frame);\n return interpolateValue(a.value, b.value, this._easingFunction?.ease(gradient) ?? gradient, this.dataType);\n }\n }\n return keys[keys.length - 1]!.value;\n }\n\n /** Babylon.js helper: build a one-shot float animation between two values. */\n public static CreateAndStartAnimation(name: string, _target: unknown, targetProperty: string, framePerSecond: number, totalFrame: number, from: number, to: number): Animation {\n const anim = new Animation(name, targetProperty, framePerSecond);\n anim.setKeys([\n { frame: 0, value: from },\n { frame: totalFrame, value: to },\n ]);\n return anim;\n }\n}\n\nfunction interpolateValue(a: AnimationValue, b: AnimationValue, t: number, dataType: number): AnimationValue {\n if (typeof a === \"number\" && typeof b === \"number\") {\n return a + (b - a) * t;\n }\n if (typeof a === \"number\" || typeof b === \"number\") {\n return a;\n }\n const stride = supportedStride(dataType) || animationComponents(a).length;\n const av = readAnimationComponents(a, stride);\n const bv = readAnimationComponents(b, stride);\n if (!av || !bv) {\n return a;\n }\n const values = dataType === AnimationTypes.ANIMATIONTYPE_QUATERNION ? slerpQuaternion(av, bv, t) : av.map((value, i) => value + (bv[i]! - value) * t);\n return cloneAnimationValue(a, values);\n}\n\nfunction readAnimationComponents(value: AnimationValue, stride: number): number[] | undefined {\n if (typeof value === \"number\") {\n return stride === 1 && Number.isFinite(value) ? [value] : undefined;\n }\n const components = Array.isArray(value) ? value : value.asArray();\n return components.length === stride && components.every(Number.isFinite) ? components.slice() : undefined;\n}\n\nfunction animationComponents(value: AnimationValue): number[] {\n return typeof value === \"number\" ? [value] : Array.isArray(value) ? value : value.asArray();\n}\n\nfunction cloneAnimationValue(template: Exclude<AnimationValue, number>, components: number[]): AnimationValue {\n if (Array.isArray(template)) {\n return components;\n }\n const clone = template.clone();\n const writable = clone as { x: number; y: number; z?: number; w?: number };\n writable.x = components[0]!;\n writable.y = components[1]!;\n if (components.length > 2) {\n writable.z = components[2]!;\n }\n if (components.length > 3) {\n writable.w = components[3]!;\n }\n return clone;\n}\n\nfunction slerpQuaternion(a: readonly number[], b: readonly number[], gradient: number): number[] {\n let bx = b[0]!;\n let by = b[1]!;\n let bz = b[2]!;\n let bw = b[3]!;\n let dot = a[0]! * bx + a[1]! * by + a[2]! * bz + a[3]! * bw;\n if (dot < 0) {\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n dot = -dot;\n }\n if (dot > 0.999999) {\n return [(1 - gradient) * a[0]! + gradient * bx, (1 - gradient) * a[1]! + gradient * by, (1 - gradient) * a[2]! + gradient * bz, (1 - gradient) * a[3]! + gradient * bw];\n }\n const angle = Math.acos(Math.min(dot, 1));\n const sine = Math.sin(angle);\n const startWeight = Math.sin((1 - gradient) * angle) / sine;\n const endWeight = Math.sin(gradient * angle) / sine;\n return [startWeight * a[0]! + endWeight * bx, startWeight * a[1]! + endWeight * by, startWeight * a[2]! + endWeight * bz, startWeight * a[3]! + endWeight * bw];\n}\n\ntype AnimValue = AnimationValue;\n\nfunction scaleValue(value: AnimValue, scale: number): AnimValue {\n if (typeof value === \"number\") {\n return value * scale;\n }\n const components = animationComponents(value);\n return components.map((component) => component * scale);\n}\n\nfunction addValue(acc: AnimValue, value: AnimValue): AnimValue {\n if (typeof acc === \"number\" && typeof value === \"number\") {\n return acc + value;\n }\n const a = animationComponents(acc);\n const v = animationComponents(value);\n return a.map((component, i) => component + (v[i] ?? 0));\n}\n\nfunction subtractValue(value: AnimValue, base: AnimValue): AnimValue {\n return addValue(value, scaleValue(base, -1));\n}\n\nfunction zeroLike(value: AnimValue): AnimValue {\n return typeof value === \"number\" ? 0 : animationComponents(value).map(() => 0);\n}\n\n/**\n * @internal Pre-animation baseline of each blended property, captured the first\n * time a structural group starts. Babylon.js mixes this \"original value\" back in\n * when a property's total animation weight is below 1 (so partially-weighted\n * blends settle toward the rest pose); keyed by target object → dotted path.\n */\nconst structuralOriginals = new WeakMap<object, Map<string, AnimValue>>();\n\nfunction readPath(target: object, path: string): AnimValue {\n const parts = path.split(\".\");\n let obj = target as Record<string, unknown>;\n for (let i = 0; i < parts.length - 1; i++) {\n const next = obj[parts[i]!];\n if (next == null) {\n return 0;\n }\n obj = next as Record<string, unknown>;\n }\n const leaf = obj[parts[parts.length - 1]!];\n return isAnimationValue(leaf) ? leaf : 0;\n}\n\nfunction captureOriginal(target: object, path: string): void {\n let perTarget = structuralOriginals.get(target);\n if (!perTarget) {\n perTarget = new Map();\n structuralOriginals.set(target, perTarget);\n }\n if (!perTarget.has(path)) {\n perTarget.set(path, snapshotValue(readPath(target, path)));\n }\n}\n\nfunction snapshotValue(value: AnimValue): AnimValue {\n if (typeof value === \"number\") {\n return value;\n }\n return cloneAnimationValue(value, animationComponents(value));\n}\n\n/** @internal Assign an animated value to `target` following a dotted property path (e.g. `\"position.x\"`). */\nfunction applyAnimatedValue(target: unknown, path: string, value: AnimationValue): void {\n const parts = path.split(\".\");\n let obj = target as Record<string, unknown>;\n for (let i = 0; i < parts.length - 1; i++) {\n const next = obj[parts[i]!];\n if (next == null) {\n return;\n }\n obj = next as Record<string, unknown>;\n }\n const leaf = parts[parts.length - 1]!;\n if (typeof value !== \"number\") {\n const components = animationComponents(value);\n const slot = obj[leaf] as { set?: (...n: number[]) => void } | undefined;\n if (slot && typeof slot.set === \"function\") {\n slot.set(...components);\n } else {\n obj[leaf] = value;\n }\n } else {\n obj[leaf] = value;\n }\n}\n\nfunction isAnimationValue(value: unknown): value is AnimationValue {\n return typeof value === \"number\" || Array.isArray(value) || isAnimationVectorValue(value);\n}\n\nfunction isAnimationVectorValue(value: unknown): value is IAnimationVectorValue {\n return (\n (typeof value === \"object\" || typeof value === \"function\") &&\n value !== null &&\n typeof (value as { x?: unknown }).x === \"number\" &&\n typeof (value as { y?: unknown }).y === \"number\" &&\n typeof (value as { clone?: unknown }).clone === \"function\" &&\n typeof (value as { asArray?: unknown }).asArray === \"function\"\n );\n}\n\ninterface AnimatableNativeState {\n readonly manager: AnimationManager | undefined;\n readonly group: LiteAnimationGroup | undefined;\n readonly fallbackAnimations: readonly Animation[];\n readonly fallbackReason: string | undefined;\n}\n\n/**\n * Babylon.js `Animatable` facade. Supported direct-animation tracks delegate to a\n * native Lite property group; unsupported tracks retain the compat CPU evaluator.\n */\nexport class Animatable {\n public masterFrame = 0;\n /** @internal Lite group backing a natively-delegated property animation. */\n public readonly _lite?: LiteAnimationGroup;\n /** @internal Reason all or part of this animatable retained the compat CPU evaluator. */\n public readonly _nativeFallbackReason?: string;\n\n private _speedRatio: number;\n private _paused = false;\n private _stopped = false;\n private readonly _nativeManager: AnimationManager | undefined;\n private readonly _fallbackAnimations: readonly Animation[];\n private readonly _fallbackFrames = new Map<Animation, number>();\n private readonly _fallbackElapsedFrames = new Map<Animation, number>();\n private readonly _fallbackRepeatCounts = new Map<Animation, number>();\n private readonly _completedFallbackAnimations = new Set<Animation>();\n\n public constructor(target: unknown, animations: Animation[], from: number, to: number, loop: boolean, speedRatio: number);\n /** @internal */\n public constructor(target: unknown, animations: Animation[], from: number, to: number, loop: boolean, speedRatio: number, nativeState: AnimatableNativeState);\n public constructor(\n private readonly _target: unknown,\n private readonly _animations: Animation[],\n private readonly _from: number,\n private readonly _to: number,\n private readonly _loop: boolean,\n speedRatio: number,\n nativeState?: AnimatableNativeState\n ) {\n this._speedRatio = speedRatio;\n this._nativeManager = nativeState?.manager;\n this._lite = nativeState?.group;\n this._fallbackAnimations = nativeState?.fallbackAnimations ?? _animations;\n this._nativeFallbackReason = nativeState?.fallbackReason;\n this.masterFrame = _from;\n for (const animation of this._fallbackAnimations) {\n this._resetFallbackAnimation(animation, _from);\n }\n if (this._lite) {\n liteGoToFrame(this._lite, _from);\n playAnimation(this._lite);\n }\n this._applyFallback();\n }\n\n /** @internal Create one facade over the native-supported and explicit fallback subsets. */\n public static _create(\n getManager: () => AnimationManager,\n target: unknown,\n animations: readonly Animation[],\n from: number,\n to: number,\n loop: boolean,\n speedRatio: number,\n blockedNativeBindings: readonly AnimationBinding[] = []\n ): Animatable {\n const partition = partitionAnimations(target, animations, from, to, speedRatio, blockedNativeBindings);\n const nativeManager = partition.nativeAnimations.length > 0 ? getManager() : undefined;\n const nativeGroup = nativeManager ? createNativeAnimationGroup(nativeManager, target, partition.nativeAnimations, from, to, loop, speedRatio) : undefined;\n return new Animatable(target, animations.slice(), from, to, loop, speedRatio, {\n manager: nativeManager,\n group: nativeGroup,\n fallbackAnimations: partition.fallbackAnimations,\n fallbackReason: partition.fallbackReasons.length > 0 ? partition.fallbackReasons.join(\"; \") : undefined,\n });\n }\n\n /** @internal Return why any track cannot preserve its semantics on Lite, or undefined when all are supported. */\n public static _getNativeFallbackReason(target: unknown, animations: readonly Animation[], from: number, to: number, speedRatio: number): string | undefined {\n const reasons = partitionAnimations(target, animations, from, to, speedRatio, []).fallbackReasons;\n return reasons.length > 0 ? reasons.join(\"; \") : undefined;\n }\n\n /** @internal Return fallback bindings that must keep later overlapping writes on the same evaluator, including stopped animatables that may restart. */\n public _getBlockingFallbackBindings(): readonly AnimationBinding[] {\n return this._fallbackAnimations.map((animation) => resolveAnimationBinding(this._target, animation.targetProperty)).filter(isAnimationBinding);\n }\n\n public get speedRatio(): number {\n return this._speedRatio;\n }\n\n public set speedRatio(value: number) {\n if (this._lite && (!Number.isFinite(value) || value < 0)) {\n throw new Error(\"Native compat property animations require a finite non-negative speedRatio\");\n }\n this._speedRatio = value;\n if (this._lite) {\n this._lite.speedRatio = value;\n }\n }\n\n /** @internal Advance the animation by `deltaMs`, called once per scene frame. */\n public _tick(deltaMs: number): void {\n if (this._paused || this._stopped) {\n return;\n }\n if (this._lite) {\n this.masterFrame = this._lite.currentTime * (this._animations[0]?.framePerSecond ?? 60);\n const fallbackRunning = this._advanceFallback(deltaMs);\n this._applyFallback();\n if (!this._loop && this._lite._stopped && !fallbackRunning) {\n this._detachLite();\n this._stopped = true;\n }\n return;\n }\n const anyFallbackRunning = this._advanceFallback(deltaMs);\n this.masterFrame = this._fallbackFrames.get(this._animations[0]!) ?? this._from;\n this._applyFallback();\n if (!this._loop && !anyFallbackRunning) {\n this._stopped = true;\n }\n }\n\n public goToFrame(frame: number): void {\n this._completedFallbackAnimations.clear();\n for (const animation of this._fallbackAnimations) {\n this._resetFallbackAnimation(animation, frame);\n }\n if (this._lite) {\n liteGoToFrame(this._lite, frame);\n this.masterFrame = this._lite.currentTime * (this._lite.frameRate ?? 60);\n if (!this._paused && !this._stopped) {\n playAnimation(this._lite);\n }\n } else {\n this.masterFrame = clampAnimationFrame(this._animations[0], frame);\n }\n this._applyFallback();\n }\n\n public pause(): void {\n this._paused = true;\n if (this._lite) {\n pauseAnimation(this._lite);\n this._detachLite();\n }\n }\n\n public restart(): void {\n const restartFromBeginning = this._stopped;\n this._paused = false;\n this._stopped = false;\n if (restartFromBeginning) {\n this.masterFrame = this._from;\n this._completedFallbackAnimations.clear();\n for (const animation of this._fallbackAnimations) {\n this._resetFallbackAnimation(animation, this._from);\n }\n }\n if (this._lite) {\n if (restartFromBeginning) {\n liteGoToFrame(this._lite, this._from);\n }\n this._attachLite();\n playAnimation(this._lite);\n }\n if (restartFromBeginning) {\n this._applyFallback();\n }\n }\n\n public stop(): void {\n this._paused = false;\n this._stopped = true;\n if (this._lite) {\n stopAnimation(this._lite);\n this._detachLite();\n }\n }\n\n public get animationStarted(): boolean {\n return !this._paused && !this._stopped;\n }\n\n private _applyFallback(): void {\n for (const anim of this._fallbackAnimations) {\n const frame = this._fallbackFrames.get(anim) ?? this.masterFrame;\n let value = anim.evaluate(frame);\n if (this._loop) {\n const repeatCount = this._fallbackRepeatCounts.get(anim) ?? 0;\n const [, to] = animationPlaybackRange(anim, this._from, this._to);\n if (anim.loopMode === AnimationLoopModes.ANIMATIONLOOPMODE_CONSTANT && repeatCount > 0) {\n value = anim.evaluate(to);\n } else if (anim.loopMode === AnimationLoopModes.ANIMATIONLOOPMODE_RELATIVE && repeatCount > 0) {\n const [from] = animationPlaybackRange(anim, this._from, this._to);\n value = addValue(value, scaleValue(subtractValue(anim.evaluate(to), anim.evaluate(from)), repeatCount));\n }\n }\n applyAnimatedValue(this._target, anim.targetProperty, value);\n }\n }\n\n private _advanceFallback(deltaMs: number): boolean {\n let anyRunning = false;\n for (const animation of this._fallbackAnimations) {\n if (this._completedFallbackAnimations.has(animation)) {\n continue;\n }\n const [from, to] = animationPlaybackRange(animation, this._from, this._to);\n const frameRange = to - from;\n let elapsedFrames = (this._fallbackElapsedFrames.get(animation) ?? 0) + (deltaMs / 1000) * animation.framePerSecond * this._speedRatio;\n const reachedEnd = frameRange >= 0 ? elapsedFrames >= frameRange : elapsedFrames <= frameRange;\n let repeatCount = 0;\n let frame: number;\n if (this._loop) {\n repeatCount = frameRange === 0 ? 0 : Math.max(0, Math.trunc(elapsedFrames / frameRange));\n frame = frameRange === 0 ? to : from + (elapsedFrames % frameRange);\n anyRunning = true;\n } else if (reachedEnd) {\n elapsedFrames = frameRange;\n frame = to;\n this._completedFallbackAnimations.add(animation);\n } else {\n frame = from + elapsedFrames;\n anyRunning = true;\n }\n this._fallbackElapsedFrames.set(animation, elapsedFrames);\n this._fallbackRepeatCounts.set(animation, repeatCount);\n this._fallbackFrames.set(animation, frame);\n }\n return anyRunning;\n }\n\n private _resetFallbackAnimation(animation: Animation, frame: number): void {\n const [from] = animationPlaybackRange(animation, this._from, this._to);\n const clampedFrame = clampAnimationFrame(animation, frame);\n this._fallbackFrames.set(animation, clampedFrame);\n this._fallbackElapsedFrames.set(animation, clampedFrame - from);\n this._fallbackRepeatCounts.set(animation, 0);\n }\n\n private _attachLite(): void {\n if (this._nativeManager && this._lite) {\n addAnimationGroup(this._nativeManager, this._lite);\n }\n }\n\n private _detachLite(): void {\n if (this._nativeManager && this._lite) {\n removeAnimationGroup(this._nativeManager, this._lite);\n }\n }\n}\n\ninterface NativeAnimationPartition {\n readonly nativeAnimations: readonly Animation[];\n readonly fallbackAnimations: readonly Animation[];\n readonly fallbackReasons: readonly string[];\n}\n\nfunction partitionAnimations(\n target: unknown,\n animations: readonly Animation[],\n from: number,\n to: number,\n speedRatio: number,\n blockedNativeBindings: readonly AnimationBinding[]\n): NativeAnimationPartition {\n const globalReason = getGlobalNativeFallbackReason(animations, from, to, speedRatio);\n if (globalReason) {\n return { nativeAnimations: [], fallbackAnimations: animations.slice(), fallbackReasons: [globalReason] };\n }\n\n const reasons = new Map<Animation, string>();\n for (const animation of animations) {\n const reason = getTrackNativeFallbackReason(target, animation, from, to);\n if (reason) {\n reasons.set(animation, reason);\n }\n }\n\n let changed = true;\n while (changed) {\n changed = false;\n const fallbackPaths = animations.filter((animation) => reasons.has(animation)).map((animation) => animation.targetProperty);\n const fallbackBindings = [\n ...blockedNativeBindings,\n ...animations\n .filter((animation) => reasons.has(animation))\n .map((animation) => resolveAnimationBinding(target, animation.targetProperty))\n .filter(isAnimationBinding),\n ];\n for (const animation of animations) {\n const binding = resolveAnimationBinding(target, animation.targetProperty);\n if (\n !reasons.has(animation) &&\n (fallbackPaths.some((path) => pathsOverlap(path, animation.targetProperty)) ||\n (binding !== undefined && fallbackBindings.some((fallbackBinding) => bindingsOverlap(binding, fallbackBinding))))\n ) {\n reasons.set(animation, `native property animation path \"${animation.targetProperty}\" overlaps a compat fallback path`);\n changed = true;\n }\n }\n }\n\n return {\n nativeAnimations: animations.filter((animation) => !reasons.has(animation)),\n fallbackAnimations: animations.filter((animation) => reasons.has(animation)),\n fallbackReasons: [...new Set(reasons.values())],\n };\n}\n\nfunction getGlobalNativeFallbackReason(animations: readonly Animation[], from: number, to: number, speedRatio: number): string | undefined {\n if (animations.length === 0) {\n return \"native property animation requires at least one Animation\";\n }\n if (!Number.isFinite(from) || !Number.isFinite(to) || !(to > from)) {\n return \"native property animation requires a finite forward play range\";\n }\n if (!Number.isFinite(speedRatio) || speedRatio < 0) {\n return \"native property animation does not delegate reverse or non-finite speed ratios\";\n }\n const frameRate = animations[0]!.framePerSecond;\n if (!(frameRate > 0) || !Number.isFinite(frameRate)) {\n return \"native property animation requires a finite positive frame rate\";\n }\n if (animations.some((animation) => animation.framePerSecond !== frameRate)) {\n return \"native property animation requires one shared frame rate\";\n }\n return undefined;\n}\n\nfunction getTrackNativeFallbackReason(target: unknown, animation: Animation, from: number, to: number): string | undefined {\n if (animation.loopMode !== AnimationLoopModes.ANIMATIONLOOPMODE_CYCLE) {\n return `native property animation track \"${animation.targetProperty}\" requires cycle loop mode`;\n }\n const stride = supportedStride(animation.dataType);\n if (stride === 0) {\n return `native property animation track \"${animation.targetProperty}\" has an unsupported data type`;\n }\n const keys = animation.getKeys();\n if (keys.length === 0) {\n return `native property animation track \"${animation.targetProperty}\" requires at least one key`;\n }\n let previousFrame = -Infinity;\n for (const key of keys) {\n if (!Number.isFinite(key.frame) || key.frame < 0 || key.frame <= previousFrame || !isSupportedKeyValue(key.value, stride)) {\n return `native property animation track \"${animation.targetProperty}\" has an unsupported key frame or value`;\n }\n previousFrame = key.frame;\n }\n if (from < keys[0]!.frame || to > keys[keys.length - 1]!.frame) {\n return `native property animation track \"${animation.targetProperty}\" does not cover the requested play range`;\n }\n if (!uniformInterpolation(keys)) {\n return `native property animation track \"${animation.targetProperty}\" mixes STEP and LINEAR segments`;\n }\n if (!supportsNativeBinding(target, animation.targetProperty, stride)) {\n return `native property animation path \"${animation.targetProperty}\" is not writable by the native binding`;\n }\n return undefined;\n}\n\nfunction createNativeAnimationGroup(\n manager: AnimationManager,\n target: unknown,\n animations: readonly Animation[],\n from: number,\n to: number,\n loop: boolean,\n speedRatio: number\n): LiteAnimationGroup {\n const tracks: PropertyAnimationTrackOptions[] = animations.map((animation) => {\n const stride = supportedStride(animation.dataType);\n return {\n path: animation.targetProperty,\n frameRate: animation.framePerSecond,\n interpolation: trackInterpolation(animation.getKeys()),\n quaternion: animation.dataType === AnimationTypes.ANIMATIONTYPE_QUATERNION,\n easing: (gradient) => animation.getEasingFunction()?.ease(gradient) ?? gradient,\n keys: animation.getKeys().map((key) => ({ frame: key.frame, value: toNativeKeyValue(key.value, stride) })),\n };\n });\n const clip = createPropertyAnimationClip(animations[0]!.name, tracks, { frameRate: animations[0]!.framePerSecond });\n return createPropertyAnimationGroup(manager, target as object, clip, { fromFrame: from, toFrame: to, loop, speedRatio });\n}\n\nfunction supportedStride(dataType: number): number {\n switch (dataType) {\n case AnimationTypes.ANIMATIONTYPE_FLOAT:\n return 1;\n case AnimationTypes.ANIMATIONTYPE_VECTOR2:\n return 2;\n case AnimationTypes.ANIMATIONTYPE_VECTOR3:\n return 3;\n case AnimationTypes.ANIMATIONTYPE_QUATERNION:\n return 4;\n default:\n return 0;\n }\n}\n\nfunction isSupportedKeyValue(value: AnimationValue, stride: number): boolean {\n return readAnimationComponents(value, stride) !== undefined;\n}\n\nfunction toNativeKeyValue(value: AnimationValue, stride: number): number | number[] {\n if (typeof value === \"number\") {\n return value;\n }\n return readAnimationComponents(value, stride)!;\n}\n\nfunction pathsOverlap(a: string, b: string): boolean {\n return a === b || a.startsWith(`${b}.`) || b.startsWith(`${a}.`);\n}\n\ninterface AnimationBinding {\n readonly root: object;\n readonly path: string;\n readonly target: object;\n readonly property: string;\n}\n\nfunction resolveAnimationBinding(target: unknown, path: string): AnimationBinding | undefined {\n const parts = path.split(\".\");\n if (parts.length === 0 || parts.some((part) => part.length === 0) || (typeof target !== \"object\" && typeof target !== \"function\") || target === null) {\n return undefined;\n }\n const root = target;\n let owner: unknown = target;\n for (let i = 0; i < parts.length - 1; i++) {\n if ((typeof owner !== \"object\" && typeof owner !== \"function\") || owner === null) {\n return undefined;\n }\n owner = (owner as Record<string, unknown>)[parts[i]!];\n }\n return (typeof owner === \"object\" || typeof owner === \"function\") && owner !== null ? { root, path, target: owner, property: parts[parts.length - 1]! } : undefined;\n}\n\nfunction bindingsOverlap(a: AnimationBinding, b: AnimationBinding): boolean {\n return (a.root === b.root && pathsOverlap(a.path, b.path)) || (a.target === b.target && a.property === b.property);\n}\n\nfunction isAnimationBinding(binding: AnimationBinding | undefined): binding is AnimationBinding {\n return binding !== undefined;\n}\n\nfunction clampAnimationFrame(animation: Animation | undefined, frame: number): number {\n const keys = animation?.getKeys();\n if (!keys || keys.length === 0) {\n return frame;\n }\n return Math.min(Math.max(frame, keys[0]!.frame), keys[keys.length - 1]!.frame);\n}\n\nfunction animationPlaybackRange(animation: Animation, from: number, to: number): readonly [number, number] {\n const keys = animation.getKeys();\n if (keys.length === 0) {\n return [from, to];\n }\n const min = keys[0]!.frame;\n const max = keys[keys.length - 1]!.frame;\n return [from < min || from > max ? min : from, to < min || to > max ? max : to];\n}\n\nfunction uniformInterpolation(keys: readonly IAnimationKey[]): boolean {\n let mode: number | undefined;\n for (let i = 0; i < keys.length - 1; i++) {\n const keyMode = keys[i]!.interpolation === AnimationKeyInterpolation.STEP ? AnimationKeyInterpolation.STEP : AnimationKeyInterpolation.NONE;\n mode ??= keyMode;\n if (mode !== keyMode) {\n return false;\n }\n }\n return true;\n}\n\nfunction trackInterpolation(keys: readonly IAnimationKey[]): PropertyAnimationInterpolation {\n return keys.length > 1 && keys[0]!.interpolation === AnimationKeyInterpolation.STEP ? \"step\" : \"linear\";\n}\n\nfunction supportsNativeBinding(target: unknown, path: string, stride: number): boolean {\n const parts = path.split(\".\");\n if (parts.length === 0 || parts.some((part) => part.length === 0)) {\n return false;\n }\n let owner: unknown = target;\n for (let i = 0; i < parts.length - 1; i++) {\n if ((typeof owner !== \"object\" && typeof owner !== \"function\") || owner === null) {\n return false;\n }\n const record = owner as Record<string, unknown>;\n const part = parts[i]!;\n if (!(part in record)) {\n return false;\n }\n owner = record[part];\n }\n if ((typeof owner !== \"object\" && typeof owner !== \"function\") || owner === null) {\n return false;\n }\n const record = owner as Record<string, unknown>;\n const property = parts[parts.length - 1]!;\n if (!(property in record)) {\n return false;\n }\n const value = record[property];\n return stride === 1\n ? typeof value === \"number\"\n : (typeof value === \"object\" || typeof value === \"function\") && value !== null && typeof (value as { set?: unknown }).set === \"function\";\n}\n\nexport type AnimationGroupState = \"init\" | \"playing\" | \"paused\" | \"stopped\";\n\n/**\n * @internal Surface a structural `AnimationGroup` needs from its host scene to be\n * stepped + weight-blended each frame. Typed structurally to avoid a Scene import\n * cycle.\n */\nexport interface StructuralAnimationHost {\n /** @internal Register a structural group to be stepped + blended each frame. */\n _registerStructuralGroup(group: AnimationGroup): void;\n /** @internal Re-run weighted blending across all structural groups. */\n _recomputeStructuralBlends(): void;\n}\n\n/**\n * @internal Surface a **loaded** glTF/.babylon `AnimationGroup` needs from its\n * host scene to enable Babylon Lite's weighted / additive skeletal blending.\n * Implemented structurally by the compat `Scene` to avoid an import cycle.\n */\nexport interface LoadedAnimationBlendHost {\n /**\n * @internal Route the scene's loaded Lite animation groups through a\n * scene-owned `AnimationManager` with blending enabled (idempotent).\n */\n _enableLoadedBlend(): void;\n}\n\n/**\n * Babylon.js `AnimationGroup` — a named collection of targeted animations with\n * playback state. This is the **single** `AnimationGroup` type, matching Babylon.js;\n * there is no separate \"loaded\" subtype. Two construction paths map onto Lite:\n *\n * - **Structural** (`new AnimationGroup(name, scene?)`): a CPU-side collection\n * built by ported code via `addTargetedAnimation`. When `start`ed it registers\n * with the scene and is stepped each frame on the CPU; multiple groups that\n * animate the same property are **weight-blended** (Babylon.js manual weighted\n * / cross-fade blending) before the result is written to the target.\n * - **Loaded** (`AnimationGroup._fromLite`, used to populate `scene.animationGroups`\n * from glTF / `.babylon` clips): a thin wrapper over a Babylon Lite loaded group.\n * The playback methods (`goToFrame`/`play`/`pause`/`stop`/`reset`) and the\n * `from`/`to`/`isPlaying`/`speedRatio`/`loopAnimation`/`weight`/`animatables`\n * accessors delegate to the Lite group so ported scenes can freeze/seek a\n * loaded animation at a deterministic frame.\n */\nexport class AnimationGroup {\n public readonly targetedAnimations: Array<{ animation: Animation; target: unknown }> = [];\n public onAnimationGroupEndObservable?: () => void;\n\n /** @internal Babylon Lite loaded-group backing (set only on the loaded path). */\n public _lite?: LiteAnimationGroup;\n /** @internal Engine context used to drive Lite-backed playback. */\n private _engine?: EngineContext;\n /** @internal Host scene that owns the loaded-group blend manager (loaded path). */\n private _blendHost?: LoadedAnimationBlendHost;\n\n private _from = 0;\n private _to = 0;\n private _state: AnimationGroupState = \"init\";\n private _speedRatio = 1;\n private _loopAnimation = false;\n /** @internal Blend weight for the structural path (loaded path reads `_lite.weight`). */\n private _weight = 1;\n /** @internal Current frame for the structural path. */\n private _currentFrame = 0;\n /** @internal Host scene that steps + blends this structural group each frame. */\n private readonly _host?: StructuralAnimationHost;\n\n public constructor(\n public name: string,\n scene?: unknown\n ) {\n this._host = (scene as StructuralAnimationHost | undefined) ?? undefined;\n }\n\n /** @internal Build an `AnimationGroup` backed by a Babylon Lite loaded group. */\n public static _fromLite(lite: LiteAnimationGroup, engine: EngineContext, blendHost?: LoadedAnimationBlendHost): AnimationGroup {\n const group = new AnimationGroup(lite.name);\n group._lite = lite;\n group._engine = engine;\n group._blendHost = blendHost;\n return group;\n }\n\n /**\n * Babylon.js `AnimationGroup.MakeAnimationAdditive(group)` — convert a loaded\n * group into an additive layer (reference frame 0) and enable the scene's\n * weighted-blend manager. Returns the same group (Babylon Lite mutates in\n * place rather than cloning).\n */\n public static MakeAnimationAdditive(group: AnimationGroup): AnimationGroup {\n if (group._lite) {\n setAnimationAdditive(group._lite, { referenceFrame: 0 });\n group._blendHost?._enableLoadedBlend();\n }\n return group;\n }\n\n /** First frame of the clip. Always 0 for loaded clips. */\n public get from(): number {\n return this._lite ? 0 : this._from;\n }\n\n /** Last frame of the clip. */\n public get to(): number {\n return this._lite ? this._lite.duration * (this._lite.frameRate ?? 60) : this._to;\n }\n\n public get isPlaying(): boolean {\n return this._lite ? this._lite.isPlaying : this._state === \"playing\";\n }\n\n public get state(): AnimationGroupState {\n if (this._lite) {\n return this._lite.isPlaying ? \"playing\" : \"paused\";\n }\n return this._state;\n }\n\n public get speedRatio(): number {\n return this._lite ? this._lite.speedRatio : this._speedRatio;\n }\n public set speedRatio(value: number) {\n if (this._lite) {\n this._lite.speedRatio = value;\n } else {\n this._speedRatio = value;\n }\n }\n\n public get loopAnimation(): boolean {\n return this._lite ? this._lite.loopAnimation : this._loopAnimation;\n }\n public set loopAnimation(value: boolean) {\n if (this._lite) {\n this._lite.loopAnimation = value;\n } else {\n this._loopAnimation = value;\n }\n }\n\n public get weight(): number {\n return this._lite ? this._lite.weight : this._weight;\n }\n public set weight(value: number) {\n if (this._lite) {\n this._lite.weight = value;\n // A non-unit weight on a loaded clip means the scene must blend its\n // groups (Babylon.js manual weighted blend). Enable the scene's\n // weighted-blend manager (idempotent; no-op for the default weight 1).\n if (value !== 1) {\n this._blendHost?._enableLoadedBlend();\n }\n } else {\n this._weight = value;\n this._host?._recomputeStructuralBlends();\n }\n }\n\n /**\n * Babylon.js `AnimationGroup.animatables`. For loaded groups Babylon Lite drives\n * the whole group as one unit, so this surfaces a single animatable whose\n * `masterFrame` reflects the group's current frame. Structural groups built\n * without a running scene report no animatables.\n */\n public get animatables(): Array<{ masterFrame: number }> {\n if (this._lite) {\n const frameRate = this._lite.frameRate ?? 60;\n return [{ masterFrame: this._lite.currentTime * frameRate }];\n }\n return [];\n }\n\n public addTargetedAnimation(animation: Animation, target: unknown): { animation: Animation; target: unknown } {\n const entry = { animation, target };\n this.targetedAnimations.push(entry);\n this._from = Math.min(this._from, 0);\n this._to = Math.max(this._to, animation.getHighestFrame());\n return entry;\n }\n\n /**\n * Babylon.js `start(loop?, speedRatio?, from?, to?)`. On the structural path this\n * registers the group with its host scene, captures the targets' rest-pose\n * baselines, and begins CPU stepping + weight blending. On the loaded path it\n * seeks to `from` and plays — except a zero-length range (`from === to`) is a\n * **held single-frame pose** (e.g. an additive pose layer), which must hold\n * rather than play: Babylon Lite's group advance ignores the BJS play range and\n * would otherwise loop the (often ~2-frame) pose clip every frame, flickering.\n */\n public start(loop = true, speedRatio = 1, from?: number, to?: number): this {\n if (this._lite) {\n const frameRate = this._lite.frameRate ?? 60;\n if (from !== undefined) {\n this._lite.currentTime = from / frameRate;\n }\n this._lite.speedRatio = speedRatio;\n this._lite.loopAnimation = loop;\n if (from !== undefined && to !== undefined && from === to) {\n // Held single-frame pose — seek and hold (do not advance/loop).\n // `play` then `pause` clears Lite's internal `_stopped` flag (set by a\n // prior `stop()`) while leaving the clip paused, so the weighted mixer\n // still includes this group (a `_stopped` group is excluded from\n // blending, which would drop the whole shared-skeleton blend).\n playAnimation(this._lite);\n pauseAnimation(this._lite);\n return this;\n }\n return this.play(loop);\n }\n this._loopAnimation = loop;\n this._speedRatio = speedRatio;\n if (from !== undefined) {\n this._from = from;\n }\n if (to !== undefined) {\n this._to = to;\n }\n this._currentFrame = this._from;\n this._state = \"playing\";\n for (const { target, animation } of this.targetedAnimations) {\n captureOriginal(target as object, animation.targetProperty);\n }\n this._host?._registerStructuralGroup(this);\n this._host?._recomputeStructuralBlends();\n return this;\n }\n\n /** Babylon.js `goToFrame(frame)` — seek to a frame (loaded groups seek + hold via Lite; structural groups re-blend). */\n public goToFrame(frame: number): this {\n if (this._lite && this._engine) {\n liteGoToFrame(this._lite, frame, this._engine);\n } else {\n this._currentFrame = frame;\n this._host?._recomputeStructuralBlends();\n }\n return this;\n }\n\n public play(loop?: boolean): this {\n if (this._lite) {\n if (loop !== undefined) {\n this._lite.loopAnimation = loop;\n }\n playAnimation(this._lite);\n } else {\n this._state = \"playing\";\n }\n return this;\n }\n\n public pause(): this {\n if (this._lite) {\n pauseAnimation(this._lite);\n } else {\n this._state = \"paused\";\n }\n return this;\n }\n\n public stop(): this {\n if (this._lite) {\n stopAnimation(this._lite);\n } else {\n this._state = \"stopped\";\n }\n return this;\n }\n\n public reset(): this {\n if (this._lite && this._engine) {\n liteGoToFrame(this._lite, 0, this._engine);\n } else {\n this._state = \"init\";\n }\n return this;\n }\n\n /** @internal Whether this structural group currently contributes to blending (started, not stopped). */\n public _isStructuralActive(): boolean {\n return !this._lite && (this._state === \"playing\" || this._state === \"paused\");\n }\n\n /** @internal Advance a playing structural group's frame by `deltaMs` (with loop wrap). */\n public _advanceStructural(deltaMs: number): void {\n if (this._lite || this._state !== \"playing\") {\n return;\n }\n const fps = this.targetedAnimations[0]?.animation.framePerSecond ?? 60;\n this._currentFrame += (deltaMs / 1000) * fps * this._speedRatio;\n if (this._currentFrame > this._to) {\n if (this._loopAnimation) {\n const span = this._to - this._from || 1;\n this._currentFrame = this._from + ((this._currentFrame - this._from) % span);\n } else {\n this._currentFrame = this._to;\n this._state = \"stopped\";\n }\n }\n }\n\n /**\n * @internal Babylon.js manual weighted / cross-fade blending. Groups of\n * animations targeting the same (target, property) are mixed by weight: when\n * the total weight exceeds 1 the contributions are normalized, and when it is\n * below 1 the property's captured rest-pose baseline fills the remainder.\n */\n public static _blendStructuralGroups(groups: readonly AnimationGroup[]): void {\n interface Holder {\n target: object;\n path: string;\n total: number;\n contributions: Array<{ value: AnimValue; weight: number }>;\n }\n const holders = new Map<object, Map<string, Holder>>();\n for (const group of groups) {\n if (!group._isStructuralActive()) {\n continue;\n }\n const weight = group._weight;\n for (const { target, animation } of group.targetedAnimations) {\n const obj = target as object;\n const path = animation.targetProperty;\n const value = animation.evaluate(group._currentFrame);\n let perTarget = holders.get(obj);\n if (!perTarget) {\n perTarget = new Map();\n holders.set(obj, perTarget);\n }\n let holder = perTarget.get(path);\n if (!holder) {\n holder = { target: obj, path, total: 0, contributions: [] };\n perTarget.set(path, holder);\n }\n holder.total += weight;\n holder.contributions.push({ value, weight });\n }\n }\n for (const perTarget of holders.values()) {\n for (const holder of perTarget.values()) {\n const original = structuralOriginals.get(holder.target)?.get(holder.path) ?? 0;\n let final: AnimValue;\n if (holder.total === 0) {\n final = original;\n } else {\n let normalizer = 1;\n if (holder.total < 1) {\n final = scaleValue(original, 1 - holder.total);\n } else {\n normalizer = holder.total;\n final = zeroLike(holder.contributions[0]!.value);\n }\n for (const c of holder.contributions) {\n final = addValue(final, scaleValue(c.value, c.weight / normalizer));\n }\n }\n applyAnimatedValue(holder.target, holder.path, final);\n }\n }\n }\n}\n","/**\n * Babylon.js engine-level enums and constant bags that scenes import for their\n * numeric values. These carry no behaviour in the compat layer — they exist so\n * that code reading `ScenePerformancePriority.Aggressive`,\n * `ImageProcessingConfiguration.TONEMAPPING_ACES`, or\n * `Constants.MATERIAL_CounterClockWiseSideOrientation` resolves to the same\n * numbers Babylon.js uses.\n */\n\nimport { unsupported } from \"../error.js\";\n\n/** Babylon.js `ScenePerformancePriority`. */\nexport enum ScenePerformancePriority {\n BackwardCompatible = 0,\n Intermediate = 1,\n Aggressive = 2,\n}\n\n/**\n * Babylon.js `ShaderLanguage` — the shader-source language selector. Babylon Lite\n * is WGSL-only, but the enum is surfaced (with Babylon.js's numeric values) so\n * scenes that import it to author `WGSL` shaders resolve the symbol; a `GLSL`\n * `ShaderMaterial`/`EffectWrapper` still fails loudly at construction.\n */\nexport enum ShaderLanguage {\n GLSL = 0,\n WGSL = 1,\n}\n\n/**\n * Minimal Babylon.js `ImageProcessingConfiguration` facade over Lite's image\n * processing state.\n */\nexport class ImageProcessingConfiguration {\n public static readonly TONEMAPPING_STANDARD = 0;\n public static readonly TONEMAPPING_ACES = 1;\n public static readonly TONEMAPPING_KHR_PBR_NEUTRAL = 2;\n\n private _backing: {\n exposure: number;\n contrast: number;\n toneMappingEnabled: boolean;\n } = {\n exposure: 1,\n contrast: 1,\n toneMappingEnabled: false,\n };\n\n /** @internal Attach this facade to a scene's Babylon Lite state. */\n public _attach(backing: { exposure: number; contrast: number; toneMappingEnabled: boolean }): this {\n this._backing = backing;\n return this;\n }\n\n public get exposure(): number {\n return this._backing.exposure;\n }\n public set exposure(value: number) {\n this._backing.exposure = value;\n }\n\n public get contrast(): number {\n return this._backing.contrast;\n }\n public set contrast(value: number) {\n this._backing.contrast = value;\n }\n\n public get toneMappingEnabled(): boolean {\n return this._backing.toneMappingEnabled;\n }\n public set toneMappingEnabled(value: boolean) {\n this._backing.toneMappingEnabled = value;\n }\n\n public get whiteBalanceEnabled(): boolean {\n return false;\n }\n public set whiteBalanceEnabled(value: boolean) {\n if (value) {\n unsupported(\"ImageProcessingConfiguration.whiteBalanceEnabled\", WHITE_BALANCE_UNSUPPORTED);\n }\n }\n\n public get temperature(): number {\n return 6500;\n }\n public set temperature(value: number) {\n if (value !== 6500) {\n unsupported(\"ImageProcessingConfiguration.temperature\", WHITE_BALANCE_UNSUPPORTED);\n }\n }\n\n public get tint(): number {\n return 0;\n }\n public set tint(value: number) {\n if (value !== 0) {\n unsupported(\"ImageProcessingConfiguration.tint\", WHITE_BALANCE_UNSUPPORTED);\n }\n }\n}\n\nconst WHITE_BALANCE_UNSUPPORTED =\n \"White balance requires color-temperature math, a shader uniform, material/post-process defines, and pipeline invalidation that Babylon Lite does not expose; adding it needs a cross-cutting Lite subsystem design.\";\n\n/** Babylon.js pure-module registration hook. */\nexport function RegisterImageProcessingConfiguration(): void {\n return unsupported(\"RegisterImageProcessingConfiguration\", \"Babylon Lite has no Babylon.js SerializationHelper parser registry to install ImageProcessingConfiguration into.\");\n}\n\n/**\n * Babylon.js pure-module texture-loader registration hook. Lite dispatches its\n * supported texture formats directly, so no registration is required.\n */\nexport function RegisterAbstractEngineTextureLoaders(): void {}\n\n/** Pure-build registration shim; compat wires the Lite array upload directly. */\nexport function RegisterEnginesExtensionsEngineTexture2DArrayImageSource(): void {}\n\n/** WebGPU pure-build registration shim; Babylon Lite is WebGPU-only. */\nexport function RegisterEnginesWebGPUExtensionsEngineTexture2DArrayImageSource(): void {}\n\n/**\n * Babylon.js `Constants` — the small subset of numeric constants referenced by\n * the ported scenes. Extend as needed.\n */\nexport const Constants = {\n MATERIAL_ClockWiseSideOrientation: 0,\n MATERIAL_CounterClockWiseSideOrientation: 1,\n MATERIAL_TriangleFillMode: 0,\n MATERIAL_WireFrameFillMode: 1,\n MATERIAL_PointFillMode: 2,\n ALPHA_DISABLE: 0,\n ALPHA_ADD: 1,\n ALPHA_COMBINE: 2,\n ALPHA_ONEONE: 6,\n ALPHA_PREMULTIPLIED: 7,\n ALPHA_REPLACE_COLOR: 21,\n MATERIAL_OPAQUE: 0,\n MATERIAL_ALPHATEST: 1,\n MATERIAL_ALPHABLEND: 2,\n TEXTURE_CLAMP_ADDRESSMODE: 0,\n TEXTURE_WRAP_ADDRESSMODE: 1,\n TEXTURE_MIRROR_ADDRESSMODE: 2,\n TEXTURE_NEAREST_SAMPLINGMODE: 1,\n TEXTURE_BILINEAR_SAMPLINGMODE: 2,\n TEXTURE_TRILINEAR_SAMPLINGMODE: 3,\n TEXTUREFORMAT_RGBA: 5,\n TEXTURETYPE_UNSIGNED_BYTE: 0,\n BUFFER_CREATIONFLAG_READ: 1,\n BUFFER_CREATIONFLAG_WRITE: 2,\n BUFFER_CREATIONFLAG_READWRITE: 3,\n BUFFER_CREATIONFLAG_UNIFORM: 4,\n BUFFER_CREATIONFLAG_VERTEX: 8,\n BUFFER_CREATIONFLAG_INDEX: 16,\n BUFFER_CREATIONFLAG_STORAGE: 32,\n BUFFER_CREATIONFLAG_INDIRECT: 64,\n} as const;\n","import type { PickingInfo } from \"../culling/picking-info.js\";\n\n/** Babylon.js pointer event masks emitted by `Scene.onPointerObservable`. */\nexport class PointerEventTypes {\n public static readonly POINTERDOWN = 0x01;\n public static readonly POINTERUP = 0x02;\n public static readonly POINTERMOVE = 0x04;\n public static readonly POINTERWHEEL = 0x08;\n public static readonly POINTERPICK = 0x10;\n public static readonly POINTERTAP = 0x20;\n public static readonly POINTERDOUBLETAP = 0x40;\n}\n\n/** Babylon.js-shaped payload emitted by `Scene.onPointerObservable`. */\nexport class PointerInfo {\n public constructor(\n public type: number,\n public event: PointerEvent | WheelEvent,\n private readonly _pickInfo: PickingInfo | null\n ) {}\n\n public get pickInfo(): PickingInfo | null {\n return this._pickInfo;\n }\n}\n","/**\n * Babylon.js-compatible `Scene` implemented over a Babylon Lite `SceneContext`.\n *\n * The wrapper owns a Lite `SceneContext` (`_lite`) and proxies the common\n * Babylon.js scene surface: `clearColor`, `activeCamera`, the before/after-render\n * observables, default camera creation, and disposal. Entities created by the\n * compat light/camera/mesh wrappers register themselves against `_lite`.\n *\n * `scene.render()` is a no-op: Babylon Lite drives rendering through the engine's\n * loop (`runRenderLoop` / `startEngine`). Manual single-frame rendering is not\n * supported in this compat layer.\n */\n\nimport {\n createSceneContext,\n disposeScene,\n onBeforeRender,\n createDefaultCamera as liteCreateDefaultCamera,\n setFog,\n setClipPlane,\n loadEnvironment,\n loadDdsEnvironment,\n loadHdrEnvironment,\n createHemisphericLight,\n addToScene,\n createAnimationManager,\n addAnimationGroup,\n clearAnimationManager,\n enableAnimationBlending,\n updateAnimationManager,\n pickMeshesWithRayPrecise as litePickWithRay,\n createPickingRay as liteCreatePickingRay,\n resolveCameraViewport,\n invertMat4,\n multiplyMat4,\n onPhysicsAfterStep,\n} from \"babylon-lite\";\nimport type {\n SceneContext,\n Camera as LiteCamera,\n ArcRotateCamera as LiteArcRotateCamera,\n FreeCamera as LiteFreeCamera,\n AnimationManager,\n Mesh as LiteMesh,\n PickingInfo as LitePickingInfo,\n Mat4,\n Material as LiteMaterial,\n EngineContext,\n} from \"babylon-lite\";\n\nimport { Color3, Color4 } from \"../math/color.js\";\nimport type { Plane } from \"../math/plane.js\";\nimport { HavokPlugin, PhysicsEngine } from \"../physics/physics.js\";\nimport { unsupported } from \"../error.js\";\nimport { Observable } from \"../misc/observable.js\";\nimport type { Camera } from \"../cameras/cameras.js\";\nimport { ArcRotateCamera, FreeCamera } from \"../cameras/cameras.js\";\nimport { StandardMaterial } from \"../materials/materials.js\";\nimport { Animatable } from \"../animations/animation.js\";\nimport type { Animation } from \"../animations/animation.js\";\nimport { AnimationGroup } from \"../animations/animation.js\";\nimport type { BaseTexture, CubeTexture, HDRCubeTexture } from \"../textures/textures.js\";\nimport type { WebGPUEngine } from \"../engine/engine.js\";\nimport { AbstractScene } from \"./abstract-scene.js\";\nimport { Logger } from \"../misc/misc-utils.js\";\nimport { ImageProcessingConfiguration } from \"../misc/engine-constants.js\";\nimport type { FluidRenderer } from \"../unsupported/unsupported-apis.js\";\nimport { Matrix } from \"../math/matrix.js\";\nimport { Ray } from \"../math/ray.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport { PickingInfo } from \"../culling/picking-info.js\";\nimport { AbstractMesh, Mesh } from \"../meshes/meshes.js\";\nimport { PointerEventTypes, PointerInfo } from \"../events/pointer-events.js\";\n\n/** Babylon.js EnvironmentHelper default skybox/ground assets (match the Lite ports). */\nconst DEFAULT_SKYBOX_URL = \"https://assets.babylonjs.com/core/environments/backgroundSkybox.dds\";\nconst DEFAULT_GROUND_URL = \"https://assets.babylonjs.com/core/environments/backgroundGround.png\";\n/** Babylon.js `createDefaultEnvironment` IBL fallback when no `environmentTexture` is set. */\nconst DEFAULT_ENV_URL = \"https://assets.babylonjs.com/environments/environmentSpecular.env\";\nconst FLUID_RENDERER_UNSUPPORTED =\n \"Fluid rendering requires dedicated depth, thickness, and diffuse passes plus render-target lifecycle and composition policies that Babylon Lite does not define.\";\ntype CompatShadowGenerator = { _build(engine: EngineContext): void; _liteGen?: unknown };\n\nexport type MeshPredicate = (mesh: AbstractMesh, thinInstanceIndex: number) => boolean;\nexport type TrianglePickingPredicate = (p0: Vector3, p1: Vector3, p2: Vector3, ray: Ray, i0: number, i1: number, i2: number) => boolean;\n\n/**\n * Babylon.js resolves the BRDF lookup texture from an embedded Base64 PNG rather than a\n * URL, so PBR materials work with no asset deployment and no network request. Mirror that\n * here instead of exposing a URL option: Babylon.js's `IEnvironmentHelperOptions` has no\n * BRDF field, and a fetched default breaks under SPA dev servers that answer missing files\n * with a 200 HTML page. Loaded lazily so only apps that load an environment pay for it.\n */\nasync function getBrdfLutUrl(): Promise<string> {\n return (await import(\"./brdf-lut-data.js\")).BRDF_LUT_DATA_URL;\n}\n\ninterface DefaultEnvironmentOptions {\n createSkybox?: boolean;\n createGround?: boolean;\n skyboxSize?: number;\n /** Babylon.js EnvironmentHelper: set up tone mapping / exposure / contrast (default true). */\n setupImageProcessing?: boolean;\n /** Babylon.js EnvironmentHelper camera exposure (default 0.8). */\n cameraExposure?: number;\n /** Babylon.js EnvironmentHelper camera contrast (default 1.2). */\n cameraContrast?: number;\n /** Babylon.js EnvironmentHelper tone-mapping toggle (default true). */\n toneMappingEnabled?: boolean;\n /** @internal When set, the skybox is the environment texture itself (Babylon.js `createDefaultSkybox`). */\n skyboxFromEnv?: boolean;\n /** @internal Apply EnvironmentHelper image processing (only set by `createDefaultEnvironment`). */\n applyImageProcessing?: boolean;\n}\n\nexport class Scene extends AbstractScene {\n /** @internal Underlying Babylon Lite scene context. */\n public readonly _lite: SceneContext;\n\n /** Babylon.js fog-mode constants. */\n public static readonly FOGMODE_NONE = 0;\n public static readonly FOGMODE_EXP = 1;\n public static readonly FOGMODE_EXP2 = 2;\n public static readonly FOGMODE_LINEAR = 3;\n\n /** Fires before each scene render (wired to Lite's before-render hook). */\n public readonly onBeforeRenderObservable = new Observable<Scene>();\n /** Fires before animations are evaluated each frame (used by ported cross-fade drivers). */\n public readonly onBeforeAnimationsObservable = new Observable<Scene>();\n /** Fires after each scene render. */\n public readonly onAfterRenderObservable = new Observable<Scene>();\n /** Fires after each Lite Havok simulation step. */\n public readonly onAfterPhysicsObservable = new Observable<Scene>();\n /** Fires once when the scene is disposed. */\n public readonly onDisposeObservable = new Observable<Scene>();\n /** Babylon.js scene-level pointer events from the engine rendering canvas. */\n public readonly onPointerObservable = new Observable<PointerInfo>();\n /** @internal Callbacks that must run after Babylon.js-compatible before-render observers. */\n private readonly _beforeRenderFlushCallbacks = new Set<() => void>();\n /** @internal Canvas target that owns this scene's pointer listeners. */\n private _pointerEventTarget: EventTarget | null = null;\n /** @internal Shared listener registered for each supported DOM pointer event. */\n private _pointerEventListener: EventListener | null = null;\n\n /**\n * Babylon.js `scene.animationGroups` / `scene.animatables`. Loaded glTF /\n * `.babylon` animation clips live on the Lite scene; `animationGroups` returns\n * BJS-shaped `AnimationGroup`s over them (so scenes can `goToFrame`/`pause`/`stop`\n * to freeze a model at a deterministic frame). `animatables` surfaces the\n * native-backed and fallback `Animatable`s started through the scene.\n */\n public get animationGroups(): AnimationGroup[] {\n const liteGroups = this._lite.animationGroups ?? [];\n return liteGroups.map((g) => {\n let wrapper = this._animationGroupCache.get(g);\n if (!wrapper) {\n wrapper = AnimationGroup._fromLite(g, this._engine._lite, this);\n this._animationGroupCache.set(g, wrapper);\n }\n return wrapper;\n });\n }\n\n /** Babylon.js `scene.getAnimationGroupByName(name)` — first loaded animation group with a matching name, else `null`. */\n public getAnimationGroupByName(name: string): AnimationGroup | null {\n return this.animationGroups.find((g) => g.name === name) ?? null;\n }\n\n public get animatables(): Animatable[] {\n return this._runningAnimatables;\n }\n\n private readonly _engine: WebGPUEngine;\n private _activeCamera: Camera | null = null;\n public cameraToUseForPointers: Camera | null = null;\n private _defaultMaterial: StandardMaterial | null = null;\n private _fogMode = 0;\n private _fogStart = 0;\n private _fogEnd = 1000;\n private _fogDensity = 0.1;\n private _fogColor = new Color3(0.2, 0.2, 0.3);\n /**\n * @internal Mesh scene-adds deferred until the engine starts. Babylon Lite\n * locks a mesh into a render group (standard vs PBR) at `addToScene` time by\n * reading its material, whereas Babylon.js code routinely creates a mesh and\n * assigns `mesh.material` a line later. Deferring the add until engine start\n * lets those assignments settle so the mesh lands in the correct group.\n */\n private readonly _pendingAdds: Array<() => void> = [];\n private _started = false;\n private _envTexture: CubeTexture | HDRCubeTexture | null = null;\n private _brdfTexture: BaseTexture | null = null;\n private _defaultEnvOptions: DefaultEnvironmentOptions | null = null;\n private readonly _shadowGenerators: CompatShadowGenerator[] = [];\n private readonly _pendingTextures: Array<Promise<void>> = [];\n private readonly _pendingGroundBakes: Array<() => void> = [];\n private readonly _pendingMorphBuilds: Array<{ mesh: { _lite: unknown }; manager: { _build(mesh: never, engine: import(\"babylon-lite\").EngineContext): void } }> = [];\n private _materialPluginsRequested = false;\n private readonly _pendingMaterialPluginReconciliations = new Set<LiteMaterial>();\n private readonly _runningAnimatables: Animatable[] = [];\n /** @internal Lite manager that owns supported compat property animations. */\n private _propertyAnimationManager: AnimationManager | null = null;\n private readonly _animationGroupCache = new WeakMap<object, AnimationGroup>();\n /** @internal Structural `AnimationGroup`s stepped + weight-blended each frame. */\n private readonly _structuralGroups: AnimationGroup[] = [];\n /** @internal Lite manager that weight/additive-blends loaded glTF groups (lazily created). */\n private _blendManager: AnimationManager | null = null;\n private _ambientColor = new Color3(0, 0, 0);\n private _environmentIntensity = 1;\n private _imageProcessingConfiguration: ImageProcessingConfiguration | null = null;\n /** @internal Tracks whether at least one frame has ticked (gates `onAfterRenderObservable`). */\n private _renderedAFrame = false;\n /** @internal `NodeMaterial`s whose async parse the engine drives after shadow generators are built. */\n private readonly _nodeMaterials: Array<{ _parse(engine: import(\"babylon-lite\").EngineContext, shadowGenerators: readonly unknown[]): Promise<void> }> = [];\n\n /** @internal Process-unique scene-id source (Babylon.js `scene.uniqueId` / `getUniqueId()`). */\n private static _uidCounter = 0;\n /** Babylon.js `scene.uniqueId` — a process-unique numeric id. */\n public readonly uniqueId = ++Scene._uidCounter;\n\n public constructor(engine: WebGPUEngine) {\n super();\n this._engine = engine;\n this._attachPointerEvents();\n if (engine._headless) {\n // Headless (`NullEngine`): back the scene with a real Lite context that has\n // NO frame-graph render task (`defaultRenderTask: false`), so no swapchain or\n // GPU resource is ever built. The engine drives it via Lite's `stepScene`,\n // which fires the same before-render hook the GPU path uses (CPU animations,\n // physics, render observables). Only the device-less surface works; adding\n // meshes with materials is unsupported (their builders need a device).\n this._lite = createSceneContext(engine._lite, { defaultRenderTask: false });\n onBeforeRender(this._lite, (deltaMs: number) => this._tick(deltaMs));\n engine._registerScene(this);\n return;\n }\n this._lite = createSceneContext(engine._lite);\n // Babylon Lite exposes a before-render hook but no after-render hook. We\n // fire `onBeforeRenderObservable` on each tick, and approximate\n // `onAfterRenderObservable` by firing it at the start of the *next* tick\n // (i.e. after the previous frame has rendered). `addOnce` after-render\n // listeners therefore resolve one frame later than they would in BJS.\n onBeforeRender(this._lite, (deltaMs: number) => this._tick(deltaMs));\n engine._registerScene(this);\n }\n\n private _attachPointerEvents(): void {\n const canvas = this._engine.getRenderingCanvas() as Partial<EventTarget>;\n if (typeof canvas.addEventListener !== \"function\" || typeof canvas.removeEventListener !== \"function\") {\n return;\n }\n\n this._pointerEventTarget = canvas as EventTarget;\n this._pointerEventListener = (event) => {\n let type: number;\n switch (event.type) {\n case \"pointerdown\":\n type = PointerEventTypes.POINTERDOWN;\n break;\n case \"pointermove\":\n type = PointerEventTypes.POINTERMOVE;\n break;\n case \"pointerup\":\n type = PointerEventTypes.POINTERUP;\n break;\n case \"wheel\":\n type = PointerEventTypes.POINTERWHEEL;\n break;\n default:\n return;\n }\n this.onPointerObservable.notifyObservers(new PointerInfo(type, event as PointerEvent | WheelEvent, null), type);\n };\n\n for (const type of [\"pointerdown\", \"pointermove\", \"pointerup\", \"wheel\"]) {\n this._pointerEventTarget.addEventListener(type, this._pointerEventListener);\n }\n }\n\n private _detachPointerEvents(): void {\n if (!this._pointerEventTarget || !this._pointerEventListener) {\n return;\n }\n for (const type of [\"pointerdown\", \"pointermove\", \"pointerup\", \"wheel\"]) {\n this._pointerEventTarget.removeEventListener(type, this._pointerEventListener);\n }\n this._pointerEventTarget = null;\n this._pointerEventListener = null;\n }\n\n /**\n * @internal Per-frame update: advance CPU animations and fire the render\n * observables. Driven by Babylon Lite's before-render hook for GPU engines, or\n * by the `NullEngine` `requestAnimationFrame` loop for headless engines.\n */\n public _tick(deltaMs: number): void {\n // Record the frame delta so `engine.getDeltaTime()` (read inside before-render\n // observers) reflects the current frame.\n this._engine._lastDeltaMs = deltaMs;\n this.onBeforeAnimationsObservable.notifyObservers(this);\n if (this._blendManager) {\n updateAnimationManager(this._blendManager, deltaMs);\n }\n if (this._propertyAnimationManager) {\n updateAnimationManager(this._propertyAnimationManager, deltaMs);\n }\n for (const a of this._runningAnimatables) {\n a._tick(deltaMs);\n }\n if (this._structuralGroups.length > 0) {\n for (const g of this._structuralGroups) {\n g._advanceStructural(deltaMs);\n }\n AnimationGroup._blendStructuralGroups(this._structuralGroups);\n }\n if (this._renderedAFrame) {\n this.onAfterRenderObservable.notifyObservers(this);\n }\n this._renderedAFrame = true;\n this.onBeforeRenderObservable.notifyObservers(this);\n for (const callback of this._beforeRenderFlushCallbacks) {\n callback();\n }\n }\n\n /** @internal Register work that must observe all compat before-render mutations before Lite renders. */\n public _registerBeforeRenderFlush(callback: () => void): () => void {\n this._beforeRenderFlushCallbacks.add(callback);\n return () => {\n this._beforeRenderFlushCallbacks.delete(callback);\n };\n }\n\n /**\n * @internal The Lite-core-owned mesh list backing `scene.meshes`. Babylon Lite's\n * `SceneContext` owns the authoritative array of scene meshes; the base\n * `AbstractScene.meshes` maps it back onto the canonical compat wrappers. Guarded\n * for prototype-only instances that have no `_lite` (GPU-free unit tests).\n */\n protected override _coreMeshList(): readonly object[] {\n return (this._lite?.meshes as readonly object[] | undefined) ?? [];\n }\n\n public getEngine(): WebGPUEngine {\n return this._engine;\n }\n\n /** Babylon.js `scene.getClassName()`. */\n public getClassName(): string {\n return \"Scene\";\n }\n\n /** Babylon.js `scene.getUniqueId()` — the process-unique scene id. */\n public getUniqueId(): number {\n return this.uniqueId;\n }\n\n /**\n * @internal Whether the engine has started, i.e. deferred mesh adds have been\n * flushed and meshes are live in the Lite scene. Used by the mesh `material`\n * setter and texture-readiness path to decide whether a material change must be\n * reconciled into the running scene (ensure renderable + rebuild) or is still\n * safely handled by the boot-time build.\n */\n public get _hasStarted(): boolean {\n return this._started;\n }\n\n /**\n * @internal Add a mesh to the Lite scene, deferring until engine start if the\n * engine has not started yet (so a later `mesh.material = …` is captured in the\n * correct render group). After start, adds happen immediately and Lite's\n * material-swap path handles re-routing.\n */\n public _deferAdd(add: () => void): void {\n if (this._started) {\n add();\n } else {\n this._pendingAdds.push(add);\n }\n }\n\n /** @internal Flush deferred mesh adds. Called by the engine just before `registerScene`. */\n public _flushPendingAdds(): void {\n this._started = true;\n for (const add of this._pendingAdds) {\n add();\n }\n this._pendingAdds.length = 0;\n }\n\n /** @internal Register a compat `ShadowGenerator` to be built at engine start. */\n public _registerShadowGenerator(gen: CompatShadowGenerator): void {\n this._shadowGenerators.push(gen);\n }\n\n /** @internal Drop a disposed compat `ShadowGenerator` from the pending/build list. */\n public _unregisterShadowGenerator(gen: CompatShadowGenerator): void {\n const index = this._shadowGenerators.indexOf(gen);\n if (index !== -1) {\n this._shadowGenerators.splice(index, 1);\n }\n }\n\n /** @internal Track an async texture load so the engine can await it before building the scene. */\n public _trackTextureLoad(promise: Promise<void>): void {\n this._pendingTextures.push(promise);\n }\n\n /** @internal Await all in-flight texture loads (so material maps are GPU-ready at build). */\n public async _awaitPendingTextures(): Promise<void> {\n if (this._pendingTextures.length > 0) {\n await Promise.all(this._pendingTextures);\n this._pendingTextures.length = 0;\n }\n }\n\n /**\n * @internal Register a deferred ground-UV bake (for `CreateGroundFromHeightMap` with a\n * PBR `albedoTexture` whose `uScale`/`vScale` tiling must be baked into the geometry,\n * since Babylon Lite's PBR pipeline has no material-level UV scale). Run by\n * {@link _bakeGroundUvs} after textures load, so the material's `albedoTexture` (assigned\n * by user code after the heightmap resolves) is in place and its tiling is read correctly.\n */\n public _registerGroundUvBake(bake: () => void): void {\n this._pendingGroundBakes.push(bake);\n }\n\n /** @internal Run deferred ground-UV bakes. Called by the engine after `_awaitPendingTextures`. */\n public _bakeGroundUvs(): void {\n for (const bake of this._pendingGroundBakes) {\n bake();\n }\n this._pendingGroundBakes.length = 0;\n }\n\n /**\n * @internal Register a mesh's compat `MorphTargetManager` to be built at engine\n * start. Building is deferred so the mesh's base CPU geometry (set by primitive\n * builders / `VertexData.applyToMesh`) exists when per-target deltas are computed.\n */\n public _registerMorphTargetManager(mesh: { _lite: unknown }, manager: { _build(mesh: never, engine: import(\"babylon-lite\").EngineContext): void }): void {\n this._pendingMorphBuilds.push({ mesh, manager });\n }\n\n /** @internal Build all registered morph-target managers. Called by the engine before registration. */\n public _buildMorphTargets(): void {\n const engine = this._engine._lite;\n for (const { mesh, manager } of this._pendingMorphBuilds) {\n manager._build(mesh as never, engine);\n }\n this._pendingMorphBuilds.length = 0;\n }\n\n /**\n * @internal Request Lite's opt-in material-plugin bridges for this scene.\n * Once the engine is live, reconcile the changed material through Lite's\n * runtime rebuild path rather than leaving the startup-only request stranded.\n */\n public _requestMaterialPlugins(material?: LiteMaterial): void {\n this._materialPluginsRequested = true;\n if (material && this._engine._hasStarted) {\n this._engine._registerLateWork(async () => {\n const { reconcileMaterialPlugins } = await import(\"babylon-lite\");\n await reconcileMaterialPlugins(this._lite, material);\n });\n } else if (material && this._started) {\n this._pendingMaterialPluginReconciliations.add(material);\n }\n }\n\n /** @internal Enable requested material plugins after meshes are added and before scene registration. */\n public async _enableMaterialPlugins(): Promise<void> {\n if (this._materialPluginsRequested) {\n const { enableMaterialPlugins } = await import(\"babylon-lite\");\n enableMaterialPlugins(this._lite);\n this._materialPluginsRequested = false;\n this._pendingMaterialPluginReconciliations.clear();\n }\n }\n\n /** @internal Reconcile plugin requests raised by first-frame callbacks before engine startup completes. */\n public async _reconcilePendingMaterialPlugins(): Promise<void> {\n while (this._pendingMaterialPluginReconciliations.size > 0) {\n const materials = [...this._pendingMaterialPluginReconciliations];\n this._pendingMaterialPluginReconciliations.clear();\n const { reconcileMaterialPlugins } = await import(\"babylon-lite\");\n await Promise.all(materials.map((material) => reconcileMaterialPlugins(this._lite, material)));\n }\n this._materialPluginsRequested = false;\n }\n\n /** @internal Whether this scene queued plugin changes during the engine startup transition. */\n public get _hasPendingMaterialPluginReconciliations(): boolean {\n return this._pendingMaterialPluginReconciliations.size > 0;\n }\n\n /** @internal Clustered light containers to register on the Lite scene at engine start. */\n private readonly _pendingClusteredContainers: Array<{ _build(): void; isDisposed(): boolean }> = [];\n\n /** @internal Register a compat `ClusteredLightContainer` to be wired into the scene at engine start. */\n public _registerClusteredLightContainer(container: { _build(): void; isDisposed(): boolean }): void {\n this._pendingClusteredContainers.push(container);\n }\n\n /** @internal Drop a container from the pending list (it was disposed before engine start). */\n public _unregisterClusteredLightContainer(container: { _build(): void; isDisposed(): boolean }): void {\n const i = this._pendingClusteredContainers.indexOf(container);\n if (i !== -1) {\n this._pendingClusteredContainers.splice(i, 1);\n }\n }\n\n /**\n * @internal Register all clustered light containers on the Lite scene. Called by\n * the engine after meshes/materials are settled (clustered wiring reads the\n * scene's materials) and before `registerScene`. Containers disposed before this\n * point are skipped — registering one would build GPU state for an object the\n * caller has already thrown away. The list is drained up front so a container\n * disposed while another builds cannot perturb the iteration.\n */\n public _buildClusteredContainers(): void {\n const containers = this._pendingClusteredContainers.splice(0);\n for (const container of containers) {\n if (!container.isDisposed()) {\n container._build();\n }\n }\n }\n\n /** @internal Whether any shadow generator is present (engine uses shadow-aware registration). */\n public _hasShadows(): boolean {\n return this._shadowGenerators.length > 0;\n }\n\n /** @internal Build all registered shadow generators. Called after meshes are added. */\n public _buildShadowGenerators(): void {\n const engine = this._engine._lite;\n for (const gen of this._shadowGenerators) {\n gen._build(engine);\n }\n }\n\n /** @internal Register a `NodeMaterial` whose parse the engine drives after shadow build. */\n public _registerNodeMaterial(material: { _parse(engine: import(\"babylon-lite\").EngineContext, shadowGenerators: readonly unknown[]): Promise<void> }): void {\n if (this._started) {\n this._engine._registerLateWork(() => material._parse(this._engine._lite, this._liteShadowGenerators()));\n return;\n }\n this._nodeMaterials.push(material);\n }\n\n private _liteShadowGenerators(): unknown[] {\n return this._shadowGenerators.map((g) => g._liteGen).filter((g): g is unknown => g !== undefined);\n }\n\n /**\n * @internal Parse all registered `NodeMaterial`s, passing the scene's built Lite\n * shadow generators so NME shadow-receiver blocks sample them (Babylon.js wires\n * shadows into the scene globally; Babylon Lite takes them at NME parse time).\n * Must run after `_buildShadowGenerators` so the Lite generators exist.\n */\n public async _parseNodeMaterials(): Promise<void> {\n if (this._nodeMaterials.length === 0) {\n return;\n }\n const engine = this._engine._lite;\n const liteGens = this._liteShadowGenerators();\n await Promise.all(this._nodeMaterials.map((m) => m._parse(engine, liteGens)));\n this._nodeMaterials.length = 0;\n }\n\n /**\n * Babylon.js `scene.defaultMaterial` — a shared `StandardMaterial` applied to\n * meshes that have no material assigned. Babylon Lite requires every mesh to\n * carry a material to render, so the mesh wrappers assign this lazily-created\n * default; reading it (or assigning a replacement) matches Babylon.js.\n */\n public get defaultMaterial(): StandardMaterial {\n if (!this._defaultMaterial) {\n this._defaultMaterial = new StandardMaterial(\"default material\", this);\n }\n return this._defaultMaterial;\n }\n public set defaultMaterial(value: StandardMaterial) {\n this._defaultMaterial = value;\n // A replacement built Babylon.js-style with no scene is owned by this scene from now on: it is the\n // effective material of every mesh without its own, none of which goes through a material setter.\n value?._adoptScene(this);\n }\n\n public get clearColor(): Color4 {\n const c = this._lite.clearColor;\n return new Color4(c.r, c.g, c.b, c.a ?? 1);\n }\n public set clearColor(value: Color4) {\n // Babylon.js accepts a `Color3` here (alpha defaults to 1). A `Color3` has no\n // `a`, which would otherwise reach WebGPU's render pass as `undefined`.\n this._lite.clearColor = { r: value.r, g: value.g, b: value.b, a: value.a ?? 1 };\n }\n\n public get activeCamera(): Camera | null {\n return this._activeCamera;\n }\n public set activeCamera(camera: Camera | null) {\n this._activeCamera = camera;\n this._lite.camera = (camera?._lite as LiteCamera | undefined) ?? null;\n }\n\n /**\n * @internal Surface a camera parsed from a loaded asset (`.babylon` files carry\n * their own camera) as the compat `scene.activeCamera`. Babylon Lite's\n * `addToScene` sets `scene._lite.camera` from the asset, but the compat scene\n * only tracks cameras created through the wrapper classes — so after a load with\n * no explicit camera we wrap the Lite one here. Loaded `.babylon` cameras are\n * always free cameras (see `parseBabylonCamera`).\n */\n public _surfaceLoadedCamera(): void {\n if (this._activeCamera || !this._lite.camera) {\n return;\n }\n FreeCamera._adopt(\"camera\", this._lite.camera as LiteFreeCamera, this);\n }\n\n /** Babylon.js image-processing facade over the scene's Lite state. */\n public get imageProcessingConfiguration(): ImageProcessingConfiguration {\n this._imageProcessingConfiguration ??= new ImageProcessingConfiguration()._attach(this._lite.imageProcessing);\n return this._imageProcessingConfiguration;\n }\n\n public get fluidRenderer(): FluidRenderer | null {\n return null;\n }\n public set fluidRenderer(value: FluidRenderer | null) {\n if (value !== null) {\n unsupported(\"Scene.fluidRenderer\", FLUID_RENDERER_UNSUPPORTED);\n }\n }\n\n public enableFluidRenderer(): FluidRenderer | null {\n return unsupported(\"Scene.enableFluidRenderer\", FLUID_RENDERER_UNSUPPORTED);\n }\n\n public disableFluidRenderer(): void {}\n\n /** Babylon.js `scene.performancePriority` — accepted for parity; Babylon Lite tunes its own pipeline. */\n public performancePriority = 0;\n\n /**\n * Babylon.js `scene.ambientColor` — the scene-wide ambient term multiplied into\n * each material's ambient contribution. Babylon Lite bakes ambient at the\n * material level (the `.babylon` loader folds `scene.ambientColor` into each\n * material), so this is stored for parity; the BJS default `(0,0,0)` is a no-op.\n */\n public get ambientColor(): Color3 {\n return this._ambientColor;\n }\n public set ambientColor(value: Color3) {\n this._ambientColor = value;\n }\n\n /**\n * Babylon.js `scene.environmentIntensity` — a global multiplier on IBL\n * contribution. Babylon Lite applies environment intensity per PBR material;\n * this is stored for parity (the BJS default `1` is a no-op).\n */\n public get environmentIntensity(): number {\n return this._environmentIntensity;\n }\n public set environmentIntensity(value: number) {\n this._environmentIntensity = value;\n }\n\n /**\n * Babylon.js `scene.useRightHandedSystem`. Babylon Lite's coordinate system is\n * fixed; this is stored for parity (the BJS WebGPU default is left-handed —\n * `false` — so the common case is a no-op).\n */\n public useRightHandedSystem = false;\n\n /** Babylon.js `scene.registerBeforeRender(cb)` — convenience over `onBeforeRenderObservable`. */\n public registerBeforeRender(callback: () => void): void {\n this.onBeforeRenderObservable.add(callback);\n }\n\n /** Babylon.js `scene.unregisterBeforeRender(cb)`. */\n public unregisterBeforeRender(callback: () => void): void {\n this.onBeforeRenderObservable.removeCallback(callback);\n }\n\n /** Babylon.js `scene.registerAfterRender(cb)` — convenience over `onAfterRenderObservable`. */\n public registerAfterRender(callback: () => void): void {\n this.onAfterRenderObservable.add(callback);\n }\n\n /** Babylon.js `scene.unregisterAfterRender(cb)`. */\n public unregisterAfterRender(callback: () => void): void {\n this.onAfterRenderObservable.removeCallback(callback);\n }\n\n /** Babylon.js `scene.attachControl` — camera input is attached per-camera in the compat layer; no-op. */\n public attachControl(_attachUp?: boolean, _attachDown?: boolean, _attachMove?: boolean): void {\n // Camera control is wired through `camera.attachControl(canvas)`.\n }\n\n /** Babylon.js `scene.detachControl` — no-op (see {@link attachControl}). */\n public detachControl(): void {\n // No-op.\n }\n\n // ── Fog (Babylon.js `scene.fogMode/fogStart/fogEnd/fogDensity/fogColor`) ──\n\n public get fogMode(): number {\n return this._fogMode;\n }\n public set fogMode(value: number) {\n this._fogMode = value;\n this._applyFog();\n }\n\n public get fogStart(): number {\n return this._fogStart;\n }\n public set fogStart(value: number) {\n this._fogStart = value;\n this._applyFog();\n }\n\n public get fogEnd(): number {\n return this._fogEnd;\n }\n public set fogEnd(value: number) {\n this._fogEnd = value;\n this._applyFog();\n }\n\n public get fogDensity(): number {\n return this._fogDensity;\n }\n public set fogDensity(value: number) {\n this._fogDensity = value;\n this._applyFog();\n }\n\n public get fogColor(): Color3 {\n return this._fogColor;\n }\n public set fogColor(value: Color3) {\n this._fogColor = value;\n this._applyFog();\n }\n\n /** @internal Push the current fog config into the Lite scene UBO. */\n private _applyFog(): void {\n setFog(this._lite, {\n mode: this._fogMode as 0 | 1 | 2 | 3,\n density: this._fogDensity,\n start: this._fogStart,\n end: this._fogEnd,\n color: [this._fogColor.r, this._fogColor.g, this._fogColor.b],\n });\n }\n\n // ── Clip plane (Babylon.js `scene.clipPlane`) ──\n\n private _clipPlane: Plane | null = null;\n\n /**\n * Babylon.js `scene.clipPlane` — a single world-space clip plane\n * (`normal · p + d = 0`); fragments on the negative side are discarded.\n * Routed to Babylon Lite's opt-in `setClipPlane`.\n */\n public get clipPlane(): Plane | null {\n return this._clipPlane;\n }\n public set clipPlane(value: Plane | null) {\n this._clipPlane = value;\n if (value) {\n setClipPlane(this._lite, [value.normal.x, value.normal.y, value.normal.z, value.d]);\n } else {\n setClipPlane(this._lite, [0, 0, 0, 0]);\n }\n }\n\n // ── Environment / IBL (Babylon.js `scene.environmentTexture` + `createDefaultEnvironment`) ──\n\n public get environmentTexture(): CubeTexture | HDRCubeTexture | null {\n return this._envTexture;\n }\n public set environmentTexture(value: CubeTexture | HDRCubeTexture | null) {\n this._envTexture = value;\n }\n\n /**\n * Babylon.js `scene.environmentBRDFTexture` — the BRDF lookup used by PBR materials.\n * Babylon.js defaults this to an embedded Base64 LUT and lets apps swap in one of the\n * published variants (e.g. `https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png`).\n *\n * Two deliberate divergences: the getter returns `null` while unset (Babylon.js\n * populates it with the decoded default once a PBR material is created, whereas Lite\n * keeps the default as an embedded data URL and never materialises a texture object),\n * and the assigned texture's own GPU upload goes unused because Babylon Lite decodes\n * the LUT itself, from the URL, as part of building the environment.\n */\n public get environmentBRDFTexture(): BaseTexture | null {\n return this._brdfTexture;\n }\n public set environmentBRDFTexture(value: BaseTexture | null) {\n this._brdfTexture = value;\n }\n\n /**\n * Resolve the BRDF LUT URL for the environment loaders: an app-supplied\n * `environmentBRDFTexture`, else the embedded Babylon.js-style default.\n */\n private async _resolveBrdfUrl(): Promise<string> {\n const override = this._brdfTexture;\n if (!override) {\n return await getBrdfLutUrl();\n }\n // Compat `Texture` records its source URL as `name`; `CubeTexture`-likes expose `url`.\n // Procedural textures (`RawTexture`, `DynamicTexture`) have no source at all and leave\n // `name` empty, which would otherwise resolve to a fetch of the page itself.\n const url = ((override as unknown as { url?: string }).url ?? override.name).trim();\n if (!url) {\n Logger.Warn(\n `scene.environmentBRDFTexture: the assigned ${override.getClassName()} has no source URL, so the built-in LUT is used instead. ` +\n `Assign a \\`Texture\\` created from a URL to override it.`\n );\n return await getBrdfLutUrl();\n }\n // Babylon.js also publishes `.dds` LUTs, but Babylon Lite decodes the BRDF LUT with\n // `createImageBitmap`, which cannot read DDS. Warn and keep the built-in LUT rather\n // than failing engine startup — the default is the same correlated-MS variant most\n // apps select anyway, so the scene still renders correctly.\n if (url.split(/[?#]/)[0]!.toLowerCase().endsWith(\".dds\")) {\n Logger.Warn(\n `scene.environmentBRDFTexture '${url}': Babylon Lite decodes the BRDF LUT from an RGBD-encoded PNG and cannot read DDS, ` +\n `so the built-in LUT is used instead. Use the PNG variant (e.g. https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png) to silence this.`\n );\n return await getBrdfLutUrl();\n }\n return url;\n }\n\n /**\n * Babylon.js `scene.createDefaultEnvironment` — adds an IBL skybox and ground.\n * Babylon Lite performs this through `loadEnvironment` (deferred to engine start),\n * combining the environment URL recorded via `scene.environmentTexture` with\n * Babylon.js's default skybox/ground assets.\n */\n public createDefaultEnvironment(options: DefaultEnvironmentOptions = {}): { dispose(): void } {\n this._defaultEnvOptions = {\n createSkybox: true,\n createGround: true,\n ...options,\n // Babylon.js EnvironmentHelper sets up image processing by default.\n applyImageProcessing: options.setupImageProcessing !== false,\n };\n return { dispose(): void {} };\n }\n\n /**\n * Babylon.js `scene.createDefaultSkybox(texture, pbr?, scale?, blur?, setGlobalEnv?)` —\n * adds a skybox built from the given environment texture. Babylon Lite reuses the\n * loaded `.env` specular cubemap as an HDR skybox, so this records the env URL (if\n * not already set) and flags a skybox-from-environment load at engine start.\n */\n public createDefaultSkybox(texture?: CubeTexture | HDRCubeTexture, _pbr?: boolean, scale?: number, _blur?: number, _setGlobalEnv?: boolean): { dispose(): void } {\n if (texture) {\n this._envTexture = texture;\n }\n this._defaultEnvOptions = {\n ...(this._defaultEnvOptions ?? {}),\n createSkybox: true,\n createGround: false,\n skyboxFromEnv: true,\n ...(scale !== undefined ? { skyboxSize: scale } : {}),\n };\n return { dispose(): void {} };\n }\n\n /**\n * @internal Load the pending environment (IBL + skybox/ground) into the Lite\n * scene. Awaited by the engine before `registerScene` so the GPU env textures\n * exist when the scene builds.\n */\n public async _loadPendingEnvironment(): Promise<void> {\n // Babylon.js `createDefaultEnvironment` lights the scene from a built-in\n // environment even when no `environmentTexture` is assigned; fall back to\n // the default specular env so IBL-only scenes are lit correctly.\n const envUrl = this._envTexture?.url ?? (this._defaultEnvOptions ? DEFAULT_ENV_URL : undefined);\n if (!envUrl) {\n return;\n }\n const opts = this._defaultEnvOptions;\n const skyboxUrl = opts?.skyboxFromEnv ? envUrl : opts?.createSkybox ? DEFAULT_SKYBOX_URL : undefined;\n // Babylon.js `scene.environmentTexture = …` / `CubeTexture.CreateFromPrefilteredData`\n // does NOT change image processing — tone mapping stays at the scene's current\n // value (Babylon.js default: off). Babylon Lite's `loadEnvironment`/`loadDdsEnvironment`,\n // however, force tone mapping on (exposure 0.8 / contrast 1.2). That side effect is\n // wrong for ported code that only assigns `environmentTexture` (e.g. NME scenes), but it\n // happens to mirror what Babylon.js's `createDefaultEnvironment` (EnvironmentHelper) does.\n // Snapshot the scene's image-processing state and restore it after the env load so the\n // side effect is invisible; if `createDefaultEnvironment` was used we re-apply the\n // EnvironmentHelper image processing explicitly below — matching Babylon.js semantics.\n const ip = this._lite.imageProcessing;\n const ipSnapshot = { exposure: ip.exposure, contrast: ip.contrast, toneMappingEnabled: ip.toneMappingEnabled };\n // Babylon.js `CubeTexture.CreateFromPrefilteredData` accepts both `.env`\n // and `.dds` prefiltered environments. Babylon Lite splits these into two\n // loaders: `loadEnvironment` (`.env`) and `loadDdsEnvironment` (`.dds`).\n if (this._envTexture?._envLoaderKind === \"hdr\") {\n await loadHdrEnvironment(this._lite, envUrl, {\n // Forward the BJS `HDRCubeTexture` `size` as Lite's cubemap `faceSize`\n // so callers that request e.g. 512 are honoured (Lite otherwise defaults\n // to 256). Only `HDRCubeTexture` carries `_envLoaderKind === \"hdr\"`.\n faceSize: (this._envTexture as HDRCubeTexture).size,\n skyboxSize: opts?.skyboxSize ?? 1000,\n useCubemapSkybox: !!skyboxUrl,\n skipGround: !opts?.createGround,\n });\n } else if (envUrl.toLowerCase().endsWith(\".dds\")) {\n await loadDdsEnvironment(this._lite, envUrl, {\n brdfUrl: await this._resolveBrdfUrl(),\n skipSkybox: !opts?.createSkybox,\n skipGround: !opts?.createGround,\n });\n } else {\n await loadEnvironment(this._lite, envUrl, {\n brdfUrl: await this._resolveBrdfUrl(),\n skyboxUrl,\n skipSkybox: !opts?.createSkybox,\n groundTextureUrl: opts?.createGround ? DEFAULT_GROUND_URL : undefined,\n skipGround: !opts?.createGround,\n skyboxSize: opts?.skyboxSize ?? 1000,\n });\n }\n ip.exposure = ipSnapshot.exposure;\n ip.contrast = ipSnapshot.contrast;\n ip.toneMappingEnabled = ipSnapshot.toneMappingEnabled;\n // Babylon.js EnvironmentHelper (`createDefaultEnvironment`) sets up image processing\n // by default: tone mapping on with exposure 0.8 / contrast 1.2 (all overridable). Apply\n // it here so `createDefaultEnvironment` scenes (e.g. PBR sphere grids) keep their tone\n // mapping while plain `environmentTexture` scenes (e.g. NME) do not.\n if (opts?.applyImageProcessing) {\n ip.toneMappingEnabled = opts.toneMappingEnabled ?? true;\n ip.exposure = opts.cameraExposure ?? 0.8;\n ip.contrast = opts.cameraContrast ?? 1.2;\n }\n }\n\n /** Create and activate a default arc-rotate camera framing the scene. */\n public createDefaultCamera(_createArcRotateCamera = true, _replace = true, _attachControl = false): Camera {\n const lite = liteCreateDefaultCamera(this._lite) as LiteArcRotateCamera;\n const camera = ArcRotateCamera._adopt(\"default camera\", lite, this);\n this._activeCamera = camera;\n return camera;\n }\n\n /** Babylon.js `createDefaultCameraOrLight` — default framing camera plus a default hemispheric light. */\n public createDefaultCameraOrLight(createArcRotateCamera = false, replace = false, attachControl = false): void {\n this.createDefaultCamera(createArcRotateCamera, replace, attachControl);\n addToScene(this._lite, createHemisphericLight([0, 1, 0], 1.0));\n }\n\n /** Babylon.js render hook. No-op under Babylon Lite's engine-driven loop. */\n public render(): void {\n // Intentionally empty: Lite renders registered scenes via startEngine.\n }\n\n /**\n * Babylon.js readiness gate. Babylon Lite builds its scene synchronously and\n * defers GPU work into `registerScene`/`startEngine` (driven by the engine's\n * render loop), so there is nothing to await here — resolve immediately.\n */\n public whenReadyAsync(): Promise<void> {\n return Promise.resolve();\n }\n\n /** Babylon.js synchronous readiness check — always ready in the compat layer. */\n public isReady(): boolean {\n return true;\n }\n\n /** Babylon.js synchronous screen-coordinate picking over Lite's CPU ray picker. */\n public pick(x: number, y: number, predicate?: MeshPredicate, fastCheck = false, camera: Camera | null = null, trianglePredicate?: TrianglePickingPredicate): PickingInfo {\n const cameraToUse = camera ?? this.activeCamera ?? this.cameraToUseForPointers;\n if (!cameraToUse) {\n return new PickingInfo();\n }\n\n return this.pickWithRay(this.createPickingRay(x, y, null, cameraToUse), predicate, fastCheck, trianglePredicate);\n }\n\n /**\n * Babylon.js `Scene.createPickingRay` — translate CSS coordinates and camera\n * transforms into Lite's reverse-Z unprojection helper.\n */\n public createPickingRay(x: number, y: number, world: Matrix | null = null, camera: Camera | null = null, cameraViewSpace = false): Ray {\n const cameraToUse = camera ?? this.activeCamera ?? this.cameraToUseForPointers;\n if (!cameraToUse) {\n return Ray.Zero();\n }\n\n const scale = this._engine.getHardwareScalingLevel();\n const width = this._engine.getRenderWidth();\n const height = this._engine.getRenderHeight();\n const viewport = resolveCameraViewport(cameraToUse._lite, width, height);\n const worldMatrix = (world ?? Matrix.Identity()).m as unknown as Mat4;\n const projectionMatrix = cameraToUse.getProjectionMatrix().m as unknown as Mat4;\n let viewMatrix = Matrix.Identity().m as unknown as Mat4;\n if (!cameraViewSpace && cameraToUse._lite._useFloatingOrigin) {\n const absoluteView = invertMat4(cameraToUse._lite.worldMatrix);\n if (!absoluteView) {\n return Ray.Zero();\n }\n viewMatrix = absoluteView;\n } else if (!cameraViewSpace) {\n viewMatrix = cameraToUse.getViewMatrix().m as unknown as Mat4;\n }\n // Compat matrices use Babylon.js's row-vector multiplication order, while\n // Lite's kernel is column-major, so reverse the operands for the same bytes.\n const transform = multiplyMat4(projectionMatrix, multiplyMat4(viewMatrix, worldMatrix));\n const liteRay = liteCreatePickingRay(x / scale - viewport.x, y / scale - viewport.y, transform, viewport.width, viewport.height);\n if (!liteRay) {\n return Ray.Zero();\n }\n\n return new Ray(new Vector3(liteRay.origin[0], liteRay.origin[1], liteRay.origin[2]), new Vector3(liteRay.direction[0], liteRay.direction[1], liteRay.direction[2]));\n }\n\n /** Synchronous CPU ray picking over Babylon Lite's scene-mesh picker. */\n public pickWithRay(ray: Ray, predicate?: MeshPredicate, fastCheck = false, trianglePredicate?: TrianglePickingPredicate): PickingInfo {\n const candidates = new Set<LiteMesh>(this._lite.meshes);\n for (const wrapper of this.meshes) {\n if (wrapper instanceof AbstractMesh) {\n candidates.add(wrapper._lite);\n }\n }\n\n const wrappers = new Map<NonNullable<LitePickingInfo[\"pickedMesh\"]>, AbstractMesh>();\n for (const candidate of candidates) {\n const registered = this._meshWrappers.get(candidate);\n const wrapper = registered instanceof AbstractMesh ? registered : Mesh._fromLite(candidate, undefined, this);\n wrappers.set(candidate, wrapper);\n }\n\n const info = litePickWithRay(\n candidates,\n {\n origin: ray.origin.asArray(),\n direction: ray.direction.asArray(),\n length: ray.length,\n },\n {\n predicate: (mesh, thinInstanceIndex) => {\n const wrapper = wrappers.get(mesh);\n return !!wrapper && (predicate ? predicate(wrapper, thinInstanceIndex) : wrapper.isEnabled() && wrapper.isVisible && wrapper.isPickable);\n },\n skipPickableCheck: !!predicate,\n fastCheck,\n trianglePredicate: trianglePredicate\n ? (p0, p1, p2, localRay, i0, i1, i2) =>\n trianglePredicate(\n Vector3.FromArray(p0),\n Vector3.FromArray(p1),\n Vector3.FromArray(p2),\n new Ray(Vector3.FromArray(localRay.origin), Vector3.FromArray(localRay.direction), localRay.length),\n i0,\n i1,\n i2\n )\n : undefined,\n }\n );\n return PickingInfo._fromLite(info, info.pickedMesh ? (wrappers.get(info.pickedMesh) ?? null) : null, ray);\n }\n\n /** @internal The active Physics V2 engine, once `enablePhysics` has wired one. */\n private _physicsEngine: PhysicsEngine | null = null;\n\n /**\n * Babylon.js `scene.enablePhysics(gravity, plugin)`. Wires the given Havok V2\n * {@link HavokPlugin} to this scene, creating the native Lite physics world and\n * registering per-frame stepping. The plugin's `useDeltaForWorldStep` flag\n * controls whether the world advances by elapsed frame time (refresh-rate\n * independent — issue #332) or a fixed `1/60` step.\n *\n * Bodies are created with the native `createPhysicsAggregate` /\n * `createPhysicsBody` API against `scene.getPhysicsEngine().getPhysicsPlugin().world`.\n * @returns `true` once physics is enabled.\n */\n public enablePhysics(gravity?: { x: number; y: number; z: number } | null, plugin?: HavokPlugin): boolean {\n if (this._engine._headless) {\n return unsupported(\"Scene.enablePhysics\", \"A headless (NullEngine) scene has no render loop to step physics.\");\n }\n if (!(plugin instanceof HavokPlugin)) {\n return unsupported(\"Scene.enablePhysics\", \"Pass a `HavokPlugin` instance (Babylon Lite physics is Havok-V2 only).\");\n }\n const g = gravity ?? { x: 0, y: -9.81, z: 0 };\n plugin._attachToLiteScene(this._lite, g);\n onPhysicsAfterStep(plugin.world!, () => this.onAfterPhysicsObservable.notifyObservers(this));\n this._physicsEngine = new PhysicsEngine(plugin, g);\n return true;\n }\n\n /** Babylon.js `scene.getPhysicsEngine()` — the active Physics V2 engine, or `null`. */\n public getPhysicsEngine(): PhysicsEngine | null {\n return this._physicsEngine;\n }\n\n /** Babylon.js `scene.isPhysicsEnabled()`. */\n public isPhysicsEnabled(): boolean {\n return this._physicsEngine !== null;\n }\n\n /** Babylon.js `scene.disablePhysicsEngine()` — release the active physics world. */\n public disablePhysicsEngine(): void {\n if (this._physicsEngine) {\n this._physicsEngine.dispose();\n this._physicsEngine = null;\n }\n }\n\n /**\n * Babylon.js `scene.beginDirectAnimation(target, animations, from, to, loop, speedRatio?)`.\n * Delegates supported tracks to Babylon Lite property animation and retains\n * explicit compat evaluation only for unsupported tracks. Returns one facade\n * coordinating both subsets.\n */\n public beginDirectAnimation(target: unknown, animations: Animation[], from: number, to: number, loop = false, speedRatio = 1): Animatable {\n if (speedRatio < 0) {\n [from, to] = [to, from];\n speedRatio = -speedRatio;\n }\n if (from > to) {\n speedRatio = -speedRatio;\n }\n const blockedNativeBindings = this._runningAnimatables.flatMap((animatable) => animatable._getBlockingFallbackBindings());\n const animatable = Animatable._create(\n () => (this._propertyAnimationManager ??= createAnimationManager()),\n target,\n animations,\n from,\n to,\n loop,\n speedRatio,\n blockedNativeBindings\n );\n this._runningAnimatables.push(animatable);\n return animatable;\n }\n\n /** @internal Register a structural `AnimationGroup` to be stepped + blended each frame. */\n public _registerStructuralGroup(group: AnimationGroup): void {\n if (!this._structuralGroups.includes(group)) {\n this._structuralGroups.push(group);\n }\n }\n\n /** @internal Re-run weighted blending across all structural groups (after a seek/weight change). */\n public _recomputeStructuralBlends(): void {\n AnimationGroup._blendStructuralGroups(this._structuralGroups);\n }\n\n /**\n * @internal Route the scene's loaded Lite animation groups through a\n * scene-owned `AnimationManager` with weighted/additive blending enabled.\n *\n * Babylon.js treats the scene as an implicit animation mixer, so any loaded\n * group whose weight ≠ 1 (or that is made additive) must blend with its\n * siblings on the shared skeleton. Babylon Lite makes the manager explicit and\n * blending opt-in (`enableAnimationBlending`). When a glTF container is added,\n * Lite installs a per-group last-writer-wins tick (scene-core `addToScene`); we\n * detach each group's controller (`_ctrl`) so that tick skips them and the\n * weighted mixer — which drives groups via `_gltfMixer`, not `_ctrl` — owns the\n * pose instead. Idempotent.\n */\n public _enableLoadedBlend(): void {\n const liteGroups = this._lite.animationGroups ?? [];\n if (liteGroups.length === 0) {\n return;\n }\n if (!this._blendManager) {\n this._blendManager = createAnimationManager({ engine: this._engine._lite });\n enableAnimationBlending(this._blendManager);\n }\n for (const g of liteGroups) {\n addAnimationGroup(this._blendManager, g);\n (g as { _ctrl?: unknown })._ctrl = undefined;\n }\n }\n\n /**\n * Babylon.js `scene.beginAnimation(target, from, to, loop, speedRatio?)`. Runs\n * the animations already attached to `target.animations`.\n */\n public beginAnimation(target: { animations?: Animation[] }, from: number, to: number, loop = false, speedRatio = 1): Animatable {\n return this.beginDirectAnimation(target, target.animations ?? [], from, to, loop, speedRatio);\n }\n\n public dispose(): void {\n let hasError = false;\n let firstError: unknown;\n const runCleanup = (cleanup: () => void): void => {\n try {\n cleanup();\n } catch (error) {\n if (!hasError) {\n hasError = true;\n firstError = error;\n }\n }\n };\n\n runCleanup(() => this._detachPointerEvents());\n const observerResult = this.onDisposeObservable._notifyObserversSafely(this);\n if (observerResult.hasError && !hasError) {\n hasError = true;\n firstError = observerResult.error;\n }\n runCleanup(() => this.onDisposeObservable.clear());\n runCleanup(() => this.onPointerObservable.clear());\n runCleanup(() => this._beforeRenderFlushCallbacks.clear());\n if (this._propertyAnimationManager) {\n runCleanup(() => clearAnimationManager(this._propertyAnimationManager!));\n }\n if (this._blendManager) {\n runCleanup(() => clearAnimationManager(this._blendManager!));\n }\n this._runningAnimatables.length = 0;\n runCleanup(() => disposeScene(this._lite));\n if (hasError) {\n throw firstError;\n }\n }\n}\n","/**\n * Babylon.js-compatible light classes implemented over the Babylon Lite light\n * factories.\n *\n * Babylon.js lights take the scene in their constructor and auto-register; these\n * wrappers do the same by calling `addToScene` when a scene is supplied. The\n * underlying Lite light is exposed as `_lite` for advanced interop.\n *\n * As in Babylon.js, the getters hand out the light's own live objects, so both assignment\n * (`light.diffuse = new Color3(...)`) and in-place edits (`light.diffuse.copyFrom(c)`,\n * `light.direction.set(x, y, z)`, `light.position.y = 2`) reach the Lite light. Direction and\n * position are proxies over Lite's observable vectors; colours are proxies over the Lite colour\n * tuples, and every colour write bumps the light version so it reaches the lights UBO.\n */\n\nimport { addToScene, createHemisphericLight, createDirectionalLight, createPointLight, createSpotLight, removeFromScene } from \"babylon-lite\";\nimport type {\n HemisphericLight as LiteHemisphericLight,\n DirectionalLight as LiteDirectionalLight,\n PointLight as LitePointLight,\n SpotLight as LiteSpotLight,\n LightBase,\n} from \"babylon-lite\";\n\nimport { liteBackedColor3 } from \"../math/color.js\";\nimport type { Color3 } from \"../math/color.js\";\nimport { liteBackedVector3 } from \"../math/vector.js\";\nimport type { Vector3 } from \"../math/vector.js\";\nimport { Node } from \"../node/node.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\ntype Tuple3 = [number, number, number];\n\n/** Babylon.js `Light` — base class for all lights (derives from `Node`). */\nexport abstract class Light extends Node {\n /** @internal Underlying Babylon Lite light. */\n public abstract readonly _lite: LightBase;\n\n /**\n * @internal The {@link ClusteredLightContainer} that owns this light, if any.\n * Babylon.js moves a light out of the normal light path when it is added to a\n * clustered container; this back-link mirrors BJS's `light._clusteredContainer`\n * so a light cannot be added to two containers. Typed loosely to avoid a cycle\n * with the container module.\n */\n public _clusteredContainer: object | null = null;\n\n /**\n * @internal The compat shadow generator logically owned by this light,\n * including before its deferred Lite generator is built.\n */\n public _shadowGenerator: object | null = null;\n\n protected constructor(name: string, scene?: Scene) {\n super(name, scene);\n scene?._registerLight(this);\n }\n\n public override getClassName(): string {\n return \"Light\";\n }\n\n /**\n * @internal When the light is effectively disabled, its Lite intensity is\n * forced to `0` (zero contribution) and the caller-visible intensity is\n * parked here so {@link intensity} keeps reporting the real value and\n * re-enabling restores it. `null` means the light is effectively enabled.\n */\n private _disabledIntensity: number | null = null;\n\n /** @internal Typed accessor for the Lite light's `intensity` scalar. */\n private get _liteIntensity(): number {\n return (this._lite as unknown as { intensity: number }).intensity;\n }\n private set _liteIntensity(value: number) {\n (this._lite as unknown as { intensity: number }).intensity = value;\n this._bumpLiteVersion();\n }\n\n /**\n * @internal Lazily-resolved bump for the underlying Lite light's\n * `_lightVersion` (see {@link ensureLightVersionBump}). Cached after first use.\n */\n private _liteVersionBump: (() => void) | null = null;\n\n /**\n * @internal Advance the underlying Lite light's `_lightVersion`. Lite's shared\n * lights-UBO refresh is gated on the sum of every light's `_lightVersion`, and\n * factory lights only bump it on observable direction/position writes — never on\n * scalar `intensity` writes. Since these wrappers mutate `intensity` directly\n * (both `intensity` and `setEnabled`), this makes those writes reach the GPU.\n */\n protected _bumpLiteVersion(): void {\n this._liteVersionBump ??= ensureLightVersionBump(this._lite);\n this._liteVersionBump();\n }\n\n /**\n * @internal Babylon.js hands out the light's own `Color3`, so `light.diffuse.copyFrom(c)` or\n * `light.specular.set(0, 0, 0)` edits the light. Return a live proxy over the Lite tuple rather than a\n * copy (whose edits were silently dropped); a colour write cannot notify Lite, so it bumps the version.\n */\n protected _liveColor(tuple: Tuple3): Color3 {\n return liteBackedColor3(tuple, () => this._bumpLiteVersion());\n }\n\n /** @internal Assign a colour and publish it (a tuple write cannot notify Lite by itself). */\n protected _writeColor(tuple: Tuple3, value: Color3): void {\n tuple[0] = value.r;\n tuple[1] = value.g;\n tuple[2] = value.b;\n this._bumpLiteVersion();\n }\n\n /**\n * Babylon.js `light.intensity`. While the light is disabled the Lite light\n * carries `0`, but the getter still returns the logical value the caller set.\n */\n public get intensity(): number {\n return this._disabledIntensity ?? this._liteIntensity;\n }\n public set intensity(value: number) {\n if (this._disabledIntensity !== null) {\n this._disabledIntensity = value;\n } else {\n this._liteIntensity = value;\n }\n }\n\n /** @internal Materialize local and inherited enabled state in Babylon Lite. */\n protected override _onEffectiveEnabledStateChanged(enabled: boolean): void {\n if (!enabled) {\n if (this._disabledIntensity === null) {\n this._disabledIntensity = this._liteIntensity;\n this._liteIntensity = 0;\n }\n } else if (this._disabledIntensity !== null) {\n this._liteIntensity = this._disabledIntensity;\n this._disabledIntensity = null;\n }\n }\n\n /** Detach this light's shadow generator (compat for `light.shadowEnabled = false`). */\n public set shadowEnabled(enabled: boolean) {\n if (!enabled) {\n this._lite.shadowGenerator = undefined;\n }\n }\n\n /** @internal Detach Lite-owned state when this node is disposed directly or through an ancestor. */\n protected override _disposeSelf(_doNotRecurse: boolean): void {\n if (this._scene) {\n removeFromScene(this._scene._lite, this._lite);\n } else {\n this._lite.shadowGenerator = undefined;\n }\n }\n}\n\n/**\n * @internal Ensure the underlying Lite light exposes a `_bumpLightVersion()` that,\n * when called, advances its `_lightVersion`, and return that bump function. Reuses a\n * pre-existing `_bumpLightVersion` (e.g. installed by the glTF punctual-lights\n * feature) when present; otherwise wraps the light's existing `_lightVersion` getter\n * with an extra counter that the returned bump increments. Mirrors the shim pattern\n * in `babylon-lite`'s `gltf-feature-lights-punctual.ts`.\n */\nfunction ensureLightVersionBump(lite: LightBase): () => void {\n const existing = (lite as { _bumpLightVersion?: () => void })._bumpLightVersion;\n if (existing) {\n return existing;\n }\n const baseGet = Object.getOwnPropertyDescriptor(lite, \"_lightVersion\")?.get;\n let extra = 0;\n Object.defineProperty(lite, \"_lightVersion\", {\n get(): number {\n return (baseGet ? (baseGet.call(lite) as number) : 0) + extra;\n },\n enumerable: false,\n configurable: true,\n });\n const bump = (): void => {\n extra++;\n };\n Object.defineProperty(lite, \"_bumpLightVersion\", {\n value: bump,\n enumerable: false,\n configurable: true,\n });\n return bump;\n}\n\nexport class HemisphericLight extends Light {\n /** @internal Underlying Babylon Lite hemispheric light. */\n public readonly _lite: LiteHemisphericLight;\n\n public constructor(name: string, direction: Vector3, scene?: Scene) {\n super(name, scene);\n this._lite = createHemisphericLight(direction.asArray());\n if (scene) {\n addToScene(scene._lite, this._lite);\n }\n }\n\n public override getClassName(): string {\n return \"HemisphericLight\";\n }\n\n public get direction(): Vector3 {\n return liteBackedVector3(this._lite.direction);\n }\n public set direction(value: Vector3) {\n this._lite.direction.set(value.x, value.y, value.z);\n }\n\n public get diffuse(): Color3 {\n return this._liveColor(this._lite.diffuseColor);\n }\n public set diffuse(value: Color3) {\n this._writeColor(this._lite.diffuseColor, value);\n }\n\n public get specular(): Color3 {\n return this._liveColor(this._lite.specularColor);\n }\n public set specular(value: Color3) {\n this._writeColor(this._lite.specularColor, value);\n }\n\n public get groundColor(): Color3 {\n return this._liveColor(this._lite.groundColor);\n }\n public set groundColor(value: Color3) {\n this._writeColor(this._lite.groundColor, value);\n }\n}\n\nexport class DirectionalLight extends Light {\n /** @internal Underlying Babylon Lite directional light. */\n public readonly _lite: LiteDirectionalLight;\n\n public constructor(name: string, direction: Vector3, scene?: Scene) {\n super(name, scene);\n this._lite = createDirectionalLight(direction.asArray());\n if (scene) {\n addToScene(scene._lite, this._lite);\n }\n }\n\n public override getClassName(): string {\n return \"DirectionalLight\";\n }\n\n public get direction(): Vector3 {\n return liteBackedVector3(this._lite.direction);\n }\n public set direction(value: Vector3) {\n this._lite.direction.set(value.x, value.y, value.z);\n }\n\n public get position(): Vector3 {\n return liteBackedVector3(this._lite.position);\n }\n public set position(value: Vector3) {\n this._lite.position.set(value.x, value.y, value.z);\n }\n\n public get diffuse(): Color3 {\n return this._liveColor(this._lite.diffuse);\n }\n public set diffuse(value: Color3) {\n this._writeColor(this._lite.diffuse, value);\n }\n\n public get specular(): Color3 {\n return this._liveColor(this._lite.specular);\n }\n public set specular(value: Color3) {\n this._writeColor(this._lite.specular, value);\n }\n}\n\nexport class PointLight extends Light {\n /** @internal Underlying Babylon Lite point light. */\n public readonly _lite: LitePointLight;\n\n public constructor(name: string, position: Vector3, scene?: Scene) {\n super(name, scene);\n this._lite = createPointLight(position.asArray());\n if (scene) {\n addToScene(scene._lite, this._lite);\n }\n }\n\n public override getClassName(): string {\n return \"PointLight\";\n }\n\n public get range(): number {\n return this._lite.range;\n }\n public set range(value: number) {\n this._lite.range = value;\n }\n\n public get position(): Vector3 {\n return liteBackedVector3(this._lite.position);\n }\n public set position(value: Vector3) {\n this._lite.position.set(value.x, value.y, value.z);\n }\n\n public get diffuse(): Color3 {\n return this._liveColor(this._lite.diffuse);\n }\n public set diffuse(value: Color3) {\n this._writeColor(this._lite.diffuse, value);\n }\n\n public get specular(): Color3 {\n return this._liveColor(this._lite.specular);\n }\n public set specular(value: Color3) {\n this._writeColor(this._lite.specular, value);\n }\n}\n\nexport class SpotLight extends Light {\n /** @internal Underlying Babylon Lite spot light. */\n public readonly _lite: LiteSpotLight;\n\n public constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene?: Scene) {\n super(name, scene);\n this._lite = createSpotLight(position.asArray(), direction.asArray(), angle, exponent);\n if (scene) {\n addToScene(scene._lite, this._lite);\n }\n }\n\n public override getClassName(): string {\n return \"SpotLight\";\n }\n\n public get angle(): number {\n return this._lite.angle;\n }\n public set angle(value: number) {\n this._lite.angle = value;\n }\n\n public get exponent(): number {\n return this._lite.exponent;\n }\n public set exponent(value: number) {\n this._lite.exponent = value;\n }\n\n public get range(): number {\n return this._lite.range;\n }\n public set range(value: number) {\n this._lite.range = value;\n }\n\n public get position(): Vector3 {\n return liteBackedVector3(this._lite.position);\n }\n public set position(value: Vector3) {\n this._lite.position.set(value.x, value.y, value.z);\n }\n\n public get direction(): Vector3 {\n return liteBackedVector3(this._lite.direction);\n }\n public set direction(value: Vector3) {\n this._lite.direction.set(value.x, value.y, value.z);\n }\n\n public get diffuse(): Color3 {\n return this._liveColor(this._lite.diffuse);\n }\n public set diffuse(value: Color3) {\n this._writeColor(this._lite.diffuse, value);\n }\n\n public get specular(): Color3 {\n return this._liveColor(this._lite.specular);\n }\n public set specular(value: Color3) {\n this._writeColor(this._lite.specular, value);\n }\n}\n","/**\n * Babylon.js-compatible `ClusteredLightContainer` implemented over Babylon Lite's\n * clustered (forward+) lighting API (`createClusteredLightContainer` /\n * `createClusteredPointLight` / `addClusteredLightContainer`).\n *\n * A clustered container groups many point lights that PBR materials shade through\n * a screen-space cluster grid on the GPU. Babylon.js exposes it as a `Light`\n * subclass whose child point/spot lights are excluded from the ordinary\n * per-mesh light path; this wrapper mirrors that shape and forwards the feature\n * work to Lite — the clustering math lives entirely in Lite.\n *\n * Scope (⚡ partial): Babylon Lite's clustered spot payload cannot represent\n * Babylon.js exponent / inner-cone falloff, so only point lights are accepted.\n * Each added point light is snapshotted into a Lite clustered light at add time;\n * later in-place mutation of the source light does not propagate. `maxRange` is a\n * clustering optimisation Babylon Lite manages internally, so the property is\n * stored for shape parity but does not re-bin lights.\n */\n\nimport { addToScene, createClusteredLightContainer, createClusteredPointLight, addClusteredLightContainer, markClusteredLightContainerDirty, removeFromScene } from \"babylon-lite\";\nimport type { ClusteredLightContainer as LiteClusteredLightContainer, ClusteredPointLight as LiteClusteredPointLight, LightBase } from \"babylon-lite\";\n\nimport { Light, PointLight } from \"./lights.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport { unsupported } from \"../error.js\";\n\n/** The numeric light type id Babylon.js reports for a clustered container (`LIGHTTYPEID_CLUSTERED_CONTAINER`). */\nconst LIGHTTYPEID_CLUSTERED_CONTAINER = 5;\n\nfunction isSupportedPointLight(light: Light): light is PointLight {\n if (!(light instanceof PointLight)) {\n return false;\n }\n if (light.getScene()?.getEngine()._headless) {\n return false;\n }\n return light._shadowGenerator === null && light._lite.shadowGenerator === undefined;\n}\n\n/**\n * Babylon.js `ClusteredLightContainer` — a `Light` that renders a large set of\n * point lights through a clustered / forward+ system.\n */\nexport class ClusteredLightContainer extends Light {\n /**\n * @internal The underlying Babylon Lite clustered light container. The base\n * `Light._lite` is typed as `LightBase`, but a clustered container is a distinct\n * Lite object (not a punctual light); every base member that dereferences `_lite`\n * as a light is overridden below, so the value is only ever read back through\n * {@link _container}.\n */\n public readonly _lite: LightBase;\n\n /** @internal Typed handle to the Lite clustered container held in {@link _lite}. */\n private get _container(): LiteClusteredLightContainer {\n return this._lite as unknown as LiteClusteredLightContainer;\n }\n\n /** @internal Point lights added to this container (Babylon.js `container.lights`). */\n private readonly _childLights: PointLight[] = [];\n /** @internal Lite clustered point lights, parallel to {@link _childLights}. */\n private readonly _liteLights: LiteClusteredPointLight[] = [];\n /** @internal Whether the container has been registered on the Lite scene (engine start). */\n private _built = false;\n private _maxRange = 16383;\n private _selfIntensity = 1;\n\n /**\n * True if this point light can be represented by Lite's clustered payload.\n */\n public static IsLightSupported(light: Light): boolean {\n return isSupportedPointLight(light);\n }\n\n /**\n * Creates a new clustered light container.\n *\n * @param name - The container's node name.\n * @param lights - Initial point lights to cluster.\n * @param scene - Owning scene; when supplied the container is registered and\n * built into the Lite scene at engine start.\n */\n public constructor(name: string, lights: Light[] = [], scene?: Scene) {\n super(name, scene);\n this._lite = createClusteredLightContainer() as unknown as LightBase;\n if (scene) {\n scene._registerClusteredLightContainer(this);\n }\n for (const light of lights) {\n this.addLight(light);\n }\n }\n\n public override getClassName(): string {\n return \"ClusteredLightContainer\";\n }\n\n /** Babylon.js `light.getTypeID()` — `LIGHTTYPEID_CLUSTERED_CONTAINER`. */\n public getTypeID(): number {\n return LIGHTTYPEID_CLUSTERED_CONTAINER;\n }\n\n /** True when clustered lighting is available (Babylon Lite backs it on WebGPU). */\n public get isSupported(): boolean {\n return !this._scene?.getEngine()._headless;\n }\n\n /** The lights added to this clustering system. */\n public get lights(): readonly Light[] {\n return this._childLights;\n }\n\n /** Number of cluster tiles across the screen horizontally (default `64`). */\n public get horizontalTiles(): number {\n return this._container.horizontalTiles;\n }\n public set horizontalTiles(value: number) {\n this._container.horizontalTiles = value;\n this._markDirty();\n }\n\n /** Number of cluster tiles across the screen vertically (default `64`). */\n public get verticalTiles(): number {\n return this._container.verticalTiles;\n }\n public set verticalTiles(value: number) {\n this._container.verticalTiles = value;\n this._markDirty();\n }\n\n /** Number of depth slices used to bin lights along view-space Z (default `16`). */\n public get depthSlices(): number {\n return this._container.zSlices;\n }\n public set depthSlices(value: number) {\n this._container.zSlices = value;\n this._markDirty();\n }\n\n /**\n * Upper bound applied to clustered light ranges. Babylon Lite manages range\n * binning internally, so this is stored for API-shape parity and does not\n * re-cluster the lights.\n */\n public get maxRange(): number {\n return this._maxRange;\n }\n public set maxRange(value: number) {\n this._maxRange = value;\n }\n\n /** Babylon.js `container.addLight(light)`. */\n public addLight(light: Light): void {\n if (!isSupportedPointLight(light) || light._clusteredContainer) {\n return;\n }\n if (this._built) {\n // Lite bakes clustered capacity and point/spot layout into GPU state.\n // Growing after registration needs a Lite-owned rebuild lifecycle.\n unsupported(\n \"ClusteredLightContainer.addLight after engine start\",\n \"Lite bakes clustered-light capacity and layout into GPU state; dynamic growth needs a Lite-owned rebuild lifecycle.\"\n );\n }\n light._clusteredContainer = this;\n const position = light.position;\n const diffuse = light.diffuse;\n const liteLight = createClusteredPointLight(this._container, {\n position: [position.x, position.y, position.z],\n diffuse: [diffuse.r, diffuse.g, diffuse.b],\n range: light.range,\n intensity: light.intensity,\n });\n this._childLights.push(light);\n this._liteLights.push(liteLight);\n // Exclude the light from the ordinary per-mesh light path (Babylon.js\n // removes it from scene.lights when it joins a cluster). The detach targets\n // the light's OWN scene, never the container's: a light built against a\n // different scene (or none at all) must not touch this container's scene\n // bookkeeping, since `removeFromScene` also disposes the light's shadow\n // generator against the scene it is handed.\n const lightScene = light.getScene();\n if (lightScene) {\n lightScene._unregisterNode(light);\n removeFromScene(lightScene._lite, light._lite);\n }\n this._markDirty();\n }\n\n /**\n * Babylon.js `container.removeLight(light)`. Returns the index the light held\n * in the container's light list, or `-1` if it was not present.\n */\n public removeLight(light: Light): number {\n const index = this._childLights.findIndex((child) => child === light);\n if (index === -1) {\n return -1;\n }\n this._childLights.splice(index, 1);\n const liteLight = this._liteLights.splice(index, 1)[0];\n const j = liteLight ? this._container.pointLights.indexOf(liteLight) : -1;\n if (j !== -1) {\n this._container.pointLights.splice(j, 1);\n }\n light._clusteredContainer = null;\n // Return the light to the ordinary per-mesh light path of its own scene —\n // the mirror of the detach performed by {@link addLight}.\n const lightScene = light.getScene();\n if (lightScene) {\n lightScene._registerLight(light);\n addToScene(lightScene._lite, light._lite);\n }\n this._markDirty();\n return index;\n }\n\n /**\n * @internal Register the container on the Lite scene, wiring its clustered\n * lights into the scene's PBR materials. Deferred to engine start so meshes and\n * materials are settled; skipped on the device-less `NullEngine` and after\n * disposal. `_built` only flips once registration actually happened, so a skipped\n * build leaves the container re-buildable and keeps {@link _markDirty} from\n * touching GPU state that was never created.\n */\n public _build(): void {\n if (this._built || this.isDisposed()) {\n return;\n }\n const scene = this._scene;\n if (!scene || scene.getEngine()._headless) {\n return;\n }\n this._built = true;\n addClusteredLightContainer(scene._lite, this._container);\n }\n\n /** @internal Force a GPU re-upload of the clustered light set on the next frame (post-build). */\n private _markDirty(): void {\n if (this._built) {\n markClusteredLightContainerDirty(this._container);\n }\n }\n\n // ─── Base `Light` members overridden: a clustered container is not a punctual\n // Lite light, so intensity/shadow/enable/dispose must not touch `_lite`. ───\n\n /** Container-level intensity (Babylon.js inherits it from `Light`; each child light carries its own). */\n public override get intensity(): number {\n return this._selfIntensity;\n }\n public override set intensity(value: number) {\n this._selfIntensity = value;\n }\n\n /** Clustered lights do not cast shadows in Babylon.js; the toggle is a no-op. */\n public override set shadowEnabled(_enabled: boolean) {\n // no-op: clustered lighting has no shadow generator\n }\n\n protected override _onEffectiveEnabledStateChanged(_enabled: boolean): void {\n // no-op: the container has no single Lite intensity to zero\n }\n\n public override dispose(): void {\n // Drop the pending build registration so a container disposed before engine\n // start is neither retained by the scene nor wired into it later.\n this._scene?._unregisterClusteredLightContainer(this);\n // Babylon Lite owns the clustered GPU state via the scene and disposes it on\n // scene disposal; the base `Light.dispose` only detaches a shadow generator\n // (a harmless no-op here) before running Node cleanup.\n super.dispose();\n }\n}\n","/**\n * Babylon.js `CSG` (legacy) and `CSG2` (Manifold-based) constructive solid\n * geometry, wrapped over Babylon Lite's native CSG API.\n *\n * Babylon.js exposes two object-oriented CSG surfaces:\n * - `CSG.FromMesh(mesh)` → `.subtract` / `.intersect` / `.union` → `.toMesh(name, material, scene)`\n * - `CSG2.FromMesh(mesh)` → `.subtract` / `.intersect` / `.add` → `.toMesh(name, scene)` (+ `.dispose()`),\n * after `await InitializeCSG2Async()`.\n *\n * Babylon Lite ships the equivalent as standalone functions\n * (`createCsgFromMesh` / `csgSubtract` / … / `createMeshFromCsg`, and the CSG2\n * `createCsg2FromMesh` / `csg2Subtract` / … / `createMeshesFromCsg2`). These\n * classes adapt the function API to Babylon.js's method-chaining shape.\n *\n * CSG (legacy) `toMesh` takes an explicit material and produces a single mesh.\n * CSG2 preserves per-source materials: each `FromMesh` records its source mesh's\n * material against a unique slot, operations union those slot→material maps, and\n * `toMesh` triangulates into one Lite mesh per slot (`createMeshesFromCsg2`),\n * returning a single compat `Mesh` with the remaining sub-meshes parented under it\n * so positioning the result moves them together — matching Babylon.js's single\n * multi-material `toMesh` return.\n */\n\nimport {\n createCsgFromMesh,\n csgSubtract,\n csgIntersect,\n csgUnion,\n createMeshFromCsg,\n initializeCsg2Async,\n createCsg2FromMesh,\n csg2Subtract,\n csg2Intersect,\n csg2Add,\n createMeshesFromCsg2,\n disposeCsg2,\n addToScene,\n type CsgSolid,\n type Csg2Solid,\n type Material as LiteMaterial,\n} from \"babylon-lite\";\n\nimport { Mesh, registerMeshAtStart } from \"./meshes.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport { attachMaterialToScene } from \"../materials/materials.js\";\nimport type { StandardMaterial, PBRMaterial } from \"../materials/materials.js\";\nimport type { NodeMaterial } from \"../materials/node-material.js\";\n\ntype CompatMaterial = StandardMaterial | PBRMaterial | NodeMaterial;\n\n/** A compat mesh exposes its backing Lite mesh as `_lite`. */\ninterface MeshLike {\n _lite: import(\"babylon-lite\").Mesh;\n}\n\n/**\n * Babylon.js `CSG` — legacy constructive solid geometry. Build from a mesh with\n * {@link FromMesh}, combine with {@link subtract} / {@link intersect} /\n * {@link union}, then materialize with {@link toMesh}.\n */\nexport class CSG {\n private constructor(private readonly _lite: CsgSolid) {}\n\n /** Babylon.js `CSG.FromMesh(mesh)`. */\n public static FromMesh(mesh: MeshLike): CSG {\n return new CSG(createCsgFromMesh(mesh._lite));\n }\n\n /** Babylon.js `csg.subtract(other)` — `this − other`. */\n public subtract(other: CSG): CSG {\n return new CSG(csgSubtract(this._lite, other._lite));\n }\n\n /** Babylon.js `csg.intersect(other)`. */\n public intersect(other: CSG): CSG {\n return new CSG(csgIntersect(this._lite, other._lite));\n }\n\n /** Babylon.js `csg.union(other)`. */\n public union(other: CSG): CSG {\n return new CSG(csgUnion(this._lite, other._lite));\n }\n\n /** Babylon.js `csg.toMesh(name, material, scene)` — triangulate into a single mesh. */\n public toMesh(name: string, material: CompatMaterial | null, scene: Scene): Mesh {\n const engine = scene.getEngine()._lite;\n const lite = createMeshFromCsg(engine, this._lite, name);\n const mesh = new Mesh(name, lite, scene);\n // As in Babylon.js, the explicit material becomes the result's `material`. The registration at\n // engine start then finalizes whatever the mesh's effective material is by then, so a material\n // assigned to the returned mesh before startup (the usual follow-up to `toMesh(name, null, scene)`)\n // is not lost behind a captured argument.\n if (material) {\n mesh.material = material;\n }\n return registerMeshAtStart(mesh, scene);\n }\n}\n\n/** Module-wide unique material-slot counter for CSG2 (`MATERIAL_ID_RESERVE_COUNT` = 65536). */\nlet nextCsg2Slot = 0;\n\n/**\n * Babylon.js `CSG2` — Manifold-based constructive solid geometry that preserves\n * per-source-mesh materials. Call `await InitializeCSG2Async()` once before use.\n */\nexport class CSG2 {\n private constructor(\n private readonly _lite: Csg2Solid,\n /** Slot → source material, accumulated across operations. */\n private readonly _materials: Map<number, CompatMaterial>\n ) {}\n\n /** Babylon.js `CSG2.FromMesh(mesh)` — records the mesh's material against a unique slot. */\n public static FromMesh(mesh: MeshLike & { material?: CompatMaterial | null }): CSG2 {\n const slot = nextCsg2Slot++;\n const materials = new Map<number, CompatMaterial>();\n if (mesh.material) {\n materials.set(slot, mesh.material);\n }\n return new CSG2(createCsg2FromMesh(mesh._lite, slot), materials);\n }\n\n private _combine(lite: Csg2Solid, other: CSG2): CSG2 {\n const materials = new Map(this._materials);\n for (const [slot, material] of other._materials) {\n materials.set(slot, material);\n }\n return new CSG2(lite, materials);\n }\n\n /** Babylon.js `csg.subtract(other)` — `this − other`. */\n public subtract(other: CSG2): CSG2 {\n return this._combine(csg2Subtract(this._lite, other._lite), other);\n }\n\n /** Babylon.js `csg.intersect(other)`. */\n public intersect(other: CSG2): CSG2 {\n return this._combine(csg2Intersect(this._lite, other._lite), other);\n }\n\n /** Babylon.js `csg.add(other)` — union. */\n public add(other: CSG2): CSG2 {\n return this._combine(csg2Add(this._lite, other._lite), other);\n }\n\n /**\n * Babylon.js `csg.toMesh(name, scene)` — triangulate into a single mesh,\n * preserving each source mesh's material across the result's faces.\n */\n public toMesh(name: string, scene: Scene): Mesh {\n const engine = scene.getEngine()._lite;\n // Build a slot-indexed Lite material array (sparse; only referenced slots are read).\n const materials: LiteMaterial[] = [];\n for (const [slot, material] of this._materials) {\n attachMaterialToScene(material, scene);\n materials[slot] = material._lite as never;\n }\n const liteMeshes = createMeshesFromCsg2(engine, this._lite, materials, name);\n // `createMeshesFromCsg2` already assigned each sub-mesh its Lite material; wrapping\n // the first in a compat `Mesh` clobbers it with the scene default, so restore it.\n const savedMaterials = liteMeshes.map((m) => m.material);\n const root = new Mesh(name, liteMeshes[0]!, scene);\n const wrapped = root.material;\n root._lite.material = savedMaterials[0] as never;\n scene._deferAdd(() => {\n // The result renders with its source materials unless the app gave the returned mesh one of its\n // own before startup; that one is finalized and bound here like any other pre-start assignment.\n const assigned = root.material;\n if (assigned && assigned !== wrapped) {\n attachMaterialToScene(assigned, scene);\n root._lite.material = assigned._lite as never;\n }\n addToScene(scene._lite, root._lite);\n });\n // Parent the remaining material sub-meshes under the returned mesh so the whole\n // result moves as one (Babylon.js returns a single multi-material mesh).\n for (let i = 1; i < liteMeshes.length; i++) {\n const sub = liteMeshes[i]!;\n sub.material = savedMaterials[i] as never;\n (sub as unknown as { parent: unknown }).parent = root._lite;\n scene._deferAdd(() => addToScene(scene._lite, sub));\n }\n return root;\n }\n\n /** Babylon.js `csg.dispose()` — release the underlying Manifold solid. */\n public dispose(): void {\n disposeCsg2(this._lite);\n }\n}\n\n/** Babylon.js `InitializeCSG2Async()` — load the Manifold runtime before any `CSG2` use. */\nexport async function InitializeCSG2Async(): Promise<void> {\n await initializeCsg2Async();\n}\n","/**\n * Babylon.js `MeshoptCompression` (`@babylonjs/core/Meshes/Compression/meshoptCompression`).\n *\n * In Babylon.js this singleton owns the meshopt decoder used by the glTF\n * `EXT_meshopt_compression` loader extension, and apps configure its decoder URL\n * via the static `Configuration`. Babylon Lite decodes meshopt-compressed buffers\n * itself inside its glTF loader feature (`gltf-feature-meshopt`), so no external\n * decoder needs wiring. This compat shim therefore accepts the `Configuration`\n * assignment ported code performs (a no-op here) so the import resolves and the\n * asset still loads — the actual decode happens in Lite.\n */\nexport class MeshoptCompression {\n /**\n * Babylon.js `MeshoptCompression.Configuration` — the decoder location. Stored\n * for API parity but unused: Babylon Lite's glTF loader carries its own meshopt\n * decoder, so setting this has no effect on decoding.\n */\n public static Configuration: { decoder: { url: string } } = { decoder: { url: \"\" } };\n\n private static _default: MeshoptCompression | null = null;\n\n /** Babylon.js `MeshoptCompression.Default` — the lazily-created shared instance. */\n public static get Default(): MeshoptCompression {\n if (!MeshoptCompression._default) {\n MeshoptCompression._default = new MeshoptCompression();\n }\n return MeshoptCompression._default;\n }\n}\n","/**\n * Babylon.js-compatible `MorphTarget` / `MorphTargetManager` over the Babylon\n * Lite native morph API (`createMorphTargets` / `setMorphTargetWeights`).\n *\n * Babylon.js morph targets carry **absolute** vertex positions/normals\n * (`target.setPositions(abs)`); Babylon Lite's `createMorphTargets` consumes\n * per-target **deltas** (target − base). The manager defers building the Lite\n * morph until engine start (when the owning mesh's base CPU geometry exists),\n * computes the deltas, and assigns the resulting `MorphTargetData` onto the\n * Lite mesh so the Standard/NME pipelines sample it. Weight changes\n * (`target.influence = …`) re-upload via `setMorphTargetWeights`.\n */\n\nimport { createMorphTargets, setMorphTargetWeights } from \"babylon-lite\";\nimport type { EngineContext, MorphTargetData } from \"babylon-lite\";\n\nimport type { Scene } from \"../scene/scene.js\";\nimport type { Mesh } from \"../meshes/meshes.js\";\n\n/** Babylon.js `MorphTarget` — a single named morph influence with absolute target geometry. */\nexport class MorphTarget {\n public name: string;\n /** @internal Absolute target positions (Babylon.js `setPositions`). */\n public _positions: Float32Array | null = null;\n /** @internal Absolute target normals (Babylon.js `setNormals`). */\n public _normals: Float32Array | null = null;\n /** @internal Owning manager, set on `addTarget`, used to push weight updates. */\n public _manager: MorphTargetManager | undefined;\n private _influence: number;\n\n public constructor(name: string, influence = 0, _scene?: Scene) {\n this.name = name;\n this._influence = influence;\n }\n\n public get influence(): number {\n return this._influence;\n }\n public set influence(value: number) {\n this._influence = value;\n this._manager?._syncWeights();\n }\n\n /** Babylon.js `MorphTarget.setPositions(data)` — absolute target positions. */\n public setPositions(data: Float32Array | number[] | null): void {\n this._positions = data ? (data instanceof Float32Array ? data : Float32Array.from(data)) : null;\n }\n\n /** Babylon.js `MorphTarget.getPositions()`. */\n public getPositions(): Float32Array | null {\n return this._positions;\n }\n\n /** Babylon.js `MorphTarget.setNormals(data)` — absolute target normals. */\n public setNormals(data: Float32Array | number[] | null): void {\n this._normals = data ? (data instanceof Float32Array ? data : Float32Array.from(data)) : null;\n }\n\n /** Babylon.js `MorphTarget.getNormals()`. */\n public getNormals(): Float32Array | null {\n return this._normals;\n }\n}\n\n/** Babylon.js `MorphTargetManager` — owns a mesh's morph targets (Babylon Lite supports up to 4). */\nexport class MorphTargetManager {\n /** @internal */\n public _engine: EngineContext | undefined;\n /** @internal Built Lite morph data (created at engine start). */\n public _lite: MorphTargetData | undefined;\n private readonly _targets: MorphTarget[] = [];\n\n public constructor(_scene?: Scene) {\n // Scene retained implicitly via the mesh that adopts this manager.\n }\n\n public get numTargets(): number {\n return this._targets.length;\n }\n\n public getTarget(index: number): MorphTarget {\n return this._targets[index]!;\n }\n\n /** Babylon.js `MorphTargetManager.addTarget(target)`. */\n public addTarget(target: MorphTarget): void {\n target._manager = this;\n this._targets.push(target);\n }\n\n /**\n * @internal Build the Lite morph data from the mesh's base CPU geometry and\n * each target's absolute positions/normals (converted to deltas), then assign\n * it onto the Lite mesh. Called by the engine at start, once geometry exists.\n */\n public _build(mesh: Mesh, engine: EngineContext): void {\n const lite = mesh._lite as { _cpuPositions?: Float32Array; _cpuNormals?: Float32Array; morphTargets?: MorphTargetData | null };\n const base = lite._cpuPositions;\n if (!base) {\n return;\n }\n this._engine = engine;\n const vertexCount = base.length / 3;\n const baseNormals = lite._cpuNormals;\n const targets = this._targets.slice(0, 4).map((t) => {\n const abs = t._positions;\n const positions = new Float32Array(base.length);\n if (abs) {\n for (let i = 0; i < base.length; i++) {\n positions[i] = (abs[i] ?? 0) - base[i]!;\n }\n }\n let normals: Float32Array | null = null;\n if (t._normals && baseNormals) {\n normals = new Float32Array(baseNormals.length);\n for (let i = 0; i < baseNormals.length; i++) {\n normals[i] = (t._normals[i] ?? 0) - baseNormals[i]!;\n }\n }\n return { positions, normals };\n });\n const weights = this._targets.slice(0, 4).map((t) => t.influence);\n this._lite = createMorphTargets(engine, targets, vertexCount, weights);\n lite.morphTargets = this._lite;\n }\n\n /** @internal Re-upload current target influences to the GPU weights buffer. */\n public _syncWeights(): void {\n if (!this._lite || !this._engine) {\n return;\n }\n const weights = this._targets.slice(0, 4).map((t) => t.influence);\n setMorphTargetWeights(this._engine, this._lite, weights);\n }\n}\n","/**\n * Babylon.js-compatible `GaussianSplattingMesh` over Babylon Lite's splat loaders.\n *\n * Babylon Lite fully backs Gaussian Splatting: `loadSplat` (`.ply` / `.splat` /\n * compressed-PLY), `loadSOG`, and `loadSPZ` each return a `GaussianSplattingMesh`\n * (a `SceneNode` carrying the splat cloud), with `splatsData` / `updateData` for\n * in-place edits and `bakeCurrentTransformIntoVertices` to fold the node transform\n * into the splat data. This wrapper exposes that through the Babylon.js\n * `GaussianSplattingMesh` shape so ported scenes (`new GaussianSplattingMesh(...)` +\n * `loadFileAsync`, or `ImportMeshAsync` of a splat URL) run unchanged.\n *\n * Babylon.js constructs the mesh synchronously and populates it via\n * `loadFileAsync`; Babylon Lite loads atomically. We bridge this by holding a\n * lightweight placeholder transform node until the splat loads, buffering any\n * transforms set in the meantime, then adopting the loaded Lite node.\n */\n\nimport { loadSplat, loadSOG, loadSPZ, bakeCurrentTransformIntoVertices, createTransformNode, setParent } from \"babylon-lite\";\nimport type { GaussianSplattingMesh as LiteGsMesh, GsShaderFragment, SceneNode } from \"babylon-lite\";\n\nimport { TransformNode } from \"./meshes.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { Vector3 } from \"../math/vector.js\";\nimport { liteBackedVector3 } from \"../math/vector.js\";\n\n/**\n * Babylon.js `ISafeOrbitCameraLimits` — safe-orbit camera limits embedded in a Gaussian\n * Splatting file's metadata (Adobe safe-orbit extension). Exposed on the loaded mesh via\n * {@link GaussianSplattingMesh.safeOrbitCameraLimits} for shape parity with `@babylonjs/core`.\n */\nexport interface ISafeOrbitCameraLimits {\n /** Minimum safe orbit radius (distance from the camera to its target), if the file specifies one. */\n radiusMin?: number;\n /** Safe elevation range as `[minElevation, maxElevation]` in radians, if the file specifies one. */\n elevationMinMax?: [number, number];\n}\n\n/** Lite loader chosen by file extension (mirrors the BJS splat plugin dispatch). */\nfunction liteLoaderFor(url: string): (scene: import(\"babylon-lite\").SceneContext, url: string, fragments?: readonly GsShaderFragment[]) => Promise<LiteGsMesh> {\n const lower = url.split(\"?\")[0]!.toLowerCase();\n if (lower.endsWith(\".sog\") || lower.endsWith(\".zip\")) {\n return loadSOG;\n }\n if (lower.endsWith(\".spz\")) {\n return loadSPZ;\n }\n // `.ply`, `.splat`, and compressed-PLY all flow through `loadSplat`.\n return loadSplat;\n}\n\n/** `.splat` row stride: position(3f) + scale(3f) + rgba(4×u8) + rot(4×u8) = 32 bytes. */\nconst SPLAT_ROW_BYTES = 32;\nconst SPLAT_ROW_FLOATS = SPLAT_ROW_BYTES / 4;\nconst SPLAT_Y_FLOAT_INDEX = 1;\n\n/**\n * @internal Return a copy of a `.splat` buffer with every row's centre Y negated\n * (the position-space half of Babylon.js's `flipY`). Used to reproduce\n * `updateData(..., { flipY: false })`. Only the 32-byte `.splat` row layout is\n * handled; other buffers are returned unchanged.\n */\nfunction mirrorSplatRowY(buffer: ArrayBuffer): ArrayBuffer {\n if (buffer.byteLength % SPLAT_ROW_BYTES !== 0) {\n return buffer;\n }\n const copy = buffer.slice(0);\n const floats = new Float32Array(copy);\n for (let f = SPLAT_Y_FLOAT_INDEX; f < floats.length; f += SPLAT_ROW_FLOATS) {\n floats[f] = -floats[f]!;\n }\n return copy;\n}\n\n/**\n * Babylon.js `GaussianSplattingMesh`. Derives from `TransformNode` so the loaded\n * cloud's `position` / `rotation` / `scaling` proxy onto the Lite splat node.\n */\nexport class GaussianSplattingMesh extends TransformNode {\n /** @internal The loaded Lite splat node (undefined until `loadFileAsync` resolves). */\n private _gs?: LiteGsMesh;\n /** @internal The constructor's deferred URL, loaded by `loadFileAsync()` with no argument. */\n private readonly _ctorUrl: string | null;\n /** @internal Optional Lite shader-fragment plugins applied at load (scene 126). */\n private _fragments?: readonly GsShaderFragment[];\n\n /**\n * Babylon.js `gs.safeOrbitCameraLimits` — safe-orbit camera limits parsed from the source\n * file's metadata (Adobe safe-orbit extension), or `null` when the file carries none.\n *\n * Babylon Lite's splat loaders (`loadSplat` / `loadSOG` / `loadSPZ`) do not parse the Adobe\n * safe-orbit metadata block, so this stays `null` — matching BJS's own default for a file\n * without the extension. Populating it from real metadata needs a (non-tree-shakeable) change\n * to Lite's splat loaders; the field is exposed here for shape parity so ported reads resolve.\n */\n public safeOrbitCameraLimits: ISafeOrbitCameraLimits | null = null;\n\n public constructor(name: string, url?: string | null, scene?: Scene, _keepInRam?: boolean) {\n // A placeholder transform node carries any transforms set before the splat\n // loads; it is never added to the scene (Lite `loadSplat` registers the real\n // splat node). Transforms are copied onto the loaded node in `loadFileAsync`.\n super(name, scene, createTransformNode(name));\n this._ctorUrl = url ?? null;\n }\n\n public override getClassName(): string {\n return \"GaussianSplattingMesh\";\n }\n\n /** @internal The wrapper's transform node; the loaded cloud is parented beneath it during deferred adoption. */\n private get _xform(): SceneNode {\n return this._gs?.parent === this._node ? this._node : (this._gs ?? this._node);\n }\n\n /** @internal Accessibility metadata belongs to the loaded cloud, or its placeholder before loading. */\n protected override _accessibilitySource(): object {\n return this._gs ?? this._node;\n }\n\n public override get position(): Vector3 {\n return liteBackedVector3(this._xform.position);\n }\n public override set position(value: Vector3) {\n this._xform.position.set(value.x, value.y, value.z);\n }\n\n public override get rotation(): Vector3 {\n return liteBackedVector3(this._xform.rotation);\n }\n public override set rotation(value: Vector3) {\n this._xform.rotation.set(value.x, value.y, value.z);\n }\n\n public override get scaling(): Vector3 {\n return liteBackedVector3(this._xform.scaling);\n }\n public override set scaling(value: Vector3) {\n this._xform.scaling.set(value.x, value.y, value.z);\n }\n\n /** @internal Set the Lite shader-fragment plugins applied on the next load (compat material-plugin path). */\n public _setFragments(fragments: readonly GsShaderFragment[]): void {\n this._fragments = fragments;\n }\n\n /**\n * Babylon.js `gs.loadFileAsync(url?)` — fetch + parse a splat asset and adopt\n * the resulting Lite node. With no argument, loads the constructor URL.\n */\n public async loadFileAsync(url?: string): Promise<GaussianSplattingMesh> {\n const target = url ?? this._ctorUrl;\n if (!target) {\n throw new Error(\"GaussianSplattingMesh.loadFileAsync: no URL provided (and none given to the constructor).\");\n }\n const scene = this._scene;\n if (!scene) {\n throw new Error(\"GaussianSplattingMesh.loadFileAsync requires a scene (pass one to the constructor).\");\n }\n const lite = await liteLoaderFor(target)(scene._lite, target, this._fragments);\n this._adopt(lite);\n return this;\n }\n\n /**\n * @internal Adopt a loaded Lite splat node from either the mesh or loader-plugin API.\n * Parenting preserves the loader's format-specific local transform while composing it\n * with transforms applied to the wrapper before loading.\n */\n public _adopt(lite: LiteGsMesh): void {\n const placeholder = this._node;\n const previousAccessibilitySource = this._accessibilitySource();\n lite.parent = placeholder;\n placeholder.children.push(lite);\n lite.name = this.name;\n this._gs = lite;\n this._syncAccessibilityTag(previousAccessibilitySource);\n this._scene?._registerMesh(this);\n }\n\n /** @internal Wrap an already-loaded Lite splat node (used by the loader's `ImportMeshAsync` path). */\n public static _fromLite(lite: LiteGsMesh, scene: Scene): GaussianSplattingMesh {\n const mesh = new GaussianSplattingMesh(lite.name, null, scene);\n mesh._gs = lite;\n scene._registerMesh(mesh);\n return mesh;\n }\n\n /** Babylon.js `gs.splatsData` — the raw 32-byte/splat row buffer (for inspection / `updateData`). */\n public get splatsData(): ArrayBuffer | null {\n return this._gs ? this._gs.splatsData : null;\n }\n\n /**\n * Babylon.js `gs.updateData(buffer, sh?, options?)` — replace the splat data in\n * place. Babylon Lite always applies its loader's Y convention on update; the\n * `sh` argument is accepted for signature parity and ignored.\n *\n * `options.flipY === false` is honoured: Babylon.js's `.splat` loader flips Y\n * on load by default, so `flipY:false` re-uploads the buffer **without** that\n * flip — i.e. mirrored relative to the default-loaded pose, which ported scenes\n * then correct with `scaling.y = -1`. Lite has no per-call flip flag and always\n * applies its (flip-on-load-equivalent) convention, so we mirror the row Y here\n * to reproduce the `flipY:false` pose before handing the buffer to Lite.\n */\n public updateData(splatBuffer: ArrayBuffer, _sh?: unknown, options?: { flipY?: boolean }): void {\n const buffer = options?.flipY === false ? mirrorSplatRowY(splatBuffer) : splatBuffer;\n this._gs?.updateData(buffer);\n }\n\n /** Babylon.js `gs.bakeCurrentTransformIntoVertices()` — fold the node transform into the splat data. */\n public bakeCurrentTransformIntoVertices(): void {\n if (this._gs) {\n bakeCurrentTransformIntoVertices(this._gs);\n if (this._gs.parent === this._node) {\n const userChildren = this._node.children.filter((child) => child !== this._gs && child.parent === this._node);\n for (const child of this.getChildren(undefined, true)) {\n if (child instanceof TransformNode && child._node !== this._gs && !userChildren.includes(child._node)) {\n userChildren.push(child._node);\n }\n }\n for (const child of userChildren) {\n setParent(child, null);\n }\n this._node.position.set(0, 0, 0);\n this._node.rotation.set(0, 0, 0);\n this._node.scaling.set(1, 1, 1);\n for (const child of userChildren) {\n setParent(child, this._node);\n }\n }\n }\n }\n\n /** @internal Babylon.js's worker-throttle flag; ported scenes poll it to detect the first sort. */\n public get _canPostToWorker(): boolean {\n return this._gs ? this._gs._orderPool.length === 2 : false;\n }\n\n /** @internal The loaded Lite splat node, for the GPU picker's result mapping (undefined until loaded). */\n public get _pickLiteNode(): LiteGsMesh | undefined {\n return this._gs;\n }\n}\n","import { createDefaultMeshBlendRadiusDefinitions, packMeshBlendingTag, unpackMeshBlendingTag } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\n\nexport enum MeshBlendingRadiusClass {\n Small = 0,\n Medium = 1,\n Large = 2,\n ExtraLarge = 3,\n}\n\nexport interface IMeshBlendingTag {\n groupId: number;\n radiusClass: MeshBlendingRadiusClass;\n}\n\nexport function PackMeshBlendingTag(groupId: number, radiusClass: MeshBlendingRadiusClass): number {\n return packMeshBlendingTag(groupId, radiusClass);\n}\n\nexport function UnpackMeshBlendingTag(tag: number): IMeshBlendingTag {\n const unpacked = unpackMeshBlendingTag(tag);\n return {\n groupId: unpacked.groupId,\n radiusClass: unpacked.radiusClass as MeshBlendingRadiusClass,\n };\n}\n\nexport enum MeshBlendQuality {\n Low = 0,\n Medium = 1,\n High = 2,\n Cinematic = 3,\n}\n\nexport enum MeshBlendDebugMode {\n Off = 0,\n PackedTag = 1,\n CandidateDirectionDistance = 2,\n SeamFade = 3,\n RejectionReason = 4,\n StageWork = 5,\n Continuation = 6,\n TinyObject = 7,\n MultiTarget = 8,\n TargetColor = 9,\n ShadowAttenuation = 10,\n ColorInterpolation = 11,\n WorldPosition = 12,\n}\n\nexport enum MeshBlendDepthType {\n View = 0,\n Screen = 1,\n}\n\nexport interface IMeshBlendRadiusDefinition {\n worldRadius: number;\n minimumProjectedRadius: number;\n}\n\nexport type MeshBlendRadiusDefinitions = readonly [IMeshBlendRadiusDefinition, IMeshBlendRadiusDefinition, IMeshBlendRadiusDefinition, IMeshBlendRadiusDefinition];\n\nexport interface IMeshBlendConfiguration {\n quality?: MeshBlendQuality;\n radiusClasses?: MeshBlendRadiusDefinitions;\n slopeFactor?: number;\n depthType?: MeshBlendDepthType;\n debugMode?: MeshBlendDebugMode;\n}\n\nexport interface IThinMeshBlendingPostProcessOptions extends IMeshBlendConfiguration {\n [key: string]: unknown;\n}\n\nexport interface IMeshBlendingPostProcessOptions extends IMeshBlendConfiguration {\n effectWrapper?: ThinMeshBlendingPostProcess;\n meshBlendTagTexture: unknown;\n depthTexture: unknown;\n baseColorTexture?: unknown;\n [key: string]: unknown;\n}\n\nexport function CreateDefaultMeshBlendRadiusDefinitions(): MeshBlendRadiusDefinitions {\n return createDefaultMeshBlendRadiusDefinitions();\n}\n\nconst MESH_BLENDING_BLOCKER =\n \"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.\";\n\nexport class ThinMeshBlendingPostProcess {\n public constructor(..._args: unknown[]) {\n unsupported(\"ThinMeshBlendingPostProcess\", MESH_BLENDING_BLOCKER);\n }\n}\n\nexport class MeshBlendingPostProcess {\n public constructor(..._args: unknown[]) {\n unsupported(\"MeshBlendingPostProcess\", MESH_BLENDING_BLOCKER);\n }\n}\n\nexport class FrameGraphMeshBlendingTask {\n public constructor(..._args: unknown[]) {\n unsupported(\"FrameGraphMeshBlendingTask\", MESH_BLENDING_BLOCKER);\n }\n}\n\nexport class NodeRenderGraphMeshBlendingPostProcessBlock {\n public constructor(..._args: unknown[]) {\n unsupported(\"NodeRenderGraphMeshBlendingPostProcessBlock\", MESH_BLENDING_BLOCKER);\n }\n}\n\nexport function RegisterMeshBlendingPostProcessBlock(): never {\n return unsupported(\"RegisterMeshBlendingPostProcessBlock\", MESH_BLENDING_BLOCKER);\n}\n","/**\n * Babylon.js-compatible texture wrappers over Babylon Lite's `loadTexture2D`.\n *\n * Babylon.js's `Texture` constructor is synchronous and loads in the background.\n * Babylon Lite loads textures asynchronously. The compat `Texture` kicks off the\n * load in its constructor and resolves `_lite` when ready; assign the texture to\n * a material after `await texture.whenReadyAsync()` (or construct via\n * `Texture.LoadAsync`) so the GPU handle is present when the material binds.\n */\n\nimport {\n loadTexture2D,\n loadBasisTexture2D,\n loadKtxTexture2D,\n createTexture2DFromPixels,\n updateTexture2DFromPixels,\n createTexture3DFromPixels,\n createDynamicTexture,\n updateDynamicTexture,\n createHtmlTexture,\n requestHtmlTextureUpdate,\n updateHtmlTexture,\n disposeHtmlTexture,\n whenHtmlTextureReady,\n} from \"babylon-lite\";\nimport type { Texture2D, Texture2DOptions, EngineContext, Texture3D, DynamicTexture2D, HtmlTexture2D } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport type { AbstractEngine } from \"../engine/engine.js\";\nimport { Matrix } from \"../math/matrix.js\";\nimport { Observable } from \"../misc/observable.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\n/** Compression suffix → `loadKtxTexture2D` token, recognised in a pre-resolved KTX URL. */\nconst KTX_SUFFIX_RE = /(-astc|-dxt|-etc2|-pvrtc)\\.ktx(\\?.*)?$/i;\n\n/**\n * @internal Recognise a pre-resolved compressed KTX URL and split it into the\n * `{ baseUrl, suffix }` pair Babylon Lite's `loadKtxTexture2D` expects (which\n * takes a base image URL plus a format suffix and reconstructs the KTX URL\n * itself), or `null` when the URL is not a compressed KTX.\n *\n * Babylon.js code selects the format via `engine.getCaps()` and hands `Texture`\n * a single fully-qualified `.ktx` URL (e.g. `…/grid-dxt.ktx`), so the base is the\n * `.png` fallback (`…/grid.png`) and the suffix is `-dxt.ktx`. Any query string\n * (auth / cache-busting / signed-URL params) is preserved on the base URL so it\n * survives onto both the KTX fetch and the `.png` fallback.\n */\nexport function resolveKtxUrl(url: string): { baseUrl: string; suffix: string } | null {\n const ktx = url.match(KTX_SUFFIX_RE);\n if (!ktx) {\n return null;\n }\n return { baseUrl: url.replace(KTX_SUFFIX_RE, \".png$2\"), suffix: ktx[1]! + \".ktx\" };\n}\n\n/**\n * Pick the right Babylon Lite loader for a texture URL:\n * - `.basis` → `loadBasisTexture2D` (GPU-format transcode; manages its own V-flip).\n * - a pre-resolved compressed KTX (`…-dxt.ktx` etc.) → `loadKtxTexture2D` (see\n * {@link resolveKtxUrl}), which re-checks device support and falls back to the\n * base image.\n * - everything else → the raster `loadTexture2D`.\n *\n * The basis/KTX loaders manage their own V-orientation, so the raster-only\n * `invertY` / `mipMaps` options are ignored there — passing the same opts is safe.\n */\nfunction loadCompatTexture(engine: EngineContext, url: string, opts: Texture2DOptions): Promise<Texture2D> {\n const path = url.split(/[?#]/)[0]!.toLowerCase();\n if (path.endsWith(\".basis\")) {\n return loadBasisTexture2D(engine, url, opts);\n }\n const ktx = resolveKtxUrl(url);\n if (ktx) {\n return loadKtxTexture2D(engine, ktx.baseUrl, [ktx.suffix], opts);\n }\n return loadTexture2D(engine, url, opts);\n}\n\nexport abstract class BaseTexture {\n public name = \"\";\n /** @internal The underlying Lite texture handle. Undefined until the async load resolves. */\n public _lite: Texture2D | undefined;\n\n /** @internal One-shot listeners fired when the GPU handle first resolves (see {@link _onReady}). */\n private _readyListeners: Array<() => void> | undefined;\n\n public getClassName(): string {\n return \"BaseTexture\";\n }\n\n /**\n * @internal Register a callback fired once this texture's GPU handle resolves.\n * Owning compat materials use it to rebind and rebuild once an asynchronously\n * loaded texture becomes available. Fires immediately if the handle already\n * exists; otherwise queues until {@link _notifyReady}. One-shot per listener.\n */\n public _onReady(listener: () => void): void {\n if (this._lite) {\n listener();\n return;\n }\n (this._readyListeners ??= []).push(listener);\n }\n\n /** @internal Fire and clear the readiness listeners (called by subclasses once `_lite` resolves). */\n protected _notifyReady(): void {\n const listeners = this._readyListeners;\n if (listeners) {\n this._readyListeners = undefined;\n for (const listener of listeners) {\n listener();\n }\n }\n }\n\n /**\n * Babylon.js `BaseTexture.getInternalTexture()` — the backend texture handle. Babylon.js\n * returns an `InternalTexture`; the compat layer's equivalent is the Lite texture handle,\n * which is what the compat engine's texture methods accept.\n */\n public getInternalTexture(): Texture2D | null {\n return this._lite ?? null;\n }\n\n public abstract whenReadyAsync(): Promise<void>;\n\n public dispose(): void {\n // Lite texture lifetimes are managed by the GPU resource pool; explicit\n // disposal is a no-op in the compat layer.\n }\n}\n\n/** Options accepted by Babylon.js `HtmlTexture`. */\nexport interface IHtmlTextureOptions {\n width?: number;\n height?: number;\n generateMipMaps?: boolean;\n samplingMode?: number;\n format?: number;\n autoUpdate?: boolean;\n useSvgFallback?: boolean;\n engine?: AbstractEngine | null;\n scene?: Scene | null;\n}\n\n/** Babylon.js `HtmlTexture`, forwarding DOM capture and updates to Babylon Lite. */\nexport class HtmlTexture extends BaseTexture {\n public readonly element: HTMLElement;\n public readonly host: HTMLElement | null;\n public readonly onLoadObservable = new Observable<HtmlTexture>(undefined, true);\n private readonly _engine: AbstractEngine | null;\n private readonly _textureMatrix = Matrix.Identity();\n private readonly _ready: Promise<void>;\n private _htmlTexture: HtmlTexture2D | undefined;\n private _disposed = false;\n\n public constructor(name: string, element: HTMLElement, options: IHtmlTextureOptions) {\n super();\n this.name = name;\n this.element = element;\n this._engine = options.scene?.getEngine() ?? options.engine ?? null;\n this.host = (this._engine?.getRenderingCanvas() as HTMLElement | null | undefined) ?? null;\n if (!this._engine || !element) {\n this._ready = Promise.reject(new Error(\"HtmlTexture requires an engine and HTML element.\"));\n void this._ready.catch(() => undefined);\n return;\n }\n if (options.format !== undefined && options.format !== 5) {\n unsupported(\"HtmlTexture.format\", \"Babylon Lite HTML textures use RGBA8; alternate Babylon.js texture formats require a new native upload/storage contract.\");\n }\n const nearest = options.samplingMode === Texture.NEAREST_SAMPLINGMODE || options.samplingMode === Texture.NEAREST_NEAREST;\n const htmlTexture = createHtmlTexture(this._engine._lite, element, {\n width: options.width,\n height: options.height,\n mipMaps: options.generateMipMaps ?? false,\n autoUpdate: options.autoUpdate ?? true,\n useSvgFallback: options.useSvgFallback ?? true,\n minFilter: nearest ? \"nearest\" : \"linear\",\n magFilter: nearest ? \"nearest\" : \"linear\",\n invertY: true,\n });\n this._htmlTexture = htmlTexture;\n this._ready = whenHtmlTextureReady(htmlTexture).then(() => {\n if (this._disposed) {\n throw new Error(\"HtmlTexture was disposed before its first upload completed.\");\n }\n this._lite = htmlTexture;\n try {\n this.onLoadObservable.notifyObservers(this);\n } finally {\n this._notifyReady();\n }\n });\n void this._ready.catch(() => undefined);\n }\n\n public getTextureMatrix(): Matrix {\n return this._textureMatrix;\n }\n\n public requestUpdate(): void {\n if (this._engine && this._htmlTexture) {\n requestHtmlTextureUpdate(this._engine._lite, this._htmlTexture);\n }\n }\n\n public update(invertY = true): void {\n if (this._engine && this._htmlTexture) {\n updateHtmlTexture(this._engine._lite, this._htmlTexture, invertY);\n }\n }\n\n public override getClassName(): string {\n return \"HtmlTexture\";\n }\n\n public whenReadyAsync(): Promise<void> {\n return this._ready;\n }\n\n public override dispose(): void {\n this._disposed = true;\n if (this._htmlTexture) {\n disposeHtmlTexture(this._htmlTexture);\n this._htmlTexture = undefined;\n }\n this._lite = undefined;\n this.onLoadObservable.clear();\n this.onLoadObservable.cleanLastNotifiedState();\n }\n}\n\nexport class Texture extends BaseTexture {\n private readonly _ready: Promise<void>;\n private _onLoadObservable: Observable<Texture> | undefined;\n /** Babylon.js sampling-mode constants (numeric parity). */\n public static readonly NEAREST_SAMPLINGMODE = 1;\n public static readonly BILINEAR_SAMPLINGMODE = 2;\n public static readonly TRILINEAR_SAMPLINGMODE = 3;\n public static readonly NEAREST_NEAREST = 8;\n public static readonly LINEAR_LINEAR = 11;\n /** Babylon.js coordinate-mode constants (numeric parity). */\n public static readonly CLAMP_ADDRESSMODE = 0;\n public static readonly WRAP_ADDRESSMODE = 1;\n public static readonly MIRROR_ADDRESSMODE = 2;\n /** Babylon.js texture UV tiling (applied to the Lite material at bind time). */\n public uScale = 1;\n public vScale = 1;\n public uOffset = 0;\n public vOffset = 0;\n public hasAlpha = false;\n public coordinatesIndex = 0;\n /** Babylon.js sampling mode passed at construction (`NEAREST_SAMPLINGMODE` = 1, etc.). */\n public readonly samplingMode: number;\n /** @internal The Scene or engine this texture was created against (for `clone`). */\n private readonly _source: Scene | { _lite: import(\"babylon-lite\").EngineContext };\n\n public constructor(\n url: string,\n sceneOrEngine: Scene | { _lite: import(\"babylon-lite\").EngineContext },\n noMipmapOrOptions?: unknown,\n invertY?: boolean,\n _samplingMode?: number,\n onLoad?: (() => void) | null\n ) {\n super();\n this.name = url;\n // Babylon.js `Texture(url, scene, noMipmapOrOptions?, invertY?, samplingMode?)`.\n // The third argument is either a `noMipmap` boolean or an options object; parse\n // both shapes so the load matches what the ported code asked for.\n let noMipmap = false;\n let invertYOpt = invertY;\n let samplingMode = _samplingMode;\n if (typeof noMipmapOrOptions === \"boolean\") {\n noMipmap = noMipmapOrOptions;\n } else if (noMipmapOrOptions && typeof noMipmapOrOptions === \"object\") {\n const o = noMipmapOrOptions as { noMipmap?: boolean; invertY?: boolean; samplingMode?: number };\n noMipmap = o.noMipmap ?? false;\n invertYOpt = invertYOpt ?? o.invertY;\n samplingMode = samplingMode ?? o.samplingMode;\n }\n // Babylon.js `Texture.invertY` defaults to true; honour an explicit `false`.\n this._invertY = invertYOpt ?? true;\n this._noMipmap = noMipmap;\n this.samplingMode = samplingMode ?? Texture.BILINEAR_SAMPLINGMODE;\n this._source = sceneOrEngine;\n // Babylon.js's `Texture` accepts either a `Scene` or a `ThinEngine`. When a\n // scene is passed, the load is tracked so the scene awaits it at build; when\n // a bare engine is passed (e.g. the scene-less `SpriteRenderer` path), there\n // is no scene to track against, so the caller awaits readiness itself.\n const scene = (sceneOrEngine as Scene).getEngine ? (sceneOrEngine as Scene) : undefined;\n const engineWrapper = scene ? undefined : (sceneOrEngine as { _lite: import(\"babylon-lite\").EngineContext; _registerStartupWork?: (w: () => Promise<void>) => void });\n const engine = scene ? scene.getEngine()._lite : engineWrapper!._lite;\n // Honour `invertY` / `noMipmap` only on the material (scene-based) path. The\n // bare-engine path feeds Babylon Lite's sprite renderer, which applies its own\n // V-orientation, so it keeps `loadTexture2D`'s defaults (matching the Lite ports).\n // Map the Babylon.js sampling mode to Lite's min/mag filters: `NEAREST_SAMPLINGMODE`\n // must load with nearest filtering, else the alpha of an alpha-tested (cutout)\n // texture is bilinear-filtered and the discard boundary shifts — invisible on\n // axis-aligned sprites but a large divergence on rotated cutout billboards.\n const nearest = this.samplingMode === Texture.NEAREST_SAMPLINGMODE || this.samplingMode === Texture.NEAREST_NEAREST;\n const filterOpts: { minFilter?: \"nearest\" | \"linear\"; magFilter?: \"nearest\" | \"linear\" } = nearest ? { minFilter: \"nearest\", magFilter: \"nearest\" } : {};\n const loadOpts = scene ? { invertY: this._invertY, mipMaps: !this._noMipmap, ...filterOpts } : {};\n\n this._ready = loadCompatTexture(engine, url, loadOpts).then((tex) => {\n this._lite = tex;\n try {\n this._notifyLoadObservable();\n if (onLoad) {\n onLoad();\n }\n } finally {\n // Rebuild after onLoad has configured UV scale and related fields.\n this._notifyReady();\n }\n });\n // Let the scene await this load before it builds renderables, so the GPU\n // handle exists when the owning material binds (Babylon.js loads in the\n // background but its render loop simply waits a frame; we wait at build).\n scene?._trackTextureLoad(this._ready);\n // Scene-less path (bare engine): register the load as engine startup work\n // so `texture.isReady()` is true by the time the render loop first runs.\n engineWrapper?._registerStartupWork?.(() => this._ready);\n }\n\n /** @internal Upload-time vertical flip / mipmap flags, preserved across `clone`. */\n private readonly _invertY: boolean;\n private readonly _noMipmap: boolean;\n\n public override getClassName(): string {\n return \"Texture\";\n }\n\n /**\n * Babylon.js `texture.clone()` — a new `Texture` over the same source URL.\n * UV tiling/offset and sampling are copied; the clone re-resolves the GPU\n * handle (tracked against the same scene so it is ready at build).\n */\n public clone(): Texture {\n const c = new Texture(this.name, this._source, this._noMipmap, this._invertY, this.samplingMode);\n c.uScale = this.uScale;\n c.vScale = this.vScale;\n c.uOffset = this.uOffset;\n c.vOffset = this.vOffset;\n c.hasAlpha = this.hasAlpha;\n c.coordinatesIndex = this.coordinatesIndex;\n return c;\n }\n\n public override whenReadyAsync(): Promise<void> {\n return this._ready;\n }\n\n /** Babylon.js `Texture.onLoadObservable`, allocated only when code subscribes. */\n public get onLoadObservable(): Observable<Texture> {\n let observable = this._onLoadObservable;\n if (!observable) {\n observable = new Observable<Texture>(undefined, true);\n this._onLoadObservable = observable;\n if (this.isReady()) {\n observable.notifyObservers(this);\n }\n }\n return observable;\n }\n\n private _notifyLoadObservable(): void {\n if (this._onLoadObservable) {\n this._onLoadObservable.notifyObservers(this);\n }\n }\n\n /** Babylon.js `BaseTexture.isReady()` — true once the GPU handle has resolved. */\n public isReady(): boolean {\n return this._lite !== undefined;\n }\n\n /** Load a texture and resolve once its GPU handle is available. */\n public static async LoadAsync(url: string, scene: Scene): Promise<Texture> {\n const texture = new Texture(url, scene);\n await texture.whenReadyAsync();\n return texture;\n }\n}\n\n/**\n * Babylon.js `RawTexture` — a texture created from raw pixel bytes. Backed by\n * Babylon Lite's `createTexture2DFromPixels`; the GPU handle is available\n * synchronously after construction.\n */\nexport class RawTexture extends BaseTexture {\n private readonly _scene: Scene;\n\n public constructor(data: Uint8Array, width: number, height: number, scene: Scene) {\n super();\n this._scene = scene;\n this._lite = createTexture2DFromPixels(scene.getEngine()._lite, data, width, height);\n }\n\n public override getClassName(): string {\n return \"RawTexture\";\n }\n\n /** Replace the texture's pixel contents. */\n public update(data: Uint8Array): void {\n if (this._lite) {\n updateTexture2DFromPixels(this._scene.getEngine()._lite, this._lite, data);\n }\n }\n\n public override whenReadyAsync(): Promise<void> {\n return Promise.resolve();\n }\n\n public static CreateRGBATexture(data: Uint8Array, width: number, height: number, scene: Scene): RawTexture {\n return new RawTexture(data, width, height, scene);\n }\n}\n\n/**\n * Babylon.js `RawTexture3D` — a volumetric texture created from raw RGBA8 pixel\n * bytes (the common case being a colour-grading LUT / colour cube). Backed by\n * Babylon Lite's `createTexture3DFromPixels`; the GPU handle is available\n * synchronously after construction.\n *\n * Babylon Lite's 3D-texture path is RGBA8-only, so the `format` argument is\n * recorded for API parity but the upload always treats `data` as tightly-packed\n * `width * height * depth * 4` RGBA bytes (x fastest, then y, then z).\n */\nexport class RawTexture3D extends BaseTexture {\n private readonly _scene: Scene;\n /** Babylon.js `RawTexture3D.is3D` — always true for a 3D texture. */\n public readonly is3D = true;\n\n public constructor(\n data: ArrayBufferView | null,\n width: number,\n height: number,\n depth: number,\n /** Babylon.js texture format (recorded for parity; Lite uploads RGBA8). */\n public format: number,\n scene: Scene,\n generateMipMaps = true,\n _invertY = false,\n _samplingMode = 3,\n _textureType?: number,\n _creationFlags?: number\n ) {\n super();\n if (generateMipMaps) {\n unsupported(\n \"RawTexture3D(generateMipMaps)\",\n \"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.\"\n );\n }\n this._scene = scene;\n const bytes = toRgbaBytes(data, width, height, depth);\n this._lite = createTexture3DFromPixels(scene.getEngine()._lite, bytes, width, height, depth) as Texture3D;\n }\n\n public override getClassName(): string {\n return \"RawTexture3D\";\n }\n\n /** Gets the width of the texture. */\n public get width(): number {\n return (this._lite as Texture3D | undefined)?.width ?? 0;\n }\n\n /** Gets the height of the texture. */\n public get height(): number {\n return (this._lite as Texture3D | undefined)?.height ?? 0;\n }\n\n /** Gets the depth of the texture. */\n public get depth(): number {\n return (this._lite as Texture3D | undefined)?.depth ?? 0;\n }\n\n /**\n * Replace the texture's pixel contents. Babylon Lite has no in-place 3D update,\n * so the volume is re-uploaded (a fresh Lite 3D texture handle).\n */\n public update(data: ArrayBufferView): void {\n const bytes = toRgbaBytes(data, this.width, this.height, this.depth);\n this._lite = createTexture3DFromPixels(this._scene.getEngine()._lite, bytes, this.width, this.height, this.depth) as Texture3D;\n }\n\n public override whenReadyAsync(): Promise<void> {\n return Promise.resolve();\n }\n}\n\n/**\n * @internal Coerce a raw `ArrayBufferView` (or a bare `Uint8Array`) into the tightly\n * packed `width * height * depth * 4` RGBA8 `Uint8Array` Babylon Lite's raw-pixel\n * texture factories expect (`createTexture3DFromPixels`,\n * `createTexture2DArrayFromPixels`). Babylon.js allows a `null` data argument\n * (an empty texture); Lite requires bytes, so `null` becomes a zero-filled volume.\n * For a 2D array, `depth` is the layer count.\n */\nexport function toRgbaBytes(data: ArrayBufferView | null, width: number, height: number, depth: number): Uint8Array {\n const expected = width * height * depth * 4;\n if (data === null) {\n return new Uint8Array(expected);\n }\n const bytes = data instanceof Uint8Array ? data : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n // Keep the result tightly packed: trim any trailing bytes beyond width*height*depth*4\n // so we never upload unintended data past the volume Lite expects.\n return bytes.byteLength > expected ? bytes.subarray(0, expected) : bytes;\n}\n\n/**\n * Babylon.js `DynamicTexture` — a canvas-backed texture. Draw into\n * `getContext()`, then call `update()` to upload the canvas pixels to the GPU.\n * Backed by Babylon Lite's `createDynamicTexture` / `updateDynamicTexture`, which\n * blit the canvas straight to the GPU via `copyExternalImageToTexture` (no\n * `getImageData` CPU readback).\n */\nexport class DynamicTexture extends BaseTexture {\n private readonly _scene: Scene;\n private readonly _canvas: HTMLCanvasElement;\n private readonly _context: CanvasRenderingContext2D;\n private readonly _width: number;\n private readonly _height: number;\n /** @internal Branded Lite dynamic texture; aliases `_lite` and is the only\n * handle `updateDynamicTexture` accepts. */\n private readonly _dyn: DynamicTexture2D;\n\n public constructor(name: string, options: { width: number; height: number }, scene: Scene) {\n super();\n this.name = name;\n this._scene = scene;\n this._width = options.width;\n this._height = options.height;\n this._canvas = document.createElement(\"canvas\");\n this._canvas.width = options.width;\n this._canvas.height = options.height;\n const ctx = this._canvas.getContext(\"2d\");\n if (!ctx) {\n throw new Error(\"DynamicTexture: 2D canvas context unavailable.\");\n }\n this._context = ctx;\n // Allocate the GPU texture up front (blank until the first draw+update),\n // matching Babylon.js where the texture exists immediately after construction.\n this._dyn = createDynamicTexture(scene.getEngine()._lite, options.width, options.height);\n this._lite = this._dyn;\n }\n\n public override getClassName(): string {\n return \"DynamicTexture\";\n }\n\n public getContext(): CanvasRenderingContext2D {\n return this._context;\n }\n\n public getSize(): { width: number; height: number } {\n return { width: this._width, height: this._height };\n }\n\n /** Draw `text` and refresh the GPU texture. */\n public drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string | null): void {\n const ctx = this._context;\n if (clearColor) {\n ctx.fillStyle = clearColor;\n ctx.fillRect(0, 0, this._width, this._height);\n }\n ctx.font = font;\n ctx.fillStyle = color;\n ctx.fillText(text, x, y);\n this.update();\n }\n\n /**\n * Blit the current canvas pixels straight to the GPU texture (no CPU readback).\n * @param invertY - Flip V so a top-down canvas samples upright. Default `true` (Babylon.js parity).\n * @param premulAlpha - Treat the upload as premultiplied alpha. Default `false`.\n * @param _allowGPUOptimization - Accepted for Babylon.js signature parity; the blit is already GPU-direct, so this is a no-op.\n */\n public update(invertY: boolean = true, premulAlpha: boolean = false, _allowGPUOptimization: boolean = false): void {\n updateDynamicTexture(this._scene.getEngine()._lite, this._dyn, this._canvas, { invertY, premultiplyAlpha: premulAlpha });\n }\n\n public override whenReadyAsync(): Promise<void> {\n return Promise.resolve();\n }\n}\n\n/**\n * Babylon.js `CubeTexture` — environment/skybox cube map. Babylon Lite loads\n * environments through `loadEnvironment` (IBL + skybox registered on the scene)\n * rather than as a standalone GPU texture object. This compat `CubeTexture`\n * therefore acts as a lightweight handle that records the environment URL; the\n * actual GPU work happens when it is assigned to `scene.environmentTexture` and\n * the engine starts (see `Scene` env handling). It still extends\n * {@link BaseTexture} to match the Babylon.js class hierarchy, so it can appear\n * in `BaseTexture[]` surfaces such as `Material.getActiveTextures()`; because the\n * environment has no standalone Lite handle, `getInternalTexture()` stays `null`.\n */\nexport class CubeTexture extends BaseTexture {\n /** Source URL of the (prefiltered) environment. */\n public readonly url: string;\n /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */\n public coordinatesMode = 0;\n public gammaSpace = true;\n public level = 1;\n /**\n * @internal Which Lite environment loader the scene should route this handle\n * through at engine start. Plain `.env`/`.dds` cube maps load via\n * `loadEnvironment`/`loadDdsEnvironment`; `HDRCubeTexture` overrides this to\n * `\"hdr\"` so the scene picks `loadHdrEnvironment`.\n */\n public readonly _envLoaderKind: \"cube\" | \"hdr\" = \"cube\";\n /** Fires when the cube map is \"ready\" (resolved on a microtask in this compat layer). */\n public readonly onLoadObservable = new Observable<CubeTexture>();\n private _ready = false;\n private readonly _readyPromise: Promise<void>;\n\n public constructor(\n url: string,\n _scene?: unknown,\n _extensions?: unknown,\n _noMipmap?: boolean,\n _files?: unknown,\n onLoad?: (() => void) | null,\n _onError?: unknown,\n _format?: unknown,\n _prefiltered?: boolean\n ) {\n super();\n this.url = url;\n this.name = url;\n // Babylon.js fires onLoad once the cube map is ready; some scenes await it\n // before continuing. We resolve on a microtask since the actual GPU upload\n // is deferred to `loadEnvironment` at engine start.\n this._readyPromise = new Promise((resolve) => {\n queueMicrotask(() => {\n this._ready = true;\n if (onLoad) {\n onLoad();\n }\n this.onLoadObservable.notifyObservers(this);\n resolve();\n });\n });\n }\n\n public override getClassName(): string {\n return \"CubeTexture\";\n }\n\n /** Babylon.js `BaseTexture.isReady()`. */\n public isReady(): boolean {\n return this._ready;\n }\n\n public override whenReadyAsync(): Promise<void> {\n return this._readyPromise;\n }\n\n /** Babylon.js `CubeTexture.CreateFromPrefilteredData(url, scene)`. */\n public static CreateFromPrefilteredData(url: string, scene?: unknown): CubeTexture {\n return new CubeTexture(url, scene);\n }\n\n public override dispose(): void {\n // GPU resources are owned by the scene's environment, disposed with the scene.\n }\n}\n\n/**\n * Babylon.js `HDRCubeTexture` — a Radiance `.hdr` (RGBE) equirectangular panorama\n * used as an environment / IBL source. Like {@link CubeTexture} this is a\n * lightweight handle that records the `.hdr` URL; the actual GPU work (equirect →\n * prefiltered cubemap + irradiance SH + BRDF LUT) happens when it is assigned to\n * `scene.environmentTexture` and the engine starts, at which point the scene\n * routes it through Babylon Lite's native `loadHdrEnvironment`.\n */\nexport class HDRCubeTexture extends BaseTexture {\n /** Source URL of the `.hdr` panorama. */\n public readonly url: string;\n /** Requested cubemap face size (BJS `size`); forwarded to Lite's `faceSize`. */\n public readonly size: number;\n /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */\n public coordinatesMode = 0;\n public gammaSpace = true;\n public level = 1;\n /** @internal Selects Lite's `loadHdrEnvironment` in the scene's env loader. */\n public readonly _envLoaderKind: \"cube\" | \"hdr\" = \"hdr\";\n /** Fires when the HDR environment is \"ready\" (resolved on a microtask). */\n public readonly onLoadObservable = new Observable<HDRCubeTexture>();\n private _ready = false;\n private readonly _readyPromise: Promise<void>;\n\n public constructor(\n url: string,\n _sceneOrEngine?: unknown,\n size = 256,\n _noMipmap?: boolean,\n _generateHarmonics?: boolean,\n _gammaSpace?: boolean,\n _prefilterOnLoad?: boolean,\n onLoad?: (() => void) | null\n ) {\n super();\n this.url = url;\n this.size = size;\n this.name = url;\n // Babylon.js fires onLoad once the HDR is decoded + prefiltered; the real\n // GPU work is deferred to `loadHdrEnvironment` at engine start, so we\n // resolve the readiness signal on a microtask (matches CubeTexture).\n this._readyPromise = new Promise((resolve) => {\n queueMicrotask(() => {\n this._ready = true;\n if (onLoad) {\n onLoad();\n }\n this.onLoadObservable.notifyObservers(this);\n resolve();\n });\n });\n }\n\n public override getClassName(): string {\n return \"HDRCubeTexture\";\n }\n\n /** Babylon.js `BaseTexture.isReady()`. */\n public isReady(): boolean {\n return this._ready;\n }\n\n public override whenReadyAsync(): Promise<void> {\n return this._readyPromise;\n }\n\n public override dispose(): void {\n // GPU resources are owned by the scene's environment, disposed with the scene.\n }\n}\n\n/** Babylon.js `RenderTargetTexture` — offscreen render target. Use the native frame-graph RTT APIs. */\nexport class RenderTargetTexture {\n public constructor() {\n unsupported(\"RenderTargetTexture\", \"Offscreen rendering uses Babylon Lite's frame-graph render-target APIs (`createRenderTargetTexture` / render tasks).\");\n }\n}\n","import { createExternalTexture, isExternalTextureReady } from \"babylon-lite\";\nimport type { ExternalTexture as LiteExternalTexture } from \"babylon-lite\";\n\nlet nextUniqueId = 0;\n\n/** Babylon.js `ExternalTexture` over Lite's caller-owned video wrapper. */\nexport class ExternalTexture {\n /** @internal Underlying Lite external texture. */\n public readonly _lite: LiteExternalTexture;\n public useMipMaps = false;\n public readonly type = 16;\n public readonly format = 0xffffffff;\n public readonly uniqueId = nextUniqueId++;\n\n public static IsExternalTexture(texture: unknown): texture is ExternalTexture {\n return !!texture && typeof texture === \"object\" && (texture as { underlyingResource?: unknown }).underlyingResource !== undefined;\n }\n\n public constructor(private readonly _video: HTMLVideoElement) {\n this._lite = createExternalTexture(_video);\n }\n\n public getClassName(): string {\n return \"ExternalTexture\";\n }\n\n public get underlyingResource(): HTMLVideoElement {\n return this._video;\n }\n\n public isReady(): boolean {\n return isExternalTextureReady(this._lite);\n }\n\n public dispose(): void {}\n}\n","/**\n * Babylon.js-compatible 2D **texture array** wrappers over Babylon Lite's\n * `createTexture2DArray` / `createTexture2DArrayFromPixels` /\n * `updateTexture2DArrayFromPixels` / `uploadImageToArrayLayer` /\n * `loadImageToArrayLayer` / `createTexture2DArrayFromUrls`.\n *\n * A texture array is a single GPU texture holding N same-size, same-format layers\n * (sampled in a shader as `texture_2d_array<f32>` with an explicit layer index).\n * Babylon.js exposes the raw-bytes constructor on `RawTexture2DArray` plus the\n * image-source helper functions in `rawTexture2DArray.functions`. Both paths are\n * backed by Babylon Lite: raw multi-layer bytes go through Lite's pixel upload,\n * decoded image sources through Lite's external-image copy.\n */\n\nimport {\n createTexture2DArray,\n createTexture2DArrayFromPixels,\n updateTexture2DArrayFromPixels,\n loadImageToArrayLayer,\n createTexture2DArrayFromUrls,\n createTexture2DArrayFromKtx2,\n} from \"babylon-lite\";\nimport type { Texture2DArray } from \"babylon-lite\";\n\nimport { Constants } from \"../misc/engine-constants.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport { BaseTexture, toRgbaBytes } from \"./textures.js\";\n\n/** The decoded image sources WebGPU (and therefore Lite) can upload into a layer. */\ntype ImageSource = ImageBitmap | HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | HTMLVideoElement | ImageData | VideoFrame;\n\n/**\n * Babylon.js `RawTexture2DArray` — a 2D array texture. Backed by Babylon Lite's\n * `Texture2DArray`.\n *\n * Both Babylon.js construction paths work: pass raw multi-layer RGBA8 bytes\n * (`data !== null`) for a CPU-generated array, or construct empty (`data = null`)\n * and fill layers from decoded image sources via\n * {@link UploadImageToTexture2DArrayLayer} /\n * {@link LoadImageToTexture2DArrayLayerAsync}, or build the whole array in one call\n * with {@link CreateTexture2DArrayFromImageUrlsAsync}.\n *\n * Babylon Lite's array path is RGBA8-only, so `format` / `textureType` /\n * `samplingMode` are recorded for API parity but the upload always treats `data` as\n * tightly-packed `width * height * depth * 4` RGBA bytes (layer-major). Raw-byte\n * uploads are not Y-flipped (matching the compat `RawTexture` / `RawTexture3D`\n * pixel paths), so `invertY` is recorded but not applied to `data`.\n */\nexport class RawTexture2DArray extends BaseTexture {\n /** @internal The underlying Lite 2D-array handle (aliases `_lite`). */\n public _liteArray: Texture2DArray | undefined;\n /** Babylon.js `RawTexture2DArray.is2DArray` — always true. */\n public readonly is2DArray = true;\n /** @internal Owning compat scene. */\n public _sceneRef: Scene;\n\n public constructor(\n data: ArrayBufferView | null,\n width: number,\n height: number,\n depth: number,\n /** Babylon.js texture format (recorded for parity; Lite uploads RGBA8). */\n public format: number,\n scene: Scene,\n generateMipMaps = true,\n _invertY = false,\n _samplingMode = 3,\n _textureType?: number,\n _creationFlags?: number,\n _mipLevelCount?: number\n ) {\n super();\n this._sceneRef = scene;\n const engine = scene.getEngine()._lite;\n const tex =\n data === null\n ? createTexture2DArray(engine, width, height, depth, { mipMaps: generateMipMaps })\n : createTexture2DArrayFromPixels(engine, toRgbaBytes(data, width, height, depth), width, height, depth, { mipMaps: generateMipMaps });\n this._liteArray = tex;\n this._lite = tex;\n }\n\n public override getClassName(): string {\n return \"RawTexture2DArray\";\n }\n\n /** Babylon.js `RawTexture2DArray.depth` — the number of array layers. */\n public get depth(): number {\n return this._liteArray?.layers ?? 0;\n }\n\n /** The scene this texture belongs to (Babylon.js `ThinTexture.getScene`). */\n public getScene(): Scene {\n return this._sceneRef;\n }\n\n /**\n * Babylon.js `RawTexture2DArray.getInternalTexture()` — the backend handle the compat\n * engine's texture methods accept (Lite's `Texture2DArray`).\n */\n public override getInternalTexture(): Texture2DArray | null {\n return this._liteArray ?? null;\n }\n\n /** Babylon.js `RawTexture2DArray.update(data)` — replace the base mip of every layer. */\n public update(data: ArrayBufferView): void {\n this.updateMipLevel(data, 0);\n }\n\n /**\n * Babylon.js `RawTexture2DArray.updateMipLevel(data, mipLevel)` — replace one mip level of\n * every layer. Level dimensions are `max(1, size >> mipLevel)`; writing level 0 of a\n * mipmapped array regenerates the rest of the chain, exactly as Babylon.js does.\n */\n public updateMipLevel(data: ArrayBufferView, mipLevel: number): void {\n const array = this._liteArray;\n if (!array) {\n return;\n }\n const width = Math.max(1, array.width >> mipLevel);\n const height = Math.max(1, array.height >> mipLevel);\n updateTexture2DArrayFromPixels(this._sceneRef.getEngine()._lite, array, toRgbaBytes(data, width, height, array.layers), mipLevel);\n }\n\n public override whenReadyAsync(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * @internal Reconcile the image-URL construction path\n * ({@link CreateTexture2DArrayFromImageUrlsAsync}) into the single BJS-named\n * class without re-running the allocating constructor.\n */\n public static _fromLite(liteArray: Texture2DArray, format: number, scene: Scene): RawTexture2DArray {\n const tex: RawTexture2DArray = Object.create(RawTexture2DArray.prototype);\n tex.name = \"\";\n (tex as { is2DArray: boolean }).is2DArray = true;\n tex.format = format;\n tex._sceneRef = scene;\n tex._liteArray = liteArray;\n tex._lite = liteArray;\n return tex;\n }\n\n /** Babylon.js `RawTexture2DArray.CreateRGBATexture` — RGBA raw-bytes factory. */\n public static CreateRGBATexture(\n data: ArrayBufferView,\n width: number,\n height: number,\n depth: number,\n scene: Scene,\n generateMipMaps = true,\n invertY = false,\n samplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\n type = Constants.TEXTURETYPE_UNSIGNED_BYTE\n ): RawTexture2DArray {\n return new RawTexture2DArray(data, width, height, depth, Constants.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode, type);\n }\n}\n\n/** Babylon.js `IUploadImageToTexture2DArrayLayerOptions`. */\nexport interface IUploadImageToTexture2DArrayLayerOptions {\n /** Store the source with the Y axis inverted (false by default). */\n invertY?: boolean;\n /** Premultiply the source alpha (false by default). */\n premultiplyAlpha?: boolean;\n}\n\n/** Babylon.js `ICreateTexture2DArrayFromImageUrlsOptions`. */\nexport interface ICreateTexture2DArrayFromImageUrlsOptions extends IUploadImageToTexture2DArrayLayerOptions {\n /** Generate a full mip chain (true by default). */\n generateMipMaps?: boolean;\n /** Sampling mode (recorded for parity; Lite uses trilinear). */\n samplingMode?: number;\n /** Texture type (recorded for parity; Lite uploads RGBA8). */\n textureType?: number;\n /** Options forwarded to `createImageBitmap` (recorded for parity). */\n imageBitmapOptions?: ImageBitmapOptions;\n}\n\n/** Babylon.js `ICreateTexture2DArrayFromKTX2Options`. */\nexport interface ICreateTexture2DArrayFromKTX2Options {\n /** Generate a full mip chain (true by default). */\n generateMipMaps?: boolean;\n /** Sampling mode (trilinear by default). */\n samplingMode?: number;\n /** Store the texture with the Y axis inverted (false by default). */\n invertY?: boolean;\n}\n\n/**\n * Babylon.js `CreateTexture2DArrayFromKTX2Async` — decode a single multi-layer KTX2\n * container into a texture array. Forwards to Lite's `createTexture2DArrayFromKtx2`\n * (transcodes to RGBA8, uploads the base level, regenerates mips), then wraps the\n * result in a `RawTexture2DArray`.\n *\n * Babylon.js defaults `generateMipMaps` to `true`; that value is always passed\n * explicitly rather than left to any Lite default. Sampling and Y inversion are\n * forwarded to the Lite array handle.\n */\nexport async function CreateTexture2DArrayFromKTX2Async(scene: Scene, data: string | ArrayBufferView, options?: ICreateTexture2DArrayFromKTX2Options): Promise<RawTexture2DArray> {\n let buffer: ArrayBufferView;\n if (typeof data === \"string\") {\n const response = await fetch(data);\n if (!response.ok) {\n throw new Error(`Failed to fetch KTX2 file \"${data}\": ${response.status} ${response.statusText}`);\n }\n buffer = new Uint8Array(await response.arrayBuffer());\n } else {\n buffer = data;\n }\n const samplingMode = options?.samplingMode ?? Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;\n const nearest = samplingMode === Constants.TEXTURE_NEAREST_SAMPLINGMODE;\n const bilinear = samplingMode === Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\n const liteArray = await createTexture2DArrayFromKtx2(scene.getEngine()._lite, buffer, {\n generateMipMaps: options?.generateMipMaps ?? true,\n invertY: options?.invertY ?? false,\n minFilter: nearest ? \"nearest\" : \"linear\",\n magFilter: nearest ? \"nearest\" : \"linear\",\n mipmapFilter: nearest || bilinear ? \"nearest\" : \"linear\",\n });\n return RawTexture2DArray._fromLite(liteArray, Constants.TEXTUREFORMAT_RGBA, scene);\n}\n/** @internal Resolve the live Lite array handle a compat texture wraps. */\nfunction liteArrayOf(texture: RawTexture2DArray): Texture2DArray {\n const array = texture.getInternalTexture();\n if (!array) {\n throw new Error(\"Cannot upload to a 2D array texture that has no internal texture.\");\n }\n return array;\n}\n\n/**\n * Babylon.js `UploadImageToTexture2DArrayLayer` — upload a decoded image source\n * into one layer of a texture array. Routes through the engine's\n * `updateTextureArrayLayerFromImageSource` (as Babylon.js does), which forwards to\n * Lite's `uploadImageToArrayLayer`.\n */\nexport function UploadImageToTexture2DArrayLayer(texture: RawTexture2DArray, source: ImageSource, layer: number, options?: IUploadImageToTexture2DArrayLayerOptions): void {\n const array = liteArrayOf(texture);\n if (!Number.isInteger(layer) || layer < 0 || layer >= texture.depth) {\n throw new Error(`Layer ${layer} is out of range for a 2D array texture with ${texture.depth} layers.`);\n }\n texture\n .getScene()\n .getEngine()\n .updateTextureArrayLayerFromImageSource(array, source as GPUCopyExternalImageSource, layer, options?.invertY ?? false, options?.premultiplyAlpha ?? false);\n}\n\n/**\n * Babylon.js `LoadImageToTexture2DArrayLayerAsync` — fetch/decode an image URL and\n * upload it into one layer. Forwards to Lite's `loadImageToArrayLayer`.\n */\nexport async function LoadImageToTexture2DArrayLayerAsync(\n texture: RawTexture2DArray,\n url: string,\n layer: number,\n options?: IUploadImageToTexture2DArrayLayerOptions\n): Promise<void> {\n const array = liteArrayOf(texture);\n await loadImageToArrayLayer(texture.getScene().getEngine()._lite, array, layer, url, {\n invertY: options?.invertY ?? false,\n premultiplyAlpha: options?.premultiplyAlpha ?? false,\n });\n}\n\n/**\n * Babylon.js `CreateTexture2DArrayFromImageUrlsAsync` — create a texture array and\n * fill each layer from a list of image URLs. Forwards to Lite's\n * `createTexture2DArrayFromUrls`, then wraps the result in a `RawTexture2DArray`.\n *\n * Lite's per-layer upload defaults to `invertY = true` (the Babylon.js *material*\n * convention); the Babylon.js helper defaults to `false`, so the flag is always\n * passed explicitly rather than left to the Lite default.\n */\nexport async function CreateTexture2DArrayFromImageUrlsAsync(\n scene: Scene,\n urls: readonly [string, ...string[]],\n options?: ICreateTexture2DArrayFromImageUrlsOptions\n): Promise<RawTexture2DArray> {\n const liteArray = await createTexture2DArrayFromUrls(scene.getEngine()._lite, urls, {\n mipMaps: options?.generateMipMaps ?? true,\n invertY: options?.invertY ?? false,\n premultiplyAlpha: options?.premultiplyAlpha ?? false,\n });\n return RawTexture2DArray._fromLite(liteArray, Constants.TEXTUREFORMAT_RGBA, scene);\n}\n","/**\n * Canonical, stable-identity compat wrappers for the meshes a loader produces.\n *\n * Babylon.js loaders return a flat `meshes` array of real `AbstractMesh` objects\n * (with the synthetic `__root__` at index 0) that apps routinely post-process —\n * reparent, clone, toggle `isVisible`/`setEnabled`, dispose. Babylon Lite returns\n * a root-node hierarchy. We reconstruct that hierarchy as canonical compat\n * `Mesh` wrappers, then flatten the wrappers in hierarchy order so the full\n * transform / visibility / clone / dispose surface is available rather than a\n * stripped read-only handle.\n *\n * **Stable identity.** The wrappers are memoized per Lite node in a registry the\n * `AssetContainer` owns, so `container.meshes[0] === container.meshes[0]` and the\n * same handle is shared with `scene.meshes` — matching Babylon.js, where a loaded\n * mesh is a single canonical object.\n *\n * The wrappers never re-insert into the scene (the loader already added the whole\n * container) and never override the natively-loaded material (`Mesh._fromLite`\n * adopts the Lite node as-is). Bounds are reported in the node's **local**\n * geometry space (`AbstractMesh.getBoundingInfo`), matching how Babylon Lite's own\n * `createDefaultCamera` frames loaded models.\n */\n\nimport type { AssetContainer as LiteAssetContainer, Mesh as LiteMesh } from \"babylon-lite\";\n\nimport { Mesh } from \"../meshes/meshes.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\n/** @internal Per-node wrapper cache giving loaded meshes stable identity across `.meshes` reads. */\nexport type LoadedMeshRegistry = Map<unknown, Mesh>;\n\n/**\n * Wrap every node a loaded Babylon Lite asset container exposes as a canonical\n * compat `Mesh`, reusing the cached wrapper for a node when one already exists (so\n * repeated reads return identical handles). When a `scene` is supplied, each\n * wrapper is bound to it (surfaced through `scene.meshes` and given scene-aware\n * disposal).\n *\n * Babylon.js places a synthetic `__root__` transform node at `result.meshes[0]`\n * (the renderable meshes follow it). Babylon Lite builds the same root\n * (`entities[0]` for glTF) but `getContainerMeshes` returns only renderable\n * meshes, so we prepend that root at index 0 to mirror Babylon.js — as a real,\n * non-renderable `Mesh`, exactly as Babylon.js's `__root__` is a `Mesh`.\n */\nexport function collectLoadedMeshes(container: LiteAssetContainer, registry: LoadedMeshRegistry, scene?: Scene): Mesh[] {\n const result: Mesh[] = [];\n const visited = new Set<unknown>();\n const visit = (node: unknown, parent: Mesh | null): void => {\n if (visited.has(node)) {\n return;\n }\n const lite = node as { _gpu?: unknown; children?: unknown[] };\n if (!lite._gpu && !Array.isArray(lite.children)) {\n return;\n }\n visited.add(node);\n let wrapper = registry.get(node);\n if (!wrapper || (scene && wrapper.getScene() !== scene)) {\n wrapper = Mesh._fromLiteHierarchy(node as LiteMesh, container, scene, registry, parent);\n }\n result.push(wrapper);\n for (const child of lite.children ?? []) {\n visit(child, wrapper);\n }\n };\n for (const entity of container.entities) {\n visit(entity, null);\n }\n return result;\n}\n","import { clearBoneOverride, getBoneByName as getLiteBoneByName, setBonePosition, setBoneRotationQuaternion, setBoneScaling } from \"babylon-lite\";\nimport type { Bone as LiteBone, Skeleton as LiteSkeleton } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport type { Quaternion } from \"../math/quaternion.js\";\nimport type { Vector3 } from \"../math/vector.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\nexport class Skeleton {\n public readonly name!: string;\n public readonly id!: string;\n public readonly bones!: Bone[];\n\n /** @internal Underlying loader-produced Babylon Lite skeleton. */\n public readonly _lite!: LiteSkeleton;\n\n public constructor(_name?: string, _id?: string, _scene?: Scene) {\n return unsupported(\n \"Skeleton\",\n \"Babylon Lite exposes loader-produced skeletons but has no public API for manually constructing a skeleton. Load a skinned glTF and use the returned skeleton.\"\n );\n }\n\n /** @internal Wrap a loader-produced Babylon Lite skeleton. */\n public static _fromLite(lite: LiteSkeleton, index: number): Skeleton {\n const skeleton = Object.create(Skeleton.prototype) as Skeleton;\n Object.defineProperties(skeleton, {\n name: { value: `skeleton${index}`, enumerable: true },\n id: { value: `skeleton${index}`, enumerable: true },\n _lite: { value: lite },\n bones: { value: lite.bones.map((bone) => Bone._fromLite(bone, skeleton)) },\n });\n return skeleton;\n }\n\n public getBoneIndexByName(name: string): number {\n const bone = getLiteBoneByName(this._lite, name);\n return bone ? this._lite.bones.indexOf(bone) : -1;\n }\n\n public getBoneByName(name: string): Bone | null {\n const index = this.getBoneIndexByName(name);\n return index < 0 ? null : this.bones[index]!;\n }\n}\n\nexport class Bone {\n private _enabled = true;\n\n public readonly name!: string;\n\n /** @internal Underlying loader-produced Babylon Lite bone. */\n public readonly _lite!: LiteBone;\n /** @internal Owning compat skeleton. */\n public readonly _skeleton!: Skeleton;\n\n public constructor(_name?: string, _skeleton?: Skeleton) {\n return unsupported(\n \"Bone\",\n \"Babylon Lite exposes loader-produced bones but has no public API for manually constructing a bone. Use Skeleton.bones from a loaded skinned glTF.\"\n );\n }\n\n /** @internal Wrap a loader-produced Babylon Lite bone. */\n public static _fromLite(lite: LiteBone, skeleton: Skeleton): Bone {\n const bone = Object.create(Bone.prototype) as Bone;\n Object.defineProperties(bone, {\n name: { value: lite.name, enumerable: true },\n _lite: { value: lite },\n _skeleton: { value: skeleton },\n _enabled: { value: true, writable: true },\n });\n return bone;\n }\n\n public getName(): string {\n return this.name;\n }\n\n public getSkeleton(): Skeleton {\n return this._skeleton;\n }\n\n public setPosition(position: Vector3, space = 0): this {\n if (space !== 0) {\n return unsupported(\"Bone.setPosition\", \"Babylon Lite's bone-control API currently exposes local-space position overrides only.\");\n }\n setBonePosition(this._skeleton._lite, this._lite, position.x, position.y, position.z);\n return this;\n }\n\n public setRotationQuaternion(rotation: Quaternion, space = 0): this {\n if (space !== 0) {\n return unsupported(\"Bone.setRotationQuaternion\", \"Babylon Lite's bone-control API currently exposes local-space rotation overrides only.\");\n }\n setBoneRotationQuaternion(this._skeleton._lite, this._lite, rotation.x, rotation.y, rotation.z, rotation.w);\n return this;\n }\n\n public setScale(scale: Vector3): this {\n setBoneScaling(this._skeleton._lite, this._lite, scale.x, scale.y, scale.z);\n return this;\n }\n\n public setEnabled(value: boolean): void {\n this._enabled = value;\n }\n\n public isEnabled(): boolean {\n return this._enabled;\n }\n\n public returnToRest(): void {\n clearBoneOverride(this._skeleton._lite, this._lite);\n }\n}\n","import { loadSOG, loadSPZ, loadSplat } from \"babylon-lite\";\nimport type { GaussianSplattingMesh as LiteGaussianSplattingMesh, GsShaderFragment, SceneContext } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { GaussianSplattingMesh } from \"../meshes/gaussian-splatting.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { AssetContainer, ISceneLoaderProgressEvent } from \"./scene-loader.js\";\n\nexport type SPLATLoadingOptions = {\n keepInRam?: boolean;\n flipY?: boolean;\n deflateURL?: string;\n fflate?: unknown;\n disableAutoCameraLimits?: boolean;\n gaussianSplattingMesh?: GaussianSplattingMesh;\n needsRotationScaleTextures?: boolean;\n useSogTextures?: boolean;\n spzLibraryUrl?: string;\n};\n\ninterface SPLATImportResult {\n meshes: GaussianSplattingMesh[];\n particleSystems: unknown[];\n skeletons: unknown[];\n animationGroups: unknown[];\n transformNodes: unknown[];\n geometries: unknown[];\n lights: unknown[];\n spriteManagers: unknown[];\n}\n\ntype LiteSplatLoader = (scene: SceneContext, url: string, fragments?: readonly GsShaderFragment[]) => Promise<LiteGaussianSplattingMesh>;\n\nconst SPLAT_ASSET_CONTAINER_UNSUPPORTED =\n \"Lite's splat loaders attach the GPU-backed cloud directly to a scene. They do not expose a detached Gaussian-Splatting asset-container lifecycle that can preserve the BJS mesh type.\";\nconst SPLAT_STREAMING_UNSUPPORTED =\n \"PlayCanvas lod-meta.json requires Babylon.js's Gaussian-Splatting streaming residency, download scheduling, and GPU work-buffer subsystem, which Babylon Lite does not define.\";\nconst SPLAT_DIRECTORY_UNSUPPORTED =\n \"Directory SOG JSON requires a loader contract for resolving and decoding external texture resources relative to rootUrl; Lite's SOG loader accepts only self-contained archives.\";\nconst SPLAT_RELOAD_UNSUPPORTED =\n \"Lite does not expose an atomic Gaussian-Splatting replacement lifecycle that detaches the old renderable and picker while retiring its worker and GPU resources.\";\nconst SPLAT_CONCURRENT_TARGET_UNSUPPORTED = \"An unloaded GaussianSplattingMesh target can only be populated by one in-flight load.\";\n\nlet loadingTargets: WeakSet<GaussianSplattingMesh> | undefined;\n\nfunction bytesOf(data: unknown): Uint8Array {\n if (data instanceof ArrayBuffer) {\n return new Uint8Array(data);\n }\n if (ArrayBuffer.isView(data)) {\n return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n }\n return unsupported(\"SPLATFileLoader\", \"Binary .splat, .ply, .sog, and .spz inputs must be supplied as an ArrayBuffer or ArrayBufferView.\");\n}\n\nfunction loaderFor(data: unknown): LiteSplatLoader {\n if (typeof data === \"string\") {\n return unsupported(\"SPLATFileLoader\", data.includes('\"lods\"') ? SPLAT_STREAMING_UNSUPPORTED : SPLAT_DIRECTORY_UNSUPPORTED);\n }\n const bytes = bytesOf(data);\n if (bytes[0] === 0x50 && bytes[1] === 0x4b) {\n return loadSOG;\n }\n if ((bytes[0] === 0x1f && bytes[1] === 0x8b) || (bytes[0] === 0x4e && bytes[1] === 0x47 && bytes[2] === 0x53 && bytes[3] === 0x50)) {\n return loadSPZ;\n }\n return loadSplat;\n}\n\nfunction loaderForUrl(url: string): LiteSplatLoader {\n const path = url.split(/[?#]/)[0]!.toLowerCase();\n if (path.endsWith(\".json\")) {\n return unsupported(\"SPLATFileLoader\", SPLAT_STREAMING_UNSUPPORTED);\n }\n if (path.endsWith(\".sog\")) {\n return loadSOG;\n }\n if (path.endsWith(\".spz\")) {\n return loadSPZ;\n }\n return loadSplat;\n}\n\nfunction binaryData(data: unknown): BlobPart {\n return new Uint8Array(bytesOf(data)).buffer;\n}\n\nfunction validateOptions(options: Readonly<SPLATLoadingOptions>): void {\n if (options.flipY === true) {\n unsupported(\"SPLATLoadingOptions.flipY\", \"Lite's native splat parsers own their format-specific orientation conversion and do not expose a parser-level flipY override.\");\n }\n if (options.deflateURL !== undefined || options.fflate !== undefined) {\n unsupported(\"SPLATLoadingOptions.fflate\", \"Lite owns its SOG decompressor and does not expose Babylon.js's replaceable fflate loading policy.\");\n }\n if (options.needsRotationScaleTextures) {\n unsupported(\n \"SPLATLoadingOptions.needsRotationScaleTextures\",\n \"Voxel IBL-shadow rotation/scale textures require Babylon.js's Gaussian-Splatting IBL shadow subsystem, which Babylon Lite does not define.\"\n );\n }\n if (options.useSogTextures) {\n unsupported(\n \"SPLATLoadingOptions.useSogTextures\",\n \"Lite's SOG loader uses its native CPU decode path and does not expose Babylon.js's raw-texture dequantization pipeline.\"\n );\n }\n if (options.spzLibraryUrl !== undefined) {\n unsupported(\"SPLATLoadingOptions.spzLibraryUrl\", \"Lite owns its SPZ decoder and does not expose a replaceable WASM-library URL policy.\");\n }\n}\n\nexport class SPLATFileLoader {\n public readonly name = \"splat\";\n public readonly extensions = {\n \".splat\": { isBinary: true },\n \".ply\": { isBinary: true },\n \".spz\": { isBinary: true },\n \".json\": { isBinary: false },\n \".sog\": { isBinary: true },\n } as const;\n\n private readonly _loadingOptions: Readonly<SPLATLoadingOptions>;\n\n public constructor(loadingOptions: Partial<Readonly<SPLATLoadingOptions>> = {}) {\n this._loadingOptions = { ...loadingOptions };\n validateOptions(this._loadingOptions);\n }\n\n public createPlugin(options: { splat?: Partial<Readonly<SPLATLoadingOptions>> }): SPLATFileLoader {\n return new SPLATFileLoader(options.splat);\n }\n\n public async importMeshAsync(\n _meshesNames: unknown,\n scene: Scene,\n data: unknown,\n _rootUrl: string,\n _onProgress?: (event: ISceneLoaderProgressEvent) => void,\n _fileName?: string\n ): Promise<SPLATImportResult> {\n const mesh = await this._load(scene, data);\n return {\n meshes: [mesh],\n particleSystems: [],\n skeletons: [],\n animationGroups: [],\n transformNodes: [],\n geometries: [],\n lights: [],\n spriteManagers: [],\n };\n }\n\n public async loadAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void> {\n await this.importMeshAsync(null, scene, data, rootUrl, onProgress, fileName);\n }\n\n public loadAssetContainerAsync(_scene: Scene, _data: string, _rootUrl: string): Promise<AssetContainer> {\n return unsupported(\"SPLATFileLoader.loadAssetContainerAsync\", SPLAT_ASSET_CONTAINER_UNSUPPORTED);\n }\n\n /** @internal Load a URL through Lite while preserving this plugin's Babylon.js options. */\n public async _loadUrlAsync(scene: Scene, url: string): Promise<GaussianSplattingMesh> {\n return this._loadReserved(scene, () => loaderForUrl(url)(scene._lite, url));\n }\n\n private async _load(scene: Scene, data: unknown): Promise<GaussianSplattingMesh> {\n return this._loadReserved(scene, async () => {\n const loader = loaderFor(data);\n const url = URL.createObjectURL(new Blob([binaryData(data)]));\n try {\n return await loader(scene._lite, url);\n } finally {\n URL.revokeObjectURL(url);\n }\n });\n }\n\n private async _loadReserved(scene: Scene, load: () => Promise<LiteGaussianSplattingMesh>): Promise<GaussianSplattingMesh> {\n const target = this._loadingOptions.gaussianSplattingMesh;\n if (target?._pickLiteNode) {\n unsupported(\"SPLATLoadingOptions.gaussianSplattingMesh\", SPLAT_RELOAD_UNSUPPORTED);\n }\n if (target) {\n loadingTargets ??= new WeakSet();\n if (loadingTargets.has(target)) {\n unsupported(\"SPLATLoadingOptions.gaussianSplattingMesh\", SPLAT_CONCURRENT_TARGET_UNSUPPORTED);\n }\n loadingTargets.add(target);\n }\n try {\n return this._adoptLoaded(scene, await load());\n } finally {\n if (target) {\n loadingTargets?.delete(target);\n }\n }\n }\n\n private _adoptLoaded(scene: Scene, lite: LiteGaussianSplattingMesh): GaussianSplattingMesh {\n const target = this._loadingOptions.gaussianSplattingMesh;\n if (target) {\n target._adopt(lite);\n return target;\n }\n lite.name = \"GaussianSplatting\";\n return GaussianSplattingMesh._fromLite(lite, scene);\n }\n}\n\nexport function RegisterSPLATFileLoader(): void {}\n","import type { LoadUsdOptions, UsdDiagnostics, UsdProgress } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\n\nexport type USDBinaryInput = ArrayBuffer | ArrayBufferView;\nexport type USDVirtualFiles = Readonly<Record<string, USDBinaryInput>>;\nexport type USDLoadProgress = Omit<UsdProgress, \"phase\"> & {\n phase: Exclude<UsdProgress[\"phase\"], \"fetching\">;\n};\nexport type USDImportTimings = UsdDiagnostics[\"timings\"];\nexport type USDImportStatistics = UsdDiagnostics[\"statistics\"];\nexport type USDImportDiagnostics = UsdDiagnostics;\n\nexport interface USDFileLoaderOptions {\n rootFileName?: string;\n files?: USDVirtualFiles;\n resolveByFileName?: boolean;\n workerUrl?: string | URL;\n glueUrl?: string;\n wasmUrl?: string;\n dataUrl?: string;\n onProgress?: (progress: USDLoadProgress) => void;\n onLog?: (level: \"info\" | \"warning\" | \"error\", message: string) => void;\n onComplete?: (diagnostics: USDImportDiagnostics) => void;\n}\n\nexport const USD_RUNTIME_BASE_URL = \"https://cdn.babylonjs.com/babylonUsdImporter/5/\";\nexport const USD_RUNTIME_NAMES = {\n workerUrl: \"babylon-usd-importer.worker.js\",\n glueUrl: \"babylon-usd-importer.js\",\n wasmUrl: \"babylon-usd-importer.wasm\",\n dataUrl: \"babylon-usd-importer.data\",\n} as const;\n\nexport type USDDefaultConfiguration = Required<Pick<USDFileLoaderOptions, \"workerUrl\" | \"glueUrl\" | \"wasmUrl\" | \"dataUrl\">>;\n\nlet defaultConfiguration: USDDefaultConfiguration | undefined;\n\nexport function getUsdDefaultConfiguration(): USDDefaultConfiguration {\n return (defaultConfiguration ??= {\n glueUrl: `${USD_RUNTIME_BASE_URL}${USD_RUNTIME_NAMES.glueUrl}`,\n wasmUrl: `${USD_RUNTIME_BASE_URL}${USD_RUNTIME_NAMES.wasmUrl}`,\n dataUrl: `${USD_RUNTIME_BASE_URL}${USD_RUNTIME_NAMES.dataUrl}`,\n workerUrl: `${USD_RUNTIME_BASE_URL}${USD_RUNTIME_NAMES.workerUrl}`,\n });\n}\n\nexport function setUsdDefaultConfiguration(configuration: USDDefaultConfiguration): void {\n defaultConfiguration = configuration;\n}\n\ninterface SceneLoaderProgressEvent {\n lengthComputable: boolean;\n loaded: number;\n total: number;\n}\n\nexport function resolveUsdOptions(options: Partial<USDFileLoaderOptions>): USDFileLoaderOptions {\n const runtimeKeys = Object.keys(USD_RUNTIME_NAMES) as Array<keyof typeof USD_RUNTIME_NAMES>;\n const configured = runtimeKeys.filter((key) => options[key] !== undefined);\n if (configured.length !== 0 && configured.length !== 4) {\n unsupported(\n \"USDFileLoaderOptions runtime URLs\",\n \"Babylon Lite loads the OpenUSD worker, glue, WASM, and data files from one runtime directory. Babylon.js runtime URL overrides can be adapted only when all four standard files are configured together.\"\n );\n }\n const defaults = getUsdDefaultConfiguration();\n return {\n ...defaults,\n ...options,\n workerUrl: options.workerUrl ?? defaults.workerUrl,\n glueUrl: options.glueUrl ?? defaults.glueUrl,\n wasmUrl: options.wasmUrl ?? defaults.wasmUrl,\n dataUrl: options.dataUrl ?? defaults.dataUrl,\n };\n}\n\nexport function toLiteUsdOptions(options: Partial<USDFileLoaderOptions>, signal?: AbortSignal, onProgress?: (event: SceneLoaderProgressEvent) => void): LoadUsdOptions {\n const configured = (Object.keys(USD_RUNTIME_NAMES) as Array<keyof typeof USD_RUNTIME_NAMES>).filter((key) => options[key] !== undefined);\n\n let runtimeBaseUrl: string | undefined;\n for (const key of configured) {\n const url = new URL(String(options[key]), globalThis.location?.href ?? \"http://localhost/\");\n if (url.search || url.hash) {\n unsupported(\n `USDFileLoaderOptions.${key}`,\n \"Babylon Lite reconstructs OpenUSD runtime file URLs from one directory and cannot preserve per-file query strings or hash fragments.\"\n );\n }\n if (!url.pathname.endsWith(`/${USD_RUNTIME_NAMES[key]}`)) {\n unsupported(\n `USDFileLoaderOptions.${key}`,\n `Babylon Lite loads the four OpenUSD runtime files from one directory using their standard names; '${USD_RUNTIME_NAMES[key]}' is required.`\n );\n }\n const candidate = new URL(\".\", url).href;\n if (runtimeBaseUrl !== undefined && candidate !== runtimeBaseUrl) {\n unsupported(\n \"USDFileLoaderOptions runtime URLs\",\n \"Babylon Lite loads the OpenUSD worker, glue, WASM, and data files from one runtime directory; independently located runtime files cannot be adapted.\"\n );\n }\n runtimeBaseUrl = candidate;\n }\n\n return {\n rootFileName: options.rootFileName,\n files: options.files,\n resolveByFileName: options.resolveByFileName ?? true,\n runtimeBaseUrl,\n signal,\n onProgress: (progress) => {\n if (progress.phase !== \"fetching\") {\n options.onProgress?.({ phase: progress.phase, message: progress.message });\n }\n const loaded = progress.phase === \"fetching\" ? 0 : progress.phase === \"initializing\" ? 1 : progress.phase === \"staging\" ? 2 : progress.phase === \"extracting\" ? 3 : 4;\n onProgress?.({ lengthComputable: false, loaded, total: 4 });\n },\n onLog: options.onLog,\n };\n}\n","/**\n * Babylon.js-compatible `SceneLoader` and `AssetContainer` over Babylon Lite's\n * `loadGltf` / `loadBabylon`.\n *\n * Coverage note: the Lite asset container exposes a root-node hierarchy plus\n * animation groups rather than the flat `meshes` array Babylon.js returns. This\n * compat layer surfaces the underlying container (`_lite`) and the animation\n * groups, and registers everything through `addToScene`. A fully BJS-shaped flat\n * mesh list is not reconstructed in this initial pass.\n */\n\nimport { addToScene, enableBoneControlForSkinnedAssets, loadGltf, loadBabylon, loadUsd, disposeUsd, removeFromScene, setParent as setLiteParent } from \"babylon-lite\";\nimport type { AssetContainer as LiteAssetContainer, AnimationGroup, Mesh as LiteMesh } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { collectLoadedMeshes, type LoadedMeshRegistry } from \"./loaded-mesh.js\";\nimport type { Mesh, TransformNode } from \"../meshes/meshes.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport { Skeleton } from \"../bones/skeleton.js\";\nimport type { USDFileLoaderOptions } from \"./usd-file-loader.js\";\nimport { SPLATFileLoader, type SPLATLoadingOptions } from \"./splat-file-loader.js\";\nimport { resolveUsdOptions, toLiteUsdOptions } from \"./usd-options.js\";\n\n/**\n * Babylon.js registers built-in loader factories through a global plugin\n * registry. Compat dispatches its supported formats directly, so registration\n * is already complete and this compatibility hook is intentionally idempotent.\n */\nexport function registerBuiltInLoaders(): void {}\n\n/** Path portion of a URL, without any query string (`?…`) or hash fragment (`#…`). */\nfunction urlPath(url: string): string {\n return url.split(/[?#]/)[0]!;\n}\n\n/** Splat asset extensions Babylon Lite can parse (`loadSplat` / `loadSOG` / `loadSPZ`). */\nfunction isSplatUrl(url: string): boolean {\n const u = urlPath(url).toLowerCase();\n return u.endsWith(\".ply\") || u.endsWith(\".splat\") || u.endsWith(\".sog\") || u.endsWith(\".spz\") || u.endsWith(\".json\");\n}\n\n/** True when a URL points at a `.babylon` file, ignoring any query string or hash. */\nfunction isBabylonUrl(url: string): boolean {\n return urlPath(url).toLowerCase().endsWith(\".babylon\");\n}\n\nfunction isUsdUrl(url: string): boolean {\n return /\\.(?:usd|usda|usdc|usdz)$/i.test(urlPath(url));\n}\n\nexport class AssetContainer {\n /** @internal Underlying Babylon Lite asset container. */\n public readonly _lite: LiteAssetContainer;\n\n /** @internal Canonical loaded-mesh wrappers, cached per Lite node for stable identity. */\n private readonly _meshRegistry: LoadedMeshRegistry = new Map();\n /** @internal The compat scene this container was added to, if any (drives scene-aware wrappers). */\n private _scene: Scene | undefined;\n /** @internal Canonical loaded-skeleton wrappers. */\n private _skeletons: Skeleton[] | undefined;\n\n private readonly _dispose: (() => void) | undefined;\n /** @internal Original USD mesh ownership, independent of later hierarchy changes. */\n private readonly _ownedMeshes: readonly LiteMesh[] | undefined;\n private _sceneDisposeObserver: ((scene: Scene) => void) | undefined;\n private _disposed = false;\n\n public constructor(lite: LiteAssetContainer, dispose?: () => void, ownedMeshes?: readonly LiteMesh[]) {\n this._lite = lite;\n this._dispose = dispose;\n this._ownedMeshes = ownedMeshes ? [...ownedMeshes] : undefined;\n }\n\n public get animationGroups(): AnimationGroup[] {\n return this._lite.animationGroups ?? [];\n }\n\n /**\n * Flat list of the loaded meshes as canonical, stable-identity compat `Mesh`\n * handles (`__root__` at index 0, matching Babylon.js). Repeated reads return\n * the same wrapper objects, and — once the container is added to a scene — the\n * same handles `scene.meshes` exposes.\n */\n public get meshes(): Mesh[] {\n if (this._disposed) {\n return [...this._meshRegistry.values()];\n }\n return collectLoadedMeshes(this._lite, this._meshRegistry, this._scene);\n }\n\n public get skeletons(): Skeleton[] {\n return (this._skeletons ??= (this._lite.skeletons ?? []).map((skeleton, index) => Skeleton._fromLite(skeleton, index)));\n }\n\n /** Add every entity, animation group, camera, and clear colour to the scene. */\n public addAllToScene(scene: Scene): void {\n addToScene(scene._lite, this._lite);\n this._adoptScene(scene);\n }\n\n /** @internal Associate an already-added Lite container with its compat scene. */\n public _adoptScene(scene: Scene): void {\n if (this._sceneDisposeObserver && this._scene && this._scene !== scene) {\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\n this._sceneDisposeObserver = undefined;\n }\n this._scene = scene;\n if (this._dispose && !this._sceneDisposeObserver) {\n this._sceneDisposeObserver = scene.onDisposeObservable.addOnce(() => {\n this._scene = undefined;\n this._sceneDisposeObserver = undefined;\n this._detachFromScene(scene);\n });\n }\n // Build/bind the canonical wrappers now that the container belongs to a\n // scene, so `scene.meshes` lists the loaded meshes and later\n // `container.meshes` reads share the same scene-aware handles.\n collectLoadedMeshes(this._lite, this._meshRegistry, scene);\n scene._surfaceLoadedCamera();\n }\n\n public dispose(): void {\n const scene = this._scene;\n if (scene && this._sceneDisposeObserver) {\n scene.onDisposeObservable.remove(this._sceneDisposeObserver);\n this._sceneDisposeObserver = undefined;\n }\n this._scene = undefined;\n if (scene) {\n this._detachFromScene(scene);\n } else {\n try {\n this._retireMeshWrappers();\n } finally {\n this._disposeOnce();\n }\n }\n }\n\n private _detachFromScene(scene: Scene): void {\n try {\n if (this._ownedMeshes) {\n for (const mesh of this._ownedMeshes) {\n setLiteParent(mesh, null);\n }\n }\n removeFromScene(scene._lite, this._lite);\n if (this._ownedMeshes) {\n for (const mesh of this._ownedMeshes) {\n removeFromScene(scene._lite, mesh);\n }\n }\n } finally {\n try {\n this._retireMeshWrappers();\n } finally {\n this._disposeOnce();\n }\n }\n }\n\n private _retireMeshWrappers(): void {\n let hasError = false;\n let firstError: unknown;\n for (const wrapper of this._meshRegistry.values()) {\n try {\n wrapper._disposeWrapperOnly();\n } catch (error) {\n if (!hasError) {\n hasError = true;\n firstError = error;\n }\n }\n }\n if (hasError) {\n throw firstError;\n }\n }\n\n private _disposeOnce(): void {\n if (!this._disposed) {\n this._disposed = true;\n this._dispose?.();\n }\n }\n}\n\ninterface ImportResult {\n meshes: TransformNode[];\n particleSystems: unknown[];\n skeletons: Skeleton[];\n animationGroups: AnimationGroup[];\n transformNodes: unknown[];\n lights: unknown[];\n /** The underlying Lite asset container (compat extension; absent for splat assets). */\n container?: AssetContainer;\n}\n\nexport interface ISceneLoaderProgressEvent {\n lengthComputable: boolean;\n loaded: number;\n total: number;\n}\n\nexport interface ISceneLoaderOptions {\n rootUrl?: string;\n onProgress?: (event: ISceneLoaderProgressEvent) => void;\n pluginExtension?: string;\n name?: string;\n pluginOptions?: Record<string, unknown> & {\n gltf?: {\n preprocessUrlAsync?: (url: string) => Promise<string>;\n [option: string]: unknown;\n };\n splat?: Partial<Readonly<SPLATLoadingOptions>>;\n usd?: Partial<USDFileLoaderOptions>;\n };\n}\n\nexport interface ImportMeshOptions extends ISceneLoaderOptions {\n meshNames?: string | readonly string[] | null;\n}\n\nexport interface AppendOptions extends ISceneLoaderOptions {}\n\nexport interface LoadAssetContainerOptions extends ISceneLoaderOptions {}\n\nfunction validateGltfOptions(source: string, options: ISceneLoaderOptions | undefined): void {\n if (!isBabylonUrl(source) && !isSplatUrl(source) && options?.pluginOptions?.gltf?.preprocessUrlAsync) {\n unsupported(\n \"ISceneLoaderOptions.pluginOptions.gltf.preprocessUrlAsync\",\n \"Supporting per-resource URL preprocessing requires a loader-wide callback/context contract across Lite's core glTF loader and lazy extension modules, which cannot be added as an independent tree-shakeable export.\"\n );\n }\n}\n\n/** @internal Load a splat URL into a `GaussianSplattingMesh` (shared by every loader entry point). */\nasync function loadSplatResult(url: string, scene: Scene, options?: Partial<Readonly<SPLATLoadingOptions>>): Promise<ImportResult> {\n const gs = await new SPLATFileLoader(options)._loadUrlAsync(scene, url);\n return { meshes: [gs], particleSystems: [], skeletons: [], animationGroups: [], transformNodes: [], lights: [] };\n}\n\nfunction joinUrl(rootUrl: string, fileName: string): string {\n if (!fileName) {\n return rootUrl;\n }\n if (/^(https?:)?\\/\\//.test(fileName) || fileName.startsWith(\"/\")) {\n return fileName;\n }\n return rootUrl.endsWith(\"/\") || rootUrl === \"\" ? rootUrl + fileName : rootUrl + \"/\" + fileName;\n}\n\nasync function load(rootUrl: string, fileName: string, scene: Scene, usdOptions?: Partial<USDFileLoaderOptions>): Promise<AssetContainer> {\n const url = joinUrl(rootUrl, fileName);\n const engine = scene.getEngine()._lite;\n // Detect the format from the path (ignoring query/hash), but hand the full URL\n // to the loader so any query string is preserved.\n if (!isBabylonUrl(url) && !isUsdUrl(url)) {\n enableBoneControlForSkinnedAssets();\n }\n if (isUsdUrl(url)) {\n return loadUsdContainer(engine, url, usdOptions);\n }\n const lite = isBabylonUrl(url) ? await loadBabylon(engine, url) : await loadGltf(engine, url);\n return new AssetContainer(lite);\n}\n\n/** Babylon.js `SceneLoader` — async glTF/.babylon loading into a compat scene. */\nexport const SceneLoader = {\n /** Import meshes (and the rest of the asset) into the scene. */\n async ImportMeshAsync(_meshNames: unknown, rootUrl: string, sceneFilename: string, scene: Scene): Promise<ImportResult> {\n const url = joinUrl(rootUrl, sceneFilename);\n if (isSplatUrl(url)) {\n return loadSplatResult(url, scene);\n }\n const container = await load(rootUrl, sceneFilename, scene);\n container.addAllToScene(scene);\n return {\n meshes: container.meshes,\n particleSystems: [],\n skeletons: container.skeletons,\n animationGroups: container.animationGroups,\n transformNodes: [],\n lights: [],\n container,\n };\n },\n\n /** Append an asset's contents to the scene. */\n async AppendAsync(rootUrl: string, sceneFilename: string, scene: Scene): Promise<Scene> {\n const url = joinUrl(rootUrl, sceneFilename);\n if (isSplatUrl(url)) {\n await loadSplatResult(url, scene);\n return scene;\n }\n const container = await load(rootUrl, sceneFilename, scene);\n container.addAllToScene(scene);\n return scene;\n },\n\n /** Load an asset into a container without adding it to the scene. */\n async LoadAssetContainerAsync(rootUrl: string, sceneFilename: string, scene: Scene): Promise<AssetContainer> {\n if (isSplatUrl(joinUrl(rootUrl, sceneFilename))) {\n return new SPLATFileLoader().loadAssetContainerAsync(scene, \"\", rootUrl);\n }\n return load(rootUrl, sceneFilename, scene);\n },\n\n /** Plugin registration — out of scope (side-effectful global registry). */\n RegisterPlugin(): never {\n return unsupported(\n \"SceneLoader.RegisterPlugin\",\n \"Loader plugin registration is out of scope for the compat layer (it relies on a side-effectful global registry). Import the loader you need directly.\"\n );\n },\n};\n\n// ── Function-style loaders (Babylon.js 7+ `@babylonjs/core/Loading/sceneLoader`) ──\n\n/** Babylon.js `ImportMeshAsync(source, scene, options?)` — imports an asset into the scene. */\nexport async function ImportMeshAsync(source: string, scene: Scene, options?: ImportMeshOptions): Promise<ImportResult> {\n const url = joinUrl(options?.rootUrl ?? \"\", source);\n if (isSplatUrl(url)) {\n return loadSplatResult(url, scene, options?.pluginOptions?.splat);\n }\n validateGltfOptions(url, options);\n const container = await loadFromSource(url, scene, options?.pluginOptions?.usd, options?.onProgress);\n container.addAllToScene(scene);\n return {\n meshes: container.meshes,\n particleSystems: [],\n skeletons: container.skeletons,\n animationGroups: container.animationGroups,\n transformNodes: [],\n lights: [],\n container,\n };\n}\n\n/** Babylon.js `AppendSceneAsync(source, scene, options?)` — appends an asset's contents to the scene. */\nexport async function AppendSceneAsync(source: string, scene: Scene, options?: AppendOptions): Promise<Scene> {\n const url = joinUrl(options?.rootUrl ?? \"\", source);\n if (isSplatUrl(url)) {\n await loadSplatResult(url, scene, options?.pluginOptions?.splat);\n return scene;\n }\n validateGltfOptions(url, options);\n const container = await loadFromSource(url, scene, options?.pluginOptions?.usd, options?.onProgress);\n container.addAllToScene(scene);\n return scene;\n}\n\n/** Babylon.js `LoadAssetContainerAsync(source, scene, options?)` — loads into a container without adding. */\nexport async function LoadAssetContainerAsync(source: string, scene: Scene, options?: LoadAssetContainerOptions): Promise<AssetContainer> {\n const url = joinUrl(options?.rootUrl ?? \"\", source);\n if (isSplatUrl(url)) {\n return new SPLATFileLoader(options?.pluginOptions?.splat).loadAssetContainerAsync(scene, \"\", options?.rootUrl ?? \"\");\n }\n validateGltfOptions(url, options);\n return loadFromSource(url, scene, options?.pluginOptions?.usd, options?.onProgress);\n}\n\n/** @internal Load a glTF/.babylon asset from a single source URL (function-loader form). */\nasync function loadFromSource(\n source: string,\n scene: Scene,\n usdOptions?: Partial<USDFileLoaderOptions>,\n onProgress?: (event: ISceneLoaderProgressEvent) => void\n): Promise<AssetContainer> {\n const engine = scene.getEngine()._lite;\n // Detect the format from the path (ignoring query/hash), but pass the full URL\n // to the loader so any query string is preserved.\n if (!isBabylonUrl(source) && !isUsdUrl(source)) {\n enableBoneControlForSkinnedAssets();\n }\n if (isUsdUrl(source)) {\n return loadUsdContainer(engine, source, usdOptions, onProgress);\n }\n const lite = isBabylonUrl(source) ? await loadBabylon(engine, source) : await loadGltf(engine, source);\n return new AssetContainer(lite);\n}\n\nasync function loadUsdContainer(\n engine: Parameters<typeof loadUsd>[0],\n source: string,\n options: Partial<USDFileLoaderOptions> = {},\n onProgress?: (event: ISceneLoaderProgressEvent) => void\n): Promise<AssetContainer> {\n const lite = await loadUsd(engine, source, toLiteUsdOptions(resolveUsdOptions(options), undefined, onProgress));\n const container = new AssetContainer(lite, () => disposeUsd(lite), lite._usdMeshes);\n try {\n options.onComplete?.(lite.diagnostics);\n return container;\n } catch (error) {\n container.dispose();\n throw error;\n }\n}\n","/**\n * Babylon.js-compatible `AssetsManager` — a pure task scheduler built on top of\n * the compat loaders. The scheduling/observable surface has no Babylon Lite or\n * GPU dependency and is fully unit-testable; the concrete mesh/texture task types\n * delegate to the compat loaders.\n */\n\nimport { Observable } from \"../misc/observable.js\";\n\nexport type TaskState = \"init\" | \"running\" | \"done\" | \"error\";\n\n/** Base class for an asset-loading task. Subclasses implement {@link runAsync}. */\nexport abstract class AbstractAssetTask {\n public name: string;\n public state: TaskState = \"init\";\n public errorObject: { message: string; exception?: unknown } | undefined;\n\n public onSuccess?: (task: this) => void;\n public onError?: (task: this, message?: string, exception?: unknown) => void;\n\n public constructor(name: string) {\n this.name = name;\n }\n\n public get isCompleted(): boolean {\n return this.state === \"done\";\n }\n\n /** Run the task. Subclasses populate their result fields here. */\n public abstract runAsync(): Promise<void>;\n\n /** @internal Run with success/error bookkeeping. */\n public async _run(): Promise<void> {\n this.state = \"running\";\n try {\n await this.runAsync();\n this.state = \"done\";\n this.onSuccess?.(this);\n } catch (exception) {\n this.state = \"error\";\n const message = exception instanceof Error ? exception.message : String(exception);\n this.errorObject = { message, exception };\n this.onError?.(this, message, exception);\n throw exception;\n }\n }\n}\n\n/** A task whose work is provided as a plain async function (useful for custom assets and tests). */\nexport class CustomAssetTask<T> extends AbstractAssetTask {\n public result: T | undefined;\n\n public constructor(\n name: string,\n private readonly _loader: () => Promise<T>\n ) {\n super(name);\n }\n\n public override async runAsync(): Promise<void> {\n this.result = await this._loader();\n }\n}\n\nexport class AssetsManager {\n public readonly onProgressObservable = new Observable<{ remainingCount: number; totalCount: number; task: AbstractAssetTask }>();\n public readonly onTaskSuccessObservable = new Observable<AbstractAssetTask>();\n public readonly onTaskErrorObservable = new Observable<AbstractAssetTask>();\n public readonly onFinishObservable = new Observable<AbstractAssetTask[]>();\n\n // Kept for Babylon.js API parity only. The compat AssetsManager has no\n // loading-screen UI, and `loadAsync` never rejects on task failure (per-task\n // errors surface via `onTaskErrorObservable`), so neither flag affects\n // loading behavior.\n public useDefaultLoadingScreen = false;\n public autoHideLoadingUI = false;\n\n private readonly _tasks: AbstractAssetTask[] = [];\n private _isLoading = false;\n\n public get tasks(): readonly AbstractAssetTask[] {\n return this._tasks;\n }\n\n public addTask<T extends AbstractAssetTask>(task: T): T {\n this._tasks.push(task);\n return task;\n }\n\n /** Add a custom async task and return it (handy for non-mesh/texture assets and tests). */\n public addCustomTask<T>(name: string, loader: () => Promise<T>): CustomAssetTask<T> {\n return this.addTask(new CustomAssetTask<T>(name, loader));\n }\n\n public reset(): this {\n this._tasks.length = 0;\n return this;\n }\n\n /** Run all queued tasks sequentially, emitting progress, and resolve when done. */\n public async loadAsync(): Promise<AbstractAssetTask[]> {\n if (this._isLoading) {\n throw new Error(\"AssetsManager is already loading.\");\n }\n this._isLoading = true;\n const total = this._tasks.length;\n const completed: AbstractAssetTask[] = [];\n\n try {\n for (const task of this._tasks) {\n try {\n await task._run();\n this.onTaskSuccessObservable.notifyObservers(task);\n } catch {\n this.onTaskErrorObservable.notifyObservers(task);\n }\n completed.push(task);\n this.onProgressObservable.notifyObservers({ remainingCount: total - completed.length, totalCount: total, task });\n }\n this.onFinishObservable.notifyObservers(this._tasks.slice());\n return completed;\n } finally {\n this._isLoading = false;\n }\n }\n}\n","/**\n * Babylon.js `KHR_materials_variants` glTF loader extension\n * (`@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_variants`).\n *\n * Babylon.js exposes the extension's static helpers to switch a loaded asset\n * between material variants at runtime. Babylon Lite decodes the same extension\n * in its glTF loader and exposes `selectVariant` / `getVariantNames` /\n * `resetVariant` keyed by the asset container. The Babylon.js helpers are keyed\n * by the asset's **root mesh** instead, so this wrapper recovers the container\n * from the `LoadedMesh` the loader returned (`result.meshes[0]`) and delegates.\n */\n\nimport { selectVariant, getVariantNames, resetVariant } from \"babylon-lite\";\nimport type { AssetContainer as LiteAssetContainer } from \"babylon-lite\";\n\n/** Recover the Lite asset container a loaded-mesh handle came from. */\nfunction containerOf(rootMesh: unknown): LiteAssetContainer | undefined {\n return (rootMesh as { _container?: LiteAssetContainer } | null)?._container;\n}\n\n/**\n * Babylon.js `KHR_materials_variants` extension helpers. Mirrors the static\n * surface ported code calls (`SelectVariant` / `GetAvailableVariants` / `Reset`)\n * over Babylon Lite's container-keyed variant API.\n */\nexport const KHR_materials_variants = {\n /** Switch the loaded asset to the named material variant. */\n SelectVariant(rootMesh: unknown, variantName: string): void {\n const container = containerOf(rootMesh);\n if (container) {\n selectVariant(container, variantName);\n }\n },\n\n /** The variant names available on the loaded asset (empty when it has none). */\n GetAvailableVariants(rootMesh: unknown): readonly string[] {\n const container = containerOf(rootMesh);\n return container ? getVariantNames(container) : [];\n },\n\n /** Restore the asset's default (variant-free) materials. */\n Reset(rootMesh: unknown): void {\n const container = containerOf(rootMesh);\n if (container) {\n resetVariant(container);\n }\n },\n};\n","import { addToScene, disposeUsd, loadUsd } from \"babylon-lite\";\nimport type { AnimationGroup, UsdBinaryInput } from \"babylon-lite\";\n\nimport type { Mesh } from \"../meshes/meshes.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { Skeleton } from \"../bones/skeleton.js\";\nimport { AssetContainer, type ISceneLoaderProgressEvent } from \"./scene-loader.js\";\nimport { getUsdDefaultConfiguration, resolveUsdOptions, setUsdDefaultConfiguration, toLiteUsdOptions } from \"./usd-options.js\";\nimport type { USDFileLoaderOptions } from \"./usd-options.js\";\nexport type { USDBinaryInput, USDVirtualFiles, USDLoadProgress, USDImportTimings, USDImportStatistics, USDImportDiagnostics, USDFileLoaderOptions } from \"./usd-options.js\";\n\nfunction requireBinary(data: unknown): UsdBinaryInput {\n if (!(data instanceof ArrayBuffer) && !ArrayBuffer.isView(data)) {\n throw new Error(\"USDFileLoader expects binary USD data.\");\n }\n return data;\n}\n\ninterface USDImportResult {\n meshes: Mesh[];\n particleSystems: unknown[];\n skeletons: Skeleton[];\n animationGroups: AnimationGroup[];\n transformNodes: unknown[];\n lights: unknown[];\n}\n\nexport class USDFileLoader {\n public static get DefaultConfiguration(): Required<Pick<USDFileLoaderOptions, \"workerUrl\" | \"glueUrl\" | \"wasmUrl\" | \"dataUrl\">> {\n return getUsdDefaultConfiguration();\n }\n\n public static set DefaultConfiguration(configuration: Required<Pick<USDFileLoaderOptions, \"workerUrl\" | \"glueUrl\" | \"wasmUrl\" | \"dataUrl\">>) {\n setUsdDefaultConfiguration(configuration);\n }\n\n public readonly name = \"usd\";\n public readonly extensions = {\n \".usd\": { isBinary: true },\n \".usda\": { isBinary: true },\n \".usdc\": { isBinary: true },\n \".usdz\": { isBinary: true },\n } as const;\n\n private readonly _options: USDFileLoaderOptions;\n private readonly _activeLoads = new Set<AbortController>();\n\n public constructor(options: Partial<USDFileLoaderOptions> = {}) {\n this._options = { ...getUsdDefaultConfiguration(), ...options };\n }\n\n public createPlugin(options: { usd?: Partial<USDFileLoaderOptions> }): USDFileLoader {\n return new USDFileLoader(options.usd);\n }\n\n public async importMeshAsync(\n _meshNames: string | readonly string[] | null | undefined,\n scene: Scene,\n data: unknown,\n _rootUrl: string,\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\n fileName?: string\n ): Promise<USDImportResult> {\n const container = await this._load(scene, data, onProgress, fileName, true);\n return {\n meshes: container.meshes,\n particleSystems: [],\n skeletons: container.skeletons,\n animationGroups: container.animationGroups,\n transformNodes: [],\n lights: [],\n };\n }\n\n public async loadAsync(scene: Scene, data: unknown, _rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void> {\n await this._load(scene, data, onProgress, fileName, true);\n }\n\n public async loadAssetContainerAsync(\n scene: Scene,\n data: unknown,\n _rootUrl: string,\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\n fileName?: string\n ): Promise<AssetContainer> {\n return this._load(scene, data, onProgress, fileName, false);\n }\n\n public dispose(): void {\n const error = new Error(\"USDFileLoader was disposed.\");\n for (const controller of this._activeLoads) {\n controller.abort(error);\n }\n this._activeLoads.clear();\n }\n\n private async _load(\n scene: Scene,\n data: unknown,\n onProgress: ((event: ISceneLoaderProgressEvent) => void) | undefined,\n fileName: string | undefined,\n add: boolean\n ): Promise<AssetContainer> {\n const controller = new AbortController();\n this._activeLoads.add(controller);\n try {\n const lite = await loadUsd(\n scene.getEngine()._lite,\n requireBinary(data),\n toLiteUsdOptions(resolveUsdOptions({ ...this._options, rootFileName: this._options.rootFileName ?? fileName }), controller.signal, onProgress)\n );\n const container = new AssetContainer(lite, () => disposeUsd(lite), lite._usdMeshes);\n try {\n controller.signal.throwIfAborted();\n if (add) {\n addToScene(scene._lite, lite);\n container._adoptScene(scene);\n }\n this._options.onComplete?.(lite.diagnostics);\n controller.signal.throwIfAborted();\n return container;\n } catch (error) {\n container.dispose();\n throw error;\n }\n } finally {\n this._activeLoads.delete(controller);\n }\n }\n}\n\nexport function RegisterUSDFileLoader(): void {}\n\n/** @internal Babylon.js pure-registration hook; Lite has no global loader dependency registry. */\nexport function _RegisterUSDLoaderDependencies(): void {}\n","/**\n * Babylon.js-compatible `GPUPicker` over Babylon Lite's GPU picker\n * (`createGpuPicker` / `pickAsync` / `disposePicker`).\n *\n * Babylon.js's `GPUPicker` is **asynchronous** GPU picking — which is exactly\n * what Babylon Lite provides — so this is a real wrapper, not a stub. You set a\n * picking list of meshes, then `pickAsync(x, y)` resolves with the picked mesh\n * (or `null`).\n *\n * Coverage notes vs. Babylon.js:\n * - `setPickingList`, `addPickingList`, `clearPickingList`, `pickAsync`,\n * `multiPickAsync`, `pickingInProgress`, and `dispose` are implemented.\n * - The `{ mesh, material }` list-item form is accepted, but the custom picking\n * material is ignored (Lite assigns picking ids internally).\n * - `boxPickAsync` is not supported (Lite has no box-pick primitive) and throws.\n * - Hardware `InstancedMesh` picking is not represented; thin-instance picking is\n * surfaced through `thinInstanceIndex` exactly as Babylon.js does.\n */\n\nimport { createGpuPicker, pickAsync as litePickAsync, disposePicker } from \"babylon-lite\";\nimport type { GpuPicker, Mesh as LiteMesh, GaussianSplattingMesh as LiteGsMesh } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { Mesh } from \"../meshes/meshes.js\";\nimport { GaussianSplattingMesh } from \"../meshes/gaussian-splatting.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\n/** A pickable compat mesh: a regular `Mesh` or a `GaussianSplattingMesh`. */\ntype PickableMesh = Mesh | GaussianSplattingMesh;\n\n/** Result of a single GPU pick. Mirrors Babylon.js `IGPUPickingInfo`. */\nexport interface IGPUPickingInfo {\n mesh: PickableMesh;\n thinInstanceIndex?: number;\n}\n\n/** Result of a multi-point GPU pick. Mirrors Babylon.js `IGPUMultiPickingInfo`. */\nexport interface IGPUMultiPickingInfo {\n meshes: Array<PickableMesh | null>;\n thinInstanceIndexes?: number[];\n}\n\ntype PickListItem = PickableMesh | { mesh: PickableMesh; material?: unknown };\n\nfunction meshOf(item: PickListItem): PickableMesh {\n return item instanceof Mesh || item instanceof GaussianSplattingMesh ? item : item.mesh;\n}\n\n/** @internal The backing Lite node used as the picker's identity key for a compat mesh. */\nfunction liteNodeOf(mesh: PickableMesh): LiteMesh | LiteGsMesh | undefined {\n return mesh instanceof GaussianSplattingMesh ? mesh._pickLiteNode : mesh._lite;\n}\n\nexport class GPUPicker {\n private _picker: GpuPicker | null = null;\n private _scene: Scene | null = null;\n /** Maps Lite nodes (regular mesh or splat node) back to the compat meshes the caller supplied. */\n private readonly _liteToCompat = new Map<LiteMesh | LiteGsMesh, PickableMesh>();\n /** Regular Lite meshes that are pickable (drives the Lite `pickAsync` filter; GS meshes bypass it). */\n private _pickable = new Set<LiteMesh>();\n private _inProgress = false;\n\n /** True while an async pick is running (Babylon.js parity). */\n public get pickingInProgress(): boolean {\n return this._inProgress;\n }\n\n /** Replace the picking list. Passing `null` clears it. */\n public setPickingList(list: PickListItem[] | null): void {\n this.clearPickingList();\n if (list && list.length > 0) {\n this.addPickingList(list);\n }\n }\n\n /** Add meshes to the current picking list. */\n public addPickingList(list: PickListItem[]): void {\n if (!list || list.length === 0) {\n return;\n }\n const first = meshOf(list[0]!);\n const scene = first.getScene();\n if (!scene) {\n unsupported(\"GPUPicker.setPickingList\", \"Picking-list meshes must belong to a Scene (create them with a scene argument).\");\n }\n if (!this._picker || this._scene !== scene) {\n // Switching to a different scene: release the previous Lite picker so\n // we don't leak its GPU resources.\n if (this._picker) {\n disposePicker(this._picker);\n }\n this._scene = scene;\n this._picker = createGpuPicker(scene._lite);\n }\n for (const item of list) {\n const mesh = meshOf(item);\n const liteNode = liteNodeOf(mesh);\n if (!liteNode) {\n // A GaussianSplattingMesh whose splat is not loaded yet has no node to\n // key on; it becomes pickable once loaded and re-added.\n continue;\n }\n this._liteToCompat.set(liteNode, mesh);\n // Only regular meshes participate in the Lite filter; the Lite picker\n // auto-includes scene splat meshes (its GS pass ignores the filter).\n if (mesh instanceof Mesh) {\n this._pickable.add(mesh._lite);\n }\n }\n }\n\n /** Clear the picking list and release its bookkeeping. */\n public clearPickingList(): void {\n this._liteToCompat.clear();\n this._pickable = new Set<LiteMesh>();\n }\n\n /** Pick the mesh at canvas coordinates `(x, y)`. Resolves to `null` on a miss. */\n public async pickAsync(x: number, y: number, disposeWhenDone = false): Promise<IGPUPickingInfo | null> {\n if (this._inProgress || !this._picker || this._liteToCompat.size === 0) {\n return null;\n }\n this._inProgress = true;\n try {\n const info = await litePickAsync(this._picker, x, y, { filter: (mesh) => this._pickable.has(mesh) });\n if (!info.hit || !info.pickedMesh) {\n return null;\n }\n const mesh = this._liteToCompat.get(info.pickedMesh as LiteMesh | LiteGsMesh);\n if (!mesh) {\n return null;\n }\n return info.thinInstanceIndex >= 0 ? { mesh, thinInstanceIndex: info.thinInstanceIndex } : { mesh };\n } finally {\n this._inProgress = false;\n if (disposeWhenDone) {\n this.dispose();\n }\n }\n }\n\n /** Pick at several points. Always returns one entry per coordinate (mesh or `null`). */\n public async multiPickAsync(xy: Array<{ x: number; y: number }>, disposeWhenDone = false): Promise<IGPUMultiPickingInfo | null> {\n if (this._inProgress || !this._picker || this._liteToCompat.size === 0 || xy.length === 0) {\n return null;\n }\n const meshes: Array<PickableMesh | null> = [];\n const thinInstanceIndexes: number[] = [];\n for (const point of xy) {\n // Sequential: Lite picks one pixel per call.\n const result = await this.pickAsync(point.x, point.y);\n meshes.push(result?.mesh ?? null);\n thinInstanceIndexes.push(result?.thinInstanceIndex ?? 0);\n }\n if (disposeWhenDone) {\n this.dispose();\n }\n return { meshes, thinInstanceIndexes };\n }\n\n /** Box picking is not implemented in Babylon Lite. */\n public boxPickAsync(): never {\n return unsupported(\"GPUPicker.boxPickAsync\", \"Box (area) picking is not implemented in Babylon Lite. Use `multiPickAsync` over the points you need.\");\n }\n\n /** Release GPU picking resources. */\n public dispose(): void {\n if (this._picker) {\n disposePicker(this._picker);\n this._picker = null;\n }\n this._scene = null;\n this.clearPickingList();\n }\n}\n","/**\n * Babylon.js-compatible gizmos over Babylon Lite's gizmo suite.\n *\n * Babylon.js gizmos take a `UtilityLayerRenderer` and attach to a node via\n * `attachedMesh`/`attachedNode`. Babylon Lite mirrors this with\n * `createUtilityLayer` + `create*Gizmo(engine, layer)` + `attach*ToNode`. These\n * wrappers reproduce the Babylon.js class shape and the `attachedMesh` setter.\n */\n\nimport {\n createUtilityLayer,\n registerUtilityLayer,\n disposeUtilityLayer,\n createPositionGizmo,\n attachPositionGizmoToNode,\n disposePositionGizmo,\n setPositionGizmoLocalCoordinates,\n createRotationGizmo,\n attachRotationGizmoToNode,\n disposeRotationGizmo,\n setRotationGizmoLocalCoordinates,\n createScaleGizmo,\n attachScaleGizmoToNode,\n disposeScaleGizmo,\n setScaleGizmoLocalCoordinates,\n createBoundingBoxGizmo,\n attachBoundingBoxGizmoToNode,\n disposeBoundingBoxGizmo,\n createLightGizmo,\n attachLightGizmoToLight,\n disposeLightGizmo,\n createCameraGizmo,\n attachCameraGizmoToCamera,\n disposeCameraGizmo,\n createAxisDragGizmo,\n attachAxisDragGizmoToNode,\n disposeAxisDragGizmo,\n createPlaneRotationGizmo,\n attachPlaneRotationGizmoToNode,\n disposePlaneRotationGizmo,\n createPlaneDragGizmo,\n attachPlaneDragGizmoToNode,\n disposePlaneDragGizmo,\n createAxisScaleGizmo,\n attachAxisScaleGizmoToNode,\n disposeAxisScaleGizmo,\n} from \"babylon-lite\";\nimport type {\n UtilityLayer as LiteUtilityLayer,\n PositionGizmo as LitePositionGizmo,\n RotationGizmo as LiteRotationGizmo,\n ScaleGizmo as LiteScaleGizmo,\n BoundingBoxGizmo as LiteBoundingBoxGizmo,\n LightGizmo as LiteLightGizmo,\n CameraGizmo as LiteCameraGizmo,\n AxisDragGizmo as LiteAxisDragGizmo,\n PlaneRotationGizmo as LitePlaneRotationGizmo,\n PlaneDragGizmo as LitePlaneDragGizmo,\n AxisScaleGizmo as LiteAxisScaleGizmo,\n EngineContext,\n SceneNode,\n PointerDrag,\n PointerDragStartEvent,\n PointerDragMoveEvent,\n PointerDragEndEvent,\n PickingInfo as LitePickingInfo,\n Mesh as LiteMesh,\n} from \"babylon-lite\";\n\nimport type { Scene } from \"../scene/scene.js\";\nimport { type AbstractMesh, Mesh } from \"../meshes/meshes.js\";\nimport type { Node } from \"../node/node.js\";\nimport type { Light } from \"../lights/lights.js\";\nimport type { Camera } from \"../cameras/cameras.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport type { Color3 } from \"../math/color.js\";\nimport { Observable } from \"../misc/observable.js\";\nimport { PointerEventTypes, PointerInfo } from \"../events/pointer-events.js\";\nimport { PickingInfo } from \"../culling/picking-info.js\";\nimport { Ray } from \"../math/ray.js\";\n\n/** Babylon.js drag move payload. */\nexport type DragEvent = {\n delta: Vector3;\n dragPlanePoint: Vector3;\n dragPlaneNormal: Vector3;\n dragDistance: number;\n pointerId: number;\n pointerInfo: PointerInfo | null;\n};\n\n/** Babylon.js drag start/end payload. */\nexport type DragStartEndEvent = Pick<DragEvent, \"dragPlanePoint\" | \"pointerId\" | \"pointerInfo\">;\n\nfunction vectorFromLite(value: { x: number; y: number; z: number }): Vector3 {\n return new Vector3(value.x, value.y, value.z);\n}\n\nfunction pickingInfoFromLite(value: LitePickingInfo, pickedMeshes: Map<LiteMesh, Mesh>): PickingInfo {\n const liteMesh = value.pickedMesh as LiteMesh | null;\n let pickedMesh = liteMesh ? pickedMeshes.get(liteMesh) : undefined;\n if (liteMesh && !pickedMesh) {\n pickedMesh = Mesh._fromLite(liteMesh);\n pickedMeshes.set(liteMesh, pickedMesh);\n }\n const ray = value.ray ? new Ray(Vector3.FromArray(value.ray.origin), Vector3.FromArray(value.ray.direction), value.ray.length) : Ray.Zero();\n const result = PickingInfo._fromLite(value, pickedMesh ?? null, ray);\n result.ray = value.ray ? ray : null;\n return result;\n}\n\nfunction relayCompositeDragEvents(\n drags: readonly PointerDrag[],\n onDragStartObservable: Observable<DragStartEndEvent>,\n onDragObservable: Observable<DragEvent>,\n onDragEndObservable: Observable<DragStartEndEvent>\n): (() => void)[] {\n const subscriptions: (() => void)[] = [];\n const pointerInfos = new Map<PointerDrag, PointerInfo>();\n const pickedMeshes = new Map<LiteMesh, Mesh>();\n const axisPlaneNormals = new Map<PointerDrag, Vector3>();\n const previousPlaneDragDistances = new Map<PointerDrag, number>();\n for (const drag of drags) {\n subscriptions.push(\n drag.onDragStart.add((event: PointerDragStartEvent) => {\n const pointerInfo = new PointerInfo(PointerEventTypes.POINTERDOWN, event.pointerEvent, pickingInfoFromLite(event.pickInfo, pickedMeshes));\n pointerInfos.set(drag, pointerInfo);\n if (drag.options.dragAxis) {\n axisPlaneNormals.set(drag, new Vector3(-event.dragPlaneNormal.x || 0, -event.dragPlaneNormal.y || 0, -event.dragPlaneNormal.z || 0));\n }\n onDragStartObservable.notifyObservers({\n dragPlanePoint: vectorFromLite(event.dragPlanePoint),\n pointerId: event.pointerId,\n pointerInfo,\n });\n }),\n drag.onDrag.add((event: PointerDragMoveEvent) => {\n const axis = drag.options.dragAxis;\n const dragDistance = axis ? event.delta.x * axis.x + event.delta.y * axis.y + event.delta.z * axis.z : (previousPlaneDragDistances.get(drag) ?? 0);\n if (!axis) {\n previousPlaneDragDistances.set(drag, Math.hypot(event.delta.x, event.delta.y, event.delta.z));\n }\n onDragObservable.notifyObservers({\n delta: vectorFromLite(event.delta),\n dragPlanePoint: vectorFromLite(event.dragPlanePoint),\n dragPlaneNormal: axisPlaneNormals.get(drag)?.clone() ?? vectorFromLite(event.dragPlaneNormal),\n dragDistance,\n pointerId: event.pointerId,\n pointerInfo: pointerInfos.get(drag) ?? null,\n });\n }),\n drag.onDragEnd.add((event: PointerDragEndEvent) => {\n onDragEndObservable.notifyObservers({\n dragPlanePoint: vectorFromLite(event.dragPlanePoint),\n pointerId: event.pointerId,\n pointerInfo: pointerInfos.get(drag) ?? null,\n });\n pointerInfos.delete(drag);\n axisPlaneNormals.delete(drag);\n })\n );\n }\n return subscriptions;\n}\n\n/** Babylon.js `UtilityLayerRenderer` — the overlay scene gizmos render into. */\nexport class UtilityLayerRenderer {\n /** @internal Underlying Babylon Lite utility layer. */\n public readonly _lite: LiteUtilityLayer;\n /** @internal Lite engine backing the layer (gizmo factories need it explicitly). */\n public readonly _engine: EngineContext;\n private _registered = false;\n\n public constructor(scene: Scene) {\n this._engine = scene.getEngine()._lite;\n this._lite = createUtilityLayer(this._engine, scene._lite);\n // Babylon Lite registers a utility layer *after* its gizmos are created and\n // after the main scene is registered. Gizmo creation is synchronous (all\n // gizmos exist by the time the engine starts), so defer registration to the\n // engine's late-work phase to capture every gizmo.\n scene.getEngine()._registerLateWork(() => this._ensureRegistered());\n }\n\n /** @internal Ensure the layer is registered with the engine (idempotent). */\n public _ensureRegistered(): Promise<void> {\n if (this._registered) {\n return Promise.resolve();\n }\n this._registered = true;\n return registerUtilityLayer(this._lite);\n }\n\n public dispose(): void {\n disposeUtilityLayer(this._lite);\n }\n}\n\n/** Shared base for compat gizmos (Babylon.js `Gizmo`). */\nabstract class GizmoBase {\n /** @internal The utility layer this gizmo renders into. */\n public readonly _layer: UtilityLayerRenderer;\n\n protected constructor(layer: UtilityLayerRenderer) {\n this._layer = layer;\n // The utility layer registers itself with the engine during the engine's\n // late-work phase (after all gizmos are created), so no eager registration\n // is needed here.\n }\n\n public abstract get attachedMesh(): AbstractMesh | null;\n public abstract set attachedMesh(value: AbstractMesh | null);\n\n public abstract dispose(): void;\n}\n\nexport class PositionGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LitePositionGizmo;\n private _attached: AbstractMesh | null = null;\n private _xGizmo: AxisDragGizmo | null = null;\n private _yGizmo: AxisDragGizmo | null = null;\n private _zGizmo: AxisDragGizmo | null = null;\n private _dragSubscriptions: (() => void)[];\n public readonly onDragStartObservable = new Observable<DragStartEndEvent>();\n public readonly onDragObservable = new Observable<DragEvent>();\n public readonly onDragEndObservable = new Observable<DragStartEndEvent>();\n\n public constructor(layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createPositionGizmo(layer._engine, layer._lite);\n this._dragSubscriptions = relayCompositeDragEvents(\n [this._lite.xGizmo.drag, this._lite.yGizmo.drag, this._lite.zGizmo.drag],\n this.onDragStartObservable,\n this.onDragObservable,\n this.onDragEndObservable\n );\n // Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` defaults to true.\n setPositionGizmoLocalCoordinates(this._lite, true);\n }\n\n /** Babylon.js `PositionGizmo.xGizmo/yGizmo/zGizmo` — the per-axis drag sub-gizmos.\n * Exposed so callers can toggle interactivity per axis (e.g. `xGizmo.isEnabled = false`\n * for a display-only gizmo). Wrappers are cached so identity is stable. */\n public get xGizmo(): AxisDragGizmo {\n return (this._xGizmo ??= AxisDragGizmo._fromLite(this._lite.xGizmo, this._layer));\n }\n public get yGizmo(): AxisDragGizmo {\n return (this._yGizmo ??= AxisDragGizmo._fromLite(this._lite.yGizmo, this._layer));\n }\n public get zGizmo(): AxisDragGizmo {\n return (this._zGizmo ??= AxisDragGizmo._fromLite(this._lite.zGizmo, this._layer));\n }\n\n /** Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` — orient widgets to the node's local axes. */\n public set updateGizmoRotationToMatchAttachedMesh(value: boolean) {\n setPositionGizmoLocalCoordinates(this._lite, value);\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this._attached = value;\n attachPositionGizmoToNode(this._lite, (value?._lite as SceneNode | undefined) ?? null);\n }\n\n public get attachedNode(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedNode(value: AbstractMesh | null) {\n this.attachedMesh = value;\n }\n\n public override dispose(): void {\n disposePositionGizmo(this._lite, this._layer._lite);\n for (const unsubscribe of this._dragSubscriptions) {\n unsubscribe();\n }\n this._dragSubscriptions.length = 0;\n this.onDragStartObservable.clear();\n this.onDragObservable.clear();\n this.onDragEndObservable.clear();\n }\n}\n\nexport class RotationGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LiteRotationGizmo;\n private _attached: AbstractMesh | null = null;\n private _xGizmo: PlaneRotationGizmo | null = null;\n private _yGizmo: PlaneRotationGizmo | null = null;\n private _zGizmo: PlaneRotationGizmo | null = null;\n private _dragSubscriptions: (() => void)[];\n public readonly onDragStartObservable = new Observable<DragStartEndEvent>();\n public readonly onDragObservable = new Observable<DragEvent>();\n public readonly onDragEndObservable = new Observable<DragStartEndEvent>();\n\n public constructor(layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createRotationGizmo(layer._engine, layer._lite);\n this._dragSubscriptions = relayCompositeDragEvents(\n [this._lite.xGizmo.drag, this._lite.yGizmo.drag, this._lite.zGizmo.drag],\n this.onDragStartObservable,\n this.onDragObservable,\n this.onDragEndObservable\n );\n // Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` defaults to true.\n setRotationGizmoLocalCoordinates(this._lite, true);\n }\n\n /** Babylon.js `RotationGizmo.xGizmo/yGizmo/zGizmo` — the per-plane rotation sub-gizmos. */\n public get xGizmo(): PlaneRotationGizmo {\n return (this._xGizmo ??= PlaneRotationGizmo._fromLite(this._lite.xGizmo, this._layer));\n }\n public get yGizmo(): PlaneRotationGizmo {\n return (this._yGizmo ??= PlaneRotationGizmo._fromLite(this._lite.yGizmo, this._layer));\n }\n public get zGizmo(): PlaneRotationGizmo {\n return (this._zGizmo ??= PlaneRotationGizmo._fromLite(this._lite.zGizmo, this._layer));\n }\n\n /** Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` — orient widgets to the node's local axes. */\n public set updateGizmoRotationToMatchAttachedMesh(value: boolean) {\n setRotationGizmoLocalCoordinates(this._lite, value);\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this._attached = value;\n attachRotationGizmoToNode(this._lite, (value?._lite as SceneNode | undefined) ?? null);\n }\n\n public get attachedNode(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedNode(value: AbstractMesh | null) {\n this.attachedMesh = value;\n }\n\n public override dispose(): void {\n disposeRotationGizmo(this._lite, this._layer._lite);\n for (const unsubscribe of this._dragSubscriptions) {\n unsubscribe();\n }\n this._dragSubscriptions.length = 0;\n this.onDragStartObservable.clear();\n this.onDragObservable.clear();\n this.onDragEndObservable.clear();\n }\n}\n\nexport class ScaleGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LiteScaleGizmo;\n private _attached: AbstractMesh | null = null;\n private _xGizmo: AxisScaleGizmo | null = null;\n private _yGizmo: AxisScaleGizmo | null = null;\n private _zGizmo: AxisScaleGizmo | null = null;\n\n public constructor(layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createScaleGizmo(layer._engine, layer._lite);\n // Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` defaults to true.\n setScaleGizmoLocalCoordinates(this._lite, true);\n }\n\n /** Babylon.js `ScaleGizmo.xGizmo/yGizmo/zGizmo` — the per-axis scale sub-gizmos. */\n public get xGizmo(): AxisScaleGizmo {\n return (this._xGizmo ??= AxisScaleGizmo._fromLite(this._lite.xGizmo, this._layer));\n }\n public get yGizmo(): AxisScaleGizmo {\n return (this._yGizmo ??= AxisScaleGizmo._fromLite(this._lite.yGizmo, this._layer));\n }\n public get zGizmo(): AxisScaleGizmo {\n return (this._zGizmo ??= AxisScaleGizmo._fromLite(this._lite.zGizmo, this._layer));\n }\n\n /** Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` — orient widgets to the node's local axes. */\n public set updateGizmoRotationToMatchAttachedMesh(value: boolean) {\n setScaleGizmoLocalCoordinates(this._lite, value);\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this._attached = value;\n attachScaleGizmoToNode(this._lite, (value?._lite as SceneNode | undefined) ?? null);\n }\n\n public get attachedNode(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedNode(value: AbstractMesh | null) {\n this.attachedMesh = value;\n }\n\n public override dispose(): void {\n disposeScaleGizmo(this._lite, this._layer._lite);\n }\n}\n\nexport class BoundingBoxGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LiteBoundingBoxGizmo;\n private _attached: AbstractMesh | null = null;\n\n /**\n * Babylon.js `BoundingBoxGizmo(color?, utilityLayer?)`. The first argument may\n * be the gizmo colour (when a layer is also supplied) or the utility layer.\n */\n public constructor(colorOrLayer: Color3 | UtilityLayerRenderer, layer?: UtilityLayerRenderer) {\n const resolvedLayer = layer ?? (colorOrLayer as UtilityLayerRenderer);\n const color = layer ? (colorOrLayer as Color3) : undefined;\n super(resolvedLayer);\n this._lite = createBoundingBoxGizmo(resolvedLayer._engine, resolvedLayer._lite, color ? { color: [color.r, color.g, color.b] } : {});\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this._attached = value;\n attachBoundingBoxGizmoToNode(this._lite, nodeLite(value));\n }\n\n public get attachedNode(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedNode(value: AbstractMesh | null) {\n this.attachedMesh = value;\n }\n\n /** Babylon.js `BoundingBoxGizmo.enableDragBehavior()` — enables body-drag (Lite enables it by default). */\n public enableDragBehavior(): void {\n // Babylon Lite's bounding-box gizmo wires body-drag through its own pointer\n // behaviour; no explicit opt-in is required.\n }\n\n public override dispose(): void {\n disposeBoundingBoxGizmo(this._lite, this._layer._lite);\n }\n}\n\nexport class LightGizmo {\n /** @internal */\n public readonly _lite: LiteLightGizmo;\n /** @internal */\n public readonly _layer: UtilityLayerRenderer;\n private _attached: Light | null = null;\n\n public constructor(layer: UtilityLayerRenderer) {\n this._layer = layer;\n this._lite = createLightGizmo(layer._engine, layer._lite);\n }\n\n public get light(): Light | null {\n return this._attached;\n }\n public set light(value: Light | null) {\n this._attached = value;\n attachLightGizmoToLight(this._lite, value?._lite ?? null);\n }\n\n /**\n * Babylon.js `LightGizmo.attachedMesh` — the gizmo's visual root. Babylon.js\n * code reads this to reposition the gizmo for lights without a position (e.g.\n * hemispheric). Returns a thin proxy over the Lite gizmo's `root` node whose\n * `position` writes through to it.\n */\n public get attachedMesh(): { position: Vector3 } {\n const root = this._lite.root;\n return {\n get position(): Vector3 {\n return root.position as unknown as Vector3;\n },\n set position(v: Vector3) {\n root.position.set(v.x, v.y, v.z);\n },\n };\n }\n\n public dispose(): void {\n disposeLightGizmo(this._lite, this._layer._lite);\n }\n}\n\nexport class CameraGizmo {\n /** @internal */\n public readonly _lite: LiteCameraGizmo;\n /** @internal */\n public readonly _layer: UtilityLayerRenderer;\n private _attached: Camera | null = null;\n\n public constructor(layer: UtilityLayerRenderer) {\n this._layer = layer;\n this._lite = createCameraGizmo(layer._engine, layer._lite);\n }\n\n public get camera(): Camera | null {\n return this._attached;\n }\n public set camera(value: Camera | null) {\n this._attached = value;\n attachCameraGizmoToCamera(this._lite, value?._lite ?? null);\n }\n\n public dispose(): void {\n disposeCameraGizmo(this._lite, this._layer._lite);\n }\n}\n\n/**\n * Babylon.js single-axis / single-plane gizmos. Babylon.js constructs these with\n * `(axis, color, utilityLayer)` and attaches to a node via `attachedNode`. Each\n * maps to a Babylon Lite single-axis gizmo factory.\n *\n * @internal Resolve the Lite scene node for a compat node (mesh `_lite` or\n * transform `_node`).\n */\nfunction nodeLite(value: Node | null): SceneNode | null {\n if (!value) {\n return null;\n }\n const n = value as { _lite?: SceneNode; _node?: SceneNode };\n return n._lite ?? n._node ?? null;\n}\n\n/**\n * @internal Build a single-axis/plane gizmo wrapper around a Lite sub-gizmo that\n * a composite already created, without re-running the public constructor (which\n * would build a second Lite gizmo). Used by the composite `xGizmo`/`yGizmo`/`zGizmo`\n * accessors so `positionGizmo.xGizmo.isEnabled = false` reaches the real sub-gizmo.\n */\nfunction wrapSubGizmo<L, T extends { _lite: L }>(ctor: { prototype: T }, lite: L, layer: UtilityLayerRenderer): T {\n const g = Object.create(ctor.prototype) as { _lite: L; _layer: UtilityLayerRenderer; _attached: Node | null };\n g._lite = lite;\n g._layer = layer;\n g._attached = null;\n return g as unknown as T;\n}\n\n/** Babylon.js `AxisDragGizmo` — drags the attached node along a single world axis. */\nexport class AxisDragGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LiteAxisDragGizmo;\n private _attached: Node | null = null;\n\n public constructor(dragAxis: Vector3, color: Color3, layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createAxisDragGizmo(layer._engine, layer._lite, {\n dragAxis: { x: dragAxis.x, y: dragAxis.y, z: dragAxis.z },\n color: [color.r, color.g, color.b],\n });\n }\n\n /** @internal Wrap an existing Lite axis-drag gizmo (a composite's sub-gizmo). */\n public static _fromLite(lite: LiteAxisDragGizmo, layer: UtilityLayerRenderer): AxisDragGizmo {\n return wrapSubGizmo(AxisDragGizmo, lite, layer);\n }\n\n /** Babylon.js `IAxisDragGizmo.isEnabled` — when false the gizmo is non-interactive\n * (no drag, and no GPU hover picking), while its meshes stay visible and keep\n * following the attached node. Toggles the underlying Lite pointer-drag. */\n public get isEnabled(): boolean {\n return this._lite.drag.enabled;\n }\n public set isEnabled(value: boolean) {\n this._lite.drag.enabled = value;\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached as AbstractMesh | null;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this.attachedNode = value;\n }\n\n public get attachedNode(): Node | null {\n return this._attached;\n }\n public set attachedNode(value: Node | null) {\n this._attached = value;\n attachAxisDragGizmoToNode(this._lite, nodeLite(value));\n }\n\n public override dispose(): void {\n disposeAxisDragGizmo(this._lite, this._layer._lite);\n }\n}\n\n/** Babylon.js `PlaneRotationGizmo` — rotates the attached node about a plane normal. */\nexport class PlaneRotationGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LitePlaneRotationGizmo;\n private _attached: Node | null = null;\n\n public constructor(planeNormal: Vector3, color: Color3, layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createPlaneRotationGizmo(layer._engine, layer._lite, {\n planeNormal: { x: planeNormal.x, y: planeNormal.y, z: planeNormal.z },\n color: [color.r, color.g, color.b],\n });\n }\n\n /** @internal Wrap an existing Lite plane-rotation gizmo (a composite's sub-gizmo). */\n public static _fromLite(lite: LitePlaneRotationGizmo, layer: UtilityLayerRenderer): PlaneRotationGizmo {\n return wrapSubGizmo(PlaneRotationGizmo, lite, layer);\n }\n\n /** Babylon.js `IPlaneRotationGizmo.isEnabled` — toggles interactivity (drag + hover pick). */\n public get isEnabled(): boolean {\n return this._lite.drag.enabled;\n }\n public set isEnabled(value: boolean) {\n this._lite.drag.enabled = value;\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached as AbstractMesh | null;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this.attachedNode = value;\n }\n\n public get attachedNode(): Node | null {\n return this._attached;\n }\n public set attachedNode(value: Node | null) {\n this._attached = value;\n attachPlaneRotationGizmoToNode(this._lite, nodeLite(value));\n }\n\n public override dispose(): void {\n disposePlaneRotationGizmo(this._lite, this._layer._lite);\n }\n}\n\n/** Babylon.js `PlaneDragGizmo` — drags the attached node within a plane. */\nexport class PlaneDragGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LitePlaneDragGizmo;\n private _attached: Node | null = null;\n\n public constructor(dragPlaneNormal: Vector3, color: Color3, layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createPlaneDragGizmo(layer._engine, layer._lite, {\n dragPlaneNormal: { x: dragPlaneNormal.x, y: dragPlaneNormal.y, z: dragPlaneNormal.z },\n color: [color.r, color.g, color.b],\n });\n }\n\n /** @internal Wrap an existing Lite plane-drag gizmo (a composite's sub-gizmo). */\n public static _fromLite(lite: LitePlaneDragGizmo, layer: UtilityLayerRenderer): PlaneDragGizmo {\n return wrapSubGizmo(PlaneDragGizmo, lite, layer);\n }\n\n /** Babylon.js `IPlaneDragGizmo.isEnabled` — toggles interactivity (drag + hover pick). */\n public get isEnabled(): boolean {\n return this._lite.drag.enabled;\n }\n public set isEnabled(value: boolean) {\n this._lite.drag.enabled = value;\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached as AbstractMesh | null;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this.attachedNode = value;\n }\n\n public get attachedNode(): Node | null {\n return this._attached;\n }\n public set attachedNode(value: Node | null) {\n this._attached = value;\n attachPlaneDragGizmoToNode(this._lite, nodeLite(value));\n }\n\n public override dispose(): void {\n disposePlaneDragGizmo(this._lite, this._layer._lite);\n }\n}\n\n/** Babylon.js `AxisScaleGizmo` — scales the attached node along a single axis. */\nexport class AxisScaleGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LiteAxisScaleGizmo;\n private _attached: Node | null = null;\n\n public constructor(dragAxis: Vector3, color: Color3, layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createAxisScaleGizmo(layer._engine, layer._lite, {\n dragAxis: { x: dragAxis.x, y: dragAxis.y, z: dragAxis.z },\n color: [color.r, color.g, color.b],\n });\n }\n\n /** @internal Wrap an existing Lite axis-scale gizmo (a composite's sub-gizmo). */\n public static _fromLite(lite: LiteAxisScaleGizmo, layer: UtilityLayerRenderer): AxisScaleGizmo {\n return wrapSubGizmo(AxisScaleGizmo, lite, layer);\n }\n\n /** Babylon.js `IAxisScaleGizmo.isEnabled` — toggles interactivity (drag + hover pick). */\n public get isEnabled(): boolean {\n return this._lite.drag.enabled;\n }\n public set isEnabled(value: boolean) {\n this._lite.drag.enabled = value;\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached as AbstractMesh | null;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this.attachedNode = value;\n }\n\n public get attachedNode(): Node | null {\n return this._attached;\n }\n public set attachedNode(value: Node | null) {\n this._attached = value;\n attachAxisScaleGizmoToNode(this._lite, nodeLite(value));\n }\n\n public override dispose(): void {\n disposeAxisScaleGizmo(this._lite, this._layer._lite);\n }\n}\n\n/**\n * Babylon.js `GizmoManager` — coordinates the position/rotation/scale/bounding-box\n * gizmos over a shared utility layer and a single attached mesh.\n */\nexport class GizmoManager {\n public readonly gizmos: {\n positionGizmo: PositionGizmo | null;\n rotationGizmo: RotationGizmo | null;\n scaleGizmo: ScaleGizmo | null;\n boundingBoxGizmo: BoundingBoxGizmo | null;\n } = { positionGizmo: null, rotationGizmo: null, scaleGizmo: null, boundingBoxGizmo: null };\n\n private readonly _layer: UtilityLayerRenderer;\n private _attached: AbstractMesh | null = null;\n\n public constructor(scene: Scene) {\n this._layer = new UtilityLayerRenderer(scene);\n }\n\n public set positionGizmoEnabled(enabled: boolean) {\n this._toggle(\"positionGizmo\", enabled, () => new PositionGizmo(this._layer));\n }\n public set rotationGizmoEnabled(enabled: boolean) {\n this._toggle(\"rotationGizmo\", enabled, () => new RotationGizmo(this._layer));\n }\n public set scaleGizmoEnabled(enabled: boolean) {\n this._toggle(\"scaleGizmo\", enabled, () => new ScaleGizmo(this._layer));\n }\n public set boundingBoxGizmoEnabled(enabled: boolean) {\n this._toggle(\"boundingBoxGizmo\", enabled, () => new BoundingBoxGizmo(this._layer));\n }\n\n public attachToMesh(mesh: Mesh | null): void {\n this._attached = mesh;\n if (this.gizmos.positionGizmo) {\n this.gizmos.positionGizmo.attachedMesh = mesh;\n }\n if (this.gizmos.rotationGizmo) {\n this.gizmos.rotationGizmo.attachedMesh = mesh;\n }\n if (this.gizmos.scaleGizmo) {\n this.gizmos.scaleGizmo.attachedMesh = mesh;\n }\n if (this.gizmos.boundingBoxGizmo) {\n this.gizmos.boundingBoxGizmo.attachedMesh = mesh;\n }\n }\n\n public dispose(): void {\n this.gizmos.positionGizmo?.dispose();\n this.gizmos.rotationGizmo?.dispose();\n this.gizmos.scaleGizmo?.dispose();\n this.gizmos.boundingBoxGizmo?.dispose();\n this._layer.dispose();\n }\n\n private _toggle<K extends \"positionGizmo\" | \"rotationGizmo\" | \"scaleGizmo\" | \"boundingBoxGizmo\">(\n key: K,\n enabled: boolean,\n make: () => PositionGizmo | RotationGizmo | ScaleGizmo | BoundingBoxGizmo\n ): void {\n if (enabled && !this.gizmos[key]) {\n const gizmo = make() as never;\n this.gizmos[key] = gizmo;\n this.gizmos[key]!.attachedMesh = this._attached;\n } else if (!enabled && this.gizmos[key]) {\n this.gizmos[key]!.dispose();\n this.gizmos[key] = null;\n }\n }\n}\n","/**\n * Babylon.js-compatible camera/mesh behaviors.\n *\n * Camera behaviors (`AutoRotationBehavior`, `BouncingBehavior`,\n * `FramingBehavior`) operate on the compat `ArcRotateCamera` via the scene's\n * before-render hook. `AutoRotationBehavior` is fully functional; bouncing and\n * framing implement the structural surface plus their core action without\n * Babylon.js's tweened animations (so they are `⚡ Partial`).\n */\n\nimport { onBeforeRender } from \"babylon-lite\";\n\nimport type { ArcRotateCamera } from \"../cameras/cameras.js\";\n\n/** Babylon.js `Behavior<T>` interface. */\nexport interface Behavior<T> {\n readonly name: string;\n init(): void;\n attach(target: T): void;\n detach(): void;\n}\n\n/** Idle auto-rotation of an `ArcRotateCamera` (spins `alpha` when not interacting). */\nexport class AutoRotationBehavior implements Behavior<ArcRotateCamera> {\n public readonly name = \"AutoRotation\";\n /** Idle rotation speed in radians/second. */\n public idleRotationSpeed = 0.05;\n private _camera: ArcRotateCamera | null = null;\n private _detach: (() => void) | undefined;\n\n public init(): void {\n // no-op\n }\n\n public attach(camera: ArcRotateCamera): void {\n this._camera = camera;\n const scene = camera.getScene();\n if (!scene) {\n return;\n }\n // onBeforeRender passes the frame delta in milliseconds.\n const cb = (deltaMs: number): void => {\n if (this._camera) {\n this._camera.alpha += this.idleRotationSpeed * (deltaMs / 1000);\n }\n };\n onBeforeRender(scene._lite, cb);\n this._detach = () => {\n this._camera = null;\n };\n }\n\n public detach(): void {\n this._detach?.();\n this._detach = undefined;\n }\n}\n\n/** Clamps an `ArcRotateCamera`'s radius to a [lower, upper] band (no bounce tween). */\nexport class BouncingBehavior implements Behavior<ArcRotateCamera> {\n public readonly name = \"Bouncing\";\n public lowerRadiusTransitionRange = 2;\n public upperRadiusTransitionRange = -2;\n private _camera: ArcRotateCamera | null = null;\n private _detach: (() => void) | undefined;\n\n public init(): void {\n // no-op\n }\n\n public attach(camera: ArcRotateCamera): void {\n this._camera = camera;\n const scene = camera.getScene();\n if (!scene) {\n return;\n }\n const cb = (): void => {\n const cam = this._camera;\n if (!cam) {\n return;\n }\n if (cam.lowerRadiusLimit != null && cam.radius < cam.lowerRadiusLimit) {\n cam.radius = cam.lowerRadiusLimit;\n }\n if (cam.upperRadiusLimit != null && cam.radius > cam.upperRadiusLimit) {\n cam.radius = cam.upperRadiusLimit;\n }\n };\n onBeforeRender(scene._lite, cb);\n this._detach = () => {\n this._camera = null;\n };\n }\n\n public detach(): void {\n this._detach?.();\n this._detach = undefined;\n }\n}\n\n/** Frames an `ArcRotateCamera` on a target by setting its radius (no zoom tween). */\nexport class FramingBehavior implements Behavior<ArcRotateCamera> {\n public readonly name = \"Framing\";\n public radius = 10;\n private _camera: ArcRotateCamera | null = null;\n\n public init(): void {\n // no-op\n }\n\n public attach(camera: ArcRotateCamera): void {\n this._camera = camera;\n }\n\n public detach(): void {\n this._camera = null;\n }\n\n /** Set the camera radius to frame a target of the given world-space radius. */\n public zoomOnBoundingRadius(boundingRadius: number): void {\n if (this._camera) {\n this._camera.radius = boundingRadius * 2.5;\n }\n }\n}\n","/**\n * Babylon.js-compatible `SpriteManager` / `Sprite` over Babylon Lite's\n * camera-facing billboard sprite system.\n *\n * Babylon.js positions sprites in **world space** (`sprite.position` is a\n * `Vector3`, `sprite.width`/`height` are world units) and renders them as\n * camera-facing billboards. Babylon Lite's `createFacingBillboardSystem` +\n * `addBillboardSpriteIndex` use the exact same world-space model\n * (`position: [x,y,z]`, `sizeWorld: [w,h]`), so the mapping is direct.\n *\n * The atlas image loads asynchronously, so the `SpriteManager` constructor\n * defers building the Lite billboard system until engine start: it tracks the\n * atlas-load promise via `scene._trackTextureLoad` and registers a\n * `scene._deferAdd` callback that — once the atlas is ready — builds the system,\n * pushes every `Sprite`'s current props, and attaches it to the scene.\n */\n\nimport {\n loadSpriteAtlas,\n createFacingBillboardSystem,\n addBillboardSpriteIndex,\n updateBillboardSpriteIndex,\n addFacingBillboardSystem,\n billboardBlendAlpha,\n billboardBlendAdditive,\n createSprite2DLayer,\n addSprite2DIndex,\n updateSprite2DIndex,\n createSpriteRenderer,\n registerSpriteRenderer,\n spriteBlendAlpha,\n spriteBlendPremultiplied,\n spriteBlendAdditive,\n} from \"babylon-lite\";\nimport type { SpriteAtlas, FacingBillboardSpriteSystem, BillboardBlendDescriptor, BillboardSpriteInit, Sprite2DLayer, SpriteBlendMode } from \"babylon-lite\";\n\nimport { Vector3 } from \"../math/vector.js\";\nimport { Color4 } from \"../math/color.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { WebGPUEngine } from \"../engine/engine.js\";\n\ninterface CellSize {\n width: number;\n height: number;\n}\n\n/** Babylon.js `Constants.ALPHA_ONEONE` (additive). */\nconst ALPHA_ONEONE = 6;\n/** Babylon.js `Constants.ALPHA_ADD`. */\nconst ALPHA_ADD = 1;\n\n/**\n * Babylon.js `SpriteManager` — owns a sprite atlas and a pool of `Sprite`s that\n * render as camera-facing billboards. Backed by a Lite facing-billboard system.\n */\nexport class SpriteManager {\n public name: string;\n /** Babylon.js `manager.disableDepthWrite`. Accepted for parity (Lite billboards self-manage depth). */\n public disableDepthWrite = false;\n /** Babylon.js `manager.blendMode` (`Constants.ALPHA_*`). Mapped to a Lite billboard blend at build. */\n public blendMode = 2;\n\n /** @internal Sprites created against this manager, in creation order. */\n public readonly _sprites: Sprite[] = [];\n /** @internal The Lite billboard system, built at engine start. */\n public _lite?: FacingBillboardSpriteSystem;\n\n private _atlas?: SpriteAtlas;\n\n public constructor(name: string, url: string, capacity: number, cellSize: CellSize, scene: Scene, _epsilon = 0.01, samplingMode = 2) {\n this.name = name;\n const engine = scene.getEngine()._lite;\n // Babylon.js `Texture.NEAREST_SAMPLINGMODE` is 1; everything else (bi/tri-\n // linear) maps to Lite's \"linear\".\n const sampling = samplingMode === 1 ? \"nearest\" : \"linear\";\n // Kick off the async atlas load; resolve stores the atlas for the\n // deferred build. Tracked so the engine awaits it before building.\n scene._trackTextureLoad(\n loadSpriteAtlas(engine, url, {\n gridSize: [cellSize.width, cellSize.height],\n sampling,\n }).then((atlas) => {\n this._atlas = atlas;\n })\n );\n // Build the billboard system once the atlas is ready (after pending\n // textures are awaited) and attach it to the scene.\n scene._deferAdd(() => {\n if (!this._atlas) {\n return;\n }\n const blendMode = this._mapBlendMode();\n const system = createFacingBillboardSystem(this._atlas, { capacity, blendMode });\n for (const sprite of this._sprites) {\n sprite._applyTo(system);\n }\n this._lite = system;\n addFacingBillboardSystem(scene._lite, system);\n });\n }\n\n /** Babylon.js `SpriteManager.isReady()` — an empty manager is ready without renderer preparation. */\n public isReady(): boolean {\n return this._sprites.length === 0 || this._lite !== undefined;\n }\n\n /** @internal Map the Babylon.js `Constants.ALPHA_*` blend mode to a Lite billboard blend. */\n private _mapBlendMode(): BillboardBlendDescriptor {\n if (this.blendMode === ALPHA_ONEONE || this.blendMode === ALPHA_ADD) {\n return billboardBlendAdditive;\n }\n return billboardBlendAlpha;\n }\n}\n\n/**\n * Babylon.js `Sprite` — a single camera-facing billboard in a `SpriteManager`'s\n * atlas. World-space position + size; cell index selects the atlas frame.\n *\n * Properties are **live**: once the manager has built its Lite billboard system\n * (at engine start), mutating a sprite property pushes an\n * `updateBillboardSpriteIndex` patch so per-frame animation (e.g. advancing\n * `cellIndex` or toggling `isVisible`) is reflected on the GPU. Before the\n * system is built, property writes are buffered and flushed once in `_applyTo`.\n *\n * Note: `position`/`color` are object values; reassigning them\n * (`sprite.position = new Vector3(...)`) pushes a patch, but mutating a\n * component in place (`sprite.position.x = …`) does not — call the setter (or\n * reassign) to push a live update.\n */\nexport class Sprite {\n public name: string;\n\n private _position = new Vector3(0, 0, 0);\n private _width = 1;\n private _height = 1;\n private _cellIndex = 0;\n private _angle = 0;\n private _color = new Color4(1, 1, 1, 1);\n private _invertU = false;\n private _invertV = false;\n private _visible = true;\n\n /** @internal The Lite billboard system this sprite belongs to (set in `_applyTo`). */\n private _system?: FacingBillboardSpriteSystem;\n /** @internal This sprite's instance index in `_system` (set in `_applyTo`). */\n private _index = -1;\n\n public constructor(name: string, manager: SpriteManager) {\n this.name = name;\n manager._sprites.push(this);\n }\n\n public get position(): Vector3 {\n return this._position;\n }\n public set position(value: Vector3) {\n this._position = value;\n this._patch({ position: [value.x, value.y, value.z] });\n }\n\n public get width(): number {\n return this._width;\n }\n public set width(value: number) {\n this._width = value;\n this._patch({ sizeWorld: [value, this._height] });\n }\n\n public get height(): number {\n return this._height;\n }\n public set height(value: number) {\n this._height = value;\n this._patch({ sizeWorld: [this._width, value] });\n }\n\n public get cellIndex(): number {\n return this._cellIndex;\n }\n public set cellIndex(value: number) {\n this._cellIndex = value;\n this._patch({ frame: value });\n }\n\n public get angle(): number {\n return this._angle;\n }\n public set angle(value: number) {\n this._angle = value;\n this._patch({ rotation: value });\n }\n\n public get color(): Color4 {\n return this._color;\n }\n public set color(value: Color4) {\n this._color = value;\n this._patch({ color: [value.r, value.g, value.b, value.a] });\n }\n\n public get invertU(): boolean {\n return this._invertU;\n }\n public set invertU(value: boolean) {\n this._invertU = value;\n this._patch({ flipX: value });\n }\n\n public get invertV(): boolean {\n return this._invertV;\n }\n public set invertV(value: boolean) {\n this._invertV = value;\n this._patch({ flipY: value });\n }\n\n public get isVisible(): boolean {\n return this._visible;\n }\n public set isVisible(value: boolean) {\n this._visible = value;\n this._patch({ visible: value });\n }\n\n /** @internal Add this sprite to the Lite billboard system and record its index for live updates. */\n public _applyTo(system: FacingBillboardSpriteSystem): void {\n this._index = addBillboardSpriteIndex(system, {\n position: [this._position.x, this._position.y, this._position.z],\n sizeWorld: [this._width, this._height],\n frame: this._cellIndex,\n rotation: this._angle,\n color: [this._color.r, this._color.g, this._color.b, this._color.a],\n flipX: this._invertU,\n flipY: this._invertV,\n visible: this._visible,\n });\n this._system = system;\n }\n\n /** @internal Push a live property patch to the Lite billboard system (no-op before build). */\n private _patch(patch: Partial<BillboardSpriteInit>): void {\n if (this._system && this._index >= 0) {\n updateBillboardSpriteIndex(this._system, this._index, patch);\n }\n }\n}\n\n/** Babylon.js `Constants.ALPHA_PREMULTIPLIED`. */\nconst ALPHA_PREMULTIPLIED = 7;\n\n/**\n * Babylon.js `ThinSprite` — a lightweight pixel-space sprite drawn by a\n * {@link SpriteRenderer}. Position is in screen pixels (origin bottom-left, +Y\n * up, matching the orthographic projection BJS sprite scenes set up); size is in\n * pixels; `cellIndex` selects the atlas frame.\n */\nexport class ThinSprite {\n public position = new Vector3(0, 0, 0);\n public width = 1;\n public height = 1;\n public cellIndex = 0;\n public angle = 0;\n public color = new Color4(1, 1, 1, 1);\n public invertU = false;\n public invertV = false;\n public isVisible = true;\n}\n\ninterface ThinSpriteLike {\n position: { x: number; y: number };\n width: number;\n height: number;\n cellIndex: number;\n angle: number;\n color: { r: number; g: number; b: number; a: number };\n invertU: boolean;\n invertV: boolean;\n isVisible: boolean;\n}\n\n/**\n * Babylon.js `SpriteRenderer` — the low-level, scene-less pixel-space sprite\n * pass. Babylon.js scenes build an array of {@link ThinSprite}s and call\n * `renderer.render(sprites, dt, view, projection)` from their own render loop\n * with an orthographic pixel projection.\n *\n * Babylon Lite's equivalent is `createSpriteRenderer` + a pixel-space\n * `Sprite2DLayer`. The atlas image loads asynchronously, so the renderer\n * registers the atlas load as engine startup work (evaluated once `cellWidth`/\n * `cellHeight` are set), then builds + registers a self-drawing Lite sprite\n * renderer on the first `render(...)` call (the engine invokes the loop callback\n * once after startup for scene-less loops). Subsequent `render(...)` calls push\n * live per-sprite updates so animated scenes stay in sync.\n *\n * Coordinate mapping: BJS sprite positions are bottom-left-origin pixels (the\n * scenes use `OrthoOffCenterLH(0, w, 0, h)` and set `y = canvas.height - topY`),\n * whereas Lite `Sprite2DLayer` uses top-left-origin pixels — so the Y axis is\n * flipped (`positionPx.y = canvasHeight - sprite.position.y`) and the rotation\n * sign is negated to match.\n */\nexport class SpriteRenderer {\n public texture: { name: string; samplingMode?: number } | null = null;\n public cellWidth = 0;\n public cellHeight = 0;\n public disableDepthWrite = false;\n /** Babylon.js `Constants.ALPHA_*` blend mode. `ALPHA_PREMULTIPLIED` maps to Lite's premultiplied path. */\n public blendMode = 2;\n /** @internal Babylon.js scenes poll this to gate readiness; true once the Lite renderer is built. */\n public _shadersLoaded = false;\n\n private readonly _engine: WebGPUEngine;\n private readonly _capacity: number;\n private _atlas?: SpriteAtlas;\n private _layer?: Sprite2DLayer;\n private _built = false;\n private readonly _indices: number[] = [];\n private _sprites: ThinSpriteLike[] = [];\n\n public constructor(engine: WebGPUEngine, capacity = 256, _epsilon = 0.01, _scene?: unknown) {\n this._engine = engine;\n this._capacity = capacity;\n // Defer the atlas load to engine startup: the thunk runs after the scene\n // setup code has assigned `texture`/`cellWidth`/`cellHeight`.\n engine._registerStartupWork(async () => {\n if (!this.texture) {\n return;\n }\n const premultiplied = this.blendMode === ALPHA_PREMULTIPLIED;\n this._atlas = await loadSpriteAtlas(engine._lite, this.texture.name, {\n gridSize: [this.cellWidth, this.cellHeight],\n sampling: this.texture.samplingMode === 1 ? \"nearest\" : \"linear\",\n premultipliedAlpha: premultiplied,\n });\n });\n }\n\n /** Babylon.js `SpriteRenderer.isReady()` — the next render can build once its atlas is loaded. */\n public isReady(): boolean {\n return this._atlas !== undefined;\n }\n\n /** @internal Map the Babylon.js blend mode to a Lite sprite blend descriptor. */\n private _blend(): SpriteBlendMode {\n if (this.blendMode === ALPHA_PREMULTIPLIED) {\n return spriteBlendPremultiplied;\n }\n if (this.blendMode === 1 || this.blendMode === 6) {\n return spriteBlendAdditive;\n }\n return spriteBlendAlpha;\n }\n\n /**\n * Babylon.js `renderer.render(sprites, deltaTime, viewMatrix, projectionMatrix)`.\n * The matrices are owned by Babylon Lite's pixel-space sprite pass, so they are\n * accepted for API parity but not consumed. First call builds + registers the\n * Lite sprite renderer; later calls push per-sprite updates.\n */\n public render(sprites: readonly ThinSpriteLike[], _deltaTime?: number, _view?: unknown, _projection?: unknown): void {\n this._sprites = sprites as ThinSpriteLike[];\n if (!this._atlas) {\n return;\n }\n const canvasHeight = this._engine.getRenderingCanvas().height;\n if (!this._built) {\n const layer = createSprite2DLayer(this._atlas, { capacity: this._capacity, depth: \"none\", blendMode: this._blend() });\n for (const s of this._sprites) {\n this._indices.push(addSprite2DIndex(layer, this._spriteProps(s, canvasHeight)));\n }\n this._layer = layer;\n const renderer = createSpriteRenderer(this._engine._lite, {\n layers: [layer],\n // Only clear if the scene drove a `engine.clear(...)` (scene-less 2D\n // path); when overlaying a 3D scene the renderer must preserve the\n // already-rendered colour, so it draws without clearing.\n clear: this._engine._clearRequested,\n clearValue: { ...this._engine._lastClearColor },\n });\n registerSpriteRenderer(renderer);\n this._built = true;\n this._shadersLoaded = true;\n return;\n }\n // Live update path (animated scenes): re-sync each sprite's props.\n const layer = this._layer!;\n for (let i = 0; i < this._sprites.length; i++) {\n updateSprite2DIndex(layer, this._indices[i]!, this._spriteProps(this._sprites[i]!, canvasHeight));\n }\n }\n\n /** @internal Convert a BJS `ThinSprite` to Lite `Sprite2DProps` (Y-flip + rotation negate). */\n private _spriteProps(s: ThinSpriteLike, canvasHeight: number): Parameters<typeof addSprite2DIndex>[1] {\n return {\n positionPx: [s.position.x, canvasHeight - s.position.y],\n sizePx: [s.width, s.height],\n frame: s.cellIndex,\n rotation: -s.angle,\n color: [s.color.r, s.color.g, s.color.b, s.color.a],\n flipX: s.invertU,\n flipY: s.invertV,\n visible: s.isVisible,\n };\n }\n}\n","/**\n * Babylon.js-compatible `ShadowGenerator` over the Babylon Lite shadow factories.\n *\n * Babylon.js constructs a `ShadowGenerator(mapSize, light)`, toggles technique\n * flags (`usePercentageCloserFiltering`, `useBlurExponentialShadowMap`, …), and\n * registers casters via `addShadowCaster(mesh)`. Babylon Lite instead has\n * dedicated factories (`createEsmDirectionalShadowGenerator`,\n * `createPcfDirectionalShadowGenerator`, `createPcfSpotlightShadowGenerator`) and\n * requires the scene to be registered with `registerSceneWithShadowSupport`.\n *\n * This wrapper records the BJS-style configuration up front and defers the actual\n * Lite generator creation to engine start (when the GPU device and all caster\n * meshes exist), then wires `light.shadowGenerator` + caster meshes. The owning\n * scene flips to shadow-aware registration when any generator is present.\n */\n\nimport {\n createCsmDirectionalShadowGenerator,\n createEsmDirectionalShadowGenerator,\n createPcfDirectionalShadowGenerator,\n createPcfSpotlightShadowGenerator,\n setShadowTaskCasterMeshes,\n} from \"babylon-lite\";\nimport type { EngineContext, Mesh as LiteMesh } from \"babylon-lite\";\n\nimport { DirectionalLight, type Light } from \"../lights/lights.js\";\nimport type { AbstractMesh } from \"../meshes/meshes.js\";\nimport type { ObserverCallback } from \"../misc/observable.js\";\nimport type { Node } from \"../node/node.js\";\n\ntype LiteShadowGenerator = ReturnType<typeof createEsmDirectionalShadowGenerator>;\n\nexport class ShadowGenerator {\n private readonly _mapSize: number;\n private readonly _light: Light;\n private readonly _casters: AbstractMesh[] = [];\n private readonly _casterDisposeObservers = new Map<LiteMesh, { caster: AbstractMesh; observer: ObserverCallback<Node> }>();\n private _casterSyncScheduled = false;\n private _casterSyncDirty = false;\n private readonly _disposeBeforeRenderFlush: (() => void) | undefined = undefined;\n /** @internal The built Lite shadow generator (set in `_build`). Used to wire NME receivers. */\n public _liteGen: LiteShadowGenerator | undefined;\n\n public getClassName(): string {\n return \"ShadowGenerator\";\n }\n\n // ── BJS technique flags / tunables (read at build time) ──\n /** Percentage-closer filtering. */\n public usePercentageCloserFiltering = false;\n /** Contact-hardening (treated as PCF here). */\n public useContactHardeningShadow = false;\n /** Blurred exponential shadow map (the Babylon.js default soft-shadow path for directional lights). */\n public useBlurExponentialShadowMap = false;\n public useExponentialShadowMap = false;\n public useBlurCloseExponentialShadowMap = false;\n public useCloseExponentialShadowMap = false;\n public usePoissonSampling = false;\n public useKernelBlur = false;\n public blurKernel = 1;\n public blurScale = 2;\n public bias = 0.00005;\n public normalBias = 0;\n public darkness = 0;\n public depthScale = 50;\n public frustumEdgeFalloff = 0;\n public forceBackFacesOnly = false;\n /** Babylon.js ortho projection bounds (directional). */\n public orthoMinZ: number | undefined;\n public orthoMaxZ: number | undefined;\n\n public constructor(mapSize: number, light: Light) {\n this._mapSize = mapSize;\n this._light = light;\n light._shadowGenerator = this;\n const scene = light.getScene();\n if (scene) {\n scene._registerShadowGenerator(this);\n this._disposeBeforeRenderFlush = scene._registerBeforeRenderFlush(() => this._flushCasterSync());\n }\n }\n\n /** Babylon.js `addShadowCaster(mesh, includeDescendants?)`. */\n public addShadowCaster(mesh: AbstractMesh, includeDescendants = true): ShadowGenerator {\n let changed = false;\n for (const caster of this._casterTree(mesh, includeDescendants)) {\n if (!this._casters.some((existing) => existing._lite === caster._lite)) {\n this._casters.push(caster);\n this._detachCasterDisposeObserver(caster._lite);\n const observer: ObserverCallback<Node> = () => this._removeCaster(caster._lite, true, observer);\n caster.onDisposeObservable.add(observer);\n this._casterDisposeObservers.set(caster._lite, { caster, observer });\n changed = true;\n }\n }\n if (changed) {\n this._scheduleCasterSync();\n }\n return this;\n }\n\n /** Babylon.js `removeShadowCaster(mesh, includeDescendants?)`. */\n public removeShadowCaster(mesh: AbstractMesh, includeDescendants = true): ShadowGenerator {\n let changed = false;\n for (const caster of this._casterTree(mesh, includeDescendants)) {\n changed = this._removeCaster(caster._lite, false) || changed;\n }\n if (changed) {\n this._scheduleCasterSync();\n }\n return this;\n }\n\n private _casterTree(mesh: AbstractMesh, includeDescendants: boolean): AbstractMesh[] {\n return includeDescendants ? [mesh, ...(mesh.getChildMeshes() as AbstractMesh[])] : [mesh];\n }\n\n private _detachCasterDisposeObserver(liteMesh: LiteMesh): void {\n const registration = this._casterDisposeObservers.get(liteMesh);\n if (registration) {\n registration.caster.onDisposeObservable.remove(registration.observer);\n this._casterDisposeObservers.delete(liteMesh);\n }\n }\n\n private _removeCaster(liteMesh: LiteMesh, scheduleSync = true, expectedObserver?: ObserverCallback<Node>): boolean {\n const registration = this._casterDisposeObservers.get(liteMesh);\n if (expectedObserver && registration?.observer !== expectedObserver) {\n return false;\n }\n\n const index = this._casters.findIndex((existing) => existing._lite === liteMesh);\n const changed = index !== -1;\n if (changed) {\n this._casters.splice(index, 1);\n }\n this._detachCasterDisposeObserver(liteMesh);\n if (changed && scheduleSync) {\n this._scheduleCasterSync();\n }\n return changed;\n }\n\n private _scheduleCasterSync(): void {\n if (!this._liteGen) {\n return;\n }\n this._casterSyncDirty = true;\n if (this._casterSyncScheduled) {\n return;\n }\n this._casterSyncScheduled = true;\n queueMicrotask(() => {\n this._casterSyncScheduled = false;\n this._flushCasterSync();\n });\n }\n\n private _flushCasterSync(): void {\n if (!this._casterSyncDirty || !this._liteGen) {\n return;\n }\n this._casterSyncDirty = false;\n setShadowTaskCasterMeshes(this._liteGen, this._liteCasterMeshes());\n }\n\n /**\n * The Lite meshes handed to the native shadow task: every requested caster that carries GPU geometry.\n * The compat loader wraps a model's complete hierarchy as `Mesh`es, so `addShadowCaster(root, true)`\n * legitimately collects transform-only roots and intermediate nodes into `renderList`, exactly as\n * Babylon.js does. Those nodes must not reach the native state: the render task cannot build a\n * renderable for a mesh without `_gpu` (it would throw inside the frame, every frame), and directional\n * fitting would substitute default bounds for it, distorting the shadow volume.\n */\n private _liteCasterMeshes(): LiteMesh[] {\n const meshes: LiteMesh[] = [];\n for (const caster of this._casters) {\n const lite = caster._lite as LiteMesh;\n if ((lite as { _gpu?: unknown })._gpu) {\n meshes.push(lite);\n }\n }\n return meshes;\n }\n\n /** Babylon.js `getShadowMap()` — returns a minimal render-list holder for parity. */\n public getShadowMap(): { renderList: AbstractMesh[] } {\n return { renderList: this._casters };\n }\n\n public getDarkness(): number {\n return this.darkness;\n }\n public setDarkness(value: number): ShadowGenerator {\n this.darkness = value;\n return this;\n }\n\n public getLight(): Light {\n return this._light;\n }\n\n public dispose(): void {\n this._disposeBeforeRenderFlush?.();\n this._light.getScene()?._unregisterShadowGenerator(this);\n for (const { caster, observer } of this._casterDisposeObservers.values()) {\n caster.onDisposeObservable.remove(observer);\n }\n this._casterDisposeObservers.clear();\n this._casterSyncScheduled = false;\n this._casterSyncDirty = false;\n this._liteGen = undefined;\n this._light._lite.shadowGenerator = undefined;\n if (this._light._shadowGenerator === this) {\n this._light._shadowGenerator = null;\n }\n }\n\n /**\n * @internal Build the underlying Lite shadow generator and wire casters. Called\n * by the engine at start, after meshes are added and before the scene registers.\n */\n public _build(engine: EngineContext): void {\n const liteLight = this._light._lite as never;\n const className = this._light.getClassName();\n const usePcf = this.usePercentageCloserFiltering || this.useContactHardeningShadow || this.usePoissonSampling;\n\n let liteGen;\n if (this instanceof CascadedShadowGenerator) {\n liteGen = createCsmDirectionalShadowGenerator(engine, liteLight, {\n mapSize: this._mapSize,\n numCascades: this.numCascades,\n lambda: this.lambda,\n cascadeBlendPercentage: this.cascadeBlendPercentage,\n stabilizeCascades: this.stabilizeCascades,\n shadowMaxZ: this.shadowMaxZ,\n bias: this.bias,\n darkness: this.darkness,\n frustumEdgeFalloff: this.frustumEdgeFalloff,\n });\n } else if (className === \"SpotLight\") {\n // Lite has only a PCF spot generator.\n liteGen = createPcfSpotlightShadowGenerator(engine, liteLight, {\n mapSize: this._mapSize,\n bias: this.bias,\n darkness: this.darkness,\n normalBias: this.normalBias,\n });\n } else if (usePcf) {\n liteGen = createPcfDirectionalShadowGenerator(engine, liteLight, {\n mapSize: this._mapSize,\n bias: this.bias,\n darkness: this.darkness,\n normalBias: this.normalBias,\n ...(this.orthoMinZ !== undefined ? { orthoMinZ: this.orthoMinZ } : {}),\n ...(this.orthoMaxZ !== undefined ? { orthoMaxZ: this.orthoMaxZ } : {}),\n });\n } else {\n // Default directional soft shadow: ESM (Babylon.js default + blur variants).\n liteGen = createEsmDirectionalShadowGenerator(engine, liteLight, {\n mapSize: this._mapSize,\n depthScale: this.depthScale,\n bias: this.bias,\n blurKernel: this.useKernelBlur || this.useBlurExponentialShadowMap ? this.blurKernel : 1,\n blurScale: this.blurScale,\n darkness: this.darkness,\n frustumEdgeFalloff: this.frustumEdgeFalloff,\n ...(this.orthoMinZ !== undefined ? { orthoMinZ: this.orthoMinZ } : {}),\n ...(this.orthoMaxZ !== undefined ? { orthoMaxZ: this.orthoMaxZ } : {}),\n });\n }\n\n (liteLight as { shadowGenerator?: unknown }).shadowGenerator = liteGen;\n this._liteGen = liteGen;\n this._casterSyncDirty = false;\n setShadowTaskCasterMeshes(liteGen, this._liteCasterMeshes());\n }\n}\n\n/** Babylon.js `CascadedShadowGenerator` backed by Lite's native CSM generator. */\nexport class CascadedShadowGenerator extends ShadowGenerator {\n private _numCascades = 4;\n public lambda = 0.5;\n public cascadeBlendPercentage = 0.1;\n public stabilizeCascades = false;\n public shadowMaxZ: number | undefined;\n public depthClamp = true;\n public autoCalcDepthBounds = false;\n\n public constructor(mapSize: number, light: DirectionalLight) {\n if (!(light instanceof DirectionalLight)) {\n throw new TypeError(\"CascadedShadowGenerator requires a DirectionalLight\");\n }\n super(mapSize, light);\n }\n\n public get numCascades(): number {\n return this._numCascades;\n }\n\n public set numCascades(value: number) {\n this._numCascades = Math.min(Math.max(value, 2), 4);\n }\n\n public override getClassName(): string {\n return \"CascadedShadowGenerator\";\n }\n}\n","/**\n * Babylon.js-compatible `NodeMaterial` over Babylon Lite's NME parser.\n *\n * Babylon.js exposes a synchronous `NodeMaterial.Parse(json, scene)`, optional\n * `getBlockByName(name).texture = …` overrides, then `build()`. Babylon Lite\n * instead parses an NME graph asynchronously via `parseNodeMaterialFromSnippet`,\n * taking texture overrides up front (keyed by block name) and emitting/compiling\n * the pipeline in one shot.\n *\n * The compat wrapper bridges the two: `Parse` returns immediately with an\n * unparsed handle and records the source; `getBlockByName` returns a thin proxy\n * that captures per-block texture assignments; the real (async) parse is deferred\n * to engine start — registered with the scene so it is awaited (alongside its\n * override textures) before the scene builds. `build()` is a no-op.\n */\n\nimport { parseNodeMaterialFromSnippet } from \"babylon-lite\";\nimport type { EngineContext, Material as LiteMaterial, NodeMaterial as LiteNodeMaterial, Texture2D } from \"babylon-lite\";\n\nimport type { Scene } from \"../scene/scene.js\";\n\ninterface TextureLike {\n _lite?: Texture2D;\n whenReadyAsync?(): Promise<void>;\n}\n\n/** A thin proxy for a Babylon.js NME block, capturing texture assignments. */\nclass NodeMaterialBlockProxy {\n public constructor(\n private readonly _owner: NodeMaterial,\n private readonly _name: string\n ) {}\n\n public set texture(value: TextureLike | null) {\n this._owner._setBlockTexture(this._name, value);\n }\n public get texture(): TextureLike | null {\n return this._owner._getBlockTexture(this._name);\n }\n}\n\nexport class NodeMaterial {\n public name: string;\n public backFaceCulling = true;\n /** @internal The compiled Lite node material. Undefined until the async parse resolves. */\n public _lite: LiteNodeMaterial | undefined;\n\n private readonly _json: object | string;\n private readonly _textureOverrides: Record<string, TextureLike> = {};\n private readonly _scene: Scene;\n private readonly _pendingBindings = new Map<{ material: LiteMaterial }, () => boolean>();\n private _parsed = false;\n\n public constructor(name: string, scene: Scene, json: object | string = {}) {\n this.name = name;\n this._scene = scene;\n this._json = json;\n }\n\n public getClassName(): string {\n return \"NodeMaterial\";\n }\n\n /**\n * Babylon.js `NodeMaterial.clone(name)`. Reuses the same NME source graph and the\n * captured per-block texture overrides (textures shared by reference, as\n * Babylon.js does), registering the clone with the scene so it parses/compiles its\n * own Lite node material (own renderable) at engine start.\n */\n public clone(name: string): NodeMaterial {\n const cloned = new NodeMaterial(name, this._scene, this._json);\n for (const [block, tex] of Object.entries(this._textureOverrides)) {\n cloned._textureOverrides[block] = tex;\n }\n cloned.backFaceCulling = this.backFaceCulling;\n // Keep assignments made immediately after clone() functional while the clone's\n // own async renderable is compiled. _parse replaces this temporary handle.\n cloned._lite = this._lite;\n this._scene._registerNodeMaterial(cloned);\n return cloned;\n }\n\n /** Babylon.js `getBlockByName(name)` — returns a proxy that captures texture overrides. */\n public getBlockByName(name: string): NodeMaterialBlockProxy {\n return new NodeMaterialBlockProxy(this, name);\n }\n\n /** @internal */\n public _setBlockTexture(name: string, value: TextureLike | null): void {\n if (value) {\n this._textureOverrides[name] = value;\n } else {\n delete this._textureOverrides[name];\n }\n }\n\n /** @internal */\n public _getBlockTexture(name: string): TextureLike | null {\n return this._textureOverrides[name] ?? null;\n }\n\n /** Babylon.js `NodeMaterial.build()` — Lite builds during parse, so this is a no-op. */\n public build(_verbose?: boolean): void {\n // Intentionally empty.\n }\n\n /** @internal Parse already happened via the scene-tracked promise; nothing to finalize. */\n public _ensureRenderable(_engine: EngineContext): void {\n // No-op: `_lite` is set when the tracked parse promise resolves.\n }\n\n /** @internal Bind a mesh immediately and refresh it if still assigned when parsing finishes. */\n public _bindMesh(mesh: { material: LiteMaterial }, isCurrent: () => boolean): void {\n if (!this._parsed) {\n this._pendingBindings.set(mesh, isCurrent);\n }\n if (this._lite) {\n mesh.material = this._lite;\n }\n }\n\n public dispose(): void {\n // GPU resources owned by the scene; disposed with it.\n }\n\n /** @internal Resolve override textures, then parse + compile the NME graph. */\n public async _parse(engine: EngineContext, shadowGenerators: readonly unknown[] = []): Promise<void> {\n // Yield once so any synchronous `getBlockByName(name).texture = …` overrides\n // set immediately after `Parse()` are recorded before we read them.\n await Promise.resolve();\n const overrides = Object.entries(this._textureOverrides);\n await Promise.all(overrides.map(([, tex]) => tex.whenReadyAsync?.() ?? Promise.resolve()));\n const textures: Record<string, Texture2D> = {};\n for (const [blockName, tex] of overrides) {\n if (tex._lite) {\n textures[blockName] = tex._lite;\n }\n }\n try {\n this._lite = await parseNodeMaterialFromSnippet(engine, \"\", {\n json: this._json,\n ...(overrides.length ? { textures } : {}),\n // Babylon.js wires shadows into the scene globally; Babylon Lite takes them\n // at NME parse time, so NME shadow-receiver blocks sample the scene's\n // generators (e.g. ground `receiveShadows` in scenes 65/66).\n ...(shadowGenerators.length ? { shadowGenerators: shadowGenerators as never } : {}),\n });\n this._parsed = true;\n for (const [mesh, isCurrent] of this._pendingBindings) {\n if (isCurrent()) {\n mesh.material = this._lite;\n }\n }\n } finally {\n this._pendingBindings.clear();\n }\n }\n\n /**\n * Babylon.js `NodeMaterial.Parse(source, scene, rootUrl?)` — parse an NME graph\n * from inline JSON. Returns synchronously; the actual GPU compile runs async and\n * is driven by the engine (after shadow generators are built) before the scene\n * builds, so NME shadow-receiver blocks can sample the scene's shadow generators.\n */\n public static Parse(source: object | string, scene: Scene, _rootUrl?: string): NodeMaterial {\n const material = new NodeMaterial(\"nodeMaterial\", scene, source);\n scene._registerNodeMaterial(material);\n return material;\n }\n}\n","/**\n * Babylon.js `@babylonjs/materials` `GridMaterial` over Babylon Lite's native\n * `createGridMaterial`.\n *\n * Babylon.js' `GridMaterial` is constructed empty and then has its appearance set\n * via mutable properties (`mainColor`, `lineColor`, `gridRatio`, …). Babylon Lite\n * instead bakes the grid options into a `ShaderMaterial` at creation time. The\n * compat wrapper accumulates the Babylon.js property assignments and builds the\n * Lite grid material lazily in {@link _ensureRenderable} (engine start, after all\n * properties are set), then exposes it as `_lite` so the mesh binds it.\n */\n\nimport { createGridMaterial } from \"babylon-lite\";\nimport type { EngineContext, ShaderMaterial as LiteShaderMaterial } from \"babylon-lite\";\n\nimport { Color3 } from \"../math/color.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\nexport class GridMaterial {\n public name: string;\n /** Background color between the lines (Babylon.js default black). */\n public mainColor = new Color3(0, 0, 0);\n /** Color of the grid lines (Babylon.js default teal). */\n public lineColor = new Color3(0.2, 0.2, 0.2);\n /** Spacing of the grid in object-space units. */\n public gridRatio = 1;\n /** Object-space offset added before computing the grid. */\n public gridOffset = new Vector3(0, 0, 0);\n /** Every Nth line is a major line. */\n public majorUnitFrequency = 10;\n /** Visibility of the minor (non-major) lines, `0..1`. */\n public minorUnitVisibility = 0.33;\n /** Opacity of the grid outside the lines; `<1` enables the transparent path. */\n public opacity = 1;\n /** Cosine-based antialiasing of the lines. */\n public antialias = true;\n /** Combine axes with `max` instead of additive sum. */\n public useMaxLine = false;\n /**\n * Babylon.js `@babylonjs/materials` 9.x `linesOnly` — show only the lines with\n * transparency between them. Babylon Lite expresses this via the opacity (`<1`)\n * transparent path, so enabling it forces that path.\n */\n public linesOnly = false;\n /** Back-face culling toggle. */\n public backFaceCulling = true;\n /** Babylon.js `Material.transparencyMode` (accepted for parity). */\n public transparencyMode: number | null = null;\n /** Wireframe toggle (not honoured by the grid material). */\n public wireframe = false;\n\n /** @internal The built Lite grid shader material (created at engine start). */\n public _lite: LiteShaderMaterial | undefined;\n\n public constructor(name: string, _scene?: Scene) {\n this.name = name;\n }\n\n public getClassName(): string {\n return \"GridMaterial\";\n }\n\n /**\n * @internal Build the Lite grid material from the accumulated Babylon.js\n * properties. Called by the engine just before the owning mesh is registered.\n */\n public _ensureRenderable(_engine: EngineContext): void {\n // `linesOnly` maps to Babylon Lite's transparent (opacity < 1) path; if the\n // caller left opacity at 1, nudge it just under 1 so the lines-only blend runs.\n const opacity = this.linesOnly && this.opacity >= 1 ? 0.9999 : this.opacity;\n this._lite = createGridMaterial({\n name: this.name,\n mainColor: [this.mainColor.r, this.mainColor.g, this.mainColor.b],\n lineColor: [this.lineColor.r, this.lineColor.g, this.lineColor.b],\n gridRatio: this.gridRatio,\n gridOffset: [this.gridOffset.x, this.gridOffset.y, this.gridOffset.z],\n majorUnitFrequency: this.majorUnitFrequency,\n minorUnitVisibility: this.minorUnitVisibility,\n opacity,\n antialias: this.antialias,\n useMaxLine: this.useMaxLine,\n backFaceCulling: this.backFaceCulling,\n });\n }\n\n public dispose(): void {\n // GPU resources are owned by the scene; disposed with it.\n }\n}\n","/**\n * Babylon.js `MaterialHelper` free functions from `@babylonjs/core`'s\n * `materialHelper.functions`. These are thin capability adapters — they read the\n * compat engine's reported {@link WebGPUEngine.getCaps | caps} and return a number;\n * no rendering or material behaviour lives here.\n */\n\nimport type { Scene } from \"../scene/scene.js\";\n\n// The vertex stage always binds Scene, Mesh, Material and LeftOver uniform buffers in\n// addition to the per-light ones. This is the exact BJS reservation used to work out\n// how many lights still fit within the device's per-stage uniform-buffer limit.\nconst NON_LIGHT_VERTEX_UNIFORM_BUFFER_COUNT = 4;\n\n/**\n * Babylon.js `GetSupportedSimultaneousLights(scene, maxSimultaneousLights)`.\n *\n * Returns the number of simultaneous lights the engine can actually render, which\n * may be lower than the requested maximum. Engines that declare one uniform buffer\n * per light in the vertex shader (WebGPU) are bounded by\n * `maxUniformBuffersPerShaderStage`; past that limit every pipeline creation is\n * rejected by the validator and nothing renders. Engines that do not report the\n * limit leave the requested count untouched.\n */\nexport function GetSupportedSimultaneousLights(scene: Scene, maxSimultaneousLights: number): number {\n const maxUniformBuffersPerShaderStage = scene.getEngine().getCaps().maxUniformBuffersPerShaderStage as number | undefined;\n\n // Engines that do not report the limit do not enforce it: leave the count untouched.\n // Tested against null rather than for truthiness so a limit of 0 still clamps.\n if (maxUniformBuffersPerShaderStage == null) {\n return maxSimultaneousLights;\n }\n\n // Each light claims one more uniform buffer on top of the reserved non-light ones.\n // Clamp to whatever budget is left, which may be zero: past the limit every pipeline\n // creation is rejected by the validator, so a material that renders unlit is strictly\n // better than one that returns a light count the device cannot honour. Real WebGPU\n // devices guarantee at least 12 buffers per stage, so this floor only bites the\n // pathological low-cap case the null path below cannot reach.\n const supported = Math.max(maxUniformBuffersPerShaderStage - NON_LIGHT_VERTEX_UNIFORM_BUFFER_COUNT, 0);\n\n return Math.min(maxSimultaneousLights, supported);\n}\n","/**\n * Babylon.js-compatible easing functions over Babylon Lite's functional curves.\n *\n * These retain Babylon.js's class hierarchy and easing modes for porting while\n * delegating curve math to tree-shakable native Lite functions.\n */\n\nimport {\n backEase,\n bezierCurveEase,\n bounceEase,\n circleEase,\n cubicEase,\n elasticEase,\n exponentialEase,\n powerEase,\n quadraticEase,\n quarticEase,\n quinticEase,\n sineEase,\n} from \"babylon-lite\";\n\nexport const EASINGMODE_EASEIN = 0;\nexport const EASINGMODE_EASEOUT = 1;\nexport const EASINGMODE_EASEINOUT = 2;\n\n/**\n * Contract implemented by Babylon.js easing functions.\n *\n * Custom easing objects only need to transform a normalized segment gradient.\n */\nexport interface IEasingFunction {\n /**\n * Transform a segment-local gradient.\n * @param gradient - Linear progress through the current keyframe segment.\n * @returns The progress used for interpolation. Values are not clamped.\n */\n ease(gradient: number): number;\n}\n\nexport abstract class EasingFunction implements IEasingFunction {\n public static readonly EASINGMODE_EASEIN = EASINGMODE_EASEIN;\n public static readonly EASINGMODE_EASEOUT = EASINGMODE_EASEOUT;\n public static readonly EASINGMODE_EASEINOUT = EASINGMODE_EASEINOUT;\n\n private _mode = EASINGMODE_EASEIN;\n\n public setEasingMode(mode: number): void {\n this._mode = Math.min(2, Math.max(0, mode));\n }\n\n public getEasingMode(): number {\n return this._mode;\n }\n\n /** The raw ease-in curve, implemented by each subclass over `gradient` in [0, 1]. */\n public abstract easeInCore(gradient: number): number;\n\n public ease(gradient: number): number {\n switch (this._mode) {\n case EASINGMODE_EASEIN:\n return this.easeInCore(gradient);\n case EASINGMODE_EASEOUT:\n return 1 - this.easeInCore(1 - gradient);\n default:\n return gradient >= 0.5 ? 1 - this.easeInCore((1 - gradient) * 2) * 0.5 : this.easeInCore(gradient * 2) * 0.5;\n }\n }\n}\n\nexport class CircleEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return circleEase(gradient);\n }\n}\n\nexport class QuadraticEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return quadraticEase(gradient);\n }\n}\n\nexport class CubicEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return cubicEase(gradient);\n }\n}\n\nexport class QuarticEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return quarticEase(gradient);\n }\n}\n\nexport class QuinticEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return quinticEase(gradient);\n }\n}\n\nexport class SineEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return sineEase(gradient);\n }\n}\n\nexport class ExponentialEase extends EasingFunction {\n public constructor(public exponent: number = 2) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n return exponentialEase(gradient, this.exponent);\n }\n}\n\nexport class BackEase extends EasingFunction {\n public constructor(public amplitude: number = 1) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n return backEase(gradient, this.amplitude);\n }\n}\n\nexport class ElasticEase extends EasingFunction {\n public constructor(\n public oscillations: number = 3,\n public springiness: number = 3\n ) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n return elasticEase(gradient, this.oscillations, this.springiness);\n }\n}\n\nexport class BounceEase extends EasingFunction {\n public constructor(\n public bounces: number = 3,\n public bounciness: number = 2\n ) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n return bounceEase(gradient, this.bounces, this.bounciness);\n }\n}\n\n/**\n * Babylon.js-compatible power easing class.\n */\nexport class PowerEase extends EasingFunction {\n public constructor(public power: number = 2) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n return powerEase(gradient, this.power);\n }\n}\n\n/**\n * Babylon.js-compatible cubic Bezier easing class.\n */\nexport class BezierCurveEase extends EasingFunction {\n public constructor(\n public x1: number = 0,\n public y1: number = 0,\n public x2: number = 1,\n public y2: number = 1\n ) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n return bezierCurveEase(gradient, this.x1, this.y1, this.x2, this.y2);\n }\n}\n","/** Babylon.js-compatible GUID helpers (`@babylonjs/core` `Misc/guid`). */\n\n/**\n * Generate a pseudo-random RFC4122 v4 UUID, matching Babylon.js `RandomGUID`.\n * Be aware `Math.random()` could cause collisions, but all except 6 of the 128 bits are\n * randomly generated, so any two ids have a 1 in 2^122 chance of colliding.\n * @returns a pseudo random id\n */\nexport function RandomGUID(): string {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\n/**\n * Namespace-like object used to manipulate GUIDs, matching Babylon.js `GUID`.\n * Babylon.js declares `GUID` as a `const` object literal rather than a class, so the\n * compat layer mirrors that shape: consumers call `GUID.RandomId()` without `new`.\n */\nexport const GUID = {\n /**\n * Generate a pseudo-random RFC4122 v4 UUID. Alias of {@link RandomGUID}.\n * @returns a pseudo random id\n */\n RandomId: RandomGUID,\n};\n","/** Babylon.js-compatible `Tools` helpers (the small, pure subset). */\n\nimport { RandomGUID } from \"./guid.js\";\n\nexport const Tools = {\n /** High-resolution timestamp in milliseconds. */\n Now(): number {\n return typeof performance !== \"undefined\" ? performance.now() : Date.now();\n },\n\n ToRadians(degrees: number): number {\n return (degrees * Math.PI) / 180;\n },\n\n ToDegrees(radians: number): number {\n return (radians * 180) / Math.PI;\n },\n\n /** Clamp `value` into the inclusive `[min, max]` range. */\n Clamp(value: number, min = 0, max = 1): number {\n return Math.min(max, Math.max(min, value));\n },\n\n /** Generate an RFC4122 v4 UUID (used by Babylon.js for unique ids). */\n RandomId(): string {\n return RandomGUID();\n },\n};\n","/**\n * Babylon.js-compatible Actions: `ActionManager`, `Action`, the common concrete\n * actions, and `Condition` variants.\n *\n * This is the structural/behavioural surface in pure JS. Triggers are not yet\n * auto-wired to Babylon Lite's input pipeline (that needs a unified pointer\n * pipe — see `COMPAT-STATUS.md`), so actions are dispatched manually via\n * `ActionManager.processTrigger(trigger)`. The action/condition execution model\n * itself is fully implemented and testable.\n */\n\n/** Babylon.js `ActionManager` trigger constants (subset). */\nexport const ActionManagerTriggers = {\n NothingTrigger: 0,\n OnPickTrigger: 1,\n OnLeftPickTrigger: 2,\n OnRightPickTrigger: 3,\n OnCenterPickTrigger: 4,\n OnPickDownTrigger: 5,\n OnDoublePickTrigger: 6,\n OnPickUpTrigger: 7,\n OnPickOutTrigger: 16,\n OnPointerOverTrigger: 10,\n OnPointerOutTrigger: 11,\n OnEveryFrameTrigger: 14,\n} as const;\n\ninterface ActionEvent {\n source: unknown;\n pointerX: number;\n pointerY: number;\n meshUnderPointer: unknown;\n additionalData?: unknown;\n}\n\n/** Base class for actions. `execute` is implemented by subclasses. */\nexport abstract class Action {\n public trigger: number;\n /** Condition gating execution. When set, `execute` runs only if it evaluates true. */\n public condition: Condition | undefined;\n\n private _nextActiveAction: Action | null = null;\n\n public constructor(trigger: number, condition?: Condition) {\n this.trigger = trigger;\n this.condition = condition;\n }\n\n public abstract execute(evt?: ActionEvent): void;\n\n /** Chain another action to run after this one (Babylon.js `then`). */\n public then(action: Action): Action {\n this._nextActiveAction = action;\n return action;\n }\n\n /** @internal Run this action (honouring its condition) and any chained action. */\n public _executeCurrent(evt?: ActionEvent): void {\n if (this.condition && !this.condition.isValid()) {\n return;\n }\n this.execute(evt);\n this._nextActiveAction?._executeCurrent(evt);\n }\n}\n\n/** Runs a user callback when triggered. */\nexport class ExecuteCodeAction extends Action {\n public constructor(\n trigger: number,\n private readonly _func: (evt?: ActionEvent) => void,\n condition?: Condition\n ) {\n super(trigger, condition);\n }\n\n public execute(evt?: ActionEvent): void {\n this._func(evt);\n }\n}\n\n/** Sets `target[propertyPath] = value` when triggered. */\nexport class SetValueAction extends Action {\n public constructor(\n trigger: number,\n private readonly _target: Record<string, unknown>,\n private readonly _propertyPath: string,\n private readonly _value: unknown,\n condition?: Condition\n ) {\n super(trigger, condition);\n }\n\n public execute(): void {\n setByPath(this._target, this._propertyPath, this._value);\n }\n}\n\n/** Adds `value` to `target[propertyPath]` when triggered. */\nexport class IncrementValueAction extends Action {\n public constructor(\n trigger: number,\n private readonly _target: Record<string, unknown>,\n private readonly _propertyPath: string,\n private readonly _value: number,\n condition?: Condition\n ) {\n super(trigger, condition);\n }\n\n public execute(): void {\n const current = getByPath(this._target, this._propertyPath);\n if (typeof current === \"number\") {\n setByPath(this._target, this._propertyPath, current + this._value);\n }\n }\n}\n\n/** Base class for action conditions. */\nexport abstract class Condition {\n public abstract isValid(): boolean;\n}\n\nexport const ValueConditionOperators = {\n IsEqual: 0,\n IsDifferent: 1,\n IsGreater: 2,\n IsLesser: 3,\n} as const;\n\n/** Compares `target[propertyPath]` against a value with an operator. */\nexport class ValueCondition extends Condition {\n public constructor(\n private readonly _target: Record<string, unknown>,\n private readonly _propertyPath: string,\n private readonly _value: number,\n private readonly _operator: number = ValueConditionOperators.IsEqual\n ) {\n super();\n }\n\n public isValid(): boolean {\n const current = getByPath(this._target, this._propertyPath);\n if (typeof current !== \"number\") {\n return false;\n }\n switch (this._operator) {\n case ValueConditionOperators.IsEqual:\n return current === this._value;\n case ValueConditionOperators.IsDifferent:\n return current !== this._value;\n case ValueConditionOperators.IsGreater:\n return current > this._value;\n case ValueConditionOperators.IsLesser:\n return current < this._value;\n default:\n return false;\n }\n }\n}\n\n/** Evaluates a user predicate. */\nexport class PredicateCondition extends Condition {\n public constructor(private readonly _predicate: () => boolean) {\n super();\n }\n\n public isValid(): boolean {\n return this._predicate();\n }\n}\n\n/**\n * Babylon.js `ActionManager`. Register actions with `registerAction`, then\n * dispatch them with `processTrigger(trigger, evt?)`. (Automatic trigger\n * dispatch from input is not yet wired — see module docs.)\n */\nexport class ActionManager {\n public static readonly Triggers = ActionManagerTriggers;\n\n public readonly actions: Action[] = [];\n\n public registerAction(action: Action): Action {\n this.actions.push(action);\n return action;\n }\n\n public unregisterAction(action: Action): boolean {\n const index = this.actions.indexOf(action);\n if (index !== -1) {\n this.actions.splice(index, 1);\n return true;\n }\n return false;\n }\n\n public hasSpecificTrigger(trigger: number): boolean {\n return this.actions.some((a) => a.trigger === trigger);\n }\n\n /** Dispatch every registered action matching `trigger`. */\n public processTrigger(trigger: number, evt?: ActionEvent): void {\n for (const action of this.actions) {\n if (action.trigger === trigger) {\n action._executeCurrent(evt);\n }\n }\n }\n}\n\nfunction getByPath(target: Record<string, unknown>, path: string): unknown {\n const parts = path.split(\".\");\n let current: unknown = target;\n for (const part of parts) {\n if (current == null || typeof current !== \"object\") {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n}\n\nfunction setByPath(target: Record<string, unknown>, path: string, value: unknown): void {\n const parts = path.split(\".\");\n let current: Record<string, unknown> = target;\n for (let i = 0; i < parts.length - 1; i++) {\n current = current[parts[i]!] as Record<string, unknown>;\n if (current == null) {\n return;\n }\n }\n current[parts[parts.length - 1]!] = value;\n}\n","/**\n * Babylon.js AudioV2 enums and small shared helpers.\n *\n * These mirror the `@babylonjs/core` `AudioV2` `const enum`s exactly (same member\n * names and values) so ported code that reads e.g. `SoundState.Started` or\n * `AudioParameterRampShape.Linear` resolves identically.\n */\n\nimport type { RampOptions as LiteRampOptions } from \"babylon-lite\";\n\n/** Playback state of a sound (mirrors `@babylonjs/core` `SoundState`). */\nexport const SoundState = {\n Stopping: 0,\n Stopped: 1,\n Starting: 2,\n Started: 3,\n FailedToStart: 4,\n Paused: 5,\n} as const;\nexport type SoundState = (typeof SoundState)[keyof typeof SoundState];\n\n/** Ramp shape used when changing an audio parameter (mirrors `AudioParameterRampShape`). */\nexport const AudioParameterRampShape = {\n Linear: \"linear\",\n Exponential: \"exponential\",\n Logarithmic: \"logarithmic\",\n None: \"none\",\n} as const;\nexport type AudioParameterRampShape = (typeof AudioParameterRampShape)[keyof typeof AudioParameterRampShape];\n\n/** Which transform components a spatial sound/listener follows (mirrors `SpatialAudioAttachmentType`). */\nexport const SpatialAudioAttachmentType = {\n Position: 1,\n Rotation: 2,\n PositionAndRotation: 3,\n} as const;\nexport type SpatialAudioAttachmentType = (typeof SpatialAudioAttachmentType)[keyof typeof SpatialAudioAttachmentType];\n\n/** FFT window sizes accepted by the analyzer (mirrors `AudioAnalyzerFFTSizeType`). */\nexport type AudioAnalyzerFFTSizeType = 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096 | 8192 | 16384 | 32768;\n\n/** Engine context state (mirrors `AudioEngineV2State`). */\nexport type AudioEngineV2State = \"closed\" | \"interrupted\" | \"running\" | \"suspended\";\n\n/** Babylon.js `IAudioParameterRampOptions`. */\nexport interface IAudioParameterRampOptions {\n /** Ramp time, in seconds. */\n duration: number;\n /** Ramp shape. */\n shape: AudioParameterRampShape;\n}\n\n/**\n * Maps a Babylon.js ramp option bag to the Lite `RampOptions` shape. The shape\n * string values are identical between the two APIs, so this is a structural pass\n * through.\n * @internal\n */\nexport function toLiteRamp(options?: Partial<IAudioParameterRampOptions> | null): LiteRampOptions | undefined {\n if (!options) {\n return undefined;\n }\n return { duration: options.duration, shape: options.shape };\n}\n","/**\n * Babylon.js AudioV2 (`AudioEngineV2` and friends) implemented on top of the\n * Babylon Lite audio port.\n *\n * The Lite audio API is pure state + standalone functions (`createAudioEngineAsync`,\n * `playSound`, `setBusVolume`, …); Babylon.js AudioV2 is a class hierarchy of\n * `AbstractAudioNode` subclasses with mutable properties. This module reproduces\n * the BJS class names, inheritance chain, and public members exactly, holding the\n * corresponding Lite handle as `_lite` and proxying property get/set + methods to\n * the Lite functions.\n *\n * Inheritance chain mirrored from `@babylonjs/core`:\n *\n * AbstractAudioNode\n * └─ AbstractNamedAudioNode\n * └─ AbstractAudioOutNode (volume / analyzer)\n * ├─ AbstractAudioBus → AudioBus / MainAudioBus\n * └─ AbstractSoundSource\n * └─ AbstractSound → StaticSound / StreamingSound\n *\n * No module-level Web Audio allocation happens at import time, so a consumer that\n * never touches audio pays nothing.\n */\n\nimport {\n createAudioEngineAsync,\n disposeAudioEngine,\n unlockAudioEngineAsync,\n setMasterVolume,\n getMasterVolume,\n createSoundAsync,\n playSound,\n pauseSound,\n resumeSound,\n stopSound,\n disposeSound,\n setSoundVolume,\n createStreamingSoundAsync,\n preloadStreamingInstanceAsync,\n preloadStreamingInstancesAsync,\n playStreamingSound,\n pauseStreamingSound,\n resumeStreamingSound,\n stopStreamingSound,\n disposeStreamingSound,\n setStreamingSoundVolume,\n createAudioBusAsync,\n disposeAudioBus,\n setBusVolume,\n createSoundBufferAsync,\n createSoundSourceAsync,\n createMicrophoneSoundSourceAsync,\n setSoundSourceVolume,\n disposeSoundSource,\n enableSpatial,\n setSpatialPosition,\n setSpatialOrientation,\n setSpatialListener,\n setSpatialListenerPosition,\n updateSpatialAudio,\n enableStereo,\n setStereoPan,\n enableAnalyzer,\n getByteFrequencyData,\n getFloatFrequencyData,\n getByteTimeDomainData,\n getFloatTimeDomainData,\n} from \"babylon-lite\";\nimport type {\n AudioEngine as LiteAudioEngine,\n AudioEngineOptions as LiteAudioEngineOptions,\n StaticSound as LiteStaticSound,\n StreamingSound as LiteStreamingSound,\n AudioBus as LiteAudioBus,\n MainBus as LiteMainBus,\n SoundBuffer as LiteSoundBuffer,\n AudioInputSource as LiteAudioInputSource,\n PrimaryAudioBus as LitePrimaryAudioBus,\n StaticSoundOptions as LiteStaticSoundOptions,\n StreamingSoundOptions as LiteStreamingSoundOptions,\n SpatialSoundOptions as LiteSpatialSoundOptions,\n AudioGraphHost as LiteHost,\n} from \"babylon-lite\";\n\nimport { Observable } from \"../misc/observable.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport { Quaternion } from \"../math/quaternion.js\";\nimport { unsupported } from \"../error.js\";\nimport { SpatialAudioAttachmentType, toLiteRamp, type SoundState, type AudioAnalyzerFFTSizeType, type AudioEngineV2State, type IAudioParameterRampOptions } from \"./audio-enums.js\";\n\n/** A bus a sound or bus can output to (mirrors AudioV2 `PrimaryAudioBus`). */\nexport type PrimaryAudioBus = MainAudioBus | AudioBus;\n\n/** A node that can have a world transform (subset of the compat `Node`). */\nexport interface SpatialNodeLike {\n getAbsolutePosition?: () => { x: number; y: number; z: number };\n absolutePosition?: { x: number; y: number; z: number };\n position?: { x: number; y: number; z: number };\n rotationQuaternion?: { x: number; y: number; z: number; w: number } | null;\n}\n\nfunction readNodePosition(node: SpatialNodeLike | null): { x: number; y: number; z: number } | null {\n if (!node) {\n return null;\n }\n return node.getAbsolutePosition?.() ?? node.absolutePosition ?? node.position ?? null;\n}\n\nfunction readNodeRotation(node: SpatialNodeLike | null): { x: number; y: number; z: number; w: number } | null {\n return node?.rotationQuaternion ?? null;\n}\n\n// ───────────────────────────── Options interfaces ────────────────────────────\n\n/** Babylon.js `IAudioEngineV2Options` (subset backed by Lite). */\nexport interface IAudioEngineV2Options {\n /** Default parameter ramp duration, in seconds. Defaults to `0.01`. */\n parameterRampDuration: number;\n /** Initial output volume. Defaults to `1`. */\n volume: number;\n}\n\n/** Babylon.js `IWebAudioEngineOptions`. */\nexport interface IWebAudioEngineOptions extends IAudioEngineV2Options {\n /** An existing audio context (pass an `OfflineAudioContext` for headless rendering). */\n audioContext: BaseAudioContext;\n /** Auto-resume the context on user interaction. Defaults to `true`. */\n resumeOnInteraction: boolean;\n /** Auto-resume the context if the browser pauses playback. Defaults to `true`. */\n resumeOnPause: boolean;\n /** Retry interval (ms) for `resumeOnPause`. Defaults to `1000`. */\n resumeOnPauseRetryInterval: number;\n /** Disable Babylon.js's iOS ringer-switch workaround. Lite does not install that workaround. */\n disableIOSRingerSwitchWorkaround?: boolean;\n}\n\n/** Babylon.js `IVolumeAudioOptions`. */\nexport interface IVolumeAudioOptions {\n /** Volume / gain. Defaults to `1`. */\n volume: number;\n}\n\n/** Babylon.js `IAudioAnalyzerOptions`. */\nexport interface IAudioAnalyzerOptions {\n /** Build the analyzer immediately. Defaults to `false`. */\n analyzerEnabled: boolean;\n /** FFT window size. Defaults to `2048`. */\n analyzerFFTSize: AudioAnalyzerFFTSizeType;\n /** Minimum dB. Defaults to `-100`. */\n analyzerMinDecibels: number;\n /** Maximum dB. Defaults to `-30`. */\n analyzerMaxDecibels: number;\n /** Time-averaging constant `[0, 1]`. Defaults to `0.8`. */\n analyzerSmoothing: number;\n}\n\n/** Babylon.js `IStereoAudioOptions`. */\nexport interface IStereoAudioOptions {\n /** Build stereo immediately. Defaults to `false`. */\n stereoEnabled: boolean;\n /** Pan `-1` (left) to `1` (right). Defaults to `0`. */\n stereoPan: number;\n}\n\n/** Babylon.js `ISpatialAudioOptions` (subset backed by Lite). */\nexport interface ISpatialAudioOptions {\n /** Build spatial immediately. */\n spatialEnabled: boolean;\n /** Cone inner angle, radians. */\n spatialConeInnerAngle: number;\n /** Cone outer angle, radians. */\n spatialConeOuterAngle: number;\n /** Volume outside the cone. */\n spatialConeOuterVolume: number;\n /** Distance attenuation model. */\n spatialDistanceModel: DistanceModelType;\n /** Max distance. */\n spatialMaxDistance: number;\n /** Reference / min distance. */\n spatialMinDistance: number;\n /** Source facing direction. */\n spatialOrientation: Vector3;\n /** Enable left/right panning. */\n spatialPanningEnabled: boolean;\n /** Panning algorithm. */\n spatialPanningModel: PanningModelType;\n /** Source world position. */\n spatialPosition: Vector3;\n /** Roll-off factor. */\n spatialRolloffFactor: number;\n /** Source rotation quaternion. */\n spatialRotationQuaternion: Quaternion;\n}\n\n/** Babylon.js `IStaticSoundBufferOptions`. */\nexport interface IStaticSoundBufferOptions {\n /** Skip codec checks when the source is a URL list. Defaults to `false`. */\n skipCodecCheck: boolean;\n}\n\n/** Babylon.js `IAbstractSoundOptions` (subset). */\nexport interface IAbstractSoundOptions extends Partial<IVolumeAudioOptions> {\n /** Play immediately once ready. Defaults to `false`. */\n autoplay?: boolean;\n /** Maximum simultaneous instances. Defaults to `Infinity`. */\n maxInstances?: number;\n /** Loop playback. Defaults to `false`. */\n loop?: boolean;\n /** Start offset in seconds. Defaults to `0`. */\n startOffset?: number;\n /** Output bus. */\n outBus?: PrimaryAudioBus;\n}\n\n/** Babylon.js `IStaticSoundOptions`. */\nexport interface IStaticSoundOptions extends IAbstractSoundOptions, Partial<IStaticSoundBufferOptions> {\n /** Play duration in seconds (`0` = full). */\n duration?: number;\n /** Loop end, seconds. */\n loopEnd?: number;\n /** Loop start, seconds. */\n loopStart?: number;\n /** Detune in cents. */\n pitch?: number;\n /** Playback rate multiplier. */\n playbackRate?: number;\n}\n\n/** Babylon.js `IStaticSoundPlayOptions`. */\nexport interface IStaticSoundPlayOptions {\n /** Loop playback. */\n loop?: boolean;\n /** Start offset in seconds. */\n startOffset?: number;\n /** Play duration in seconds. */\n duration?: number;\n /** Loop start, seconds. */\n loopStart?: number;\n /** Loop end, seconds. */\n loopEnd?: number;\n /** Per-instance volume. */\n volume?: number;\n /** Delay before playback, seconds. */\n waitTime?: number;\n}\n\n/** Babylon.js `IStaticSoundStopOptions`. */\nexport interface IStaticSoundStopOptions {\n /** Delay before stopping, seconds. */\n waitTime?: number;\n}\n\n/** Babylon.js `IStaticSoundCloneOptions`. */\nexport interface IStaticSoundCloneOptions {\n /** Clone the underlying buffer (Lite reuses the same buffer). Defaults to `false`. */\n cloneBuffer?: boolean;\n /** Output bus for the clone. */\n outBus?: PrimaryAudioBus | null;\n}\n\n/** Babylon.js `IStreamingSoundOptions`. */\nexport interface IStreamingSoundOptions extends IAbstractSoundOptions {\n /** Number of instances to preload. Defaults to `1`. */\n preloadCount?: number;\n}\n\n/** Babylon.js `IStreamingSoundPlayOptions`. */\nexport interface IStreamingSoundPlayOptions {\n /** Loop playback. */\n loop?: boolean;\n /** Start offset in seconds. */\n startOffset?: number;\n /** Per-instance volume. */\n volume?: number;\n}\n\n/** Babylon.js `IAudioBusOptions` (subset). */\nexport interface IAudioBusOptions extends Partial<IVolumeAudioOptions> {\n /** Output bus. Defaults to the engine's default main bus. */\n outBus?: PrimaryAudioBus;\n}\n\n/** Babylon.js `IMainAudioBusOptions`. */\nexport interface IMainAudioBusOptions extends Partial<IVolumeAudioOptions> {}\n\n/** Babylon.js `ISoundSourceOptions` (subset). */\nexport interface ISoundSourceOptions extends Partial<IVolumeAudioOptions> {\n /** Name. */\n name?: string;\n /** Output bus. */\n outBus?: PrimaryAudioBus | null;\n /** Auto-assign the default main bus when `outBus` is null. */\n outBusAutoDefault?: boolean;\n}\n\n// ───────────────────────────── Node base classes ─────────────────────────────\n\n/** Babylon.js `AbstractAudioNode` — the root of the AudioV2 node hierarchy. */\nexport abstract class AbstractAudioNode {\n /** The engine that owns this node. */\n public readonly engine: AudioEngineV2;\n /** Fires when this node is disposed. */\n public readonly onDisposeObservable = new Observable<AbstractAudioNode>();\n\n protected constructor(engine: AudioEngineV2) {\n this.engine = engine;\n }\n\n /** Disposes the node. */\n public dispose(): void {\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n }\n\n /** The class name (mirrors Babylon.js `getClassName()`). */\n public abstract getClassName(): string;\n}\n\n/** Payload for `AbstractNamedAudioNode.onNameChangedObservable`. */\nexport interface IAudioNodeNameChange {\n /** The new name. */\n newName: string;\n /** The previous name. */\n oldName: string;\n /** The node whose name changed. */\n node: AbstractNamedAudioNode;\n}\n\n/** Babylon.js `AbstractNamedAudioNode` — an `AbstractAudioNode` with a mutable name. */\nexport abstract class AbstractNamedAudioNode extends AbstractAudioNode {\n /** Fires when {@link name} changes. */\n public readonly onNameChangedObservable = new Observable<IAudioNodeNameChange>();\n private _name: string;\n\n protected constructor(name: string, engine: AudioEngineV2) {\n super(engine);\n this._name = name;\n engine._addNode(this);\n }\n\n /** The node name. */\n public get name(): string {\n return this._name;\n }\n public set name(value: string) {\n const oldName = this._name;\n if (oldName === value) {\n return;\n }\n this._name = value;\n this.onNameChangedObservable.notifyObservers({ newName: value, oldName, node: this });\n }\n\n public override dispose(): void {\n this.engine._removeNode(this);\n this.onNameChangedObservable.clear();\n super.dispose();\n }\n}\n\n/**\n * Babylon.js `AbstractAudioOutNode` — a named node with a volume and a lazily\n * created analyzer.\n */\nexport abstract class AbstractAudioOutNode extends AbstractNamedAudioNode {\n protected _volume = 1;\n private _analyzer: AbstractAudioAnalyzer | null = null;\n\n /** The node output volume. */\n public get volume(): number {\n return this._volume;\n }\n public set volume(value: number) {\n this.setVolume(value);\n }\n\n /** Lazily-built audio analyzer for this node's output. */\n public get analyzer(): AbstractAudioAnalyzer {\n return (this._analyzer ??= new AbstractAudioAnalyzer(this._spatialHost()));\n }\n\n /** Sets the volume, optionally ramping. */\n public setVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void {\n this._volume = value;\n this._applyVolume(value, options);\n }\n\n public override dispose(): void {\n this._analyzer?.dispose();\n this._analyzer = null;\n super.dispose();\n }\n\n /** @internal Apply the volume to the backing Lite handle. */\n protected abstract _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void;\n /** @internal The Lite host used to back spatial/stereo/analyzer sub-nodes. */\n protected abstract _spatialHost(): LiteHost;\n}\n\n// ───────────────────────────── Sub-properties ────────────────────────────────\n\n/** Babylon.js `AbstractStereoAudio` — the `sound.stereo` / `bus.stereo` sub-property. */\nexport class AbstractStereoAudio {\n private readonly _host: LiteHost;\n private _pan = 0;\n private _enabled = false;\n\n /** @internal */\n public constructor(host: LiteHost) {\n this._host = host;\n }\n\n /** Stereo pan, `-1` (left) to `1` (right). */\n public get pan(): number {\n return this._pan;\n }\n public set pan(value: number) {\n this._pan = value;\n if (!this._enabled) {\n enableStereo(this._host, { pan: value });\n this._enabled = true;\n } else {\n setStereoPan(this._host, value);\n }\n }\n}\n\n/** Babylon.js `AbstractAudioAnalyzer` — the `sound.analyzer` / `bus.analyzer` sub-property. */\nexport class AbstractAudioAnalyzer {\n private readonly _host: LiteHost;\n private _fftSize: AudioAnalyzerFFTSizeType = 2048;\n private _minDecibels = -100;\n private _maxDecibels = -30;\n private _smoothing = 0.8;\n private _enabled = false;\n\n /** @internal */\n public constructor(host: LiteHost) {\n this._host = host;\n }\n\n /** FFT window size. */\n public get fftSize(): AudioAnalyzerFFTSizeType {\n return this._fftSize;\n }\n public set fftSize(value: AudioAnalyzerFFTSizeType) {\n this._fftSize = value;\n this._reapply();\n }\n\n /** Number of frequency bins (`fftSize / 2`). */\n public get frequencyBinCount(): number {\n return this._fftSize / 2;\n }\n\n /** Whether the analyzer is enabled. */\n public get isEnabled(): boolean {\n return this._enabled;\n }\n\n /** Minimum dB. */\n public get minDecibels(): number {\n return this._minDecibels;\n }\n public set minDecibels(value: number) {\n this._minDecibels = value;\n this._reapply();\n }\n\n /** Maximum dB. */\n public get maxDecibels(): number {\n return this._maxDecibels;\n }\n public set maxDecibels(value: number) {\n this._maxDecibels = value;\n this._reapply();\n }\n\n /** Time-averaging constant `[0, 1]`. */\n public get smoothing(): number {\n return this._smoothing;\n }\n public set smoothing(value: number) {\n this._smoothing = value;\n this._reapply();\n }\n\n /** Builds (enables) the analyzer tap. */\n public async enableAsync(): Promise<void> {\n this._apply();\n }\n\n /** Returns the byte frequency-domain data. Empty when disabled. */\n public getByteFrequencyData(): Uint8Array {\n if (!this._enabled) {\n return new Uint8Array(0);\n }\n const out = new Uint8Array(this.frequencyBinCount);\n getByteFrequencyData(this._host, out);\n return out;\n }\n\n /** Returns the float frequency-domain data. Empty when disabled. */\n public getFloatFrequencyData(): Float32Array {\n if (!this._enabled) {\n return new Float32Array(0);\n }\n const out = new Float32Array(this.frequencyBinCount);\n getFloatFrequencyData(this._host, out);\n return out;\n }\n\n /** Returns the byte time-domain data. Empty when disabled. */\n public getByteTimeDomainData(): Uint8Array {\n if (!this._enabled) {\n return new Uint8Array(0);\n }\n const out = new Uint8Array(this._fftSize);\n getByteTimeDomainData(this._host, out);\n return out;\n }\n\n /** Returns the float time-domain data. Empty when disabled. */\n public getFloatTimeDomainData(): Float32Array {\n if (!this._enabled) {\n return new Float32Array(0);\n }\n const out = new Float32Array(this._fftSize);\n getFloatTimeDomainData(this._host, out);\n return out;\n }\n\n /** Disposes the analyzer (Lite tears it down with the host). */\n public dispose(): void {\n this._enabled = false;\n }\n\n private _apply(): void {\n enableAnalyzer(this._host, {\n fftSize: this._fftSize,\n minDecibels: this._minDecibels,\n maxDecibels: this._maxDecibels,\n smoothing: this._smoothing,\n });\n this._enabled = true;\n }\n\n private _reapply(): void {\n if (this._enabled) {\n this._apply();\n }\n }\n}\n\n/** Babylon.js `AbstractSpatialAudio` — the `sound.spatial` / `bus.spatial` sub-property. */\nexport class AbstractSpatialAudio {\n private readonly _host: LiteHost;\n private _enabled = false;\n\n private _position = new Vector3(0, 0, 0);\n private _orientation = new Vector3(1, 0, 0);\n private _rotationQuaternion = new Quaternion(0, 0, 0, 1);\n\n /** Cone inner angle, radians. */\n public coneInnerAngle = 2 * Math.PI;\n /** Cone outer angle, radians. */\n public coneOuterAngle = 2 * Math.PI;\n /** Volume outside the cone. */\n public coneOuterVolume = 0;\n /** Distance attenuation model. */\n public distanceModel: DistanceModelType = \"linear\";\n /** Max distance. */\n public maxDistance = 10000;\n /** Reference / min distance. */\n public minDistance = 1;\n /** Minimum time between auto-updates, seconds. */\n public minUpdateTime = 0;\n /** Enable left/right panning. */\n public panningEnabled = true;\n /** Panning algorithm. */\n public panningModel: PanningModelType = \"equalpower\";\n /** Roll-off factor. */\n public rolloffFactor = 1;\n /** Whether following a scene node. */\n public useBoundingBox = false;\n /** Which transform components are followed. */\n public attachmentType: SpatialAudioAttachmentType = SpatialAudioAttachmentType.PositionAndRotation;\n\n private _attachedNode: SpatialNodeLike | null = null;\n\n /** @internal */\n public constructor(host: LiteHost) {\n this._host = host;\n }\n\n /** Source world position. */\n public get position(): Vector3 {\n return this._position;\n }\n public set position(value: Vector3) {\n this._position = value;\n this._ensure();\n setSpatialPosition(this._host, value);\n }\n\n /** Source facing direction. */\n public get orientation(): Vector3 {\n return this._orientation;\n }\n public set orientation(value: Vector3) {\n this._orientation = value;\n this._ensure();\n setSpatialOrientation(this._host, value);\n }\n\n /** Source rotation quaternion. */\n public get rotationQuaternion(): Quaternion {\n return this._rotationQuaternion;\n }\n public set rotationQuaternion(value: Quaternion) {\n this._rotationQuaternion = value;\n this._reapply();\n }\n\n /** Whether attached to a scene node. */\n public get isAttached(): boolean {\n return this._attachedNode !== null;\n }\n\n /** The scene node this source follows, if any. */\n public get attachedNode(): SpatialNodeLike | null {\n return this._attachedNode;\n }\n\n /** Follows a scene node's world transform. */\n public attach(sceneNode: SpatialNodeLike | null, useBoundingBox = false, attachmentType: SpatialAudioAttachmentType = SpatialAudioAttachmentType.PositionAndRotation): void {\n this._attachedNode = sceneNode;\n this.useBoundingBox = useBoundingBox;\n this.attachmentType = attachmentType;\n this._ensure();\n this.update();\n }\n\n /** Stops following a scene node. */\n public detach(): void {\n this._attachedNode = null;\n }\n\n /** Pulls the attached node's current world position/rotation into the source. */\n public update(): void {\n const node = this._attachedNode;\n if (!node) {\n return;\n }\n let dirty = false;\n if ((this.attachmentType & SpatialAudioAttachmentType.Position) !== 0) {\n const pos = readNodePosition(node);\n if (pos) {\n this._position = new Vector3(pos.x, pos.y, pos.z);\n dirty = true;\n }\n }\n if ((this.attachmentType & SpatialAudioAttachmentType.Rotation) !== 0) {\n const quat = readNodeRotation(node);\n if (quat) {\n this._rotationQuaternion = new Quaternion(quat.x, quat.y, quat.z, quat.w);\n dirty = true;\n }\n }\n if (dirty) {\n enableSpatial(this._host, this._options());\n this._enabled = true;\n }\n }\n\n /** Disposes the spatial sub-node (Lite tears it down with the host). */\n public dispose(): void {\n this._attachedNode = null;\n this._enabled = false;\n }\n\n private _ensure(): void {\n if (!this._enabled) {\n enableSpatial(this._host, this._options());\n this._enabled = true;\n }\n }\n\n private _reapply(): void {\n if (this._enabled) {\n enableSpatial(this._host, this._options());\n }\n }\n\n private _options(): LiteSpatialSoundOptions {\n return {\n position: this._position,\n orientation: this._orientation,\n rotationQuaternion: this._rotationQuaternion,\n panningEnabled: this.panningEnabled,\n panningModel: this.panningModel,\n distanceModel: this.distanceModel,\n minDistance: this.minDistance,\n maxDistance: this.maxDistance,\n rolloffFactor: this.rolloffFactor,\n coneInnerAngle: this.coneInnerAngle,\n coneOuterAngle: this.coneOuterAngle,\n coneOuterVolume: this.coneOuterVolume,\n };\n }\n}\n\n/** Babylon.js `AbstractSpatialAudioListener` — the engine's `listener` (the \"ears\"). */\nexport class AbstractSpatialAudioListener {\n private readonly _engine: LiteAudioEngine;\n private _position = new Vector3(0, 0, 0);\n private _rotation = new Vector3(0, 0, 0);\n private _rotationQuaternion = new Quaternion(0, 0, 0, 1);\n private _attachedNode: SpatialNodeLike | null = null;\n\n /** Minimum time between auto-updates, seconds. */\n public minUpdateTime = 0;\n\n /** @internal */\n public constructor(engine: LiteAudioEngine) {\n this._engine = engine;\n }\n\n /** Whether attached to a scene node. */\n public get isAttached(): boolean {\n return this._attachedNode !== null;\n }\n\n /** The scene node the listener follows, if any. */\n public get attachedNode(): SpatialNodeLike | null {\n return this._attachedNode;\n }\n\n /** Listener world position. */\n public get position(): Vector3 {\n return this._position;\n }\n public set position(value: Vector3) {\n this._position = value;\n setSpatialListenerPosition(this._engine, value);\n }\n\n /** Listener Euler rotation. */\n public get rotation(): Vector3 {\n return this._rotation;\n }\n public set rotation(value: Vector3) {\n this._rotation = value;\n }\n\n /** Listener rotation quaternion. */\n public get rotationQuaternion(): Quaternion {\n return this._rotationQuaternion;\n }\n public set rotationQuaternion(value: Quaternion) {\n this._rotationQuaternion = value;\n setSpatialListener(this._engine, { rotationQuaternion: value });\n }\n\n /** Follows a scene node's world transform. */\n public attach(sceneNode: SpatialNodeLike | null): void {\n this._attachedNode = sceneNode;\n this.update();\n }\n\n /** Stops following a scene node. */\n public detach(): void {\n this._attachedNode = null;\n }\n\n /** Pulls the attached node's current world position/rotation into the listener. */\n public update(): void {\n const node = this._attachedNode;\n const pos = readNodePosition(node);\n if (pos) {\n this._position = new Vector3(pos.x, pos.y, pos.z);\n setSpatialListenerPosition(this._engine, pos);\n }\n const quat = readNodeRotation(node);\n if (quat) {\n this._rotationQuaternion = new Quaternion(quat.x, quat.y, quat.z, quat.w);\n setSpatialListener(this._engine, { rotationQuaternion: this._rotationQuaternion });\n }\n updateSpatialAudio(this._engine);\n }\n}\n\n// ───────────────────────────── Buses ─────────────────────────────────────────\n\n/** Babylon.js `AbstractAudioBus` — base class for both bus kinds. */\nexport abstract class AbstractAudioBus extends AbstractAudioOutNode {}\n\n/** Babylon.js `AudioBus` — a generic mixer bus. */\nexport class AudioBus extends AbstractAudioBus {\n /** @internal The backing Lite bus. */\n public readonly _lite: LiteAudioBus;\n private _spatial: AbstractSpatialAudio | null = null;\n private _stereo: AbstractStereoAudio | null = null;\n private _outBus: PrimaryAudioBus | null;\n\n /** @internal */\n public constructor(engine: AudioEngineV2, lite: LiteAudioBus, outBus: PrimaryAudioBus | null, volume = 1) {\n super(lite.name, engine);\n this._lite = lite;\n this._outBus = outBus;\n this._volume = volume;\n }\n\n /** The output bus this bus routes to. */\n public get outBus(): PrimaryAudioBus | null {\n return this._outBus;\n }\n public set outBus(value: PrimaryAudioBus | null) {\n if (this._outBus === value) {\n return;\n }\n rerouteLiteOutBus(this._lite, unwrapBus(value) ?? null);\n this._outBus = value;\n }\n\n /** Lazily-built spatial sub-property. */\n public get spatial(): AbstractSpatialAudio {\n return (this._spatial ??= new AbstractSpatialAudio(this._lite));\n }\n\n /** Lazily-built stereo sub-property. */\n public get stereo(): AbstractStereoAudio {\n return (this._stereo ??= new AbstractStereoAudio(this._lite));\n }\n\n public getClassName(): string {\n return \"AudioBus\";\n }\n\n public override dispose(): void {\n disposeAudioBus(this._lite);\n super.dispose();\n }\n\n protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void {\n setBusVolume(this._lite, value, toLiteRamp(options));\n }\n\n protected _spatialHost(): LiteHost {\n return this._lite;\n }\n}\n\n/** Babylon.js `MainAudioBus` — a bus that connects directly to the engine output. */\nexport class MainAudioBus extends AbstractAudioBus {\n /** @internal The backing Lite main bus. */\n public readonly _lite: LiteMainBus;\n\n /** @internal */\n public constructor(engine: AudioEngineV2, lite: LiteMainBus) {\n super(lite.name, engine);\n this._lite = lite;\n }\n\n public getClassName(): string {\n return \"MainAudioBus\";\n }\n\n protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void {\n setBusVolume(this._lite as LitePrimaryAudioBus, value, toLiteRamp(options));\n }\n\n protected _spatialHost(): LiteHost {\n // The Lite main bus is not an `AudioGraphHost`; spatial/stereo/analyzer\n // are not available on a main bus (matching the BJS `MainAudioBus`, which\n // exposes neither). Accessing `.analyzer` on a main bus is unsupported.\n return unsupported(\"MainAudioBus.analyzer\", \"Main buses have no analyzer; attach one to a sound or generic AudioBus instead.\");\n }\n}\n\n// ───────────────────────────── Sound source / sounds ─────────────────────────\n\n/** Babylon.js `AbstractSoundSource` — an out-node with an output bus + spatial/stereo. */\nexport abstract class AbstractSoundSource extends AbstractAudioOutNode {\n private _spatial: AbstractSpatialAudio | null = null;\n private _stereo: AbstractStereoAudio | null = null;\n protected _outBus: PrimaryAudioBus | null;\n\n protected constructor(name: string, engine: AudioEngineV2, outBus: PrimaryAudioBus | null) {\n super(name, engine);\n this._outBus = outBus;\n }\n\n /** The output bus this source routes to. */\n public get outBus(): PrimaryAudioBus | null {\n return this._outBus;\n }\n public set outBus(value: PrimaryAudioBus | null) {\n if (this._outBus === value) {\n return;\n }\n rerouteLiteOutBus(this._spatialHost(), unwrapBus(value) ?? null);\n this._outBus = value;\n }\n\n /** Lazily-built spatial sub-property. */\n public get spatial(): AbstractSpatialAudio {\n return (this._spatial ??= new AbstractSpatialAudio(this._spatialHost()));\n }\n\n /** Lazily-built stereo sub-property. */\n public get stereo(): AbstractStereoAudio {\n return (this._stereo ??= new AbstractStereoAudio(this._spatialHost()));\n }\n}\n\n/** A live input source (e.g. microphone) wrapping a Lite `AudioInputSource`. */\nexport class SoundSource extends AbstractSoundSource {\n /** @internal The backing Lite input source. */\n public readonly _lite: LiteAudioInputSource;\n\n /** @internal */\n public constructor(engine: AudioEngineV2, lite: LiteAudioInputSource, outBus: PrimaryAudioBus | null, volume = 1) {\n super(lite.name, engine, outBus);\n this._lite = lite;\n this._volume = volume;\n }\n\n public getClassName(): string {\n return \"SoundSource\";\n }\n\n public override dispose(): void {\n disposeSoundSource(this._lite);\n super.dispose();\n }\n\n protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void {\n setSoundSourceVolume(this._lite, value, toLiteRamp(options));\n }\n\n protected _spatialHost(): LiteHost {\n return this._lite;\n }\n}\n\n/** Babylon.js `AbstractSound` — a playable sound (static or streaming). */\nexport abstract class AbstractSound extends AbstractSoundSource {\n /** Fires when the sound finishes (all instances ended). */\n public readonly onEndedObservable = new Observable<AbstractSound>();\n\n protected constructor(name: string, engine: AudioEngineV2, outBus: PrimaryAudioBus | null) {\n super(name, engine, outBus);\n engine._addSound(this);\n }\n\n /** Number of live playing instances. */\n public abstract get activeInstancesCount(): number;\n /** Whether the sound auto-plays on creation. */\n public abstract get autoplay(): boolean;\n /** Current playback state. */\n public abstract get state(): SoundState;\n\n /** Whether the sound loops. */\n public abstract get loop(): boolean;\n public abstract set loop(value: boolean);\n\n /** Start offset, seconds. */\n public abstract get startOffset(): number;\n public abstract set startOffset(value: number);\n\n /** Maximum simultaneous instances. */\n public abstract get maxInstances(): number;\n public abstract set maxInstances(value: number);\n\n /** Current playback time of the newest instance, seconds. */\n public abstract get currentTime(): number;\n public abstract set currentTime(value: number);\n\n /** Plays the sound. */\n public abstract play(options?: Partial<IStaticSoundPlayOptions & IStreamingSoundPlayOptions>): void;\n /** Pauses the sound. */\n public abstract pause(): void;\n /** Resumes the sound. */\n public abstract resume(options?: Partial<IStaticSoundPlayOptions & IStreamingSoundPlayOptions>): void;\n /** Stops the sound. */\n public abstract stop(options?: Partial<IStaticSoundStopOptions>): void;\n\n public override dispose(): void {\n this.engine._removeSound(this);\n this.onEndedObservable.clear();\n super.dispose();\n }\n}\n\n/** Babylon.js `StaticSoundBuffer` — a decoded buffer wrapping a Lite `SoundBuffer`. */\nexport class StaticSoundBuffer {\n /** The engine that owns this buffer. */\n public readonly engine: AudioEngineV2;\n /** The buffer name. */\n public name: string;\n /** @internal The backing Lite sound buffer. */\n public readonly _lite: LiteSoundBuffer;\n\n /** @internal */\n public constructor(engine: AudioEngineV2, lite: LiteSoundBuffer, name = \"StaticSoundBuffer\") {\n this.engine = engine;\n this._lite = lite;\n this.name = name;\n }\n\n /** Sample rate, Hz. */\n public get sampleRate(): number {\n return this._lite.sampleRate;\n }\n /** Length in sample frames. */\n public get length(): number {\n return this._lite.length;\n }\n /** Duration, seconds. */\n public get duration(): number {\n return this._lite.duration;\n }\n /** Number of channels. */\n public get channelCount(): number {\n return this._lite.channelCount;\n }\n\n /** Clones the buffer. Lite buffers are immutable, so the clone shares the data. */\n public clone(options?: Partial<{ name: string }>): StaticSoundBuffer {\n return new StaticSoundBuffer(this.engine, this._lite, options?.name ?? this.name);\n }\n}\n\n/** Babylon.js `StaticSound` — a buffer-backed sound wrapping a Lite `StaticSound`. */\nexport class StaticSound extends AbstractSound {\n /** @internal The backing Lite static sound. */\n public readonly _lite: LiteStaticSound;\n private readonly _autoplay: boolean;\n private _buffer: StaticSoundBuffer;\n\n /** @internal */\n public constructor(engine: AudioEngineV2, lite: LiteStaticSound, buffer: StaticSoundBuffer, outBus: PrimaryAudioBus | null, autoplay: boolean, name?: string, volume = 1) {\n super(name ?? lite.name ?? \"Sound\", engine, outBus);\n this._lite = lite;\n this._buffer = buffer;\n this._autoplay = autoplay;\n this._volume = volume;\n lite.onEnded.add(() => this.onEndedObservable.notifyObservers(this));\n }\n\n /** The decoded buffer this sound plays. */\n public get buffer(): StaticSoundBuffer {\n return this._buffer;\n }\n\n public get activeInstancesCount(): number {\n return this._lite.instanceCount;\n }\n public get autoplay(): boolean {\n return this._autoplay;\n }\n public get state(): SoundState {\n return this._lite.state as SoundState;\n }\n\n public get loop(): boolean {\n return this._lite._options.loop;\n }\n public set loop(value: boolean) {\n this._lite._options.loop = value;\n }\n\n public get startOffset(): number {\n return this._lite._options.startOffset;\n }\n public set startOffset(value: number) {\n this._lite._options.startOffset = value;\n }\n\n public get maxInstances(): number {\n return this._lite._options.maxInstances;\n }\n public set maxInstances(value: number) {\n this._lite._options.maxInstances = value;\n }\n\n public get duration(): number {\n return this._lite._options.duration;\n }\n public set duration(value: number) {\n this._lite._options.duration = value;\n }\n\n public get loopStart(): number {\n return this._lite._options.loopStart;\n }\n public set loopStart(value: number) {\n this._lite._options.loopStart = value;\n }\n\n public get loopEnd(): number {\n return this._lite._options.loopEnd;\n }\n public set loopEnd(value: number) {\n this._lite._options.loopEnd = value;\n }\n\n public get pitch(): number {\n return this._lite._options.pitch;\n }\n public set pitch(value: number) {\n this._lite._options.pitch = value;\n for (const instance of this._lite._instances) {\n if (instance._sourceNode) {\n instance._sourceNode.detune.value = value;\n }\n }\n }\n\n public get playbackRate(): number {\n return this._lite._options.playbackRate;\n }\n public set playbackRate(value: number) {\n this._lite._options.playbackRate = value;\n for (const instance of this._lite._instances) {\n if (instance._sourceNode) {\n instance._sourceNode.playbackRate.value = value;\n }\n }\n }\n\n public get currentTime(): number {\n return this.startOffset;\n }\n public set currentTime(value: number) {\n this.startOffset = value;\n }\n\n public play(options?: Partial<IStaticSoundPlayOptions>): void {\n playSound(this._lite, options);\n }\n\n public pause(): void {\n pauseSound(this._lite);\n }\n\n public resume(options?: Partial<IStaticSoundPlayOptions>): void {\n resumeSound(this._lite, options);\n }\n\n public stop(options?: Partial<IStaticSoundStopOptions>): void {\n stopSound(this._lite, options);\n }\n\n /** Clones the sound (shares the decoded buffer). */\n public async cloneAsync(options?: Partial<IStaticSoundCloneOptions>): Promise<StaticSound> {\n const outBus = (options?.outBus as PrimaryAudioBus | undefined) ?? this._outBus ?? undefined;\n return this.engine.createSoundAsync(this.name, this._buffer, { outBus });\n }\n\n public getClassName(): string {\n return \"StaticSound\";\n }\n\n public override dispose(): void {\n disposeSound(this._lite);\n super.dispose();\n }\n\n protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void {\n setSoundVolume(this._lite, value, toLiteRamp(options));\n }\n\n protected _spatialHost(): LiteHost {\n return this._lite;\n }\n}\n\n/** Babylon.js `StreamingSound` — a media-element-backed sound. */\nexport class StreamingSound extends AbstractSound {\n /** @internal The backing Lite streaming sound. */\n public readonly _lite: LiteStreamingSound;\n private readonly _autoplay: boolean;\n private _loop: boolean;\n private _startOffset: number;\n private _maxInstances: number;\n\n /** @internal */\n public constructor(engine: AudioEngineV2, lite: LiteStreamingSound, outBus: PrimaryAudioBus | null, options: Partial<IStreamingSoundOptions>, name?: string) {\n super(name ?? lite.name ?? \"Sound\", engine, outBus);\n this._lite = lite;\n this._autoplay = options.autoplay ?? false;\n this._loop = options.loop ?? false;\n this._startOffset = options.startOffset ?? 0;\n this._maxInstances = options.maxInstances ?? Infinity;\n this._volume = options.volume ?? 1;\n lite.onEnded.add(() => this.onEndedObservable.notifyObservers(this));\n }\n\n /** Number of instances configured to preload. */\n public get preloadCount(): number {\n return this._lite._options.preloadCount;\n }\n\n /** Number of instances that have finished preloading. */\n public get preloadCompletedCount(): number {\n return this._lite.preloadCompletedCount;\n }\n\n public get activeInstancesCount(): number {\n return this._lite.instanceCount;\n }\n public get autoplay(): boolean {\n return this._autoplay;\n }\n public get state(): SoundState {\n return this._lite.state as SoundState;\n }\n\n public get loop(): boolean {\n return this._loop;\n }\n public set loop(value: boolean) {\n this._loop = value;\n this._lite._options.loop = value;\n }\n\n public get startOffset(): number {\n return this._startOffset;\n }\n public set startOffset(value: number) {\n this._startOffset = value;\n this._lite._options.startOffset = value;\n }\n\n public get maxInstances(): number {\n return this._maxInstances;\n }\n public set maxInstances(value: number) {\n this._maxInstances = value;\n this._lite._options.maxInstances = value;\n }\n\n public get currentTime(): number {\n return this._startOffset;\n }\n public set currentTime(value: number) {\n this.startOffset = value;\n }\n\n public play(options?: Partial<IStreamingSoundPlayOptions>): void {\n playStreamingSound(this._lite, options);\n }\n\n public pause(): void {\n pauseStreamingSound(this._lite);\n }\n\n public resume(options?: Partial<IStreamingSoundPlayOptions>): void {\n resumeStreamingSound(this._lite, options);\n }\n\n public stop(): void {\n stopStreamingSound(this._lite);\n }\n\n /** Preloads a single instance. */\n public preloadInstanceAsync(): Promise<void> {\n return preloadStreamingInstanceAsync(this._lite);\n }\n\n /** Preloads `count` instances. */\n public preloadInstancesAsync(count: number): Promise<void> {\n return preloadStreamingInstancesAsync(this._lite, count);\n }\n\n public getClassName(): string {\n return \"StreamingSound\";\n }\n\n public override dispose(): void {\n disposeStreamingSound(this._lite);\n super.dispose();\n }\n\n protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void {\n setStreamingSoundVolume(this._lite, value, toLiteRamp(options));\n }\n\n protected _spatialHost(): LiteHost {\n return this._lite;\n }\n}\n\n// ───────────────────────────── Engine ────────────────────────────────────────\n\nconst FormatMimeTypes: { [key: string]: string } = {\n aac: \"audio/aac\",\n ac3: \"audio/ac3\",\n flac: \"audio/flac\",\n m4a: \"audio/mp4\",\n mp3: 'audio/mpeg; codecs=\"mp3\"',\n mp4: \"audio/mp4\",\n ogg: 'audio/ogg; codecs=\"vorbis\"',\n wav: \"audio/wav\",\n webm: 'audio/webm; codecs=\"vorbis\"',\n};\n\n/** Source accepted by `createSoundAsync` / `createSoundBufferAsync`. */\nexport type StaticSoundSource = ArrayBuffer | AudioBuffer | StaticSoundBuffer | string | string[];\n\nfunction unwrapBus(bus: PrimaryAudioBus | null | undefined): LitePrimaryAudioBus | undefined {\n if (!bus) {\n return undefined;\n }\n return (bus as AudioBus | MainAudioBus)._lite as LitePrimaryAudioBus;\n}\n\n/** The Web Audio input node a Lite primary bus exposes (mirrors Lite's internal `getBusInputNode`). */\nfunction liteBusInputNode(bus: LitePrimaryAudioBus): AudioNode {\n return \"_graph\" in bus ? (bus as LiteAudioBus)._graph._in : (bus as LiteMainBus)._in;\n}\n\n/**\n * Re-routes a Lite graph-bearing handle (sound, source, or generic bus) from its\n * current output bus to `newOutBus`, mirroring AudioV2's `outBus` setter. Lite\n * exposes no public re-route entry point, so this rewires the single stable tail\n * link (the sub-graph's `_out` node to the target bus input) directly, exactly as\n * Lite wires it at creation time.\n */\nfunction rerouteLiteOutBus(host: LiteHost, newOutBus: LitePrimaryAudioBus | null): void {\n const out = host._graph._out;\n const oldOutBus = host._outBus;\n if (oldOutBus) {\n try {\n out.disconnect(liteBusInputNode(oldOutBus));\n } catch {\n // The tail may not be connected yet (e.g. a microphone source created\n // without an output bus); ignore.\n }\n }\n if (newOutBus) {\n out.connect(liteBusInputNode(newOutBus));\n }\n (host as { _outBus: LitePrimaryAudioBus | null })._outBus = newOutBus;\n}\n\nfunction unwrapBufferSource(source: StaticSoundSource): ArrayBuffer | AudioBuffer | LiteSoundBuffer | string | string[] {\n if (source instanceof StaticSoundBuffer) {\n return source._lite;\n }\n return source;\n}\n\n/**\n * Babylon.js `AudioEngineV2` — the AudioV2 engine. Backed by a Lite audio engine.\n * Created via {@link CreateAudioEngineAsync}.\n */\nexport class AudioEngineV2 {\n private static _Instances: AudioEngineV2[] = [];\n /** All live audio engines. */\n public static get Instances(): readonly AudioEngineV2[] {\n return AudioEngineV2._Instances;\n }\n\n /** Fires when a named node is added to the engine. */\n public readonly onNodeAddedObservable = new Observable<AbstractNamedAudioNode>();\n /** Fires when a named node is removed from the engine. */\n public readonly onNodeRemovedObservable = new Observable<AbstractNamedAudioNode>();\n /** Fires when the engine is disposed. */\n public readonly onDisposeObservable = new Observable<AudioEngineV2>();\n\n /** @internal The backing Lite audio engine. */\n public readonly _lite: LiteAudioEngine;\n\n private readonly _sounds = new Set<AbstractSound>();\n private readonly _nodes = new Set<AbstractNamedAudioNode>();\n private _defaultMainBus: MainAudioBus | null = null;\n private _listener: AbstractSpatialAudioListener | null = null;\n private _mainOut: AbstractAudioNode | null = null;\n\n /** @internal */\n public constructor(lite: LiteAudioEngine) {\n this._lite = lite;\n AudioEngineV2._Instances.push(this);\n }\n\n /** The audio context's current time, seconds. */\n public get currentTime(): number {\n return this._lite.currentTime;\n }\n\n /** The context state. */\n public get state(): AudioEngineV2State {\n return this._lite.state;\n }\n\n /** Master output volume. */\n public get volume(): number {\n return getMasterVolume(this._lite);\n }\n public set volume(value: number) {\n setMasterVolume(this._lite, value);\n }\n\n /** Default parameter ramp duration, seconds. */\n public get parameterRampDuration(): number {\n return this._lite._rampDuration;\n }\n public set parameterRampDuration(value: number) {\n this._lite._rampDuration = value;\n }\n\n /** The default main bus all sounds route to. */\n public get defaultMainBus(): MainAudioBus | null {\n return (this._defaultMainBus ??= new MainAudioBus(this, this._lite._mainBus));\n }\n\n /** The spatial-audio listener (the \"ears\"). */\n public get listener(): AbstractSpatialAudioListener {\n return (this._listener ??= new AbstractSpatialAudioListener(this._lite));\n }\n\n /** The engine output node. */\n public get mainOut(): AbstractAudioNode {\n return (this._mainOut ??= new MainOutNode(this));\n }\n\n /** All live sounds. */\n public get sounds(): readonly AbstractSound[] {\n return Array.from(this._sounds);\n }\n\n /** All live named nodes. */\n public get nodes(): ReadonlySet<AbstractNamedAudioNode> {\n return this._nodes;\n }\n\n /** Sets the master volume, optionally ramping. */\n public setVolume(value: number, options?: Partial<IAudioParameterRampOptions>): void {\n setMasterVolume(this._lite, value, toLiteRamp(options));\n }\n\n /** Whether the given audio format/extension can be decoded. */\n public isFormatValid(format: string): boolean {\n const mimeType = FormatMimeTypes[format.toLowerCase()];\n if (mimeType === undefined) {\n return false;\n }\n if (typeof Audio === \"undefined\") {\n return true;\n }\n return new Audio().canPlayType(mimeType) !== \"\";\n }\n\n /** Suspends the engine context. */\n public async pauseAsync(): Promise<void> {\n const ctx = this._lite._ctx as AudioContext;\n if (typeof ctx.suspend === \"function\" && ctx.state === \"running\") {\n await ctx.suspend();\n }\n }\n\n /** Resumes the engine context. */\n public async resumeAsync(): Promise<void> {\n await unlockAudioEngineAsync(this._lite);\n }\n\n /** Resumes the engine context (alias of {@link resumeAsync}). */\n public async unlockAsync(): Promise<void> {\n await unlockAudioEngineAsync(this._lite);\n }\n\n /** Creates a buffer-backed sound. */\n public async createSoundAsync(name: string, source: StaticSoundSource, options?: Partial<IStaticSoundOptions>): Promise<StaticSound> {\n const liteOptions = toLiteStaticSoundOptions(name, options);\n const lite = await createSoundAsync(this._lite, unwrapBufferSource(source), liteOptions);\n const buffer = new StaticSoundBuffer(this, lite.buffer, name);\n return new StaticSound(this, lite, buffer, (options?.outBus as PrimaryAudioBus | undefined) ?? this.defaultMainBus, options?.autoplay ?? false, name, options?.volume ?? 1);\n }\n\n /** Creates a decoded sound buffer. */\n public async createSoundBufferAsync(source: StaticSoundSource, options?: Partial<IStaticSoundBufferOptions>): Promise<StaticSoundBuffer> {\n const lite = await createSoundBufferAsync(this._lite, unwrapBufferSource(source), { skipCodecCheck: options?.skipCodecCheck });\n return new StaticSoundBuffer(this, lite);\n }\n\n /** Creates a streaming, media-element-backed sound. */\n public async createStreamingSoundAsync(name: string, source: HTMLMediaElement | string | string[], options?: Partial<IStreamingSoundOptions>): Promise<StreamingSound> {\n const liteOptions: LiteStreamingSoundOptions = {\n autoplay: options?.autoplay,\n loop: options?.loop,\n maxInstances: options?.maxInstances,\n outBus: unwrapBus(options?.outBus) as LitePrimaryAudioBus | undefined,\n preloadCount: options?.preloadCount,\n startOffset: options?.startOffset,\n volume: options?.volume,\n };\n const lite = await createStreamingSoundAsync(this._lite, source, liteOptions);\n return new StreamingSound(this, lite, (options?.outBus as PrimaryAudioBus | undefined) ?? this.defaultMainBus, options ?? {}, name);\n }\n\n /** Creates a generic mixer bus. */\n public async createBusAsync(name: string, options?: Partial<IAudioBusOptions>): Promise<AudioBus> {\n const lite = await createAudioBusAsync(this._lite, name, {\n volume: options?.volume,\n outBus: unwrapBus(options?.outBus) as LitePrimaryAudioBus | undefined,\n });\n return new AudioBus(this, lite, (options?.outBus as PrimaryAudioBus | undefined) ?? this.defaultMainBus, options?.volume ?? 1);\n }\n\n /**\n * Creates a main bus. Babylon Lite builds a single default main bus per engine\n * and does not expose creating additional ones, so this resolves the default\n * main bus.\n */\n public async createMainBusAsync(_name: string, _options?: Partial<IMainAudioBusOptions>): Promise<MainAudioBus> {\n return this.defaultMainBus as MainAudioBus;\n }\n\n /** Wraps an arbitrary Web Audio node as a sound source. */\n public async createSoundSourceAsync(name: string, source: AudioNode, options?: Partial<ISoundSourceOptions>): Promise<SoundSource> {\n const lite = await createSoundSourceAsync(this._lite, source, {\n name,\n outBus: unwrapBus(options?.outBus) as LitePrimaryAudioBus | undefined,\n outBusAutoDefault: options?.outBusAutoDefault,\n volume: options?.volume,\n });\n return new SoundSource(this, lite, (options?.outBus as PrimaryAudioBus | undefined) ?? null, options?.volume ?? 1);\n }\n\n /** Creates a microphone-backed sound source. */\n public async createMicrophoneSoundSourceAsync(name: string, options?: Partial<ISoundSourceOptions>): Promise<SoundSource> {\n const lite = await createMicrophoneSoundSourceAsync(this._lite, {\n name,\n outBus: unwrapBus(options?.outBus) as LitePrimaryAudioBus | undefined,\n outBusAutoDefault: options?.outBusAutoDefault,\n volume: options?.volume,\n });\n return new SoundSource(this, lite, (options?.outBus as PrimaryAudioBus | undefined) ?? null, options?.volume ?? 1);\n }\n\n /** Disposes the engine and all its sounds/buses. */\n public dispose(): void {\n disposeAudioEngine(this._lite);\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n this.onNodeAddedObservable.clear();\n this.onNodeRemovedObservable.clear();\n this._sounds.clear();\n this._nodes.clear();\n const i = AudioEngineV2._Instances.indexOf(this);\n if (i !== -1) {\n AudioEngineV2._Instances.splice(i, 1);\n }\n if (LastCreatedEngine === this) {\n LastCreatedEngine = null;\n }\n }\n\n /** @internal */\n public _addSound(sound: AbstractSound): void {\n this._sounds.add(sound);\n }\n /** @internal */\n public _removeSound(sound: AbstractSound): void {\n this._sounds.delete(sound);\n }\n /** @internal */\n public _addNode(node: AbstractNamedAudioNode): void {\n this._nodes.add(node);\n this.onNodeAddedObservable.notifyObservers(node);\n }\n /** @internal */\n public _removeNode(node: AbstractNamedAudioNode): void {\n if (this._nodes.delete(node)) {\n this.onNodeRemovedObservable.notifyObservers(node);\n }\n }\n}\n\n/** The engine output node returned by `engine.mainOut`. */\nclass MainOutNode extends AbstractAudioNode {\n public constructor(engine: AudioEngineV2) {\n super(engine);\n }\n public getClassName(): string {\n return \"_MainAudioOut\";\n }\n}\n\n// ───────────────────────────── Option mapping ────────────────────────────────\n\nfunction toLiteStaticSoundOptions(_name: string, options?: Partial<IStaticSoundOptions>): LiteStaticSoundOptions {\n return {\n autoplay: options?.autoplay,\n duration: options?.duration,\n loop: options?.loop,\n loopEnd: options?.loopEnd,\n loopStart: options?.loopStart,\n maxInstances: options?.maxInstances,\n outBus: unwrapBus(options?.outBus) as LitePrimaryAudioBus | undefined,\n pitch: options?.pitch,\n playbackRate: options?.playbackRate,\n startOffset: options?.startOffset,\n volume: options?.volume,\n skipCodecCheck: options?.skipCodecCheck,\n };\n}\n\nfunction toLiteEngineOptions(options?: Partial<IWebAudioEngineOptions>): LiteAudioEngineOptions {\n return {\n audioContext: options?.audioContext,\n volume: options?.volume,\n parameterRampDuration: options?.parameterRampDuration,\n resumeOnInteraction: options?.resumeOnInteraction,\n resumeOnPause: options?.resumeOnPause,\n resumeOnPauseRetryInterval: options?.resumeOnPauseRetryInterval,\n };\n}\n\n// ───────────────────────────── Factory functions ─────────────────────────────\n\n/**\n * Module-level \"last created engine\", mirroring Babylon.js. Assigning a primitive\n * default is bundler-safe (no allocation at import time) and the compat package is\n * excluded from Lite bundle ceilings.\n */\nlet LastCreatedEngine: AudioEngineV2 | null = null;\n\n/** Babylon.js `OnAudioEngineV2CreatedObservable` — fires when an engine is created. */\nexport const OnAudioEngineV2CreatedObservable = new Observable<AudioEngineV2>();\n\n/** Babylon.js `LastCreatedAudioEngine()` — the most recently created engine, if any. */\nexport function LastCreatedAudioEngine(): AudioEngineV2 | null {\n return LastCreatedEngine;\n}\n\nfunction resolveEngine(engine?: AudioEngineV2 | null): AudioEngineV2 {\n const resolved = engine ?? LastCreatedEngine;\n if (!resolved) {\n return unsupported(\"AudioV2 factory\", \"No audio engine available. Call CreateAudioEngineAsync(...) first or pass an engine.\");\n }\n return resolved;\n}\n\n/** Babylon.js `CreateAudioEngineAsync` — creates and initialises an AudioV2 engine. */\nexport async function CreateAudioEngineAsync(options?: Partial<IWebAudioEngineOptions>): Promise<AudioEngineV2> {\n const lite = await createAudioEngineAsync(toLiteEngineOptions(options));\n const engine = new AudioEngineV2(lite);\n LastCreatedEngine = engine;\n OnAudioEngineV2CreatedObservable.notifyObservers(engine);\n return engine;\n}\n\n/** Babylon.js `CreateSoundAsync`. */\nexport function CreateSoundAsync(name: string, source: StaticSoundSource, options?: Partial<IStaticSoundOptions>, engine?: AudioEngineV2 | null): Promise<StaticSound> {\n return resolveEngine(engine).createSoundAsync(name, source, options);\n}\n\n/** Babylon.js `CreateSoundBufferAsync`. */\nexport function CreateSoundBufferAsync(source: StaticSoundSource, options?: Partial<IStaticSoundBufferOptions>, engine?: AudioEngineV2 | null): Promise<StaticSoundBuffer> {\n return resolveEngine(engine).createSoundBufferAsync(source, options);\n}\n\n/** Babylon.js `CreateStreamingSoundAsync`. */\nexport function CreateStreamingSoundAsync(\n name: string,\n source: HTMLMediaElement | string | string[],\n options?: Partial<IStreamingSoundOptions>,\n engine?: AudioEngineV2 | null\n): Promise<StreamingSound> {\n return resolveEngine(engine).createStreamingSoundAsync(name, source, options);\n}\n\n/** Babylon.js `CreateAudioBusAsync`. */\nexport function CreateAudioBusAsync(name: string, options?: Partial<IAudioBusOptions>, engine?: AudioEngineV2 | null): Promise<AudioBus> {\n return resolveEngine(engine).createBusAsync(name, options);\n}\n\n/** Babylon.js `CreateMainAudioBusAsync`. */\nexport function CreateMainAudioBusAsync(name: string, options?: Partial<IMainAudioBusOptions>, engine?: AudioEngineV2 | null): Promise<MainAudioBus> {\n return resolveEngine(engine).createMainBusAsync(name, options);\n}\n\n/** Babylon.js `CreateSoundSourceAsync`. */\nexport function CreateSoundSourceAsync(name: string, source: AudioNode, options?: Partial<ISoundSourceOptions>, engine?: AudioEngineV2 | null): Promise<SoundSource> {\n return resolveEngine(engine).createSoundSourceAsync(name, source, options);\n}\n\n/** Babylon.js `CreateMicrophoneSoundSourceAsync`. */\nexport function CreateMicrophoneSoundSourceAsync(name: string, options?: Partial<ISoundSourceOptions>, engine?: AudioEngineV2 | null): Promise<SoundSource> {\n return resolveEngine(engine).createMicrophoneSoundSourceAsync(name, options);\n}\n","import type { MaterialPlugin, MaterialPluginPoint } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { ShaderLanguage } from \"../misc/engine-constants.js\";\nimport type { AbstractMesh } from \"../meshes/meshes.js\";\nimport type { SmartArray } from \"../misc/misc-utils.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { BaseTexture, RenderTargetTexture } from \"../textures/textures.js\";\nimport type { Material } from \"./materials.js\";\n\nexport type MaterialPluginDefines = Record<string, unknown>;\nexport type MaterialPluginCustomCode = Record<string, string>;\n\nconst MATERIAL_PLUGIN_INCLUDES_UNSUPPORTED =\n \"Babylon.js shader includes depend on its ShaderStore include registry and expansion pipeline. Lite has no compatible include registry, and introducing one is a loader/shader-subsystem design rather than adapter translation.\";\nconst MATERIAL_PLUGIN_REGEX_UNSUPPORTED =\n \"Regular-expression shader replacement requires access to the composed host shader source. Lite's plugin bridge exposes fixed injection slots only, so adding regex rewriting requires a new Lite shader-composition contract.\";\nconst MATERIAL_PLUGIN_HOOKS_UNSUPPORTED =\n \"This Babylon.js plugin overrides hooks outside fixed-slot custom shader code. Executing those hooks requires Babylon.js-compatible define, uniform-buffer, sampler, texture, mesh-attribute, or render-target bridge contracts that Lite does not expose.\";\n\nfunction toLiteCustomCode(code: MaterialPluginCustomCode | null): Partial<Record<MaterialPluginPoint, string>> | null {\n if (!code) {\n return null;\n }\n const translated: Partial<Record<MaterialPluginPoint, string>> = {};\n for (const [point, value] of Object.entries(code)) {\n if (point.startsWith(\"!\")) {\n return unsupported(\"MaterialPluginBase.getCustomCode(regex)\", MATERIAL_PLUGIN_REGEX_UNSUPPORTED);\n }\n switch (point) {\n case \"CUSTOM_FRAGMENT_DEFINITIONS\":\n case \"CUSTOM_FRAGMENT_MAIN_BEGIN\":\n case \"CUSTOM_FRAGMENT_UPDATE_ALPHA\":\n case \"CUSTOM_FRAGMENT_UPDATE_DIFFUSE\":\n case \"CUSTOM_FRAGMENT_BEFORE_LIGHTS\":\n case \"CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\":\n case \"CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\":\n case \"CUSTOM_VERTEX_MAIN_BEGIN\":\n case \"CUSTOM_VERTEX_UPDATE_WORLDPOS\":\n case \"CUSTOM_VERTEX_MAIN_END\":\n translated[point] = value;\n break;\n default:\n return unsupported(`MaterialPluginBase.getCustomCode(${point})`, \"Lite's material-plugin bridge does not expose this Babylon.js shader injection point.\");\n }\n }\n return translated;\n}\n\nfunction toLiteDefines(defines: MaterialPluginDefines): Record<string, boolean | number> {\n const translated: Record<string, boolean | number> = {};\n for (const [name, value] of Object.entries(defines)) {\n if (typeof value === \"boolean\" || typeof value === \"number\") {\n translated[name] = value;\n }\n }\n return translated;\n}\n\n/** Babylon.js-shaped manager for the adapter-visible material plugin list. */\nexport class MaterialPluginManager {\n private readonly _plugins: MaterialPluginBase[] = [];\n\n public constructor(material: Material) {\n void material;\n }\n\n /** @internal Attach a plugin through Lite's descriptor list. */\n public _addPlugin(plugin: MaterialPluginBase): boolean {\n if (this._plugins.some((candidate) => candidate.name === plugin.name)) {\n return false;\n }\n this._plugins.push(plugin);\n this._plugins.sort((a, b) => a.priority - b.priority);\n plugin._attachToLiteMaterial();\n return true;\n }\n\n /** @internal Activate a plugin through Lite's descriptor state. */\n public _activatePlugin(plugin: MaterialPluginBase): void {\n plugin._setLiteEnabled(true);\n }\n\n /** @internal Remove a disposed plugin from the adapter-visible list. */\n public _removePlugin(plugin: MaterialPluginBase): void {\n const index = this._plugins.indexOf(plugin);\n if (index >= 0) {\n this._plugins.splice(index, 1);\n }\n }\n\n public getPlugin<T = MaterialPluginBase>(name: string): T | null {\n return (this._plugins.find((plugin) => plugin.name === name) as T | undefined) ?? null;\n }\n}\n\n/**\n * Babylon.js `MaterialPluginBase` adapter over Lite's opt-in material-plugin\n * bridge. Subclasses keep the Babylon.js override shape while Lite receives a\n * plain plugin descriptor.\n */\nexport class MaterialPluginBase {\n private _name: string;\n private _priority: number;\n private _resolveIncludes = false;\n public readonly markAllDefinesAsDirty: () => void;\n public registerForExtraEvents = false;\n public doNotSerialize = false;\n protected readonly _material: Material;\n protected readonly _pluginManager: MaterialPluginManager;\n protected readonly _pluginDefineNames?: MaterialPluginDefines;\n\n /** @internal Plain plugin descriptor attached to the backing Lite material. */\n private readonly _lite: MaterialPlugin;\n\n public constructor(material: Material, name: string, priority: number, defines: MaterialPluginDefines = {}, addToPluginList = true, enable = false, resolveIncludes = false) {\n this._material = material;\n this._name = name;\n this._priority = priority;\n this.resolveIncludes = resolveIncludes;\n this._pluginDefineNames = defines;\n const pluginManager = material.pluginManager ?? new MaterialPluginManager(material);\n if (addToPluginList || this._attachToLite) {\n material.pluginManager ??= pluginManager;\n }\n this._pluginManager = pluginManager;\n this.markAllDefinesAsDirty = () => material._markPluginDefinesDirty();\n this._lite = {\n get name() {\n return name;\n },\n get priority() {\n return priority;\n },\n defines: toLiteDefines(defines),\n isEnabled: enable,\n getCustomCode: (shaderType) => {\n this._assertSupportedExecution();\n return this.isCompatible(ShaderLanguage.WGSL) ? toLiteCustomCode(this.getCustomCode(shaderType, ShaderLanguage.WGSL)) : null;\n },\n };\n\n if (addToPluginList) {\n this._pluginManager._addPlugin(this);\n }\n }\n\n public get name(): string {\n return this._name;\n }\n\n public set name(value: string) {\n this._name = value;\n Object.defineProperty(this._lite, \"name\", { configurable: true, enumerable: true, get: () => this._name });\n }\n\n public get priority(): number {\n return this._priority;\n }\n\n public set priority(value: number) {\n this._priority = value;\n Object.defineProperty(this._lite, \"priority\", { configurable: true, enumerable: true, get: () => this._priority });\n }\n\n public get resolveIncludes(): boolean {\n return this._resolveIncludes;\n }\n\n public set resolveIncludes(value: boolean) {\n if (value) {\n unsupported(\"MaterialPluginBase.resolveIncludes\", MATERIAL_PLUGIN_INCLUDES_UNSUPPORTED);\n }\n this._resolveIncludes = false;\n }\n\n /** @internal Unsupported derived stubs override this to avoid mutating Lite state before throwing. */\n protected get _attachToLite(): boolean {\n return true;\n }\n\n protected _enable(enable: boolean): void {\n if (enable) {\n this._pluginManager._activatePlugin(this);\n } else {\n this._setLiteEnabled(false);\n }\n }\n\n /** @internal Attach this adapter's descriptor to the backing Lite material. */\n public _attachToLiteMaterial(): void {\n if (!this._attachToLite) {\n return;\n }\n const liteMaterial = this._material._lite as typeof this._material._lite & { plugins?: MaterialPlugin[] };\n liteMaterial.plugins = [...(liteMaterial.plugins ?? []), this._lite];\n this._material._usesMaterialPlugins = true;\n this._material.getScene()?._requestMaterialPlugins(this._material._lite);\n }\n\n /** @internal Update this adapter's Lite activation state. */\n public _setLiteEnabled(enable: boolean): void {\n this._lite.isEnabled = enable;\n this.markAllDefinesAsDirty();\n }\n\n private _assertSupportedExecution(): void {\n if (this.resolveIncludes) {\n unsupported(\"MaterialPluginBase.resolveIncludes\", MATERIAL_PLUGIN_INCLUDES_UNSUPPORTED);\n }\n const base = MaterialPluginBase.prototype;\n const unsupportedHook =\n this.registerForExtraEvents ||\n this.collectDefines !== base.collectDefines ||\n this.prepareDefinesBeforeAttributes !== base.prepareDefinesBeforeAttributes ||\n this.prepareDefines !== base.prepareDefines ||\n this.isReadyForSubMesh !== base.isReadyForSubMesh ||\n this.hardBindForSubMesh !== base.hardBindForSubMesh ||\n this.bindForSubMesh !== base.bindForSubMesh ||\n this.hasTexture !== base.hasTexture ||\n this.hasRenderTargetTextures !== base.hasRenderTargetTextures ||\n this.fillRenderTargetTextures !== base.fillRenderTargetTextures ||\n this.getActiveTextures !== base.getActiveTextures ||\n this.getAnimatables !== base.getAnimatables ||\n this.addFallbacks !== base.addFallbacks ||\n this.getSamplers !== base.getSamplers ||\n this.getAttributes !== base.getAttributes ||\n this.getUniformBuffersNames !== base.getUniformBuffersNames ||\n this.getUniforms !== base.getUniforms;\n if (unsupportedHook) {\n unsupported(\"MaterialPluginBase hooks\", MATERIAL_PLUGIN_HOOKS_UNSUPPORTED);\n }\n }\n\n public isCompatible(_shaderLanguage: ShaderLanguage): boolean {\n return _shaderLanguage === ShaderLanguage.GLSL;\n }\n\n public getCustomCode(_shaderType: string, _shaderLanguage = ShaderLanguage.GLSL): MaterialPluginCustomCode | null {\n return null;\n }\n\n public isReadyForSubMesh(_defines: object, _scene: Scene, _engine: object, _subMesh: object): boolean {\n return true;\n }\n\n public hardBindForSubMesh(_uniformBuffer: object, _scene: Scene, _engine: object, _subMesh: object): void {}\n\n public bindForSubMesh(_uniformBuffer: object, _scene: Scene, _engine: object, _subMesh: object): void {}\n\n public collectDefines(defines: Record<string, { type: string; default: unknown }>): void {\n if (!this._pluginDefineNames) {\n return;\n }\n for (const [name, value] of Object.entries(this._pluginDefineNames)) {\n if (!name.startsWith(\"_\")) {\n const valueType = typeof value;\n defines[name] = {\n type: valueType === \"number\" || valueType === \"string\" || valueType === \"boolean\" ? valueType : \"object\",\n default: value,\n };\n }\n }\n }\n\n public prepareDefinesBeforeAttributes(_defines: object, _scene: Scene, _mesh: AbstractMesh): void {}\n\n public prepareDefines(_defines: object, _scene: Scene, _mesh: AbstractMesh): void {}\n\n public hasTexture(_texture: BaseTexture): boolean {\n return false;\n }\n\n public hasRenderTargetTextures(): boolean {\n return false;\n }\n\n public fillRenderTargetTextures(_renderTargets: SmartArray<RenderTargetTexture>): void {}\n\n public getActiveTextures(_activeTextures: BaseTexture[]): void {}\n\n public getAnimatables(_animatables: object[]): void {}\n\n public addFallbacks(_defines: object, _fallbacks: object, currentRank: number): number {\n return currentRank;\n }\n\n public getSamplers(_samplers: string[]): void {}\n\n public getAttributes(_attributes: string[], _scene: Scene, _mesh: AbstractMesh): void {}\n\n public getUniformBuffersNames(_ubos: string[]): void {}\n\n public getUniforms(_shaderLanguage = ShaderLanguage.GLSL): {\n ubo?: Array<{ name: string; size?: number; type?: string; arraySize?: number }>;\n vertex?: string;\n fragment?: string;\n externalUniforms?: string[];\n } {\n return {};\n }\n\n public getClassName(): string {\n return \"MaterialPluginBase\";\n }\n\n public copyTo(plugin: MaterialPluginBase): void {\n plugin.name = this.name;\n plugin.priority = this.priority;\n plugin.resolveIncludes = this.resolveIncludes;\n plugin.registerForExtraEvents = this.registerForExtraEvents;\n plugin.doNotSerialize = this.doNotSerialize;\n }\n\n public serialize(): Record<string, unknown> {\n return {\n name: this.name,\n priority: this.priority,\n resolveIncludes: this.resolveIncludes,\n registerForExtraEvents: this.registerForExtraEvents,\n doNotSerialize: this.doNotSerialize,\n };\n }\n\n public parse(source: Record<string, unknown>, _scene: Scene, _rootUrl: string): void {\n if (typeof source.resolveIncludes === \"boolean\") {\n this.resolveIncludes = source.resolveIncludes;\n }\n if (typeof source.name === \"string\") {\n this.name = source.name;\n }\n if (typeof source.priority === \"number\") {\n this.priority = source.priority;\n }\n if (typeof source.registerForExtraEvents === \"boolean\") {\n this.registerForExtraEvents = source.registerForExtraEvents;\n }\n if (typeof source.doNotSerialize === \"boolean\") {\n this.doNotSerialize = source.doNotSerialize;\n }\n }\n\n public dispose(_forceDisposeTextures?: boolean): void {\n const liteMaterial = this._material._lite as typeof this._material._lite & { plugins?: MaterialPlugin[] };\n if (liteMaterial.plugins) {\n liteMaterial.plugins = liteMaterial.plugins.filter((plugin) => plugin !== this._lite);\n this._material._usesMaterialPlugins = liteMaterial.plugins.length > 0;\n this._material._markPluginDefinesDirty();\n }\n this._pluginManager._removePlugin(this);\n }\n}\n","/**\n * Stubs for Babylon.js core/loader APIs that are **known but not supported** by\n * Babylon Lite.\n *\n * Every entry here throws {@link LiteCompatError} on use (construction or call),\n * so a ported scene fails loudly with a clear pointer instead of either a\n * confusing \"X is not exported from the compat package\" error or, worse, a\n * silently-wrong render. These mirror the `❌ Not supported` /\n * `⛔ Out of scope` rows in `COMPAT-STATUS.md`.\n *\n * As Babylon Lite gains a capability, the corresponding stub here should be\n * replaced by a real wrapper (and its `COMPAT-STATUS.md` row upgraded).\n */\n\nimport { unsupported } from \"../error.js\";\nimport { GAUSSIAN_SPLATTING_MAX_PART_COUNT, encodeIdToColor, getGaussianSplattingMaxPartCount, getGaussianSplattingPartIndexVaryingDeclaration } from \"babylon-lite\";\nimport type { AbstractEngine } from \"../engine/engine.js\";\nimport { PushMaterial } from \"../materials/materials.js\";\nimport type { Material } from \"../materials/materials.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { Camera } from \"../cameras/cameras.js\";\nimport { ShaderLanguage } from \"../misc/engine-constants.js\";\nimport type { StandardMaterial, PBRMaterial } from \"../materials/materials.js\";\nimport type { Mesh, InstancedMesh } from \"../meshes/meshes.js\";\nimport { MaterialPluginBase } from \"../materials/material-plugin.js\";\nimport type { AnimationGroup } from \"../animations/animation.js\";\nimport type { Bone } from \"../bones/skeleton.js\";\nimport type { TransformNode } from \"../meshes/meshes.js\";\nimport type { Vector3 } from \"../math/vector.js\";\nimport type { Color3 } from \"../math/color.js\";\nimport type { Observable } from \"../misc/observable.js\";\n\nconst FLUID_RENDERER_UNSUPPORTED =\n \"Fluid rendering requires dedicated depth, thickness, and diffuse passes plus render-target lifecycle and composition policies that Babylon Lite does not define.\";\nconst DITHERED_TILE_FADE_UNSUPPORTED =\n \"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.\";\nconst GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED =\n \"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.\";\n// ─── Flow graph validation ───────────────────────────────────────────\nconst FLOW_GRAPH_UNSUPPORTED =\n \"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.\";\n\nexport enum FlowGraphValidationSeverity {\n Error = 0,\n Warning = 1,\n}\n\nexport interface IFlowGraphValidationIssue {\n severity: FlowGraphValidationSeverity;\n message: string;\n block?: unknown;\n connectionName?: string;\n}\n\nexport interface IFlowGraphValidationResult {\n isValid: boolean;\n issues: IFlowGraphValidationIssue[];\n errorCount: number;\n warningCount: number;\n issuesByBlock: Map<string, IFlowGraphValidationIssue[]>;\n}\n\nexport function ValidateFlowGraph(_flowGraph: unknown): IFlowGraphValidationResult {\n return unsupported(\"ValidateFlowGraph\", FLOW_GRAPH_UNSUPPORTED);\n}\n\nexport function ValidateFlowGraphWithBlockList(_flowGraph: unknown, _allKnownBlocks: unknown[]): IFlowGraphValidationResult {\n return unsupported(\"ValidateFlowGraphWithBlockList\", FLOW_GRAPH_UNSUPPORTED);\n}\n\n// ─── Fluid rendering ─────────────────────────────────────────────────\nexport abstract class FluidRenderingObject {\n public static UsePerParticleSizeAttribute = false;\n\n protected constructor(_scene: Scene, _shaderLanguage?: ShaderLanguage) {\n unsupported(\"FluidRenderingObject\", FLUID_RENDERER_UNSUPPORTED);\n }\n}\n\nexport class FluidRenderingObjectParticleSystem extends FluidRenderingObject {\n public constructor(scene: Scene, _particleSystem: unknown, shaderLanguage?: ShaderLanguage) {\n super(scene, shaderLanguage);\n }\n}\n\nexport class FluidRenderingObjectCustomParticles extends FluidRenderingObject {\n public constructor(scene: Scene, _buffers: Record<string, ArrayLike<number>>, _numParticles: number, shaderLanguage?: ShaderLanguage) {\n super(scene, shaderLanguage);\n }\n}\n\nexport class FluidRenderingTargetRenderer {\n public constructor(_scene: Scene, _camera?: Camera, _shaderLanguage?: ShaderLanguage) {\n unsupported(\"FluidRenderingTargetRenderer\", FLUID_RENDERER_UNSUPPORTED);\n }\n}\n\nexport class FluidRenderer {\n public constructor(_scene: Scene) {\n unsupported(\"FluidRenderer\", FLUID_RENDERER_UNSUPPORTED);\n }\n}\n\nexport class FluidRendererSceneComponent {\n public constructor(_scene: Scene) {\n unsupported(\"FluidRendererSceneComponent\", FLUID_RENDERER_UNSUPPORTED);\n }\n}\n\nexport function RegisterFluidRenderer(): void {\n unsupported(\"RegisterFluidRenderer\", FLUID_RENDERER_UNSUPPORTED);\n}\n\n// ─── Root motion ─────────────────────────────────────────────────────\nconst ROOT_MOTION_UNSUPPORTED =\n \"Babylon.js root motion analyzes animation hierarchies, rewrites in-place clips, journals mixer writes, and applies blended per-frame travel. Lite exposes animation playback but not that analysis and mixer-journal subsystem; its lifecycle and ownership require a Lite-level design.\";\n\nexport enum RootMotionSource {\n None = 0,\n Root = 1,\n FootContact = 2,\n}\n\nexport interface IRootMotionClipOptions {\n rootNode?: TransformNode | Bone;\n characterNode?: TransformNode;\n contactNodes?: Array<TransformNode | Bone>;\n source?: RootMotionSource;\n extractRotation?: boolean;\n samplesPerSecond?: number;\n minimumTravel?: number;\n minimumTurn?: number;\n directionSnapAngle?: number;\n extractLateralMotion?: boolean;\n upAxis?: Vector3;\n name?: string;\n cloneAnimations?: boolean;\n}\n\nexport class RootMotionClip {\n public constructor(_animationGroup: AnimationGroup, _options: IRootMotionClipOptions = {}) {\n unsupported(\"RootMotionClip\", ROOT_MOTION_UNSUPPORTED);\n }\n\n public get sourceAnimationGroup(): AnimationGroup {\n return unsupported(\"RootMotionClip.sourceAnimationGroup\", ROOT_MOTION_UNSUPPORTED);\n }\n public get animationGroup(): AnimationGroup {\n return unsupported(\"RootMotionClip.animationGroup\", ROOT_MOTION_UNSUPPORTED);\n }\n public get controller(): RootMotionController | null {\n return unsupported(\"RootMotionClip.controller\", ROOT_MOTION_UNSUPPORTED);\n }\n public get source(): RootMotionSource {\n return unsupported(\"RootMotionClip.source\", ROOT_MOTION_UNSUPPORTED);\n }\n public get rootNode(): TransformNode | null {\n return unsupported(\"RootMotionClip.rootNode\", ROOT_MOTION_UNSUPPORTED);\n }\n public get characterNode(): TransformNode {\n return unsupported(\"RootMotionClip.characterNode\", ROOT_MOTION_UNSUPPORTED);\n }\n public get contactNodes(): ReadonlyArray<TransformNode> {\n return unsupported(\"RootMotionClip.contactNodes\", ROOT_MOTION_UNSUPPORTED);\n }\n public get upAxis(): Vector3 {\n return unsupported(\"RootMotionClip.upAxis\", ROOT_MOTION_UNSUPPORTED);\n }\n public get fromFrame(): number {\n return unsupported(\"RootMotionClip.fromFrame\", ROOT_MOTION_UNSUPPORTED);\n }\n public get toFrame(): number {\n return unsupported(\"RootMotionClip.toFrame\", ROOT_MOTION_UNSUPPORTED);\n }\n public get travelDirection(): Vector3 {\n return unsupported(\"RootMotionClip.travelDirection\", ROOT_MOTION_UNSUPPORTED);\n }\n public get cycleOffset(): Vector3 {\n return unsupported(\"RootMotionClip.cycleOffset\", ROOT_MOTION_UNSUPPORTED);\n }\n public get cycleDistance(): number {\n return unsupported(\"RootMotionClip.cycleDistance\", ROOT_MOTION_UNSUPPORTED);\n }\n public get cycleRotation(): number {\n return unsupported(\"RootMotionClip.cycleRotation\", ROOT_MOTION_UNSUPPORTED);\n }\n public get extractsRotation(): boolean {\n return unsupported(\"RootMotionClip.extractsRotation\", ROOT_MOTION_UNSUPPORTED);\n }\n public get duration(): number {\n return unsupported(\"RootMotionClip.duration\", ROOT_MOTION_UNSUPPORTED);\n }\n public get averageSpeed(): number {\n return unsupported(\"RootMotionClip.averageSpeed\", ROOT_MOTION_UNSUPPORTED);\n }\n public get characterHeight(): number {\n return unsupported(\"RootMotionClip.characterHeight\", ROOT_MOTION_UNSUPPORTED);\n }\n public getOffsetAtFrame(_frame: number, _result: Vector3): Vector3 {\n return unsupported(\"RootMotionClip.getOffsetAtFrame\", ROOT_MOTION_UNSUPPORTED);\n }\n public getRotationAtFrame(_frame: number): number {\n return unsupported(\"RootMotionClip.getRotationAtFrame\", ROOT_MOTION_UNSUPPORTED);\n }\n public dispose(): void {\n unsupported(\"RootMotionClip.dispose\", ROOT_MOTION_UNSUPPORTED);\n }\n}\n\nexport class RootMotionController {\n public applyToCharacter = true;\n public readonly onRootMotionObservable!: Observable<RootMotionController>;\n\n public constructor(_characterNode: TransformNode, _clips: RootMotionClip[] = []) {\n unsupported(\"RootMotionController\", ROOT_MOTION_UNSUPPORTED);\n }\n\n public get characterNode(): TransformNode {\n return unsupported(\"RootMotionController.characterNode\", ROOT_MOTION_UNSUPPORTED);\n }\n public get clips(): ReadonlyArray<RootMotionClip> {\n return unsupported(\"RootMotionController.clips\", ROOT_MOTION_UNSUPPORTED);\n }\n public get deltaPosition(): Vector3 {\n return unsupported(\"RootMotionController.deltaPosition\", ROOT_MOTION_UNSUPPORTED);\n }\n public get deltaRotation(): number {\n return unsupported(\"RootMotionController.deltaRotation\", ROOT_MOTION_UNSUPPORTED);\n }\n public addClip(_clip: RootMotionClip): void {\n unsupported(\"RootMotionController.addClip\", ROOT_MOTION_UNSUPPORTED);\n }\n public removeClip(_clip: RootMotionClip): void {\n unsupported(\"RootMotionController.removeClip\", ROOT_MOTION_UNSUPPORTED);\n }\n public reset(): void {\n unsupported(\"RootMotionController.reset\", ROOT_MOTION_UNSUPPORTED);\n }\n public dispose(): void {\n unsupported(\"RootMotionController.dispose\", ROOT_MOTION_UNSUPPORTED);\n }\n}\n\n// ─── Materials ───────────────────────────────────────────────────────\nexport class MultiMaterial {\n public constructor() {\n unsupported(\"MultiMaterial\", \"Babylon Lite uses one material per renderable. Split the mesh geometry by material into separate meshes instead.\");\n }\n}\n\nexport type DitheredTileFadeSupportedMaterial = StandardMaterial | PBRMaterial;\nexport type DitheredTileFadeMesh = Mesh | InstancedMesh;\n\nexport interface IDitheredTileFadeBounds {\n lowerBound: number;\n upperBound: number;\n}\n\nexport interface IGaussianSplattingDebugOptions {\n clippingBox: { min: Vector3; max: Vector3 } | null;\n opacityCulling: { min: number; max: number } | null;\n sizeCulling: { min: number; max: number } | null;\n opacityScale: number;\n opacitySaturate: boolean;\n shDc: boolean;\n shOrder1: boolean;\n shOrder2: boolean;\n shOrder3: boolean;\n shOrder4: boolean;\n}\n\nexport const GaussianSplattingMaxPartCount = GAUSSIAN_SPLATTING_MAX_PART_COUNT;\n\nexport function GetGaussianSplattingMaxPartCount(engine: AbstractEngine): number {\n return getGaussianSplattingMaxPartCount(engine._lite);\n}\n\nexport function GetPartIndexVaryingDeclaration(shaderLanguage: ShaderLanguage): string {\n return getGaussianSplattingPartIndexVaryingDeclaration(shaderLanguage === ShaderLanguage.WGSL);\n}\n\nexport class GaussianSplattingMaterial extends PushMaterial {\n /** @internal The unsupported material has no Lite backing. */\n public get _lite(): never {\n return unsupported(\"GaussianSplattingMaterial._lite\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public constructor(name: string, scene?: Scene) {\n super(name);\n void scene;\n unsupported(\"GaussianSplattingMaterial\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public override clone(_name: string): GaussianSplattingMaterial {\n return unsupported(\"GaussianSplattingMaterial.clone\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n}\n\nexport class GaussianSplattingDebugMaterialPlugin extends MaterialPluginBase {\n /** @internal An unsupported plugin must not attach to a Lite material. */\n protected override get _attachToLite(): boolean {\n return false;\n }\n\n public constructor(material: GaussianSplattingMaterial) {\n super(material, \"GaussianSplattingDebug\", 200, {}, false);\n unsupported(\"GaussianSplattingDebugMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n}\n\nexport class GaussianSplattingGpuPickingMaterialPlugin extends MaterialPluginBase {\n public static EncodeIdToColor(id: number): [number, number, number] {\n return encodeIdToColor(id);\n }\n\n /** @internal An unsupported plugin must not attach to a Lite material. */\n protected override get _attachToLite(): boolean {\n return false;\n }\n\n public constructor(material: GaussianSplattingMaterial, _maxPartCount?: number) {\n super(material, \"GaussianSplatGpuPicking\", 230, {}, false);\n unsupported(\"GaussianSplattingGpuPickingMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n}\n\nexport class GaussianSplattingSolidColorMaterialPlugin extends MaterialPluginBase {\n /** @internal An unsupported plugin must not attach to a Lite material. */\n protected override get _attachToLite(): boolean {\n return false;\n }\n\n public constructor(material: GaussianSplattingMaterial, _partColors: Color3[], _maxPartCount?: number) {\n super(material, \"GaussianSplatSolidColor\", 200, {}, false);\n unsupported(\"GaussianSplattingSolidColorMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n}\n\nexport class GaussianSplattingSizeMaterialPlugin extends MaterialPluginBase {\n /** @internal An unsupported plugin must not attach to a Lite material. */\n protected override get _attachToLite(): boolean {\n return false;\n }\n\n public constructor(material: GaussianSplattingMaterial) {\n super(material, \"GaussianSplattingSize\", 210, {}, false);\n unsupported(\"GaussianSplattingSizeMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public get isEnabled(): boolean {\n return unsupported(\"GaussianSplattingSizeMaterialPlugin.isEnabled\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public set isEnabled(_value: boolean) {\n unsupported(\"GaussianSplattingSizeMaterialPlugin.isEnabled\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public get sizeScale(): number {\n return unsupported(\"GaussianSplattingSizeMaterialPlugin.sizeScale\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public set sizeScale(_value: number) {\n unsupported(\"GaussianSplattingSizeMaterialPlugin.sizeScale\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n}\n\nexport class GaussianSplattingOverdrawMaterialPlugin extends MaterialPluginBase {\n /** @internal An unsupported plugin must not attach to a Lite material. */\n protected override get _attachToLite(): boolean {\n return false;\n }\n\n public constructor(material: GaussianSplattingMaterial) {\n super(material, \"GaussianSplattingOverdraw\", 220, {}, false);\n unsupported(\"GaussianSplattingOverdrawMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public get isEnabled(): boolean {\n return unsupported(\"GaussianSplattingOverdrawMaterialPlugin.isEnabled\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public set isEnabled(_value: boolean) {\n unsupported(\"GaussianSplattingOverdrawMaterialPlugin.isEnabled\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public get intensity(): number {\n return unsupported(\"GaussianSplattingOverdrawMaterialPlugin.intensity\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public set intensity(_value: number) {\n unsupported(\"GaussianSplattingOverdrawMaterialPlugin.intensity\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n}\n\nexport function RegisterGaussianSplattingDebugMaterialPlugin(): void {\n unsupported(\"RegisterGaussianSplattingDebugMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n}\n\nexport function RegisterGaussianSplattingGpuPickingMaterialPlugin(): void {\n unsupported(\"RegisterGaussianSplattingGpuPickingMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n}\n\nexport function RegisterGaussianSplattingSolidColorMaterialPlugin(): void {\n unsupported(\"RegisterGaussianSplattingSolidColorMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n}\n\nexport function RegisterGaussianSplattingSizeMaterialPlugin(): void {\n unsupported(\"RegisterGaussianSplattingSizeMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n}\n\nexport function RegisterGaussianSplattingOverdrawMaterialPlugin(): void {\n unsupported(\"RegisterGaussianSplattingOverdrawMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n}\n\nexport function RegisterGaussianSplattingMaterial(): void {\n unsupported(\"RegisterGaussianSplattingMaterial\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n}\n\nexport class DitheredTileFadeMaterialPlugin extends MaterialPluginBase {\n public static readonly Name = \"DitheredTileFade\";\n\n /** @internal The unsupported constructor must not alter the material or scene. */\n protected override get _attachToLite(): boolean {\n return false;\n }\n\n public constructor(material: DitheredTileFadeSupportedMaterial) {\n super(material, DitheredTileFadeMaterialPlugin.Name, 190, {}, false);\n unsupported(\"DitheredTileFadeMaterialPlugin\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public static GetOrCreate(_material: DitheredTileFadeSupportedMaterial): DitheredTileFadeMaterialPlugin {\n return unsupported(\"DitheredTileFadeMaterialPlugin.GetOrCreate\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public get isEnabled(): boolean {\n return unsupported(\"DitheredTileFadeMaterialPlugin.isEnabled\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public set isEnabled(_value: boolean) {\n unsupported(\"DitheredTileFadeMaterialPlugin.isEnabled\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public setFadeBounds(_mesh: DitheredTileFadeMesh, _lowerBound: number, _upperBound: number): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.setFadeBounds\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public setFadeLowerBound(_mesh: DitheredTileFadeMesh, _lowerBound: number): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.setFadeLowerBound\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public setFadeUpperBound(_mesh: DitheredTileFadeMesh, _upperBound: number): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.setFadeUpperBound\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public getFadeBoundsToRef(_mesh: DitheredTileFadeMesh, _result: IDitheredTileFadeBounds): boolean {\n return unsupported(\"DitheredTileFadeMaterialPlugin.getFadeBoundsToRef\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public resetFade(_mesh: DitheredTileFadeMesh): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.resetFade\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public setThinInstanceFadeBounds(_mesh: Mesh, _index: number, _lowerBound: number, _upperBound: number, _refresh = true): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.setThinInstanceFadeBounds\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public setThinInstanceFadeBoundsBuffer(_mesh: Mesh, _bounds: Float32Array): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.setThinInstanceFadeBoundsBuffer\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public commitThinInstanceFadeBounds(_mesh: Mesh): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.commitThinInstanceFadeBounds\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public resetThinInstanceFade(_mesh: Mesh, _index: number, _refresh = true): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.resetThinInstanceFade\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public reset(): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.reset\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public copyToMaterial(_material: DitheredTileFadeSupportedMaterial): DitheredTileFadeMaterialPlugin {\n return unsupported(\"DitheredTileFadeMaterialPlugin.copyToMaterial\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public getClassName(): string {\n return \"DitheredTileFadeMaterialPlugin\";\n }\n}\n\nexport class ShaderMaterial {\n public constructor() {\n unsupported(\n \"ShaderMaterial\",\n \"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.\"\n );\n }\n}\n\nexport class BackgroundMaterial {\n public constructor() {\n unsupported(\"BackgroundMaterial\", \"Standalone BackgroundMaterial is not wrapped. Use the compat `Scene` environment helpers / native `loadEnvironment` instead.\");\n }\n}\n\nexport class OpenPBRMaterial extends PushMaterial {\n /** @internal Unsupported stubs never expose a backing Lite material. */\n public override get _lite(): never {\n return unsupported(\n \"OpenPBRMaterial._lite\",\n \"OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design.\"\n );\n }\n\n public constructor(_name: string, _scene?: Scene, _forceGLSL = false) {\n super(_name);\n unsupported(\n \"OpenPBRMaterial\",\n \"OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design.\"\n );\n }\n\n public clone(_name: string, _cloneTexturesOnlyOnce = true, _rootUrl = \"\"): OpenPBRMaterial {\n return unsupported(\n \"OpenPBRMaterial.clone\",\n \"OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design.\"\n );\n }\n}\n\nexport class OpenPBRMaterialDefines {\n public constructor(_externalProperties?: Record<string, { type: string; default: unknown }>) {\n unsupported(\n \"OpenPBRMaterialDefines\",\n \"OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design.\"\n );\n }\n}\n\nexport function RegisterOpenpbrMaterial(): void {\n unsupported(\n \"RegisterOpenpbrMaterial\",\n \"OpenPBR registration would install a material parser and shader subsystem that Babylon Lite does not define; adding that subsystem needs Lite maintainer design.\"\n );\n}\n\nexport class OpenPBRMaterialLoadingAdapter {\n public constructor(_material: Material) {\n unsupported(\n \"OpenPBRMaterialLoadingAdapter\",\n \"The adapter translates glTF material data into OpenPBRMaterial, whose shader/material subsystem requires Lite maintainer design.\"\n );\n }\n}\n\n// ─── Lights ──────────────────────────────────────────────────────────\nexport class RectAreaLight {\n public constructor() {\n unsupported(\"RectAreaLight\", \"Area lights are not implemented in Babylon Lite. Use Point/Spot/Directional/Hemispheric lights.\");\n }\n}\n\n// ─── Particles ───────────────────────────────────────────────────────\nexport class GPUParticleSystem {\n public constructor() {\n unsupported(\n \"GPUParticleSystem\",\n \"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.\"\n );\n }\n}\n\nexport class SolidParticleSystem {\n public constructor() {\n unsupported(\n \"SolidParticleSystem\",\n \"Solid particle systems (per-particle mesh copies) are not backed by Babylon Lite. Consider native thin instances for many-copies use cases; node-particle billboards are available via `NodeParticleSystemSet`.\"\n );\n }\n}\n\n// ─── Effect layers ───────────────────────────────────────────────────\nexport class HighlightLayer {\n public constructor() {\n unsupported(\"HighlightLayer\", \"Effect layers are not implemented in Babylon Lite.\");\n }\n}\n\nexport class GlowLayer {\n public constructor() {\n unsupported(\"GlowLayer\", \"Effect layers are not implemented in Babylon Lite. For a bloom-style glow, use the native bloom post-process task.\");\n }\n}\n\n// ─── Mesh-attached renderers / projectors ────────────────────────────\n// ─── GreasedLine (thick-line ribbon subsystem) ───────────────────────\n// Greased lines render polylines as camera-facing ribbons/tubes driven by a\n// dedicated plugin material (per-point widths, color/width distribution tables,\n// dashing, ribbon face/direction modes). Babylon Lite renders only 1px hardware\n// line-lists (see `MeshBuilder.CreateLines` / `CreateDashedLines`) and has no\n// thick-line ribbon geometry generator or plugin-material subsystem to back it,\n// so the whole family is a `❌ Not supported` throwing stub.\nconst GREASED_LINE_REASON =\n \"Greased (thick) lines are a ribbon/tube geometry + dedicated plugin-material subsystem (per-point widths, color/width distribution tables, dashing, camera-facing ribbon modes). Babylon Lite renders only 1px hardware line-lists (MeshBuilder.CreateLines / CreateDashedLines) and has no thick-line ribbon pipeline or plugin material to back it.\";\n\nexport class GreasedLineBaseMesh {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLineBaseMesh\", GREASED_LINE_REASON);\n }\n}\n\nexport class GreasedLineMesh {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLineMesh\", GREASED_LINE_REASON);\n }\n}\n\nexport class GreasedLineRibbonMesh {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLineRibbonMesh\", GREASED_LINE_REASON);\n }\n}\n\nexport class GreasedLinePluginMaterial {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLinePluginMaterial\", GREASED_LINE_REASON);\n }\n}\n\nexport class MaterialGreasedLineDefines {\n public constructor(..._args: unknown[]) {\n unsupported(\"MaterialGreasedLineDefines\", GREASED_LINE_REASON);\n }\n}\n\nexport class GreasedLineMaterialDefaults {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLineMaterialDefaults\", GREASED_LINE_REASON);\n }\n\n public static get DEFAULT_COLOR(): never {\n return unsupported(\"GreasedLineMaterialDefaults.DEFAULT_COLOR\", GREASED_LINE_REASON);\n }\n\n public static get DEFAULT_WIDTH_ATTENUATED(): never {\n return unsupported(\"GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED\", GREASED_LINE_REASON);\n }\n\n public static get DEFAULT_WIDTH(): never {\n return unsupported(\"GreasedLineMaterialDefaults.DEFAULT_WIDTH\", GREASED_LINE_REASON);\n }\n\n public static get EmptyColorsTexture(): never {\n return unsupported(\"GreasedLineMaterialDefaults.EmptyColorsTexture\", GREASED_LINE_REASON);\n }\n}\n\nexport function RegisterGreasedLinePluginMaterial(..._args: unknown[]): never {\n return unsupported(\"RegisterGreasedLinePluginMaterial\", GREASED_LINE_REASON);\n}\n\nexport class GreasedLineSimpleMaterial {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLineSimpleMaterial\", GREASED_LINE_REASON);\n }\n}\n\nexport class GreasedLineTools {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLineTools\", GREASED_LINE_REASON);\n }\n\n public static ConvertPoints(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.ConvertPoints\", GREASED_LINE_REASON);\n }\n\n public static OmitZeroLengthPredicate(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.OmitZeroLengthPredicate\", GREASED_LINE_REASON);\n }\n\n public static OmitDuplicatesPredicate(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.OmitDuplicatesPredicate\", GREASED_LINE_REASON);\n }\n\n public static MeshesToLines(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.MeshesToLines\", GREASED_LINE_REASON);\n }\n\n public static ToVector3Array(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.ToVector3Array\", GREASED_LINE_REASON);\n }\n\n public static ToNumberArray(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.ToNumberArray\", GREASED_LINE_REASON);\n }\n\n public static GetPointsCountInfo(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetPointsCountInfo\", GREASED_LINE_REASON);\n }\n\n public static GetLineLength(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetLineLength\", GREASED_LINE_REASON);\n }\n\n public static GetLineLengthArray(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetLineLengthArray\", GREASED_LINE_REASON);\n }\n\n public static SegmentizeSegmentByCount(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.SegmentizeSegmentByCount\", GREASED_LINE_REASON);\n }\n\n public static SegmentizeLineBySegmentLength(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.SegmentizeLineBySegmentLength\", GREASED_LINE_REASON);\n }\n\n public static SegmentizeLineBySegmentCount(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.SegmentizeLineBySegmentCount\", GREASED_LINE_REASON);\n }\n\n public static GetLineSegments(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetLineSegments\", GREASED_LINE_REASON);\n }\n\n public static GetMinMaxSegmentLength(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetMinMaxSegmentLength\", GREASED_LINE_REASON);\n }\n\n public static GetPositionOnLineByVisibility(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetPositionOnLineByVisibility\", GREASED_LINE_REASON);\n }\n\n public static GetCircleLinePoints(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetCircleLinePoints\", GREASED_LINE_REASON);\n }\n\n public static GetBezierLinePoints(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetBezierLinePoints\", GREASED_LINE_REASON);\n }\n\n public static GetArrowCap(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetArrowCap\", GREASED_LINE_REASON);\n }\n\n public static GetPointsFromText(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetPointsFromText\", GREASED_LINE_REASON);\n }\n\n public static Color3toRGBAUint8(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.Color3toRGBAUint8\", GREASED_LINE_REASON);\n }\n\n public static CreateColorsTexture(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.CreateColorsTexture\", GREASED_LINE_REASON);\n }\n\n public static PrepareEmptyColorsTexture(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.PrepareEmptyColorsTexture\", GREASED_LINE_REASON);\n }\n\n public static DisposeEmptyColorsTexture(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.DisposeEmptyColorsTexture\", GREASED_LINE_REASON);\n }\n\n public static BooleanToNumber(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.BooleanToNumber\", GREASED_LINE_REASON);\n }\n}\n\nexport function CreateGreasedLine(..._args: unknown[]): never {\n return unsupported(\"CreateGreasedLine\", GREASED_LINE_REASON);\n}\n\nexport function CreateGreasedLineMaterial(..._args: unknown[]): never {\n return unsupported(\"CreateGreasedLineMaterial\", GREASED_LINE_REASON);\n}\n\nexport function GetPointsCount(..._args: unknown[]): never {\n return unsupported(\"GetPointsCount\", GREASED_LINE_REASON);\n}\n\nexport function CompleteGreasedLineWidthTable(..._args: unknown[]): never {\n return unsupported(\"CompleteGreasedLineWidthTable\", GREASED_LINE_REASON);\n}\n\nexport function CompleteGreasedLineColorTable(..._args: unknown[]): never {\n return unsupported(\"CompleteGreasedLineColorTable\", GREASED_LINE_REASON);\n}\n\n// GreasedLine enums are pure numeric parity shape (no feature logic), mirrored\n// from BJS so ported code that references the members resolves.\nexport enum GreasedLineMeshColorDistribution {\n COLOR_DISTRIBUTION_NONE = 0,\n COLOR_DISTRIBUTION_REPEAT = 1,\n COLOR_DISTRIBUTION_EVEN = 2,\n COLOR_DISTRIBUTION_START = 3,\n COLOR_DISTRIBUTION_END = 4,\n COLOR_DISTRIBUTION_START_END = 5,\n}\n\nexport enum GreasedLineMeshWidthDistribution {\n WIDTH_DISTRIBUTION_NONE = 0,\n WIDTH_DISTRIBUTION_REPEAT = 1,\n WIDTH_DISTRIBUTION_EVEN = 2,\n WIDTH_DISTRIBUTION_START = 3,\n WIDTH_DISTRIBUTION_END = 4,\n WIDTH_DISTRIBUTION_START_END = 5,\n}\n\nexport enum GreasedLineRibbonPointsMode {\n POINTS_MODE_POINTS = 0,\n POINTS_MODE_PATHS = 1,\n}\n\nexport enum GreasedLineRibbonFacesMode {\n FACES_MODE_SINGLE_SIDED = 0,\n FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = 1,\n FACES_MODE_DOUBLE_SIDED = 2,\n}\n\nexport enum GreasedLineRibbonAutoDirectionMode {\n AUTO_DIRECTIONS_FROM_FIRST_SEGMENT = 0,\n AUTO_DIRECTIONS_FROM_ALL_SEGMENTS = 1,\n AUTO_DIRECTIONS_ENHANCED = 2,\n AUTO_DIRECTIONS_FACE_TO = 3,\n AUTO_DIRECTIONS_NONE = 99,\n}\n\nexport class EdgesRenderer {\n public constructor() {\n unsupported(\"EdgesRenderer\", \"Edge rendering is not implemented in Babylon Lite.\");\n }\n}\n\nexport class OutlineRenderer {\n public constructor() {\n unsupported(\"OutlineRenderer\", \"Mesh outline rendering is not implemented in Babylon Lite.\");\n }\n}\n\n// ─── Textures ────────────────────────────────────────────────────────\nexport class MirrorTexture {\n public constructor() {\n unsupported(\"MirrorTexture\", \"Mirror/reflection textures are not implemented in Babylon Lite. Build one from a native render-target texture + clip plane if required.\");\n }\n}\n\n// ─── HTML texture interaction (DOM/CSS overlay interop) ──────────────\n// `HtmlTexture` itself is Lite-backed in textures/textures.ts. These remaining\n// APIs bind arbitrary textures to DOM overlay/raycast and polyfill lifecycles,\n// which Lite's owned HTML-texture surface does not expose.\n\n/** Options accepted by Babylon.js `HtmlInteractionManager` (shape-only stub). */\nexport interface IHtmlInteractionManagerOptions {\n [key: string]: unknown;\n}\n\n/** Options accepted by Babylon.js `HtmlRaycastInteractionManager` (shape-only stub). */\nexport interface IHtmlRaycastInteractionManagerOptions {\n [key: string]: unknown;\n}\n\n/** Module shape of an HTML-in-canvas polyfill (shape-only stub). */\nexport interface IHtmlInCanvasPolyfillModule {\n [key: string]: unknown;\n}\n\n/** Options accepted by `InstallHtmlInCanvasPolyfill` (shape-only stub). */\nexport interface IInstallHtmlInCanvasPolyfillOptions {\n [key: string]: unknown;\n}\n\nexport class HtmlInteractionManager {\n public constructor() {\n unsupported(\"HtmlInteractionManager\", \"HTML overlay interaction is not part of Babylon Lite's WebGPU renderer.\");\n }\n}\n\nexport class HtmlRaycastInteractionManager {\n public constructor() {\n unsupported(\"HtmlRaycastInteractionManager\", \"HTML overlay raycast interaction is not part of Babylon Lite's WebGPU renderer.\");\n }\n}\n\n/** Babylon.js `IsHtmlInCanvasUploadSupported` — kept in lockstep with the unavailable upload helper. */\nexport function IsHtmlInCanvasUploadSupported(engine: AbstractEngine): boolean {\n void engine;\n return unsupported(\n \"IsHtmlInCanvasUploadSupported\",\n \"Lite's HTML texture owns its element and texture together; it cannot back BJS's arbitrary InternalTexture upload contract.\"\n );\n}\n\n/** Babylon.js `UploadHtmlElementToTexture` — HTML texture upload is unsupported by the compat layer. */\nexport function UploadHtmlElementToTexture(): never {\n return unsupported(\"UploadHtmlElementToTexture\", \"HTML-element texture upload is not supported by Babylon Lite.\");\n}\n\n/** Babylon.js `ComputeOverlayCssTransform` — HTML overlay interaction is unsupported by the compat layer. */\nexport function ComputeOverlayCssTransform(): never {\n return unsupported(\"ComputeOverlayCssTransform\", \"HTML overlay interaction is not supported by Babylon Lite.\");\n}\n\n/** Babylon.js `GetElementPixelFromUv` — HTML overlay raycast interaction is unsupported by the compat layer. */\nexport function GetElementPixelFromUv(): never {\n return unsupported(\"GetElementPixelFromUv\", \"HTML overlay raycast interaction is not supported by Babylon Lite.\");\n}\n\n/** Babylon.js `IsHtmlInCanvasSupportedNatively` — the HTML-in-canvas feature is unsupported by the compat layer. */\nexport function IsHtmlInCanvasSupportedNatively(): never {\n return unsupported(\"IsHtmlInCanvasSupportedNatively\", \"The HTML-in-canvas feature is not supported by Babylon Lite.\");\n}\n\n/** Babylon.js `InstallHtmlInCanvasPolyfill` — the HTML-in-canvas polyfill is unsupported by the compat layer. */\nexport function InstallHtmlInCanvasPolyfill(): never {\n return unsupported(\"InstallHtmlInCanvasPolyfill\", \"The HTML-in-canvas polyfill is not supported by Babylon Lite.\");\n}\n\n/** Babylon.js `UninstallHtmlInCanvasPolyfill` — the HTML-in-canvas polyfill is unsupported by the compat layer. */\nexport function UninstallHtmlInCanvasPolyfill(): never {\n return unsupported(\"UninstallHtmlInCanvasPolyfill\", \"The HTML-in-canvas polyfill is not supported by Babylon Lite.\");\n}\n\n// ─── Audio ───────────────────────────────────────────────────────────\nexport class Sound {\n public constructor() {\n unsupported(\"Sound\", \"Audio is not part of Babylon Lite. Use the Web Audio API directly.\");\n }\n}\n\n// ─── Behaviors (mesh + camera) ───────────────────────────────────────\n// Babylon Lite exposes a utility-layer pointer-drag dispatcher\n// (`createPointerDrag` / `registerPointerDrag`) used by its gizmos, but it does\n// not expose the main-scene mesh-dragging, XR/multi-pointer, follow, or\n// geospatial camera behaviors these BJS classes provide, so each is a throwing\n// stub. The camera behaviors that Lite *can* back (`AutoRotationBehavior`,\n// `BouncingBehavior`, `FramingBehavior`) live in `behaviors/behaviors.ts`.\nexport class PointerDragBehavior {\n public constructor() {\n unsupported(\n \"PointerDragBehavior\",\n \"Babylon Lite's pointer-drag (`createPointerDrag`) only drives utility-layer gizmo colliders, not arbitrary main-scene meshes, so mesh drag-behaviors cannot be wrapped.\"\n );\n }\n}\n\nexport class BaseSixDofDragBehavior {\n public constructor() {\n unsupported(\"BaseSixDofDragBehavior\", \"Six-DoF mesh dragging is not implemented in Babylon Lite.\");\n }\n}\n\nexport class SixDofDragBehavior {\n public constructor() {\n unsupported(\"SixDofDragBehavior\", \"Six-DoF mesh dragging is not implemented in Babylon Lite.\");\n }\n}\n\nexport class MultiPointerScaleBehavior {\n public constructor() {\n unsupported(\"MultiPointerScaleBehavior\", \"Multi-pointer scaling is not implemented in Babylon Lite.\");\n }\n}\n\nexport class AttachToBoxBehavior {\n public constructor() {\n unsupported(\"AttachToBoxBehavior\", \"Bounding-box attachment (app-bar UI) is not implemented in Babylon Lite.\");\n }\n}\n\nexport class FadeInOutBehavior {\n public constructor() {\n unsupported(\"FadeInOutBehavior\", \"Mesh fade-in/out visibility tweening is not implemented in Babylon Lite.\");\n }\n}\n\nexport class SurfaceMagnetismBehavior {\n public constructor() {\n unsupported(\"SurfaceMagnetismBehavior\", \"Surface magnetism (mesh snapping) is not implemented in Babylon Lite.\");\n }\n}\n\nexport class FollowBehavior {\n public constructor() {\n unsupported(\"FollowBehavior\", \"Camera-follow behavior is not implemented in Babylon Lite.\");\n }\n}\n\nexport class HandConstraintBehavior {\n public constructor() {\n unsupported(\"HandConstraintBehavior\", \"WebXR hand-constraint behavior is out of scope for Babylon Lite.\");\n }\n}\n\nexport class InterpolatingBehavior {\n public constructor() {\n unsupported(\"InterpolatingBehavior\", \"The interpolating camera behavior is not implemented in Babylon Lite.\");\n }\n}\n\nexport class GeospatialClippingBehavior {\n public constructor() {\n unsupported(\"GeospatialClippingBehavior\", \"Geospatial camera clipping is not implemented in Babylon Lite.\");\n }\n}\n\n// ─── Serialization ───────────────────────────────────────────────────\n/** Babylon.js scene serializer. Babylon Lite uses different data structures and does not round-trip `.babylon`. */\nexport const SceneSerializer = {\n Serialize(): never {\n return unsupported(\"SceneSerializer.Serialize\", \"Babylon Lite does not implement `.babylon` scene serialization.\");\n },\n SerializeMesh(): never {\n return unsupported(\"SceneSerializer.SerializeMesh\", \"Babylon Lite does not implement mesh serialization.\");\n },\n};\n","import {\n createKhrInteractivityRuntimeValueSnapshot,\n hasDefaultInteractivityFlowInput,\n normalizeInteractivityEventDataConfiguration,\n normalizeKhrInteractivityRuntimeValue,\n} from \"babylon-lite\";\n\nimport type { AnimationGroup } from \"../animations/animation.js\";\nimport type { Camera } from \"../cameras/cameras.js\";\nimport { unsupported } from \"../error.js\";\nimport type { Material } from \"../materials/materials.js\";\nimport type { Node } from \"../node/node.js\";\n\nconst KHR_INTERACTIVITY_UNSUPPORTED =\n \"KHR_interactivity depends on Babylon.js FlowGraph block, connection, context, serialization, and glTF-reference models. Lite's flow-graph runtime uses a different graph model, so a stable cross-model adapter requires a broader loader/runtime design.\";\nconst KHR_INTERACTIVITY_EXPORT_UNSUPPORTED =\n \"KHR_interactivity export planning depends on Babylon.js FlowGraph block provenance and the Babylon.js glTF serializer's final entity-index remapping context. Lite exposes a different runtime graph model and no glTF serializer.\";\n\nexport type KHRInteractivitySignature = \"bool\" | \"float\" | \"float2\" | \"float3\" | \"float4\" | \"float2x2\" | \"float3x3\" | \"float4x4\" | \"int\" | \"ref\" | \"custom\";\n\nexport interface IKHRInteractivityNode {\n declaration: number;\n values?: Record<string, IKHRInteractivityVariable | IKHRInteractivityOutputSocketReference>;\n flows?: Record<string, IKHRInteractivityOutputFlow>;\n configuration?: Record<string, IKHRInteractivityConfiguration>;\n}\n\nexport interface IKHRInteractivityGraph {\n name?: string;\n types?: IKHRInteractivityType[];\n variables?: IKHRInteractivityVariable[];\n events?: IKHRInteractivityEvent[];\n declarations?: IKHRInteractivityDeclaration[];\n nodes?: IKHRInteractivityNode[];\n}\n\nexport interface IKHRInteractivityDeclaration {\n op: string;\n extension?: string;\n outputValueSockets?: Record<string, { type: number }>;\n inputValueSockets?: Record<string, { type: number }>;\n}\n\nexport interface IKHRInteractivityType {\n signature: KHRInteractivitySignature;\n}\n\nexport interface IKHRInteractivityVariable {\n value?: Array<boolean | number | string>;\n type: number;\n}\n\nexport interface IKHRInteractivityEvent {\n id?: string;\n values?: Record<string, IKHRInteractivityVariable>;\n}\n\nexport interface IKHRInteractivityOutputSocketReference {\n node: number;\n socket?: string;\n type?: number;\n}\n\nexport interface IKHRInteractivityOutputFlow {\n node: number;\n socket?: string;\n}\n\nexport interface IKHRInteractivityConfiguration {\n value?: Array<boolean | number | string>;\n}\n\nexport interface IGLTF {\n asset: {\n version: string;\n };\n nodes?: unknown[];\n}\n\nexport interface ISerializedFlowGraphConnection {\n uniqueId: string;\n name: string;\n // eslint-disable-next-line babylon-lite/underscore-requires-internal -- Public Babylon.js field.\n _connectionType: number;\n connectedPointIds: string[];\n defaultValue?: unknown;\n}\n\nexport interface ISerializedFlowGraphBlock {\n className: string;\n type: string;\n config: unknown;\n uniqueId: string;\n dataInputs: ISerializedFlowGraphConnection[];\n dataOutputs: ISerializedFlowGraphConnection[];\n metadata: unknown;\n signalInputs: ISerializedFlowGraphConnection[];\n signalOutputs: ISerializedFlowGraphConnection[];\n}\n\nexport type ISerializedFlowGraphContext = {\n uniqueId: string;\n name?: string;\n enableLogging?: boolean;\n} & Record<\"_userVariables\" | \"_connectionValues\", Record<string, unknown>> &\n Partial<Record<\"_variableTypes\", Record<string, string>>> &\n Partial<Record<\"_assetsContext\", Record<string, unknown>>>;\n\nexport interface ISerializedFlowGraph {\n name?: string;\n uniqueId?: string;\n executionContexts: ISerializedFlowGraphContext[];\n allBlocks: ISerializedFlowGraphBlock[];\n rightHanded?: boolean;\n}\n\ntype CompatibleCallback<TArgs extends unknown[], TResult> = {\n bivarianceHack(...args: TArgs): TResult;\n}[\"bivarianceHack\"];\n\nexport interface IGLTFToFlowGraphMappingObject {\n name: string;\n compatibilityOnly?: boolean;\n gltfType?: string;\n flowGraphType?: string;\n // Babylon.js intentionally exposes `any` here so explicitly typed transformers remain assignable under strictFunctionTypes.\n dataTransformer?: (data: any, parser: InteractivityGraphToFlowGraphParser) => any;\n isArray?: boolean;\n inOptions?: boolean;\n isVariable?: boolean;\n toBlock?: string;\n defaultValue?: unknown;\n convertConnectedTimeToFrames?: boolean;\n configurationType?: \"bool\" | \"int\" | \"int[]\" | \"string\";\n validationOnly?: boolean;\n required?: boolean;\n indexSource?: \"types\" | \"variables\" | \"events\" | \"nodes\" | \"assetNodes\";\n minItems?: number;\n generatesInputValueSockets?: boolean;\n generatesCaseInputValueSockets?: boolean;\n pointerTemplate?: boolean;\n invalidUsesDefault?: boolean;\n allowedSignatures?: readonly KHRInteractivitySignature[];\n typeSourceInput?: string;\n minimum?: number;\n maximum?: number;\n generatesInputFlowSockets?: boolean;\n generatesOutputFlowSockets?: boolean;\n configurationGroup?: string;\n uniqueValues?: boolean;\n debugLogTemplate?: boolean;\n}\n\nexport interface IGLTFToFlowGraphMapping {\n blocks: string[];\n declarationSchema?: {\n inputValueSockets: Record<string, KHRInteractivitySignature>;\n outputValueSockets: Record<string, KHRInteractivitySignature>;\n };\n inputs?: {\n values?: Record<string, IGLTFToFlowGraphMappingObject>;\n flows?: Record<string, IGLTFToFlowGraphMappingObject>;\n };\n outputs?: {\n values?: Record<string, IGLTFToFlowGraphMappingObject>;\n flows?: Record<string, IGLTFToFlowGraphMappingObject>;\n };\n configuration?: Record<string, IGLTFToFlowGraphMappingObject>;\n typeToTypeMapping?: Record<string, IGLTFToFlowGraphMappingObject>;\n interBlockConnectors?: Array<{\n input: string;\n output: string;\n inputBlockIndex: number;\n outputBlockIndex: number;\n isVariable?: boolean;\n }>;\n validation?: CompatibleCallback<[gltfBlock: IKHRInteractivityNode, interactivityGraph: IKHRInteractivityGraph, glTFObject?: IGLTF], { valid: boolean; error?: string }>;\n extraProcessor?: CompatibleCallback<\n [\n gltfBlock: IKHRInteractivityNode,\n declaration: IKHRInteractivityDeclaration,\n mapping: IGLTFToFlowGraphMapping,\n parser: InteractivityGraphToFlowGraphParser,\n serializedObjects: ISerializedFlowGraphBlock[],\n context: ISerializedFlowGraphContext,\n globalGLTF?: IGLTF,\n ],\n ISerializedFlowGraphBlock[]\n >;\n}\n\nexport interface IKHRInteractivityOperationRegistryEntry {\n op: string;\n extension?: string;\n mapping: IGLTFToFlowGraphMapping;\n}\n\nexport interface IDebugLogTemplateParseResult {\n valid: boolean;\n sockets: string[];\n}\n\nexport function ParseDebugLogTemplate(_message: string): IDebugLogTemplateParseResult {\n return unsupported(\"GLTF2.ParseDebugLogTemplate\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function getMappingForFullOperationName(_operation: string): IGLTFToFlowGraphMapping | undefined {\n return unsupported(\"GLTF2.getMappingForFullOperationName\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function getMappingForDeclaration(_declaration: unknown, _returnNoOpIfNotAvailable = true): IGLTFToFlowGraphMapping | undefined {\n return unsupported(\"GLTF2.getMappingForDeclaration\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function getNoOpMappingForDeclaration(_declaration: unknown): IGLTFToFlowGraphMapping {\n return unsupported(\"GLTF2.getNoOpMappingForDeclaration\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function addNewInteractivityFlowGraphMapping(_key: string, _extension: string, _mapping: IGLTFToFlowGraphMapping): void {\n unsupported(\"GLTF2.addNewInteractivityFlowGraphMapping\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function getAllSupportedNativeNodeTypes(): string[] {\n return unsupported(\"GLTF2.getAllSupportedNativeNodeTypes\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function HasDefaultInteractivityFlowInput(operation: string): boolean {\n return hasDefaultInteractivityFlowInput(operation);\n}\n\nexport function NormalizeInteractivityEventDataConfiguration(value: unknown): unknown {\n return normalizeInteractivityEventDataConfiguration(value);\n}\n\nexport function GetInteractivityOperationRegistry(): readonly IKHRInteractivityOperationRegistryEntry[] {\n return unsupported(\"GLTF2.GetInteractivityOperationRegistry\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport type KHRInteractivityFlowGraphType =\n | \"any\"\n | \"string\"\n | \"number\"\n | \"boolean\"\n | \"object\"\n | \"FlowGraphInteger\"\n | \"Vector2\"\n | \"Vector3\"\n | \"Vector4\"\n | \"Quaternion\"\n | \"Matrix\"\n | \"Matrix2D\"\n | \"Matrix3D\"\n | \"Color3\"\n | \"Color4\";\n\nexport interface IKHRInteractivityTypeMapping {\n length: number;\n flowGraphType: KHRInteractivityFlowGraphType;\n elementType: \"number\" | \"boolean\" | \"string\" | \"any\";\n}\n\nexport const gltfTypeToBabylonType: Readonly<Record<string, IKHRInteractivityTypeMapping>> = {\n float: { length: 1, flowGraphType: \"number\", elementType: \"number\" },\n bool: { length: 1, flowGraphType: \"boolean\", elementType: \"boolean\" },\n float2: { length: 2, flowGraphType: \"Vector2\", elementType: \"number\" },\n float3: { length: 3, flowGraphType: \"Vector3\", elementType: \"number\" },\n float4: { length: 4, flowGraphType: \"Vector4\", elementType: \"number\" },\n float4x4: { length: 16, flowGraphType: \"Matrix\", elementType: \"number\" },\n float2x2: { length: 4, flowGraphType: \"Matrix2D\", elementType: \"number\" },\n float3x3: { length: 9, flowGraphType: \"Matrix3D\", elementType: \"number\" },\n int: { length: 1, flowGraphType: \"FlowGraphInteger\", elementType: \"number\" },\n ref: { length: 1, flowGraphType: \"string\", elementType: \"string\" },\n custom: { length: 0, flowGraphType: \"any\", elementType: \"any\" },\n};\n\nexport interface IFlowGraphEventReferenceBlockConfiguration {\n eventKey?: string;\n [key: string]: unknown;\n}\n\nexport class FlowGraphEventReferenceBlock {\n public readonly config: IFlowGraphEventReferenceBlockConfiguration;\n\n public constructor(config: IFlowGraphEventReferenceBlockConfiguration) {\n this.config = config;\n unsupported(\"GLTF2.FlowGraphEventReferenceBlock\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n}\n\nexport interface IFlowGraphGLTFDataProviderBlockConfiguration {\n glTF?: unknown;\n [key: string]: unknown;\n}\n\nexport class FlowGraphGLTFDataProvider {\n public constructor(_config: IFlowGraphGLTFDataProviderBlockConfiguration = {}) {\n unsupported(\"GLTF2.FlowGraphGLTFDataProvider\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n}\n\nexport function GetInteractivityObjectReference(_context: unknown, _value: object | undefined): string {\n return unsupported(\"GLTF2.GetInteractivityObjectReference\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport class FlowGraphObjectReferenceBlock {\n public constructor(_config: Record<string, unknown> = {}) {\n unsupported(\"GLTF2.FlowGraphObjectReferenceBlock\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n}\n\nexport interface IFlowGraphUnsupportedInteractivitySocket {\n name: string;\n type?: string;\n signature?: string;\n}\n\nexport interface IFlowGraphUnsupportedInteractivityBlockConfiguration {\n operation: string;\n inputValueSockets: IFlowGraphUnsupportedInteractivitySocket[];\n outputValueSockets: IFlowGraphUnsupportedInteractivitySocket[];\n inputFlowSockets: string[];\n outputFlowSockets: string[];\n [key: string]: unknown;\n}\n\nexport class FlowGraphUnsupportedInteractivityBlock {\n public readonly config: IFlowGraphUnsupportedInteractivityBlockConfiguration;\n\n public constructor(config: IFlowGraphUnsupportedInteractivityBlockConfiguration) {\n this.config = config;\n unsupported(\"GLTF2.FlowGraphUnsupportedInteractivityBlock\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n}\n\nexport const KHR_INTERACTIVITY_SPECIFICATION_COMMIT = \"f798712c5685bc9223a628140fba707db8889300\";\n\nexport type KHRInteractivityDeclarationSupport = \"core\" | \"extension\" | \"unsupported-extension\" | \"unknown-core\";\n\nexport interface IKHRInteractivityDiagnostic {\n path: string;\n message: string;\n severity: \"error\" | \"warning\";\n}\n\nexport interface IKHRInteractivityDeclarationModel {\n index: number;\n operation: string;\n support: KHRInteractivityDeclarationSupport;\n source: IKHRInteractivityDeclaration;\n}\n\nexport interface IKHRInteractivityGraphModel {\n index: number;\n path: string;\n name: string;\n source: unknown;\n effectiveSource: unknown;\n declarations: IKHRInteractivityDeclarationModel[];\n diagnostics: IKHRInteractivityDiagnostic[];\n valid: boolean;\n}\n\nexport interface IKHRInteractivityInputDefaultProvenance {\n runtimeValueFingerprint?: string;\n unrepresentable?: true;\n}\n\nexport interface IKHRInteractivityConfigurationProvenance {\n sourceValue?: unknown[];\n runtimeValue?: unknown;\n}\n\nexport interface IKHRInteractivityBlockProvenance {\n graphIndex: number;\n nodeIndex: number;\n declarationIndex: number;\n operation: string;\n role: number;\n sourcePath: string;\n configuration?: Record<string, IKHRInteractivityConfigurationProvenance>;\n generatedConfiguration?: Record<string, unknown>;\n generatedConfigurationRuntime?: Record<string, IKHRInteractivityInputDefaultProvenance>;\n generatedInputDefaults?: Record<string, IKHRInteractivityInputDefaultProvenance>;\n}\n\nexport interface IKHRInteractivitySocketProvenance extends IKHRInteractivityBlockProvenance {\n kind: \"value\" | \"flow\";\n direction: \"input\" | \"output\";\n socket: string;\n sourceValue?: IKHRInteractivityVariable | IKHRInteractivityOutputSocketReference;\n runtimeValue?: unknown[];\n runtimeValueSnapshot?: IKHRInteractivityInputDefaultProvenance;\n}\n\nexport interface IKHRInteractivityGraphProvenance {\n graphIndex: number;\n specificationCommit: string;\n source: IKHRInteractivityGraph;\n authoredVariableValues?: Record<number, unknown[]>;\n authoredVariableTypes?: Record<number, string>;\n authoredVariableStructureChanged?: boolean;\n}\n\nexport function _NormalizeKHRInteractivityRuntimeValue(value: unknown): unknown[] | undefined {\n return normalizeKhrInteractivityRuntimeValue(value);\n}\n\nexport function _CreateKHRInteractivityRuntimeValueSnapshot(value: unknown): IKHRInteractivityInputDefaultProvenance {\n return createKhrInteractivityRuntimeValueSnapshot(value);\n}\n\nexport interface IKHRInteractivityDocument {\n specificationCommit: string;\n source: unknown;\n defaultGraphIndex: number;\n graphs: IKHRInteractivityGraphModel[];\n diagnostics: IKHRInteractivityDiagnostic[];\n}\n\nexport function CloneKHRInteractivityGraph(_graph: unknown): never {\n return unsupported(\"GLTF2.CloneKHRInteractivityGraph\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function CreateEffectiveKHRInteractivityGraph(_graph: unknown, _declarations: readonly IKHRInteractivityDeclarationModel[], _assetNodeCount?: number): never {\n return unsupported(\"GLTF2.CreateEffectiveKHRInteractivityGraph\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function CreateKHRInteractivityGraphModel(_graph: unknown, _index = 0, _supportedExtensions?: ReadonlySet<string>, _assetNodeCount?: number): IKHRInteractivityGraphModel {\n return unsupported(\"GLTF2.CreateKHRInteractivityGraphModel\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function CreateKHRInteractivityDocument(_extension: unknown, _supportedExtensions?: ReadonlySet<string>, _assetNodeCount?: number): IKHRInteractivityDocument {\n return unsupported(\"GLTF2.CreateKHRInteractivityDocument\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function _CaptureKHRInteractivityRuntimeInputDefaults(_flowGraph: unknown): void {\n unsupported(\"GLTF2._CaptureKHRInteractivityRuntimeInputDefaults\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport type KHRInteractivityExportClassification = \"exact\" | \"inverse-composite\" | \"unsupported\" | \"lossy\";\n\nexport interface IKHRInteractivityExportDiagnostic {\n code:\n | \"GRAPH_SOURCE_MISSING\"\n | \"GRAPH_COUNT_MISMATCH\"\n | \"NODE_SOURCE_MISSING\"\n | \"BLOCK_PROVENANCE_INVALID\"\n | \"BLOCK_ROLE_MISSING\"\n | \"BLOCK_ROLE_DUPLICATE\"\n | \"BLOCK_TYPE_MISMATCH\"\n | \"BLOCK_UNSUPPORTED\"\n | \"BLOCK_AMBIGUOUS\"\n | \"COMPOSITE_CONNECTION_CHANGED\"\n | \"SOCKET_PROVENANCE_MISSING\"\n | \"SOCKET_CONNECTION_AMBIGUOUS\"\n | \"SOCKET_TARGET_UNREPRESENTABLE\"\n | \"INPUT_DEFAULT_UNREPRESENTABLE\"\n | \"VALUE_UNREPRESENTABLE\"\n | \"CONFIGURATION_UNREPRESENTABLE\"\n | \"REFERENCE_UNRESOLVED\"\n | \"DEPENDENCY_CYCLE\"\n | \"GRAPH_INVALID\";\n path: string;\n message: string;\n severity: \"error\" | \"warning\";\n graphIndex?: number;\n nodeIndex?: number;\n blockId?: string;\n socket?: string;\n}\n\nexport interface IKHRInteractivityNodeExportAnalysis {\n graphIndex: number;\n nodeIndex?: number;\n operation?: string;\n blockIds: string[];\n classification: KHRInteractivityExportClassification;\n diagnostics: IKHRInteractivityExportDiagnostic[];\n}\n\nexport interface IKHRInteractivityExportAnalysis {\n representable: boolean;\n nodes: IKHRInteractivityNodeExportAnalysis[];\n diagnostics: IKHRInteractivityExportDiagnostic[];\n}\n\nexport type KhrInteractivityRootCollection = \"nodes\" | \"animations\" | \"cameras\" | \"materials\" | \"meshes\" | \"textures\" | \"images\" | \"samplers\" | \"skins\" | \"scenes\";\n\nexport interface IKHRInteractivitySerializerContext {\n getNodeCount(): number;\n getNodeIndex(node: Node): number | undefined;\n getAnimationIndex(animation: AnimationGroup): number | undefined;\n getCameraIndex(camera: Camera): number | undefined;\n getMaterialIndex(material: Material): number | undefined;\n getRootIndex?(collection: KhrInteractivityRootCollection, entity: object): number | undefined;\n setNodeExtension(nodeIndex: number, extensionName: string, value: unknown): void;\n}\n\nexport interface IKHRInteractivityExportProvider {\n readonly required: boolean;\n readonly additionalExtensionsUsed: readonly string[];\n readonly additionalExtensionsRequired: readonly string[];\n analyze(): IKHRInteractivityExportAnalysis;\n build(context: IKHRInteractivitySerializerContext): unknown;\n}\n\nexport interface IKHRInteractivityExportOptions {\n document?: IKHRInteractivityDocument;\n sourceGLTF?: IGLTF;\n defaultGraphIndex?: number;\n targetFps?: number;\n required?: boolean;\n additionalExtensionsRequired?: readonly string[];\n}\n\nexport class KHRInteractivityExportError extends Error {\n public constructor(public readonly diagnostics: readonly IKHRInteractivityExportDiagnostic[]) {\n super(diagnostics.map((diagnostic) => `${diagnostic.path}: ${diagnostic.message}`).join(\"\\n\"));\n this.name = \"KHRInteractivityExportError\";\n }\n}\n\nexport class KHRInteractivityExportPlan implements IKHRInteractivityExportProvider {\n public readonly required = true;\n public readonly additionalExtensionsUsed: readonly string[] = [];\n public readonly additionalExtensionsRequired: readonly string[] = [];\n\n public constructor(_flowGraphs: readonly unknown[], _options: IKHRInteractivityExportOptions = {}) {\n unsupported(\"GLTF2.KHRInteractivityExportPlan\", KHR_INTERACTIVITY_EXPORT_UNSUPPORTED);\n }\n\n public analyze(): IKHRInteractivityExportAnalysis {\n return unsupported(\"GLTF2.KHRInteractivityExportPlan.analyze\", KHR_INTERACTIVITY_EXPORT_UNSUPPORTED);\n }\n\n public build(_context: IKHRInteractivitySerializerContext): unknown {\n return unsupported(\"GLTF2.KHRInteractivityExportPlan.build\", KHR_INTERACTIVITY_EXPORT_UNSUPPORTED);\n }\n}\n\nexport function CreateKHRInteractivityExportPlan(flowGraphs: readonly unknown[], options: IKHRInteractivityExportOptions = {}): KHRInteractivityExportPlan {\n return new KHRInteractivityExportPlan(flowGraphs, options);\n}\n\nexport interface InteractivityEvent {\n eventId: string;\n eventData?: Array<{\n eventData: boolean;\n id: string;\n type: string;\n value?: unknown;\n }>;\n}\n\nexport class InteractivityGraphToFlowGraphParser {\n /** @internal Upstream parser timing state; the parser itself is unsupported. */\n public _animationTargetFps: number;\n\n public constructor(\n _interactivityGraph: unknown,\n _gltf: unknown,\n animationTargetFps = 60,\n _graphIndex = 0,\n _supportedExtensions?: ReadonlySet<string>,\n _declarationModels?: readonly IKHRInteractivityDeclarationModel[]\n ) {\n this._animationTargetFps = animationTargetFps;\n unsupported(\"GLTF2.InteractivityGraphToFlowGraphParser\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n\n public getVariableName(_index: number): string {\n return unsupported(\"GLTF2.InteractivityGraphToFlowGraphParser.getVariableName\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n\n public get arrays(): {\n types: IKHRInteractivityTypeMapping[];\n mappings: Array<{\n flowGraphMapping: IGLTFToFlowGraphMapping;\n fullOperationName: string;\n declaration: IKHRInteractivityDeclarationModel;\n }>;\n staticVariables: Array<{ type: KHRInteractivityFlowGraphType; value: any[] }>;\n events: InteractivityEvent[];\n nodes: Array<{ blocks: ISerializedFlowGraphBlock[]; fullOperationName: string }>;\n } {\n return unsupported(\"GLTF2.InteractivityGraphToFlowGraphParser.arrays\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n\n public serializeToFlowGraph(): ISerializedFlowGraph {\n return unsupported(\"GLTF2.InteractivityGraphToFlowGraphParser.serializeToFlowGraph\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n}\n\nexport type InteractivityNodeState = \"hoverable\" | \"selectable\";\n\nexport function InitializeInteractivityNodeState(_nodes: readonly unknown[], _state: InteractivityNodeState, _getAuthoredState: (node: unknown) => boolean | undefined): void {\n unsupported(\"GLTF2.InitializeInteractivityNodeState\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function GetInteractivityNodeState(_node: unknown, _state: InteractivityNodeState): boolean {\n return unsupported(\"GLTF2.GetInteractivityNodeState\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function SetInteractivityNodeState(_node: unknown, _state: InteractivityNodeState, _value: boolean): void {\n unsupported(\"GLTF2.SetInteractivityNodeState\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n","export { OpenPBRMaterialLoadingAdapter } from \"../unsupported/unsupported-apis.js\";\nexport * from \"./unsupported-khr-interactivity.js\";\n","import { unsupported } from \"../error.js\";\n\nconst GLTF1_UNSUPPORTED = \"Babylon Lite only implements glTF 2.0; glTF 1.0 needs a separate parser, extension registry, and material conversion subsystem.\";\n\nexport class GLTFLoaderBase {\n public constructor(..._args: unknown[]) {\n unsupported(\"GLTF1.GLTFLoaderBase\", GLTF1_UNSUPPORTED);\n }\n}\n\nexport class GLTFLoader {\n public constructor(..._args: unknown[]) {\n unsupported(\"GLTF1.GLTFLoader\", GLTF1_UNSUPPORTED);\n }\n}\n\nexport class GLTFBinaryExtension {\n public constructor(..._args: unknown[]) {\n unsupported(\"GLTF1.GLTFBinaryExtension\", GLTF1_UNSUPPORTED);\n }\n}\n\nexport class GLTFMaterialsCommonExtension {\n public constructor(..._args: unknown[]) {\n unsupported(\"GLTF1.GLTFMaterialsCommonExtension\", GLTF1_UNSUPPORTED);\n }\n}\n\nexport function RegisterGLTF1Loader(): void {\n unsupported(\"GLTF1.RegisterGLTF1Loader\", GLTF1_UNSUPPORTED);\n}\n\nexport function RegisterGLTFBinaryExtension(): void {\n unsupported(\"GLTF1.RegisterGLTFBinaryExtension\", GLTF1_UNSUPPORTED);\n}\n\nexport function RegisterGLTFMaterialsCommonExtension(): void {\n unsupported(\"GLTF1.RegisterGLTFMaterialsCommonExtension\", GLTF1_UNSUPPORTED);\n}\n","import { unsupported } from \"../error.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { BaseTexture } from \"../textures/textures.js\";\nimport type { BoundingInfo } from \"../culling/bounding.js\";\nimport type { Vector3 } from \"../math/vector.js\";\nimport { Mesh } from \"./meshes.js\";\nimport { GaussianSplattingMesh } from \"./gaussian-splatting.js\";\n\ninterface ISOGLODEntry {\n file: number;\n offset: number;\n count: number;\n}\n\ninterface ISOGLODNode {\n bound: { min: number[]; max: number[] };\n children?: ISOGLODNode[];\n lods?: Record<string, ISOGLODEntry>;\n}\n\n/** Babylon.js parsed PlayCanvas-style `lod-meta.json` shape. */\nexport interface ISOGLODMetadata {\n lodLevels: number;\n filenames: string[];\n environment?: string;\n tree: ISOGLODNode;\n}\n\nexport type GaussianSplattingStreamDebugLodSource = \"optimal\" | \"current\";\n\nexport type GaussianSplattingStreamLod0SplatCount = Readonly<{ status: \"pending\" }> | Readonly<{ status: \"available\"; count: number }> | Readonly<{ status: \"unavailable\" }>;\n\nexport interface IGaussianSplattingStreamOptions {\n deflateURL?: string;\n fflate?: unknown;\n debugDisplay?: boolean;\n debugLodSource?: GaussianSplattingStreamDebugLodSource;\n lodBaseDistance?: number;\n lodMultiplier?: number;\n lodBehindPenalty?: number;\n lodRangeMin?: number;\n lodRangeMax?: number;\n maxDecodesPerFrame?: number;\n lodCooldownFrames?: number;\n lodUpdateInterval?: number;\n lodUpdateDistance?: number;\n maxDetailLod?: number;\n frustumCulling?: boolean;\n maxConcurrentDownloads?: number;\n maxDownloadRetries?: number;\n memoryBudgetMb?: number;\n maxResidentSplats?: number;\n evictionCooldownFrames?: number;\n splatBudget?: number | \"auto\";\n hostCompound?: GaussianSplattingMesh;\n decodeSh?: boolean;\n needsRotationScale?: boolean;\n}\n\nexport interface IGaussianSplattingStreamingPart {\n readonly proxy: GaussianSplattingPartProxyMesh;\n readonly partIndex: number;\n readonly base: number;\n readonly capacity: number;\n readonly centersTexture: BaseTexture | null;\n readonly covariancesATexture: BaseTexture | null;\n readonly covariancesBTexture: BaseTexture | null;\n readonly colorsTexture: BaseTexture | null;\n readonly splatPositions: Float32Array | null;\n readonly mrtAtlas: unknown | null;\n readonly shMrtAtlas: unknown[] | null;\n readonly rotMrtAtlas: unknown | null;\n readonly atlasWidth: number;\n readonly isDepthSortSettled: boolean;\n setActiveRanges(localRanges: readonly { offset: number; count: number }[] | null): void;\n writeSplats(localOffset: number, count: number, splatsData: ArrayBuffer | ArrayBufferView): void;\n postPositionsRange(localOffset: number, count: number): void;\n expandBounds(min: Vector3, max: Vector3): void;\n notifyDataChanged(): void;\n onBeforeAtlasRebuild(callback: (oldAtlas: unknown) => void): () => void;\n onAfterAtlasRebuild(callback: (newAtlas: unknown) => void): () => void;\n}\n\nconst STREAM_BLOCKER =\n \"Lite's native streamer accepts only an HTTP(S) manifest URL and combines selection capacity with a mandatory render cap. Babylon.js constructs synchronously from parsed metadata, applies a distinct SOG coordinate transform, and independently controls render budget, residency, compound hosting, and cancellation. Bridging those lifecycle/policy differences requires a new Lite stream-construction contract.\";\n\nconst COMPOUND_BLOCKER = \"Lite streams one independently rendered scene node and has no compound-mesh atlas reservation/proxy lifecycle to adapt.\";\n\nfunction unsupportedProxyConstruction(_name: string): never {\n return unsupported(\"GaussianSplattingPartProxyMesh\", COMPOUND_BLOCKER);\n}\n\nexport class GaussianSplattingPartProxyMesh extends Mesh {\n public readonly compoundSplatMesh: GaussianSplattingMesh;\n /** @internal */\n public readonly _vertexCount: number;\n /** @internal */\n public readonly _splatsDataOffset: number;\n /** @internal */\n public readonly _shDataOffset: number;\n private readonly _partIndex: number;\n private _visibility = 1;\n\n public constructor(\n name: string,\n _scene: Scene | null,\n compoundSplatMesh: GaussianSplattingMesh,\n partIndex: number,\n _boundingInfo: BoundingInfo,\n vertexCount: number,\n splatsDataOffset: number,\n shDataOffset = splatsDataOffset\n ) {\n super(unsupportedProxyConstruction(name));\n this.compoundSplatMesh = compoundSplatMesh;\n this._partIndex = partIndex;\n this._vertexCount = vertexCount;\n this._splatsDataOffset = splatsDataOffset;\n this._shDataOffset = shDataOffset;\n }\n\n public get partIndex(): number {\n return this._partIndex;\n }\n\n public get proxiedMesh(): GaussianSplattingMesh {\n return this.compoundSplatMesh;\n }\n\n public override getClassName(): string {\n return \"GaussianSplattingPartProxyMesh\";\n }\n\n public override get isVisible(): boolean {\n return this._visibility > 0;\n }\n public override set isVisible(value: boolean) {\n this._visibility = value ? 1 : 0;\n }\n\n public get visibility(): number {\n return this._visibility;\n }\n public set visibility(value: number) {\n this._visibility = Math.max(0, Math.min(1, value));\n }\n\n public updateBoundingInfoFromPartData(): never {\n return unsupported(\"GaussianSplattingPartProxyMesh.updateBoundingInfoFromPartData\", COMPOUND_BLOCKER);\n }\n\n public updateBoundingInfoFromProxiedMesh(): never {\n return unsupported(\"GaussianSplattingPartProxyMesh.updateBoundingInfoFromProxiedMesh\", COMPOUND_BLOCKER);\n }\n\n public updatePartIndex(_newPartIndex: number): never {\n return unsupported(\"GaussianSplattingPartProxyMesh.updatePartIndex\", COMPOUND_BLOCKER);\n }\n\n public updatePartMetadata(_vertexCount: number, _splatsDataOffset: number, _shDataOffset = _splatsDataOffset): never {\n return unsupported(\"GaussianSplattingPartProxyMesh.updatePartMetadata\", COMPOUND_BLOCKER);\n }\n}\n\n/** Babylon.js `GaussianSplattingStream` exact-shape stub pending a compatible Lite construction contract. */\nexport class GaussianSplattingStream extends GaussianSplattingMesh {\n public static IsLODMetadata(data: unknown): data is ISOGLODMetadata {\n if (!data || typeof data !== \"object\") {\n return false;\n }\n const metadata = data as Partial<ISOGLODMetadata>;\n return typeof metadata.lodLevels === \"number\" && Array.isArray(metadata.filenames) && !!metadata.tree && typeof metadata.tree === \"object\";\n }\n\n public constructor(name: string, _metadata: ISOGLODMetadata, _rootUrl: string, scene: Scene, _options: IGaussianSplattingStreamOptions = {}) {\n super(name, null, scene, false);\n unsupported(\"GaussianSplattingStream\", STREAM_BLOCKER);\n }\n\n public override getClassName(): string {\n return \"GaussianSplattingStream\";\n }\n\n public isReady(_completeCheck = false): never {\n return unsupported(\"GaussianSplattingStream.isReady\", STREAM_BLOCKER);\n }\n\n public get streamingPartProxy(): never {\n return unsupported(\"GaussianSplattingStream.streamingPartProxy\", COMPOUND_BLOCKER);\n }\n\n public whenPartReadyAsync(): Promise<never> {\n return unsupported(\"GaussianSplattingStream.whenPartReadyAsync\", COMPOUND_BLOCKER);\n }\n\n public whenSettledAsync(_stableFrames = 3): Promise<never> {\n return unsupported(\"GaussianSplattingStream.whenSettledAsync\", STREAM_BLOCKER);\n }\n\n public get maxDetailLod(): never {\n return unsupported(\"GaussianSplattingStream.maxDetailLod\", STREAM_BLOCKER);\n }\n public set maxDetailLod(_value: number) {\n unsupported(\"GaussianSplattingStream.maxDetailLod\", STREAM_BLOCKER);\n }\n\n public get splatBudget(): never {\n return unsupported(\"GaussianSplattingStream.splatBudget\", STREAM_BLOCKER);\n }\n public set splatBudget(_value: number) {\n unsupported(\"GaussianSplattingStream.splatBudget\", STREAM_BLOCKER);\n }\n\n public get effectiveSplatBudget(): never {\n return unsupported(\"GaussianSplattingStream.effectiveSplatBudget\", STREAM_BLOCKER);\n }\n\n public get residentSplatBudget(): never {\n return unsupported(\"GaussianSplattingStream.residentSplatBudget\", STREAM_BLOCKER);\n }\n\n public get minimumResidentSplats(): never {\n return unsupported(\"GaussianSplattingStream.minimumResidentSplats\", STREAM_BLOCKER);\n }\n\n public get lod0SplatCount(): GaussianSplattingStreamLod0SplatCount {\n return unsupported(\"GaussianSplattingStream.lod0SplatCount\", STREAM_BLOCKER);\n }\n\n public getBudgetDemand(): never {\n return unsupported(\"GaussianSplattingStream.getBudgetDemand\", COMPOUND_BLOCKER);\n }\n\n public setBudgetAllocation(_splats: number | null): never {\n return unsupported(\"GaussianSplattingStream.setBudgetAllocation\", COMPOUND_BLOCKER);\n }\n\n public get maxLodLevel(): never {\n return unsupported(\"GaussianSplattingStream.maxLodLevel\", STREAM_BLOCKER);\n }\n\n public get frustumCulling(): never {\n return unsupported(\"GaussianSplattingStream.frustumCulling\", STREAM_BLOCKER);\n }\n public set frustumCulling(_value: boolean) {\n unsupported(\"GaussianSplattingStream.frustumCulling\", STREAM_BLOCKER);\n }\n\n public get debugDisplay(): never {\n return unsupported(\"GaussianSplattingStream.debugDisplay\", STREAM_BLOCKER);\n }\n public set debugDisplay(_value: boolean) {\n unsupported(\"GaussianSplattingStream.debugDisplay\", STREAM_BLOCKER);\n }\n\n public get debugLodSource(): never {\n return unsupported(\"GaussianSplattingStream.debugLodSource\", STREAM_BLOCKER);\n }\n public set debugLodSource(_value: GaussianSplattingStreamDebugLodSource) {\n unsupported(\"GaussianSplattingStream.debugLodSource\", STREAM_BLOCKER);\n }\n\n public evaluateOptimalLods(_camera: unknown = null): never {\n return unsupported(\"GaussianSplattingStream.evaluateOptimalLods\", STREAM_BLOCKER);\n }\n}\n\nexport function AddGaussianSplattingStreamPart(\n _compound: GaussianSplattingMesh,\n _name: string,\n _metadata: ISOGLODMetadata,\n _rootUrl: string,\n _options: IGaussianSplattingStreamOptions = {}\n): never {\n return unsupported(\"AddGaussianSplattingStreamPart\", COMPOUND_BLOCKER);\n}\n\nexport async function AddGaussianSplattingStreamPartAsync(\n _compound: GaussianSplattingMesh,\n _name: string,\n _metadata: ISOGLODMetadata,\n _rootUrl: string,\n _options: IGaussianSplattingStreamOptions = {}\n): Promise<GaussianSplattingPartProxyMesh> {\n unsupported(\"AddGaussianSplattingStreamPartAsync\", COMPOUND_BLOCKER);\n}\n","/**\n * Throwing stubs for additional Babylon.js core/loaders symbols that Babylon\n * Lite either does not implement, or exposes only through a different native API\n * that the compat layer does not wrap 1:1.\n *\n * Every stub throws {@link LiteCompatError} on use with a pointer to the native\n * Babylon Lite alternative where one exists. This keeps the completeness\n * invariant — every core/loaders symbol resolves to an import and fails loudly\n * rather than silently.\n */\n\nimport { unsupported } from \"../error.js\";\nimport type { AbstractMesh, TransformNode } from \"../meshes/meshes.js\";\nimport type { AbstractEngine } from \"../engine/engine.js\";\nimport type { Matrix } from \"../math/matrix.js\";\nimport type { Vector3 } from \"../math/vector.js\";\nimport type { ShaderLanguage } from \"../misc/engine-constants.js\";\nimport type { Node } from \"../node/node.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { BaseTexture } from \"../textures/textures.js\";\n\nexport { Skeleton, Bone } from \"../bones/skeleton.js\";\n\n// ─── Probes / Layers / Rendering ─────────────────────────────────────\nexport type GeometryRenderingObjectIdProvider = (mesh: AbstractMesh) => number;\n\nexport class ReflectionProbe {\n public constructor() {\n unsupported(\"ReflectionProbe\", \"Dynamic reflection probes are not implemented in Babylon Lite.\");\n }\n}\n\nexport class Layer {\n public constructor() {\n unsupported(\"Layer\", \"2D background/foreground layers are not wrapped. Use the native effect-render-task APIs for fullscreen overlays.\");\n }\n}\n\nexport class EffectLayer {\n public constructor() {\n unsupported(\"EffectLayer\", \"Effect layers are not implemented in Babylon Lite.\");\n }\n}\n\nexport class DepthRenderer {\n public constructor() {\n unsupported(\"DepthRenderer\", \"Use the native linear-depth material / geometry-renderer task instead.\");\n }\n}\n\nexport class GeometryBufferRenderer {\n public constructor() {\n unsupported(\"GeometryBufferRenderer\", \"Use the native `createGeometryRendererTask` (G-buffer) API instead.\");\n }\n}\n\nexport class BoundingBoxRenderer {\n public constructor() {\n unsupported(\"BoundingBoxRenderer\", \"Bounding-box rendering is not implemented in Babylon Lite.\");\n }\n}\n\n// ─── Post-processes ──────────────────────────────────────────────────\n// The visual effects below exist in Babylon Lite as frame-graph post-process\n// tasks (e.g. `createBloomPostProcessTask`), but the Babylon.js camera-attached\n// `PostProcess` class model is not wrapped. Use the native task APIs.\nexport class PostProcess {\n public constructor() {\n unsupported(\n \"PostProcess\",\n \"Babylon Lite uses frame-graph post-process tasks rather than camera-attached PostProcess objects. Use the native `create*PostProcessTask` APIs.\"\n );\n }\n}\n\nexport class Effect {\n public constructor() {\n unsupported(\n \"Effect\",\n \"Babylon.js Effect owns shader-store lookup, preprocessing, compilation, reflection, and binding; Lite exposes explicit typed WGSL material/render-shader APIs instead.\"\n );\n }\n\n public isReady(): never {\n return unsupported(\"Effect.isReady\", \"Lite has no Babylon.js Effect compilation lifecycle.\");\n }\n\n public getEngine(): AbstractEngine {\n return unsupported(\"Effect.getEngine\", \"Lite has no Babylon.js Effect object associated with a compat engine.\");\n }\n\n public getCompilationError(): string {\n return unsupported(\"Effect.getCompilationError\", \"Lite has no Babylon.js Effect compilation lifecycle or error store.\");\n }\n\n public setTexture(_channel: string, _texture: BaseTexture): never {\n return unsupported(\"Effect.setTexture\", \"Lite binds textures through typed material/render-shader APIs, not an Effect binding table.\");\n }\n\n public setFloat(_uniformName: string, _value: number): never {\n return unsupported(\"Effect.setFloat\", \"Lite binds uniforms through typed material/render-shader APIs, not an Effect binding table.\");\n }\n}\n\nexport type EffectWrapperCustomShaderCodeProcessing = {\n processCodeAfterIncludes?: (postProcessName: string, shaderType: string, code: string) => string;\n processFinalCode?: (postProcessName: string, shaderType: string, code: string) => string;\n defineCustomBindings?: (postProcessName: string, defines: string | null, uniforms: string[], samplers: string[]) => string | null;\n bindCustomBindings?: (postProcessName: string, effect: Effect) => void;\n};\n\nexport interface EffectWrapperCreationOptions {\n engine?: AbstractEngine;\n fragmentShader?: string;\n useShaderStore?: boolean;\n vertexShader?: string;\n vertexUrl?: string;\n attributeNames?: string[];\n uniformNames?: string[];\n uniforms?: string[] | null;\n samplerNames?: string[];\n samplers?: string[] | null;\n uniformBuffers?: string[] | null;\n defines?: string | string[] | null;\n indexParameters?: any;\n blockCompilation?: boolean;\n onCompiled?: ((effect: Effect) => void) | null;\n onError?: (effect: Effect, errors: string) => void;\n name?: string;\n shaderLanguage?: ShaderLanguage;\n extraInitializations?: (useWebGPU: boolean, list: Promise<any>[]) => void;\n extraInitializationsAsync?: () => Promise<void>;\n useAsPostProcess?: boolean;\n allowEmptySourceTexture?: boolean;\n}\n\nexport class EffectWrapper {\n public static ForceGLSL = false;\n\n public static RegisterShaderCodeProcessing(_effectWrapperName: string | null, _customShaderCodeProcessing?: EffectWrapperCustomShaderCodeProcessing): never {\n return unsupported(\n \"EffectWrapper.RegisterShaderCodeProcessing\",\n \"Lite has no Babylon.js Effect shader-store/preprocessor registry to receive custom code-processing hooks.\"\n );\n }\n\n public constructor(_options: EffectWrapperCreationOptions) {\n unsupported(\n \"EffectWrapper\",\n \"Babylon.js EffectWrapper compiles GLSL/WGSL through the Effect shader-store and preprocessor lifecycle; Lite exposes only explicit WGSL render shaders and has no Effect object to adapt.\"\n );\n }\n}\n\nconst FRAME_GRAPH_MODEL_BLOCKER =\n \"Lite exposes standalone frame-graph task factories, but not Babylon.js's FrameGraph handles, task base classes, texture manager, or node-render-graph object model required by this API.\";\n\n/** Babylon.js 9.29 frame-graph min/max reduction task. */\nexport class FrameGraphMinMaxReducerTask {\n public constructor(..._args: unknown[]) {\n unsupported(\"FrameGraphMinMaxReducerTask\", FRAME_GRAPH_MODEL_BLOCKER);\n }\n}\n\n/** Babylon.js 9.29 node-render-graph min/max reduction block. */\nexport class NodeRenderGraphMinMaxReducerBlock {\n public constructor(..._args: unknown[]) {\n unsupported(\"NodeRenderGraphMinMaxReducerBlock\", FRAME_GRAPH_MODEL_BLOCKER);\n }\n}\n\n/** Babylon.js 9.29 node-render-graph registration function. */\nexport function RegisterMinMaxReducerBlock(): never {\n return unsupported(\"RegisterMinMaxReducerBlock\", FRAME_GRAPH_MODEL_BLOCKER);\n}\n\nfunction postProcessStub(name: string, nativeTask: string): { new (): never } {\n return class {\n public constructor() {\n unsupported(name, `Use the native \\`${nativeTask}\\` frame-graph task instead of the Babylon.js PostProcess class.`);\n }\n } as unknown as { new (): never };\n}\n\nexport const BlackAndWhitePostProcess = postProcessStub(\"BlackAndWhitePostProcess\", \"createBlackAndWhitePostProcessTask\");\nexport const BlurPostProcess = postProcessStub(\"BlurPostProcess\", \"createBlurPostProcessTask\");\nexport const BloomEffect = postProcessStub(\"BloomEffect\", \"createBloomPostProcessTask\");\nexport const ChromaticAberrationPostProcess = postProcessStub(\"ChromaticAberrationPostProcess\", \"createChromaticAberrationPostProcessTask\");\nexport const DepthOfFieldEffect = postProcessStub(\"DepthOfFieldEffect\", \"createDepthOfFieldPostProcessTask\");\n\nexport class DefaultRenderingPipeline {\n public constructor() {\n unsupported(\n \"DefaultRenderingPipeline\",\n \"Compose the native frame-graph post-process tasks (bloom, depth-of-field, chromatic aberration, image processing) instead of the Babylon.js DefaultRenderingPipeline.\"\n );\n }\n}\n\nexport class FxaaPostProcess {\n public constructor() {\n unsupported(\"FxaaPostProcess\", \"FXAA is not implemented in Babylon Lite.\");\n }\n}\n\nexport class SSAO2RenderingPipeline {\n public constructor() {\n unsupported(\"SSAO2RenderingPipeline\", \"SSAO is not implemented in Babylon Lite.\");\n }\n}\n\n// FSR 1 (AMD FidelityFX Super Resolution) upscale + sharpen. Babylon Lite has no\n// PostProcessRenderPipeline subsystem and ships no FSR/EASU/RCAS post-process, so\n// there is nothing to forward to — the same structural blocker as the other rendering\n// pipelines above.\nexport class FSR1RenderingPipeline {\n public constructor() {\n unsupported(\"FSR1RenderingPipeline\", \"FSR 1 upscaling is not implemented in Babylon Lite; it has no PostProcessRenderPipeline subsystem.\");\n }\n}\n\nexport class ThinFSR1UpscalePostProcess {\n public constructor() {\n unsupported(\"ThinFSR1UpscalePostProcess\", \"FSR 1 (EASU) upscaling is not implemented in Babylon Lite.\");\n }\n}\n\nexport class ThinFSR1SharpenPostProcess {\n public constructor() {\n unsupported(\"ThinFSR1SharpenPostProcess\", \"FSR 1 (RCAS) sharpening is not implemented in Babylon Lite.\");\n }\n}\n\n// ─── Particles ───────────────────────────────────────────────────────\nexport class ParticleHelper {\n public constructor() {\n unsupported(\n \"ParticleHelper\",\n \"The imperative particle-preset helper is not backed. Babylon Lite renders serialized Node Particle Editor graphs (`NodeParticleSystemSet.ParseFromSnippetAsync` → `buildAsync`), not preset-driven imperative `ParticleSystem`s.\"\n );\n }\n}\n\nexport class PointsCloudSystem {\n public constructor() {\n unsupported(\"PointsCloudSystem\", \"Point-cloud systems are not implemented in Babylon Lite. For Gaussian splats use the native splat loaders.\");\n }\n}\n\nexport class CannonJSPlugin {\n public constructor() {\n unsupported(\"CannonJSPlugin\", \"Babylon Lite physics is Havok-V2 only.\");\n }\n}\n\nexport class AmmoJSPlugin {\n public constructor() {\n unsupported(\"AmmoJSPlugin\", \"Babylon Lite physics is Havok-V2 only.\");\n }\n}\n\n// ─── Navigation ──────────────────────────────────────────────────────\nexport class RecastJSPlugin {\n public constructor() {\n unsupported(\"RecastJSPlugin\", \"Use the native Recast-V2 navigation API (`createNavigationPluginAsync`, `createNavMesh`, `createNavCrowd`).\");\n }\n}\n\n// ─── Audio ───────────────────────────────────────────────────────────\nexport class AudioEngine {\n public constructor() {\n unsupported(\"AudioEngine\", \"Audio is not part of Babylon Lite. Use the Web Audio API directly.\");\n }\n}\n\nexport class WeightedSound {\n public constructor() {\n unsupported(\"WeightedSound\", \"Audio is not part of Babylon Lite.\");\n }\n}\n\n// ─── Loaders (formats not present in Babylon Lite) ───────────────────\nconst FBX_LOADER_UNSUPPORTED =\n \"FBX support requires a parser, DCC transform/material/animation mapping, geometry and skin materialization, and a scene-scheduled constraint solver. Those form a new loader subsystem with unresolved ownership and mapping policies.\";\n\nexport class OBJFileLoader {\n public constructor() {\n unsupported(\"OBJFileLoader\", \"The OBJ format is not supported by Babylon Lite. Convert to glTF.\");\n }\n}\n\nexport class STLFileLoader {\n public constructor() {\n unsupported(\"STLFileLoader\", \"The STL format is not supported by Babylon Lite. Convert to glTF.\");\n }\n}\n\nexport type FBXNormalMapCoordinateSystem = \"y-up\" | \"y-down\";\n\nexport interface FBXLoaderWarning {\n source: \"scene\" | \"model\" | \"geometry\" | \"skin\" | \"rig\" | \"animation\" | \"blendShape\" | \"camera\" | \"light\";\n message: string;\n objectName?: string;\n details?: unknown;\n}\n\nexport interface FBXFileLoaderOptions {\n preset?: \"compatible\" | \"full\";\n normalMapCoordinateSystem?: FBXNormalMapCoordinateSystem;\n materials?: \"auto\" | \"standard\" | \"pbr\";\n unitScale?: \"preserve\" | \"meters\" | number;\n shareGeometry?: boolean;\n onWarning?: (warning: FBXLoaderWarning) => void;\n nurbsSubdivision?: number;\n curves?: \"lines\" | \"skip\";\n constraints?: \"apply\" | \"metadata\";\n rebaseAnimations?: boolean;\n attachCamerasAndLights?: boolean;\n}\n\nexport const FBXFileLoaderMetadata = {\n name: \"fbx\",\n extensions: {\n \".fbx\": { isBinary: true },\n },\n} as const;\n\nexport class FBXFileLoader {\n public constructor(_options: Partial<FBXFileLoaderOptions> = {}) {\n unsupported(\"FBXFileLoader\", FBX_LOADER_UNSUPPORTED);\n }\n}\n\nexport type FBXConstraintType = \"aim\" | \"parent\" | \"position\" | \"rotation\" | \"scale\" | \"singleChainIK\" | \"unknown\";\nexport type FBXConstraintVector3 = [number, number, number];\nexport type FBXConstraintBoolean3 = [boolean, boolean, boolean];\n\nexport interface FBXConstraintTarget {\n modelId: number;\n weight: number;\n offsetTranslation: FBXConstraintVector3;\n offsetRotation: FBXConstraintVector3;\n offsetScale: FBXConstraintVector3;\n}\n\nexport interface FBXConstraintData {\n id: number;\n name: string;\n type: FBXConstraintType;\n typeName: string;\n nodeId?: number;\n targets: FBXConstraintTarget[];\n weight: number;\n active: boolean;\n affectTranslation: FBXConstraintBoolean3;\n affectRotation: FBXConstraintBoolean3;\n affectScale: FBXConstraintBoolean3;\n offsetTranslation: FBXConstraintVector3;\n offsetRotation: FBXConstraintVector3;\n offsetScale: FBXConstraintVector3;\n aimVector: FBXConstraintVector3;\n upVector: FBXConstraintVector3;\n worldUpVector: FBXConstraintVector3;\n worldUpType: number;\n worldUpNodeId?: number;\n ikFirstJointId?: number;\n ikEndJointId?: number;\n ikEffectorId?: number;\n ikPoleVector: FBXConstraintVector3;\n}\n\nexport interface FBXConstraintBehaviorTarget {\n node: TransformNode;\n weight: number;\n offset: Matrix;\n}\n\nexport interface FBXConstraintBehaviorOptions {\n root: TransformNode;\n targets: FBXConstraintBehaviorTarget[];\n upNode: TransformNode | null;\n sceneUp: Vector3;\n}\n\nexport class FBXConstraintSolver {\n private constructor() {\n unsupported(\"FBXConstraintSolver\", FBX_LOADER_UNSUPPORTED);\n }\n\n public static Get(_scene: Scene): FBXConstraintSolver | undefined {\n return unsupported(\"FBXConstraintSolver.Get\", FBX_LOADER_UNSUPPORTED);\n }\n\n public static GetOrCreate(_scene: Scene): FBXConstraintSolver {\n return unsupported(\"FBXConstraintSolver.GetOrCreate\", FBX_LOADER_UNSUPPORTED);\n }\n\n public get constraints(): readonly FBXConstraintBehavior[] {\n return unsupported(\"FBXConstraintSolver.constraints\", FBX_LOADER_UNSUPPORTED);\n }\n\n public get cyclicConstraints(): readonly FBXConstraintBehavior[] {\n return unsupported(\"FBXConstraintSolver.cyclicConstraints\", FBX_LOADER_UNSUPPORTED);\n }\n\n public register(_behavior: FBXConstraintBehavior): void {\n unsupported(\"FBXConstraintSolver.register\", FBX_LOADER_UNSUPPORTED);\n }\n\n public unregister(_behavior: FBXConstraintBehavior): void {\n unsupported(\"FBXConstraintSolver.unregister\", FBX_LOADER_UNSUPPORTED);\n }\n\n public invalidateOrder(): void {\n unsupported(\"FBXConstraintSolver.invalidateOrder\", FBX_LOADER_UNSUPPORTED);\n }\n\n public beginFrame(): void {\n unsupported(\"FBXConstraintSolver.beginFrame\", FBX_LOADER_UNSUPPORTED);\n }\n\n public solve(): void {\n unsupported(\"FBXConstraintSolver.solve\", FBX_LOADER_UNSUPPORTED);\n }\n}\n\nexport class FBXConstraintBehavior {\n public readonly name: string;\n public attachedNode: TransformNode | null = null;\n public enabled = true;\n\n public constructor(\n public readonly constraint: FBXConstraintData,\n _options: FBXConstraintBehaviorOptions\n ) {\n this.name = `fbxConstraint:${constraint.name}`;\n unsupported(\"FBXConstraintBehavior\", FBX_LOADER_UNSUPPORTED);\n }\n\n public init(): void {\n unsupported(\"FBXConstraintBehavior.init\", FBX_LOADER_UNSUPPORTED);\n }\n\n public attach(_target: TransformNode): void {\n unsupported(\"FBXConstraintBehavior.attach\", FBX_LOADER_UNSUPPORTED);\n }\n\n public detach(): void {\n unsupported(\"FBXConstraintBehavior.detach\", FBX_LOADER_UNSUPPORTED);\n }\n\n public captureBase(): void {\n unsupported(\"FBXConstraintBehavior.captureBase\", FBX_LOADER_UNSUPPORTED);\n }\n\n public restoreBase(): void {\n unsupported(\"FBXConstraintBehavior.restoreBase\", FBX_LOADER_UNSUPPORTED);\n }\n\n public dependencyNodes(): Array<Node | null> {\n return unsupported(\"FBXConstraintBehavior.dependencyNodes\", FBX_LOADER_UNSUPPORTED);\n }\n\n public evaluate(): void {\n unsupported(\"FBXConstraintBehavior.evaluate\", FBX_LOADER_UNSUPPORTED);\n }\n}\n\nexport class BVHFileLoader {\n public constructor() {\n unsupported(\"BVHFileLoader\", \"The BVH format is not supported by Babylon Lite.\");\n }\n}\n\n// ─── Sprites ─────────────────────────────────────────────────────────\n// `SpriteManager` / `Sprite` are wrapped over Lite's facing-billboard system\n// (see ../sprites/sprites.ts). `SpriteMap` / `SpritePackedManager` remain\n// unsupported (tile-map / packed-atlas variants are not wrapped).\nexport class SpriteMap {\n public constructor() {\n unsupported(\"SpriteMap\", \"Tile-map sprites are not wrapped; use the native sprite APIs.\");\n }\n}\n\nexport class SpritePackedManager {\n public constructor() {\n unsupported(\"SpritePackedManager\", \"Use the native Babylon Lite sprite APIs.\");\n }\n}\n\n// ─── Misc (device / optimisation surfaces not wrapped) ───────────────\nexport class VirtualJoystick {\n public constructor() {\n unsupported(\"VirtualJoystick\", \"The virtual joystick UI is not part of Babylon Lite.\");\n }\n}\n\nexport class SceneOptimizer {\n public constructor() {\n unsupported(\"SceneOptimizer\", \"Automatic scene optimisation is not implemented in the compat layer.\");\n }\n}\n","/**\n * Babylon.js-compatible `ParticleSystem` over Babylon Lite's data-oriented\n * node-particle runtime.\n *\n * Babylon.js exposes `ParticleSystem` both as an **imperative constructor**\n * (`new ParticleSystem(name, capacity, scene)` — emitters, over-lifetime\n * gradients, `minEmitBox`) and as the **per-system handle** returned from a built\n * Node Particle Editor graph (`NodeParticleSystemSet.buildAsync(scene).systems[i]`).\n *\n * Babylon Lite backs only the second shape: `buildNodeParticleSet` compiles a\n * serialized graph into `NodeParticleSet.systems` (Lite `ParticleSystem` state\n * objects), which the standalone functions `startParticleSystem` /\n * `animateParticleSystem` / `stopParticleSystem` drive, and\n * `createParticleBillboard` / `syncParticleBillboard` /\n * `addFacingBillboardSystem` render as camera-facing billboards. So the compat\n * wrapper's **runtime subset** (`start` / `animate` / `stop` / `updateSpeed` /\n * `particleTexture` / `preWarmStepOffset`) forwards to those Lite functions,\n * while the imperative constructor throws — there is no Lite graph to author.\n *\n * The instances handed back from {@link ParticleSystemSet.systems} are built via\n * the `@internal` {@link ParticleSystem._fromLite} factory, which bypasses the\n * throwing constructor (mirroring `AnimationGroup._fromLite`).\n */\n\nimport { startParticleSystem, animateParticleSystem, stopParticleSystem, createParticleBillboard, syncParticleBillboard, addFacingBillboardSystem } from \"babylon-lite\";\nimport type { ParticleSystem as LiteParticleSystem, Texture2D } from \"babylon-lite\";\n\nimport type { Scene } from \"../scene/scene.js\";\nimport type { Texture } from \"../textures/textures.js\";\nimport { unsupported } from \"../error.js\";\n\n/**\n * Babylon.js `ParticleSystem` — the built output of one NPE graph system. Backed\n * by a Lite `ParticleSystem`; the deterministic prewarm-and-freeze pattern used by\n * ported parity scenes (seed RNG → `start()` → N × `animate()` → `updateSpeed = 0`)\n * maps directly onto Lite's `startParticleSystem` / `animateParticleSystem`, with a\n * camera-facing billboard built and synced once the scene starts.\n */\nexport class ParticleSystem {\n public name = \"\";\n\n /** @internal The backing Lite particle system (null on a bare, unbuilt instance). */\n public _lite: LiteParticleSystem | null = null;\n /** @internal The compat scene this system was built against. */\n public _scene: Scene | null = null;\n\n /**\n * Babylon.js `ParticleSystem.preWarmStepOffset` — the step ratio applied during\n * prewarm cycles. Multiplies {@link updateSpeed} on every `animate(true)` call,\n * matching Babylon.js (which uses `updateSpeed * preWarmStepOffset` while\n * prewarming and the regular animation ratio otherwise).\n */\n public preWarmStepOffset = 1;\n\n private _texture: Texture | null = null;\n private _billboardScheduled = false;\n private _billboardOwnedBySet = false;\n\n /**\n * Babylon.js `new ParticleSystem(name, capacity, scene)`. The imperative\n * construction API (emitters, over-lifetime gradients, `minEmitBox`, a\n * GPU-compute path) is not backed: Babylon Lite builds particle systems only\n * from a serialized Node Particle Editor graph. Load a graph via\n * `NodeParticleSystemSet.Parse` / `ParseFromSnippetAsync` → `buildAsync` and read\n * its {@link ParticleSystemSet.systems} instead.\n */\n public constructor() {\n unsupported(\n \"ParticleSystem\",\n \"Babylon Lite builds particle systems only from a serialized Node Particle Editor graph, not the imperative classic `ParticleSystem` construction API (emitters, over-lifetime gradients, `minEmitBox`). Use `NodeParticleSystemSet.Parse`/`ParseFromSnippetAsync` → `buildAsync` and drive `set.systems[i]`.\"\n );\n }\n\n /**\n * @internal Build a `ParticleSystem` backed by a Lite `ParticleSystem` produced\n * by an NPE graph build. Bypasses the throwing public constructor.\n */\n public static _fromLite(lite: LiteParticleSystem, scene: Scene): ParticleSystem {\n const system = Object.create(ParticleSystem.prototype) as ParticleSystem;\n system.name = \"\";\n system._lite = lite;\n system._scene = scene;\n system.preWarmStepOffset = 1;\n system._texture = null;\n system._billboardScheduled = false;\n system._billboardOwnedBySet = false;\n return system;\n }\n\n public getClassName(): string {\n return \"ParticleSystem\";\n }\n\n /** Babylon.js `ParticleSystem.updateSpeed` — simulation advance per frame. Proxies the Lite system. */\n public get updateSpeed(): number {\n return this._lite?.updateSpeed ?? 0;\n }\n public set updateSpeed(value: number) {\n if (this._lite) {\n this._lite.updateSpeed = value;\n }\n }\n\n /**\n * Babylon.js `ParticleSystem.particleTexture` — the sprite texture. Recorded and\n * bound onto the Lite system when the billboard is built at engine start (the\n * compat `Texture` loads asynchronously, so its GPU handle is read after the\n * scene's pending texture loads settle).\n */\n public get particleTexture(): Texture | null {\n return this._texture;\n }\n public set particleTexture(value: Texture | null) {\n this._texture = value;\n }\n\n /**\n * Babylon.js `ParticleSystem.start()` — begin emission. Forwards to Lite\n * `startParticleSystem` (which clears the stopped flag and resets the frame\n * counter, so `start()` → `stop()` → `start()` resumes emission) and schedules\n * the camera-facing billboard build for engine start. The billboard build is\n * separately guarded, so it happens exactly once however often `start()` runs.\n */\n public start(): void {\n if (!this._lite) {\n return;\n }\n startParticleSystem(this._lite);\n this._scheduleBillboard();\n }\n\n /**\n * Babylon.js `ParticleSystem.animate(preWarmOnly?)` — advance the simulation by\n * one deterministic step. Forwards to Lite `animateParticleSystem` with Babylon.js's\n * step ratio: {@link preWarmStepOffset} while prewarming, otherwise the ratio `1`\n * used by the parity ports' seeded step loop.\n */\n public animate(preWarmOnly = false): void {\n if (this._lite) {\n animateParticleSystem(this._lite, preWarmOnly ? this.preWarmStepOffset : 1);\n }\n }\n\n /** Babylon.js `ParticleSystem.stop()` — stop emission; live particles drain. Forwards to Lite `stopParticleSystem`. */\n public stop(): void {\n if (this._lite) {\n stopParticleSystem(this._lite);\n }\n }\n\n /** Babylon.js `ParticleSystem.dispose()` — stop the system. */\n public dispose(): void {\n this.stop();\n }\n\n /**\n * @internal Bind the recorded {@link particleTexture}'s GPU handle onto the backing\n * Lite system. Called from the deferred per-system billboard build and from\n * {@link ParticleSystemSet.start} before set-level registration, so a\n * wrapper-assigned texture wins over whatever the graph baked in. A no-op while\n * the compat `Texture` is still loading (callers run after the scene's pending\n * texture loads settle).\n */\n public _bindTexture(): void {\n const liteTexture = this._texture?._lite as Texture2D | undefined;\n if (this._lite && liteTexture) {\n this._lite.texture = liteTexture;\n }\n }\n\n /**\n * @internal Hand billboard rendering to the owning {@link ParticleSystemSet}: Lite's\n * `registerNodeParticleSet` builds and per-frame syncs a billboard for every system\n * in the set, so this wrapper's one-shot build must be skipped to avoid rendering\n * the same particles twice.\n */\n public _releaseBillboardToSet(): void {\n this._billboardOwnedBySet = true;\n }\n\n /**\n * Schedule the one-time billboard build. Deferred to engine start (via the\n * scene's `_deferAdd`, which runs after pending texture loads settle), so the\n * particle system is already prewarmed/frozen and its texture GPU handle is\n * ready. Mirrors the native Lite port's build → sync → add sequence.\n */\n private _scheduleBillboard(): void {\n if (this._billboardScheduled || !this._scene || !this._lite) {\n return;\n }\n this._billboardScheduled = true;\n const scene = this._scene;\n const lite = this._lite;\n scene._deferAdd(() => {\n // Re-checked at flush time: the owning set may have claimed billboard\n // rendering after this build was scheduled.\n if (this._billboardOwnedBySet) {\n return;\n }\n this._bindTexture();\n if (!lite.texture) {\n return;\n }\n const billboard = createParticleBillboard(lite);\n syncParticleBillboard(lite, billboard);\n addFacingBillboardSystem(scene._lite, billboard);\n });\n }\n}\n","/**\n * Babylon.js-compatible Node Particle Editor (NPE) surface over Babylon Lite's\n * node-particle runtime.\n *\n * Babylon.js authors particle graphs as a `NodeParticleSystemSet` (a block graph),\n * then `buildAsync(scene)` compiles them into a live `ParticleSystemSet`. Babylon\n * Lite exposes the same capability through a fused parse+build entry point,\n * `parseNodeParticleSetFromSnippet(engine, scene, id, { json })`, plus\n * `registerNodeParticleSet(scene, set)` which wires each built system to a\n * camera-facing billboard system and advances it every frame.\n *\n * The compat wrapper bridges the two shapes: `Parse` / `ParseFromSnippetAsync` /\n * `ParseFromFileAsync` record the graph source and defer the single Lite call to\n * `buildAsync`, which returns a {@link ParticleSystemSet} wrapping the built Lite\n * `NodeParticleSet`. `ParticleSystemSet.start()` forwards to\n * `registerNodeParticleSet` (Lite owns all simulation + rendering); `dispose()`\n * stops emission via `stopParticleSystem`.\n *\n * The graph-authoring surface (programmatic blocks, `serialize`, `editAsync`,\n * `getBlockByName`) is **not** backed: Lite consumes a serialized graph and\n * exposes no block-construction API. The per-system runtime handles\n * (`ParticleSystemSet.systems[i]`) are backed — see {@link ParticleSystem}.\n */\n\nimport { parseNodeParticleSetFromSnippet, registerNodeParticleSet, stopParticleSystem } from \"babylon-lite\";\nimport type { NodeParticleSet as LiteNodeParticleSet } from \"babylon-lite\";\n\nimport type { Scene } from \"../scene/scene.js\";\nimport { ParticleSystem } from \"./particle-system.js\";\nimport { unsupported } from \"../error.js\";\n\n/**\n * Babylon.js `ParticleSystemSet` — the built output of an NPE graph. Backed by a\n * Lite `NodeParticleSet`; `start()` registers it as a live billboard system in the\n * scene. Directly constructing an empty set (`new ParticleSystemSet()`) is allowed\n * for parity but has no systems until produced by {@link NodeParticleSystemSet.buildAsync}.\n */\nexport class ParticleSystemSet {\n /** @internal The built Lite node-particle set (null for a directly-constructed empty set). */\n public _lite: LiteNodeParticleSet | null = null;\n /** @internal The compat scene the set was built against (set by `buildAsync`). */\n public _scene: Scene | null = null;\n\n private _started = false;\n /** @internal Cached per-system wrappers (stable identity across `systems` reads). */\n private _systems: ParticleSystem[] | null = null;\n\n public getClassName(): string {\n return \"ParticleSystemSet\";\n }\n\n /**\n * Babylon.js `ParticleSystemSet.systems` — the per-system {@link ParticleSystem}\n * handles. Each wraps one Lite `NodeParticleSet.systems[i]`, exposing the\n * runtime subset Lite backs (`start` / `animate` / `stop` / `updateSpeed` /\n * `particleTexture`). An empty (directly-constructed) set has no systems.\n */\n public get systems(): ParticleSystem[] {\n if (!this._lite || !this._scene) {\n return [];\n }\n if (!this._systems) {\n const scene = this._scene;\n this._systems = this._lite.systems.map((s) => {\n const system = ParticleSystem._fromLite(s, scene);\n // Wrappers materialized after set-level registration must not build a\n // second billboard for a system Lite already renders.\n if (this._started) {\n system._releaseBillboardToSet();\n }\n return system;\n });\n }\n return this._systems;\n }\n\n /**\n * Babylon.js `ParticleSystemSet.start()` — begin all systems. Forwards to Lite\n * `registerNodeParticleSet`, which renders each system as a camera-facing\n * billboard and advances it once per frame. Idempotent.\n *\n * Per-system wrapper state (`systems[i].particleTexture`) is pushed onto the\n * backing Lite systems first, so the standard\n * `set.systems[i].particleTexture = texture; set.start()` sequence renders with\n * the assigned texture rather than the graph's. Registration is deferred to\n * engine start (`scene._deferAdd`, which runs after the scene's pending texture\n * loads settle) because a compat `Texture` resolves its GPU handle\n * asynchronously and Lite's billboard build needs it.\n */\n public start(): void {\n if (this._started || !this._lite || !this._scene) {\n return;\n }\n this._started = true;\n const scene = this._scene;\n const lite = this._lite;\n // Claim billboard rendering synchronously so an already-scheduled per-system\n // build (from `systems[i].start()`) is skipped when the deferred adds flush.\n for (const system of this._systems ?? []) {\n system._releaseBillboardToSet();\n }\n scene._deferAdd(() => {\n for (const system of this._systems ?? []) {\n system._bindTexture();\n }\n registerNodeParticleSet(scene._lite, lite, { autoStart: true });\n });\n }\n\n /**\n * Babylon.js `ParticleSystemSet.dispose()` — stop the systems. Lite exposes no\n * unregister for an already-registered billboard system, so this stops emission\n * on every built system (via `stopParticleSystem`); the last-emitted particles\n * finish their lifetime.\n */\n public dispose(): void {\n if (!this._lite) {\n return;\n }\n for (const system of this._lite.systems) {\n stopParticleSystem(system);\n }\n }\n}\n\n/**\n * Babylon.js `NodeParticleSystemSet` — a Node Particle Editor graph. The compat\n * wrapper supports the load→build→start path used by ported scenes; the\n * programmatic graph-authoring surface throws.\n */\nexport class NodeParticleSystemSet {\n public name: string;\n\n /** @internal Inline serialized graph (from `Parse` / `ParseFromFileAsync`); null when built from a snippet id. */\n public _source: object | string | null = null;\n /** @internal Snippet id (from `ParseFromSnippetAsync`); null when built from inline JSON. */\n public _snippetId: string | null = null;\n\n public constructor(name = \"\") {\n this.name = name;\n }\n\n public getClassName(): string {\n return \"NodeParticleSystemSet\";\n }\n\n /**\n * Babylon.js `NodeParticleSystemSet.buildAsync(scene)` — compile the graph into\n * a live {@link ParticleSystemSet}. Forwards to Lite\n * `parseNodeParticleSetFromSnippet`, which parses and builds in one shot (from\n * the recorded snippet id or inline JSON).\n */\n public async buildAsync(scene: Scene, _verbose = false): Promise<ParticleSystemSet> {\n void _verbose;\n const engine = scene.getEngine()._lite;\n const liteSet =\n this._snippetId !== null\n ? await parseNodeParticleSetFromSnippet(engine, scene._lite, this._snippetId, {})\n : await parseNodeParticleSetFromSnippet(engine, scene._lite, \"\", { json: this._source ?? {} });\n const set = new ParticleSystemSet();\n set._lite = liteSet;\n set._scene = scene;\n return set;\n }\n\n /** Babylon.js `NodeParticleSystemSet.Parse(source)` — deserialize an inline graph. */\n public static Parse(source: unknown): NodeParticleSystemSet {\n const name = (source as { name?: string } | null)?.name ?? \"\";\n const set = new NodeParticleSystemSet(name);\n set._source = source as object | string;\n return set;\n }\n\n /**\n * Babylon.js `NodeParticleSystemSet.ParseFromSnippetAsync(snippetId)` — load a\n * graph from the snippet server. The network fetch is deferred to `buildAsync`\n * (Lite fuses fetch+parse+build), so this resolves immediately with the id.\n */\n public static ParseFromSnippetAsync(snippetId: string, nodeParticleSet?: NodeParticleSystemSet): Promise<NodeParticleSystemSet> {\n const set = nodeParticleSet ?? new NodeParticleSystemSet();\n set._snippetId = snippetId;\n set.name = snippetId;\n return Promise.resolve(set);\n }\n\n /**\n * Babylon.js `NodeParticleSystemSet.ParseFromFileAsync(name, url)` — load a\n * serialized graph from a URL, then behave like {@link Parse}.\n */\n public static async ParseFromFileAsync(name: string, url: string, nodeParticleSet?: NodeParticleSystemSet): Promise<NodeParticleSystemSet> {\n const response = await fetch(url);\n const source = (await response.json()) as object;\n const set = nodeParticleSet ?? new NodeParticleSystemSet(name);\n set.name = name;\n set._source = source;\n return set;\n }\n\n /** Babylon.js `NodeParticleSystemSet.CreateDefault(name)`. Requires programmatic block authoring — not backed. */\n public static CreateDefault(_name: string): NodeParticleSystemSet {\n void _name;\n return unsupported(\n \"NodeParticleSystemSet.CreateDefault\",\n \"Babylon Lite consumes a serialized node-particle graph (snippet id or JSON); it has no programmatic block-authoring API to assemble a default graph. Load a graph via `Parse` / `ParseFromSnippetAsync` instead.\"\n );\n }\n\n public get attachedBlocks(): never {\n return unsupported(\n \"NodeParticleSystemSet.attachedBlocks\",\n \"Babylon Lite consumes a serialized node-particle graph and exposes no programmatic block graph. Load and build a graph via `Parse` / `ParseFromSnippetAsync` + `buildAsync`.\"\n );\n }\n\n public getBlockByName(_name: string): never {\n void _name;\n return unsupported(\"NodeParticleSystemSet.getBlockByName\", \"Babylon Lite exposes no programmatic node-particle block graph to query.\");\n }\n\n public serialize(): never {\n return unsupported(\"NodeParticleSystemSet.serialize\", \"Babylon Lite exposes no programmatic node-particle block graph to serialize.\");\n }\n\n public editAsync(): never {\n return unsupported(\"NodeParticleSystemSet.editAsync\", \"The Node Particle Editor UI is not part of the Babylon Lite compat layer.\");\n }\n\n public dispose(): void {\n this._source = null;\n this._snippetId = null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAEA,IAAa,UAAU;AACvB,IAAa,YAAY,KAAK,KAAK;AACnC,IAAa,YAAY,MAAM,KAAK;;AAGpC,IAAa,SAAS;CAClB,MAAM,OAAe,MAAM,GAAG,MAAM,GAAW;EAC3C,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;CAC7C;CACA,KAAK,OAAe,KAAa,QAAwB;EACrD,OAAO,SAAS,MAAM,SAAS;CACnC;CACA,YAAY,GAAW,GAAW,OAAuB;EACrD,OAAO,MAAM,IAAI,KAAK,QAAQ,MAAM,IAAI;CAC5C;CACA,iBAAiB,SAAyB;EACtC,OAAO,UAAU;CACrB;CACA,iBAAiB,SAAyB;EACtC,OAAO,UAAU;CACrB;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;CACtB;AACJ"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/math/scalar.ts","../src/math/constants.ts","../src/math/plane.ts","../src/math/ray.ts","../src/math/frustum.ts","../src/math/size.ts","../src/math/polar.ts","../src/math/spherical.ts","../src/math/curve.ts","../src/math/color-temperature.ts","../src/culling/picking-info.ts","../src/misc/misc-utils.ts","../src/engine/engine.ts","../src/compute/compute-shader.ts","../src/buffers/storage-buffer.ts","../src/materials/uniform-buffer.ts","../src/scene/abstract-scene.ts","../src/physics/physics.ts","../src/cameras/cameras.ts","../src/animations/animation.ts","../src/misc/engine-constants.ts","../src/events/pointer-events.ts","../src/scene/scene.ts","../src/lights/lights.ts","../src/lights/clustered-light-container.ts","../src/meshes/csg.ts","../src/meshes/compression.ts","../src/morph/morph.ts","../src/meshes/gaussian-splatting.ts","../src/meshes/mesh-blending.ts","../src/textures/textures.ts","../src/textures/external-texture.ts","../src/textures/raw-texture-2d-array.ts","../src/loading/loaded-mesh.ts","../src/bones/skeleton.ts","../src/loading/splat-file-loader.ts","../src/loading/usd-options.ts","../src/loading/scene-loader.ts","../src/loading/assets-manager.ts","../src/loading/material-variants.ts","../src/loading/usd-file-loader.ts","../src/picking/gpu-picker.ts","../src/gizmos/gizmos.ts","../src/behaviors/behaviors.ts","../src/sprites/sprites.ts","../src/shadows/shadow-generator.ts","../src/materials/node-material.ts","../src/materials/grid-material.ts","../src/materials/material-helpers.ts","../src/animations/easing.ts","../src/misc/guid.ts","../src/misc/tools.ts","../src/actions/actions.ts","../src/audio/audio-enums.ts","../src/audio/audio.ts","../src/materials/material-plugin.ts","../src/unsupported/unsupported-apis.ts","../src/loading/unsupported-khr-interactivity.ts","../src/loading/gltf2.ts","../src/loading/gltf1.ts","../src/meshes/gaussian-splatting-stream.ts","../src/unsupported/unsupported-extended.ts","../src/particles/particle-system.ts","../src/particles/node-particle-system-set.ts"],"sourcesContent":["/** Babylon.js-compatible scalar helpers and a small set of math constants. */\n\nimport { inverseLerp } from \"babylon-lite\";\n\nexport const Epsilon = 0.001;\nexport const ToRadians = Math.PI / 180;\nexport const ToDegrees = 180 / Math.PI;\n\n/** Babylon.js `Scalar` namespace — common scalar utilities. */\nexport const Scalar = {\n Clamp(value: number, min = 0, max = 1): number {\n return Math.min(max, Math.max(min, value));\n },\n Lerp(start: number, end: number, amount: number): number {\n return start + (end - start) * amount;\n },\n InverseLerp(a: number, b: number, value: number): number {\n return inverseLerp(a, b, value);\n },\n DegreesToRadians(degrees: number): number {\n return degrees * ToRadians;\n },\n RadiansToDegrees(radians: number): number {\n return radians * ToDegrees;\n },\n WithinEpsilon(a: number, b: number, epsilon = 1.401298e-45): boolean {\n return Math.abs(a - b) <= epsilon;\n },\n Normalize(value: number, min: number, max: number): number {\n return (value - min) / (max - min);\n },\n Denormalize(normalized: number, min: number, max: number): number {\n return normalized * (max - min) + min;\n },\n};\n","/** Babylon.js-compatible spatial constants (`Axis`, `Space`). */\n\nimport { Vector3 } from \"./vector.js\";\n\n// Lazily-cached axis singletons: stable identity (matching Babylon.js, where\n// `Axis.X/Y/Z` are shared constants) and no allocation until first accessed.\nlet _axisX: Vector3 | undefined;\nlet _axisY: Vector3 | undefined;\nlet _axisZ: Vector3 | undefined;\n\nexport const Axis = {\n get X(): Vector3 {\n return (_axisX ??= new Vector3(1, 0, 0));\n },\n get Y(): Vector3 {\n return (_axisY ??= new Vector3(0, 1, 0));\n },\n get Z(): Vector3 {\n return (_axisZ ??= new Vector3(0, 0, 1));\n },\n};\n\nexport enum Space {\n LOCAL = 0,\n WORLD = 1,\n BONE = 2,\n}\n","/** Babylon.js-compatible `Plane` (pure JS). */\n\nimport { Vector3 } from \"./vector.js\";\nimport type { Matrix } from \"./matrix.js\";\n\nexport class Plane {\n /** Normal x/y/z and signed distance `d` from the origin (`normal · p + d = 0`). */\n public normal: Vector3;\n public d: number;\n\n public constructor(a: number, b: number, c: number, d: number) {\n this.normal = new Vector3(a, b, c);\n this.d = d;\n }\n\n public asArray(): [number, number, number, number] {\n return [this.normal.x, this.normal.y, this.normal.z, this.d];\n }\n\n public clone(): Plane {\n return new Plane(this.normal.x, this.normal.y, this.normal.z, this.d);\n }\n\n public normalize(): this {\n const norm = Math.sqrt(this.normal.x * this.normal.x + this.normal.y * this.normal.y + this.normal.z * this.normal.z);\n const inv = norm === 0 ? 0 : 1 / norm;\n this.normal.scaleInPlace(inv);\n this.d *= inv;\n return this;\n }\n\n /** Signed distance from `point` to this plane. */\n public signedDistanceTo(point: Vector3): number {\n return Vector3.Dot(point, this.normal) + this.d;\n }\n\n public dotCoordinate(point: Vector3): number {\n return this.normal.x * point.x + this.normal.y * point.y + this.normal.z * point.z + this.d;\n }\n\n public static FromArray(array: ArrayLike<number>): Plane {\n return new Plane(array[0] ?? 0, array[1] ?? 0, array[2] ?? 0, array[3] ?? 0);\n }\n\n public static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane {\n const n = normal.clone().normalize();\n const d = -(n.x * origin.x + n.y * origin.y + n.z * origin.z);\n return new Plane(n.x, n.y, n.z, d);\n }\n\n public static FromPoints(point1: Vector3, point2: Vector3, point3: Vector3): Plane {\n const normal = Vector3.Cross(point2.subtract(point1), point3.subtract(point1)).normalize();\n return Plane.FromPositionAndNormal(point1, normal);\n }\n\n /** Transform a copy of this plane by the transpose of the inverse of `transformation`. */\n public transform(transformation: Matrix): Plane {\n // For a correct plane transform the caller passes the inverse-transpose;\n // here we apply the matrix directly to (normal, d) as a row-vector.\n const m = transformation.m;\n const x = this.normal.x;\n const y = this.normal.y;\n const z = this.normal.z;\n const d = this.d;\n const nx = x * m[0]! + y * m[1]! + z * m[2]! + d * m[3]!;\n const ny = x * m[4]! + y * m[5]! + z * m[6]! + d * m[7]!;\n const nz = x * m[8]! + y * m[9]! + z * m[10]! + d * m[11]!;\n const nd = x * m[12]! + y * m[13]! + z * m[14]! + d * m[15]!;\n return new Plane(nx, ny, nz, nd);\n }\n}\n","/** Babylon.js-compatible `Ray` (pure JS). */\n\nimport { Vector3 } from \"./vector.js\";\nimport type { Plane } from \"./plane.js\";\n\nexport class Ray {\n public origin: Vector3;\n public direction: Vector3;\n public length: number;\n\n public constructor(origin: Vector3, direction: Vector3, length: number = Number.MAX_VALUE) {\n this.origin = origin;\n this.direction = direction;\n this.length = length;\n }\n\n public clone(): Ray {\n return new Ray(this.origin.clone(), this.direction.clone(), this.length);\n }\n\n /** Distance at which this ray crosses `plane`, or `null` if parallel / behind. */\n public intersectsPlane(plane: Plane): number | null {\n const dot = Vector3.Dot(plane.normal, this.direction);\n if (Math.abs(dot) < 1e-9) {\n return null;\n }\n const t = -(Vector3.Dot(plane.normal, this.origin) + plane.d) / dot;\n return t < 0 ? null : t;\n }\n\n /** True if this ray passes within `sphereRadius` of `spherePosition`. */\n public intersectsSphere(spherePosition: Vector3, sphereRadius: number): boolean {\n const x = spherePosition.x - this.origin.x;\n const y = spherePosition.y - this.origin.y;\n const z = spherePosition.z - this.origin.z;\n const pyth = x * x + y * y + z * z;\n const rr = sphereRadius * sphereRadius;\n if (pyth <= rr) {\n return true;\n }\n const dot = x * this.direction.x + y * this.direction.y + z * this.direction.z;\n if (dot < 0) {\n return false;\n }\n const temp = pyth - dot * dot;\n return temp <= rr;\n }\n\n public static Zero(): Ray {\n return new Ray(Vector3.Zero(), Vector3.Zero(), Number.MAX_VALUE);\n }\n\n public static CreateNew(x: number, y: number, z: number, dx: number, dy: number, dz: number, length = Number.MAX_VALUE): Ray {\n return new Ray(new Vector3(x, y, z), new Vector3(dx, dy, dz), length);\n }\n}\n","/** Babylon.js-compatible `Frustum` (pure JS): extract clip planes from a matrix. */\n\nimport { Plane } from \"./plane.js\";\nimport type { Matrix } from \"./matrix.js\";\n\nexport const Frustum = {\n /** Extract the 6 frustum planes from a view-projection `transform`. */\n GetPlanes(transform: Matrix): Plane[] {\n const planes: Plane[] = [];\n for (let i = 0; i < 6; i++) {\n planes.push(new Plane(0, 0, 0, 0));\n }\n Frustum.GetPlanesToRef(transform, planes);\n return planes;\n },\n\n /** Extract the 6 frustum planes from `transform` into the supplied `planes` array. */\n GetPlanesToRef(transform: Matrix, planes: Plane[]): void {\n const m = transform.m;\n // Left\n set(planes[0]!, m[3]! + m[0]!, m[7]! + m[4]!, m[11]! + m[8]!, m[15]! + m[12]!);\n // Right\n set(planes[1]!, m[3]! - m[0]!, m[7]! - m[4]!, m[11]! - m[8]!, m[15]! - m[12]!);\n // Bottom\n set(planes[2]!, m[3]! + m[1]!, m[7]! + m[5]!, m[11]! + m[9]!, m[15]! + m[13]!);\n // Top\n set(planes[3]!, m[3]! - m[1]!, m[7]! - m[5]!, m[11]! - m[9]!, m[15]! - m[13]!);\n // Near\n set(planes[4]!, m[3]! + m[2]!, m[7]! + m[6]!, m[11]! + m[10]!, m[15]! + m[14]!);\n // Far\n set(planes[5]!, m[3]! - m[2]!, m[7]! - m[6]!, m[11]! - m[10]!, m[15]! - m[14]!);\n },\n};\n\nfunction set(plane: Plane, a: number, b: number, c: number, d: number): void {\n plane.normal.set(a, b, c);\n plane.d = d;\n plane.normalize();\n}\n","/** Babylon.js-compatible `Size` and `Viewport` (pure JS). */\n\nexport class Size {\n public constructor(\n public width: number = 0,\n public height: number = 0\n ) {}\n\n public get surface(): number {\n return this.width * this.height;\n }\n\n public clone(): Size {\n return new Size(this.width, this.height);\n }\n\n public equals(other: Size): boolean {\n return this.width === other.width && this.height === other.height;\n }\n\n public add(other: Size): Size {\n return new Size(this.width + other.width, this.height + other.height);\n }\n\n public static Zero(): Size {\n return new Size(0, 0);\n }\n}\n\nexport class Viewport {\n public constructor(\n public x: number,\n public y: number,\n public width: number,\n public height: number\n ) {}\n\n /** Resolve this normalized viewport to pixel coordinates for a render target. */\n public toGlobal(renderWidth: number, renderHeight: number): Viewport {\n return new Viewport(this.x * renderWidth, this.y * renderHeight, this.width * renderWidth, this.height * renderHeight);\n }\n\n public clone(): Viewport {\n return new Viewport(this.x, this.y, this.width, this.height);\n }\n}\n","import { addPolarToRef, dividePolarToRef, multiplyPolarToRef, polarFromVec2ToRef, polarToVec2ToRef, scalePolarToRef, subtractPolarToRef } from \"babylon-lite\";\n\nimport { Vector2 } from \"./vector.js\";\n\n/** Babylon.js-compatible polar-coordinate value object. */\nexport class Polar {\n public constructor(\n public radius: number,\n public theta: number\n ) {}\n\n public getClassName(): string {\n return \"Polar\";\n }\n\n public toString(): string {\n return JSON.stringify(this);\n }\n\n public asArray(): number[] {\n return [this.radius, this.theta];\n }\n\n public addToRef(polar: Polar, ref: Polar): Polar {\n return addPolarToRef(this, polar, ref);\n }\n\n public add(polar: Polar): Polar {\n return this.addToRef(polar, new Polar(0, 0));\n }\n\n public addInPlace(polar: Polar): this {\n this.addToRef(polar, this);\n return this;\n }\n\n public addInPlaceFromFloats(radius: number, theta: number): this {\n return this.addInPlace(new Polar(radius, theta));\n }\n\n public subtractToRef(polar: Polar, ref: Polar): Polar {\n return subtractPolarToRef(this, polar, ref);\n }\n\n public subtract(polar: Polar): Polar {\n return this.subtractToRef(polar, new Polar(0, 0));\n }\n\n public subtractInPlace(polar: Polar): this {\n this.subtractToRef(polar, this);\n return this;\n }\n\n public subtractFromFloatsToRef(radius: number, theta: number, ref: Polar): Polar {\n return this.subtractToRef(new Polar(radius, theta), ref);\n }\n\n public subtractFromFloats(radius: number, theta: number): Polar {\n return this.subtractFromFloatsToRef(radius, theta, new Polar(0, 0));\n }\n\n public multiplyToRef(polar: Polar, ref: Polar): Polar {\n return multiplyPolarToRef(this, polar, ref);\n }\n\n public multiply(polar: Polar): Polar {\n return this.multiplyToRef(polar, new Polar(0, 0));\n }\n\n public multiplyInPlace(polar: Polar): this {\n this.multiplyToRef(polar, this);\n return this;\n }\n\n public divideToRef(polar: Polar, ref: Polar): Polar {\n return dividePolarToRef(this, polar, ref);\n }\n\n public divide(polar: Polar): Polar {\n return this.divideToRef(polar, new Polar(0, 0));\n }\n\n public divideInPlace(polar: Polar): this {\n this.divideToRef(polar, this);\n return this;\n }\n\n public clone(): Polar {\n return new Polar(this.radius, this.theta);\n }\n\n public copyFrom(source: Polar): this {\n return this.copyFromFloats(source.radius, source.theta);\n }\n\n public copyFromFloats(radius: number, theta: number): this {\n this.radius = radius;\n this.theta = theta;\n return this;\n }\n\n public scaleToRef(scale: number, ref: Polar): Polar {\n return scalePolarToRef(this, scale, ref);\n }\n\n public scale(scale: number): Polar {\n return this.scaleToRef(scale, new Polar(0, 0));\n }\n\n public scaleInPlace(scale: number): this {\n this.scaleToRef(scale, this);\n return this;\n }\n\n public set(radius: number, theta: number): this {\n return this.copyFromFloats(radius, theta);\n }\n\n public setAll(value: number): this {\n return this.set(value, value);\n }\n\n public toVector2ToRef(ref: Vector2): Vector2 {\n return polarToVec2ToRef(this, ref);\n }\n\n public toVector2(): Vector2 {\n return this.toVector2ToRef(new Vector2());\n }\n\n public static FromVector2ToRef(vector: Vector2, ref: Polar): Polar {\n return polarFromVec2ToRef(vector, ref);\n }\n\n public static FromVector2(vector: Vector2): Polar {\n return Polar.FromVector2ToRef(vector, new Polar(0, 0));\n }\n\n public static FromArray(array: number[]): Polar {\n return new Polar(array[0]!, array[1]!);\n }\n}\n","import {\n addSphericalToRef,\n divideSphericalToRef,\n multiplySphericalToRef,\n scaleSphericalToRef,\n sphericalFromVec3ToRef,\n sphericalToVec3ToRef,\n subtractSphericalToRef,\n} from \"babylon-lite\";\n\nimport { Vector3 } from \"./vector.js\";\n\n/** Babylon.js-compatible spherical-coordinate value object. */\nexport class Spherical {\n public constructor(\n public radius: number,\n public theta: number,\n public phi: number\n ) {}\n\n public getClassName(): string {\n return \"Spherical\";\n }\n\n public toString(): string {\n return JSON.stringify(this);\n }\n\n public asArray(): number[] {\n return [this.radius, this.theta, this.phi];\n }\n\n public addToRef(spherical: Spherical, ref: Spherical): Spherical {\n return addSphericalToRef(this, spherical, ref);\n }\n\n public add(spherical: Spherical): Spherical {\n return this.addToRef(spherical, new Spherical(0, 0, 0));\n }\n\n public addInPlace(spherical: Spherical): this {\n this.addToRef(spherical, this);\n return this;\n }\n\n public addInPlaceFromFloats(radius: number, theta: number, phi: number): this {\n return this.addInPlace(new Spherical(radius, theta, phi));\n }\n\n public subtractToRef(spherical: Spherical, ref: Spherical): Spherical {\n return subtractSphericalToRef(this, spherical, ref);\n }\n\n public subtract(spherical: Spherical): Spherical {\n return this.subtractToRef(spherical, new Spherical(0, 0, 0));\n }\n\n public subtractInPlace(spherical: Spherical): this {\n this.subtractToRef(spherical, this);\n return this;\n }\n\n public subtractFromFloatsToRef(radius: number, theta: number, phi: number, ref: Spherical): Spherical {\n return this.subtractToRef(new Spherical(radius, theta, phi), ref);\n }\n\n public subtractFromFloats(radius: number, theta: number, phi: number): Spherical {\n return this.subtractFromFloatsToRef(radius, theta, phi, new Spherical(0, 0, 0));\n }\n\n public multiplyToRef(spherical: Spherical, ref: Spherical): Spherical {\n return multiplySphericalToRef(this, spherical, ref);\n }\n\n public multiply(spherical: Spherical): Spherical {\n return this.multiplyToRef(spherical, new Spherical(0, 0, 0));\n }\n\n public multiplyInPlace(spherical: Spherical): this {\n this.multiplyToRef(spherical, this);\n return this;\n }\n\n public divideToRef(spherical: Spherical, ref: Spherical): Spherical {\n return divideSphericalToRef(this, spherical, ref);\n }\n\n public divide(spherical: Spherical): Spherical {\n return this.divideToRef(spherical, new Spherical(0, 0, 0));\n }\n\n public divideInPlace(spherical: Spherical): this {\n this.divideToRef(spherical, this);\n return this;\n }\n\n public clone(): Spherical {\n return new Spherical(this.radius, this.theta, this.phi);\n }\n\n public copyFrom(source: Spherical): this {\n return this.copyFromFloats(source.radius, source.theta, source.phi);\n }\n\n public copyFromFloats(radius: number, theta: number, phi: number): this {\n this.radius = radius;\n this.theta = theta;\n this.phi = phi;\n return this;\n }\n\n public scaleToRef(scale: number, ref: Spherical): Spherical {\n return scaleSphericalToRef(this, scale, ref);\n }\n\n public scale(scale: number): Spherical {\n return this.scaleToRef(scale, new Spherical(0, 0, 0));\n }\n\n public scaleInPlace(scale: number): this {\n this.scaleToRef(scale, this);\n return this;\n }\n\n public set(radius: number, theta: number, phi: number): this {\n return this.copyFromFloats(radius, theta, phi);\n }\n\n public setAll(value: number): this {\n return this.set(value, value, value);\n }\n\n public toVector3ToRef(ref: Vector3): Vector3 {\n return sphericalToVec3ToRef(this, ref);\n }\n\n public toVector3(): Vector3 {\n return this.toVector3ToRef(new Vector3());\n }\n\n public static FromVector3ToRef(vector: Vector3, ref: Spherical): Spherical {\n return sphericalFromVec3ToRef(vector, ref);\n }\n\n public static FromVector3(vector: Vector3): Spherical {\n return Spherical.FromVector3ToRef(vector, new Spherical(0, 0, 0));\n }\n\n public static FromArray(array: number[]): Spherical {\n return new Spherical(array[0]!, array[1]!, array[2]!);\n }\n}\n","/** Babylon.js-compatible curve/path helpers: `Angle`, `Curve3`, `Path3D` (pure JS). */\n\nimport { sampleCatmullRomSpline, sampleHermiteSpline } from \"babylon-lite\";\n\nimport { Vector3 } from \"./vector.js\";\n\nexport class Angle {\n public constructor(private readonly _radians: number) {}\n\n public radians(): number {\n return this._radians;\n }\n\n public degrees(): number {\n return (this._radians * 180) / Math.PI;\n }\n\n public static FromRadians(radians: number): Angle {\n return new Angle(radians);\n }\n\n public static FromDegrees(degrees: number): Angle {\n return new Angle((degrees * Math.PI) / 180);\n }\n}\n\n/** A 3D curve built from an ordered list of points. */\nexport class Curve3 {\n public constructor(private readonly _points: Vector3[]) {}\n\n public getPoints(): Vector3[] {\n return this._points;\n }\n\n /** Total polyline length along the curve points. */\n public length(): number {\n let total = 0;\n for (let i = 1; i < this._points.length; i++) {\n total += Vector3.Distance(this._points[i]!, this._points[i - 1]!);\n }\n return total;\n }\n\n /** Concatenate another curve (dropping the duplicated join point). */\n public continue(curve: Curve3): Curve3 {\n const points = this._points.slice();\n const other = curve.getPoints();\n for (let i = 1; i < other.length; i++) {\n points.push(other[i]!.clone());\n }\n return new Curve3(points);\n }\n\n /** Quadratic Bézier from `v0` → `v2` with control `v1`, sampled `nbPoints` times. */\n public static CreateQuadraticBezier(v0: Vector3, v1: Vector3, v2: Vector3, nbPoints: number): Curve3 {\n const count = Math.max(nbPoints, 2);\n const points: Vector3[] = [];\n for (let i = 0; i <= count; i++) {\n const t = i / count;\n const u = 1 - t;\n const x = u * u * v0.x + 2 * u * t * v1.x + t * t * v2.x;\n const y = u * u * v0.y + 2 * u * t * v1.y + t * t * v2.y;\n const z = u * u * v0.z + 2 * u * t * v1.z + t * t * v2.z;\n points.push(new Vector3(x, y, z));\n }\n return new Curve3(points);\n }\n\n /** Cubic Bézier from `v0` → `v3` with controls `v1`, `v2`, sampled `nbPoints` times. */\n public static CreateCubicBezier(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, nbPoints: number): Curve3 {\n const count = Math.max(nbPoints, 2);\n const points: Vector3[] = [];\n for (let i = 0; i <= count; i++) {\n const t = i / count;\n const u = 1 - t;\n const w0 = u * u * u;\n const w1 = 3 * u * u * t;\n const w2 = 3 * u * t * t;\n const w3 = t * t * t;\n points.push(new Vector3(w0 * v0.x + w1 * v1.x + w2 * v2.x + w3 * v3.x, w0 * v0.y + w1 * v1.y + w2 * v2.y + w3 * v3.y, w0 * v0.z + w1 * v1.z + w2 * v2.z + w3 * v3.z));\n }\n return new Curve3(points);\n }\n\n public static CreateHermiteSpline(p1: Vector3, t1: Vector3, p2: Vector3, t2: Vector3, nSeg: number): Curve3 {\n return new Curve3(sampleHermiteSpline(p1, t1, p2, t2, nSeg).map(({ x, y, z }) => new Vector3(x, y, z)));\n }\n\n public static CreateCatmullRomSpline(points: readonly Vector3[], nbPoints: number, closed: boolean = false): Curve3 {\n return new Curve3(sampleCatmullRomSpline(points, nbPoints, closed).map(({ x, y, z }) => new Vector3(x, y, z)));\n }\n}\n\n/** A 3D path with cumulative-distance queries over its points. */\nexport class Path3D {\n private readonly _curve: Vector3[];\n private readonly _distances: number[] = [];\n private _length = 0;\n\n public constructor(points: Vector3[]) {\n this._curve = points.map((p) => p.clone());\n this._distances[0] = 0;\n for (let i = 1; i < this._curve.length; i++) {\n this._length += Vector3.Distance(this._curve[i]!, this._curve[i - 1]!);\n this._distances[i] = this._length;\n }\n }\n\n public getCurve(): Vector3[] {\n return this._curve;\n }\n\n public getPoints(): Vector3[] {\n return this._curve;\n }\n\n public length(): number {\n return this._length;\n }\n\n /** Distances of each point from the path start, normalized to [0, 1] when `length > 0`. */\n public getDistances(): number[] {\n return this._distances;\n }\n}\n","import { getWhiteBalanceMatrix, MaxTintMagnitude, MinTemperatureKelvin, temperatureTintToXyz } from \"babylon-lite\";\n\nimport { Vector3 } from \"./vector.js\";\n\nexport { MinTemperatureKelvin, MaxTintMagnitude };\n\nexport function TemperatureTintToXyz(temperatureKelvin: number, tint: number): Vector3 {\n const [x, y, z] = temperatureTintToXyz(temperatureKelvin, tint);\n return new Vector3(x, y, z);\n}\n\nexport function GetWhiteBalanceMatrix(temperatureKelvin: number, tint: number): Float32Array {\n return getWhiteBalanceMatrix(temperatureKelvin, tint);\n}\n","import { getPickedUV, type PickingInfo as LitePickingInfo } from \"babylon-lite\";\n\nimport type { TransformNode } from \"../meshes/meshes.js\";\nimport { Vector2, Vector3 } from \"../math/vector.js\";\nimport type { Ray } from \"../math/ray.js\";\n\n/** Babylon.js-compatible result of a scene pick. */\nexport class PickingInfo {\n public hit = false;\n public distance = 0;\n public pickedPoint: Vector3 | null = null;\n public pickedMesh: TransformNode | null = null;\n public bu = 0;\n public bv = 0;\n public faceId = -1;\n public subMeshFaceId = -1;\n public subMeshId = 0;\n public pickedSprite: null = null;\n public thinInstanceIndex = -1;\n public ray: Ray | null = null;\n public originMesh: TransformNode | null = null;\n public aimTransform: TransformNode | null = null;\n public gripTransform: TransformNode | null = null;\n\n private _normal: Vector3 | null = null;\n private _worldNormal: Vector3 | null = null;\n private _faceNormal: Vector3 | null = null;\n private _faceWorldNormal: Vector3 | null = null;\n private _uv: Vector2 | null = null;\n\n /** @internal Create a compat result from Lite's synchronous CPU-picking result. */\n public static _fromLite(info: LitePickingInfo, pickedMesh: TransformNode | null, ray: Ray): PickingInfo {\n const result = new PickingInfo();\n result.hit = info.hit && pickedMesh !== null;\n result.distance = info.distance;\n result.pickedPoint = result.hit && info.pickedPoint ? Vector3.FromArray(info.pickedPoint) : null;\n result.pickedMesh = result.hit ? pickedMesh : null;\n result.bu = info.bu;\n result.bv = info.bv;\n result.faceId = info.faceId;\n result.subMeshFaceId = info.faceId;\n result.subMeshId = info.subMeshId;\n result.thinInstanceIndex = info.thinInstanceIndex;\n result.ray = ray;\n result._normal = info.pickedNormal ? Vector3.FromArray(info.pickedNormal) : null;\n result._worldNormal = info.pickedNormalWorld ? Vector3.FromArray(info.pickedNormalWorld) : null;\n result._faceNormal = info.pickedFaceNormal ? Vector3.FromArray(info.pickedFaceNormal) : null;\n result._faceWorldNormal = info.pickedFaceNormalWorld ? Vector3.FromArray(info.pickedFaceNormalWorld) : null;\n const uv = getPickedUV(info);\n result._uv = uv ? new Vector2(uv[0], uv[1]) : null;\n return result;\n }\n\n public getNormal(useWorldCoordinates = false, useVerticesNormals = true): Vector3 | null {\n const normal = useVerticesNormals ? (useWorldCoordinates ? this._worldNormal : this._normal) : useWorldCoordinates ? this._faceWorldNormal : this._faceNormal;\n return normal?.clone() ?? null;\n }\n\n public getTextureCoordinates(uvSet = \"uv\"): Vector2 | null {\n return uvSet === \"uv\" ? (this._uv?.clone() ?? null) : null;\n }\n}\n","/**\n * Babylon.js-compatible Misc utilities — the pure-JS subset that has no Babylon\n * Lite or GPU dependency: `SmartArray`, `StringDictionary`, `Tags`,\n * `PerformanceMonitor`, and `ColorGradient`/`FactorGradient`.\n */\n\n/** A pre-sized, reusable array that tracks a logical `length` separately from capacity. */\nexport class SmartArray<T> {\n public data: Array<T | undefined>;\n public length = 0;\n\n public constructor(capacity: number) {\n this.data = new Array<T | undefined>(capacity);\n }\n\n public push(value: T): void {\n this.data[this.length++] = value;\n if (this.length > this.data.length) {\n this.data.length = this.length;\n }\n }\n\n public reset(): void {\n this.length = 0;\n }\n\n public concat(array: { length: number; data: Array<T | undefined> }): void {\n for (let i = 0; i < array.length; i++) {\n this.push(array.data[i] as T);\n }\n }\n\n public dispose(): void {\n this.reset();\n this.data.length = 0;\n }\n}\n\n/** A string-keyed dictionary with the Babylon.js `StringDictionary` surface. */\nexport class StringDictionary<T> {\n private _store: Record<string, T> = {};\n\n public get count(): number {\n return Object.keys(this._store).length;\n }\n\n public add(key: string, value: T): boolean {\n if (key in this._store) {\n return false;\n }\n this._store[key] = value;\n return true;\n }\n\n public set(key: string, value: T): boolean {\n if (!(key in this._store)) {\n return false;\n }\n this._store[key] = value;\n return true;\n }\n\n public get(key: string): T | undefined {\n return this._store[key];\n }\n\n public getOrAddWithFactory(key: string, factory: (key: string) => T): T {\n let value = this._store[key];\n if (value === undefined) {\n value = factory(key);\n this._store[key] = value;\n }\n return value;\n }\n\n public contains(key: string): boolean {\n return key in this._store;\n }\n\n public remove(key: string): boolean {\n if (key in this._store) {\n delete this._store[key];\n return true;\n }\n return false;\n }\n\n public clear(): void {\n this._store = {};\n }\n\n public forEach(callback: (key: string, value: T) => void): void {\n for (const key of Object.keys(this._store)) {\n callback(key, this._store[key]!);\n }\n }\n}\n\ninterface Taggable {\n _tags?: Record<string, true>;\n}\n\n/** Babylon.js `Tags` — space-separated tag strings attached to arbitrary objects. */\nexport const Tags = {\n EnableFor(obj: Taggable): void {\n obj._tags ??= {};\n },\n\n HasTags(obj: Taggable): boolean {\n return !!obj._tags && Object.keys(obj._tags).length > 0;\n },\n\n AddTagsTo(obj: Taggable, tags: string): void {\n obj._tags ??= {};\n for (const tag of tags.split(/\\s+/).filter(Boolean)) {\n obj._tags[tag] = true;\n }\n },\n\n RemoveTagsFrom(obj: Taggable, tags: string): void {\n if (!obj._tags) {\n return;\n }\n for (const tag of tags.split(/\\s+/).filter(Boolean)) {\n delete obj._tags[tag];\n }\n },\n\n MatchesQuery(obj: Taggable, tag: string): boolean {\n return !!obj._tags && obj._tags[tag] === true;\n },\n\n GetTags(obj: Taggable): string[] {\n return obj._tags ? Object.keys(obj._tags) : [];\n },\n};\n\n/** Rolling FPS/frame-time monitor (Babylon.js `PerformanceMonitor`). */\nexport class PerformanceMonitor {\n private _samples: number[] = [];\n private _max: number;\n private _lastTime: number | null = null;\n private _enabled = true;\n\n public constructor(frameSampleSize = 30) {\n this._max = frameSampleSize;\n }\n\n public sampleFrame(timeMs: number = now()): void {\n if (!this._enabled) {\n return;\n }\n if (this._lastTime !== null) {\n const delta = timeMs - this._lastTime;\n this._samples.push(delta);\n if (this._samples.length > this._max) {\n this._samples.shift();\n }\n }\n this._lastTime = timeMs;\n }\n\n public get averageFrameTime(): number {\n if (this._samples.length === 0) {\n return 0;\n }\n return this._samples.reduce((a, b) => a + b, 0) / this._samples.length;\n }\n\n public get averageFPS(): number {\n const avg = this.averageFrameTime;\n return avg > 0 ? 1000 / avg : 0;\n }\n\n public get isSaturated(): boolean {\n return this._samples.length >= this._max;\n }\n\n public enable(): void {\n this._enabled = true;\n }\n\n public disable(): void {\n this._enabled = false;\n }\n\n public reset(): void {\n this._samples = [];\n this._lastTime = null;\n }\n}\n\n/** A gradient value bound to a [0, 1] position (Babylon.js `FactorGradient`). */\nexport class FactorGradient {\n public constructor(\n public gradient: number,\n public factor1: number,\n public factor2: number = factor1\n ) {}\n\n public getFactor(): number {\n return this.factor1;\n }\n}\n\n/** An RGBA color bound to a [0, 1] position (Babylon.js `ColorGradient`). */\nexport class ColorGradient {\n public constructor(\n public gradient: number,\n public color1: [number, number, number, number],\n public color2?: [number, number, number, number]\n ) {}\n}\n\nfunction now(): number {\n return typeof performance !== \"undefined\" ? performance.now() : Date.now();\n}\n\n/** Babylon.js `Logger` — level-gated console logging. */\nexport const Logger = {\n NoneLogLevel: 0,\n MessageLogLevel: 1,\n WarningLogLevel: 2,\n ErrorLogLevel: 4,\n AllLogLevel: 7,\n\n /** Current log-level bitmask. */\n LogLevels: 7,\n\n Log(message: string): void {\n if (this.LogLevels & this.MessageLogLevel) {\n // eslint-disable-next-line no-console\n console.log(\"BJS - \" + message);\n }\n },\n\n Warn(message: string): void {\n if (this.LogLevels & this.WarningLogLevel) {\n console.warn(\"BJS - \" + message);\n }\n },\n\n Error(message: string): void {\n if (this.LogLevels & this.ErrorLogLevel) {\n console.error(\"BJS - \" + message);\n }\n },\n};\n\n/** Babylon.js `PrecisionDate` — high-resolution timestamp source. */\nexport const PrecisionDate = {\n get Now(): number {\n return now();\n },\n};\n","/**\n * Babylon.js-compatible engine wrappers.\n *\n * The class hierarchy mirrors Babylon.js exactly: `AbstractEngine` is the base,\n * `ThinEngine extends AbstractEngine`, `Engine extends ThinEngine`, and\n * `WebGPUEngine extends AbstractEngine` (so `Engine` and `WebGPUEngine` are\n * siblings, as in Babylon.js). All shared behaviour lives on `AbstractEngine`;\n * because Babylon Lite is WebGPU-only, every concrete engine is backed by the\n * same Lite WebGPU context, so `new Engine(...)` and `new WebGPUEngine(...)`\n * behave identically.\n *\n * Babylon.js exposes a synchronous constructor plus an async `initAsync()` for\n * WebGPU. Babylon Lite acquires the GPU device in an async `createEngine()`.\n * The wrapper mirrors the Babylon.js shape: construct, then `await initAsync()`.\n *\n * Because Lite drives its own render loop through `startEngine`, `runRenderLoop`\n * is implemented by registering the callback through each scene's\n * before-render hook and kicking off Lite's loop. The startup is async under the\n * hood (Lite must register scenes before the first frame); `runRenderLoop`\n * returns immediately and rendering begins on a subsequent tick.\n */\n\nimport {\n createEngine,\n startEngine,\n stopEngine,\n resizeEngine,\n setEngineSize,\n disposeEngine,\n registerScene,\n registerSceneWithShadowSupport,\n enableMirroredMeshes,\n onBeforeRender,\n createNullEngine,\n stepScene,\n uploadImageToArrayLayer,\n onEngineDeviceLost,\n VERSION,\n} from \"babylon-lite\";\nimport type { EngineContext, EngineOptions, RenderCanvas, Texture2DArray } from \"babylon-lite\";\n\nimport { LiteCompatError, unsupported } from \"../error.js\";\nimport { Logger } from \"../misc/misc-utils.js\";\nimport { Observable } from \"../misc/observable.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\n/** Babylon.js `WebGPUEngineOptions` subset accepted by the compat engine. */\nexport interface WebGPUEngineOptions extends EngineOptions {\n antialias?: boolean;\n adaptToDeviceRatio?: boolean;\n useLargeWorldRendering?: boolean;\n canvasToneMapping?: GPUCanvasToneMapping;\n canvasColorSpace?: PredefinedColorSpace;\n}\n\n/**\n * Late work (utility-layer registration) is best-effort: it must never fail engine startup, and it\n * runs from two places — folded into `_startCore` when registered before startup completes, and\n * immediately after. Both go through this helper, so neither a rejection nor a synchronous throw\n * can escape unattributed.\n */\nasync function runLateWork(work: () => Promise<void>): Promise<void> {\n // `work()` is invoked inside the try so a synchronous throw is reported the same way as a\n // rejection; a trailing `.catch` on the returned promise would never see it.\n try {\n await work();\n } catch (error) {\n Logger.Error(`Late engine work failed: ${error instanceof Error ? error.message : String(error)}`);\n }\n}\n\nexport abstract class AbstractEngine {\n /**\n * Babylon.js `AbstractEngine.Version` — reports the underlying Babylon Lite\n * runtime version (the build-time-resolved `VERSION` exported by\n * `@babylonjs/lite`), not the upstream `@babylonjs/core` release it targets.\n */\n public static get Version(): string {\n return VERSION;\n }\n\n /** Babylon.js `AbstractEngine.NpmPackage` — the npm package + version string. */\n public static get NpmPackage(): string {\n return `@babylonjs/lite-compat@${this.Version}`;\n }\n\n /** @internal The underlying Lite engine context. Populated by `initAsync()`. */\n public _lite!: EngineContext;\n\n /**\n * @internal Whether this engine has no GPU device (a {@link NullEngine}). Headless\n * engines build their Lite scene context with no frame-graph render task and are\n * advanced by a pure-JS loop that steps Lite's simulation (see {@link NullEngine}).\n */\n public _headless = false;\n\n protected readonly _canvas: RenderCanvas;\n private readonly _options: EngineOptions | undefined;\n protected readonly _scenes: Scene[] = [];\n protected readonly _loopCallbacks: Array<() => void> = [];\n protected _initialized = false;\n private _startupComplete = false;\n private _startPromise: Promise<void> | null = null;\n\n /** @internal Whether scene registration and the first engine start have completed. */\n public get _hasStarted(): boolean {\n return this._startupComplete;\n }\n /** @internal Active `requestAnimationFrame` id for the scene-less loop, if any. */\n protected _rafId: number | null = null;\n\n /**\n * Babylon.js `engine.useReverseDepthBuffer`. Babylon Lite owns its depth\n * configuration internally, so this is a settable no-op kept for API shape.\n */\n public useReverseDepthBuffer = false;\n\n /** Babylon.js `engine.onResizeObservable` — fires after `resize()` / `setSize()`. */\n public readonly onResizeObservable = new Observable<AbstractEngine>();\n /** Babylon.js context-loss signal, forwarded from Lite's device-loss subscription. */\n public readonly onContextLostObservable = new Observable<AbstractEngine>();\n /** Babylon.js context-restored signal. Lite does not expose a completed-recovery event, so this remains shape-only. */\n public readonly onContextRestoredObservable = new Observable<AbstractEngine>();\n /** @internal Device-loss unsubscriber installed by `initAsync`. */\n private _unsubscribeDeviceLost: (() => void) | null = null;\n\n /** @internal Babylon.js hardware-scaling level. Babylon Lite manages device-pixel-ratio itself; stored for parity. */\n private _hardwareScalingLevel = 1;\n\n /** @internal Latest per-frame delta in ms, updated by each scene's before-render hook. */\n public _lastDeltaMs = 16;\n\n /** @internal Last clear colour passed to `engine.clear(...)` (consumed by the scene-less sprite path). */\n public _lastClearColor: { r: number; g: number; b: number; a: number } = { r: 0, g: 0, b: 0, a: 1 };\n\n /** @internal Whether `engine.clear(...)` was ever called (sprite renderers overlay a scene if not). */\n public _clearRequested = false;\n\n /** @internal Deferred startup work (thunks) awaited before the engine starts — e.g. sprite-atlas loads. */\n private readonly _startupWork: Array<() => Promise<void>> = [];\n\n /**\n * @internal Deferred work awaited after the main engine renders its first frame\n * — e.g. utility-layer registration, which must follow the main scene but must\n * not block engine startup.\n */\n private readonly _lateWork: Array<() => Promise<void>> = [];\n\n public constructor(canvas: RenderCanvas, options?: WebGPUEngineOptions | boolean) {\n this._canvas = canvas;\n // Babylon.js's WebGPUEngine takes an options object as the second arg;\n // accept a bare boolean too (some older call sites pass `antialias`).\n const opts: WebGPUEngineOptions | undefined = typeof options === \"object\" ? { ...options } : options === false ? { msaaSamples: 1 } : undefined;\n if (opts) {\n if (opts.canvasToneMapping !== undefined || opts.canvasColorSpace !== undefined) {\n unsupported(\n \"WebGPUEngineOptions.canvasToneMapping/canvasColorSpace\",\n \"Supporting WebGPU canvas presentation options requires changing Lite's existing surface configuration hot path; it cannot be added as an independently tree-shakeable compat capability.\"\n );\n }\n const antialias = opts.antialias;\n delete opts.antialias;\n delete opts.canvasToneMapping;\n delete opts.canvasColorSpace;\n if (antialias === false) {\n opts.msaaSamples = 1;\n }\n }\n // Babylon.js exposes floating-origin / large-world rendering through a\n // single `useLargeWorldRendering` flag. Babylon Lite splits it into\n // `useHighPrecisionMatrix` + `useFloatingOrigin` (the latter requires the\n // former). Translate so compat scenes that pass the BJS flag light up LWR.\n if (opts?.useLargeWorldRendering) {\n delete opts.useLargeWorldRendering;\n opts.useHighPrecisionMatrix = true;\n opts.useFloatingOrigin = true;\n }\n this._options = opts;\n }\n\n /** Acquire the GPU device and build the Lite engine context. */\n public async initAsync(): Promise<void> {\n if (this._initialized) {\n return;\n }\n this._lite = await createEngine(this._canvas, this._options);\n this._unsubscribeDeviceLost = onEngineDeviceLost(this._lite, () => this.onContextLostObservable.notifyObservers(this));\n this._initialized = true;\n }\n\n public getRenderingCanvas(): RenderCanvas {\n return this._canvas;\n }\n\n /**\n * Babylon.js `engine.getDeltaTime()` — milliseconds elapsed since the previous\n * frame. Updated from each scene's Lite before-render hook (which receives the\n * frame delta); defaults to ~16ms before the first frame.\n */\n public getDeltaTime(): number {\n return this._lastDeltaMs;\n }\n\n /**\n * Babylon.js `engine.isNDCHalfZRange`. WebGPU's clip space uses a `[0, 1]`\n * depth range, so this is always `true` under Babylon Lite.\n */\n public get isNDCHalfZRange(): boolean {\n return true;\n }\n\n /** Babylon.js `engine.isWebGPU` — Babylon Lite is WebGPU-only, so always `true`. */\n public get isWebGPU(): boolean {\n return true;\n }\n\n /**\n * Babylon.js `engine.getCaps()` — engine capability flags. Only the\n * compressed-texture-format flags ported scenes branch on are derived (from the\n * Lite WebGPU device's enabled features); the rest report Babylon Lite's fixed\n * WebGPU baseline. A headless `NullEngine` has no device, so all flags are off.\n */\n public getCaps(): Record<string, unknown> {\n const device = (this._lite as { _device?: { features?: { has(name: string): boolean }; limits?: { maxUniformBuffersPerShaderStage?: number } } } | undefined)?._device;\n const has = (name: string): boolean => !!device?.features?.has(name);\n return {\n astc: has(\"texture-compression-astc\"),\n s3tc: has(\"texture-compression-bc\"),\n bc7: has(\"texture-compression-bc\"),\n etc2: has(\"texture-compression-etc2\"),\n // ETC1 is a distinct format family with no WebGPU feature flag — never\n // report it as available (an ETC2 device can decode ETC1 content, but\n // advertising `etc1` can steer upstream selection to a non-existent path).\n etc1: false,\n pvrtc: false,\n // WebGPU baseline capabilities Babylon Lite always provides.\n textureFloat: true,\n textureHalfFloat: true,\n textureFloatLinearFiltering: true,\n maxTextureSize: 8192,\n // Maximum uniform buffers bindable to a single shader stage. BJS reports this\n // only for engines that enforce it as a hard limit (WebGPU); Babylon Lite is\n // WebGPU-only, so it forwards the device's reported limit, and leaves it\n // undefined for a device-less NullEngine — matching BJS's \"left undefined\n // elsewhere\" contract.\n maxUniformBuffersPerShaderStage: device?.limits?.maxUniformBuffersPerShaderStage,\n instancedArrays: true,\n uintIndices: true,\n };\n }\n\n /** Babylon.js `engine.scenes` — every scene created against this engine. */\n public get scenes(): Scene[] {\n return this._scenes;\n }\n\n /** Babylon.js `engine.getRenderWidth()` — backing render-target width in pixels. */\n public getRenderWidth(): number {\n return (this._canvas as { width?: number }).width ?? 0;\n }\n\n /** Babylon.js `engine.getRenderHeight()` — backing render-target height in pixels. */\n public getRenderHeight(): number {\n return (this._canvas as { height?: number }).height ?? 0;\n }\n\n /** Babylon.js `engine.getScreenAspectRatio()` — render-target width / height. */\n public getScreenAspectRatio(): number {\n const h = this.getRenderHeight();\n return h !== 0 ? this.getRenderWidth() / h : 1;\n }\n\n /**\n * Babylon.js `engine.getAspectRatio(camera?, useScreen?)`. Babylon Lite renders\n * each scene through a single full-canvas viewport, so the camera viewport does\n * not subdivide the surface — this is the screen aspect ratio.\n */\n public getAspectRatio(_camera?: unknown, _useScreen?: boolean): number {\n return this.getScreenAspectRatio();\n }\n\n /** Babylon.js `engine.getFps()` — frames-per-second estimate from the last frame delta. */\n public getFps(): number {\n return this._lastDeltaMs > 0 ? 1000 / this._lastDeltaMs : 60;\n }\n\n /**\n * Babylon.js `engine.getHardwareScalingLevel()`. Babylon Lite manages its own\n * device-pixel-ratio scaling, so this returns the stored parity value.\n */\n public getHardwareScalingLevel(): number {\n return this._hardwareScalingLevel;\n }\n\n /** Babylon.js `engine.setHardwareScalingLevel(level)` — stored for parity (Lite self-manages DPR). */\n public setHardwareScalingLevel(level: number): void {\n this._hardwareScalingLevel = level;\n }\n\n /** Babylon.js `engine.getRenderingCanvasClientRect()` — the canvas client rect, or `null` for offscreen canvases. */\n public getRenderingCanvasClientRect(): { x: number; y: number; width: number; height: number } | null {\n const c = this._canvas as { getBoundingClientRect?: () => { x: number; y: number; width: number; height: number } };\n return typeof c.getBoundingClientRect === \"function\" ? c.getBoundingClientRect() : null;\n }\n\n /**\n * Babylon.js `engine.clear(color?, backBuffer?, depth?, stencil?)`. Babylon\n * Lite owns clearing through its render contexts (scenes / sprite renderers),\n * so this records the requested clear colour (used by the scene-less sprite\n * renderer path) and is otherwise a no-op.\n */\n public clear(color?: { r: number; g: number; b: number; a: number }, _backBuffer?: boolean, _depth?: boolean, _stencil?: boolean): void {\n this._clearRequested = true;\n if (color) {\n this._lastClearColor = { r: color.r, g: color.g, b: color.b, a: color.a ?? 1 };\n }\n }\n\n /** @internal Register deferred startup work (a thunk) awaited before the engine starts. */\n public _registerStartupWork(work: () => Promise<void>): void {\n this._startupWork.push(work);\n }\n\n /** @internal Register work that must run after the main scene is rendering. */\n public _registerLateWork(work: () => Promise<void>): void {\n // This gates on startup having completed, not on the render loop currently spinning:\n // `_lateWork` is only ever drained by `_startCore`, so once startup is past that point\n // queueing would strand the work forever — including after a `stopRenderLoop`, where the\n // registering feature (e.g. a utility layer) still needs to be wired up for the next frame.\n if (this._startupComplete) {\n // There is no startup promise left to fold this into. Surface a rejection through the\n // logger rather than letting it escape as an unhandled rejection, which is hard to\n // attribute back to the registering feature.\n void runLateWork(work);\n return;\n }\n this._lateWork.push(work);\n }\n\n /** @internal Scenes register themselves on construction. */\n public _registerScene(scene: Scene): void {\n this._scenes.push(scene);\n // Wire already-registered loop callbacks into the new scene.\n for (const cb of this._loopCallbacks) {\n onBeforeRender(scene._lite, () => cb());\n }\n }\n\n public runRenderLoop(callback: () => void): void {\n this._ensureInitialized(\"runRenderLoop\");\n this._loopCallbacks.push(callback);\n for (const scene of this._scenes) {\n onBeforeRender(scene._lite, () => callback());\n }\n void this._start().then(() => {\n // Scene-less render loops (e.g. the `SpriteRenderer` 2D path) have no\n // scene before-render hook to drive the callback. Run them on a\n // `requestAnimationFrame` loop so per-frame work (e.g. sprite-sheet\n // animation that mutates `cellIndex` each tick) actually advances.\n // Babylon Lite's own render loop draws the registered sprite renderer;\n // we just need to push the updated sprite data before each frame.\n if (this._scenes.length === 0 && this._rafId === null && typeof requestAnimationFrame === \"function\") {\n const tick = (): void => {\n for (const cb of this._loopCallbacks) {\n cb();\n }\n this._rafId = requestAnimationFrame(tick);\n };\n this._rafId = requestAnimationFrame(tick);\n }\n });\n }\n\n public stopRenderLoop(): void {\n if (this._rafId !== null && typeof cancelAnimationFrame === \"function\") {\n cancelAnimationFrame(this._rafId);\n this._rafId = null;\n }\n if (this._initialized) {\n stopEngine(this._lite);\n }\n }\n\n public resize(): void {\n this._ensureInitialized(\"resize\");\n resizeEngine(this._lite);\n this.onResizeObservable.notifyObservers(this);\n }\n\n public setSize(width: number, height: number): void {\n this._ensureInitialized(\"setSize\");\n setEngineSize(this._lite, width, height);\n this.onResizeObservable.notifyObservers(this);\n }\n\n public dispose(): void {\n if (this._rafId !== null && typeof cancelAnimationFrame === \"function\") {\n cancelAnimationFrame(this._rafId);\n this._rafId = null;\n }\n this._unsubscribeDeviceLost?.();\n this._unsubscribeDeviceLost = null;\n if (this._initialized) {\n disposeEngine(this._lite);\n }\n }\n\n /** Babylon.js manual frame-pump entry point — unsupported (Lite's frame graph owns the frame). */\n public beginFrame(): never {\n return unsupported(\"WebGPUEngine.beginFrame\", \"Babylon Lite's frame graph owns the frame loop; drive rendering with `runRenderLoop`.\");\n }\n\n /** Babylon.js manual frame-pump exit point — unsupported (Lite's frame graph owns the frame). */\n public endFrame(): never {\n return unsupported(\"WebGPUEngine.endFrame\", \"Babylon Lite's frame graph owns the frame loop; drive rendering with `runRenderLoop`.\");\n }\n\n /** Babylon.js `engine.currentSampleCount` — the active surface's MSAA sample count. */\n public get currentSampleCount(): number {\n return this._headless ? 1 : this._lite.msaaSamples;\n }\n\n /**\n * Babylon.js `engine.getAlphaToCoverage()` — alpha-to-coverage state. Lite's API is scoped to\n * individual material/sprite/text pipeline owners, not the engine-wide state BJS exposes.\n */\n public getAlphaToCoverage(): never {\n return unsupported(\n \"AbstractEngine.getAlphaToCoverage\",\n \"Lite's alpha-to-coverage API is target-scoped; mapping BJS's engine-wide state requires a pipeline-owner lifecycle policy.\"\n );\n }\n\n /**\n * Babylon.js `engine.setAlphaToCoverage(enable)` — toggle alpha-to-coverage. Lite's target-\n * scoped API cannot reproduce the engine-wide state without a pipeline-owner lifecycle policy.\n */\n public setAlphaToCoverage(_enable: boolean): never {\n return unsupported(\n \"AbstractEngine.setAlphaToCoverage\",\n \"Lite's alpha-to-coverage API is target-scoped; mapping BJS's engine-wide state requires a pipeline-owner lifecycle policy.\"\n );\n }\n\n /**\n * Babylon.js `engine.isOcclusionQueryVisible(query)` — Lite does not expose\n * occlusion-query allocation, render-pass encoding, or asynchronous result state.\n */\n public isOcclusionQueryVisible(_query: unknown): never {\n return unsupported(\n \"AbstractEngine.isOcclusionQueryVisible\",\n \"Lite has no occlusion-query subsystem; supporting this requires query allocation, render-pass encoding, and asynchronous result-lifetime policy.\"\n );\n }\n\n /**\n * Babylon.js `engine.updateTextureArrayLayerFromImageSource(texture, source, layer, invertY, premultiplyAlpha)`\n * — the engine extension that uploads a decoded image source into one layer of a 2D array\n * texture. Forwards to Babylon Lite's `uploadImageToArrayLayer`.\n *\n * Babylon.js passes an `InternalTexture`; the compat layer's equivalent handle is the Lite\n * `Texture2DArray` returned by `RawTexture2DArray.getInternalTexture()`, so ported code that\n * goes through `UploadImageToTexture2DArrayLayer` (which is exactly what Babylon.js's helper\n * does) works unchanged.\n */\n public updateTextureArrayLayerFromImageSource(texture: Texture2DArray, source: GPUCopyExternalImageSource, layer: number, invertY = false, premultiplyAlpha = false): void {\n uploadImageToArrayLayer(this._lite, texture, layer, source, { invertY, premultiplyAlpha });\n }\n\n private _start(): Promise<void> {\n this._startPromise ??= this._startCore();\n return this._startPromise;\n }\n\n private async _startCore(): Promise<void> {\n // Run deferred startup work (e.g. sprite-atlas loads) first, so any\n // resources a render context needs exist before the first frame.\n if (this._startupWork.length > 0) {\n await Promise.all(this._startupWork.map((w) => w()));\n this._startupWork.length = 0;\n }\n for (const scene of this._scenes) {\n // Build shadow generators first so NME materials can sample them at parse\n // time (Babylon Lite wires shadow receivers into the NME graph on parse).\n scene._buildShadowGenerators();\n await scene._parseNodeMaterials();\n await scene._awaitPendingTextures();\n scene._bakeGroundUvs();\n scene._flushPendingAdds();\n scene._buildMorphTargets();\n scene._buildClusteredContainers();\n await scene._enableMaterialPlugins();\n await scene._loadPendingEnvironment();\n // Babylon.js reverses triangle winding for negative-determinant (mirrored) world\n // transforms so a `scaling.x = -1` mesh renders upright rather than inside-out. Enable\n // Lite's equivalent opt-in per scene (after all assets are added, before registerScene)\n // to match that behaviour for Standard/procedural meshes; non-mirrored meshes are\n // unaffected, and the glTF loader's own load-time winding handling is not double-flipped.\n await enableMirroredMeshes(scene._lite);\n if (scene._hasShadows()) {\n await registerSceneWithShadowSupport(scene._lite);\n } else {\n await registerScene(scene._lite);\n }\n }\n // Start the main render loop before utility-layer registration. Utility\n // layers are overlays and can join on a subsequent frame; awaiting them\n // here would deadlock any registration path that depends on the first frame.\n await startEngine(this._lite);\n do {\n await Promise.all(this._scenes.map((scene) => scene._reconcilePendingMaterialPlugins()));\n } while (this._scenes.some((scene) => scene._hasPendingMaterialPluginReconciliations));\n this._startupComplete = true;\n // Late work now runs after the main render loop has started.\n // Late work is explicitly allowed to fail without taking startup with it: a rejection here\n // would otherwise poison `_startPromise` forever and resurface as an unhandled rejection\n // from `runRenderLoop`, which only does `void this._start()`.\n if (this._lateWork.length > 0) {\n await Promise.all(this._lateWork.map(runLateWork));\n this._lateWork.length = 0;\n }\n }\n\n private _ensureInitialized(api: string): void {\n if (!this._initialized) {\n throw new LiteCompatError(`${this.constructor.name}.${api}`, \"Call `await engine.initAsync()` before using the engine.\");\n }\n }\n}\n\n/**\n * Babylon.js's headless/abstract WebGL engine layer. In Babylon.js\n * `ThinEngine extends AbstractEngine` and is the lightweight (no scene-graph)\n * engine; the compat layer carries no extra behaviour over {@link AbstractEngine}\n * (everything is WebGPU-backed), so this exists purely to reproduce the class\n * name and inheritance chain.\n */\nexport class ThinEngine extends AbstractEngine {}\n\n/**\n * Babylon.js's full WebGL engine. In Babylon.js `Engine extends ThinEngine`\n * (sibling to {@link WebGPUEngine}, both rooted at {@link AbstractEngine}).\n * Babylon Lite is WebGPU-only, so a compat `Engine` is still backed by the same\n * Lite WebGPU context; this class exists to mirror Babylon.js's name + hierarchy.\n */\nexport class Engine extends ThinEngine {}\n\n/**\n * Babylon.js's WebGPU engine. In Babylon.js `WebGPUEngine extends AbstractEngine`\n * (sibling to {@link Engine}). This is the natural engine for the compat layer\n * since Babylon Lite is WebGPU-only.\n */\nexport class WebGPUEngine extends AbstractEngine {}\n\n/** A degenerate canvas stand-in for the deviceless {@link NullEngine}. */\nconst NULL_CANVAS = { width: 0, height: 0 } as unknown as RenderCanvas;\n\n/**\n * Babylon.js's `NullEngine` — a headless engine with no GPU device, used to run\n * scene logic (animations, observables, physics stepping, frame timing) without\n * rendering. Backed by Babylon Lite's real device-less headless engine\n * (`createNullEngine`): scenes constructed against it build a Lite scene context\n * with **no** frame-graph render task (`defaultRenderTask: false`), so no swapchain\n * or GPU resource is ever allocated. The compat `NullEngine` drives a pure-JS\n * `requestAnimationFrame` loop that advances each scene by the wall-clock delta\n * between frames via Lite's `stepScene` (which fires the scene's `onBeforeRender`\n * callbacks — CPU animations,\n * physics steps, user logic). Only the device-less simulation surface works; adding\n * meshes with materials (whose deferred GPU builders need a device) is unsupported,\n * matching Babylon.js's `NullEngine` limitations. Extends {@link WebGPUEngine} so it\n * is accepted everywhere a compat engine is (e.g. `new Scene(engine)`).\n */\nexport class NullEngine extends WebGPUEngine {\n public constructor() {\n super(NULL_CANVAS);\n this._headless = true;\n // Back the headless engine with Lite's real device-less engine context. No GPU\n // device to acquire — usable immediately, no `initAsync()` needed.\n this._lite = createNullEngine();\n this._initialized = true;\n }\n\n /** No GPU device to acquire. */\n public override async initAsync(): Promise<void> {\n // Headless: nothing to initialise.\n }\n\n /**\n * Drive a pure-JS frame loop: each tick advances every registered scene by the\n * wall-clock delta between frames through Lite's `stepScene` (which fires the scene's before-render\n * callbacks: CPU animations, physics, render observables), then runs the user\n * callback(s). No GPU work is recorded or submitted.\n */\n public override runRenderLoop(callback: () => void): void {\n this._loopCallbacks.push(callback);\n if (this._rafId !== null || typeof requestAnimationFrame !== \"function\") {\n return;\n }\n const now = (): number => (typeof performance !== \"undefined\" ? performance.now() : Date.now());\n let last = now();\n const tick = (): void => {\n const current = now();\n const deltaMs = current - last;\n last = current;\n for (const scene of this._scenes) {\n stepScene(this._lite, scene._lite, deltaMs);\n }\n for (const cb of this._loopCallbacks) {\n cb();\n }\n this._rafId = requestAnimationFrame(tick);\n };\n this._rafId = requestAnimationFrame(tick);\n }\n\n /** @internal Track the scene for the headless tick loop (no Lite before-render wiring). */\n public override _registerScene(scene: Scene): void {\n if (!this._scenes.includes(scene)) {\n this._scenes.push(scene);\n }\n }\n}\n","import {\n addComputeDispatch,\n computeStorageBufferBinding,\n computeUniformBufferBinding,\n createComputeBindingSet,\n createComputeDispatch,\n createComputeIndirectDispatch,\n createComputeShader,\n createComputeTask,\n disposeComputeBindingSet,\n disposeComputeShader,\n submitComputeTasks,\n} from \"babylon-lite\";\nimport type {\n ComputeBindingDecl,\n ComputeBindingResources,\n ComputeBindingSet as LiteComputeBindingSet,\n ComputeShader as LiteComputeShader,\n StorageBuffer as LiteStorageBuffer,\n UniformBuffer as LiteUniformBuffer,\n} from \"babylon-lite\";\n\nimport type { StorageBuffer } from \"../buffers/storage-buffer.js\";\nimport type { AbstractEngine } from \"../engine/engine.js\";\nimport { unsupported } from \"../error.js\";\nimport type { UniformBuffer } from \"../materials/uniform-buffer.js\";\nimport type { BaseTexture } from \"../textures/textures.js\";\n\nexport interface ComputeBindingLocation {\n group: number;\n binding: number;\n}\n\nexport type ComputeBindingMapping = Record<string, ComputeBindingLocation>;\n\nexport interface IComputeShaderPath {\n computeSource?: string;\n compute?: string;\n computeElement?: string;\n}\n\nexport interface IComputeShaderOptions {\n bindingsMapping: ComputeBindingMapping;\n defines?: string[];\n entryPoint?: string;\n processFinalCode?: ((code: string) => string) | null;\n useExplicitComputePipelineLayout?: boolean;\n}\n\ntype ComputeEffect = LiteComputeShader;\ntype BufferBinding = { readonly kind: \"uniform\"; readonly resource: LiteUniformBuffer } | { readonly kind: \"storage\"; readonly resource: LiteStorageBuffer };\nlet nextComputeShaderId = 1;\n\nfunction sourceFrom(shaderPath: IComputeShaderPath | string): string {\n if (typeof shaderPath === \"object\" && shaderPath.computeSource !== undefined) {\n return shaderPath.computeSource;\n }\n return unsupported(\n \"ComputeShader.constructor\",\n \"Lite's public compute factory accepts complete WGSL source. Babylon.js ShaderStore names, external .compute.fx paths, and DOM script-element lookup have no public Lite resolver.\"\n );\n}\n\n/** Babylon.js ComputeShader adapted to Lite's public buffer-backed compute graph. */\nexport class ComputeShader {\n public static readonly Parse = ComputeShaderParse;\n\n public readonly uniqueId = nextComputeShaderId++;\n public name: string;\n public fastMode = false;\n public onCompiled: ((effect: ComputeEffect) => void) | null = null;\n public onError: ((effect: ComputeEffect, errors: string) => void) | null = null;\n public readonly gpuTimeInFrame = undefined;\n public triggerContextRebuild = false;\n\n private readonly _source: string;\n private readonly _bindings = new Map<string, BufferBinding>();\n private _shader: LiteComputeShader | null = null;\n private _bindingSet: LiteComputeBindingSet | null = null;\n private _bindingsDirty = false;\n private _shaderDirty = false;\n private _compiled = false;\n\n public constructor(\n name: string,\n private readonly _engine: AbstractEngine,\n private readonly _shaderPath: IComputeShaderPath | string,\n options: Partial<IComputeShaderOptions> = {}\n ) {\n this.name = name;\n this._options = {\n bindingsMapping: {},\n defines: [],\n entryPoint: \"main\",\n ...options,\n };\n if (this._options.defines?.length) {\n unsupported(\n \"ComputeShader.constructor(options.defines)\",\n \"Lite's public compute factory accepts final WGSL and intentionally exposes no Babylon.js shader preprocessor for #define expansion.\"\n );\n }\n const source = sourceFrom(this._shaderPath);\n this._source = this._options.processFinalCode?.(source) ?? source;\n }\n\n private readonly _options: IComputeShaderOptions;\n\n public get options(): IComputeShaderOptions {\n return this._options;\n }\n\n public get shaderPath(): string | IComputeShaderPath {\n return this._shaderPath;\n }\n\n public getClassName(): string {\n return \"ComputeShader\";\n }\n\n public setTexture(_name: string, _texture: BaseTexture, _bindSampler = true): never {\n return unsupported(\n \"ComputeShader.setTexture\",\n \"Lite validates an existing Texture2D for compute through the asynchronous createComputeTextureResource API, which cannot preserve Babylon.js's synchronous setter and dispatch contract.\"\n );\n }\n\n public setInternalTexture(_name: string, _texture: unknown): never {\n return unsupported(\n \"ComputeShader.setInternalTexture\",\n \"Lite intentionally does not expose raw GPU texture handles, and its public compute texture adapter is asynchronous.\"\n );\n }\n\n public setStorageTexture(_name: string, _texture: BaseTexture): never {\n return unsupported(\n \"ComputeShader.setStorageTexture\",\n \"A Babylon.js BaseTexture does not carry the storage usage, format, and access metadata required by Lite's distinct ComputeStorageTexture public resource.\"\n );\n }\n\n public setExternalTexture(_name: string, _texture: unknown): never {\n return unsupported(\"ComputeShader.setExternalTexture\", \"Lite's public compute binding API has no external-texture binding declaration or resource.\");\n }\n\n public setVideoTexture(_name: string, _texture: unknown): false {\n return false;\n }\n\n public setUniformBuffer(name: string, buffer: UniformBuffer | LiteUniformBuffer): void {\n const resource = \"_getLiteBuffer\" in buffer ? buffer._getLiteBuffer() : buffer;\n const current = this._bindings.get(name);\n if (current?.kind === \"uniform\" && current.resource === resource) {\n return;\n }\n this._bindingsDirty = true;\n this._shaderDirty ||= this._shader !== null && (current === undefined || current.kind !== \"uniform\");\n this._bindings.set(name, { kind: \"uniform\", resource });\n }\n\n public setStorageBuffer(name: string, buffer: StorageBuffer | LiteStorageBuffer): void {\n const resource = \"_getLiteBuffer\" in buffer ? buffer._getLiteBuffer() : buffer;\n const current = this._bindings.get(name);\n if (current?.kind === \"storage\" && current.resource === resource) {\n return;\n }\n this._bindingsDirty = true;\n this._shaderDirty ||= this._shader !== null && (current === undefined || current.kind !== \"storage\");\n this._bindings.set(name, { kind: \"storage\", resource });\n }\n\n public setTextureSampler(_name: string, _sampler: unknown): never {\n return unsupported(\n \"ComputeShader.setTextureSampler\",\n \"Babylon.js TextureSampler does not expose a Lite ComputeSampler, and Lite intentionally does not accept raw GPUSampler handles.\"\n );\n }\n\n public isReady(): boolean {\n if (!this._engine._lite) {\n return false;\n }\n for (const name of this._bindings.keys()) {\n if (!this._options.bindingsMapping[name]) {\n throw new Error(`ComputeShader ('${this.name}'): No binding mapping has been provided for the property '${name}'`);\n }\n }\n if (this._bindingsDirty) {\n this._invalidateBindings(this._shaderDirty);\n this._bindingsDirty = false;\n this._shaderDirty = false;\n }\n this._createGraph();\n return true;\n }\n\n public dispatch(x: number, y = 1, z = 1): boolean {\n const checkContext = !this.fastMode || this.triggerContextRebuild || !this._shader || !this._bindingSet;\n if (this.triggerContextRebuild) {\n this._bindingsDirty = true;\n }\n if (checkContext && !this.isReady()) {\n return false;\n }\n const graph = this._createGraph();\n const dispatch = createComputeDispatch(graph.shader, graph.bindings, { size: { x, y, z } });\n this._submit(graph, dispatch);\n return true;\n }\n\n public dispatchIndirect(buffer: StorageBuffer | LiteStorageBuffer, offset = 0): boolean {\n const checkContext = !this.fastMode || this.triggerContextRebuild || !this._shader || !this._bindingSet;\n if (this.triggerContextRebuild) {\n this._bindingsDirty = true;\n }\n if (checkContext && !this.isReady()) {\n return false;\n }\n const resource = \"_getLiteBuffer\" in buffer ? buffer._getLiteBuffer() : buffer;\n const graph = this._createGraph();\n const dispatch = createComputeIndirectDispatch(graph.shader, graph.bindings, { buffer: resource, byteOffset: offset });\n this._submit(graph, dispatch);\n return true;\n }\n\n public async dispatchWhenReady(x: number, y = 1, z = 1, delay = 10): Promise<void> {\n while (!this.dispatch(x, y, z)) {\n await new Promise<void>((resolve) => setTimeout(resolve, delay));\n }\n }\n\n public serialize(): Record<string, unknown> {\n return {\n name: this.name,\n fastMode: this.fastMode,\n options: this._options,\n shaderPath: this._shaderPath,\n bindings: {},\n textures: {},\n };\n }\n\n private _createGraph(): { shader: LiteComputeShader; bindings: LiteComputeBindingSet } {\n const shader = this._createShader();\n let compiledNow = false;\n if (!this._compiled) {\n this._compiled = true;\n compiledNow = true;\n this.onCompiled?.(shader);\n }\n if (compiledNow && this._bindingsDirty) {\n const recreateShader = this._shaderDirty;\n this._invalidateBindings(recreateShader);\n this._bindingsDirty = false;\n this._shaderDirty = false;\n const finalShader = recreateShader ? this._createShader() : shader;\n this._compiled = true;\n return { shader: finalShader, bindings: this._createBindingSet(finalShader) };\n }\n return { shader, bindings: this._createBindingSet(shader) };\n }\n\n private _createShader(): LiteComputeShader {\n const declarations: ComputeBindingDecl[] = [];\n for (const [name, binding] of this._bindings) {\n const location = this._options.bindingsMapping[name];\n if (!location) {\n throw new Error(`ComputeShader ('${this.name}'): No binding mapping has been provided for the property '${name}'`);\n }\n declarations.push(\n binding.kind === \"uniform\"\n ? computeUniformBufferBinding(name, location)\n : computeStorageBufferBinding(name, {\n ...location,\n access: this._options.useExplicitComputePipelineLayout === true ? \"read-write\" : \"read\",\n })\n );\n }\n return (this._shader ??= createComputeShader(this._engine._lite, {\n name: this.name,\n computeSource: this._source,\n entryPoint: this._options.entryPoint,\n bindings: declarations,\n automaticLayout: this._options.useExplicitComputePipelineLayout !== true,\n }));\n }\n\n private _createBindingSet(shader: LiteComputeShader): LiteComputeBindingSet {\n if (!this._bindingSet) {\n const resources: Record<string, unknown> = {};\n for (const [name, binding] of this._bindings) {\n resources[name] = binding.resource;\n }\n this._bindingSet = createComputeBindingSet(shader, resources as ComputeBindingResources);\n }\n return this._bindingSet;\n }\n\n private _submit(graph: { shader: LiteComputeShader; bindings: LiteComputeBindingSet }, dispatch: ReturnType<typeof createComputeDispatch>): void {\n const task = createComputeTask(this._engine._lite, this.name);\n addComputeDispatch(task, dispatch);\n task.record();\n try {\n submitComputeTasks([task]);\n } catch (error) {\n if (error instanceof Error && error.message === \"submitComputeTasks cannot run while a frame is being recorded.\") {\n return unsupported(\n \"ComputeShader.dispatch\",\n \"Lite's public immediate compute submission cannot run while its frame encoder is active, and it exposes no engine-level hook equivalent to Babylon.js's in-frame compute dispatch.\"\n );\n }\n this.onError?.(graph.shader, error instanceof Error ? error.message : String(error));\n throw error;\n } finally {\n task.dispose();\n this.triggerContextRebuild = false;\n }\n }\n\n private _invalidateBindings(recreateShader = false): void {\n if (this._bindingSet) {\n disposeComputeBindingSet(this._bindingSet);\n this._bindingSet = null;\n }\n if (recreateShader && this._shader) {\n disposeComputeShader(this._shader);\n this._shader = null;\n this._compiled = false;\n }\n }\n}\n\nexport function ComputeShaderParse(source: Record<string, unknown>, scene: { getEngine(): AbstractEngine }, _rootUrl: string): ComputeShader {\n if (source.textures && Object.keys(source.textures as object).length > 0) {\n return unsupported(\n \"ComputeShader.Parse\",\n \"Serialized Babylon.js textures require its texture parser, while Lite's public compute texture adapter is asynchronous and has no serialization registry.\"\n );\n }\n const computeShader = new ComputeShader(\n String(source.name ?? \"\"),\n scene.getEngine(),\n source.shaderPath as IComputeShaderPath | string,\n (source.options ?? {}) as Partial<IComputeShaderOptions>\n );\n computeShader.fastMode = source.fastMode === true;\n return computeShader;\n}\n\nexport function RegisterComputeShader(): void {}\n","import { clearStorageBuffer, createStorageBuffer, disposeStorageBuffer, readStorageBufferAfterFrame, updateStorageBufferRange } from \"babylon-lite\";\nimport type { StorageBuffer as LiteStorageBuffer } from \"babylon-lite\";\n\nimport type { WebGPUEngine } from \"../engine/engine.js\";\nimport { unsupported } from \"../error.js\";\n\nexport type DataArray = number[] | ArrayBufferLike | ArrayBufferView;\n\nfunction asBytes(data: DataArray, byteLength?: number): Uint8Array {\n let bytes: Uint8Array;\n if (Array.isArray(data)) {\n bytes = new Uint8Array(new Float32Array(data).buffer);\n } else if (ArrayBuffer.isView(data)) {\n bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n } else {\n bytes = new Uint8Array(data);\n }\n if (byteLength === undefined) {\n return bytes;\n }\n if (!Number.isSafeInteger(byteLength) || byteLength < 0 || byteLength > bytes.byteLength) {\n throw new RangeError(`StorageBuffer byteLength must be between 0 and ${bytes.byteLength}; received ${byteLength}.`);\n }\n return bytes.subarray(0, byteLength);\n}\n\n/** Babylon.js-shaped wrapper over Lite's public opaque storage allocation. */\nexport class StorageBuffer {\n /** @internal */\n public _lite: LiteStorageBuffer | null;\n private readonly _copyReadable: boolean;\n private readonly _copyWritable: boolean;\n\n public constructor(\n private readonly _engine: WebGPUEngine,\n size: number,\n creationFlags = 3,\n label?: string\n ) {\n if ((creationFlags & 4) !== 0) {\n unsupported(\n \"StorageBuffer.constructor\",\n \"Babylon.js can combine storage and uniform usage on one DataBuffer, while Babylon Lite intentionally exposes distinct opaque StorageBuffer and UniformBuffer allocations.\"\n );\n }\n this._copyReadable = (creationFlags & 1) !== 0;\n this._copyWritable = (creationFlags & 2) !== 0;\n this._lite = createStorageBuffer(_engine._lite, size, {\n label,\n // Every BJS StorageBuffer can be declared read-only or read-write by WGSL.\n // Lite's `writable` flag enables that shader role and also supplies COPY_SRC;\n // the BJS READ flag is enforced independently by read().\n writable: true,\n vertex: (creationFlags & 8) !== 0,\n index: (creationFlags & 16) !== 0,\n indirect: (creationFlags & 64) !== 0,\n });\n }\n\n /** @internal Lite owns device-loss resource rebuilding. */\n public _rebuild(): void {}\n\n public getBuffer(): LiteStorageBuffer | null {\n return this._lite;\n }\n\n public clear(byteOffset = 0, byteLength = this._requireBuffer().byteLength - byteOffset): void {\n this._assertCopyWritable(\"clear\");\n const buffer = this._requireBuffer();\n if (!Number.isSafeInteger(byteOffset) || byteOffset < 0 || !Number.isSafeInteger(byteLength) || byteLength < 0 || byteOffset + byteLength > buffer.byteLength) {\n throw new RangeError(`StorageBuffer.clear range [${byteOffset}, ${byteOffset + byteLength}) exceeds the ${buffer.byteLength}-byte buffer.`);\n }\n clearStorageBuffer(this._engine._lite, buffer, byteOffset, byteLength);\n }\n\n public update(data: DataArray, byteOffset = 0, byteLength?: number): void {\n if (!this._lite) {\n return;\n }\n this._assertCopyWritable(\"update\");\n updateStorageBufferRange(this._engine._lite, this._lite, asBytes(data, byteLength), byteOffset);\n }\n\n public async read(offset = 0, size = this._requireBuffer().byteLength - offset, buffer?: ArrayBufferView, noDelay = false): Promise<ArrayBufferView> {\n if (!this._copyReadable) {\n throw new Error(\"StorageBuffer.read requires Constants.BUFFER_CREATIONFLAG_READ.\");\n }\n const result = await readStorageBufferAfterFrame(this._requireBuffer(), offset, size, noDelay);\n const bytes = new Uint8Array(result);\n if (!buffer) {\n return bytes;\n }\n if (buffer.byteLength < bytes.byteLength) {\n throw new RangeError(`StorageBuffer.read target has ${buffer.byteLength} bytes but ${bytes.byteLength} bytes were requested.`);\n }\n new Uint8Array(buffer.buffer, buffer.byteOffset, bytes.byteLength).set(bytes);\n return buffer;\n }\n\n public dispose(): void {\n if (this._lite) {\n disposeStorageBuffer(this._lite);\n this._lite = null;\n }\n }\n\n /** @internal */\n public _getLiteBuffer(): LiteStorageBuffer {\n return this._requireBuffer();\n }\n\n private _requireBuffer(): LiteStorageBuffer {\n if (!this._lite) {\n throw new Error(\"StorageBuffer has been disposed.\");\n }\n return this._lite;\n }\n\n private _assertCopyWritable(operation: string): void {\n if (!this._copyWritable) {\n throw new Error(`StorageBuffer.${operation} requires Constants.BUFFER_CREATIONFLAG_WRITE.`);\n }\n }\n}\n","import { createUniformBuffer, disposeUniformBuffer, updateUniformBuffer } from \"babylon-lite\";\nimport type { UniformBuffer as LiteUniformBuffer } from \"babylon-lite\";\n\nimport type { AbstractEngine } from \"../engine/engine.js\";\nimport { unsupported } from \"../error.js\";\nimport type { BaseTexture } from \"../textures/textures.js\";\n\nexport interface MatrixLike {\n asArray(): ArrayLike<number>;\n readonly updateFlag?: number;\n}\n\nexport interface Vector3Like {\n readonly x: number;\n readonly y: number;\n readonly z: number;\n}\n\nexport interface Vector4Like extends Vector3Like {\n readonly w: number;\n}\n\nexport interface Color3Like {\n readonly r: number;\n readonly g: number;\n readonly b: number;\n}\n\nexport interface Color4Like extends Color3Like {\n readonly a: number;\n}\n\ntype FloatArray = number[] | Float32Array;\n\ninterface UniformArrayLayout {\n readonly strideSize: number;\n readonly arraySize: number;\n}\n\n/** Minimum Babylon.js UniformBuffer surface needed to author compute bindings. */\nexport class UniformBuffer {\n private readonly _data: number[];\n private readonly _dynamic: boolean;\n private readonly _uniformLocations = new Map<string, number>();\n private readonly _uniformSizes = new Map<string, number>();\n private readonly _uniformArraySizes = new Map<string, UniformArrayLayout>();\n private readonly _uniformNames: string[] = [];\n private _uniformLocationPointer = 0;\n private _bufferData: Float32Array | null = null;\n private _buffer: LiteUniformBuffer | null = null;\n private _needSync = false;\n private _name: string;\n\n public constructor(\n private readonly _engine: AbstractEngine,\n data: number[] = [],\n dynamic = false,\n name = \"no-name\",\n forceNoUniformBuffer = false,\n _trackUBOsInFrame?: boolean\n ) {\n if (forceNoUniformBuffer) {\n unsupported(\n \"UniformBuffer.constructor\",\n \"A forceNoUniformBuffer instance falls back to Effect setters in Babylon.js and therefore has no GPU uniform allocation that Lite compute bindings can consume.\"\n );\n }\n this._data = data;\n this._dynamic = dynamic;\n this._name = name;\n }\n\n public readonly updateMatrix3x3 = (name: string, matrix: Float32Array): void => {\n const aligned = new Float32Array(12);\n for (let column = 0; column < 3; column++) {\n aligned.set(matrix.subarray(column * 3, column * 3 + 3), column * 4);\n }\n this.updateUniform(name, aligned, 12);\n };\n\n public readonly updateMatrix2x2 = (name: string, matrix: Float32Array): void => {\n const aligned = new Float32Array(8);\n for (let column = 0; column < 2; column++) {\n aligned.set(matrix.subarray(column * 2, column * 2 + 2), column * 4);\n }\n this.updateUniform(name, aligned, 8);\n };\n\n public readonly updateFloat = (name: string, x: number, _suffix?: string): void => this.updateUniform(name, [x], 1);\n public readonly updateFloat2 = (name: string, x: number, y: number, _suffix?: string): void => this.updateUniform(name, [x, y], 2);\n public readonly updateFloat3 = (name: string, x: number, y: number, z: number, _suffix?: string): void => this.updateUniform(name, [x, y, z], 3);\n public readonly updateFloat4 = (name: string, x: number, y: number, z: number, w: number, _suffix?: string): void => this.updateUniform(name, [x, y, z, w], 4);\n public readonly updateFloatArray = (name: string, array: Float32Array, _suffix?: string): void => this.updateUniformArray(name, array, array.length);\n public readonly updateArray = (name: string, array: number[]): void => this.updateUniformArray(name, array, array.length);\n public readonly updateIntArray = (name: string, array: Int32Array): void => this._updateIntegerUniformArray(name, array, false);\n public readonly updateUIntArray = (name: string, array: Uint32Array): void => this._updateIntegerUniformArray(name, array, true);\n public readonly updateMatrix = (name: string, matrix: MatrixLike): void => this.updateUniform(name, Array.from(matrix.asArray()), 16);\n public readonly updateMatrices = (name: string, matrices: Float32Array): void => this.updateUniform(name, matrices, matrices.length);\n public readonly updateVector3 = (name: string, vector: Vector3Like): void => this.updateFloat3(name, vector.x, vector.y, vector.z);\n public readonly updateVector4 = (name: string, vector: Vector4Like): void => this.updateFloat4(name, vector.x, vector.y, vector.z, vector.w);\n public readonly updateColor3 = (name: string, color: Color3Like, suffix?: string): void => this.updateFloat3(name, color.r, color.g, color.b, suffix);\n public readonly updateColor4 = (name: string, color: Color3Like, alpha: number, suffix?: string): void => this.updateFloat4(name, color.r, color.g, color.b, alpha, suffix);\n public readonly updateDirectColor4 = (name: string, color: Color4Like, suffix?: string): void => this.updateFloat4(name, color.r, color.g, color.b, color.a, suffix);\n public readonly updateInt = (name: string, x: number, _suffix?: string): void => this._updateIntegerUniform(name, [x], false);\n public readonly updateInt2 = (name: string, x: number, y: number, _suffix?: string): void => this._updateIntegerUniform(name, [x, y], false);\n public readonly updateInt3 = (name: string, x: number, y: number, z: number, _suffix?: string): void => this._updateIntegerUniform(name, [x, y, z], false);\n public readonly updateInt4 = (name: string, x: number, y: number, z: number, w: number, _suffix?: string): void => this._updateIntegerUniform(name, [x, y, z, w], false);\n public readonly updateUInt = (name: string, x: number, _suffix?: string): void => this._updateIntegerUniform(name, [x], true);\n public readonly updateUInt2 = (name: string, x: number, y: number, _suffix?: string): void => this._updateIntegerUniform(name, [x, y], true);\n public readonly updateUInt3 = (name: string, x: number, y: number, z: number, _suffix?: string): void => this._updateIntegerUniform(name, [x, y, z], true);\n public readonly updateUInt4 = (name: string, x: number, y: number, z: number, w: number, _suffix?: string): void => this._updateIntegerUniform(name, [x, y, z, w], true);\n\n public get useUbo(): boolean {\n return true;\n }\n\n public get isSync(): boolean {\n return !this._needSync;\n }\n\n public isDynamic(): boolean {\n return this._dynamic;\n }\n\n public getData(): Float32Array {\n return this._bufferData ?? new Float32Array(this._data);\n }\n\n public getBuffer(): LiteUniformBuffer | null {\n return this._buffer;\n }\n\n public getUniformNames(): string[] {\n return this._uniformNames.slice();\n }\n\n public addUniform(name: string, sizeOrData: number | number[], arraySize = 0): void {\n if (this._uniformLocations.has(name)) {\n return;\n }\n if (this._buffer) {\n throw new Error(`Cannot add uniform \"${name}\" after the UniformBuffer has been created.`);\n }\n this._uniformNames.push(name);\n let size: number;\n let data: number[];\n if (arraySize > 0) {\n if (typeof sizeOrData !== \"number\") {\n throw new TypeError(`addUniform cannot use inline array data for UBO array \"${name}\".`);\n }\n this._align(4);\n this._uniformArraySizes.set(name, { strideSize: sizeOrData, arraySize });\n size = sizeOrData === 16 ? sizeOrData * arraySize : 4 * arraySize;\n data = new Array<number>(size).fill(0);\n } else {\n data = typeof sizeOrData === \"number\" ? new Array<number>(sizeOrData).fill(0) : sizeOrData.slice();\n size = data.length;\n this._align(size);\n }\n this._uniformLocations.set(name, this._uniformLocationPointer);\n this._uniformSizes.set(name, size);\n this._uniformLocationPointer += size;\n this._data.push(...data);\n this._needSync = true;\n }\n\n public addMatrix(name: string, matrix: MatrixLike): void {\n this.addUniform(name, Array.from(matrix.asArray()));\n }\n\n public addFloat2(name: string, x: number, y: number): void {\n this.addUniform(name, [x, y]);\n }\n\n public addFloat3(name: string, x: number, y: number, z: number): void {\n this.addUniform(name, [x, y, z]);\n }\n\n public addColor3(name: string, color: Color3Like): void {\n this.addUniform(name, [color.r, color.g, color.b]);\n }\n\n public addColor4(name: string, color: Color3Like, alpha: number): void {\n this.addUniform(name, [color.r, color.g, color.b, alpha]);\n }\n\n public addVector3(name: string, vector: Vector3Like): void {\n this.addUniform(name, [vector.x, vector.y, vector.z]);\n }\n\n public addMatrix3x3(name: string): void {\n this.addUniform(name, 12);\n }\n\n public addMatrix2x2(name: string): void {\n this.addUniform(name, 8);\n }\n\n public create(): void {\n if (this._buffer) {\n return;\n }\n this._align(4);\n this._bufferData = new Float32Array(this._data);\n this._buffer = createUniformBuffer(this._engine._lite, this._bufferData, { label: `${this._name}_UniformList:${this._uniformNames.slice(0, 10).join(\",\")}` });\n this._needSync = true;\n }\n\n /** @internal */\n public _getLiteBuffer(): LiteUniformBuffer {\n this.create();\n return this._buffer!;\n }\n\n public get name(): string {\n return this._name;\n }\n\n public set name(value: string) {\n this._name = value;\n }\n\n public get currentEffect(): unknown | null {\n return null;\n }\n\n public update(): void {\n this.create();\n if (this._dynamic || this._needSync) {\n updateUniformBuffer(this._engine._lite, this._buffer!, this._bufferData!);\n this._needSync = false;\n }\n }\n\n public updateUniform(uniformName: string, data: FloatArray, size: number): void {\n let location = this._uniformLocations.get(uniformName);\n if (location === undefined) {\n this.addUniform(uniformName, size);\n location = this._uniformLocations.get(uniformName)!;\n }\n this.create();\n if (size > (this._uniformSizes.get(uniformName) ?? 0)) {\n throw new RangeError(`Uniform \"${uniformName}\" has room for ${this._uniformSizes.get(uniformName)} floats, not ${size}.`);\n }\n for (let i = 0; i < size; i++) {\n const value = Math.fround(data[i]!);\n if (this._bufferData![location + i] !== value) {\n this._bufferData![location + i] = value;\n this._needSync = true;\n }\n }\n }\n\n public updateUniformArray(uniformName: string, data: FloatArray, size: number): void {\n const location = this._uniformLocations.get(uniformName);\n const layout = this._uniformArraySizes.get(uniformName);\n if (location === undefined || !layout) {\n throw new Error(`Uniform array \"${uniformName}\" must be declared with addUniform before it can be updated.`);\n }\n this.create();\n if (size > layout.strideSize * layout.arraySize) {\n throw new RangeError(`Uniform array \"${uniformName}\" accepts at most ${layout.strideSize * layout.arraySize} values, not ${size}.`);\n }\n for (let i = 0; i < size; i++) {\n const destination = location + Math.floor(i / layout.strideSize) * 4 + (i % layout.strideSize);\n const value = Math.fround(data[i]!);\n if (this._bufferData![destination] !== value) {\n this._bufferData![destination] = value;\n this._needSync = true;\n }\n }\n }\n\n public setTexture(_name: string, _texture: BaseTexture | null): never {\n return unsupported(\"UniformBuffer.setTexture\", \"Lite compute uniform allocations contain bytes only and do not own Effect sampler bindings.\");\n }\n\n public setTextureArray(_name: string, _textures: BaseTexture[]): never {\n return unsupported(\"UniformBuffer.setTextureArray\", \"Lite compute uniform allocations contain bytes only and do not own Effect sampler bindings.\");\n }\n\n public bindTexture(_name: string, _texture: unknown | null): never {\n return unsupported(\"UniformBuffer.bindTexture\", \"Lite compute uniform allocations contain bytes only and do not own Effect sampler bindings.\");\n }\n\n public updateUniformDirectly(uniformName: string, data: FloatArray): void {\n const size = this._uniformSizes.get(uniformName);\n if (size === undefined) {\n throw new Error(`Uniform \"${uniformName}\" has not been declared.`);\n }\n this.updateUniform(uniformName, data, Math.min(size, data.length));\n this.update();\n }\n\n public bindToEffect(_effect: unknown, _name: string): never {\n return unsupported(\n \"UniformBuffer.bindToEffect\",\n \"The compute-only compat UniformBuffer forwards to Lite's opaque compute allocation; Lite has no Babylon.js Effect binding surface.\"\n );\n }\n\n public bindUniformBuffer(): never {\n return unsupported(\"UniformBuffer.bindUniformBuffer\", \"The compute-only compat UniformBuffer is bound through ComputeShader.setUniformBuffer.\");\n }\n\n public unbindEffect(): void {}\n\n public setDataBuffer(dataBuffer: LiteUniformBuffer): boolean {\n return this._buffer === dataBuffer;\n }\n\n public has(name: string): boolean {\n return this._uniformLocations.has(name);\n }\n\n public dispose(): void {\n if (this._buffer) {\n disposeUniformBuffer(this._buffer);\n this._buffer = null;\n }\n }\n\n private _align(size: number): void {\n const alignment = size <= 2 ? size : 4;\n if (alignment > 0 && this._uniformLocationPointer % alignment !== 0) {\n const padding = alignment - (this._uniformLocationPointer % alignment);\n this._data.push(...new Array<number>(padding).fill(0));\n this._uniformLocationPointer += padding;\n }\n }\n\n private _updateIntegerUniform(uniformName: string, data: ArrayLike<number>, unsigned: boolean): void {\n let location = this._uniformLocations.get(uniformName);\n if (location === undefined) {\n this.addUniform(uniformName, data.length);\n location = this._uniformLocations.get(uniformName)!;\n }\n this.create();\n if (data.length > (this._uniformSizes.get(uniformName) ?? 0)) {\n throw new RangeError(`Uniform \"${uniformName}\" has room for ${this._uniformSizes.get(uniformName)} values, not ${data.length}.`);\n }\n const view = unsigned ? new Uint32Array(this._bufferData!.buffer) : new Int32Array(this._bufferData!.buffer);\n for (let i = 0; i < data.length; i++) {\n this._setInteger(view, location + i, data[i]!, unsigned);\n }\n }\n\n private _updateIntegerUniformArray(uniformName: string, data: ArrayLike<number>, unsigned: boolean): void {\n const location = this._uniformLocations.get(uniformName);\n const layout = this._uniformArraySizes.get(uniformName);\n if (location === undefined || !layout) {\n throw new Error(`Uniform array \"${uniformName}\" must be declared with addUniform before it can be updated.`);\n }\n this.create();\n if (data.length > layout.strideSize * layout.arraySize) {\n throw new RangeError(`Uniform array \"${uniformName}\" accepts at most ${layout.strideSize * layout.arraySize} values, not ${data.length}.`);\n }\n const view = unsigned ? new Uint32Array(this._bufferData!.buffer) : new Int32Array(this._bufferData!.buffer);\n for (let i = 0; i < data.length; i++) {\n const destination = location + Math.floor(i / layout.strideSize) * 4 + (i % layout.strideSize);\n this._setInteger(view, destination, data[i]!, unsigned);\n }\n }\n\n private _setInteger(view: Int32Array | Uint32Array, index: number, input: number, unsigned: boolean): void {\n const value = unsigned ? input >>> 0 : input | 0;\n if (view[index] !== value) {\n view[index] = value;\n this._needSync = true;\n }\n }\n}\n","/**\n * Babylon.js-compatible `AbstractScene` — the base of the `Scene` class.\n *\n * In Babylon.js the scene class chain is `Scene extends AbstractScene`, where\n * `AbstractScene` owns the entity collections (`meshes`, `cameras`, `lights`,\n * `materials`, …) and the by-name lookups over them. The compat layer mirrors\n * that split so `instanceof AbstractScene` and the inherited collection API\n * behave as ported code expects. {@link Scene} adds the engine-backed rendering,\n * environment, animation, and lifecycle surface on top.\n */\n\nimport type { Node } from \"../node/node.js\";\nimport type { Camera } from \"../cameras/cameras.js\";\nimport type { Light } from \"../lights/lights.js\";\nimport type { TransformNode } from \"../meshes/meshes.js\";\nimport type { Material } from \"../materials/materials.js\";\n\nexport abstract class AbstractScene {\n /**\n * @internal Canonical compat mesh-wrapper registry, keyed by the Lite node each\n * wrapper carries. Kept in sync with the Lite-core-owned scene list: a wrapper is\n * registered when its mesh is constructed against the scene and dropped on dispose,\n * mirroring the core `addToScene` / `removeFromScene` it drives. `scene.meshes` is\n * derived from this so **every** compat mesh is enumerable — ordinary primitives\n * (which register straight with the Lite scene) as well as the loader-surfaced\n * Gaussian-Splatting meshes, which the old array only ever held.\n */\n protected readonly _meshWrappers = new Map<object, TransformNode>();\n /** @internal Stable Babylon.js-compatible array returned by `scene.meshes`. */\n protected readonly _meshes: TransformNode[] = [];\n /** @internal Reused scratch array for reconciling Lite-core mesh order. */\n protected readonly _orderedCoreMeshes: TransformNode[] = [];\n /** @internal Reused membership set for linear-time mesh-order reconciliation. */\n protected readonly _orderedCoreMeshSet = new Set<TransformNode>();\n /** @internal Cameras constructed against this scene (`scene.cameras`). */\n protected readonly _cameras: Camera[] = [];\n /** @internal Lights constructed against this scene (`scene.lights`). */\n protected readonly _lights: Light[] = [];\n /** @internal Materials constructed against this scene (`scene.materials`). */\n protected readonly _materials: Material[] = [];\n\n /**\n * @internal The Lite-core-owned mesh list backing `scene.meshes`. The concrete\n * {@link Scene} overrides this to return its Lite `SceneContext.meshes` (the\n * authoritative list); the abstract base owns no Lite scene, so it returns none.\n * Returning the core meshes directly is not an option (they are Lite `Mesh`\n * objects, not compat wrappers) — they only provide the authoritative membership\n * and order that {@link meshes} maps back onto canonical wrappers.\n */\n protected _coreMeshList(): readonly object[] {\n return [];\n }\n\n /**\n * Babylon.js `scene.meshes` — the compat mesh wrappers in the scene. Backed by the\n * canonical {@link _meshWrappers} registry and kept in sync with the Lite-core-owned\n * list: the core list ({@link _coreMeshList}) supplies authoritative membership and\n * ordering, mapped back to each mesh's canonical wrapper so the returned handles are\n * the right type and keep wrapper identity. Wrappers not yet mirrored into the core\n * list (transform-only loader roots, primitives whose scene-add is deferred to engine\n * start, and Gaussian-Splatting meshes that register their renderables outside\n * `scene.meshes`) retain their registration positions.\n */\n public get meshes(): TransformNode[] {\n const orderedCore = this._orderedCoreMeshes;\n const orderedCoreSet = this._orderedCoreMeshSet;\n orderedCore.length = 0;\n orderedCoreSet.clear();\n for (const core of this._coreMeshList()) {\n const wrapper = this._meshWrappers.get(core);\n if (wrapper && !orderedCoreSet.has(wrapper)) {\n orderedCore.push(wrapper);\n orderedCoreSet.add(wrapper);\n }\n }\n\n let orderedIndex = 0;\n for (let i = 0; i < this._meshes.length; i++) {\n if (orderedCoreSet.has(this._meshes[i]!)) {\n this._meshes[i] = orderedCore[orderedIndex++]!;\n }\n }\n return this._meshes;\n }\n\n /** Babylon.js `scene.cameras` — every camera constructed against this scene. */\n public get cameras(): Camera[] {\n return this._cameras;\n }\n\n /** Babylon.js `scene.lights` — every light constructed against this scene. */\n public get lights(): Light[] {\n return this._lights;\n }\n\n /** Babylon.js `scene.materials` — every material constructed against this scene. */\n public get materials(): Material[] {\n return this._materials;\n }\n\n /**\n * @internal Register a compat mesh wrapper so it appears in `scene.meshes`. Keyed\n * by the Lite node the wrapper carries (`liteKey`) so it can be reconciled with the\n * core-owned list — pass an `AbstractMesh`'s `_lite`; loader-surfaced meshes whose\n * Lite node is not a core scene mesh (Gaussian Splatting) key by the wrapper itself.\n */\n public _registerMesh(mesh: TransformNode, liteKey: object = mesh): void {\n const registered = this._meshWrappers.get(liteKey);\n if (registered && registered !== mesh) {\n return;\n }\n if (!registered) {\n this._meshWrappers.set(liteKey, mesh);\n }\n if (!this._meshes.includes(mesh)) {\n this._meshes.push(mesh);\n }\n }\n\n /** @internal Register a camera so it appears in `scene.cameras`. */\n public _registerCamera(camera: Camera): void {\n if (!this._cameras.includes(camera)) {\n this._cameras.push(camera);\n }\n }\n\n /** @internal Register a light so it appears in `scene.lights`. */\n public _registerLight(light: Light): void {\n if (!this._lights.includes(light)) {\n this._lights.push(light);\n }\n }\n\n /** @internal Register a material so it appears in `scene.materials`. */\n public _registerMaterial(material: Material): void {\n if (!this._materials.includes(material)) {\n this._materials.push(material);\n }\n }\n\n /** @internal Remove a node from the camera / light / mesh registries on dispose. */\n public _unregisterNode(node: Node): void {\n const ci = this._cameras.indexOf(node as unknown as Camera);\n if (ci !== -1) {\n this._cameras.splice(ci, 1);\n }\n const li = this._lights.indexOf(node as unknown as Light);\n if (li !== -1) {\n this._lights.splice(li, 1);\n }\n for (const [key, wrapper] of this._meshWrappers) {\n if (wrapper === (node as unknown as TransformNode)) {\n this._meshWrappers.delete(key);\n }\n }\n const mi = this._meshes.indexOf(node as unknown as TransformNode);\n if (mi !== -1) {\n this._meshes.splice(mi, 1);\n }\n }\n\n /** @internal Remove a material from `scene.materials` on dispose. */\n public _unregisterMaterial(material: Material): void {\n const i = this._materials.indexOf(material);\n if (i !== -1) {\n this._materials.splice(i, 1);\n }\n }\n\n /** Babylon.js `scene.getCameraByName(name)` — first camera with a matching name, else `null`. */\n public getCameraByName(name: string): Camera | null {\n return this._cameras.find((c) => c.name === name) ?? null;\n }\n\n /** Babylon.js `scene.getCameraById(id)` — first camera whose `id` matches, else `null`. */\n public getCameraById(id: string): Camera | null {\n return this._cameras.find((c) => (c as unknown as { id?: string }).id === id) ?? null;\n }\n\n /** Babylon.js `scene.getLightByName(name)` — first light with a matching name, else `null`. */\n public getLightByName(name: string): Light | null {\n return this._lights.find((l) => l.name === name) ?? null;\n }\n\n /** Babylon.js `scene.getLightById(id)` — first light whose `id` matches, else `null`. */\n public getLightById(id: string): Light | null {\n return this._lights.find((l) => (l as unknown as { id?: string }).id === id) ?? null;\n }\n\n /** Babylon.js `scene.getMaterialByName(name)` — first material with a matching name, else `null`. */\n public getMaterialByName(name: string): Material | null {\n return this._materials.find((m) => m.name === name) ?? null;\n }\n\n /** Babylon.js `scene.getMaterialById(id)` — first material whose `id` matches, else `null`. */\n public getMaterialById(id: string): Material | null {\n return this._materials.find((m) => (m as unknown as { id?: string }).id === id) ?? null;\n }\n\n /**\n * Babylon.js `scene.getMeshByName(name)` — first mesh in {@link meshes} with a\n * matching name, else `null`. Enumerates the full canonical mesh registry\n * (primitives + loader-surfaced meshes), not just the loader-surfaced subset.\n */\n public getMeshByName(name: string): TransformNode | null {\n return this.meshes.find((m) => m.name === name) ?? null;\n }\n\n /** Babylon.js `scene.getMeshById(id)` — first mesh whose `id` matches, else `null`. */\n public getMeshById(id: string): TransformNode | null {\n return this.meshes.find((m) => (m as unknown as { id?: string }).id === id) ?? null;\n }\n\n /** Babylon.js legacy `scene.getMeshByID(id)` — alias of {@link getMeshById}. */\n public getMeshByID(id: string): TransformNode | null {\n return this.getMeshById(id);\n }\n\n /** Babylon.js `scene.getNodeByName(name)` — searches meshes, cameras, and lights. */\n public getNodeByName(name: string): Node | null {\n return this.meshes.find((m) => m.name === name) ?? this._cameras.find((c) => c.name === name) ?? this._lights.find((l) => l.name === name) ?? null;\n }\n\n /** Babylon.js `scene.getNodeById(id)` — searches meshes, cameras, and lights by `id`. */\n public getNodeById(id: string): Node | null {\n const byId = (n: { id?: string }): boolean => n.id === id;\n return (\n this.meshes.find((m) => byId(m as unknown as { id?: string })) ??\n this._cameras.find((c) => byId(c as unknown as { id?: string })) ??\n this._lights.find((l) => byId(l as unknown as { id?: string })) ??\n null\n );\n }\n}\n","/**\n * Physics (Havok V2) compat surface.\n *\n * Babylon Lite ships a Havok-V2 physics subset through standalone factory\n * functions (`createHavokWorld`, `createPhysicsAggregate`, …). This module wraps\n * the Babylon.js class-shaped entry points on top of that native API so ported\n * `@babylonjs/core` physics code resolves and behaves correctly.\n *\n * The headline wrapper is {@link HavokPlugin}, which mirrors Babylon.js's\n * `new HavokPlugin(useDeltaForWorldStep, hpInjection)`. When\n * `useDeltaForWorldStep` is `true` (the Babylon.js default) the world is stepped\n * by the **elapsed frame time** rather than a fixed `1/60` slice, so simulation\n * speed is independent of the display refresh rate (resolves issue #332). Lite's\n * native physics does this on its own: a world with no fixed step (its\n * `_fixedDeltaMs` is `0`, the default) advances by the live per-frame delta each\n * frame (clamped to a tunnelling ceiling). The wrapper therefore just leaves the\n * world in its native frame-delta mode for delta stepping, and pins a fixed step\n * only when `useDeltaForWorldStep` is `false` — no per-frame policy of its own is\n * needed.\n */\n\nimport {\n applyPhysicsBodyForce,\n applyPhysicsBodyImpulse,\n calculatePhysicsCharacterMovementToRef,\n createPhysicsCharacterController,\n createHavokWorld,\n createPhysicsAggregate,\n createPhysicsBody,\n createPhysicsConstraint,\n createPhysicsShape,\n disposePhysics,\n enableHavokThinInstancePhysicsSync,\n getPhysicsBodyAngularVelocity,\n getPhysicsBodyLinearVelocity,\n physicsRaycast,\n CharacterSupportedState as LiteCharacterSupportedState,\n PhysicsMotionType as LitePhysicsMotionType,\n PhysicsPrestepType as LitePhysicsPrestepType,\n PhysicsConstraintAxis as LitePhysicsConstraintAxis,\n PhysicsConstraintType as LitePhysicsConstraintType,\n PhysicsShapeType as LitePhysicsShapeType,\n releasePhysicsConstraint,\n releasePhysicsShape,\n removePhysicsBody,\n setPhysicsBodyAngularVelocity,\n setPhysicsBodyLinearVelocity,\n setPhysicsBodyMassProperties,\n setPhysicsBodyMotionType,\n setPhysicsBodyPrestepType,\n setPhysicsBodyShape,\n setPhysicsGravity,\n setPhysicsShapeFilterCollideMask,\n setPhysicsShapeFilterMembershipMask,\n setPhysicsShapeIsTrigger,\n setPhysicsShapeMaterial,\n setPhysicsTimestep,\n} from \"babylon-lite\";\nimport type {\n CharacterCollisionEvent as LiteCharacterCollisionEvent,\n CharacterSurfaceInfo as LiteCharacterSurfaceInfo,\n Mesh as LiteMesh,\n PhysicsBody as LitePhysicsBody,\n PhysicsCharacterController as LitePhysicsCharacterController,\n PhysicsConstraint as LitePhysicsConstraint,\n PhysicsMassProperties,\n PhysicsShape as LitePhysicsShape,\n PhysicsShapeParameters,\n PhysicsWorld,\n RaycastQuery,\n SceneContext,\n} from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport type { Mesh, TransformNode } from \"../meshes/meshes.js\";\nimport type { ObserverCallback } from \"../misc/observable.js\";\nimport { Observable } from \"../misc/observable.js\";\nimport type { Node } from \"../node/node.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\n/** Minimal `{x, y, z}` view shared by the compat `Vector3` and Lite's `Vec3`. */\ninterface Vec3Like {\n x: number;\n y: number;\n z: number;\n}\n\nlet physicsBodyWrappers: WeakMap<LitePhysicsBody, PhysicsBody> | null = null;\n\nfunction getPhysicsBodyWrappers(): WeakMap<LitePhysicsBody, PhysicsBody> {\n return (physicsBodyWrappers ??= new WeakMap());\n}\n\n// ─── Enums (values match Babylon.js `@babylonjs/core`) ───────────────\n\n/** The type of a Havok physics collision shape. Values match Babylon.js `PhysicsShapeType`. */\nexport enum PhysicsShapeType {\n SPHERE = 0,\n CAPSULE = 1,\n CYLINDER = 2,\n BOX = 3,\n CONVEX_HULL = 4,\n CONTAINER = 5,\n MESH = 6,\n HEIGHTFIELD = 7,\n}\n\n/** How a body moves. Values match Babylon.js `PhysicsMotionType`. */\nexport enum PhysicsMotionType {\n STATIC = 0,\n ANIMATED = 1,\n DYNAMIC = 2,\n}\n\n/** How a moved transform node is propagated to its body before each step. Values match Babylon.js `PhysicsPrestepType`. */\nexport enum PhysicsPrestepType {\n DISABLED = 0,\n TELEPORT = 1,\n ACTION = 2,\n}\n\n/** Type of a Physics V2 constraint. Values match Babylon.js `PhysicsConstraintType`. */\nexport enum PhysicsConstraintType {\n BALL_AND_SOCKET = 1,\n DISTANCE = 2,\n HINGE = 3,\n SLIDER = 4,\n LOCK = 5,\n PRISMATIC = 6,\n SIX_DOF = 7,\n}\n\n/** Axis addressed by a Physics V2 constraint limit. */\nexport enum PhysicsConstraintAxis {\n LINEAR_X = 0,\n LINEAR_Y = 1,\n LINEAR_Z = 2,\n ANGULAR_X = 3,\n ANGULAR_Y = 4,\n ANGULAR_Z = 5,\n LINEAR_DISTANCE = 6,\n}\n\n/** Contact state of a physics character against its supporting surface. */\nexport enum CharacterSupportedState {\n UNSUPPORTED = 0,\n SLIDING = 1,\n SUPPORTED = 2,\n}\n\nexport interface CharacterShapeOptions {\n shape?: PhysicsShape;\n capsuleHeight?: number;\n capsuleRadius?: number;\n}\n\n/** Babylon.js raycast collision-filter options. */\nexport interface IRaycastQuery {\n membership?: number;\n collideWith?: number;\n shouldHitTriggers?: boolean;\n ignoreBody?: PhysicsBody;\n}\n\n/** Base result shared by Babylon.js physics casting queries. */\nexport class CastingResult {\n protected readonly _hitNormal = Vector3.Zero();\n protected readonly _hitPoint = Vector3.Zero();\n private _hasHit = false;\n private _triangleIndex = -1;\n\n public body?: PhysicsBody;\n public bodyIndex?: number;\n public shape?: PhysicsShape;\n\n public get hitPoint(): Vector3 {\n return this._hitPoint;\n }\n public get hitNormal(): Vector3 {\n return this._hitNormal;\n }\n public get hasHit(): boolean {\n return this._hasHit;\n }\n public get triangleIndex(): number {\n return this._triangleIndex;\n }\n\n public setHitData(hitNormal: Vec3Like, hitPoint: Vec3Like, triangleIndex?: number): void {\n this._hasHit = true;\n this._hitNormal.copyFromFloats(hitNormal.x, hitNormal.y, hitNormal.z);\n this._hitPoint.copyFromFloats(hitPoint.x, hitPoint.y, hitPoint.z);\n this._triangleIndex = triangleIndex ?? -1;\n }\n\n public reset(): void {\n this._hasHit = false;\n this._hitNormal.setAll(0);\n this._hitPoint.setAll(0);\n this._triangleIndex = -1;\n this.body = undefined;\n this.bodyIndex = undefined;\n this.shape = undefined;\n }\n}\n\n/** Babylon.js raycast result backed by Lite's native Havok query result. */\nexport class PhysicsRaycastResult extends CastingResult {\n private _hitDistance = 0;\n private readonly _rayFromWorld = Vector3.Zero();\n private readonly _rayToWorld = Vector3.Zero();\n\n public get hitDistance(): number {\n return this._hitDistance;\n }\n public get hitNormalWorld(): Vector3 {\n return this._hitNormal;\n }\n public get hitPointWorld(): Vector3 {\n return this._hitPoint;\n }\n public get rayFromWorld(): Vector3 {\n return this._rayFromWorld;\n }\n public get rayToWorld(): Vector3 {\n return this._rayToWorld;\n }\n\n public setHitDistance(distance: number): void {\n this._hitDistance = distance;\n }\n\n public calculateHitDistance(): void {\n this._hitDistance = Vector3.Distance(this._rayFromWorld, this._hitPoint);\n }\n\n public override reset(from: Vector3 = Vector3.Zero(), to: Vector3 = Vector3.Zero()): void {\n super.reset();\n this._rayFromWorld.copyFrom(from);\n this._rayToWorld.copyFrom(to);\n this._hitDistance = 0;\n }\n}\n\nexport interface CharacterSurfaceInfo {\n isSurfaceDynamic: boolean;\n supportedState: CharacterSupportedState;\n averageSurfaceNormal: Vector3;\n averageSurfaceVelocity: Vector3;\n averageAngularSurfaceVelocity: Vector3;\n}\n\nexport interface ICharacterControllerCollisionEvent {\n collider: PhysicsBody;\n colliderIndex: number;\n impulse: Vector3;\n impulsePosition: Vector3;\n}\n\nexport interface PhysicsConstraintParameters {\n pivotA?: Vec3Like;\n pivotB?: Vec3Like;\n axisA?: Vec3Like;\n axisB?: Vec3Like;\n perpAxisA?: Vec3Like;\n perpAxisB?: Vec3Like;\n maxDistance?: number;\n collision?: boolean;\n}\n\nexport class Physics6DoFLimit {\n public axis!: PhysicsConstraintAxis;\n public minLimit?: number;\n public maxLimit?: number;\n public stiffness?: number;\n public damping?: number;\n}\n\nexport interface PhysicsMaterial {\n friction?: number;\n staticFriction?: number;\n restitution?: number;\n}\n\nexport interface PhysicShapeOptions {\n type?: PhysicsShapeType;\n parameters?: PhysicsShapeParameters;\n pluginData?: LitePhysicsShape;\n}\n\nexport interface PhysicsAggregateParameters {\n mass: number;\n friction?: number;\n staticFriction?: number;\n restitution?: number;\n radius?: number;\n pointA?: Vec3Like;\n pointB?: Vec3Like;\n extents?: Vec3Like;\n rotation?: { x: number; y: number; z: number; w: number };\n center?: Vec3Like;\n mesh?: Mesh;\n startAsleep?: boolean;\n isTriggerShape?: boolean;\n}\n\nfunction requirePhysicsWorld(scene: Scene | undefined): PhysicsWorld {\n const world = scene?.getPhysicsEngine()?.getPhysicsPlugin().world;\n if (!world) {\n return unsupported(\"Physics\", \"Call `scene.enablePhysics(...)` with a ready HavokPlugin before creating physics bodies or shapes.\");\n }\n return world;\n}\n\nfunction liteShapeType(type: PhysicsShapeType): LitePhysicsShapeType {\n switch (type) {\n case PhysicsShapeType.SPHERE:\n return LitePhysicsShapeType.SPHERE;\n case PhysicsShapeType.CAPSULE:\n return LitePhysicsShapeType.CAPSULE;\n case PhysicsShapeType.CYLINDER:\n return LitePhysicsShapeType.CYLINDER;\n case PhysicsShapeType.BOX:\n return LitePhysicsShapeType.BOX;\n case PhysicsShapeType.CONVEX_HULL:\n return LitePhysicsShapeType.CONVEX_HULL;\n case PhysicsShapeType.CONTAINER:\n return LitePhysicsShapeType.CONTAINER;\n case PhysicsShapeType.MESH:\n return LitePhysicsShapeType.MESH;\n case PhysicsShapeType.HEIGHTFIELD:\n return LitePhysicsShapeType.HEIGHTFIELD;\n default:\n throw new Error(`Invalid PhysicsShapeType value: ${type}`);\n }\n}\n\nfunction liteMotionType(type: PhysicsMotionType): LitePhysicsMotionType {\n switch (type) {\n case PhysicsMotionType.STATIC:\n return LitePhysicsMotionType.STATIC;\n case PhysicsMotionType.ANIMATED:\n return LitePhysicsMotionType.ANIMATED;\n case PhysicsMotionType.DYNAMIC:\n return LitePhysicsMotionType.DYNAMIC;\n default:\n throw new Error(`Invalid PhysicsMotionType value: ${type}`);\n }\n}\n\nfunction litePrestepType(type: PhysicsPrestepType): LitePhysicsPrestepType {\n switch (type) {\n case PhysicsPrestepType.DISABLED:\n return LitePhysicsPrestepType.DISABLED;\n case PhysicsPrestepType.TELEPORT:\n return LitePhysicsPrestepType.TELEPORT;\n case PhysicsPrestepType.ACTION:\n return LitePhysicsPrestepType.ACTION;\n default:\n throw new Error(`Invalid PhysicsPrestepType value: ${type}`);\n }\n}\n\nfunction liteConstraintType(type: PhysicsConstraintType): LitePhysicsConstraintType {\n switch (type) {\n case PhysicsConstraintType.BALL_AND_SOCKET:\n return LitePhysicsConstraintType.BALL_AND_SOCKET;\n case PhysicsConstraintType.DISTANCE:\n return LitePhysicsConstraintType.DISTANCE;\n case PhysicsConstraintType.HINGE:\n return LitePhysicsConstraintType.HINGE;\n case PhysicsConstraintType.SLIDER:\n return LitePhysicsConstraintType.SLIDER;\n case PhysicsConstraintType.LOCK:\n return LitePhysicsConstraintType.LOCK;\n case PhysicsConstraintType.PRISMATIC:\n return LitePhysicsConstraintType.PRISMATIC;\n case PhysicsConstraintType.SIX_DOF:\n return LitePhysicsConstraintType.SIX_DOF;\n default:\n throw new Error(`Invalid PhysicsConstraintType value: ${type}`);\n }\n}\n\nfunction liteConstraintAxis(axis: PhysicsConstraintAxis): LitePhysicsConstraintAxis {\n switch (axis) {\n case PhysicsConstraintAxis.LINEAR_X:\n return LitePhysicsConstraintAxis.LINEAR_X;\n case PhysicsConstraintAxis.LINEAR_Y:\n return LitePhysicsConstraintAxis.LINEAR_Y;\n case PhysicsConstraintAxis.LINEAR_Z:\n return LitePhysicsConstraintAxis.LINEAR_Z;\n case PhysicsConstraintAxis.ANGULAR_X:\n return LitePhysicsConstraintAxis.ANGULAR_X;\n case PhysicsConstraintAxis.ANGULAR_Y:\n return LitePhysicsConstraintAxis.ANGULAR_Y;\n case PhysicsConstraintAxis.ANGULAR_Z:\n return LitePhysicsConstraintAxis.ANGULAR_Z;\n case PhysicsConstraintAxis.LINEAR_DISTANCE:\n return LitePhysicsConstraintAxis.LINEAR_DISTANCE;\n default:\n throw new Error(`Invalid PhysicsConstraintAxis value: ${axis}`);\n }\n}\n\nfunction liteCharacterSupportedState(state: CharacterSupportedState): LiteCharacterSupportedState {\n switch (state) {\n case CharacterSupportedState.UNSUPPORTED:\n return LiteCharacterSupportedState.UNSUPPORTED;\n case CharacterSupportedState.SLIDING:\n return LiteCharacterSupportedState.SLIDING;\n case CharacterSupportedState.SUPPORTED:\n return LiteCharacterSupportedState.SUPPORTED;\n default:\n throw new Error(`Invalid CharacterSupportedState value: ${state}`);\n }\n}\n\nfunction compatCharacterSupportedState(state: LiteCharacterSupportedState): CharacterSupportedState {\n switch (state) {\n case LiteCharacterSupportedState.UNSUPPORTED:\n return CharacterSupportedState.UNSUPPORTED;\n case LiteCharacterSupportedState.SLIDING:\n return CharacterSupportedState.SLIDING;\n case LiteCharacterSupportedState.SUPPORTED:\n return CharacterSupportedState.SUPPORTED;\n default:\n throw new Error(`Invalid Lite CharacterSupportedState value: ${state}`);\n }\n}\n\n/** Babylon.js-shaped collision shape backed by a Babylon Lite physics shape. */\nexport class PhysicsShape {\n /** @internal */\n public _lite!: LitePhysicsShape;\n /** @internal */\n private readonly _world: PhysicsWorld;\n /** @internal */\n private _material: PhysicsMaterial = {};\n /** @internal */\n private _membershipMask = 0xffffffff;\n /** @internal */\n private _collideMask = 0xffffffff;\n /** @internal */\n private _isTrigger = false;\n /** @internal */\n private _disposed = false;\n /** @internal Whether this wrapper is responsible for releasing the native shape. */\n private _ownsLiteShape = true;\n\n public constructor(options: PhysicShapeOptions, scene: Scene) {\n this._world = requirePhysicsWorld(scene);\n if (options.pluginData) {\n this._lite = options.pluginData;\n } else if (options.type !== undefined) {\n this._lite = createPhysicsShape(this._world, { type: liteShapeType(options.type), parameters: options.parameters });\n } else {\n return unsupported(\"PhysicsShape\", \"Specify either `type` or a native Lite shape as `pluginData`.\");\n }\n }\n\n /** @internal */\n public static _fromLite(shape: LitePhysicsShape, world: PhysicsWorld, ownsLiteShape = true): PhysicsShape {\n const wrapper = Object.create(PhysicsShape.prototype) as PhysicsShape;\n Object.defineProperties(wrapper, {\n _lite: { value: shape, enumerable: true, writable: true },\n _world: { value: world },\n _material: { value: {}, writable: true },\n _membershipMask: { value: 0xffffffff, writable: true },\n _collideMask: { value: 0xffffffff, writable: true },\n _isTrigger: { value: false, writable: true },\n _disposed: { value: false, writable: true },\n _ownsLiteShape: { value: ownsLiteShape },\n });\n return wrapper;\n }\n\n /** @internal */\n public _replaceLiteShape(shape: LitePhysicsShape): void {\n this._lite = shape;\n this.material = this._material;\n this.filterMembershipMask = this._membershipMask;\n this.filterCollideMask = this._collideMask;\n this.isTrigger = this._isTrigger;\n }\n\n public getClassName(): string {\n return \"PhysicsShape\";\n }\n\n public get type(): PhysicsShapeType {\n switch (this._lite._type) {\n case LitePhysicsShapeType.SPHERE:\n return PhysicsShapeType.SPHERE;\n case LitePhysicsShapeType.CAPSULE:\n return PhysicsShapeType.CAPSULE;\n case LitePhysicsShapeType.CYLINDER:\n return PhysicsShapeType.CYLINDER;\n case LitePhysicsShapeType.BOX:\n return PhysicsShapeType.BOX;\n case LitePhysicsShapeType.CONVEX_HULL:\n return PhysicsShapeType.CONVEX_HULL;\n case LitePhysicsShapeType.CONTAINER:\n return PhysicsShapeType.CONTAINER;\n case LitePhysicsShapeType.MESH:\n return PhysicsShapeType.MESH;\n case LitePhysicsShapeType.HEIGHTFIELD:\n return PhysicsShapeType.HEIGHTFIELD;\n default:\n throw new Error(`Invalid Lite PhysicsShapeType value: ${this._lite._type}`);\n }\n }\n\n public set filterMembershipMask(value: number) {\n this._membershipMask = value;\n setPhysicsShapeFilterMembershipMask(this._world, this._lite, value);\n }\n public get filterMembershipMask(): number {\n return this._membershipMask;\n }\n\n public set filterCollideMask(value: number) {\n this._collideMask = value;\n setPhysicsShapeFilterCollideMask(this._world, this._lite, value);\n }\n public get filterCollideMask(): number {\n return this._collideMask;\n }\n\n public set material(value: PhysicsMaterial) {\n this._material = value;\n const friction = value.friction ?? 0.5;\n setPhysicsShapeMaterial(this._world, this._lite, friction, value.restitution ?? 0, value.staticFriction ?? friction);\n }\n public get material(): PhysicsMaterial {\n return this._material;\n }\n\n public set isTrigger(value: boolean) {\n this._isTrigger = value;\n setPhysicsShapeIsTrigger(this._world, this._lite, value);\n }\n public get isTrigger(): boolean {\n return this._isTrigger;\n }\n\n public dispose(): void {\n if (!this._disposed) {\n if (this._ownsLiteShape) {\n releasePhysicsShape(this._world, this._lite);\n }\n this._disposed = true;\n }\n }\n}\n\n/** Babylon.js-shaped rigid body backed by a Babylon Lite physics body. */\nexport class PhysicsBody {\n /** @internal */\n public readonly _lite: LitePhysicsBody;\n /** @internal */\n private readonly _world: PhysicsWorld;\n /** @internal */\n private _shape: PhysicsShape | null = null;\n /** @internal */\n private _disposed = false;\n /** @internal */\n private _nodeDisposeObserver: ObserverCallback<Node> | null = null;\n public readonly transformNode: TransformNode;\n private _disableSync = false;\n public readonly startAsleep: boolean;\n\n public constructor(transformNode: TransformNode, motionType: PhysicsMotionType, startsAsleep: boolean, scene: Scene) {\n assertPhysicsNodeSupported(transformNode);\n this.transformNode = transformNode;\n this.startAsleep = startsAsleep;\n this._world = requirePhysicsWorld(scene);\n this._lite = createPhysicsBody(this._world, transformNode._node, liteMotionType(motionType), startsAsleep);\n getPhysicsBodyWrappers().set(this._lite, this);\n setPhysicsBodyPrestepType(this._lite, LitePhysicsPrestepType.DISABLED);\n this._attachToNode();\n }\n\n /** @internal */\n public static _fromLite(body: LitePhysicsBody, transformNode: TransformNode, world: PhysicsWorld, startsAsleep = false): PhysicsBody {\n const wrapper = Object.create(PhysicsBody.prototype) as PhysicsBody;\n Object.defineProperties(wrapper, {\n _lite: { value: body, enumerable: true },\n _world: { value: world },\n _shape: { value: null, writable: true },\n _disposed: { value: false, writable: true },\n _nodeDisposeObserver: { value: null, writable: true },\n transformNode: { value: transformNode, enumerable: true },\n _disableSync: { value: false, writable: true },\n startAsleep: { value: startsAsleep, enumerable: true },\n });\n setPhysicsBodyPrestepType(wrapper._lite, LitePhysicsPrestepType.DISABLED);\n getPhysicsBodyWrappers().set(wrapper._lite, wrapper);\n wrapper._attachToNode();\n return wrapper;\n }\n\n public getClassName(): string {\n return \"PhysicsBody\";\n }\n\n public get disablePreStep(): boolean {\n return this._lite._prestepType === LitePhysicsPrestepType.DISABLED;\n }\n public set disablePreStep(value: boolean) {\n setPhysicsBodyPrestepType(this._lite, value ? LitePhysicsPrestepType.DISABLED : LitePhysicsPrestepType.TELEPORT);\n }\n\n public get disableSync(): boolean {\n return this._disableSync;\n }\n public set disableSync(value: boolean) {\n if (value) {\n unsupported(\n \"PhysicsBody.disableSync\",\n \"Babylon Lite's shared physics step always synchronizes dynamic bodies; opting out would require changing that existing hot-path module and every physics scene bundle.\"\n );\n }\n this._disableSync = false;\n }\n\n public get motionType(): PhysicsMotionType {\n switch (this._lite.motionType) {\n case LitePhysicsMotionType.STATIC:\n return PhysicsMotionType.STATIC;\n case LitePhysicsMotionType.ANIMATED:\n return PhysicsMotionType.ANIMATED;\n case LitePhysicsMotionType.DYNAMIC:\n return PhysicsMotionType.DYNAMIC;\n default:\n throw new Error(`Invalid Lite PhysicsMotionType value: ${this._lite.motionType}`);\n }\n }\n\n public set shape(value: PhysicsShape | null) {\n if (!value) {\n unsupported(\"PhysicsBody.shape\", \"Babylon Lite cannot detach a shape from a live body; assign another PhysicsShape or dispose the body.\");\n }\n this._shape = value;\n setPhysicsBodyShape(this._world, this._lite, value._lite);\n }\n public get shape(): PhysicsShape | null {\n return this._shape;\n }\n\n public setMotionType(value: PhysicsMotionType): void {\n setPhysicsBodyMotionType(this._world, this._lite, liteMotionType(value));\n }\n public getMotionType(): PhysicsMotionType {\n return this.motionType;\n }\n public setPrestepType(value: PhysicsPrestepType): void {\n setPhysicsBodyPrestepType(this._lite, litePrestepType(value));\n }\n public getPrestepType(): PhysicsPrestepType {\n switch (this._lite._prestepType) {\n case LitePhysicsPrestepType.DISABLED:\n return PhysicsPrestepType.DISABLED;\n case LitePhysicsPrestepType.TELEPORT:\n return PhysicsPrestepType.TELEPORT;\n case LitePhysicsPrestepType.ACTION:\n return PhysicsPrestepType.ACTION;\n default:\n throw new Error(`Invalid Lite PhysicsPrestepType value: ${this._lite._prestepType}`);\n }\n }\n public setMassProperties(properties: PhysicsMassProperties): void {\n setPhysicsBodyMassProperties(this._world, this._lite, properties);\n }\n public setLinearVelocity(value: Vec3Like): void {\n setPhysicsBodyLinearVelocity(this._world, this._lite, value);\n }\n public getLinearVelocity(): Vector3 {\n const value = getPhysicsBodyLinearVelocity(this._world, this._lite);\n return new Vector3(value.x, value.y, value.z);\n }\n public getLinearVelocityToRef(result: Vector3): void {\n const value = getPhysicsBodyLinearVelocity(this._world, this._lite);\n result.set(value.x, value.y, value.z);\n }\n public setAngularVelocity(value: Vec3Like): void {\n setPhysicsBodyAngularVelocity(this._world, this._lite, value);\n }\n public getAngularVelocity(): Vector3 {\n const value = getPhysicsBodyAngularVelocity(this._world, this._lite);\n return new Vector3(value.x, value.y, value.z);\n }\n public getAngularVelocityToRef(result: Vector3): void {\n const value = getPhysicsBodyAngularVelocity(this._world, this._lite);\n result.set(value.x, value.y, value.z);\n }\n public applyImpulse(impulse: Vec3Like, location: Vec3Like): void {\n applyPhysicsBodyImpulse(this._lite, impulse, location);\n }\n public applyForce(force: Vec3Like, location: Vec3Like): void {\n applyPhysicsBodyForce(this._world, this._lite, force, location);\n }\n public addConstraint(childBody: PhysicsBody, constraint: PhysicsConstraint): void {\n if (childBody._world !== this._world) {\n throw new Error(\"PhysicsBody.addConstraint requires both bodies to belong to the same scene\");\n }\n constraint._bind(this._world, this._lite, childBody._lite);\n }\n\n public dispose(): void {\n if (!this._disposed) {\n this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);\n this._nodeDisposeObserver = null;\n removePhysicsBody(this._world, this._lite);\n getPhysicsBodyWrappers().delete(this._lite);\n if (this.transformNode.physicsBody === this) {\n this.transformNode.physicsBody = null;\n }\n this._disposed = true;\n }\n }\n\n /** @internal */\n public _adoptShape(shape: PhysicsShape): void {\n this._shape = shape;\n }\n\n /** @internal */\n private _attachToNode(): void {\n this.transformNode.physicsBody = this;\n this._nodeDisposeObserver = this.transformNode.onDisposeObservable.add(() => this.dispose());\n }\n}\n\n/** Babylon.js-shaped Physics V2 constraint backed by Lite's native constraint factory. */\nexport class PhysicsConstraint {\n private readonly _lite: LitePhysicsConstraint[] = [];\n private readonly _world: PhysicsWorld;\n\n public constructor(\n public readonly type: PhysicsConstraintType,\n protected readonly _options: PhysicsConstraintParameters,\n protected readonly _scene: Scene,\n protected readonly _limits: readonly Physics6DoFLimit[] = []\n ) {\n this._world = requirePhysicsWorld(_scene);\n }\n\n public get options(): PhysicsConstraintParameters {\n return this._options;\n }\n\n public getClassName(): string {\n return \"PhysicsConstraint\";\n }\n\n /** @internal */\n public _bind(world: PhysicsWorld, bodyA: LitePhysicsBody, bodyB: LitePhysicsBody): void {\n if (this._world !== world) {\n throw new Error(\"PhysicsConstraint and PhysicsBody must belong to the same scene\");\n }\n this._lite.push(\n createPhysicsConstraint(\n world,\n bodyA,\n bodyB,\n liteConstraintType(this.type),\n this._options,\n this._limits.map((limit) => ({ ...limit, axis: liteConstraintAxis(limit.axis) }))\n )\n );\n }\n\n public dispose(): void {\n if (this._lite.length > 0) {\n // Releasing the Havok world invalidates all of its constraint handles.\n if (this._scene.getPhysicsEngine()?.getPhysicsPlugin().world === this._world) {\n for (const constraint of this._lite) {\n releasePhysicsConstraint(this._world, constraint);\n }\n }\n this._lite.length = 0;\n }\n }\n}\n\n/** Babylon.js `HingeConstraint` adapter. */\nexport class HingeConstraint extends PhysicsConstraint {\n public constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\n super(PhysicsConstraintType.HINGE, { pivotA, pivotB, axisA, axisB }, scene);\n }\n\n public override getClassName(): string {\n return \"HingeConstraint\";\n }\n}\n\nexport class BallAndSocketConstraint extends PhysicsConstraint {\n public constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\n super(PhysicsConstraintType.BALL_AND_SOCKET, { pivotA, pivotB, axisA, axisB }, scene);\n }\n}\n\nexport class DistanceConstraint extends PhysicsConstraint {\n public constructor(maxDistance: number, scene: Scene) {\n super(PhysicsConstraintType.DISTANCE, { maxDistance }, scene);\n }\n}\n\nexport class SliderConstraint extends PhysicsConstraint {\n public constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\n super(PhysicsConstraintType.SLIDER, { pivotA, pivotB, axisA, axisB }, scene);\n }\n}\n\nexport class LockConstraint extends PhysicsConstraint {\n public constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\n super(PhysicsConstraintType.LOCK, { pivotA, pivotB, axisA, axisB }, scene);\n }\n}\n\nexport class PrismaticConstraint extends PhysicsConstraint {\n public constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\n super(PhysicsConstraintType.PRISMATIC, { pivotA, pivotB, axisA, axisB }, scene);\n }\n}\n\nexport class Physics6DoFConstraint extends PhysicsConstraint {\n public constructor(\n constraintParams: PhysicsConstraintParameters,\n public readonly limits: Physics6DoFLimit[],\n scene: Scene\n ) {\n super(PhysicsConstraintType.SIX_DOF, constraintParams, scene, limits);\n }\n}\n\nexport class SpringConstraint extends Physics6DoFConstraint {\n public constructor(\n pivotA: Vector3,\n pivotB: Vector3,\n axisA: Vector3,\n axisB: Vector3,\n minDistance: number,\n maxDistance: number,\n stiffness: number,\n damping: number,\n scene: Scene\n ) {\n super({ pivotA, pivotB, axisA, axisB }, [{ axis: PhysicsConstraintAxis.LINEAR_DISTANCE, minLimit: minDistance, maxLimit: maxDistance, stiffness, damping }], scene);\n }\n}\n\nfunction vectorFromLite(value: Vec3Like): Vector3 {\n return new Vector3(value.x, value.y, value.z);\n}\n\nfunction vectorFromLiteOwned(value: Vec3Like): Vector3 {\n if (!(value instanceof Vector3)) {\n Object.setPrototypeOf(value, Vector3.prototype);\n }\n return value as Vector3;\n}\n\nfunction surfaceInfoFromLite(value: LiteCharacterSurfaceInfo): CharacterSurfaceInfo {\n return {\n isSurfaceDynamic: value.isSurfaceDynamic,\n supportedState: compatCharacterSupportedState(value.supportedState),\n averageSurfaceNormal: vectorFromLite(value.averageSurfaceNormal),\n averageSurfaceVelocity: vectorFromLite(value.averageSurfaceVelocity),\n averageAngularSurfaceVelocity: vectorFromLite(value.averageAngularSurfaceVelocity),\n };\n}\n\n/**\n * Babylon.js-shaped character controller backed by Lite's native, tree-shakeable\n * Havok character controller.\n */\nexport class PhysicsCharacterController {\n /** @internal */\n public readonly _lite: LitePhysicsCharacterController;\n public readonly onTriggerCollisionObservable = new Observable<ICharacterControllerCollisionEvent>();\n private _shape: PhysicsShape;\n private _up: Vector3;\n private _maxStepHeight = 0;\n private _footOffset: number;\n private _disposed = false;\n\n public constructor(position: Vector3, characterShapeOptions: CharacterShapeOptions, scene: Scene) {\n if (characterShapeOptions.shape) {\n unsupported(\n \"PhysicsCharacterController custom shapes\",\n \"Lite's controller owns and rebuilds a capsule internally; exposing caller-owned shape replacement requires an ownership/lifetime design in Lite.\"\n );\n }\n const world = requirePhysicsWorld(scene);\n this._lite = createPhysicsCharacterController(world, position, {\n capsuleHeight: characterShapeOptions.capsuleHeight ?? 1.8,\n capsuleRadius: characterShapeOptions.capsuleRadius ?? 0.6,\n });\n this._up = vectorFromLite(this._lite.up);\n this._lite.up = this._up;\n this._footOffset = (characterShapeOptions.capsuleHeight ?? 1.8) * 0.5;\n const liteShape = this._lite.getBody()._shape;\n if (!liteShape) {\n throw new Error(\"Babylon Lite character controller did not create a collision shape.\");\n }\n this._shape = PhysicsShape._fromLite(liteShape, world, false);\n this._lite.onTriggerCollisionObservable.add((event) => this._notifyCollision(event));\n }\n\n public get shape(): PhysicsShape {\n return this._shape;\n }\n\n public set shape(_value: PhysicsShape) {\n unsupported(\"PhysicsCharacterController.shape\", \"Lite's controller owns its cast shape; replacing it requires an explicit Lite ownership/lifetime contract.\");\n }\n\n public get shapeOptions(): CharacterShapeOptions {\n const { capsuleHeight, capsuleRadius } = this._lite.shapeOptions;\n return { capsuleHeight, capsuleRadius };\n }\n\n public setShapeOptions(options: CharacterShapeOptions, preserveFootPosition = true): void {\n if (options.shape) {\n this.shape = options.shape;\n return;\n }\n this._lite.setShapeOptions({ capsuleHeight: options.capsuleHeight ?? 1.8, capsuleRadius: options.capsuleRadius ?? 0.6 }, preserveFootPosition);\n const liteShape = this._lite.getBody()._shape;\n if (!liteShape) {\n throw new Error(\"Babylon Lite character controller did not rebuild its collision shape.\");\n }\n this._shape._replaceLiteShape(liteShape);\n this._footOffset = (options.capsuleHeight ?? 1.8) * 0.5;\n }\n\n public getPosition(): Vector3 {\n return vectorFromLiteOwned(this._lite.getPosition());\n }\n\n public setPosition(position: Vector3): void {\n this._lite.setPosition(position);\n }\n\n public getVelocity(): Vector3 {\n return vectorFromLiteOwned(this._lite.getVelocity());\n }\n\n public setVelocity(velocity: Vector3): void {\n this._lite.setVelocity(velocity);\n }\n\n public moveWithCollisions(displacement: Vector3): void {\n this._lite.moveWithCollisions(displacement);\n }\n\n public integrate(deltaTime: number, surfaceInfo: CharacterSurfaceInfo, gravity: Vector3): void {\n this._lite.integrate(deltaTime, { ...surfaceInfo, supportedState: liteCharacterSupportedState(surfaceInfo.supportedState) }, gravity);\n }\n\n public checkSupport(deltaTime: number, direction: Vector3): CharacterSurfaceInfo {\n return surfaceInfoFromLite(this._lite.checkSupport(deltaTime, direction));\n }\n\n public checkSupportToRef(deltaTime: number, direction: Vector3, result: CharacterSurfaceInfo): void {\n const value = this._lite.checkSupport(deltaTime, direction);\n result.isSurfaceDynamic = value.isSurfaceDynamic;\n result.supportedState = compatCharacterSupportedState(value.supportedState);\n result.averageSurfaceNormal.set(value.averageSurfaceNormal.x, value.averageSurfaceNormal.y, value.averageSurfaceNormal.z);\n result.averageSurfaceVelocity.set(value.averageSurfaceVelocity.x, value.averageSurfaceVelocity.y, value.averageSurfaceVelocity.z);\n result.averageAngularSurfaceVelocity.set(value.averageAngularSurfaceVelocity.x, value.averageAngularSurfaceVelocity.y, value.averageAngularSurfaceVelocity.z);\n }\n\n public calculateMovement(\n deltaTime: number,\n forwardWorld: Vector3,\n surfaceNormal: Vector3,\n currentVelocity: Vector3,\n surfaceVelocity: Vector3,\n desiredVelocity: Vector3,\n upWorld: Vector3\n ): Vector3 {\n return vectorFromLite(this._lite.calculateMovement(deltaTime, forwardWorld, surfaceNormal, currentVelocity, surfaceVelocity, desiredVelocity, upWorld));\n }\n\n public calculateMovementToRef(\n deltaTime: number,\n forwardWorld: Vector3,\n surfaceNormal: Vector3,\n currentVelocity: Vector3,\n surfaceVelocity: Vector3,\n desiredVelocity: Vector3,\n upWorld: Vector3,\n result: Vector3\n ): boolean {\n return calculatePhysicsCharacterMovementToRef(this._lite, deltaTime, forwardWorld, surfaceNormal, currentVelocity, surfaceVelocity, desiredVelocity, upWorld, result);\n }\n\n public dispose(): void {\n if (!this._disposed) {\n this._lite.dispose();\n this.onTriggerCollisionObservable.clear();\n this._disposed = true;\n }\n }\n\n public get up(): Vector3 {\n return this._up;\n }\n\n public set up(value: Vector3) {\n this._up = value;\n this._lite.up = value;\n }\n\n public get maxStepHeight(): number {\n return this._maxStepHeight;\n }\n\n public set maxStepHeight(value: number) {\n if (value !== 0) {\n unsupported(\n \"PhysicsCharacterController.maxStepHeight\",\n \"Step-up needs a substantial additional sweep/manifold policy in Lite's controller and cannot be implemented as compat translation.\"\n );\n }\n this._maxStepHeight = 0;\n }\n\n public get footOffset(): number {\n return this._footOffset;\n }\n\n public set footOffset(value: number) {\n if (value !== this._footOffset) {\n unsupported(\n \"PhysicsCharacterController.footOffset\",\n \"Lite derives the character foot from capsule height and does not expose the custom-shape foot-offset policy used by Babylon.js.\"\n );\n }\n }\n\n private _notifyCollision(event: LiteCharacterCollisionEvent): void {\n const collider = getPhysicsBodyWrappers().get(event.collider);\n if (!collider) {\n unsupported(\n \"PhysicsCharacterController collision body mapping\",\n \"The contacted Lite body was not created through the compat physics API and has no Babylon.js TransformNode wrapper.\"\n );\n }\n this.onTriggerCollisionObservable.notifyObservers({\n collider,\n colliderIndex: 0,\n impulse: vectorFromLite(event.impulse),\n impulsePosition: vectorFromLite(event.impulsePosition),\n });\n }\n\n public get keepDistance(): number {\n return this._lite.keepDistance;\n }\n public set keepDistance(value: number) {\n this._lite.keepDistance = value;\n }\n public get keepContactTolerance(): number {\n return this._lite.keepContactTolerance;\n }\n public set keepContactTolerance(value: number) {\n this._lite.keepContactTolerance = value;\n }\n public get maxCastIterations(): number {\n return this._lite.maxCastIterations;\n }\n public set maxCastIterations(value: number) {\n this._lite.maxCastIterations = value;\n }\n public get penetrationRecoverySpeed(): number {\n return this._lite.penetrationRecoverySpeed;\n }\n public set penetrationRecoverySpeed(value: number) {\n this._lite.penetrationRecoverySpeed = value;\n }\n public get staticFriction(): number {\n return this._lite.staticFriction;\n }\n public set staticFriction(value: number) {\n this._lite.staticFriction = value;\n }\n public get dynamicFriction(): number {\n return this._lite.dynamicFriction;\n }\n public set dynamicFriction(value: number) {\n this._lite.dynamicFriction = value;\n }\n public get maxSlopeCosine(): number {\n return this._lite.maxSlopeCosine;\n }\n public set maxSlopeCosine(value: number) {\n this._lite.maxSlopeCosine = value;\n }\n public get maxCharacterSpeedForSolver(): number {\n return this._lite.maxCharacterSpeedForSolver;\n }\n public set maxCharacterSpeedForSolver(value: number) {\n this._lite.maxCharacterSpeedForSolver = value;\n }\n public get characterStrength(): number {\n return this._lite.characterStrength;\n }\n public set characterStrength(value: number) {\n this._lite.characterStrength = value;\n }\n public get acceleration(): number {\n return this._lite.acceleration;\n }\n public set acceleration(value: number) {\n this._lite.acceleration = value;\n }\n public get maxAcceleration(): number {\n return this._lite.maxAcceleration;\n }\n public set maxAcceleration(value: number) {\n this._lite.maxAcceleration = value;\n }\n public get characterMass(): number {\n return this._lite.characterMass;\n }\n public set characterMass(value: number) {\n this._lite.characterMass = value;\n }\n}\n\n/** Babylon.js aggregate convenience object backed by Lite's native aggregate factory. */\nexport class PhysicsAggregate {\n public readonly transformNode: TransformNode;\n public readonly type: PhysicsShapeType | PhysicsShape;\n public readonly body: PhysicsBody;\n public readonly shape: PhysicsShape;\n public readonly material: PhysicsMaterial;\n /** @internal */\n private _disposed = false;\n /** @internal */\n private readonly _disposeShapeWhenDisposed: boolean;\n /** @internal */\n private _nodeDisposeObserver: ObserverCallback<Node> | null = null;\n\n public constructor(transformNode: TransformNode, type: PhysicsShapeType | PhysicsShape, options: PhysicsAggregateParameters = { mass: 0 }, scene?: Scene) {\n assertPhysicsNodeSupported(transformNode);\n this.transformNode = transformNode;\n this.type = type;\n const resolvedScene = scene ?? transformNode.getScene();\n const world = requirePhysicsWorld(resolvedScene);\n const nativeType = type instanceof PhysicsShape ? type._lite._type : liteShapeType(type);\n let suppliedShape = type instanceof PhysicsShape ? type : undefined;\n this._disposeShapeWhenDisposed = !suppliedShape;\n if (!suppliedShape && (type === PhysicsShapeType.MESH || type === PhysicsShapeType.CONVEX_HULL)) {\n suppliedShape = PhysicsShape._fromLite(createPhysicsShape(world, { type: nativeType, mesh: (options.mesh ?? transformNode)._node }), world);\n }\n const aggregate = createPhysicsAggregate(world, transformNode._node as LiteMesh, nativeType, {\n ...options,\n shape: suppliedShape?._lite,\n });\n this.material = {\n friction: options.friction ?? 0.2,\n staticFriction: options.staticFriction,\n restitution: options.restitution ?? 0.2,\n };\n this.shape = suppliedShape ?? PhysicsShape._fromLite(aggregate.shape, world);\n this.shape.material = this.material;\n if (options.isTriggerShape !== undefined) {\n this.shape.isTrigger = options.isTriggerShape;\n }\n this.body = PhysicsBody._fromLite(aggregate.body, transformNode, world, options.startAsleep);\n this.body._adoptShape(this.shape);\n this._nodeDisposeObserver = transformNode.onDisposeObservable.add(() => this.dispose());\n }\n\n public dispose(): void {\n if (!this._disposed) {\n this.transformNode.onDisposeObservable.remove(this._nodeDisposeObserver);\n this._nodeDisposeObserver = null;\n this.body.dispose();\n if (this._disposeShapeWhenDisposed) {\n this.shape.dispose();\n }\n\n this._disposed = true;\n }\n }\n}\n\nfunction assertPhysicsNodeSupported(transformNode: TransformNode): void {\n if (transformNode.physicsBody) {\n unsupported(\"PhysicsBody\", \"Babylon Lite synchronizes one physics body per scene node; dispose the existing TransformNode.physicsBody before attaching another.\");\n }\n if (transformNode.parent || transformNode._node.parent) {\n unsupported(\"PhysicsBody\", \"Babylon Lite physics bodies currently consume local transforms, so parented TransformNodes cannot be synchronized in Babylon.js world space.\");\n }\n}\n\n// ─── HavokPlugin ─────────────────────────────────────────────────────\n\n/**\n * Babylon.js-shaped Havok V2 physics plugin, backed by Babylon Lite's native\n * `createHavokWorld` API.\n *\n * Construct it exactly as in Babylon.js and pass it to {@link Scene.enablePhysics}:\n * ```ts\n * const hknp = await HavokPhysics();\n * scene.enablePhysics(new Vector3(0, -9.81, 0), new HavokPlugin(true, hknp));\n * ```\n *\n * The first constructor argument, `useDeltaForWorldStep` (default `true`,\n * matching Babylon.js), selects delta-driven stepping: the world advances by the\n * elapsed real time each frame, so the simulation runs at the same real-time\n * speed regardless of the display refresh rate (issue #332). Pass `false` for the\n * legacy fixed `1/60`-per-frame behaviour.\n *\n * Bodies are still created with the native `createPhysicsAggregate` /\n * `createPhysicsBody` API against {@link world}; the Babylon.js `PhysicsAggregate`\n * class is not wrapped.\n */\nexport class HavokPlugin {\n /** Name of the plugin. */\n public readonly name: string = \"HavokPlugin\";\n\n /** @internal Reference to the Havok WASM module (`@babylonjs/havok`). */\n public _hknp: unknown;\n\n /** The native Lite physics world, created when the plugin is attached to a scene. */\n public world: PhysicsWorld | null = null;\n\n /** @internal Fixed timestep used when delta stepping is disabled, and by force scaling. */\n private _fixedTimeStep: number = 1 / 60;\n\n /** @internal Whether to advance the world by the elapsed frame time (vs a fixed `1/60`). */\n private readonly _useDeltaForWorldStep: boolean;\n\n /** @internal Whether the injected Havok module looks usable. */\n private readonly _supported: boolean;\n\n public constructor(useDeltaForWorldStep: boolean = true, hpInjection?: unknown) {\n this._useDeltaForWorldStep = useDeltaForWorldStep;\n this._hknp = hpInjection;\n // Babylon.js treats a still-pending `HavokPhysics()` promise factory (a\n // function) as \"not ready\". Mirror that: a function injection is unusable.\n this._supported = hpInjection != null && typeof hpInjection !== \"function\";\n }\n\n /** Whether the plugin has a usable Havok module. */\n public isSupported(): boolean {\n return this._supported;\n }\n\n /** Babylon.js physics plugin version (Havok is V2). */\n public getPluginVersion(): number {\n return 2;\n }\n\n /** Set the fixed timestep used when delta stepping is disabled. Matches Babylon.js. */\n public setTimeStep(timeStep: number): void {\n this._fixedTimeStep = timeStep;\n // Only a fixed-step world tracks this value on the native side. In delta mode Lite steps by\n // the live frame delta, so pushing a fixed step here would disable that — leave the world be.\n if (this.world && !this._useDeltaForWorldStep) {\n setPhysicsTimestep(this.world, timeStep);\n }\n }\n\n /** Get the fixed timestep. Matches Babylon.js. */\n public getTimeStep(): number {\n return this._fixedTimeStep;\n }\n\n /** Set the world gravity. */\n public setGravity(gravity: Vec3Like, worldPosition?: Vec3Like): void {\n if (this.world) {\n setPhysicsGravity(this.world, gravity, worldPosition);\n }\n }\n\n /**\n * Manual single-step entry point. Babylon Lite drives world stepping\n * internally (once per rendered frame, via the scene's before-render hook),\n * so calling this directly is unsupported — use {@link Scene.enablePhysics}.\n */\n public executeStep(): never {\n return unsupported(\"HavokPlugin.executeStep\", \"Babylon Lite advances the world internally each frame; manual stepping is not supported.\");\n }\n\n /** Release the native physics world. */\n public dispose(): void {\n if (this.world) {\n disposePhysics(this.world);\n this.world = null;\n }\n }\n\n /**\n * @internal Create the native Lite world for `liteScene` and select the step mode.\n *\n * Lite's native physics already steps a world by the live per-frame delta when it has no fixed\n * step (`createHavokWorld` leaves `_fixedDeltaMs === 0`), clamping to a tunnelling ceiling — which\n * is exactly Babylon.js's `useDeltaForWorldStep` behaviour. So delta stepping needs nothing extra\n * here; only the legacy fixed-step mode pins the world to {@link _fixedTimeStep}. The step is\n * driven from inside the world's own per-frame callback, so it is torn down together with the\n * world in {@link dispose} — nothing lingers on the scene after disposal.\n */\n public _attachToLiteScene(liteScene: SceneContext, gravity?: Vec3Like): void {\n if (!this._supported) {\n return unsupported(\"HavokPlugin\", \"The Havok module is not ready. `await HavokPhysics()` before constructing the plugin.\");\n }\n this.world = createHavokWorld(liteScene, this._hknp, gravity);\n enableHavokThinInstancePhysicsSync(this.world);\n if (!this._useDeltaForWorldStep) {\n setPhysicsTimestep(this.world, this._fixedTimeStep);\n }\n }\n}\n\n// ─── PhysicsEngine (V2) ──────────────────────────────────────────────\n\n/**\n * Babylon.js-shaped Physics V2 engine wrapper returned by\n * {@link Scene.getPhysicsEngine}. Holds the active {@link HavokPlugin} and the\n * world gravity, exposing the common Babylon.js `IPhysicsEngine` surface.\n */\nexport class PhysicsEngine {\n /** @internal */\n private readonly _plugin: HavokPlugin;\n\n /** Current world gravity. */\n public gravity: Vec3Like;\n\n public constructor(plugin: HavokPlugin, gravity: Vec3Like) {\n this._plugin = plugin;\n this.gravity = gravity;\n }\n\n /** The underlying physics plugin. */\n public getPhysicsPlugin(): HavokPlugin {\n return this._plugin;\n }\n\n /** Physics engine plugin version (Havok is V2). */\n public getPluginVersion(): number {\n return this._plugin.getPluginVersion();\n }\n\n /** Set the world gravity. */\n public setGravity(gravity: Vec3Like): void {\n this.gravity = gravity;\n this._plugin.setGravity(gravity);\n }\n\n /** Set the fixed timestep. */\n public setTimeStep(newTimeStep: number): void {\n this._plugin.setTimeStep(newTimeStep);\n }\n\n /** Get the fixed timestep. */\n public getTimeStep(): number {\n return this._plugin.getTimeStep();\n }\n\n /** Cast a ray through the active Lite Havok world. */\n public raycast(from: Vector3, to: Vector3, query?: IRaycastQuery): PhysicsRaycastResult {\n const result = new PhysicsRaycastResult();\n this.raycastToRef(from, to, result, query);\n return result;\n }\n\n /** Cast a ray through the active Lite Havok world and write into `result`. */\n public raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult, query?: IRaycastQuery): void {\n if (query?.ignoreBody) {\n return unsupported(\n \"PhysicsEngine.raycast.ignoreBody\",\n \"Lite's public raycast query does not accept an ignored body, and adding it would modify the shared Havok query hot path already used by scene bundles.\"\n );\n }\n const world = this._plugin.world;\n if (!world) {\n return unsupported(\"PhysicsEngine.raycast\", \"Call `scene.enablePhysics(...)` before issuing physics queries.\");\n }\n const liteQuery: RaycastQuery = {\n membership: query?.membership,\n collideWith: query?.collideWith,\n shouldHitTriggers: query?.shouldHitTriggers,\n };\n const hit = physicsRaycast(world, from, to, liteQuery);\n result.reset(from, to);\n if (!hit.hasHit) {\n return;\n }\n result.setHitData(hit.hitNormal, hit.hitPoint, hit.triangleIndex);\n result.setHitDistance(hit.hitDistance);\n result.body = hit.body ? getPhysicsBodyWrappers().get(hit.body) : undefined;\n result.shape = result.body?.shape ?? undefined;\n result.bodyIndex = hit.bodyIndex;\n }\n\n /** Release the underlying physics world. */\n public dispose(): void {\n this._plugin.dispose();\n }\n}\n","/**\n * Babylon.js-compatible camera classes implemented over the Babylon Lite camera\n * factories.\n *\n * Babylon.js cameras take the scene in their constructor and become the active\n * camera; these wrappers do the same by assigning `scene.activeCamera` when a\n * scene is supplied. `attachControl()` is a method here (Lite separates it into\n * standalone functions) and returns the detach handle Lite already provides.\n */\n\nimport {\n createArcRotateCamera,\n createBankedFreeCamera,\n createFreeCamera,\n createGeospatialCamera,\n disableOrthographicCamera,\n enableArcRotateKeyboardControls,\n enableOrthographicCamera,\n setGeospatialOrientation,\n attachGeospatialControls,\n attachControl as liteAttachControl,\n attachFreeControl,\n getCameraPosition,\n getViewMatrix as liteGetViewMatrix,\n getProjectionMatrix as liteGetProjectionMatrix,\n onBeforeRender,\n} from \"babylon-lite\";\nimport type {\n ArcRotateCamera as LiteArcRotateCamera,\n BankedFreeCamera as LiteBankedFreeCamera,\n FreeCamera as LiteFreeCamera,\n GeospatialCamera as LiteGeospatialCamera,\n Camera as LiteCamera,\n} from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { liteBackedVector3, Vector3 } from \"../math/vector.js\";\nimport { Matrix } from \"../math/matrix.js\";\nimport { Viewport } from \"../math/size.js\";\nimport { Node } from \"../node/node.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\n/** Babylon.js `Camera` — base class for all cameras (derives from `Node`). */\nexport abstract class Camera extends Node {\n public static readonly PERSPECTIVE_CAMERA = 0;\n public static readonly ORTHOGRAPHIC_CAMERA = 1;\n\n /** @internal Underlying Babylon Lite camera. */\n public abstract readonly _lite: LiteCamera;\n private _detach: (() => void) | undefined;\n private _orthoLeft: number | null = null;\n private _orthoRight: number | null = null;\n private _orthoBottom: number | null = null;\n private _orthoTop: number | null = null;\n\n protected constructor(name: string, scene?: Scene) {\n super(name, scene);\n scene?._registerCamera(this);\n }\n\n public override getClassName(): string {\n return \"Camera\";\n }\n\n public get fov(): number {\n return this._lite.fov;\n }\n public set fov(value: number) {\n this._lite.fov = value;\n }\n\n public get minZ(): number {\n return this._lite.nearPlane;\n }\n public set minZ(value: number) {\n this._lite.nearPlane = value;\n }\n\n public get maxZ(): number {\n return this._lite.farPlane;\n }\n public set maxZ(value: number) {\n this._lite.farPlane = value;\n }\n\n public get orthoLeft(): number | null {\n return this._lite.ortho ? this._lite.ortho.left : this._orthoLeft;\n }\n public set orthoLeft(value: number | null) {\n this._orthoLeft = value;\n if (this._lite.ortho) {\n this._lite.ortho.left = value;\n }\n }\n\n public get orthoRight(): number | null {\n return this._lite.ortho ? this._lite.ortho.right : this._orthoRight;\n }\n public set orthoRight(value: number | null) {\n this._orthoRight = value;\n if (this._lite.ortho) {\n this._lite.ortho.right = value;\n }\n }\n\n public get orthoBottom(): number | null {\n return this._lite.ortho ? this._lite.ortho.bottom : this._orthoBottom;\n }\n public set orthoBottom(value: number | null) {\n this._orthoBottom = value;\n if (this._lite.ortho) {\n this._lite.ortho.bottom = value;\n }\n }\n\n public get orthoTop(): number | null {\n return this._lite.ortho ? this._lite.ortho.top : this._orthoTop;\n }\n public set orthoTop(value: number | null) {\n this._orthoTop = value;\n if (this._lite.ortho) {\n this._lite.ortho.top = value;\n }\n }\n\n public get mode(): number {\n return this._lite.ortho ? Camera.ORTHOGRAPHIC_CAMERA : Camera.PERSPECTIVE_CAMERA;\n }\n public set mode(value: number) {\n if (value === this.mode) {\n return;\n }\n if (value === Camera.ORTHOGRAPHIC_CAMERA) {\n enableOrthographicCamera(this._lite, {\n left: this._orthoLeft,\n right: this._orthoRight,\n bottom: this._orthoBottom,\n top: this._orthoTop,\n });\n return;\n }\n if (value === Camera.PERSPECTIVE_CAMERA) {\n this._orthoLeft = this.orthoLeft;\n this._orthoRight = this.orthoRight;\n this._orthoBottom = this.orthoBottom;\n this._orthoTop = this.orthoTop;\n disableOrthographicCamera(this._lite);\n return;\n }\n unsupported(\"Camera.mode\", `Projection mode ${value} is not supported.`);\n }\n\n public get viewport(): Viewport {\n const viewport = this._lite.viewport;\n if (viewport instanceof Viewport) {\n return viewport;\n }\n const compatViewport = viewport ? new Viewport(viewport.x, viewport.y, viewport.width, viewport.height) : new Viewport(0, 0, 1, 1);\n this._lite.viewport = compatViewport;\n return compatViewport;\n }\n public set viewport(value: Viewport) {\n this._lite.viewport = value;\n }\n\n /** World-space position of the camera. */\n public get globalPosition(): Vector3 {\n const p = getCameraPosition(this._lite);\n return new Vector3(p.x, p.y, p.z);\n }\n\n /** Babylon.js `camera.getViewMatrix()` — the camera's view matrix. */\n public getViewMatrix(): Matrix {\n return Matrix.FromArray(liteGetViewMatrix(this._lite));\n }\n\n /** Babylon.js `camera.getProjectionMatrix()` — the camera's projection matrix. */\n public getProjectionMatrix(): Matrix {\n return Matrix.FromArray(liteGetProjectionMatrix(this._lite, this._aspectRatio()));\n }\n\n private _aspectRatio(): number {\n const scene = this._scene;\n const canvas = scene?.getEngine().getRenderingCanvas() as { width?: number; height?: number } | undefined;\n const w = canvas?.width ?? 1;\n const h = canvas?.height ?? 1;\n const viewport = this._lite.viewport;\n return h !== 0 && (!viewport || viewport.height !== 0) ? (w / h) * (viewport ? viewport.width / viewport.height : 1) : 1;\n }\n\n public abstract attachControl(canvas: HTMLCanvasElement, noPreventDefault?: boolean): void;\n\n public detachControl(): void {\n if (this._detach) {\n this._detach();\n this._detach = undefined;\n }\n }\n\n /** @internal Store the detach handle returned by Lite's attach function. */\n protected _setDetach(detach: () => void): void {\n this._detach = detach;\n }\n\n protected _makeActive(scene: Scene | undefined): void {\n // Babylon.js sets `scene.activeCamera` to the **first** camera constructed\n // against a scene; later cameras are added but do not steal the active\n // slot (e.g. a `CameraGizmo`'s subject camera must not become the view).\n if (scene && !scene.activeCamera) {\n scene.activeCamera = this;\n }\n }\n}\n\nexport class ArcRotateCamera extends Camera {\n /** @internal Underlying Babylon Lite arc-rotate camera. */\n public readonly _lite: LiteArcRotateCamera;\n\n public constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene?: Scene);\n /** @internal Adopt an already-built Lite arc-rotate camera (e.g. from `createDefaultCamera`) instead of creating a new one. */\n public constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene: Scene | undefined, adoptLite: LiteArcRotateCamera);\n public constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, scene?: Scene, adoptLite?: LiteArcRotateCamera) {\n super(name, scene);\n this._lite = adoptLite ?? createArcRotateCamera(alpha, beta, radius, { x: target.x, y: target.y, z: target.z });\n if (!adoptLite) {\n this._makeActive(scene);\n }\n }\n\n public override getClassName(): string {\n return \"ArcRotateCamera\";\n }\n\n public get alpha(): number {\n return this._lite.alpha;\n }\n public set alpha(value: number) {\n this._lite.alpha = value;\n }\n\n public get beta(): number {\n return this._lite.beta;\n }\n public set beta(value: number) {\n this._lite.beta = value;\n }\n\n public get radius(): number {\n return this._lite.radius;\n }\n public set radius(value: number) {\n this._lite.radius = value;\n }\n\n public get target(): Vector3 {\n const t = this._lite.target;\n return new Vector3(t.x, t.y, t.z);\n }\n public set target(value: Vector3) {\n this._lite.target = { x: value.x, y: value.y, z: value.z };\n }\n\n /** Babylon.js `setTarget` — point the arc-rotate camera at a world-space target. */\n public setTarget(target: Vector3): void {\n this.target = target;\n }\n\n public get lowerRadiusLimit(): number | undefined {\n return this._lite.lowerRadiusLimit;\n }\n public set lowerRadiusLimit(value: number | undefined) {\n this._lite.lowerRadiusLimit = value;\n }\n\n public get upperRadiusLimit(): number | undefined {\n return this._lite.upperRadiusLimit;\n }\n public set upperRadiusLimit(value: number | undefined) {\n this._lite.upperRadiusLimit = value;\n }\n\n // These input-tuning fields delegate straight through to the underlying Lite\n // camera so that Babylon.js-style code — which may set them either before or\n // AFTER attachControl — takes effect. Lite's attachControl reads these live on\n // every input event, so a post-attach write (as Babylon.js allows) is honored.\n // Without these accessors a write would land on the wrapper instance and never\n // reach _lite, leaving zoom/orbit/pan at the Lite defaults (e.g. wheel zoom\n // running far too fast because a raised wheelPrecision was silently dropped).\n\n /** Wheel-zoom sensitivity (HIGHER = slower zoom). Babylon default 3. */\n public get wheelPrecision(): number {\n return this._lite.wheelPrecision;\n }\n public set wheelPrecision(value: number) {\n this._lite.wheelPrecision = value;\n }\n\n /** Mouse-drag orbit sensitivity (HIGHER = slower rotation). Babylon default 1000. */\n public get angularSensibility(): number {\n return this._lite.angularSensibility;\n }\n public set angularSensibility(value: number) {\n this._lite.angularSensibility = value;\n }\n\n /** Right-drag panning sensitivity in pixels-per-unit (LOWER = faster pan). Babylon default 50. */\n public get panningSensibility(): number {\n return this._lite.panningSensibility;\n }\n public set panningSensibility(value: number) {\n this._lite.panningSensibility = value;\n }\n\n public attachControl(canvas: HTMLCanvasElement, noPreventDefault = false): void {\n enableArcRotateKeyboardControls();\n const detach = liteAttachControl(this._lite, canvas, this._scene?._lite, { keyboard: { preventDefault: !noPreventDefault } });\n this._setDetach(detach);\n }\n\n /** @internal Wrap an already-built Lite arc-rotate camera (e.g. from `createDefaultCamera`). */\n public static _adopt(name: string, lite: LiteArcRotateCamera, scene?: Scene): ArcRotateCamera {\n return new ArcRotateCamera(name, lite.alpha, lite.beta, lite.radius, new Vector3(lite.target.x, lite.target.y, lite.target.z), scene, lite);\n }\n}\n\n/**\n * Babylon.js `TargetCamera` — a free-moving camera with a look-at target. Base\n * for `FreeCamera`/`UniversalCamera`/`TouchCamera`/`FlyCamera`/`FollowCamera`.\n */\nexport class TargetCamera extends Camera {\n /** @internal Underlying Babylon Lite free camera. */\n public readonly _lite: LiteFreeCamera;\n\n public constructor(name: string, position: Vector3, scene?: Scene);\n /** @internal Adopt an already-built Lite free camera (e.g. one parsed from a `.babylon` file) instead of creating a new one. */\n public constructor(name: string, position: Vector3, scene: Scene | undefined, adoptLite: LiteFreeCamera);\n public constructor(name: string, position: Vector3, scene?: Scene, adoptLite?: LiteFreeCamera) {\n super(name, scene);\n this._lite = adoptLite ?? createFreeCamera({ x: position.x, y: position.y, z: position.z }, { x: position.x, y: position.y, z: position.z - 1 });\n this._makeActive(scene);\n }\n\n public override getClassName(): string {\n return \"TargetCamera\";\n }\n\n public get position(): Vector3 {\n const p = this._lite.position;\n return new Vector3(p.x, p.y, p.z);\n }\n public set position(value: Vector3) {\n this._lite.position.set(value.x, value.y, value.z);\n }\n\n public get speed(): number {\n return this._lite.speed;\n }\n public set speed(value: number) {\n this._lite.speed = value;\n }\n\n /** Babylon.js `setTarget` — aim the camera at a world-space point. */\n public setTarget(target: Vector3): void {\n this._lite.target.set(target.x, target.y, target.z);\n }\n\n public attachControl(canvas: HTMLCanvasElement, _noPreventDefault?: boolean): void {\n const detach = attachFreeControl(this._lite, canvas, this._scene?._lite);\n this._setDetach(detach);\n }\n}\n\n/** Babylon.js `FreeCamera` — keyboard/mouse free camera. */\nexport class FreeCamera extends TargetCamera {\n public override getClassName(): string {\n return \"FreeCamera\";\n }\n\n /** @internal Wrap an already-built Lite free camera (e.g. one parsed from a `.babylon` file). */\n public static _adopt(name: string, lite: LiteFreeCamera, scene?: Scene): FreeCamera {\n const p = lite.position;\n return new FreeCamera(name, new Vector3(p.x, p.y, p.z), scene, lite);\n }\n}\n\n/** Babylon.js `UniversalCamera` — touch-friendly free camera. */\nexport class UniversalCamera extends FreeCamera {\n public override getClassName(): string {\n return \"UniversalCamera\";\n }\n}\n\n/** Babylon.js `TouchCamera` — touch-controlled free camera. */\nexport class TouchCamera extends FreeCamera {\n public override getClassName(): string {\n return \"TouchCamera\";\n }\n}\n\n/** Babylon.js `GamepadCamera` — gamepad-controlled free camera. */\nexport class GamepadCamera extends UniversalCamera {\n public override getClassName(): string {\n return \"GamepadCamera\";\n }\n}\n\n/** Babylon.js `FlyCamera` — 6-DOF free-flight camera. */\nexport class FlyCamera extends TargetCamera {\n /** @internal Underlying banked Babylon Lite free camera. */\n public override readonly _lite: LiteBankedFreeCamera;\n\n public constructor(name: string, position: Vector3, scene?: Scene) {\n const lite = createBankedFreeCamera({ x: position.x, y: position.y, z: position.z }, { x: position.x, y: position.y, z: position.z - 1 });\n super(name, position, scene, lite);\n this._lite = lite;\n }\n\n public get upVector(): Vector3 {\n return liteBackedVector3(this._lite.upVector);\n }\n public set upVector(value: Vector3) {\n this._lite.upVector.set(value.x, value.y, value.z);\n }\n\n public override getClassName(): string {\n return \"FlyCamera\";\n }\n}\n\ninterface LockedTarget {\n position: { x: number; y: number; z: number };\n}\n\n/**\n * Babylon.js `FollowCamera` — follows a `lockedTarget` at a fixed radius /\n * height / rotation offset, updated each frame via the scene's before-render hook.\n */\nexport class FollowCamera extends TargetCamera {\n public lockedTarget: LockedTarget | null = null;\n public radius = 12;\n public heightOffset = 4;\n /** Rotation offset around the target, in degrees. */\n public rotationOffset = 0;\n\n public constructor(name: string, position: Vector3, scene?: Scene, lockedTarget?: LockedTarget) {\n super(name, position, scene);\n this.lockedTarget = lockedTarget ?? null;\n if (scene) {\n onBeforeRender(scene._lite, () => this._follow());\n }\n }\n\n public override getClassName(): string {\n return \"FollowCamera\";\n }\n\n private _follow(): void {\n const target = this.lockedTarget;\n if (!target) {\n return;\n }\n const radians = (this.rotationOffset * Math.PI) / 180;\n const x = target.position.x + this.radius * Math.sin(radians);\n const z = target.position.z + this.radius * Math.cos(radians);\n const y = target.position.y + this.heightOffset;\n this._lite.position.set(x, y, z);\n this.setTarget(new Vector3(target.position.x, target.position.y, target.position.z));\n }\n}\n\n/**\n * Babylon.js `GeospatialCamera` — globe-orbit camera anchored to a surface\n * `center` (ECEF), orbiting at `radius` with `yaw`/`pitch`. Wraps Babylon Lite's\n * `createGeospatialCamera` + `setGeospatialOrientation` (which clamps pitch\n * against the effective max for the current radius, so each orientation field is\n * applied through Lite with the others left at their current values).\n */\nexport class GeospatialCamera extends Camera {\n /** @internal Underlying Babylon Lite geospatial camera. */\n public readonly _lite: LiteGeospatialCamera;\n\n public constructor(name: string, scene?: Scene, options?: { planetRadius: number }) {\n super(name, scene);\n this._lite = createGeospatialCamera({ planetRadius: options?.planetRadius ?? 1 });\n this._makeActive(scene);\n }\n\n public override getClassName(): string {\n return \"GeospatialCamera\";\n }\n\n /** Anchored surface point the camera orbits (ECEF coordinates). */\n public get center(): Vector3 {\n const c = this._lite.center;\n return new Vector3(c.x, c.y, c.z);\n }\n public set center(value: Vector3) {\n setGeospatialOrientation(this._lite, { center: { x: value.x, y: value.y, z: value.z } });\n }\n\n /** Distance from the camera to its centre point. */\n public get radius(): number {\n return this._lite.radius;\n }\n public set radius(value: number) {\n setGeospatialOrientation(this._lite, { radius: value });\n }\n\n /** Yaw about the geocentric up axis (0 = north, π/2 = east). */\n public get yaw(): number {\n return this._lite.yaw;\n }\n public set yaw(value: number) {\n setGeospatialOrientation(this._lite, { yaw: value });\n }\n\n /** Pitch from looking straight down (0) to the horizon (π/2). */\n public get pitch(): number {\n return this._lite.pitch;\n }\n public set pitch(value: number) {\n setGeospatialOrientation(this._lite, { pitch: value });\n }\n\n public attachControl(canvas: HTMLCanvasElement, _noPreventDefault?: boolean): void {\n if (this._scene) {\n const detach = attachGeospatialControls(this._lite, canvas, this._scene._lite);\n this._setDetach(detach);\n }\n }\n}\n\n/** Babylon.js `DeviceOrientationCamera` — device-orientation input is not available in Babylon Lite. */\nexport class DeviceOrientationCamera {\n public constructor() {\n unsupported(\"DeviceOrientationCamera\", \"Device-orientation input is not part of Babylon Lite.\");\n }\n}\n\n/** Babylon.js `WebXRCamera` — WebXR is not part of Babylon Lite. */\nexport class WebXRCamera {\n public constructor() {\n unsupported(\"WebXRCamera\", \"WebXR is not part of Babylon Lite.\");\n }\n}\n\n/** Babylon.js `AnaglyphArcRotateCamera` — stereoscopic camera rigs are not implemented in Babylon Lite. */\nexport class AnaglyphArcRotateCamera {\n public constructor() {\n unsupported(\"AnaglyphArcRotateCamera\", \"Stereoscopic camera rigs are not implemented in Babylon Lite. (An anaglyph post-process exists separately.)\");\n }\n}\n","/**\n * Babylon.js-compatible `Animation` keyframe model + `AnimationGroup`.\n *\n * `Animation` is a pure-JS keyframe container with CPU evaluation (`evaluate`),\n * the Babylon.js data-type / loop-mode constants, and `setKeys`/`getKeys`. Common\n * direct-animation tracks are compiled onto Babylon Lite property groups; the CPU\n * evaluator remains as an explicit fallback for shapes Lite cannot yet preserve.\n * `AnimationGroup` provides the structural grouping/playback-state surface.\n */\n\nimport {\n createPropertyAnimationClip,\n createPropertyAnimationGroup,\n goToFrame as liteGoToFrame,\n playAnimation,\n pauseAnimation,\n stopAnimation,\n setAnimationAdditive,\n addAnimationGroup,\n removeAnimationGroup,\n} from \"babylon-lite\";\nimport type { AnimationGroup as LiteAnimationGroup, AnimationManager, EngineContext, PropertyAnimationInterpolation, PropertyAnimationTrackOptions } from \"babylon-lite\";\n\nimport type { IEasingFunction } from \"./easing.js\";\n\n/** Structural vector/quaternion value accepted by Babylon.js animation keys. */\nexport interface IAnimationVectorValue {\n readonly x: number;\n readonly y: number;\n readonly z?: number;\n readonly w?: number;\n clone(): IAnimationVectorValue;\n asArray(): number[];\n}\n\nexport type AnimationValue = number | number[] | IAnimationVectorValue;\n\nexport interface IAnimationKey {\n frame: number;\n value: AnimationValue;\n /** Babylon.js per-key interpolation hint (`AnimationKeyInterpolation`). */\n interpolation?: number;\n /** Easing for the segment starting at this key; overrides animation-level easing. */\n easingFunction?: IEasingFunction;\n}\n\n/**\n * Babylon.js `AnimationKeyInterpolation` — how the segment starting at a key is\n * interpolated. `STEP` holds the key's value until the next key (no blend).\n */\nexport const AnimationKeyInterpolation = {\n NONE: 0,\n STEP: 1,\n} as const;\n\nexport const AnimationTypes = {\n ANIMATIONTYPE_FLOAT: 0,\n ANIMATIONTYPE_VECTOR3: 1,\n ANIMATIONTYPE_QUATERNION: 2,\n ANIMATIONTYPE_MATRIX: 3,\n ANIMATIONTYPE_COLOR3: 4,\n ANIMATIONTYPE_VECTOR2: 5,\n ANIMATIONTYPE_COLOR4: 6,\n} as const;\n\nexport const AnimationLoopModes = {\n ANIMATIONLOOPMODE_RELATIVE: 0,\n ANIMATIONLOOPMODE_CYCLE: 1,\n ANIMATIONLOOPMODE_CONSTANT: 2,\n} as const;\n\nexport class Animation {\n public static readonly ANIMATIONTYPE_FLOAT = AnimationTypes.ANIMATIONTYPE_FLOAT;\n public static readonly ANIMATIONTYPE_VECTOR3 = AnimationTypes.ANIMATIONTYPE_VECTOR3;\n public static readonly ANIMATIONTYPE_QUATERNION = AnimationTypes.ANIMATIONTYPE_QUATERNION;\n public static readonly ANIMATIONTYPE_MATRIX = AnimationTypes.ANIMATIONTYPE_MATRIX;\n public static readonly ANIMATIONTYPE_COLOR3 = AnimationTypes.ANIMATIONTYPE_COLOR3;\n public static readonly ANIMATIONTYPE_VECTOR2 = AnimationTypes.ANIMATIONTYPE_VECTOR2;\n public static readonly ANIMATIONTYPE_COLOR4 = AnimationTypes.ANIMATIONTYPE_COLOR4;\n public static readonly ANIMATIONLOOPMODE_RELATIVE = AnimationLoopModes.ANIMATIONLOOPMODE_RELATIVE;\n public static readonly ANIMATIONLOOPMODE_CYCLE = AnimationLoopModes.ANIMATIONLOOPMODE_CYCLE;\n public static readonly ANIMATIONLOOPMODE_CONSTANT = AnimationLoopModes.ANIMATIONLOOPMODE_CONSTANT;\n\n private _keys: IAnimationKey[] = [];\n private _easingFunction: IEasingFunction | null = null;\n\n public constructor(\n public name: string,\n public targetProperty: string,\n public framePerSecond: number,\n public dataType: number = AnimationTypes.ANIMATIONTYPE_FLOAT,\n public loopMode: number = AnimationLoopModes.ANIMATIONLOOPMODE_CYCLE\n ) {}\n\n public setKeys(keys: IAnimationKey[]): void {\n this._keys = keys.slice().sort((a, b) => a.frame - b.frame);\n }\n\n public getKeys(): IAnimationKey[] {\n return this._keys;\n }\n\n public getHighestFrame(): number {\n return this._keys.length > 0 ? this._keys[this._keys.length - 1]!.frame : 0;\n }\n\n /**\n * Assigns default easing for non-STEP segments without a key-specific easing function.\n * @param easingFunction - A Babylon.js-shaped easing object, or `null` to use linear progress on keys without an override.\n */\n public setEasingFunction(easingFunction: IEasingFunction | null): void {\n this._easingFunction = easingFunction;\n }\n\n /**\n * Gets the easing function currently assigned to this animation.\n * @returns The assigned default easing object, or `null` when keys without an override use linear progress.\n */\n public getEasingFunction(): IEasingFunction | null {\n return this._easingFunction;\n }\n\n /** Evaluate the animated value at `frame`, clamped to the key range. */\n public evaluate(frame: number): AnimationValue {\n const keys = this._keys;\n if (keys.length === 0) {\n return 0;\n }\n if (frame <= keys[0]!.frame) {\n return keys[0]!.value;\n }\n if (frame >= keys[keys.length - 1]!.frame) {\n return keys[keys.length - 1]!.value;\n }\n for (let i = 0; i < keys.length - 1; i++) {\n const a = keys[i]!;\n const b = keys[i + 1]!;\n // Half-open `[a, b)` so an exact key frame belongs to the segment it\n // starts (matters for STEP, where the value changes _at_ the next key).\n if (frame >= a.frame && frame < b.frame) {\n // Babylon.js `AnimationKeyInterpolation.STEP` holds the start key's\n // value across the whole segment (no blend to the next key).\n if (a.interpolation === AnimationKeyInterpolation.STEP) {\n return a.value;\n }\n const gradient = (frame - a.frame) / (b.frame - a.frame);\n const easing = a.easingFunction ?? this._easingFunction;\n return interpolateValue(a.value, b.value, easing?.ease(gradient) ?? gradient, this.dataType);\n }\n }\n return keys[keys.length - 1]!.value;\n }\n\n /** Babylon.js helper: build a one-shot float animation between two values. */\n public static CreateAndStartAnimation(name: string, _target: unknown, targetProperty: string, framePerSecond: number, totalFrame: number, from: number, to: number): Animation {\n const anim = new Animation(name, targetProperty, framePerSecond);\n anim.setKeys([\n { frame: 0, value: from },\n { frame: totalFrame, value: to },\n ]);\n return anim;\n }\n}\n\nfunction interpolateValue(a: AnimationValue, b: AnimationValue, t: number, dataType: number): AnimationValue {\n if (typeof a === \"number\" && typeof b === \"number\") {\n return a + (b - a) * t;\n }\n if (typeof a === \"number\" || typeof b === \"number\") {\n return a;\n }\n const stride = supportedStride(dataType) || animationComponents(a).length;\n const av = readAnimationComponents(a, stride);\n const bv = readAnimationComponents(b, stride);\n if (!av || !bv) {\n return a;\n }\n const values = dataType === AnimationTypes.ANIMATIONTYPE_QUATERNION ? slerpQuaternion(av, bv, t) : av.map((value, i) => value + (bv[i]! - value) * t);\n return cloneAnimationValue(a, values);\n}\n\nfunction readAnimationComponents(value: AnimationValue, stride: number): number[] | undefined {\n if (typeof value === \"number\") {\n return stride === 1 && Number.isFinite(value) ? [value] : undefined;\n }\n const components = Array.isArray(value) ? value : value.asArray();\n return components.length === stride && components.every(Number.isFinite) ? components.slice() : undefined;\n}\n\nfunction animationComponents(value: AnimationValue): number[] {\n return typeof value === \"number\" ? [value] : Array.isArray(value) ? value : value.asArray();\n}\n\nfunction cloneAnimationValue(template: Exclude<AnimationValue, number>, components: number[]): AnimationValue {\n if (Array.isArray(template)) {\n return components;\n }\n const clone = template.clone();\n const writable = clone as { x: number; y: number; z?: number; w?: number };\n writable.x = components[0]!;\n writable.y = components[1]!;\n if (components.length > 2) {\n writable.z = components[2]!;\n }\n if (components.length > 3) {\n writable.w = components[3]!;\n }\n return clone;\n}\n\nfunction slerpQuaternion(a: readonly number[], b: readonly number[], gradient: number): number[] {\n let bx = b[0]!;\n let by = b[1]!;\n let bz = b[2]!;\n let bw = b[3]!;\n let dot = a[0]! * bx + a[1]! * by + a[2]! * bz + a[3]! * bw;\n if (dot < 0) {\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n dot = -dot;\n }\n if (dot > 0.999999) {\n return [(1 - gradient) * a[0]! + gradient * bx, (1 - gradient) * a[1]! + gradient * by, (1 - gradient) * a[2]! + gradient * bz, (1 - gradient) * a[3]! + gradient * bw];\n }\n const angle = Math.acos(Math.min(dot, 1));\n const sine = Math.sin(angle);\n const startWeight = Math.sin((1 - gradient) * angle) / sine;\n const endWeight = Math.sin(gradient * angle) / sine;\n return [startWeight * a[0]! + endWeight * bx, startWeight * a[1]! + endWeight * by, startWeight * a[2]! + endWeight * bz, startWeight * a[3]! + endWeight * bw];\n}\n\ntype AnimValue = AnimationValue;\n\nfunction scaleValue(value: AnimValue, scale: number): AnimValue {\n if (typeof value === \"number\") {\n return value * scale;\n }\n const components = animationComponents(value);\n return components.map((component) => component * scale);\n}\n\nfunction addValue(acc: AnimValue, value: AnimValue): AnimValue {\n if (typeof acc === \"number\" && typeof value === \"number\") {\n return acc + value;\n }\n const a = animationComponents(acc);\n const v = animationComponents(value);\n return a.map((component, i) => component + (v[i] ?? 0));\n}\n\nfunction subtractValue(value: AnimValue, base: AnimValue): AnimValue {\n return addValue(value, scaleValue(base, -1));\n}\n\nfunction zeroLike(value: AnimValue): AnimValue {\n return typeof value === \"number\" ? 0 : animationComponents(value).map(() => 0);\n}\n\n/**\n * @internal Pre-animation baseline of each blended property, captured the first\n * time a structural group starts. Babylon.js mixes this \"original value\" back in\n * when a property's total animation weight is below 1 (so partially-weighted\n * blends settle toward the rest pose); keyed by target object → dotted path.\n */\nconst structuralOriginals = new WeakMap<object, Map<string, AnimValue>>();\n\nfunction readPath(target: object, path: string): AnimValue {\n const parts = path.split(\".\");\n let obj = target as Record<string, unknown>;\n for (let i = 0; i < parts.length - 1; i++) {\n const next = obj[parts[i]!];\n if (next == null) {\n return 0;\n }\n obj = next as Record<string, unknown>;\n }\n const leaf = obj[parts[parts.length - 1]!];\n return isAnimationValue(leaf) ? leaf : 0;\n}\n\nfunction captureOriginal(target: object, path: string): void {\n let perTarget = structuralOriginals.get(target);\n if (!perTarget) {\n perTarget = new Map();\n structuralOriginals.set(target, perTarget);\n }\n if (!perTarget.has(path)) {\n perTarget.set(path, snapshotValue(readPath(target, path)));\n }\n}\n\nfunction snapshotValue(value: AnimValue): AnimValue {\n if (typeof value === \"number\") {\n return value;\n }\n return cloneAnimationValue(value, animationComponents(value));\n}\n\n/** @internal Assign an animated value to `target` following a dotted property path (e.g. `\"position.x\"`). */\nfunction applyAnimatedValue(target: unknown, path: string, value: AnimationValue): void {\n const parts = path.split(\".\");\n let obj = target as Record<string, unknown>;\n for (let i = 0; i < parts.length - 1; i++) {\n const next = obj[parts[i]!];\n if (next == null) {\n return;\n }\n obj = next as Record<string, unknown>;\n }\n const leaf = parts[parts.length - 1]!;\n if (typeof value !== \"number\") {\n const components = animationComponents(value);\n const slot = obj[leaf] as { set?: (...n: number[]) => void } | undefined;\n if (slot && typeof slot.set === \"function\") {\n slot.set(...components);\n } else {\n obj[leaf] = value;\n }\n } else {\n obj[leaf] = value;\n }\n}\n\nfunction isAnimationValue(value: unknown): value is AnimationValue {\n return typeof value === \"number\" || Array.isArray(value) || isAnimationVectorValue(value);\n}\n\nfunction isAnimationVectorValue(value: unknown): value is IAnimationVectorValue {\n return (\n (typeof value === \"object\" || typeof value === \"function\") &&\n value !== null &&\n typeof (value as { x?: unknown }).x === \"number\" &&\n typeof (value as { y?: unknown }).y === \"number\" &&\n typeof (value as { clone?: unknown }).clone === \"function\" &&\n typeof (value as { asArray?: unknown }).asArray === \"function\"\n );\n}\n\ninterface AnimatableNativeState {\n readonly manager: AnimationManager | undefined;\n readonly group: LiteAnimationGroup | undefined;\n readonly fallbackAnimations: readonly Animation[];\n readonly fallbackReason: string | undefined;\n}\n\n/**\n * Babylon.js `Animatable` facade. Supported direct-animation tracks delegate to a\n * native Lite property group; unsupported tracks retain the compat CPU evaluator.\n */\nexport class Animatable {\n public masterFrame = 0;\n /** @internal Lite group backing a natively-delegated property animation. */\n public readonly _lite?: LiteAnimationGroup;\n /** @internal Reason all or part of this animatable retained the compat CPU evaluator. */\n public readonly _nativeFallbackReason?: string;\n\n private _speedRatio: number;\n private _paused = false;\n private _stopped = false;\n private readonly _nativeManager: AnimationManager | undefined;\n private readonly _fallbackAnimations: readonly Animation[];\n private readonly _fallbackFrames = new Map<Animation, number>();\n private readonly _fallbackElapsedFrames = new Map<Animation, number>();\n private readonly _fallbackRepeatCounts = new Map<Animation, number>();\n private readonly _completedFallbackAnimations = new Set<Animation>();\n\n public constructor(target: unknown, animations: Animation[], from: number, to: number, loop: boolean, speedRatio: number);\n /** @internal */\n public constructor(target: unknown, animations: Animation[], from: number, to: number, loop: boolean, speedRatio: number, nativeState: AnimatableNativeState);\n public constructor(\n private readonly _target: unknown,\n private readonly _animations: Animation[],\n private readonly _from: number,\n private readonly _to: number,\n private readonly _loop: boolean,\n speedRatio: number,\n nativeState?: AnimatableNativeState\n ) {\n this._speedRatio = speedRatio;\n this._nativeManager = nativeState?.manager;\n this._lite = nativeState?.group;\n this._fallbackAnimations = nativeState?.fallbackAnimations ?? _animations;\n this._nativeFallbackReason = nativeState?.fallbackReason;\n this.masterFrame = _from;\n for (const animation of this._fallbackAnimations) {\n this._resetFallbackAnimation(animation, _from);\n }\n if (this._lite) {\n liteGoToFrame(this._lite, _from);\n playAnimation(this._lite);\n }\n this._applyFallback();\n }\n\n /** @internal Create one facade over the native-supported and explicit fallback subsets. */\n public static _create(\n getManager: () => AnimationManager,\n target: unknown,\n animations: readonly Animation[],\n from: number,\n to: number,\n loop: boolean,\n speedRatio: number,\n blockedNativeBindings: readonly AnimationBinding[] = []\n ): Animatable {\n const partition = partitionAnimations(target, animations, from, to, speedRatio, blockedNativeBindings);\n const nativeManager = partition.nativeAnimations.length > 0 ? getManager() : undefined;\n const nativeGroup = nativeManager ? createNativeAnimationGroup(nativeManager, target, partition.nativeAnimations, from, to, loop, speedRatio) : undefined;\n return new Animatable(target, animations.slice(), from, to, loop, speedRatio, {\n manager: nativeManager,\n group: nativeGroup,\n fallbackAnimations: partition.fallbackAnimations,\n fallbackReason: partition.fallbackReasons.length > 0 ? partition.fallbackReasons.join(\"; \") : undefined,\n });\n }\n\n /** @internal Return why any track cannot preserve its semantics on Lite, or undefined when all are supported. */\n public static _getNativeFallbackReason(target: unknown, animations: readonly Animation[], from: number, to: number, speedRatio: number): string | undefined {\n const reasons = partitionAnimations(target, animations, from, to, speedRatio, []).fallbackReasons;\n return reasons.length > 0 ? reasons.join(\"; \") : undefined;\n }\n\n /** @internal Return fallback bindings that must keep later overlapping writes on the same evaluator, including stopped animatables that may restart. */\n public _getBlockingFallbackBindings(): readonly AnimationBinding[] {\n return this._fallbackAnimations.map((animation) => resolveAnimationBinding(this._target, animation.targetProperty)).filter(isAnimationBinding);\n }\n\n public get speedRatio(): number {\n return this._speedRatio;\n }\n\n public set speedRatio(value: number) {\n if (this._lite && (!Number.isFinite(value) || value < 0)) {\n throw new Error(\"Native compat property animations require a finite non-negative speedRatio\");\n }\n this._speedRatio = value;\n if (this._lite) {\n this._lite.speedRatio = value;\n }\n }\n\n /** @internal Advance the animation by `deltaMs`, called once per scene frame. */\n public _tick(deltaMs: number): void {\n if (this._paused || this._stopped) {\n return;\n }\n if (this._lite) {\n this.masterFrame = this._lite.currentTime * (this._animations[0]?.framePerSecond ?? 60);\n const fallbackRunning = this._advanceFallback(deltaMs);\n this._applyFallback();\n if (!this._loop && this._lite._stopped && !fallbackRunning) {\n this._detachLite();\n this._stopped = true;\n }\n return;\n }\n const anyFallbackRunning = this._advanceFallback(deltaMs);\n this.masterFrame = this._fallbackFrames.get(this._animations[0]!) ?? this._from;\n this._applyFallback();\n if (!this._loop && !anyFallbackRunning) {\n this._stopped = true;\n }\n }\n\n public goToFrame(frame: number): void {\n this._completedFallbackAnimations.clear();\n for (const animation of this._fallbackAnimations) {\n this._resetFallbackAnimation(animation, frame);\n }\n if (this._lite) {\n liteGoToFrame(this._lite, frame);\n this.masterFrame = this._lite.currentTime * (this._lite.frameRate ?? 60);\n if (!this._paused && !this._stopped) {\n playAnimation(this._lite);\n }\n } else {\n this.masterFrame = clampAnimationFrame(this._animations[0], frame);\n }\n this._applyFallback();\n }\n\n public pause(): void {\n this._paused = true;\n if (this._lite) {\n pauseAnimation(this._lite);\n this._detachLite();\n }\n }\n\n public restart(): void {\n const restartFromBeginning = this._stopped;\n this._paused = false;\n this._stopped = false;\n if (restartFromBeginning) {\n this.masterFrame = this._from;\n this._completedFallbackAnimations.clear();\n for (const animation of this._fallbackAnimations) {\n this._resetFallbackAnimation(animation, this._from);\n }\n }\n if (this._lite) {\n if (restartFromBeginning) {\n liteGoToFrame(this._lite, this._from);\n }\n this._attachLite();\n playAnimation(this._lite);\n }\n if (restartFromBeginning) {\n this._applyFallback();\n }\n }\n\n public stop(): void {\n this._paused = false;\n this._stopped = true;\n if (this._lite) {\n stopAnimation(this._lite);\n this._detachLite();\n }\n }\n\n public get animationStarted(): boolean {\n return !this._paused && !this._stopped;\n }\n\n private _applyFallback(): void {\n for (const anim of this._fallbackAnimations) {\n const frame = this._fallbackFrames.get(anim) ?? this.masterFrame;\n let value = anim.evaluate(frame);\n if (this._loop) {\n const repeatCount = this._fallbackRepeatCounts.get(anim) ?? 0;\n const [, to] = animationPlaybackRange(anim, this._from, this._to);\n if (anim.loopMode === AnimationLoopModes.ANIMATIONLOOPMODE_CONSTANT && repeatCount > 0) {\n value = anim.evaluate(to);\n } else if (anim.loopMode === AnimationLoopModes.ANIMATIONLOOPMODE_RELATIVE && repeatCount > 0) {\n const [from] = animationPlaybackRange(anim, this._from, this._to);\n value = addValue(value, scaleValue(subtractValue(anim.evaluate(to), anim.evaluate(from)), repeatCount));\n }\n }\n applyAnimatedValue(this._target, anim.targetProperty, value);\n }\n }\n\n private _advanceFallback(deltaMs: number): boolean {\n let anyRunning = false;\n for (const animation of this._fallbackAnimations) {\n if (this._completedFallbackAnimations.has(animation)) {\n continue;\n }\n const [from, to] = animationPlaybackRange(animation, this._from, this._to);\n const frameRange = to - from;\n let elapsedFrames = (this._fallbackElapsedFrames.get(animation) ?? 0) + (deltaMs / 1000) * animation.framePerSecond * this._speedRatio;\n const reachedEnd = frameRange >= 0 ? elapsedFrames >= frameRange : elapsedFrames <= frameRange;\n let repeatCount = 0;\n let frame: number;\n if (this._loop) {\n repeatCount = frameRange === 0 ? 0 : Math.max(0, Math.trunc(elapsedFrames / frameRange));\n frame = frameRange === 0 ? to : from + (elapsedFrames % frameRange);\n anyRunning = true;\n } else if (reachedEnd) {\n elapsedFrames = frameRange;\n frame = to;\n this._completedFallbackAnimations.add(animation);\n } else {\n frame = from + elapsedFrames;\n anyRunning = true;\n }\n this._fallbackElapsedFrames.set(animation, elapsedFrames);\n this._fallbackRepeatCounts.set(animation, repeatCount);\n this._fallbackFrames.set(animation, frame);\n }\n return anyRunning;\n }\n\n private _resetFallbackAnimation(animation: Animation, frame: number): void {\n const [from] = animationPlaybackRange(animation, this._from, this._to);\n const clampedFrame = clampAnimationFrame(animation, frame);\n this._fallbackFrames.set(animation, clampedFrame);\n this._fallbackElapsedFrames.set(animation, clampedFrame - from);\n this._fallbackRepeatCounts.set(animation, 0);\n }\n\n private _attachLite(): void {\n if (this._nativeManager && this._lite) {\n addAnimationGroup(this._nativeManager, this._lite);\n }\n }\n\n private _detachLite(): void {\n if (this._nativeManager && this._lite) {\n removeAnimationGroup(this._nativeManager, this._lite);\n }\n }\n}\n\ninterface NativeAnimationPartition {\n readonly nativeAnimations: readonly Animation[];\n readonly fallbackAnimations: readonly Animation[];\n readonly fallbackReasons: readonly string[];\n}\n\nfunction partitionAnimations(\n target: unknown,\n animations: readonly Animation[],\n from: number,\n to: number,\n speedRatio: number,\n blockedNativeBindings: readonly AnimationBinding[]\n): NativeAnimationPartition {\n const globalReason = getGlobalNativeFallbackReason(animations, from, to, speedRatio);\n if (globalReason) {\n return { nativeAnimations: [], fallbackAnimations: animations.slice(), fallbackReasons: [globalReason] };\n }\n\n const reasons = new Map<Animation, string>();\n for (const animation of animations) {\n const reason = getTrackNativeFallbackReason(target, animation, from, to);\n if (reason) {\n reasons.set(animation, reason);\n }\n }\n\n let changed = true;\n while (changed) {\n changed = false;\n const fallbackPaths = animations.filter((animation) => reasons.has(animation)).map((animation) => animation.targetProperty);\n const fallbackBindings = [\n ...blockedNativeBindings,\n ...animations\n .filter((animation) => reasons.has(animation))\n .map((animation) => resolveAnimationBinding(target, animation.targetProperty))\n .filter(isAnimationBinding),\n ];\n for (const animation of animations) {\n const binding = resolveAnimationBinding(target, animation.targetProperty);\n if (\n !reasons.has(animation) &&\n (fallbackPaths.some((path) => pathsOverlap(path, animation.targetProperty)) ||\n (binding !== undefined && fallbackBindings.some((fallbackBinding) => bindingsOverlap(binding, fallbackBinding))))\n ) {\n reasons.set(animation, `native property animation path \"${animation.targetProperty}\" overlaps a compat fallback path`);\n changed = true;\n }\n }\n }\n\n return {\n nativeAnimations: animations.filter((animation) => !reasons.has(animation)),\n fallbackAnimations: animations.filter((animation) => reasons.has(animation)),\n fallbackReasons: [...new Set(reasons.values())],\n };\n}\n\nfunction getGlobalNativeFallbackReason(animations: readonly Animation[], from: number, to: number, speedRatio: number): string | undefined {\n if (animations.length === 0) {\n return \"native property animation requires at least one Animation\";\n }\n if (!Number.isFinite(from) || !Number.isFinite(to) || !(to > from)) {\n return \"native property animation requires a finite forward play range\";\n }\n if (!Number.isFinite(speedRatio) || speedRatio < 0) {\n return \"native property animation does not delegate reverse or non-finite speed ratios\";\n }\n const frameRate = animations[0]!.framePerSecond;\n if (!(frameRate > 0) || !Number.isFinite(frameRate)) {\n return \"native property animation requires a finite positive frame rate\";\n }\n if (animations.some((animation) => animation.framePerSecond !== frameRate)) {\n return \"native property animation requires one shared frame rate\";\n }\n return undefined;\n}\n\nfunction getTrackNativeFallbackReason(target: unknown, animation: Animation, from: number, to: number): string | undefined {\n if (animation.loopMode !== AnimationLoopModes.ANIMATIONLOOPMODE_CYCLE) {\n return `native property animation track \"${animation.targetProperty}\" requires cycle loop mode`;\n }\n const stride = supportedStride(animation.dataType);\n if (stride === 0) {\n return `native property animation track \"${animation.targetProperty}\" has an unsupported data type`;\n }\n const keys = animation.getKeys();\n if (keys.length === 0) {\n return `native property animation track \"${animation.targetProperty}\" requires at least one key`;\n }\n let previousFrame = -Infinity;\n for (const key of keys) {\n if (!Number.isFinite(key.frame) || key.frame < 0 || key.frame <= previousFrame || !isSupportedKeyValue(key.value, stride)) {\n return `native property animation track \"${animation.targetProperty}\" has an unsupported key frame or value`;\n }\n previousFrame = key.frame;\n }\n if (from < keys[0]!.frame || to > keys[keys.length - 1]!.frame) {\n return `native property animation track \"${animation.targetProperty}\" does not cover the requested play range`;\n }\n if (!uniformInterpolation(keys)) {\n return `native property animation track \"${animation.targetProperty}\" mixes STEP and LINEAR segments`;\n }\n if (keys.some((key, index) => index < keys.length - 1 && key.interpolation !== AnimationKeyInterpolation.STEP && key.easingFunction)) {\n return `native property animation track \"${animation.targetProperty}\" uses per-key easing`;\n }\n if (!supportsNativeBinding(target, animation.targetProperty, stride)) {\n return `native property animation path \"${animation.targetProperty}\" is not writable by the native binding`;\n }\n return undefined;\n}\n\nfunction createNativeAnimationGroup(\n manager: AnimationManager,\n target: unknown,\n animations: readonly Animation[],\n from: number,\n to: number,\n loop: boolean,\n speedRatio: number\n): LiteAnimationGroup {\n const tracks: PropertyAnimationTrackOptions[] = animations.map((animation) => {\n const stride = supportedStride(animation.dataType);\n return {\n path: animation.targetProperty,\n frameRate: animation.framePerSecond,\n interpolation: trackInterpolation(animation.getKeys()),\n quaternion: animation.dataType === AnimationTypes.ANIMATIONTYPE_QUATERNION,\n easing: (gradient) => animation.getEasingFunction()?.ease(gradient) ?? gradient,\n keys: animation.getKeys().map((key) => ({ frame: key.frame, value: toNativeKeyValue(key.value, stride) })),\n };\n });\n const clip = createPropertyAnimationClip(animations[0]!.name, tracks, { frameRate: animations[0]!.framePerSecond });\n return createPropertyAnimationGroup(manager, target as object, clip, { fromFrame: from, toFrame: to, loop, speedRatio });\n}\n\nfunction supportedStride(dataType: number): number {\n switch (dataType) {\n case AnimationTypes.ANIMATIONTYPE_FLOAT:\n return 1;\n case AnimationTypes.ANIMATIONTYPE_VECTOR2:\n return 2;\n case AnimationTypes.ANIMATIONTYPE_VECTOR3:\n return 3;\n case AnimationTypes.ANIMATIONTYPE_QUATERNION:\n return 4;\n default:\n return 0;\n }\n}\n\nfunction isSupportedKeyValue(value: AnimationValue, stride: number): boolean {\n return readAnimationComponents(value, stride) !== undefined;\n}\n\nfunction toNativeKeyValue(value: AnimationValue, stride: number): number | number[] {\n if (typeof value === \"number\") {\n return value;\n }\n return readAnimationComponents(value, stride)!;\n}\n\nfunction pathsOverlap(a: string, b: string): boolean {\n return a === b || a.startsWith(`${b}.`) || b.startsWith(`${a}.`);\n}\n\ninterface AnimationBinding {\n readonly root: object;\n readonly path: string;\n readonly target: object;\n readonly property: string;\n}\n\nfunction resolveAnimationBinding(target: unknown, path: string): AnimationBinding | undefined {\n const parts = path.split(\".\");\n if (parts.length === 0 || parts.some((part) => part.length === 0) || (typeof target !== \"object\" && typeof target !== \"function\") || target === null) {\n return undefined;\n }\n const root = target;\n let owner: unknown = target;\n for (let i = 0; i < parts.length - 1; i++) {\n if ((typeof owner !== \"object\" && typeof owner !== \"function\") || owner === null) {\n return undefined;\n }\n owner = (owner as Record<string, unknown>)[parts[i]!];\n }\n return (typeof owner === \"object\" || typeof owner === \"function\") && owner !== null ? { root, path, target: owner, property: parts[parts.length - 1]! } : undefined;\n}\n\nfunction bindingsOverlap(a: AnimationBinding, b: AnimationBinding): boolean {\n return (a.root === b.root && pathsOverlap(a.path, b.path)) || (a.target === b.target && a.property === b.property);\n}\n\nfunction isAnimationBinding(binding: AnimationBinding | undefined): binding is AnimationBinding {\n return binding !== undefined;\n}\n\nfunction clampAnimationFrame(animation: Animation | undefined, frame: number): number {\n const keys = animation?.getKeys();\n if (!keys || keys.length === 0) {\n return frame;\n }\n return Math.min(Math.max(frame, keys[0]!.frame), keys[keys.length - 1]!.frame);\n}\n\nfunction animationPlaybackRange(animation: Animation, from: number, to: number): readonly [number, number] {\n const keys = animation.getKeys();\n if (keys.length === 0) {\n return [from, to];\n }\n const min = keys[0]!.frame;\n const max = keys[keys.length - 1]!.frame;\n return [from < min || from > max ? min : from, to < min || to > max ? max : to];\n}\n\nfunction uniformInterpolation(keys: readonly IAnimationKey[]): boolean {\n let mode: number | undefined;\n for (let i = 0; i < keys.length - 1; i++) {\n const keyMode = keys[i]!.interpolation === AnimationKeyInterpolation.STEP ? AnimationKeyInterpolation.STEP : AnimationKeyInterpolation.NONE;\n mode ??= keyMode;\n if (mode !== keyMode) {\n return false;\n }\n }\n return true;\n}\n\nfunction trackInterpolation(keys: readonly IAnimationKey[]): PropertyAnimationInterpolation {\n return keys.length > 1 && keys[0]!.interpolation === AnimationKeyInterpolation.STEP ? \"step\" : \"linear\";\n}\n\nfunction supportsNativeBinding(target: unknown, path: string, stride: number): boolean {\n const parts = path.split(\".\");\n if (parts.length === 0 || parts.some((part) => part.length === 0)) {\n return false;\n }\n let owner: unknown = target;\n for (let i = 0; i < parts.length - 1; i++) {\n if ((typeof owner !== \"object\" && typeof owner !== \"function\") || owner === null) {\n return false;\n }\n const record = owner as Record<string, unknown>;\n const part = parts[i]!;\n if (!(part in record)) {\n return false;\n }\n owner = record[part];\n }\n if ((typeof owner !== \"object\" && typeof owner !== \"function\") || owner === null) {\n return false;\n }\n const record = owner as Record<string, unknown>;\n const property = parts[parts.length - 1]!;\n if (!(property in record)) {\n return false;\n }\n const value = record[property];\n return stride === 1\n ? typeof value === \"number\"\n : (typeof value === \"object\" || typeof value === \"function\") && value !== null && typeof (value as { set?: unknown }).set === \"function\";\n}\n\nexport type AnimationGroupState = \"init\" | \"playing\" | \"paused\" | \"stopped\";\n\n/**\n * @internal Surface a structural `AnimationGroup` needs from its host scene to be\n * stepped + weight-blended each frame. Typed structurally to avoid a Scene import\n * cycle.\n */\nexport interface StructuralAnimationHost {\n /** @internal Register a structural group to be stepped + blended each frame. */\n _registerStructuralGroup(group: AnimationGroup): void;\n /** @internal Re-run weighted blending across all structural groups. */\n _recomputeStructuralBlends(): void;\n}\n\n/**\n * @internal Surface a **loaded** glTF/.babylon `AnimationGroup` needs from its\n * host scene to enable Babylon Lite's weighted / additive skeletal blending.\n * Implemented structurally by the compat `Scene` to avoid an import cycle.\n */\nexport interface LoadedAnimationBlendHost {\n /**\n * @internal Route the scene's loaded Lite animation groups through a\n * scene-owned `AnimationManager` with blending enabled (idempotent).\n */\n _enableLoadedBlend(): void;\n}\n\n/**\n * Babylon.js `AnimationGroup` — a named collection of targeted animations with\n * playback state. This is the **single** `AnimationGroup` type, matching Babylon.js;\n * there is no separate \"loaded\" subtype. Two construction paths map onto Lite:\n *\n * - **Structural** (`new AnimationGroup(name, scene?)`): a CPU-side collection\n * built by ported code via `addTargetedAnimation`. When `start`ed it registers\n * with the scene and is stepped each frame on the CPU; multiple groups that\n * animate the same property are **weight-blended** (Babylon.js manual weighted\n * / cross-fade blending) before the result is written to the target.\n * - **Loaded** (`AnimationGroup._fromLite`, used to populate `scene.animationGroups`\n * from glTF / `.babylon` clips): a thin wrapper over a Babylon Lite loaded group.\n * The playback methods (`goToFrame`/`play`/`pause`/`stop`/`reset`) and the\n * `from`/`to`/`isPlaying`/`speedRatio`/`loopAnimation`/`weight`/`animatables`\n * accessors delegate to the Lite group so ported scenes can freeze/seek a\n * loaded animation at a deterministic frame.\n */\nexport class AnimationGroup {\n public readonly targetedAnimations: Array<{ animation: Animation; target: unknown }> = [];\n public onAnimationGroupEndObservable?: () => void;\n\n /** @internal Babylon Lite loaded-group backing (set only on the loaded path). */\n public _lite?: LiteAnimationGroup;\n /** @internal Engine context used to drive Lite-backed playback. */\n private _engine?: EngineContext;\n /** @internal Host scene that owns the loaded-group blend manager (loaded path). */\n private _blendHost?: LoadedAnimationBlendHost;\n\n private _from = 0;\n private _to = 0;\n private _state: AnimationGroupState = \"init\";\n private _speedRatio = 1;\n private _loopAnimation = false;\n /** @internal Blend weight for the structural path (loaded path reads `_lite.weight`). */\n private _weight = 1;\n /** @internal Current frame for the structural path. */\n private _currentFrame = 0;\n /** @internal Host scene that steps + blends this structural group each frame. */\n private readonly _host?: StructuralAnimationHost;\n\n public constructor(\n public name: string,\n scene?: unknown\n ) {\n this._host = (scene as StructuralAnimationHost | undefined) ?? undefined;\n }\n\n /** @internal Build an `AnimationGroup` backed by a Babylon Lite loaded group. */\n public static _fromLite(lite: LiteAnimationGroup, engine: EngineContext, blendHost?: LoadedAnimationBlendHost): AnimationGroup {\n const group = new AnimationGroup(lite.name);\n group._lite = lite;\n group._engine = engine;\n group._blendHost = blendHost;\n return group;\n }\n\n /**\n * Babylon.js `AnimationGroup.MakeAnimationAdditive(group)` — convert a loaded\n * group into an additive layer (reference frame 0) and enable the scene's\n * weighted-blend manager. Returns the same group (Babylon Lite mutates in\n * place rather than cloning).\n */\n public static MakeAnimationAdditive(group: AnimationGroup): AnimationGroup {\n if (group._lite) {\n setAnimationAdditive(group._lite, { referenceFrame: 0 });\n group._blendHost?._enableLoadedBlend();\n }\n return group;\n }\n\n /** First frame of the clip. Always 0 for loaded clips. */\n public get from(): number {\n return this._lite ? 0 : this._from;\n }\n\n /** Last frame of the clip. */\n public get to(): number {\n return this._lite ? this._lite.duration * (this._lite.frameRate ?? 60) : this._to;\n }\n\n public get isPlaying(): boolean {\n return this._lite ? this._lite.isPlaying : this._state === \"playing\";\n }\n\n public get state(): AnimationGroupState {\n if (this._lite) {\n return this._lite.isPlaying ? \"playing\" : \"paused\";\n }\n return this._state;\n }\n\n public get speedRatio(): number {\n return this._lite ? this._lite.speedRatio : this._speedRatio;\n }\n public set speedRatio(value: number) {\n if (this._lite) {\n this._lite.speedRatio = value;\n } else {\n this._speedRatio = value;\n }\n }\n\n public get loopAnimation(): boolean {\n return this._lite ? this._lite.loopAnimation : this._loopAnimation;\n }\n public set loopAnimation(value: boolean) {\n if (this._lite) {\n this._lite.loopAnimation = value;\n } else {\n this._loopAnimation = value;\n }\n }\n\n public get weight(): number {\n return this._lite ? this._lite.weight : this._weight;\n }\n public set weight(value: number) {\n if (this._lite) {\n this._lite.weight = value;\n // A non-unit weight on a loaded clip means the scene must blend its\n // groups (Babylon.js manual weighted blend). Enable the scene's\n // weighted-blend manager (idempotent; no-op for the default weight 1).\n if (value !== 1) {\n this._blendHost?._enableLoadedBlend();\n }\n } else {\n this._weight = value;\n this._host?._recomputeStructuralBlends();\n }\n }\n\n /**\n * Babylon.js `AnimationGroup.animatables`. For loaded groups Babylon Lite drives\n * the whole group as one unit, so this surfaces a single animatable whose\n * `masterFrame` reflects the group's current frame. Structural groups built\n * without a running scene report no animatables.\n */\n public get animatables(): Array<{ masterFrame: number }> {\n if (this._lite) {\n const frameRate = this._lite.frameRate ?? 60;\n return [{ masterFrame: this._lite.currentTime * frameRate }];\n }\n return [];\n }\n\n public addTargetedAnimation(animation: Animation, target: unknown): { animation: Animation; target: unknown } {\n const entry = { animation, target };\n this.targetedAnimations.push(entry);\n this._from = Math.min(this._from, 0);\n this._to = Math.max(this._to, animation.getHighestFrame());\n return entry;\n }\n\n /**\n * Babylon.js `start(loop?, speedRatio?, from?, to?)`. On the structural path this\n * registers the group with its host scene, captures the targets' rest-pose\n * baselines, and begins CPU stepping + weight blending. On the loaded path it\n * seeks to `from` and plays — except a zero-length range (`from === to`) is a\n * **held single-frame pose** (e.g. an additive pose layer), which must hold\n * rather than play: Babylon Lite's group advance ignores the BJS play range and\n * would otherwise loop the (often ~2-frame) pose clip every frame, flickering.\n */\n public start(loop = true, speedRatio = 1, from?: number, to?: number): this {\n if (this._lite) {\n const frameRate = this._lite.frameRate ?? 60;\n if (from !== undefined) {\n this._lite.currentTime = from / frameRate;\n }\n this._lite.speedRatio = speedRatio;\n this._lite.loopAnimation = loop;\n if (from !== undefined && to !== undefined && from === to) {\n // Held single-frame pose — seek and hold (do not advance/loop).\n // `play` then `pause` clears Lite's internal `_stopped` flag (set by a\n // prior `stop()`) while leaving the clip paused, so the weighted mixer\n // still includes this group (a `_stopped` group is excluded from\n // blending, which would drop the whole shared-skeleton blend).\n playAnimation(this._lite);\n pauseAnimation(this._lite);\n return this;\n }\n return this.play(loop);\n }\n this._loopAnimation = loop;\n this._speedRatio = speedRatio;\n if (from !== undefined) {\n this._from = from;\n }\n if (to !== undefined) {\n this._to = to;\n }\n this._currentFrame = this._from;\n this._state = \"playing\";\n for (const { target, animation } of this.targetedAnimations) {\n captureOriginal(target as object, animation.targetProperty);\n }\n this._host?._registerStructuralGroup(this);\n this._host?._recomputeStructuralBlends();\n return this;\n }\n\n /** Babylon.js `goToFrame(frame)` — seek to a frame (loaded groups seek + hold via Lite; structural groups re-blend). */\n public goToFrame(frame: number): this {\n if (this._lite && this._engine) {\n liteGoToFrame(this._lite, frame, this._engine);\n } else {\n this._currentFrame = frame;\n this._host?._recomputeStructuralBlends();\n }\n return this;\n }\n\n public play(loop?: boolean): this {\n if (this._lite) {\n if (loop !== undefined) {\n this._lite.loopAnimation = loop;\n }\n playAnimation(this._lite);\n } else {\n this._state = \"playing\";\n }\n return this;\n }\n\n public pause(): this {\n if (this._lite) {\n pauseAnimation(this._lite);\n } else {\n this._state = \"paused\";\n }\n return this;\n }\n\n public stop(): this {\n if (this._lite) {\n stopAnimation(this._lite);\n } else {\n this._state = \"stopped\";\n }\n return this;\n }\n\n public reset(): this {\n if (this._lite && this._engine) {\n liteGoToFrame(this._lite, 0, this._engine);\n } else {\n this._state = \"init\";\n }\n return this;\n }\n\n /** @internal Whether this structural group currently contributes to blending (started, not stopped). */\n public _isStructuralActive(): boolean {\n return !this._lite && (this._state === \"playing\" || this._state === \"paused\");\n }\n\n /** @internal Advance a playing structural group's frame by `deltaMs` (with loop wrap). */\n public _advanceStructural(deltaMs: number): void {\n if (this._lite || this._state !== \"playing\") {\n return;\n }\n const fps = this.targetedAnimations[0]?.animation.framePerSecond ?? 60;\n this._currentFrame += (deltaMs / 1000) * fps * this._speedRatio;\n if (this._currentFrame > this._to) {\n if (this._loopAnimation) {\n const span = this._to - this._from || 1;\n this._currentFrame = this._from + ((this._currentFrame - this._from) % span);\n } else {\n this._currentFrame = this._to;\n this._state = \"stopped\";\n }\n }\n }\n\n /**\n * @internal Babylon.js manual weighted / cross-fade blending. Groups of\n * animations targeting the same (target, property) are mixed by weight: when\n * the total weight exceeds 1 the contributions are normalized, and when it is\n * below 1 the property's captured rest-pose baseline fills the remainder.\n */\n public static _blendStructuralGroups(groups: readonly AnimationGroup[]): void {\n interface Holder {\n target: object;\n path: string;\n total: number;\n contributions: Array<{ value: AnimValue; weight: number }>;\n }\n const holders = new Map<object, Map<string, Holder>>();\n for (const group of groups) {\n if (!group._isStructuralActive()) {\n continue;\n }\n const weight = group._weight;\n for (const { target, animation } of group.targetedAnimations) {\n const obj = target as object;\n const path = animation.targetProperty;\n const value = animation.evaluate(group._currentFrame);\n let perTarget = holders.get(obj);\n if (!perTarget) {\n perTarget = new Map();\n holders.set(obj, perTarget);\n }\n let holder = perTarget.get(path);\n if (!holder) {\n holder = { target: obj, path, total: 0, contributions: [] };\n perTarget.set(path, holder);\n }\n holder.total += weight;\n holder.contributions.push({ value, weight });\n }\n }\n for (const perTarget of holders.values()) {\n for (const holder of perTarget.values()) {\n const original = structuralOriginals.get(holder.target)?.get(holder.path) ?? 0;\n let final: AnimValue;\n if (holder.total === 0) {\n final = original;\n } else {\n let normalizer = 1;\n if (holder.total < 1) {\n final = scaleValue(original, 1 - holder.total);\n } else {\n normalizer = holder.total;\n final = zeroLike(holder.contributions[0]!.value);\n }\n for (const c of holder.contributions) {\n final = addValue(final, scaleValue(c.value, c.weight / normalizer));\n }\n }\n applyAnimatedValue(holder.target, holder.path, final);\n }\n }\n }\n}\n","/**\n * Babylon.js engine-level enums and constant bags that scenes import for their\n * numeric values. These carry no behaviour in the compat layer — they exist so\n * that code reading `ScenePerformancePriority.Aggressive`,\n * `ImageProcessingConfiguration.TONEMAPPING_ACES`, or\n * `Constants.MATERIAL_CounterClockWiseSideOrientation` resolves to the same\n * numbers Babylon.js uses.\n */\n\nimport { unsupported } from \"../error.js\";\n\n/** Babylon.js `ScenePerformancePriority`. */\nexport enum ScenePerformancePriority {\n BackwardCompatible = 0,\n Intermediate = 1,\n Aggressive = 2,\n}\n\n/**\n * Babylon.js `ShaderLanguage` — the shader-source language selector. Babylon Lite\n * is WGSL-only, but the enum is surfaced (with Babylon.js's numeric values) so\n * scenes that import it to author `WGSL` shaders resolve the symbol; a `GLSL`\n * `ShaderMaterial`/`EffectWrapper` still fails loudly at construction.\n */\nexport enum ShaderLanguage {\n GLSL = 0,\n WGSL = 1,\n}\n\n/**\n * Minimal Babylon.js `ImageProcessingConfiguration` facade over Lite's image\n * processing state.\n */\nexport class ImageProcessingConfiguration {\n public static readonly TONEMAPPING_STANDARD = 0;\n public static readonly TONEMAPPING_ACES = 1;\n public static readonly TONEMAPPING_KHR_PBR_NEUTRAL = 2;\n\n private _backing: {\n exposure: number;\n contrast: number;\n toneMappingEnabled: boolean;\n } = {\n exposure: 1,\n contrast: 1,\n toneMappingEnabled: false,\n };\n\n /** @internal Attach this facade to a scene's Babylon Lite state. */\n public _attach(backing: { exposure: number; contrast: number; toneMappingEnabled: boolean }): this {\n this._backing = backing;\n return this;\n }\n\n public get exposure(): number {\n return this._backing.exposure;\n }\n public set exposure(value: number) {\n this._backing.exposure = value;\n }\n\n public get contrast(): number {\n return this._backing.contrast;\n }\n public set contrast(value: number) {\n this._backing.contrast = value;\n }\n\n public get toneMappingEnabled(): boolean {\n return this._backing.toneMappingEnabled;\n }\n public set toneMappingEnabled(value: boolean) {\n this._backing.toneMappingEnabled = value;\n }\n\n public get whiteBalanceEnabled(): boolean {\n return false;\n }\n public set whiteBalanceEnabled(value: boolean) {\n if (value) {\n unsupported(\"ImageProcessingConfiguration.whiteBalanceEnabled\", WHITE_BALANCE_UNSUPPORTED);\n }\n }\n\n public get temperature(): number {\n return 6500;\n }\n public set temperature(value: number) {\n if (value !== 6500) {\n unsupported(\"ImageProcessingConfiguration.temperature\", WHITE_BALANCE_UNSUPPORTED);\n }\n }\n\n public get tint(): number {\n return 0;\n }\n public set tint(value: number) {\n if (value !== 0) {\n unsupported(\"ImageProcessingConfiguration.tint\", WHITE_BALANCE_UNSUPPORTED);\n }\n }\n}\n\nconst WHITE_BALANCE_UNSUPPORTED =\n \"White balance requires color-temperature math, a shader uniform, material/post-process defines, and pipeline invalidation that Babylon Lite does not expose; adding it needs a cross-cutting Lite subsystem design.\";\n\n/** Babylon.js pure-module registration hook. */\nexport function RegisterImageProcessingConfiguration(): void {\n return unsupported(\"RegisterImageProcessingConfiguration\", \"Babylon Lite has no Babylon.js SerializationHelper parser registry to install ImageProcessingConfiguration into.\");\n}\n\n/**\n * Babylon.js pure-module texture-loader registration hook. Lite dispatches its\n * supported texture formats directly, so no registration is required.\n */\nexport function RegisterAbstractEngineTextureLoaders(): void {}\n\n/** Pure-build registration shim; compat wires the Lite array upload directly. */\nexport function RegisterEnginesExtensionsEngineTexture2DArrayImageSource(): void {}\n\n/** WebGPU pure-build registration shim; Babylon Lite is WebGPU-only. */\nexport function RegisterEnginesWebGPUExtensionsEngineTexture2DArrayImageSource(): void {}\n\n/**\n * Babylon.js `Constants` — the small subset of numeric constants referenced by\n * the ported scenes. Extend as needed.\n */\nexport const Constants = {\n MATERIAL_ClockWiseSideOrientation: 0,\n MATERIAL_CounterClockWiseSideOrientation: 1,\n MATERIAL_TriangleFillMode: 0,\n MATERIAL_WireFrameFillMode: 1,\n MATERIAL_PointFillMode: 2,\n ALPHA_DISABLE: 0,\n ALPHA_ADD: 1,\n ALPHA_COMBINE: 2,\n ALPHA_ONEONE: 6,\n ALPHA_PREMULTIPLIED: 7,\n ALPHA_REPLACE_COLOR: 21,\n MATERIAL_OPAQUE: 0,\n MATERIAL_ALPHATEST: 1,\n MATERIAL_ALPHABLEND: 2,\n TEXTURE_CLAMP_ADDRESSMODE: 0,\n TEXTURE_WRAP_ADDRESSMODE: 1,\n TEXTURE_MIRROR_ADDRESSMODE: 2,\n TEXTURE_NEAREST_SAMPLINGMODE: 1,\n TEXTURE_BILINEAR_SAMPLINGMODE: 2,\n TEXTURE_TRILINEAR_SAMPLINGMODE: 3,\n TEXTUREFORMAT_RGBA: 5,\n TEXTURETYPE_UNSIGNED_BYTE: 0,\n BUFFER_CREATIONFLAG_READ: 1,\n BUFFER_CREATIONFLAG_WRITE: 2,\n BUFFER_CREATIONFLAG_READWRITE: 3,\n BUFFER_CREATIONFLAG_UNIFORM: 4,\n BUFFER_CREATIONFLAG_VERTEX: 8,\n BUFFER_CREATIONFLAG_INDEX: 16,\n BUFFER_CREATIONFLAG_STORAGE: 32,\n BUFFER_CREATIONFLAG_INDIRECT: 64,\n} as const;\n","import type { PickingInfo } from \"../culling/picking-info.js\";\n\n/** Babylon.js pointer event masks emitted by `Scene.onPointerObservable`. */\nexport class PointerEventTypes {\n public static readonly POINTERDOWN = 0x01;\n public static readonly POINTERUP = 0x02;\n public static readonly POINTERMOVE = 0x04;\n public static readonly POINTERWHEEL = 0x08;\n public static readonly POINTERPICK = 0x10;\n public static readonly POINTERTAP = 0x20;\n public static readonly POINTERDOUBLETAP = 0x40;\n}\n\n/** Babylon.js-shaped payload emitted by `Scene.onPointerObservable`. */\nexport class PointerInfo {\n public constructor(\n public type: number,\n public event: PointerEvent | WheelEvent,\n private readonly _pickInfo: PickingInfo | null\n ) {}\n\n public get pickInfo(): PickingInfo | null {\n return this._pickInfo;\n }\n}\n","/**\n * Babylon.js-compatible `Scene` implemented over a Babylon Lite `SceneContext`.\n *\n * The wrapper owns a Lite `SceneContext` (`_lite`) and proxies the common\n * Babylon.js scene surface: `clearColor`, `activeCamera`, the before/after-render\n * observables, default camera creation, and disposal. Entities created by the\n * compat light/camera/mesh wrappers register themselves against `_lite`.\n *\n * `scene.render()` is a no-op: Babylon Lite drives rendering through the engine's\n * loop (`runRenderLoop` / `startEngine`). Manual single-frame rendering is not\n * supported in this compat layer.\n */\n\nimport {\n createSceneContext,\n disposeScene,\n onBeforeRender,\n createDefaultCamera as liteCreateDefaultCamera,\n setFog,\n setClipPlane,\n loadEnvironment,\n loadDdsEnvironment,\n loadHdrEnvironment,\n createHemisphericLight,\n addToScene,\n createAnimationManager,\n addAnimationGroup,\n clearAnimationManager,\n enableAnimationBlending,\n updateAnimationManager,\n pickMeshesWithRayPrecise as litePickWithRay,\n createPickingRay as liteCreatePickingRay,\n resolveCameraViewport,\n invertMat4,\n multiplyMat4,\n onPhysicsAfterStep,\n} from \"babylon-lite\";\nimport type {\n SceneContext,\n Camera as LiteCamera,\n ArcRotateCamera as LiteArcRotateCamera,\n FreeCamera as LiteFreeCamera,\n AnimationManager,\n Mesh as LiteMesh,\n PickingInfo as LitePickingInfo,\n Mat4,\n Material as LiteMaterial,\n EngineContext,\n} from \"babylon-lite\";\n\nimport { Color3, Color4 } from \"../math/color.js\";\nimport type { Plane } from \"../math/plane.js\";\nimport { HavokPlugin, PhysicsEngine } from \"../physics/physics.js\";\nimport { unsupported } from \"../error.js\";\nimport { Observable } from \"../misc/observable.js\";\nimport type { Camera } from \"../cameras/cameras.js\";\nimport { ArcRotateCamera, FreeCamera } from \"../cameras/cameras.js\";\nimport { StandardMaterial } from \"../materials/materials.js\";\nimport { Animatable } from \"../animations/animation.js\";\nimport type { Animation } from \"../animations/animation.js\";\nimport { AnimationGroup } from \"../animations/animation.js\";\nimport type { BaseTexture, CubeTexture, HDRCubeTexture } from \"../textures/textures.js\";\nimport type { WebGPUEngine } from \"../engine/engine.js\";\nimport { AbstractScene } from \"./abstract-scene.js\";\nimport { Logger } from \"../misc/misc-utils.js\";\nimport { ImageProcessingConfiguration } from \"../misc/engine-constants.js\";\nimport type { FluidRenderer } from \"../unsupported/unsupported-apis.js\";\nimport { Matrix } from \"../math/matrix.js\";\nimport { Ray } from \"../math/ray.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport { PickingInfo } from \"../culling/picking-info.js\";\nimport { AbstractMesh, Mesh } from \"../meshes/meshes.js\";\nimport { PointerEventTypes, PointerInfo } from \"../events/pointer-events.js\";\n\n/** Babylon.js EnvironmentHelper default skybox/ground assets (match the Lite ports). */\nconst DEFAULT_SKYBOX_URL = \"https://assets.babylonjs.com/core/environments/backgroundSkybox.dds\";\nconst DEFAULT_GROUND_URL = \"https://assets.babylonjs.com/core/environments/backgroundGround.png\";\n/** Babylon.js `createDefaultEnvironment` IBL fallback when no `environmentTexture` is set. */\nconst DEFAULT_ENV_URL = \"https://assets.babylonjs.com/environments/environmentSpecular.env\";\nconst FLUID_RENDERER_UNSUPPORTED =\n \"Fluid rendering requires dedicated depth, thickness, and diffuse passes plus render-target lifecycle and composition policies that Babylon Lite does not define.\";\ntype CompatShadowGenerator = { _build(engine: EngineContext): void; _liteGen?: unknown };\n\nexport type MeshPredicate = (mesh: AbstractMesh, thinInstanceIndex: number) => boolean;\nexport type TrianglePickingPredicate = (p0: Vector3, p1: Vector3, p2: Vector3, ray: Ray, i0: number, i1: number, i2: number) => boolean;\n\n/**\n * Babylon.js resolves the BRDF lookup texture from an embedded Base64 PNG rather than a\n * URL, so PBR materials work with no asset deployment and no network request. Mirror that\n * here instead of exposing a URL option: Babylon.js's `IEnvironmentHelperOptions` has no\n * BRDF field, and a fetched default breaks under SPA dev servers that answer missing files\n * with a 200 HTML page. Loaded lazily so only apps that load an environment pay for it.\n */\nasync function getBrdfLutUrl(): Promise<string> {\n return (await import(\"./brdf-lut-data.js\")).BRDF_LUT_DATA_URL;\n}\n\ninterface DefaultEnvironmentOptions {\n createSkybox?: boolean;\n createGround?: boolean;\n skyboxSize?: number;\n /** Babylon.js EnvironmentHelper: set up tone mapping / exposure / contrast (default true). */\n setupImageProcessing?: boolean;\n /** Babylon.js EnvironmentHelper camera exposure (default 0.8). */\n cameraExposure?: number;\n /** Babylon.js EnvironmentHelper camera contrast (default 1.2). */\n cameraContrast?: number;\n /** Babylon.js EnvironmentHelper tone-mapping toggle (default true). */\n toneMappingEnabled?: boolean;\n /** @internal When set, the skybox is the environment texture itself (Babylon.js `createDefaultSkybox`). */\n skyboxFromEnv?: boolean;\n /** @internal Apply EnvironmentHelper image processing (only set by `createDefaultEnvironment`). */\n applyImageProcessing?: boolean;\n}\n\nexport class Scene extends AbstractScene {\n /** @internal Underlying Babylon Lite scene context. */\n public readonly _lite: SceneContext;\n\n /** Babylon.js fog-mode constants. */\n public static readonly FOGMODE_NONE = 0;\n public static readonly FOGMODE_EXP = 1;\n public static readonly FOGMODE_EXP2 = 2;\n public static readonly FOGMODE_LINEAR = 3;\n\n /** Fires before each scene render (wired to Lite's before-render hook). */\n public readonly onBeforeRenderObservable = new Observable<Scene>();\n /** Fires before animations are evaluated each frame (used by ported cross-fade drivers). */\n public readonly onBeforeAnimationsObservable = new Observable<Scene>();\n /** Fires after each scene render. */\n public readonly onAfterRenderObservable = new Observable<Scene>();\n /** Fires after each Lite Havok simulation step. */\n public readonly onAfterPhysicsObservable = new Observable<Scene>();\n /** Fires once when the scene is disposed. */\n public readonly onDisposeObservable = new Observable<Scene>();\n /** Babylon.js scene-level pointer events from the engine rendering canvas. */\n public readonly onPointerObservable = new Observable<PointerInfo>();\n /** @internal Callbacks that must run after Babylon.js-compatible before-render observers. */\n private readonly _beforeRenderFlushCallbacks = new Set<() => void>();\n /** @internal Canvas target that owns this scene's pointer listeners. */\n private _pointerEventTarget: EventTarget | null = null;\n /** @internal Shared listener registered for each supported DOM pointer event. */\n private _pointerEventListener: EventListener | null = null;\n\n /**\n * Babylon.js `scene.animationGroups` / `scene.animatables`. Loaded glTF /\n * `.babylon` animation clips live on the Lite scene; `animationGroups` returns\n * BJS-shaped `AnimationGroup`s over them (so scenes can `goToFrame`/`pause`/`stop`\n * to freeze a model at a deterministic frame). `animatables` surfaces the\n * native-backed and fallback `Animatable`s started through the scene.\n */\n public get animationGroups(): AnimationGroup[] {\n const liteGroups = this._lite.animationGroups ?? [];\n return liteGroups.map((g) => {\n let wrapper = this._animationGroupCache.get(g);\n if (!wrapper) {\n wrapper = AnimationGroup._fromLite(g, this._engine._lite, this);\n this._animationGroupCache.set(g, wrapper);\n }\n return wrapper;\n });\n }\n\n /** Babylon.js `scene.getAnimationGroupByName(name)` — first loaded animation group with a matching name, else `null`. */\n public getAnimationGroupByName(name: string): AnimationGroup | null {\n return this.animationGroups.find((g) => g.name === name) ?? null;\n }\n\n public get animatables(): Animatable[] {\n return this._runningAnimatables;\n }\n\n private readonly _engine: WebGPUEngine;\n private _activeCamera: Camera | null = null;\n public cameraToUseForPointers: Camera | null = null;\n private _defaultMaterial: StandardMaterial | null = null;\n private _fogMode = 0;\n private _fogStart = 0;\n private _fogEnd = 1000;\n private _fogDensity = 0.1;\n private _fogColor = new Color3(0.2, 0.2, 0.3);\n /**\n * @internal Mesh scene-adds deferred until the engine starts. Babylon Lite\n * locks a mesh into a render group (standard vs PBR) at `addToScene` time by\n * reading its material, whereas Babylon.js code routinely creates a mesh and\n * assigns `mesh.material` a line later. Deferring the add until engine start\n * lets those assignments settle so the mesh lands in the correct group.\n */\n private readonly _pendingAdds: Array<() => void> = [];\n private _started = false;\n private _envTexture: CubeTexture | HDRCubeTexture | null = null;\n private _brdfTexture: BaseTexture | null = null;\n private _defaultEnvOptions: DefaultEnvironmentOptions | null = null;\n private readonly _shadowGenerators: CompatShadowGenerator[] = [];\n private readonly _pendingTextures: Array<Promise<void>> = [];\n private readonly _pendingGroundBakes: Array<() => void> = [];\n private readonly _pendingMorphBuilds: Array<{ mesh: { _lite: unknown }; manager: { _build(mesh: never, engine: import(\"babylon-lite\").EngineContext): void } }> = [];\n private _materialPluginsRequested = false;\n private readonly _pendingMaterialPluginReconciliations = new Set<LiteMaterial>();\n private readonly _runningAnimatables: Animatable[] = [];\n /** @internal Lite manager that owns supported compat property animations. */\n private _propertyAnimationManager: AnimationManager | null = null;\n private readonly _animationGroupCache = new WeakMap<object, AnimationGroup>();\n /** @internal Structural `AnimationGroup`s stepped + weight-blended each frame. */\n private readonly _structuralGroups: AnimationGroup[] = [];\n /** @internal Lite manager that weight/additive-blends loaded glTF groups (lazily created). */\n private _blendManager: AnimationManager | null = null;\n private _ambientColor = new Color3(0, 0, 0);\n private _environmentIntensity = 1;\n private _imageProcessingConfiguration: ImageProcessingConfiguration | null = null;\n /** @internal Tracks whether at least one frame has ticked (gates `onAfterRenderObservable`). */\n private _renderedAFrame = false;\n /** @internal `NodeMaterial`s whose async parse the engine drives after shadow generators are built. */\n private readonly _nodeMaterials: Array<{ _parse(engine: import(\"babylon-lite\").EngineContext, shadowGenerators: readonly unknown[]): Promise<void> }> = [];\n\n /** @internal Process-unique scene-id source (Babylon.js `scene.uniqueId` / `getUniqueId()`). */\n private static _uidCounter = 0;\n /** Babylon.js `scene.uniqueId` — a process-unique numeric id. */\n public readonly uniqueId = ++Scene._uidCounter;\n\n public constructor(engine: WebGPUEngine) {\n super();\n this._engine = engine;\n this._attachPointerEvents();\n if (engine._headless) {\n // Headless (`NullEngine`): back the scene with a real Lite context that has\n // NO frame-graph render task (`defaultRenderTask: false`), so no swapchain or\n // GPU resource is ever built. The engine drives it via Lite's `stepScene`,\n // which fires the same before-render hook the GPU path uses (CPU animations,\n // physics, render observables). Only the device-less surface works; adding\n // meshes with materials is unsupported (their builders need a device).\n this._lite = createSceneContext(engine._lite, { defaultRenderTask: false });\n onBeforeRender(this._lite, (deltaMs: number) => this._tick(deltaMs));\n engine._registerScene(this);\n return;\n }\n this._lite = createSceneContext(engine._lite);\n // Babylon Lite exposes a before-render hook but no after-render hook. We\n // fire `onBeforeRenderObservable` on each tick, and approximate\n // `onAfterRenderObservable` by firing it at the start of the *next* tick\n // (i.e. after the previous frame has rendered). `addOnce` after-render\n // listeners therefore resolve one frame later than they would in BJS.\n onBeforeRender(this._lite, (deltaMs: number) => this._tick(deltaMs));\n engine._registerScene(this);\n }\n\n private _attachPointerEvents(): void {\n const canvas = this._engine.getRenderingCanvas() as Partial<EventTarget>;\n if (typeof canvas.addEventListener !== \"function\" || typeof canvas.removeEventListener !== \"function\") {\n return;\n }\n\n this._pointerEventTarget = canvas as EventTarget;\n this._pointerEventListener = (event) => {\n let type: number;\n switch (event.type) {\n case \"pointerdown\":\n type = PointerEventTypes.POINTERDOWN;\n break;\n case \"pointermove\":\n type = PointerEventTypes.POINTERMOVE;\n break;\n case \"pointerup\":\n type = PointerEventTypes.POINTERUP;\n break;\n case \"wheel\":\n type = PointerEventTypes.POINTERWHEEL;\n break;\n default:\n return;\n }\n this.onPointerObservable.notifyObservers(new PointerInfo(type, event as PointerEvent | WheelEvent, null), type);\n };\n\n for (const type of [\"pointerdown\", \"pointermove\", \"pointerup\", \"wheel\"]) {\n this._pointerEventTarget.addEventListener(type, this._pointerEventListener);\n }\n }\n\n private _detachPointerEvents(): void {\n if (!this._pointerEventTarget || !this._pointerEventListener) {\n return;\n }\n for (const type of [\"pointerdown\", \"pointermove\", \"pointerup\", \"wheel\"]) {\n this._pointerEventTarget.removeEventListener(type, this._pointerEventListener);\n }\n this._pointerEventTarget = null;\n this._pointerEventListener = null;\n }\n\n /**\n * @internal Per-frame update: advance CPU animations and fire the render\n * observables. Driven by Babylon Lite's before-render hook for GPU engines, or\n * by the `NullEngine` `requestAnimationFrame` loop for headless engines.\n */\n public _tick(deltaMs: number): void {\n // Record the frame delta so `engine.getDeltaTime()` (read inside before-render\n // observers) reflects the current frame.\n this._engine._lastDeltaMs = deltaMs;\n this.onBeforeAnimationsObservable.notifyObservers(this);\n if (this._blendManager) {\n updateAnimationManager(this._blendManager, deltaMs);\n }\n if (this._propertyAnimationManager) {\n updateAnimationManager(this._propertyAnimationManager, deltaMs);\n }\n for (const a of this._runningAnimatables) {\n a._tick(deltaMs);\n }\n if (this._structuralGroups.length > 0) {\n for (const g of this._structuralGroups) {\n g._advanceStructural(deltaMs);\n }\n AnimationGroup._blendStructuralGroups(this._structuralGroups);\n }\n if (this._renderedAFrame) {\n this.onAfterRenderObservable.notifyObservers(this);\n }\n this._renderedAFrame = true;\n this.onBeforeRenderObservable.notifyObservers(this);\n for (const callback of this._beforeRenderFlushCallbacks) {\n callback();\n }\n }\n\n /** @internal Register work that must observe all compat before-render mutations before Lite renders. */\n public _registerBeforeRenderFlush(callback: () => void): () => void {\n this._beforeRenderFlushCallbacks.add(callback);\n return () => {\n this._beforeRenderFlushCallbacks.delete(callback);\n };\n }\n\n /**\n * @internal The Lite-core-owned mesh list backing `scene.meshes`. Babylon Lite's\n * `SceneContext` owns the authoritative array of scene meshes; the base\n * `AbstractScene.meshes` maps it back onto the canonical compat wrappers. Guarded\n * for prototype-only instances that have no `_lite` (GPU-free unit tests).\n */\n protected override _coreMeshList(): readonly object[] {\n return (this._lite?.meshes as readonly object[] | undefined) ?? [];\n }\n\n public getEngine(): WebGPUEngine {\n return this._engine;\n }\n\n /** Babylon.js `scene.getClassName()`. */\n public getClassName(): string {\n return \"Scene\";\n }\n\n /** Babylon.js `scene.getUniqueId()` — the process-unique scene id. */\n public getUniqueId(): number {\n return this.uniqueId;\n }\n\n /**\n * @internal Whether the engine has started, i.e. deferred mesh adds have been\n * flushed and meshes are live in the Lite scene. Used by the mesh `material`\n * setter and texture-readiness path to decide whether a material change must be\n * reconciled into the running scene (ensure renderable + rebuild) or is still\n * safely handled by the boot-time build.\n */\n public get _hasStarted(): boolean {\n return this._started;\n }\n\n /**\n * @internal Add a mesh to the Lite scene, deferring until engine start if the\n * engine has not started yet (so a later `mesh.material = …` is captured in the\n * correct render group). After start, adds happen immediately and Lite's\n * material-swap path handles re-routing.\n */\n public _deferAdd(add: () => void): void {\n if (this._started) {\n add();\n } else {\n this._pendingAdds.push(add);\n }\n }\n\n /** @internal Flush deferred mesh adds. Called by the engine just before `registerScene`. */\n public _flushPendingAdds(): void {\n this._started = true;\n for (const add of this._pendingAdds) {\n add();\n }\n this._pendingAdds.length = 0;\n }\n\n /** @internal Register a compat `ShadowGenerator` to be built at engine start. */\n public _registerShadowGenerator(gen: CompatShadowGenerator): void {\n this._shadowGenerators.push(gen);\n }\n\n /** @internal Drop a disposed compat `ShadowGenerator` from the pending/build list. */\n public _unregisterShadowGenerator(gen: CompatShadowGenerator): void {\n const index = this._shadowGenerators.indexOf(gen);\n if (index !== -1) {\n this._shadowGenerators.splice(index, 1);\n }\n }\n\n /** @internal Track an async texture load so the engine can await it before building the scene. */\n public _trackTextureLoad(promise: Promise<void>): void {\n this._pendingTextures.push(promise);\n }\n\n /** @internal Await all in-flight texture loads (so material maps are GPU-ready at build). */\n public async _awaitPendingTextures(): Promise<void> {\n if (this._pendingTextures.length > 0) {\n await Promise.all(this._pendingTextures);\n this._pendingTextures.length = 0;\n }\n }\n\n /**\n * @internal Register a deferred ground-UV bake (for `CreateGroundFromHeightMap` with a\n * PBR `albedoTexture` whose `uScale`/`vScale` tiling must be baked into the geometry,\n * since Babylon Lite's PBR pipeline has no material-level UV scale). Run by\n * {@link _bakeGroundUvs} after textures load, so the material's `albedoTexture` (assigned\n * by user code after the heightmap resolves) is in place and its tiling is read correctly.\n */\n public _registerGroundUvBake(bake: () => void): void {\n this._pendingGroundBakes.push(bake);\n }\n\n /** @internal Run deferred ground-UV bakes. Called by the engine after `_awaitPendingTextures`. */\n public _bakeGroundUvs(): void {\n for (const bake of this._pendingGroundBakes) {\n bake();\n }\n this._pendingGroundBakes.length = 0;\n }\n\n /**\n * @internal Register a mesh's compat `MorphTargetManager` to be built at engine\n * start. Building is deferred so the mesh's base CPU geometry (set by primitive\n * builders / `VertexData.applyToMesh`) exists when per-target deltas are computed.\n */\n public _registerMorphTargetManager(mesh: { _lite: unknown }, manager: { _build(mesh: never, engine: import(\"babylon-lite\").EngineContext): void }): void {\n this._pendingMorphBuilds.push({ mesh, manager });\n }\n\n /** @internal Build all registered morph-target managers. Called by the engine before registration. */\n public _buildMorphTargets(): void {\n const engine = this._engine._lite;\n for (const { mesh, manager } of this._pendingMorphBuilds) {\n manager._build(mesh as never, engine);\n }\n this._pendingMorphBuilds.length = 0;\n }\n\n /**\n * @internal Request Lite's opt-in material-plugin bridges for this scene.\n * Once the engine is live, reconcile the changed material through Lite's\n * runtime rebuild path rather than leaving the startup-only request stranded.\n */\n public _requestMaterialPlugins(material?: LiteMaterial): void {\n this._materialPluginsRequested = true;\n if (material && this._engine._hasStarted) {\n this._engine._registerLateWork(async () => {\n const { reconcileMaterialPlugins } = await import(\"babylon-lite\");\n await reconcileMaterialPlugins(this._lite, material);\n });\n } else if (material && this._started) {\n this._pendingMaterialPluginReconciliations.add(material);\n }\n }\n\n /** @internal Enable requested material plugins after meshes are added and before scene registration. */\n public async _enableMaterialPlugins(): Promise<void> {\n if (this._materialPluginsRequested) {\n const { enableMaterialPlugins } = await import(\"babylon-lite\");\n enableMaterialPlugins(this._lite);\n this._materialPluginsRequested = false;\n this._pendingMaterialPluginReconciliations.clear();\n }\n }\n\n /** @internal Reconcile plugin requests raised by first-frame callbacks before engine startup completes. */\n public async _reconcilePendingMaterialPlugins(): Promise<void> {\n while (this._pendingMaterialPluginReconciliations.size > 0) {\n const materials = [...this._pendingMaterialPluginReconciliations];\n this._pendingMaterialPluginReconciliations.clear();\n const { reconcileMaterialPlugins } = await import(\"babylon-lite\");\n await Promise.all(materials.map((material) => reconcileMaterialPlugins(this._lite, material)));\n }\n this._materialPluginsRequested = false;\n }\n\n /** @internal Whether this scene queued plugin changes during the engine startup transition. */\n public get _hasPendingMaterialPluginReconciliations(): boolean {\n return this._pendingMaterialPluginReconciliations.size > 0;\n }\n\n /** @internal Clustered light containers to register on the Lite scene at engine start. */\n private readonly _pendingClusteredContainers: Array<{ _build(): void; isDisposed(): boolean }> = [];\n\n /** @internal Register a compat `ClusteredLightContainer` to be wired into the scene at engine start. */\n public _registerClusteredLightContainer(container: { _build(): void; isDisposed(): boolean }): void {\n this._pendingClusteredContainers.push(container);\n }\n\n /** @internal Drop a container from the pending list (it was disposed before engine start). */\n public _unregisterClusteredLightContainer(container: { _build(): void; isDisposed(): boolean }): void {\n const i = this._pendingClusteredContainers.indexOf(container);\n if (i !== -1) {\n this._pendingClusteredContainers.splice(i, 1);\n }\n }\n\n /**\n * @internal Register all clustered light containers on the Lite scene. Called by\n * the engine after meshes/materials are settled (clustered wiring reads the\n * scene's materials) and before `registerScene`. Containers disposed before this\n * point are skipped — registering one would build GPU state for an object the\n * caller has already thrown away. The list is drained up front so a container\n * disposed while another builds cannot perturb the iteration.\n */\n public _buildClusteredContainers(): void {\n const containers = this._pendingClusteredContainers.splice(0);\n for (const container of containers) {\n if (!container.isDisposed()) {\n container._build();\n }\n }\n }\n\n /** @internal Whether any shadow generator is present (engine uses shadow-aware registration). */\n public _hasShadows(): boolean {\n return this._shadowGenerators.length > 0;\n }\n\n /** @internal Build all registered shadow generators. Called after meshes are added. */\n public _buildShadowGenerators(): void {\n const engine = this._engine._lite;\n for (const gen of this._shadowGenerators) {\n gen._build(engine);\n }\n }\n\n /** @internal Register a `NodeMaterial` whose parse the engine drives after shadow build. */\n public _registerNodeMaterial(material: { _parse(engine: import(\"babylon-lite\").EngineContext, shadowGenerators: readonly unknown[]): Promise<void> }): void {\n if (this._started) {\n this._engine._registerLateWork(() => material._parse(this._engine._lite, this._liteShadowGenerators()));\n return;\n }\n this._nodeMaterials.push(material);\n }\n\n private _liteShadowGenerators(): unknown[] {\n return this._shadowGenerators.map((g) => g._liteGen).filter((g): g is unknown => g !== undefined);\n }\n\n /**\n * @internal Parse all registered `NodeMaterial`s, passing the scene's built Lite\n * shadow generators so NME shadow-receiver blocks sample them (Babylon.js wires\n * shadows into the scene globally; Babylon Lite takes them at NME parse time).\n * Must run after `_buildShadowGenerators` so the Lite generators exist.\n */\n public async _parseNodeMaterials(): Promise<void> {\n if (this._nodeMaterials.length === 0) {\n return;\n }\n const engine = this._engine._lite;\n const liteGens = this._liteShadowGenerators();\n await Promise.all(this._nodeMaterials.map((m) => m._parse(engine, liteGens)));\n this._nodeMaterials.length = 0;\n }\n\n /**\n * Babylon.js `scene.defaultMaterial` — a shared `StandardMaterial` applied to\n * meshes that have no material assigned. Babylon Lite requires every mesh to\n * carry a material to render, so the mesh wrappers assign this lazily-created\n * default; reading it (or assigning a replacement) matches Babylon.js.\n */\n public get defaultMaterial(): StandardMaterial {\n if (!this._defaultMaterial) {\n this._defaultMaterial = new StandardMaterial(\"default material\", this);\n }\n return this._defaultMaterial;\n }\n public set defaultMaterial(value: StandardMaterial) {\n this._defaultMaterial = value;\n // A replacement built Babylon.js-style with no scene is owned by this scene from now on: it is the\n // effective material of every mesh without its own, none of which goes through a material setter.\n value?._adoptScene(this);\n }\n\n public get clearColor(): Color4 {\n const c = this._lite.clearColor;\n return new Color4(c.r, c.g, c.b, c.a ?? 1);\n }\n public set clearColor(value: Color4) {\n // Babylon.js accepts a `Color3` here (alpha defaults to 1). A `Color3` has no\n // `a`, which would otherwise reach WebGPU's render pass as `undefined`.\n this._lite.clearColor = { r: value.r, g: value.g, b: value.b, a: value.a ?? 1 };\n }\n\n public get activeCamera(): Camera | null {\n return this._activeCamera;\n }\n public set activeCamera(camera: Camera | null) {\n this._activeCamera = camera;\n this._lite.camera = (camera?._lite as LiteCamera | undefined) ?? null;\n }\n\n /**\n * @internal Surface a camera parsed from a loaded asset (`.babylon` files carry\n * their own camera) as the compat `scene.activeCamera`. Babylon Lite's\n * `addToScene` sets `scene._lite.camera` from the asset, but the compat scene\n * only tracks cameras created through the wrapper classes — so after a load with\n * no explicit camera we wrap the Lite one here. Loaded `.babylon` cameras are\n * always free cameras (see `parseBabylonCamera`).\n */\n public _surfaceLoadedCamera(): void {\n if (this._activeCamera || !this._lite.camera) {\n return;\n }\n FreeCamera._adopt(\"camera\", this._lite.camera as LiteFreeCamera, this);\n }\n\n /** Babylon.js image-processing facade over the scene's Lite state. */\n public get imageProcessingConfiguration(): ImageProcessingConfiguration {\n this._imageProcessingConfiguration ??= new ImageProcessingConfiguration()._attach(this._lite.imageProcessing);\n return this._imageProcessingConfiguration;\n }\n\n public get fluidRenderer(): FluidRenderer | null {\n return null;\n }\n public set fluidRenderer(value: FluidRenderer | null) {\n if (value !== null) {\n unsupported(\"Scene.fluidRenderer\", FLUID_RENDERER_UNSUPPORTED);\n }\n }\n\n public enableFluidRenderer(): FluidRenderer | null {\n return unsupported(\"Scene.enableFluidRenderer\", FLUID_RENDERER_UNSUPPORTED);\n }\n\n public disableFluidRenderer(): void {}\n\n /** Babylon.js `scene.performancePriority` — accepted for parity; Babylon Lite tunes its own pipeline. */\n public performancePriority = 0;\n\n /**\n * Babylon.js `scene.ambientColor` — the scene-wide ambient term multiplied into\n * each material's ambient contribution. Babylon Lite bakes ambient at the\n * material level (the `.babylon` loader folds `scene.ambientColor` into each\n * material), so this is stored for parity; the BJS default `(0,0,0)` is a no-op.\n */\n public get ambientColor(): Color3 {\n return this._ambientColor;\n }\n public set ambientColor(value: Color3) {\n this._ambientColor = value;\n }\n\n /**\n * Babylon.js `scene.environmentIntensity` — a global multiplier on IBL\n * contribution. Babylon Lite applies environment intensity per PBR material;\n * this is stored for parity (the BJS default `1` is a no-op).\n */\n public get environmentIntensity(): number {\n return this._environmentIntensity;\n }\n public set environmentIntensity(value: number) {\n this._environmentIntensity = value;\n }\n\n /**\n * Babylon.js `scene.useRightHandedSystem`. Babylon Lite's coordinate system is\n * fixed; this is stored for parity (the BJS WebGPU default is left-handed —\n * `false` — so the common case is a no-op).\n */\n public useRightHandedSystem = false;\n\n /** Babylon.js `scene.registerBeforeRender(cb)` — convenience over `onBeforeRenderObservable`. */\n public registerBeforeRender(callback: () => void): void {\n this.onBeforeRenderObservable.add(callback);\n }\n\n /** Babylon.js `scene.unregisterBeforeRender(cb)`. */\n public unregisterBeforeRender(callback: () => void): void {\n this.onBeforeRenderObservable.removeCallback(callback);\n }\n\n /** Babylon.js `scene.registerAfterRender(cb)` — convenience over `onAfterRenderObservable`. */\n public registerAfterRender(callback: () => void): void {\n this.onAfterRenderObservable.add(callback);\n }\n\n /** Babylon.js `scene.unregisterAfterRender(cb)`. */\n public unregisterAfterRender(callback: () => void): void {\n this.onAfterRenderObservable.removeCallback(callback);\n }\n\n /** Babylon.js `scene.attachControl` — camera input is attached per-camera in the compat layer; no-op. */\n public attachControl(_attachUp?: boolean, _attachDown?: boolean, _attachMove?: boolean): void {\n // Camera control is wired through `camera.attachControl(canvas)`.\n }\n\n /** Babylon.js `scene.detachControl` — no-op (see {@link attachControl}). */\n public detachControl(): void {\n // No-op.\n }\n\n // ── Fog (Babylon.js `scene.fogMode/fogStart/fogEnd/fogDensity/fogColor`) ──\n\n public get fogMode(): number {\n return this._fogMode;\n }\n public set fogMode(value: number) {\n this._fogMode = value;\n this._applyFog();\n }\n\n public get fogStart(): number {\n return this._fogStart;\n }\n public set fogStart(value: number) {\n this._fogStart = value;\n this._applyFog();\n }\n\n public get fogEnd(): number {\n return this._fogEnd;\n }\n public set fogEnd(value: number) {\n this._fogEnd = value;\n this._applyFog();\n }\n\n public get fogDensity(): number {\n return this._fogDensity;\n }\n public set fogDensity(value: number) {\n this._fogDensity = value;\n this._applyFog();\n }\n\n public get fogColor(): Color3 {\n return this._fogColor;\n }\n public set fogColor(value: Color3) {\n this._fogColor = value;\n this._applyFog();\n }\n\n /** @internal Push the current fog config into the Lite scene UBO. */\n private _applyFog(): void {\n setFog(this._lite, {\n mode: this._fogMode as 0 | 1 | 2 | 3,\n density: this._fogDensity,\n start: this._fogStart,\n end: this._fogEnd,\n color: [this._fogColor.r, this._fogColor.g, this._fogColor.b],\n });\n }\n\n // ── Clip plane (Babylon.js `scene.clipPlane`) ──\n\n private _clipPlane: Plane | null = null;\n\n /**\n * Babylon.js `scene.clipPlane` — a single world-space clip plane\n * (`normal · p + d = 0`); fragments on the negative side are discarded.\n * Routed to Babylon Lite's opt-in `setClipPlane`.\n */\n public get clipPlane(): Plane | null {\n return this._clipPlane;\n }\n public set clipPlane(value: Plane | null) {\n this._clipPlane = value;\n if (value) {\n setClipPlane(this._lite, [value.normal.x, value.normal.y, value.normal.z, value.d]);\n } else {\n setClipPlane(this._lite, [0, 0, 0, 0]);\n }\n }\n\n // ── Environment / IBL (Babylon.js `scene.environmentTexture` + `createDefaultEnvironment`) ──\n\n public get environmentTexture(): CubeTexture | HDRCubeTexture | null {\n return this._envTexture;\n }\n public set environmentTexture(value: CubeTexture | HDRCubeTexture | null) {\n this._envTexture = value;\n }\n\n /**\n * Babylon.js `scene.environmentBRDFTexture` — the BRDF lookup used by PBR materials.\n * Babylon.js defaults this to an embedded Base64 LUT and lets apps swap in one of the\n * published variants (e.g. `https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png`).\n *\n * Two deliberate divergences: the getter returns `null` while unset (Babylon.js\n * populates it with the decoded default once a PBR material is created, whereas Lite\n * keeps the default as an embedded data URL and never materialises a texture object),\n * and the assigned texture's own GPU upload goes unused because Babylon Lite decodes\n * the LUT itself, from the URL, as part of building the environment.\n */\n public get environmentBRDFTexture(): BaseTexture | null {\n return this._brdfTexture;\n }\n public set environmentBRDFTexture(value: BaseTexture | null) {\n this._brdfTexture = value;\n }\n\n /**\n * Resolve the BRDF LUT URL for the environment loaders: an app-supplied\n * `environmentBRDFTexture`, else the embedded Babylon.js-style default.\n */\n private async _resolveBrdfUrl(): Promise<string> {\n const override = this._brdfTexture;\n if (!override) {\n return await getBrdfLutUrl();\n }\n // Compat `Texture` records its source URL as `name`; `CubeTexture`-likes expose `url`.\n // Procedural textures (`RawTexture`, `DynamicTexture`) have no source at all and leave\n // `name` empty, which would otherwise resolve to a fetch of the page itself.\n const url = ((override as unknown as { url?: string }).url ?? override.name).trim();\n if (!url) {\n Logger.Warn(\n `scene.environmentBRDFTexture: the assigned ${override.getClassName()} has no source URL, so the built-in LUT is used instead. ` +\n `Assign a \\`Texture\\` created from a URL to override it.`\n );\n return await getBrdfLutUrl();\n }\n // Babylon.js also publishes `.dds` LUTs, but Babylon Lite decodes the BRDF LUT with\n // `createImageBitmap`, which cannot read DDS. Warn and keep the built-in LUT rather\n // than failing engine startup — the default is the same correlated-MS variant most\n // apps select anyway, so the scene still renders correctly.\n if (url.split(/[?#]/)[0]!.toLowerCase().endsWith(\".dds\")) {\n Logger.Warn(\n `scene.environmentBRDFTexture '${url}': Babylon Lite decodes the BRDF LUT from an RGBD-encoded PNG and cannot read DDS, ` +\n `so the built-in LUT is used instead. Use the PNG variant (e.g. https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png) to silence this.`\n );\n return await getBrdfLutUrl();\n }\n return url;\n }\n\n /**\n * Babylon.js `scene.createDefaultEnvironment` — adds an IBL skybox and ground.\n * Babylon Lite performs this through `loadEnvironment` (deferred to engine start),\n * combining the environment URL recorded via `scene.environmentTexture` with\n * Babylon.js's default skybox/ground assets.\n */\n public createDefaultEnvironment(options: DefaultEnvironmentOptions = {}): { dispose(): void } {\n this._defaultEnvOptions = {\n createSkybox: true,\n createGround: true,\n ...options,\n // Babylon.js EnvironmentHelper sets up image processing by default.\n applyImageProcessing: options.setupImageProcessing !== false,\n };\n return { dispose(): void {} };\n }\n\n /**\n * Babylon.js `scene.createDefaultSkybox(texture, pbr?, scale?, blur?, setGlobalEnv?)` —\n * adds a skybox built from the given environment texture. Babylon Lite reuses the\n * loaded `.env` specular cubemap as an HDR skybox, so this records the env URL (if\n * not already set) and flags a skybox-from-environment load at engine start.\n */\n public createDefaultSkybox(texture?: CubeTexture | HDRCubeTexture, _pbr?: boolean, scale?: number, _blur?: number, _setGlobalEnv?: boolean): { dispose(): void } {\n if (texture) {\n this._envTexture = texture;\n }\n this._defaultEnvOptions = {\n ...(this._defaultEnvOptions ?? {}),\n createSkybox: true,\n createGround: false,\n skyboxFromEnv: true,\n ...(scale !== undefined ? { skyboxSize: scale } : {}),\n };\n return { dispose(): void {} };\n }\n\n /**\n * @internal Load the pending environment (IBL + skybox/ground) into the Lite\n * scene. Awaited by the engine before `registerScene` so the GPU env textures\n * exist when the scene builds.\n */\n public async _loadPendingEnvironment(): Promise<void> {\n // Babylon.js `createDefaultEnvironment` lights the scene from a built-in\n // environment even when no `environmentTexture` is assigned; fall back to\n // the default specular env so IBL-only scenes are lit correctly.\n const envUrl = this._envTexture?.url ?? (this._defaultEnvOptions ? DEFAULT_ENV_URL : undefined);\n if (!envUrl) {\n return;\n }\n const opts = this._defaultEnvOptions;\n const skyboxUrl = opts?.skyboxFromEnv ? envUrl : opts?.createSkybox ? DEFAULT_SKYBOX_URL : undefined;\n // Babylon.js `scene.environmentTexture = …` / `CubeTexture.CreateFromPrefilteredData`\n // does NOT change image processing — tone mapping stays at the scene's current\n // value (Babylon.js default: off). Babylon Lite's `loadEnvironment`/`loadDdsEnvironment`,\n // however, force tone mapping on (exposure 0.8 / contrast 1.2). That side effect is\n // wrong for ported code that only assigns `environmentTexture` (e.g. NME scenes), but it\n // happens to mirror what Babylon.js's `createDefaultEnvironment` (EnvironmentHelper) does.\n // Snapshot the scene's image-processing state and restore it after the env load so the\n // side effect is invisible; if `createDefaultEnvironment` was used we re-apply the\n // EnvironmentHelper image processing explicitly below — matching Babylon.js semantics.\n const ip = this._lite.imageProcessing;\n const ipSnapshot = { exposure: ip.exposure, contrast: ip.contrast, toneMappingEnabled: ip.toneMappingEnabled };\n // Babylon.js `CubeTexture.CreateFromPrefilteredData` accepts both `.env`\n // and `.dds` prefiltered environments. Babylon Lite splits these into two\n // loaders: `loadEnvironment` (`.env`) and `loadDdsEnvironment` (`.dds`).\n if (this._envTexture?._envLoaderKind === \"hdr\") {\n await loadHdrEnvironment(this._lite, envUrl, {\n // Forward the BJS `HDRCubeTexture` `size` as Lite's cubemap `faceSize`\n // so callers that request e.g. 512 are honoured (Lite otherwise defaults\n // to 256). Only `HDRCubeTexture` carries `_envLoaderKind === \"hdr\"`.\n faceSize: (this._envTexture as HDRCubeTexture).size,\n skyboxSize: opts?.skyboxSize ?? 1000,\n useCubemapSkybox: !!skyboxUrl,\n skipGround: !opts?.createGround,\n });\n } else if (envUrl.toLowerCase().endsWith(\".dds\")) {\n await loadDdsEnvironment(this._lite, envUrl, {\n brdfUrl: await this._resolveBrdfUrl(),\n skipSkybox: !opts?.createSkybox,\n skipGround: !opts?.createGround,\n });\n } else {\n await loadEnvironment(this._lite, envUrl, {\n brdfUrl: await this._resolveBrdfUrl(),\n skyboxUrl,\n skipSkybox: !opts?.createSkybox,\n groundTextureUrl: opts?.createGround ? DEFAULT_GROUND_URL : undefined,\n skipGround: !opts?.createGround,\n skyboxSize: opts?.skyboxSize ?? 1000,\n });\n }\n ip.exposure = ipSnapshot.exposure;\n ip.contrast = ipSnapshot.contrast;\n ip.toneMappingEnabled = ipSnapshot.toneMappingEnabled;\n // Babylon.js EnvironmentHelper (`createDefaultEnvironment`) sets up image processing\n // by default: tone mapping on with exposure 0.8 / contrast 1.2 (all overridable). Apply\n // it here so `createDefaultEnvironment` scenes (e.g. PBR sphere grids) keep their tone\n // mapping while plain `environmentTexture` scenes (e.g. NME) do not.\n if (opts?.applyImageProcessing) {\n ip.toneMappingEnabled = opts.toneMappingEnabled ?? true;\n ip.exposure = opts.cameraExposure ?? 0.8;\n ip.contrast = opts.cameraContrast ?? 1.2;\n }\n }\n\n /** Create and activate a default arc-rotate camera framing the scene. */\n public createDefaultCamera(_createArcRotateCamera = true, _replace = true, _attachControl = false): Camera {\n const lite = liteCreateDefaultCamera(this._lite) as LiteArcRotateCamera;\n const camera = ArcRotateCamera._adopt(\"default camera\", lite, this);\n this._activeCamera = camera;\n return camera;\n }\n\n /** Babylon.js `createDefaultCameraOrLight` — default framing camera plus a default hemispheric light. */\n public createDefaultCameraOrLight(createArcRotateCamera = false, replace = false, attachControl = false): void {\n this.createDefaultCamera(createArcRotateCamera, replace, attachControl);\n addToScene(this._lite, createHemisphericLight([0, 1, 0], 1.0));\n }\n\n /** Babylon.js render hook. No-op under Babylon Lite's engine-driven loop. */\n public render(): void {\n // Intentionally empty: Lite renders registered scenes via startEngine.\n }\n\n /**\n * Babylon.js readiness gate. Babylon Lite builds its scene synchronously and\n * defers GPU work into `registerScene`/`startEngine` (driven by the engine's\n * render loop), so there is nothing to await here — resolve immediately.\n */\n public whenReadyAsync(): Promise<void> {\n return Promise.resolve();\n }\n\n /** Babylon.js synchronous readiness check — always ready in the compat layer. */\n public isReady(): boolean {\n return true;\n }\n\n /** Babylon.js synchronous screen-coordinate picking over Lite's CPU ray picker. */\n public pick(x: number, y: number, predicate?: MeshPredicate, fastCheck = false, camera: Camera | null = null, trianglePredicate?: TrianglePickingPredicate): PickingInfo {\n const cameraToUse = camera ?? this.activeCamera ?? this.cameraToUseForPointers;\n if (!cameraToUse) {\n return new PickingInfo();\n }\n\n return this.pickWithRay(this.createPickingRay(x, y, null, cameraToUse), predicate, fastCheck, trianglePredicate);\n }\n\n /**\n * Babylon.js `Scene.createPickingRay` — translate CSS coordinates and camera\n * transforms into Lite's reverse-Z unprojection helper.\n */\n public createPickingRay(x: number, y: number, world: Matrix | null = null, camera: Camera | null = null, cameraViewSpace = false): Ray {\n const cameraToUse = camera ?? this.activeCamera ?? this.cameraToUseForPointers;\n if (!cameraToUse) {\n return Ray.Zero();\n }\n\n const scale = this._engine.getHardwareScalingLevel();\n const width = this._engine.getRenderWidth();\n const height = this._engine.getRenderHeight();\n const viewport = resolveCameraViewport(cameraToUse._lite, width, height);\n const worldMatrix = (world ?? Matrix.Identity()).m as unknown as Mat4;\n const projectionMatrix = cameraToUse.getProjectionMatrix().m as unknown as Mat4;\n let viewMatrix = Matrix.Identity().m as unknown as Mat4;\n if (!cameraViewSpace && cameraToUse._lite._useFloatingOrigin) {\n const absoluteView = invertMat4(cameraToUse._lite.worldMatrix);\n if (!absoluteView) {\n return Ray.Zero();\n }\n viewMatrix = absoluteView;\n } else if (!cameraViewSpace) {\n viewMatrix = cameraToUse.getViewMatrix().m as unknown as Mat4;\n }\n // Compat matrices use Babylon.js's row-vector multiplication order, while\n // Lite's kernel is column-major, so reverse the operands for the same bytes.\n const transform = multiplyMat4(projectionMatrix, multiplyMat4(viewMatrix, worldMatrix));\n const liteRay = liteCreatePickingRay(x / scale - viewport.x, y / scale - viewport.y, transform, viewport.width, viewport.height);\n if (!liteRay) {\n return Ray.Zero();\n }\n\n return new Ray(new Vector3(liteRay.origin[0], liteRay.origin[1], liteRay.origin[2]), new Vector3(liteRay.direction[0], liteRay.direction[1], liteRay.direction[2]));\n }\n\n /** Synchronous CPU ray picking over Babylon Lite's scene-mesh picker. */\n public pickWithRay(ray: Ray, predicate?: MeshPredicate, fastCheck = false, trianglePredicate?: TrianglePickingPredicate): PickingInfo {\n const candidates = new Set<LiteMesh>(this._lite.meshes);\n for (const wrapper of this.meshes) {\n if (wrapper instanceof AbstractMesh) {\n candidates.add(wrapper._lite);\n }\n }\n\n const wrappers = new Map<NonNullable<LitePickingInfo[\"pickedMesh\"]>, AbstractMesh>();\n for (const candidate of candidates) {\n const registered = this._meshWrappers.get(candidate);\n const wrapper = registered instanceof AbstractMesh ? registered : Mesh._fromLite(candidate, undefined, this);\n wrappers.set(candidate, wrapper);\n }\n\n const info = litePickWithRay(\n candidates,\n {\n origin: ray.origin.asArray(),\n direction: ray.direction.asArray(),\n length: ray.length,\n },\n {\n predicate: (mesh, thinInstanceIndex) => {\n const wrapper = wrappers.get(mesh);\n return !!wrapper && (predicate ? predicate(wrapper, thinInstanceIndex) : wrapper.isEnabled() && wrapper.isVisible && wrapper.isPickable);\n },\n skipPickableCheck: !!predicate,\n fastCheck,\n trianglePredicate: trianglePredicate\n ? (p0, p1, p2, localRay, i0, i1, i2) =>\n trianglePredicate(\n Vector3.FromArray(p0),\n Vector3.FromArray(p1),\n Vector3.FromArray(p2),\n new Ray(Vector3.FromArray(localRay.origin), Vector3.FromArray(localRay.direction), localRay.length),\n i0,\n i1,\n i2\n )\n : undefined,\n }\n );\n return PickingInfo._fromLite(info, info.pickedMesh ? (wrappers.get(info.pickedMesh) ?? null) : null, ray);\n }\n\n /** @internal The active Physics V2 engine, once `enablePhysics` has wired one. */\n private _physicsEngine: PhysicsEngine | null = null;\n\n /**\n * Babylon.js `scene.enablePhysics(gravity, plugin)`. Wires the given Havok V2\n * {@link HavokPlugin} to this scene, creating the native Lite physics world and\n * registering per-frame stepping. The plugin's `useDeltaForWorldStep` flag\n * controls whether the world advances by elapsed frame time (refresh-rate\n * independent — issue #332) or a fixed `1/60` step.\n *\n * Bodies are created with the native `createPhysicsAggregate` /\n * `createPhysicsBody` API against `scene.getPhysicsEngine().getPhysicsPlugin().world`.\n * @returns `true` once physics is enabled.\n */\n public enablePhysics(gravity?: { x: number; y: number; z: number } | null, plugin?: HavokPlugin): boolean {\n if (this._engine._headless) {\n return unsupported(\"Scene.enablePhysics\", \"A headless (NullEngine) scene has no render loop to step physics.\");\n }\n if (!(plugin instanceof HavokPlugin)) {\n return unsupported(\"Scene.enablePhysics\", \"Pass a `HavokPlugin` instance (Babylon Lite physics is Havok-V2 only).\");\n }\n const g = gravity ?? { x: 0, y: -9.81, z: 0 };\n plugin._attachToLiteScene(this._lite, g);\n onPhysicsAfterStep(plugin.world!, () => this.onAfterPhysicsObservable.notifyObservers(this));\n this._physicsEngine = new PhysicsEngine(plugin, g);\n return true;\n }\n\n /** Babylon.js `scene.getPhysicsEngine()` — the active Physics V2 engine, or `null`. */\n public getPhysicsEngine(): PhysicsEngine | null {\n return this._physicsEngine;\n }\n\n /** Babylon.js `scene.isPhysicsEnabled()`. */\n public isPhysicsEnabled(): boolean {\n return this._physicsEngine !== null;\n }\n\n /** Babylon.js `scene.disablePhysicsEngine()` — release the active physics world. */\n public disablePhysicsEngine(): void {\n if (this._physicsEngine) {\n this._physicsEngine.dispose();\n this._physicsEngine = null;\n }\n }\n\n /**\n * Babylon.js `scene.beginDirectAnimation(target, animations, from, to, loop, speedRatio?)`.\n * Delegates supported tracks to Babylon Lite property animation and retains\n * explicit compat evaluation only for unsupported tracks. Returns one facade\n * coordinating both subsets.\n */\n public beginDirectAnimation(target: unknown, animations: Animation[], from: number, to: number, loop = false, speedRatio = 1): Animatable {\n if (speedRatio < 0) {\n [from, to] = [to, from];\n speedRatio = -speedRatio;\n }\n if (from > to) {\n speedRatio = -speedRatio;\n }\n const blockedNativeBindings = this._runningAnimatables.flatMap((animatable) => animatable._getBlockingFallbackBindings());\n const animatable = Animatable._create(\n () => (this._propertyAnimationManager ??= createAnimationManager()),\n target,\n animations,\n from,\n to,\n loop,\n speedRatio,\n blockedNativeBindings\n );\n this._runningAnimatables.push(animatable);\n return animatable;\n }\n\n /** @internal Register a structural `AnimationGroup` to be stepped + blended each frame. */\n public _registerStructuralGroup(group: AnimationGroup): void {\n if (!this._structuralGroups.includes(group)) {\n this._structuralGroups.push(group);\n }\n }\n\n /** @internal Re-run weighted blending across all structural groups (after a seek/weight change). */\n public _recomputeStructuralBlends(): void {\n AnimationGroup._blendStructuralGroups(this._structuralGroups);\n }\n\n /**\n * @internal Route the scene's loaded Lite animation groups through a\n * scene-owned `AnimationManager` with weighted/additive blending enabled.\n *\n * Babylon.js treats the scene as an implicit animation mixer, so any loaded\n * group whose weight ≠ 1 (or that is made additive) must blend with its\n * siblings on the shared skeleton. Babylon Lite makes the manager explicit and\n * blending opt-in (`enableAnimationBlending`). When a glTF container is added,\n * Lite installs a per-group last-writer-wins tick (scene-core `addToScene`); we\n * detach each group's controller (`_ctrl`) so that tick skips them and the\n * weighted mixer — which drives groups via `_gltfMixer`, not `_ctrl` — owns the\n * pose instead. Idempotent.\n */\n public _enableLoadedBlend(): void {\n const liteGroups = this._lite.animationGroups ?? [];\n if (liteGroups.length === 0) {\n return;\n }\n if (!this._blendManager) {\n this._blendManager = createAnimationManager({ engine: this._engine._lite });\n enableAnimationBlending(this._blendManager);\n }\n for (const g of liteGroups) {\n addAnimationGroup(this._blendManager, g);\n (g as { _ctrl?: unknown })._ctrl = undefined;\n }\n }\n\n /**\n * Babylon.js `scene.beginAnimation(target, from, to, loop, speedRatio?)`. Runs\n * the animations already attached to `target.animations`.\n */\n public beginAnimation(target: { animations?: Animation[] }, from: number, to: number, loop = false, speedRatio = 1): Animatable {\n return this.beginDirectAnimation(target, target.animations ?? [], from, to, loop, speedRatio);\n }\n\n public dispose(): void {\n let hasError = false;\n let firstError: unknown;\n const runCleanup = (cleanup: () => void): void => {\n try {\n cleanup();\n } catch (error) {\n if (!hasError) {\n hasError = true;\n firstError = error;\n }\n }\n };\n\n runCleanup(() => this._detachPointerEvents());\n const observerResult = this.onDisposeObservable._notifyObserversSafely(this);\n if (observerResult.hasError && !hasError) {\n hasError = true;\n firstError = observerResult.error;\n }\n runCleanup(() => this.onDisposeObservable.clear());\n runCleanup(() => this.onPointerObservable.clear());\n runCleanup(() => this._beforeRenderFlushCallbacks.clear());\n if (this._propertyAnimationManager) {\n runCleanup(() => clearAnimationManager(this._propertyAnimationManager!));\n }\n if (this._blendManager) {\n runCleanup(() => clearAnimationManager(this._blendManager!));\n }\n this._runningAnimatables.length = 0;\n runCleanup(() => disposeScene(this._lite));\n if (hasError) {\n throw firstError;\n }\n }\n}\n","/**\n * Babylon.js-compatible light classes implemented over the Babylon Lite light\n * factories.\n *\n * Babylon.js lights take the scene in their constructor and auto-register; these\n * wrappers do the same by calling `addToScene` when a scene is supplied. The\n * underlying Lite light is exposed as `_lite` for advanced interop.\n *\n * As in Babylon.js, the getters hand out the light's own live objects, so both assignment\n * (`light.diffuse = new Color3(...)`) and in-place edits (`light.diffuse.copyFrom(c)`,\n * `light.direction.set(x, y, z)`, `light.position.y = 2`) reach the Lite light. Direction and\n * position are proxies over Lite's observable vectors; colours are proxies over the Lite colour\n * tuples, and every colour write bumps the light version so it reaches the lights UBO.\n */\n\nimport { addToScene, createHemisphericLight, createDirectionalLight, createPointLight, createSpotLight, removeFromScene } from \"babylon-lite\";\nimport type {\n HemisphericLight as LiteHemisphericLight,\n DirectionalLight as LiteDirectionalLight,\n PointLight as LitePointLight,\n SpotLight as LiteSpotLight,\n LightBase,\n} from \"babylon-lite\";\n\nimport { liteBackedColor3 } from \"../math/color.js\";\nimport type { Color3 } from \"../math/color.js\";\nimport { liteBackedVector3 } from \"../math/vector.js\";\nimport type { Vector3 } from \"../math/vector.js\";\nimport { Node } from \"../node/node.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\ntype Tuple3 = [number, number, number];\n\n/** Babylon.js `Light` — base class for all lights (derives from `Node`). */\nexport abstract class Light extends Node {\n /** @internal Underlying Babylon Lite light. */\n public abstract readonly _lite: LightBase;\n\n /**\n * @internal The {@link ClusteredLightContainer} that owns this light, if any.\n * Babylon.js moves a light out of the normal light path when it is added to a\n * clustered container; this back-link mirrors BJS's `light._clusteredContainer`\n * so a light cannot be added to two containers. Typed loosely to avoid a cycle\n * with the container module.\n */\n public _clusteredContainer: object | null = null;\n\n /**\n * @internal The compat shadow generator logically owned by this light,\n * including before its deferred Lite generator is built.\n */\n public _shadowGenerator: object | null = null;\n\n protected constructor(name: string, scene?: Scene) {\n super(name, scene);\n scene?._registerLight(this);\n }\n\n public override getClassName(): string {\n return \"Light\";\n }\n\n /**\n * @internal When the light is effectively disabled, its Lite intensity is\n * forced to `0` (zero contribution) and the caller-visible intensity is\n * parked here so {@link intensity} keeps reporting the real value and\n * re-enabling restores it. `null` means the light is effectively enabled.\n */\n private _disabledIntensity: number | null = null;\n\n /** @internal Typed accessor for the Lite light's `intensity` scalar. */\n private get _liteIntensity(): number {\n return (this._lite as unknown as { intensity: number }).intensity;\n }\n private set _liteIntensity(value: number) {\n (this._lite as unknown as { intensity: number }).intensity = value;\n this._bumpLiteVersion();\n }\n\n /**\n * @internal Lazily-resolved bump for the underlying Lite light's\n * `_lightVersion` (see {@link ensureLightVersionBump}). Cached after first use.\n */\n private _liteVersionBump: (() => void) | null = null;\n\n /**\n * @internal Advance the underlying Lite light's `_lightVersion`. Lite's shared\n * lights-UBO refresh is gated on the sum of every light's `_lightVersion`, and\n * factory lights only bump it on observable direction/position writes — never on\n * scalar `intensity` writes. Since these wrappers mutate `intensity` directly\n * (both `intensity` and `setEnabled`), this makes those writes reach the GPU.\n */\n protected _bumpLiteVersion(): void {\n this._liteVersionBump ??= ensureLightVersionBump(this._lite);\n this._liteVersionBump();\n }\n\n /**\n * @internal Babylon.js hands out the light's own `Color3`, so `light.diffuse.copyFrom(c)` or\n * `light.specular.set(0, 0, 0)` edits the light. Return a live proxy over the Lite tuple rather than a\n * copy (whose edits were silently dropped); a colour write cannot notify Lite, so it bumps the version.\n */\n protected _liveColor(tuple: Tuple3): Color3 {\n return liteBackedColor3(tuple, () => this._bumpLiteVersion());\n }\n\n /** @internal Assign a colour and publish it (a tuple write cannot notify Lite by itself). */\n protected _writeColor(tuple: Tuple3, value: Color3): void {\n tuple[0] = value.r;\n tuple[1] = value.g;\n tuple[2] = value.b;\n this._bumpLiteVersion();\n }\n\n /**\n * Babylon.js `light.intensity`. While the light is disabled the Lite light\n * carries `0`, but the getter still returns the logical value the caller set.\n */\n public get intensity(): number {\n return this._disabledIntensity ?? this._liteIntensity;\n }\n public set intensity(value: number) {\n if (this._disabledIntensity !== null) {\n this._disabledIntensity = value;\n } else {\n this._liteIntensity = value;\n }\n }\n\n /** @internal Materialize local and inherited enabled state in Babylon Lite. */\n protected override _onEffectiveEnabledStateChanged(enabled: boolean): void {\n if (!enabled) {\n if (this._disabledIntensity === null) {\n this._disabledIntensity = this._liteIntensity;\n this._liteIntensity = 0;\n }\n } else if (this._disabledIntensity !== null) {\n this._liteIntensity = this._disabledIntensity;\n this._disabledIntensity = null;\n }\n }\n\n /** Detach this light's shadow generator (compat for `light.shadowEnabled = false`). */\n public set shadowEnabled(enabled: boolean) {\n if (!enabled) {\n this._lite.shadowGenerator = undefined;\n }\n }\n\n /** @internal Detach Lite-owned state when this node is disposed directly or through an ancestor. */\n protected override _disposeSelf(_doNotRecurse: boolean): void {\n if (this._scene) {\n removeFromScene(this._scene._lite, this._lite);\n } else {\n this._lite.shadowGenerator = undefined;\n }\n }\n}\n\n/**\n * @internal Ensure the underlying Lite light exposes a `_bumpLightVersion()` that,\n * when called, advances its `_lightVersion`, and return that bump function. Reuses a\n * pre-existing `_bumpLightVersion` (e.g. installed by the glTF punctual-lights\n * feature) when present; otherwise wraps the light's existing `_lightVersion` getter\n * with an extra counter that the returned bump increments. Mirrors the shim pattern\n * in `babylon-lite`'s `gltf-feature-lights-punctual.ts`.\n */\nfunction ensureLightVersionBump(lite: LightBase): () => void {\n const existing = (lite as { _bumpLightVersion?: () => void })._bumpLightVersion;\n if (existing) {\n return existing;\n }\n const baseGet = Object.getOwnPropertyDescriptor(lite, \"_lightVersion\")?.get;\n let extra = 0;\n Object.defineProperty(lite, \"_lightVersion\", {\n get(): number {\n return (baseGet ? (baseGet.call(lite) as number) : 0) + extra;\n },\n enumerable: false,\n configurable: true,\n });\n const bump = (): void => {\n extra++;\n };\n Object.defineProperty(lite, \"_bumpLightVersion\", {\n value: bump,\n enumerable: false,\n configurable: true,\n });\n return bump;\n}\n\nexport class HemisphericLight extends Light {\n /** @internal Underlying Babylon Lite hemispheric light. */\n public readonly _lite: LiteHemisphericLight;\n\n public constructor(name: string, direction: Vector3, scene?: Scene) {\n super(name, scene);\n this._lite = createHemisphericLight(direction.asArray());\n if (scene) {\n addToScene(scene._lite, this._lite);\n }\n }\n\n public override getClassName(): string {\n return \"HemisphericLight\";\n }\n\n public get direction(): Vector3 {\n return liteBackedVector3(this._lite.direction);\n }\n public set direction(value: Vector3) {\n this._lite.direction.set(value.x, value.y, value.z);\n }\n\n public get diffuse(): Color3 {\n return this._liveColor(this._lite.diffuseColor);\n }\n public set diffuse(value: Color3) {\n this._writeColor(this._lite.diffuseColor, value);\n }\n\n public get specular(): Color3 {\n return this._liveColor(this._lite.specularColor);\n }\n public set specular(value: Color3) {\n this._writeColor(this._lite.specularColor, value);\n }\n\n public get groundColor(): Color3 {\n return this._liveColor(this._lite.groundColor);\n }\n public set groundColor(value: Color3) {\n this._writeColor(this._lite.groundColor, value);\n }\n}\n\nexport class DirectionalLight extends Light {\n /** @internal Underlying Babylon Lite directional light. */\n public readonly _lite: LiteDirectionalLight;\n\n public constructor(name: string, direction: Vector3, scene?: Scene) {\n super(name, scene);\n this._lite = createDirectionalLight(direction.asArray());\n if (scene) {\n addToScene(scene._lite, this._lite);\n }\n }\n\n public override getClassName(): string {\n return \"DirectionalLight\";\n }\n\n public get direction(): Vector3 {\n return liteBackedVector3(this._lite.direction);\n }\n public set direction(value: Vector3) {\n this._lite.direction.set(value.x, value.y, value.z);\n }\n\n public get position(): Vector3 {\n return liteBackedVector3(this._lite.position);\n }\n public set position(value: Vector3) {\n this._lite.position.set(value.x, value.y, value.z);\n }\n\n public get diffuse(): Color3 {\n return this._liveColor(this._lite.diffuse);\n }\n public set diffuse(value: Color3) {\n this._writeColor(this._lite.diffuse, value);\n }\n\n public get specular(): Color3 {\n return this._liveColor(this._lite.specular);\n }\n public set specular(value: Color3) {\n this._writeColor(this._lite.specular, value);\n }\n}\n\nexport class PointLight extends Light {\n /** @internal Underlying Babylon Lite point light. */\n public readonly _lite: LitePointLight;\n\n public constructor(name: string, position: Vector3, scene?: Scene) {\n super(name, scene);\n this._lite = createPointLight(position.asArray());\n if (scene) {\n addToScene(scene._lite, this._lite);\n }\n }\n\n public override getClassName(): string {\n return \"PointLight\";\n }\n\n public get range(): number {\n return this._lite.range;\n }\n public set range(value: number) {\n this._lite.range = value;\n }\n\n public get position(): Vector3 {\n return liteBackedVector3(this._lite.position);\n }\n public set position(value: Vector3) {\n this._lite.position.set(value.x, value.y, value.z);\n }\n\n public get diffuse(): Color3 {\n return this._liveColor(this._lite.diffuse);\n }\n public set diffuse(value: Color3) {\n this._writeColor(this._lite.diffuse, value);\n }\n\n public get specular(): Color3 {\n return this._liveColor(this._lite.specular);\n }\n public set specular(value: Color3) {\n this._writeColor(this._lite.specular, value);\n }\n}\n\nexport class SpotLight extends Light {\n /** @internal Underlying Babylon Lite spot light. */\n public readonly _lite: LiteSpotLight;\n\n public constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene?: Scene) {\n super(name, scene);\n this._lite = createSpotLight(position.asArray(), direction.asArray(), angle, exponent);\n if (scene) {\n addToScene(scene._lite, this._lite);\n }\n }\n\n public override getClassName(): string {\n return \"SpotLight\";\n }\n\n public get angle(): number {\n return this._lite.angle;\n }\n public set angle(value: number) {\n this._lite.angle = value;\n }\n\n public get exponent(): number {\n return this._lite.exponent;\n }\n public set exponent(value: number) {\n this._lite.exponent = value;\n }\n\n public get range(): number {\n return this._lite.range;\n }\n public set range(value: number) {\n this._lite.range = value;\n }\n\n public get position(): Vector3 {\n return liteBackedVector3(this._lite.position);\n }\n public set position(value: Vector3) {\n this._lite.position.set(value.x, value.y, value.z);\n }\n\n public get direction(): Vector3 {\n return liteBackedVector3(this._lite.direction);\n }\n public set direction(value: Vector3) {\n this._lite.direction.set(value.x, value.y, value.z);\n }\n\n public get diffuse(): Color3 {\n return this._liveColor(this._lite.diffuse);\n }\n public set diffuse(value: Color3) {\n this._writeColor(this._lite.diffuse, value);\n }\n\n public get specular(): Color3 {\n return this._liveColor(this._lite.specular);\n }\n public set specular(value: Color3) {\n this._writeColor(this._lite.specular, value);\n }\n}\n","/**\n * Babylon.js-compatible `ClusteredLightContainer` implemented over Babylon Lite's\n * clustered (forward+) lighting API (`createClusteredLightContainer` /\n * `createClusteredPointLight` / `addClusteredLightContainer`).\n *\n * A clustered container groups many point lights that PBR materials shade through\n * a screen-space cluster grid on the GPU. Babylon.js exposes it as a `Light`\n * subclass whose child point/spot lights are excluded from the ordinary\n * per-mesh light path; this wrapper mirrors that shape and forwards the feature\n * work to Lite — the clustering math lives entirely in Lite.\n *\n * Scope (⚡ partial): Babylon Lite's clustered spot payload cannot represent\n * Babylon.js exponent / inner-cone falloff, so only point lights are accepted.\n * Each added point light is snapshotted into a Lite clustered light at add time;\n * later in-place mutation of the source light does not propagate. `maxRange` is a\n * clustering optimisation Babylon Lite manages internally, so the property is\n * stored for shape parity but does not re-bin lights.\n */\n\nimport { addToScene, createClusteredLightContainer, createClusteredPointLight, addClusteredLightContainer, markClusteredLightContainerDirty, removeFromScene } from \"babylon-lite\";\nimport type { ClusteredLightContainer as LiteClusteredLightContainer, ClusteredPointLight as LiteClusteredPointLight, LightBase } from \"babylon-lite\";\n\nimport { Light, PointLight } from \"./lights.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport { unsupported } from \"../error.js\";\n\n/** The numeric light type id Babylon.js reports for a clustered container (`LIGHTTYPEID_CLUSTERED_CONTAINER`). */\nconst LIGHTTYPEID_CLUSTERED_CONTAINER = 5;\n\nfunction isSupportedPointLight(light: Light): light is PointLight {\n if (!(light instanceof PointLight)) {\n return false;\n }\n if (light.getScene()?.getEngine()._headless) {\n return false;\n }\n return light._shadowGenerator === null && light._lite.shadowGenerator === undefined;\n}\n\n/**\n * Babylon.js `ClusteredLightContainer` — a `Light` that renders a large set of\n * point lights through a clustered / forward+ system.\n */\nexport class ClusteredLightContainer extends Light {\n /**\n * @internal The underlying Babylon Lite clustered light container. The base\n * `Light._lite` is typed as `LightBase`, but a clustered container is a distinct\n * Lite object (not a punctual light); every base member that dereferences `_lite`\n * as a light is overridden below, so the value is only ever read back through\n * {@link _container}.\n */\n public readonly _lite: LightBase;\n\n /** @internal Typed handle to the Lite clustered container held in {@link _lite}. */\n private get _container(): LiteClusteredLightContainer {\n return this._lite as unknown as LiteClusteredLightContainer;\n }\n\n /** @internal Point lights added to this container (Babylon.js `container.lights`). */\n private readonly _childLights: PointLight[] = [];\n /** @internal Lite clustered point lights, parallel to {@link _childLights}. */\n private readonly _liteLights: LiteClusteredPointLight[] = [];\n /** @internal Whether the container has been registered on the Lite scene (engine start). */\n private _built = false;\n private _maxRange = 16383;\n private _selfIntensity = 1;\n\n /**\n * True if this point light can be represented by Lite's clustered payload.\n */\n public static IsLightSupported(light: Light): boolean {\n return isSupportedPointLight(light);\n }\n\n /**\n * Creates a new clustered light container.\n *\n * @param name - The container's node name.\n * @param lights - Initial point lights to cluster.\n * @param scene - Owning scene; when supplied the container is registered and\n * built into the Lite scene at engine start.\n */\n public constructor(name: string, lights: Light[] = [], scene?: Scene) {\n super(name, scene);\n this._lite = createClusteredLightContainer() as unknown as LightBase;\n if (scene) {\n scene._registerClusteredLightContainer(this);\n }\n for (const light of lights) {\n this.addLight(light);\n }\n }\n\n public override getClassName(): string {\n return \"ClusteredLightContainer\";\n }\n\n /** Babylon.js `light.getTypeID()` — `LIGHTTYPEID_CLUSTERED_CONTAINER`. */\n public getTypeID(): number {\n return LIGHTTYPEID_CLUSTERED_CONTAINER;\n }\n\n /** True when clustered lighting is available (Babylon Lite backs it on WebGPU). */\n public get isSupported(): boolean {\n return !this._scene?.getEngine()._headless;\n }\n\n /** The lights added to this clustering system. */\n public get lights(): readonly Light[] {\n return this._childLights;\n }\n\n /** Number of cluster tiles across the screen horizontally (default `64`). */\n public get horizontalTiles(): number {\n return this._container.horizontalTiles;\n }\n public set horizontalTiles(value: number) {\n this._container.horizontalTiles = value;\n this._markDirty();\n }\n\n /** Number of cluster tiles across the screen vertically (default `64`). */\n public get verticalTiles(): number {\n return this._container.verticalTiles;\n }\n public set verticalTiles(value: number) {\n this._container.verticalTiles = value;\n this._markDirty();\n }\n\n /** Number of depth slices used to bin lights along view-space Z (default `16`). */\n public get depthSlices(): number {\n return this._container.zSlices;\n }\n public set depthSlices(value: number) {\n this._container.zSlices = value;\n this._markDirty();\n }\n\n /**\n * Upper bound applied to clustered light ranges. Babylon Lite manages range\n * binning internally, so this is stored for API-shape parity and does not\n * re-cluster the lights.\n */\n public get maxRange(): number {\n return this._maxRange;\n }\n public set maxRange(value: number) {\n this._maxRange = value;\n }\n\n /** Babylon.js `container.addLight(light)`. */\n public addLight(light: Light): void {\n if (!isSupportedPointLight(light) || light._clusteredContainer) {\n return;\n }\n if (this._built) {\n // Lite bakes clustered capacity and point/spot layout into GPU state.\n // Growing after registration needs a Lite-owned rebuild lifecycle.\n unsupported(\n \"ClusteredLightContainer.addLight after engine start\",\n \"Lite bakes clustered-light capacity and layout into GPU state; dynamic growth needs a Lite-owned rebuild lifecycle.\"\n );\n }\n light._clusteredContainer = this;\n const position = light.position;\n const diffuse = light.diffuse;\n const liteLight = createClusteredPointLight(this._container, {\n position: [position.x, position.y, position.z],\n diffuse: [diffuse.r, diffuse.g, diffuse.b],\n range: light.range,\n intensity: light.intensity,\n });\n this._childLights.push(light);\n this._liteLights.push(liteLight);\n // Exclude the light from the ordinary per-mesh light path (Babylon.js\n // removes it from scene.lights when it joins a cluster). The detach targets\n // the light's OWN scene, never the container's: a light built against a\n // different scene (or none at all) must not touch this container's scene\n // bookkeeping, since `removeFromScene` also disposes the light's shadow\n // generator against the scene it is handed.\n const lightScene = light.getScene();\n if (lightScene) {\n lightScene._unregisterNode(light);\n removeFromScene(lightScene._lite, light._lite);\n }\n this._markDirty();\n }\n\n /**\n * Babylon.js `container.removeLight(light)`. Returns the index the light held\n * in the container's light list, or `-1` if it was not present.\n */\n public removeLight(light: Light): number {\n const index = this._childLights.findIndex((child) => child === light);\n if (index === -1) {\n return -1;\n }\n this._childLights.splice(index, 1);\n const liteLight = this._liteLights.splice(index, 1)[0];\n const j = liteLight ? this._container.pointLights.indexOf(liteLight) : -1;\n if (j !== -1) {\n this._container.pointLights.splice(j, 1);\n }\n light._clusteredContainer = null;\n // Return the light to the ordinary per-mesh light path of its own scene —\n // the mirror of the detach performed by {@link addLight}.\n const lightScene = light.getScene();\n if (lightScene) {\n lightScene._registerLight(light);\n addToScene(lightScene._lite, light._lite);\n }\n this._markDirty();\n return index;\n }\n\n /**\n * @internal Register the container on the Lite scene, wiring its clustered\n * lights into the scene's PBR materials. Deferred to engine start so meshes and\n * materials are settled; skipped on the device-less `NullEngine` and after\n * disposal. `_built` only flips once registration actually happened, so a skipped\n * build leaves the container re-buildable and keeps {@link _markDirty} from\n * touching GPU state that was never created.\n */\n public _build(): void {\n if (this._built || this.isDisposed()) {\n return;\n }\n const scene = this._scene;\n if (!scene || scene.getEngine()._headless) {\n return;\n }\n this._built = true;\n addClusteredLightContainer(scene._lite, this._container);\n }\n\n /** @internal Force a GPU re-upload of the clustered light set on the next frame (post-build). */\n private _markDirty(): void {\n if (this._built) {\n markClusteredLightContainerDirty(this._container);\n }\n }\n\n // ─── Base `Light` members overridden: a clustered container is not a punctual\n // Lite light, so intensity/shadow/enable/dispose must not touch `_lite`. ───\n\n /** Container-level intensity (Babylon.js inherits it from `Light`; each child light carries its own). */\n public override get intensity(): number {\n return this._selfIntensity;\n }\n public override set intensity(value: number) {\n this._selfIntensity = value;\n }\n\n /** Clustered lights do not cast shadows in Babylon.js; the toggle is a no-op. */\n public override set shadowEnabled(_enabled: boolean) {\n // no-op: clustered lighting has no shadow generator\n }\n\n protected override _onEffectiveEnabledStateChanged(_enabled: boolean): void {\n // no-op: the container has no single Lite intensity to zero\n }\n\n public override dispose(): void {\n // Drop the pending build registration so a container disposed before engine\n // start is neither retained by the scene nor wired into it later.\n this._scene?._unregisterClusteredLightContainer(this);\n // Babylon Lite owns the clustered GPU state via the scene and disposes it on\n // scene disposal; the base `Light.dispose` only detaches a shadow generator\n // (a harmless no-op here) before running Node cleanup.\n super.dispose();\n }\n}\n","/**\n * Babylon.js `CSG` (legacy) and `CSG2` (Manifold-based) constructive solid\n * geometry, wrapped over Babylon Lite's native CSG API.\n *\n * Babylon.js exposes two object-oriented CSG surfaces:\n * - `CSG.FromMesh(mesh)` → `.subtract` / `.intersect` / `.union` → `.toMesh(name, material, scene)`\n * - `CSG2.FromMesh(mesh)` → `.subtract` / `.intersect` / `.add` → `.toMesh(name, scene)` (+ `.dispose()`),\n * after `await InitializeCSG2Async()`.\n *\n * Babylon Lite ships the equivalent as standalone functions\n * (`createCsgFromMesh` / `csgSubtract` / … / `createMeshFromCsg`, and the CSG2\n * `createCsg2FromMesh` / `csg2Subtract` / … / `createMeshesFromCsg2`). These\n * classes adapt the function API to Babylon.js's method-chaining shape.\n *\n * CSG (legacy) `toMesh` takes an explicit material and produces a single mesh.\n * CSG2 preserves per-source materials: each `FromMesh` records its source mesh's\n * material against a unique slot, operations union those slot→material maps, and\n * `toMesh` triangulates into one Lite mesh per slot (`createMeshesFromCsg2`),\n * returning a single compat `Mesh` with the remaining sub-meshes parented under it\n * so positioning the result moves them together — matching Babylon.js's single\n * multi-material `toMesh` return.\n */\n\nimport {\n createCsgFromMesh,\n csgSubtract,\n csgIntersect,\n csgUnion,\n createMeshFromCsg,\n initializeCsg2Async,\n createCsg2FromMesh,\n csg2Subtract,\n csg2Intersect,\n csg2Add,\n createMeshesFromCsg2,\n disposeCsg2,\n addToScene,\n type CsgSolid,\n type Csg2Solid,\n type Material as LiteMaterial,\n} from \"babylon-lite\";\n\nimport { Mesh, registerMeshAtStart } from \"./meshes.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport { attachMaterialToScene } from \"../materials/materials.js\";\nimport type { StandardMaterial, PBRMaterial } from \"../materials/materials.js\";\nimport type { NodeMaterial } from \"../materials/node-material.js\";\n\ntype CompatMaterial = StandardMaterial | PBRMaterial | NodeMaterial;\n\n/** A compat mesh exposes its backing Lite mesh as `_lite`. */\ninterface MeshLike {\n _lite: import(\"babylon-lite\").Mesh;\n}\n\n/**\n * Babylon.js `CSG` — legacy constructive solid geometry. Build from a mesh with\n * {@link FromMesh}, combine with {@link subtract} / {@link intersect} /\n * {@link union}, then materialize with {@link toMesh}.\n */\nexport class CSG {\n private constructor(private readonly _lite: CsgSolid) {}\n\n /** Babylon.js `CSG.FromMesh(mesh)`. */\n public static FromMesh(mesh: MeshLike): CSG {\n return new CSG(createCsgFromMesh(mesh._lite));\n }\n\n /** Babylon.js `csg.subtract(other)` — `this − other`. */\n public subtract(other: CSG): CSG {\n return new CSG(csgSubtract(this._lite, other._lite));\n }\n\n /** Babylon.js `csg.intersect(other)`. */\n public intersect(other: CSG): CSG {\n return new CSG(csgIntersect(this._lite, other._lite));\n }\n\n /** Babylon.js `csg.union(other)`. */\n public union(other: CSG): CSG {\n return new CSG(csgUnion(this._lite, other._lite));\n }\n\n /** Babylon.js `csg.toMesh(name, material, scene)` — triangulate into a single mesh. */\n public toMesh(name: string, material: CompatMaterial | null, scene: Scene): Mesh {\n const engine = scene.getEngine()._lite;\n const lite = createMeshFromCsg(engine, this._lite, name);\n const mesh = new Mesh(name, lite, scene);\n // As in Babylon.js, the explicit material becomes the result's `material`. The registration at\n // engine start then finalizes whatever the mesh's effective material is by then, so a material\n // assigned to the returned mesh before startup (the usual follow-up to `toMesh(name, null, scene)`)\n // is not lost behind a captured argument.\n if (material) {\n mesh.material = material;\n }\n return registerMeshAtStart(mesh, scene);\n }\n}\n\n/** Module-wide unique material-slot counter for CSG2 (`MATERIAL_ID_RESERVE_COUNT` = 65536). */\nlet nextCsg2Slot = 0;\n\n/**\n * Babylon.js `CSG2` — Manifold-based constructive solid geometry that preserves\n * per-source-mesh materials. Call `await InitializeCSG2Async()` once before use.\n */\nexport class CSG2 {\n private constructor(\n private readonly _lite: Csg2Solid,\n /** Slot → source material, accumulated across operations. */\n private readonly _materials: Map<number, CompatMaterial>\n ) {}\n\n /** Babylon.js `CSG2.FromMesh(mesh)` — records the mesh's material against a unique slot. */\n public static FromMesh(mesh: MeshLike & { material?: CompatMaterial | null }): CSG2 {\n const slot = nextCsg2Slot++;\n const materials = new Map<number, CompatMaterial>();\n if (mesh.material) {\n materials.set(slot, mesh.material);\n }\n return new CSG2(createCsg2FromMesh(mesh._lite, slot), materials);\n }\n\n private _combine(lite: Csg2Solid, other: CSG2): CSG2 {\n const materials = new Map(this._materials);\n for (const [slot, material] of other._materials) {\n materials.set(slot, material);\n }\n return new CSG2(lite, materials);\n }\n\n /** Babylon.js `csg.subtract(other)` — `this − other`. */\n public subtract(other: CSG2): CSG2 {\n return this._combine(csg2Subtract(this._lite, other._lite), other);\n }\n\n /** Babylon.js `csg.intersect(other)`. */\n public intersect(other: CSG2): CSG2 {\n return this._combine(csg2Intersect(this._lite, other._lite), other);\n }\n\n /** Babylon.js `csg.add(other)` — union. */\n public add(other: CSG2): CSG2 {\n return this._combine(csg2Add(this._lite, other._lite), other);\n }\n\n /**\n * Babylon.js `csg.toMesh(name, scene)` — triangulate into a single mesh,\n * preserving each source mesh's material across the result's faces.\n */\n public toMesh(name: string, scene: Scene): Mesh {\n const engine = scene.getEngine()._lite;\n // Build a slot-indexed Lite material array (sparse; only referenced slots are read).\n const materials: LiteMaterial[] = [];\n for (const [slot, material] of this._materials) {\n attachMaterialToScene(material, scene);\n materials[slot] = material._lite as never;\n }\n const liteMeshes = createMeshesFromCsg2(engine, this._lite, materials, name);\n // `createMeshesFromCsg2` already assigned each sub-mesh its Lite material; wrapping\n // the first in a compat `Mesh` clobbers it with the scene default, so restore it.\n const savedMaterials = liteMeshes.map((m) => m.material);\n const root = new Mesh(name, liteMeshes[0]!, scene);\n const wrapped = root.material;\n root._lite.material = savedMaterials[0] as never;\n scene._deferAdd(() => {\n // The result renders with its source materials unless the app gave the returned mesh one of its\n // own before startup; that one is finalized and bound here like any other pre-start assignment.\n const assigned = root.material;\n if (assigned && assigned !== wrapped) {\n attachMaterialToScene(assigned, scene);\n root._lite.material = assigned._lite as never;\n }\n addToScene(scene._lite, root._lite);\n });\n // Parent the remaining material sub-meshes under the returned mesh so the whole\n // result moves as one (Babylon.js returns a single multi-material mesh).\n for (let i = 1; i < liteMeshes.length; i++) {\n const sub = liteMeshes[i]!;\n sub.material = savedMaterials[i] as never;\n (sub as unknown as { parent: unknown }).parent = root._lite;\n scene._deferAdd(() => addToScene(scene._lite, sub));\n }\n return root;\n }\n\n /** Babylon.js `csg.dispose()` — release the underlying Manifold solid. */\n public dispose(): void {\n disposeCsg2(this._lite);\n }\n}\n\n/** Babylon.js `InitializeCSG2Async()` — load the Manifold runtime before any `CSG2` use. */\nexport async function InitializeCSG2Async(): Promise<void> {\n await initializeCsg2Async();\n}\n","/**\n * Babylon.js `MeshoptCompression` (`@babylonjs/core/Meshes/Compression/meshoptCompression`).\n *\n * In Babylon.js this singleton owns the meshopt decoder used by the glTF\n * `EXT_meshopt_compression` loader extension, and apps configure its decoder URL\n * via the static `Configuration`. Babylon Lite decodes meshopt-compressed buffers\n * itself inside its glTF loader feature (`gltf-feature-meshopt`), so no external\n * decoder needs wiring. This compat shim therefore accepts the `Configuration`\n * assignment ported code performs (a no-op here) so the import resolves and the\n * asset still loads — the actual decode happens in Lite.\n */\nexport class MeshoptCompression {\n /**\n * Babylon.js `MeshoptCompression.Configuration` — the decoder location. Stored\n * for API parity but unused: Babylon Lite's glTF loader carries its own meshopt\n * decoder, so setting this has no effect on decoding.\n */\n public static Configuration: { decoder: { url: string } } = { decoder: { url: \"\" } };\n\n private static _default: MeshoptCompression | null = null;\n\n /** Babylon.js `MeshoptCompression.Default` — the lazily-created shared instance. */\n public static get Default(): MeshoptCompression {\n if (!MeshoptCompression._default) {\n MeshoptCompression._default = new MeshoptCompression();\n }\n return MeshoptCompression._default;\n }\n}\n","/**\n * Babylon.js-compatible `MorphTarget` / `MorphTargetManager` over the Babylon\n * Lite native morph API (`createMorphTargets` / `setMorphTargetWeights`).\n *\n * Babylon.js morph targets carry **absolute** vertex positions/normals\n * (`target.setPositions(abs)`); Babylon Lite's `createMorphTargets` consumes\n * per-target **deltas** (target − base). The manager defers building the Lite\n * morph until engine start (when the owning mesh's base CPU geometry exists),\n * computes the deltas, and assigns the resulting `MorphTargetData` onto the\n * Lite mesh so the Standard/NME pipelines sample it. Weight changes\n * (`target.influence = …`) re-upload via `setMorphTargetWeights`.\n */\n\nimport { createMorphTargets, setMorphTargetWeights } from \"babylon-lite\";\nimport type { EngineContext, MorphTargetData } from \"babylon-lite\";\n\nimport type { Scene } from \"../scene/scene.js\";\nimport type { Mesh } from \"../meshes/meshes.js\";\n\n/** Babylon.js `MorphTarget` — a single named morph influence with absolute target geometry. */\nexport class MorphTarget {\n public name: string;\n /** @internal Absolute target positions (Babylon.js `setPositions`). */\n public _positions: Float32Array | null = null;\n /** @internal Absolute target normals (Babylon.js `setNormals`). */\n public _normals: Float32Array | null = null;\n /** @internal Owning manager, set on `addTarget`, used to push weight updates. */\n public _manager: MorphTargetManager | undefined;\n private _influence: number;\n\n public constructor(name: string, influence = 0, _scene?: Scene) {\n this.name = name;\n this._influence = influence;\n }\n\n public get influence(): number {\n return this._influence;\n }\n public set influence(value: number) {\n this._influence = value;\n this._manager?._syncWeights();\n }\n\n /** Babylon.js `MorphTarget.setPositions(data)` — absolute target positions. */\n public setPositions(data: Float32Array | number[] | null): void {\n this._positions = data ? (data instanceof Float32Array ? data : Float32Array.from(data)) : null;\n }\n\n /** Babylon.js `MorphTarget.getPositions()`. */\n public getPositions(): Float32Array | null {\n return this._positions;\n }\n\n /** Babylon.js `MorphTarget.setNormals(data)` — absolute target normals. */\n public setNormals(data: Float32Array | number[] | null): void {\n this._normals = data ? (data instanceof Float32Array ? data : Float32Array.from(data)) : null;\n }\n\n /** Babylon.js `MorphTarget.getNormals()`. */\n public getNormals(): Float32Array | null {\n return this._normals;\n }\n}\n\n/** Babylon.js `MorphTargetManager` — owns a mesh's morph targets (Babylon Lite supports up to 4). */\nexport class MorphTargetManager {\n /** @internal */\n public _engine: EngineContext | undefined;\n /** @internal Built Lite morph data (created at engine start). */\n public _lite: MorphTargetData | undefined;\n private readonly _targets: MorphTarget[] = [];\n\n public constructor(_scene?: Scene) {\n // Scene retained implicitly via the mesh that adopts this manager.\n }\n\n public get numTargets(): number {\n return this._targets.length;\n }\n\n public getTarget(index: number): MorphTarget {\n return this._targets[index]!;\n }\n\n /** Babylon.js `MorphTargetManager.addTarget(target)`. */\n public addTarget(target: MorphTarget): void {\n target._manager = this;\n this._targets.push(target);\n }\n\n /**\n * @internal Build the Lite morph data from the mesh's base CPU geometry and\n * each target's absolute positions/normals (converted to deltas), then assign\n * it onto the Lite mesh. Called by the engine at start, once geometry exists.\n */\n public _build(mesh: Mesh, engine: EngineContext): void {\n const lite = mesh._lite as { _cpuPositions?: Float32Array; _cpuNormals?: Float32Array; morphTargets?: MorphTargetData | null };\n const base = lite._cpuPositions;\n if (!base) {\n return;\n }\n this._engine = engine;\n const vertexCount = base.length / 3;\n const baseNormals = lite._cpuNormals;\n const targets = this._targets.slice(0, 4).map((t) => {\n const abs = t._positions;\n const positions = new Float32Array(base.length);\n if (abs) {\n for (let i = 0; i < base.length; i++) {\n positions[i] = (abs[i] ?? 0) - base[i]!;\n }\n }\n let normals: Float32Array | null = null;\n if (t._normals && baseNormals) {\n normals = new Float32Array(baseNormals.length);\n for (let i = 0; i < baseNormals.length; i++) {\n normals[i] = (t._normals[i] ?? 0) - baseNormals[i]!;\n }\n }\n return { positions, normals };\n });\n const weights = this._targets.slice(0, 4).map((t) => t.influence);\n this._lite = createMorphTargets(engine, targets, vertexCount, weights);\n lite.morphTargets = this._lite;\n }\n\n /** @internal Re-upload current target influences to the GPU weights buffer. */\n public _syncWeights(): void {\n if (!this._lite || !this._engine) {\n return;\n }\n const weights = this._targets.slice(0, 4).map((t) => t.influence);\n setMorphTargetWeights(this._engine, this._lite, weights);\n }\n}\n","/**\n * Babylon.js-compatible `GaussianSplattingMesh` over Babylon Lite's splat loaders.\n *\n * Babylon Lite fully backs Gaussian Splatting: `loadSplat` (`.ply` / `.splat` /\n * compressed-PLY), `loadSOG`, and `loadSPZ` each return a `GaussianSplattingMesh`\n * (a `SceneNode` carrying the splat cloud), with `splatsData` / `updateData` for\n * in-place edits and `bakeCurrentTransformIntoVertices` to fold the node transform\n * into the splat data. This wrapper exposes that through the Babylon.js\n * `GaussianSplattingMesh` shape so ported scenes (`new GaussianSplattingMesh(...)` +\n * `loadFileAsync`, or `ImportMeshAsync` of a splat URL) run unchanged.\n *\n * Babylon.js constructs the mesh synchronously and populates it via\n * `loadFileAsync`; Babylon Lite loads atomically. We bridge this by holding a\n * lightweight placeholder transform node until the splat loads, buffering any\n * transforms set in the meantime, then adopting the loaded Lite node.\n */\n\nimport {\n loadSplat,\n loadSOG,\n loadSPZ,\n bakeCurrentTransformIntoVertices,\n createTransformNode,\n setParent,\n _getGaussianPointSplattingPackedShBytesPerSplat,\n _hasGaussianPointSplattingProjectedDepth,\n} from \"babylon-lite\";\nimport type { GaussianSplattingMesh as LiteGsMesh, GsShaderFragment, Mat4, SceneNode } from \"babylon-lite\";\n\nimport { TransformNode } from \"./meshes.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { Vector3 } from \"../math/vector.js\";\nimport { liteBackedVector3 } from \"../math/vector.js\";\nimport { unsupported } from \"../error.js\";\nimport type { Matrix } from \"../math/matrix.js\";\n\nconst GAUSSIAN_POINT_SPLATTING_UNSUPPORTED =\n \"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.\";\n\n/**\n * Babylon.js `ISafeOrbitCameraLimits` — safe-orbit camera limits embedded in a Gaussian\n * Splatting file's metadata (Adobe safe-orbit extension). Exposed on the loaded mesh via\n * {@link GaussianSplattingMesh.safeOrbitCameraLimits} for shape parity with `@babylonjs/core`.\n */\nexport interface ISafeOrbitCameraLimits {\n /** Minimum safe orbit radius (distance from the camera to its target), if the file specifies one. */\n radiusMin?: number;\n /** Safe elevation range as `[minElevation, maxElevation]` in radians, if the file specifies one. */\n elevationMinMax?: [number, number];\n}\n\nexport interface IGaussianPointSplattingProgress {\n renderedFrameCount: number;\n accumulationVersion: number;\n pixelCycleLength: number;\n}\n\nexport function _HasGaussianPointSplattingProjectedDepth(projection: Matrix): boolean {\n return _hasGaussianPointSplattingProjectedDepth(projection.m as unknown as Mat4);\n}\n\nexport function _GetPackedShBytesPerSplat(shDegree: number): number {\n return _getGaussianPointSplattingPackedShBytesPerSplat(shDegree);\n}\n\n/** Lite loader chosen by file extension (mirrors the BJS splat plugin dispatch). */\nfunction liteLoaderFor(url: string): (scene: import(\"babylon-lite\").SceneContext, url: string, fragments?: readonly GsShaderFragment[]) => Promise<LiteGsMesh> {\n const lower = url.split(\"?\")[0]!.toLowerCase();\n if (lower.endsWith(\".sog\") || lower.endsWith(\".zip\")) {\n return loadSOG;\n }\n if (lower.endsWith(\".spz\")) {\n return loadSPZ;\n }\n // `.ply`, `.splat`, and compressed-PLY all flow through `loadSplat`.\n return loadSplat;\n}\n\n/** `.splat` row stride: position(3f) + scale(3f) + rgba(4×u8) + rot(4×u8) = 32 bytes. */\nconst SPLAT_ROW_BYTES = 32;\nconst SPLAT_ROW_FLOATS = SPLAT_ROW_BYTES / 4;\nconst SPLAT_Y_FLOAT_INDEX = 1;\n\n/**\n * @internal Return a copy of a `.splat` buffer with every row's centre Y negated\n * (the position-space half of Babylon.js's `flipY`). Used to reproduce\n * `updateData(..., { flipY: false })`. Only the 32-byte `.splat` row layout is\n * handled; other buffers are returned unchanged.\n */\nfunction mirrorSplatRowY(buffer: ArrayBuffer): ArrayBuffer {\n if (buffer.byteLength % SPLAT_ROW_BYTES !== 0) {\n return buffer;\n }\n const copy = buffer.slice(0);\n const floats = new Float32Array(copy);\n for (let f = SPLAT_Y_FLOAT_INDEX; f < floats.length; f += SPLAT_ROW_FLOATS) {\n floats[f] = -floats[f]!;\n }\n return copy;\n}\n\n/**\n * Babylon.js `GaussianSplattingMesh`. Derives from `TransformNode` so the loaded\n * cloud's `position` / `rotation` / `scaling` proxy onto the Lite splat node.\n */\nexport class GaussianSplattingMesh extends TransformNode {\n /** @internal The loaded Lite splat node (undefined until `loadFileAsync` resolves). */\n private _gs?: LiteGsMesh;\n /** @internal The constructor's deferred URL, loaded by `loadFileAsync()` with no argument. */\n private readonly _ctorUrl: string | null;\n /** @internal Optional Lite shader-fragment plugins applied at load (scene 126). */\n private _fragments?: readonly GsShaderFragment[];\n /** @internal Point-splatting configuration retained for BJS state parity while the unsupported mode is disabled. */\n private _pointSplattingRenderScale: number | \"auto\" = \"auto\";\n /** @internal Point-splatting configuration retained for BJS state parity while the unsupported mode is disabled. */\n private _pointSplattingOcclusionCulling = false;\n /** @internal Point-splatting configuration retained for BJS state parity while the unsupported mode is disabled. */\n private _pointSplattingScale = 1;\n\n /**\n * Babylon.js `gs.safeOrbitCameraLimits` — safe-orbit camera limits parsed from the source\n * file's metadata (Adobe safe-orbit extension), or `null` when the file carries none.\n *\n * Babylon Lite's splat loaders (`loadSplat` / `loadSOG` / `loadSPZ`) do not parse the Adobe\n * safe-orbit metadata block, so this stays `null` — matching BJS's own default for a file\n * without the extension. Populating it from real metadata needs a (non-tree-shakeable) change\n * to Lite's splat loaders; the field is exposed here for shape parity so ported reads resolve.\n */\n public safeOrbitCameraLimits: ISafeOrbitCameraLimits | null = null;\n\n public get pointSplattingRenderScale(): number | \"auto\" {\n return this._pointSplattingRenderScale;\n }\n\n public set pointSplattingRenderScale(value: number | \"auto\") {\n this._pointSplattingRenderScale = value;\n }\n\n public get pointSplattingOcclusionCulling(): boolean {\n return this._pointSplattingOcclusionCulling;\n }\n\n public set pointSplattingOcclusionCulling(value: boolean) {\n this._pointSplattingOcclusionCulling = value;\n }\n\n public get pointSplattingRenderMode(): boolean {\n return false;\n }\n\n public set pointSplattingRenderMode(value: boolean) {\n if (value) {\n unsupported(\"GaussianSplattingMesh.pointSplattingRenderMode\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n }\n\n public get pointSplattingDepthRenderMode(): boolean {\n return false;\n }\n\n public set pointSplattingDepthRenderMode(value: boolean) {\n if (value) {\n unsupported(\"GaussianSplattingMesh.pointSplattingDepthRenderMode\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n }\n\n public get pointSplattingProgress(): IGaussianPointSplattingProgress | null {\n return null;\n }\n\n public get pointSplattingScale(): number {\n return this._pointSplattingScale;\n }\n\n public set pointSplattingScale(value: number) {\n this._pointSplattingScale = value;\n }\n\n public constructor(name: string, url?: string | null, scene?: Scene, _keepInRam?: boolean) {\n // A placeholder transform node carries any transforms set before the splat\n // loads; it is never added to the scene (Lite `loadSplat` registers the real\n // splat node). Transforms are copied onto the loaded node in `loadFileAsync`.\n super(name, scene, createTransformNode(name));\n this._ctorUrl = url ?? null;\n }\n\n public override getClassName(): string {\n return \"GaussianSplattingMesh\";\n }\n\n /** @internal The wrapper's transform node; the loaded cloud is parented beneath it during deferred adoption. */\n private get _xform(): SceneNode {\n return this._gs?.parent === this._node ? this._node : (this._gs ?? this._node);\n }\n\n /** @internal Accessibility metadata belongs to the loaded cloud, or its placeholder before loading. */\n protected override _accessibilitySource(): object {\n return this._gs ?? this._node;\n }\n\n public override get position(): Vector3 {\n return liteBackedVector3(this._xform.position);\n }\n public override set position(value: Vector3) {\n this._xform.position.set(value.x, value.y, value.z);\n }\n\n public override get rotation(): Vector3 {\n return liteBackedVector3(this._xform.rotation);\n }\n public override set rotation(value: Vector3) {\n this._xform.rotation.set(value.x, value.y, value.z);\n }\n\n public override get scaling(): Vector3 {\n return liteBackedVector3(this._xform.scaling);\n }\n public override set scaling(value: Vector3) {\n this._xform.scaling.set(value.x, value.y, value.z);\n }\n\n /** @internal Set the Lite shader-fragment plugins applied on the next load (compat material-plugin path). */\n public _setFragments(fragments: readonly GsShaderFragment[]): void {\n this._fragments = fragments;\n }\n\n /**\n * Babylon.js `gs.loadFileAsync(url?)` — fetch + parse a splat asset and adopt\n * the resulting Lite node. With no argument, loads the constructor URL.\n */\n public async loadFileAsync(url?: string): Promise<GaussianSplattingMesh> {\n const target = url ?? this._ctorUrl;\n if (!target) {\n throw new Error(\"GaussianSplattingMesh.loadFileAsync: no URL provided (and none given to the constructor).\");\n }\n const scene = this._scene;\n if (!scene) {\n throw new Error(\"GaussianSplattingMesh.loadFileAsync requires a scene (pass one to the constructor).\");\n }\n const lite = await liteLoaderFor(target)(scene._lite, target, this._fragments);\n this._adopt(lite);\n return this;\n }\n\n /**\n * @internal Adopt a loaded Lite splat node from either the mesh or loader-plugin API.\n * Parenting preserves the loader's format-specific local transform while composing it\n * with transforms applied to the wrapper before loading.\n */\n public _adopt(lite: LiteGsMesh): void {\n const placeholder = this._node;\n const previousAccessibilitySource = this._accessibilitySource();\n lite.parent = placeholder;\n placeholder.children.push(lite);\n lite.name = this.name;\n this._gs = lite;\n this._syncAccessibilityTag(previousAccessibilitySource);\n this._scene?._registerMesh(this);\n }\n\n /** @internal Wrap an already-loaded Lite splat node (used by the loader's `ImportMeshAsync` path). */\n public static _fromLite(lite: LiteGsMesh, scene: Scene): GaussianSplattingMesh {\n const mesh = new GaussianSplattingMesh(lite.name, null, scene);\n mesh._gs = lite;\n scene._registerMesh(mesh);\n return mesh;\n }\n\n /** Babylon.js `gs.splatsData` — the raw 32-byte/splat row buffer (for inspection / `updateData`). */\n public get splatsData(): ArrayBuffer | null {\n return this._gs ? this._gs.splatsData : null;\n }\n\n /**\n * Babylon.js `gs.updateData(buffer, sh?, options?)` — replace the splat data in\n * place. Babylon Lite always applies its loader's Y convention on update; the\n * `sh` argument is accepted for signature parity and ignored.\n *\n * `options.flipY === false` is honoured: Babylon.js's `.splat` loader flips Y\n * on load by default, so `flipY:false` re-uploads the buffer **without** that\n * flip — i.e. mirrored relative to the default-loaded pose, which ported scenes\n * then correct with `scaling.y = -1`. Lite has no per-call flip flag and always\n * applies its (flip-on-load-equivalent) convention, so we mirror the row Y here\n * to reproduce the `flipY:false` pose before handing the buffer to Lite.\n */\n public updateData(splatBuffer: ArrayBuffer, _sh?: unknown, options?: { flipY?: boolean }): void {\n const buffer = options?.flipY === false ? mirrorSplatRowY(splatBuffer) : splatBuffer;\n this._gs?.updateData(buffer);\n }\n\n /** Babylon.js `gs.bakeCurrentTransformIntoVertices()` — fold the node transform into the splat data. */\n public bakeCurrentTransformIntoVertices(): void {\n if (this._gs) {\n bakeCurrentTransformIntoVertices(this._gs);\n if (this._gs.parent === this._node) {\n const userChildren = this._node.children.filter((child) => child !== this._gs && child.parent === this._node);\n for (const child of this.getChildren(undefined, true)) {\n if (child instanceof TransformNode && child._node !== this._gs && !userChildren.includes(child._node)) {\n userChildren.push(child._node);\n }\n }\n for (const child of userChildren) {\n setParent(child, null);\n }\n this._node.position.set(0, 0, 0);\n this._node.rotation.set(0, 0, 0);\n this._node.scaling.set(1, 1, 1);\n for (const child of userChildren) {\n setParent(child, this._node);\n }\n }\n }\n }\n\n /** @internal Babylon.js's worker-throttle flag; ported scenes poll it to detect the first sort. */\n public get _canPostToWorker(): boolean {\n return this._gs ? this._gs._orderPool.length === 2 : false;\n }\n\n /** @internal The loaded Lite splat node, for the GPU picker's result mapping (undefined until loaded). */\n public get _pickLiteNode(): LiteGsMesh | undefined {\n return this._gs;\n }\n}\n","import { createDefaultMeshBlendRadiusDefinitions, packMeshBlendingTag, unpackMeshBlendingTag } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\n\nexport enum MeshBlendingRadiusClass {\n Small = 0,\n Medium = 1,\n Large = 2,\n ExtraLarge = 3,\n}\n\nexport interface IMeshBlendingTag {\n groupId: number;\n radiusClass: MeshBlendingRadiusClass;\n}\n\nexport function PackMeshBlendingTag(groupId: number, radiusClass: MeshBlendingRadiusClass): number {\n return packMeshBlendingTag(groupId, radiusClass);\n}\n\nexport function UnpackMeshBlendingTag(tag: number): IMeshBlendingTag {\n const unpacked = unpackMeshBlendingTag(tag);\n return {\n groupId: unpacked.groupId,\n radiusClass: unpacked.radiusClass as MeshBlendingRadiusClass,\n };\n}\n\nexport enum MeshBlendQuality {\n Low = 0,\n Medium = 1,\n High = 2,\n Cinematic = 3,\n}\n\nexport enum MeshBlendDebugMode {\n Off = 0,\n PackedTag = 1,\n CandidateDirectionDistance = 2,\n SeamFade = 3,\n RejectionReason = 4,\n StageWork = 5,\n Continuation = 6,\n TinyObject = 7,\n MultiTarget = 8,\n TargetColor = 9,\n ShadowAttenuation = 10,\n ColorInterpolation = 11,\n WorldPosition = 12,\n}\n\nexport enum MeshBlendDepthType {\n View = 0,\n Screen = 1,\n}\n\nexport interface IMeshBlendRadiusDefinition {\n worldRadius: number;\n minimumProjectedRadius: number;\n}\n\nexport type MeshBlendRadiusDefinitions = readonly [IMeshBlendRadiusDefinition, IMeshBlendRadiusDefinition, IMeshBlendRadiusDefinition, IMeshBlendRadiusDefinition];\n\nexport interface IMeshBlendConfiguration {\n quality?: MeshBlendQuality;\n radiusClasses?: MeshBlendRadiusDefinitions;\n slopeFactor?: number;\n depthType?: MeshBlendDepthType;\n debugMode?: MeshBlendDebugMode;\n}\n\nexport interface IThinMeshBlendingPostProcessOptions extends IMeshBlendConfiguration {\n [key: string]: unknown;\n}\n\nexport interface IMeshBlendingPostProcessOptions extends IMeshBlendConfiguration {\n effectWrapper?: ThinMeshBlendingPostProcess;\n meshBlendTagTexture: unknown;\n depthTexture: unknown;\n baseColorTexture?: unknown;\n [key: string]: unknown;\n}\n\nexport function CreateDefaultMeshBlendRadiusDefinitions(): MeshBlendRadiusDefinitions {\n return createDefaultMeshBlendRadiusDefinitions();\n}\n\nconst MESH_BLENDING_BLOCKER =\n \"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.\";\n\nexport class ThinMeshBlendingPostProcess {\n public constructor(..._args: unknown[]) {\n unsupported(\"ThinMeshBlendingPostProcess\", MESH_BLENDING_BLOCKER);\n }\n}\n\nexport class MeshBlendingPostProcess {\n public constructor(..._args: unknown[]) {\n unsupported(\"MeshBlendingPostProcess\", MESH_BLENDING_BLOCKER);\n }\n}\n\nexport class FrameGraphMeshBlendingTask {\n public constructor(..._args: unknown[]) {\n unsupported(\"FrameGraphMeshBlendingTask\", MESH_BLENDING_BLOCKER);\n }\n}\n\nexport class NodeRenderGraphMeshBlendingPostProcessBlock {\n public constructor(..._args: unknown[]) {\n unsupported(\"NodeRenderGraphMeshBlendingPostProcessBlock\", MESH_BLENDING_BLOCKER);\n }\n}\n\nexport function RegisterMeshBlendingPostProcessBlock(): never {\n return unsupported(\"RegisterMeshBlendingPostProcessBlock\", MESH_BLENDING_BLOCKER);\n}\n","/**\n * Babylon.js-compatible texture wrappers over Babylon Lite's `loadTexture2D`.\n *\n * Babylon.js's `Texture` constructor is synchronous and loads in the background.\n * Babylon Lite loads textures asynchronously. The compat `Texture` kicks off the\n * load in its constructor and resolves `_lite` when ready; assign the texture to\n * a material after `await texture.whenReadyAsync()` (or construct via\n * `Texture.LoadAsync`) so the GPU handle is present when the material binds.\n */\n\nimport {\n loadTexture2D,\n loadBasisTexture2D,\n loadKtxTexture2D,\n createTexture2DFromPixels,\n updateTexture2DFromPixels,\n createTexture3DFromPixels,\n createDynamicTexture,\n updateDynamicTexture,\n createHtmlTexture,\n requestHtmlTextureUpdate,\n updateHtmlTexture,\n disposeHtmlTexture,\n whenHtmlTextureReady,\n} from \"babylon-lite\";\nimport type { Texture2D, Texture2DOptions, EngineContext, Texture3D, DynamicTexture2D, HtmlTexture2D } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport type { AbstractEngine } from \"../engine/engine.js\";\nimport { Matrix } from \"../math/matrix.js\";\nimport { Observable } from \"../misc/observable.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\n/** Compression suffix → `loadKtxTexture2D` token, recognised in a pre-resolved KTX URL. */\nconst KTX_SUFFIX_RE = /(-astc|-dxt|-etc2|-pvrtc)\\.ktx(\\?.*)?$/i;\n\n/**\n * @internal Recognise a pre-resolved compressed KTX URL and split it into the\n * `{ baseUrl, suffix }` pair Babylon Lite's `loadKtxTexture2D` expects (which\n * takes a base image URL plus a format suffix and reconstructs the KTX URL\n * itself), or `null` when the URL is not a compressed KTX.\n *\n * Babylon.js code selects the format via `engine.getCaps()` and hands `Texture`\n * a single fully-qualified `.ktx` URL (e.g. `…/grid-dxt.ktx`), so the base is the\n * `.png` fallback (`…/grid.png`) and the suffix is `-dxt.ktx`. Any query string\n * (auth / cache-busting / signed-URL params) is preserved on the base URL so it\n * survives onto both the KTX fetch and the `.png` fallback.\n */\nexport function resolveKtxUrl(url: string): { baseUrl: string; suffix: string } | null {\n const ktx = url.match(KTX_SUFFIX_RE);\n if (!ktx) {\n return null;\n }\n return { baseUrl: url.replace(KTX_SUFFIX_RE, \".png$2\"), suffix: ktx[1]! + \".ktx\" };\n}\n\n/**\n * Pick the right Babylon Lite loader for a texture URL:\n * - `.basis` → `loadBasisTexture2D` (GPU-format transcode; manages its own V-flip).\n * - a pre-resolved compressed KTX (`…-dxt.ktx` etc.) → `loadKtxTexture2D` (see\n * {@link resolveKtxUrl}), which re-checks device support and falls back to the\n * base image.\n * - everything else → the raster `loadTexture2D`.\n *\n * The basis/KTX loaders manage their own V-orientation, so the raster-only\n * `invertY` / `mipMaps` options are ignored there — passing the same opts is safe.\n */\nfunction loadCompatTexture(engine: EngineContext, url: string, opts: Texture2DOptions): Promise<Texture2D> {\n const path = url.split(/[?#]/)[0]!.toLowerCase();\n if (path.endsWith(\".basis\")) {\n return loadBasisTexture2D(engine, url, opts);\n }\n const ktx = resolveKtxUrl(url);\n if (ktx) {\n return loadKtxTexture2D(engine, ktx.baseUrl, [ktx.suffix], opts);\n }\n return loadTexture2D(engine, url, opts);\n}\n\nexport abstract class BaseTexture {\n public name = \"\";\n /** @internal The underlying Lite texture handle. Undefined until the async load resolves. */\n public _lite: Texture2D | undefined;\n\n /** @internal One-shot listeners fired when the GPU handle first resolves (see {@link _onReady}). */\n private _readyListeners: Array<() => void> | undefined;\n\n public getClassName(): string {\n return \"BaseTexture\";\n }\n\n /**\n * @internal Register a callback fired once this texture's GPU handle resolves.\n * Owning compat materials use it to rebind and rebuild once an asynchronously\n * loaded texture becomes available. Fires immediately if the handle already\n * exists; otherwise queues until {@link _notifyReady}. One-shot per listener.\n */\n public _onReady(listener: () => void): void {\n if (this._lite) {\n listener();\n return;\n }\n (this._readyListeners ??= []).push(listener);\n }\n\n /** @internal Fire and clear the readiness listeners (called by subclasses once `_lite` resolves). */\n protected _notifyReady(): void {\n const listeners = this._readyListeners;\n if (listeners) {\n this._readyListeners = undefined;\n for (const listener of listeners) {\n listener();\n }\n }\n }\n\n /**\n * Babylon.js `BaseTexture.getInternalTexture()` — the backend texture handle. Babylon.js\n * returns an `InternalTexture`; the compat layer's equivalent is the Lite texture handle,\n * which is what the compat engine's texture methods accept.\n */\n public getInternalTexture(): Texture2D | null {\n return this._lite ?? null;\n }\n\n public abstract whenReadyAsync(): Promise<void>;\n\n public dispose(): void {\n // Lite texture lifetimes are managed by the GPU resource pool; explicit\n // disposal is a no-op in the compat layer.\n }\n}\n\n/** Options accepted by Babylon.js `HtmlTexture`. */\nexport interface IHtmlTextureOptions {\n width?: number;\n height?: number;\n generateMipMaps?: boolean;\n samplingMode?: number;\n format?: number;\n autoUpdate?: boolean;\n useSvgFallback?: boolean;\n engine?: AbstractEngine | null;\n scene?: Scene | null;\n}\n\n/** Babylon.js `HtmlTexture`, forwarding DOM capture and updates to Babylon Lite. */\nexport class HtmlTexture extends BaseTexture {\n public readonly element: HTMLElement;\n public readonly host: HTMLElement | null;\n public readonly onLoadObservable = new Observable<HtmlTexture>(undefined, true);\n private readonly _engine: AbstractEngine | null;\n private readonly _textureMatrix = Matrix.Identity();\n private readonly _ready: Promise<void>;\n private _htmlTexture: HtmlTexture2D | undefined;\n private _disposed = false;\n\n public constructor(name: string, element: HTMLElement, options: IHtmlTextureOptions) {\n super();\n this.name = name;\n this.element = element;\n this._engine = options.scene?.getEngine() ?? options.engine ?? null;\n this.host = (this._engine?.getRenderingCanvas() as HTMLElement | null | undefined) ?? null;\n if (!this._engine || !element) {\n this._ready = Promise.reject(new Error(\"HtmlTexture requires an engine and HTML element.\"));\n void this._ready.catch(() => undefined);\n return;\n }\n if (options.format !== undefined && options.format !== 5) {\n unsupported(\"HtmlTexture.format\", \"Babylon Lite HTML textures use RGBA8; alternate Babylon.js texture formats require a new native upload/storage contract.\");\n }\n const nearest = options.samplingMode === Texture.NEAREST_SAMPLINGMODE || options.samplingMode === Texture.NEAREST_NEAREST;\n const htmlTexture = createHtmlTexture(this._engine._lite, element, {\n width: options.width,\n height: options.height,\n mipMaps: options.generateMipMaps ?? false,\n autoUpdate: options.autoUpdate ?? true,\n useSvgFallback: options.useSvgFallback ?? true,\n minFilter: nearest ? \"nearest\" : \"linear\",\n magFilter: nearest ? \"nearest\" : \"linear\",\n invertY: true,\n });\n this._htmlTexture = htmlTexture;\n this._ready = whenHtmlTextureReady(htmlTexture).then(() => {\n if (this._disposed) {\n throw new Error(\"HtmlTexture was disposed before its first upload completed.\");\n }\n this._lite = htmlTexture;\n try {\n this.onLoadObservable.notifyObservers(this);\n } finally {\n this._notifyReady();\n }\n });\n void this._ready.catch(() => undefined);\n }\n\n public getTextureMatrix(): Matrix {\n return this._textureMatrix;\n }\n\n public requestUpdate(): void {\n if (this._engine && this._htmlTexture) {\n requestHtmlTextureUpdate(this._engine._lite, this._htmlTexture);\n }\n }\n\n public update(invertY = true): void {\n if (this._engine && this._htmlTexture) {\n updateHtmlTexture(this._engine._lite, this._htmlTexture, invertY);\n }\n }\n\n public override getClassName(): string {\n return \"HtmlTexture\";\n }\n\n public whenReadyAsync(): Promise<void> {\n return this._ready;\n }\n\n public override dispose(): void {\n this._disposed = true;\n if (this._htmlTexture) {\n disposeHtmlTexture(this._htmlTexture);\n this._htmlTexture = undefined;\n }\n this._lite = undefined;\n this.onLoadObservable.clear();\n this.onLoadObservable.cleanLastNotifiedState();\n }\n}\n\nexport class Texture extends BaseTexture {\n private readonly _ready: Promise<void>;\n private _onLoadObservable: Observable<Texture> | undefined;\n /** Babylon.js sampling-mode constants (numeric parity). */\n public static readonly NEAREST_SAMPLINGMODE = 1;\n public static readonly BILINEAR_SAMPLINGMODE = 2;\n public static readonly TRILINEAR_SAMPLINGMODE = 3;\n public static readonly NEAREST_NEAREST = 8;\n public static readonly LINEAR_LINEAR = 11;\n /** Babylon.js coordinate-mode constants (numeric parity). */\n public static readonly CLAMP_ADDRESSMODE = 0;\n public static readonly WRAP_ADDRESSMODE = 1;\n public static readonly MIRROR_ADDRESSMODE = 2;\n /** Babylon.js texture UV tiling (applied to the Lite material at bind time). */\n public uScale = 1;\n public vScale = 1;\n public uOffset = 0;\n public vOffset = 0;\n public hasAlpha = false;\n public coordinatesIndex = 0;\n /** Babylon.js sampling mode passed at construction (`NEAREST_SAMPLINGMODE` = 1, etc.). */\n public readonly samplingMode: number;\n /** @internal The Scene or engine this texture was created against (for `clone`). */\n private readonly _source: Scene | { _lite: import(\"babylon-lite\").EngineContext };\n\n public constructor(\n url: string,\n sceneOrEngine: Scene | { _lite: import(\"babylon-lite\").EngineContext },\n noMipmapOrOptions?: unknown,\n invertY?: boolean,\n _samplingMode?: number,\n onLoad?: (() => void) | null\n ) {\n super();\n this.name = url;\n // Babylon.js `Texture(url, scene, noMipmapOrOptions?, invertY?, samplingMode?)`.\n // The third argument is either a `noMipmap` boolean or an options object; parse\n // both shapes so the load matches what the ported code asked for.\n let noMipmap = false;\n let invertYOpt = invertY;\n let samplingMode = _samplingMode;\n if (typeof noMipmapOrOptions === \"boolean\") {\n noMipmap = noMipmapOrOptions;\n } else if (noMipmapOrOptions && typeof noMipmapOrOptions === \"object\") {\n const o = noMipmapOrOptions as { noMipmap?: boolean; invertY?: boolean; samplingMode?: number };\n noMipmap = o.noMipmap ?? false;\n invertYOpt = invertYOpt ?? o.invertY;\n samplingMode = samplingMode ?? o.samplingMode;\n }\n // Babylon.js `Texture.invertY` defaults to true; honour an explicit `false`.\n this._invertY = invertYOpt ?? true;\n this._noMipmap = noMipmap;\n this.samplingMode = samplingMode ?? Texture.BILINEAR_SAMPLINGMODE;\n this._source = sceneOrEngine;\n // Babylon.js's `Texture` accepts either a `Scene` or a `ThinEngine`. When a\n // scene is passed, the load is tracked so the scene awaits it at build; when\n // a bare engine is passed (e.g. the scene-less `SpriteRenderer` path), there\n // is no scene to track against, so the caller awaits readiness itself.\n const scene = (sceneOrEngine as Scene).getEngine ? (sceneOrEngine as Scene) : undefined;\n const engineWrapper = scene ? undefined : (sceneOrEngine as { _lite: import(\"babylon-lite\").EngineContext; _registerStartupWork?: (w: () => Promise<void>) => void });\n const engine = scene ? scene.getEngine()._lite : engineWrapper!._lite;\n // Honour `invertY` / `noMipmap` only on the material (scene-based) path. The\n // bare-engine path feeds Babylon Lite's sprite renderer, which applies its own\n // V-orientation, so it keeps `loadTexture2D`'s defaults (matching the Lite ports).\n // Map the Babylon.js sampling mode to Lite's min/mag filters: `NEAREST_SAMPLINGMODE`\n // must load with nearest filtering, else the alpha of an alpha-tested (cutout)\n // texture is bilinear-filtered and the discard boundary shifts — invisible on\n // axis-aligned sprites but a large divergence on rotated cutout billboards.\n const nearest = this.samplingMode === Texture.NEAREST_SAMPLINGMODE || this.samplingMode === Texture.NEAREST_NEAREST;\n const filterOpts: { minFilter?: \"nearest\" | \"linear\"; magFilter?: \"nearest\" | \"linear\" } = nearest ? { minFilter: \"nearest\", magFilter: \"nearest\" } : {};\n const loadOpts = scene ? { invertY: this._invertY, mipMaps: !this._noMipmap, ...filterOpts } : {};\n\n this._ready = loadCompatTexture(engine, url, loadOpts).then((tex) => {\n this._lite = tex;\n try {\n this._notifyLoadObservable();\n if (onLoad) {\n onLoad();\n }\n } finally {\n // Rebuild after onLoad has configured UV scale and related fields.\n this._notifyReady();\n }\n });\n // Let the scene await this load before it builds renderables, so the GPU\n // handle exists when the owning material binds (Babylon.js loads in the\n // background but its render loop simply waits a frame; we wait at build).\n scene?._trackTextureLoad(this._ready);\n // Scene-less path (bare engine): register the load as engine startup work\n // so `texture.isReady()` is true by the time the render loop first runs.\n engineWrapper?._registerStartupWork?.(() => this._ready);\n }\n\n /** @internal Upload-time vertical flip / mipmap flags, preserved across `clone`. */\n private readonly _invertY: boolean;\n private readonly _noMipmap: boolean;\n\n public override getClassName(): string {\n return \"Texture\";\n }\n\n /**\n * Babylon.js `texture.clone()` — a new `Texture` over the same source URL.\n * UV tiling/offset and sampling are copied; the clone re-resolves the GPU\n * handle (tracked against the same scene so it is ready at build).\n */\n public clone(): Texture {\n const c = new Texture(this.name, this._source, this._noMipmap, this._invertY, this.samplingMode);\n c.uScale = this.uScale;\n c.vScale = this.vScale;\n c.uOffset = this.uOffset;\n c.vOffset = this.vOffset;\n c.hasAlpha = this.hasAlpha;\n c.coordinatesIndex = this.coordinatesIndex;\n return c;\n }\n\n public override whenReadyAsync(): Promise<void> {\n return this._ready;\n }\n\n /** Babylon.js `Texture.onLoadObservable`, allocated only when code subscribes. */\n public get onLoadObservable(): Observable<Texture> {\n let observable = this._onLoadObservable;\n if (!observable) {\n observable = new Observable<Texture>(undefined, true);\n this._onLoadObservable = observable;\n if (this.isReady()) {\n observable.notifyObservers(this);\n }\n }\n return observable;\n }\n\n private _notifyLoadObservable(): void {\n if (this._onLoadObservable) {\n this._onLoadObservable.notifyObservers(this);\n }\n }\n\n /** Babylon.js `BaseTexture.isReady()` — true once the GPU handle has resolved. */\n public isReady(): boolean {\n return this._lite !== undefined;\n }\n\n /** Load a texture and resolve once its GPU handle is available. */\n public static async LoadAsync(url: string, scene: Scene): Promise<Texture> {\n const texture = new Texture(url, scene);\n await texture.whenReadyAsync();\n return texture;\n }\n}\n\n/**\n * Babylon.js `RawTexture` — a texture created from raw pixel bytes. Backed by\n * Babylon Lite's `createTexture2DFromPixels`; the GPU handle is available\n * synchronously after construction.\n */\nexport class RawTexture extends BaseTexture {\n private readonly _scene: Scene;\n\n public constructor(data: Uint8Array, width: number, height: number, scene: Scene) {\n super();\n this._scene = scene;\n this._lite = createTexture2DFromPixels(scene.getEngine()._lite, data, width, height);\n }\n\n public override getClassName(): string {\n return \"RawTexture\";\n }\n\n /** Replace the texture's pixel contents. */\n public update(data: Uint8Array): void {\n if (this._lite) {\n updateTexture2DFromPixels(this._scene.getEngine()._lite, this._lite, data);\n }\n }\n\n public override whenReadyAsync(): Promise<void> {\n return Promise.resolve();\n }\n\n public static CreateRGBATexture(data: Uint8Array, width: number, height: number, scene: Scene): RawTexture {\n return new RawTexture(data, width, height, scene);\n }\n}\n\n/**\n * Babylon.js `RawTexture3D` — a volumetric texture created from raw RGBA8 pixel\n * bytes (the common case being a colour-grading LUT / colour cube). Backed by\n * Babylon Lite's `createTexture3DFromPixels`; the GPU handle is available\n * synchronously after construction.\n *\n * Babylon Lite's 3D-texture path is RGBA8-only, so the `format` argument is\n * recorded for API parity but the upload always treats `data` as tightly-packed\n * `width * height * depth * 4` RGBA bytes (x fastest, then y, then z).\n */\nexport class RawTexture3D extends BaseTexture {\n private readonly _scene: Scene;\n /** Babylon.js `RawTexture3D.is3D` — always true for a 3D texture. */\n public readonly is3D = true;\n\n public constructor(\n data: ArrayBufferView | null,\n width: number,\n height: number,\n depth: number,\n /** Babylon.js texture format (recorded for parity; Lite uploads RGBA8). */\n public format: number,\n scene: Scene,\n generateMipMaps = true,\n _invertY = false,\n _samplingMode = 3,\n _textureType?: number,\n _creationFlags?: number\n ) {\n super();\n if (generateMipMaps) {\n unsupported(\n \"RawTexture3D(generateMipMaps)\",\n \"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.\"\n );\n }\n this._scene = scene;\n const bytes = toRgbaBytes(data, width, height, depth);\n this._lite = createTexture3DFromPixels(scene.getEngine()._lite, bytes, width, height, depth) as Texture3D;\n }\n\n public override getClassName(): string {\n return \"RawTexture3D\";\n }\n\n /** Gets the width of the texture. */\n public get width(): number {\n return (this._lite as Texture3D | undefined)?.width ?? 0;\n }\n\n /** Gets the height of the texture. */\n public get height(): number {\n return (this._lite as Texture3D | undefined)?.height ?? 0;\n }\n\n /** Gets the depth of the texture. */\n public get depth(): number {\n return (this._lite as Texture3D | undefined)?.depth ?? 0;\n }\n\n /**\n * Replace the texture's pixel contents. Babylon Lite has no in-place 3D update,\n * so the volume is re-uploaded (a fresh Lite 3D texture handle).\n */\n public update(data: ArrayBufferView): void {\n const bytes = toRgbaBytes(data, this.width, this.height, this.depth);\n this._lite = createTexture3DFromPixels(this._scene.getEngine()._lite, bytes, this.width, this.height, this.depth) as Texture3D;\n }\n\n public override whenReadyAsync(): Promise<void> {\n return Promise.resolve();\n }\n}\n\n/**\n * @internal Coerce a raw `ArrayBufferView` (or a bare `Uint8Array`) into the tightly\n * packed `width * height * depth * 4` RGBA8 `Uint8Array` Babylon Lite's raw-pixel\n * texture factories expect (`createTexture3DFromPixels`,\n * `createTexture2DArrayFromPixels`). Babylon.js allows a `null` data argument\n * (an empty texture); Lite requires bytes, so `null` becomes a zero-filled volume.\n * For a 2D array, `depth` is the layer count.\n */\nexport function toRgbaBytes(data: ArrayBufferView | null, width: number, height: number, depth: number): Uint8Array {\n const expected = width * height * depth * 4;\n if (data === null) {\n return new Uint8Array(expected);\n }\n const bytes = data instanceof Uint8Array ? data : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n // Keep the result tightly packed: trim any trailing bytes beyond width*height*depth*4\n // so we never upload unintended data past the volume Lite expects.\n return bytes.byteLength > expected ? bytes.subarray(0, expected) : bytes;\n}\n\n/**\n * Babylon.js `DynamicTexture` — a canvas-backed texture. Draw into\n * `getContext()`, then call `update()` to upload the canvas pixels to the GPU.\n * Backed by Babylon Lite's `createDynamicTexture` / `updateDynamicTexture`, which\n * blit the canvas straight to the GPU via `copyExternalImageToTexture` (no\n * `getImageData` CPU readback).\n */\nexport class DynamicTexture extends BaseTexture {\n private readonly _scene: Scene;\n private readonly _canvas: HTMLCanvasElement;\n private readonly _context: CanvasRenderingContext2D;\n private readonly _width: number;\n private readonly _height: number;\n /** @internal Branded Lite dynamic texture; aliases `_lite` and is the only\n * handle `updateDynamicTexture` accepts. */\n private readonly _dyn: DynamicTexture2D;\n\n public constructor(name: string, options: { width: number; height: number }, scene: Scene) {\n super();\n this.name = name;\n this._scene = scene;\n this._width = options.width;\n this._height = options.height;\n this._canvas = document.createElement(\"canvas\");\n this._canvas.width = options.width;\n this._canvas.height = options.height;\n const ctx = this._canvas.getContext(\"2d\");\n if (!ctx) {\n throw new Error(\"DynamicTexture: 2D canvas context unavailable.\");\n }\n this._context = ctx;\n // Allocate the GPU texture up front (blank until the first draw+update),\n // matching Babylon.js where the texture exists immediately after construction.\n this._dyn = createDynamicTexture(scene.getEngine()._lite, options.width, options.height);\n this._lite = this._dyn;\n }\n\n public override getClassName(): string {\n return \"DynamicTexture\";\n }\n\n public getContext(): CanvasRenderingContext2D {\n return this._context;\n }\n\n public getSize(): { width: number; height: number } {\n return { width: this._width, height: this._height };\n }\n\n /** Draw `text` and refresh the GPU texture. */\n public drawText(text: string, x: number, y: number, font: string, color: string, clearColor: string | null): void {\n const ctx = this._context;\n if (clearColor) {\n ctx.fillStyle = clearColor;\n ctx.fillRect(0, 0, this._width, this._height);\n }\n ctx.font = font;\n ctx.fillStyle = color;\n ctx.fillText(text, x, y);\n this.update();\n }\n\n /**\n * Blit the current canvas pixels straight to the GPU texture (no CPU readback).\n * @param invertY - Flip V so a top-down canvas samples upright. Default `true` (Babylon.js parity).\n * @param premulAlpha - Treat the upload as premultiplied alpha. Default `false`.\n * @param _allowGPUOptimization - Accepted for Babylon.js signature parity; the blit is already GPU-direct, so this is a no-op.\n */\n public update(invertY: boolean = true, premulAlpha: boolean = false, _allowGPUOptimization: boolean = false): void {\n updateDynamicTexture(this._scene.getEngine()._lite, this._dyn, this._canvas, { invertY, premultiplyAlpha: premulAlpha });\n }\n\n public override whenReadyAsync(): Promise<void> {\n return Promise.resolve();\n }\n}\n\n/**\n * Babylon.js `CubeTexture` — environment/skybox cube map. Babylon Lite loads\n * environments through `loadEnvironment` (IBL + skybox registered on the scene)\n * rather than as a standalone GPU texture object. This compat `CubeTexture`\n * therefore acts as a lightweight handle that records the environment URL; the\n * actual GPU work happens when it is assigned to `scene.environmentTexture` and\n * the engine starts (see `Scene` env handling). It still extends\n * {@link BaseTexture} to match the Babylon.js class hierarchy, so it can appear\n * in `BaseTexture[]` surfaces such as `Material.getActiveTextures()`; because the\n * environment has no standalone Lite handle, `getInternalTexture()` stays `null`.\n */\nexport class CubeTexture extends BaseTexture {\n /** Source URL of the (prefiltered) environment. */\n public readonly url: string;\n /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */\n public coordinatesMode = 0;\n public gammaSpace = true;\n public level = 1;\n /**\n * @internal Which Lite environment loader the scene should route this handle\n * through at engine start. Plain `.env`/`.dds` cube maps load via\n * `loadEnvironment`/`loadDdsEnvironment`; `HDRCubeTexture` overrides this to\n * `\"hdr\"` so the scene picks `loadHdrEnvironment`.\n */\n public readonly _envLoaderKind: \"cube\" | \"hdr\" = \"cube\";\n /** Fires when the cube map is \"ready\" (resolved on a microtask in this compat layer). */\n public readonly onLoadObservable = new Observable<CubeTexture>();\n private _ready = false;\n private readonly _readyPromise: Promise<void>;\n\n public constructor(\n url: string,\n _scene?: unknown,\n _extensions?: unknown,\n _noMipmap?: boolean,\n _files?: unknown,\n onLoad?: (() => void) | null,\n _onError?: unknown,\n _format?: unknown,\n _prefiltered?: boolean\n ) {\n super();\n this.url = url;\n this.name = url;\n // Babylon.js fires onLoad once the cube map is ready; some scenes await it\n // before continuing. We resolve on a microtask since the actual GPU upload\n // is deferred to `loadEnvironment` at engine start.\n this._readyPromise = new Promise((resolve) => {\n queueMicrotask(() => {\n this._ready = true;\n if (onLoad) {\n onLoad();\n }\n this.onLoadObservable.notifyObservers(this);\n resolve();\n });\n });\n }\n\n public override getClassName(): string {\n return \"CubeTexture\";\n }\n\n /** Babylon.js `BaseTexture.isReady()`. */\n public isReady(): boolean {\n return this._ready;\n }\n\n public override whenReadyAsync(): Promise<void> {\n return this._readyPromise;\n }\n\n /** Babylon.js `CubeTexture.CreateFromPrefilteredData(url, scene)`. */\n public static CreateFromPrefilteredData(url: string, scene?: unknown): CubeTexture {\n return new CubeTexture(url, scene);\n }\n\n public override dispose(): void {\n // GPU resources are owned by the scene's environment, disposed with the scene.\n }\n}\n\n/**\n * Babylon.js `HDRCubeTexture` — a Radiance `.hdr` (RGBE) equirectangular panorama\n * used as an environment / IBL source. Like {@link CubeTexture} this is a\n * lightweight handle that records the `.hdr` URL; the actual GPU work (equirect →\n * prefiltered cubemap + irradiance SH + BRDF LUT) happens when it is assigned to\n * `scene.environmentTexture` and the engine starts, at which point the scene\n * routes it through Babylon Lite's native `loadHdrEnvironment`.\n */\nexport class HDRCubeTexture extends BaseTexture {\n /** Source URL of the `.hdr` panorama. */\n public readonly url: string;\n /** Requested cubemap face size (BJS `size`); forwarded to Lite's `faceSize`. */\n public readonly size: number;\n /** Babylon.js `coordinatesMode` (skybox = 5). Recorded for API parity. */\n public coordinatesMode = 0;\n public gammaSpace = true;\n public level = 1;\n /** @internal Selects Lite's `loadHdrEnvironment` in the scene's env loader. */\n public readonly _envLoaderKind: \"cube\" | \"hdr\" = \"hdr\";\n /** Fires when the HDR environment is \"ready\" (resolved on a microtask). */\n public readonly onLoadObservable = new Observable<HDRCubeTexture>();\n private _ready = false;\n private readonly _readyPromise: Promise<void>;\n\n public constructor(\n url: string,\n _sceneOrEngine?: unknown,\n size = 256,\n _noMipmap?: boolean,\n _generateHarmonics?: boolean,\n _gammaSpace?: boolean,\n _prefilterOnLoad?: boolean,\n onLoad?: (() => void) | null\n ) {\n super();\n this.url = url;\n this.size = size;\n this.name = url;\n // Babylon.js fires onLoad once the HDR is decoded + prefiltered; the real\n // GPU work is deferred to `loadHdrEnvironment` at engine start, so we\n // resolve the readiness signal on a microtask (matches CubeTexture).\n this._readyPromise = new Promise((resolve) => {\n queueMicrotask(() => {\n this._ready = true;\n if (onLoad) {\n onLoad();\n }\n this.onLoadObservable.notifyObservers(this);\n resolve();\n });\n });\n }\n\n public override getClassName(): string {\n return \"HDRCubeTexture\";\n }\n\n /** Babylon.js `BaseTexture.isReady()`. */\n public isReady(): boolean {\n return this._ready;\n }\n\n public override whenReadyAsync(): Promise<void> {\n return this._readyPromise;\n }\n\n public override dispose(): void {\n // GPU resources are owned by the scene's environment, disposed with the scene.\n }\n}\n\n/** Babylon.js `RenderTargetTexture` — offscreen render target. Use the native frame-graph RTT APIs. */\nexport class RenderTargetTexture {\n public constructor() {\n unsupported(\"RenderTargetTexture\", \"Offscreen rendering uses Babylon Lite's frame-graph render-target APIs (`createRenderTargetTexture` / render tasks).\");\n }\n}\n","import { createExternalTexture, isExternalTextureReady } from \"babylon-lite\";\nimport type { ExternalTexture as LiteExternalTexture } from \"babylon-lite\";\n\nlet nextUniqueId = 0;\n\n/** Babylon.js `ExternalTexture` over Lite's caller-owned video wrapper. */\nexport class ExternalTexture {\n /** @internal Underlying Lite external texture. */\n public readonly _lite: LiteExternalTexture;\n public useMipMaps = false;\n public readonly type = 16;\n public readonly format = 0xffffffff;\n public readonly uniqueId = nextUniqueId++;\n\n public static IsExternalTexture(texture: unknown): texture is ExternalTexture {\n return !!texture && typeof texture === \"object\" && (texture as { underlyingResource?: unknown }).underlyingResource !== undefined;\n }\n\n public constructor(private readonly _video: HTMLVideoElement) {\n this._lite = createExternalTexture(_video);\n }\n\n public getClassName(): string {\n return \"ExternalTexture\";\n }\n\n public get underlyingResource(): HTMLVideoElement {\n return this._video;\n }\n\n public isReady(): boolean {\n return isExternalTextureReady(this._lite);\n }\n\n public dispose(): void {}\n}\n","/**\n * Babylon.js-compatible 2D **texture array** wrappers over Babylon Lite's\n * `createTexture2DArray` / `createTexture2DArrayFromPixels` /\n * `updateTexture2DArrayFromPixels` / `uploadImageToArrayLayer` /\n * `loadImageToArrayLayer` / `createTexture2DArrayFromUrls`.\n *\n * A texture array is a single GPU texture holding N same-size, same-format layers\n * (sampled in a shader as `texture_2d_array<f32>` with an explicit layer index).\n * Babylon.js exposes the raw-bytes constructor on `RawTexture2DArray` plus the\n * image-source helper functions in `rawTexture2DArray.functions`. Both paths are\n * backed by Babylon Lite: raw multi-layer bytes go through Lite's pixel upload,\n * decoded image sources through Lite's external-image copy.\n */\n\nimport {\n createTexture2DArray,\n createTexture2DArrayFromPixels,\n updateTexture2DArrayFromPixels,\n loadImageToArrayLayer,\n createTexture2DArrayFromUrls,\n createTexture2DArrayFromKtx2,\n} from \"babylon-lite\";\nimport type { Texture2DArray } from \"babylon-lite\";\n\nimport { Constants } from \"../misc/engine-constants.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport { BaseTexture, toRgbaBytes } from \"./textures.js\";\n\n/** The decoded image sources WebGPU (and therefore Lite) can upload into a layer. */\ntype ImageSource = ImageBitmap | HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | HTMLVideoElement | ImageData | VideoFrame;\n\n/**\n * Babylon.js `RawTexture2DArray` — a 2D array texture. Backed by Babylon Lite's\n * `Texture2DArray`.\n *\n * Both Babylon.js construction paths work: pass raw multi-layer RGBA8 bytes\n * (`data !== null`) for a CPU-generated array, or construct empty (`data = null`)\n * and fill layers from decoded image sources via\n * {@link UploadImageToTexture2DArrayLayer} /\n * {@link LoadImageToTexture2DArrayLayerAsync}, or build the whole array in one call\n * with {@link CreateTexture2DArrayFromImageUrlsAsync}.\n *\n * Babylon Lite's array path is RGBA8-only, so `format` / `textureType` /\n * `samplingMode` are recorded for API parity but the upload always treats `data` as\n * tightly-packed `width * height * depth * 4` RGBA bytes (layer-major). Raw-byte\n * uploads are not Y-flipped (matching the compat `RawTexture` / `RawTexture3D`\n * pixel paths), so `invertY` is recorded but not applied to `data`.\n */\nexport class RawTexture2DArray extends BaseTexture {\n /** @internal The underlying Lite 2D-array handle (aliases `_lite`). */\n public _liteArray: Texture2DArray | undefined;\n /** Babylon.js `RawTexture2DArray.is2DArray` — always true. */\n public readonly is2DArray = true;\n /** @internal Owning compat scene. */\n public _sceneRef: Scene;\n\n public constructor(\n data: ArrayBufferView | null,\n width: number,\n height: number,\n depth: number,\n /** Babylon.js texture format (recorded for parity; Lite uploads RGBA8). */\n public format: number,\n scene: Scene,\n generateMipMaps = true,\n _invertY = false,\n _samplingMode = 3,\n _textureType?: number,\n _creationFlags?: number,\n _mipLevelCount?: number\n ) {\n super();\n this._sceneRef = scene;\n const engine = scene.getEngine()._lite;\n const tex =\n data === null\n ? createTexture2DArray(engine, width, height, depth, { mipMaps: generateMipMaps })\n : createTexture2DArrayFromPixels(engine, toRgbaBytes(data, width, height, depth), width, height, depth, { mipMaps: generateMipMaps });\n this._liteArray = tex;\n this._lite = tex;\n }\n\n public override getClassName(): string {\n return \"RawTexture2DArray\";\n }\n\n /** Babylon.js `RawTexture2DArray.depth` — the number of array layers. */\n public get depth(): number {\n return this._liteArray?.layers ?? 0;\n }\n\n /** The scene this texture belongs to (Babylon.js `ThinTexture.getScene`). */\n public getScene(): Scene {\n return this._sceneRef;\n }\n\n /**\n * Babylon.js `RawTexture2DArray.getInternalTexture()` — the backend handle the compat\n * engine's texture methods accept (Lite's `Texture2DArray`).\n */\n public override getInternalTexture(): Texture2DArray | null {\n return this._liteArray ?? null;\n }\n\n /** Babylon.js `RawTexture2DArray.update(data)` — replace the base mip of every layer. */\n public update(data: ArrayBufferView): void {\n this.updateMipLevel(data, 0);\n }\n\n /**\n * Babylon.js `RawTexture2DArray.updateMipLevel(data, mipLevel)` — replace one mip level of\n * every layer. Level dimensions are `max(1, size >> mipLevel)`; writing level 0 of a\n * mipmapped array regenerates the rest of the chain, exactly as Babylon.js does.\n */\n public updateMipLevel(data: ArrayBufferView, mipLevel: number): void {\n const array = this._liteArray;\n if (!array) {\n return;\n }\n const width = Math.max(1, array.width >> mipLevel);\n const height = Math.max(1, array.height >> mipLevel);\n updateTexture2DArrayFromPixels(this._sceneRef.getEngine()._lite, array, toRgbaBytes(data, width, height, array.layers), mipLevel);\n }\n\n public override whenReadyAsync(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * @internal Reconcile the image-URL construction path\n * ({@link CreateTexture2DArrayFromImageUrlsAsync}) into the single BJS-named\n * class without re-running the allocating constructor.\n */\n public static _fromLite(liteArray: Texture2DArray, format: number, scene: Scene): RawTexture2DArray {\n const tex: RawTexture2DArray = Object.create(RawTexture2DArray.prototype);\n tex.name = \"\";\n (tex as { is2DArray: boolean }).is2DArray = true;\n tex.format = format;\n tex._sceneRef = scene;\n tex._liteArray = liteArray;\n tex._lite = liteArray;\n return tex;\n }\n\n /** Babylon.js `RawTexture2DArray.CreateRGBATexture` — RGBA raw-bytes factory. */\n public static CreateRGBATexture(\n data: ArrayBufferView,\n width: number,\n height: number,\n depth: number,\n scene: Scene,\n generateMipMaps = true,\n invertY = false,\n samplingMode = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\n type = Constants.TEXTURETYPE_UNSIGNED_BYTE\n ): RawTexture2DArray {\n return new RawTexture2DArray(data, width, height, depth, Constants.TEXTUREFORMAT_RGBA, scene, generateMipMaps, invertY, samplingMode, type);\n }\n}\n\n/** Babylon.js `IUploadImageToTexture2DArrayLayerOptions`. */\nexport interface IUploadImageToTexture2DArrayLayerOptions {\n /** Store the source with the Y axis inverted (false by default). */\n invertY?: boolean;\n /** Premultiply the source alpha (false by default). */\n premultiplyAlpha?: boolean;\n}\n\n/** Babylon.js `ICreateTexture2DArrayFromImageUrlsOptions`. */\nexport interface ICreateTexture2DArrayFromImageUrlsOptions extends IUploadImageToTexture2DArrayLayerOptions {\n /** Generate a full mip chain (true by default). */\n generateMipMaps?: boolean;\n /** Sampling mode (recorded for parity; Lite uses trilinear). */\n samplingMode?: number;\n /** Texture type (recorded for parity; Lite uploads RGBA8). */\n textureType?: number;\n /** Options forwarded to `createImageBitmap` (recorded for parity). */\n imageBitmapOptions?: ImageBitmapOptions;\n}\n\n/** Babylon.js `ICreateTexture2DArrayFromKTX2Options`. */\nexport interface ICreateTexture2DArrayFromKTX2Options {\n /** Generate a full mip chain (true by default). */\n generateMipMaps?: boolean;\n /** Sampling mode (trilinear by default). */\n samplingMode?: number;\n /** Store the texture with the Y axis inverted (false by default). */\n invertY?: boolean;\n}\n\n/**\n * Babylon.js `CreateTexture2DArrayFromKTX2Async` — decode a single multi-layer KTX2\n * container into a texture array. Forwards to Lite's `createTexture2DArrayFromKtx2`\n * (transcodes to RGBA8, uploads the base level, regenerates mips), then wraps the\n * result in a `RawTexture2DArray`.\n *\n * Babylon.js defaults `generateMipMaps` to `true`; that value is always passed\n * explicitly rather than left to any Lite default. Sampling and Y inversion are\n * forwarded to the Lite array handle.\n */\nexport async function CreateTexture2DArrayFromKTX2Async(scene: Scene, data: string | ArrayBufferView, options?: ICreateTexture2DArrayFromKTX2Options): Promise<RawTexture2DArray> {\n let buffer: ArrayBufferView;\n if (typeof data === \"string\") {\n const response = await fetch(data);\n if (!response.ok) {\n throw new Error(`Failed to fetch KTX2 file \"${data}\": ${response.status} ${response.statusText}`);\n }\n buffer = new Uint8Array(await response.arrayBuffer());\n } else {\n buffer = data;\n }\n const samplingMode = options?.samplingMode ?? Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;\n const nearest = samplingMode === Constants.TEXTURE_NEAREST_SAMPLINGMODE;\n const bilinear = samplingMode === Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\n const liteArray = await createTexture2DArrayFromKtx2(scene.getEngine()._lite, buffer, {\n generateMipMaps: options?.generateMipMaps ?? true,\n invertY: options?.invertY ?? false,\n minFilter: nearest ? \"nearest\" : \"linear\",\n magFilter: nearest ? \"nearest\" : \"linear\",\n mipmapFilter: nearest || bilinear ? \"nearest\" : \"linear\",\n });\n return RawTexture2DArray._fromLite(liteArray, Constants.TEXTUREFORMAT_RGBA, scene);\n}\n/** @internal Resolve the live Lite array handle a compat texture wraps. */\nfunction liteArrayOf(texture: RawTexture2DArray): Texture2DArray {\n const array = texture.getInternalTexture();\n if (!array) {\n throw new Error(\"Cannot upload to a 2D array texture that has no internal texture.\");\n }\n return array;\n}\n\n/**\n * Babylon.js `UploadImageToTexture2DArrayLayer` — upload a decoded image source\n * into one layer of a texture array. Routes through the engine's\n * `updateTextureArrayLayerFromImageSource` (as Babylon.js does), which forwards to\n * Lite's `uploadImageToArrayLayer`.\n */\nexport function UploadImageToTexture2DArrayLayer(texture: RawTexture2DArray, source: ImageSource, layer: number, options?: IUploadImageToTexture2DArrayLayerOptions): void {\n const array = liteArrayOf(texture);\n if (!Number.isInteger(layer) || layer < 0 || layer >= texture.depth) {\n throw new Error(`Layer ${layer} is out of range for a 2D array texture with ${texture.depth} layers.`);\n }\n texture\n .getScene()\n .getEngine()\n .updateTextureArrayLayerFromImageSource(array, source as GPUCopyExternalImageSource, layer, options?.invertY ?? false, options?.premultiplyAlpha ?? false);\n}\n\n/**\n * Babylon.js `LoadImageToTexture2DArrayLayerAsync` — fetch/decode an image URL and\n * upload it into one layer. Forwards to Lite's `loadImageToArrayLayer`.\n */\nexport async function LoadImageToTexture2DArrayLayerAsync(\n texture: RawTexture2DArray,\n url: string,\n layer: number,\n options?: IUploadImageToTexture2DArrayLayerOptions\n): Promise<void> {\n const array = liteArrayOf(texture);\n await loadImageToArrayLayer(texture.getScene().getEngine()._lite, array, layer, url, {\n invertY: options?.invertY ?? false,\n premultiplyAlpha: options?.premultiplyAlpha ?? false,\n });\n}\n\n/**\n * Babylon.js `CreateTexture2DArrayFromImageUrlsAsync` — create a texture array and\n * fill each layer from a list of image URLs. Forwards to Lite's\n * `createTexture2DArrayFromUrls`, then wraps the result in a `RawTexture2DArray`.\n *\n * Lite's per-layer upload defaults to `invertY = true` (the Babylon.js *material*\n * convention); the Babylon.js helper defaults to `false`, so the flag is always\n * passed explicitly rather than left to the Lite default.\n */\nexport async function CreateTexture2DArrayFromImageUrlsAsync(\n scene: Scene,\n urls: readonly [string, ...string[]],\n options?: ICreateTexture2DArrayFromImageUrlsOptions\n): Promise<RawTexture2DArray> {\n const liteArray = await createTexture2DArrayFromUrls(scene.getEngine()._lite, urls, {\n mipMaps: options?.generateMipMaps ?? true,\n invertY: options?.invertY ?? false,\n premultiplyAlpha: options?.premultiplyAlpha ?? false,\n });\n return RawTexture2DArray._fromLite(liteArray, Constants.TEXTUREFORMAT_RGBA, scene);\n}\n","/**\n * Canonical, stable-identity compat wrappers for the meshes a loader produces.\n *\n * Babylon.js loaders return a flat `meshes` array of real `AbstractMesh` objects\n * (with the synthetic `__root__` at index 0) that apps routinely post-process —\n * reparent, clone, toggle `isVisible`/`setEnabled`, dispose. Babylon Lite returns\n * a root-node hierarchy. We reconstruct that hierarchy as canonical compat\n * `Mesh` wrappers, then flatten the wrappers in hierarchy order so the full\n * transform / visibility / clone / dispose surface is available rather than a\n * stripped read-only handle.\n *\n * **Stable identity.** The wrappers are memoized per Lite node in a registry the\n * `AssetContainer` owns, so `container.meshes[0] === container.meshes[0]` and the\n * same handle is shared with `scene.meshes` — matching Babylon.js, where a loaded\n * mesh is a single canonical object.\n *\n * The wrappers never re-insert into the scene (the loader already added the whole\n * container) and never override the natively-loaded material (`Mesh._fromLite`\n * adopts the Lite node as-is). Bounds are reported in the node's **local**\n * geometry space (`AbstractMesh.getBoundingInfo`), matching how Babylon Lite's own\n * `createDefaultCamera` frames loaded models.\n */\n\nimport type { AssetContainer as LiteAssetContainer, Mesh as LiteMesh } from \"babylon-lite\";\n\nimport { Mesh } from \"../meshes/meshes.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\n/** @internal Per-node wrapper cache giving loaded meshes stable identity across `.meshes` reads. */\nexport type LoadedMeshRegistry = Map<unknown, Mesh>;\n\n/**\n * Wrap every node a loaded Babylon Lite asset container exposes as a canonical\n * compat `Mesh`, reusing the cached wrapper for a node when one already exists (so\n * repeated reads return identical handles). When a `scene` is supplied, each\n * wrapper is bound to it (surfaced through `scene.meshes` and given scene-aware\n * disposal).\n *\n * Babylon.js places a synthetic `__root__` transform node at `result.meshes[0]`\n * (the renderable meshes follow it). Babylon Lite builds the same root\n * (`entities[0]` for glTF) but `getContainerMeshes` returns only renderable\n * meshes, so we prepend that root at index 0 to mirror Babylon.js — as a real,\n * non-renderable `Mesh`, exactly as Babylon.js's `__root__` is a `Mesh`.\n */\nexport function collectLoadedMeshes(container: LiteAssetContainer, registry: LoadedMeshRegistry, scene?: Scene): Mesh[] {\n const result: Mesh[] = [];\n const visited = new Set<unknown>();\n const visit = (node: unknown, parent: Mesh | null): void => {\n if (visited.has(node)) {\n return;\n }\n const lite = node as { _gpu?: unknown; children?: unknown[] };\n if (!lite._gpu && !Array.isArray(lite.children)) {\n return;\n }\n visited.add(node);\n let wrapper = registry.get(node);\n if (!wrapper || (scene && wrapper.getScene() !== scene)) {\n wrapper = Mesh._fromLiteHierarchy(node as LiteMesh, container, scene, registry, parent);\n }\n result.push(wrapper);\n for (const child of lite.children ?? []) {\n visit(child, wrapper);\n }\n };\n for (const entity of container.entities) {\n visit(entity, null);\n }\n return result;\n}\n","import { clearBoneOverride, getBoneByName as getLiteBoneByName, setBonePosition, setBoneRotationQuaternion, setBoneScaling } from \"babylon-lite\";\nimport type { Bone as LiteBone, Skeleton as LiteSkeleton } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport type { Quaternion } from \"../math/quaternion.js\";\nimport type { Vector3 } from \"../math/vector.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\nexport class Skeleton {\n public readonly name!: string;\n public readonly id!: string;\n public readonly bones!: Bone[];\n\n /** @internal Underlying loader-produced Babylon Lite skeleton. */\n public readonly _lite!: LiteSkeleton;\n\n public constructor(_name?: string, _id?: string, _scene?: Scene) {\n return unsupported(\n \"Skeleton\",\n \"Babylon Lite exposes loader-produced skeletons but has no public API for manually constructing a skeleton. Load a skinned glTF and use the returned skeleton.\"\n );\n }\n\n /** @internal Wrap a loader-produced Babylon Lite skeleton. */\n public static _fromLite(lite: LiteSkeleton, index: number): Skeleton {\n const skeleton = Object.create(Skeleton.prototype) as Skeleton;\n Object.defineProperties(skeleton, {\n name: { value: `skeleton${index}`, enumerable: true },\n id: { value: `skeleton${index}`, enumerable: true },\n _lite: { value: lite },\n bones: { value: lite.bones.map((bone) => Bone._fromLite(bone, skeleton)) },\n });\n return skeleton;\n }\n\n public getBoneIndexByName(name: string): number {\n const bone = getLiteBoneByName(this._lite, name);\n return bone ? this._lite.bones.indexOf(bone) : -1;\n }\n\n public getBoneByName(name: string): Bone | null {\n const index = this.getBoneIndexByName(name);\n return index < 0 ? null : this.bones[index]!;\n }\n}\n\nexport class Bone {\n private _enabled = true;\n\n public readonly name!: string;\n\n /** @internal Underlying loader-produced Babylon Lite bone. */\n public readonly _lite!: LiteBone;\n /** @internal Owning compat skeleton. */\n public readonly _skeleton!: Skeleton;\n\n public constructor(_name?: string, _skeleton?: Skeleton) {\n return unsupported(\n \"Bone\",\n \"Babylon Lite exposes loader-produced bones but has no public API for manually constructing a bone. Use Skeleton.bones from a loaded skinned glTF.\"\n );\n }\n\n /** @internal Wrap a loader-produced Babylon Lite bone. */\n public static _fromLite(lite: LiteBone, skeleton: Skeleton): Bone {\n const bone = Object.create(Bone.prototype) as Bone;\n Object.defineProperties(bone, {\n name: { value: lite.name, enumerable: true },\n _lite: { value: lite },\n _skeleton: { value: skeleton },\n _enabled: { value: true, writable: true },\n });\n return bone;\n }\n\n public getName(): string {\n return this.name;\n }\n\n public getSkeleton(): Skeleton {\n return this._skeleton;\n }\n\n public setPosition(position: Vector3, space = 0): this {\n if (space !== 0) {\n return unsupported(\"Bone.setPosition\", \"Babylon Lite's bone-control API currently exposes local-space position overrides only.\");\n }\n setBonePosition(this._skeleton._lite, this._lite, position.x, position.y, position.z);\n return this;\n }\n\n public setRotationQuaternion(rotation: Quaternion, space = 0): this {\n if (space !== 0) {\n return unsupported(\"Bone.setRotationQuaternion\", \"Babylon Lite's bone-control API currently exposes local-space rotation overrides only.\");\n }\n setBoneRotationQuaternion(this._skeleton._lite, this._lite, rotation.x, rotation.y, rotation.z, rotation.w);\n return this;\n }\n\n public setScale(scale: Vector3): this {\n setBoneScaling(this._skeleton._lite, this._lite, scale.x, scale.y, scale.z);\n return this;\n }\n\n public setEnabled(value: boolean): void {\n this._enabled = value;\n }\n\n public isEnabled(): boolean {\n return this._enabled;\n }\n\n public returnToRest(): void {\n clearBoneOverride(this._skeleton._lite, this._lite);\n }\n}\n","import { loadSOG, loadSPZ, loadSplat } from \"babylon-lite\";\nimport type { GaussianSplattingMesh as LiteGaussianSplattingMesh, GsShaderFragment, SceneContext } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { GaussianSplattingMesh } from \"../meshes/gaussian-splatting.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { AssetContainer, ISceneLoaderProgressEvent } from \"./scene-loader.js\";\n\nexport type SPLATLoadingOptions = {\n keepInRam?: boolean;\n flipY?: boolean;\n deflateURL?: string;\n fflate?: unknown;\n disableAutoCameraLimits?: boolean;\n gaussianSplattingMesh?: GaussianSplattingMesh;\n needsRotationScaleTextures?: boolean;\n useSogTextures?: boolean;\n spzLibraryUrl?: string;\n};\n\ninterface SPLATImportResult {\n meshes: GaussianSplattingMesh[];\n particleSystems: unknown[];\n skeletons: unknown[];\n animationGroups: unknown[];\n transformNodes: unknown[];\n geometries: unknown[];\n lights: unknown[];\n spriteManagers: unknown[];\n}\n\ntype LiteSplatLoader = (scene: SceneContext, url: string, fragments?: readonly GsShaderFragment[]) => Promise<LiteGaussianSplattingMesh>;\n\nconst SPLAT_ASSET_CONTAINER_UNSUPPORTED =\n \"Lite's splat loaders attach the GPU-backed cloud directly to a scene. They do not expose a detached Gaussian-Splatting asset-container lifecycle that can preserve the BJS mesh type.\";\nconst SPLAT_STREAMING_UNSUPPORTED =\n \"PlayCanvas lod-meta.json requires Babylon.js's Gaussian-Splatting streaming residency, download scheduling, and GPU work-buffer subsystem, which Babylon Lite does not define.\";\nconst SPLAT_DIRECTORY_UNSUPPORTED =\n \"Directory SOG JSON requires a loader contract for resolving and decoding external texture resources relative to rootUrl; Lite's SOG loader accepts only self-contained archives.\";\nconst SPLAT_RELOAD_UNSUPPORTED =\n \"Lite does not expose an atomic Gaussian-Splatting replacement lifecycle that detaches the old renderable and picker while retiring its worker and GPU resources.\";\nconst SPLAT_CONCURRENT_TARGET_UNSUPPORTED = \"An unloaded GaussianSplattingMesh target can only be populated by one in-flight load.\";\n\nlet loadingTargets: WeakSet<GaussianSplattingMesh> | undefined;\n\nfunction bytesOf(data: unknown): Uint8Array {\n if (data instanceof ArrayBuffer) {\n return new Uint8Array(data);\n }\n if (ArrayBuffer.isView(data)) {\n return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n }\n return unsupported(\"SPLATFileLoader\", \"Binary .splat, .ply, .sog, and .spz inputs must be supplied as an ArrayBuffer or ArrayBufferView.\");\n}\n\nfunction loaderFor(data: unknown): LiteSplatLoader {\n if (typeof data === \"string\") {\n return unsupported(\"SPLATFileLoader\", data.includes('\"lods\"') ? SPLAT_STREAMING_UNSUPPORTED : SPLAT_DIRECTORY_UNSUPPORTED);\n }\n const bytes = bytesOf(data);\n if (bytes[0] === 0x50 && bytes[1] === 0x4b) {\n return loadSOG;\n }\n if ((bytes[0] === 0x1f && bytes[1] === 0x8b) || (bytes[0] === 0x4e && bytes[1] === 0x47 && bytes[2] === 0x53 && bytes[3] === 0x50)) {\n return loadSPZ;\n }\n return loadSplat;\n}\n\nfunction loaderForUrl(url: string): LiteSplatLoader {\n const path = url.split(/[?#]/)[0]!.toLowerCase();\n if (path.endsWith(\".json\")) {\n return unsupported(\"SPLATFileLoader\", SPLAT_STREAMING_UNSUPPORTED);\n }\n if (path.endsWith(\".sog\")) {\n return loadSOG;\n }\n if (path.endsWith(\".spz\")) {\n return loadSPZ;\n }\n return loadSplat;\n}\n\nfunction binaryData(data: unknown): BlobPart {\n return new Uint8Array(bytesOf(data)).buffer;\n}\n\nfunction validateOptions(options: Readonly<SPLATLoadingOptions>): void {\n if (options.flipY === true) {\n unsupported(\"SPLATLoadingOptions.flipY\", \"Lite's native splat parsers own their format-specific orientation conversion and do not expose a parser-level flipY override.\");\n }\n if (options.deflateURL !== undefined || options.fflate !== undefined) {\n unsupported(\"SPLATLoadingOptions.fflate\", \"Lite owns its SOG decompressor and does not expose Babylon.js's replaceable fflate loading policy.\");\n }\n if (options.needsRotationScaleTextures) {\n unsupported(\n \"SPLATLoadingOptions.needsRotationScaleTextures\",\n \"Voxel IBL-shadow rotation/scale textures require Babylon.js's Gaussian-Splatting IBL shadow subsystem, which Babylon Lite does not define.\"\n );\n }\n if (options.useSogTextures) {\n unsupported(\n \"SPLATLoadingOptions.useSogTextures\",\n \"Lite's SOG loader uses its native CPU decode path and does not expose Babylon.js's raw-texture dequantization pipeline.\"\n );\n }\n if (options.spzLibraryUrl !== undefined) {\n unsupported(\"SPLATLoadingOptions.spzLibraryUrl\", \"Lite owns its SPZ decoder and does not expose a replaceable WASM-library URL policy.\");\n }\n}\n\nexport class SPLATFileLoader {\n public readonly name = \"splat\";\n public readonly extensions = {\n \".splat\": { isBinary: true },\n \".ply\": { isBinary: true },\n \".spz\": { isBinary: true },\n \".json\": { isBinary: false },\n \".sog\": { isBinary: true },\n } as const;\n\n private readonly _loadingOptions: Readonly<SPLATLoadingOptions>;\n\n public constructor(loadingOptions: Partial<Readonly<SPLATLoadingOptions>> = {}) {\n this._loadingOptions = { ...loadingOptions };\n validateOptions(this._loadingOptions);\n }\n\n public createPlugin(options: { splat?: Partial<Readonly<SPLATLoadingOptions>> }): SPLATFileLoader {\n return new SPLATFileLoader(options.splat);\n }\n\n public async importMeshAsync(\n _meshesNames: unknown,\n scene: Scene,\n data: unknown,\n _rootUrl: string,\n _onProgress?: (event: ISceneLoaderProgressEvent) => void,\n _fileName?: string\n ): Promise<SPLATImportResult> {\n const mesh = await this._load(scene, data);\n return {\n meshes: [mesh],\n particleSystems: [],\n skeletons: [],\n animationGroups: [],\n transformNodes: [],\n geometries: [],\n lights: [],\n spriteManagers: [],\n };\n }\n\n public async loadAsync(scene: Scene, data: unknown, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void> {\n await this.importMeshAsync(null, scene, data, rootUrl, onProgress, fileName);\n }\n\n public loadAssetContainerAsync(_scene: Scene, _data: string, _rootUrl: string): Promise<AssetContainer> {\n return unsupported(\"SPLATFileLoader.loadAssetContainerAsync\", SPLAT_ASSET_CONTAINER_UNSUPPORTED);\n }\n\n /** @internal Load a URL through Lite while preserving this plugin's Babylon.js options. */\n public async _loadUrlAsync(scene: Scene, url: string): Promise<GaussianSplattingMesh> {\n return this._loadReserved(scene, () => loaderForUrl(url)(scene._lite, url));\n }\n\n private async _load(scene: Scene, data: unknown): Promise<GaussianSplattingMesh> {\n return this._loadReserved(scene, async () => {\n const loader = loaderFor(data);\n const url = URL.createObjectURL(new Blob([binaryData(data)]));\n try {\n return await loader(scene._lite, url);\n } finally {\n URL.revokeObjectURL(url);\n }\n });\n }\n\n private async _loadReserved(scene: Scene, load: () => Promise<LiteGaussianSplattingMesh>): Promise<GaussianSplattingMesh> {\n const target = this._loadingOptions.gaussianSplattingMesh;\n if (target?._pickLiteNode) {\n unsupported(\"SPLATLoadingOptions.gaussianSplattingMesh\", SPLAT_RELOAD_UNSUPPORTED);\n }\n if (target) {\n loadingTargets ??= new WeakSet();\n if (loadingTargets.has(target)) {\n unsupported(\"SPLATLoadingOptions.gaussianSplattingMesh\", SPLAT_CONCURRENT_TARGET_UNSUPPORTED);\n }\n loadingTargets.add(target);\n }\n try {\n return this._adoptLoaded(scene, await load());\n } finally {\n if (target) {\n loadingTargets?.delete(target);\n }\n }\n }\n\n private _adoptLoaded(scene: Scene, lite: LiteGaussianSplattingMesh): GaussianSplattingMesh {\n const target = this._loadingOptions.gaussianSplattingMesh;\n if (target) {\n target._adopt(lite);\n return target;\n }\n lite.name = \"GaussianSplatting\";\n return GaussianSplattingMesh._fromLite(lite, scene);\n }\n}\n\nexport function RegisterSPLATFileLoader(): void {}\n","import type { LoadUsdOptions, UsdDiagnostics, UsdProgress } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\n\nexport type USDBinaryInput = ArrayBuffer | ArrayBufferView;\nexport type USDVirtualFiles = Readonly<Record<string, USDBinaryInput>>;\nexport type USDLoadProgress = Omit<UsdProgress, \"phase\"> & {\n phase: Exclude<UsdProgress[\"phase\"], \"fetching\">;\n};\nexport type USDImportTimings = UsdDiagnostics[\"timings\"];\nexport type USDImportStatistics = UsdDiagnostics[\"statistics\"];\nexport type USDImportDiagnostics = UsdDiagnostics;\n\nexport interface USDFileLoaderOptions {\n rootFileName?: string;\n files?: USDVirtualFiles;\n resolveByFileName?: boolean;\n workerUrl?: string | URL;\n glueUrl?: string;\n wasmUrl?: string;\n dataUrl?: string;\n onProgress?: (progress: USDLoadProgress) => void;\n onLog?: (level: \"info\" | \"warning\" | \"error\", message: string) => void;\n onComplete?: (diagnostics: USDImportDiagnostics) => void;\n}\n\nexport const USD_RUNTIME_BASE_URL = \"https://cdn.babylonjs.com/babylonUsdImporter/5/\";\nexport const USD_RUNTIME_NAMES = {\n workerUrl: \"babylon-usd-importer.worker.js\",\n glueUrl: \"babylon-usd-importer.js\",\n wasmUrl: \"babylon-usd-importer.wasm\",\n dataUrl: \"babylon-usd-importer.data\",\n} as const;\n\nexport type USDDefaultConfiguration = Required<Pick<USDFileLoaderOptions, \"workerUrl\" | \"glueUrl\" | \"wasmUrl\" | \"dataUrl\">>;\n\nlet defaultConfiguration: USDDefaultConfiguration | undefined;\n\nexport function getUsdDefaultConfiguration(): USDDefaultConfiguration {\n return (defaultConfiguration ??= {\n glueUrl: `${USD_RUNTIME_BASE_URL}${USD_RUNTIME_NAMES.glueUrl}`,\n wasmUrl: `${USD_RUNTIME_BASE_URL}${USD_RUNTIME_NAMES.wasmUrl}`,\n dataUrl: `${USD_RUNTIME_BASE_URL}${USD_RUNTIME_NAMES.dataUrl}`,\n workerUrl: `${USD_RUNTIME_BASE_URL}${USD_RUNTIME_NAMES.workerUrl}`,\n });\n}\n\nexport function setUsdDefaultConfiguration(configuration: USDDefaultConfiguration): void {\n defaultConfiguration = configuration;\n}\n\ninterface SceneLoaderProgressEvent {\n lengthComputable: boolean;\n loaded: number;\n total: number;\n}\n\nexport function resolveUsdOptions(options: Partial<USDFileLoaderOptions>): USDFileLoaderOptions {\n const runtimeKeys = Object.keys(USD_RUNTIME_NAMES) as Array<keyof typeof USD_RUNTIME_NAMES>;\n const configured = runtimeKeys.filter((key) => options[key] !== undefined);\n if (configured.length !== 0 && configured.length !== 4) {\n unsupported(\n \"USDFileLoaderOptions runtime URLs\",\n \"Babylon Lite loads the OpenUSD worker, glue, WASM, and data files from one runtime directory. Babylon.js runtime URL overrides can be adapted only when all four standard files are configured together.\"\n );\n }\n const defaults = getUsdDefaultConfiguration();\n return {\n ...defaults,\n ...options,\n workerUrl: options.workerUrl ?? defaults.workerUrl,\n glueUrl: options.glueUrl ?? defaults.glueUrl,\n wasmUrl: options.wasmUrl ?? defaults.wasmUrl,\n dataUrl: options.dataUrl ?? defaults.dataUrl,\n };\n}\n\nexport function toLiteUsdOptions(options: Partial<USDFileLoaderOptions>, signal?: AbortSignal, onProgress?: (event: SceneLoaderProgressEvent) => void): LoadUsdOptions {\n const configured = (Object.keys(USD_RUNTIME_NAMES) as Array<keyof typeof USD_RUNTIME_NAMES>).filter((key) => options[key] !== undefined);\n\n let runtimeBaseUrl: string | undefined;\n for (const key of configured) {\n const url = new URL(String(options[key]), globalThis.location?.href ?? \"http://localhost/\");\n if (url.search || url.hash) {\n unsupported(\n `USDFileLoaderOptions.${key}`,\n \"Babylon Lite reconstructs OpenUSD runtime file URLs from one directory and cannot preserve per-file query strings or hash fragments.\"\n );\n }\n if (!url.pathname.endsWith(`/${USD_RUNTIME_NAMES[key]}`)) {\n unsupported(\n `USDFileLoaderOptions.${key}`,\n `Babylon Lite loads the four OpenUSD runtime files from one directory using their standard names; '${USD_RUNTIME_NAMES[key]}' is required.`\n );\n }\n const candidate = new URL(\".\", url).href;\n if (runtimeBaseUrl !== undefined && candidate !== runtimeBaseUrl) {\n unsupported(\n \"USDFileLoaderOptions runtime URLs\",\n \"Babylon Lite loads the OpenUSD worker, glue, WASM, and data files from one runtime directory; independently located runtime files cannot be adapted.\"\n );\n }\n runtimeBaseUrl = candidate;\n }\n\n return {\n rootFileName: options.rootFileName,\n files: options.files,\n resolveByFileName: options.resolveByFileName ?? true,\n runtimeBaseUrl,\n signal,\n onProgress: (progress) => {\n if (progress.phase !== \"fetching\") {\n options.onProgress?.({ phase: progress.phase, message: progress.message });\n }\n const loaded = progress.phase === \"fetching\" ? 0 : progress.phase === \"initializing\" ? 1 : progress.phase === \"staging\" ? 2 : progress.phase === \"extracting\" ? 3 : 4;\n onProgress?.({ lengthComputable: false, loaded, total: 4 });\n },\n onLog: options.onLog,\n };\n}\n","/**\n * Babylon.js-compatible `SceneLoader` and `AssetContainer` over Babylon Lite's\n * `loadGltf` / `loadBabylon`.\n *\n * Coverage note: the Lite asset container exposes a root-node hierarchy plus\n * animation groups rather than the flat `meshes` array Babylon.js returns. This\n * compat layer surfaces the underlying container (`_lite`) and the animation\n * groups, and registers everything through `addToScene`. A fully BJS-shaped flat\n * mesh list is not reconstructed in this initial pass.\n */\n\nimport { addToScene, enableBoneControlForSkinnedAssets, loadGltf, loadBabylon, loadUsd, disposeUsd, removeFromScene, setParent as setLiteParent } from \"babylon-lite\";\nimport type { AssetContainer as LiteAssetContainer, AnimationGroup, Mesh as LiteMesh } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { collectLoadedMeshes, type LoadedMeshRegistry } from \"./loaded-mesh.js\";\nimport type { Mesh, TransformNode } from \"../meshes/meshes.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport { Skeleton } from \"../bones/skeleton.js\";\nimport type { USDFileLoaderOptions } from \"./usd-file-loader.js\";\nimport { SPLATFileLoader, type SPLATLoadingOptions } from \"./splat-file-loader.js\";\nimport { resolveUsdOptions, toLiteUsdOptions } from \"./usd-options.js\";\n\n/**\n * Babylon.js registers built-in loader factories through a global plugin\n * registry. Compat dispatches its supported formats directly, so registration\n * is already complete and this compatibility hook is intentionally idempotent.\n */\nexport function registerBuiltInLoaders(): void {}\n\n/** Path portion of a URL, without any query string (`?…`) or hash fragment (`#…`). */\nfunction urlPath(url: string): string {\n return url.split(/[?#]/)[0]!;\n}\n\n/** Splat asset extensions Babylon Lite can parse (`loadSplat` / `loadSOG` / `loadSPZ`). */\nfunction isSplatUrl(url: string): boolean {\n const u = urlPath(url).toLowerCase();\n return u.endsWith(\".ply\") || u.endsWith(\".splat\") || u.endsWith(\".sog\") || u.endsWith(\".spz\") || u.endsWith(\".json\");\n}\n\n/** True when a URL points at a `.babylon` file, ignoring any query string or hash. */\nfunction isBabylonUrl(url: string): boolean {\n return urlPath(url).toLowerCase().endsWith(\".babylon\");\n}\n\nfunction isUsdUrl(url: string): boolean {\n return /\\.(?:usd|usda|usdc|usdz)$/i.test(urlPath(url));\n}\n\nexport class AssetContainer {\n /** @internal Underlying Babylon Lite asset container. */\n public readonly _lite: LiteAssetContainer;\n\n /** @internal Canonical loaded-mesh wrappers, cached per Lite node for stable identity. */\n private readonly _meshRegistry: LoadedMeshRegistry = new Map();\n /** @internal The compat scene this container was added to, if any (drives scene-aware wrappers). */\n private _scene: Scene | undefined;\n /** @internal Canonical loaded-skeleton wrappers. */\n private _skeletons: Skeleton[] | undefined;\n\n private readonly _dispose: (() => void) | undefined;\n /** @internal Original USD mesh ownership, independent of later hierarchy changes. */\n private readonly _ownedMeshes: readonly LiteMesh[] | undefined;\n private _sceneDisposeObserver: ((scene: Scene) => void) | undefined;\n private _disposed = false;\n\n public constructor(lite: LiteAssetContainer, dispose?: () => void, ownedMeshes?: readonly LiteMesh[]) {\n this._lite = lite;\n this._dispose = dispose;\n this._ownedMeshes = ownedMeshes ? [...ownedMeshes] : undefined;\n }\n\n public get animationGroups(): AnimationGroup[] {\n return this._lite.animationGroups ?? [];\n }\n\n /**\n * Flat list of the loaded meshes as canonical, stable-identity compat `Mesh`\n * handles (`__root__` at index 0, matching Babylon.js). Repeated reads return\n * the same wrapper objects, and — once the container is added to a scene — the\n * same handles `scene.meshes` exposes.\n */\n public get meshes(): Mesh[] {\n if (this._disposed) {\n return [...this._meshRegistry.values()];\n }\n return collectLoadedMeshes(this._lite, this._meshRegistry, this._scene);\n }\n\n public get skeletons(): Skeleton[] {\n return (this._skeletons ??= (this._lite.skeletons ?? []).map((skeleton, index) => Skeleton._fromLite(skeleton, index)));\n }\n\n /** Add every entity, animation group, camera, and clear colour to the scene. */\n public addAllToScene(scene: Scene): void {\n addToScene(scene._lite, this._lite);\n this._adoptScene(scene);\n }\n\n /** @internal Associate an already-added Lite container with its compat scene. */\n public _adoptScene(scene: Scene): void {\n if (this._sceneDisposeObserver && this._scene && this._scene !== scene) {\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\n this._sceneDisposeObserver = undefined;\n }\n this._scene = scene;\n if (this._dispose && !this._sceneDisposeObserver) {\n this._sceneDisposeObserver = scene.onDisposeObservable.addOnce(() => {\n this._scene = undefined;\n this._sceneDisposeObserver = undefined;\n this._detachFromScene(scene);\n });\n }\n // Build/bind the canonical wrappers now that the container belongs to a\n // scene, so `scene.meshes` lists the loaded meshes and later\n // `container.meshes` reads share the same scene-aware handles.\n collectLoadedMeshes(this._lite, this._meshRegistry, scene);\n scene._surfaceLoadedCamera();\n }\n\n public dispose(): void {\n const scene = this._scene;\n if (scene && this._sceneDisposeObserver) {\n scene.onDisposeObservable.remove(this._sceneDisposeObserver);\n this._sceneDisposeObserver = undefined;\n }\n this._scene = undefined;\n if (scene) {\n this._detachFromScene(scene);\n } else {\n try {\n this._retireMeshWrappers();\n } finally {\n this._disposeOnce();\n }\n }\n }\n\n private _detachFromScene(scene: Scene): void {\n try {\n if (this._ownedMeshes) {\n for (const mesh of this._ownedMeshes) {\n setLiteParent(mesh, null);\n }\n }\n removeFromScene(scene._lite, this._lite);\n if (this._ownedMeshes) {\n for (const mesh of this._ownedMeshes) {\n removeFromScene(scene._lite, mesh);\n }\n }\n } finally {\n try {\n this._retireMeshWrappers();\n } finally {\n this._disposeOnce();\n }\n }\n }\n\n private _retireMeshWrappers(): void {\n let hasError = false;\n let firstError: unknown;\n for (const wrapper of this._meshRegistry.values()) {\n try {\n wrapper._disposeWrapperOnly();\n } catch (error) {\n if (!hasError) {\n hasError = true;\n firstError = error;\n }\n }\n }\n if (hasError) {\n throw firstError;\n }\n }\n\n private _disposeOnce(): void {\n if (!this._disposed) {\n this._disposed = true;\n this._dispose?.();\n }\n }\n}\n\ninterface ImportResult {\n meshes: TransformNode[];\n particleSystems: unknown[];\n skeletons: Skeleton[];\n animationGroups: AnimationGroup[];\n transformNodes: unknown[];\n lights: unknown[];\n /** The underlying Lite asset container (compat extension; absent for splat assets). */\n container?: AssetContainer;\n}\n\nexport interface ISceneLoaderProgressEvent {\n lengthComputable: boolean;\n loaded: number;\n total: number;\n}\n\nexport interface ISceneLoaderOptions {\n rootUrl?: string;\n onProgress?: (event: ISceneLoaderProgressEvent) => void;\n pluginExtension?: string;\n name?: string;\n pluginOptions?: Record<string, unknown> & {\n gltf?: {\n preprocessUrlAsync?: (url: string) => Promise<string>;\n [option: string]: unknown;\n };\n splat?: Partial<Readonly<SPLATLoadingOptions>>;\n usd?: Partial<USDFileLoaderOptions>;\n };\n}\n\nexport interface ImportMeshOptions extends ISceneLoaderOptions {\n meshNames?: string | readonly string[] | null;\n}\n\nexport interface AppendOptions extends ISceneLoaderOptions {}\n\nexport interface LoadAssetContainerOptions extends ISceneLoaderOptions {}\n\nfunction validateGltfOptions(source: string, options: ISceneLoaderOptions | undefined): void {\n if (!isBabylonUrl(source) && !isSplatUrl(source) && options?.pluginOptions?.gltf?.preprocessUrlAsync) {\n unsupported(\n \"ISceneLoaderOptions.pluginOptions.gltf.preprocessUrlAsync\",\n \"Supporting per-resource URL preprocessing requires a loader-wide callback/context contract across Lite's core glTF loader and lazy extension modules, which cannot be added as an independent tree-shakeable export.\"\n );\n }\n}\n\n/** @internal Load a splat URL into a `GaussianSplattingMesh` (shared by every loader entry point). */\nasync function loadSplatResult(url: string, scene: Scene, options?: Partial<Readonly<SPLATLoadingOptions>>): Promise<ImportResult> {\n const gs = await new SPLATFileLoader(options)._loadUrlAsync(scene, url);\n return { meshes: [gs], particleSystems: [], skeletons: [], animationGroups: [], transformNodes: [], lights: [] };\n}\n\nfunction joinUrl(rootUrl: string, fileName: string): string {\n if (!fileName) {\n return rootUrl;\n }\n if (/^(https?:)?\\/\\//.test(fileName) || fileName.startsWith(\"/\")) {\n return fileName;\n }\n return rootUrl.endsWith(\"/\") || rootUrl === \"\" ? rootUrl + fileName : rootUrl + \"/\" + fileName;\n}\n\nasync function load(rootUrl: string, fileName: string, scene: Scene, usdOptions?: Partial<USDFileLoaderOptions>): Promise<AssetContainer> {\n const url = joinUrl(rootUrl, fileName);\n const engine = scene.getEngine()._lite;\n // Detect the format from the path (ignoring query/hash), but hand the full URL\n // to the loader so any query string is preserved.\n if (!isBabylonUrl(url) && !isUsdUrl(url)) {\n enableBoneControlForSkinnedAssets();\n }\n if (isUsdUrl(url)) {\n return loadUsdContainer(engine, url, usdOptions);\n }\n const lite = isBabylonUrl(url) ? await loadBabylon(engine, url) : await loadGltf(engine, url);\n return new AssetContainer(lite);\n}\n\n/** Babylon.js `SceneLoader` — async glTF/.babylon loading into a compat scene. */\nexport const SceneLoader = {\n /** Import meshes (and the rest of the asset) into the scene. */\n async ImportMeshAsync(_meshNames: unknown, rootUrl: string, sceneFilename: string, scene: Scene): Promise<ImportResult> {\n const url = joinUrl(rootUrl, sceneFilename);\n if (isSplatUrl(url)) {\n return loadSplatResult(url, scene);\n }\n const container = await load(rootUrl, sceneFilename, scene);\n container.addAllToScene(scene);\n return {\n meshes: container.meshes,\n particleSystems: [],\n skeletons: container.skeletons,\n animationGroups: container.animationGroups,\n transformNodes: [],\n lights: [],\n container,\n };\n },\n\n /** Append an asset's contents to the scene. */\n async AppendAsync(rootUrl: string, sceneFilename: string, scene: Scene): Promise<Scene> {\n const url = joinUrl(rootUrl, sceneFilename);\n if (isSplatUrl(url)) {\n await loadSplatResult(url, scene);\n return scene;\n }\n const container = await load(rootUrl, sceneFilename, scene);\n container.addAllToScene(scene);\n return scene;\n },\n\n /** Load an asset into a container without adding it to the scene. */\n async LoadAssetContainerAsync(rootUrl: string, sceneFilename: string, scene: Scene): Promise<AssetContainer> {\n if (isSplatUrl(joinUrl(rootUrl, sceneFilename))) {\n return new SPLATFileLoader().loadAssetContainerAsync(scene, \"\", rootUrl);\n }\n return load(rootUrl, sceneFilename, scene);\n },\n\n /** Plugin registration — out of scope (side-effectful global registry). */\n RegisterPlugin(): never {\n return unsupported(\n \"SceneLoader.RegisterPlugin\",\n \"Loader plugin registration is out of scope for the compat layer (it relies on a side-effectful global registry). Import the loader you need directly.\"\n );\n },\n};\n\n// ── Function-style loaders (Babylon.js 7+ `@babylonjs/core/Loading/sceneLoader`) ──\n\n/** Babylon.js `ImportMeshAsync(source, scene, options?)` — imports an asset into the scene. */\nexport async function ImportMeshAsync(source: string, scene: Scene, options?: ImportMeshOptions): Promise<ImportResult> {\n const url = joinUrl(options?.rootUrl ?? \"\", source);\n if (isSplatUrl(url)) {\n return loadSplatResult(url, scene, options?.pluginOptions?.splat);\n }\n validateGltfOptions(url, options);\n const container = await loadFromSource(url, scene, options?.pluginOptions?.usd, options?.onProgress);\n container.addAllToScene(scene);\n return {\n meshes: container.meshes,\n particleSystems: [],\n skeletons: container.skeletons,\n animationGroups: container.animationGroups,\n transformNodes: [],\n lights: [],\n container,\n };\n}\n\n/** Babylon.js `AppendSceneAsync(source, scene, options?)` — appends an asset's contents to the scene. */\nexport async function AppendSceneAsync(source: string, scene: Scene, options?: AppendOptions): Promise<Scene> {\n const url = joinUrl(options?.rootUrl ?? \"\", source);\n if (isSplatUrl(url)) {\n await loadSplatResult(url, scene, options?.pluginOptions?.splat);\n return scene;\n }\n validateGltfOptions(url, options);\n const container = await loadFromSource(url, scene, options?.pluginOptions?.usd, options?.onProgress);\n container.addAllToScene(scene);\n return scene;\n}\n\n/** Babylon.js `LoadAssetContainerAsync(source, scene, options?)` — loads into a container without adding. */\nexport async function LoadAssetContainerAsync(source: string, scene: Scene, options?: LoadAssetContainerOptions): Promise<AssetContainer> {\n const url = joinUrl(options?.rootUrl ?? \"\", source);\n if (isSplatUrl(url)) {\n return new SPLATFileLoader(options?.pluginOptions?.splat).loadAssetContainerAsync(scene, \"\", options?.rootUrl ?? \"\");\n }\n validateGltfOptions(url, options);\n return loadFromSource(url, scene, options?.pluginOptions?.usd, options?.onProgress);\n}\n\n/** @internal Load a glTF/.babylon asset from a single source URL (function-loader form). */\nasync function loadFromSource(\n source: string,\n scene: Scene,\n usdOptions?: Partial<USDFileLoaderOptions>,\n onProgress?: (event: ISceneLoaderProgressEvent) => void\n): Promise<AssetContainer> {\n const engine = scene.getEngine()._lite;\n // Detect the format from the path (ignoring query/hash), but pass the full URL\n // to the loader so any query string is preserved.\n if (!isBabylonUrl(source) && !isUsdUrl(source)) {\n enableBoneControlForSkinnedAssets();\n }\n if (isUsdUrl(source)) {\n return loadUsdContainer(engine, source, usdOptions, onProgress);\n }\n const lite = isBabylonUrl(source) ? await loadBabylon(engine, source) : await loadGltf(engine, source);\n return new AssetContainer(lite);\n}\n\nasync function loadUsdContainer(\n engine: Parameters<typeof loadUsd>[0],\n source: string,\n options: Partial<USDFileLoaderOptions> = {},\n onProgress?: (event: ISceneLoaderProgressEvent) => void\n): Promise<AssetContainer> {\n const lite = await loadUsd(engine, source, toLiteUsdOptions(resolveUsdOptions(options), undefined, onProgress));\n const container = new AssetContainer(lite, () => disposeUsd(lite), lite._usdMeshes);\n try {\n options.onComplete?.(lite.diagnostics);\n return container;\n } catch (error) {\n container.dispose();\n throw error;\n }\n}\n","/**\n * Babylon.js-compatible `AssetsManager` — a pure task scheduler built on top of\n * the compat loaders. The scheduling/observable surface has no Babylon Lite or\n * GPU dependency and is fully unit-testable; the concrete mesh/texture task types\n * delegate to the compat loaders.\n */\n\nimport { Observable } from \"../misc/observable.js\";\n\nexport type TaskState = \"init\" | \"running\" | \"done\" | \"error\";\n\n/** Base class for an asset-loading task. Subclasses implement {@link runAsync}. */\nexport abstract class AbstractAssetTask {\n public name: string;\n public state: TaskState = \"init\";\n public errorObject: { message: string; exception?: unknown } | undefined;\n\n public onSuccess?: (task: this) => void;\n public onError?: (task: this, message?: string, exception?: unknown) => void;\n\n public constructor(name: string) {\n this.name = name;\n }\n\n public get isCompleted(): boolean {\n return this.state === \"done\";\n }\n\n /** Run the task. Subclasses populate their result fields here. */\n public abstract runAsync(): Promise<void>;\n\n /** @internal Run with success/error bookkeeping. */\n public async _run(): Promise<void> {\n this.state = \"running\";\n try {\n await this.runAsync();\n this.state = \"done\";\n this.onSuccess?.(this);\n } catch (exception) {\n this.state = \"error\";\n const message = exception instanceof Error ? exception.message : String(exception);\n this.errorObject = { message, exception };\n this.onError?.(this, message, exception);\n throw exception;\n }\n }\n}\n\n/** A task whose work is provided as a plain async function (useful for custom assets and tests). */\nexport class CustomAssetTask<T> extends AbstractAssetTask {\n public result: T | undefined;\n\n public constructor(\n name: string,\n private readonly _loader: () => Promise<T>\n ) {\n super(name);\n }\n\n public override async runAsync(): Promise<void> {\n this.result = await this._loader();\n }\n}\n\nexport class AssetsManager {\n public readonly onProgressObservable = new Observable<{ remainingCount: number; totalCount: number; task: AbstractAssetTask }>();\n public readonly onTaskSuccessObservable = new Observable<AbstractAssetTask>();\n public readonly onTaskErrorObservable = new Observable<AbstractAssetTask>();\n public readonly onFinishObservable = new Observable<AbstractAssetTask[]>();\n\n // Kept for Babylon.js API parity only. The compat AssetsManager has no\n // loading-screen UI, and `loadAsync` never rejects on task failure (per-task\n // errors surface via `onTaskErrorObservable`), so neither flag affects\n // loading behavior.\n public useDefaultLoadingScreen = false;\n public autoHideLoadingUI = false;\n\n private readonly _tasks: AbstractAssetTask[] = [];\n private _isLoading = false;\n\n public get tasks(): readonly AbstractAssetTask[] {\n return this._tasks;\n }\n\n public addTask<T extends AbstractAssetTask>(task: T): T {\n this._tasks.push(task);\n return task;\n }\n\n /** Add a custom async task and return it (handy for non-mesh/texture assets and tests). */\n public addCustomTask<T>(name: string, loader: () => Promise<T>): CustomAssetTask<T> {\n return this.addTask(new CustomAssetTask<T>(name, loader));\n }\n\n public reset(): this {\n this._tasks.length = 0;\n return this;\n }\n\n /** Run all queued tasks sequentially, emitting progress, and resolve when done. */\n public async loadAsync(): Promise<AbstractAssetTask[]> {\n if (this._isLoading) {\n throw new Error(\"AssetsManager is already loading.\");\n }\n this._isLoading = true;\n const total = this._tasks.length;\n const completed: AbstractAssetTask[] = [];\n\n try {\n for (const task of this._tasks) {\n try {\n await task._run();\n this.onTaskSuccessObservable.notifyObservers(task);\n } catch {\n this.onTaskErrorObservable.notifyObservers(task);\n }\n completed.push(task);\n this.onProgressObservable.notifyObservers({ remainingCount: total - completed.length, totalCount: total, task });\n }\n this.onFinishObservable.notifyObservers(this._tasks.slice());\n return completed;\n } finally {\n this._isLoading = false;\n }\n }\n}\n","/**\n * Babylon.js `KHR_materials_variants` glTF loader extension\n * (`@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_variants`).\n *\n * Babylon.js exposes the extension's static helpers to switch a loaded asset\n * between material variants at runtime. Babylon Lite decodes the same extension\n * in its glTF loader and exposes `selectVariant` / `getVariantNames` /\n * `resetVariant` keyed by the asset container. The Babylon.js helpers are keyed\n * by the asset's **root mesh** instead, so this wrapper recovers the container\n * from the `LoadedMesh` the loader returned (`result.meshes[0]`) and delegates.\n */\n\nimport { selectVariant, getVariantNames, resetVariant } from \"babylon-lite\";\nimport type { AssetContainer as LiteAssetContainer } from \"babylon-lite\";\n\n/** Recover the Lite asset container a loaded-mesh handle came from. */\nfunction containerOf(rootMesh: unknown): LiteAssetContainer | undefined {\n return (rootMesh as { _container?: LiteAssetContainer } | null)?._container;\n}\n\n/**\n * Babylon.js `KHR_materials_variants` extension helpers. Mirrors the static\n * surface ported code calls (`SelectVariant` / `GetAvailableVariants` / `Reset`)\n * over Babylon Lite's container-keyed variant API.\n */\nexport const KHR_materials_variants = {\n /** Switch the loaded asset to the named material variant. */\n SelectVariant(rootMesh: unknown, variantName: string): void {\n const container = containerOf(rootMesh);\n if (container) {\n selectVariant(container, variantName);\n }\n },\n\n /** The variant names available on the loaded asset (empty when it has none). */\n GetAvailableVariants(rootMesh: unknown): readonly string[] {\n const container = containerOf(rootMesh);\n return container ? getVariantNames(container) : [];\n },\n\n /** Restore the asset's default (variant-free) materials. */\n Reset(rootMesh: unknown): void {\n const container = containerOf(rootMesh);\n if (container) {\n resetVariant(container);\n }\n },\n};\n","import { addToScene, disposeUsd, loadUsd } from \"babylon-lite\";\nimport type { AnimationGroup, UsdBinaryInput } from \"babylon-lite\";\n\nimport type { Mesh } from \"../meshes/meshes.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { Skeleton } from \"../bones/skeleton.js\";\nimport { AssetContainer, type ISceneLoaderProgressEvent } from \"./scene-loader.js\";\nimport { getUsdDefaultConfiguration, resolveUsdOptions, setUsdDefaultConfiguration, toLiteUsdOptions } from \"./usd-options.js\";\nimport type { USDFileLoaderOptions } from \"./usd-options.js\";\nexport type { USDBinaryInput, USDVirtualFiles, USDLoadProgress, USDImportTimings, USDImportStatistics, USDImportDiagnostics, USDFileLoaderOptions } from \"./usd-options.js\";\n\nfunction requireBinary(data: unknown): UsdBinaryInput {\n if (!(data instanceof ArrayBuffer) && !ArrayBuffer.isView(data)) {\n throw new Error(\"USDFileLoader expects binary USD data.\");\n }\n return data;\n}\n\ninterface USDImportResult {\n meshes: Mesh[];\n particleSystems: unknown[];\n skeletons: Skeleton[];\n animationGroups: AnimationGroup[];\n transformNodes: unknown[];\n lights: unknown[];\n}\n\nexport class USDFileLoader {\n public static get DefaultConfiguration(): Required<Pick<USDFileLoaderOptions, \"workerUrl\" | \"glueUrl\" | \"wasmUrl\" | \"dataUrl\">> {\n return getUsdDefaultConfiguration();\n }\n\n public static set DefaultConfiguration(configuration: Required<Pick<USDFileLoaderOptions, \"workerUrl\" | \"glueUrl\" | \"wasmUrl\" | \"dataUrl\">>) {\n setUsdDefaultConfiguration(configuration);\n }\n\n public readonly name = \"usd\";\n public readonly extensions = {\n \".usd\": { isBinary: true },\n \".usda\": { isBinary: true },\n \".usdc\": { isBinary: true },\n \".usdz\": { isBinary: true },\n } as const;\n\n private readonly _options: USDFileLoaderOptions;\n private readonly _activeLoads = new Set<AbortController>();\n\n public constructor(options: Partial<USDFileLoaderOptions> = {}) {\n this._options = { ...getUsdDefaultConfiguration(), ...options };\n }\n\n public createPlugin(options: { usd?: Partial<USDFileLoaderOptions> }): USDFileLoader {\n return new USDFileLoader(options.usd);\n }\n\n public async importMeshAsync(\n _meshNames: string | readonly string[] | null | undefined,\n scene: Scene,\n data: unknown,\n _rootUrl: string,\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\n fileName?: string\n ): Promise<USDImportResult> {\n const container = await this._load(scene, data, onProgress, fileName, true);\n return {\n meshes: container.meshes,\n particleSystems: [],\n skeletons: container.skeletons,\n animationGroups: container.animationGroups,\n transformNodes: [],\n lights: [],\n };\n }\n\n public async loadAsync(scene: Scene, data: unknown, _rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, fileName?: string): Promise<void> {\n await this._load(scene, data, onProgress, fileName, true);\n }\n\n public async loadAssetContainerAsync(\n scene: Scene,\n data: unknown,\n _rootUrl: string,\n onProgress?: (event: ISceneLoaderProgressEvent) => void,\n fileName?: string\n ): Promise<AssetContainer> {\n return this._load(scene, data, onProgress, fileName, false);\n }\n\n public dispose(): void {\n const error = new Error(\"USDFileLoader was disposed.\");\n for (const controller of this._activeLoads) {\n controller.abort(error);\n }\n this._activeLoads.clear();\n }\n\n private async _load(\n scene: Scene,\n data: unknown,\n onProgress: ((event: ISceneLoaderProgressEvent) => void) | undefined,\n fileName: string | undefined,\n add: boolean\n ): Promise<AssetContainer> {\n const controller = new AbortController();\n this._activeLoads.add(controller);\n try {\n const lite = await loadUsd(\n scene.getEngine()._lite,\n requireBinary(data),\n toLiteUsdOptions(resolveUsdOptions({ ...this._options, rootFileName: this._options.rootFileName ?? fileName }), controller.signal, onProgress)\n );\n const container = new AssetContainer(lite, () => disposeUsd(lite), lite._usdMeshes);\n try {\n controller.signal.throwIfAborted();\n if (add) {\n addToScene(scene._lite, lite);\n container._adoptScene(scene);\n }\n this._options.onComplete?.(lite.diagnostics);\n controller.signal.throwIfAborted();\n return container;\n } catch (error) {\n container.dispose();\n throw error;\n }\n } finally {\n this._activeLoads.delete(controller);\n }\n }\n}\n\nexport function RegisterUSDFileLoader(): void {}\n\n/** @internal Babylon.js pure-registration hook; Lite has no global loader dependency registry. */\nexport function _RegisterUSDLoaderDependencies(): void {}\n","/**\n * Babylon.js-compatible `GPUPicker` over Babylon Lite's GPU picker\n * (`createGpuPicker` / `pickAsync` / `disposePicker`).\n *\n * Babylon.js's `GPUPicker` is **asynchronous** GPU picking — which is exactly\n * what Babylon Lite provides — so this is a real wrapper, not a stub. You set a\n * picking list of meshes, then `pickAsync(x, y)` resolves with the picked mesh\n * (or `null`).\n *\n * Coverage notes vs. Babylon.js:\n * - `setPickingList`, `addPickingList`, `clearPickingList`, `pickAsync`,\n * `multiPickAsync`, `pickingInProgress`, and `dispose` are implemented.\n * - The `{ mesh, material }` list-item form is accepted, but the custom picking\n * material is ignored (Lite assigns picking ids internally).\n * - `boxPickAsync` is not supported (Lite has no box-pick primitive) and throws.\n * - Hardware `InstancedMesh` picking is not represented; thin-instance picking is\n * surfaced through `thinInstanceIndex` exactly as Babylon.js does.\n */\n\nimport { createGpuPicker, pickAsync as litePickAsync, disposePicker } from \"babylon-lite\";\nimport type { GpuPicker, Mesh as LiteMesh, GaussianSplattingMesh as LiteGsMesh } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { Mesh } from \"../meshes/meshes.js\";\nimport { GaussianSplattingMesh } from \"../meshes/gaussian-splatting.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\n/** A pickable compat mesh: a regular `Mesh` or a `GaussianSplattingMesh`. */\ntype PickableMesh = Mesh | GaussianSplattingMesh;\n\n/** Result of a single GPU pick. Mirrors Babylon.js `IGPUPickingInfo`. */\nexport interface IGPUPickingInfo {\n mesh: PickableMesh;\n thinInstanceIndex?: number;\n}\n\n/** Result of a multi-point GPU pick. Mirrors Babylon.js `IGPUMultiPickingInfo`. */\nexport interface IGPUMultiPickingInfo {\n meshes: Array<PickableMesh | null>;\n thinInstanceIndexes?: number[];\n}\n\ntype PickListItem = PickableMesh | { mesh: PickableMesh; material?: unknown };\n\nfunction meshOf(item: PickListItem): PickableMesh {\n return item instanceof Mesh || item instanceof GaussianSplattingMesh ? item : item.mesh;\n}\n\n/** @internal The backing Lite node used as the picker's identity key for a compat mesh. */\nfunction liteNodeOf(mesh: PickableMesh): LiteMesh | LiteGsMesh | undefined {\n return mesh instanceof GaussianSplattingMesh ? mesh._pickLiteNode : mesh._lite;\n}\n\nexport class GPUPicker {\n private _picker: GpuPicker | null = null;\n private _scene: Scene | null = null;\n /** Maps Lite nodes (regular mesh or splat node) back to the compat meshes the caller supplied. */\n private readonly _liteToCompat = new Map<LiteMesh | LiteGsMesh, PickableMesh>();\n /** Regular Lite meshes that are pickable (drives the Lite `pickAsync` filter; GS meshes bypass it). */\n private _pickable = new Set<LiteMesh>();\n private _inProgress = false;\n\n /** True while an async pick is running (Babylon.js parity). */\n public get pickingInProgress(): boolean {\n return this._inProgress;\n }\n\n /** Replace the picking list. Passing `null` clears it. */\n public setPickingList(list: PickListItem[] | null): void {\n this.clearPickingList();\n if (list && list.length > 0) {\n this.addPickingList(list);\n }\n }\n\n /** Add meshes to the current picking list. */\n public addPickingList(list: PickListItem[]): void {\n if (!list || list.length === 0) {\n return;\n }\n const first = meshOf(list[0]!);\n const scene = first.getScene();\n if (!scene) {\n unsupported(\"GPUPicker.setPickingList\", \"Picking-list meshes must belong to a Scene (create them with a scene argument).\");\n }\n if (!this._picker || this._scene !== scene) {\n // Switching to a different scene: release the previous Lite picker so\n // we don't leak its GPU resources.\n if (this._picker) {\n disposePicker(this._picker);\n }\n this._scene = scene;\n this._picker = createGpuPicker(scene._lite);\n }\n for (const item of list) {\n const mesh = meshOf(item);\n const liteNode = liteNodeOf(mesh);\n if (!liteNode) {\n // A GaussianSplattingMesh whose splat is not loaded yet has no node to\n // key on; it becomes pickable once loaded and re-added.\n continue;\n }\n this._liteToCompat.set(liteNode, mesh);\n // Only regular meshes participate in the Lite filter; the Lite picker\n // auto-includes scene splat meshes (its GS pass ignores the filter).\n if (mesh instanceof Mesh) {\n this._pickable.add(mesh._lite);\n }\n }\n }\n\n /** Clear the picking list and release its bookkeeping. */\n public clearPickingList(): void {\n this._liteToCompat.clear();\n this._pickable = new Set<LiteMesh>();\n }\n\n /** Pick the mesh at canvas coordinates `(x, y)`. Resolves to `null` on a miss. */\n public async pickAsync(x: number, y: number, disposeWhenDone = false): Promise<IGPUPickingInfo | null> {\n if (this._inProgress || !this._picker || this._liteToCompat.size === 0) {\n return null;\n }\n this._inProgress = true;\n try {\n const info = await litePickAsync(this._picker, x, y, { filter: (mesh) => this._pickable.has(mesh) });\n if (!info.hit || !info.pickedMesh) {\n return null;\n }\n const mesh = this._liteToCompat.get(info.pickedMesh as LiteMesh | LiteGsMesh);\n if (!mesh) {\n return null;\n }\n return info.thinInstanceIndex >= 0 ? { mesh, thinInstanceIndex: info.thinInstanceIndex } : { mesh };\n } finally {\n this._inProgress = false;\n if (disposeWhenDone) {\n this.dispose();\n }\n }\n }\n\n /** Pick at several points. Always returns one entry per coordinate (mesh or `null`). */\n public async multiPickAsync(xy: Array<{ x: number; y: number }>, disposeWhenDone = false): Promise<IGPUMultiPickingInfo | null> {\n if (this._inProgress || !this._picker || this._liteToCompat.size === 0 || xy.length === 0) {\n return null;\n }\n const meshes: Array<PickableMesh | null> = [];\n const thinInstanceIndexes: number[] = [];\n for (const point of xy) {\n // Sequential: Lite picks one pixel per call.\n const result = await this.pickAsync(point.x, point.y);\n meshes.push(result?.mesh ?? null);\n thinInstanceIndexes.push(result?.thinInstanceIndex ?? 0);\n }\n if (disposeWhenDone) {\n this.dispose();\n }\n return { meshes, thinInstanceIndexes };\n }\n\n /** Box picking is not implemented in Babylon Lite. */\n public boxPickAsync(): never {\n return unsupported(\"GPUPicker.boxPickAsync\", \"Box (area) picking is not implemented in Babylon Lite. Use `multiPickAsync` over the points you need.\");\n }\n\n /** Release GPU picking resources. */\n public dispose(): void {\n if (this._picker) {\n disposePicker(this._picker);\n this._picker = null;\n }\n this._scene = null;\n this.clearPickingList();\n }\n}\n","/**\n * Babylon.js-compatible gizmos over Babylon Lite's gizmo suite.\n *\n * Babylon.js gizmos take a `UtilityLayerRenderer` and attach to a node via\n * `attachedMesh`/`attachedNode`. Babylon Lite mirrors this with\n * `createUtilityLayer` + `create*Gizmo(engine, layer)` + `attach*ToNode`. These\n * wrappers reproduce the Babylon.js class shape and the `attachedMesh` setter.\n */\n\nimport {\n createUtilityLayer,\n registerUtilityLayer,\n disposeUtilityLayer,\n createPositionGizmo,\n attachPositionGizmoToNode,\n disposePositionGizmo,\n setPositionGizmoLocalCoordinates,\n createRotationGizmo,\n attachRotationGizmoToNode,\n disposeRotationGizmo,\n setRotationGizmoLocalCoordinates,\n createScaleGizmo,\n attachScaleGizmoToNode,\n disposeScaleGizmo,\n setScaleGizmoLocalCoordinates,\n createBoundingBoxGizmo,\n attachBoundingBoxGizmoToNode,\n disposeBoundingBoxGizmo,\n createLightGizmo,\n attachLightGizmoToLight,\n disposeLightGizmo,\n createCameraGizmo,\n attachCameraGizmoToCamera,\n disposeCameraGizmo,\n createAxisDragGizmo,\n attachAxisDragGizmoToNode,\n disposeAxisDragGizmo,\n createPlaneRotationGizmo,\n attachPlaneRotationGizmoToNode,\n disposePlaneRotationGizmo,\n createPlaneDragGizmo,\n attachPlaneDragGizmoToNode,\n disposePlaneDragGizmo,\n createAxisScaleGizmo,\n attachAxisScaleGizmoToNode,\n disposeAxisScaleGizmo,\n} from \"babylon-lite\";\nimport type {\n UtilityLayer as LiteUtilityLayer,\n PositionGizmo as LitePositionGizmo,\n RotationGizmo as LiteRotationGizmo,\n ScaleGizmo as LiteScaleGizmo,\n BoundingBoxGizmo as LiteBoundingBoxGizmo,\n LightGizmo as LiteLightGizmo,\n CameraGizmo as LiteCameraGizmo,\n AxisDragGizmo as LiteAxisDragGizmo,\n PlaneRotationGizmo as LitePlaneRotationGizmo,\n PlaneDragGizmo as LitePlaneDragGizmo,\n AxisScaleGizmo as LiteAxisScaleGizmo,\n EngineContext,\n SceneNode,\n PointerDrag,\n PointerDragStartEvent,\n PointerDragMoveEvent,\n PointerDragEndEvent,\n PickingInfo as LitePickingInfo,\n Mesh as LiteMesh,\n} from \"babylon-lite\";\n\nimport type { Scene } from \"../scene/scene.js\";\nimport { type AbstractMesh, Mesh } from \"../meshes/meshes.js\";\nimport type { Node } from \"../node/node.js\";\nimport type { Light } from \"../lights/lights.js\";\nimport type { Camera } from \"../cameras/cameras.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport type { Color3 } from \"../math/color.js\";\nimport { Observable } from \"../misc/observable.js\";\nimport { PointerEventTypes, PointerInfo } from \"../events/pointer-events.js\";\nimport { PickingInfo } from \"../culling/picking-info.js\";\nimport { Ray } from \"../math/ray.js\";\n\n/** Babylon.js drag move payload. */\nexport type DragEvent = {\n delta: Vector3;\n dragPlanePoint: Vector3;\n dragPlaneNormal: Vector3;\n dragDistance: number;\n pointerId: number;\n pointerInfo: PointerInfo | null;\n};\n\n/** Babylon.js drag start/end payload. */\nexport type DragStartEndEvent = Pick<DragEvent, \"dragPlanePoint\" | \"pointerId\" | \"pointerInfo\">;\n\nfunction vectorFromLite(value: { x: number; y: number; z: number }): Vector3 {\n return new Vector3(value.x, value.y, value.z);\n}\n\nfunction pickingInfoFromLite(value: LitePickingInfo, pickedMeshes: Map<LiteMesh, Mesh>): PickingInfo {\n const liteMesh = value.pickedMesh as LiteMesh | null;\n let pickedMesh = liteMesh ? pickedMeshes.get(liteMesh) : undefined;\n if (liteMesh && !pickedMesh) {\n pickedMesh = Mesh._fromLite(liteMesh);\n pickedMeshes.set(liteMesh, pickedMesh);\n }\n const ray = value.ray ? new Ray(Vector3.FromArray(value.ray.origin), Vector3.FromArray(value.ray.direction), value.ray.length) : Ray.Zero();\n const result = PickingInfo._fromLite(value, pickedMesh ?? null, ray);\n result.ray = value.ray ? ray : null;\n return result;\n}\n\nfunction relayCompositeDragEvents(\n drags: readonly PointerDrag[],\n onDragStartObservable: Observable<DragStartEndEvent>,\n onDragObservable: Observable<DragEvent>,\n onDragEndObservable: Observable<DragStartEndEvent>\n): (() => void)[] {\n const subscriptions: (() => void)[] = [];\n const pointerInfos = new Map<PointerDrag, PointerInfo>();\n const pickedMeshes = new Map<LiteMesh, Mesh>();\n const axisPlaneNormals = new Map<PointerDrag, Vector3>();\n const previousPlaneDragDistances = new Map<PointerDrag, number>();\n for (const drag of drags) {\n subscriptions.push(\n drag.onDragStart.add((event: PointerDragStartEvent) => {\n const pointerInfo = new PointerInfo(PointerEventTypes.POINTERDOWN, event.pointerEvent, pickingInfoFromLite(event.pickInfo, pickedMeshes));\n pointerInfos.set(drag, pointerInfo);\n if (drag.options.dragAxis) {\n axisPlaneNormals.set(drag, new Vector3(-event.dragPlaneNormal.x || 0, -event.dragPlaneNormal.y || 0, -event.dragPlaneNormal.z || 0));\n }\n onDragStartObservable.notifyObservers({\n dragPlanePoint: vectorFromLite(event.dragPlanePoint),\n pointerId: event.pointerId,\n pointerInfo,\n });\n }),\n drag.onDrag.add((event: PointerDragMoveEvent) => {\n const axis = drag.options.dragAxis;\n const dragDistance = axis ? event.delta.x * axis.x + event.delta.y * axis.y + event.delta.z * axis.z : (previousPlaneDragDistances.get(drag) ?? 0);\n if (!axis) {\n previousPlaneDragDistances.set(drag, Math.hypot(event.delta.x, event.delta.y, event.delta.z));\n }\n onDragObservable.notifyObservers({\n delta: vectorFromLite(event.delta),\n dragPlanePoint: vectorFromLite(event.dragPlanePoint),\n dragPlaneNormal: axisPlaneNormals.get(drag)?.clone() ?? vectorFromLite(event.dragPlaneNormal),\n dragDistance,\n pointerId: event.pointerId,\n pointerInfo: pointerInfos.get(drag) ?? null,\n });\n }),\n drag.onDragEnd.add((event: PointerDragEndEvent) => {\n onDragEndObservable.notifyObservers({\n dragPlanePoint: vectorFromLite(event.dragPlanePoint),\n pointerId: event.pointerId,\n pointerInfo: pointerInfos.get(drag) ?? null,\n });\n pointerInfos.delete(drag);\n axisPlaneNormals.delete(drag);\n })\n );\n }\n return subscriptions;\n}\n\n/** Babylon.js `UtilityLayerRenderer` — the overlay scene gizmos render into. */\nexport class UtilityLayerRenderer {\n /** @internal Underlying Babylon Lite utility layer. */\n public readonly _lite: LiteUtilityLayer;\n /** @internal Lite engine backing the layer (gizmo factories need it explicitly). */\n public readonly _engine: EngineContext;\n private _registered = false;\n\n public constructor(scene: Scene) {\n this._engine = scene.getEngine()._lite;\n this._lite = createUtilityLayer(this._engine, scene._lite);\n // Babylon Lite registers a utility layer *after* its gizmos are created and\n // after the main scene is registered. Gizmo creation is synchronous (all\n // gizmos exist by the time the engine starts), so defer registration to the\n // engine's late-work phase to capture every gizmo.\n scene.getEngine()._registerLateWork(() => this._ensureRegistered());\n }\n\n /** @internal Ensure the layer is registered with the engine (idempotent). */\n public _ensureRegistered(): Promise<void> {\n if (this._registered) {\n return Promise.resolve();\n }\n this._registered = true;\n return registerUtilityLayer(this._lite);\n }\n\n public dispose(): void {\n disposeUtilityLayer(this._lite);\n }\n}\n\n/** Shared base for compat gizmos (Babylon.js `Gizmo`). */\nabstract class GizmoBase {\n /** @internal The utility layer this gizmo renders into. */\n public readonly _layer: UtilityLayerRenderer;\n\n protected constructor(layer: UtilityLayerRenderer) {\n this._layer = layer;\n // The utility layer registers itself with the engine during the engine's\n // late-work phase (after all gizmos are created), so no eager registration\n // is needed here.\n }\n\n public abstract get attachedMesh(): AbstractMesh | null;\n public abstract set attachedMesh(value: AbstractMesh | null);\n\n public abstract dispose(): void;\n}\n\nexport class PositionGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LitePositionGizmo;\n private _attached: AbstractMesh | null = null;\n private _xGizmo: AxisDragGizmo | null = null;\n private _yGizmo: AxisDragGizmo | null = null;\n private _zGizmo: AxisDragGizmo | null = null;\n private _dragSubscriptions: (() => void)[];\n public readonly onDragStartObservable = new Observable<DragStartEndEvent>();\n public readonly onDragObservable = new Observable<DragEvent>();\n public readonly onDragEndObservable = new Observable<DragStartEndEvent>();\n\n public constructor(layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createPositionGizmo(layer._engine, layer._lite);\n this._dragSubscriptions = relayCompositeDragEvents(\n [this._lite.xGizmo.drag, this._lite.yGizmo.drag, this._lite.zGizmo.drag],\n this.onDragStartObservable,\n this.onDragObservable,\n this.onDragEndObservable\n );\n // Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` defaults to true.\n setPositionGizmoLocalCoordinates(this._lite, true);\n }\n\n /** Babylon.js `PositionGizmo.xGizmo/yGizmo/zGizmo` — the per-axis drag sub-gizmos.\n * Exposed so callers can toggle interactivity per axis (e.g. `xGizmo.isEnabled = false`\n * for a display-only gizmo). Wrappers are cached so identity is stable. */\n public get xGizmo(): AxisDragGizmo {\n return (this._xGizmo ??= AxisDragGizmo._fromLite(this._lite.xGizmo, this._layer));\n }\n public get yGizmo(): AxisDragGizmo {\n return (this._yGizmo ??= AxisDragGizmo._fromLite(this._lite.yGizmo, this._layer));\n }\n public get zGizmo(): AxisDragGizmo {\n return (this._zGizmo ??= AxisDragGizmo._fromLite(this._lite.zGizmo, this._layer));\n }\n\n /** Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` — orient widgets to the node's local axes. */\n public set updateGizmoRotationToMatchAttachedMesh(value: boolean) {\n setPositionGizmoLocalCoordinates(this._lite, value);\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this._attached = value;\n attachPositionGizmoToNode(this._lite, (value?._lite as SceneNode | undefined) ?? null);\n }\n\n public get attachedNode(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedNode(value: AbstractMesh | null) {\n this.attachedMesh = value;\n }\n\n public override dispose(): void {\n disposePositionGizmo(this._lite, this._layer._lite);\n for (const unsubscribe of this._dragSubscriptions) {\n unsubscribe();\n }\n this._dragSubscriptions.length = 0;\n this.onDragStartObservable.clear();\n this.onDragObservable.clear();\n this.onDragEndObservable.clear();\n }\n}\n\nexport class RotationGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LiteRotationGizmo;\n private _attached: AbstractMesh | null = null;\n private _xGizmo: PlaneRotationGizmo | null = null;\n private _yGizmo: PlaneRotationGizmo | null = null;\n private _zGizmo: PlaneRotationGizmo | null = null;\n private _dragSubscriptions: (() => void)[];\n public readonly onDragStartObservable = new Observable<DragStartEndEvent>();\n public readonly onDragObservable = new Observable<DragEvent>();\n public readonly onDragEndObservable = new Observable<DragStartEndEvent>();\n\n public constructor(layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createRotationGizmo(layer._engine, layer._lite);\n this._dragSubscriptions = relayCompositeDragEvents(\n [this._lite.xGizmo.drag, this._lite.yGizmo.drag, this._lite.zGizmo.drag],\n this.onDragStartObservable,\n this.onDragObservable,\n this.onDragEndObservable\n );\n // Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` defaults to true.\n setRotationGizmoLocalCoordinates(this._lite, true);\n }\n\n /** Babylon.js `RotationGizmo.xGizmo/yGizmo/zGizmo` — the per-plane rotation sub-gizmos. */\n public get xGizmo(): PlaneRotationGizmo {\n return (this._xGizmo ??= PlaneRotationGizmo._fromLite(this._lite.xGizmo, this._layer));\n }\n public get yGizmo(): PlaneRotationGizmo {\n return (this._yGizmo ??= PlaneRotationGizmo._fromLite(this._lite.yGizmo, this._layer));\n }\n public get zGizmo(): PlaneRotationGizmo {\n return (this._zGizmo ??= PlaneRotationGizmo._fromLite(this._lite.zGizmo, this._layer));\n }\n\n /** Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` — orient widgets to the node's local axes. */\n public set updateGizmoRotationToMatchAttachedMesh(value: boolean) {\n setRotationGizmoLocalCoordinates(this._lite, value);\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this._attached = value;\n attachRotationGizmoToNode(this._lite, (value?._lite as SceneNode | undefined) ?? null);\n }\n\n public get attachedNode(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedNode(value: AbstractMesh | null) {\n this.attachedMesh = value;\n }\n\n public override dispose(): void {\n disposeRotationGizmo(this._lite, this._layer._lite);\n for (const unsubscribe of this._dragSubscriptions) {\n unsubscribe();\n }\n this._dragSubscriptions.length = 0;\n this.onDragStartObservable.clear();\n this.onDragObservable.clear();\n this.onDragEndObservable.clear();\n }\n}\n\nexport class ScaleGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LiteScaleGizmo;\n private _attached: AbstractMesh | null = null;\n private _xGizmo: AxisScaleGizmo | null = null;\n private _yGizmo: AxisScaleGizmo | null = null;\n private _zGizmo: AxisScaleGizmo | null = null;\n\n public constructor(layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createScaleGizmo(layer._engine, layer._lite);\n // Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` defaults to true.\n setScaleGizmoLocalCoordinates(this._lite, true);\n }\n\n /** Babylon.js `ScaleGizmo.xGizmo/yGizmo/zGizmo` — the per-axis scale sub-gizmos. */\n public get xGizmo(): AxisScaleGizmo {\n return (this._xGizmo ??= AxisScaleGizmo._fromLite(this._lite.xGizmo, this._layer));\n }\n public get yGizmo(): AxisScaleGizmo {\n return (this._yGizmo ??= AxisScaleGizmo._fromLite(this._lite.yGizmo, this._layer));\n }\n public get zGizmo(): AxisScaleGizmo {\n return (this._zGizmo ??= AxisScaleGizmo._fromLite(this._lite.zGizmo, this._layer));\n }\n\n /** Babylon.js `Gizmo.updateGizmoRotationToMatchAttachedMesh` — orient widgets to the node's local axes. */\n public set updateGizmoRotationToMatchAttachedMesh(value: boolean) {\n setScaleGizmoLocalCoordinates(this._lite, value);\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this._attached = value;\n attachScaleGizmoToNode(this._lite, (value?._lite as SceneNode | undefined) ?? null);\n }\n\n public get attachedNode(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedNode(value: AbstractMesh | null) {\n this.attachedMesh = value;\n }\n\n public override dispose(): void {\n disposeScaleGizmo(this._lite, this._layer._lite);\n }\n}\n\nexport class BoundingBoxGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LiteBoundingBoxGizmo;\n private _attached: AbstractMesh | null = null;\n\n /**\n * Babylon.js `BoundingBoxGizmo(color?, utilityLayer?)`. The first argument may\n * be the gizmo colour (when a layer is also supplied) or the utility layer.\n */\n public constructor(colorOrLayer: Color3 | UtilityLayerRenderer, layer?: UtilityLayerRenderer) {\n const resolvedLayer = layer ?? (colorOrLayer as UtilityLayerRenderer);\n const color = layer ? (colorOrLayer as Color3) : undefined;\n super(resolvedLayer);\n this._lite = createBoundingBoxGizmo(resolvedLayer._engine, resolvedLayer._lite, color ? { color: [color.r, color.g, color.b] } : {});\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this._attached = value;\n attachBoundingBoxGizmoToNode(this._lite, nodeLite(value));\n }\n\n public get attachedNode(): AbstractMesh | null {\n return this._attached;\n }\n public set attachedNode(value: AbstractMesh | null) {\n this.attachedMesh = value;\n }\n\n /** Babylon.js `BoundingBoxGizmo.enableDragBehavior()` — enables body-drag (Lite enables it by default). */\n public enableDragBehavior(): void {\n // Babylon Lite's bounding-box gizmo wires body-drag through its own pointer\n // behaviour; no explicit opt-in is required.\n }\n\n public override dispose(): void {\n disposeBoundingBoxGizmo(this._lite, this._layer._lite);\n }\n}\n\nexport class LightGizmo {\n /** @internal */\n public readonly _lite: LiteLightGizmo;\n /** @internal */\n public readonly _layer: UtilityLayerRenderer;\n private _attached: Light | null = null;\n\n public constructor(layer: UtilityLayerRenderer) {\n this._layer = layer;\n this._lite = createLightGizmo(layer._engine, layer._lite);\n }\n\n public get light(): Light | null {\n return this._attached;\n }\n public set light(value: Light | null) {\n this._attached = value;\n attachLightGizmoToLight(this._lite, value?._lite ?? null);\n }\n\n /**\n * Babylon.js `LightGizmo.attachedMesh` — the gizmo's visual root. Babylon.js\n * code reads this to reposition the gizmo for lights without a position (e.g.\n * hemispheric). Returns a thin proxy over the Lite gizmo's `root` node whose\n * `position` writes through to it.\n */\n public get attachedMesh(): { position: Vector3 } {\n const root = this._lite.root;\n return {\n get position(): Vector3 {\n return root.position as unknown as Vector3;\n },\n set position(v: Vector3) {\n root.position.set(v.x, v.y, v.z);\n },\n };\n }\n\n public dispose(): void {\n disposeLightGizmo(this._lite, this._layer._lite);\n }\n}\n\nexport class CameraGizmo {\n /** @internal */\n public readonly _lite: LiteCameraGizmo;\n /** @internal */\n public readonly _layer: UtilityLayerRenderer;\n private _attached: Camera | null = null;\n\n public constructor(layer: UtilityLayerRenderer) {\n this._layer = layer;\n this._lite = createCameraGizmo(layer._engine, layer._lite);\n }\n\n public get camera(): Camera | null {\n return this._attached;\n }\n public set camera(value: Camera | null) {\n this._attached = value;\n attachCameraGizmoToCamera(this._lite, value?._lite ?? null);\n }\n\n public dispose(): void {\n disposeCameraGizmo(this._lite, this._layer._lite);\n }\n}\n\n/**\n * Babylon.js single-axis / single-plane gizmos. Babylon.js constructs these with\n * `(axis, color, utilityLayer)` and attaches to a node via `attachedNode`. Each\n * maps to a Babylon Lite single-axis gizmo factory.\n *\n * @internal Resolve the Lite scene node for a compat node (mesh `_lite` or\n * transform `_node`).\n */\nfunction nodeLite(value: Node | null): SceneNode | null {\n if (!value) {\n return null;\n }\n const n = value as { _lite?: SceneNode; _node?: SceneNode };\n return n._lite ?? n._node ?? null;\n}\n\n/**\n * @internal Build a single-axis/plane gizmo wrapper around a Lite sub-gizmo that\n * a composite already created, without re-running the public constructor (which\n * would build a second Lite gizmo). Used by the composite `xGizmo`/`yGizmo`/`zGizmo`\n * accessors so `positionGizmo.xGizmo.isEnabled = false` reaches the real sub-gizmo.\n */\nfunction wrapSubGizmo<L, T extends { _lite: L }>(ctor: { prototype: T }, lite: L, layer: UtilityLayerRenderer): T {\n const g = Object.create(ctor.prototype) as { _lite: L; _layer: UtilityLayerRenderer; _attached: Node | null };\n g._lite = lite;\n g._layer = layer;\n g._attached = null;\n return g as unknown as T;\n}\n\n/** Babylon.js `AxisDragGizmo` — drags the attached node along a single world axis. */\nexport class AxisDragGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LiteAxisDragGizmo;\n private _attached: Node | null = null;\n\n public constructor(dragAxis: Vector3, color: Color3, layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createAxisDragGizmo(layer._engine, layer._lite, {\n dragAxis: { x: dragAxis.x, y: dragAxis.y, z: dragAxis.z },\n color: [color.r, color.g, color.b],\n });\n }\n\n /** @internal Wrap an existing Lite axis-drag gizmo (a composite's sub-gizmo). */\n public static _fromLite(lite: LiteAxisDragGizmo, layer: UtilityLayerRenderer): AxisDragGizmo {\n return wrapSubGizmo(AxisDragGizmo, lite, layer);\n }\n\n /** Babylon.js `IAxisDragGizmo.isEnabled` — when false the gizmo is non-interactive\n * (no drag, and no GPU hover picking), while its meshes stay visible and keep\n * following the attached node. Toggles the underlying Lite pointer-drag. */\n public get isEnabled(): boolean {\n return this._lite.drag.enabled;\n }\n public set isEnabled(value: boolean) {\n this._lite.drag.enabled = value;\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached as AbstractMesh | null;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this.attachedNode = value;\n }\n\n public get attachedNode(): Node | null {\n return this._attached;\n }\n public set attachedNode(value: Node | null) {\n this._attached = value;\n attachAxisDragGizmoToNode(this._lite, nodeLite(value));\n }\n\n public override dispose(): void {\n disposeAxisDragGizmo(this._lite, this._layer._lite);\n }\n}\n\n/** Babylon.js `PlaneRotationGizmo` — rotates the attached node about a plane normal. */\nexport class PlaneRotationGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LitePlaneRotationGizmo;\n private _attached: Node | null = null;\n\n public constructor(planeNormal: Vector3, color: Color3, layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createPlaneRotationGizmo(layer._engine, layer._lite, {\n planeNormal: { x: planeNormal.x, y: planeNormal.y, z: planeNormal.z },\n color: [color.r, color.g, color.b],\n });\n }\n\n /** @internal Wrap an existing Lite plane-rotation gizmo (a composite's sub-gizmo). */\n public static _fromLite(lite: LitePlaneRotationGizmo, layer: UtilityLayerRenderer): PlaneRotationGizmo {\n return wrapSubGizmo(PlaneRotationGizmo, lite, layer);\n }\n\n /** Babylon.js `IPlaneRotationGizmo.isEnabled` — toggles interactivity (drag + hover pick). */\n public get isEnabled(): boolean {\n return this._lite.drag.enabled;\n }\n public set isEnabled(value: boolean) {\n this._lite.drag.enabled = value;\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached as AbstractMesh | null;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this.attachedNode = value;\n }\n\n public get attachedNode(): Node | null {\n return this._attached;\n }\n public set attachedNode(value: Node | null) {\n this._attached = value;\n attachPlaneRotationGizmoToNode(this._lite, nodeLite(value));\n }\n\n public override dispose(): void {\n disposePlaneRotationGizmo(this._lite, this._layer._lite);\n }\n}\n\n/** Babylon.js `PlaneDragGizmo` — drags the attached node within a plane. */\nexport class PlaneDragGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LitePlaneDragGizmo;\n private _attached: Node | null = null;\n\n public constructor(dragPlaneNormal: Vector3, color: Color3, layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createPlaneDragGizmo(layer._engine, layer._lite, {\n dragPlaneNormal: { x: dragPlaneNormal.x, y: dragPlaneNormal.y, z: dragPlaneNormal.z },\n color: [color.r, color.g, color.b],\n });\n }\n\n /** @internal Wrap an existing Lite plane-drag gizmo (a composite's sub-gizmo). */\n public static _fromLite(lite: LitePlaneDragGizmo, layer: UtilityLayerRenderer): PlaneDragGizmo {\n return wrapSubGizmo(PlaneDragGizmo, lite, layer);\n }\n\n /** Babylon.js `IPlaneDragGizmo.isEnabled` — toggles interactivity (drag + hover pick). */\n public get isEnabled(): boolean {\n return this._lite.drag.enabled;\n }\n public set isEnabled(value: boolean) {\n this._lite.drag.enabled = value;\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached as AbstractMesh | null;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this.attachedNode = value;\n }\n\n public get attachedNode(): Node | null {\n return this._attached;\n }\n public set attachedNode(value: Node | null) {\n this._attached = value;\n attachPlaneDragGizmoToNode(this._lite, nodeLite(value));\n }\n\n public override dispose(): void {\n disposePlaneDragGizmo(this._lite, this._layer._lite);\n }\n}\n\n/** Babylon.js `AxisScaleGizmo` — scales the attached node along a single axis. */\nexport class AxisScaleGizmo extends GizmoBase {\n /** @internal */\n public readonly _lite: LiteAxisScaleGizmo;\n private _attached: Node | null = null;\n\n public constructor(dragAxis: Vector3, color: Color3, layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createAxisScaleGizmo(layer._engine, layer._lite, {\n dragAxis: { x: dragAxis.x, y: dragAxis.y, z: dragAxis.z },\n color: [color.r, color.g, color.b],\n });\n }\n\n /** @internal Wrap an existing Lite axis-scale gizmo (a composite's sub-gizmo). */\n public static _fromLite(lite: LiteAxisScaleGizmo, layer: UtilityLayerRenderer): AxisScaleGizmo {\n return wrapSubGizmo(AxisScaleGizmo, lite, layer);\n }\n\n /** Babylon.js `IAxisScaleGizmo.isEnabled` — toggles interactivity (drag + hover pick). */\n public get isEnabled(): boolean {\n return this._lite.drag.enabled;\n }\n public set isEnabled(value: boolean) {\n this._lite.drag.enabled = value;\n }\n\n public get attachedMesh(): AbstractMesh | null {\n return this._attached as AbstractMesh | null;\n }\n public set attachedMesh(value: AbstractMesh | null) {\n this.attachedNode = value;\n }\n\n public get attachedNode(): Node | null {\n return this._attached;\n }\n public set attachedNode(value: Node | null) {\n this._attached = value;\n attachAxisScaleGizmoToNode(this._lite, nodeLite(value));\n }\n\n public override dispose(): void {\n disposeAxisScaleGizmo(this._lite, this._layer._lite);\n }\n}\n\n/**\n * Babylon.js `GizmoManager` — coordinates the position/rotation/scale/bounding-box\n * gizmos over a shared utility layer and a single attached mesh.\n */\nexport class GizmoManager {\n public readonly gizmos: {\n positionGizmo: PositionGizmo | null;\n rotationGizmo: RotationGizmo | null;\n scaleGizmo: ScaleGizmo | null;\n boundingBoxGizmo: BoundingBoxGizmo | null;\n } = { positionGizmo: null, rotationGizmo: null, scaleGizmo: null, boundingBoxGizmo: null };\n\n private readonly _layer: UtilityLayerRenderer;\n private _attached: AbstractMesh | null = null;\n\n public constructor(scene: Scene) {\n this._layer = new UtilityLayerRenderer(scene);\n }\n\n public set positionGizmoEnabled(enabled: boolean) {\n this._toggle(\"positionGizmo\", enabled, () => new PositionGizmo(this._layer));\n }\n public set rotationGizmoEnabled(enabled: boolean) {\n this._toggle(\"rotationGizmo\", enabled, () => new RotationGizmo(this._layer));\n }\n public set scaleGizmoEnabled(enabled: boolean) {\n this._toggle(\"scaleGizmo\", enabled, () => new ScaleGizmo(this._layer));\n }\n public set boundingBoxGizmoEnabled(enabled: boolean) {\n this._toggle(\"boundingBoxGizmo\", enabled, () => new BoundingBoxGizmo(this._layer));\n }\n\n public attachToMesh(mesh: Mesh | null): void {\n this._attached = mesh;\n if (this.gizmos.positionGizmo) {\n this.gizmos.positionGizmo.attachedMesh = mesh;\n }\n if (this.gizmos.rotationGizmo) {\n this.gizmos.rotationGizmo.attachedMesh = mesh;\n }\n if (this.gizmos.scaleGizmo) {\n this.gizmos.scaleGizmo.attachedMesh = mesh;\n }\n if (this.gizmos.boundingBoxGizmo) {\n this.gizmos.boundingBoxGizmo.attachedMesh = mesh;\n }\n }\n\n public dispose(): void {\n this.gizmos.positionGizmo?.dispose();\n this.gizmos.rotationGizmo?.dispose();\n this.gizmos.scaleGizmo?.dispose();\n this.gizmos.boundingBoxGizmo?.dispose();\n this._layer.dispose();\n }\n\n private _toggle<K extends \"positionGizmo\" | \"rotationGizmo\" | \"scaleGizmo\" | \"boundingBoxGizmo\">(\n key: K,\n enabled: boolean,\n make: () => PositionGizmo | RotationGizmo | ScaleGizmo | BoundingBoxGizmo\n ): void {\n if (enabled && !this.gizmos[key]) {\n const gizmo = make() as never;\n this.gizmos[key] = gizmo;\n this.gizmos[key]!.attachedMesh = this._attached;\n } else if (!enabled && this.gizmos[key]) {\n this.gizmos[key]!.dispose();\n this.gizmos[key] = null;\n }\n }\n}\n","/**\n * Babylon.js-compatible camera/mesh behaviors.\n *\n * Camera behaviors (`AutoRotationBehavior`, `BouncingBehavior`,\n * `FramingBehavior`) operate on the compat `ArcRotateCamera` via the scene's\n * before-render hook. `AutoRotationBehavior` is fully functional; bouncing and\n * framing implement the structural surface plus their core action without\n * Babylon.js's tweened animations (so they are `⚡ Partial`).\n */\n\nimport { onBeforeRender } from \"babylon-lite\";\n\nimport type { ArcRotateCamera } from \"../cameras/cameras.js\";\n\n/** Babylon.js `Behavior<T>` interface. */\nexport interface Behavior<T> {\n readonly name: string;\n init(): void;\n attach(target: T): void;\n detach(): void;\n}\n\n/** Idle auto-rotation of an `ArcRotateCamera` (spins `alpha` when not interacting). */\nexport class AutoRotationBehavior implements Behavior<ArcRotateCamera> {\n public readonly name = \"AutoRotation\";\n /** Idle rotation speed in radians/second. */\n public idleRotationSpeed = 0.05;\n private _camera: ArcRotateCamera | null = null;\n private _detach: (() => void) | undefined;\n\n public init(): void {\n // no-op\n }\n\n public attach(camera: ArcRotateCamera): void {\n this._camera = camera;\n const scene = camera.getScene();\n if (!scene) {\n return;\n }\n // onBeforeRender passes the frame delta in milliseconds.\n const cb = (deltaMs: number): void => {\n if (this._camera) {\n this._camera.alpha += this.idleRotationSpeed * (deltaMs / 1000);\n }\n };\n onBeforeRender(scene._lite, cb);\n this._detach = () => {\n this._camera = null;\n };\n }\n\n public detach(): void {\n this._detach?.();\n this._detach = undefined;\n }\n}\n\n/** Clamps an `ArcRotateCamera`'s radius to a [lower, upper] band (no bounce tween). */\nexport class BouncingBehavior implements Behavior<ArcRotateCamera> {\n public readonly name = \"Bouncing\";\n public lowerRadiusTransitionRange = 2;\n public upperRadiusTransitionRange = -2;\n private _camera: ArcRotateCamera | null = null;\n private _detach: (() => void) | undefined;\n\n public init(): void {\n // no-op\n }\n\n public attach(camera: ArcRotateCamera): void {\n this._camera = camera;\n const scene = camera.getScene();\n if (!scene) {\n return;\n }\n const cb = (): void => {\n const cam = this._camera;\n if (!cam) {\n return;\n }\n if (cam.lowerRadiusLimit != null && cam.radius < cam.lowerRadiusLimit) {\n cam.radius = cam.lowerRadiusLimit;\n }\n if (cam.upperRadiusLimit != null && cam.radius > cam.upperRadiusLimit) {\n cam.radius = cam.upperRadiusLimit;\n }\n };\n onBeforeRender(scene._lite, cb);\n this._detach = () => {\n this._camera = null;\n };\n }\n\n public detach(): void {\n this._detach?.();\n this._detach = undefined;\n }\n}\n\n/** Frames an `ArcRotateCamera` on a target by setting its radius (no zoom tween). */\nexport class FramingBehavior implements Behavior<ArcRotateCamera> {\n public readonly name = \"Framing\";\n public radius = 10;\n private _camera: ArcRotateCamera | null = null;\n\n public init(): void {\n // no-op\n }\n\n public attach(camera: ArcRotateCamera): void {\n this._camera = camera;\n }\n\n public detach(): void {\n this._camera = null;\n }\n\n /** Set the camera radius to frame a target of the given world-space radius. */\n public zoomOnBoundingRadius(boundingRadius: number): void {\n if (this._camera) {\n this._camera.radius = boundingRadius * 2.5;\n }\n }\n}\n","/**\n * Babylon.js-compatible `SpriteManager` / `Sprite` over Babylon Lite's\n * camera-facing billboard sprite system.\n *\n * Babylon.js positions sprites in **world space** (`sprite.position` is a\n * `Vector3`, `sprite.width`/`height` are world units) and renders them as\n * camera-facing billboards. Babylon Lite's `createFacingBillboardSystem` +\n * `addBillboardSpriteIndex` use the exact same world-space model\n * (`position: [x,y,z]`, `sizeWorld: [w,h]`), so the mapping is direct.\n *\n * The atlas image loads asynchronously, so the `SpriteManager` constructor\n * defers building the Lite billboard system until engine start: it tracks the\n * atlas-load promise via `scene._trackTextureLoad` and registers a\n * `scene._deferAdd` callback that — once the atlas is ready — builds the system,\n * pushes every `Sprite`'s current props, and attaches it to the scene.\n */\n\nimport {\n loadSpriteAtlas,\n createFacingBillboardSystem,\n addBillboardSpriteIndex,\n updateBillboardSpriteIndex,\n addFacingBillboardSystem,\n billboardBlendAlpha,\n billboardBlendAdditive,\n createSprite2DLayer,\n addSprite2DIndex,\n updateSprite2DIndex,\n createSpriteRenderer,\n registerSpriteRenderer,\n spriteBlendAlpha,\n spriteBlendPremultiplied,\n spriteBlendAdditive,\n} from \"babylon-lite\";\nimport type { SpriteAtlas, FacingBillboardSpriteSystem, BillboardBlendDescriptor, BillboardSpriteInit, Sprite2DLayer, SpriteBlendMode } from \"babylon-lite\";\n\nimport { Vector3 } from \"../math/vector.js\";\nimport { Color4 } from \"../math/color.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { WebGPUEngine } from \"../engine/engine.js\";\n\ninterface CellSize {\n width: number;\n height: number;\n}\n\n/** Babylon.js `Constants.ALPHA_ONEONE` (additive). */\nconst ALPHA_ONEONE = 6;\n/** Babylon.js `Constants.ALPHA_ADD`. */\nconst ALPHA_ADD = 1;\n\n/**\n * Babylon.js `SpriteManager` — owns a sprite atlas and a pool of `Sprite`s that\n * render as camera-facing billboards. Backed by a Lite facing-billboard system.\n */\nexport class SpriteManager {\n public name: string;\n /** Babylon.js `manager.disableDepthWrite`. Accepted for parity (Lite billboards self-manage depth). */\n public disableDepthWrite = false;\n /** Babylon.js `manager.blendMode` (`Constants.ALPHA_*`). Mapped to a Lite billboard blend at build. */\n public blendMode = 2;\n\n /** @internal Sprites created against this manager, in creation order. */\n public readonly _sprites: Sprite[] = [];\n /** @internal The Lite billboard system, built at engine start. */\n public _lite?: FacingBillboardSpriteSystem;\n\n private _atlas?: SpriteAtlas;\n\n public constructor(name: string, url: string, capacity: number, cellSize: CellSize, scene: Scene, _epsilon = 0.01, samplingMode = 2) {\n this.name = name;\n const engine = scene.getEngine()._lite;\n // Babylon.js `Texture.NEAREST_SAMPLINGMODE` is 1; everything else (bi/tri-\n // linear) maps to Lite's \"linear\".\n const sampling = samplingMode === 1 ? \"nearest\" : \"linear\";\n // Kick off the async atlas load; resolve stores the atlas for the\n // deferred build. Tracked so the engine awaits it before building.\n scene._trackTextureLoad(\n loadSpriteAtlas(engine, url, {\n gridSize: [cellSize.width, cellSize.height],\n sampling,\n }).then((atlas) => {\n this._atlas = atlas;\n })\n );\n // Build the billboard system once the atlas is ready (after pending\n // textures are awaited) and attach it to the scene.\n scene._deferAdd(() => {\n if (!this._atlas) {\n return;\n }\n const blendMode = this._mapBlendMode();\n const system = createFacingBillboardSystem(this._atlas, { capacity, blendMode });\n for (const sprite of this._sprites) {\n sprite._applyTo(system);\n }\n this._lite = system;\n addFacingBillboardSystem(scene._lite, system);\n });\n }\n\n /** Babylon.js `SpriteManager.isReady()` — an empty manager is ready without renderer preparation. */\n public isReady(): boolean {\n return this._sprites.length === 0 || this._lite !== undefined;\n }\n\n /** @internal Map the Babylon.js `Constants.ALPHA_*` blend mode to a Lite billboard blend. */\n private _mapBlendMode(): BillboardBlendDescriptor {\n if (this.blendMode === ALPHA_ONEONE || this.blendMode === ALPHA_ADD) {\n return billboardBlendAdditive;\n }\n return billboardBlendAlpha;\n }\n}\n\n/**\n * Babylon.js `Sprite` — a single camera-facing billboard in a `SpriteManager`'s\n * atlas. World-space position + size; cell index selects the atlas frame.\n *\n * Properties are **live**: once the manager has built its Lite billboard system\n * (at engine start), mutating a sprite property pushes an\n * `updateBillboardSpriteIndex` patch so per-frame animation (e.g. advancing\n * `cellIndex` or toggling `isVisible`) is reflected on the GPU. Before the\n * system is built, property writes are buffered and flushed once in `_applyTo`.\n *\n * Note: `position`/`color` are object values; reassigning them\n * (`sprite.position = new Vector3(...)`) pushes a patch, but mutating a\n * component in place (`sprite.position.x = …`) does not — call the setter (or\n * reassign) to push a live update.\n */\nexport class Sprite {\n public name: string;\n\n private _position = new Vector3(0, 0, 0);\n private _width = 1;\n private _height = 1;\n private _cellIndex = 0;\n private _angle = 0;\n private _color = new Color4(1, 1, 1, 1);\n private _invertU = false;\n private _invertV = false;\n private _visible = true;\n\n /** @internal The Lite billboard system this sprite belongs to (set in `_applyTo`). */\n private _system?: FacingBillboardSpriteSystem;\n /** @internal This sprite's instance index in `_system` (set in `_applyTo`). */\n private _index = -1;\n\n public constructor(name: string, manager: SpriteManager) {\n this.name = name;\n manager._sprites.push(this);\n }\n\n public get position(): Vector3 {\n return this._position;\n }\n public set position(value: Vector3) {\n this._position = value;\n this._patch({ position: [value.x, value.y, value.z] });\n }\n\n public get width(): number {\n return this._width;\n }\n public set width(value: number) {\n this._width = value;\n this._patch({ sizeWorld: [value, this._height] });\n }\n\n public get height(): number {\n return this._height;\n }\n public set height(value: number) {\n this._height = value;\n this._patch({ sizeWorld: [this._width, value] });\n }\n\n public get cellIndex(): number {\n return this._cellIndex;\n }\n public set cellIndex(value: number) {\n this._cellIndex = value;\n this._patch({ frame: value });\n }\n\n public get angle(): number {\n return this._angle;\n }\n public set angle(value: number) {\n this._angle = value;\n this._patch({ rotation: value });\n }\n\n public get color(): Color4 {\n return this._color;\n }\n public set color(value: Color4) {\n this._color = value;\n this._patch({ color: [value.r, value.g, value.b, value.a] });\n }\n\n public get invertU(): boolean {\n return this._invertU;\n }\n public set invertU(value: boolean) {\n this._invertU = value;\n this._patch({ flipX: value });\n }\n\n public get invertV(): boolean {\n return this._invertV;\n }\n public set invertV(value: boolean) {\n this._invertV = value;\n this._patch({ flipY: value });\n }\n\n public get isVisible(): boolean {\n return this._visible;\n }\n public set isVisible(value: boolean) {\n this._visible = value;\n this._patch({ visible: value });\n }\n\n /** @internal Add this sprite to the Lite billboard system and record its index for live updates. */\n public _applyTo(system: FacingBillboardSpriteSystem): void {\n this._index = addBillboardSpriteIndex(system, {\n position: [this._position.x, this._position.y, this._position.z],\n sizeWorld: [this._width, this._height],\n frame: this._cellIndex,\n rotation: this._angle,\n color: [this._color.r, this._color.g, this._color.b, this._color.a],\n flipX: this._invertU,\n flipY: this._invertV,\n visible: this._visible,\n });\n this._system = system;\n }\n\n /** @internal Push a live property patch to the Lite billboard system (no-op before build). */\n private _patch(patch: Partial<BillboardSpriteInit>): void {\n if (this._system && this._index >= 0) {\n updateBillboardSpriteIndex(this._system, this._index, patch);\n }\n }\n}\n\n/** Babylon.js `Constants.ALPHA_PREMULTIPLIED`. */\nconst ALPHA_PREMULTIPLIED = 7;\n\n/**\n * Babylon.js `ThinSprite` — a lightweight pixel-space sprite drawn by a\n * {@link SpriteRenderer}. Position is in screen pixels (origin bottom-left, +Y\n * up, matching the orthographic projection BJS sprite scenes set up); size is in\n * pixels; `cellIndex` selects the atlas frame.\n */\nexport class ThinSprite {\n public position = new Vector3(0, 0, 0);\n public width = 1;\n public height = 1;\n public cellIndex = 0;\n public angle = 0;\n public color = new Color4(1, 1, 1, 1);\n public invertU = false;\n public invertV = false;\n public isVisible = true;\n}\n\ninterface ThinSpriteLike {\n position: { x: number; y: number };\n width: number;\n height: number;\n cellIndex: number;\n angle: number;\n color: { r: number; g: number; b: number; a: number };\n invertU: boolean;\n invertV: boolean;\n isVisible: boolean;\n}\n\n/**\n * Babylon.js `SpriteRenderer` — the low-level, scene-less pixel-space sprite\n * pass. Babylon.js scenes build an array of {@link ThinSprite}s and call\n * `renderer.render(sprites, dt, view, projection)` from their own render loop\n * with an orthographic pixel projection.\n *\n * Babylon Lite's equivalent is `createSpriteRenderer` + a pixel-space\n * `Sprite2DLayer`. The atlas image loads asynchronously, so the renderer\n * registers the atlas load as engine startup work (evaluated once `cellWidth`/\n * `cellHeight` are set), then builds + registers a self-drawing Lite sprite\n * renderer on the first `render(...)` call (the engine invokes the loop callback\n * once after startup for scene-less loops). Subsequent `render(...)` calls push\n * live per-sprite updates so animated scenes stay in sync.\n *\n * Coordinate mapping: BJS sprite positions are bottom-left-origin pixels (the\n * scenes use `OrthoOffCenterLH(0, w, 0, h)` and set `y = canvas.height - topY`),\n * whereas Lite `Sprite2DLayer` uses top-left-origin pixels — so the Y axis is\n * flipped (`positionPx.y = canvasHeight - sprite.position.y`) and the rotation\n * sign is negated to match.\n */\nexport class SpriteRenderer {\n public texture: { name: string; samplingMode?: number } | null = null;\n public cellWidth = 0;\n public cellHeight = 0;\n public disableDepthWrite = false;\n /** Babylon.js `Constants.ALPHA_*` blend mode. `ALPHA_PREMULTIPLIED` maps to Lite's premultiplied path. */\n public blendMode = 2;\n /** @internal Babylon.js scenes poll this to gate readiness; true once the Lite renderer is built. */\n public _shadersLoaded = false;\n\n private readonly _engine: WebGPUEngine;\n private readonly _capacity: number;\n private _atlas?: SpriteAtlas;\n private _layer?: Sprite2DLayer;\n private _built = false;\n private readonly _indices: number[] = [];\n private _sprites: ThinSpriteLike[] = [];\n\n public constructor(engine: WebGPUEngine, capacity = 256, _epsilon = 0.01, _scene?: unknown) {\n this._engine = engine;\n this._capacity = capacity;\n // Defer the atlas load to engine startup: the thunk runs after the scene\n // setup code has assigned `texture`/`cellWidth`/`cellHeight`.\n engine._registerStartupWork(async () => {\n if (!this.texture) {\n return;\n }\n const premultiplied = this.blendMode === ALPHA_PREMULTIPLIED;\n this._atlas = await loadSpriteAtlas(engine._lite, this.texture.name, {\n gridSize: [this.cellWidth, this.cellHeight],\n sampling: this.texture.samplingMode === 1 ? \"nearest\" : \"linear\",\n premultipliedAlpha: premultiplied,\n });\n });\n }\n\n /** Babylon.js `SpriteRenderer.isReady()` — the next render can build once its atlas is loaded. */\n public isReady(): boolean {\n return this._atlas !== undefined;\n }\n\n /** @internal Map the Babylon.js blend mode to a Lite sprite blend descriptor. */\n private _blend(): SpriteBlendMode {\n if (this.blendMode === ALPHA_PREMULTIPLIED) {\n return spriteBlendPremultiplied;\n }\n if (this.blendMode === 1 || this.blendMode === 6) {\n return spriteBlendAdditive;\n }\n return spriteBlendAlpha;\n }\n\n /**\n * Babylon.js `renderer.render(sprites, deltaTime, viewMatrix, projectionMatrix)`.\n * The matrices are owned by Babylon Lite's pixel-space sprite pass, so they are\n * accepted for API parity but not consumed. First call builds + registers the\n * Lite sprite renderer; later calls push per-sprite updates.\n */\n public render(sprites: readonly ThinSpriteLike[], _deltaTime?: number, _view?: unknown, _projection?: unknown): void {\n this._sprites = sprites as ThinSpriteLike[];\n if (!this._atlas) {\n return;\n }\n const canvasHeight = this._engine.getRenderingCanvas().height;\n if (!this._built) {\n const layer = createSprite2DLayer(this._atlas, { capacity: this._capacity, depth: \"none\", blendMode: this._blend() });\n for (const s of this._sprites) {\n this._indices.push(addSprite2DIndex(layer, this._spriteProps(s, canvasHeight)));\n }\n this._layer = layer;\n const renderer = createSpriteRenderer(this._engine._lite, {\n layers: [layer],\n // Only clear if the scene drove a `engine.clear(...)` (scene-less 2D\n // path); when overlaying a 3D scene the renderer must preserve the\n // already-rendered colour, so it draws without clearing.\n clear: this._engine._clearRequested,\n clearValue: { ...this._engine._lastClearColor },\n });\n registerSpriteRenderer(renderer);\n this._built = true;\n this._shadersLoaded = true;\n return;\n }\n // Live update path (animated scenes): re-sync each sprite's props.\n const layer = this._layer!;\n for (let i = 0; i < this._sprites.length; i++) {\n updateSprite2DIndex(layer, this._indices[i]!, this._spriteProps(this._sprites[i]!, canvasHeight));\n }\n }\n\n /** @internal Convert a BJS `ThinSprite` to Lite `Sprite2DProps` (Y-flip + rotation negate). */\n private _spriteProps(s: ThinSpriteLike, canvasHeight: number): Parameters<typeof addSprite2DIndex>[1] {\n return {\n positionPx: [s.position.x, canvasHeight - s.position.y],\n sizePx: [s.width, s.height],\n frame: s.cellIndex,\n rotation: -s.angle,\n color: [s.color.r, s.color.g, s.color.b, s.color.a],\n flipX: s.invertU,\n flipY: s.invertV,\n visible: s.isVisible,\n };\n }\n}\n","/**\n * Babylon.js-compatible `ShadowGenerator` over the Babylon Lite shadow factories.\n *\n * Babylon.js constructs a `ShadowGenerator(mapSize, light)`, toggles technique\n * flags (`usePercentageCloserFiltering`, `useBlurExponentialShadowMap`, …), and\n * registers casters via `addShadowCaster(mesh)`. Babylon Lite instead has\n * dedicated factories (`createEsmDirectionalShadowGenerator`,\n * `createPcfDirectionalShadowGenerator`, `createPcfSpotlightShadowGenerator`) and\n * requires the scene to be registered with `registerSceneWithShadowSupport`.\n *\n * This wrapper records the BJS-style configuration up front and defers the actual\n * Lite generator creation to engine start (when the GPU device and all caster\n * meshes exist), then wires `light.shadowGenerator` + caster meshes. The owning\n * scene flips to shadow-aware registration when any generator is present.\n */\n\nimport {\n createCsmDirectionalShadowGenerator,\n createEsmDirectionalShadowGenerator,\n createPcfDirectionalShadowGenerator,\n createPcfSpotlightShadowGenerator,\n setShadowTaskCasterMeshes,\n} from \"babylon-lite\";\nimport type { EngineContext, Mesh as LiteMesh } from \"babylon-lite\";\n\nimport { DirectionalLight, type Light } from \"../lights/lights.js\";\nimport type { AbstractMesh } from \"../meshes/meshes.js\";\nimport type { ObserverCallback } from \"../misc/observable.js\";\nimport type { Node } from \"../node/node.js\";\n\ntype LiteShadowGenerator = ReturnType<typeof createEsmDirectionalShadowGenerator>;\n\nexport class ShadowGenerator {\n private readonly _mapSize: number;\n private readonly _light: Light;\n private readonly _casters: AbstractMesh[] = [];\n private readonly _casterDisposeObservers = new Map<LiteMesh, { caster: AbstractMesh; observer: ObserverCallback<Node> }>();\n private _casterSyncScheduled = false;\n private _casterSyncDirty = false;\n private readonly _disposeBeforeRenderFlush: (() => void) | undefined = undefined;\n /** @internal The built Lite shadow generator (set in `_build`). Used to wire NME receivers. */\n public _liteGen: LiteShadowGenerator | undefined;\n\n public getClassName(): string {\n return \"ShadowGenerator\";\n }\n\n // ── BJS technique flags / tunables (read at build time) ──\n /** Percentage-closer filtering. */\n public usePercentageCloserFiltering = false;\n /** Contact-hardening (treated as PCF here). */\n public useContactHardeningShadow = false;\n /** Blurred exponential shadow map (the Babylon.js default soft-shadow path for directional lights). */\n public useBlurExponentialShadowMap = false;\n public useExponentialShadowMap = false;\n public useBlurCloseExponentialShadowMap = false;\n public useCloseExponentialShadowMap = false;\n public usePoissonSampling = false;\n public useKernelBlur = false;\n public blurKernel = 1;\n public blurScale = 2;\n public bias = 0.00005;\n public normalBias = 0;\n public darkness = 0;\n public depthScale = 50;\n public frustumEdgeFalloff = 0;\n public forceBackFacesOnly = false;\n /** Babylon.js ortho projection bounds (directional). */\n public orthoMinZ: number | undefined;\n public orthoMaxZ: number | undefined;\n\n public constructor(mapSize: number, light: Light) {\n this._mapSize = mapSize;\n this._light = light;\n light._shadowGenerator = this;\n const scene = light.getScene();\n if (scene) {\n scene._registerShadowGenerator(this);\n this._disposeBeforeRenderFlush = scene._registerBeforeRenderFlush(() => this._flushCasterSync());\n }\n }\n\n /** Babylon.js `addShadowCaster(mesh, includeDescendants?)`. */\n public addShadowCaster(mesh: AbstractMesh, includeDescendants = true): ShadowGenerator {\n let changed = false;\n for (const caster of this._casterTree(mesh, includeDescendants)) {\n if (!this._casters.some((existing) => existing._lite === caster._lite)) {\n this._casters.push(caster);\n this._detachCasterDisposeObserver(caster._lite);\n const observer: ObserverCallback<Node> = () => this._removeCaster(caster._lite, true, observer);\n caster.onDisposeObservable.add(observer);\n this._casterDisposeObservers.set(caster._lite, { caster, observer });\n changed = true;\n }\n }\n if (changed) {\n this._scheduleCasterSync();\n }\n return this;\n }\n\n /** Babylon.js `removeShadowCaster(mesh, includeDescendants?)`. */\n public removeShadowCaster(mesh: AbstractMesh, includeDescendants = true): ShadowGenerator {\n let changed = false;\n for (const caster of this._casterTree(mesh, includeDescendants)) {\n changed = this._removeCaster(caster._lite, false) || changed;\n }\n if (changed) {\n this._scheduleCasterSync();\n }\n return this;\n }\n\n private _casterTree(mesh: AbstractMesh, includeDescendants: boolean): AbstractMesh[] {\n return includeDescendants ? [mesh, ...(mesh.getChildMeshes() as AbstractMesh[])] : [mesh];\n }\n\n private _detachCasterDisposeObserver(liteMesh: LiteMesh): void {\n const registration = this._casterDisposeObservers.get(liteMesh);\n if (registration) {\n registration.caster.onDisposeObservable.remove(registration.observer);\n this._casterDisposeObservers.delete(liteMesh);\n }\n }\n\n private _removeCaster(liteMesh: LiteMesh, scheduleSync = true, expectedObserver?: ObserverCallback<Node>): boolean {\n const registration = this._casterDisposeObservers.get(liteMesh);\n if (expectedObserver && registration?.observer !== expectedObserver) {\n return false;\n }\n\n const index = this._casters.findIndex((existing) => existing._lite === liteMesh);\n const changed = index !== -1;\n if (changed) {\n this._casters.splice(index, 1);\n }\n this._detachCasterDisposeObserver(liteMesh);\n if (changed && scheduleSync) {\n this._scheduleCasterSync();\n }\n return changed;\n }\n\n private _scheduleCasterSync(): void {\n if (!this._liteGen) {\n return;\n }\n this._casterSyncDirty = true;\n if (this._casterSyncScheduled) {\n return;\n }\n this._casterSyncScheduled = true;\n queueMicrotask(() => {\n this._casterSyncScheduled = false;\n this._flushCasterSync();\n });\n }\n\n private _flushCasterSync(): void {\n if (!this._casterSyncDirty || !this._liteGen) {\n return;\n }\n this._casterSyncDirty = false;\n setShadowTaskCasterMeshes(this._liteGen, this._liteCasterMeshes());\n }\n\n /**\n * The Lite meshes handed to the native shadow task: every requested caster that carries GPU geometry.\n * The compat loader wraps a model's complete hierarchy as `Mesh`es, so `addShadowCaster(root, true)`\n * legitimately collects transform-only roots and intermediate nodes into `renderList`, exactly as\n * Babylon.js does. Those nodes must not reach the native state: the render task cannot build a\n * renderable for a mesh without `_gpu` (it would throw inside the frame, every frame), and directional\n * fitting would substitute default bounds for it, distorting the shadow volume.\n */\n private _liteCasterMeshes(): LiteMesh[] {\n const meshes: LiteMesh[] = [];\n for (const caster of this._casters) {\n const lite = caster._lite as LiteMesh;\n if ((lite as { _gpu?: unknown })._gpu) {\n meshes.push(lite);\n }\n }\n return meshes;\n }\n\n /** Babylon.js `getShadowMap()` — returns a minimal render-list holder for parity. */\n public getShadowMap(): { renderList: AbstractMesh[] } {\n return { renderList: this._casters };\n }\n\n public getDarkness(): number {\n return this.darkness;\n }\n public setDarkness(value: number): ShadowGenerator {\n this.darkness = value;\n return this;\n }\n\n public getLight(): Light {\n return this._light;\n }\n\n public dispose(): void {\n this._disposeBeforeRenderFlush?.();\n this._light.getScene()?._unregisterShadowGenerator(this);\n for (const { caster, observer } of this._casterDisposeObservers.values()) {\n caster.onDisposeObservable.remove(observer);\n }\n this._casterDisposeObservers.clear();\n this._casterSyncScheduled = false;\n this._casterSyncDirty = false;\n this._liteGen = undefined;\n this._light._lite.shadowGenerator = undefined;\n if (this._light._shadowGenerator === this) {\n this._light._shadowGenerator = null;\n }\n }\n\n /**\n * @internal Build the underlying Lite shadow generator and wire casters. Called\n * by the engine at start, after meshes are added and before the scene registers.\n */\n public _build(engine: EngineContext): void {\n const liteLight = this._light._lite as never;\n const className = this._light.getClassName();\n const usePcf = this.usePercentageCloserFiltering || this.useContactHardeningShadow || this.usePoissonSampling;\n\n let liteGen;\n if (this instanceof CascadedShadowGenerator) {\n liteGen = createCsmDirectionalShadowGenerator(engine, liteLight, {\n mapSize: this._mapSize,\n numCascades: this.numCascades,\n lambda: this.lambda,\n cascadeBlendPercentage: this.cascadeBlendPercentage,\n stabilizeCascades: this.stabilizeCascades,\n shadowMaxZ: this.shadowMaxZ,\n bias: this.bias,\n darkness: this.darkness,\n frustumEdgeFalloff: this.frustumEdgeFalloff,\n });\n } else if (className === \"SpotLight\") {\n // Lite has only a PCF spot generator.\n liteGen = createPcfSpotlightShadowGenerator(engine, liteLight, {\n mapSize: this._mapSize,\n bias: this.bias,\n darkness: this.darkness,\n normalBias: this.normalBias,\n });\n } else if (usePcf) {\n liteGen = createPcfDirectionalShadowGenerator(engine, liteLight, {\n mapSize: this._mapSize,\n bias: this.bias,\n darkness: this.darkness,\n normalBias: this.normalBias,\n ...(this.orthoMinZ !== undefined ? { orthoMinZ: this.orthoMinZ } : {}),\n ...(this.orthoMaxZ !== undefined ? { orthoMaxZ: this.orthoMaxZ } : {}),\n });\n } else {\n // Default directional soft shadow: ESM (Babylon.js default + blur variants).\n liteGen = createEsmDirectionalShadowGenerator(engine, liteLight, {\n mapSize: this._mapSize,\n depthScale: this.depthScale,\n bias: this.bias,\n blurKernel: this.useKernelBlur || this.useBlurExponentialShadowMap ? this.blurKernel : 1,\n blurScale: this.blurScale,\n darkness: this.darkness,\n frustumEdgeFalloff: this.frustumEdgeFalloff,\n ...(this.orthoMinZ !== undefined ? { orthoMinZ: this.orthoMinZ } : {}),\n ...(this.orthoMaxZ !== undefined ? { orthoMaxZ: this.orthoMaxZ } : {}),\n });\n }\n\n (liteLight as { shadowGenerator?: unknown }).shadowGenerator = liteGen;\n this._liteGen = liteGen;\n this._casterSyncDirty = false;\n setShadowTaskCasterMeshes(liteGen, this._liteCasterMeshes());\n }\n}\n\n/** Babylon.js `CascadedShadowGenerator` backed by Lite's native CSM generator. */\nexport class CascadedShadowGenerator extends ShadowGenerator {\n private _numCascades = 4;\n public lambda = 0.5;\n public cascadeBlendPercentage = 0.1;\n public stabilizeCascades = false;\n public shadowMaxZ: number | undefined;\n public depthClamp = true;\n public autoCalcDepthBounds = false;\n\n public constructor(mapSize: number, light: DirectionalLight) {\n if (!(light instanceof DirectionalLight)) {\n throw new TypeError(\"CascadedShadowGenerator requires a DirectionalLight\");\n }\n super(mapSize, light);\n }\n\n public get numCascades(): number {\n return this._numCascades;\n }\n\n public set numCascades(value: number) {\n this._numCascades = Math.min(Math.max(value, 2), 4);\n }\n\n public override getClassName(): string {\n return \"CascadedShadowGenerator\";\n }\n}\n","/**\n * Babylon.js-compatible `NodeMaterial` over Babylon Lite's NME parser.\n *\n * Babylon.js exposes a synchronous `NodeMaterial.Parse(json, scene)`, optional\n * `getBlockByName(name).texture = …` overrides, then `build()`. Babylon Lite\n * instead parses an NME graph asynchronously via `parseNodeMaterialFromSnippet`,\n * taking texture overrides up front (keyed by block name) and emitting/compiling\n * the pipeline in one shot.\n *\n * The compat wrapper bridges the two: `Parse` returns immediately with an\n * unparsed handle and records the source; `getBlockByName` returns a thin proxy\n * that captures per-block texture assignments; the real (async) parse is deferred\n * to engine start — registered with the scene so it is awaited (alongside its\n * override textures) before the scene builds. `build()` is a no-op.\n */\n\nimport { parseNodeMaterialFromSnippet } from \"babylon-lite\";\nimport type { EngineContext, Material as LiteMaterial, NodeMaterial as LiteNodeMaterial, Texture2D } from \"babylon-lite\";\n\nimport type { Scene } from \"../scene/scene.js\";\n\ninterface TextureLike {\n _lite?: Texture2D;\n whenReadyAsync?(): Promise<void>;\n}\n\n/** A thin proxy for a Babylon.js NME block, capturing texture assignments. */\nclass NodeMaterialBlockProxy {\n public constructor(\n private readonly _owner: NodeMaterial,\n private readonly _name: string\n ) {}\n\n public set texture(value: TextureLike | null) {\n this._owner._setBlockTexture(this._name, value);\n }\n public get texture(): TextureLike | null {\n return this._owner._getBlockTexture(this._name);\n }\n}\n\nexport class NodeMaterial {\n public name: string;\n public backFaceCulling = true;\n /** @internal The compiled Lite node material. Undefined until the async parse resolves. */\n public _lite: LiteNodeMaterial | undefined;\n\n private readonly _json: object | string;\n private readonly _textureOverrides: Record<string, TextureLike> = {};\n private readonly _scene: Scene;\n private readonly _pendingBindings = new Map<{ material: LiteMaterial }, () => boolean>();\n private _parsed = false;\n\n public constructor(name: string, scene: Scene, json: object | string = {}) {\n this.name = name;\n this._scene = scene;\n this._json = json;\n }\n\n public getClassName(): string {\n return \"NodeMaterial\";\n }\n\n /**\n * Babylon.js `NodeMaterial.clone(name)`. Reuses the same NME source graph and the\n * captured per-block texture overrides (textures shared by reference, as\n * Babylon.js does), registering the clone with the scene so it parses/compiles its\n * own Lite node material (own renderable) at engine start.\n */\n public clone(name: string): NodeMaterial {\n const cloned = new NodeMaterial(name, this._scene, this._json);\n for (const [block, tex] of Object.entries(this._textureOverrides)) {\n cloned._textureOverrides[block] = tex;\n }\n cloned.backFaceCulling = this.backFaceCulling;\n // Keep assignments made immediately after clone() functional while the clone's\n // own async renderable is compiled. _parse replaces this temporary handle.\n cloned._lite = this._lite;\n this._scene._registerNodeMaterial(cloned);\n return cloned;\n }\n\n /** Babylon.js `getBlockByName(name)` — returns a proxy that captures texture overrides. */\n public getBlockByName(name: string): NodeMaterialBlockProxy {\n return new NodeMaterialBlockProxy(this, name);\n }\n\n /** @internal */\n public _setBlockTexture(name: string, value: TextureLike | null): void {\n if (value) {\n this._textureOverrides[name] = value;\n } else {\n delete this._textureOverrides[name];\n }\n }\n\n /** @internal */\n public _getBlockTexture(name: string): TextureLike | null {\n return this._textureOverrides[name] ?? null;\n }\n\n /** Babylon.js `NodeMaterial.build()` — Lite builds during parse, so this is a no-op. */\n public build(_verbose?: boolean): void {\n // Intentionally empty.\n }\n\n /** @internal Parse already happened via the scene-tracked promise; nothing to finalize. */\n public _ensureRenderable(_engine: EngineContext): void {\n // No-op: `_lite` is set when the tracked parse promise resolves.\n }\n\n /** @internal Bind a mesh immediately and refresh it if still assigned when parsing finishes. */\n public _bindMesh(mesh: { material: LiteMaterial }, isCurrent: () => boolean): void {\n if (!this._parsed) {\n this._pendingBindings.set(mesh, isCurrent);\n }\n if (this._lite) {\n mesh.material = this._lite;\n }\n }\n\n public dispose(): void {\n // GPU resources owned by the scene; disposed with it.\n }\n\n /** @internal Resolve override textures, then parse + compile the NME graph. */\n public async _parse(engine: EngineContext, shadowGenerators: readonly unknown[] = []): Promise<void> {\n // Yield once so any synchronous `getBlockByName(name).texture = …` overrides\n // set immediately after `Parse()` are recorded before we read them.\n await Promise.resolve();\n const overrides = Object.entries(this._textureOverrides);\n await Promise.all(overrides.map(([, tex]) => tex.whenReadyAsync?.() ?? Promise.resolve()));\n const textures: Record<string, Texture2D> = {};\n for (const [blockName, tex] of overrides) {\n if (tex._lite) {\n textures[blockName] = tex._lite;\n }\n }\n try {\n this._lite = await parseNodeMaterialFromSnippet(engine, \"\", {\n json: this._json,\n ...(overrides.length ? { textures } : {}),\n // Babylon.js wires shadows into the scene globally; Babylon Lite takes them\n // at NME parse time, so NME shadow-receiver blocks sample the scene's\n // generators (e.g. ground `receiveShadows` in scenes 65/66).\n ...(shadowGenerators.length ? { shadowGenerators: shadowGenerators as never } : {}),\n });\n this._parsed = true;\n for (const [mesh, isCurrent] of this._pendingBindings) {\n if (isCurrent()) {\n mesh.material = this._lite;\n }\n }\n } finally {\n this._pendingBindings.clear();\n }\n }\n\n /**\n * Babylon.js `NodeMaterial.Parse(source, scene, rootUrl?)` — parse an NME graph\n * from inline JSON. Returns synchronously; the actual GPU compile runs async and\n * is driven by the engine (after shadow generators are built) before the scene\n * builds, so NME shadow-receiver blocks can sample the scene's shadow generators.\n */\n public static Parse(source: object | string, scene: Scene, _rootUrl?: string): NodeMaterial {\n const material = new NodeMaterial(\"nodeMaterial\", scene, source);\n scene._registerNodeMaterial(material);\n return material;\n }\n}\n","/**\n * Babylon.js `@babylonjs/materials` `GridMaterial` over Babylon Lite's native\n * `createGridMaterial`.\n *\n * Babylon.js' `GridMaterial` is constructed empty and then has its appearance set\n * via mutable properties (`mainColor`, `lineColor`, `gridRatio`, …). Babylon Lite\n * instead bakes the grid options into a `ShaderMaterial` at creation time. The\n * compat wrapper accumulates the Babylon.js property assignments and builds the\n * Lite grid material lazily in {@link _ensureRenderable} (engine start, after all\n * properties are set), then exposes it as `_lite` so the mesh binds it.\n */\n\nimport { createGridMaterial } from \"babylon-lite\";\nimport type { EngineContext, ShaderMaterial as LiteShaderMaterial } from \"babylon-lite\";\n\nimport { Color3 } from \"../math/color.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport type { Scene } from \"../scene/scene.js\";\n\nexport class GridMaterial {\n public name: string;\n /** Background color between the lines (Babylon.js default black). */\n public mainColor = new Color3(0, 0, 0);\n /** Color of the grid lines (Babylon.js default teal). */\n public lineColor = new Color3(0.2, 0.2, 0.2);\n /** Spacing of the grid in object-space units. */\n public gridRatio = 1;\n /** Object-space offset added before computing the grid. */\n public gridOffset = new Vector3(0, 0, 0);\n /** Every Nth line is a major line. */\n public majorUnitFrequency = 10;\n /** Visibility of the minor (non-major) lines, `0..1`. */\n public minorUnitVisibility = 0.33;\n /** Opacity of the grid outside the lines; `<1` enables the transparent path. */\n public opacity = 1;\n /** Cosine-based antialiasing of the lines. */\n public antialias = true;\n /** Combine axes with `max` instead of additive sum. */\n public useMaxLine = false;\n /**\n * Babylon.js `@babylonjs/materials` 9.x `linesOnly` — show only the lines with\n * transparency between them. Babylon Lite expresses this via the opacity (`<1`)\n * transparent path, so enabling it forces that path.\n */\n public linesOnly = false;\n /** Back-face culling toggle. */\n public backFaceCulling = true;\n /** Babylon.js `Material.transparencyMode` (accepted for parity). */\n public transparencyMode: number | null = null;\n /** Wireframe toggle (not honoured by the grid material). */\n public wireframe = false;\n\n /** @internal The built Lite grid shader material (created at engine start). */\n public _lite: LiteShaderMaterial | undefined;\n\n public constructor(name: string, _scene?: Scene) {\n this.name = name;\n }\n\n public getClassName(): string {\n return \"GridMaterial\";\n }\n\n /**\n * @internal Build the Lite grid material from the accumulated Babylon.js\n * properties. Called by the engine just before the owning mesh is registered.\n */\n public _ensureRenderable(_engine: EngineContext): void {\n // `linesOnly` maps to Babylon Lite's transparent (opacity < 1) path; if the\n // caller left opacity at 1, nudge it just under 1 so the lines-only blend runs.\n const opacity = this.linesOnly && this.opacity >= 1 ? 0.9999 : this.opacity;\n this._lite = createGridMaterial({\n name: this.name,\n mainColor: [this.mainColor.r, this.mainColor.g, this.mainColor.b],\n lineColor: [this.lineColor.r, this.lineColor.g, this.lineColor.b],\n gridRatio: this.gridRatio,\n gridOffset: [this.gridOffset.x, this.gridOffset.y, this.gridOffset.z],\n majorUnitFrequency: this.majorUnitFrequency,\n minorUnitVisibility: this.minorUnitVisibility,\n opacity,\n antialias: this.antialias,\n useMaxLine: this.useMaxLine,\n backFaceCulling: this.backFaceCulling,\n });\n }\n\n public dispose(): void {\n // GPU resources are owned by the scene; disposed with it.\n }\n}\n","/**\n * Babylon.js `MaterialHelper` free functions from `@babylonjs/core`'s\n * `materialHelper.functions`. These are thin capability adapters — they read the\n * compat engine's reported {@link WebGPUEngine.getCaps | caps} and return a number;\n * no rendering or material behaviour lives here.\n */\n\nimport type { Scene } from \"../scene/scene.js\";\n\n// The vertex stage always binds Scene, Mesh, Material and LeftOver uniform buffers in\n// addition to the per-light ones. This is the exact BJS reservation used to work out\n// how many lights still fit within the device's per-stage uniform-buffer limit.\nconst NON_LIGHT_VERTEX_UNIFORM_BUFFER_COUNT = 4;\n\n/**\n * Babylon.js `GetSupportedSimultaneousLights(scene, maxSimultaneousLights)`.\n *\n * Returns the number of simultaneous lights the engine can actually render, which\n * may be lower than the requested maximum. Engines that declare one uniform buffer\n * per light in the vertex shader (WebGPU) are bounded by\n * `maxUniformBuffersPerShaderStage`; past that limit every pipeline creation is\n * rejected by the validator and nothing renders. Engines that do not report the\n * limit leave the requested count untouched.\n */\nexport function GetSupportedSimultaneousLights(scene: Scene, maxSimultaneousLights: number): number {\n const maxUniformBuffersPerShaderStage = scene.getEngine().getCaps().maxUniformBuffersPerShaderStage as number | undefined;\n\n // Engines that do not report the limit do not enforce it: leave the count untouched.\n // Tested against null rather than for truthiness so a limit of 0 still clamps.\n if (maxUniformBuffersPerShaderStage == null) {\n return maxSimultaneousLights;\n }\n\n // Each light claims one more uniform buffer on top of the reserved non-light ones.\n // Clamp to whatever budget is left, which may be zero: past the limit every pipeline\n // creation is rejected by the validator, so a material that renders unlit is strictly\n // better than one that returns a light count the device cannot honour. Real WebGPU\n // devices guarantee at least 12 buffers per stage, so this floor only bites the\n // pathological low-cap case the null path below cannot reach.\n const supported = Math.max(maxUniformBuffersPerShaderStage - NON_LIGHT_VERTEX_UNIFORM_BUFFER_COUNT, 0);\n\n return Math.min(maxSimultaneousLights, supported);\n}\n","/**\n * Babylon.js-compatible easing functions over Babylon Lite's functional curves.\n *\n * These retain Babylon.js's class hierarchy and easing modes for porting while\n * delegating curve math to tree-shakable native Lite functions.\n */\n\nimport {\n backEase,\n bezierCurveEase,\n bounceEase,\n circleEase,\n cubicEase,\n elasticEase,\n exponentialEase,\n powerEase,\n quadraticEase,\n quarticEase,\n quinticEase,\n sineEase,\n} from \"babylon-lite\";\n\nexport const EASINGMODE_EASEIN = 0;\nexport const EASINGMODE_EASEOUT = 1;\nexport const EASINGMODE_EASEINOUT = 2;\n\n/**\n * Contract implemented by Babylon.js easing functions.\n *\n * Custom easing objects only need to transform a normalized segment gradient.\n */\nexport interface IEasingFunction {\n /**\n * Transform a segment-local gradient.\n * @param gradient - Linear progress through the current keyframe segment.\n * @returns The progress used for interpolation. Values are not clamped.\n */\n ease(gradient: number): number;\n}\n\nexport abstract class EasingFunction implements IEasingFunction {\n public static readonly EASINGMODE_EASEIN = EASINGMODE_EASEIN;\n public static readonly EASINGMODE_EASEOUT = EASINGMODE_EASEOUT;\n public static readonly EASINGMODE_EASEINOUT = EASINGMODE_EASEINOUT;\n\n private _mode = EASINGMODE_EASEIN;\n\n public setEasingMode(mode: number): void {\n this._mode = Math.min(2, Math.max(0, mode));\n }\n\n public getEasingMode(): number {\n return this._mode;\n }\n\n /** The raw ease-in curve, implemented by each subclass over `gradient` in [0, 1]. */\n public abstract easeInCore(gradient: number): number;\n\n public ease(gradient: number): number {\n switch (this._mode) {\n case EASINGMODE_EASEIN:\n return this.easeInCore(gradient);\n case EASINGMODE_EASEOUT:\n return 1 - this.easeInCore(1 - gradient);\n default:\n return gradient >= 0.5 ? 1 - this.easeInCore((1 - gradient) * 2) * 0.5 : this.easeInCore(gradient * 2) * 0.5;\n }\n }\n}\n\nexport class CircleEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return circleEase(gradient);\n }\n}\n\nexport class QuadraticEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return quadraticEase(gradient);\n }\n}\n\nexport class CubicEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return cubicEase(gradient);\n }\n}\n\nexport class QuarticEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return quarticEase(gradient);\n }\n}\n\nexport class QuinticEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return quinticEase(gradient);\n }\n}\n\nexport class SineEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return sineEase(gradient);\n }\n}\n\nexport class ExponentialEase extends EasingFunction {\n public constructor(public exponent: number = 2) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n return exponentialEase(gradient, this.exponent);\n }\n}\n\nexport class BackEase extends EasingFunction {\n public constructor(public amplitude: number = 1) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n return backEase(gradient, this.amplitude);\n }\n}\n\nexport class ElasticEase extends EasingFunction {\n public constructor(\n public oscillations: number = 3,\n public springiness: number = 3\n ) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n return elasticEase(gradient, this.oscillations, this.springiness);\n }\n}\n\nexport class BounceEase extends EasingFunction {\n public constructor(\n public bounces: number = 3,\n public bounciness: number = 2\n ) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n return bounceEase(gradient, this.bounces, this.bounciness);\n }\n}\n\n/**\n * Babylon.js-compatible power easing class.\n */\nexport class PowerEase extends EasingFunction {\n public constructor(public power: number = 2) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n return powerEase(gradient, this.power);\n }\n}\n\n/**\n * Babylon.js-compatible cubic Bezier easing class.\n */\nexport class BezierCurveEase extends EasingFunction {\n public constructor(\n public x1: number = 0,\n public y1: number = 0,\n public x2: number = 1,\n public y2: number = 1\n ) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n return bezierCurveEase(gradient, this.x1, this.y1, this.x2, this.y2);\n }\n}\n","/** Babylon.js-compatible GUID helpers (`@babylonjs/core` `Misc/guid`). */\n\n/**\n * Generate a pseudo-random RFC4122 v4 UUID, matching Babylon.js `RandomGUID`.\n * Be aware `Math.random()` could cause collisions, but all except 6 of the 128 bits are\n * randomly generated, so any two ids have a 1 in 2^122 chance of colliding.\n * @returns a pseudo random id\n */\nexport function RandomGUID(): string {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\n/**\n * Namespace-like object used to manipulate GUIDs, matching Babylon.js `GUID`.\n * Babylon.js declares `GUID` as a `const` object literal rather than a class, so the\n * compat layer mirrors that shape: consumers call `GUID.RandomId()` without `new`.\n */\nexport const GUID = {\n /**\n * Generate a pseudo-random RFC4122 v4 UUID. Alias of {@link RandomGUID}.\n * @returns a pseudo random id\n */\n RandomId: RandomGUID,\n};\n","/** Babylon.js-compatible `Tools` helpers (the small, pure subset). */\n\nimport { RandomGUID } from \"./guid.js\";\nimport { PrecisionDate } from \"./misc-utils.js\";\n\nexport const Tools = {\n /** Current high-resolution timestamp in milliseconds, matching Babylon.js's numeric property. */\n get Now(): number {\n return PrecisionDate.Now;\n },\n\n ToRadians(degrees: number): number {\n return (degrees * Math.PI) / 180;\n },\n\n ToDegrees(radians: number): number {\n return (radians * 180) / Math.PI;\n },\n\n /** Clamp `value` into the inclusive `[min, max]` range. */\n Clamp(value: number, min = 0, max = 1): number {\n return Math.min(max, Math.max(min, value));\n },\n\n /** Generate an RFC4122 v4 UUID (used by Babylon.js for unique ids). */\n RandomId(): string {\n return RandomGUID();\n },\n};\n","/**\n * Babylon.js-compatible Actions: `ActionManager`, `Action`, the common concrete\n * actions, and `Condition` variants.\n *\n * This is the structural/behavioural surface in pure JS. Triggers are not yet\n * auto-wired to Babylon Lite's input pipeline (that needs a unified pointer\n * pipe — see `COMPAT-STATUS.md`), so actions are dispatched manually via\n * `ActionManager.processTrigger(trigger)`. The action/condition execution model\n * itself is fully implemented and testable.\n */\n\n/** Babylon.js `ActionManager` trigger constants (subset). */\nexport const ActionManagerTriggers = {\n NothingTrigger: 0,\n OnPickTrigger: 1,\n OnLeftPickTrigger: 2,\n OnRightPickTrigger: 3,\n OnCenterPickTrigger: 4,\n OnPickDownTrigger: 5,\n OnDoublePickTrigger: 6,\n OnPickUpTrigger: 7,\n OnPickOutTrigger: 16,\n OnPointerOverTrigger: 10,\n OnPointerOutTrigger: 11,\n OnEveryFrameTrigger: 14,\n} as const;\n\ninterface ActionEvent {\n source: unknown;\n pointerX: number;\n pointerY: number;\n meshUnderPointer: unknown;\n additionalData?: unknown;\n}\n\n/** Base class for actions. `execute` is implemented by subclasses. */\nexport abstract class Action {\n public trigger: number;\n /** Condition gating execution. When set, `execute` runs only if it evaluates true. */\n public condition: Condition | undefined;\n\n private _nextActiveAction: Action | null = null;\n\n public constructor(trigger: number, condition?: Condition) {\n this.trigger = trigger;\n this.condition = condition;\n }\n\n public abstract execute(evt?: ActionEvent): void;\n\n /** Chain another action to run after this one (Babylon.js `then`). */\n public then(action: Action): Action {\n this._nextActiveAction = action;\n return action;\n }\n\n /** @internal Run this action (honouring its condition) and any chained action. */\n public _executeCurrent(evt?: ActionEvent): void {\n if (this.condition && !this.condition.isValid()) {\n return;\n }\n this.execute(evt);\n this._nextActiveAction?._executeCurrent(evt);\n }\n}\n\n/** Runs a user callback when triggered. */\nexport class ExecuteCodeAction extends Action {\n public constructor(\n trigger: number,\n private readonly _func: (evt?: ActionEvent) => void,\n condition?: Condition\n ) {\n super(trigger, condition);\n }\n\n public execute(evt?: ActionEvent): void {\n this._func(evt);\n }\n}\n\n/** Sets `target[propertyPath] = value` when triggered. */\nexport class SetValueAction extends Action {\n public constructor(\n trigger: number,\n private readonly _target: Record<string, unknown>,\n private readonly _propertyPath: string,\n private readonly _value: unknown,\n condition?: Condition\n ) {\n super(trigger, condition);\n }\n\n public execute(): void {\n setByPath(this._target, this._propertyPath, this._value);\n }\n}\n\n/** Adds `value` to `target[propertyPath]` when triggered. */\nexport class IncrementValueAction extends Action {\n public constructor(\n trigger: number,\n private readonly _target: Record<string, unknown>,\n private readonly _propertyPath: string,\n private readonly _value: number,\n condition?: Condition\n ) {\n super(trigger, condition);\n }\n\n public execute(): void {\n const current = getByPath(this._target, this._propertyPath);\n if (typeof current === \"number\") {\n setByPath(this._target, this._propertyPath, current + this._value);\n }\n }\n}\n\n/** Base class for action conditions. */\nexport abstract class Condition {\n public abstract isValid(): boolean;\n}\n\nexport const ValueConditionOperators = {\n IsEqual: 0,\n IsDifferent: 1,\n IsGreater: 2,\n IsLesser: 3,\n} as const;\n\n/** Compares `target[propertyPath]` against a value with an operator. */\nexport class ValueCondition extends Condition {\n public constructor(\n private readonly _target: Record<string, unknown>,\n private readonly _propertyPath: string,\n private readonly _value: number,\n private readonly _operator: number = ValueConditionOperators.IsEqual\n ) {\n super();\n }\n\n public isValid(): boolean {\n const current = getByPath(this._target, this._propertyPath);\n if (typeof current !== \"number\") {\n return false;\n }\n switch (this._operator) {\n case ValueConditionOperators.IsEqual:\n return current === this._value;\n case ValueConditionOperators.IsDifferent:\n return current !== this._value;\n case ValueConditionOperators.IsGreater:\n return current > this._value;\n case ValueConditionOperators.IsLesser:\n return current < this._value;\n default:\n return false;\n }\n }\n}\n\n/** Evaluates a user predicate. */\nexport class PredicateCondition extends Condition {\n public constructor(private readonly _predicate: () => boolean) {\n super();\n }\n\n public isValid(): boolean {\n return this._predicate();\n }\n}\n\n/**\n * Babylon.js `ActionManager`. Register actions with `registerAction`, then\n * dispatch them with `processTrigger(trigger, evt?)`. (Automatic trigger\n * dispatch from input is not yet wired — see module docs.)\n */\nexport class ActionManager {\n public static readonly Triggers = ActionManagerTriggers;\n\n public readonly actions: Action[] = [];\n\n public registerAction(action: Action): Action {\n this.actions.push(action);\n return action;\n }\n\n public unregisterAction(action: Action): boolean {\n const index = this.actions.indexOf(action);\n if (index !== -1) {\n this.actions.splice(index, 1);\n return true;\n }\n return false;\n }\n\n public hasSpecificTrigger(trigger: number): boolean {\n return this.actions.some((a) => a.trigger === trigger);\n }\n\n /** Dispatch every registered action matching `trigger`. */\n public processTrigger(trigger: number, evt?: ActionEvent): void {\n for (const action of this.actions) {\n if (action.trigger === trigger) {\n action._executeCurrent(evt);\n }\n }\n }\n}\n\nfunction getByPath(target: Record<string, unknown>, path: string): unknown {\n const parts = path.split(\".\");\n let current: unknown = target;\n for (const part of parts) {\n if (current == null || typeof current !== \"object\") {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n return current;\n}\n\nfunction setByPath(target: Record<string, unknown>, path: string, value: unknown): void {\n const parts = path.split(\".\");\n let current: Record<string, unknown> = target;\n for (let i = 0; i < parts.length - 1; i++) {\n current = current[parts[i]!] as Record<string, unknown>;\n if (current == null) {\n return;\n }\n }\n current[parts[parts.length - 1]!] = value;\n}\n","/**\n * Babylon.js AudioV2 enums and small shared helpers.\n *\n * These mirror the `@babylonjs/core` `AudioV2` `const enum`s exactly (same member\n * names and values) so ported code that reads e.g. `SoundState.Started` or\n * `AudioParameterRampShape.Linear` resolves identically.\n */\n\nimport type { RampOptions as LiteRampOptions } from \"babylon-lite\";\n\n/** Playback state of a sound (mirrors `@babylonjs/core` `SoundState`). */\nexport const SoundState = {\n Stopping: 0,\n Stopped: 1,\n Starting: 2,\n Started: 3,\n FailedToStart: 4,\n Paused: 5,\n} as const;\nexport type SoundState = (typeof SoundState)[keyof typeof SoundState];\n\n/** Ramp shape used when changing an audio parameter (mirrors `AudioParameterRampShape`). */\nexport const AudioParameterRampShape = {\n Linear: \"linear\",\n Exponential: \"exponential\",\n Logarithmic: \"logarithmic\",\n None: \"none\",\n} as const;\nexport type AudioParameterRampShape = (typeof AudioParameterRampShape)[keyof typeof AudioParameterRampShape];\n\n/** Which transform components a spatial sound/listener follows (mirrors `SpatialAudioAttachmentType`). */\nexport const SpatialAudioAttachmentType = {\n Position: 1,\n Rotation: 2,\n PositionAndRotation: 3,\n} as const;\nexport type SpatialAudioAttachmentType = (typeof SpatialAudioAttachmentType)[keyof typeof SpatialAudioAttachmentType];\n\n/** FFT window sizes accepted by the analyzer (mirrors `AudioAnalyzerFFTSizeType`). */\nexport type AudioAnalyzerFFTSizeType = 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096 | 8192 | 16384 | 32768;\n\n/** Engine context state (mirrors `AudioEngineV2State`). */\nexport type AudioEngineV2State = \"closed\" | \"interrupted\" | \"running\" | \"suspended\";\n\n/** Babylon.js `IAudioParameterRampOptions`. */\nexport interface IAudioParameterRampOptions {\n /** Ramp time, in seconds. */\n duration: number;\n /** Ramp shape. */\n shape: AudioParameterRampShape;\n}\n\n/**\n * Maps a Babylon.js ramp option bag to the Lite `RampOptions` shape. The shape\n * string values are identical between the two APIs, so this is a structural pass\n * through.\n * @internal\n */\nexport function toLiteRamp(options?: Partial<IAudioParameterRampOptions> | null): LiteRampOptions | undefined {\n if (!options) {\n return undefined;\n }\n return { duration: options.duration, shape: options.shape };\n}\n","/**\n * Babylon.js AudioV2 (`AudioEngineV2` and friends) implemented on top of the\n * Babylon Lite audio port.\n *\n * The Lite audio API is pure state + standalone functions (`createAudioEngineAsync`,\n * `playSound`, `setBusVolume`, …); Babylon.js AudioV2 is a class hierarchy of\n * `AbstractAudioNode` subclasses with mutable properties. This module reproduces\n * the BJS class names, inheritance chain, and public members exactly, holding the\n * corresponding Lite handle as `_lite` and proxying property get/set + methods to\n * the Lite functions.\n *\n * Inheritance chain mirrored from `@babylonjs/core`:\n *\n * AbstractAudioNode\n * └─ AbstractNamedAudioNode\n * └─ AbstractAudioOutNode (volume / analyzer)\n * ├─ AbstractAudioBus → AudioBus / MainAudioBus\n * └─ AbstractSoundSource\n * └─ AbstractSound → StaticSound / StreamingSound\n *\n * No module-level Web Audio allocation happens at import time, so a consumer that\n * never touches audio pays nothing.\n */\n\nimport {\n createAudioEngineAsync,\n disposeAudioEngine,\n unlockAudioEngineAsync,\n setMasterVolume,\n getMasterVolume,\n createSoundAsync,\n playSound,\n pauseSound,\n resumeSound,\n stopSound,\n disposeSound,\n setSoundVolume,\n createStreamingSoundAsync,\n preloadStreamingInstanceAsync,\n preloadStreamingInstancesAsync,\n playStreamingSound,\n pauseStreamingSound,\n resumeStreamingSound,\n stopStreamingSound,\n disposeStreamingSound,\n setStreamingSoundVolume,\n createAudioBusAsync,\n disposeAudioBus,\n setBusVolume,\n createSoundBufferAsync,\n createSoundSourceAsync,\n createMicrophoneSoundSourceAsync,\n setSoundSourceVolume,\n disposeSoundSource,\n enableSpatial,\n setSpatialPosition,\n setSpatialOrientation,\n setSpatialListener,\n setSpatialListenerPosition,\n updateSpatialAudio,\n enableStereo,\n setStereoPan,\n enableAnalyzer,\n getByteFrequencyData,\n getFloatFrequencyData,\n getByteTimeDomainData,\n getFloatTimeDomainData,\n} from \"babylon-lite\";\nimport type {\n AudioEngine as LiteAudioEngine,\n AudioEngineOptions as LiteAudioEngineOptions,\n StaticSound as LiteStaticSound,\n StreamingSound as LiteStreamingSound,\n AudioBus as LiteAudioBus,\n MainBus as LiteMainBus,\n SoundBuffer as LiteSoundBuffer,\n AudioInputSource as LiteAudioInputSource,\n PrimaryAudioBus as LitePrimaryAudioBus,\n StaticSoundOptions as LiteStaticSoundOptions,\n StreamingSoundOptions as LiteStreamingSoundOptions,\n SpatialSoundOptions as LiteSpatialSoundOptions,\n AudioGraphHost as LiteHost,\n} from \"babylon-lite\";\n\nimport { Observable } from \"../misc/observable.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport { Quaternion } from \"../math/quaternion.js\";\nimport { unsupported } from \"../error.js\";\nimport { SpatialAudioAttachmentType, toLiteRamp, type SoundState, type AudioAnalyzerFFTSizeType, type AudioEngineV2State, type IAudioParameterRampOptions } from \"./audio-enums.js\";\n\n/** A bus a sound or bus can output to (mirrors AudioV2 `PrimaryAudioBus`). */\nexport type PrimaryAudioBus = MainAudioBus | AudioBus;\n\n/** A node that can have a world transform (subset of the compat `Node`). */\nexport interface SpatialNodeLike {\n getAbsolutePosition?: () => { x: number; y: number; z: number };\n absolutePosition?: { x: number; y: number; z: number };\n position?: { x: number; y: number; z: number };\n rotationQuaternion?: { x: number; y: number; z: number; w: number } | null;\n}\n\nfunction readNodePosition(node: SpatialNodeLike | null): { x: number; y: number; z: number } | null {\n if (!node) {\n return null;\n }\n return node.getAbsolutePosition?.() ?? node.absolutePosition ?? node.position ?? null;\n}\n\nfunction readNodeRotation(node: SpatialNodeLike | null): { x: number; y: number; z: number; w: number } | null {\n return node?.rotationQuaternion ?? null;\n}\n\n// ───────────────────────────── Options interfaces ────────────────────────────\n\n/** Babylon.js `IAudioEngineV2Options` (subset backed by Lite). */\nexport interface IAudioEngineV2Options {\n /** Default parameter ramp duration, in seconds. Defaults to `0.01`. */\n parameterRampDuration: number;\n /** Initial output volume. Defaults to `1`. */\n volume: number;\n}\n\n/** Babylon.js `IWebAudioEngineOptions`. */\nexport interface IWebAudioEngineOptions extends IAudioEngineV2Options {\n /** An existing audio context (pass an `OfflineAudioContext` for headless rendering). */\n audioContext: BaseAudioContext;\n /** Auto-resume the context on user interaction. Defaults to `true`. */\n resumeOnInteraction: boolean;\n /** Auto-resume the context if the browser pauses playback. Defaults to `true`. */\n resumeOnPause: boolean;\n /** Retry interval (ms) for `resumeOnPause`. Defaults to `1000`. */\n resumeOnPauseRetryInterval: number;\n /** Disable Babylon.js's iOS ringer-switch workaround. Lite does not install that workaround. */\n disableIOSRingerSwitchWorkaround?: boolean;\n}\n\n/** Babylon.js `IVolumeAudioOptions`. */\nexport interface IVolumeAudioOptions {\n /** Volume / gain. Defaults to `1`. */\n volume: number;\n}\n\n/** Babylon.js `IAudioAnalyzerOptions`. */\nexport interface IAudioAnalyzerOptions {\n /** Build the analyzer immediately. Defaults to `false`. */\n analyzerEnabled: boolean;\n /** FFT window size. Defaults to `2048`. */\n analyzerFFTSize: AudioAnalyzerFFTSizeType;\n /** Minimum dB. Defaults to `-100`. */\n analyzerMinDecibels: number;\n /** Maximum dB. Defaults to `-30`. */\n analyzerMaxDecibels: number;\n /** Time-averaging constant `[0, 1]`. Defaults to `0.8`. */\n analyzerSmoothing: number;\n}\n\n/** Babylon.js `IStereoAudioOptions`. */\nexport interface IStereoAudioOptions {\n /** Build stereo immediately. Defaults to `false`. */\n stereoEnabled: boolean;\n /** Pan `-1` (left) to `1` (right). Defaults to `0`. */\n stereoPan: number;\n}\n\n/** Babylon.js `ISpatialAudioOptions` (subset backed by Lite). */\nexport interface ISpatialAudioOptions {\n /** Build spatial immediately. */\n spatialEnabled: boolean;\n /** Cone inner angle, radians. */\n spatialConeInnerAngle: number;\n /** Cone outer angle, radians. */\n spatialConeOuterAngle: number;\n /** Volume outside the cone. */\n spatialConeOuterVolume: number;\n /** Distance attenuation model. */\n spatialDistanceModel: DistanceModelType;\n /** Max distance. */\n spatialMaxDistance: number;\n /** Reference / min distance. */\n spatialMinDistance: number;\n /** Source facing direction. */\n spatialOrientation: Vector3;\n /** Enable left/right panning. */\n spatialPanningEnabled: boolean;\n /** Panning algorithm. */\n spatialPanningModel: PanningModelType;\n /** Source world position. */\n spatialPosition: Vector3;\n /** Roll-off factor. */\n spatialRolloffFactor: number;\n /** Source rotation quaternion. */\n spatialRotationQuaternion: Quaternion;\n}\n\n/** Babylon.js `IStaticSoundBufferOptions`. */\nexport interface IStaticSoundBufferOptions {\n /** Skip codec checks when the source is a URL list. Defaults to `false`. */\n skipCodecCheck: boolean;\n}\n\n/** Babylon.js `IAbstractSoundOptions` (subset). */\nexport interface IAbstractSoundOptions extends Partial<IVolumeAudioOptions> {\n /** Play immediately once ready. Defaults to `false`. */\n autoplay?: boolean;\n /** Maximum simultaneous instances. Defaults to `Infinity`. */\n maxInstances?: number;\n /** Loop playback. Defaults to `false`. */\n loop?: boolean;\n /** Start offset in seconds. Defaults to `0`. */\n startOffset?: number;\n /** Output bus. */\n outBus?: PrimaryAudioBus;\n}\n\n/** Babylon.js `IStaticSoundOptions`. */\nexport interface IStaticSoundOptions extends IAbstractSoundOptions, Partial<IStaticSoundBufferOptions> {\n /** Play duration in seconds (`0` = full). */\n duration?: number;\n /** Loop end, seconds. */\n loopEnd?: number;\n /** Loop start, seconds. */\n loopStart?: number;\n /** Detune in cents. */\n pitch?: number;\n /** Playback rate multiplier. */\n playbackRate?: number;\n}\n\n/** Babylon.js `IStaticSoundPlayOptions`. */\nexport interface IStaticSoundPlayOptions {\n /** Loop playback. */\n loop?: boolean;\n /** Start offset in seconds. */\n startOffset?: number;\n /** Play duration in seconds. */\n duration?: number;\n /** Loop start, seconds. */\n loopStart?: number;\n /** Loop end, seconds. */\n loopEnd?: number;\n /** Per-instance volume. */\n volume?: number;\n /** Delay before playback, seconds. */\n waitTime?: number;\n}\n\n/** Babylon.js `IStaticSoundStopOptions`. */\nexport interface IStaticSoundStopOptions {\n /** Delay before stopping, seconds. */\n waitTime?: number;\n}\n\n/** Babylon.js `IStaticSoundCloneOptions`. */\nexport interface IStaticSoundCloneOptions {\n /** Clone the underlying buffer (Lite reuses the same buffer). Defaults to `false`. */\n cloneBuffer?: boolean;\n /** Output bus for the clone. */\n outBus?: PrimaryAudioBus | null;\n}\n\n/** Babylon.js `IStreamingSoundOptions`. */\nexport interface IStreamingSoundOptions extends IAbstractSoundOptions {\n /** Number of instances to preload. Defaults to `1`. */\n preloadCount?: number;\n}\n\n/** Babylon.js `IStreamingSoundPlayOptions`. */\nexport interface IStreamingSoundPlayOptions {\n /** Loop playback. */\n loop?: boolean;\n /** Start offset in seconds. */\n startOffset?: number;\n /** Per-instance volume. */\n volume?: number;\n}\n\n/** Babylon.js `IAudioBusOptions` (subset). */\nexport interface IAudioBusOptions extends Partial<IVolumeAudioOptions> {\n /** Output bus. Defaults to the engine's default main bus. */\n outBus?: PrimaryAudioBus;\n}\n\n/** Babylon.js `IMainAudioBusOptions`. */\nexport interface IMainAudioBusOptions extends Partial<IVolumeAudioOptions> {}\n\n/** Babylon.js `ISoundSourceOptions` (subset). */\nexport interface ISoundSourceOptions extends Partial<IVolumeAudioOptions> {\n /** Name. */\n name?: string;\n /** Output bus. */\n outBus?: PrimaryAudioBus | null;\n /** Auto-assign the default main bus when `outBus` is null. */\n outBusAutoDefault?: boolean;\n}\n\n// ───────────────────────────── Node base classes ─────────────────────────────\n\n/** Babylon.js `AbstractAudioNode` — the root of the AudioV2 node hierarchy. */\nexport abstract class AbstractAudioNode {\n /** The engine that owns this node. */\n public readonly engine: AudioEngineV2;\n /** Fires when this node is disposed. */\n public readonly onDisposeObservable = new Observable<AbstractAudioNode>();\n\n protected constructor(engine: AudioEngineV2) {\n this.engine = engine;\n }\n\n /** Disposes the node. */\n public dispose(): void {\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n }\n\n /** The class name (mirrors Babylon.js `getClassName()`). */\n public abstract getClassName(): string;\n}\n\n/** Payload for `AbstractNamedAudioNode.onNameChangedObservable`. */\nexport interface IAudioNodeNameChange {\n /** The new name. */\n newName: string;\n /** The previous name. */\n oldName: string;\n /** The node whose name changed. */\n node: AbstractNamedAudioNode;\n}\n\n/** Babylon.js `AbstractNamedAudioNode` — an `AbstractAudioNode` with a mutable name. */\nexport abstract class AbstractNamedAudioNode extends AbstractAudioNode {\n /** Fires when {@link name} changes. */\n public readonly onNameChangedObservable = new Observable<IAudioNodeNameChange>();\n private _name: string;\n\n protected constructor(name: string, engine: AudioEngineV2) {\n super(engine);\n this._name = name;\n engine._addNode(this);\n }\n\n /** The node name. */\n public get name(): string {\n return this._name;\n }\n public set name(value: string) {\n const oldName = this._name;\n if (oldName === value) {\n return;\n }\n this._name = value;\n this.onNameChangedObservable.notifyObservers({ newName: value, oldName, node: this });\n }\n\n public override dispose(): void {\n this.engine._removeNode(this);\n this.onNameChangedObservable.clear();\n super.dispose();\n }\n}\n\n/**\n * Babylon.js `AbstractAudioOutNode` — a named node with a volume and a lazily\n * created analyzer.\n */\nexport abstract class AbstractAudioOutNode extends AbstractNamedAudioNode {\n protected _volume = 1;\n private _analyzer: AbstractAudioAnalyzer | null = null;\n\n /** The node output volume. */\n public get volume(): number {\n return this._volume;\n }\n public set volume(value: number) {\n this.setVolume(value);\n }\n\n /** Lazily-built audio analyzer for this node's output. */\n public get analyzer(): AbstractAudioAnalyzer {\n return (this._analyzer ??= new AbstractAudioAnalyzer(this._spatialHost()));\n }\n\n /** Sets the volume, optionally ramping. */\n public setVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void {\n this._volume = value;\n this._applyVolume(value, options);\n }\n\n public override dispose(): void {\n this._analyzer?.dispose();\n this._analyzer = null;\n super.dispose();\n }\n\n /** @internal Apply the volume to the backing Lite handle. */\n protected abstract _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void;\n /** @internal The Lite host used to back spatial/stereo/analyzer sub-nodes. */\n protected abstract _spatialHost(): LiteHost;\n}\n\n// ───────────────────────────── Sub-properties ────────────────────────────────\n\n/** Babylon.js `AbstractStereoAudio` — the `sound.stereo` / `bus.stereo` sub-property. */\nexport class AbstractStereoAudio {\n private readonly _host: LiteHost;\n private _pan = 0;\n private _enabled = false;\n\n /** @internal */\n public constructor(host: LiteHost) {\n this._host = host;\n }\n\n /** Stereo pan, `-1` (left) to `1` (right). */\n public get pan(): number {\n return this._pan;\n }\n public set pan(value: number) {\n this._pan = value;\n if (!this._enabled) {\n enableStereo(this._host, { pan: value });\n this._enabled = true;\n } else {\n setStereoPan(this._host, value);\n }\n }\n}\n\n/** Babylon.js `AbstractAudioAnalyzer` — the `sound.analyzer` / `bus.analyzer` sub-property. */\nexport class AbstractAudioAnalyzer {\n private readonly _host: LiteHost;\n private _fftSize: AudioAnalyzerFFTSizeType = 2048;\n private _minDecibels = -100;\n private _maxDecibels = -30;\n private _smoothing = 0.8;\n private _enabled = false;\n\n /** @internal */\n public constructor(host: LiteHost) {\n this._host = host;\n }\n\n /** FFT window size. */\n public get fftSize(): AudioAnalyzerFFTSizeType {\n return this._fftSize;\n }\n public set fftSize(value: AudioAnalyzerFFTSizeType) {\n this._fftSize = value;\n this._reapply();\n }\n\n /** Number of frequency bins (`fftSize / 2`). */\n public get frequencyBinCount(): number {\n return this._fftSize / 2;\n }\n\n /** Whether the analyzer is enabled. */\n public get isEnabled(): boolean {\n return this._enabled;\n }\n\n /** Minimum dB. */\n public get minDecibels(): number {\n return this._minDecibels;\n }\n public set minDecibels(value: number) {\n this._minDecibels = value;\n this._reapply();\n }\n\n /** Maximum dB. */\n public get maxDecibels(): number {\n return this._maxDecibels;\n }\n public set maxDecibels(value: number) {\n this._maxDecibels = value;\n this._reapply();\n }\n\n /** Time-averaging constant `[0, 1]`. */\n public get smoothing(): number {\n return this._smoothing;\n }\n public set smoothing(value: number) {\n this._smoothing = value;\n this._reapply();\n }\n\n /** Builds (enables) the analyzer tap. */\n public async enableAsync(): Promise<void> {\n this._apply();\n }\n\n /** Returns the byte frequency-domain data. Empty when disabled. */\n public getByteFrequencyData(): Uint8Array {\n if (!this._enabled) {\n return new Uint8Array(0);\n }\n const out = new Uint8Array(this.frequencyBinCount);\n getByteFrequencyData(this._host, out);\n return out;\n }\n\n /** Returns the float frequency-domain data. Empty when disabled. */\n public getFloatFrequencyData(): Float32Array {\n if (!this._enabled) {\n return new Float32Array(0);\n }\n const out = new Float32Array(this.frequencyBinCount);\n getFloatFrequencyData(this._host, out);\n return out;\n }\n\n /** Returns the byte time-domain data. Empty when disabled. */\n public getByteTimeDomainData(): Uint8Array {\n if (!this._enabled) {\n return new Uint8Array(0);\n }\n const out = new Uint8Array(this._fftSize);\n getByteTimeDomainData(this._host, out);\n return out;\n }\n\n /** Returns the float time-domain data. Empty when disabled. */\n public getFloatTimeDomainData(): Float32Array {\n if (!this._enabled) {\n return new Float32Array(0);\n }\n const out = new Float32Array(this._fftSize);\n getFloatTimeDomainData(this._host, out);\n return out;\n }\n\n /** Disposes the analyzer (Lite tears it down with the host). */\n public dispose(): void {\n this._enabled = false;\n }\n\n private _apply(): void {\n enableAnalyzer(this._host, {\n fftSize: this._fftSize,\n minDecibels: this._minDecibels,\n maxDecibels: this._maxDecibels,\n smoothing: this._smoothing,\n });\n this._enabled = true;\n }\n\n private _reapply(): void {\n if (this._enabled) {\n this._apply();\n }\n }\n}\n\n/** Babylon.js `AbstractSpatialAudio` — the `sound.spatial` / `bus.spatial` sub-property. */\nexport class AbstractSpatialAudio {\n private readonly _host: LiteHost;\n private _enabled = false;\n\n private _position = new Vector3(0, 0, 0);\n private _orientation = new Vector3(1, 0, 0);\n private _rotationQuaternion = new Quaternion(0, 0, 0, 1);\n\n /** Cone inner angle, radians. */\n public coneInnerAngle = 2 * Math.PI;\n /** Cone outer angle, radians. */\n public coneOuterAngle = 2 * Math.PI;\n /** Volume outside the cone. */\n public coneOuterVolume = 0;\n /** Distance attenuation model. */\n public distanceModel: DistanceModelType = \"linear\";\n /** Max distance. */\n public maxDistance = 10000;\n /** Reference / min distance. */\n public minDistance = 1;\n /** Minimum time between auto-updates, seconds. */\n public minUpdateTime = 0;\n /** Enable left/right panning. */\n public panningEnabled = true;\n /** Panning algorithm. */\n public panningModel: PanningModelType = \"equalpower\";\n /** Roll-off factor. */\n public rolloffFactor = 1;\n /** Whether following a scene node. */\n public useBoundingBox = false;\n /** Which transform components are followed. */\n public attachmentType: SpatialAudioAttachmentType = SpatialAudioAttachmentType.PositionAndRotation;\n\n private _attachedNode: SpatialNodeLike | null = null;\n\n /** @internal */\n public constructor(host: LiteHost) {\n this._host = host;\n }\n\n /** Source world position. */\n public get position(): Vector3 {\n return this._position;\n }\n public set position(value: Vector3) {\n this._position = value;\n this._ensure();\n setSpatialPosition(this._host, value);\n }\n\n /** Source facing direction. */\n public get orientation(): Vector3 {\n return this._orientation;\n }\n public set orientation(value: Vector3) {\n this._orientation = value;\n this._ensure();\n setSpatialOrientation(this._host, value);\n }\n\n /** Source rotation quaternion. */\n public get rotationQuaternion(): Quaternion {\n return this._rotationQuaternion;\n }\n public set rotationQuaternion(value: Quaternion) {\n this._rotationQuaternion = value;\n this._reapply();\n }\n\n /** Whether attached to a scene node. */\n public get isAttached(): boolean {\n return this._attachedNode !== null;\n }\n\n /** The scene node this source follows, if any. */\n public get attachedNode(): SpatialNodeLike | null {\n return this._attachedNode;\n }\n\n /** Follows a scene node's world transform. */\n public attach(sceneNode: SpatialNodeLike | null, useBoundingBox = false, attachmentType: SpatialAudioAttachmentType = SpatialAudioAttachmentType.PositionAndRotation): void {\n this._attachedNode = sceneNode;\n this.useBoundingBox = useBoundingBox;\n this.attachmentType = attachmentType;\n this._ensure();\n this.update();\n }\n\n /** Stops following a scene node. */\n public detach(): void {\n this._attachedNode = null;\n }\n\n /** Pulls the attached node's current world position/rotation into the source. */\n public update(): void {\n const node = this._attachedNode;\n if (!node) {\n return;\n }\n let dirty = false;\n if ((this.attachmentType & SpatialAudioAttachmentType.Position) !== 0) {\n const pos = readNodePosition(node);\n if (pos) {\n this._position = new Vector3(pos.x, pos.y, pos.z);\n dirty = true;\n }\n }\n if ((this.attachmentType & SpatialAudioAttachmentType.Rotation) !== 0) {\n const quat = readNodeRotation(node);\n if (quat) {\n this._rotationQuaternion = new Quaternion(quat.x, quat.y, quat.z, quat.w);\n dirty = true;\n }\n }\n if (dirty) {\n enableSpatial(this._host, this._options());\n this._enabled = true;\n }\n }\n\n /** Disposes the spatial sub-node (Lite tears it down with the host). */\n public dispose(): void {\n this._attachedNode = null;\n this._enabled = false;\n }\n\n private _ensure(): void {\n if (!this._enabled) {\n enableSpatial(this._host, this._options());\n this._enabled = true;\n }\n }\n\n private _reapply(): void {\n if (this._enabled) {\n enableSpatial(this._host, this._options());\n }\n }\n\n private _options(): LiteSpatialSoundOptions {\n return {\n position: this._position,\n orientation: this._orientation,\n rotationQuaternion: this._rotationQuaternion,\n panningEnabled: this.panningEnabled,\n panningModel: this.panningModel,\n distanceModel: this.distanceModel,\n minDistance: this.minDistance,\n maxDistance: this.maxDistance,\n rolloffFactor: this.rolloffFactor,\n coneInnerAngle: this.coneInnerAngle,\n coneOuterAngle: this.coneOuterAngle,\n coneOuterVolume: this.coneOuterVolume,\n };\n }\n}\n\n/** Babylon.js `AbstractSpatialAudioListener` — the engine's `listener` (the \"ears\"). */\nexport class AbstractSpatialAudioListener {\n private readonly _engine: LiteAudioEngine;\n private _position = new Vector3(0, 0, 0);\n private _rotation = new Vector3(0, 0, 0);\n private _rotationQuaternion = new Quaternion(0, 0, 0, 1);\n private _attachedNode: SpatialNodeLike | null = null;\n\n /** Minimum time between auto-updates, seconds. */\n public minUpdateTime = 0;\n\n /** @internal */\n public constructor(engine: LiteAudioEngine) {\n this._engine = engine;\n }\n\n /** Whether attached to a scene node. */\n public get isAttached(): boolean {\n return this._attachedNode !== null;\n }\n\n /** The scene node the listener follows, if any. */\n public get attachedNode(): SpatialNodeLike | null {\n return this._attachedNode;\n }\n\n /** Listener world position. */\n public get position(): Vector3 {\n return this._position;\n }\n public set position(value: Vector3) {\n this._position = value;\n setSpatialListenerPosition(this._engine, value);\n }\n\n /** Listener Euler rotation. */\n public get rotation(): Vector3 {\n return this._rotation;\n }\n public set rotation(value: Vector3) {\n this._rotation = value;\n }\n\n /** Listener rotation quaternion. */\n public get rotationQuaternion(): Quaternion {\n return this._rotationQuaternion;\n }\n public set rotationQuaternion(value: Quaternion) {\n this._rotationQuaternion = value;\n setSpatialListener(this._engine, { rotationQuaternion: value });\n }\n\n /** Follows a scene node's world transform. */\n public attach(sceneNode: SpatialNodeLike | null): void {\n this._attachedNode = sceneNode;\n this.update();\n }\n\n /** Stops following a scene node. */\n public detach(): void {\n this._attachedNode = null;\n }\n\n /** Pulls the attached node's current world position/rotation into the listener. */\n public update(): void {\n const node = this._attachedNode;\n const pos = readNodePosition(node);\n if (pos) {\n this._position = new Vector3(pos.x, pos.y, pos.z);\n setSpatialListenerPosition(this._engine, pos);\n }\n const quat = readNodeRotation(node);\n if (quat) {\n this._rotationQuaternion = new Quaternion(quat.x, quat.y, quat.z, quat.w);\n setSpatialListener(this._engine, { rotationQuaternion: this._rotationQuaternion });\n }\n updateSpatialAudio(this._engine);\n }\n}\n\n// ───────────────────────────── Buses ─────────────────────────────────────────\n\n/** Babylon.js `AbstractAudioBus` — base class for both bus kinds. */\nexport abstract class AbstractAudioBus extends AbstractAudioOutNode {}\n\n/** Babylon.js `AudioBus` — a generic mixer bus. */\nexport class AudioBus extends AbstractAudioBus {\n /** @internal The backing Lite bus. */\n public readonly _lite: LiteAudioBus;\n private _spatial: AbstractSpatialAudio | null = null;\n private _stereo: AbstractStereoAudio | null = null;\n private _outBus: PrimaryAudioBus | null;\n\n /** @internal */\n public constructor(engine: AudioEngineV2, lite: LiteAudioBus, outBus: PrimaryAudioBus | null, volume = 1) {\n super(lite.name, engine);\n this._lite = lite;\n this._outBus = outBus;\n this._volume = volume;\n }\n\n /** The output bus this bus routes to. */\n public get outBus(): PrimaryAudioBus | null {\n return this._outBus;\n }\n public set outBus(value: PrimaryAudioBus | null) {\n if (this._outBus === value) {\n return;\n }\n rerouteLiteOutBus(this._lite, unwrapBus(value) ?? null);\n this._outBus = value;\n }\n\n /** Lazily-built spatial sub-property. */\n public get spatial(): AbstractSpatialAudio {\n return (this._spatial ??= new AbstractSpatialAudio(this._lite));\n }\n\n /** Lazily-built stereo sub-property. */\n public get stereo(): AbstractStereoAudio {\n return (this._stereo ??= new AbstractStereoAudio(this._lite));\n }\n\n public getClassName(): string {\n return \"AudioBus\";\n }\n\n public override dispose(): void {\n disposeAudioBus(this._lite);\n super.dispose();\n }\n\n protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void {\n setBusVolume(this._lite, value, toLiteRamp(options));\n }\n\n protected _spatialHost(): LiteHost {\n return this._lite;\n }\n}\n\n/** Babylon.js `MainAudioBus` — a bus that connects directly to the engine output. */\nexport class MainAudioBus extends AbstractAudioBus {\n /** @internal The backing Lite main bus. */\n public readonly _lite: LiteMainBus;\n\n /** @internal */\n public constructor(engine: AudioEngineV2, lite: LiteMainBus) {\n super(lite.name, engine);\n this._lite = lite;\n }\n\n public getClassName(): string {\n return \"MainAudioBus\";\n }\n\n protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void {\n setBusVolume(this._lite as LitePrimaryAudioBus, value, toLiteRamp(options));\n }\n\n protected _spatialHost(): LiteHost {\n // The Lite main bus is not an `AudioGraphHost`; spatial/stereo/analyzer\n // are not available on a main bus (matching the BJS `MainAudioBus`, which\n // exposes neither). Accessing `.analyzer` on a main bus is unsupported.\n return unsupported(\"MainAudioBus.analyzer\", \"Main buses have no analyzer; attach one to a sound or generic AudioBus instead.\");\n }\n}\n\n// ───────────────────────────── Sound source / sounds ─────────────────────────\n\n/** Babylon.js `AbstractSoundSource` — an out-node with an output bus + spatial/stereo. */\nexport abstract class AbstractSoundSource extends AbstractAudioOutNode {\n private _spatial: AbstractSpatialAudio | null = null;\n private _stereo: AbstractStereoAudio | null = null;\n protected _outBus: PrimaryAudioBus | null;\n\n protected constructor(name: string, engine: AudioEngineV2, outBus: PrimaryAudioBus | null) {\n super(name, engine);\n this._outBus = outBus;\n }\n\n /** The output bus this source routes to. */\n public get outBus(): PrimaryAudioBus | null {\n return this._outBus;\n }\n public set outBus(value: PrimaryAudioBus | null) {\n if (this._outBus === value) {\n return;\n }\n rerouteLiteOutBus(this._spatialHost(), unwrapBus(value) ?? null);\n this._outBus = value;\n }\n\n /** Lazily-built spatial sub-property. */\n public get spatial(): AbstractSpatialAudio {\n return (this._spatial ??= new AbstractSpatialAudio(this._spatialHost()));\n }\n\n /** Lazily-built stereo sub-property. */\n public get stereo(): AbstractStereoAudio {\n return (this._stereo ??= new AbstractStereoAudio(this._spatialHost()));\n }\n}\n\n/** A live input source (e.g. microphone) wrapping a Lite `AudioInputSource`. */\nexport class SoundSource extends AbstractSoundSource {\n /** @internal The backing Lite input source. */\n public readonly _lite: LiteAudioInputSource;\n\n /** @internal */\n public constructor(engine: AudioEngineV2, lite: LiteAudioInputSource, outBus: PrimaryAudioBus | null, volume = 1) {\n super(lite.name, engine, outBus);\n this._lite = lite;\n this._volume = volume;\n }\n\n public getClassName(): string {\n return \"SoundSource\";\n }\n\n public override dispose(): void {\n disposeSoundSource(this._lite);\n super.dispose();\n }\n\n protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void {\n setSoundSourceVolume(this._lite, value, toLiteRamp(options));\n }\n\n protected _spatialHost(): LiteHost {\n return this._lite;\n }\n}\n\n/** Babylon.js `AbstractSound` — a playable sound (static or streaming). */\nexport abstract class AbstractSound extends AbstractSoundSource {\n /** Fires when the sound finishes (all instances ended). */\n public readonly onEndedObservable = new Observable<AbstractSound>();\n\n protected constructor(name: string, engine: AudioEngineV2, outBus: PrimaryAudioBus | null) {\n super(name, engine, outBus);\n engine._addSound(this);\n }\n\n /** Number of live playing instances. */\n public abstract get activeInstancesCount(): number;\n /** Whether the sound auto-plays on creation. */\n public abstract get autoplay(): boolean;\n /** Current playback state. */\n public abstract get state(): SoundState;\n\n /** Whether the sound loops. */\n public abstract get loop(): boolean;\n public abstract set loop(value: boolean);\n\n /** Start offset, seconds. */\n public abstract get startOffset(): number;\n public abstract set startOffset(value: number);\n\n /** Maximum simultaneous instances. */\n public abstract get maxInstances(): number;\n public abstract set maxInstances(value: number);\n\n /** Current playback time of the newest instance, seconds. */\n public abstract get currentTime(): number;\n public abstract set currentTime(value: number);\n\n /** Plays the sound. */\n public abstract play(options?: Partial<IStaticSoundPlayOptions & IStreamingSoundPlayOptions>): void;\n /** Pauses the sound. */\n public abstract pause(): void;\n /** Resumes the sound. */\n public abstract resume(options?: Partial<IStaticSoundPlayOptions & IStreamingSoundPlayOptions>): void;\n /** Stops the sound. */\n public abstract stop(options?: Partial<IStaticSoundStopOptions>): void;\n\n public override dispose(): void {\n this.engine._removeSound(this);\n this.onEndedObservable.clear();\n super.dispose();\n }\n}\n\n/** Babylon.js `StaticSoundBuffer` — a decoded buffer wrapping a Lite `SoundBuffer`. */\nexport class StaticSoundBuffer {\n /** The engine that owns this buffer. */\n public readonly engine: AudioEngineV2;\n /** The buffer name. */\n public name: string;\n /** @internal The backing Lite sound buffer. */\n public readonly _lite: LiteSoundBuffer;\n\n /** @internal */\n public constructor(engine: AudioEngineV2, lite: LiteSoundBuffer, name = \"StaticSoundBuffer\") {\n this.engine = engine;\n this._lite = lite;\n this.name = name;\n }\n\n /** Sample rate, Hz. */\n public get sampleRate(): number {\n return this._lite.sampleRate;\n }\n /** Length in sample frames. */\n public get length(): number {\n return this._lite.length;\n }\n /** Duration, seconds. */\n public get duration(): number {\n return this._lite.duration;\n }\n /** Number of channels. */\n public get channelCount(): number {\n return this._lite.channelCount;\n }\n\n /** Clones the buffer. Lite buffers are immutable, so the clone shares the data. */\n public clone(options?: Partial<{ name: string }>): StaticSoundBuffer {\n return new StaticSoundBuffer(this.engine, this._lite, options?.name ?? this.name);\n }\n}\n\n/** Babylon.js `StaticSound` — a buffer-backed sound wrapping a Lite `StaticSound`. */\nexport class StaticSound extends AbstractSound {\n /** @internal The backing Lite static sound. */\n public readonly _lite: LiteStaticSound;\n private readonly _autoplay: boolean;\n private _buffer: StaticSoundBuffer;\n\n /** @internal */\n public constructor(engine: AudioEngineV2, lite: LiteStaticSound, buffer: StaticSoundBuffer, outBus: PrimaryAudioBus | null, autoplay: boolean, name?: string, volume = 1) {\n super(name ?? lite.name ?? \"Sound\", engine, outBus);\n this._lite = lite;\n this._buffer = buffer;\n this._autoplay = autoplay;\n this._volume = volume;\n lite.onEnded.add(() => this.onEndedObservable.notifyObservers(this));\n }\n\n /** The decoded buffer this sound plays. */\n public get buffer(): StaticSoundBuffer {\n return this._buffer;\n }\n\n public get activeInstancesCount(): number {\n return this._lite.instanceCount;\n }\n public get autoplay(): boolean {\n return this._autoplay;\n }\n public get state(): SoundState {\n return this._lite.state as SoundState;\n }\n\n public get loop(): boolean {\n return this._lite._options.loop;\n }\n public set loop(value: boolean) {\n this._lite._options.loop = value;\n }\n\n public get startOffset(): number {\n return this._lite._options.startOffset;\n }\n public set startOffset(value: number) {\n this._lite._options.startOffset = value;\n }\n\n public get maxInstances(): number {\n return this._lite._options.maxInstances;\n }\n public set maxInstances(value: number) {\n this._lite._options.maxInstances = value;\n }\n\n public get duration(): number {\n return this._lite._options.duration;\n }\n public set duration(value: number) {\n this._lite._options.duration = value;\n }\n\n public get loopStart(): number {\n return this._lite._options.loopStart;\n }\n public set loopStart(value: number) {\n this._lite._options.loopStart = value;\n }\n\n public get loopEnd(): number {\n return this._lite._options.loopEnd;\n }\n public set loopEnd(value: number) {\n this._lite._options.loopEnd = value;\n }\n\n public get pitch(): number {\n return this._lite._options.pitch;\n }\n public set pitch(value: number) {\n this._lite._options.pitch = value;\n for (const instance of this._lite._instances) {\n if (instance._sourceNode) {\n instance._sourceNode.detune.value = value;\n }\n }\n }\n\n public get playbackRate(): number {\n return this._lite._options.playbackRate;\n }\n public set playbackRate(value: number) {\n this._lite._options.playbackRate = value;\n for (const instance of this._lite._instances) {\n if (instance._sourceNode) {\n instance._sourceNode.playbackRate.value = value;\n }\n }\n }\n\n public get currentTime(): number {\n return this.startOffset;\n }\n public set currentTime(value: number) {\n this.startOffset = value;\n }\n\n public play(options?: Partial<IStaticSoundPlayOptions>): void {\n playSound(this._lite, options);\n }\n\n public pause(): void {\n pauseSound(this._lite);\n }\n\n public resume(options?: Partial<IStaticSoundPlayOptions>): void {\n resumeSound(this._lite, options);\n }\n\n public stop(options?: Partial<IStaticSoundStopOptions>): void {\n stopSound(this._lite, options);\n }\n\n /** Clones the sound (shares the decoded buffer). */\n public async cloneAsync(options?: Partial<IStaticSoundCloneOptions>): Promise<StaticSound> {\n const outBus = (options?.outBus as PrimaryAudioBus | undefined) ?? this._outBus ?? undefined;\n return this.engine.createSoundAsync(this.name, this._buffer, { outBus });\n }\n\n public getClassName(): string {\n return \"StaticSound\";\n }\n\n public override dispose(): void {\n disposeSound(this._lite);\n super.dispose();\n }\n\n protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void {\n setSoundVolume(this._lite, value, toLiteRamp(options));\n }\n\n protected _spatialHost(): LiteHost {\n return this._lite;\n }\n}\n\n/** Babylon.js `StreamingSound` — a media-element-backed sound. */\nexport class StreamingSound extends AbstractSound {\n /** @internal The backing Lite streaming sound. */\n public readonly _lite: LiteStreamingSound;\n private readonly _autoplay: boolean;\n private _loop: boolean;\n private _startOffset: number;\n private _maxInstances: number;\n\n /** @internal */\n public constructor(engine: AudioEngineV2, lite: LiteStreamingSound, outBus: PrimaryAudioBus | null, options: Partial<IStreamingSoundOptions>, name?: string) {\n super(name ?? lite.name ?? \"Sound\", engine, outBus);\n this._lite = lite;\n this._autoplay = options.autoplay ?? false;\n this._loop = options.loop ?? false;\n this._startOffset = options.startOffset ?? 0;\n this._maxInstances = options.maxInstances ?? Infinity;\n this._volume = options.volume ?? 1;\n lite.onEnded.add(() => this.onEndedObservable.notifyObservers(this));\n }\n\n /** Number of instances configured to preload. */\n public get preloadCount(): number {\n return this._lite._options.preloadCount;\n }\n\n /** Number of instances that have finished preloading. */\n public get preloadCompletedCount(): number {\n return this._lite.preloadCompletedCount;\n }\n\n public get activeInstancesCount(): number {\n return this._lite.instanceCount;\n }\n public get autoplay(): boolean {\n return this._autoplay;\n }\n public get state(): SoundState {\n return this._lite.state as SoundState;\n }\n\n public get loop(): boolean {\n return this._loop;\n }\n public set loop(value: boolean) {\n this._loop = value;\n this._lite._options.loop = value;\n }\n\n public get startOffset(): number {\n return this._startOffset;\n }\n public set startOffset(value: number) {\n this._startOffset = value;\n this._lite._options.startOffset = value;\n }\n\n public get maxInstances(): number {\n return this._maxInstances;\n }\n public set maxInstances(value: number) {\n this._maxInstances = value;\n this._lite._options.maxInstances = value;\n }\n\n public get currentTime(): number {\n return this._startOffset;\n }\n public set currentTime(value: number) {\n this.startOffset = value;\n }\n\n public play(options?: Partial<IStreamingSoundPlayOptions>): void {\n playStreamingSound(this._lite, options);\n }\n\n public pause(): void {\n pauseStreamingSound(this._lite);\n }\n\n public resume(options?: Partial<IStreamingSoundPlayOptions>): void {\n resumeStreamingSound(this._lite, options);\n }\n\n public stop(): void {\n stopStreamingSound(this._lite);\n }\n\n /** Preloads a single instance. */\n public preloadInstanceAsync(): Promise<void> {\n return preloadStreamingInstanceAsync(this._lite);\n }\n\n /** Preloads `count` instances. */\n public preloadInstancesAsync(count: number): Promise<void> {\n return preloadStreamingInstancesAsync(this._lite, count);\n }\n\n public getClassName(): string {\n return \"StreamingSound\";\n }\n\n public override dispose(): void {\n disposeStreamingSound(this._lite);\n super.dispose();\n }\n\n protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void {\n setStreamingSoundVolume(this._lite, value, toLiteRamp(options));\n }\n\n protected _spatialHost(): LiteHost {\n return this._lite;\n }\n}\n\n// ───────────────────────────── Engine ────────────────────────────────────────\n\nconst FormatMimeTypes: { [key: string]: string } = {\n aac: \"audio/aac\",\n ac3: \"audio/ac3\",\n flac: \"audio/flac\",\n m4a: \"audio/mp4\",\n mp3: 'audio/mpeg; codecs=\"mp3\"',\n mp4: \"audio/mp4\",\n ogg: 'audio/ogg; codecs=\"vorbis\"',\n wav: \"audio/wav\",\n webm: 'audio/webm; codecs=\"vorbis\"',\n};\n\n/** Source accepted by `createSoundAsync` / `createSoundBufferAsync`. */\nexport type StaticSoundSource = ArrayBuffer | AudioBuffer | StaticSoundBuffer | string | string[];\n\nfunction unwrapBus(bus: PrimaryAudioBus | null | undefined): LitePrimaryAudioBus | undefined {\n if (!bus) {\n return undefined;\n }\n return (bus as AudioBus | MainAudioBus)._lite as LitePrimaryAudioBus;\n}\n\n/** The Web Audio input node a Lite primary bus exposes (mirrors Lite's internal `getBusInputNode`). */\nfunction liteBusInputNode(bus: LitePrimaryAudioBus): AudioNode {\n return \"_graph\" in bus ? (bus as LiteAudioBus)._graph._in : (bus as LiteMainBus)._in;\n}\n\n/**\n * Re-routes a Lite graph-bearing handle (sound, source, or generic bus) from its\n * current output bus to `newOutBus`, mirroring AudioV2's `outBus` setter. Lite\n * exposes no public re-route entry point, so this rewires the single stable tail\n * link (the sub-graph's `_out` node to the target bus input) directly, exactly as\n * Lite wires it at creation time.\n */\nfunction rerouteLiteOutBus(host: LiteHost, newOutBus: LitePrimaryAudioBus | null): void {\n const out = host._graph._out;\n const oldOutBus = host._outBus;\n if (oldOutBus) {\n try {\n out.disconnect(liteBusInputNode(oldOutBus));\n } catch {\n // The tail may not be connected yet (e.g. a microphone source created\n // without an output bus); ignore.\n }\n }\n if (newOutBus) {\n out.connect(liteBusInputNode(newOutBus));\n }\n (host as { _outBus: LitePrimaryAudioBus | null })._outBus = newOutBus;\n}\n\nfunction unwrapBufferSource(source: StaticSoundSource): ArrayBuffer | AudioBuffer | LiteSoundBuffer | string | string[] {\n if (source instanceof StaticSoundBuffer) {\n return source._lite;\n }\n return source;\n}\n\n/**\n * Babylon.js `AudioEngineV2` — the AudioV2 engine. Backed by a Lite audio engine.\n * Created via {@link CreateAudioEngineAsync}.\n */\nexport class AudioEngineV2 {\n private static _Instances: AudioEngineV2[] = [];\n /** All live audio engines. */\n public static get Instances(): readonly AudioEngineV2[] {\n return AudioEngineV2._Instances;\n }\n\n /** Fires when a named node is added to the engine. */\n public readonly onNodeAddedObservable = new Observable<AbstractNamedAudioNode>();\n /** Fires when a named node is removed from the engine. */\n public readonly onNodeRemovedObservable = new Observable<AbstractNamedAudioNode>();\n /** Fires when the engine is disposed. */\n public readonly onDisposeObservable = new Observable<AudioEngineV2>();\n\n /** @internal The backing Lite audio engine. */\n public readonly _lite: LiteAudioEngine;\n\n private readonly _sounds = new Set<AbstractSound>();\n private readonly _nodes = new Set<AbstractNamedAudioNode>();\n private _defaultMainBus: MainAudioBus | null = null;\n private _listener: AbstractSpatialAudioListener | null = null;\n private _mainOut: AbstractAudioNode | null = null;\n\n /** @internal */\n public constructor(lite: LiteAudioEngine) {\n this._lite = lite;\n AudioEngineV2._Instances.push(this);\n }\n\n /** The audio context's current time, seconds. */\n public get currentTime(): number {\n return this._lite.currentTime;\n }\n\n /** The context state. */\n public get state(): AudioEngineV2State {\n return this._lite.state;\n }\n\n /** Master output volume. */\n public get volume(): number {\n return getMasterVolume(this._lite);\n }\n public set volume(value: number) {\n setMasterVolume(this._lite, value);\n }\n\n /** Default parameter ramp duration, seconds. */\n public get parameterRampDuration(): number {\n return this._lite._rampDuration;\n }\n public set parameterRampDuration(value: number) {\n this._lite._rampDuration = value;\n }\n\n /** The default main bus all sounds route to. */\n public get defaultMainBus(): MainAudioBus | null {\n return (this._defaultMainBus ??= new MainAudioBus(this, this._lite._mainBus));\n }\n\n /** The spatial-audio listener (the \"ears\"). */\n public get listener(): AbstractSpatialAudioListener {\n return (this._listener ??= new AbstractSpatialAudioListener(this._lite));\n }\n\n /** The engine output node. */\n public get mainOut(): AbstractAudioNode {\n return (this._mainOut ??= new MainOutNode(this));\n }\n\n /** All live sounds. */\n public get sounds(): readonly AbstractSound[] {\n return Array.from(this._sounds);\n }\n\n /** All live named nodes. */\n public get nodes(): ReadonlySet<AbstractNamedAudioNode> {\n return this._nodes;\n }\n\n /** Sets the master volume, optionally ramping. */\n public setVolume(value: number, options?: Partial<IAudioParameterRampOptions>): void {\n setMasterVolume(this._lite, value, toLiteRamp(options));\n }\n\n /** Whether the given audio format/extension can be decoded. */\n public isFormatValid(format: string): boolean {\n const mimeType = FormatMimeTypes[format.toLowerCase()];\n if (mimeType === undefined) {\n return false;\n }\n if (typeof Audio === \"undefined\") {\n return true;\n }\n return new Audio().canPlayType(mimeType) !== \"\";\n }\n\n /** Suspends the engine context. */\n public async pauseAsync(): Promise<void> {\n const ctx = this._lite._ctx as AudioContext;\n if (typeof ctx.suspend === \"function\" && ctx.state === \"running\") {\n await ctx.suspend();\n }\n }\n\n /** Resumes the engine context. */\n public async resumeAsync(): Promise<void> {\n await unlockAudioEngineAsync(this._lite);\n }\n\n /** Resumes the engine context (alias of {@link resumeAsync}). */\n public async unlockAsync(): Promise<void> {\n await unlockAudioEngineAsync(this._lite);\n }\n\n /** Creates a buffer-backed sound. */\n public async createSoundAsync(name: string, source: StaticSoundSource, options?: Partial<IStaticSoundOptions>): Promise<StaticSound> {\n const liteOptions = toLiteStaticSoundOptions(name, options);\n const lite = await createSoundAsync(this._lite, unwrapBufferSource(source), liteOptions);\n const buffer = new StaticSoundBuffer(this, lite.buffer, name);\n return new StaticSound(this, lite, buffer, (options?.outBus as PrimaryAudioBus | undefined) ?? this.defaultMainBus, options?.autoplay ?? false, name, options?.volume ?? 1);\n }\n\n /** Creates a decoded sound buffer. */\n public async createSoundBufferAsync(source: StaticSoundSource, options?: Partial<IStaticSoundBufferOptions>): Promise<StaticSoundBuffer> {\n const lite = await createSoundBufferAsync(this._lite, unwrapBufferSource(source), { skipCodecCheck: options?.skipCodecCheck });\n return new StaticSoundBuffer(this, lite);\n }\n\n /** Creates a streaming, media-element-backed sound. */\n public async createStreamingSoundAsync(name: string, source: HTMLMediaElement | string | string[], options?: Partial<IStreamingSoundOptions>): Promise<StreamingSound> {\n const liteOptions: LiteStreamingSoundOptions = {\n autoplay: options?.autoplay,\n loop: options?.loop,\n maxInstances: options?.maxInstances,\n outBus: unwrapBus(options?.outBus) as LitePrimaryAudioBus | undefined,\n preloadCount: options?.preloadCount,\n startOffset: options?.startOffset,\n volume: options?.volume,\n };\n const lite = await createStreamingSoundAsync(this._lite, source, liteOptions);\n return new StreamingSound(this, lite, (options?.outBus as PrimaryAudioBus | undefined) ?? this.defaultMainBus, options ?? {}, name);\n }\n\n /** Creates a generic mixer bus. */\n public async createBusAsync(name: string, options?: Partial<IAudioBusOptions>): Promise<AudioBus> {\n const lite = await createAudioBusAsync(this._lite, name, {\n volume: options?.volume,\n outBus: unwrapBus(options?.outBus) as LitePrimaryAudioBus | undefined,\n });\n return new AudioBus(this, lite, (options?.outBus as PrimaryAudioBus | undefined) ?? this.defaultMainBus, options?.volume ?? 1);\n }\n\n /**\n * Creates a main bus. Babylon Lite builds a single default main bus per engine\n * and does not expose creating additional ones, so this resolves the default\n * main bus.\n */\n public async createMainBusAsync(_name: string, _options?: Partial<IMainAudioBusOptions>): Promise<MainAudioBus> {\n return this.defaultMainBus as MainAudioBus;\n }\n\n /** Wraps an arbitrary Web Audio node as a sound source. */\n public async createSoundSourceAsync(name: string, source: AudioNode, options?: Partial<ISoundSourceOptions>): Promise<SoundSource> {\n const lite = await createSoundSourceAsync(this._lite, source, {\n name,\n outBus: unwrapBus(options?.outBus) as LitePrimaryAudioBus | undefined,\n outBusAutoDefault: options?.outBusAutoDefault,\n volume: options?.volume,\n });\n return new SoundSource(this, lite, (options?.outBus as PrimaryAudioBus | undefined) ?? null, options?.volume ?? 1);\n }\n\n /** Creates a microphone-backed sound source. */\n public async createMicrophoneSoundSourceAsync(name: string, options?: Partial<ISoundSourceOptions>): Promise<SoundSource> {\n const lite = await createMicrophoneSoundSourceAsync(this._lite, {\n name,\n outBus: unwrapBus(options?.outBus) as LitePrimaryAudioBus | undefined,\n outBusAutoDefault: options?.outBusAutoDefault,\n volume: options?.volume,\n });\n return new SoundSource(this, lite, (options?.outBus as PrimaryAudioBus | undefined) ?? null, options?.volume ?? 1);\n }\n\n /** Disposes the engine and all its sounds/buses. */\n public dispose(): void {\n disposeAudioEngine(this._lite);\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n this.onNodeAddedObservable.clear();\n this.onNodeRemovedObservable.clear();\n this._sounds.clear();\n this._nodes.clear();\n const i = AudioEngineV2._Instances.indexOf(this);\n if (i !== -1) {\n AudioEngineV2._Instances.splice(i, 1);\n }\n if (LastCreatedEngine === this) {\n LastCreatedEngine = null;\n }\n }\n\n /** @internal */\n public _addSound(sound: AbstractSound): void {\n this._sounds.add(sound);\n }\n /** @internal */\n public _removeSound(sound: AbstractSound): void {\n this._sounds.delete(sound);\n }\n /** @internal */\n public _addNode(node: AbstractNamedAudioNode): void {\n this._nodes.add(node);\n this.onNodeAddedObservable.notifyObservers(node);\n }\n /** @internal */\n public _removeNode(node: AbstractNamedAudioNode): void {\n if (this._nodes.delete(node)) {\n this.onNodeRemovedObservable.notifyObservers(node);\n }\n }\n}\n\n/** The engine output node returned by `engine.mainOut`. */\nclass MainOutNode extends AbstractAudioNode {\n public constructor(engine: AudioEngineV2) {\n super(engine);\n }\n public getClassName(): string {\n return \"_MainAudioOut\";\n }\n}\n\n// ───────────────────────────── Option mapping ────────────────────────────────\n\nfunction toLiteStaticSoundOptions(_name: string, options?: Partial<IStaticSoundOptions>): LiteStaticSoundOptions {\n return {\n autoplay: options?.autoplay,\n duration: options?.duration,\n loop: options?.loop,\n loopEnd: options?.loopEnd,\n loopStart: options?.loopStart,\n maxInstances: options?.maxInstances,\n outBus: unwrapBus(options?.outBus) as LitePrimaryAudioBus | undefined,\n pitch: options?.pitch,\n playbackRate: options?.playbackRate,\n startOffset: options?.startOffset,\n volume: options?.volume,\n skipCodecCheck: options?.skipCodecCheck,\n };\n}\n\nfunction toLiteEngineOptions(options?: Partial<IWebAudioEngineOptions>): LiteAudioEngineOptions {\n return {\n audioContext: options?.audioContext,\n volume: options?.volume,\n parameterRampDuration: options?.parameterRampDuration,\n resumeOnInteraction: options?.resumeOnInteraction,\n resumeOnPause: options?.resumeOnPause,\n resumeOnPauseRetryInterval: options?.resumeOnPauseRetryInterval,\n };\n}\n\n// ───────────────────────────── Factory functions ─────────────────────────────\n\n/**\n * Module-level \"last created engine\", mirroring Babylon.js. Assigning a primitive\n * default is bundler-safe (no allocation at import time) and the compat package is\n * excluded from Lite bundle ceilings.\n */\nlet LastCreatedEngine: AudioEngineV2 | null = null;\n\n/** Babylon.js `OnAudioEngineV2CreatedObservable` — fires when an engine is created. */\nexport const OnAudioEngineV2CreatedObservable = new Observable<AudioEngineV2>();\n\n/** Babylon.js `LastCreatedAudioEngine()` — the most recently created engine, if any. */\nexport function LastCreatedAudioEngine(): AudioEngineV2 | null {\n return LastCreatedEngine;\n}\n\nfunction resolveEngine(engine?: AudioEngineV2 | null): AudioEngineV2 {\n const resolved = engine ?? LastCreatedEngine;\n if (!resolved) {\n return unsupported(\"AudioV2 factory\", \"No audio engine available. Call CreateAudioEngineAsync(...) first or pass an engine.\");\n }\n return resolved;\n}\n\n/** Babylon.js `CreateAudioEngineAsync` — creates and initialises an AudioV2 engine. */\nexport async function CreateAudioEngineAsync(options?: Partial<IWebAudioEngineOptions>): Promise<AudioEngineV2> {\n const lite = await createAudioEngineAsync(toLiteEngineOptions(options));\n const engine = new AudioEngineV2(lite);\n LastCreatedEngine = engine;\n OnAudioEngineV2CreatedObservable.notifyObservers(engine);\n return engine;\n}\n\n/** Babylon.js `CreateSoundAsync`. */\nexport function CreateSoundAsync(name: string, source: StaticSoundSource, options?: Partial<IStaticSoundOptions>, engine?: AudioEngineV2 | null): Promise<StaticSound> {\n return resolveEngine(engine).createSoundAsync(name, source, options);\n}\n\n/** Babylon.js `CreateSoundBufferAsync`. */\nexport function CreateSoundBufferAsync(source: StaticSoundSource, options?: Partial<IStaticSoundBufferOptions>, engine?: AudioEngineV2 | null): Promise<StaticSoundBuffer> {\n return resolveEngine(engine).createSoundBufferAsync(source, options);\n}\n\n/** Babylon.js `CreateStreamingSoundAsync`. */\nexport function CreateStreamingSoundAsync(\n name: string,\n source: HTMLMediaElement | string | string[],\n options?: Partial<IStreamingSoundOptions>,\n engine?: AudioEngineV2 | null\n): Promise<StreamingSound> {\n return resolveEngine(engine).createStreamingSoundAsync(name, source, options);\n}\n\n/** Babylon.js `CreateAudioBusAsync`. */\nexport function CreateAudioBusAsync(name: string, options?: Partial<IAudioBusOptions>, engine?: AudioEngineV2 | null): Promise<AudioBus> {\n return resolveEngine(engine).createBusAsync(name, options);\n}\n\n/** Babylon.js `CreateMainAudioBusAsync`. */\nexport function CreateMainAudioBusAsync(name: string, options?: Partial<IMainAudioBusOptions>, engine?: AudioEngineV2 | null): Promise<MainAudioBus> {\n return resolveEngine(engine).createMainBusAsync(name, options);\n}\n\n/** Babylon.js `CreateSoundSourceAsync`. */\nexport function CreateSoundSourceAsync(name: string, source: AudioNode, options?: Partial<ISoundSourceOptions>, engine?: AudioEngineV2 | null): Promise<SoundSource> {\n return resolveEngine(engine).createSoundSourceAsync(name, source, options);\n}\n\n/** Babylon.js `CreateMicrophoneSoundSourceAsync`. */\nexport function CreateMicrophoneSoundSourceAsync(name: string, options?: Partial<ISoundSourceOptions>, engine?: AudioEngineV2 | null): Promise<SoundSource> {\n return resolveEngine(engine).createMicrophoneSoundSourceAsync(name, options);\n}\n","import type { MaterialPlugin, MaterialPluginPoint } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { ShaderLanguage } from \"../misc/engine-constants.js\";\nimport type { AbstractMesh } from \"../meshes/meshes.js\";\nimport type { SmartArray } from \"../misc/misc-utils.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { BaseTexture, RenderTargetTexture } from \"../textures/textures.js\";\nimport type { Material } from \"./materials.js\";\n\nexport type MaterialPluginDefines = Record<string, unknown>;\nexport type MaterialPluginCustomCode = Record<string, string>;\n\nconst MATERIAL_PLUGIN_INCLUDES_UNSUPPORTED =\n \"Babylon.js shader includes depend on its ShaderStore include registry and expansion pipeline. Lite has no compatible include registry, and introducing one is a loader/shader-subsystem design rather than adapter translation.\";\nconst MATERIAL_PLUGIN_REGEX_UNSUPPORTED =\n \"Regular-expression shader replacement requires access to the composed host shader source. Lite's plugin bridge exposes fixed injection slots only, so adding regex rewriting requires a new Lite shader-composition contract.\";\nconst MATERIAL_PLUGIN_HOOKS_UNSUPPORTED =\n \"This Babylon.js plugin overrides hooks outside fixed-slot custom shader code. Executing those hooks requires Babylon.js-compatible define, uniform-buffer, sampler, texture, mesh-attribute, or render-target bridge contracts that Lite does not expose.\";\n\nfunction toLiteCustomCode(code: MaterialPluginCustomCode | null): Partial<Record<MaterialPluginPoint, string>> | null {\n if (!code) {\n return null;\n }\n const translated: Partial<Record<MaterialPluginPoint, string>> = {};\n for (const [point, value] of Object.entries(code)) {\n if (point.startsWith(\"!\")) {\n return unsupported(\"MaterialPluginBase.getCustomCode(regex)\", MATERIAL_PLUGIN_REGEX_UNSUPPORTED);\n }\n switch (point) {\n case \"CUSTOM_FRAGMENT_DEFINITIONS\":\n case \"CUSTOM_FRAGMENT_MAIN_BEGIN\":\n case \"CUSTOM_FRAGMENT_UPDATE_ALPHA\":\n case \"CUSTOM_FRAGMENT_UPDATE_DIFFUSE\":\n case \"CUSTOM_FRAGMENT_BEFORE_LIGHTS\":\n case \"CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\":\n case \"CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\":\n case \"CUSTOM_VERTEX_MAIN_BEGIN\":\n case \"CUSTOM_VERTEX_UPDATE_WORLDPOS\":\n case \"CUSTOM_VERTEX_MAIN_END\":\n translated[point] = value;\n break;\n default:\n return unsupported(`MaterialPluginBase.getCustomCode(${point})`, \"Lite's material-plugin bridge does not expose this Babylon.js shader injection point.\");\n }\n }\n return translated;\n}\n\nfunction toLiteDefines(defines: MaterialPluginDefines): Record<string, boolean | number> {\n const translated: Record<string, boolean | number> = {};\n for (const [name, value] of Object.entries(defines)) {\n if (typeof value === \"boolean\" || typeof value === \"number\") {\n translated[name] = value;\n }\n }\n return translated;\n}\n\n/** Babylon.js-shaped manager for the adapter-visible material plugin list. */\nexport class MaterialPluginManager {\n private readonly _plugins: MaterialPluginBase[] = [];\n\n public constructor(material: Material) {\n void material;\n }\n\n /** @internal Attach a plugin through Lite's descriptor list. */\n public _addPlugin(plugin: MaterialPluginBase): boolean {\n if (this._plugins.some((candidate) => candidate.name === plugin.name)) {\n return false;\n }\n this._plugins.push(plugin);\n this._plugins.sort((a, b) => a.priority - b.priority);\n plugin._attachToLiteMaterial();\n return true;\n }\n\n /** @internal Activate a plugin through Lite's descriptor state. */\n public _activatePlugin(plugin: MaterialPluginBase): void {\n plugin._setLiteEnabled(true);\n }\n\n /** @internal Remove a disposed plugin from the adapter-visible list. */\n public _removePlugin(plugin: MaterialPluginBase): void {\n const index = this._plugins.indexOf(plugin);\n if (index >= 0) {\n this._plugins.splice(index, 1);\n }\n }\n\n public getPlugin<T = MaterialPluginBase>(name: string): T | null {\n return (this._plugins.find((plugin) => plugin.name === name) as T | undefined) ?? null;\n }\n}\n\n/**\n * Babylon.js `MaterialPluginBase` adapter over Lite's opt-in material-plugin\n * bridge. Subclasses keep the Babylon.js override shape while Lite receives a\n * plain plugin descriptor.\n */\nexport class MaterialPluginBase {\n private _name: string;\n private _priority: number;\n private _resolveIncludes = false;\n public readonly markAllDefinesAsDirty: () => void;\n public registerForExtraEvents = false;\n public doNotSerialize = false;\n protected readonly _material: Material;\n protected readonly _pluginManager: MaterialPluginManager;\n protected readonly _pluginDefineNames?: MaterialPluginDefines;\n\n /** @internal Plain plugin descriptor attached to the backing Lite material. */\n private readonly _lite: MaterialPlugin;\n\n public constructor(material: Material, name: string, priority: number, defines: MaterialPluginDefines = {}, addToPluginList = true, enable = false, resolveIncludes = false) {\n this._material = material;\n this._name = name;\n this._priority = priority;\n this.resolveIncludes = resolveIncludes;\n this._pluginDefineNames = defines;\n const pluginManager = material.pluginManager ?? new MaterialPluginManager(material);\n if (addToPluginList || this._attachToLite) {\n material.pluginManager ??= pluginManager;\n }\n this._pluginManager = pluginManager;\n this.markAllDefinesAsDirty = () => material._markPluginDefinesDirty();\n this._lite = {\n get name() {\n return name;\n },\n get priority() {\n return priority;\n },\n defines: toLiteDefines(defines),\n isEnabled: enable,\n getCustomCode: (shaderType) => {\n this._assertSupportedExecution();\n return this.isCompatible(ShaderLanguage.WGSL) ? toLiteCustomCode(this.getCustomCode(shaderType, ShaderLanguage.WGSL)) : null;\n },\n };\n\n if (addToPluginList) {\n this._pluginManager._addPlugin(this);\n }\n }\n\n public get name(): string {\n return this._name;\n }\n\n public set name(value: string) {\n this._name = value;\n Object.defineProperty(this._lite, \"name\", { configurable: true, enumerable: true, get: () => this._name });\n }\n\n public get priority(): number {\n return this._priority;\n }\n\n public set priority(value: number) {\n this._priority = value;\n Object.defineProperty(this._lite, \"priority\", { configurable: true, enumerable: true, get: () => this._priority });\n }\n\n public get resolveIncludes(): boolean {\n return this._resolveIncludes;\n }\n\n public set resolveIncludes(value: boolean) {\n if (value) {\n unsupported(\"MaterialPluginBase.resolveIncludes\", MATERIAL_PLUGIN_INCLUDES_UNSUPPORTED);\n }\n this._resolveIncludes = false;\n }\n\n /** @internal Unsupported derived stubs override this to avoid mutating Lite state before throwing. */\n protected get _attachToLite(): boolean {\n return true;\n }\n\n protected _enable(enable: boolean): void {\n if (enable) {\n this._pluginManager._activatePlugin(this);\n } else {\n this._setLiteEnabled(false);\n }\n }\n\n /** @internal Attach this adapter's descriptor to the backing Lite material. */\n public _attachToLiteMaterial(): void {\n if (!this._attachToLite) {\n return;\n }\n const liteMaterial = this._material._lite as typeof this._material._lite & { plugins?: MaterialPlugin[] };\n liteMaterial.plugins = [...(liteMaterial.plugins ?? []), this._lite];\n this._material._usesMaterialPlugins = true;\n this._material.getScene()?._requestMaterialPlugins(this._material._lite);\n }\n\n /** @internal Update this adapter's Lite activation state. */\n public _setLiteEnabled(enable: boolean): void {\n this._lite.isEnabled = enable;\n this.markAllDefinesAsDirty();\n }\n\n private _assertSupportedExecution(): void {\n if (this.resolveIncludes) {\n unsupported(\"MaterialPluginBase.resolveIncludes\", MATERIAL_PLUGIN_INCLUDES_UNSUPPORTED);\n }\n const base = MaterialPluginBase.prototype;\n const unsupportedHook =\n this.registerForExtraEvents ||\n this.collectDefines !== base.collectDefines ||\n this.prepareDefinesBeforeAttributes !== base.prepareDefinesBeforeAttributes ||\n this.prepareDefines !== base.prepareDefines ||\n this.isReadyForSubMesh !== base.isReadyForSubMesh ||\n this.hardBindForSubMesh !== base.hardBindForSubMesh ||\n this.bindForSubMesh !== base.bindForSubMesh ||\n this.hasTexture !== base.hasTexture ||\n this.hasRenderTargetTextures !== base.hasRenderTargetTextures ||\n this.fillRenderTargetTextures !== base.fillRenderTargetTextures ||\n this.getActiveTextures !== base.getActiveTextures ||\n this.getAnimatables !== base.getAnimatables ||\n this.addFallbacks !== base.addFallbacks ||\n this.getSamplers !== base.getSamplers ||\n this.getAttributes !== base.getAttributes ||\n this.getUniformBuffersNames !== base.getUniformBuffersNames ||\n this.getUniforms !== base.getUniforms;\n if (unsupportedHook) {\n unsupported(\"MaterialPluginBase hooks\", MATERIAL_PLUGIN_HOOKS_UNSUPPORTED);\n }\n }\n\n public isCompatible(_shaderLanguage: ShaderLanguage): boolean {\n return _shaderLanguage === ShaderLanguage.GLSL;\n }\n\n public getCustomCode(_shaderType: string, _shaderLanguage = ShaderLanguage.GLSL): MaterialPluginCustomCode | null {\n return null;\n }\n\n public isReadyForSubMesh(_defines: object, _scene: Scene, _engine: object, _subMesh: object): boolean {\n return true;\n }\n\n public hardBindForSubMesh(_uniformBuffer: object, _scene: Scene, _engine: object, _subMesh: object): void {}\n\n public bindForSubMesh(_uniformBuffer: object, _scene: Scene, _engine: object, _subMesh: object): void {}\n\n public collectDefines(defines: Record<string, { type: string; default: unknown }>): void {\n if (!this._pluginDefineNames) {\n return;\n }\n for (const [name, value] of Object.entries(this._pluginDefineNames)) {\n if (!name.startsWith(\"_\")) {\n const valueType = typeof value;\n defines[name] = {\n type: valueType === \"number\" || valueType === \"string\" || valueType === \"boolean\" ? valueType : \"object\",\n default: value,\n };\n }\n }\n }\n\n public prepareDefinesBeforeAttributes(_defines: object, _scene: Scene, _mesh: AbstractMesh): void {}\n\n public prepareDefines(_defines: object, _scene: Scene, _mesh: AbstractMesh): void {}\n\n public hasTexture(_texture: BaseTexture): boolean {\n return false;\n }\n\n public hasRenderTargetTextures(): boolean {\n return false;\n }\n\n public fillRenderTargetTextures(_renderTargets: SmartArray<RenderTargetTexture>): void {}\n\n public getActiveTextures(_activeTextures: BaseTexture[]): void {}\n\n public getAnimatables(_animatables: object[]): void {}\n\n public addFallbacks(_defines: object, _fallbacks: object, currentRank: number): number {\n return currentRank;\n }\n\n public getSamplers(_samplers: string[]): void {}\n\n public getAttributes(_attributes: string[], _scene: Scene, _mesh: AbstractMesh): void {}\n\n public getUniformBuffersNames(_ubos: string[]): void {}\n\n public getUniforms(_shaderLanguage = ShaderLanguage.GLSL): {\n ubo?: Array<{ name: string; size?: number; type?: string; arraySize?: number }>;\n vertex?: string;\n fragment?: string;\n externalUniforms?: string[];\n } {\n return {};\n }\n\n public getClassName(): string {\n return \"MaterialPluginBase\";\n }\n\n public copyTo(plugin: MaterialPluginBase): void {\n plugin.name = this.name;\n plugin.priority = this.priority;\n plugin.resolveIncludes = this.resolveIncludes;\n plugin.registerForExtraEvents = this.registerForExtraEvents;\n plugin.doNotSerialize = this.doNotSerialize;\n }\n\n public serialize(): Record<string, unknown> {\n return {\n name: this.name,\n priority: this.priority,\n resolveIncludes: this.resolveIncludes,\n registerForExtraEvents: this.registerForExtraEvents,\n doNotSerialize: this.doNotSerialize,\n };\n }\n\n public parse(source: Record<string, unknown>, _scene: Scene, _rootUrl: string): void {\n if (typeof source.resolveIncludes === \"boolean\") {\n this.resolveIncludes = source.resolveIncludes;\n }\n if (typeof source.name === \"string\") {\n this.name = source.name;\n }\n if (typeof source.priority === \"number\") {\n this.priority = source.priority;\n }\n if (typeof source.registerForExtraEvents === \"boolean\") {\n this.registerForExtraEvents = source.registerForExtraEvents;\n }\n if (typeof source.doNotSerialize === \"boolean\") {\n this.doNotSerialize = source.doNotSerialize;\n }\n }\n\n public dispose(_forceDisposeTextures?: boolean): void {\n const liteMaterial = this._material._lite as typeof this._material._lite & { plugins?: MaterialPlugin[] };\n if (liteMaterial.plugins) {\n liteMaterial.plugins = liteMaterial.plugins.filter((plugin) => plugin !== this._lite);\n this._material._usesMaterialPlugins = liteMaterial.plugins.length > 0;\n this._material._markPluginDefinesDirty();\n }\n this._pluginManager._removePlugin(this);\n }\n}\n","/**\n * Stubs for Babylon.js core/loader APIs that are **known but not supported** by\n * Babylon Lite.\n *\n * Every entry here throws {@link LiteCompatError} on use (construction or call),\n * so a ported scene fails loudly with a clear pointer instead of either a\n * confusing \"X is not exported from the compat package\" error or, worse, a\n * silently-wrong render. These mirror the `❌ Not supported` /\n * `⛔ Out of scope` rows in `COMPAT-STATUS.md`.\n *\n * As Babylon Lite gains a capability, the corresponding stub here should be\n * replaced by a real wrapper (and its `COMPAT-STATUS.md` row upgraded).\n */\n\nimport { unsupported } from \"../error.js\";\nimport { GAUSSIAN_SPLATTING_MAX_PART_COUNT, encodeIdToColor, getGaussianSplattingMaxPartCount, getGaussianSplattingPartIndexVaryingDeclaration } from \"babylon-lite\";\nimport type { AbstractEngine } from \"../engine/engine.js\";\nimport { PushMaterial } from \"../materials/materials.js\";\nimport type { Material } from \"../materials/materials.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { Camera } from \"../cameras/cameras.js\";\nimport { ShaderLanguage } from \"../misc/engine-constants.js\";\nimport type { StandardMaterial, PBRMaterial } from \"../materials/materials.js\";\nimport type { Mesh, InstancedMesh } from \"../meshes/meshes.js\";\nimport { MaterialPluginBase } from \"../materials/material-plugin.js\";\nimport type { AnimationGroup } from \"../animations/animation.js\";\nimport type { Bone } from \"../bones/skeleton.js\";\nimport type { TransformNode } from \"../meshes/meshes.js\";\nimport type { Vector3 } from \"../math/vector.js\";\nimport type { Color3 } from \"../math/color.js\";\nimport type { Observable } from \"../misc/observable.js\";\nimport type { Matrix } from \"../math/matrix.js\";\nimport type { StorageBuffer } from \"../buffers/storage-buffer.js\";\n\nconst FLUID_RENDERER_UNSUPPORTED =\n \"Fluid rendering requires dedicated depth, thickness, and diffuse passes plus render-target lifecycle and composition policies that Babylon Lite does not define.\";\nconst DITHERED_TILE_FADE_UNSUPPORTED =\n \"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.\";\nconst GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED =\n \"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.\";\nconst GAUSSIAN_POINT_SPLATTING_UNSUPPORTED =\n \"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.\";\nconst SHADER_MATERIAL_UNSUPPORTED =\n \"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.\";\n// ─── Flow graph validation ───────────────────────────────────────────\nconst FLOW_GRAPH_UNSUPPORTED =\n \"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.\";\n\nexport enum FlowGraphValidationSeverity {\n Error = 0,\n Warning = 1,\n}\n\nexport interface IFlowGraphValidationIssue {\n severity: FlowGraphValidationSeverity;\n message: string;\n block?: unknown;\n connectionName?: string;\n}\n\nexport interface IFlowGraphValidationResult {\n isValid: boolean;\n issues: IFlowGraphValidationIssue[];\n errorCount: number;\n warningCount: number;\n issuesByBlock: Map<string, IFlowGraphValidationIssue[]>;\n}\n\nexport function ValidateFlowGraph(_flowGraph: unknown): IFlowGraphValidationResult {\n return unsupported(\"ValidateFlowGraph\", FLOW_GRAPH_UNSUPPORTED);\n}\n\nexport function ValidateFlowGraphWithBlockList(_flowGraph: unknown, _allKnownBlocks: unknown[]): IFlowGraphValidationResult {\n return unsupported(\"ValidateFlowGraphWithBlockList\", FLOW_GRAPH_UNSUPPORTED);\n}\n\n// ─── Fluid rendering ─────────────────────────────────────────────────\nexport abstract class FluidRenderingObject {\n public static UsePerParticleSizeAttribute = false;\n\n protected constructor(_scene: Scene, _shaderLanguage?: ShaderLanguage) {\n unsupported(\"FluidRenderingObject\", FLUID_RENDERER_UNSUPPORTED);\n }\n}\n\nexport class FluidRenderingObjectParticleSystem extends FluidRenderingObject {\n public constructor(scene: Scene, _particleSystem: unknown, shaderLanguage?: ShaderLanguage) {\n super(scene, shaderLanguage);\n }\n}\n\nexport class FluidRenderingObjectCustomParticles extends FluidRenderingObject {\n public constructor(scene: Scene, _buffers: Record<string, ArrayLike<number>>, _numParticles: number, shaderLanguage?: ShaderLanguage) {\n super(scene, shaderLanguage);\n }\n}\n\nexport class FluidRenderingTargetRenderer {\n public constructor(_scene: Scene, _camera?: Camera, _shaderLanguage?: ShaderLanguage) {\n unsupported(\"FluidRenderingTargetRenderer\", FLUID_RENDERER_UNSUPPORTED);\n }\n}\n\nexport class FluidRenderer {\n public constructor(_scene: Scene) {\n unsupported(\"FluidRenderer\", FLUID_RENDERER_UNSUPPORTED);\n }\n}\n\nexport class FluidRendererSceneComponent {\n public constructor(_scene: Scene) {\n unsupported(\"FluidRendererSceneComponent\", FLUID_RENDERER_UNSUPPORTED);\n }\n}\n\nexport function RegisterFluidRenderer(): void {\n unsupported(\"RegisterFluidRenderer\", FLUID_RENDERER_UNSUPPORTED);\n}\n\n// ─── Root motion ─────────────────────────────────────────────────────\nconst ROOT_MOTION_UNSUPPORTED =\n \"Babylon.js root motion analyzes animation hierarchies, rewrites in-place clips, journals mixer writes, and applies blended per-frame travel. Lite exposes animation playback but not that analysis and mixer-journal subsystem; its lifecycle and ownership require a Lite-level design.\";\n\nexport enum RootMotionSource {\n None = 0,\n Root = 1,\n FootContact = 2,\n}\n\nexport interface IRootMotionClipOptions {\n rootNode?: TransformNode | Bone;\n characterNode?: TransformNode;\n contactNodes?: Array<TransformNode | Bone>;\n source?: RootMotionSource;\n extractRotation?: boolean;\n samplesPerSecond?: number;\n minimumTravel?: number;\n minimumTurn?: number;\n directionSnapAngle?: number;\n extractLateralMotion?: boolean;\n upAxis?: Vector3;\n name?: string;\n cloneAnimations?: boolean;\n}\n\nexport class RootMotionClip {\n public constructor(_animationGroup: AnimationGroup, _options: IRootMotionClipOptions = {}) {\n unsupported(\"RootMotionClip\", ROOT_MOTION_UNSUPPORTED);\n }\n\n public get sourceAnimationGroup(): AnimationGroup {\n return unsupported(\"RootMotionClip.sourceAnimationGroup\", ROOT_MOTION_UNSUPPORTED);\n }\n public get animationGroup(): AnimationGroup {\n return unsupported(\"RootMotionClip.animationGroup\", ROOT_MOTION_UNSUPPORTED);\n }\n public get controller(): RootMotionController | null {\n return unsupported(\"RootMotionClip.controller\", ROOT_MOTION_UNSUPPORTED);\n }\n public get source(): RootMotionSource {\n return unsupported(\"RootMotionClip.source\", ROOT_MOTION_UNSUPPORTED);\n }\n public get rootNode(): TransformNode | null {\n return unsupported(\"RootMotionClip.rootNode\", ROOT_MOTION_UNSUPPORTED);\n }\n public get characterNode(): TransformNode {\n return unsupported(\"RootMotionClip.characterNode\", ROOT_MOTION_UNSUPPORTED);\n }\n public get contactNodes(): ReadonlyArray<TransformNode> {\n return unsupported(\"RootMotionClip.contactNodes\", ROOT_MOTION_UNSUPPORTED);\n }\n public get upAxis(): Vector3 {\n return unsupported(\"RootMotionClip.upAxis\", ROOT_MOTION_UNSUPPORTED);\n }\n public get fromFrame(): number {\n return unsupported(\"RootMotionClip.fromFrame\", ROOT_MOTION_UNSUPPORTED);\n }\n public get toFrame(): number {\n return unsupported(\"RootMotionClip.toFrame\", ROOT_MOTION_UNSUPPORTED);\n }\n public get travelDirection(): Vector3 {\n return unsupported(\"RootMotionClip.travelDirection\", ROOT_MOTION_UNSUPPORTED);\n }\n public get cycleOffset(): Vector3 {\n return unsupported(\"RootMotionClip.cycleOffset\", ROOT_MOTION_UNSUPPORTED);\n }\n public get cycleDistance(): number {\n return unsupported(\"RootMotionClip.cycleDistance\", ROOT_MOTION_UNSUPPORTED);\n }\n public get cycleRotation(): number {\n return unsupported(\"RootMotionClip.cycleRotation\", ROOT_MOTION_UNSUPPORTED);\n }\n public get extractsRotation(): boolean {\n return unsupported(\"RootMotionClip.extractsRotation\", ROOT_MOTION_UNSUPPORTED);\n }\n public get duration(): number {\n return unsupported(\"RootMotionClip.duration\", ROOT_MOTION_UNSUPPORTED);\n }\n public get averageSpeed(): number {\n return unsupported(\"RootMotionClip.averageSpeed\", ROOT_MOTION_UNSUPPORTED);\n }\n public get characterHeight(): number {\n return unsupported(\"RootMotionClip.characterHeight\", ROOT_MOTION_UNSUPPORTED);\n }\n public getOffsetAtFrame(_frame: number, _result: Vector3): Vector3 {\n return unsupported(\"RootMotionClip.getOffsetAtFrame\", ROOT_MOTION_UNSUPPORTED);\n }\n public getRotationAtFrame(_frame: number): number {\n return unsupported(\"RootMotionClip.getRotationAtFrame\", ROOT_MOTION_UNSUPPORTED);\n }\n public dispose(): void {\n unsupported(\"RootMotionClip.dispose\", ROOT_MOTION_UNSUPPORTED);\n }\n}\n\nexport class RootMotionController {\n public applyToCharacter = true;\n public readonly onRootMotionObservable!: Observable<RootMotionController>;\n\n public constructor(_characterNode: TransformNode, _clips: RootMotionClip[] = []) {\n unsupported(\"RootMotionController\", ROOT_MOTION_UNSUPPORTED);\n }\n\n public get characterNode(): TransformNode {\n return unsupported(\"RootMotionController.characterNode\", ROOT_MOTION_UNSUPPORTED);\n }\n public get clips(): ReadonlyArray<RootMotionClip> {\n return unsupported(\"RootMotionController.clips\", ROOT_MOTION_UNSUPPORTED);\n }\n public get deltaPosition(): Vector3 {\n return unsupported(\"RootMotionController.deltaPosition\", ROOT_MOTION_UNSUPPORTED);\n }\n public get deltaRotation(): number {\n return unsupported(\"RootMotionController.deltaRotation\", ROOT_MOTION_UNSUPPORTED);\n }\n public addClip(_clip: RootMotionClip): void {\n unsupported(\"RootMotionController.addClip\", ROOT_MOTION_UNSUPPORTED);\n }\n public removeClip(_clip: RootMotionClip): void {\n unsupported(\"RootMotionController.removeClip\", ROOT_MOTION_UNSUPPORTED);\n }\n public reset(): void {\n unsupported(\"RootMotionController.reset\", ROOT_MOTION_UNSUPPORTED);\n }\n public dispose(): void {\n unsupported(\"RootMotionController.dispose\", ROOT_MOTION_UNSUPPORTED);\n }\n}\n\n// ─── Materials ───────────────────────────────────────────────────────\nexport class MultiMaterial {\n public constructor() {\n unsupported(\"MultiMaterial\", \"Babylon Lite uses one material per renderable. Split the mesh geometry by material into separate meshes instead.\");\n }\n}\n\nexport type DitheredTileFadeSupportedMaterial = StandardMaterial | PBRMaterial;\nexport type DitheredTileFadeMesh = Mesh | InstancedMesh;\n\nexport interface IDitheredTileFadeBounds {\n lowerBound: number;\n upperBound: number;\n}\n\nexport interface IGaussianSplattingDebugOptions {\n clippingBox: { min: Vector3; max: Vector3 } | null;\n opacityCulling: { min: number; max: number } | null;\n sizeCulling: { min: number; max: number } | null;\n opacityScale: number;\n opacitySaturate: boolean;\n shDc: boolean;\n shOrder1: boolean;\n shOrder2: boolean;\n shOrder3: boolean;\n shOrder4: boolean;\n}\n\nexport const GaussianSplattingMaxPartCount = GAUSSIAN_SPLATTING_MAX_PART_COUNT;\n\nexport function GetGaussianSplattingMaxPartCount(engine: AbstractEngine): number {\n return getGaussianSplattingMaxPartCount(engine._lite);\n}\n\nexport function GetPartIndexVaryingDeclaration(shaderLanguage: ShaderLanguage): string {\n return getGaussianSplattingPartIndexVaryingDeclaration(shaderLanguage === ShaderLanguage.WGSL);\n}\n\nexport class GaussianSplattingMaterial extends PushMaterial {\n /** @internal The unsupported material has no Lite backing. */\n public get _lite(): never {\n return unsupported(\"GaussianSplattingMaterial._lite\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public constructor(name: string, scene?: Scene) {\n super(name);\n void scene;\n unsupported(\"GaussianSplattingMaterial\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public override clone(_name: string): GaussianSplattingMaterial {\n return unsupported(\"GaussianSplattingMaterial.clone\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n}\n\nexport class GaussianSplattingDebugMaterialPlugin extends MaterialPluginBase {\n /** @internal An unsupported plugin must not attach to a Lite material. */\n protected override get _attachToLite(): boolean {\n return false;\n }\n\n public constructor(material: GaussianSplattingMaterial) {\n super(material, \"GaussianSplattingDebug\", 200, {}, false);\n unsupported(\"GaussianSplattingDebugMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n}\n\nexport class GaussianSplattingGpuPickingMaterialPlugin extends MaterialPluginBase {\n public static EncodeIdToColor(id: number): [number, number, number] {\n return encodeIdToColor(id);\n }\n\n /** @internal An unsupported plugin must not attach to a Lite material. */\n protected override get _attachToLite(): boolean {\n return false;\n }\n\n public constructor(material: GaussianSplattingMaterial, _maxPartCount?: number) {\n super(material, \"GaussianSplatGpuPicking\", 230, {}, false);\n unsupported(\"GaussianSplattingGpuPickingMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n}\n\nexport class GaussianSplattingSolidColorMaterialPlugin extends MaterialPluginBase {\n /** @internal An unsupported plugin must not attach to a Lite material. */\n protected override get _attachToLite(): boolean {\n return false;\n }\n\n public constructor(material: GaussianSplattingMaterial, _partColors: Color3[], _maxPartCount?: number) {\n super(material, \"GaussianSplatSolidColor\", 200, {}, false);\n unsupported(\"GaussianSplattingSolidColorMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n}\n\nexport class GaussianSplattingSizeMaterialPlugin extends MaterialPluginBase {\n /** @internal An unsupported plugin must not attach to a Lite material. */\n protected override get _attachToLite(): boolean {\n return false;\n }\n\n public constructor(material: GaussianSplattingMaterial) {\n super(material, \"GaussianSplattingSize\", 210, {}, false);\n unsupported(\"GaussianSplattingSizeMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public get isEnabled(): boolean {\n return unsupported(\"GaussianSplattingSizeMaterialPlugin.isEnabled\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public set isEnabled(_value: boolean) {\n unsupported(\"GaussianSplattingSizeMaterialPlugin.isEnabled\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public get sizeScale(): number {\n return unsupported(\"GaussianSplattingSizeMaterialPlugin.sizeScale\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public set sizeScale(_value: number) {\n unsupported(\"GaussianSplattingSizeMaterialPlugin.sizeScale\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n}\n\nexport class GaussianSplattingOverdrawMaterialPlugin extends MaterialPluginBase {\n /** @internal An unsupported plugin must not attach to a Lite material. */\n protected override get _attachToLite(): boolean {\n return false;\n }\n\n public constructor(material: GaussianSplattingMaterial) {\n super(material, \"GaussianSplattingOverdraw\", 220, {}, false);\n unsupported(\"GaussianSplattingOverdrawMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public get isEnabled(): boolean {\n return unsupported(\"GaussianSplattingOverdrawMaterialPlugin.isEnabled\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public set isEnabled(_value: boolean) {\n unsupported(\"GaussianSplattingOverdrawMaterialPlugin.isEnabled\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public get intensity(): number {\n return unsupported(\"GaussianSplattingOverdrawMaterialPlugin.intensity\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n\n public set intensity(_value: number) {\n unsupported(\"GaussianSplattingOverdrawMaterialPlugin.intensity\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n }\n}\n\nexport function RegisterGaussianSplattingDebugMaterialPlugin(): void {\n unsupported(\"RegisterGaussianSplattingDebugMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n}\n\nexport function RegisterGaussianSplattingGpuPickingMaterialPlugin(): void {\n unsupported(\"RegisterGaussianSplattingGpuPickingMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n}\n\nexport function RegisterGaussianSplattingSolidColorMaterialPlugin(): void {\n unsupported(\"RegisterGaussianSplattingSolidColorMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n}\n\nexport function RegisterGaussianSplattingSizeMaterialPlugin(): void {\n unsupported(\"RegisterGaussianSplattingSizeMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n}\n\nexport function RegisterGaussianSplattingOverdrawMaterialPlugin(): void {\n unsupported(\"RegisterGaussianSplattingOverdrawMaterialPlugin\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n}\n\nexport function RegisterGaussianSplattingMaterial(): void {\n unsupported(\"RegisterGaussianSplattingMaterial\", GAUSSIAN_SPLATTING_MATERIAL_UNSUPPORTED);\n}\n\nexport class GaussianPointSplattingRenderer {\n public pointScale = 1;\n public kernelSize = 0.3;\n public minPixelSize = 0;\n public rightHandedSystem = false;\n public debugActive = 0;\n public isOrthographic = false;\n public compensation = false;\n public occlusionCulling = false;\n public maxAccumFrames = 255;\n\n public constructor(_engine: AbstractEngine) {\n unsupported(\"GaussianPointSplattingRenderer\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public supportsWorkload(_gaussianCount: number, _shDegree: number, _outWidth: number, _outHeight: number): boolean {\n return unsupported(\"GaussianPointSplattingRenderer.supportsWorkload\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public get accumBuffer(): StorageBuffer | null {\n return unsupported(\"GaussianPointSplattingRenderer.accumBuffer\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public get accumDepthBuffer(): StorageBuffer | null {\n return unsupported(\"GaussianPointSplattingRenderer.accumDepthBuffer\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public get renderedFrameCount(): number {\n return unsupported(\"GaussianPointSplattingRenderer.renderedFrameCount\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public get accumulationVersion(): number {\n return unsupported(\"GaussianPointSplattingRenderer.accumulationVersion\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public get pixelCycleLength(): number {\n return unsupported(\"GaussianPointSplattingRenderer.pixelCycleLength\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public async readPointCountAsync(): Promise<number> {\n return unsupported(\"GaussianPointSplattingRenderer.readPointCountAsync\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public get width(): number {\n return unsupported(\"GaussianPointSplattingRenderer.width\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public get height(): number {\n return unsupported(\"GaussianPointSplattingRenderer.height\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public get outputWidth(): number {\n return unsupported(\"GaussianPointSplattingRenderer.outputWidth\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public get outputHeight(): number {\n return unsupported(\"GaussianPointSplattingRenderer.outputHeight\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public get gaussianCount(): number {\n return unsupported(\"GaussianPointSplattingRenderer.gaussianCount\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public isReady(): boolean {\n return unsupported(\"GaussianPointSplattingRenderer.isReady\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public updateSplats(_means: Float32Array, _cov3d: Uint32Array, _colorOpacity: Uint32Array, _sh: Uint32Array | null, _shDegree: number, _count: number): void {\n unsupported(\"GaussianPointSplattingRenderer.updateSplats\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public resetAccumulation(): void {\n unsupported(\"GaussianPointSplattingRenderer.resetAccumulation\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setCamera(\n _view: Matrix,\n _viewProjection: Matrix,\n _near: number,\n _far: number,\n _focalX: number,\n _focalY: number,\n _camX: number,\n _camY: number,\n _camZ: number,\n _viewZMin: number,\n _viewZMax: number\n ): void {\n unsupported(\"GaussianPointSplattingRenderer.setCamera\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setProjectionZ(_m10: number, _m11: number, _m14: number, _m15: number): void {\n unsupported(\"GaussianPointSplattingRenderer.setProjectionZ\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setProjectionMatrix(_projection: Matrix, _inverseProjection: Matrix, _reverseDepth = false): void {\n unsupported(\"GaussianPointSplattingRenderer.setProjectionMatrix\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setPartData(_packed: Float32Array, _count: number): void {\n unsupported(\"GaussianPointSplattingRenderer.setPartData\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n /** @internal */\n public _matchesPartData(_packed: Float32Array, _count: number): boolean {\n return unsupported(\"GaussianPointSplattingRenderer._matchesPartData\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public renderToBuffer(_width: number, _height: number, _outWidth = _width, _outHeight = _height, _upsampleN = 1, _jitterX = 0, _jitterY = 0): boolean {\n return unsupported(\"GaussianPointSplattingRenderer.renderToBuffer\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public dispose(): void {\n unsupported(\"GaussianPointSplattingRenderer.dispose\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n}\n\nexport class DitheredTileFadeMaterialPlugin extends MaterialPluginBase {\n public static readonly Name = \"DitheredTileFade\";\n\n /** @internal The unsupported constructor must not alter the material or scene. */\n protected override get _attachToLite(): boolean {\n return false;\n }\n\n public constructor(material: DitheredTileFadeSupportedMaterial) {\n super(material, DitheredTileFadeMaterialPlugin.Name, 190, {}, false);\n unsupported(\"DitheredTileFadeMaterialPlugin\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public static GetOrCreate(_material: DitheredTileFadeSupportedMaterial): DitheredTileFadeMaterialPlugin {\n return unsupported(\"DitheredTileFadeMaterialPlugin.GetOrCreate\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public get isEnabled(): boolean {\n return unsupported(\"DitheredTileFadeMaterialPlugin.isEnabled\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public set isEnabled(_value: boolean) {\n unsupported(\"DitheredTileFadeMaterialPlugin.isEnabled\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public setFadeBounds(_mesh: DitheredTileFadeMesh, _lowerBound: number, _upperBound: number): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.setFadeBounds\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public setFadeLowerBound(_mesh: DitheredTileFadeMesh, _lowerBound: number): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.setFadeLowerBound\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public setFadeUpperBound(_mesh: DitheredTileFadeMesh, _upperBound: number): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.setFadeUpperBound\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public getFadeBoundsToRef(_mesh: DitheredTileFadeMesh, _result: IDitheredTileFadeBounds): boolean {\n return unsupported(\"DitheredTileFadeMaterialPlugin.getFadeBoundsToRef\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public resetFade(_mesh: DitheredTileFadeMesh): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.resetFade\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public setThinInstanceFadeBounds(_mesh: Mesh, _index: number, _lowerBound: number, _upperBound: number, _refresh = true): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.setThinInstanceFadeBounds\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public setThinInstanceFadeBoundsBuffer(_mesh: Mesh, _bounds: Float32Array): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.setThinInstanceFadeBoundsBuffer\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public commitThinInstanceFadeBounds(_mesh: Mesh): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.commitThinInstanceFadeBounds\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public resetThinInstanceFade(_mesh: Mesh, _index: number, _refresh = true): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.resetThinInstanceFade\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public reset(): void {\n unsupported(\"DitheredTileFadeMaterialPlugin.reset\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public copyToMaterial(_material: DitheredTileFadeSupportedMaterial): DitheredTileFadeMaterialPlugin {\n return unsupported(\"DitheredTileFadeMaterialPlugin.copyToMaterial\", DITHERED_TILE_FADE_UNSUPPORTED);\n }\n\n public getClassName(): string {\n return \"DitheredTileFadeMaterialPlugin\";\n }\n}\n\nexport class ShaderMaterial {\n /** @internal Stable diagnostic API inherited by unsupported subclasses. */\n protected static readonly _UnsupportedApi: string = \"ShaderMaterial\";\n\n /** @internal Stable structural blocker inherited by unsupported subclasses. */\n protected static readonly _UnsupportedReason: string = SHADER_MATERIAL_UNSUPPORTED;\n\n public constructor() {\n unsupported(new.target._UnsupportedApi, new.target._UnsupportedReason);\n }\n}\n\nexport class GaussianPointSplattingBlitMaterial extends ShaderMaterial {\n /** @internal Stable diagnostic API inherited by consumer subclasses. */\n protected static override readonly _UnsupportedApi = \"GaussianPointSplattingBlitMaterial\";\n\n /** @internal Stable structural blocker inherited by consumer subclasses. */\n protected static override readonly _UnsupportedReason = GAUSSIAN_POINT_SPLATTING_UNSUPPORTED;\n\n public constructor(_name: string, _scene: Scene) {\n super();\n }\n\n public setAccumBuffer(_buffer: StorageBuffer): void {\n unsupported(\"GaussianPointSplattingBlitMaterial.setAccumBuffer\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setAccumDepthBuffer(_buffer: StorageBuffer): void {\n unsupported(\"GaussianPointSplattingBlitMaterial.setAccumDepthBuffer\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setResolution(_width: number, _height: number): void {\n unsupported(\"GaussianPointSplattingBlitMaterial.setResolution\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setProjectionZ(_m10: number, _m11: number, _m14: number, _m15: number): void {\n unsupported(\"GaussianPointSplattingBlitMaterial.setProjectionZ\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setInverseProjection(_inverseProjection: Matrix): void {\n unsupported(\"GaussianPointSplattingBlitMaterial.setInverseProjection\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setLogarithmicDepthConstant(_constant: number): void {\n unsupported(\"GaussianPointSplattingBlitMaterial.setLogarithmicDepthConstant\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n}\n\nexport class GaussianPointSplattingDepthBlitMaterial extends ShaderMaterial {\n /** @internal Stable diagnostic API inherited by consumer subclasses. */\n protected static override readonly _UnsupportedApi = \"GaussianPointSplattingDepthBlitMaterial\";\n\n /** @internal Stable structural blocker inherited by consumer subclasses. */\n protected static override readonly _UnsupportedReason = GAUSSIAN_POINT_SPLATTING_UNSUPPORTED;\n\n public constructor(_name: string, _scene: Scene) {\n super();\n }\n\n public setAccumBuffer(_buffer: StorageBuffer): void {\n unsupported(\"GaussianPointSplattingDepthBlitMaterial.setAccumBuffer\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setAccumDepthBuffer(_buffer: StorageBuffer): void {\n unsupported(\"GaussianPointSplattingDepthBlitMaterial.setAccumDepthBuffer\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setResolution(_width: number, _height: number): void {\n unsupported(\"GaussianPointSplattingDepthBlitMaterial.setResolution\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setProjectionZ(_m10: number, _m11: number, _m14: number, _m15: number): void {\n unsupported(\"GaussianPointSplattingDepthBlitMaterial.setProjectionZ\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setInverseProjection(_inverseProjection: Matrix): void {\n unsupported(\"GaussianPointSplattingDepthBlitMaterial.setInverseProjection\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setDepthValues(_minZ: number, _minZPlusMaxZ: number): void {\n unsupported(\"GaussianPointSplattingDepthBlitMaterial.setDepthValues\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n\n public setReverseDepth(_reverse: boolean): void {\n unsupported(\"GaussianPointSplattingDepthBlitMaterial.setReverseDepth\", GAUSSIAN_POINT_SPLATTING_UNSUPPORTED);\n }\n}\n\nexport class BackgroundMaterial {\n public constructor() {\n unsupported(\"BackgroundMaterial\", \"Standalone BackgroundMaterial is not wrapped. Use the compat `Scene` environment helpers / native `loadEnvironment` instead.\");\n }\n}\n\nexport class OpenPBRMaterial extends PushMaterial {\n /** @internal Unsupported stubs never expose a backing Lite material. */\n public override get _lite(): never {\n return unsupported(\n \"OpenPBRMaterial._lite\",\n \"OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design.\"\n );\n }\n\n public constructor(_name: string, _scene?: Scene, _forceGLSL = false) {\n super(_name);\n unsupported(\n \"OpenPBRMaterial\",\n \"OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design.\"\n );\n }\n\n public clone(_name: string, _cloneTexturesOnlyOnce = true, _rootUrl = \"\"): OpenPBRMaterial {\n return unsupported(\n \"OpenPBRMaterial.clone\",\n \"OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design.\"\n );\n }\n}\n\nexport class OpenPBRMaterialDefines {\n public constructor(_externalProperties?: Record<string, { type: string; default: unknown }>) {\n unsupported(\n \"OpenPBRMaterialDefines\",\n \"OpenPBR requires a distinct shader/material model and parameter mapping that Babylon Lite does not define; adding that subsystem needs Lite maintainer design.\"\n );\n }\n}\n\nexport function RegisterOpenpbrMaterial(): void {\n unsupported(\n \"RegisterOpenpbrMaterial\",\n \"OpenPBR registration would install a material parser and shader subsystem that Babylon Lite does not define; adding that subsystem needs Lite maintainer design.\"\n );\n}\n\nexport class OpenPBRMaterialLoadingAdapter {\n public constructor(_material: Material) {\n unsupported(\n \"OpenPBRMaterialLoadingAdapter\",\n \"The adapter translates glTF material data into OpenPBRMaterial, whose shader/material subsystem requires Lite maintainer design.\"\n );\n }\n}\n\n// ─── Lights ──────────────────────────────────────────────────────────\nexport class RectAreaLight {\n public constructor() {\n unsupported(\"RectAreaLight\", \"Area lights are not implemented in Babylon Lite. Use Point/Spot/Directional/Hemispheric lights.\");\n }\n}\n\n// ─── Particles ───────────────────────────────────────────────────────\nexport class GPUParticleSystem {\n public constructor() {\n unsupported(\n \"GPUParticleSystem\",\n \"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.\"\n );\n }\n}\n\nexport class SolidParticleSystem {\n public constructor() {\n unsupported(\n \"SolidParticleSystem\",\n \"Solid particle systems (per-particle mesh copies) are not backed by Babylon Lite. Consider native thin instances for many-copies use cases; node-particle billboards are available via `NodeParticleSystemSet`.\"\n );\n }\n}\n\n// ─── Effect layers ───────────────────────────────────────────────────\nexport class HighlightLayer {\n public constructor() {\n unsupported(\"HighlightLayer\", \"Effect layers are not implemented in Babylon Lite.\");\n }\n}\n\nexport class GlowLayer {\n public constructor() {\n unsupported(\"GlowLayer\", \"Effect layers are not implemented in Babylon Lite. For a bloom-style glow, use the native bloom post-process task.\");\n }\n}\n\n// ─── Mesh-attached renderers / projectors ────────────────────────────\n// ─── GreasedLine (thick-line ribbon subsystem) ───────────────────────\n// Greased lines render polylines as camera-facing ribbons/tubes driven by a\n// dedicated plugin material (per-point widths, color/width distribution tables,\n// dashing, ribbon face/direction modes). Babylon Lite renders only 1px hardware\n// line-lists (see `MeshBuilder.CreateLines` / `CreateDashedLines`) and has no\n// thick-line ribbon geometry generator or plugin-material subsystem to back it,\n// so the whole family is a `❌ Not supported` throwing stub.\nconst GREASED_LINE_REASON =\n \"Greased (thick) lines are a ribbon/tube geometry + dedicated plugin-material subsystem (per-point widths, color/width distribution tables, dashing, camera-facing ribbon modes). Babylon Lite renders only 1px hardware line-lists (MeshBuilder.CreateLines / CreateDashedLines) and has no thick-line ribbon pipeline or plugin material to back it.\";\n\nexport class GreasedLineBaseMesh {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLineBaseMesh\", GREASED_LINE_REASON);\n }\n}\n\nexport class GreasedLineMesh {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLineMesh\", GREASED_LINE_REASON);\n }\n}\n\nexport class GreasedLineRibbonMesh {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLineRibbonMesh\", GREASED_LINE_REASON);\n }\n}\n\nexport class GreasedLinePluginMaterial {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLinePluginMaterial\", GREASED_LINE_REASON);\n }\n}\n\nexport class MaterialGreasedLineDefines {\n public constructor(..._args: unknown[]) {\n unsupported(\"MaterialGreasedLineDefines\", GREASED_LINE_REASON);\n }\n}\n\nexport class GreasedLineMaterialDefaults {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLineMaterialDefaults\", GREASED_LINE_REASON);\n }\n\n public static get DEFAULT_COLOR(): never {\n return unsupported(\"GreasedLineMaterialDefaults.DEFAULT_COLOR\", GREASED_LINE_REASON);\n }\n\n public static get DEFAULT_WIDTH_ATTENUATED(): never {\n return unsupported(\"GreasedLineMaterialDefaults.DEFAULT_WIDTH_ATTENUATED\", GREASED_LINE_REASON);\n }\n\n public static get DEFAULT_WIDTH(): never {\n return unsupported(\"GreasedLineMaterialDefaults.DEFAULT_WIDTH\", GREASED_LINE_REASON);\n }\n\n public static get EmptyColorsTexture(): never {\n return unsupported(\"GreasedLineMaterialDefaults.EmptyColorsTexture\", GREASED_LINE_REASON);\n }\n}\n\nexport function RegisterGreasedLinePluginMaterial(..._args: unknown[]): never {\n return unsupported(\"RegisterGreasedLinePluginMaterial\", GREASED_LINE_REASON);\n}\n\nexport class GreasedLineSimpleMaterial {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLineSimpleMaterial\", GREASED_LINE_REASON);\n }\n}\n\nexport class GreasedLineTools {\n public constructor(..._args: unknown[]) {\n unsupported(\"GreasedLineTools\", GREASED_LINE_REASON);\n }\n\n public static ConvertPoints(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.ConvertPoints\", GREASED_LINE_REASON);\n }\n\n public static OmitZeroLengthPredicate(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.OmitZeroLengthPredicate\", GREASED_LINE_REASON);\n }\n\n public static OmitDuplicatesPredicate(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.OmitDuplicatesPredicate\", GREASED_LINE_REASON);\n }\n\n public static MeshesToLines(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.MeshesToLines\", GREASED_LINE_REASON);\n }\n\n public static ToVector3Array(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.ToVector3Array\", GREASED_LINE_REASON);\n }\n\n public static ToNumberArray(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.ToNumberArray\", GREASED_LINE_REASON);\n }\n\n public static GetPointsCountInfo(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetPointsCountInfo\", GREASED_LINE_REASON);\n }\n\n public static GetLineLength(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetLineLength\", GREASED_LINE_REASON);\n }\n\n public static GetLineLengthArray(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetLineLengthArray\", GREASED_LINE_REASON);\n }\n\n public static SegmentizeSegmentByCount(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.SegmentizeSegmentByCount\", GREASED_LINE_REASON);\n }\n\n public static SegmentizeLineBySegmentLength(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.SegmentizeLineBySegmentLength\", GREASED_LINE_REASON);\n }\n\n public static SegmentizeLineBySegmentCount(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.SegmentizeLineBySegmentCount\", GREASED_LINE_REASON);\n }\n\n public static GetLineSegments(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetLineSegments\", GREASED_LINE_REASON);\n }\n\n public static GetMinMaxSegmentLength(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetMinMaxSegmentLength\", GREASED_LINE_REASON);\n }\n\n public static GetPositionOnLineByVisibility(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetPositionOnLineByVisibility\", GREASED_LINE_REASON);\n }\n\n public static GetCircleLinePoints(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetCircleLinePoints\", GREASED_LINE_REASON);\n }\n\n public static GetBezierLinePoints(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetBezierLinePoints\", GREASED_LINE_REASON);\n }\n\n public static GetArrowCap(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetArrowCap\", GREASED_LINE_REASON);\n }\n\n public static GetPointsFromText(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.GetPointsFromText\", GREASED_LINE_REASON);\n }\n\n public static Color3toRGBAUint8(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.Color3toRGBAUint8\", GREASED_LINE_REASON);\n }\n\n public static CreateColorsTexture(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.CreateColorsTexture\", GREASED_LINE_REASON);\n }\n\n public static PrepareEmptyColorsTexture(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.PrepareEmptyColorsTexture\", GREASED_LINE_REASON);\n }\n\n public static DisposeEmptyColorsTexture(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.DisposeEmptyColorsTexture\", GREASED_LINE_REASON);\n }\n\n public static BooleanToNumber(..._args: unknown[]): never {\n return unsupported(\"GreasedLineTools.BooleanToNumber\", GREASED_LINE_REASON);\n }\n}\n\nexport function CreateGreasedLine(..._args: unknown[]): never {\n return unsupported(\"CreateGreasedLine\", GREASED_LINE_REASON);\n}\n\nexport function CreateGreasedLineMaterial(..._args: unknown[]): never {\n return unsupported(\"CreateGreasedLineMaterial\", GREASED_LINE_REASON);\n}\n\nexport function GetPointsCount(..._args: unknown[]): never {\n return unsupported(\"GetPointsCount\", GREASED_LINE_REASON);\n}\n\nexport function CompleteGreasedLineWidthTable(..._args: unknown[]): never {\n return unsupported(\"CompleteGreasedLineWidthTable\", GREASED_LINE_REASON);\n}\n\nexport function CompleteGreasedLineColorTable(..._args: unknown[]): never {\n return unsupported(\"CompleteGreasedLineColorTable\", GREASED_LINE_REASON);\n}\n\n// GreasedLine enums are pure numeric parity shape (no feature logic), mirrored\n// from BJS so ported code that references the members resolves.\nexport enum GreasedLineMeshColorDistribution {\n COLOR_DISTRIBUTION_NONE = 0,\n COLOR_DISTRIBUTION_REPEAT = 1,\n COLOR_DISTRIBUTION_EVEN = 2,\n COLOR_DISTRIBUTION_START = 3,\n COLOR_DISTRIBUTION_END = 4,\n COLOR_DISTRIBUTION_START_END = 5,\n}\n\nexport enum GreasedLineMeshWidthDistribution {\n WIDTH_DISTRIBUTION_NONE = 0,\n WIDTH_DISTRIBUTION_REPEAT = 1,\n WIDTH_DISTRIBUTION_EVEN = 2,\n WIDTH_DISTRIBUTION_START = 3,\n WIDTH_DISTRIBUTION_END = 4,\n WIDTH_DISTRIBUTION_START_END = 5,\n}\n\nexport enum GreasedLineRibbonPointsMode {\n POINTS_MODE_POINTS = 0,\n POINTS_MODE_PATHS = 1,\n}\n\nexport enum GreasedLineRibbonFacesMode {\n FACES_MODE_SINGLE_SIDED = 0,\n FACES_MODE_SINGLE_SIDED_NO_BACKFACE_CULLING = 1,\n FACES_MODE_DOUBLE_SIDED = 2,\n}\n\nexport enum GreasedLineRibbonAutoDirectionMode {\n AUTO_DIRECTIONS_FROM_FIRST_SEGMENT = 0,\n AUTO_DIRECTIONS_FROM_ALL_SEGMENTS = 1,\n AUTO_DIRECTIONS_ENHANCED = 2,\n AUTO_DIRECTIONS_FACE_TO = 3,\n AUTO_DIRECTIONS_NONE = 99,\n}\n\nexport class EdgesRenderer {\n public constructor() {\n unsupported(\"EdgesRenderer\", \"Edge rendering is not implemented in Babylon Lite.\");\n }\n}\n\nexport class OutlineRenderer {\n public constructor() {\n unsupported(\"OutlineRenderer\", \"Mesh outline rendering is not implemented in Babylon Lite.\");\n }\n}\n\n// ─── Textures ────────────────────────────────────────────────────────\nexport class MirrorTexture {\n public constructor() {\n unsupported(\"MirrorTexture\", \"Mirror/reflection textures are not implemented in Babylon Lite. Build one from a native render-target texture + clip plane if required.\");\n }\n}\n\n// ─── HTML texture interaction (DOM/CSS overlay interop) ──────────────\n// `HtmlTexture` itself is Lite-backed in textures/textures.ts. These remaining\n// APIs bind arbitrary textures to DOM overlay/raycast and polyfill lifecycles,\n// which Lite's owned HTML-texture surface does not expose.\n\n/** Options accepted by Babylon.js `HtmlInteractionManager` (shape-only stub). */\nexport interface IHtmlInteractionManagerOptions {\n [key: string]: unknown;\n}\n\n/** Options accepted by Babylon.js `HtmlRaycastInteractionManager` (shape-only stub). */\nexport interface IHtmlRaycastInteractionManagerOptions {\n [key: string]: unknown;\n}\n\n/** Module shape of an HTML-in-canvas polyfill (shape-only stub). */\nexport interface IHtmlInCanvasPolyfillModule {\n [key: string]: unknown;\n}\n\n/** Options accepted by `InstallHtmlInCanvasPolyfill` (shape-only stub). */\nexport interface IInstallHtmlInCanvasPolyfillOptions {\n [key: string]: unknown;\n}\n\nexport class HtmlInteractionManager {\n public constructor() {\n unsupported(\"HtmlInteractionManager\", \"HTML overlay interaction is not part of Babylon Lite's WebGPU renderer.\");\n }\n}\n\nexport class HtmlRaycastInteractionManager {\n public constructor() {\n unsupported(\"HtmlRaycastInteractionManager\", \"HTML overlay raycast interaction is not part of Babylon Lite's WebGPU renderer.\");\n }\n}\n\n/** Babylon.js `IsHtmlInCanvasUploadSupported` — kept in lockstep with the unavailable upload helper. */\nexport function IsHtmlInCanvasUploadSupported(engine: AbstractEngine): boolean {\n void engine;\n return unsupported(\n \"IsHtmlInCanvasUploadSupported\",\n \"Lite's HTML texture owns its element and texture together; it cannot back BJS's arbitrary InternalTexture upload contract.\"\n );\n}\n\n/** Babylon.js `UploadHtmlElementToTexture` — HTML texture upload is unsupported by the compat layer. */\nexport function UploadHtmlElementToTexture(): never {\n return unsupported(\"UploadHtmlElementToTexture\", \"HTML-element texture upload is not supported by Babylon Lite.\");\n}\n\n/** Babylon.js `ComputeOverlayCssTransform` — HTML overlay interaction is unsupported by the compat layer. */\nexport function ComputeOverlayCssTransform(): never {\n return unsupported(\"ComputeOverlayCssTransform\", \"HTML overlay interaction is not supported by Babylon Lite.\");\n}\n\n/** Babylon.js `GetElementPixelFromUv` — HTML overlay raycast interaction is unsupported by the compat layer. */\nexport function GetElementPixelFromUv(): never {\n return unsupported(\"GetElementPixelFromUv\", \"HTML overlay raycast interaction is not supported by Babylon Lite.\");\n}\n\n/** Babylon.js `IsHtmlInCanvasSupportedNatively` — the HTML-in-canvas feature is unsupported by the compat layer. */\nexport function IsHtmlInCanvasSupportedNatively(): never {\n return unsupported(\"IsHtmlInCanvasSupportedNatively\", \"The HTML-in-canvas feature is not supported by Babylon Lite.\");\n}\n\n/** Babylon.js `InstallHtmlInCanvasPolyfill` — the HTML-in-canvas polyfill is unsupported by the compat layer. */\nexport function InstallHtmlInCanvasPolyfill(): never {\n return unsupported(\"InstallHtmlInCanvasPolyfill\", \"The HTML-in-canvas polyfill is not supported by Babylon Lite.\");\n}\n\n/** Babylon.js `UninstallHtmlInCanvasPolyfill` — the HTML-in-canvas polyfill is unsupported by the compat layer. */\nexport function UninstallHtmlInCanvasPolyfill(): never {\n return unsupported(\"UninstallHtmlInCanvasPolyfill\", \"The HTML-in-canvas polyfill is not supported by Babylon Lite.\");\n}\n\n// ─── Audio ───────────────────────────────────────────────────────────\nexport class Sound {\n public constructor() {\n unsupported(\"Sound\", \"Audio is not part of Babylon Lite. Use the Web Audio API directly.\");\n }\n}\n\n// ─── Behaviors (mesh + camera) ───────────────────────────────────────\n// Babylon Lite exposes a utility-layer pointer-drag dispatcher\n// (`createPointerDrag` / `registerPointerDrag`) used by its gizmos, but it does\n// not expose the main-scene mesh-dragging, XR/multi-pointer, follow, or\n// geospatial camera behaviors these BJS classes provide, so each is a throwing\n// stub. The camera behaviors that Lite *can* back (`AutoRotationBehavior`,\n// `BouncingBehavior`, `FramingBehavior`) live in `behaviors/behaviors.ts`.\nexport class PointerDragBehavior {\n public constructor() {\n unsupported(\n \"PointerDragBehavior\",\n \"Babylon Lite's pointer-drag (`createPointerDrag`) only drives utility-layer gizmo colliders, not arbitrary main-scene meshes, so mesh drag-behaviors cannot be wrapped.\"\n );\n }\n}\n\nexport class BaseSixDofDragBehavior {\n public constructor() {\n unsupported(\"BaseSixDofDragBehavior\", \"Six-DoF mesh dragging is not implemented in Babylon Lite.\");\n }\n}\n\nexport class SixDofDragBehavior {\n public constructor() {\n unsupported(\"SixDofDragBehavior\", \"Six-DoF mesh dragging is not implemented in Babylon Lite.\");\n }\n}\n\nexport class MultiPointerScaleBehavior {\n public constructor() {\n unsupported(\"MultiPointerScaleBehavior\", \"Multi-pointer scaling is not implemented in Babylon Lite.\");\n }\n}\n\nexport class AttachToBoxBehavior {\n public constructor() {\n unsupported(\"AttachToBoxBehavior\", \"Bounding-box attachment (app-bar UI) is not implemented in Babylon Lite.\");\n }\n}\n\nexport class FadeInOutBehavior {\n public constructor() {\n unsupported(\"FadeInOutBehavior\", \"Mesh fade-in/out visibility tweening is not implemented in Babylon Lite.\");\n }\n}\n\nexport class SurfaceMagnetismBehavior {\n public constructor() {\n unsupported(\"SurfaceMagnetismBehavior\", \"Surface magnetism (mesh snapping) is not implemented in Babylon Lite.\");\n }\n}\n\nexport class FollowBehavior {\n public constructor() {\n unsupported(\"FollowBehavior\", \"Camera-follow behavior is not implemented in Babylon Lite.\");\n }\n}\n\nexport class HandConstraintBehavior {\n public constructor() {\n unsupported(\"HandConstraintBehavior\", \"WebXR hand-constraint behavior is out of scope for Babylon Lite.\");\n }\n}\n\nexport class InterpolatingBehavior {\n public constructor() {\n unsupported(\"InterpolatingBehavior\", \"The interpolating camera behavior is not implemented in Babylon Lite.\");\n }\n}\n\nexport class GeospatialClippingBehavior {\n public constructor() {\n unsupported(\"GeospatialClippingBehavior\", \"Geospatial camera clipping is not implemented in Babylon Lite.\");\n }\n}\n\n// ─── Serialization ───────────────────────────────────────────────────\n/** Babylon.js scene serializer. Babylon Lite uses different data structures and does not round-trip `.babylon`. */\nexport const SceneSerializer = {\n Serialize(): never {\n return unsupported(\"SceneSerializer.Serialize\", \"Babylon Lite does not implement `.babylon` scene serialization.\");\n },\n SerializeMesh(): never {\n return unsupported(\"SceneSerializer.SerializeMesh\", \"Babylon Lite does not implement mesh serialization.\");\n },\n};\n","import {\n createKhrInteractivityRuntimeValueSnapshot,\n hasDefaultInteractivityFlowInput,\n normalizeInteractivityEventDataConfiguration,\n normalizeKhrInteractivityRuntimeValue,\n} from \"babylon-lite\";\n\nimport type { AnimationGroup } from \"../animations/animation.js\";\nimport type { Camera } from \"../cameras/cameras.js\";\nimport { unsupported } from \"../error.js\";\nimport type { Material } from \"../materials/materials.js\";\nimport type { Node } from \"../node/node.js\";\n\nconst KHR_INTERACTIVITY_UNSUPPORTED =\n \"KHR_interactivity depends on Babylon.js FlowGraph block, connection, context, serialization, and glTF-reference models. Lite's flow-graph runtime uses a different graph model, so a stable cross-model adapter requires a broader loader/runtime design.\";\nconst KHR_INTERACTIVITY_EXPORT_UNSUPPORTED =\n \"KHR_interactivity export planning depends on Babylon.js FlowGraph block provenance and the Babylon.js glTF serializer's final entity-index remapping context. Lite exposes a different runtime graph model and no glTF serializer.\";\n\nexport type KHRInteractivitySignature = \"bool\" | \"float\" | \"float2\" | \"float3\" | \"float4\" | \"float2x2\" | \"float3x3\" | \"float4x4\" | \"int\" | \"ref\" | \"custom\";\n\nexport interface IKHRInteractivityNode {\n declaration: number;\n values?: Record<string, IKHRInteractivityVariable | IKHRInteractivityOutputSocketReference>;\n flows?: Record<string, IKHRInteractivityOutputFlow>;\n configuration?: Record<string, IKHRInteractivityConfiguration>;\n}\n\nexport interface IKHRInteractivityGraph {\n name?: string;\n types?: IKHRInteractivityType[];\n variables?: IKHRInteractivityVariable[];\n events?: IKHRInteractivityEvent[];\n declarations?: IKHRInteractivityDeclaration[];\n nodes?: IKHRInteractivityNode[];\n}\n\nexport interface IKHRInteractivityDeclaration {\n op: string;\n extension?: string;\n outputValueSockets?: Record<string, { type: number }>;\n inputValueSockets?: Record<string, { type: number }>;\n}\n\nexport interface IKHRInteractivityType {\n signature: KHRInteractivitySignature;\n}\n\nexport interface IKHRInteractivityVariable {\n value?: Array<boolean | number | string>;\n type: number;\n}\n\nexport interface IKHRInteractivityEvent {\n id?: string;\n values?: Record<string, IKHRInteractivityVariable>;\n}\n\nexport interface IKHRInteractivityOutputSocketReference {\n node: number;\n socket?: string;\n type?: number;\n}\n\nexport interface IKHRInteractivityOutputFlow {\n node: number;\n socket?: string;\n}\n\nexport interface IKHRInteractivityConfiguration {\n value?: Array<boolean | number | string>;\n}\n\nexport interface IGLTF {\n asset: {\n version: string;\n };\n nodes?: unknown[];\n}\n\nexport interface ISerializedFlowGraphConnection {\n uniqueId: string;\n name: string;\n // eslint-disable-next-line babylon-lite/underscore-requires-internal -- Public Babylon.js field.\n _connectionType: number;\n connectedPointIds: string[];\n defaultValue?: unknown;\n}\n\nexport interface ISerializedFlowGraphBlock {\n className: string;\n type: string;\n config: unknown;\n uniqueId: string;\n dataInputs: ISerializedFlowGraphConnection[];\n dataOutputs: ISerializedFlowGraphConnection[];\n metadata: unknown;\n signalInputs: ISerializedFlowGraphConnection[];\n signalOutputs: ISerializedFlowGraphConnection[];\n}\n\nexport type ISerializedFlowGraphContext = {\n uniqueId: string;\n name?: string;\n enableLogging?: boolean;\n} & Record<\"_userVariables\" | \"_connectionValues\", Record<string, unknown>> &\n Partial<Record<\"_variableTypes\", Record<string, string>>> &\n Partial<Record<\"_assetsContext\", Record<string, unknown>>>;\n\nexport interface ISerializedFlowGraph {\n name?: string;\n uniqueId?: string;\n executionContexts: ISerializedFlowGraphContext[];\n allBlocks: ISerializedFlowGraphBlock[];\n rightHanded?: boolean;\n}\n\ntype CompatibleCallback<TArgs extends unknown[], TResult> = {\n bivarianceHack(...args: TArgs): TResult;\n}[\"bivarianceHack\"];\n\nexport interface IGLTFToFlowGraphMappingObject {\n name: string;\n compatibilityOnly?: boolean;\n gltfType?: string;\n flowGraphType?: string;\n // Babylon.js intentionally exposes `any` here so explicitly typed transformers remain assignable under strictFunctionTypes.\n dataTransformer?: (data: any, parser: InteractivityGraphToFlowGraphParser) => any;\n isArray?: boolean;\n inOptions?: boolean;\n isVariable?: boolean;\n toBlock?: string;\n defaultValue?: unknown;\n convertConnectedTimeToFrames?: boolean;\n configurationType?: \"bool\" | \"int\" | \"int[]\" | \"string\";\n validationOnly?: boolean;\n required?: boolean;\n indexSource?: \"types\" | \"variables\" | \"events\" | \"nodes\" | \"assetNodes\";\n minItems?: number;\n generatesInputValueSockets?: boolean;\n generatesCaseInputValueSockets?: boolean;\n pointerTemplate?: boolean;\n invalidUsesDefault?: boolean;\n allowedSignatures?: readonly KHRInteractivitySignature[];\n typeSourceInput?: string;\n minimum?: number;\n maximum?: number;\n generatesInputFlowSockets?: boolean;\n generatesOutputFlowSockets?: boolean;\n configurationGroup?: string;\n uniqueValues?: boolean;\n debugLogTemplate?: boolean;\n}\n\nexport interface IGLTFToFlowGraphMapping {\n blocks: string[];\n declarationSchema?: {\n inputValueSockets: Record<string, KHRInteractivitySignature>;\n outputValueSockets: Record<string, KHRInteractivitySignature>;\n };\n inputs?: {\n values?: Record<string, IGLTFToFlowGraphMappingObject>;\n flows?: Record<string, IGLTFToFlowGraphMappingObject>;\n };\n outputs?: {\n values?: Record<string, IGLTFToFlowGraphMappingObject>;\n flows?: Record<string, IGLTFToFlowGraphMappingObject>;\n };\n configuration?: Record<string, IGLTFToFlowGraphMappingObject>;\n typeToTypeMapping?: Record<string, IGLTFToFlowGraphMappingObject>;\n interBlockConnectors?: Array<{\n input: string;\n output: string;\n inputBlockIndex: number;\n outputBlockIndex: number;\n isVariable?: boolean;\n }>;\n validation?: CompatibleCallback<[gltfBlock: IKHRInteractivityNode, interactivityGraph: IKHRInteractivityGraph, glTFObject?: IGLTF], { valid: boolean; error?: string }>;\n extraProcessor?: CompatibleCallback<\n [\n gltfBlock: IKHRInteractivityNode,\n declaration: IKHRInteractivityDeclaration,\n mapping: IGLTFToFlowGraphMapping,\n parser: InteractivityGraphToFlowGraphParser,\n serializedObjects: ISerializedFlowGraphBlock[],\n context: ISerializedFlowGraphContext,\n globalGLTF?: IGLTF,\n ],\n ISerializedFlowGraphBlock[]\n >;\n}\n\nexport interface IKHRInteractivityOperationRegistryEntry {\n op: string;\n extension?: string;\n mapping: IGLTFToFlowGraphMapping;\n}\n\nexport interface IDebugLogTemplateParseResult {\n valid: boolean;\n sockets: string[];\n}\n\nexport function ParseDebugLogTemplate(_message: string): IDebugLogTemplateParseResult {\n return unsupported(\"GLTF2.ParseDebugLogTemplate\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function getMappingForFullOperationName(_operation: string): IGLTFToFlowGraphMapping | undefined {\n return unsupported(\"GLTF2.getMappingForFullOperationName\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function getMappingForDeclaration(_declaration: unknown, _returnNoOpIfNotAvailable = true): IGLTFToFlowGraphMapping | undefined {\n return unsupported(\"GLTF2.getMappingForDeclaration\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function getNoOpMappingForDeclaration(_declaration: unknown): IGLTFToFlowGraphMapping {\n return unsupported(\"GLTF2.getNoOpMappingForDeclaration\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function addNewInteractivityFlowGraphMapping(_key: string, _extension: string, _mapping: IGLTFToFlowGraphMapping): void {\n unsupported(\"GLTF2.addNewInteractivityFlowGraphMapping\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function getAllSupportedNativeNodeTypes(): string[] {\n return unsupported(\"GLTF2.getAllSupportedNativeNodeTypes\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function HasDefaultInteractivityFlowInput(operation: string): boolean {\n return hasDefaultInteractivityFlowInput(operation);\n}\n\nexport function NormalizeInteractivityEventDataConfiguration(value: unknown): unknown {\n return normalizeInteractivityEventDataConfiguration(value);\n}\n\nexport function GetInteractivityOperationRegistry(): readonly IKHRInteractivityOperationRegistryEntry[] {\n return unsupported(\"GLTF2.GetInteractivityOperationRegistry\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport type KHRInteractivityFlowGraphType =\n | \"any\"\n | \"string\"\n | \"number\"\n | \"boolean\"\n | \"object\"\n | \"FlowGraphInteger\"\n | \"Vector2\"\n | \"Vector3\"\n | \"Vector4\"\n | \"Quaternion\"\n | \"Matrix\"\n | \"Matrix2D\"\n | \"Matrix3D\"\n | \"Color3\"\n | \"Color4\";\n\nexport interface IKHRInteractivityTypeMapping {\n length: number;\n flowGraphType: KHRInteractivityFlowGraphType;\n elementType: \"number\" | \"boolean\" | \"string\" | \"any\";\n}\n\nexport const gltfTypeToBabylonType: Readonly<Record<string, IKHRInteractivityTypeMapping>> = {\n float: { length: 1, flowGraphType: \"number\", elementType: \"number\" },\n bool: { length: 1, flowGraphType: \"boolean\", elementType: \"boolean\" },\n float2: { length: 2, flowGraphType: \"Vector2\", elementType: \"number\" },\n float3: { length: 3, flowGraphType: \"Vector3\", elementType: \"number\" },\n float4: { length: 4, flowGraphType: \"Vector4\", elementType: \"number\" },\n float4x4: { length: 16, flowGraphType: \"Matrix\", elementType: \"number\" },\n float2x2: { length: 4, flowGraphType: \"Matrix2D\", elementType: \"number\" },\n float3x3: { length: 9, flowGraphType: \"Matrix3D\", elementType: \"number\" },\n int: { length: 1, flowGraphType: \"FlowGraphInteger\", elementType: \"number\" },\n ref: { length: 1, flowGraphType: \"string\", elementType: \"string\" },\n custom: { length: 0, flowGraphType: \"any\", elementType: \"any\" },\n};\n\nexport interface IFlowGraphEventReferenceBlockConfiguration {\n eventKey?: string;\n [key: string]: unknown;\n}\n\nexport class FlowGraphEventReferenceBlock {\n public readonly config: IFlowGraphEventReferenceBlockConfiguration;\n\n public constructor(config: IFlowGraphEventReferenceBlockConfiguration) {\n this.config = config;\n unsupported(\"GLTF2.FlowGraphEventReferenceBlock\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n}\n\nexport interface IFlowGraphGLTFDataProviderBlockConfiguration {\n glTF?: unknown;\n [key: string]: unknown;\n}\n\nexport class FlowGraphGLTFDataProvider {\n public constructor(_config: IFlowGraphGLTFDataProviderBlockConfiguration = {}) {\n unsupported(\"GLTF2.FlowGraphGLTFDataProvider\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n}\n\nexport function GetInteractivityObjectReference(_context: unknown, _value: object | undefined): string {\n return unsupported(\"GLTF2.GetInteractivityObjectReference\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport class FlowGraphObjectReferenceBlock {\n public constructor(_config: Record<string, unknown> = {}) {\n unsupported(\"GLTF2.FlowGraphObjectReferenceBlock\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n}\n\nexport interface IFlowGraphUnsupportedInteractivitySocket {\n name: string;\n type?: string;\n signature?: string;\n}\n\nexport interface IFlowGraphUnsupportedInteractivityBlockConfiguration {\n operation: string;\n inputValueSockets: IFlowGraphUnsupportedInteractivitySocket[];\n outputValueSockets: IFlowGraphUnsupportedInteractivitySocket[];\n inputFlowSockets: string[];\n outputFlowSockets: string[];\n [key: string]: unknown;\n}\n\nexport class FlowGraphUnsupportedInteractivityBlock {\n public readonly config: IFlowGraphUnsupportedInteractivityBlockConfiguration;\n\n public constructor(config: IFlowGraphUnsupportedInteractivityBlockConfiguration) {\n this.config = config;\n unsupported(\"GLTF2.FlowGraphUnsupportedInteractivityBlock\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n}\n\nexport const KHR_INTERACTIVITY_SPECIFICATION_COMMIT = \"f798712c5685bc9223a628140fba707db8889300\";\n\nexport type KHRInteractivityDeclarationSupport = \"core\" | \"extension\" | \"unsupported-extension\" | \"unknown-core\";\n\nexport interface IKHRInteractivityDiagnostic {\n path: string;\n message: string;\n severity: \"error\" | \"warning\";\n}\n\nexport interface IKHRInteractivityDeclarationModel {\n index: number;\n operation: string;\n support: KHRInteractivityDeclarationSupport;\n source: IKHRInteractivityDeclaration;\n}\n\nexport interface IKHRInteractivityGraphModel {\n index: number;\n path: string;\n name: string;\n source: unknown;\n effectiveSource: unknown;\n declarations: IKHRInteractivityDeclarationModel[];\n diagnostics: IKHRInteractivityDiagnostic[];\n valid: boolean;\n}\n\nexport interface IKHRInteractivityInputDefaultProvenance {\n runtimeValueFingerprint?: string;\n unrepresentable?: true;\n}\n\nexport interface IKHRInteractivityConfigurationProvenance {\n sourceValue?: unknown[];\n runtimeValue?: unknown;\n}\n\nexport interface IKHRInteractivityBlockProvenance {\n graphIndex: number;\n nodeIndex: number;\n declarationIndex: number;\n operation: string;\n role: number;\n sourcePath: string;\n configuration?: Record<string, IKHRInteractivityConfigurationProvenance>;\n generatedConfiguration?: Record<string, unknown>;\n generatedConfigurationRuntime?: Record<string, IKHRInteractivityInputDefaultProvenance>;\n generatedInputDefaults?: Record<string, IKHRInteractivityInputDefaultProvenance>;\n}\n\nexport interface IKHRInteractivitySocketProvenance extends IKHRInteractivityBlockProvenance {\n kind: \"value\" | \"flow\";\n direction: \"input\" | \"output\";\n socket: string;\n sourceValue?: IKHRInteractivityVariable | IKHRInteractivityOutputSocketReference;\n runtimeValue?: unknown[];\n runtimeValueSnapshot?: IKHRInteractivityInputDefaultProvenance;\n}\n\nexport interface IKHRInteractivityGraphProvenance {\n graphIndex: number;\n specificationCommit: string;\n source: IKHRInteractivityGraph;\n authoredVariableValues?: Record<number, unknown[]>;\n authoredVariableTypes?: Record<number, string>;\n authoredVariableStructureChanged?: boolean;\n}\n\nexport function _NormalizeKHRInteractivityRuntimeValue(value: unknown): unknown[] | undefined {\n return normalizeKhrInteractivityRuntimeValue(value);\n}\n\nexport function _CreateKHRInteractivityRuntimeValueSnapshot(value: unknown): IKHRInteractivityInputDefaultProvenance {\n return createKhrInteractivityRuntimeValueSnapshot(value);\n}\n\nexport interface IKHRInteractivityDocument {\n specificationCommit: string;\n source: unknown;\n defaultGraphIndex: number;\n graphs: IKHRInteractivityGraphModel[];\n diagnostics: IKHRInteractivityDiagnostic[];\n}\n\nexport function CloneKHRInteractivityGraph(_graph: unknown): never {\n return unsupported(\"GLTF2.CloneKHRInteractivityGraph\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function CreateEffectiveKHRInteractivityGraph(_graph: unknown, _declarations: readonly IKHRInteractivityDeclarationModel[], _assetNodeCount?: number): never {\n return unsupported(\"GLTF2.CreateEffectiveKHRInteractivityGraph\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function CreateKHRInteractivityGraphModel(_graph: unknown, _index = 0, _supportedExtensions?: ReadonlySet<string>, _assetNodeCount?: number): IKHRInteractivityGraphModel {\n return unsupported(\"GLTF2.CreateKHRInteractivityGraphModel\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function CreateKHRInteractivityDocument(_extension: unknown, _supportedExtensions?: ReadonlySet<string>, _assetNodeCount?: number): IKHRInteractivityDocument {\n return unsupported(\"GLTF2.CreateKHRInteractivityDocument\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function _CaptureKHRInteractivityRuntimeInputDefaults(_flowGraph: unknown): void {\n unsupported(\"GLTF2._CaptureKHRInteractivityRuntimeInputDefaults\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport type KHRInteractivityExportClassification = \"exact\" | \"inverse-composite\" | \"unsupported\" | \"lossy\";\n\nexport interface IKHRInteractivityExportDiagnostic {\n code:\n | \"GRAPH_SOURCE_MISSING\"\n | \"GRAPH_COUNT_MISMATCH\"\n | \"NODE_SOURCE_MISSING\"\n | \"BLOCK_PROVENANCE_INVALID\"\n | \"BLOCK_ROLE_MISSING\"\n | \"BLOCK_ROLE_DUPLICATE\"\n | \"BLOCK_TYPE_MISMATCH\"\n | \"BLOCK_UNSUPPORTED\"\n | \"BLOCK_AMBIGUOUS\"\n | \"COMPOSITE_CONNECTION_CHANGED\"\n | \"SOCKET_PROVENANCE_MISSING\"\n | \"SOCKET_CONNECTION_AMBIGUOUS\"\n | \"SOCKET_TARGET_UNREPRESENTABLE\"\n | \"INPUT_DEFAULT_UNREPRESENTABLE\"\n | \"VALUE_UNREPRESENTABLE\"\n | \"CONFIGURATION_UNREPRESENTABLE\"\n | \"REFERENCE_UNRESOLVED\"\n | \"DEPENDENCY_CYCLE\"\n | \"GRAPH_INVALID\";\n path: string;\n message: string;\n severity: \"error\" | \"warning\";\n graphIndex?: number;\n nodeIndex?: number;\n blockId?: string;\n socket?: string;\n}\n\nexport interface IKHRInteractivityNodeExportAnalysis {\n graphIndex: number;\n nodeIndex?: number;\n operation?: string;\n blockIds: string[];\n classification: KHRInteractivityExportClassification;\n diagnostics: IKHRInteractivityExportDiagnostic[];\n}\n\nexport interface IKHRInteractivityExportAnalysis {\n representable: boolean;\n nodes: IKHRInteractivityNodeExportAnalysis[];\n diagnostics: IKHRInteractivityExportDiagnostic[];\n}\n\nexport type KhrInteractivityRootCollection = \"nodes\" | \"animations\" | \"cameras\" | \"materials\" | \"meshes\" | \"textures\" | \"images\" | \"samplers\" | \"skins\" | \"scenes\";\n\nexport interface IKHRInteractivitySerializerContext {\n getNodeCount(): number;\n getNodeIndex(node: Node): number | undefined;\n getAnimationIndex(animation: AnimationGroup): number | undefined;\n getCameraIndex(camera: Camera): number | undefined;\n getMaterialIndex(material: Material): number | undefined;\n getRootIndex?(collection: KhrInteractivityRootCollection, entity: object): number | undefined;\n setNodeExtension(nodeIndex: number, extensionName: string, value: unknown): void;\n}\n\nexport interface IKHRInteractivityExportProvider {\n readonly required: boolean;\n readonly additionalExtensionsUsed: readonly string[];\n readonly additionalExtensionsRequired: readonly string[];\n analyze(): IKHRInteractivityExportAnalysis;\n build(context: IKHRInteractivitySerializerContext): unknown;\n}\n\nexport interface IKHRInteractivityExportOptions {\n document?: IKHRInteractivityDocument;\n sourceGLTF?: IGLTF;\n defaultGraphIndex?: number;\n targetFps?: number;\n required?: boolean;\n additionalExtensionsRequired?: readonly string[];\n}\n\nexport class KHRInteractivityExportError extends Error {\n public constructor(public readonly diagnostics: readonly IKHRInteractivityExportDiagnostic[]) {\n super(diagnostics.map((diagnostic) => `${diagnostic.path}: ${diagnostic.message}`).join(\"\\n\"));\n this.name = \"KHRInteractivityExportError\";\n }\n}\n\nexport class KHRInteractivityExportPlan implements IKHRInteractivityExportProvider {\n public readonly required = true;\n public readonly additionalExtensionsUsed: readonly string[] = [];\n public readonly additionalExtensionsRequired: readonly string[] = [];\n\n public constructor(_flowGraphs: readonly unknown[], _options: IKHRInteractivityExportOptions = {}) {\n unsupported(\"GLTF2.KHRInteractivityExportPlan\", KHR_INTERACTIVITY_EXPORT_UNSUPPORTED);\n }\n\n public analyze(): IKHRInteractivityExportAnalysis {\n return unsupported(\"GLTF2.KHRInteractivityExportPlan.analyze\", KHR_INTERACTIVITY_EXPORT_UNSUPPORTED);\n }\n\n public build(_context: IKHRInteractivitySerializerContext): unknown {\n return unsupported(\"GLTF2.KHRInteractivityExportPlan.build\", KHR_INTERACTIVITY_EXPORT_UNSUPPORTED);\n }\n}\n\nexport function CreateKHRInteractivityExportPlan(flowGraphs: readonly unknown[], options: IKHRInteractivityExportOptions = {}): KHRInteractivityExportPlan {\n return new KHRInteractivityExportPlan(flowGraphs, options);\n}\n\nexport interface InteractivityEvent {\n eventId: string;\n eventData?: Array<{\n eventData: boolean;\n id: string;\n type: string;\n value?: unknown;\n }>;\n}\n\nexport class InteractivityGraphToFlowGraphParser {\n /** @internal Upstream parser timing state; the parser itself is unsupported. */\n public _animationTargetFps: number;\n\n public constructor(\n _interactivityGraph: unknown,\n _gltf: unknown,\n animationTargetFps = 60,\n _graphIndex = 0,\n _supportedExtensions?: ReadonlySet<string>,\n _declarationModels?: readonly IKHRInteractivityDeclarationModel[]\n ) {\n this._animationTargetFps = animationTargetFps;\n unsupported(\"GLTF2.InteractivityGraphToFlowGraphParser\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n\n public getVariableName(_index: number): string {\n return unsupported(\"GLTF2.InteractivityGraphToFlowGraphParser.getVariableName\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n\n public get arrays(): {\n types: IKHRInteractivityTypeMapping[];\n mappings: Array<{\n flowGraphMapping: IGLTFToFlowGraphMapping;\n fullOperationName: string;\n declaration: IKHRInteractivityDeclarationModel;\n }>;\n staticVariables: Array<{ type: KHRInteractivityFlowGraphType; value: any[] }>;\n events: InteractivityEvent[];\n nodes: Array<{ blocks: ISerializedFlowGraphBlock[]; fullOperationName: string }>;\n } {\n return unsupported(\"GLTF2.InteractivityGraphToFlowGraphParser.arrays\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n\n public serializeToFlowGraph(): ISerializedFlowGraph {\n return unsupported(\"GLTF2.InteractivityGraphToFlowGraphParser.serializeToFlowGraph\", KHR_INTERACTIVITY_UNSUPPORTED);\n }\n}\n\nexport type InteractivityNodeState = \"hoverable\" | \"selectable\";\n\nexport function InitializeInteractivityNodeState(_nodes: readonly unknown[], _state: InteractivityNodeState, _getAuthoredState: (node: unknown) => boolean | undefined): void {\n unsupported(\"GLTF2.InitializeInteractivityNodeState\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function GetInteractivityNodeState(_node: unknown, _state: InteractivityNodeState): boolean {\n return unsupported(\"GLTF2.GetInteractivityNodeState\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n\nexport function SetInteractivityNodeState(_node: unknown, _state: InteractivityNodeState, _value: boolean): void {\n unsupported(\"GLTF2.SetInteractivityNodeState\", KHR_INTERACTIVITY_UNSUPPORTED);\n}\n","export { OpenPBRMaterialLoadingAdapter } from \"../unsupported/unsupported-apis.js\";\nexport * from \"./unsupported-khr-interactivity.js\";\n","import { unsupported } from \"../error.js\";\n\nconst GLTF1_UNSUPPORTED = \"Babylon Lite only implements glTF 2.0; glTF 1.0 needs a separate parser, extension registry, and material conversion subsystem.\";\n\nexport class GLTFLoaderBase {\n public constructor(..._args: unknown[]) {\n unsupported(\"GLTF1.GLTFLoaderBase\", GLTF1_UNSUPPORTED);\n }\n}\n\nexport class GLTFLoader {\n public constructor(..._args: unknown[]) {\n unsupported(\"GLTF1.GLTFLoader\", GLTF1_UNSUPPORTED);\n }\n}\n\nexport class GLTFBinaryExtension {\n public constructor(..._args: unknown[]) {\n unsupported(\"GLTF1.GLTFBinaryExtension\", GLTF1_UNSUPPORTED);\n }\n}\n\nexport class GLTFMaterialsCommonExtension {\n public constructor(..._args: unknown[]) {\n unsupported(\"GLTF1.GLTFMaterialsCommonExtension\", GLTF1_UNSUPPORTED);\n }\n}\n\nexport function RegisterGLTF1Loader(): void {\n unsupported(\"GLTF1.RegisterGLTF1Loader\", GLTF1_UNSUPPORTED);\n}\n\nexport function RegisterGLTFBinaryExtension(): void {\n unsupported(\"GLTF1.RegisterGLTFBinaryExtension\", GLTF1_UNSUPPORTED);\n}\n\nexport function RegisterGLTFMaterialsCommonExtension(): void {\n unsupported(\"GLTF1.RegisterGLTFMaterialsCommonExtension\", GLTF1_UNSUPPORTED);\n}\n","import { unsupported } from \"../error.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { BaseTexture } from \"../textures/textures.js\";\nimport type { BoundingInfo } from \"../culling/bounding.js\";\nimport type { Vector3 } from \"../math/vector.js\";\nimport { Mesh } from \"./meshes.js\";\nimport { GaussianSplattingMesh } from \"./gaussian-splatting.js\";\n\ninterface ISOGLODEntry {\n file: number;\n offset: number;\n count: number;\n}\n\ninterface ISOGLODNode {\n bound: { min: number[]; max: number[] };\n children?: ISOGLODNode[];\n lods?: Record<string, ISOGLODEntry>;\n}\n\n/** Babylon.js parsed PlayCanvas-style `lod-meta.json` shape. */\nexport interface ISOGLODMetadata {\n lodLevels: number;\n filenames: string[];\n environment?: string;\n tree: ISOGLODNode;\n}\n\nexport type GaussianSplattingStreamDebugLodSource = \"optimal\" | \"current\";\n\nexport type GaussianSplattingStreamLod0SplatCount = Readonly<{ status: \"pending\" }> | Readonly<{ status: \"available\"; count: number }> | Readonly<{ status: \"unavailable\" }>;\n\nexport interface IGaussianSplattingStreamOptions {\n deflateURL?: string;\n fflate?: unknown;\n debugDisplay?: boolean;\n debugLodSource?: GaussianSplattingStreamDebugLodSource;\n lodBaseDistance?: number;\n lodMultiplier?: number;\n lodBehindPenalty?: number;\n lodRangeMin?: number;\n lodRangeMax?: number;\n maxDecodesPerFrame?: number;\n lodCooldownFrames?: number;\n lodUpdateInterval?: number;\n lodUpdateDistance?: number;\n maxDetailLod?: number;\n frustumCulling?: boolean;\n maxConcurrentDownloads?: number;\n maxDownloadRetries?: number;\n memoryBudgetMb?: number;\n maxResidentSplats?: number;\n evictionCooldownFrames?: number;\n splatBudget?: number | \"auto\";\n hostCompound?: GaussianSplattingMesh;\n decodeSh?: boolean;\n needsRotationScale?: boolean;\n}\n\nexport interface IGaussianSplattingStreamingPart {\n readonly proxy: GaussianSplattingPartProxyMesh;\n readonly partIndex: number;\n readonly base: number;\n readonly capacity: number;\n readonly centersTexture: BaseTexture | null;\n readonly covariancesATexture: BaseTexture | null;\n readonly covariancesBTexture: BaseTexture | null;\n readonly colorsTexture: BaseTexture | null;\n readonly splatPositions: Float32Array | null;\n readonly mrtAtlas: unknown | null;\n readonly shMrtAtlas: unknown[] | null;\n readonly rotMrtAtlas: unknown | null;\n readonly atlasWidth: number;\n readonly isDepthSortSettled: boolean;\n setActiveRanges(localRanges: readonly { offset: number; count: number }[] | null): void;\n writeSplats(localOffset: number, count: number, splatsData: ArrayBuffer | ArrayBufferView): void;\n postPositionsRange(localOffset: number, count: number): void;\n expandBounds(min: Vector3, max: Vector3): void;\n notifyDataChanged(): void;\n onBeforeAtlasRebuild(callback: (oldAtlas: unknown) => void): () => void;\n onAfterAtlasRebuild(callback: (newAtlas: unknown) => void): () => void;\n}\n\nconst STREAM_BLOCKER =\n \"Lite's native streamer accepts only an HTTP(S) manifest URL and combines selection capacity with a mandatory render cap. Babylon.js constructs synchronously from parsed metadata, applies a distinct SOG coordinate transform, and independently controls render budget, residency, compound hosting, and cancellation. Bridging those lifecycle/policy differences requires a new Lite stream-construction contract.\";\n\nconst COMPOUND_BLOCKER = \"Lite streams one independently rendered scene node and has no compound-mesh atlas reservation/proxy lifecycle to adapt.\";\n\nfunction unsupportedProxyConstruction(_name: string): never {\n return unsupported(\"GaussianSplattingPartProxyMesh\", COMPOUND_BLOCKER);\n}\n\nexport class GaussianSplattingPartProxyMesh extends Mesh {\n public readonly compoundSplatMesh: GaussianSplattingMesh;\n /** @internal */\n public readonly _vertexCount: number;\n /** @internal */\n public readonly _splatsDataOffset: number;\n /** @internal */\n public readonly _shDataOffset: number;\n private readonly _partIndex: number;\n private _visibility = 1;\n\n public constructor(\n name: string,\n _scene: Scene | null,\n compoundSplatMesh: GaussianSplattingMesh,\n partIndex: number,\n _boundingInfo: BoundingInfo,\n vertexCount: number,\n splatsDataOffset: number,\n shDataOffset = splatsDataOffset\n ) {\n super(unsupportedProxyConstruction(name));\n this.compoundSplatMesh = compoundSplatMesh;\n this._partIndex = partIndex;\n this._vertexCount = vertexCount;\n this._splatsDataOffset = splatsDataOffset;\n this._shDataOffset = shDataOffset;\n }\n\n public get partIndex(): number {\n return this._partIndex;\n }\n\n public get proxiedMesh(): GaussianSplattingMesh {\n return this.compoundSplatMesh;\n }\n\n public override getClassName(): string {\n return \"GaussianSplattingPartProxyMesh\";\n }\n\n public override get isVisible(): boolean {\n return this._visibility > 0;\n }\n public override set isVisible(value: boolean) {\n this._visibility = value ? 1 : 0;\n }\n\n public get visibility(): number {\n return this._visibility;\n }\n public set visibility(value: number) {\n this._visibility = Math.max(0, Math.min(1, value));\n }\n\n public updateBoundingInfoFromPartData(): never {\n return unsupported(\"GaussianSplattingPartProxyMesh.updateBoundingInfoFromPartData\", COMPOUND_BLOCKER);\n }\n\n public updateBoundingInfoFromProxiedMesh(): never {\n return unsupported(\"GaussianSplattingPartProxyMesh.updateBoundingInfoFromProxiedMesh\", COMPOUND_BLOCKER);\n }\n\n public updatePartIndex(_newPartIndex: number): never {\n return unsupported(\"GaussianSplattingPartProxyMesh.updatePartIndex\", COMPOUND_BLOCKER);\n }\n\n public updatePartMetadata(_vertexCount: number, _splatsDataOffset: number, _shDataOffset = _splatsDataOffset): never {\n return unsupported(\"GaussianSplattingPartProxyMesh.updatePartMetadata\", COMPOUND_BLOCKER);\n }\n}\n\n/** Babylon.js `GaussianSplattingStream` exact-shape stub pending a compatible Lite construction contract. */\nexport class GaussianSplattingStream extends GaussianSplattingMesh {\n public static IsLODMetadata(data: unknown): data is ISOGLODMetadata {\n if (!data || typeof data !== \"object\") {\n return false;\n }\n const metadata = data as Partial<ISOGLODMetadata>;\n return typeof metadata.lodLevels === \"number\" && Array.isArray(metadata.filenames) && !!metadata.tree && typeof metadata.tree === \"object\";\n }\n\n public constructor(name: string, _metadata: ISOGLODMetadata, _rootUrl: string, scene: Scene, _options: IGaussianSplattingStreamOptions = {}) {\n super(name, null, scene, false);\n unsupported(\"GaussianSplattingStream\", STREAM_BLOCKER);\n }\n\n public override getClassName(): string {\n return \"GaussianSplattingStream\";\n }\n\n public isReady(_completeCheck = false): never {\n return unsupported(\"GaussianSplattingStream.isReady\", STREAM_BLOCKER);\n }\n\n public get streamingPartProxy(): never {\n return unsupported(\"GaussianSplattingStream.streamingPartProxy\", COMPOUND_BLOCKER);\n }\n\n public whenPartReadyAsync(): Promise<never> {\n return unsupported(\"GaussianSplattingStream.whenPartReadyAsync\", COMPOUND_BLOCKER);\n }\n\n public whenSettledAsync(_stableFrames = 3): Promise<never> {\n return unsupported(\"GaussianSplattingStream.whenSettledAsync\", STREAM_BLOCKER);\n }\n\n public get maxDetailLod(): never {\n return unsupported(\"GaussianSplattingStream.maxDetailLod\", STREAM_BLOCKER);\n }\n public set maxDetailLod(_value: number) {\n unsupported(\"GaussianSplattingStream.maxDetailLod\", STREAM_BLOCKER);\n }\n\n public get splatBudget(): never {\n return unsupported(\"GaussianSplattingStream.splatBudget\", STREAM_BLOCKER);\n }\n public set splatBudget(_value: number) {\n unsupported(\"GaussianSplattingStream.splatBudget\", STREAM_BLOCKER);\n }\n\n public get effectiveSplatBudget(): never {\n return unsupported(\"GaussianSplattingStream.effectiveSplatBudget\", STREAM_BLOCKER);\n }\n\n public get residentSplatBudget(): never {\n return unsupported(\"GaussianSplattingStream.residentSplatBudget\", STREAM_BLOCKER);\n }\n\n public get minimumResidentSplats(): never {\n return unsupported(\"GaussianSplattingStream.minimumResidentSplats\", STREAM_BLOCKER);\n }\n\n public get lod0SplatCount(): GaussianSplattingStreamLod0SplatCount {\n return unsupported(\"GaussianSplattingStream.lod0SplatCount\", STREAM_BLOCKER);\n }\n\n public getBudgetDemand(): never {\n return unsupported(\"GaussianSplattingStream.getBudgetDemand\", COMPOUND_BLOCKER);\n }\n\n public setBudgetAllocation(_splats: number | null): never {\n return unsupported(\"GaussianSplattingStream.setBudgetAllocation\", COMPOUND_BLOCKER);\n }\n\n public get maxLodLevel(): never {\n return unsupported(\"GaussianSplattingStream.maxLodLevel\", STREAM_BLOCKER);\n }\n\n public get frustumCulling(): never {\n return unsupported(\"GaussianSplattingStream.frustumCulling\", STREAM_BLOCKER);\n }\n public set frustumCulling(_value: boolean) {\n unsupported(\"GaussianSplattingStream.frustumCulling\", STREAM_BLOCKER);\n }\n\n public get debugDisplay(): never {\n return unsupported(\"GaussianSplattingStream.debugDisplay\", STREAM_BLOCKER);\n }\n public set debugDisplay(_value: boolean) {\n unsupported(\"GaussianSplattingStream.debugDisplay\", STREAM_BLOCKER);\n }\n\n public get debugLodSource(): never {\n return unsupported(\"GaussianSplattingStream.debugLodSource\", STREAM_BLOCKER);\n }\n public set debugLodSource(_value: GaussianSplattingStreamDebugLodSource) {\n unsupported(\"GaussianSplattingStream.debugLodSource\", STREAM_BLOCKER);\n }\n\n public evaluateOptimalLods(_camera: unknown = null): never {\n return unsupported(\"GaussianSplattingStream.evaluateOptimalLods\", STREAM_BLOCKER);\n }\n}\n\nexport function AddGaussianSplattingStreamPart(\n _compound: GaussianSplattingMesh,\n _name: string,\n _metadata: ISOGLODMetadata,\n _rootUrl: string,\n _options: IGaussianSplattingStreamOptions = {}\n): never {\n return unsupported(\"AddGaussianSplattingStreamPart\", COMPOUND_BLOCKER);\n}\n\nexport async function AddGaussianSplattingStreamPartAsync(\n _compound: GaussianSplattingMesh,\n _name: string,\n _metadata: ISOGLODMetadata,\n _rootUrl: string,\n _options: IGaussianSplattingStreamOptions = {}\n): Promise<GaussianSplattingPartProxyMesh> {\n unsupported(\"AddGaussianSplattingStreamPartAsync\", COMPOUND_BLOCKER);\n}\n","/**\n * Throwing stubs for additional Babylon.js core/loaders symbols that Babylon\n * Lite either does not implement, or exposes only through a different native API\n * that the compat layer does not wrap 1:1.\n *\n * Every stub throws {@link LiteCompatError} on use with a pointer to the native\n * Babylon Lite alternative where one exists. This keeps the completeness\n * invariant — every core/loaders symbol resolves to an import and fails loudly\n * rather than silently.\n */\n\nimport { unsupported } from \"../error.js\";\nimport type { AbstractMesh, TransformNode } from \"../meshes/meshes.js\";\nimport type { AbstractEngine } from \"../engine/engine.js\";\nimport type { Matrix } from \"../math/matrix.js\";\nimport type { Vector3 } from \"../math/vector.js\";\nimport type { ShaderLanguage } from \"../misc/engine-constants.js\";\nimport type { Node } from \"../node/node.js\";\nimport type { Scene } from \"../scene/scene.js\";\nimport type { BaseTexture } from \"../textures/textures.js\";\n\nexport { Skeleton, Bone } from \"../bones/skeleton.js\";\n\n// ─── Probes / Layers / Rendering ─────────────────────────────────────\nexport type GeometryRenderingObjectIdProvider = (mesh: AbstractMesh) => number;\n\nexport class ReflectionProbe {\n public constructor() {\n unsupported(\"ReflectionProbe\", \"Dynamic reflection probes are not implemented in Babylon Lite.\");\n }\n}\n\nexport class Layer {\n public constructor() {\n unsupported(\"Layer\", \"2D background/foreground layers are not wrapped. Use the native effect-render-task APIs for fullscreen overlays.\");\n }\n}\n\nexport class EffectLayer {\n public constructor() {\n unsupported(\"EffectLayer\", \"Effect layers are not implemented in Babylon Lite.\");\n }\n}\n\nexport class DepthRenderer {\n public constructor() {\n unsupported(\"DepthRenderer\", \"Use the native linear-depth material / geometry-renderer task instead.\");\n }\n}\n\nexport class GeometryBufferRenderer {\n public constructor() {\n unsupported(\"GeometryBufferRenderer\", \"Use the native `createGeometryRendererTask` (G-buffer) API instead.\");\n }\n}\n\nexport class BoundingBoxRenderer {\n public constructor() {\n unsupported(\"BoundingBoxRenderer\", \"Bounding-box rendering is not implemented in Babylon Lite.\");\n }\n}\n\n// ─── Post-processes ──────────────────────────────────────────────────\n// The visual effects below exist in Babylon Lite as frame-graph post-process\n// tasks (e.g. `createBloomPostProcessTask`), but the Babylon.js camera-attached\n// `PostProcess` class model is not wrapped. Use the native task APIs.\nexport class PostProcess {\n public constructor() {\n unsupported(\n \"PostProcess\",\n \"Babylon Lite uses frame-graph post-process tasks rather than camera-attached PostProcess objects. Use the native `create*PostProcessTask` APIs.\"\n );\n }\n}\n\nexport class Effect {\n public constructor() {\n unsupported(\n \"Effect\",\n \"Babylon.js Effect owns shader-store lookup, preprocessing, compilation, reflection, and binding; Lite exposes explicit typed WGSL material/render-shader APIs instead.\"\n );\n }\n\n public isReady(): never {\n return unsupported(\"Effect.isReady\", \"Lite has no Babylon.js Effect compilation lifecycle.\");\n }\n\n public getEngine(): AbstractEngine {\n return unsupported(\"Effect.getEngine\", \"Lite has no Babylon.js Effect object associated with a compat engine.\");\n }\n\n public getCompilationError(): string {\n return unsupported(\"Effect.getCompilationError\", \"Lite has no Babylon.js Effect compilation lifecycle or error store.\");\n }\n\n public setTexture(_channel: string, _texture: BaseTexture): never {\n return unsupported(\"Effect.setTexture\", \"Lite binds textures through typed material/render-shader APIs, not an Effect binding table.\");\n }\n\n public setFloat(_uniformName: string, _value: number): never {\n return unsupported(\"Effect.setFloat\", \"Lite binds uniforms through typed material/render-shader APIs, not an Effect binding table.\");\n }\n}\n\nexport type EffectWrapperCustomShaderCodeProcessing = {\n processCodeAfterIncludes?: (postProcessName: string, shaderType: string, code: string) => string;\n processFinalCode?: (postProcessName: string, shaderType: string, code: string) => string;\n defineCustomBindings?: (postProcessName: string, defines: string | null, uniforms: string[], samplers: string[]) => string | null;\n bindCustomBindings?: (postProcessName: string, effect: Effect) => void;\n};\n\nexport interface EffectWrapperCreationOptions {\n engine?: AbstractEngine;\n fragmentShader?: string;\n useShaderStore?: boolean;\n vertexShader?: string;\n vertexUrl?: string;\n attributeNames?: string[];\n uniformNames?: string[];\n uniforms?: string[] | null;\n samplerNames?: string[];\n samplers?: string[] | null;\n uniformBuffers?: string[] | null;\n defines?: string | string[] | null;\n indexParameters?: any;\n blockCompilation?: boolean;\n onCompiled?: ((effect: Effect) => void) | null;\n onError?: (effect: Effect, errors: string) => void;\n name?: string;\n shaderLanguage?: ShaderLanguage;\n extraInitializations?: (useWebGPU: boolean, list: Promise<any>[]) => void;\n extraInitializationsAsync?: () => Promise<void>;\n useAsPostProcess?: boolean;\n allowEmptySourceTexture?: boolean;\n}\n\nexport class EffectWrapper {\n public static ForceGLSL = false;\n\n public static RegisterShaderCodeProcessing(_effectWrapperName: string | null, _customShaderCodeProcessing?: EffectWrapperCustomShaderCodeProcessing): never {\n return unsupported(\n \"EffectWrapper.RegisterShaderCodeProcessing\",\n \"Lite has no Babylon.js Effect shader-store/preprocessor registry to receive custom code-processing hooks.\"\n );\n }\n\n public constructor(_options: EffectWrapperCreationOptions) {\n unsupported(\n \"EffectWrapper\",\n \"Babylon.js EffectWrapper compiles GLSL/WGSL through the Effect shader-store and preprocessor lifecycle; Lite exposes only explicit WGSL render shaders and has no Effect object to adapt.\"\n );\n }\n}\n\nconst FRAME_GRAPH_MODEL_BLOCKER =\n \"Lite exposes standalone frame-graph task factories, but not Babylon.js's FrameGraph handles, task base classes, texture manager, or node-render-graph object model required by this API.\";\n\n/** Babylon.js 9.29 frame-graph min/max reduction task. */\nexport class FrameGraphMinMaxReducerTask {\n public constructor(..._args: unknown[]) {\n unsupported(\"FrameGraphMinMaxReducerTask\", FRAME_GRAPH_MODEL_BLOCKER);\n }\n}\n\n/** Babylon.js 9.29 node-render-graph min/max reduction block. */\nexport class NodeRenderGraphMinMaxReducerBlock {\n public constructor(..._args: unknown[]) {\n unsupported(\"NodeRenderGraphMinMaxReducerBlock\", FRAME_GRAPH_MODEL_BLOCKER);\n }\n}\n\n/** Babylon.js 9.29 node-render-graph registration function. */\nexport function RegisterMinMaxReducerBlock(): never {\n return unsupported(\"RegisterMinMaxReducerBlock\", FRAME_GRAPH_MODEL_BLOCKER);\n}\n\nfunction postProcessStub(name: string, nativeTask: string): { new (): never } {\n return class {\n public constructor() {\n unsupported(name, `Use the native \\`${nativeTask}\\` frame-graph task instead of the Babylon.js PostProcess class.`);\n }\n } as unknown as { new (): never };\n}\n\nexport const BlackAndWhitePostProcess = postProcessStub(\"BlackAndWhitePostProcess\", \"createBlackAndWhitePostProcessTask\");\nexport const BlurPostProcess = postProcessStub(\"BlurPostProcess\", \"createBlurPostProcessTask\");\nexport const BloomEffect = postProcessStub(\"BloomEffect\", \"createBloomPostProcessTask\");\nexport const ChromaticAberrationPostProcess = postProcessStub(\"ChromaticAberrationPostProcess\", \"createChromaticAberrationPostProcessTask\");\nexport const DepthOfFieldEffect = postProcessStub(\"DepthOfFieldEffect\", \"createDepthOfFieldPostProcessTask\");\n\nexport class DefaultRenderingPipeline {\n public constructor() {\n unsupported(\n \"DefaultRenderingPipeline\",\n \"Compose the native frame-graph post-process tasks (bloom, depth-of-field, chromatic aberration, image processing) instead of the Babylon.js DefaultRenderingPipeline.\"\n );\n }\n}\n\nexport class FxaaPostProcess {\n public constructor() {\n unsupported(\"FxaaPostProcess\", \"FXAA is not implemented in Babylon Lite.\");\n }\n}\n\nexport class SSAO2RenderingPipeline {\n public constructor() {\n unsupported(\"SSAO2RenderingPipeline\", \"SSAO is not implemented in Babylon Lite.\");\n }\n}\n\n// FSR 1 (AMD FidelityFX Super Resolution) upscale + sharpen. Babylon Lite has no\n// PostProcessRenderPipeline subsystem and ships no FSR/EASU/RCAS post-process, so\n// there is nothing to forward to — the same structural blocker as the other rendering\n// pipelines above.\nexport class FSR1RenderingPipeline {\n public constructor() {\n unsupported(\"FSR1RenderingPipeline\", \"FSR 1 upscaling is not implemented in Babylon Lite; it has no PostProcessRenderPipeline subsystem.\");\n }\n}\n\nexport class ThinFSR1UpscalePostProcess {\n public constructor() {\n unsupported(\"ThinFSR1UpscalePostProcess\", \"FSR 1 (EASU) upscaling is not implemented in Babylon Lite.\");\n }\n}\n\nexport class ThinFSR1SharpenPostProcess {\n public constructor() {\n unsupported(\"ThinFSR1SharpenPostProcess\", \"FSR 1 (RCAS) sharpening is not implemented in Babylon Lite.\");\n }\n}\n\n// ─── Particles ───────────────────────────────────────────────────────\nexport class ParticleHelper {\n public constructor() {\n unsupported(\n \"ParticleHelper\",\n \"The imperative particle-preset helper is not backed. Babylon Lite renders serialized Node Particle Editor graphs (`NodeParticleSystemSet.ParseFromSnippetAsync` → `buildAsync`), not preset-driven imperative `ParticleSystem`s.\"\n );\n }\n}\n\nexport class PointsCloudSystem {\n public constructor() {\n unsupported(\"PointsCloudSystem\", \"Point-cloud systems are not implemented in Babylon Lite. For Gaussian splats use the native splat loaders.\");\n }\n}\n\nexport class CannonJSPlugin {\n public constructor() {\n unsupported(\"CannonJSPlugin\", \"Babylon Lite physics is Havok-V2 only.\");\n }\n}\n\nexport class AmmoJSPlugin {\n public constructor() {\n unsupported(\"AmmoJSPlugin\", \"Babylon Lite physics is Havok-V2 only.\");\n }\n}\n\n// ─── Navigation ──────────────────────────────────────────────────────\nexport class RecastJSPlugin {\n public constructor() {\n unsupported(\"RecastJSPlugin\", \"Use the native Recast-V2 navigation API (`createNavigationPluginAsync`, `createNavMesh`, `createNavCrowd`).\");\n }\n}\n\n// ─── Audio ───────────────────────────────────────────────────────────\nexport class AudioEngine {\n public constructor() {\n unsupported(\"AudioEngine\", \"Audio is not part of Babylon Lite. Use the Web Audio API directly.\");\n }\n}\n\nexport class WeightedSound {\n public constructor() {\n unsupported(\"WeightedSound\", \"Audio is not part of Babylon Lite.\");\n }\n}\n\n// ─── Loaders (formats not present in Babylon Lite) ───────────────────\nconst FBX_LOADER_UNSUPPORTED =\n \"FBX support requires a parser, DCC transform/material/animation mapping, geometry and skin materialization, and a scene-scheduled constraint solver. Those form a new loader subsystem with unresolved ownership and mapping policies.\";\n\nexport class OBJFileLoader {\n public constructor() {\n unsupported(\"OBJFileLoader\", \"The OBJ format is not supported by Babylon Lite. Convert to glTF.\");\n }\n}\n\nexport class STLFileLoader {\n public constructor() {\n unsupported(\"STLFileLoader\", \"The STL format is not supported by Babylon Lite. Convert to glTF.\");\n }\n}\n\nexport type FBXNormalMapCoordinateSystem = \"y-up\" | \"y-down\";\n\nexport interface FBXLoaderWarning {\n source: \"scene\" | \"model\" | \"geometry\" | \"skin\" | \"rig\" | \"animation\" | \"blendShape\" | \"camera\" | \"light\";\n message: string;\n objectName?: string;\n details?: unknown;\n}\n\nexport interface FBXFileLoaderOptions {\n preset?: \"compatible\" | \"full\";\n normalMapCoordinateSystem?: FBXNormalMapCoordinateSystem;\n materials?: \"auto\" | \"standard\" | \"pbr\";\n unitScale?: \"preserve\" | \"meters\" | number;\n shareGeometry?: boolean;\n onWarning?: (warning: FBXLoaderWarning) => void;\n nurbsSubdivision?: number;\n curves?: \"lines\" | \"skip\";\n constraints?: \"apply\" | \"metadata\";\n rebaseAnimations?: boolean;\n attachCamerasAndLights?: boolean;\n}\n\nexport const FBXFileLoaderMetadata = {\n name: \"fbx\",\n extensions: {\n \".fbx\": { isBinary: true },\n },\n} as const;\n\nexport class FBXFileLoader {\n public constructor(_options: Partial<FBXFileLoaderOptions> = {}) {\n unsupported(\"FBXFileLoader\", FBX_LOADER_UNSUPPORTED);\n }\n}\n\nexport type FBXConstraintType = \"aim\" | \"parent\" | \"position\" | \"rotation\" | \"scale\" | \"singleChainIK\" | \"unknown\";\nexport type FBXConstraintVector3 = [number, number, number];\nexport type FBXConstraintBoolean3 = [boolean, boolean, boolean];\n\nexport interface FBXConstraintTarget {\n modelId: number;\n weight: number;\n offsetTranslation: FBXConstraintVector3;\n offsetRotation: FBXConstraintVector3;\n offsetScale: FBXConstraintVector3;\n}\n\nexport interface FBXConstraintData {\n id: number;\n name: string;\n type: FBXConstraintType;\n typeName: string;\n nodeId?: number;\n targets: FBXConstraintTarget[];\n weight: number;\n active: boolean;\n affectTranslation: FBXConstraintBoolean3;\n affectRotation: FBXConstraintBoolean3;\n affectScale: FBXConstraintBoolean3;\n offsetTranslation: FBXConstraintVector3;\n offsetRotation: FBXConstraintVector3;\n offsetScale: FBXConstraintVector3;\n aimVector: FBXConstraintVector3;\n upVector: FBXConstraintVector3;\n worldUpVector: FBXConstraintVector3;\n worldUpType: number;\n worldUpNodeId?: number;\n ikFirstJointId?: number;\n ikEndJointId?: number;\n ikEffectorId?: number;\n ikPoleVector: FBXConstraintVector3;\n}\n\nexport interface FBXConstraintBehaviorTarget {\n node: TransformNode;\n weight: number;\n offset: Matrix;\n}\n\nexport interface FBXConstraintBehaviorOptions {\n root: TransformNode;\n targets: FBXConstraintBehaviorTarget[];\n upNode: TransformNode | null;\n sceneUp: Vector3;\n}\n\nexport class FBXConstraintSolver {\n private constructor() {\n unsupported(\"FBXConstraintSolver\", FBX_LOADER_UNSUPPORTED);\n }\n\n public static Get(_scene: Scene): FBXConstraintSolver | undefined {\n return unsupported(\"FBXConstraintSolver.Get\", FBX_LOADER_UNSUPPORTED);\n }\n\n public static GetOrCreate(_scene: Scene): FBXConstraintSolver {\n return unsupported(\"FBXConstraintSolver.GetOrCreate\", FBX_LOADER_UNSUPPORTED);\n }\n\n public get constraints(): readonly FBXConstraintBehavior[] {\n return unsupported(\"FBXConstraintSolver.constraints\", FBX_LOADER_UNSUPPORTED);\n }\n\n public get cyclicConstraints(): readonly FBXConstraintBehavior[] {\n return unsupported(\"FBXConstraintSolver.cyclicConstraints\", FBX_LOADER_UNSUPPORTED);\n }\n\n public register(_behavior: FBXConstraintBehavior): void {\n unsupported(\"FBXConstraintSolver.register\", FBX_LOADER_UNSUPPORTED);\n }\n\n public unregister(_behavior: FBXConstraintBehavior): void {\n unsupported(\"FBXConstraintSolver.unregister\", FBX_LOADER_UNSUPPORTED);\n }\n\n public invalidateOrder(): void {\n unsupported(\"FBXConstraintSolver.invalidateOrder\", FBX_LOADER_UNSUPPORTED);\n }\n\n public beginFrame(): void {\n unsupported(\"FBXConstraintSolver.beginFrame\", FBX_LOADER_UNSUPPORTED);\n }\n\n public solve(): void {\n unsupported(\"FBXConstraintSolver.solve\", FBX_LOADER_UNSUPPORTED);\n }\n}\n\nexport class FBXConstraintBehavior {\n public readonly name: string;\n public attachedNode: TransformNode | null = null;\n public enabled = true;\n\n public constructor(\n public readonly constraint: FBXConstraintData,\n _options: FBXConstraintBehaviorOptions\n ) {\n this.name = `fbxConstraint:${constraint.name}`;\n unsupported(\"FBXConstraintBehavior\", FBX_LOADER_UNSUPPORTED);\n }\n\n public init(): void {\n unsupported(\"FBXConstraintBehavior.init\", FBX_LOADER_UNSUPPORTED);\n }\n\n public attach(_target: TransformNode): void {\n unsupported(\"FBXConstraintBehavior.attach\", FBX_LOADER_UNSUPPORTED);\n }\n\n public detach(): void {\n unsupported(\"FBXConstraintBehavior.detach\", FBX_LOADER_UNSUPPORTED);\n }\n\n public captureBase(): void {\n unsupported(\"FBXConstraintBehavior.captureBase\", FBX_LOADER_UNSUPPORTED);\n }\n\n public restoreBase(): void {\n unsupported(\"FBXConstraintBehavior.restoreBase\", FBX_LOADER_UNSUPPORTED);\n }\n\n public dependencyNodes(): Array<Node | null> {\n return unsupported(\"FBXConstraintBehavior.dependencyNodes\", FBX_LOADER_UNSUPPORTED);\n }\n\n public evaluate(): void {\n unsupported(\"FBXConstraintBehavior.evaluate\", FBX_LOADER_UNSUPPORTED);\n }\n}\n\nexport class BVHFileLoader {\n public constructor() {\n unsupported(\"BVHFileLoader\", \"The BVH format is not supported by Babylon Lite.\");\n }\n}\n\n// ─── Sprites ─────────────────────────────────────────────────────────\n// `SpriteManager` / `Sprite` are wrapped over Lite's facing-billboard system\n// (see ../sprites/sprites.ts). `SpriteMap` / `SpritePackedManager` remain\n// unsupported (tile-map / packed-atlas variants are not wrapped).\nexport class SpriteMap {\n public constructor() {\n unsupported(\"SpriteMap\", \"Tile-map sprites are not wrapped; use the native sprite APIs.\");\n }\n}\n\nexport class SpritePackedManager {\n public constructor() {\n unsupported(\"SpritePackedManager\", \"Use the native Babylon Lite sprite APIs.\");\n }\n}\n\n// ─── Misc (device / optimisation surfaces not wrapped) ───────────────\nexport class VirtualJoystick {\n public constructor() {\n unsupported(\"VirtualJoystick\", \"The virtual joystick UI is not part of Babylon Lite.\");\n }\n}\n\nexport class SceneOptimizer {\n public constructor() {\n unsupported(\"SceneOptimizer\", \"Automatic scene optimisation is not implemented in the compat layer.\");\n }\n}\n","/**\n * Babylon.js-compatible `ParticleSystem` over Babylon Lite's data-oriented\n * node-particle runtime.\n *\n * Babylon.js exposes `ParticleSystem` both as an **imperative constructor**\n * (`new ParticleSystem(name, capacity, scene)` — emitters, over-lifetime\n * gradients, `minEmitBox`) and as the **per-system handle** returned from a built\n * Node Particle Editor graph (`NodeParticleSystemSet.buildAsync(scene).systems[i]`).\n *\n * Babylon Lite backs only the second shape: `buildNodeParticleSet` compiles a\n * serialized graph into `NodeParticleSet.systems` (Lite `ParticleSystem` state\n * objects), which the standalone functions `startParticleSystem` /\n * `animateParticleSystem` / `stopParticleSystem` drive, and\n * `createParticleBillboard` / `syncParticleBillboard` /\n * `addFacingBillboardSystem` render as camera-facing billboards. So the compat\n * wrapper's **runtime subset** (`start` / `animate` / `stop` / `updateSpeed` /\n * `particleTexture` / `preWarmStepOffset`) forwards to those Lite functions,\n * while the imperative constructor throws — there is no Lite graph to author.\n *\n * The instances handed back from {@link ParticleSystemSet.systems} are built via\n * the `@internal` {@link ParticleSystem._fromLite} factory, which bypasses the\n * throwing constructor (mirroring `AnimationGroup._fromLite`).\n */\n\nimport { startParticleSystem, animateParticleSystem, stopParticleSystem, createParticleBillboard, syncParticleBillboard, addFacingBillboardSystem } from \"babylon-lite\";\nimport type { ParticleSystem as LiteParticleSystem, Texture2D } from \"babylon-lite\";\n\nimport type { Scene } from \"../scene/scene.js\";\nimport type { Texture } from \"../textures/textures.js\";\nimport { unsupported } from \"../error.js\";\n\n/**\n * Babylon.js `ParticleSystem` — the built output of one NPE graph system. Backed\n * by a Lite `ParticleSystem`; the deterministic prewarm-and-freeze pattern used by\n * ported parity scenes (seed RNG → `start()` → N × `animate()` → `updateSpeed = 0`)\n * maps directly onto Lite's `startParticleSystem` / `animateParticleSystem`, with a\n * camera-facing billboard built and synced once the scene starts.\n */\nexport class ParticleSystem {\n public name = \"\";\n\n /** @internal The backing Lite particle system (null on a bare, unbuilt instance). */\n public _lite: LiteParticleSystem | null = null;\n /** @internal The compat scene this system was built against. */\n public _scene: Scene | null = null;\n\n /**\n * Babylon.js `ParticleSystem.preWarmStepOffset` — the step ratio applied during\n * prewarm cycles. Multiplies {@link updateSpeed} on every `animate(true)` call,\n * matching Babylon.js (which uses `updateSpeed * preWarmStepOffset` while\n * prewarming and the regular animation ratio otherwise).\n */\n public preWarmStepOffset = 1;\n\n private _texture: Texture | null = null;\n private _billboardScheduled = false;\n private _billboardOwnedBySet = false;\n\n /**\n * Babylon.js `new ParticleSystem(name, capacity, scene)`. The imperative\n * construction API (emitters, over-lifetime gradients, `minEmitBox`, a\n * GPU-compute path) is not backed: Babylon Lite builds particle systems only\n * from a serialized Node Particle Editor graph. Load a graph via\n * `NodeParticleSystemSet.Parse` / `ParseFromSnippetAsync` → `buildAsync` and read\n * its {@link ParticleSystemSet.systems} instead.\n */\n public constructor() {\n unsupported(\n \"ParticleSystem\",\n \"Babylon Lite builds particle systems only from a serialized Node Particle Editor graph, not the imperative classic `ParticleSystem` construction API (emitters, over-lifetime gradients, `minEmitBox`). Use `NodeParticleSystemSet.Parse`/`ParseFromSnippetAsync` → `buildAsync` and drive `set.systems[i]`.\"\n );\n }\n\n /**\n * @internal Build a `ParticleSystem` backed by a Lite `ParticleSystem` produced\n * by an NPE graph build. Bypasses the throwing public constructor.\n */\n public static _fromLite(lite: LiteParticleSystem, scene: Scene): ParticleSystem {\n const system = Object.create(ParticleSystem.prototype) as ParticleSystem;\n system.name = \"\";\n system._lite = lite;\n system._scene = scene;\n system.preWarmStepOffset = 1;\n system._texture = null;\n system._billboardScheduled = false;\n system._billboardOwnedBySet = false;\n return system;\n }\n\n public getClassName(): string {\n return \"ParticleSystem\";\n }\n\n /** Babylon.js `ParticleSystem.updateSpeed` — simulation advance per frame. Proxies the Lite system. */\n public get updateSpeed(): number {\n return this._lite?.updateSpeed ?? 0;\n }\n public set updateSpeed(value: number) {\n if (this._lite) {\n this._lite.updateSpeed = value;\n }\n }\n\n /**\n * Babylon.js `ParticleSystem.particleTexture` — the sprite texture. Recorded and\n * bound onto the Lite system when the billboard is built at engine start (the\n * compat `Texture` loads asynchronously, so its GPU handle is read after the\n * scene's pending texture loads settle).\n */\n public get particleTexture(): Texture | null {\n return this._texture;\n }\n public set particleTexture(value: Texture | null) {\n this._texture = value;\n }\n\n /**\n * Babylon.js `ParticleSystem.start()` — begin emission. Forwards to Lite\n * `startParticleSystem` (which clears the stopped flag and resets the frame\n * counter, so `start()` → `stop()` → `start()` resumes emission) and schedules\n * the camera-facing billboard build for engine start. The billboard build is\n * separately guarded, so it happens exactly once however often `start()` runs.\n */\n public start(): void {\n if (!this._lite) {\n return;\n }\n startParticleSystem(this._lite);\n this._scheduleBillboard();\n }\n\n /**\n * Babylon.js `ParticleSystem.animate(preWarmOnly?)` — advance the simulation by\n * one deterministic step. Forwards to Lite `animateParticleSystem` with Babylon.js's\n * step ratio: {@link preWarmStepOffset} while prewarming, otherwise the ratio `1`\n * used by the parity ports' seeded step loop.\n */\n public animate(preWarmOnly = false): void {\n if (this._lite) {\n animateParticleSystem(this._lite, preWarmOnly ? this.preWarmStepOffset : 1);\n }\n }\n\n /** Babylon.js `ParticleSystem.stop()` — stop emission; live particles drain. Forwards to Lite `stopParticleSystem`. */\n public stop(): void {\n if (this._lite) {\n stopParticleSystem(this._lite);\n }\n }\n\n /** Babylon.js `ParticleSystem.dispose()` — stop the system. */\n public dispose(): void {\n this.stop();\n }\n\n /**\n * @internal Bind the recorded {@link particleTexture}'s GPU handle onto the backing\n * Lite system. Called from the deferred per-system billboard build and from\n * {@link ParticleSystemSet.start} before set-level registration, so a\n * wrapper-assigned texture wins over whatever the graph baked in. A no-op while\n * the compat `Texture` is still loading (callers run after the scene's pending\n * texture loads settle).\n */\n public _bindTexture(): void {\n const liteTexture = this._texture?._lite as Texture2D | undefined;\n if (this._lite && liteTexture) {\n this._lite.texture = liteTexture;\n }\n }\n\n /**\n * @internal Hand billboard rendering to the owning {@link ParticleSystemSet}: Lite's\n * `registerNodeParticleSet` builds and per-frame syncs a billboard for every system\n * in the set, so this wrapper's one-shot build must be skipped to avoid rendering\n * the same particles twice.\n */\n public _releaseBillboardToSet(): void {\n this._billboardOwnedBySet = true;\n }\n\n /**\n * Schedule the one-time billboard build. Deferred to engine start (via the\n * scene's `_deferAdd`, which runs after pending texture loads settle), so the\n * particle system is already prewarmed/frozen and its texture GPU handle is\n * ready. Mirrors the native Lite port's build → sync → add sequence.\n */\n private _scheduleBillboard(): void {\n if (this._billboardScheduled || !this._scene || !this._lite) {\n return;\n }\n this._billboardScheduled = true;\n const scene = this._scene;\n const lite = this._lite;\n scene._deferAdd(() => {\n // Re-checked at flush time: the owning set may have claimed billboard\n // rendering after this build was scheduled.\n if (this._billboardOwnedBySet) {\n return;\n }\n this._bindTexture();\n if (!lite.texture) {\n return;\n }\n const billboard = createParticleBillboard(lite);\n syncParticleBillboard(lite, billboard);\n addFacingBillboardSystem(scene._lite, billboard);\n });\n }\n}\n","/**\n * Babylon.js-compatible Node Particle Editor (NPE) surface over Babylon Lite's\n * node-particle runtime.\n *\n * Babylon.js authors particle graphs as a `NodeParticleSystemSet` (a block graph),\n * then `buildAsync(scene)` compiles them into a live `ParticleSystemSet`. Babylon\n * Lite exposes the same capability through a fused parse+build entry point,\n * `parseNodeParticleSetFromSnippet(engine, scene, id, { json })`, plus\n * `registerNodeParticleSet(scene, set)` which wires each built system to a\n * camera-facing billboard system and advances it every frame.\n *\n * The compat wrapper bridges the two shapes: `Parse` / `ParseFromSnippetAsync` /\n * `ParseFromFileAsync` record the graph source and defer the single Lite call to\n * `buildAsync`, which returns a {@link ParticleSystemSet} wrapping the built Lite\n * `NodeParticleSet`. `ParticleSystemSet.start()` forwards to\n * `registerNodeParticleSet` (Lite owns all simulation + rendering); `dispose()`\n * stops emission via `stopParticleSystem`.\n *\n * The graph-authoring surface (programmatic blocks, `serialize`, `editAsync`,\n * `getBlockByName`) is **not** backed: Lite consumes a serialized graph and\n * exposes no block-construction API. The per-system runtime handles\n * (`ParticleSystemSet.systems[i]`) are backed — see {@link ParticleSystem}.\n */\n\nimport { parseNodeParticleSetFromSnippet, registerNodeParticleSet, stopParticleSystem } from \"babylon-lite\";\nimport type { NodeParticleSet as LiteNodeParticleSet } from \"babylon-lite\";\n\nimport type { Scene } from \"../scene/scene.js\";\nimport { ParticleSystem } from \"./particle-system.js\";\nimport { unsupported } from \"../error.js\";\n\n/**\n * Babylon.js `ParticleSystemSet` — the built output of an NPE graph. Backed by a\n * Lite `NodeParticleSet`; `start()` registers it as a live billboard system in the\n * scene. Directly constructing an empty set (`new ParticleSystemSet()`) is allowed\n * for parity but has no systems until produced by {@link NodeParticleSystemSet.buildAsync}.\n */\nexport class ParticleSystemSet {\n /** @internal The built Lite node-particle set (null for a directly-constructed empty set). */\n public _lite: LiteNodeParticleSet | null = null;\n /** @internal The compat scene the set was built against (set by `buildAsync`). */\n public _scene: Scene | null = null;\n\n private _started = false;\n /** @internal Cached per-system wrappers (stable identity across `systems` reads). */\n private _systems: ParticleSystem[] | null = null;\n\n public getClassName(): string {\n return \"ParticleSystemSet\";\n }\n\n /**\n * Babylon.js `ParticleSystemSet.systems` — the per-system {@link ParticleSystem}\n * handles. Each wraps one Lite `NodeParticleSet.systems[i]`, exposing the\n * runtime subset Lite backs (`start` / `animate` / `stop` / `updateSpeed` /\n * `particleTexture`). An empty (directly-constructed) set has no systems.\n */\n public get systems(): ParticleSystem[] {\n if (!this._lite || !this._scene) {\n return [];\n }\n if (!this._systems) {\n const scene = this._scene;\n this._systems = this._lite.systems.map((s) => {\n const system = ParticleSystem._fromLite(s, scene);\n // Wrappers materialized after set-level registration must not build a\n // second billboard for a system Lite already renders.\n if (this._started) {\n system._releaseBillboardToSet();\n }\n return system;\n });\n }\n return this._systems;\n }\n\n /**\n * Babylon.js `ParticleSystemSet.start()` — begin all systems. Forwards to Lite\n * `registerNodeParticleSet`, which renders each system as a camera-facing\n * billboard and advances it once per frame. Idempotent.\n *\n * Per-system wrapper state (`systems[i].particleTexture`) is pushed onto the\n * backing Lite systems first, so the standard\n * `set.systems[i].particleTexture = texture; set.start()` sequence renders with\n * the assigned texture rather than the graph's. Registration is deferred to\n * engine start (`scene._deferAdd`, which runs after the scene's pending texture\n * loads settle) because a compat `Texture` resolves its GPU handle\n * asynchronously and Lite's billboard build needs it.\n */\n public start(): void {\n if (this._started || !this._lite || !this._scene) {\n return;\n }\n this._started = true;\n const scene = this._scene;\n const lite = this._lite;\n // Claim billboard rendering synchronously so an already-scheduled per-system\n // build (from `systems[i].start()`) is skipped when the deferred adds flush.\n for (const system of this._systems ?? []) {\n system._releaseBillboardToSet();\n }\n scene._deferAdd(() => {\n for (const system of this._systems ?? []) {\n system._bindTexture();\n }\n registerNodeParticleSet(scene._lite, lite, { autoStart: true });\n });\n }\n\n /**\n * Babylon.js `ParticleSystemSet.dispose()` — stop the systems. Lite exposes no\n * unregister for an already-registered billboard system, so this stops emission\n * on every built system (via `stopParticleSystem`); the last-emitted particles\n * finish their lifetime.\n */\n public dispose(): void {\n if (!this._lite) {\n return;\n }\n for (const system of this._lite.systems) {\n stopParticleSystem(system);\n }\n }\n}\n\n/**\n * Babylon.js `NodeParticleSystemSet` — a Node Particle Editor graph. The compat\n * wrapper supports the load→build→start path used by ported scenes; the\n * programmatic graph-authoring surface throws.\n */\nexport class NodeParticleSystemSet {\n public name: string;\n\n /** @internal Inline serialized graph (from `Parse` / `ParseFromFileAsync`); null when built from a snippet id. */\n public _source: object | string | null = null;\n /** @internal Snippet id (from `ParseFromSnippetAsync`); null when built from inline JSON. */\n public _snippetId: string | null = null;\n\n public constructor(name = \"\") {\n this.name = name;\n }\n\n public getClassName(): string {\n return \"NodeParticleSystemSet\";\n }\n\n /**\n * Babylon.js `NodeParticleSystemSet.buildAsync(scene)` — compile the graph into\n * a live {@link ParticleSystemSet}. Forwards to Lite\n * `parseNodeParticleSetFromSnippet`, which parses and builds in one shot (from\n * the recorded snippet id or inline JSON).\n */\n public async buildAsync(scene: Scene, _verbose = false): Promise<ParticleSystemSet> {\n void _verbose;\n const engine = scene.getEngine()._lite;\n const liteSet =\n this._snippetId !== null\n ? await parseNodeParticleSetFromSnippet(engine, scene._lite, this._snippetId, {})\n : await parseNodeParticleSetFromSnippet(engine, scene._lite, \"\", { json: this._source ?? {} });\n const set = new ParticleSystemSet();\n set._lite = liteSet;\n set._scene = scene;\n return set;\n }\n\n /** Babylon.js `NodeParticleSystemSet.Parse(source)` — deserialize an inline graph. */\n public static Parse(source: unknown): NodeParticleSystemSet {\n const name = (source as { name?: string } | null)?.name ?? \"\";\n const set = new NodeParticleSystemSet(name);\n set._source = source as object | string;\n return set;\n }\n\n /**\n * Babylon.js `NodeParticleSystemSet.ParseFromSnippetAsync(snippetId)` — load a\n * graph from the snippet server. The network fetch is deferred to `buildAsync`\n * (Lite fuses fetch+parse+build), so this resolves immediately with the id.\n */\n public static ParseFromSnippetAsync(snippetId: string, nodeParticleSet?: NodeParticleSystemSet): Promise<NodeParticleSystemSet> {\n const set = nodeParticleSet ?? new NodeParticleSystemSet();\n set._snippetId = snippetId;\n set.name = snippetId;\n return Promise.resolve(set);\n }\n\n /**\n * Babylon.js `NodeParticleSystemSet.ParseFromFileAsync(name, url)` — load a\n * serialized graph from a URL, then behave like {@link Parse}.\n */\n public static async ParseFromFileAsync(name: string, url: string, nodeParticleSet?: NodeParticleSystemSet): Promise<NodeParticleSystemSet> {\n const response = await fetch(url);\n const source = (await response.json()) as object;\n const set = nodeParticleSet ?? new NodeParticleSystemSet(name);\n set.name = name;\n set._source = source;\n return set;\n }\n\n /** Babylon.js `NodeParticleSystemSet.CreateDefault(name)`. Requires programmatic block authoring — not backed. */\n public static CreateDefault(_name: string): NodeParticleSystemSet {\n void _name;\n return unsupported(\n \"NodeParticleSystemSet.CreateDefault\",\n \"Babylon Lite consumes a serialized node-particle graph (snippet id or JSON); it has no programmatic block-authoring API to assemble a default graph. Load a graph via `Parse` / `ParseFromSnippetAsync` instead.\"\n );\n }\n\n public get attachedBlocks(): never {\n return unsupported(\n \"NodeParticleSystemSet.attachedBlocks\",\n \"Babylon Lite consumes a serialized node-particle graph and exposes no programmatic block graph. Load and build a graph via `Parse` / `ParseFromSnippetAsync` + `buildAsync`.\"\n );\n }\n\n public getBlockByName(_name: string): never {\n void _name;\n return unsupported(\"NodeParticleSystemSet.getBlockByName\", \"Babylon Lite exposes no programmatic node-particle block graph to query.\");\n }\n\n public serialize(): never {\n return unsupported(\"NodeParticleSystemSet.serialize\", \"Babylon Lite exposes no programmatic node-particle block graph to serialize.\");\n }\n\n public editAsync(): never {\n return unsupported(\"NodeParticleSystemSet.editAsync\", \"The Node Particle Editor UI is not part of the Babylon Lite compat layer.\");\n }\n\n public dispose(): void {\n this._source = null;\n this._snippetId = null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,IAAa,UAAU;AACvB,IAAa,YAAY,KAAK,KAAK;AACnC,IAAa,YAAY,MAAM,KAAK;;AAGpC,IAAa,SAAS;CAClB,MAAM,OAAe,MAAM,GAAG,MAAM,GAAW;EAC3C,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;CAC7C;CACA,KAAK,OAAe,KAAa,QAAwB;EACrD,OAAO,SAAS,MAAM,SAAS;CACnC;CACA,YAAY,GAAW,GAAW,OAAuB;EACrD,OAAO,YAAY,GAAG,GAAG,KAAK;CAClC;CACA,iBAAiB,SAAyB;EACtC,OAAO,UAAU;CACrB;CACA,iBAAiB,SAAyB;EACtC,OAAO,UAAU;CACrB;CACA,cAAc,GAAW,GAAW,UAAU,aAAuB;EACjE,OAAO,KAAK,IAAI,IAAI,CAAC,KAAK;CAC9B;CACA,UAAU,OAAe,KAAa,KAAqB;EACvD,QAAQ,QAAQ,QAAQ,MAAM;CAClC;CACA,YAAY,YAAoB,KAAa,KAAqB;EAC9D,OAAO,cAAc,MAAM,OAAO;CACtC;AACJ;;;;AC5BA,IAAI;AACJ,IAAI;AACJ,IAAI;AAEJ,IAAa,OAAO;CAChB,IAAI,IAAa;EACb,OAAQ,WAAW,IA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