@ignifx/core 0.13.0 → 0.15.0
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/dist/agx-tone-mapping-Cgt844j6.js +53 -0
- package/dist/agx-tone-mapping-Cgt844j6.js.map +1 -0
- package/dist/auto-exposure-uzPn0beO.js +246 -0
- package/dist/auto-exposure-uzPn0beO.js.map +1 -0
- package/dist/bloom-hdr-CLtQj-oY.js +315 -0
- package/dist/bloom-hdr-CLtQj-oY.js.map +1 -0
- package/dist/contact-shadows-T523EXaP.js +84 -0
- package/dist/contact-shadows-T523EXaP.js.map +1 -0
- package/dist/{environment-C9AjYJgV.js → environment-DPi0_0SP.js} +19 -5
- package/dist/environment-DPi0_0SP.js.map +1 -0
- package/dist/gtao-_nr0b6-E.js +630 -0
- package/dist/gtao-_nr0b6-E.js.map +1 -0
- package/dist/hdr-output-BrUvpAsE.js +525 -0
- package/dist/hdr-output-BrUvpAsE.js.map +1 -0
- package/dist/{ignifx-error-Dq2qJMkZ.js → ignifx-error-oYdVnT1S.js} +16 -1
- package/dist/ignifx-error-oYdVnT1S.js.map +1 -0
- package/dist/index.d.ts +753 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1679 -183
- package/dist/index.js.map +1 -1
- package/dist/{instanced-mesh-instance-DYwH0vLi.js → instanced-mesh-instance-NnODkvqK.js} +2 -2
- package/dist/{instanced-mesh-instance-DYwH0vLi.js.map → instanced-mesh-instance-NnODkvqK.js.map} +1 -1
- package/dist/mat4-D6exvAuO.js +949 -0
- package/dist/mat4-D6exvAuO.js.map +1 -0
- package/dist/material-CGk5mAah.js +204 -0
- package/dist/material-CGk5mAah.js.map +1 -0
- package/dist/{material-plugin-BOCB7Stt.js → material-plugin-BUlqLsap.js} +3 -204
- package/dist/material-plugin-BUlqLsap.js.map +1 -0
- package/dist/{post-effect-compiler-Dw6zW2cG.js → post-effect-compiler-CRek8VxQ.js} +2 -2
- package/dist/{post-effect-compiler-Dw6zW2cG.js.map → post-effect-compiler-CRek8VxQ.js.map} +1 -1
- package/dist/render-path-Be7WgN7r.js +166 -0
- package/dist/render-path-Be7WgN7r.js.map +1 -0
- package/dist/render-texture-C_TnaSz2.js +200 -0
- package/dist/render-texture-C_TnaSz2.js.map +1 -0
- package/dist/scene-color-passes-DlNr-qyZ.js +65 -0
- package/dist/scene-color-passes-DlNr-qyZ.js.map +1 -0
- package/dist/scene-inputs-BxGOsnIZ.js +318 -0
- package/dist/scene-inputs-BxGOsnIZ.js.map +1 -0
- package/dist/{shader-material-DRZmqA_S.js → shader-material-B6p66wB8.js} +18 -7
- package/dist/shader-material-B6p66wB8.js.map +1 -0
- package/dist/{shader-material-BxQn9FT4.js → shader-material-C0TAUr4t.js} +102 -4
- package/dist/shader-material-C0TAUr4t.js.map +1 -0
- package/dist/{shader-pragma-DrFm5f5m.js → shader-pragma-BKCoZTTA.js} +2 -2
- package/dist/{shader-pragma-DrFm5f5m.js.map → shader-pragma-BKCoZTTA.js.map} +1 -1
- package/dist/ssgi-Dm-maZrc.js +113 -0
- package/dist/ssgi-Dm-maZrc.js.map +1 -0
- package/dist/{surface-shader-BgZchRBe.js → surface-shader-BaK0kvBB.js} +5 -4
- package/dist/{surface-shader-BgZchRBe.js.map → surface-shader-BaK0kvBB.js.map} +1 -1
- package/dist/taa-BwBZLy11.js +480 -0
- package/dist/taa-BwBZLy11.js.map +1 -0
- package/dist/{vec3-T2PasQZv.js → vec3-D-0Y2mzE.js} +4 -948
- package/dist/vec3-D-0Y2mzE.js.map +1 -0
- package/package.json +1 -1
- package/dist/environment-C9AjYJgV.js.map +0 -1
- package/dist/ignifx-error-Dq2qJMkZ.js.map +0 -1
- package/dist/material-plugin-BOCB7Stt.js.map +0 -1
- package/dist/shader-material-BxQn9FT4.js.map +0 -1
- package/dist/shader-material-DRZmqA_S.js.map +0 -1
- package/dist/vec3-T2PasQZv.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shader-material-DRZmqA_S.js","names":[],"sources":["../src/render/shader-material.ts"],"sourcesContent":["import { CoreErrorCode } from \"../errors/error-codes.js\";\nimport { IgnifxError } from \"../errors/ignifx-error.js\";\nimport { Color } from \"../math/color.js\";\nimport { setOwnJsonProperty } from \"../schema/json.js\";\nimport { IGNIFX_UNIFORM_TYPES, IGNIFX_UNIFORM_NAMES, LITE_SYSTEM_UNIFORM_NAMES } from \"./shader-declaration.js\";\nimport type { ShaderAsset } from \"./shader-asset.js\";\nimport type {\n IgnifxUniformName,\n ShaderDeclaration,\n ShaderTextureDeclaration,\n ShaderUniformDeclaration,\n ShaderUniformType,\n} from \"./shader-declaration.js\";\nimport type { ShaderMaterialDefinition } from \"./shader-material-definition.js\";\nimport type { StorageBufferAsset } from \"./storage-buffer-asset.js\";\nimport type { TextureAsset } from \"./texture-asset.js\";\nimport type { App } from \"../app/types.js\";\nimport type { AssetHandle } from \"../assets/types.js\";\nimport type {\n LiteShaderMaterial,\n ShaderMaterialAdapter,\n ShaderMaterialBuildOptions,\n ShaderSamplerEntry,\n ShaderStorageEntry,\n ShaderUniformEntry,\n} from \"../lite/gpu/shader-material.js\";\nimport type { LiteTexture2D } from \"../lite/gpu/texture.js\";\nimport type { ColorLike } from \"../math/types.js\";\nimport type { Disconnect } from \"../signal/signal.js\";\n\n/**\n * The `\"shader\"` material family (`docs/plan/2026-09-terrain-particles-shaders.md` §3.1): a\n * `ShaderAsset` plus the values a material sets on it.\n *\n * Nothing here imports Babylon Lite: {@link toShaderMaterialOptions} is the whole mapping onto the\n * shape `createShaderMaterial` takes, as plain data, and the adapter itself arrives through\n * {@link loadShaderMaterialAdapter} so a project that loads no `.wgsl` never fetches that chunk\n * (`./shader-support.ts`).\n *\n * Two Lite rules shape the design:\n *\n * - A declared sampler must have something bound (error 309), so an unbound declared texture gets\n * the declaration's 1x1 fallback and `setTexture(name, null)` restores it rather than unbinding.\n * - A declared storage buffer must have something bound too (error 310), and `array<T>` has no 1x1\n * equivalent, so such a material is not drawable until `setStorageBuffer` binds one.\n */\n\n/** The uniform names Babylon Lite and ignifx write themselves, which a material may not set. */\nconst ENGINE_UNIFORM_NAMES: readonly string[] = Object.freeze([...LITE_SYSTEM_UNIFORM_NAMES, ...IGNIFX_UNIFORM_NAMES]);\n\n/** How many floats the `PreRender` system's frame buffer holds: direction, colour, ambient. */\nconst FRAME_FLOATS = 9;\n\n/** Where the main light's direction starts inside the frame buffer. */\nconst DIRECTION_OFFSET = 0;\n\n/** Where the main light's colour starts inside the frame buffer. */\nconst LIGHT_COLOR_OFFSET = 3;\n\n/** Where the ambient colour starts inside the frame buffer. */\nconst AMBIENT_OFFSET = 6;\n\n/** How many elements each uniform type holds. */\nconst ELEMENT_COUNTS: Readonly<Record<ShaderUniformType, number>> = Object.freeze({\n f32: 1,\n u32: 1,\n i32: 1,\n \"vec2<f32>\": 2,\n \"vec3<f32>\": 3,\n \"vec4<f32>\": 4,\n \"mat4x4<f32>\": 16,\n});\n\n/**\n * The premultiplied-alpha blend state, which Babylon Lite's two named modes cannot express.\n *\n * @remarks\n * `blendMode: \"alpha\"` compiles `srcFactor: \"src-alpha\"` (`lib/material/shader/shader-pipeline.js`),\n * which multiplies the source colour by its alpha a second time. A premultiplied surface has\n * already done that, so it needs `srcFactor: \"one\"` — the state that lets additive and over-blended\n * particles share one draw.\n */\nconst PREMULTIPLIED_BLEND: GPUBlendState = Object.freeze({\n color: Object.freeze({ srcFactor: \"one\", dstFactor: \"one-minus-src-alpha\", operation: \"add\" }),\n alpha: Object.freeze({ srcFactor: \"one\", dstFactor: \"one-minus-src-alpha\", operation: \"add\" }),\n});\n\n/**\n * Maps a shader file's declaration and a material's `define` overrides onto the shape\n * `createShaderMaterial` takes.\n *\n * @remarks\n * Pure data in, pure data out, so every mapping rule is asserted headlessly:\n *\n * - `blend opaque` leaves blending off; `alpha` and `additive` are Lite's two named modes;\n * `premultiplied` supplies an explicit `GPUBlendState`, because Lite's `\"alpha\"` mode multiplies\n * by alpha a second time.\n * - `depthWrite` is passed explicitly, because the declaration already resolved Lite's\n * \"blended defaults to off unless stated\" rule.\n * - `depthTest off` becomes `depthCompare: \"always\"`; `depthTest on` passes `null`, which leaves\n * Lite's reverse-Z default in place.\n * - `instancing matrices` and `matrices-colors` differ only in `useThinInstanceColors`; which\n * pipeline layout a mesh draws with is Lite's decision at build time, from whether the mesh has a\n * thin-instance colour stream.\n * - A colour uniform's declared default is sRGB and is decoded here, which is the one place the\n * conversion happens for defaults.\n *\n * @param name - The material's name, for GPU debug labels.\n * @param source - The whole `.wgsl` file.\n * @param declaration - What the file's pragmas declared.\n * @param uniforms - The initial value of every custom uniform, keyed by name, already **linear**.\n * @param defines - The resolved `define` values.\n * @returns The options.\n *\n * @internal\n */\nexport function toShaderMaterialOptions(\n name: string,\n source: string,\n declaration: ShaderDeclaration,\n uniforms: ReadonlyMap<string, Float32Array>,\n defines: Readonly<Record<string, boolean | number>>,\n): ShaderMaterialBuildOptions {\n const entries: ShaderUniformEntry[] = [];\n // `for…of` rather than an indexed loop: this runs once per material build, not per frame, and the\n // iterator yields the element type rather than `T | undefined`.\n for (const system of declaration.system) {\n entries.push(system);\n }\n for (const ignifx of declaration.ignifx) {\n const type = IGNIFX_UNIFORM_TYPES[ignifx];\n entries.push({ name: ignifx, type, defaultValue: zeros(ELEMENT_COUNTS[type]) });\n }\n for (const uniform of declaration.uniforms) {\n entries.push({\n name: uniform.name,\n type: uniform.type,\n defaultValue: Array.from(uniforms.get(uniform.name) ?? uniformStore(uniform)),\n });\n }\n const samplers: ShaderSamplerEntry[] = [];\n for (const texture of declaration.textures) {\n samplers.push({ name: texture.name, viewDimension: texture.array ? \"2d-array\" : \"2d\" });\n }\n const storageBuffers: ShaderStorageEntry[] = [];\n for (const storage of declaration.storage) {\n storageBuffers.push({ name: storage.name, type: storage.type });\n }\n const pipeline = declaration.pipeline;\n const blended = pipeline.blend !== \"opaque\";\n return {\n name,\n source,\n attributes: declaration.attributes,\n uniforms: entries,\n samplers,\n storageBuffers,\n defines,\n useThinInstanceColors: pipeline.instancing === \"matrices-colors\",\n needAlphaBlending: blended,\n blendMode: pipeline.blend === \"additive\" ? \"additive\" : \"alpha\",\n blend: pipeline.blend === \"premultiplied\" ? PREMULTIPLIED_BLEND : null,\n transmissive: pipeline.transmissive,\n backFaceCulling: pipeline.cull === \"back\",\n depthWrite: pipeline.depthWrite,\n depthCompare: pipeline.depthTest ? null : \"always\",\n };\n}\n\n/** The dynamically imported Babylon Lite adapter, memoised for the process. */\nlet adapter: ShaderMaterialAdapter | null = null;\n\n/**\n * Loads the custom-WGSL half of the Babylon Lite adapter, once per process.\n *\n * @remarks\n * The shader **loader** awaits this before it hands back a `ShaderAsset`, which is what makes\n * {@link shaderMaterialAdapter} safe to call from the synchronous material builders. Loading it also\n * turns on Lite's cached uniform serialization plans, which is what makes the per-frame `time`\n * upload rewrite only the slots that changed.\n *\n * @returns A promise that resolves once the adapter is in place.\n *\n * @internal\n */\nexport async function loadShaderMaterialAdapter(): Promise<void> {\n if (adapter !== null) {\n return;\n }\n const loaded = await import(\"../lite/gpu/shader-material.js\");\n loaded.enableShaderUniformCaching();\n // The assignment is what checks `ShaderMaterialAdapter` against the module it stands for.\n adapter = loaded;\n}\n\n/**\n * The adapter, if it has been loaded.\n *\n * @returns The module, or `null` before any `.wgsl` has been loaded.\n *\n * @internal\n */\nexport function shaderMaterialAdapter(): ShaderMaterialAdapter | null {\n return adapter;\n}\n\n/**\n * The adapter, or the failure a material built before the `.wgsl` loader ran produces.\n *\n * @param shader - The shader being built, for the message.\n * @returns The adapter.\n * @throws IgnifxError with code `IGX-0715` when the chunk has not been loaded.\n */\nfunction requireShaderMaterialAdapter(shader: ShaderAsset): ShaderMaterialAdapter {\n const module = shaderMaterialAdapter();\n if (module === null) {\n throw new IgnifxError(\n CoreErrorCode.shaderCompileFailed,\n `${shader.address} cannot be built because the shader adapter has not been loaded.`,\n {\n context: { asset: shader.address, message: \"adapter not loaded\" },\n hint: \"Load the .wgsl through app.assets, which is what loads the adapter.\",\n },\n );\n }\n return module;\n}\n\n/**\n * The per-app state the shader material family needs: the 1x1 fallback textures declared samplers\n * fall back to, and the list of live materials whose per-frame ignifx uniforms have to be written.\n *\n * @remarks\n * It hangs off the app through a lazily created `WeakMap` rather than a service, so a shader\n * material works whether or not an extension registered anything, and two apps in one process keep\n * separate state (`CONSTITUTION.md` §3.6).\n *\n * @internal\n */\nexport class ShaderMaterialRegistry {\n readonly #app: App;\n\n /** Live materials that declare at least one ignifx uniform, in no particular order. */\n readonly #animated: ShaderMaterialState[] = [];\n\n readonly #fallbacks = new Map<string, LiteTexture2D>();\n\n /**\n * Creates the registry.\n *\n * @param app - The app it belongs to.\n */\n constructor(app: App) {\n this.#app = app;\n }\n\n /**\n * The materials the `PreRender` uniform system has to write this frame.\n *\n * @returns The list; the registry's own array, iterated without copying.\n */\n get animated(): readonly ShaderMaterialState[] {\n return this.#animated;\n }\n\n /**\n * Starts writing a material's ignifx uniforms every frame.\n *\n * @param state - The material.\n */\n add(state: ShaderMaterialState): void {\n if (!this.#animated.includes(state)) {\n this.#animated.push(state);\n }\n }\n\n /**\n * Stops writing a material's ignifx uniforms.\n *\n * @param state - The material.\n */\n remove(state: ShaderMaterialState): void {\n const index = this.#animated.indexOf(state);\n if (index < 0) {\n return;\n }\n const last = this.#animated.pop();\n if (last !== undefined && index < this.#animated.length) {\n this.#animated[index] = last;\n }\n }\n\n /**\n * The 1x1 texture a declared-but-unbound sampler is filled with, created on first use and shared\n * for the life of the app.\n *\n * @param declaration - The sampler declaration, for its `default` and `array` flags.\n * @returns The texture, or `null` under a headless app or before the adapter has loaded.\n */\n fallbackTexture(declaration: ShaderTextureDeclaration): LiteTexture2D | null {\n const module = shaderMaterialAdapter();\n if (module === null || this.#app.isHeadless) {\n return null;\n }\n return module.resolveFallbackTexture(\n this.#app.lite.engine,\n this.#fallbacks,\n declaration.fallback,\n declaration.array,\n );\n }\n}\n\n/** The per-app registries, created on first use so module scope allocates nothing. */\nlet registries: WeakMap<App, ShaderMaterialRegistry> | null = null;\n\n/**\n * The shader material state of one app.\n *\n * @param app - The app.\n * @returns Its registry, created on first use.\n *\n * @internal\n */\nexport function shaderMaterialsOf(app: App): ShaderMaterialRegistry {\n const map = (registries ??= new WeakMap<App, ShaderMaterialRegistry>());\n const existing = map.get(app);\n if (existing !== undefined) {\n return existing;\n }\n const created = new ShaderMaterialRegistry(app);\n map.set(app, created);\n return created;\n}\n\n/**\n * One live `\"shader\"` material: the Babylon Lite material, the CPU-side copy of every value written\n * to it, and the bindings it has to replay when the shader file or a `define` changes.\n *\n * @remarks\n * `MaterialAsset` owns one of these and forwards `setUniform`, `getUniform`, `setTexture`,\n * `setDefine`, and `setStorageBuffer` to it. It is `@internal` because the public surface is the\n * material's methods, not this object.\n *\n * @internal\n */\nexport class ShaderMaterialState {\n /** The definition the material was built from; a clone replays it. */\n readonly definition: ShaderMaterialDefinition;\n\n readonly #app: App;\n\n readonly #values = new Map<string, Float32Array>();\n\n readonly #textures = new Map<string, AssetHandle<TextureAsset> | null>();\n\n readonly #storage = new Map<string, AssetHandle<StorageBufferAsset> | null>();\n\n readonly #defines = new Map<string, boolean | number>();\n\n /** The last light values written, so an unchanged light costs no upload. */\n readonly #light = new Float32Array(FRAME_FLOATS);\n\n /** The ignifx-provided uniforms the file declares, paired with their stores. */\n readonly #engineSlots: { readonly name: IgnifxUniformName; readonly store: Float32Array }[] = [];\n\n #shader: ShaderAsset;\n\n #material: LiteShaderMaterial;\n\n /**\n * The adapter every write goes through. Captured once, because a state can only be built after\n * {@link buildLiteShaderMaterial} has proved the chunk is in memory.\n */\n readonly #adapter: ShaderMaterialAdapter;\n\n #hasLight = false;\n\n #hasWarnedAboutLight = false;\n\n #onReplaced: Disconnect | null = null;\n\n /**\n * Builds the material. Use {@link buildShaderMaterialState}.\n *\n * @param app - The app that owns the engine, the log, and the registry.\n * @param shader - The shader the material sets values on.\n * @param definition - The declaration.\n * @param material - The already-built Babylon Lite material.\n * @param liteAdapter - The custom-WGSL adapter every write goes through.\n */\n constructor(\n app: App,\n shader: ShaderAsset,\n definition: ShaderMaterialDefinition,\n material: LiteShaderMaterial,\n liteAdapter: ShaderMaterialAdapter,\n ) {\n this.#app = app;\n this.#adapter = liteAdapter;\n this.#shader = shader;\n this.definition = definition;\n this.#material = material;\n // Not zeros: a light really at the origin pointing along +Z would then never be written.\n this.#light.fill(Number.NaN);\n }\n\n /**\n * The shader the material is values for.\n *\n * @returns The shader asset, which a hot reload replaces.\n */\n get shader(): ShaderAsset {\n return this.#shader;\n }\n\n /**\n * The Babylon Lite material, which `setDefine` and a hot reload replace with a new object.\n *\n * @returns The material.\n */\n get material(): LiteShaderMaterial {\n return this.#material;\n }\n\n /**\n * Whether the shader declares any ignifx-provided uniform, and so needs a per-frame write.\n *\n * @returns `true` when the `PreRender` system has work to do for this material.\n */\n get isAnimated(): boolean {\n return this.#shader.declaration.ignifx.length > 0;\n }\n\n /**\n * Whether every declared storage buffer has a buffer bound, which is what Babylon Lite needs\n * before the material can be drawn at all.\n *\n * @returns `true` when the material is drawable.\n */\n get isDrawable(): boolean {\n const declared = this.#shader.declaration.storage;\n for (let index = 0; index < declared.length; index += 1) {\n const name = declared[index]?.name;\n if (name !== undefined && (this.#storage.get(name) ?? null) === null) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Writes a declared uniform.\n *\n * @param name - The uniform's name.\n * @param value - The value: a number, a numeric array, or — for a `color` uniform — an sRGB\n * colour, which is uploaded linear.\n * @throws IgnifxError with code `IGX-0712` when the shader declares no such uniform or the engine\n * writes it, or `IGX-0713` when the value has the wrong shape.\n */\n setUniform(name: string, value: number | readonly number[] | Float32Array | ColorLike): void {\n const declaration = this.#writableUniform(name);\n const store = this.#values.get(name) ?? uniformStore(declaration);\n this.#values.set(name, store);\n writeUniformValue(store, declaration, value, this.definition.name);\n this.#write(name, store);\n }\n\n /**\n * Reads the current CPU-side value of a declared uniform.\n *\n * @param name - The uniform's name.\n * @param out - Receives the value for a vector or matrix uniform; a fresh array is allocated when\n * it is omitted.\n * @returns The number for a scalar uniform, or the filled array.\n * @throws IgnifxError with code `IGX-0712` when the shader declares no such uniform, or\n * `IGX-0713` when `out` is too short.\n */\n getUniform(name: string, out?: Float32Array): number | Float32Array {\n const declaration = this.#uniform(name);\n const store = this.#values.get(name) ?? uniformStore(declaration);\n this.#values.set(name, store);\n if (store.length === 1 && out === undefined) {\n return store[0] ?? 0;\n }\n if (out === undefined) {\n return Float32Array.from(store);\n }\n if (out.length < store.length) {\n throw new IgnifxError(\n CoreErrorCode.shaderValueMismatch,\n `${name} on ${this.definition.name} expects ${String(store.length)} floats, not ${String(out.length)}.`,\n {\n context: { name, material: this.definition.name, expected: store.length, actual: out.length },\n hint: \"Pass an out array at least as long as the uniform's element count.\",\n },\n );\n }\n out.set(store);\n return out;\n }\n\n /**\n * Binds a texture to a declared sampler, or restores the declaration's fallback.\n *\n * @param name - The sampler's name.\n * @param texture - The texture, or `null` for the declared 1x1 fallback.\n * @throws IgnifxError with code `IGX-0712` when the shader declares no such sampler.\n */\n setTexture(name: string, texture: AssetHandle<TextureAsset> | null): void {\n const declaration = this.#texture(name);\n this.#textures.set(name, texture);\n this.#bindTexture(declaration, texture);\n }\n\n /**\n * Binds a storage buffer to a declared binding.\n *\n * @param name - The binding's name.\n * @param buffer - The buffer, or `null` to unbind. A material with an unbound declared storage\n * buffer cannot be drawn.\n * @throws IgnifxError with code `IGX-0712` when the shader declares no such storage buffer.\n */\n setStorageBuffer(name: string, buffer: AssetHandle<StorageBufferAsset> | null): void {\n const declared = this.#shader.declaration.storage;\n let found = false;\n for (let index = 0; index < declared.length; index += 1) {\n if (declared[index]?.name === name) {\n found = true;\n break;\n }\n }\n if (!found) {\n throw this.#unknownBinding(name, \"storage buffer\");\n }\n this.#storage.set(name, buffer);\n this.#bindStorage(name, buffer);\n }\n\n /**\n * Overrides a declared `define` and rebuilds the Babylon Lite material, because a define is a\n * WGSL `const` baked into the compiled pipeline.\n *\n * @remarks\n * The rebuild replaces the Lite material **object**. `MeshRenderer` re-reads\n * `MaterialAsset.lite.material` every `PreRender` and writes it onto its mesh when it changed,\n * and Lite's `mesh.material` setter enqueues a material swap that the next frame drains\n * (`lib/scene/mesh-scene-registry.js`), so the new pipeline is picked up on the following frame\n * with no explicit topology flag.\n *\n * @param name - The define's name.\n * @param value - The new value.\n * @throws IgnifxError with code `IGX-0712` when the shader declares no such define.\n */\n setDefine(name: string, value: boolean | number): void {\n const declared = this.#shader.declaration.defines;\n let fileValue: boolean | number | undefined;\n for (let index = 0; index < declared.length; index += 1) {\n const definition = declared[index];\n if (definition?.name === name) {\n fileValue = definition.value;\n break;\n }\n }\n if (fileValue === undefined) {\n throw this.#unknownBinding(name, \"define\");\n }\n // Compared against the value in force, not against the override map, so re-setting what the\n // file already declares is not a pipeline rebuild.\n if ((this.#defines.get(name) ?? fileValue) === value) {\n return;\n }\n this.#defines.set(name, value);\n this.#rebuild(this.#shader);\n }\n\n /**\n * Writes this frame's ignifx uniforms. The `PreRender` system calls it.\n *\n * @param time - Scaled seconds since `app.start()`.\n * @param unscaledTime - Unscaled seconds since `app.start()`.\n * @param deltaTime - Scaled seconds since the previous frame.\n * @param light - Nine floats: the main light's world direction, its linear colour times its\n * intensity, and the ambient colour.\n * @param hasLight - Whether an enabled directional light supplied the first six.\n */\n writeFrameUniforms(\n time: number,\n unscaledTime: number,\n deltaTime: number,\n light: Float32Array,\n hasLight: boolean,\n ): void {\n let lightChanged = this.#hasLight !== hasLight;\n this.#hasLight = hasLight;\n for (let index = 0; index < this.#light.length; index += 1) {\n if (this.#light[index] !== light[index]) {\n this.#light[index] = light[index] ?? 0;\n lightChanged = true;\n }\n }\n const slots = this.#engineSlots;\n for (let index = 0; index < slots.length; index += 1) {\n const slot = slots[index];\n if (slot === undefined) {\n continue;\n }\n switch (slot.name) {\n case \"time\":\n this.#writeScalar(slot.name, slot.store, time);\n break;\n case \"unscaledTime\":\n this.#writeScalar(slot.name, slot.store, unscaledTime);\n break;\n case \"deltaTime\":\n this.#writeScalar(slot.name, slot.store, deltaTime);\n break;\n case \"mainLightDirection\":\n if (lightChanged) {\n this.#writeTriple(slot.name, slot.store, light, DIRECTION_OFFSET);\n }\n break;\n case \"mainLightColor\":\n if (lightChanged) {\n this.#writeTriple(slot.name, slot.store, light, LIGHT_COLOR_OFFSET);\n }\n break;\n case \"ambientColor\":\n if (lightChanged) {\n this.#writeTriple(slot.name, slot.store, light, AMBIENT_OFFSET);\n }\n break;\n default:\n break;\n }\n }\n if (!hasLight && !this.#hasWarnedAboutLight && this.#needsLight()) {\n this.#hasWarnedAboutLight = true;\n const declared = this.#engineSlots.map((slot) => slot.name).join(\", \");\n this.#app.log.warnOnce(\n `${CoreErrorCode.shaderLightUniformWithoutLight}:${this.definition.name}`,\n `${CoreErrorCode.shaderLightUniformWithoutLight}: ${this.definition.name} declares ${declared}, ` +\n \"but this world has no enabled directional light; zeros are uploaded.\",\n );\n }\n }\n\n /**\n * Replays the definition's values, textures, defines, and storage bindings onto a freshly built\n * Babylon Lite material, and connects the hot-reload hook. Called once, by\n * {@link buildShaderMaterialState}.\n *\n * @param textures - The texture handles the loader resolved, in declaration order.\n */\n initialise(textures: readonly AssetHandle<TextureAsset>[]): void {\n const declaration = this.#shader.declaration;\n for (const name of Object.keys(this.definition.defines)) {\n const value = this.definition.defines[name];\n if (value !== undefined) {\n this.#defines.set(name, value);\n }\n }\n for (const name of Object.keys(this.definition.values)) {\n const value = this.definition.values[name];\n if (value !== undefined) {\n this.setUniform(name, value);\n }\n }\n const addresses = Object.keys(this.definition.textures);\n for (let index = 0; index < declaration.textures.length; index += 1) {\n const declared = declaration.textures[index];\n if (declared === undefined) {\n continue;\n }\n const slot = addresses.indexOf(declared.name);\n const handle = slot < 0 ? undefined : textures[slot];\n this.#textures.set(declared.name, handle ?? null);\n this.#bindTexture(declared, handle ?? null);\n }\n this.#refreshEngineSlots();\n if (this.isAnimated) {\n shaderMaterialsOf(this.#app).add(this);\n }\n const source = this.#app.assets.get<ShaderAsset>(this.definition.shader);\n this.#onReplaced =\n source?.onReplaced.connect((value: ShaderAsset): void => {\n this.#reload(value);\n }) ?? null;\n }\n\n /**\n * Stops the per-frame writes and the hot-reload hook. The `material` asset type's `unload` runs\n * it when the last holder releases the material.\n */\n dispose(): void {\n this.#onReplaced?.();\n this.#onReplaced = null;\n shaderMaterialsOf(this.#app).remove(this);\n }\n\n /**\n * Rebuilds the Lite material for a replaced shader file, keeping the previous one on failure.\n *\n * @param shader - The re-parsed shader asset.\n */\n #reload(shader: ShaderAsset): void {\n try {\n this.#rebuild(shader);\n this.#shader = shader;\n } catch (error: unknown) {\n this.#app.onError.emit({\n error: new IgnifxError(\n CoreErrorCode.shaderCompileFailed,\n `${shader.address} failed to rebuild; the previous material stays in use. ${String(error)}`,\n {\n context: { asset: shader.address, message: String(error) },\n cause: error,\n hint: \"Fix the shader file; the running material is the last one that built.\",\n },\n ),\n source: \"asset\",\n phase: null,\n entity: null,\n component: null,\n });\n }\n }\n\n /**\n * Builds a new Lite material from a declaration and replays every binding that still exists.\n *\n * @param shader - The shader to build from.\n */\n #rebuild(shader: ShaderAsset): void {\n const declaration = shader.declaration;\n const previous = this.#shader;\n // The Lite material is replaced halfway through, so a failure has to put the old one back or the\n // material would be left drawing a new program against the old declaration's bindings.\n const previousMaterial = this.#material;\n const previousValues = new Map(this.#values);\n this.#shader = shader;\n try {\n const values = new Map<string, Float32Array>();\n for (let index = 0; index < declaration.uniforms.length; index += 1) {\n const uniform = declaration.uniforms[index];\n if (uniform === undefined) {\n continue;\n }\n const kept = this.#values.get(uniform.name);\n values.set(\n uniform.name,\n kept !== undefined && kept.length === ELEMENT_COUNTS[uniform.type] ? kept : uniformStore(uniform),\n );\n }\n this.#material = buildLiteShaderMaterial(this.definition.name, shader, values, this.#resolveDefines(shader));\n this.#values.clear();\n for (const [name, store] of values) {\n this.#values.set(name, store);\n }\n this.#rebind(declaration);\n } catch (error: unknown) {\n this.#shader = previous;\n this.#material = previousMaterial;\n this.#values.clear();\n for (const [name, store] of previousValues) {\n this.#values.set(name, store);\n }\n throw error;\n }\n }\n\n /**\n * Re-applies the texture and storage bindings that the new declaration still has, dropping the\n * ones it no longer declares.\n *\n * @param declaration - The new declaration.\n */\n #rebind(declaration: ShaderDeclaration): void {\n const textures = new Map(this.#textures);\n this.#textures.clear();\n for (let index = 0; index < declaration.textures.length; index += 1) {\n const declared = declaration.textures[index];\n if (declared === undefined) {\n continue;\n }\n const handle = textures.get(declared.name) ?? null;\n this.#textures.set(declared.name, handle);\n this.#bindTexture(declared, handle);\n }\n const storage = new Map(this.#storage);\n this.#storage.clear();\n for (let index = 0; index < declaration.storage.length; index += 1) {\n const name = declaration.storage[index]?.name;\n if (name === undefined) {\n continue;\n }\n const handle = storage.get(name) ?? null;\n this.#storage.set(name, handle);\n this.#bindStorage(name, handle);\n }\n this.#refreshEngineSlots();\n const registry = shaderMaterialsOf(this.#app);\n if (this.isAnimated) {\n registry.add(this);\n } else {\n registry.remove(this);\n }\n this.#light.fill(Number.NaN);\n }\n\n /**\n * The declared `define` values with this material's overrides applied.\n *\n * @param shader - The shader whose declaration supplies the defaults.\n * @returns The resolved values.\n */\n #resolveDefines(shader: ShaderAsset): Readonly<Record<string, boolean | number>> {\n const resolved: Record<string, boolean | number> = {};\n const declared = shader.declaration.defines;\n for (let index = 0; index < declared.length; index += 1) {\n const define = declared[index];\n if (define === undefined) {\n continue;\n }\n setOwnJsonProperty(resolved, define.name, this.#defines.get(define.name) ?? define.value);\n }\n return resolved;\n }\n\n /**\n * Binds a texture, or the declaration's fallback when there is none.\n *\n * @param declaration - The sampler declaration.\n * @param handle - The texture handle, or `null`.\n */\n #bindTexture(declaration: ShaderTextureDeclaration, handle: AssetHandle<TextureAsset> | null): void {\n const loaded = handle?.state === \"loaded\" ? handle.value.lite.texture : null;\n this.#adapter.writeShaderTexture(\n this.#material,\n declaration.name,\n loaded ?? shaderMaterialsOf(this.#app).fallbackTexture(declaration),\n );\n }\n\n /**\n * Binds a storage buffer.\n *\n * @param name - The binding's name.\n * @param handle - The buffer handle, or `null`.\n */\n #bindStorage(name: string, handle: AssetHandle<StorageBufferAsset> | null): void {\n this.#adapter.writeShaderStorageBuffer(\n this.#material,\n name,\n handle?.state === \"loaded\" ? handle.value.lite.buffer : null,\n );\n }\n\n /**\n * Writes one CPU-side value through to Babylon Lite.\n *\n * @param name - The uniform's name.\n * @param store - The value.\n */\n #write(name: string, store: Float32Array): void {\n this.#adapter.writeShaderUniform(this.#material, name, store);\n }\n\n /**\n * Writes one engine-owned scalar uniform through its CPU-side store.\n *\n * @param name - The uniform's name.\n * @param store - The store, which is also what `getUniform` reads.\n * @param value - The value.\n */\n #writeScalar(name: string, store: Float32Array, value: number): void {\n store[0] = value;\n this.#adapter.writeShaderUniform(this.#material, name, store);\n }\n\n /**\n * Writes three floats of an engine-owned `vec3<f32>` uniform, without allocating.\n *\n * @param name - The uniform's name.\n * @param store - The store, which is also what `getUniform` reads.\n * @param source - The nine-float frame buffer.\n * @param offset - Where the triple starts inside it.\n */\n #writeTriple(name: string, store: Float32Array, source: Float32Array, offset: number): void {\n store.set(source.subarray(offset, offset + 3));\n this.#adapter.writeShaderUniform(this.#material, name, store);\n }\n\n /**\n * Resolves the CPU-side store of every ignifx-provided uniform the file declares, so the\n * per-frame write is an indexed loop with no name lookup (coding standards §7).\n */\n #refreshEngineSlots(): void {\n const slots = this.#engineSlots;\n slots.length = 0;\n const declared = this.#shader.declaration.ignifx;\n for (let index = 0; index < declared.length; index += 1) {\n const name = declared[index];\n if (name === undefined) {\n continue;\n }\n const count = ELEMENT_COUNTS[IGNIFX_UNIFORM_TYPES[name]];\n const store = this.#values.get(name) ?? new Float32Array(count);\n this.#values.set(name, store);\n slots.push({ name, store });\n }\n }\n\n /**\n * Whether the shader declares a uniform that needs a directional light.\n *\n * @returns `true` when `mainLightDirection` or `mainLightColor` is declared.\n */\n #needsLight(): boolean {\n const declared = this.#shader.declaration.ignifx;\n for (let index = 0; index < declared.length; index += 1) {\n const name = declared[index];\n if (name === \"mainLightDirection\" || name === \"mainLightColor\") {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Looks a custom uniform declaration up.\n *\n * @param name - The uniform's name.\n * @returns The declaration.\n * @throws IgnifxError with code `IGX-0712`.\n */\n #uniform(name: string): ShaderUniformDeclaration {\n const custom = this.#customUniform(name);\n if (custom !== null) {\n return custom;\n }\n const engine = this.#engineUniform(name);\n if (engine !== null) {\n return engine;\n }\n throw this.#unknownBinding(name, \"uniform\");\n }\n\n /**\n * Looks a custom uniform declaration up, refusing the ones the engine writes.\n *\n * @param name - The uniform's name.\n * @returns The declaration.\n * @throws IgnifxError with code `IGX-0712`.\n */\n #writableUniform(name: string): ShaderUniformDeclaration {\n const custom = this.#customUniform(name);\n if (custom !== null) {\n return custom;\n }\n if (ENGINE_UNIFORM_NAMES.includes(name)) {\n throw new IgnifxError(\n CoreErrorCode.unknownShaderBinding,\n `${name} on ${this.definition.name} is written by the engine every frame and cannot be set.`,\n {\n context: { material: this.definition.name, name },\n hint: \"System uniforms come from Babylon Lite and the ignifx uniforms from the PreRender system.\",\n },\n );\n }\n throw this.#unknownBinding(name, \"uniform\");\n }\n\n /**\n * The file's own declaration of a uniform, if it declares one by that name.\n *\n * @param name - The uniform's name.\n * @returns The declaration, or `null`.\n */\n #customUniform(name: string): ShaderUniformDeclaration | null {\n const declared = this.#shader.declaration.uniforms;\n for (let index = 0; index < declared.length; index += 1) {\n const uniform = declared[index];\n if (uniform !== undefined && uniform.name === name) {\n return uniform;\n }\n }\n return null;\n }\n\n /**\n * The synthetic declaration of an ignifx-provided uniform the file declared, so `getUniform` can\n * read back what the `PreRender` system wrote.\n *\n * @param name - The uniform's name.\n * @returns The declaration, or `null` when the file declares no such engine uniform.\n */\n #engineUniform(name: string): ShaderUniformDeclaration | null {\n const declared = this.#shader.declaration.ignifx;\n for (let index = 0; index < declared.length; index += 1) {\n const ignifx = declared[index];\n if (ignifx !== undefined && ignifx === name) {\n return {\n name: ignifx,\n type: IGNIFX_UNIFORM_TYPES[ignifx],\n defaultValue: zeros(ELEMENT_COUNTS[IGNIFX_UNIFORM_TYPES[ignifx]]),\n color: false,\n range: null,\n step: null,\n tooltip: null,\n };\n }\n }\n return null;\n }\n\n /**\n * Looks a sampler declaration up.\n *\n * @param name - The sampler's name.\n * @returns The declaration.\n * @throws IgnifxError with code `IGX-0712`.\n */\n #texture(name: string): ShaderTextureDeclaration {\n const declared = this.#shader.declaration.textures;\n for (let index = 0; index < declared.length; index += 1) {\n const texture = declared[index];\n if (texture !== undefined && texture.name === name) {\n return texture;\n }\n }\n throw this.#unknownBinding(name, \"texture\");\n }\n\n /**\n * Builds the `IGX-0712` failure an undeclared binding name produces.\n *\n * @param name - The name that was asked for.\n * @param what - What kind of binding was expected.\n * @returns The error to throw.\n */\n #unknownBinding(name: string, what: string): IgnifxError {\n return new IgnifxError(\n CoreErrorCode.unknownShaderBinding,\n `${this.definition.name} declares no ${what} named ${name}.`,\n {\n context: { material: this.definition.name, name },\n hint: `Declare it in ${this.#shader.address} with an // @ignifx ${what} pragma.`,\n },\n );\n }\n}\n\n/**\n * Builds the live state of a `\"shader\"` material: the Babylon Lite material, then every value,\n * texture, and define the definition names.\n *\n * @param app - The app that owns the engine, the log, and the registry.\n * @param shader - The shader the material sets values on.\n * @param definition - The declaration.\n * @param textures - The texture handles the loader resolved, in the order the definition's\n * `textures` record names them.\n * @returns The state.\n * @throws IgnifxError with code `IGX-0715` when the adapter has not been loaded, `IGX-0712` for an\n * undeclared value or define name, or `IGX-0713` for a value of the wrong shape.\n *\n * @internal\n */\nexport function buildShaderMaterialState(\n app: App,\n shader: ShaderAsset,\n definition: ShaderMaterialDefinition,\n textures: readonly AssetHandle<TextureAsset>[],\n): ShaderMaterialState {\n const defines: Record<string, boolean | number> = {};\n const declared = shader.declaration.defines;\n for (let index = 0; index < declared.length; index += 1) {\n const define = declared[index];\n if (define !== undefined) {\n const given = Object.hasOwn(definition.defines, define.name) ? definition.defines[define.name] : undefined;\n setOwnJsonProperty(defines, define.name, given ?? define.value);\n }\n }\n for (const name of Object.keys(definition.defines)) {\n if (!Object.hasOwn(defines, name)) {\n throw new IgnifxError(\n CoreErrorCode.unknownShaderBinding,\n `${definition.name} declares no define named ${name}.`,\n {\n context: { material: definition.name, name },\n hint: `Declare it in ${shader.address} with an // @ignifx define pragma.`,\n },\n );\n }\n }\n const material = buildLiteShaderMaterial(definition.name, shader, new Map(), defines);\n const state = new ShaderMaterialState(app, shader, definition, material, requireShaderMaterialAdapter(shader));\n state.initialise(textures);\n return state;\n}\n\n/**\n * Builds the Babylon Lite material a declaration describes, through the dynamically loaded adapter.\n *\n * @param name - The material's name.\n * @param shader - The shader.\n * @param values - Current custom uniform values to seed the declaration's defaults with.\n * @param defines - The resolved `define` values.\n * @returns The Lite material.\n * @throws IgnifxError with code `IGX-0715` when the adapter has not been loaded yet.\n */\nfunction buildLiteShaderMaterial(\n name: string,\n shader: ShaderAsset,\n values: ReadonlyMap<string, Float32Array>,\n defines: Readonly<Record<string, boolean | number>>,\n): LiteShaderMaterial {\n return requireShaderMaterialAdapter(shader).createShaderMaterialFromOptions(\n toShaderMaterialOptions(name, shader.source, shader.declaration, values, defines),\n );\n}\n\n/**\n * A number, or an array of that many zeros, matching what a uniform of that arity starts at.\n *\n * @param count - How many elements the uniform holds.\n * @returns The zero value.\n */\nfunction zeros(count: number): number | readonly number[] {\n if (count === 1) {\n return 0;\n }\n const values: number[] = [];\n for (let index = 0; index < count; index += 1) {\n values.push(0);\n }\n return values;\n}\n\n/**\n * A fresh CPU-side store for one uniform, filled with its declared default — **linear** for a\n * colour, because that is what the GPU reads.\n *\n * @param declaration - The uniform declaration.\n * @returns The store.\n */\nfunction uniformStore(declaration: ShaderUniformDeclaration): Float32Array {\n const count = ELEMENT_COUNTS[declaration.type];\n const store = new Float32Array(count);\n const value = declaration.defaultValue;\n if (typeof value === \"number\") {\n store[0] = value;\n } else {\n store.set(value.slice(0, count));\n }\n if (declaration.color) {\n decodeColourComponents(store);\n }\n return store;\n}\n\n/**\n * Writes a caller's value into a uniform's CPU-side store, checking its shape and decoding a\n * colour.\n *\n * @param store - The store to write into.\n * @param declaration - The uniform declaration.\n * @param value - The caller's value.\n * @param material - The material's name, for diagnostics.\n * @throws IgnifxError with code `IGX-0713` when the value's shape does not match the declared type.\n */\nfunction writeUniformValue(\n store: Float32Array,\n declaration: ShaderUniformDeclaration,\n value: number | readonly number[] | Float32Array | ColorLike,\n material: string,\n): void {\n const count = store.length;\n if (typeof value === \"number\") {\n if (count !== 1) {\n throw shapeMismatch(declaration, material, `${declaration.type} (${String(count)} floats)`, \"a single number\");\n }\n store[0] = value;\n return;\n }\n if (isColorLike(value)) {\n if (count !== 3 && count !== 4) {\n throw shapeMismatch(declaration, material, `${declaration.type} (${String(count)} floats)`, \"a colour\");\n }\n store[0] = Color.srgbToLinear(value.r);\n store[1] = Color.srgbToLinear(value.g);\n store[2] = Color.srgbToLinear(value.b);\n if (count === 4) {\n store[3] = value.a;\n }\n return;\n }\n if (value.length !== count) {\n throw shapeMismatch(\n declaration,\n material,\n `${declaration.type} (${String(count)} floats)`,\n `${String(value.length)} floats`,\n );\n }\n store.set(value instanceof Float32Array ? value : Float32Array.from(value));\n if (declaration.color) {\n decodeColourComponents(store);\n }\n}\n\n/**\n * Decodes a store's first three components from sRGB to linear, in place.\n *\n * @remarks\n * A `subarray` view and `map` rather than three indexed reads: a `Float32Array` element is typed\n * `number | undefined` under `noUncheckedIndexedAccess`, and `map` hands the callback a `number`.\n * It runs on a value write, never per frame.\n *\n * @param store - The store, at least three floats long.\n */\nfunction decodeColourComponents(store: Float32Array): void {\n const rgb = store.subarray(0, 3);\n rgb.set(rgb.map((component) => Color.srgbToLinear(component)));\n}\n\n/**\n * Whether a value is an sRGB colour rather than a numeric array.\n *\n * @param value - The candidate.\n * @returns `true` for an object carrying `r`, `g`, `b`, and `a`.\n */\nfunction isColorLike(value: readonly number[] | Float32Array | ColorLike): value is ColorLike {\n return !Array.isArray(value) && !(value instanceof Float32Array);\n}\n\n/**\n * Builds the `IGX-0713` failure a wrongly shaped value produces.\n *\n * @param declaration - The uniform declaration.\n * @param material - The material's name.\n * @param expected - What the uniform takes.\n * @param actual - What the caller passed.\n * @returns The error to throw.\n */\nfunction shapeMismatch(\n declaration: ShaderUniformDeclaration,\n material: string,\n expected: string,\n actual: string,\n): IgnifxError {\n return new IgnifxError(\n CoreErrorCode.shaderValueMismatch,\n `${declaration.name} on ${material} expects ${expected}, not ${actual}.`,\n {\n context: { name: declaration.name, material, expected, actual },\n hint: \"A colour uniform takes a ColorLike or its element count; every other uniform takes its element count.\",\n },\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAM,uBAA0C,OAAO,OAAO,CAAC,GAAG,2BAA2B,GAAG,oBAAoB,CAAC;;AAGrH,MAAM,eAAe;;AAGrB,MAAM,mBAAmB;;AAGzB,MAAM,qBAAqB;;AAG3B,MAAM,iBAAiB;;AAGvB,MAAM,iBAA8D,OAAO,OAAO;CAChF,KAAK;CACL,KAAK;CACL,KAAK;CACL,aAAa;CACb,aAAa;CACb,aAAa;CACb,eAAe;AACjB,CAAC;;;;;;;;;;AAWD,MAAM,sBAAqC,OAAO,OAAO;CACvD,OAAO,OAAO,OAAO;EAAE,WAAW;EAAO,WAAW;EAAuB,WAAW;CAAM,CAAC;CAC7F,OAAO,OAAO,OAAO;EAAE,WAAW;EAAO,WAAW;EAAuB,WAAW;CAAM,CAAC;AAC/F,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,SAAgB,wBACd,MACA,QACA,aACA,UACA,SAC4B;CAC5B,MAAM,UAAgC,CAAC;CAGvC,KAAK,MAAM,UAAU,YAAY,QAC/B,QAAQ,KAAK,MAAM;CAErB,KAAK,MAAM,UAAU,YAAY,QAAQ;EACvC,MAAM,OAAO,qBAAqB;EAClC,QAAQ,KAAK;GAAE,MAAM;GAAQ;GA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EhC;;;;;;;;;;;AAYA,SAAS,uBAAuB,OAA2B;CACzD,MAAM,MAAM,MAAM,SAAS,GAAG,CAAC;CAC/B,IAAI,IAAI,IAAI,KAAK,cAAc,MAAM,aAAa,SAAS,CAAC,CAAC;AAC/D;;;;;;;AAQA,SAAS,YAAY,OAAyE;CAC5F,OAAO,CAAC,MAAM,QAAQ,KAAK,KAAK,EAAE,iBAAiB;AACrD;;;;;;;;;;AAWA,SAAS,cACP,aACA,UACA,UACA,QACa;CACb,OAAO,IAAI,YACT,cAAc,qBACd,GAAG,YAAY,KAAK,MAAM,SAAS,WAAW,SAAS,QAAQ,OAAO,IACtE;EACE,SAAS;GAAE,MAAM,YAAY;GAAM;GAAU;GAAU;EAAO;EAC9D,MAAM;CACR,CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vec3-T2PasQZv.js","names":["updateMeshPositions","updateMeshNormals","updateMeshUvs","updateMeshColors"],"sources":["../src/math/mat4.ts","../src/lite/node.ts","../src/lite/gpu/mesh.ts","../src/math/vec3.ts"],"sourcesContent":["import { degToRad, EPSILON } from \"./math-utils.js\";\nimport type { Mat4Like, MutableQuat, MutableVec3, QuatLike, Vec3Like } from \"./types.js\";\n\n/**\n * The backing store of a {@link Mat4}: a `Float32Array` of exactly 16 elements, in column-major\n * order (`m[column * 4 + row]`). The `length: 16` refinement is what makes it a {@link Mat4Like},\n * and therefore what makes it accepted anywhere Babylon Lite wants a `Mat4`.\n *\n * @public\n */\nexport type Mat4Elements = Float32Array & { readonly length: 16 };\n\n/**\n * Allocates the 16-element column-major storage a matrix owns, pre-filled with zeroes.\n *\n * @returns Fresh, zeroed storage.\n */\nfunction allocateElements(): Mat4Elements {\n // The invariant is that this array is exactly 16\n // elements long, which `Float32Array`'s `length: number` cannot express. Babylon Lite brands its\n // own allocation the same way (`lib/math/_matrix-allocator.js`).\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return new Float32Array(16) as Mat4Elements;\n}\n\n/**\n * The determinant of the upper-left 3×3 basis. Its sign says whether the matrix mirrors, which is\n * how Babylon Lite decides the sign of the decomposed Y scale (`lib/math/mat4-decompose.js`).\n *\n * @param m - The matrix to measure.\n * @returns The 3×3 determinant.\n */\nfunction basisDeterminant(m: Mat4Like): number {\n const m0 = m[0] ?? 0;\n const m1 = m[1] ?? 0;\n const m2 = m[2] ?? 0;\n const m4 = m[4] ?? 0;\n const m5 = m[5] ?? 0;\n const m6 = m[6] ?? 0;\n const m8 = m[8] ?? 0;\n const m9 = m[9] ?? 0;\n const m10 = m[10] ?? 0;\n return m0 * (m5 * m10 - m6 * m9) + m1 * (m6 * m8 - m4 * m10) + m2 * (m4 * m9 - m5 * m8);\n}\n\n/**\n * Writes the unit quaternion of an orthonormal basis into `out`. Arguments are named row-major\n * (`b<row><column>`), matching Babylon Lite's `_quatFromRotationBasis`\n * (`lib/math/quat-from-rotation-matrix.js`), which this reproduces branch for branch.\n *\n * Shared with the quaternion module; not part of the public API.\n *\n * @param b00 - Row 0, column 0.\n * @param b01 - Row 0, column 1.\n * @param b02 - Row 0, column 2.\n * @param b10 - Row 1, column 0.\n * @param b11 - Row 1, column 1.\n * @param b12 - Row 1, column 2.\n * @param b20 - Row 2, column 0.\n * @param b21 - Row 2, column 1.\n * @param b22 - Row 2, column 2.\n * @param out - The quaternion to write.\n *\n * @internal\n */\nexport function basisToQuatToRef(\n b00: number,\n b01: number,\n b02: number,\n b10: number,\n b11: number,\n b12: number,\n b20: number,\n b21: number,\n b22: number,\n out: MutableQuat,\n): void {\n const trace = b00 + b11 + b22;\n if (trace > 0) {\n const s = 0.5 / Math.sqrt(trace + 1);\n out.set((b21 - b12) * s, (b02 - b20) * s, (b10 - b01) * s, 0.25 / s);\n return;\n }\n if (b00 > b11 && b00 > b22) {\n const s = 2 * Math.sqrt(1 + b00 - b11 - b22);\n out.set(0.25 * s, (b01 + b10) / s, (b02 + b20) / s, (b21 - b12) / s);\n return;\n }\n if (b11 > b22) {\n const s = 2 * Math.sqrt(1 + b11 - b00 - b22);\n out.set((b01 + b10) / s, 0.25 * s, (b12 + b21) / s, (b02 - b20) / s);\n return;\n }\n const s = 2 * Math.sqrt(1 + b22 - b00 - b11);\n out.set((b02 + b20) / s, (b12 + b21) / s, 0.25 * s, (b10 - b01) / s);\n}\n\n/**\n * A 4×4 transformation matrix stored column-major in a `Float32Array`, byte-compatible with WGSL's\n * `mat4x4<f32>` and with Babylon Lite's `Mat4` (translation in slots 12/13/14).\n *\n * ignifx is left-handed, Y up, +Z forward (ADR-0011), so the projection helpers are the `LH`\n * family and they use Lite's **reverse depth** convention: the near plane maps to 1 and the far\n * plane to 0.\n *\n * Instance methods mutate the matrix and return `this`; `ToRef` statics write into their `out`\n * matrix and allocate nothing, and are safe when `out` aliases an input. The remaining statics\n * allocate a fresh matrix and say so.\n *\n * @example\n * ```ts\n * const world = new Mat4();\n * Mat4.composeToRef(position, rotation, scale, world);\n *\n * const inverse = new Mat4();\n * if (Mat4.invertToRef(world, inverse)) {\n * Mat4.transformPointToRef(inverse, worldPoint, localPoint);\n * }\n * ```\n *\n * @public\n */\nexport class Mat4 {\n /**\n * The 16 elements, column-major (`elements[column * 4 + row]`). This is the object to hand to\n * anything that wants a {@link Mat4Like} — including Babylon Lite — and the buffer to upload to\n * the GPU. It is never reallocated, so a reference to it stays valid for the matrix's lifetime.\n */\n readonly elements: Mat4Elements;\n\n /**\n * Creates an identity matrix.\n */\n constructor() {\n const e = allocateElements();\n e[0] = 1;\n e[5] = 1;\n e[10] = 1;\n e[15] = 1;\n this.elements = e;\n }\n\n /**\n * Resets this matrix to the identity.\n *\n * @returns This matrix.\n */\n identity(): this {\n const e = this.elements;\n e[0] = 1;\n e[1] = 0;\n e[2] = 0;\n e[3] = 0;\n e[4] = 0;\n e[5] = 1;\n e[6] = 0;\n e[7] = 0;\n e[8] = 0;\n e[9] = 0;\n e[10] = 1;\n e[11] = 0;\n e[12] = 0;\n e[13] = 0;\n e[14] = 0;\n e[15] = 1;\n return this;\n }\n\n /**\n * Copies every element from another matrix.\n *\n * @param m - The matrix to read.\n * @returns This matrix.\n */\n copyFrom(m: Mat4Like): this {\n const e = this.elements;\n for (let i = 0; i < 16; i++) {\n e[i] = m[i] ?? 0;\n }\n return this;\n }\n\n /**\n * Copies this matrix into a new one.\n *\n * @returns A new matrix. **Allocates.**\n */\n clone(): Mat4 {\n return new Mat4().copyFrom(this.elements);\n }\n\n /**\n * Post-multiplies this matrix by another (`this = this * m`), so `m`'s transform is applied first\n * when the product acts on a column vector.\n *\n * @param m - The right-hand matrix.\n * @returns This matrix.\n */\n multiply(m: Mat4Like): this {\n Mat4.multiplyToRef(this.elements, m, this);\n return this;\n }\n\n /**\n * Inverts this matrix in place.\n *\n * @returns `true` on success. When the matrix is singular this returns `false` and leaves the\n * matrix untouched.\n */\n invert(): boolean {\n return Mat4.invertToRef(this.elements, this);\n }\n\n /**\n * Transposes this matrix in place, swapping rows and columns.\n *\n * @returns This matrix.\n */\n transpose(): this {\n Mat4.transposeToRef(this.elements, this);\n return this;\n }\n\n /**\n * The full 4×4 determinant of this matrix.\n *\n * @returns The determinant; zero means the matrix cannot be inverted.\n */\n determinant(): number {\n return Mat4.determinant(this.elements);\n }\n\n /**\n * Compares this matrix with another element by element, with a tolerance.\n *\n * @param m - The matrix to compare against.\n * @param epsilon - The largest per-element difference still considered equal.\n * @returns `true` when every element matches within `epsilon`.\n */\n equalsWithEpsilon(m: Mat4Like, epsilon: number = EPSILON): boolean {\n return Mat4.equalsWithEpsilon(this.elements, m, epsilon);\n }\n\n /**\n * Creates an identity matrix.\n *\n * @returns A new identity matrix. **Allocates.**\n */\n static identity(): Mat4 {\n return new Mat4();\n }\n\n /**\n * Creates a matrix holding a copy of another matrix's elements.\n *\n * @param m - The matrix to copy.\n * @returns A new matrix. **Allocates.**\n */\n static from(m: Mat4Like): Mat4 {\n return new Mat4().copyFrom(m);\n }\n\n /**\n * Builds a translation-rotation-scale matrix, the same composition order Babylon Lite's\n * `mat4Compose` uses (`translation * rotation * scale`).\n *\n * @param position - The translation, in metres.\n * @param rotation - The rotation; assumed to be a unit quaternion.\n * @param scale - The per-axis scale.\n * @returns A new matrix. **Allocates.**\n */\n static compose(position: Vec3Like, rotation: QuatLike, scale: Vec3Like): Mat4 {\n return Mat4.composeToRef(position, rotation, scale, new Mat4());\n }\n\n /**\n * Writes a translation-rotation-scale matrix into `out`.\n *\n * @param position - The translation, in metres.\n * @param rotation - The rotation; assumed to be a unit quaternion.\n * @param scale - The per-axis scale.\n * @param out - The matrix to write.\n * @returns `out`.\n *\n * @example\n * ```ts\n * Mat4.composeToRef(transform.localPosition, transform.localRotation, transform.localScale, local);\n * ```\n */\n static composeToRef(position: Vec3Like, rotation: QuatLike, scale: Vec3Like, out: Mat4): Mat4 {\n const qx = rotation.x;\n const qy = rotation.y;\n const qz = rotation.z;\n const qw = rotation.w;\n const sx = scale.x;\n const sy = scale.y;\n const sz = scale.z;\n const xx = qx * qx;\n const yy = qy * qy;\n const zz = qz * qz;\n const xy = qx * qy;\n const xz = qx * qz;\n const yz = qy * qz;\n const wx = qw * qx;\n const wy = qw * qy;\n const wz = qw * qz;\n const e = out.elements;\n e[0] = (1 - 2 * (yy + zz)) * sx;\n e[1] = 2 * (xy + wz) * sx;\n e[2] = 2 * (xz - wy) * sx;\n e[3] = 0;\n e[4] = 2 * (xy - wz) * sy;\n e[5] = (1 - 2 * (xx + zz)) * sy;\n e[6] = 2 * (yz + wx) * sy;\n e[7] = 0;\n e[8] = 2 * (xz + wy) * sz;\n e[9] = 2 * (yz - wx) * sz;\n e[10] = (1 - 2 * (xx + yy)) * sz;\n e[11] = 0;\n e[12] = position.x;\n e[13] = position.y;\n e[14] = position.z;\n e[15] = 1;\n return out;\n }\n\n /**\n * Splits an affine transformation-rotation-scale matrix back into its parts, using Babylon Lite's\n * convention (`lib/math/mat4-decompose.js`): scales are the lengths of the basis columns, and a\n * mirrored matrix (negative basis determinant) reports a **negative Y scale** rather than\n * silently dropping the reflection. Shear is not detected.\n *\n * @param m - The matrix to split.\n * @param outPosition - Receives the translation.\n * @param outRotation - Receives the rotation as a unit quaternion.\n * @param outScale - Receives the per-axis scale.\n * @returns `true` on success; `false` when a basis column has (near) zero length, in which case\n * the outputs are left untouched.\n *\n * @example\n * ```ts\n * Mat4.decomposeToRef(node.worldMatrix, position, rotation, scale);\n * ```\n */\n static decomposeToRef(\n m: Mat4Like,\n outPosition: MutableVec3,\n outRotation: MutableQuat,\n outScale: MutableVec3,\n ): boolean {\n const m0 = m[0] ?? 0;\n const m1 = m[1] ?? 0;\n const m2 = m[2] ?? 0;\n const m4 = m[4] ?? 0;\n const m5 = m[5] ?? 0;\n const m6 = m[6] ?? 0;\n const m8 = m[8] ?? 0;\n const m9 = m[9] ?? 0;\n const m10 = m[10] ?? 0;\n const sx = Math.hypot(m0, m1, m2);\n const syAbs = Math.hypot(m4, m5, m6);\n const sz = Math.hypot(m8, m9, m10);\n if (sx <= 1e-8 || syAbs <= 1e-8 || sz <= 1e-8) {\n return false;\n }\n const sy = basisDeterminant(m) < 0 ? -syAbs : syAbs;\n const invSx = 1 / sx;\n const invSy = 1 / sy;\n const invSz = 1 / sz;\n // Read the translation before writing anything, so `outPosition` may alias nothing dangerous.\n const tx = m[12] ?? 0;\n const ty = m[13] ?? 0;\n const tz = m[14] ?? 0;\n basisToQuatToRef(\n m0 * invSx,\n m4 * invSy,\n m8 * invSz,\n m1 * invSx,\n m5 * invSy,\n m9 * invSz,\n m2 * invSx,\n m6 * invSy,\n m10 * invSz,\n outRotation,\n );\n const qx = outRotation.x;\n const qy = outRotation.y;\n const qz = outRotation.z;\n const qw = outRotation.w;\n const invLength = 1 / Math.hypot(qx, qy, qz, qw);\n outRotation.set(qx * invLength, qy * invLength, qz * invLength, qw * invLength);\n outPosition.set(tx, ty, tz);\n outScale.set(sx, sy, sz);\n return true;\n }\n\n /**\n * Multiplies two matrices.\n *\n * @param a - The left-hand matrix.\n * @param b - The right-hand matrix.\n * @returns A new matrix holding `a * b`. **Allocates.**\n */\n static multiply(a: Mat4Like, b: Mat4Like): Mat4 {\n return Mat4.multiplyToRef(a, b, new Mat4());\n }\n\n /**\n * Writes `a * b` into `out`. Acting on a column vector, `b` is applied first.\n *\n * @param a - The left-hand matrix.\n * @param b - The right-hand matrix.\n * @param out - The matrix to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static multiplyToRef(a: Mat4Like, b: Mat4Like, out: Mat4): Mat4 {\n const a0 = a[0] ?? 0;\n const a1 = a[1] ?? 0;\n const a2 = a[2] ?? 0;\n const a3 = a[3] ?? 0;\n const a4 = a[4] ?? 0;\n const a5 = a[5] ?? 0;\n const a6 = a[6] ?? 0;\n const a7 = a[7] ?? 0;\n const a8 = a[8] ?? 0;\n const a9 = a[9] ?? 0;\n const a10 = a[10] ?? 0;\n const a11 = a[11] ?? 0;\n const a12 = a[12] ?? 0;\n const a13 = a[13] ?? 0;\n const a14 = a[14] ?? 0;\n const a15 = a[15] ?? 0;\n const b0 = b[0] ?? 0;\n const b1 = b[1] ?? 0;\n const b2 = b[2] ?? 0;\n const b3 = b[3] ?? 0;\n const b4 = b[4] ?? 0;\n const b5 = b[5] ?? 0;\n const b6 = b[6] ?? 0;\n const b7 = b[7] ?? 0;\n const b8 = b[8] ?? 0;\n const b9 = b[9] ?? 0;\n const b10 = b[10] ?? 0;\n const b11 = b[11] ?? 0;\n const b12 = b[12] ?? 0;\n const b13 = b[13] ?? 0;\n const b14 = b[14] ?? 0;\n const b15 = b[15] ?? 0;\n const e = out.elements;\n e[0] = a0 * b0 + a4 * b1 + a8 * b2 + a12 * b3;\n e[1] = a1 * b0 + a5 * b1 + a9 * b2 + a13 * b3;\n e[2] = a2 * b0 + a6 * b1 + a10 * b2 + a14 * b3;\n e[3] = a3 * b0 + a7 * b1 + a11 * b2 + a15 * b3;\n e[4] = a0 * b4 + a4 * b5 + a8 * b6 + a12 * b7;\n e[5] = a1 * b4 + a5 * b5 + a9 * b6 + a13 * b7;\n e[6] = a2 * b4 + a6 * b5 + a10 * b6 + a14 * b7;\n e[7] = a3 * b4 + a7 * b5 + a11 * b6 + a15 * b7;\n e[8] = a0 * b8 + a4 * b9 + a8 * b10 + a12 * b11;\n e[9] = a1 * b8 + a5 * b9 + a9 * b10 + a13 * b11;\n e[10] = a2 * b8 + a6 * b9 + a10 * b10 + a14 * b11;\n e[11] = a3 * b8 + a7 * b9 + a11 * b10 + a15 * b11;\n e[12] = a0 * b12 + a4 * b13 + a8 * b14 + a12 * b15;\n e[13] = a1 * b12 + a5 * b13 + a9 * b14 + a13 * b15;\n e[14] = a2 * b12 + a6 * b13 + a10 * b14 + a14 * b15;\n e[15] = a3 * b12 + a7 * b13 + a11 * b14 + a15 * b15;\n return out;\n }\n\n /**\n * Writes the inverse of `m` into `out`.\n *\n * @param m - The matrix to invert.\n * @param out - The matrix to write; may alias `m`. Left untouched when the inverse does not exist.\n * @returns `true` on success, `false` when `m` is singular. Returning a status rather than `null`\n * keeps the call allocation-free (coding standards §7).\n *\n * @example\n * ```ts\n * if (!Mat4.invertToRef(world, worldToLocal)) {\n * // degenerate scale — skip this entity\n * }\n * ```\n */\n static invertToRef(m: Mat4Like, out: Mat4): boolean {\n const a00 = m[0] ?? 0;\n const a01 = m[1] ?? 0;\n const a02 = m[2] ?? 0;\n const a03 = m[3] ?? 0;\n const a10 = m[4] ?? 0;\n const a11 = m[5] ?? 0;\n const a12 = m[6] ?? 0;\n const a13 = m[7] ?? 0;\n const a20 = m[8] ?? 0;\n const a21 = m[9] ?? 0;\n const a22 = m[10] ?? 0;\n const a23 = m[11] ?? 0;\n const a30 = m[12] ?? 0;\n const a31 = m[13] ?? 0;\n const a32 = m[14] ?? 0;\n const a33 = m[15] ?? 0;\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n const determinant = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n // Lite rejects at the same threshold (`lib/math/mat4-invert.js`), so both agree on which\n // matrices are singular.\n if (Math.abs(determinant) < 1e-10) {\n return false;\n }\n const inv = 1 / determinant;\n const e = out.elements;\n e[0] = (a11 * b11 - a12 * b10 + a13 * b09) * inv;\n e[1] = (a02 * b10 - a01 * b11 - a03 * b09) * inv;\n e[2] = (a31 * b05 - a32 * b04 + a33 * b03) * inv;\n e[3] = (a22 * b04 - a21 * b05 - a23 * b03) * inv;\n e[4] = (a12 * b08 - a10 * b11 - a13 * b07) * inv;\n e[5] = (a00 * b11 - a02 * b08 + a03 * b07) * inv;\n e[6] = (a32 * b02 - a30 * b05 - a33 * b01) * inv;\n e[7] = (a20 * b05 - a22 * b02 + a23 * b01) * inv;\n e[8] = (a10 * b10 - a11 * b08 + a13 * b06) * inv;\n e[9] = (a01 * b08 - a00 * b10 - a03 * b06) * inv;\n e[10] = (a30 * b04 - a31 * b02 + a33 * b00) * inv;\n e[11] = (a21 * b02 - a20 * b04 - a23 * b00) * inv;\n e[12] = (a11 * b07 - a10 * b09 - a12 * b06) * inv;\n e[13] = (a00 * b09 - a01 * b07 + a02 * b06) * inv;\n e[14] = (a31 * b01 - a30 * b03 - a32 * b00) * inv;\n e[15] = (a20 * b03 - a21 * b01 + a22 * b00) * inv;\n return true;\n }\n\n /**\n * Writes the transpose of `m` into `out`.\n *\n * @param m - The matrix to transpose.\n * @param out - The matrix to write; may alias `m`.\n * @returns `out`.\n */\n static transposeToRef(m: Mat4Like, out: Mat4): Mat4 {\n const m0 = m[0] ?? 0;\n const m1 = m[1] ?? 0;\n const m2 = m[2] ?? 0;\n const m3 = m[3] ?? 0;\n const m4 = m[4] ?? 0;\n const m5 = m[5] ?? 0;\n const m6 = m[6] ?? 0;\n const m7 = m[7] ?? 0;\n const m8 = m[8] ?? 0;\n const m9 = m[9] ?? 0;\n const m10 = m[10] ?? 0;\n const m11 = m[11] ?? 0;\n const m12 = m[12] ?? 0;\n const m13 = m[13] ?? 0;\n const m14 = m[14] ?? 0;\n const m15 = m[15] ?? 0;\n const e = out.elements;\n e[0] = m0;\n e[1] = m4;\n e[2] = m8;\n e[3] = m12;\n e[4] = m1;\n e[5] = m5;\n e[6] = m9;\n e[7] = m13;\n e[8] = m2;\n e[9] = m6;\n e[10] = m10;\n e[11] = m14;\n e[12] = m3;\n e[13] = m7;\n e[14] = m11;\n e[15] = m15;\n return out;\n }\n\n /**\n * The full 4×4 determinant.\n *\n * @param m - The matrix to measure.\n * @returns The determinant; zero means the matrix cannot be inverted.\n */\n static determinant(m: Mat4Like): number {\n const a00 = m[0] ?? 0;\n const a01 = m[1] ?? 0;\n const a02 = m[2] ?? 0;\n const a03 = m[3] ?? 0;\n const a10 = m[4] ?? 0;\n const a11 = m[5] ?? 0;\n const a12 = m[6] ?? 0;\n const a13 = m[7] ?? 0;\n const a20 = m[8] ?? 0;\n const a21 = m[9] ?? 0;\n const a22 = m[10] ?? 0;\n const a23 = m[11] ?? 0;\n const a30 = m[12] ?? 0;\n const a31 = m[13] ?? 0;\n const a32 = m[14] ?? 0;\n const a33 = m[15] ?? 0;\n const b00 = a00 * a11 - a01 * a10;\n const b01 = a00 * a12 - a02 * a10;\n const b02 = a00 * a13 - a03 * a10;\n const b03 = a01 * a12 - a02 * a11;\n const b04 = a01 * a13 - a03 * a11;\n const b05 = a02 * a13 - a03 * a12;\n const b06 = a20 * a31 - a21 * a30;\n const b07 = a20 * a32 - a22 * a30;\n const b08 = a20 * a33 - a23 * a30;\n const b09 = a21 * a32 - a22 * a31;\n const b10 = a21 * a33 - a23 * a31;\n const b11 = a22 * a33 - a23 * a32;\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n }\n\n /**\n * Builds a pure translation matrix.\n *\n * @param x - Translation along X, in metres.\n * @param y - Translation along Y, in metres.\n * @param z - Translation along Z, in metres.\n * @returns A new matrix. **Allocates.**\n */\n static translation(x: number, y: number, z: number): Mat4 {\n return Mat4.translationToRef(x, y, z, new Mat4());\n }\n\n /**\n * Writes a pure translation matrix into `out`.\n *\n * @param x - Translation along X, in metres.\n * @param y - Translation along Y, in metres.\n * @param z - Translation along Z, in metres.\n * @param out - The matrix to write.\n * @returns `out`.\n */\n static translationToRef(x: number, y: number, z: number, out: Mat4): Mat4 {\n const e = out.identity().elements;\n e[12] = x;\n e[13] = y;\n e[14] = z;\n return out;\n }\n\n /**\n * Builds a pure scaling matrix.\n *\n * @param x - Scale along X.\n * @param y - Scale along Y.\n * @param z - Scale along Z.\n * @returns A new matrix. **Allocates.**\n */\n static scaling(x: number, y: number, z: number): Mat4 {\n return Mat4.scalingToRef(x, y, z, new Mat4());\n }\n\n /**\n * Writes a pure scaling matrix into `out`.\n *\n * @param x - Scale along X.\n * @param y - Scale along Y.\n * @param z - Scale along Z.\n * @param out - The matrix to write.\n * @returns `out`.\n */\n static scalingToRef(x: number, y: number, z: number, out: Mat4): Mat4 {\n const e = out.identity().elements;\n e[0] = x;\n e[5] = y;\n e[10] = z;\n return out;\n }\n\n /**\n * Builds a pure rotation matrix from a quaternion.\n *\n * @param q - The rotation; assumed to be a unit quaternion.\n * @returns A new matrix. **Allocates.**\n */\n static fromQuat(q: QuatLike): Mat4 {\n return Mat4.fromQuatToRef(q, new Mat4());\n }\n\n /**\n * Writes a pure rotation matrix into `out`.\n *\n * @param q - The rotation; assumed to be a unit quaternion.\n * @param out - The matrix to write.\n * @returns `out`.\n */\n static fromQuatToRef(q: QuatLike, out: Mat4): Mat4 {\n return Mat4.composeToRef(ZERO_TRANSLATION, q, UNIT_SCALE, out);\n }\n\n /**\n * Builds a left-handed view matrix that places the camera at `eye` looking at `target`.\n *\n * @param eye - The camera position, in metres.\n * @param target - The point to look at, in metres.\n * @param up - The camera's up direction.\n * @returns A new matrix. **Allocates.**\n */\n static lookAtLH(eye: Vec3Like, target: Vec3Like, up: Vec3Like): Mat4 {\n return Mat4.lookAtLHToRef(eye, target, up, new Mat4());\n }\n\n /**\n * Writes a left-handed view matrix into `out`. Reproduces Babylon Lite's `mat4LookAtLHToRef`,\n * including its degenerate-input behaviour: when `eye` and `target` coincide, or when `up` is\n * parallel to the view direction, `out` becomes the identity.\n *\n * @param eye - The camera position, in metres.\n * @param target - The point to look at, in metres.\n * @param up - The camera's up direction.\n * @param out - The matrix to write.\n * @returns `out`.\n */\n static lookAtLHToRef(eye: Vec3Like, target: Vec3Like, up: Vec3Like, out: Mat4): Mat4 {\n const ex = eye.x;\n const ey = eye.y;\n const ez = eye.z;\n let zx = target.x - ex;\n let zy = target.y - ey;\n let zz = target.z - ez;\n const zLength = Math.hypot(zx, zy, zz);\n if (zLength < 1e-10) {\n return out.identity();\n }\n const invZ = 1 / zLength;\n zx *= invZ;\n zy *= invZ;\n zz *= invZ;\n let xx = up.y * zz - up.z * zy;\n let xy = up.z * zx - up.x * zz;\n let xz = up.x * zy - up.y * zx;\n const xLength = Math.hypot(xx, xy, xz);\n if (xLength < 1e-10) {\n return out.identity();\n }\n const invX = 1 / xLength;\n xx *= invX;\n xy *= invX;\n xz *= invX;\n const yx = zy * xz - zz * xy;\n const yy = zz * xx - zx * xz;\n const yz = zx * xy - zy * xx;\n const e = out.elements;\n e[0] = xx;\n e[1] = yx;\n e[2] = zx;\n e[3] = 0;\n e[4] = xy;\n e[5] = yy;\n e[6] = zy;\n e[7] = 0;\n e[8] = xz;\n e[9] = yz;\n e[10] = zz;\n e[11] = 0;\n e[12] = -(xx * ex + xy * ey + xz * ez);\n e[13] = -(yx * ex + yy * ey + yz * ez);\n e[14] = -(zx * ex + zy * ey + zz * ez);\n e[15] = 1;\n return out;\n }\n\n /**\n * Builds a left-handed perspective projection.\n *\n * @param fovDegrees - The vertical field of view, in degrees.\n * @param aspect - The viewport's width divided by its height.\n * @param near - The near plane distance, in metres.\n * @param far - The far plane distance, in metres.\n * @returns A new matrix. **Allocates.**\n */\n static perspectiveLH(fovDegrees: number, aspect: number, near: number, far: number): Mat4 {\n return Mat4.perspectiveLHToRef(fovDegrees, aspect, near, far, new Mat4());\n }\n\n /**\n * Writes a left-handed perspective projection into `out`, matching Babylon Lite's\n * `mat4PerspectiveLHToRef` — which is a **reverse-depth** projection: the near plane maps to\n * clip-space depth 1 and the far plane to 0, the arrangement that keeps float depth precise.\n *\n * @param fovDegrees - The vertical field of view, in degrees.\n * @param aspect - The viewport's width divided by its height.\n * @param near - The near plane distance, in metres.\n * @param far - The far plane distance, in metres.\n * @param out - The matrix to write.\n * @returns `out`.\n */\n static perspectiveLHToRef(fovDegrees: number, aspect: number, near: number, far: number, out: Mat4): Mat4 {\n const cot = 1 / Math.tan(degToRad(fovDegrees) * 0.5);\n const range = far - near;\n const e = out.elements;\n e[0] = cot / aspect;\n e[1] = 0;\n e[2] = 0;\n e[3] = 0;\n e[4] = 0;\n e[5] = cot;\n e[6] = 0;\n e[7] = 0;\n e[8] = 0;\n e[9] = 0;\n e[10] = -near / range;\n e[11] = 1;\n e[12] = 0;\n e[13] = 0;\n e[14] = (far * near) / range;\n e[15] = 0;\n return out;\n }\n\n /**\n * Builds a centred left-handed orthographic projection.\n *\n * @param width - The view width, in metres.\n * @param height - The view height, in metres.\n * @param near - The near plane distance, in metres.\n * @param far - The far plane distance, in metres.\n * @returns A new matrix. **Allocates.**\n */\n static orthoLH(width: number, height: number, near: number, far: number): Mat4 {\n return Mat4.orthoLHToRef(width, height, near, far, new Mat4());\n }\n\n /**\n * Writes a centred left-handed orthographic projection into `out`, with the same reverse-depth\n * convention as {@link Mat4.perspectiveLHToRef}.\n *\n * @param width - The view width, in metres.\n * @param height - The view height, in metres.\n * @param near - The near plane distance, in metres.\n * @param far - The far plane distance, in metres.\n * @param out - The matrix to write.\n * @returns `out`.\n */\n static orthoLHToRef(width: number, height: number, near: number, far: number, out: Mat4): Mat4 {\n const halfWidth = width * 0.5;\n const halfHeight = height * 0.5;\n return Mat4.orthoOffCenterLHToRef(-halfWidth, halfWidth, -halfHeight, halfHeight, near, far, out);\n }\n\n /**\n * Writes an off-centre left-handed orthographic projection into `out`, reproducing Babylon Lite's\n * `mat4OrthoOffCenterLHToRef` (reverse depth).\n *\n * @param left - The left clip plane, in metres.\n * @param right - The right clip plane, in metres.\n * @param bottom - The bottom clip plane, in metres.\n * @param top - The top clip plane, in metres.\n * @param near - The near plane distance, in metres.\n * @param far - The far plane distance, in metres.\n * @param out - The matrix to write.\n * @returns `out`.\n */\n static orthoOffCenterLHToRef(\n left: number,\n right: number,\n bottom: number,\n top: number,\n near: number,\n far: number,\n out: Mat4,\n ): Mat4 {\n const range = far - near;\n const e = out.elements;\n e[0] = 2 / (right - left);\n e[1] = 0;\n e[2] = 0;\n e[3] = 0;\n e[4] = 0;\n e[5] = 2 / (top - bottom);\n e[6] = 0;\n e[7] = 0;\n e[8] = 0;\n e[9] = 0;\n e[10] = -1 / range;\n e[11] = 0;\n e[12] = (left + right) / (left - right);\n e[13] = (top + bottom) / (bottom - top);\n e[14] = far / range;\n e[15] = 1;\n return out;\n }\n\n /**\n * Reads a matrix's translation.\n *\n * @param m - The matrix to read.\n * @param out - The vector to write.\n * @returns `out`.\n */\n static getTranslationToRef<TOut extends MutableVec3>(m: Mat4Like, out: TOut): TOut {\n out.set(m[12] ?? 0, m[13] ?? 0, m[14] ?? 0);\n return out;\n }\n\n /**\n * Reads a matrix's per-axis scale as the lengths of its basis columns, negating Y for a mirrored\n * matrix exactly as {@link Mat4.decomposeToRef} does.\n *\n * @param m - The matrix to read.\n * @param out - The vector to write.\n * @returns `out`.\n */\n static getScaleToRef<TOut extends MutableVec3>(m: Mat4Like, out: TOut): TOut {\n const sx = Math.hypot(m[0] ?? 0, m[1] ?? 0, m[2] ?? 0);\n const syAbs = Math.hypot(m[4] ?? 0, m[5] ?? 0, m[6] ?? 0);\n const sz = Math.hypot(m[8] ?? 0, m[9] ?? 0, m[10] ?? 0);\n out.set(sx, basisDeterminant(m) < 0 ? -syAbs : syAbs, sz);\n return out;\n }\n\n /**\n * Reads a matrix's rotation, dividing the scale out of the basis first.\n *\n * @param m - The matrix to read.\n * @param out - The quaternion to write. Left untouched when a basis column has zero length.\n * @returns `out`.\n */\n static getRotationToRef<TOut extends MutableQuat>(m: Mat4Like, out: TOut): TOut {\n const m0 = m[0] ?? 0;\n const m1 = m[1] ?? 0;\n const m2 = m[2] ?? 0;\n const m4 = m[4] ?? 0;\n const m5 = m[5] ?? 0;\n const m6 = m[6] ?? 0;\n const m8 = m[8] ?? 0;\n const m9 = m[9] ?? 0;\n const m10 = m[10] ?? 0;\n const sx = Math.hypot(m0, m1, m2);\n const syAbs = Math.hypot(m4, m5, m6);\n const sz = Math.hypot(m8, m9, m10);\n if (sx <= 1e-8 || syAbs <= 1e-8 || sz <= 1e-8) {\n return out;\n }\n const invSx = 1 / sx;\n const invSy = 1 / (basisDeterminant(m) < 0 ? -syAbs : syAbs);\n const invSz = 1 / sz;\n basisToQuatToRef(\n m0 * invSx,\n m4 * invSy,\n m8 * invSz,\n m1 * invSx,\n m5 * invSy,\n m9 * invSz,\n m2 * invSx,\n m6 * invSy,\n m10 * invSz,\n out,\n );\n const invLength = 1 / Math.hypot(out.x, out.y, out.z, out.w);\n out.set(out.x * invLength, out.y * invLength, out.z * invLength, out.w * invLength);\n return out;\n }\n\n /**\n * Transforms a point by a matrix, applying translation and the perspective divide.\n *\n * @param m - The transformation.\n * @param point - The point to transform, in metres.\n * @param out - The vector to write; may alias `point`.\n * @returns `out`.\n */\n static transformPointToRef<TOut extends MutableVec3>(m: Mat4Like, point: Vec3Like, out: TOut): TOut {\n const x = point.x;\n const y = point.y;\n const z = point.z;\n const rx = x * (m[0] ?? 0) + y * (m[4] ?? 0) + z * (m[8] ?? 0) + (m[12] ?? 0);\n const ry = x * (m[1] ?? 0) + y * (m[5] ?? 0) + z * (m[9] ?? 0) + (m[13] ?? 0);\n const rz = x * (m[2] ?? 0) + y * (m[6] ?? 0) + z * (m[10] ?? 0) + (m[14] ?? 0);\n const invW = 1 / (x * (m[3] ?? 0) + y * (m[7] ?? 0) + z * (m[11] ?? 0) + (m[15] ?? 0));\n out.set(rx * invW, ry * invW, rz * invW);\n return out;\n }\n\n /**\n * Transforms a direction by a matrix, ignoring translation. Note that this is the plain basis\n * transform: a non-uniformly scaled matrix needs its inverse-transpose to keep normals correct.\n *\n * @param m - The transformation.\n * @param direction - The direction to transform.\n * @param out - The vector to write; may alias `direction`.\n * @returns `out`.\n */\n static transformDirectionToRef<TOut extends MutableVec3>(m: Mat4Like, direction: Vec3Like, out: TOut): TOut {\n const x = direction.x;\n const y = direction.y;\n const z = direction.z;\n out.set(\n x * (m[0] ?? 0) + y * (m[4] ?? 0) + z * (m[8] ?? 0),\n x * (m[1] ?? 0) + y * (m[5] ?? 0) + z * (m[9] ?? 0),\n x * (m[2] ?? 0) + y * (m[6] ?? 0) + z * (m[10] ?? 0),\n );\n return out;\n }\n\n /**\n * Compares two matrices element by element, with a tolerance.\n *\n * @param a - The first matrix.\n * @param b - The second matrix.\n * @param epsilon - The largest per-element difference still considered equal.\n * @returns `true` when every element matches within `epsilon`.\n */\n static equalsWithEpsilon(a: Mat4Like, b: Mat4Like, epsilon: number = EPSILON): boolean {\n for (let i = 0; i < 16; i++) {\n if (Math.abs((a[i] ?? 0) - (b[i] ?? 0)) > epsilon) {\n return false;\n }\n }\n return true;\n }\n}\n\n/**\n * The zero translation {@link Mat4.fromQuatToRef} composes with. Module-scope constant, frozen so it\n * can never be written through.\n */\nconst ZERO_TRANSLATION: Vec3Like = Object.freeze({ x: 0, y: 0, z: 0 });\n\n/**\n * The unit scale {@link Mat4.fromQuatToRef} composes with.\n */\nconst UNIT_SCALE: Vec3Like = Object.freeze({ x: 1, y: 1, z: 1 });\n\n/**\n * A frozen identity matrix, for the common case of \"no transform\". It is a plain {@link Mat4Like}\n * rather than a {@link Mat4} because a `Float32Array` cannot be frozen — pass it to anything that\n * reads a matrix, and use `new Mat4()` when you need one you can write to.\n *\n * @example\n * ```ts\n * Mat4.transformPointToRef(MAT4_IDENTITY, point, out); // copies the point\n * ```\n *\n * @public\n */\nexport const MAT4_IDENTITY: Mat4Like = Object.freeze({\n length: 16,\n 0: 1,\n 1: 0,\n 2: 0,\n 3: 0,\n 4: 0,\n 5: 1,\n 6: 0,\n 7: 0,\n 8: 0,\n 9: 0,\n 10: 1,\n 11: 0,\n 12: 0,\n 13: 0,\n 14: 0,\n 15: 1,\n} as const);\n","import {\n createTransformNode,\n decomposeMat4,\n setParent,\n setSubtreeVisible,\n type IWorldMatrixProvider,\n type SceneNode,\n} from \"@babylonjs/lite\";\nimport type { MutableQuat, MutableVec3 } from \"../math/types.js\";\n\n/**\n * Scene-graph half of the Babylon Lite adapter: the transform node primitives the kernel's\n * `Transform` component is built from (`docs/architecture/02-scene-graph.md` §5, §5.1). Together\n * with the other files in this directory it is the only place in the package allowed to import\n * `@babylonjs/lite` (`CONSTITUTION.md` §3.4, coding standards §4).\n *\n * Everything here is `@internal`: the kernel decides what becomes public API and what stays behind\n * `Transform`. Nothing in this file is re-exported from `src/index.ts`.\n *\n * ## How Lite computes `worldMatrix` (verified against `@babylonjs/lite@1.27.0`\n * `lib/scene/world-matrix-state.js` and `lib/scene/scene-node.js`)\n *\n * Every node owns a *world-matrix state* holding a cached world matrix, a version counter, a\n * parent link, and a list of the states of the children that were linked through that parent\n * property. The rules that follow from the source are:\n *\n * 1. Writing any TRS value calls the node's dirty hook, which clears the cache, increments the\n * version, and **recursively invalidates every linked descendant** — invalidation is pushed\n * down eagerly, not polled.\n * 2. `ObservableVec3`/`ObservableQuat` per-component setters only fire that hook when the value\n * actually changes; the bulk `set(...)`/`copyFrom(...)` methods fire it unconditionally. So\n * `node.position.x = node.position.x` does not bump the version, while\n * `node.position.set(sameX, sameY, sameZ)` does.\n * 3. `worldMatrix` is a getter. On a cache miss it composes the local matrix from TRS and, when a\n * parent is linked, returns `parentWorld × local` (column-major; translation in elements\n * 12/13/14). A node with no parent returns its local matrix directly.\n * 4. A parent that is a plain {@link IWorldMatrixProvider} rather than a Lite scene node (a camera,\n * for instance) cannot be invalidated eagerly, so the child polls `parent.worldMatrixVersion`\n * on every `worldMatrix` and `worldMatrixVersion` read instead.\n * 5. Nothing in that path touches the scene: a transform node never needs `addToScene` for its\n * matrices to be correct. Only renderable objects do (`docs/architecture/02-scene-graph.md`\n * §5.1).\n */\n\n/**\n * A mutable `{ x, y, z }` accepted as an output parameter. Deliberately the minimal shape: Lite's\n * `Vec3`, the math module's `MutableVec3` (which adds `set`/`copyFrom`), a live `ObservableVec3` over\n * a node's TRS, and a plain object literal all satisfy it, so nothing has to be converted.\n *\n * @internal\n */\nexport interface MutableVec3Like {\n /** The x component. */\n x: number;\n /** The y component. */\n y: number;\n /** The z component. */\n z: number;\n}\n\n/**\n * A mutable `{ x, y, z, w }` accepted as an output parameter. The minimal shape, for the same reason\n * as {@link MutableVec3Like}: Lite's `Quat`, the math module's `MutableQuat`, and a plain object\n * literal all satisfy it.\n *\n * @internal\n */\nexport interface MutableQuatLike {\n /** The x component of the quaternion's vector part. */\n x: number;\n /** The y component of the quaternion's vector part. */\n y: number;\n /** The z component of the quaternion's vector part. */\n z: number;\n /** The scalar part. */\n w: number;\n}\n\n/**\n * A writable 16-element matrix sink in column-major order. `Float32Array` (including the math\n * module's `Mat4.elements`), `Float64Array`, and a plain `number[]` all satisfy it, which is why\n * `length` is a plain `number`: `Float32Array` cannot express the literal `16` that Lite's read-only\n * `Mat4` and the math module's `Mat4Like` declare.\n *\n * @internal\n */\nexport interface MutableMat4Like {\n /** Element count; callers must supply at least 16 slots. */\n readonly length: number;\n /** Column-major element access. */\n [index: number]: number;\n}\n\n/**\n * The ignifx identity written into a Lite node's metadata bag so picking results and physics bodies\n * resolve back to the owning entity (`docs/architecture/00-overview.md` §5,\n * `docs/architecture/02-scene-graph.md` §10).\n *\n * @internal\n */\nexport interface NodeTag {\n /** The dense runtime handle of the entity that owns the node. */\n readonly entity: number;\n /** The component that created the node, when the node is not the entity's own transform. */\n readonly component?: number;\n}\n\n/** The single key ignifx owns inside Lite's open `metadata` record. */\nconst METADATA_KEY = \"ignifx\";\n\n/** Number of elements in a 4x4 matrix. */\nconst MATRIX_LENGTH = 16;\n\n/**\n * Creates a pure transform node at the origin with an identity rotation and unit scale.\n *\n * @remarks\n * The node is deliberately **not** added to any Lite scene: a transform node is only a matrix\n * provider, and `worldMatrix` is valid the moment the node exists (see rule 5 in the module\n * documentation). Renderable Lite objects created by components are parented under it and added\n * with `addToScene` separately.\n *\n * @param name - A human-readable name; Lite never uses it for lookup and it need not be unique.\n * @returns A fresh, unparented transform node.\n *\n * @example\n * ```ts\n * const node = createNode(\"Player\");\n * node.position.set(1, 2, 3);\n * ```\n *\n * @internal\n */\nexport function createNode(name: string): SceneNode {\n return createTransformNode(name);\n}\n\n/**\n * Releases a pure transform node.\n *\n * @remarks\n * Lite requires nothing to release a transform node that was never added to a scene: verified in\n * `lib/scene/transform-node.js` and `lib/scene/scene-node.js`, the node is a plain object holding\n * three observable values, one `Float32Array` for the cached world matrix, and closures — no GPU\n * resource, no ref count, no scene registry. (Reference counting in `lib/resource/ref-count.js`\n * applies to meshes and their GPU buffers only, and `disposeScene` never walks transform nodes.)\n *\n * What *does* need doing is breaking the parent link: a linked parent keeps a reference to this\n * node's world-matrix state so it can invalidate it, so a node dropped while still parented is\n * retained by its parent. This function therefore unlinks the node and drops the ignifx tag. It\n * leaves the node's own `children` alone: the kernel destroys children before parents\n * (`docs/architecture/01-lifecycle-and-time.md` §3 step 9), so each child unlinks itself first.\n *\n * @param node - A node from {@link createNode}.\n *\n * @internal\n */\nexport function disposeNode(node: SceneNode): void {\n linkParent(node, null);\n const metadata = node.metadata;\n if (metadata !== undefined) {\n delete metadata[METADATA_KEY];\n }\n}\n\n/**\n * Links `child` under `parent`, **keeping the child's local values** — its world transform moves\n * with the new parent. This is `setParent(parent, { worldPositionStays: false })` in\n * `docs/architecture/02-scene-graph.md` §5.1.\n *\n * @remarks\n * Lite has no public helper for this case (its own `setParent` preserves the world transform), so\n * the adapter does the linking itself: it assigns `child.parent`, which is the setter that\n * re-registers the child's world-matrix state with the new parent and invalidates the subtree, and\n * maintains the `children` arrays on both the old and the new parent so tree traversal stays\n * consistent. Passing the parent the child already has is a no-op.\n *\n * @param child - The node to move.\n * @param parent - The new parent, or `null` to detach the child to world space.\n *\n * @example\n * ```ts\n * linkParent(child, parent); // child keeps localPosition; its world position changes\n * ```\n *\n * @internal\n */\nexport function linkParent(child: SceneNode, parent: SceneNode | null): void {\n const previous = child.parent;\n if (previous === parent) {\n return;\n }\n const previousChildren = childrenOf(previous);\n if (previousChildren !== null) {\n const index = previousChildren.indexOf(child);\n if (index >= 0) {\n previousChildren.splice(index, 1);\n }\n }\n // The setter, not a field write: it swaps the world-matrix state's parent, re-registers this\n // node in the new parent's invalidation list, and bumps `worldMatrixVersion` down the subtree.\n child.parent = parent;\n if (parent !== null && !parent.children.includes(child)) {\n parent.children.push(child);\n }\n}\n\n/**\n * Reparents `child` under `parent` **keeping its world transform**, by delegating to Lite's own\n * `setParent`. This is `setParent(parent, { worldPositionStays: true })`, the ignifx default\n * (`docs/architecture/02-scene-graph.md` §5.1).\n *\n * @remarks\n * Lite snapshots the child's world matrix, relinks the node (maintaining both `children` arrays),\n * then decomposes `inverse(parentWorld) × childWorld` back into local TRS. Two documented caveats\n * carry straight through to ignifx:\n *\n * - **Singular parent matrices.** When the parent's world matrix has a collapsed axis it cannot be\n * inverted, so no local transform can reproduce the child's world. Lite then keeps the parent\n * link and copies the child's world *position* into its local position, leaving rotation and\n * scale uncompensated. Non-uniform-but-invertible parents are fine; zero scale on any axis is\n * not.\n * - **Canonical, not sign-faithful, decomposition.** The local TRS comes from `decomposeMat4`,\n * which folds a reflection into a negative Y scale. The world matrix is reproduced exactly, but a\n * child that had a negative X scale comes back with a negative Y scale and a different rotation.\n *\n * A third caveat in Lite's TSDoc — that `child.parent` links are only established by `addToScene`,\n * so a node from a freshly loaded asset must have its container added before it is reparented —\n * does not apply to nodes ignifx creates, because {@link linkParent} establishes the link itself.\n *\n * @param child - The node to move.\n * @param parent - The new parent, or `null` to detach the child to world space.\n *\n * @internal\n */\nexport function reparentKeepingWorld(child: SceneNode, parent: SceneNode | null): void {\n setParent(child, parent);\n}\n\n/**\n * Copies a node's world matrix into `out`.\n *\n * @remarks\n * Allocation-free on the ignifx side, which is why the destination is a parameter: Lite's\n * `worldMatrix` getter may recompute up the parent chain, and the object it returns is Lite's own\n * cache — never hold on to it. Lite documents `Mat4` as opaque (\"callers MUST NOT depend on the\n * underlying storage\"); it is a `Float32Array` in 1.27.0 (`lib/math/_matrix-allocator.js`), so\n * copying element by element is the only supported read.\n *\n * @param node - The node to read.\n * @param out - A sink of at least 16 elements, written in column-major order.\n * @returns `out`, for chaining.\n *\n * @internal\n */\nexport function readWorldMatrix(node: SceneNode, out: MutableMat4Like): MutableMat4Like {\n const matrix = node.worldMatrix;\n for (let index = 0; index < MATRIX_LENGTH; index += 1) {\n out[index] = matrix[index] ?? 0;\n }\n return out;\n}\n\n/**\n * Reads a node's world-matrix version — the counter that increases whenever the node's world\n * matrix is invalidated, by its own TRS or by any ancestor's.\n *\n * @remarks\n * Snapshot it to detect movement without comparing matrices; systems that maintain acceleration\n * structures do exactly that (`docs/architecture/02-scene-graph.md` §9). The counter is\n * monotonically increasing but not a change *count*: it moves on invalidation, not on\n * recomputation, and a bulk `position.set(...)` bumps it even when the values are unchanged.\n *\n * @param node - The node to read.\n * @returns The current version.\n *\n * @internal\n */\nexport function worldMatrixVersion(node: SceneNode): number {\n return node.worldMatrixVersion;\n}\n\n/**\n * Decomposes a node's world matrix into translation, rotation, and scale, writing into the three\n * output parameters.\n *\n * @remarks\n * The decomposition is canonical rather than sign-faithful: a mirror is folded into a negative Y\n * scale, so recomposing reproduces the matrix but a matrix built from a negative X or Z scale comes\n * back as a negative Y scale plus a different rotation. A degenerate axis (scale below `1e-8`) is\n * tolerated: the rotation stays finite but is meaningless for that axis.\n *\n * ignifx allocates nothing here, but Lite's `decomposeMat4` allocates its own TRS triple per call\n * (`lib/math/mat4-decompose.js`), so this is not yet a zero-allocation path in the sense of coding\n * standards §7. The math module's in-place decomposition replaces the Lite call when it lands.\n *\n * @param node - The node to read.\n * @param outPosition - Receives the world translation.\n * @param outRotation - Receives the world rotation as a unit quaternion.\n * @param outScale - Receives the per-axis world scale.\n *\n * @internal\n */\nexport function decomposeWorld(\n node: SceneNode,\n outPosition: MutableVec3Like,\n outRotation: MutableQuatLike,\n outScale: MutableVec3Like,\n): void {\n const decomposed = decomposeMat4(node.worldMatrix);\n outPosition.x = decomposed.translation.x;\n outPosition.y = decomposed.translation.y;\n outPosition.z = decomposed.translation.z;\n outRotation.x = decomposed.rotation.x;\n outRotation.y = decomposed.rotation.y;\n outRotation.z = decomposed.rotation.z;\n outRotation.w = decomposed.rotation.w;\n outScale.x = decomposed.scale.x;\n outScale.y = decomposed.scale.y;\n outScale.z = decomposed.scale.z;\n}\n\n/**\n * Shows or hides a node and its whole subtree.\n *\n * @remarks\n * Lite materializes the cascade at write time — it walks `children` and writes `visible` on every\n * descendant — so a node added to the subtree afterwards does not inherit the state and must be\n * set separately. This is how entity deactivation hides render objects\n * (`docs/architecture/01-lifecycle-and-time.md` §6); removing a mesh from its last scene disposes\n * it permanently, so visibility, never removal, is the deactivation path.\n *\n * @param node - The subtree root.\n * @param visible - `true` to show the subtree, `false` to hide it.\n *\n * @internal\n */\nexport function setNodeVisible(node: SceneNode, visible: boolean): void {\n setSubtreeVisible(node, visible);\n}\n\n/**\n * Shows or hides **one** node, without touching its subtree.\n *\n * @remarks\n * Lite's `visible` is per node — the renderer reads each node's own flag, and `setSubtreeVisible`\n * is only a bulk helper that materialises a cascade at write time. ignifx already materialises\n * `activeInHierarchy` over the subtree itself, so it writes one flag per entity: correct for a\n * subtree that mixes active and inactive entities, and linear rather than quadratic.\n *\n * @param node - The node to show or hide.\n * @param visible - `true` to show it, `false` to hide it.\n *\n * @internal\n */\nexport function setNodeSelfVisible(node: SceneNode, visible: boolean): void {\n node.visible = visible;\n}\n\n/**\n * Writes the ignifx identity into a node's Lite metadata bag, under the single `ignifx` key.\n *\n * @remarks\n * `LiteMetadata` is an open record (`{ gltf?: GltfMetadata; [key: string]: unknown }`), so the tag\n * coexists with the `gltf.extras` a glTF load writes. The metadata object is created on demand;\n * nodes ignifx never tags keep `metadata` undefined.\n *\n * @param node - The node to tag.\n * @param tag - The owning entity, and the component that created the node when it is not the\n * entity's own transform.\n *\n * @internal\n */\nexport function tagNode(node: SceneNode, tag: NodeTag): void {\n const metadata = (node.metadata ??= {});\n metadata[METADATA_KEY] = tag;\n}\n\n/**\n * Reads the ignifx identity back from a node.\n *\n * @param node - The node to read; it may be any Lite node, including one ignifx never created.\n * @returns The tag {@link tagNode} wrote, or `null` when the node carries none.\n *\n * @internal\n */\nexport function readNodeTag(node: SceneNode): NodeTag | null {\n const metadata = node.metadata;\n if (metadata === undefined) {\n return null;\n }\n const value = metadata[METADATA_KEY];\n if (typeof value !== \"object\" || value === null || !(\"entity\" in value)) {\n return null;\n }\n const entity = value.entity;\n if (typeof entity !== \"number\") {\n return null;\n }\n const component = \"component\" in value ? value.component : undefined;\n return typeof component === \"number\" ? { entity, component } : { entity };\n}\n\n/**\n * The `children` array of a world-matrix provider, when it has one.\n *\n * @remarks\n * `SceneNode.parent` is typed as the minimal {@link IWorldMatrixProvider}, which declares no\n * `children`, but every parent ignifx links is a scene node. Lite's own `setParent` solves this the\n * same way (`lib/scene/set-parent.js`), and the array check keeps a non-node provider — a camera,\n * say — from being treated as a tree node.\n *\n * @param provider - The candidate parent.\n * @returns The provider's children, or `null` when it is not a tree node.\n */\nfunction childrenOf(provider: IWorldMatrixProvider | null): SceneNode[] | null {\n if (provider === null || !(\"children\" in provider)) {\n return null;\n }\n const children = provider.children;\n // The invariant is that a world-matrix provider with\n // an array-valued `children` is a `SceneNode`, which is what Lite itself assumes here.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return Array.isArray(children) ? (children as SceneNode[]) : null;\n}\n\n/**\n * The Babylon Lite node an ignifx `Transform` wraps, re-exported under an ignifx name so that\n * feature code can name the type without importing `@babylonjs/lite`\n * (`CONSTITUTION.md` §3.4, coding standards §4).\n *\n * @remarks\n * Unstable: it is Lite's type, reachable only through documented `.lite` escape hatches, and it is\n * excluded from the stability guarantees of `CONSTITUTION.md` Article IV.\n *\n * @public\n */\nexport type LiteSceneNode = SceneNode;\n\n/**\n * The node's local position as a live, writable view.\n *\n * @remarks\n * Zero-copy: the returned object *is* Lite's `ObservableVec3` over the node's TRS, so `.x += 1`,\n * `.set(x, y, z)`, and `.copyFrom(v)` write straight through and invalidate the subtree's world\n * matrices (`docs/architecture/02-scene-graph.md` §5). Never hold it past the node's lifetime.\n *\n * @param node - The node to view.\n * @returns The live local position.\n *\n * @internal\n */\nexport function localPosition(node: SceneNode): MutableVec3 {\n return node.position;\n}\n\n/**\n * The node's local rotation as a live, writable view.\n *\n * @param node - The node to view.\n * @returns The live local rotation quaternion.\n *\n * @internal\n */\nexport function localRotation(node: SceneNode): MutableQuat {\n return node.rotationQuaternion;\n}\n\n/**\n * The node's local scale as a live, writable view.\n *\n * @param node - The node to view.\n * @returns The live local scale.\n *\n * @internal\n */\nexport function localScale(node: SceneNode): MutableVec3 {\n return node.scaling;\n}\n\n/**\n * Reads a node's own visibility flag.\n *\n * @remarks\n * Lite leaves `visible` `undefined` on a node that was never hidden, which means *visible*; this\n * normalises that to `true` so callers never have to spell the tri-state out. Only\n * {@link setNodeVisible} writes it, and it materialises the cascade at write time.\n *\n * @param node - The node to read.\n * @returns `true` when the node renders.\n *\n * @internal\n */\nexport function isNodeVisible(node: SceneNode): boolean {\n return node.visible !== false;\n}\n\n/**\n * Renames a node.\n *\n * @remarks\n * Lite never uses the name for lookup, so this is purely for debugging and for the names that show\n * up in Lite-side tooling; ignifx keeps `Entity.name` as the source of truth and mirrors it here.\n *\n * @param node - The node to rename.\n * @param name - The new name.\n *\n * @internal\n */\nexport function setNodeName(node: SceneNode, name: string): void {\n node.name = name;\n}\n\n/**\n * The parent a node is currently linked to, when that parent is itself a scene node.\n *\n * @param node - The node to read.\n * @returns The parent node, or `null` when the node is unparented or its parent is a bare\n * world-matrix provider such as a camera.\n *\n * @internal\n */\nexport function parentNode(node: SceneNode): SceneNode | null {\n const parent = node.parent;\n if (parent === null || !(\"children\" in parent)) {\n return null;\n }\n // A world-matrix provider that carries `children` is\n // a `SceneNode` — the same invariant Lite's own `setParent` relies on.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n return parent as SceneNode;\n}\n","import {\n addToScene,\n cloneTransformNode,\n createBox,\n createCapsule,\n createCylinder,\n createGround,\n createMeshFromData,\n createPlane,\n createSphere,\n createTorus,\n removeFromScene,\n setSubtreeVisible,\n updateMeshColors as liteUpdateMeshColors,\n updateMeshNormals as liteUpdateMeshNormals,\n updateMeshPositions as liteUpdateMeshPositions,\n updateMeshUvs as liteUpdateMeshUvs,\n} from \"@babylonjs/lite\";\nimport type {\n BoxOptions,\n CapsuleOptions,\n CylinderOptions,\n EngineContext,\n GroundOptions,\n Material,\n Mesh,\n PlaneOptions,\n SceneContext,\n SceneNode,\n SphereOptions,\n TorusOptions,\n} from \"@babylonjs/lite\";\n\n/**\n * Mesh half of the Babylon Lite adapter (`docs/architecture/07-rendering.md` §2.3). Every function\n * here needs a WebGPU device — `createMeshFromData` uploads four vertex buffers through\n * `engine._device` (`lib/mesh/mesh.js`, `uploadMeshToGPU`) and the null engine has no `_device` —\n * so the whole module lives under `src/lite/gpu/` and is covered by the browser test project.\n *\n * Everything here is `@internal`.\n *\n * ## Ownership, cloning, and disposal (verified against `@babylonjs/lite@1.27.0`)\n *\n * - `cloneTransformNode(mesh)` (`index.d.ts` 1776, `lib/scene/transform-node.js`) shallow-clones a\n * mesh: the clone gets a fresh transform and **the same `_gpu` wrapper object**, with\n * `retain(_gpu)` bumping a reference count. So N clones of one template share exactly one set of\n * GPU buffers — that is spike S2.4's \"instancing shares GPU buffers\", and it is provable by\n * object identity rather than by measuring memory.\n * - Disposal is driven entirely by scene membership. `removeFromScene` calls `unregisterMeshScene`,\n * and only when the mesh has left its **last** scene does it queue `disposeMeshGpu`, which calls\n * `release(_gpu)` and destroys the buffers only when the count drops to one\n * (`lib/scene/scene-remove.js`, `lib/mesh/mesh-dispose.js`, `lib/resource/ref-count.js`). A\n * template that is never added to a scene therefore keeps its buffers alive no matter how many\n * clones come and go — which is what `docs/architecture/07-rendering.md` §2.3 means by \"the\n * template's buffers stay alive while the asset is retained\".\n * - The flip side is that Lite exports **no** mesh disposer. The only public way to release a\n * template's buffers is {@link disposeMeshTemplate}: add it to a scene and take it out again.\n * - `removeFromScene` also recursively removes a mesh's `children` and nulls its `parent`, so\n * removing a `Model`'s root removes the whole instantiated subtree in one call.\n * - Hiding is `setSubtreeVisible` (exported as `setMeshVisible` too, `index.d.ts` 11199): it\n * cascades `visible` down the subtree and bumps a global visibility epoch. Never remove a mesh\n * from the scene to hide it — that disposes it.\n *\n * ## Updating a mesh's vertices (verified against `lib/mesh/mesh-factories.js`)\n *\n * `updateMesh*` writes the GPU buffer and **nothing else**. Three consequences, all of them\n * surprising enough to be worth stating where the calls are:\n *\n * 1. **The retained CPU arrays are not replaced.** `createMeshFromData` keeps `_cpuPositions`,\n * `_cpuNormals`, `_cpuUvs` and `_cpuIndices` — the arrays it was handed — and Lite's CPU ray\n * pick reads them (`lib/picking/ray-pick.js`). Only `updateMeshGeometry`/`resizeMeshGeometry`\n * re-retain, through `retainMeshGeometry`. So an update that hands over a *different* array\n * leaves picking looking at the old geometry, while an update after mutating the retained array\n * in place leaves picking exact. `MeshAsset` keeps its own copy in step for that reason.\n * 2. **Bounds are not recomputed.** `retainMeshGeometry` is what calls `computeAabb` and writes\n * `boundMin`/`boundMax`; the partial updaters do not. `Mesh`'s own declaration says a consumer\n * \"MAY overwrite these with a wider hand-computed box\", so {@link setMeshBounds} exists and\n * `MeshAsset.updatePositions` uses it.\n * 3. **A cloned template cannot be updated at all.** `writeVertexAttributeRange` throws\n * (`ThrowLiteError(360)`) when `mesh._gpu._refCount > 1`, and cloning a mesh retains that very\n * wrapper. A `MeshAsset` a `MeshRenderer` has drawn is therefore frozen; a mesh meant to be\n * edited is a renderable of its own, which is the shape the terrain chunk adapter uses.\n */\n\n/**\n * The Babylon Lite mesh a `MeshAsset` template and a `MeshRenderer` clone are, re-exported under an\n * ignifx name so feature code can name the type without importing `@babylonjs/lite`\n * (`CONSTITUTION.md` §3.4, coding standards §4).\n *\n * @remarks\n * Unstable: it is Lite's own type, reachable only through documented `.lite` escape hatches, and it\n * is excluded from the stability guarantees of `CONSTITUTION.md` Article IV.\n *\n * @public\n */\nexport type LiteMesh = Mesh;\n\n/**\n * Creates a box template.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - A uniform size, or per-axis dimensions.\n * @returns The mesh. It belongs to no scene yet.\n *\n * @example\n * ```ts\n * const template = createBoxMesh(engine, { size: 2 });\n * const instance = cloneMeshUnderNode(template, entityNode);\n * addMeshToScene(scene, instance);\n * ```\n *\n * @internal\n */\nexport function createBoxMesh(engine: EngineContext, options?: number | BoxOptions): Mesh {\n return createBox(engine, options);\n}\n\n/**\n * Creates a sphere template.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - Segment count and diameters.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createSphereMesh(engine: EngineContext, options?: SphereOptions): Mesh {\n return createSphere(engine, options);\n}\n\n/**\n * Creates a plane template in the XY plane.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - Size, or width and height.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createPlaneMesh(engine: EngineContext, options?: PlaneOptions): Mesh {\n return createPlane(engine, options);\n}\n\n/**\n * Creates a subdivided ground template in the XZ plane.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - Width, height, subdivisions, and UV scale.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createGroundMesh(engine: EngineContext, options?: GroundOptions): Mesh {\n return createGround(engine, options);\n}\n\n/**\n * Creates a cylinder template along the Y axis.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - Height, diameters, and tessellation.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createCylinderMesh(engine: EngineContext, options?: CylinderOptions): Mesh {\n return createCylinder(engine, options);\n}\n\n/**\n * Creates a capsule template along the Y axis.\n *\n * @remarks\n * `height` is the **total** height including both caps (`index.d.ts` 1523), which is the same\n * convention `@ignifx/physics`'s capsule collider uses, so a renderer and a collider built from one\n * pair of numbers line up.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - Height, radius, and tessellation.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createCapsuleMesh(engine: EngineContext, options?: CapsuleOptions): Mesh {\n return createCapsule(engine, options);\n}\n\n/**\n * Creates a torus template in the XZ plane.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param options - Diameter, thickness, and tessellation.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createTorusMesh(engine: EngineContext, options?: TorusOptions): Mesh {\n return createTorus(engine, options);\n}\n\n/**\n * Creates a mesh from raw vertex data.\n *\n * @remarks\n * Lite keeps a reference to the arrays that are handed in — it does not copy them — and uses them\n * for CPU ray picking and bounds (`lib/mesh/mesh-factories.js`). Callers must not mutate them\n * afterwards.\n *\n * @param engine - The engine that owns the GPU buffers.\n * @param name - A debug name.\n * @param positions - Three floats per vertex.\n * @param normals - Three floats per vertex.\n * @param indices - Three indices per triangle.\n * @param uvs - Two floats per vertex, or omitted.\n * @param uvs2 - Two floats per vertex for the second UV set, or omitted.\n * @param tangents - Four floats per vertex, or omitted.\n * @param colors - Four floats per vertex, or omitted.\n * @returns The mesh.\n *\n * @internal\n */\nexport function createMeshFromGeometry(\n engine: EngineContext,\n name: string,\n positions: Float32Array,\n normals: Float32Array,\n indices: Uint32Array,\n uvs?: Float32Array,\n uvs2?: Float32Array,\n tangents?: Float32Array,\n colors?: Float32Array,\n): Mesh {\n return createMeshFromData(engine, name, positions, normals, indices, uvs, uvs2, tangents, colors);\n}\n\n/**\n * Re-uploads part of a mesh's position buffer.\n *\n * @remarks\n * A no-op range is accepted; an out-of-range one, or a mesh whose GPU geometry has co-owners,\n * throws a Lite error (see the module note). It does **not** refresh the CPU picking geometry or\n * the bounds.\n *\n * @param engine - The engine that owns the buffer.\n * @param mesh - The mesh to update.\n * @param positions - Three floats per vertex, read from index 0.\n * @param vertexOffset - The first destination vertex to overwrite.\n * @param vertexCount - How many vertices to write.\n *\n * @internal\n */\nexport function updateMeshPositions(\n engine: EngineContext,\n mesh: Mesh,\n positions: Float32Array,\n vertexOffset: number,\n vertexCount: number,\n): void {\n liteUpdateMeshPositions(engine, mesh, positions, vertexOffset, vertexCount);\n}\n\n/**\n * Re-uploads part of a mesh's normal buffer.\n *\n * @param engine - The engine that owns the buffer.\n * @param mesh - The mesh to update.\n * @param normals - Three floats per vertex.\n * @param vertexOffset - The first destination vertex to overwrite.\n * @param vertexCount - How many vertices to write.\n *\n * @internal\n */\nexport function updateMeshNormals(\n engine: EngineContext,\n mesh: Mesh,\n normals: Float32Array,\n vertexOffset: number,\n vertexCount: number,\n): void {\n liteUpdateMeshNormals(engine, mesh, normals, vertexOffset, vertexCount);\n}\n\n/**\n * Re-uploads part of a mesh's UV buffer.\n *\n * @remarks\n * Lite makes it a no-op when the mesh was created without UVs, rather than an error.\n *\n * @param engine - The engine that owns the buffer.\n * @param mesh - The mesh to update.\n * @param uvs - Two floats per vertex.\n * @param vertexOffset - The first destination vertex to overwrite.\n * @param vertexCount - How many vertices to write.\n *\n * @internal\n */\nexport function updateMeshUvs(\n engine: EngineContext,\n mesh: Mesh,\n uvs: Float32Array,\n vertexOffset: number,\n vertexCount: number,\n): void {\n liteUpdateMeshUvs(engine, mesh, uvs, vertexOffset, vertexCount);\n}\n\n/**\n * Re-uploads part of a mesh's vertex-colour buffer.\n *\n * @remarks\n * The colour attribute is `vec4`, and Lite makes the call a no-op when the mesh was created without\n * colours.\n *\n * @param engine - The engine that owns the buffer.\n * @param mesh - The mesh to update.\n * @param colors - Four floats per vertex.\n * @param vertexOffset - The first destination vertex to overwrite.\n * @param vertexCount - How many vertices to write.\n *\n * @internal\n */\nexport function updateMeshColors(\n engine: EngineContext,\n mesh: Mesh,\n colors: Float32Array,\n vertexOffset: number,\n vertexCount: number,\n): void {\n liteUpdateMeshColors(engine, mesh, colors, vertexOffset, vertexCount);\n}\n\n/**\n * Writes a mesh's object-local bounding box.\n *\n * @remarks\n * `Mesh.boundMin`/`boundMax` are declared consumer-writable, and writing them is the only way to\n * keep the shadow fit, the thin-instance culler and the Havok shape extents honest after a partial\n * vertex update — none of the partial updaters recomputes them. The existing arrays are mutated in\n * place when they are there, so repeated sculpting allocates nothing.\n *\n * @param mesh - The mesh to re-bound.\n * @param minX - The smallest X.\n * @param minY - The smallest Y.\n * @param minZ - The smallest Z.\n * @param maxX - The largest X.\n * @param maxY - The largest Y.\n * @param maxZ - The largest Z.\n *\n * @internal\n */\nexport function setMeshBounds(\n mesh: Mesh,\n minX: number,\n minY: number,\n minZ: number,\n maxX: number,\n maxY: number,\n maxZ: number,\n): void {\n const boundMin = mesh.boundMin;\n if (boundMin === undefined) {\n mesh.boundMin = [minX, minY, minZ];\n } else {\n boundMin[0] = minX;\n boundMin[1] = minY;\n boundMin[2] = minZ;\n }\n const boundMax = mesh.boundMax;\n if (boundMax === undefined) {\n mesh.boundMax = [maxX, maxY, maxZ];\n } else {\n boundMax[0] = maxX;\n boundMax[1] = maxY;\n boundMax[2] = maxZ;\n }\n}\n\n/**\n * Gives a cloned mesh bounding-box arrays of its own.\n *\n * @remarks\n * `cloneMeshNode` shallow-spreads the template (`lib/scene/transform-node.js`), so a clone starts\n * out sharing the template's `boundMin`/`boundMax` arrays and {@link setMeshBounds} — which mutates\n * in place — would write through to the template and to every other clone. Any caller that re-bounds\n * one clone alone has to call this first.\n *\n * @param mesh - The clone.\n *\n * @internal\n */\nexport function detachMeshBounds(mesh: Mesh): void {\n const boundMin = mesh.boundMin;\n if (boundMin !== undefined) {\n mesh.boundMin = [boundMin[0], boundMin[1], boundMin[2]];\n }\n const boundMax = mesh.boundMax;\n if (boundMax !== undefined) {\n mesh.boundMax = [boundMax[0], boundMax[1], boundMax[2]];\n }\n}\n\n/**\n * Recomputes a mesh's object-local bounding box from a position array and writes it.\n *\n * @remarks\n * The partial vertex updaters leave `boundMin`/`boundMax` alone (see the module note), and every\n * consumer that fits a shadow cascade, culls a thin instance, or measures a Havok shape reads them.\n * One linear pass, no allocation. A position array too short to hold one vertex leaves the bounds\n * as they were.\n *\n * @param mesh - The mesh to re-bound.\n * @param positions - Three floats per vertex.\n *\n * @internal\n */\nexport function recomputeMeshBounds(mesh: Mesh, positions: Float32Array): void {\n if (positions.length < 3) {\n return;\n }\n let minX = Number.POSITIVE_INFINITY;\n let minY = Number.POSITIVE_INFINITY;\n let minZ = Number.POSITIVE_INFINITY;\n let maxX = Number.NEGATIVE_INFINITY;\n let maxY = Number.NEGATIVE_INFINITY;\n let maxZ = Number.NEGATIVE_INFINITY;\n for (let index = 0; index + 2 < positions.length; index += 3) {\n const x = positions[index] ?? 0;\n const y = positions[index + 1] ?? 0;\n const z = positions[index + 2] ?? 0;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n minZ = z < minZ ? z : minZ;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n maxZ = z > maxZ ? z : maxZ;\n }\n setMeshBounds(mesh, minX, minY, minZ, maxX, maxY, maxZ);\n}\n\n/**\n * Clones a template — mesh or transform-node subtree — and parents the clone under an entity node.\n *\n * @remarks\n * The clone shares the template's GPU buffers (see the module note). Cloning a mesh whose buffers\n * were already released throws, which is Lite's way of telling you the template outlived its asset.\n *\n * Only the `parent` link is written; the clone is deliberately **not** pushed into the parent's\n * `children` array, for the same reason cameras and lights are not (`./camera.ts`): ignifx\n * transform nodes are never added to a Lite scene, so nothing in Lite walks their children, and\n * `removeFromScene` nulls a removed mesh's `parent` without touching the array it was listed in —\n * so maintaining it would only create a stale entry to clean up.\n *\n * @param template - The mesh or subtree to clone.\n * @param parent - The entity's transform node, or `null` for world space.\n * @returns The cloned root. Add it to the scene with {@link addMeshToScene}.\n *\n * @internal\n */\nexport function cloneMeshUnderNode(template: SceneNode, parent: SceneNode | null): SceneNode {\n const clone = cloneTransformNode(template);\n clone.parent = parent;\n return clone;\n}\n\n/**\n * Adds a mesh — or a transform-node subtree containing meshes — to a render scene.\n *\n * @remarks\n * `addToScene` recurses into `children` and re-parents each one, so a whole instantiated model goes\n * in with one call. When the scene is already registered, the mesh joins Lite's runtime\n * material-swap queue and appears once its material family's renderable has been rebuilt\n * (`docs/architecture/07-rendering.md` §1.1 and ADR-0014).\n *\n * @param scene - The render scene.\n * @param node - The mesh or subtree root to add.\n *\n * @internal\n */\nexport function addMeshToScene(scene: SceneContext, node: SceneNode): void {\n addToScene(scene, node);\n}\n\n/**\n * Removes a mesh — and everything under it — from a render scene, releasing its GPU buffers when it\n * has left its last scene.\n *\n * @remarks\n * This is destruction, not hiding: use {@link setMeshSubtreeVisible} to hide.\n *\n * @param scene - The render scene.\n * @param node - The mesh or subtree root to remove.\n *\n * @internal\n */\nexport function removeMeshFromScene(scene: SceneContext, node: SceneNode): void {\n removeFromScene(scene, node);\n}\n\n/**\n * Shows or hides a mesh and everything under it.\n *\n * @param node - The subtree root.\n * @param visible - `true` to show it, `false` to hide it.\n *\n * @internal\n */\nexport function setMeshSubtreeVisible(node: SceneNode, visible: boolean): void {\n setSubtreeVisible(node, visible);\n}\n\n/**\n * Assigns a mesh's material.\n *\n * @remarks\n * `Mesh.material` is an accessor once the mesh has joined a scene: writing it queues a material\n * swap on every scene the mesh belongs to (`lib/scene/mesh-scene-registry.js`,\n * `installMaterialSetter`). Assigning the material the mesh already has is a no-op.\n *\n * @param mesh - The mesh to change.\n * @param material - The material to draw it with.\n *\n * @internal\n */\nexport function setMeshMaterial(mesh: Mesh, material: Material): void {\n mesh.material = material;\n}\n\n/**\n * Sets whether a mesh is darkened by shadow maps.\n *\n * @param mesh - The mesh to change.\n * @param receiveShadows - `true` to sample shadow maps on this mesh.\n *\n * @internal\n */\nexport function setMeshReceiveShadows(mesh: Mesh, receiveShadows: boolean): void {\n mesh.receiveShadows = receiveShadows;\n}\n\n/**\n * Sets a mesh's sort key within its phase. Lower values are drawn first.\n *\n * @param mesh - The mesh to change.\n * @param renderOrder - The sort key; it only orders within the opaque or the transparent phase.\n *\n * @internal\n */\nexport function setMeshRenderOrder(mesh: Mesh, renderOrder: number): void {\n mesh.renderOrder = renderOrder;\n}\n\n/**\n * Sets whether picking considers a mesh at all.\n *\n * @remarks\n * `pickable === false` removes the mesh from both the GPU picker's candidate list and the CPU ray\n * test, so it neither occludes nor returns a hit (`index.d.ts` 7214, `lib/picking/ray-pick.js`).\n *\n * @param mesh - The mesh to change.\n * @param pickable - `true` to allow picking.\n *\n * @internal\n */\nexport function setMeshPickable(mesh: Mesh, pickable: boolean): void {\n mesh.pickable = pickable;\n}\n\n/**\n * Gives a mesh the string id Lite's light include/exclude sets match on.\n *\n * @param mesh - The mesh to name.\n * @param id - The id. It should be unique within the scene.\n *\n * @internal\n */\nexport function setMeshId(mesh: Mesh, id: string): void {\n mesh.id = id;\n}\n\n/**\n * Replaces the materials of every mesh in a subtree whose current material carries one of the given\n * names.\n *\n * @remarks\n * `Material.name` is \"populated by loaders from the source asset (e.g. the glTF material name) so\n * callers can look a material up by name\" (`index.d.ts`), which is the identifier\n * `docs/architecture/07-rendering.md` §2.4 means by \"by material name\". Assigning `Mesh.material`\n * queues a material swap on every scene the mesh belongs to; assigning the material a mesh already\n * has is a no-op, so re-running this is cheap.\n *\n * @param node - The subtree root.\n * @param overrides - Source material name to replacement material.\n * @returns How many meshes were re-materialled.\n *\n * @internal\n */\nexport function overrideSubtreeMaterials(node: SceneNode, overrides: ReadonlyMap<string, Material>): number {\n let changed = 0;\n if (\"material\" in node) {\n // A scene node that carries `material` is a mesh —\n // the same structural test Lite's own scene walk uses.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n const mesh = node as Mesh;\n const name = mesh.material.name;\n const replacement = name === undefined ? undefined : overrides.get(name);\n if (replacement !== undefined && replacement !== mesh.material) {\n mesh.material = replacement;\n changed += 1;\n }\n }\n const children = node.children;\n for (let index = 0; index < children.length; index += 1) {\n const child = children[index];\n if (child !== undefined) {\n changed += overrideSubtreeMaterials(child, overrides);\n }\n }\n return changed;\n}\n\n/**\n * Releases a template mesh's GPU buffers.\n *\n * @remarks\n * Lite exports no mesh disposer: a mesh's buffers are freed only when it leaves its last scene\n * (`lib/scene/scene-remove.js`). A template that was never added to a scene therefore has to be\n * added and removed to be released, which is exactly what this does. Two consequences the caller\n * must respect:\n *\n * 1. The template must carry no material, or the round trip will build and immediately tear down a\n * renderable for it. Templates created by the factories above start with none.\n * 2. Any clone still alive keeps the shared buffers: the reference count only reaches zero when the\n * last co-owner has gone. Releasing the template while clones are in a scene is safe, but the\n * template can no longer be cloned afterwards.\n *\n * @param scene - Any scene on the template's engine; it is used only as the round trip's vehicle.\n * @param template - The template to release.\n *\n * @internal\n */\nexport function disposeMeshTemplate(scene: SceneContext, template: Mesh): void {\n addToScene(scene, template);\n removeFromScene(scene, template);\n}\n\n/**\n * Collects every mesh in a subtree — the root included — in depth-first order.\n *\n * @remarks\n * A scene node that carries `material` is a mesh: the same structural test\n * {@link overrideSubtreeMaterials} and Lite's own scene walk use (`index.d.ts` 7156 declares\n * `material` on `Mesh` and nowhere on `SceneNode`, 10104).\n *\n * Call it **once**, when the subtree is instantiated. The clone tree `instantiateContainer` built\n * never changes shape afterwards, so walking it again every frame would put a recursion on the\n * render path for an answer that cannot have moved (coding standards §7).\n *\n * @param node - The subtree root.\n * @param out - The list the meshes are appended to; it is not cleared first.\n *\n * @internal\n */\nexport function collectSubtreeMeshes(node: SceneNode, out: Mesh[]): void {\n if (\"material\" in node) {\n // See the note above.\n // oxlint-disable-next-line typescript/no-unsafe-type-assertion\n out.push(node as Mesh);\n }\n const children = node.children;\n for (let index = 0; index < children.length; index += 1) {\n const child = children[index];\n if (child !== undefined) {\n collectSubtreeMeshes(child, out);\n }\n }\n}\n","import { Mat4 } from \"./mat4.js\";\nimport { EPSILON, lerp } from \"./math-utils.js\";\nimport type { Mat4Like, MutableVec3, Vec3Like } from \"./types.js\";\n\n/**\n * A 3-component vector: a position or a direction in metres, or a per-axis scale. ignifx is\n * left-handed with Y up and +Z forward (ADR-0011), so {@link Vec3.forward} is `(0, 0, 1)` and\n * {@link Vec3.right} is `(1, 0, 0)`.\n *\n * The fields are plain mutable numbers, which is what makes a `Vec3` interchangeable with Babylon\n * Lite's `{ x, y, z }` vectors and with the live {@link MutableVec3} views a `Transform` exposes.\n *\n * Three families of operations, and the names say which is which:\n *\n * - instance methods mutate the receiver and return `this` (`a.add(b)` means `a += b`);\n * - `ToRef` statics write into a final `out` argument, allocate nothing, and are safe when `out`\n * aliases an input — these are what per-frame code uses (coding standards section 7);\n * - the remaining statics return a fresh vector and are documented as allocating.\n *\n * @example\n * ```ts\n * // convenience code\n * const offset = Vec3.add(position, Vec3.scale(direction, distance));\n *\n * // per-frame code: no allocation\n * Vec3.scaleToRef(direction, distance, scratch);\n * Vec3.addToRef(position, scratch, position);\n * ```\n *\n * @public\n */\nexport class Vec3 {\n /** The X component; positive is right. */\n x: number;\n /** The Y component; positive is up. */\n y: number;\n /** The Z component; positive is forward. */\n z: number;\n\n /**\n * Creates a vector.\n *\n * @param x - The X component. Defaults to 0.\n * @param y - The Y component. Defaults to 0.\n * @param z - The Z component. Defaults to 0.\n */\n constructor(x: number = 0, y: number = 0, z: number = 0) {\n this.x = x;\n this.y = y;\n this.z = z;\n }\n\n /**\n * Assigns every component at once.\n *\n * @param x - The new X component.\n * @param y - The new Y component.\n * @param z - The new Z component.\n * @returns This vector.\n */\n set(x: number, y: number, z: number): this {\n this.x = x;\n this.y = y;\n this.z = z;\n return this;\n }\n\n /**\n * Copies every component from another vector.\n *\n * @param v - The vector to read.\n * @returns This vector.\n */\n copyFrom(v: Vec3Like): this {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n return this;\n }\n\n /**\n * Copies this vector into a new one.\n *\n * @returns A new vector. **Allocates.**\n */\n clone(): Vec3 {\n return new Vec3(this.x, this.y, this.z);\n }\n\n /**\n * Adds another vector to this one.\n *\n * @param v - The vector to add.\n * @returns This vector.\n */\n add(v: Vec3Like): this {\n this.x += v.x;\n this.y += v.y;\n this.z += v.z;\n return this;\n }\n\n /**\n * Adds a scaled vector to this one — the \"move by velocity times delta time\" step, without a\n * temporary.\n *\n * @param v - The vector to add.\n * @param scale - The factor to multiply `v` by first.\n * @returns This vector.\n *\n * @example\n * ```ts\n * position.addScaled(velocity, time.deltaTime);\n * ```\n */\n addScaled(v: Vec3Like, scale: number): this {\n this.x += v.x * scale;\n this.y += v.y * scale;\n this.z += v.z * scale;\n return this;\n }\n\n /**\n * Subtracts another vector from this one.\n *\n * @param v - The vector to subtract.\n * @returns This vector.\n */\n subtract(v: Vec3Like): this {\n this.x -= v.x;\n this.y -= v.y;\n this.z -= v.z;\n return this;\n }\n\n /**\n * Multiplies this vector by another component by component.\n *\n * @param v - The vector to multiply by.\n * @returns This vector.\n */\n multiply(v: Vec3Like): this {\n this.x *= v.x;\n this.y *= v.y;\n this.z *= v.z;\n return this;\n }\n\n /**\n * Multiplies every component by a number.\n *\n * @param scale - The factor.\n * @returns This vector.\n */\n scale(scale: number): this {\n this.x *= scale;\n this.y *= scale;\n this.z *= scale;\n return this;\n }\n\n /**\n * Flips this vector to point the other way.\n *\n * @returns This vector.\n */\n negate(): this {\n this.x = -this.x;\n this.y = -this.y;\n this.z = -this.z;\n return this;\n }\n\n /**\n * Scales this vector to unit length. A zero-length vector is left at zero rather than becoming\n * `NaN`, so callers can normalize an unchecked direction safely.\n *\n * @returns This vector.\n */\n normalize(): this {\n const length = Math.hypot(this.x, this.y, this.z);\n if (length === 0) {\n return this;\n }\n return this.scale(1 / length);\n }\n\n /**\n * Replaces this vector with its cross product with another (`this = this x v`).\n *\n * @param v - The right-hand vector.\n * @returns This vector.\n */\n cross(v: Vec3Like): this {\n return Vec3.crossToRef(this, v, this);\n }\n\n /**\n * Moves this vector towards a target by an interpolant.\n *\n * @param target - The vector reached at `t === 1`.\n * @param t - The interpolant; not clamped.\n * @returns This vector.\n */\n lerp(target: Vec3Like, t: number): this {\n return Vec3.lerpToRef(this, target, t, this);\n }\n\n /**\n * The dot product of this vector with another.\n *\n * @param v - The other vector.\n * @returns The dot product.\n */\n dot(v: Vec3Like): number {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n }\n\n /**\n * The length of this vector, in metres.\n *\n * @returns The length.\n */\n length(): number {\n return Math.hypot(this.x, this.y, this.z);\n }\n\n /**\n * The squared length of this vector. Prefer it over `length()` when comparing distances:\n * it skips the square root.\n *\n * @returns The squared length.\n */\n lengthSquared(): number {\n return this.x * this.x + this.y * this.y + this.z * this.z;\n }\n\n /**\n * The distance from this vector to another, in metres.\n *\n * @param v - The other position.\n * @returns The distance.\n */\n distance(v: Vec3Like): number {\n return Math.hypot(this.x - v.x, this.y - v.y, this.z - v.z);\n }\n\n /**\n * The squared distance from this vector to another.\n *\n * @param v - The other position.\n * @returns The squared distance.\n */\n distanceSquared(v: Vec3Like): number {\n return Vec3.distanceSquared(this, v);\n }\n\n /**\n * Compares this vector with another, component by component, with a tolerance.\n *\n * @param v - The vector to compare against.\n * @param epsilon - The largest per-component difference still considered equal.\n * @returns `true` when every component matches within `epsilon`.\n */\n equalsWithEpsilon(v: Vec3Like, epsilon: number = EPSILON): boolean {\n return Vec3.equalsWithEpsilon(this, v, epsilon);\n }\n\n /**\n * Writes this vector into a `Float32Array`, for GPU upload. The output comes first to mirror\n * Babylon Lite's `ObservableVec3.toArray`, the shape the adapter has to interoperate with.\n *\n * @param out - The array to write into.\n * @param offset - The index of the X component. Defaults to 0.\n * @returns `out`.\n */\n toArray(out: Float32Array, offset: number = 0): Float32Array {\n out[offset] = this.x;\n out[offset + 1] = this.y;\n out[offset + 2] = this.z;\n return out;\n }\n\n /**\n * The zero vector.\n *\n * @returns A new `(0, 0, 0)`. **Allocates**; use {@link VEC3_ZERO} when a read-only value will do.\n */\n static zero(): Vec3 {\n return new Vec3(0, 0, 0);\n }\n\n /**\n * The vector whose components are all one.\n *\n * @returns A new `(1, 1, 1)`. **Allocates.**\n */\n static one(): Vec3 {\n return new Vec3(1, 1, 1);\n }\n\n /**\n * The world up direction.\n *\n * @returns A new `(0, 1, 0)`. **Allocates**; see {@link VEC3_UP}.\n */\n static up(): Vec3 {\n return new Vec3(0, 1, 0);\n }\n\n /**\n * The world down direction.\n *\n * @returns A new `(0, -1, 0)`. **Allocates.**\n */\n static down(): Vec3 {\n return new Vec3(0, -1, 0);\n }\n\n /**\n * The world right direction.\n *\n * @returns A new `(1, 0, 0)`. **Allocates**; see {@link VEC3_RIGHT}.\n */\n static right(): Vec3 {\n return new Vec3(1, 0, 0);\n }\n\n /**\n * The world left direction.\n *\n * @returns A new `(-1, 0, 0)`. **Allocates.**\n */\n static left(): Vec3 {\n return new Vec3(-1, 0, 0);\n }\n\n /**\n * The world forward direction. ignifx is left-handed, so forward is **+Z** (ADR-0011).\n *\n * @returns A new `(0, 0, 1)`. **Allocates**; see {@link VEC3_FORWARD}.\n */\n static forward(): Vec3 {\n return new Vec3(0, 0, 1);\n }\n\n /**\n * The world backward direction.\n *\n * @returns A new `(0, 0, -1)`. **Allocates.**\n */\n static backward(): Vec3 {\n return new Vec3(0, 0, -1);\n }\n\n /**\n * Copies any vector-shaped value into a `Vec3`.\n *\n * @param v - The vector to copy.\n * @returns A new vector. **Allocates.**\n *\n * @example\n * ```ts\n * const position = Vec3.from(node.position); // snapshot of a live Lite view\n * ```\n */\n static from(v: Vec3Like): Vec3 {\n return new Vec3(v.x, v.y, v.z);\n }\n\n /**\n * Adds two vectors.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns A new vector. **Allocates**; use {@link Vec3.addToRef} in per-frame code.\n */\n static add(a: Vec3Like, b: Vec3Like): Vec3 {\n return Vec3.addToRef(a, b, new Vec3());\n }\n\n /**\n * Subtracts one vector from another.\n *\n * @param a - The vector to subtract from.\n * @param b - The vector to subtract.\n * @returns A new vector holding `a - b`. **Allocates.**\n */\n static subtract(a: Vec3Like, b: Vec3Like): Vec3 {\n return Vec3.subtractToRef(a, b, new Vec3());\n }\n\n /**\n * Multiplies a vector by a number.\n *\n * @param v - The vector to scale.\n * @param scale - The factor.\n * @returns A new vector. **Allocates.**\n */\n static scale(v: Vec3Like, scale: number): Vec3 {\n return Vec3.scaleToRef(v, scale, new Vec3());\n }\n\n /**\n * The cross product of two vectors.\n *\n * @param a - The left-hand vector.\n * @param b - The right-hand vector.\n * @returns A new vector holding `a x b`. **Allocates.**\n */\n static cross(a: Vec3Like, b: Vec3Like): Vec3 {\n return Vec3.crossToRef(a, b, new Vec3());\n }\n\n /**\n * A unit-length copy of a vector.\n *\n * @param v - The vector to normalize.\n * @returns A new vector. **Allocates.**\n */\n static normalize(v: Vec3Like): Vec3 {\n return Vec3.normalizeToRef(v, new Vec3());\n }\n\n /**\n * Linearly interpolates between two vectors.\n *\n * @param a - The vector returned at `t === 0`.\n * @param b - The vector returned at `t === 1`.\n * @param t - The interpolant; not clamped.\n * @returns A new vector. **Allocates.**\n */\n static lerp(a: Vec3Like, b: Vec3Like, t: number): Vec3 {\n return Vec3.lerpToRef(a, b, t, new Vec3());\n }\n\n /**\n * Writes `a + b` into `out`.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static addToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, out: TOut): TOut {\n out.set(a.x + b.x, a.y + b.y, a.z + b.z);\n return out;\n }\n\n /**\n * Writes `a - b` into `out`.\n *\n * @param a - The vector to subtract from.\n * @param b - The vector to subtract.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static subtractToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, out: TOut): TOut {\n out.set(a.x - b.x, a.y - b.y, a.z - b.z);\n return out;\n }\n\n /**\n * Writes the component-wise product `a * b` into `out`.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static multiplyToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, out: TOut): TOut {\n out.set(a.x * b.x, a.y * b.y, a.z * b.z);\n return out;\n }\n\n /**\n * Writes `v * scale` into `out`.\n *\n * @param v - The vector to scale.\n * @param scale - The factor.\n * @param out - The vector to write; may alias `v`.\n * @returns `out`.\n */\n static scaleToRef<TOut extends MutableVec3>(v: Vec3Like, scale: number, out: TOut): TOut {\n out.set(v.x * scale, v.y * scale, v.z * scale);\n return out;\n }\n\n /**\n * Writes `-v` into `out`.\n *\n * @param v - The vector to flip.\n * @param out - The vector to write; may alias `v`.\n * @returns `out`.\n */\n static negateToRef<TOut extends MutableVec3>(v: Vec3Like, out: TOut): TOut {\n out.set(-v.x, -v.y, -v.z);\n return out;\n }\n\n /**\n * Writes a unit-length copy of `v` into `out`. A zero-length input is written as zero rather than\n * `NaN`.\n *\n * @param v - The vector to normalize.\n * @param out - The vector to write; may alias `v`.\n * @returns `out`.\n */\n static normalizeToRef<TOut extends MutableVec3>(v: Vec3Like, out: TOut): TOut {\n const length = Math.hypot(v.x, v.y, v.z);\n if (length === 0) {\n out.set(0, 0, 0);\n return out;\n }\n const inv = 1 / length;\n out.set(v.x * inv, v.y * inv, v.z * inv);\n return out;\n }\n\n /**\n * Writes `a x b` into `out`.\n *\n * @param a - The left-hand vector.\n * @param b - The right-hand vector.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static crossToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, out: TOut): TOut {\n const ax = a.x;\n const ay = a.y;\n const az = a.z;\n const bx = b.x;\n const by = b.y;\n const bz = b.z;\n out.set(ay * bz - az * by, az * bx - ax * bz, ax * by - ay * bx);\n return out;\n }\n\n /**\n * Writes the interpolation of `a` and `b` into `out`.\n *\n * @param a - The vector written at `t === 0`.\n * @param b - The vector written at `t === 1`.\n * @param t - The interpolant; not clamped.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static lerpToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, t: number, out: TOut): TOut {\n out.set(lerp(a.x, b.x, t), lerp(a.y, b.y, t), lerp(a.z, b.z, t));\n return out;\n }\n\n /**\n * Writes the component-wise minimum of two vectors into `out`.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static minToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, out: TOut): TOut {\n out.set(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.min(a.z, b.z));\n return out;\n }\n\n /**\n * Writes the component-wise maximum of two vectors into `out`.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @param out - The vector to write; may alias `a` or `b`.\n * @returns `out`.\n */\n static maxToRef<TOut extends MutableVec3>(a: Vec3Like, b: Vec3Like, out: TOut): TOut {\n out.set(Math.max(a.x, b.x), Math.max(a.y, b.y), Math.max(a.z, b.z));\n return out;\n }\n\n /**\n * Transforms a **position** by a matrix into `out`: the matrix's translation is applied and the\n * result is divided by w, so a projection matrix gives clip-space coordinates.\n *\n * @param v - The position to transform, in metres.\n * @param m - The transformation, column-major.\n * @param out - The vector to write; may alias `v`.\n * @returns `out`.\n *\n * @example\n * ```ts\n * Vec3.transformCoordinatesToRef(localPoint, node.worldMatrix, worldPoint);\n * ```\n */\n static transformCoordinatesToRef<TOut extends MutableVec3>(v: Vec3Like, m: Mat4Like, out: TOut): TOut {\n return Mat4.transformPointToRef(m, v, out);\n }\n\n /**\n * Transforms a **direction** by a matrix into `out`, ignoring the matrix's translation.\n *\n * @param v - The direction to transform.\n * @param m - The transformation, column-major.\n * @param out - The vector to write; may alias `v`.\n * @returns `out`.\n */\n static transformNormalToRef<TOut extends MutableVec3>(v: Vec3Like, m: Mat4Like, out: TOut): TOut {\n return Mat4.transformDirectionToRef(m, v, out);\n }\n\n /**\n * The dot product of two vectors.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @returns The dot product.\n */\n static dot(a: Vec3Like, b: Vec3Like): number {\n return a.x * b.x + a.y * b.y + a.z * b.z;\n }\n\n /**\n * The length of a vector, in metres.\n *\n * @param v - The vector to measure.\n * @returns The length.\n */\n static length(v: Vec3Like): number {\n return Math.hypot(v.x, v.y, v.z);\n }\n\n /**\n * The squared length of a vector.\n *\n * @param v - The vector to measure.\n * @returns The squared length.\n */\n static lengthSquared(v: Vec3Like): number {\n return v.x * v.x + v.y * v.y + v.z * v.z;\n }\n\n /**\n * The distance between two positions, in metres.\n *\n * @param a - The first position.\n * @param b - The second position.\n * @returns The distance.\n */\n static distance(a: Vec3Like, b: Vec3Like): number {\n return Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);\n }\n\n /**\n * The squared distance between two positions. Compare squared distances to avoid a square root.\n *\n * @param a - The first position.\n * @param b - The second position.\n * @returns The squared distance.\n */\n static distanceSquared(a: Vec3Like, b: Vec3Like): number {\n const dx = a.x - b.x;\n const dy = a.y - b.y;\n const dz = a.z - b.z;\n return dx * dx + dy * dy + dz * dz;\n }\n\n /**\n * Compares two vectors component by component, with a tolerance.\n *\n * @param a - The first vector.\n * @param b - The second vector.\n * @param epsilon - The largest per-component difference still considered equal.\n * @returns `true` when every component matches within `epsilon`.\n */\n static equalsWithEpsilon(a: Vec3Like, b: Vec3Like, epsilon: number = EPSILON): boolean {\n return Math.abs(a.x - b.x) <= epsilon && Math.abs(a.y - b.y) <= epsilon && Math.abs(a.z - b.z) <= epsilon;\n }\n}\n\n/**\n * The frozen zero vector, `(0, 0, 0)`. Read-only: pass it anywhere a {@link Vec3Like} is wanted, and\n * call {@link Vec3.zero} when you need a vector you can write to.\n *\n * @public\n */\nexport const VEC3_ZERO: Vec3Like = Object.freeze({ x: 0, y: 0, z: 0 });\n\n/**\n * The frozen vector whose components are all one, `(1, 1, 1)` — the identity scale.\n *\n * @public\n */\nexport const VEC3_ONE: Vec3Like = Object.freeze({ x: 1, y: 1, z: 1 });\n\n/**\n * The frozen world up direction, `(0, 1, 0)`.\n *\n * @public\n */\nexport const VEC3_UP: Vec3Like = Object.freeze({ x: 0, y: 1, z: 0 });\n\n/**\n * The frozen world down direction, `(0, -1, 0)`.\n *\n * @public\n */\nexport const VEC3_DOWN: Vec3Like = Object.freeze({ x: 0, y: -1, z: 0 });\n\n/**\n * The frozen world right direction, `(1, 0, 0)`.\n *\n * @public\n */\nexport const VEC3_RIGHT: Vec3Like = Object.freeze({ x: 1, y: 0, z: 0 });\n\n/**\n * The frozen world left direction, `(-1, 0, 0)`.\n *\n * @public\n */\nexport const VEC3_LEFT: Vec3Like = Object.freeze({ x: -1, y: 0, z: 0 });\n\n/**\n * The frozen world forward direction, `(0, 0, 1)`. ignifx is left-handed, so forward is +Z\n * (ADR-0011).\n *\n * @public\n */\nexport const VEC3_FORWARD: Vec3Like = Object.freeze({ x: 0, y: 0, z: 1 });\n\n/**\n * The frozen world backward direction, `(0, 0, -1)`.\n *\n * @public\n */\nexport const VEC3_BACKWARD: Vec3Like = Object.freeze({ x: 0, y: 0, z: -1 });\n"],"mappings":";;;;;;;;AAiBA,SAAS,mBAAiC;CAKxC,uBAAO,IAAI,aAAa,EAAE;AAC5B;;;;;;;;AASA,SAAS,iBAAiB,GAAqB;CAC7C,MAAM,KAAK,EAAE,MAAM;CACnB,MAAM,KAAK,EAAE,MAAM;CACnB,MAAM,KAAK,EAAE,MAAM;CACnB,MAAM,KAAK,EAAE,MAAM;CACnB,MAAM,KAAK,EAAE,MAAM;CACnB,MAAM,KAAK,EAAE,MAAM;CACnB,MAAM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