@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.
Files changed (59) hide show
  1. package/dist/agx-tone-mapping-Cgt844j6.js +53 -0
  2. package/dist/agx-tone-mapping-Cgt844j6.js.map +1 -0
  3. package/dist/auto-exposure-uzPn0beO.js +246 -0
  4. package/dist/auto-exposure-uzPn0beO.js.map +1 -0
  5. package/dist/bloom-hdr-CLtQj-oY.js +315 -0
  6. package/dist/bloom-hdr-CLtQj-oY.js.map +1 -0
  7. package/dist/contact-shadows-T523EXaP.js +84 -0
  8. package/dist/contact-shadows-T523EXaP.js.map +1 -0
  9. package/dist/{environment-C9AjYJgV.js → environment-DPi0_0SP.js} +19 -5
  10. package/dist/environment-DPi0_0SP.js.map +1 -0
  11. package/dist/gtao-_nr0b6-E.js +630 -0
  12. package/dist/gtao-_nr0b6-E.js.map +1 -0
  13. package/dist/hdr-output-BrUvpAsE.js +525 -0
  14. package/dist/hdr-output-BrUvpAsE.js.map +1 -0
  15. package/dist/{ignifx-error-Dq2qJMkZ.js → ignifx-error-oYdVnT1S.js} +16 -1
  16. package/dist/ignifx-error-oYdVnT1S.js.map +1 -0
  17. package/dist/index.d.ts +753 -18
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1679 -183
  20. package/dist/index.js.map +1 -1
  21. package/dist/{instanced-mesh-instance-DYwH0vLi.js → instanced-mesh-instance-NnODkvqK.js} +2 -2
  22. package/dist/{instanced-mesh-instance-DYwH0vLi.js.map → instanced-mesh-instance-NnODkvqK.js.map} +1 -1
  23. package/dist/mat4-D6exvAuO.js +949 -0
  24. package/dist/mat4-D6exvAuO.js.map +1 -0
  25. package/dist/material-CGk5mAah.js +204 -0
  26. package/dist/material-CGk5mAah.js.map +1 -0
  27. package/dist/{material-plugin-BOCB7Stt.js → material-plugin-BUlqLsap.js} +3 -204
  28. package/dist/material-plugin-BUlqLsap.js.map +1 -0
  29. package/dist/{post-effect-compiler-Dw6zW2cG.js → post-effect-compiler-CRek8VxQ.js} +2 -2
  30. package/dist/{post-effect-compiler-Dw6zW2cG.js.map → post-effect-compiler-CRek8VxQ.js.map} +1 -1
  31. package/dist/render-path-Be7WgN7r.js +166 -0
  32. package/dist/render-path-Be7WgN7r.js.map +1 -0
  33. package/dist/render-texture-C_TnaSz2.js +200 -0
  34. package/dist/render-texture-C_TnaSz2.js.map +1 -0
  35. package/dist/scene-color-passes-DlNr-qyZ.js +65 -0
  36. package/dist/scene-color-passes-DlNr-qyZ.js.map +1 -0
  37. package/dist/scene-inputs-BxGOsnIZ.js +318 -0
  38. package/dist/scene-inputs-BxGOsnIZ.js.map +1 -0
  39. package/dist/{shader-material-DRZmqA_S.js → shader-material-B6p66wB8.js} +18 -7
  40. package/dist/shader-material-B6p66wB8.js.map +1 -0
  41. package/dist/{shader-material-BxQn9FT4.js → shader-material-C0TAUr4t.js} +102 -4
  42. package/dist/shader-material-C0TAUr4t.js.map +1 -0
  43. package/dist/{shader-pragma-DrFm5f5m.js → shader-pragma-BKCoZTTA.js} +2 -2
  44. package/dist/{shader-pragma-DrFm5f5m.js.map → shader-pragma-BKCoZTTA.js.map} +1 -1
  45. package/dist/ssgi-Dm-maZrc.js +113 -0
  46. package/dist/ssgi-Dm-maZrc.js.map +1 -0
  47. package/dist/{surface-shader-BgZchRBe.js → surface-shader-BaK0kvBB.js} +5 -4
  48. package/dist/{surface-shader-BgZchRBe.js.map → surface-shader-BaK0kvBB.js.map} +1 -1
  49. package/dist/taa-BwBZLy11.js +480 -0
  50. package/dist/taa-BwBZLy11.js.map +1 -0
  51. package/dist/{vec3-T2PasQZv.js → vec3-D-0Y2mzE.js} +4 -948
  52. package/dist/vec3-D-0Y2mzE.js.map +1 -0
  53. package/package.json +1 -1
  54. package/dist/environment-C9AjYJgV.js.map +0 -1
  55. package/dist/ignifx-error-Dq2qJMkZ.js.map +0 -1
  56. package/dist/material-plugin-BOCB7Stt.js.map +0 -1
  57. package/dist/shader-material-BxQn9FT4.js.map +0 -1
  58. package/dist/shader-material-DRZmqA_S.js.map +0 -1
  59. package/dist/vec3-T2PasQZv.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mat4-D6exvAuO.js","names":[],"sources":["../src/math/mat4.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"],"mappings":";;;;;;;AAiBA,SAAS,mBAAiC;CAKxC,uBAAO,IAAI,aAAa,EAAE;AAC5B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GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,CAAU"}
@@ -0,0 +1,204 @@
1
+ import { createPbrMaterial, createStandardMaterial, markMaterialUboDirty, rebuildMaterial, setPbrAlphaCutoff, setPbrEmissive, setPbrUnlit, setStandardBumpTexture, setStandardEmissiveTexture, setStandardOpacityTexture, setStandardSpecularTexture } from "@babylonjs/lite";
2
+ //#region src/lite/material.ts
3
+ /** glTF's default alpha cutoff, used when a `"mask"` material declares none. */
4
+ const DEFAULT_ALPHA_CUTOFF = .5;
5
+ /**
6
+ * How a material's alpha channel is interpreted, in glTF's vocabulary, in the order the inspector
7
+ * lists them (`docs/architecture/07-rendering.md` §2.4).
8
+ *
9
+ * @public
10
+ */
11
+ const MATERIAL_ALPHA_MODES = [
12
+ "opaque",
13
+ "mask",
14
+ "blend"
15
+ ];
16
+ /**
17
+ * Builds a Lite PBR material from ignifx props.
18
+ *
19
+ * @param input - The declared properties.
20
+ * @returns The material. It holds no GPU resource of its own; the textures it references do.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const gold = createPbrMaterialFromProps({ baseColor: [1, 0.77, 0.34, 1], metallic: 1, roughness: 0.25 });
25
+ * ```
26
+ *
27
+ * @internal
28
+ */
29
+ function createPbrMaterialFromProps(input) {
30
+ const props = {};
31
+ if (input.name !== void 0) props.name = input.name;
32
+ if (input.baseColor !== void 0) props.baseColorFactor = [
33
+ input.baseColor[0],
34
+ input.baseColor[1],
35
+ input.baseColor[2],
36
+ input.baseColor[3]
37
+ ];
38
+ if (input.baseColorTexture !== void 0) props.baseColorTexture = input.baseColorTexture;
39
+ if (input.metallic !== void 0) props.metallicFactor = input.metallic;
40
+ if (input.roughness !== void 0) props.roughnessFactor = input.roughness;
41
+ if (input.metallicRoughnessTexture !== void 0) props.ormTexture = input.metallicRoughnessTexture;
42
+ if (input.normalTexture !== void 0) props.normalTexture = input.normalTexture;
43
+ if (input.normalScale !== void 0) props.normalTextureScale = input.normalScale;
44
+ if (input.emissiveTexture !== void 0) props.emissiveTexture = input.emissiveTexture;
45
+ if (input.occlusionTexture !== void 0) props.occlusionTexture = input.occlusionTexture;
46
+ if (input.occlusionStrength !== void 0) props.occlusionStrength = input.occlusionStrength;
47
+ if (input.alpha !== void 0) props.alpha = input.alpha;
48
+ if (input.doubleSided !== void 0) props.doubleSided = input.doubleSided;
49
+ if (input.environmentIntensity !== void 0) props.environmentIntensity = input.environmentIntensity;
50
+ if (input.alphaMode === "blend") props.alphaBlend = true;
51
+ const material = createPbrMaterial(props);
52
+ if (input.alphaMode === "mask") setPbrAlphaCutoff(material, input.alphaCutoff ?? DEFAULT_ALPHA_CUTOFF);
53
+ if (input.emissive !== void 0) setPbrEmissive(material, [
54
+ input.emissive[0],
55
+ input.emissive[1],
56
+ input.emissive[2]
57
+ ]);
58
+ if (input.unlit === true) setPbrUnlit(material);
59
+ return material;
60
+ }
61
+ /**
62
+ * Builds a Lite Standard material from ignifx props.
63
+ *
64
+ * @param input - The declared properties.
65
+ * @returns The material.
66
+ *
67
+ * @internal
68
+ */
69
+ function createStandardMaterialFromProps(input) {
70
+ const material = createStandardMaterial();
71
+ if (input.name !== void 0) material.name = input.name;
72
+ if (input.diffuse !== void 0) writeTriple(material.diffuseColor, input.diffuse);
73
+ if (input.specular !== void 0) writeTriple(material.specularColor, input.specular);
74
+ if (input.emissive !== void 0) writeTriple(material.emissiveColor, input.emissive);
75
+ if (input.specularPower !== void 0) material.specularPower = input.specularPower;
76
+ if (input.alpha !== void 0) material.alpha = input.alpha;
77
+ if (input.alphaCutoff !== void 0) material.alphaCutOff = input.alphaCutoff;
78
+ if (input.doubleSided !== void 0) material.backFaceCulling = !input.doubleSided;
79
+ if (input.unlit !== void 0) material.disableLighting = input.unlit;
80
+ if (input.diffuseTexture !== void 0) material.diffuseTexture = input.diffuseTexture;
81
+ if (input.specularTexture !== void 0) setStandardSpecularTexture(material, input.specularTexture);
82
+ if (input.emissiveTexture !== void 0) setStandardEmissiveTexture(material, input.emissiveTexture);
83
+ if (input.normalTexture !== void 0) setStandardBumpTexture(material, input.normalTexture);
84
+ if (input.opacityTexture !== void 0) setStandardOpacityTexture(material, input.opacityTexture);
85
+ return material;
86
+ }
87
+ /**
88
+ * The material a `MeshRenderer` uses when it declares none: a neutral, fully rough dielectric.
89
+ *
90
+ * @returns A fresh material. Callers share one instance per app rather than one per renderer.
91
+ *
92
+ * @internal
93
+ */
94
+ function createDefaultMaterial() {
95
+ return createPbrMaterialFromProps({
96
+ name: "ignifx:default",
97
+ baseColor: [
98
+ 1,
99
+ 1,
100
+ 1,
101
+ 1
102
+ ],
103
+ metallic: 0,
104
+ roughness: .9
105
+ });
106
+ }
107
+ /**
108
+ * Replaces a PBR material's linear base colour.
109
+ *
110
+ * @param material - The material to change.
111
+ * @param r - The linear red component.
112
+ * @param g - The linear green component.
113
+ * @param b - The linear blue component.
114
+ * @param a - The alpha component.
115
+ *
116
+ * @internal
117
+ */
118
+ function setPbrBaseColor(material, r, g, b, a) {
119
+ const factor = material.baseColorFactor;
120
+ if (factor === void 0) material.baseColorFactor = [
121
+ r,
122
+ g,
123
+ b,
124
+ a
125
+ ];
126
+ else {
127
+ factor[0] = r;
128
+ factor[1] = g;
129
+ factor[2] = b;
130
+ factor[3] = a;
131
+ }
132
+ markMaterialDirty(material);
133
+ }
134
+ /**
135
+ * Replaces a PBR material's metallic and roughness factors.
136
+ *
137
+ * @param material - The material to change.
138
+ * @param metallic - The metallic factor, 0 to 1.
139
+ * @param roughness - The roughness factor, 0 to 1.
140
+ *
141
+ * @internal
142
+ */
143
+ function setPbrMetallicRoughness(material, metallic, roughness) {
144
+ material.metallicFactor = metallic;
145
+ material.roughnessFactor = roughness;
146
+ markMaterialDirty(material);
147
+ }
148
+ /**
149
+ * Replaces a material's overall alpha.
150
+ *
151
+ * @param material - The PBR or Standard material to change.
152
+ * @param alpha - The new alpha, 0 to 1.
153
+ *
154
+ * @internal
155
+ */
156
+ function setMaterialAlpha(material, alpha) {
157
+ material.alpha = alpha;
158
+ markMaterialDirty(material);
159
+ }
160
+ /**
161
+ * Marks a material's uniform block for re-upload on the next frame.
162
+ *
163
+ * @remarks
164
+ * This is the cheap path and covers every scalar, vector, and colour edit. It does **not** cover
165
+ * changes that alter the compiled feature set; those go through {@link rebuildMaterialPipelines}.
166
+ *
167
+ * @param material - The material that changed.
168
+ *
169
+ * @internal
170
+ */
171
+ function markMaterialDirty(material) {
172
+ markMaterialUboDirty(material);
173
+ }
174
+ /**
175
+ * Rebuilds the renderables of a material whose compiled feature set changed.
176
+ *
177
+ * @remarks
178
+ * Needed after binding or clearing a texture, changing culling, or toggling a sub-feature
179
+ * (`index.d.ts` 11133). `rebuildFrameGraph` is left off so a component can batch several material
180
+ * edits and rebuild the frame graph once.
181
+ *
182
+ * @param scene - The scene the material renders in.
183
+ * @param material - The material that changed.
184
+ *
185
+ * @internal
186
+ */
187
+ function rebuildMaterialPipelines(scene, material) {
188
+ rebuildMaterial(scene, material);
189
+ }
190
+ /**
191
+ * Writes three components into a Lite colour tuple in place.
192
+ *
193
+ * @param target - The tuple Lite owns.
194
+ * @param source - The values to copy.
195
+ */
196
+ function writeTriple(target, source) {
197
+ target[0] = source[0];
198
+ target[1] = source[1];
199
+ target[2] = source[2];
200
+ }
201
+ //#endregion
202
+ export { markMaterialDirty as a, setPbrBaseColor as c, createStandardMaterialFromProps as i, setPbrMetallicRoughness as l, createDefaultMaterial as n, rebuildMaterialPipelines as o, createPbrMaterialFromProps as r, setMaterialAlpha as s, MATERIAL_ALPHA_MODES as t };
203
+
204
+ //# sourceMappingURL=material-CGk5mAah.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"material-CGk5mAah.js","names":[],"sources":["../src/lite/material.ts"],"sourcesContent":["import {\n createPbrMaterial,\n createStandardMaterial,\n enableMaterialTracking,\n markMaterialUboDirty,\n rebuildMaterial,\n setPbrAlphaCutoff,\n setPbrEmissive,\n setPbrUnlit,\n setStandardBumpTexture,\n setStandardEmissiveTexture,\n setStandardOpacityTexture,\n setStandardSpecularTexture,\n} from \"@babylonjs/lite\";\nimport { assertNever } from \"../errors/ignifx-error.js\";\nimport type { Material, PbrMaterialProps, SceneContext, StandardMaterialProps, Texture2D } from \"@babylonjs/lite\";\n\n/**\n * Material half of the Babylon Lite adapter (`docs/architecture/07-rendering.md` §2.6): the three\n * material kinds a `MaterialAsset` can produce, built from plain ignifx props.\n *\n * Everything here is `@internal`, and every colour that reaches it is **linear** — the sRGB decode\n * belongs to the asset layer.\n *\n * ## What a Lite material is (verified against `@babylonjs/lite@1.27.0`)\n *\n * - A material is plain data plus one private `_buildGroup` function; `createPbrMaterial` is\n * literally `{ ...props, _buildGroup, _uboVersion: 0 }` (`lib/material/pbr/pbr-material.js`), so\n * none of these factories touches the GPU and all of them run under the null engine.\n * - **The build group is a per-family singleton.** `getPbrGroupBuilder()`, `getStandardGroupBuilder()`\n * and `getShaderGroupBuilder()` each memoise one function for the whole process\n * (`lib/material/pbr/pbr-material.js`, `lib/material/standard/create-standard-material.js`,\n * `lib/material/shader/shader-material.js` line 123), and a scene keys its renderable groups by\n * that function (`lib/scene/scene-core.js`, `addToScene`). \"Material family\" in\n * `docs/architecture/07-rendering.md` §1.1 therefore means *pbr*, *standard*, *shader* or *node* —\n * **not** an individual material. Only node materials get a per-material builder\n * (`lib/material/node/node-material.js`). This is what makes {@link warmUpMaterialFamilies} in\n * `./gpu/warm-up.ts` cheap: one hidden mesh per family covers every material in it.\n * - Scalar and vector edits only need `markMaterialUboDirty` (`index.d.ts` 6974), which bumps\n * `_uboVersion`. Anything that changes the compiled feature set — binding or clearing a texture,\n * flipping `doubleSided`, changing culling — needs {@link rebuildMaterialPipelines}.\n *\n * ## The custom WGSL family lives elsewhere\n *\n * `createShaderMaterial` and the `setShader*` setters are in `./gpu/shader-material.ts`, not here:\n * this module is statically reachable from every app through the material asset layer, and Babylon\n * Lite exports one barrel, so a static import of the shader factory would put Lite's whole\n * shader-material pipeline in every entry chunk. That module is reached through a dynamic\n * `import()` instead (`docs/plan/2026-09-terrain-particles-shaders.md` §3.1, \"Bundle cost\").\n */\n\n/**\n * The Babylon Lite material a `MaterialAsset` owns, re-exported under an ignifx name\n * (`CONSTITUTION.md` §3.4, coding standards §4).\n *\n * @remarks\n * Unstable; excluded from the stability guarantees of `CONSTITUTION.md` Article IV.\n *\n * @public\n */\nexport type LiteMaterial = Material;\n\n/**\n * A Babylon Lite physically based material, re-exported under an ignifx name.\n *\n * @remarks\n * Unstable; excluded from the stability guarantees of `CONSTITUTION.md` Article IV.\n *\n * @public\n */\nexport type LitePbrMaterial = PbrMaterialProps;\n\n/**\n * A Babylon Lite Babylon-Standard material, re-exported under an ignifx name.\n *\n * @remarks\n * Unstable; excluded from the stability guarantees of `CONSTITUTION.md` Article IV.\n *\n * @public\n */\nexport type LiteStandardMaterial = StandardMaterialProps;\n\n/** glTF's default alpha cutoff, used when a `\"mask\"` material declares none. */\nconst DEFAULT_ALPHA_CUTOFF = 0.5;\n\n/**\n * How a material's alpha channel is interpreted, in glTF's vocabulary, in the order the inspector\n * lists them (`docs/architecture/07-rendering.md` §2.4).\n *\n * @public\n */\nexport const MATERIAL_ALPHA_MODES = [\"opaque\", \"mask\", \"blend\"] as const;\n\n/**\n * The union of the alpha modes a material can declare.\n *\n * @public\n */\nexport type MaterialAlphaMode = (typeof MATERIAL_ALPHA_MODES)[number];\n\n/**\n * The physically based material properties an ignifx `.material.json` declares\n * (`docs/architecture/06-serialization-and-scene-format.md` §6). Every field is optional; an\n * omitted field leaves Lite's own default in place.\n *\n * @internal\n */\nexport interface PbrMaterialInput {\n /** A human-readable name, used for glTF material overrides and diagnostics. */\n readonly name?: string;\n /** Linear base colour and alpha, multiplied with the base colour texture. */\n readonly baseColor?: readonly [number, number, number, number];\n /** The base colour texture. Load it with an sRGB format. */\n readonly baseColorTexture?: Texture2D;\n /** Metallic factor, 0 to 1. */\n readonly metallic?: number;\n /** Roughness factor, 0 to 1. */\n readonly roughness?: number;\n /** The packed occlusion/roughness/metallic texture (glTF `ORM`). */\n readonly metallicRoughnessTexture?: Texture2D;\n /** The tangent-space normal map. */\n readonly normalTexture?: Texture2D;\n /** Normal map strength. */\n readonly normalScale?: number;\n /** Linear emissive colour. */\n readonly emissive?: readonly [number, number, number];\n /** The emissive texture. */\n readonly emissiveTexture?: Texture2D;\n /** A separate occlusion texture, sampled on UV1 when the ORM texture is not used for it. */\n readonly occlusionTexture?: Texture2D;\n /** How strongly ambient occlusion darkens the surface, 0 to 1. */\n readonly occlusionStrength?: number;\n /** How the alpha channel is interpreted. */\n readonly alphaMode?: MaterialAlphaMode;\n /** The cutoff below which a `\"mask\"` material discards a fragment. */\n readonly alphaCutoff?: number;\n /** Overall material alpha, 0 to 1. */\n readonly alpha?: number;\n /** Whether back faces are drawn. */\n readonly doubleSided?: boolean;\n /** Whether lighting is skipped entirely. */\n readonly unlit?: boolean;\n /** How strongly the environment map contributes. */\n readonly environmentIntensity?: number;\n}\n\n/**\n * The Babylon-Standard material properties an ignifx `.material.json` declares, for the cheap\n * non-PBR path (`docs/architecture/07-rendering.md` §2.6).\n *\n * @internal\n */\nexport interface StandardMaterialInput {\n /** A human-readable name. */\n readonly name?: string;\n /** Linear diffuse colour. */\n readonly diffuse?: readonly [number, number, number];\n /** The diffuse texture. */\n readonly diffuseTexture?: Texture2D;\n /** Linear specular colour. */\n readonly specular?: readonly [number, number, number];\n /** Specular exponent; higher values give a tighter highlight. */\n readonly specularPower?: number;\n /** The specular texture. */\n readonly specularTexture?: Texture2D;\n /** Linear emissive colour. */\n readonly emissive?: readonly [number, number, number];\n /** The emissive texture. */\n readonly emissiveTexture?: Texture2D;\n /** The tangent-space normal map. */\n readonly normalTexture?: Texture2D;\n /** The opacity texture. */\n readonly opacityTexture?: Texture2D;\n /** Overall material alpha, 0 to 1. */\n readonly alpha?: number;\n /** The cutoff below which a fragment is discarded. `0` disables the alpha test. */\n readonly alphaCutoff?: number;\n /** Whether back faces are drawn. */\n readonly doubleSided?: boolean;\n /** Whether lighting is skipped entirely. */\n readonly unlit?: boolean;\n}\n\n/**\n * Builds a Lite PBR material from ignifx props.\n *\n * @param input - The declared properties.\n * @returns The material. It holds no GPU resource of its own; the textures it references do.\n *\n * @example\n * ```ts\n * const gold = createPbrMaterialFromProps({ baseColor: [1, 0.77, 0.34, 1], metallic: 1, roughness: 0.25 });\n * ```\n *\n * @internal\n */\nexport function createPbrMaterialFromProps(input: PbrMaterialInput): PbrMaterialProps {\n const props: Partial<PbrMaterialProps> = {};\n if (input.name !== undefined) {\n props.name = input.name;\n }\n if (input.baseColor !== undefined) {\n props.baseColorFactor = [input.baseColor[0], input.baseColor[1], input.baseColor[2], input.baseColor[3]];\n }\n if (input.baseColorTexture !== undefined) {\n props.baseColorTexture = input.baseColorTexture;\n }\n if (input.metallic !== undefined) {\n props.metallicFactor = input.metallic;\n }\n if (input.roughness !== undefined) {\n props.roughnessFactor = input.roughness;\n }\n if (input.metallicRoughnessTexture !== undefined) {\n props.ormTexture = input.metallicRoughnessTexture;\n }\n if (input.normalTexture !== undefined) {\n props.normalTexture = input.normalTexture;\n }\n if (input.normalScale !== undefined) {\n props.normalTextureScale = input.normalScale;\n }\n if (input.emissiveTexture !== undefined) {\n props.emissiveTexture = input.emissiveTexture;\n }\n if (input.occlusionTexture !== undefined) {\n props.occlusionTexture = input.occlusionTexture;\n }\n if (input.occlusionStrength !== undefined) {\n props.occlusionStrength = input.occlusionStrength;\n }\n if (input.alpha !== undefined) {\n props.alpha = input.alpha;\n }\n if (input.doubleSided !== undefined) {\n props.doubleSided = input.doubleSided;\n }\n if (input.environmentIntensity !== undefined) {\n props.environmentIntensity = input.environmentIntensity;\n }\n if (input.alphaMode === \"blend\") {\n props.alphaBlend = true;\n }\n const material = createPbrMaterial(props);\n if (input.alphaMode === \"mask\") {\n setPbrAlphaCutoff(material, input.alphaCutoff ?? DEFAULT_ALPHA_CUTOFF);\n }\n if (input.emissive !== undefined) {\n setPbrEmissive(material, [input.emissive[0], input.emissive[1], input.emissive[2]]);\n }\n if (input.unlit === true) {\n setPbrUnlit(material);\n }\n return material;\n}\n\n/**\n * Builds a Lite Standard material from ignifx props.\n *\n * @param input - The declared properties.\n * @returns The material.\n *\n * @internal\n */\nexport function createStandardMaterialFromProps(input: StandardMaterialInput): StandardMaterialProps {\n const material = createStandardMaterial();\n if (input.name !== undefined) {\n material.name = input.name;\n }\n if (input.diffuse !== undefined) {\n writeTriple(material.diffuseColor, input.diffuse);\n }\n if (input.specular !== undefined) {\n writeTriple(material.specularColor, input.specular);\n }\n if (input.emissive !== undefined) {\n writeTriple(material.emissiveColor, input.emissive);\n }\n if (input.specularPower !== undefined) {\n material.specularPower = input.specularPower;\n }\n if (input.alpha !== undefined) {\n material.alpha = input.alpha;\n }\n if (input.alphaCutoff !== undefined) {\n material.alphaCutOff = input.alphaCutoff;\n }\n if (input.doubleSided !== undefined) {\n material.backFaceCulling = !input.doubleSided;\n }\n if (input.unlit !== undefined) {\n material.disableLighting = input.unlit;\n }\n if (input.diffuseTexture !== undefined) {\n material.diffuseTexture = input.diffuseTexture;\n }\n if (input.specularTexture !== undefined) {\n setStandardSpecularTexture(material, input.specularTexture);\n }\n if (input.emissiveTexture !== undefined) {\n setStandardEmissiveTexture(material, input.emissiveTexture);\n }\n if (input.normalTexture !== undefined) {\n setStandardBumpTexture(material, input.normalTexture);\n }\n if (input.opacityTexture !== undefined) {\n setStandardOpacityTexture(material, input.opacityTexture);\n }\n return material;\n}\n\n/**\n * The material a `MeshRenderer` uses when it declares none: a neutral, fully rough dielectric.\n *\n * @returns A fresh material. Callers share one instance per app rather than one per renderer.\n *\n * @internal\n */\nexport function createDefaultMaterial(): PbrMaterialProps {\n return createPbrMaterialFromProps({\n name: \"ignifx:default\",\n baseColor: [1, 1, 1, 1],\n metallic: 0,\n roughness: 0.9,\n });\n}\n\n/**\n * Replaces a PBR material's linear base colour.\n *\n * @param material - The material to change.\n * @param r - The linear red component.\n * @param g - The linear green component.\n * @param b - The linear blue component.\n * @param a - The alpha component.\n *\n * @internal\n */\nexport function setPbrBaseColor(material: PbrMaterialProps, r: number, g: number, b: number, a: number): void {\n const factor = material.baseColorFactor;\n if (factor === undefined) {\n material.baseColorFactor = [r, g, b, a];\n } else {\n factor[0] = r;\n factor[1] = g;\n factor[2] = b;\n factor[3] = a;\n }\n markMaterialDirty(material);\n}\n\n/**\n * Replaces a PBR material's metallic and roughness factors.\n *\n * @param material - The material to change.\n * @param metallic - The metallic factor, 0 to 1.\n * @param roughness - The roughness factor, 0 to 1.\n *\n * @internal\n */\nexport function setPbrMetallicRoughness(material: PbrMaterialProps, metallic: number, roughness: number): void {\n material.metallicFactor = metallic;\n material.roughnessFactor = roughness;\n markMaterialDirty(material);\n}\n\n/**\n * Replaces a material's overall alpha.\n *\n * @param material - The PBR or Standard material to change.\n * @param alpha - The new alpha, 0 to 1.\n *\n * @internal\n */\nexport function setMaterialAlpha(material: PbrMaterialProps | StandardMaterialProps, alpha: number): void {\n material.alpha = alpha;\n markMaterialDirty(material);\n}\n\n/**\n * Marks a material's uniform block for re-upload on the next frame.\n *\n * @remarks\n * This is the cheap path and covers every scalar, vector, and colour edit. It does **not** cover\n * changes that alter the compiled feature set; those go through {@link rebuildMaterialPipelines}.\n *\n * @param material - The material that changed.\n *\n * @internal\n */\nexport function markMaterialDirty(material: Material): void {\n markMaterialUboDirty(material);\n}\n\n/**\n * Rebuilds the renderables of a material whose compiled feature set changed.\n *\n * @remarks\n * Needed after binding or clearing a texture, changing culling, or toggling a sub-feature\n * (`index.d.ts` 11133). `rebuildFrameGraph` is left off so a component can batch several material\n * edits and rebuild the frame graph once.\n *\n * @param scene - The scene the material renders in.\n * @param material - The material that changed.\n *\n * @internal\n */\nexport function rebuildMaterialPipelines(scene: SceneContext, material: Material): void {\n // Since 1.34 a PBR rebuild in a built scene finishes asynchronously, and Lite reports its failure\n // itself (`lib/material/material-rebuild.js`, `rebuildMaterial`), so nothing is left to await.\n void rebuildMaterial(scene, material);\n}\n\n/**\n * Installs automatic dirty tracking on a material, so property writes mark its uniform block\n * without an explicit {@link markMaterialDirty}.\n *\n * @remarks\n * Lite installs the tracker by rewriting the material's property descriptors, and the module that\n * does it is loaded lazily, so this is asynchronous (`index.d.ts` 4480,\n * `lib/material/observable-material.js`). Opt-in only: it costs an accessor call per write, which\n * the zero-allocation rules (coding standards §7) do not want on every material.\n *\n * @param material - The PBR or Standard material to track.\n * @returns A promise that resolves once the tracker is installed.\n *\n * @internal\n */\nexport function enableMaterialChangeTracking(material: PbrMaterialProps | StandardMaterialProps): Promise<void> {\n return enableMaterialTracking(material);\n}\n\n/**\n * Reports whether Lite will alpha-blend a material declared with this alpha mode.\n *\n * @param mode - The declared alpha mode.\n * @returns `true` for `\"blend\"`, `false` for `\"opaque\"` and `\"mask\"`.\n *\n * @internal\n */\nexport function isBlendedAlphaMode(mode: MaterialAlphaMode): boolean {\n switch (mode) {\n case \"opaque\":\n case \"mask\":\n return false;\n case \"blend\":\n return true;\n default:\n return assertNever(mode, \"material alpha mode\");\n }\n}\n\n/**\n * Writes three components into a Lite colour tuple in place.\n *\n * @param target - The tuple Lite owns.\n * @param source - The values to copy.\n */\nfunction writeTriple(target: [number, number, number], source: readonly [number, number, number]): void {\n target[0] = source[0];\n target[1] = source[1];\n target[2] = source[2];\n}\n"],"mappings":";;;AAmFA,MAAM,uBAAuB;;;;;;;AAQ7B,MAAa,uBAAuB;CAAC;CAAU;CAAQ;AAAO;;;;;;;;;;;;;;AAyG9D,SAAgB,2BAA2B,OAA2C;CACpF,MAAM,QAAmC,CAAC;CAC1C,IAAI,MAAM,SAAS,KAAA,GACjB,MAAM,OAAO,MAAM;CAErB,IAAI,MAAM,cAAc,KAAA,GACtB,MAAM,kBAAkB;EAAC,MAAM,UAAU;EAAI,MAAM,UAAU;EAAI,MAAM,UAAU;EAAI,MAAM,UAAU;CAAE;CAEzG,IAA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G,SAAS,iBAAiB;CAC1B,SAAS,kBAAkB;CAC3B,kBAAkB,QAAQ;AAC5B;;;;;;;;;AAUA,SAAgB,iBAAiB,UAAoD,OAAqB;CACxG,SAAS,QAAQ;CACjB,kBAAkB,QAAQ;AAC5B;;;;;;;;;;;;AAaA,SAAgB,kBAAkB,UAA0B;CAC1D,qBAAqB,QAAQ;AAC/B;;;;;;;;;;;;;;AAeA,SAAgB,yBAAyB,OAAqB,UAA0B;CAGtF,gBAAqB,OAAO,QAAQ;AACtC;;;;;;;AA+CA,SAAS,YAAY,QAAkC,QAAiD;CACtG,OAAO,KAAK,OAAO;CACnB,OAAO,KAAK,OAAO;CACnB,OAAO,KAAK,OAAO;AACrB"}
@@ -1,206 +1,5 @@
1
- import { n as assertNever, o as CoreErrorCode, t as IgnifxError } from "./ignifx-error-Dq2qJMkZ.js";
1
+ import { n as assertNever, o as CoreErrorCode, t as IgnifxError } from "./ignifx-error-oYdVnT1S.js";
2
2
  import { u as SHADER_UNIFORM_TYPES } from "./shader-declaration-5q__jycG.js";
3
- import { createPbrMaterial, createStandardMaterial, markMaterialUboDirty, rebuildMaterial, setPbrAlphaCutoff, setPbrEmissive, setPbrUnlit, setStandardBumpTexture, setStandardEmissiveTexture, setStandardOpacityTexture, setStandardSpecularTexture } from "@babylonjs/lite";
4
- //#region src/lite/material.ts
5
- /** glTF's default alpha cutoff, used when a `"mask"` material declares none. */
6
- const DEFAULT_ALPHA_CUTOFF = .5;
7
- /**
8
- * How a material's alpha channel is interpreted, in glTF's vocabulary, in the order the inspector
9
- * lists them (`docs/architecture/07-rendering.md` §2.4).
10
- *
11
- * @public
12
- */
13
- const MATERIAL_ALPHA_MODES = [
14
- "opaque",
15
- "mask",
16
- "blend"
17
- ];
18
- /**
19
- * Builds a Lite PBR material from ignifx props.
20
- *
21
- * @param input - The declared properties.
22
- * @returns The material. It holds no GPU resource of its own; the textures it references do.
23
- *
24
- * @example
25
- * ```ts
26
- * const gold = createPbrMaterialFromProps({ baseColor: [1, 0.77, 0.34, 1], metallic: 1, roughness: 0.25 });
27
- * ```
28
- *
29
- * @internal
30
- */
31
- function createPbrMaterialFromProps(input) {
32
- const props = {};
33
- if (input.name !== void 0) props.name = input.name;
34
- if (input.baseColor !== void 0) props.baseColorFactor = [
35
- input.baseColor[0],
36
- input.baseColor[1],
37
- input.baseColor[2],
38
- input.baseColor[3]
39
- ];
40
- if (input.baseColorTexture !== void 0) props.baseColorTexture = input.baseColorTexture;
41
- if (input.metallic !== void 0) props.metallicFactor = input.metallic;
42
- if (input.roughness !== void 0) props.roughnessFactor = input.roughness;
43
- if (input.metallicRoughnessTexture !== void 0) props.ormTexture = input.metallicRoughnessTexture;
44
- if (input.normalTexture !== void 0) props.normalTexture = input.normalTexture;
45
- if (input.normalScale !== void 0) props.normalTextureScale = input.normalScale;
46
- if (input.emissiveTexture !== void 0) props.emissiveTexture = input.emissiveTexture;
47
- if (input.occlusionTexture !== void 0) props.occlusionTexture = input.occlusionTexture;
48
- if (input.occlusionStrength !== void 0) props.occlusionStrength = input.occlusionStrength;
49
- if (input.alpha !== void 0) props.alpha = input.alpha;
50
- if (input.doubleSided !== void 0) props.doubleSided = input.doubleSided;
51
- if (input.environmentIntensity !== void 0) props.environmentIntensity = input.environmentIntensity;
52
- if (input.alphaMode === "blend") props.alphaBlend = true;
53
- const material = createPbrMaterial(props);
54
- if (input.alphaMode === "mask") setPbrAlphaCutoff(material, input.alphaCutoff ?? DEFAULT_ALPHA_CUTOFF);
55
- if (input.emissive !== void 0) setPbrEmissive(material, [
56
- input.emissive[0],
57
- input.emissive[1],
58
- input.emissive[2]
59
- ]);
60
- if (input.unlit === true) setPbrUnlit(material);
61
- return material;
62
- }
63
- /**
64
- * Builds a Lite Standard material from ignifx props.
65
- *
66
- * @param input - The declared properties.
67
- * @returns The material.
68
- *
69
- * @internal
70
- */
71
- function createStandardMaterialFromProps(input) {
72
- const material = createStandardMaterial();
73
- if (input.name !== void 0) material.name = input.name;
74
- if (input.diffuse !== void 0) writeTriple(material.diffuseColor, input.diffuse);
75
- if (input.specular !== void 0) writeTriple(material.specularColor, input.specular);
76
- if (input.emissive !== void 0) writeTriple(material.emissiveColor, input.emissive);
77
- if (input.specularPower !== void 0) material.specularPower = input.specularPower;
78
- if (input.alpha !== void 0) material.alpha = input.alpha;
79
- if (input.alphaCutoff !== void 0) material.alphaCutOff = input.alphaCutoff;
80
- if (input.doubleSided !== void 0) material.backFaceCulling = !input.doubleSided;
81
- if (input.unlit !== void 0) material.disableLighting = input.unlit;
82
- if (input.diffuseTexture !== void 0) material.diffuseTexture = input.diffuseTexture;
83
- if (input.specularTexture !== void 0) setStandardSpecularTexture(material, input.specularTexture);
84
- if (input.emissiveTexture !== void 0) setStandardEmissiveTexture(material, input.emissiveTexture);
85
- if (input.normalTexture !== void 0) setStandardBumpTexture(material, input.normalTexture);
86
- if (input.opacityTexture !== void 0) setStandardOpacityTexture(material, input.opacityTexture);
87
- return material;
88
- }
89
- /**
90
- * The material a `MeshRenderer` uses when it declares none: a neutral, fully rough dielectric.
91
- *
92
- * @returns A fresh material. Callers share one instance per app rather than one per renderer.
93
- *
94
- * @internal
95
- */
96
- function createDefaultMaterial() {
97
- return createPbrMaterialFromProps({
98
- name: "ignifx:default",
99
- baseColor: [
100
- 1,
101
- 1,
102
- 1,
103
- 1
104
- ],
105
- metallic: 0,
106
- roughness: .9
107
- });
108
- }
109
- /**
110
- * Replaces a PBR material's linear base colour.
111
- *
112
- * @param material - The material to change.
113
- * @param r - The linear red component.
114
- * @param g - The linear green component.
115
- * @param b - The linear blue component.
116
- * @param a - The alpha component.
117
- *
118
- * @internal
119
- */
120
- function setPbrBaseColor(material, r, g, b, a) {
121
- const factor = material.baseColorFactor;
122
- if (factor === void 0) material.baseColorFactor = [
123
- r,
124
- g,
125
- b,
126
- a
127
- ];
128
- else {
129
- factor[0] = r;
130
- factor[1] = g;
131
- factor[2] = b;
132
- factor[3] = a;
133
- }
134
- markMaterialDirty(material);
135
- }
136
- /**
137
- * Replaces a PBR material's metallic and roughness factors.
138
- *
139
- * @param material - The material to change.
140
- * @param metallic - The metallic factor, 0 to 1.
141
- * @param roughness - The roughness factor, 0 to 1.
142
- *
143
- * @internal
144
- */
145
- function setPbrMetallicRoughness(material, metallic, roughness) {
146
- material.metallicFactor = metallic;
147
- material.roughnessFactor = roughness;
148
- markMaterialDirty(material);
149
- }
150
- /**
151
- * Replaces a material's overall alpha.
152
- *
153
- * @param material - The PBR or Standard material to change.
154
- * @param alpha - The new alpha, 0 to 1.
155
- *
156
- * @internal
157
- */
158
- function setMaterialAlpha(material, alpha) {
159
- material.alpha = alpha;
160
- markMaterialDirty(material);
161
- }
162
- /**
163
- * Marks a material's uniform block for re-upload on the next frame.
164
- *
165
- * @remarks
166
- * This is the cheap path and covers every scalar, vector, and colour edit. It does **not** cover
167
- * changes that alter the compiled feature set; those go through {@link rebuildMaterialPipelines}.
168
- *
169
- * @param material - The material that changed.
170
- *
171
- * @internal
172
- */
173
- function markMaterialDirty(material) {
174
- markMaterialUboDirty(material);
175
- }
176
- /**
177
- * Rebuilds the renderables of a material whose compiled feature set changed.
178
- *
179
- * @remarks
180
- * Needed after binding or clearing a texture, changing culling, or toggling a sub-feature
181
- * (`index.d.ts` 11133). `rebuildFrameGraph` is left off so a component can batch several material
182
- * edits and rebuild the frame graph once.
183
- *
184
- * @param scene - The scene the material renders in.
185
- * @param material - The material that changed.
186
- *
187
- * @internal
188
- */
189
- function rebuildMaterialPipelines(scene, material) {
190
- rebuildMaterial(scene, material);
191
- }
192
- /**
193
- * Writes three components into a Lite colour tuple in place.
194
- *
195
- * @param target - The tuple Lite owns.
196
- * @param source - The values to copy.
197
- */
198
- function writeTriple(target, source) {
199
- target[0] = source[0];
200
- target[1] = source[1];
201
- target[2] = source[2];
202
- }
203
- //#endregion
204
3
  //#region src/render/material-plugin.ts
205
4
  /**
206
5
  * The raw Babylon Lite material-plugin points, as a `@beta` escape hatch
@@ -480,6 +279,6 @@ function assertUniformType(plugin, binding, type) {
480
279
  });
481
280
  }
482
281
  //#endregion
483
- export { defineMaterialPlugin as a, MATERIAL_ALPHA_MODES as c, createStandardMaterialFromProps as d, markMaterialDirty as f, setPbrMetallicRoughness as g, setPbrBaseColor as h, MATERIAL_PLUGIN_SAMPLER_BUDGET as i, createDefaultMaterial as l, setMaterialAlpha as m, MATERIAL_PLUGIN_DEFAULT_PRIORITY as n, isLiteMaterialPluginPoint as o, rebuildMaterialPipelines as p, MATERIAL_PLUGIN_RESERVED_NAMES as r, uniformComponentCount as s, LITE_MATERIAL_PLUGIN_POINTS as t, createPbrMaterialFromProps as u };
282
+ export { defineMaterialPlugin as a, MATERIAL_PLUGIN_SAMPLER_BUDGET as i, MATERIAL_PLUGIN_DEFAULT_PRIORITY as n, isLiteMaterialPluginPoint as o, MATERIAL_PLUGIN_RESERVED_NAMES as r, uniformComponentCount as s, LITE_MATERIAL_PLUGIN_POINTS as t };
484
283
 
485
- //# sourceMappingURL=material-plugin-BOCB7Stt.js.map
284
+ //# sourceMappingURL=material-plugin-BUlqLsap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"material-plugin-BUlqLsap.js","names":[],"sources":["../src/render/material-plugin.ts"],"sourcesContent":["import { CoreErrorCode } from \"../errors/error-codes.js\";\nimport { assertNever, IgnifxError } from \"../errors/ignifx-error.js\";\nimport { SHADER_UNIFORM_TYPES } from \"./shader-declaration.js\";\nimport type { ShaderTextureDeclaration, ShaderUniformDeclaration, ShaderUniformType } from \"./shader-declaration.js\";\n\n/**\n * The raw Babylon Lite material-plugin points, as a `@beta` escape hatch\n * (`docs/plan/2026-09-terrain-particles-shaders.md` §3.2, ADR-0024).\n *\n * `@beta` because the meaning of each point is whatever the surrounding Lite template declares at\n * that line; ignifx's stable contract is the three hooks of `./surface-shader.ts`. Four rules read\n * out of `@babylonjs/lite@1.27.0`'s `lib/` on 2026-09-08:\n *\n * - Plugin uniforms and samplers are **fragment-stage only** on both families\n * (`lib/material/plugin/plugin-bridge-shared.js` 99), and there is no vertex helper-function\n * channel, so vertex code may read only attributes, `mesh.world` and the scene block, and must be\n * statements rather than functions.\n * - `CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION` is injected **twice** — Lite maps it to the two\n * adjacent PBR slots `AI` and `NI` — so its code must be idempotent or guard itself with a flag\n * set at an earlier point, and must declare nothing at statement level.\n * - Only PBR carries `CUSTOM_FRAGMENT_UPDATE_DIFFUSE` after `CUSTOM_FRAGMENT_UPDATE_ALPHA`;\n * Standard's template orders them the other way and has no `AI`/`NI`/`MF` slots.\n * - `roughness` and `metallic` are `let` in the PBR template and cannot be written.\n */\n\n/**\n * The Babylon Lite injection points a {@link MaterialPluginDefinition} may fill in.\n *\n * @remarks\n * The names are Lite's own (`MaterialPluginPoint`, `index.d.ts` 7084) and are taught verbatim,\n * because a plugin's code is written against the template around the point.\n *\n * @beta\n */\nexport const LITE_MATERIAL_PLUGIN_POINTS = [\n \"CUSTOM_FRAGMENT_DEFINITIONS\",\n \"CUSTOM_FRAGMENT_MAIN_BEGIN\",\n \"CUSTOM_FRAGMENT_UPDATE_ALPHA\",\n \"CUSTOM_FRAGMENT_UPDATE_DIFFUSE\",\n \"CUSTOM_FRAGMENT_BEFORE_LIGHTS\",\n \"CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\",\n \"CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\",\n \"CUSTOM_VERTEX_MAIN_BEGIN\",\n \"CUSTOM_VERTEX_UPDATE_WORLDPOS\",\n \"CUSTOM_VERTEX_MAIN_END\",\n] as const;\n\n/**\n * One of Babylon Lite's ten material-plugin injection points.\n *\n * @beta\n */\nexport type LiteMaterialPluginPoint = (typeof LITE_MATERIAL_PLUGIN_POINTS)[number];\n\n/**\n * The default priority Babylon Lite gives a plugin with none (`index.d.ts` 7057).\n *\n * @beta\n */\nexport const MATERIAL_PLUGIN_DEFAULT_PRIORITY = 500;\n\n/**\n * How many `texture`/`sampler` pairs one material's plugins may declare together.\n *\n * @remarks\n * Measured on a device on 2026-09-08 (spike S0.2): a fully textured PBR material — base colour,\n * normal, ORM, emissive — with image-based lighting and one PCF shadow light already binds seven\n * textures and seven samplers of the sixteen per stage that every WebGPU implementation guarantees,\n * SwiftShader included, and Lite requests no higher `requiredLimits`. Nine is what is left, and it\n * drops to eight with a second shadow light and seven with a lightmap, so a material that means to\n * be portable should stay well under the cap.\n *\n * @beta\n */\nexport const MATERIAL_PLUGIN_SAMPLER_BUDGET = 9;\n\n/**\n * The WGSL names the PBR and Standard templates already own, which a plugin may not reuse for a\n * uniform field or a sampler.\n *\n * @remarks\n * A plugin's fields land in the host's own uniform block and its samplers in the host's own bind\n * group, so a collision is a duplicate WGSL declaration and the whole material stops compiling with\n * a message that names neither the plugin nor the field. Refusing at attach time is the difference\n * between a sentence and a shader dump. Read from `pbr-template.js` `_baseMaterialUboFields` and\n * `_baseBindings`, and `standard-template.js` `materialStruct` and `_baseBindings`.\n *\n * @beta\n */\nexport const MATERIAL_PLUGIN_RESERVED_NAMES: readonly string[] = Object.freeze([\n // Blocks and entry points the templates declare.\n \"material\",\n \"mesh\",\n \"scene\",\n \"lights\",\n \"pluginUbo\",\n \"shadowParams\",\n \"main\",\n // PBR material uniform fields.\n \"environmentIntensity\",\n \"directIntensity\",\n \"reflectance\",\n \"materialAlpha\",\n \"baseColorFactor\",\n \"metallicFactor\",\n \"roughnessFactor\",\n \"normalScale\",\n \"lightFalloffMode\",\n \"anisotropyParams\",\n // PBR samplers.\n \"baseColorTexture\",\n \"baseColorSampler\",\n \"normalTexture\",\n \"normalSampler_\",\n \"ormTexture\",\n \"ormSampler\",\n \"emissiveTexture\",\n \"emissiveSampler\",\n \"specGlossTexture\",\n \"specGlossSampler\",\n // Standard samplers (`standard-template.js` uses two-letter names).\n \"dT\",\n \"dS\",\n \"mat\",\n \"up\",\n]);\n\n/**\n * What a raw material plugin declares: a name, the values and textures it wants beside the host\n * material's own, and the WGSL it injects.\n *\n * @beta\n */\nexport interface MaterialPluginDefinition {\n /** The plugin's identity. It is part of Lite's pipeline cache key, so it must be stable. */\n readonly name: string;\n /** Lower runs first; Lite's own default is {@link MATERIAL_PLUGIN_DEFAULT_PRIORITY}. */\n readonly priority: number;\n /** The uniform fields appended to the host material's uniform block. Fragment stage only. */\n readonly uniforms: readonly ShaderUniformDeclaration[];\n /** The `texture`/`sampler` pairs added to the host material's bind group. Fragment stage only. */\n readonly textures: readonly ShaderTextureDeclaration[];\n /** The WGSL to inject, by point. Vertex points take statements; there are no vertex helpers. */\n readonly code: Readonly<Partial<Record<LiteMaterialPluginPoint, string>>>;\n}\n\n/**\n * The properties {@link defineMaterialPlugin} accepts; everything but `name` and `code` has a\n * default.\n *\n * @beta\n */\nexport interface MaterialPluginDefinitionInit {\n /** The plugin's identity. */\n readonly name: string;\n /** Lower runs first. Defaults to {@link MATERIAL_PLUGIN_DEFAULT_PRIORITY}. */\n readonly priority?: number;\n /** The uniform fields. Defaults to none. */\n readonly uniforms?: readonly ShaderUniformDeclaration[];\n /** The samplers. Defaults to none. */\n readonly textures?: readonly ShaderTextureDeclaration[];\n /** The WGSL to inject, by point. */\n readonly code: Readonly<Partial<Record<LiteMaterialPluginPoint, string>>>;\n}\n\n/** Matches a WGSL identifier. */\nconst IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;\n\n/** Matches a legal plugin name: an identifier, optionally with `.`, `:`, or `-` inside it. */\nconst PLUGIN_NAME = /^[A-Za-z_][A-Za-z0-9_]*(?:[.:-][A-Za-z0-9_]+)*$/;\n\n/**\n * Validates a raw material-plugin declaration and fills in its defaults.\n *\n * @remarks\n * Nothing here reaches a device: the result is plain data that `attachSurfaceShaders` and\n * `attachMaterialPlugin` turn into a Lite plugin. The checks are the ones whose failure would\n * otherwise surface as a WGSL compile error with no mention of the plugin — an empty `code`, a\n * duplicate or reserved binding name, a name that is not a WGSL identifier, an unknown injection\n * point, or more samplers than {@link MATERIAL_PLUGIN_SAMPLER_BUDGET}.\n *\n * The **surface-shader compiler produces one of these**, so a bug in this validation is a bug in\n * every surface shader too, which is why it lives here rather than inside the compiler.\n *\n * @param definition - The declaration.\n * @returns The same declaration with `priority`, `uniforms`, and `textures` filled in.\n * @throws IgnifxError with code `IGX-0723` when `code` fills in no point, `IGX-0712` when a name is\n * not a legal, unique, unreserved WGSL identifier or a point name is unknown, or `IGX-0726` when the\n * plugin alone exceeds the sampler budget.\n *\n * @example\n * ```ts\n * const tint = defineMaterialPlugin({\n * name: \"tint\",\n * code: { CUSTOM_FRAGMENT_UPDATE_ALPHA: \"baseColor = baseColor * vec3<f32>(1.0, 0.5, 0.5);\" },\n * });\n * ```\n *\n * @beta\n */\nexport function defineMaterialPlugin(definition: MaterialPluginDefinitionInit): MaterialPluginDefinition {\n const name = definition.name;\n if (!PLUGIN_NAME.test(name)) {\n throw new IgnifxError(\n CoreErrorCode.unknownShaderBinding,\n `${JSON.stringify(name)} is not a legal material-plugin name.`,\n {\n context: { plugin: name, name },\n hint: \"Start with a letter or underscore; letters, digits, underscores, and inner . : - follow.\",\n },\n );\n }\n const points = Object.keys(definition.code);\n let filled = 0;\n for (const point of points) {\n if (!isLiteMaterialPluginPoint(point)) {\n throw new IgnifxError(CoreErrorCode.unknownShaderBinding, `${name} declares no Lite point named ${point}.`, {\n context: { plugin: name, name: point, point },\n hint: `The ten points are ${LITE_MATERIAL_PLUGIN_POINTS.join(\", \")}.`,\n });\n }\n if ((definition.code[point] ?? \"\").trim().length > 0) {\n filled += 1;\n }\n }\n if (filled === 0) {\n throw new IgnifxError(CoreErrorCode.surfaceHookMissing, `${name} injects no WGSL at any Lite point.`, {\n context: { plugin: name, name },\n hint: \"Fill in at least one of the ten points, or do not attach the plugin.\",\n });\n }\n const uniforms = definition.uniforms ?? [];\n const textures = definition.textures ?? [];\n const seen = new Set<string>();\n for (const uniform of uniforms) {\n assertBindingName(name, uniform.name, seen);\n assertUniformType(name, uniform.name, uniform.type);\n }\n for (const texture of textures) {\n assertBindingName(name, texture.name, seen);\n assertBindingName(name, `${texture.name}Sampler`, seen);\n }\n if (textures.length > MATERIAL_PLUGIN_SAMPLER_BUDGET) {\n throw new IgnifxError(\n CoreErrorCode.surfaceSamplerBudgetExceeded,\n `${name} declares ${String(textures.length)} samplers; a material's plugins may declare ${String(MATERIAL_PLUGIN_SAMPLER_BUDGET)} together.`,\n {\n context: { plugin: name, samplers: textures.length, budget: MATERIAL_PLUGIN_SAMPLER_BUDGET },\n hint: \"Pack the maps into fewer textures — an RGBA control map rather than four masks.\",\n },\n );\n }\n return {\n name,\n priority: definition.priority ?? MATERIAL_PLUGIN_DEFAULT_PRIORITY,\n uniforms,\n textures,\n code: definition.code,\n };\n}\n\n/**\n * Whether a string is one of Lite's ten injection points.\n *\n * @param value - The candidate.\n * @returns `true` when Lite accepts it.\n *\n * @beta\n */\nexport function isLiteMaterialPluginPoint(value: string): value is LiteMaterialPluginPoint {\n for (const point of LITE_MATERIAL_PLUGIN_POINTS) {\n if (point === value) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * How many floats one uniform of a declared type occupies on the CPU side.\n *\n * @param type - The declared WGSL type.\n * @returns The component count: 1, 2, 3, 4, or 16.\n *\n * @internal\n */\nexport function uniformComponentCount(type: ShaderUniformType): number {\n switch (type) {\n case \"vec2<f32>\": {\n return 2;\n }\n case \"vec3<f32>\": {\n return 3;\n }\n case \"vec4<f32>\": {\n return 4;\n }\n case \"mat4x4<f32>\": {\n return 16;\n }\n case \"f32\":\n case \"u32\":\n case \"i32\": {\n return 1;\n }\n default: {\n return assertNever(type, \"shader uniform type\");\n }\n }\n}\n\n/**\n * Refuses a binding name that is not a unique, unreserved WGSL identifier.\n *\n * @param plugin - The plugin's name, for the message.\n * @param binding - The candidate name.\n * @param seen - The names already taken by this plugin; the accepted name is added.\n * @throws IgnifxError with code `IGX-0712`.\n */\nfunction assertBindingName(plugin: string, binding: string, seen: Set<string>): void {\n if (!IDENTIFIER.test(binding)) {\n throw new IgnifxError(\n CoreErrorCode.unknownShaderBinding,\n `${plugin} declares ${JSON.stringify(binding)}, which is not a WGSL identifier.`,\n { context: { plugin, name: binding }, hint: \"Use letters, digits, and underscores, starting with a letter.\" },\n );\n }\n if (MATERIAL_PLUGIN_RESERVED_NAMES.includes(binding)) {\n throw new IgnifxError(\n CoreErrorCode.unknownShaderBinding,\n `${plugin} declares ${binding}, which Babylon Lite's own PBR or Standard shader already owns.`,\n { context: { plugin, name: binding }, hint: \"Rename it; a plugin shares the host material's WGSL namespace.\" },\n );\n }\n if (seen.has(binding)) {\n throw new IgnifxError(CoreErrorCode.unknownShaderBinding, `${plugin} declares ${binding} twice.`, {\n context: { plugin, name: binding },\n hint: \"Every uniform and texture of one plugin needs its own name.\",\n });\n }\n seen.add(binding);\n}\n\n/**\n * Refuses a uniform type Lite's plugin bridge cannot carry.\n *\n * @param plugin - The plugin's name, for the message.\n * @param binding - The uniform's name.\n * @param type - The declared type.\n * @throws IgnifxError with code `IGX-0712`.\n */\nfunction assertUniformType(plugin: string, binding: string, type: ShaderUniformType): void {\n if (!SHADER_UNIFORM_TYPES.includes(type)) {\n throw new IgnifxError(CoreErrorCode.unknownShaderBinding, `${plugin}.${binding} declares the type ${type}.`, {\n context: { plugin, name: binding, type },\n hint: `The plugin uniform types are ${SHADER_UNIFORM_TYPES.join(\", \")}.`,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,8BAA8B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;AAcA,MAAa,mCAAmC;;;;;;;;;;;;;;AAehD,MAAa,iCAAiC;;;;;;;;;;;;;;AAe9C,MAAa,iCAAoD,OAAO,OAAO;CAE7E;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;AACF,CAAC;;AAyCD,MAAM,aAAa;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,CAAC,qBAAqB,SAAS,IAAI,GACrC,MAAM,IAAI,YAAY,cAAc,sBAAsB,GAAG,OAAO,GAAG,QAAQ,qBAAqB,KAAK,IAAI;EAC3G,SAAS;GAAE;GAAQ,MAAM;GAAS;EAAK;EACvC,MAAM,gCAAgC,qBAAqB,KAAK,IAAI,EAAE;CACxE,CAAC;AAEL"}
@@ -1,4 +1,4 @@
1
- import { n as assertNever, o as CoreErrorCode, t as IgnifxError } from "./ignifx-error-Dq2qJMkZ.js";
1
+ import { n as assertNever, o as CoreErrorCode, t as IgnifxError } from "./ignifx-error-oYdVnT1S.js";
2
2
  import { i as declaredTextureBinding, n as POST_EFFECT_FUNCTION, t as POST_EFFECT_BUILTIN_UNIFORMS } from "./post-effect-BHl7U56q.js";
3
3
  //#region src/render/post-effect-compiler.ts
4
4
  /**
@@ -308,4 +308,4 @@ function isBuiltinUniformName(name) {
308
308
  //#endregion
309
309
  export { compilePostEffect, compiledPostEffect, writePostEffectValues };
310
310
 
311
- //# sourceMappingURL=post-effect-compiler-Dw6zW2cG.js.map
311
+ //# sourceMappingURL=post-effect-compiler-CRek8VxQ.js.map