@babylonjs/lite-compat 1.20.0-preview → 1.22.0-preview
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.d.ts +78 -2
- package/index.js +250 -13
- package/index.js.map +1 -1
- package/{meshes-eNVvq5sm.js → meshes-CidWpEh8.js} +6 -6
- package/meshes-CidWpEh8.js.map +1 -0
- package/navigation.js +1 -1
- package/package.json +4 -4
- package/meshes-eNVvq5sm.js.map +0 -1
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","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/curve.ts","../src/misc/misc-utils.ts","../src/misc/observable.ts","../src/engine/engine.ts","../src/scene/abstract-scene.ts","../src/physics/physics.ts","../src/cameras/cameras.ts","../src/animations/animation.ts","../src/scene/scene.ts","../src/lights/lights.ts","../src/meshes/csg.ts","../src/meshes/compression.ts","../src/morph/morph.ts","../src/meshes/gaussian-splatting.ts","../src/textures/textures.ts","../src/misc/engine-constants.ts","../src/textures/raw-texture-2d-array.ts","../src/loading/loaded-mesh.ts","../src/loading/scene-loader.ts","../src/loading/assets-manager.ts","../src/loading/material-variants.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/animations/easing.ts","../src/misc/tools.ts","../src/actions/actions.ts","../src/audio/audio-enums.ts","../src/audio/audio.ts","../src/unsupported/unsupported-apis.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(), new Vector3(0, 0, 1), 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","/** Babylon.js-compatible curve/path helpers: `Angle`, `Curve3`, `Path3D` (pure JS). */\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\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","/**\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 * Minimal Babylon.js-compatible `Observable`.\n *\n * Supports the common surface used by ported scenes: `add`, `addOnce`, `remove`,\n * `removeCallback`, `notifyObservers`, `hasObservers`, and `clear`. This is pure\n * JS with no Babylon Lite dependency and is fully unit-testable.\n */\n\nexport type ObserverCallback<T> = (eventData: T) => void;\n\nexport class Observable<T> {\n private _observers: ObserverCallback<T>[] = [];\n private _hasNotified = false;\n private _lastNotifiedValue: T | undefined;\n\n public constructor(\n private _onObserverAdded?: (observer: ObserverCallback<T>) => void,\n public notifyIfTriggered = false\n ) {}\n\n public add(callback: ObserverCallback<T>): ObserverCallback<T> {\n this._observers.push(callback);\n this._onObserverAdded?.(callback);\n if (this._hasNotified && this.notifyIfTriggered && this._lastNotifiedValue !== undefined) {\n callback(this._lastNotifiedValue);\n }\n return callback;\n }\n\n public addOnce(callback: ObserverCallback<T>): ObserverCallback<T> {\n const wrapper: ObserverCallback<T> = (eventData) => {\n this.removeCallback(wrapper);\n callback(eventData);\n };\n return this.add(wrapper);\n }\n\n public remove(callback: ObserverCallback<T> | null | undefined): boolean {\n return callback ? this.removeCallback(callback) : false;\n }\n\n public removeCallback(callback: ObserverCallback<T>): boolean {\n const index = this._observers.indexOf(callback);\n if (index !== -1) {\n this._observers.splice(index, 1);\n return true;\n }\n return false;\n }\n\n public notifyObservers(eventData?: T): void {\n if (this.notifyIfTriggered) {\n this._hasNotified = true;\n this._lastNotifiedValue = eventData;\n }\n // Iterate a copy so observers can add/remove during notification.\n for (const observer of this._observers.slice()) {\n observer(eventData as T);\n }\n }\n\n public hasObservers(): boolean {\n return this._observers.length > 0;\n }\n\n public clear(): void {\n this._observers = [];\n this._onObserverAdded = undefined;\n this.cleanLastNotifiedState();\n }\n\n public cleanLastNotifiedState(): void {\n this._hasNotified = false;\n this._lastNotifiedValue = undefined;\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 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/**\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 /** @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\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?: ({ antialias?: boolean; adaptToDeviceRatio?: boolean; useLargeWorldRendering?: boolean } & EngineOptions) | 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 = typeof options === \"object\" ? { ...options } : undefined;\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 && (opts as { useLargeWorldRendering?: boolean }).useLargeWorldRendering) {\n delete (opts as { useLargeWorldRendering?: boolean }).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._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 } } } | 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 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 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 /**\n * Babylon.js `engine.currentSampleCount` — the MSAA sample count of the current render target.\n * Babylon Lite manages MSAA internally and exposes no public sample-count accessor, so this\n * needs a tree-shakeable Lite core addition before it can report a real value.\n */\n public get currentSampleCount(): never {\n return unsupported(\"AbstractEngine.currentSampleCount\", \"Babylon Lite manages MSAA internally and exposes no public sample-count accessor.\");\n }\n\n /**\n * Babylon.js `engine.getAlphaToCoverage()` — alpha-to-coverage state. Babylon Lite does not\n * expose an engine-level alpha-to-coverage toggle, so this is unsupported.\n */\n public getAlphaToCoverage(): never {\n return unsupported(\"AbstractEngine.getAlphaToCoverage\", \"Babylon Lite does not expose an engine-level alpha-to-coverage toggle.\");\n }\n\n /**\n * Babylon.js `engine.setAlphaToCoverage(enable)` — toggle alpha-to-coverage. Babylon Lite does\n * not expose an engine-level alpha-to-coverage toggle, so this is unsupported.\n */\n public setAlphaToCoverage(_enable: boolean): never {\n return unsupported(\"AbstractEngine.setAlphaToCoverage\", \"Babylon Lite does not expose an engine-level alpha-to-coverage toggle.\");\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 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 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","/**\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 { createHavokWorld, setPhysicsTimestep, setPhysicsGravity, disposePhysics } from \"babylon-lite\";\nimport type { PhysicsWorld, SceneContext } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.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\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// ─── 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 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 /** 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 createFreeCamera,\n createGeospatialCamera,\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 { ArcRotateCamera as LiteArcRotateCamera, FreeCamera as LiteFreeCamera, GeospatialCamera as LiteGeospatialCamera, Camera as LiteCamera } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport { Matrix } from \"../math/matrix.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 /** @internal Underlying Babylon Lite camera. */\n public abstract readonly _lite: LiteCamera;\n private _detach: (() => void) | undefined;\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 /** 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 return h !== 0 ? w / h : 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?: boolean): void {\n const detach = liteAttachControl(this._lite, canvas, this._scene?._lite);\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 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`. This\n * is fully testable without a GPU. `AnimationGroup` provides the structural\n * grouping/playback-state surface; frame-accurate playback is driven through the\n * native Babylon Lite animation manager when wired to a scene (not modelled here).\n */\n\nimport { goToFrame as liteGoToFrame, playAnimation, pauseAnimation, stopAnimation, setAnimationAdditive } from \"babylon-lite\";\nimport type { AnimationGroup as LiteAnimationGroup, EngineContext } from \"babylon-lite\";\n\nexport interface IAnimationKey {\n frame: number;\n value: number | number[];\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 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\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 /** Linearly evaluate the animated value at `frame` (clamped to the key range). */\n public evaluate(frame: number): number | number[] {\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 t = (frame - a.frame) / (b.frame - a.frame);\n return lerpValue(a.value, b.value, t);\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 lerpValue(a: number | number[], b: number | number[], t: number): number | number[] {\n if (typeof a === \"number\" && typeof b === \"number\") {\n return a + (b - a) * t;\n }\n const av = a as number[];\n const bv = b as number[];\n return av.map((value, i) => value + ((bv[i] ?? value) - value) * t);\n}\n\ntype AnimValue = number | number[];\n\nfunction scaleValue(value: AnimValue, scale: number): AnimValue {\n return typeof value === \"number\" ? value * scale : value.map((v) => v * 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 = acc as number[];\n const v = value as number[];\n return a.map((x, i) => x + (v[i] ?? 0));\n}\n\nfunction zeroLike(value: AnimValue): AnimValue {\n return typeof value === \"number\" ? 0 : (value as number[]).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 typeof leaf === \"number\" ? 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, readPath(target, path));\n }\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: number | number[]): 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 (Array.isArray(value)) {\n const slot = obj[leaf] as { set?: (...n: number[]) => void } | undefined;\n if (slot && typeof slot.set === \"function\") {\n slot.set(...value);\n } else {\n obj[leaf] = value;\n }\n } else {\n obj[leaf] = value;\n }\n}\n\n/**\n * Babylon.js `Animatable` — a running animation on a target, driven per-frame on\n * the CPU by evaluating each `Animation`'s keyframes and writing the result onto\n * the target's (dotted) property path.\n */\nexport class Animatable {\n public masterFrame = 0;\n public speedRatio: number;\n private _paused = false;\n private _stopped = false;\n\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 ) {\n this.speedRatio = speedRatio;\n this.masterFrame = _from;\n this._apply();\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 const fps = this._animations[0]?.framePerSecond ?? 60;\n this.masterFrame += (deltaMs / 1000) * fps * this.speedRatio;\n if (this.masterFrame > this._to) {\n if (this._loop) {\n const span = this._to - this._from || 1;\n this.masterFrame = this._from + ((this.masterFrame - this._from) % span);\n } else {\n this.masterFrame = this._to;\n this._stopped = true;\n }\n }\n this._apply();\n }\n\n public goToFrame(frame: number): void {\n this.masterFrame = frame;\n this._apply();\n }\n\n public pause(): void {\n this._paused = true;\n }\n\n public restart(): void {\n this._paused = false;\n this._stopped = false;\n this.masterFrame = this._from;\n }\n\n public stop(): void {\n this._stopped = true;\n }\n\n public get animationStarted(): boolean {\n return !this._stopped;\n }\n\n private _apply(): void {\n for (const anim of this._animations) {\n applyAnimatedValue(this._target, anim.targetProperty, anim.evaluate(this.masterFrame));\n }\n }\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-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 enableAnimationBlending,\n updateAnimationManager,\n} from \"babylon-lite\";\nimport type { SceneContext, Camera as LiteCamera, ArcRotateCamera as LiteArcRotateCamera, FreeCamera as LiteFreeCamera, AnimationManager } 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\";\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\";\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 once when the scene is disposed. */\n public readonly onDisposeObservable = new Observable<Scene>();\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 running\n * CPU `Animatable`s started via `beginDirectAnimation`.\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 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: Array<{ _build(engine: import(\"babylon-lite\").EngineContext): void; _liteGen?: unknown }> = [];\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 readonly _runningAnimatables: Animatable[] = [];\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 /** @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 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 /**\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 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 }\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: { _build(engine: import(\"babylon-lite\").EngineContext): void }): void {\n this._shadowGenerators.push(gen);\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 /** @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 }\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 /** Image-processing exposure proxy (Babylon.js `imageProcessingConfiguration.exposure`). */\n public get imageProcessingConfiguration(): { exposure: number; contrast: number; toneMappingEnabled: boolean } {\n return this._lite.imageProcessing;\n }\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 /** Synchronous CPU picking — unsupported. Babylon Lite uses async GPU picking. */\n public pick(): never {\n return unsupported(\n \"Scene.pick\",\n \"Babylon Lite uses asynchronous GPU picking. Use the compat `GPUPicker` class (Babylon.js parity) or the native `createGpuPicker` + `pickAsync` API.\"\n );\n }\n\n /** Synchronous ray picking — unsupported. */\n public pickWithRay(): never {\n return unsupported(\"Scene.pickWithRay\", \"Synchronous CPU ray-mesh intersection is not implemented in Babylon Lite.\");\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 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 * Drives the given `Animation`s on the CPU each frame, writing onto the target's\n * (dotted) property path. Returns an `Animatable` with `goToFrame`/`pause`/`stop`.\n */\n public beginDirectAnimation(target: unknown, animations: Animation[], from: number, to: number, loop = false, speedRatio = 1): Animatable {\n const animatable = new Animatable(target, animations, from, to, loop, speedRatio);\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 this.onDisposeObservable.notifyObservers(this);\n disposeScene(this._lite);\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 * Colour properties (`diffuse`, `specular`, `groundColor`) are write-through on\n * assignment: `light.diffuse = new Color3(...)` propagates immediately. In-place\n * mutation of a returned colour (`light.diffuse.r = x`) does not propagate; assign\n * a new colour instead. Direction/position are backed by Lite's observable vectors\n * and propagate on `.x/.y/.z` writes.\n */\n\nimport { addToScene, createHemisphericLight, createDirectionalLight, createPointLight, createSpotLight } 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 { Color3 } from \"../math/color.js\";\nimport { 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 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 private _bumpLiteVersion(): void {\n this._liteVersionBump ??= ensureLightVersionBump(this._lite);\n this._liteVersionBump();\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 public override dispose(): void {\n // Lite removes lights through the scene; without a back-reference the\n // caller should use `removeFromScene`. Detaching the shadow generator is\n // the safe, scene-free cleanup we can do here.\n this._lite.shadowGenerator = undefined;\n super.dispose();\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\nfunction readColor(tuple: Tuple3): Color3 {\n return new Color3(tuple[0], tuple[1], tuple[2]);\n}\n\nfunction writeColor(tuple: Tuple3, value: Color3): void {\n tuple[0] = value.r;\n tuple[1] = value.g;\n tuple[2] = value.b;\n}\n\nfunction readVector(vec: { x: number; y: number; z: number }): Vector3 {\n return new Vector3(vec.x, vec.y, vec.z);\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 readVector(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 readColor(this._lite.diffuseColor);\n }\n public set diffuse(value: Color3) {\n writeColor(this._lite.diffuseColor, value);\n }\n\n public get specular(): Color3 {\n return readColor(this._lite.specularColor);\n }\n public set specular(value: Color3) {\n writeColor(this._lite.specularColor, value);\n }\n\n public get groundColor(): Color3 {\n return readColor(this._lite.groundColor);\n }\n public set groundColor(value: Color3) {\n 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 readVector(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 readVector(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 readColor(this._lite.diffuse);\n }\n public set diffuse(value: Color3) {\n writeColor(this._lite.diffuse, value);\n }\n\n public get specular(): Color3 {\n return readColor(this._lite.specular);\n }\n public set specular(value: Color3) {\n 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 readVector(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 readColor(this._lite.diffuse);\n }\n public set diffuse(value: Color3) {\n writeColor(this._lite.diffuse, value);\n }\n\n public get specular(): Color3 {\n return readColor(this._lite.specular);\n }\n public set specular(value: Color3) {\n 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 readVector(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 readVector(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 readColor(this._lite.diffuse);\n }\n public set diffuse(value: Color3) {\n writeColor(this._lite.diffuse, value);\n }\n\n public get specular(): Color3 {\n return readColor(this._lite.specular);\n }\n public set specular(value: Color3) {\n writeColor(this._lite.specular, value);\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 } from \"./meshes.js\";\nimport type { Scene } from \"../scene/scene.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/** @internal Add a freshly-built CSG result mesh to its scene at engine start. */\nfunction deferAddCsgMesh(mesh: Mesh, scene: Scene, material?: CompatMaterial): void {\n scene._deferAdd(() => {\n const engine = scene.getEngine()._lite;\n if (material) {\n material._ensureRenderable(engine);\n mesh._lite.material = material._lite as never;\n }\n addToScene(scene._lite, mesh._lite);\n });\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 deferAddCsgMesh(mesh, scene, material ?? undefined);\n return mesh;\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 material._ensureRenderable(engine);\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 root._lite.material = savedMaterials[0] as never;\n scene._deferAdd(() => addToScene(scene._lite, root._lite));\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 } 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 transform-carrying Lite node: the loaded splat node once present, else the placeholder. */\n private get _xform(): SceneNode {\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 /** @internal Adopt a loaded Lite splat node: carry over placeholder transforms + name, and register on the scene. */\n private _adopt(lite: LiteGsMesh): void {\n const placeholder = this._node;\n lite.position.set(placeholder.position.x, placeholder.position.y, placeholder.position.z);\n lite.scaling.set(placeholder.scaling.x, placeholder.scaling.y, placeholder.scaling.z);\n lite.rotation.set(placeholder.rotation.x, placeholder.rotation.y, placeholder.rotation.z);\n lite.name = this.name;\n this._gs = lite;\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 }\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","/**\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} from \"babylon-lite\";\nimport type { Texture2D, Texture2DOptions, EngineContext, Texture3D, DynamicTexture2D } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.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\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 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","/**\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\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 * Babylon.js `ImageProcessingConfiguration` — only the tone-mapping constants are\n * surfaced (the live exposure/contrast/tone-mapping toggle is exposed through\n * `scene.imageProcessingConfiguration`).\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\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} as const;\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","/**\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, loadGltf, loadBabylon } from \"babylon-lite\";\nimport type { AssetContainer as LiteAssetContainer, AnimationGroup } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { collectLoadedMeshes, type LoadedMeshRegistry } from \"./loaded-mesh.js\";\nimport { GaussianSplattingMesh } from \"../meshes/gaussian-splatting.js\";\nimport type { Mesh, TransformNode } from \"../meshes/meshes.js\";\nimport type { Scene } from \"../scene/scene.js\";\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\");\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\n/** Last path segment of a URL, used to name a loaded Gaussian-Splatting mesh. */\nfunction baseName(url: string): string {\n const path = urlPath(url);\n return path.slice(path.lastIndexOf(\"/\") + 1) || \"splat\";\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\n public constructor(lite: LiteAssetContainer) {\n this._lite = lite;\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 return collectLoadedMeshes(this._lite, this._meshRegistry, this._scene);\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._scene = scene;\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 // Lite owns container GPU resources through the scene; explicit container\n // disposal is a no-op until removed from the scene.\n }\n}\n\ninterface ImportResult {\n meshes: TransformNode[];\n particleSystems: unknown[];\n skeletons: unknown[];\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\n/** @internal Load a splat URL into a `GaussianSplattingMesh` (shared by every loader entry point). */\nasync function loadSplatResult(url: string, scene: Scene): Promise<ImportResult> {\n const gs = new GaussianSplattingMesh(baseName(url), null, scene);\n await gs.loadFileAsync(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): 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 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: [],\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 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?: unknown): Promise<ImportResult> {\n if (isSplatUrl(source)) {\n return loadSplatResult(source, scene);\n }\n const container = await loadFromSource(source, scene);\n container.addAllToScene(scene);\n return {\n meshes: container.meshes,\n particleSystems: [],\n 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?: unknown): Promise<Scene> {\n if (isSplatUrl(source)) {\n await loadSplatResult(source, scene);\n return scene;\n }\n const container = await loadFromSource(source, scene);\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?: unknown): Promise<AssetContainer> {\n return loadFromSource(source, scene);\n}\n\n/** @internal Load a glTF/.babylon asset from a single source URL (function-loader form). */\nasync function loadFromSource(source: string, scene: Scene): 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 const lite = isBabylonUrl(source) ? await loadBabylon(engine, source) : await loadGltf(engine, source);\n return new AssetContainer(lite);\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","/**\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} 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 type { Vector3 } from \"../math/vector.js\";\nimport type { Color3 } from \"../math/color.js\";\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\n public constructor(layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createPositionGizmo(layer._engine, layer._lite);\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 }\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\n public constructor(layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createRotationGizmo(layer._engine, layer._lite);\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 }\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 /** @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 /** @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 { createEsmDirectionalShadowGenerator, createPcfDirectionalShadowGenerator, createPcfSpotlightShadowGenerator, setShadowTaskCasterMeshes } from \"babylon-lite\";\nimport type { EngineContext, Mesh as LiteMesh } from \"babylon-lite\";\n\nimport type { Light } from \"../lights/lights.js\";\nimport type { AbstractMesh } from \"../meshes/meshes.js\";\n\nexport class ShadowGenerator {\n private readonly _mapSize: number;\n private readonly _light: Light;\n private readonly _casters: AbstractMesh[] = [];\n /** @internal The built Lite shadow generator (set in `_build`). Used to wire NME receivers. */\n public _liteGen: unknown;\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 const scene = light.getScene();\n if (scene) {\n scene._registerShadowGenerator(this);\n }\n }\n\n /** Babylon.js `addShadowCaster(mesh, includeDescendants?)`. */\n public addShadowCaster(mesh: AbstractMesh, _includeDescendants = true): ShadowGenerator {\n if (!this._casters.includes(mesh)) {\n this._casters.push(mesh);\n }\n return this;\n }\n\n /** Babylon.js `removeShadowCaster(mesh)`. */\n public removeShadowCaster(mesh: AbstractMesh): ShadowGenerator {\n const i = this._casters.indexOf(mesh);\n if (i >= 0) {\n this._casters.splice(i, 1);\n }\n return this;\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._light._lite.shadowGenerator = undefined;\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 (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 const casterMeshes = this._casters.map((m) => m._lite as LiteMesh);\n setShadowTaskCasterMeshes(liteGen, casterMeshes);\n }\n}\n\n/**\n * Babylon.js `CascadedShadowGenerator` — cascaded shadow maps for large directional\n * scenes. Mapped onto Babylon Lite's CSM generator is a larger task; for now this\n * extends {@link ShadowGenerator} and falls back to the standard directional path,\n * which renders (a single cascade's worth of) shadows rather than throwing.\n */\nexport class CascadedShadowGenerator extends ShadowGenerator {\n public numCascades = 4;\n public lambda = 0.5;\n public stabilizeCascades = false;\n public depthClamp = true;\n public autoCalcDepthBounds = false;\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-compatible easing functions (pure, no Babylon Lite dependency).\n *\n * These mirror Babylon.js's `EasingFunction` hierarchy and easing modes for use\n * with property animations. They are fully unit-testable.\n */\n\nexport const EASINGMODE_EASEIN = 0;\nexport const EASINGMODE_EASEOUT = 1;\nexport const EASINGMODE_EASEINOUT = 2;\n\nexport abstract class EasingFunction {\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 const g = Math.max(0, Math.min(1, gradient));\n return 1 - Math.sqrt(1 - g * g);\n }\n}\n\nexport class QuadraticEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return gradient * gradient;\n }\n}\n\nexport class CubicEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return gradient * gradient * gradient;\n }\n}\n\nexport class QuarticEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return gradient * gradient * gradient * gradient;\n }\n}\n\nexport class QuinticEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return gradient * gradient * gradient * gradient * gradient;\n }\n}\n\nexport class SineEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return 1 - Math.sin((Math.PI / 2) * (1 - gradient));\n }\n}\n\nexport class ExponentialEase extends EasingFunction {\n public constructor(private readonly exponent: number = 2) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n if (this.exponent <= 0) {\n return gradient;\n }\n return (Math.exp(this.exponent * gradient) - 1) / (Math.exp(this.exponent) - 1);\n }\n}\n\nexport class BackEase extends EasingFunction {\n public constructor(private readonly amplitude: number = 1) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n const num = Math.max(0, this.amplitude);\n return Math.pow(gradient, 3) - gradient * num * Math.sin(Math.PI * gradient);\n }\n}\n\nexport class ElasticEase extends EasingFunction {\n public constructor(\n private readonly oscillations: number = 3,\n private readonly springiness: number = 3\n ) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n const num2 = Math.max(0, this.oscillations);\n const num3 = Math.max(0, this.springiness);\n const num = num3 === 0 ? gradient : (Math.exp(num3 * gradient) - 1) / (Math.exp(num3) - 1);\n return num * Math.sin((2 * Math.PI * num2 + Math.PI / 2) * gradient);\n }\n}\n\nexport class BounceEase extends EasingFunction {\n public constructor(\n private readonly bounces: number = 3,\n private readonly bounciness: number = 2\n ) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n const num = Math.max(0, this.bounces);\n let bounciness = this.bounciness;\n if (bounciness <= 1) {\n bounciness = 1.001;\n }\n const num2 = Math.pow(bounciness, num);\n const num3 = 1 - bounciness;\n const num4 = (1 - num2) / num3 + num2 * 0.5;\n const num5 = gradient * num4;\n const num6 = Math.log(-num5 * (1 - bounciness) + 1) / Math.log(bounciness);\n const num7 = Math.floor(num6);\n const num8 = num7 + 1;\n const num9 = (1 - Math.pow(bounciness, num7)) / (num3 * num4);\n const num10 = (1 - Math.pow(bounciness, num8)) / (num3 * num4);\n const num11 = (num9 + num10) * 0.5;\n const num12 = gradient - num11;\n const num13 = num11 - num9;\n return (-Math.pow(1 / bounciness, num - num7) / (num13 * num13)) * (num12 - num13) * (num12 + num13);\n }\n}\n","/** Babylon.js-compatible `Tools` helpers (the small, pure subset). */\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 \"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 * 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}\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","/**\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\";\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 class ShaderMaterial {\n public constructor() {\n unsupported(\"ShaderMaterial\", \"Babylon Lite is WGSL-only. Use the native `createShaderMaterial` (WGSL) API; there is no automatic GLSL translation.\");\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\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\nexport class ClusteredLightContainer {\n public constructor() {\n unsupported(\"ClusteredLightContainer\", \"Clustered lighting is not exposed by the Babylon Lite public API; the compat layer cannot wrap it.\");\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 textures (DOM/CSS overlay interop) ─────────────────────────\n// New in BJS: `Materials/Textures/HTML/*` — uploads a live DOM element into a\n// texture and forwards pointer/raycast interaction onto an overlaid HTML layer.\n// This is a DOM-driven, host-page feature with no Babylon Lite equivalent (Lite\n// is a WebGPU renderer with no HTML overlay / interaction subsystem),\n// so every entry throws.\n\n/** Options accepted by Babylon.js `HtmlTexture` (shape-only stub for type parity). */\nexport interface IHtmlTextureOptions {\n [key: string]: unknown;\n}\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 HtmlTexture {\n public constructor() {\n unsupported(\"HtmlTexture\", \"Rendering a live DOM element into a texture is a host-page/DOM feature with no Babylon Lite equivalent.\");\n }\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` — HTML texture upload is unsupported by the compat layer. */\nexport function IsHtmlInCanvasUploadSupported(): never {\n return unsupported(\"IsHtmlInCanvasUploadSupported\", \"HTML-element texture upload is not supported by Babylon Lite.\");\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// ─── Gaussian Splatting LOD streaming ────────────────────────────────\n// BJS `@babylonjs/loaders` SPLAT exposes a Gaussian-Splatting LOD *streaming*\n// subsystem (`GaussianSplattingStream` + `AddGaussianSplattingStreamPart[Async]`,\n// with `IGaussianSplattingStreamingPart` / `IGaussianSplattingStreamOptions` /\n// `ISOGLODMetadata` describing a compound mesh assembled from streamed parts).\n// It layers SOG-octree LOD residency management (download/residency controllers,\n// a block allocator) on top of a GPU work-buffer decode pipeline that decodes\n// SH / rotation / scale into shared render-target atlases via dedicated\n// GLSL+WGSL shaders. Babylon Lite loads a *whole* splat cloud eagerly\n// (`loadSplat` / `loadSOG` / `loadSPZ`, wrapped by the compat `GaussianSplattingMesh`)\n// and has no streaming/LOD residency subsystem or work-buffer decode pipeline to\n// back it. Adding one is a whole GPU subsystem with open design questions\n// (residency policy, LOD scheduling, atlas layout) — not a small, mechanical,\n// objective Lite addition — so these throw (structural blocker; move 3).\n\n/** Babylon.js `GaussianSplattingStreamDebugLodSource` — LOD debug source selector (shape-only stub for type parity). */\nexport type GaussianSplattingStreamDebugLodSource = \"optimal\" | \"current\";\n\n/** Babylon.js `IGaussianSplattingStreamOptions` — GS LOD stream options (shape-only stub for type parity). */\nexport interface IGaussianSplattingStreamOptions {\n [key: string]: unknown;\n}\n\n/** Babylon.js `ISOGLODMetadata` — SOG LOD octree metadata (shape-only stub for type parity). */\nexport interface ISOGLODMetadata {\n [key: string]: unknown;\n}\n\n/** Babylon.js `IGaussianSplattingStreamingPart` — a streamed part of a GS compound mesh (shape-only stub for type parity). */\nexport interface IGaussianSplattingStreamingPart {\n [key: string]: unknown;\n}\n\nexport class GaussianSplattingStream {\n public constructor(..._args: unknown[]) {\n unsupported(\n \"GaussianSplattingStream\",\n \"Gaussian-Splatting LOD streaming is a whole GPU subsystem (SOG-octree LOD residency + work-buffer decode into render-target atlases) with no Babylon Lite equivalent. Load the full cloud with `GaussianSplattingMesh` / `loadSplat` instead.\"\n );\n }\n}\n\n/** Babylon.js `AddGaussianSplattingStreamPart` — appends a streamed LOD part to a GS compound mesh. */\nexport function AddGaussianSplattingStreamPart(..._args: unknown[]): never {\n return unsupported(\n \"AddGaussianSplattingStreamPart\",\n \"Gaussian-Splatting LOD streaming (compound mesh + streamed parts) is not backed by Babylon Lite, which loads a whole splat cloud eagerly via `GaussianSplattingMesh`.\"\n );\n}\n\n/** Babylon.js `AddGaussianSplattingStreamPartAsync` — async variant of {@link AddGaussianSplattingStreamPart}. */\nexport function AddGaussianSplattingStreamPartAsync(..._args: unknown[]): never {\n return unsupported(\n \"AddGaussianSplattingStreamPartAsync\",\n \"Gaussian-Splatting LOD streaming (compound mesh + streamed parts) is not backed by Babylon Lite, which loads a whole splat cloud eagerly via `GaussianSplattingMesh`.\"\n );\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","/**\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\";\n\n// ─── Bones / Skeletons / Morph ───────────────────────────────────────\nexport class Skeleton {\n public constructor() {\n unsupported(\"Skeleton\", \"Skeletons are produced by the glTF loader in Babylon Lite and driven by `createAnimationController`; they are not constructed manually.\");\n }\n}\n\nexport class Bone {\n public constructor() {\n unsupported(\"Bone\", \"Bones are produced by the glTF loader in Babylon Lite; manual bone construction is not wrapped.\");\n }\n}\n\n// ─── Probes / Layers / Rendering ─────────────────────────────────────\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\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// ─── 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\n// ─── Physics ─────────────────────────────────────────────────────────\n// Babylon Lite ships a Havok-V2 subset via `createHavokWorld` /\n// `createPhysicsAggregate` etc. `HavokPlugin` is wrapped (see\n// `src/physics/physics.ts`); the aggregate/body/shape class model is not wrapped\n// 1:1 — use the native physics functions against `plugin.world`.\nexport class PhysicsAggregate {\n public constructor() {\n unsupported(\"PhysicsAggregate\", \"Use the native `createPhysicsAggregate` API instead of the Babylon.js PhysicsAggregate class.\");\n }\n}\n\nexport class PhysicsBody {\n public constructor() {\n unsupported(\"PhysicsBody\", \"Use the native `createPhysicsBody` API.\");\n }\n}\n\nexport class PhysicsShape {\n public constructor() {\n unsupported(\"PhysicsShape\", \"Use the native `createPhysicsShape` API.\");\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) ───────────────────\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 class FBXFileLoader {\n public constructor() {\n unsupported(\"FBXFileLoader\", \"The FBX format is not supported by Babylon Lite. Convert to glTF.\");\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"],"names":["Space","c","d","n","m","x","y","z","t","i","p","_a","h","w","now","PhysicsShapeType","PhysicsMotionType","PhysicsPrestepType","PhysicsConstraintType","liteGetViewMatrix","liteGetProjectionMatrix","liteAttachControl","v","liteGoToFrame","g","liteCreateDefaultCamera","createArcRotateCamera","attachControl","f","o","ScenePerformancePriority","ShaderLanguage","litePickAsync","mesh","layer","s","r","GreasedLineMeshColorDistribution","GreasedLineMeshWidthDistribution","GreasedLineRibbonPointsMode","GreasedLineRibbonFacesMode","GreasedLineRibbonAutoDirectionMode","set"],"mappings":";;;;;;AAEO,MAAM,UAAU;AAChB,MAAM,YAAY,KAAK,KAAK;AAC5B,MAAM,YAAY,MAAM,KAAK;AAG7B,MAAM,SAAS;AAAA,EAClB,MAAM,OAAe,MAAM,GAAG,MAAM,GAAW;AAC3C,WAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAAA,EAC7C;AAAA,EACA,KAAK,OAAe,KAAa,QAAwB;AACrD,WAAO,SAAS,MAAM,SAAS;AAAA,EACnC;AAAA,EACA,YAAY,GAAW,GAAW,OAAuB;AACrD,WAAO,MAAM,IAAI,KAAK,QAAQ,MAAM,IAAI;AAAA,EAC5C;AAAA,EACA,iBAAiB,SAAyB;AACtC,WAAO,UAAU;AAAA,EACrB;AAAA,EACA,iBAAiB,SAAyB;AACtC,WAAO,UAAU;AAAA,EACrB;AAAA,EACA,cAAc,GAAW,GAAW,UAAU,aAAuB;AACjE,WAAO,KAAK,IAAI,IAAI,CAAC,KAAK;AAAA,EAC9B;AAAA,EACA,UAAU,OAAe,KAAa,KAAqB;AACvD,YAAQ,QAAQ,QAAQ,MAAM;AAAA,EAClC;AAAA,EACA,YAAY,YAAoB,KAAa,KAAqB;AAC9D,WAAO,cAAc,MAAM,OAAO;AAAA,EACtC;AACJ;AC1BA,IAAI;AACJ,IAAI;AACJ,IAAI;AAEG,MAAM,OAAO;AAAA,EAChB,IAAI,IAAa;AACb,WAAQ,oBAAW,IAAI,QAAQ,GAAG,GAAG,CAAC;AAAA,EAC1C;AAAA,EACA,IAAI,IAAa;AAC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,MAAM,QAAwC;AACxD,UAAM,QAAQ,iCAAqC,SAAQ;AAC3D,UAAMA,OAAM,IAAI,sBAAsB,IAAI;AAC1C,IAAAA,KAAI,UAAU;AACd,WAAOA;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAc,sBAAsB,WAAmB,iBAAyE;AAC5H,UAAMA,OAAM,mBAAmB,IAAI,sBAAA;AACnC,IAAAA,KAAI,aAAa;AACjB,IAAAA,KAAI,OAAO;AACX,WAAO,QAAQ,QAAQA,IAAG;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAoB,mBAAmB,MAAc,KAAa,iBAAyE;AACvI,UAAM,WAAW,MAAM,MAAM,GAAG;AAChC,UAAM,SAAU,MAAM,SAAS,KAAA;AAC/B,UAAMA,OAAM,mBAAmB,IAAI,sBAAsB,IAAI;AAC7D,IAAAA,KAAI,OAAO;AACX,IAAAA,KAAI,UAAU;AACd,WAAOA;AAAA,EACX;AAAA;AAAA,EAGA,OAAc,cAAc,OAAsC;AAE9D,WAAO;AAAA,MACH;AAAA,MACA;AAAA,IAAA;AAAA,EAER;AAAA,EAEA,IAAW,iBAAwB;AAC/B,WAAO;AAAA,MACH;AAAA,MACA;AAAA,IAAA;AAAA,EAER;AAAA,EAEO,eAAe,OAAsB;AAExC,WAAO,YAAY,wCAAwC,0EAA0E;AAAA,EACzI;AAAA,EAEO,YAAmB;AACtB,WAAO,YAAY,mCAAmC,8EAA8E;AAAA,EACxI;AAAA,EAEO,YAAmB;AACtB,WAAO,YAAY,mCAAmC,2EAA2E;AAAA,EACrI;AAAA,EAEO,UAAgB;AACnB,SAAK,UAAU;AACf,SAAK,aAAa;AAAA,EACtB;AACJ;"}
|
|
1
|
+
{"version":3,"file":"index.js","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/curve.ts","../src/misc/misc-utils.ts","../src/misc/observable.ts","../src/engine/engine.ts","../src/scene/abstract-scene.ts","../src/physics/physics.ts","../src/cameras/cameras.ts","../src/animations/animation.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/textures/textures.ts","../src/misc/engine-constants.ts","../src/textures/raw-texture-2d-array.ts","../src/loading/loaded-mesh.ts","../src/loading/scene-loader.ts","../src/loading/assets-manager.ts","../src/loading/material-variants.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/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/unsupported/unsupported-apis.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(), new Vector3(0, 0, 1), 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","/** Babylon.js-compatible curve/path helpers: `Angle`, `Curve3`, `Path3D` (pure JS). */\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\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","/**\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 * Minimal Babylon.js-compatible `Observable`.\n *\n * Supports the common surface used by ported scenes: `add`, `addOnce`, `remove`,\n * `removeCallback`, `notifyObservers`, `hasObservers`, and `clear`. This is pure\n * JS with no Babylon Lite dependency and is fully unit-testable.\n */\n\nexport type ObserverCallback<T> = (eventData: T) => void;\n\nexport class Observable<T> {\n private _observers: ObserverCallback<T>[] = [];\n private _hasNotified = false;\n private _lastNotifiedValue: T | undefined;\n\n public constructor(\n private _onObserverAdded?: (observer: ObserverCallback<T>) => void,\n public notifyIfTriggered = false\n ) {}\n\n public add(callback: ObserverCallback<T>): ObserverCallback<T> {\n this._observers.push(callback);\n this._onObserverAdded?.(callback);\n if (this._hasNotified && this.notifyIfTriggered && this._lastNotifiedValue !== undefined) {\n callback(this._lastNotifiedValue);\n }\n return callback;\n }\n\n public addOnce(callback: ObserverCallback<T>): ObserverCallback<T> {\n const wrapper: ObserverCallback<T> = (eventData) => {\n this.removeCallback(wrapper);\n callback(eventData);\n };\n return this.add(wrapper);\n }\n\n public remove(callback: ObserverCallback<T> | null | undefined): boolean {\n return callback ? this.removeCallback(callback) : false;\n }\n\n public removeCallback(callback: ObserverCallback<T>): boolean {\n const index = this._observers.indexOf(callback);\n if (index !== -1) {\n this._observers.splice(index, 1);\n return true;\n }\n return false;\n }\n\n public notifyObservers(eventData?: T): void {\n if (this.notifyIfTriggered) {\n this._hasNotified = true;\n this._lastNotifiedValue = eventData;\n }\n // Iterate a copy so observers can add/remove during notification.\n for (const observer of this._observers.slice()) {\n observer(eventData as T);\n }\n }\n\n public hasObservers(): boolean {\n return this._observers.length > 0;\n }\n\n public clear(): void {\n this._observers = [];\n this._onObserverAdded = undefined;\n this.cleanLastNotifiedState();\n }\n\n public cleanLastNotifiedState(): void {\n this._hasNotified = false;\n this._lastNotifiedValue = undefined;\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 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/**\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 /** @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\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?: ({ antialias?: boolean; adaptToDeviceRatio?: boolean; useLargeWorldRendering?: boolean } & EngineOptions) | 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 = typeof options === \"object\" ? { ...options } : undefined;\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 && (opts as { useLargeWorldRendering?: boolean }).useLargeWorldRendering) {\n delete (opts as { useLargeWorldRendering?: boolean }).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._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 } } } | 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 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 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 /**\n * Babylon.js `engine.currentSampleCount` — the MSAA sample count of the current render target.\n * Babylon Lite manages MSAA internally and exposes no public sample-count accessor, so this\n * needs a tree-shakeable Lite core addition before it can report a real value.\n */\n public get currentSampleCount(): never {\n return unsupported(\"AbstractEngine.currentSampleCount\", \"Babylon Lite manages MSAA internally and exposes no public sample-count accessor.\");\n }\n\n /**\n * Babylon.js `engine.getAlphaToCoverage()` — alpha-to-coverage state. Babylon Lite does not\n * expose an engine-level alpha-to-coverage toggle, so this is unsupported.\n */\n public getAlphaToCoverage(): never {\n return unsupported(\"AbstractEngine.getAlphaToCoverage\", \"Babylon Lite does not expose an engine-level alpha-to-coverage toggle.\");\n }\n\n /**\n * Babylon.js `engine.setAlphaToCoverage(enable)` — toggle alpha-to-coverage. Babylon Lite does\n * not expose an engine-level alpha-to-coverage toggle, so this is unsupported.\n */\n public setAlphaToCoverage(_enable: boolean): never {\n return unsupported(\"AbstractEngine.setAlphaToCoverage\", \"Babylon Lite does not expose an engine-level alpha-to-coverage toggle.\");\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._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 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","/**\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 { createHavokWorld, setPhysicsTimestep, setPhysicsGravity, disposePhysics } from \"babylon-lite\";\nimport type { PhysicsWorld, SceneContext } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.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\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// ─── 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 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 /** 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 createFreeCamera,\n createGeospatialCamera,\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 { ArcRotateCamera as LiteArcRotateCamera, FreeCamera as LiteFreeCamera, GeospatialCamera as LiteGeospatialCamera, Camera as LiteCamera } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { Vector3 } from \"../math/vector.js\";\nimport { Matrix } from \"../math/matrix.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 /** @internal Underlying Babylon Lite camera. */\n public abstract readonly _lite: LiteCamera;\n private _detach: (() => void) | undefined;\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 /** 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 return h !== 0 ? w / h : 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?: boolean): void {\n const detach = liteAttachControl(this._lite, canvas, this._scene?._lite);\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 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`. This\n * is fully testable without a GPU. `AnimationGroup` provides the structural\n * grouping/playback-state surface; frame-accurate playback is driven through the\n * native Babylon Lite animation manager when wired to a scene (not modelled here).\n */\n\nimport { goToFrame as liteGoToFrame, playAnimation, pauseAnimation, stopAnimation, setAnimationAdditive } from \"babylon-lite\";\nimport type { AnimationGroup as LiteAnimationGroup, EngineContext } from \"babylon-lite\";\n\nexport interface IAnimationKey {\n frame: number;\n value: number | number[];\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 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\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 /** Linearly evaluate the animated value at `frame` (clamped to the key range). */\n public evaluate(frame: number): number | number[] {\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 t = (frame - a.frame) / (b.frame - a.frame);\n return lerpValue(a.value, b.value, t);\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 lerpValue(a: number | number[], b: number | number[], t: number): number | number[] {\n if (typeof a === \"number\" && typeof b === \"number\") {\n return a + (b - a) * t;\n }\n const av = a as number[];\n const bv = b as number[];\n return av.map((value, i) => value + ((bv[i] ?? value) - value) * t);\n}\n\ntype AnimValue = number | number[];\n\nfunction scaleValue(value: AnimValue, scale: number): AnimValue {\n return typeof value === \"number\" ? value * scale : value.map((v) => v * 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 = acc as number[];\n const v = value as number[];\n return a.map((x, i) => x + (v[i] ?? 0));\n}\n\nfunction zeroLike(value: AnimValue): AnimValue {\n return typeof value === \"number\" ? 0 : (value as number[]).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 typeof leaf === \"number\" ? 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, readPath(target, path));\n }\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: number | number[]): 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 (Array.isArray(value)) {\n const slot = obj[leaf] as { set?: (...n: number[]) => void } | undefined;\n if (slot && typeof slot.set === \"function\") {\n slot.set(...value);\n } else {\n obj[leaf] = value;\n }\n } else {\n obj[leaf] = value;\n }\n}\n\n/**\n * Babylon.js `Animatable` — a running animation on a target, driven per-frame on\n * the CPU by evaluating each `Animation`'s keyframes and writing the result onto\n * the target's (dotted) property path.\n */\nexport class Animatable {\n public masterFrame = 0;\n public speedRatio: number;\n private _paused = false;\n private _stopped = false;\n\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 ) {\n this.speedRatio = speedRatio;\n this.masterFrame = _from;\n this._apply();\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 const fps = this._animations[0]?.framePerSecond ?? 60;\n this.masterFrame += (deltaMs / 1000) * fps * this.speedRatio;\n if (this.masterFrame > this._to) {\n if (this._loop) {\n const span = this._to - this._from || 1;\n this.masterFrame = this._from + ((this.masterFrame - this._from) % span);\n } else {\n this.masterFrame = this._to;\n this._stopped = true;\n }\n }\n this._apply();\n }\n\n public goToFrame(frame: number): void {\n this.masterFrame = frame;\n this._apply();\n }\n\n public pause(): void {\n this._paused = true;\n }\n\n public restart(): void {\n this._paused = false;\n this._stopped = false;\n this.masterFrame = this._from;\n }\n\n public stop(): void {\n this._stopped = true;\n }\n\n public get animationStarted(): boolean {\n return !this._stopped;\n }\n\n private _apply(): void {\n for (const anim of this._animations) {\n applyAnimatedValue(this._target, anim.targetProperty, anim.evaluate(this.masterFrame));\n }\n }\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-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 enableAnimationBlending,\n updateAnimationManager,\n} from \"babylon-lite\";\nimport type { SceneContext, Camera as LiteCamera, ArcRotateCamera as LiteArcRotateCamera, FreeCamera as LiteFreeCamera, AnimationManager } 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\";\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\";\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 once when the scene is disposed. */\n public readonly onDisposeObservable = new Observable<Scene>();\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 running\n * CPU `Animatable`s started via `beginDirectAnimation`.\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 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: Array<{ _build(engine: import(\"babylon-lite\").EngineContext): void; _liteGen?: unknown }> = [];\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 readonly _runningAnimatables: Animatable[] = [];\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 /** @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 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 /**\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 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 }\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: { _build(engine: import(\"babylon-lite\").EngineContext): void }): void {\n this._shadowGenerators.push(gen);\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 /** @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 }\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 /** Image-processing exposure proxy (Babylon.js `imageProcessingConfiguration.exposure`). */\n public get imageProcessingConfiguration(): { exposure: number; contrast: number; toneMappingEnabled: boolean } {\n return this._lite.imageProcessing;\n }\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 /** Synchronous CPU picking — unsupported. Babylon Lite uses async GPU picking. */\n public pick(): never {\n return unsupported(\n \"Scene.pick\",\n \"Babylon Lite uses asynchronous GPU picking. Use the compat `GPUPicker` class (Babylon.js parity) or the native `createGpuPicker` + `pickAsync` API.\"\n );\n }\n\n /** Synchronous ray picking — unsupported. */\n public pickWithRay(): never {\n return unsupported(\"Scene.pickWithRay\", \"Synchronous CPU ray-mesh intersection is not implemented in Babylon Lite.\");\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 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 * Drives the given `Animation`s on the CPU each frame, writing onto the target's\n * (dotted) property path. Returns an `Animatable` with `goToFrame`/`pause`/`stop`.\n */\n public beginDirectAnimation(target: unknown, animations: Animation[], from: number, to: number, loop = false, speedRatio = 1): Animatable {\n const animatable = new Animatable(target, animations, from, to, loop, speedRatio);\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 this.onDisposeObservable.notifyObservers(this);\n disposeScene(this._lite);\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 * Colour properties (`diffuse`, `specular`, `groundColor`) are write-through on\n * assignment: `light.diffuse = new Color3(...)` propagates immediately. In-place\n * mutation of a returned colour (`light.diffuse.r = x`) does not propagate; assign\n * a new colour instead. Direction/position are backed by Lite's observable vectors\n * and propagate on `.x/.y/.z` writes.\n */\n\nimport { addToScene, createHemisphericLight, createDirectionalLight, createPointLight, createSpotLight } 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 { Color3 } from \"../math/color.js\";\nimport { 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 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 private _bumpLiteVersion(): void {\n this._liteVersionBump ??= ensureLightVersionBump(this._lite);\n this._liteVersionBump();\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 public override dispose(): void {\n // Lite removes lights through the scene; without a back-reference the\n // caller should use `removeFromScene`. Detaching the shadow generator is\n // the safe, scene-free cleanup we can do here.\n this._lite.shadowGenerator = undefined;\n super.dispose();\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\nfunction readColor(tuple: Tuple3): Color3 {\n return new Color3(tuple[0], tuple[1], tuple[2]);\n}\n\nfunction writeColor(tuple: Tuple3, value: Color3): void {\n tuple[0] = value.r;\n tuple[1] = value.g;\n tuple[2] = value.b;\n}\n\nfunction readVector(vec: { x: number; y: number; z: number }): Vector3 {\n return new Vector3(vec.x, vec.y, vec.z);\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 readVector(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 readColor(this._lite.diffuseColor);\n }\n public set diffuse(value: Color3) {\n writeColor(this._lite.diffuseColor, value);\n }\n\n public get specular(): Color3 {\n return readColor(this._lite.specularColor);\n }\n public set specular(value: Color3) {\n writeColor(this._lite.specularColor, value);\n }\n\n public get groundColor(): Color3 {\n return readColor(this._lite.groundColor);\n }\n public set groundColor(value: Color3) {\n 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 readVector(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 readVector(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 readColor(this._lite.diffuse);\n }\n public set diffuse(value: Color3) {\n writeColor(this._lite.diffuse, value);\n }\n\n public get specular(): Color3 {\n return readColor(this._lite.specular);\n }\n public set specular(value: Color3) {\n 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 readVector(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 readColor(this._lite.diffuse);\n }\n public set diffuse(value: Color3) {\n writeColor(this._lite.diffuse, value);\n }\n\n public get specular(): Color3 {\n return readColor(this._lite.specular);\n }\n public set specular(value: Color3) {\n 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 readVector(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 readVector(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 readColor(this._lite.diffuse);\n }\n public set diffuse(value: Color3) {\n writeColor(this._lite.diffuse, value);\n }\n\n public get specular(): Color3 {\n return readColor(this._lite.specular);\n }\n public set specular(value: Color3) {\n 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 clusters **point lights only**, so\n * {@link ClusteredLightContainer.IsLightSupported} accepts a compat `PointLight`\n * and rejects everything else (Babylon.js additionally clusters spot lights).\n * Each added light is snapshotted into a Lite `ClusteredPointLight` 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\";\n\n/** The numeric light type id Babylon.js reports for a clustered container (`LIGHTTYPEID_CLUSTERED_CONTAINER`). */\nconst LIGHTTYPEID_CLUSTERED_CONTAINER = 5;\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 a point/spot light can be clustered by this container. Babylon Lite\n * clusters point lights only.\n */\n public static IsLightSupported(light: Light): boolean {\n return light instanceof PointLight;\n }\n\n /**\n * Creates a new clustered light container.\n *\n * @param name - The container's node name.\n * @param lights - Initial lights to cluster (point lights).\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 true;\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)`. Only point lights are clustered. */\n public addLight(light: Light): void {\n if (!ClusteredLightContainer.IsLightSupported(light) || light._clusteredContainer) {\n return;\n }\n const point = light as PointLight;\n light._clusteredContainer = this;\n const pos = point.position;\n const diffuse = point.diffuse;\n const liteLight = createClusteredPointLight(this._container, {\n position: [pos.x, pos.y, pos.z],\n diffuse: [diffuse.r, diffuse.g, diffuse.b],\n range: point.range,\n intensity: point.intensity,\n });\n this._childLights.push(point);\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 = point.getScene();\n if (lightScene) {\n lightScene._unregisterNode(point);\n removeFromScene(lightScene._lite, point._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.indexOf(light as PointLight);\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 pool = this._container.pointLights;\n const j = liteLight ? pool.indexOf(liteLight) : -1;\n if (j !== -1) {\n pool.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 point = light as PointLight;\n const lightScene = point.getScene();\n if (lightScene) {\n lightScene._registerLight(point);\n addToScene(lightScene._lite, point._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 } from \"./meshes.js\";\nimport type { Scene } from \"../scene/scene.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/** @internal Add a freshly-built CSG result mesh to its scene at engine start. */\nfunction deferAddCsgMesh(mesh: Mesh, scene: Scene, material?: CompatMaterial): void {\n scene._deferAdd(() => {\n const engine = scene.getEngine()._lite;\n if (material) {\n material._ensureRenderable(engine);\n mesh._lite.material = material._lite as never;\n }\n addToScene(scene._lite, mesh._lite);\n });\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 deferAddCsgMesh(mesh, scene, material ?? undefined);\n return mesh;\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 material._ensureRenderable(engine);\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 root._lite.material = savedMaterials[0] as never;\n scene._deferAdd(() => addToScene(scene._lite, root._lite));\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 } 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 transform-carrying Lite node: the loaded splat node once present, else the placeholder. */\n private get _xform(): SceneNode {\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 /** @internal Adopt a loaded Lite splat node: carry over placeholder transforms + name, and register on the scene. */\n private _adopt(lite: LiteGsMesh): void {\n const placeholder = this._node;\n lite.position.set(placeholder.position.x, placeholder.position.y, placeholder.position.z);\n lite.scaling.set(placeholder.scaling.x, placeholder.scaling.y, placeholder.scaling.z);\n lite.rotation.set(placeholder.rotation.x, placeholder.rotation.y, placeholder.rotation.z);\n lite.name = this.name;\n this._gs = lite;\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 }\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","/**\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} from \"babylon-lite\";\nimport type { Texture2D, Texture2DOptions, EngineContext, Texture3D, DynamicTexture2D } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.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\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 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","/**\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\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 * Babylon.js `ImageProcessingConfiguration` — only the tone-mapping constants are\n * surfaced (the live exposure/contrast/tone-mapping toggle is exposed through\n * `scene.imageProcessingConfiguration`).\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\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} as const;\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","/**\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, loadGltf, loadBabylon } from \"babylon-lite\";\nimport type { AssetContainer as LiteAssetContainer, AnimationGroup } from \"babylon-lite\";\n\nimport { unsupported } from \"../error.js\";\nimport { collectLoadedMeshes, type LoadedMeshRegistry } from \"./loaded-mesh.js\";\nimport { GaussianSplattingMesh } from \"../meshes/gaussian-splatting.js\";\nimport type { Mesh, TransformNode } from \"../meshes/meshes.js\";\nimport type { Scene } from \"../scene/scene.js\";\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\");\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\n/** Last path segment of a URL, used to name a loaded Gaussian-Splatting mesh. */\nfunction baseName(url: string): string {\n const path = urlPath(url);\n return path.slice(path.lastIndexOf(\"/\") + 1) || \"splat\";\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\n public constructor(lite: LiteAssetContainer) {\n this._lite = lite;\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 return collectLoadedMeshes(this._lite, this._meshRegistry, this._scene);\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._scene = scene;\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 // Lite owns container GPU resources through the scene; explicit container\n // disposal is a no-op until removed from the scene.\n }\n}\n\ninterface ImportResult {\n meshes: TransformNode[];\n particleSystems: unknown[];\n skeletons: unknown[];\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\n/** @internal Load a splat URL into a `GaussianSplattingMesh` (shared by every loader entry point). */\nasync function loadSplatResult(url: string, scene: Scene): Promise<ImportResult> {\n const gs = new GaussianSplattingMesh(baseName(url), null, scene);\n await gs.loadFileAsync(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): 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 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: [],\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 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?: unknown): Promise<ImportResult> {\n if (isSplatUrl(source)) {\n return loadSplatResult(source, scene);\n }\n const container = await loadFromSource(source, scene);\n container.addAllToScene(scene);\n return {\n meshes: container.meshes,\n particleSystems: [],\n 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?: unknown): Promise<Scene> {\n if (isSplatUrl(source)) {\n await loadSplatResult(source, scene);\n return scene;\n }\n const container = await loadFromSource(source, scene);\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?: unknown): Promise<AssetContainer> {\n return loadFromSource(source, scene);\n}\n\n/** @internal Load a glTF/.babylon asset from a single source URL (function-loader form). */\nasync function loadFromSource(source: string, scene: Scene): 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 const lite = isBabylonUrl(source) ? await loadBabylon(engine, source) : await loadGltf(engine, source);\n return new AssetContainer(lite);\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","/**\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} 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 type { Vector3 } from \"../math/vector.js\";\nimport type { Color3 } from \"../math/color.js\";\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\n public constructor(layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createPositionGizmo(layer._engine, layer._lite);\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 }\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\n public constructor(layer: UtilityLayerRenderer) {\n super(layer);\n this._lite = createRotationGizmo(layer._engine, layer._lite);\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 }\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 /** @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 /** @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 { createEsmDirectionalShadowGenerator, createPcfDirectionalShadowGenerator, createPcfSpotlightShadowGenerator, setShadowTaskCasterMeshes } from \"babylon-lite\";\nimport type { EngineContext, Mesh as LiteMesh } from \"babylon-lite\";\n\nimport type { Light } from \"../lights/lights.js\";\nimport type { AbstractMesh } from \"../meshes/meshes.js\";\n\nexport class ShadowGenerator {\n private readonly _mapSize: number;\n private readonly _light: Light;\n private readonly _casters: AbstractMesh[] = [];\n /** @internal The built Lite shadow generator (set in `_build`). Used to wire NME receivers. */\n public _liteGen: unknown;\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 const scene = light.getScene();\n if (scene) {\n scene._registerShadowGenerator(this);\n }\n }\n\n /** Babylon.js `addShadowCaster(mesh, includeDescendants?)`. */\n public addShadowCaster(mesh: AbstractMesh, _includeDescendants = true): ShadowGenerator {\n if (!this._casters.includes(mesh)) {\n this._casters.push(mesh);\n }\n return this;\n }\n\n /** Babylon.js `removeShadowCaster(mesh)`. */\n public removeShadowCaster(mesh: AbstractMesh): ShadowGenerator {\n const i = this._casters.indexOf(mesh);\n if (i >= 0) {\n this._casters.splice(i, 1);\n }\n return this;\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._light._lite.shadowGenerator = undefined;\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 (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 const casterMeshes = this._casters.map((m) => m._lite as LiteMesh);\n setShadowTaskCasterMeshes(liteGen, casterMeshes);\n }\n}\n\n/**\n * Babylon.js `CascadedShadowGenerator` — cascaded shadow maps for large directional\n * scenes. Mapped onto Babylon Lite's CSM generator is a larger task; for now this\n * extends {@link ShadowGenerator} and falls back to the standard directional path,\n * which renders (a single cascade's worth of) shadows rather than throwing.\n */\nexport class CascadedShadowGenerator extends ShadowGenerator {\n public numCascades = 4;\n public lambda = 0.5;\n public stabilizeCascades = false;\n public depthClamp = true;\n public autoCalcDepthBounds = false;\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-compatible easing functions (pure, no Babylon Lite dependency).\n *\n * These mirror Babylon.js's `EasingFunction` hierarchy and easing modes for use\n * with property animations. They are fully unit-testable.\n */\n\nexport const EASINGMODE_EASEIN = 0;\nexport const EASINGMODE_EASEOUT = 1;\nexport const EASINGMODE_EASEINOUT = 2;\n\nexport abstract class EasingFunction {\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 const g = Math.max(0, Math.min(1, gradient));\n return 1 - Math.sqrt(1 - g * g);\n }\n}\n\nexport class QuadraticEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return gradient * gradient;\n }\n}\n\nexport class CubicEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return gradient * gradient * gradient;\n }\n}\n\nexport class QuarticEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return gradient * gradient * gradient * gradient;\n }\n}\n\nexport class QuinticEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return gradient * gradient * gradient * gradient * gradient;\n }\n}\n\nexport class SineEase extends EasingFunction {\n public easeInCore(gradient: number): number {\n return 1 - Math.sin((Math.PI / 2) * (1 - gradient));\n }\n}\n\nexport class ExponentialEase extends EasingFunction {\n public constructor(private readonly exponent: number = 2) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n if (this.exponent <= 0) {\n return gradient;\n }\n return (Math.exp(this.exponent * gradient) - 1) / (Math.exp(this.exponent) - 1);\n }\n}\n\nexport class BackEase extends EasingFunction {\n public constructor(private readonly amplitude: number = 1) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n const num = Math.max(0, this.amplitude);\n return Math.pow(gradient, 3) - gradient * num * Math.sin(Math.PI * gradient);\n }\n}\n\nexport class ElasticEase extends EasingFunction {\n public constructor(\n private readonly oscillations: number = 3,\n private readonly springiness: number = 3\n ) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n const num2 = Math.max(0, this.oscillations);\n const num3 = Math.max(0, this.springiness);\n const num = num3 === 0 ? gradient : (Math.exp(num3 * gradient) - 1) / (Math.exp(num3) - 1);\n return num * Math.sin((2 * Math.PI * num2 + Math.PI / 2) * gradient);\n }\n}\n\nexport class BounceEase extends EasingFunction {\n public constructor(\n private readonly bounces: number = 3,\n private readonly bounciness: number = 2\n ) {\n super();\n }\n\n public easeInCore(gradient: number): number {\n const num = Math.max(0, this.bounces);\n let bounciness = this.bounciness;\n if (bounciness <= 1) {\n bounciness = 1.001;\n }\n const num2 = Math.pow(bounciness, num);\n const num3 = 1 - bounciness;\n const num4 = (1 - num2) / num3 + num2 * 0.5;\n const num5 = gradient * num4;\n const num6 = Math.log(-num5 * (1 - bounciness) + 1) / Math.log(bounciness);\n const num7 = Math.floor(num6);\n const num8 = num7 + 1;\n const num9 = (1 - Math.pow(bounciness, num7)) / (num3 * num4);\n const num10 = (1 - Math.pow(bounciness, num8)) / (num3 * num4);\n const num11 = (num9 + num10) * 0.5;\n const num12 = gradient - num11;\n const num13 = num11 - num9;\n return (-Math.pow(1 / bounciness, num - num7) / (num13 * num13)) * (num12 - num13) * (num12 + num13);\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}\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","/**\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\";\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 class ShaderMaterial {\n public constructor() {\n unsupported(\"ShaderMaterial\", \"Babylon Lite is WGSL-only. Use the native `createShaderMaterial` (WGSL) API; there is no automatic GLSL translation.\");\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\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 textures (DOM/CSS overlay interop) ─────────────────────────\n// New in BJS: `Materials/Textures/HTML/*` — uploads a live DOM element into a\n// texture and forwards pointer/raycast interaction onto an overlaid HTML layer.\n// This is a DOM-driven, host-page feature with no Babylon Lite equivalent (Lite\n// is a WebGPU renderer with no HTML overlay / interaction subsystem),\n// so every entry throws.\n\n/** Options accepted by Babylon.js `HtmlTexture` (shape-only stub for type parity). */\nexport interface IHtmlTextureOptions {\n [key: string]: unknown;\n}\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 HtmlTexture {\n public constructor() {\n unsupported(\"HtmlTexture\", \"Rendering a live DOM element into a texture is a host-page/DOM feature with no Babylon Lite equivalent.\");\n }\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` — HTML texture upload is unsupported by the compat layer. */\nexport function IsHtmlInCanvasUploadSupported(): never {\n return unsupported(\"IsHtmlInCanvasUploadSupported\", \"HTML-element texture upload is not supported by Babylon Lite.\");\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// ─── Gaussian Splatting LOD streaming ────────────────────────────────\n// BJS `@babylonjs/loaders` SPLAT exposes a Gaussian-Splatting LOD *streaming*\n// subsystem (`GaussianSplattingStream` + `AddGaussianSplattingStreamPart[Async]`,\n// with `IGaussianSplattingStreamingPart` / `IGaussianSplattingStreamOptions` /\n// `ISOGLODMetadata` describing a compound mesh assembled from streamed parts).\n// It layers SOG-octree LOD residency management (download/residency controllers,\n// a block allocator) on top of a GPU work-buffer decode pipeline that decodes\n// SH / rotation / scale into shared render-target atlases via dedicated\n// GLSL+WGSL shaders. Babylon Lite loads a *whole* splat cloud eagerly\n// (`loadSplat` / `loadSOG` / `loadSPZ`, wrapped by the compat `GaussianSplattingMesh`)\n// and has no streaming/LOD residency subsystem or work-buffer decode pipeline to\n// back it. Adding one is a whole GPU subsystem with open design questions\n// (residency policy, LOD scheduling, atlas layout) — not a small, mechanical,\n// objective Lite addition — so these throw (structural blocker; move 3).\n\n/** Babylon.js `GaussianSplattingStreamDebugLodSource` — LOD debug source selector (shape-only stub for type parity). */\nexport type GaussianSplattingStreamDebugLodSource = \"optimal\" | \"current\";\n\n/** Babylon.js `IGaussianSplattingStreamOptions` — GS LOD stream options (shape-only stub for type parity). */\nexport interface IGaussianSplattingStreamOptions {\n [key: string]: unknown;\n}\n\n/** Babylon.js `ISOGLODMetadata` — SOG LOD octree metadata (shape-only stub for type parity). */\nexport interface ISOGLODMetadata {\n [key: string]: unknown;\n}\n\n/** Babylon.js `IGaussianSplattingStreamingPart` — a streamed part of a GS compound mesh (shape-only stub for type parity). */\nexport interface IGaussianSplattingStreamingPart {\n [key: string]: unknown;\n}\n\nexport class GaussianSplattingStream {\n public constructor(..._args: unknown[]) {\n unsupported(\n \"GaussianSplattingStream\",\n \"Gaussian-Splatting LOD streaming is a whole GPU subsystem (SOG-octree LOD residency + work-buffer decode into render-target atlases) with no Babylon Lite equivalent. Load the full cloud with `GaussianSplattingMesh` / `loadSplat` instead.\"\n );\n }\n}\n\n/** Babylon.js `AddGaussianSplattingStreamPart` — appends a streamed LOD part to a GS compound mesh. */\nexport function AddGaussianSplattingStreamPart(..._args: unknown[]): never {\n return unsupported(\n \"AddGaussianSplattingStreamPart\",\n \"Gaussian-Splatting LOD streaming (compound mesh + streamed parts) is not backed by Babylon Lite, which loads a whole splat cloud eagerly via `GaussianSplattingMesh`.\"\n );\n}\n\n/** Babylon.js `AddGaussianSplattingStreamPartAsync` — async variant of {@link AddGaussianSplattingStreamPart}. */\nexport function AddGaussianSplattingStreamPartAsync(..._args: unknown[]): never {\n return unsupported(\n \"AddGaussianSplattingStreamPartAsync\",\n \"Gaussian-Splatting LOD streaming (compound mesh + streamed parts) is not backed by Babylon Lite, which loads a whole splat cloud eagerly via `GaussianSplattingMesh`.\"\n );\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","/**\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\";\n\n// ─── Bones / Skeletons / Morph ───────────────────────────────────────\nexport class Skeleton {\n public constructor() {\n unsupported(\"Skeleton\", \"Skeletons are produced by the glTF loader in Babylon Lite and driven by `createAnimationController`; they are not constructed manually.\");\n }\n}\n\nexport class Bone {\n public constructor() {\n unsupported(\"Bone\", \"Bones are produced by the glTF loader in Babylon Lite; manual bone construction is not wrapped.\");\n }\n}\n\n// ─── Probes / Layers / Rendering ─────────────────────────────────────\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\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// ─── 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\n// ─── Physics ─────────────────────────────────────────────────────────\n// Babylon Lite ships a Havok-V2 subset via `createHavokWorld` /\n// `createPhysicsAggregate` etc. `HavokPlugin` is wrapped (see\n// `src/physics/physics.ts`); the aggregate/body/shape class model is not wrapped\n// 1:1 — use the native physics functions against `plugin.world`.\nexport class PhysicsAggregate {\n public constructor() {\n unsupported(\"PhysicsAggregate\", \"Use the native `createPhysicsAggregate` API instead of the Babylon.js PhysicsAggregate class.\");\n }\n}\n\nexport class PhysicsBody {\n public constructor() {\n unsupported(\"PhysicsBody\", \"Use the native `createPhysicsBody` API.\");\n }\n}\n\nexport class PhysicsShape {\n public constructor() {\n unsupported(\"PhysicsShape\", \"Use the native `createPhysicsShape` API.\");\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) ───────────────────\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 class FBXFileLoader {\n public constructor() {\n unsupported(\"FBXFileLoader\", \"The FBX format is not supported by Babylon Lite. Convert to glTF.\");\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"],"names":["Space","c","d","n","m","x","y","z","t","i","p","_a","h","w","now","PhysicsShapeType","PhysicsMotionType","PhysicsPrestepType","PhysicsConstraintType","liteGetViewMatrix","liteGetProjectionMatrix","liteAttachControl","v","liteGoToFrame","g","liteCreateDefaultCamera","createArcRotateCamera","attachControl","j","f","o","ScenePerformancePriority","ShaderLanguage","litePickAsync","mesh","layer","s","r","GreasedLineMeshColorDistribution","GreasedLineMeshWidthDistribution","GreasedLineRibbonPointsMode","GreasedLineRibbonFacesMode","GreasedLineRibbonAutoDirectionMode","set"],"mappings":";;;;;;AAEO,MAAM,UAAU;AAChB,MAAM,YAAY,KAAK,KAAK;AAC5B,MAAM,YAAY,MAAM,KAAK;AAG7B,MAAM,SAAS;AAAA,EAClB,MAAM,OAAe,MAAM,GAAG,MAAM,GAAW;AAC3C,WAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK,CAAC;AAAA,EAC7C;AAAA,EACA,KAAK,OAAe,KAAa,QAAwB;AACrD,WAAO,SAAS,MAAM,SAAS;AAAA,EACnC;AAAA,EACA,YAAY,GAAW,GAAW,OAAuB;AACrD,WAAO,MAAM,IAAI,KAAK,QAAQ,MAAM,IAAI;AAAA,EAC5C;AAAA,EACA,iBAAiB,SAAyB;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