@voluma/vlam 0.3.0 → 0.3.2

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 (119) hide show
  1. package/README.md +0 -2
  2. package/dist/chunk-loader-DlNwggfG.js.map +1 -1
  3. package/dist/{index.d.ts → core/index.d.ts} +1 -1
  4. package/dist/{splat-budget.d.ts → core/splat-budget.d.ts} +1 -1
  5. package/dist/{splat-data.d.ts → core/splat-data.d.ts} +1 -1
  6. package/dist/{splat-mesh-types.d.ts → core/splat-mesh-types.d.ts} +5 -2
  7. package/dist/{effects.d.ts → effects/index.d.ts} +3 -3
  8. package/dist/effects.js.map +1 -1
  9. package/dist/formats/ksplat/parse-ksplat.d.ts +1 -1
  10. package/dist/formats/ksplat.js.map +1 -1
  11. package/dist/formats/lcc/collision-mesh.d.ts +2 -2
  12. package/dist/formats/lcc/collision-partition.d.ts +1 -1
  13. package/dist/formats/lcc/lcc.d.ts +3 -3
  14. package/dist/formats/lcc/lcc2.d.ts +2 -2
  15. package/dist/formats/lcc/parse-lcc.d.ts +1 -1
  16. package/dist/formats/lcc.js.map +1 -1
  17. package/dist/formats/ply/parse-compressed-ply.d.ts +2 -2
  18. package/dist/formats/ply/parse-splat-ply.d.ts +2 -2
  19. package/dist/formats/ply.js.map +1 -1
  20. package/dist/formats/rad/frontier-worker-protocol.d.ts +8 -1
  21. package/dist/formats/rad/index.d.ts +1 -1
  22. package/dist/formats/rad/parse-rad.d.ts +1 -1
  23. package/dist/formats/rad/rad-foveated-source.d.ts +3 -3
  24. package/dist/formats/rad/rad.d.ts +5 -5
  25. package/dist/formats/rad.js.map +1 -1
  26. package/dist/formats/sog/parse-sog.d.ts +2 -2
  27. package/dist/formats/sog.js.map +1 -1
  28. package/dist/formats/splat/parse-splat.d.ts +1 -1
  29. package/dist/formats/splat.js.map +1 -1
  30. package/dist/formats/spz/parse-spz.d.ts +1 -1
  31. package/dist/formats/spz.js.map +1 -1
  32. package/dist/half-float-Cs4FDq8Q.js.map +1 -1
  33. package/dist/index.js +3 -3
  34. package/dist/index.js.map +1 -1
  35. package/dist/{chunk-loader.d.ts → loaders/chunk-loader.d.ts} +2 -2
  36. package/dist/{load-splat-data.d.ts → loaders/load-splat-data.d.ts} +1 -1
  37. package/dist/{load-worker-protocol.d.ts → loaders/load-worker-protocol.d.ts} +2 -2
  38. package/dist/loaders.js.map +1 -1
  39. package/dist/loading-wLo8vRbA.js.map +1 -1
  40. package/dist/lod-scheduler-B0a_uBlv.js.map +1 -1
  41. package/dist/logging-BfPdd7NJ.js.map +1 -1
  42. package/dist/ply-header-B9WllbPg.js.map +1 -1
  43. package/dist/{radix-sorter-R0FCSqKu.js → radix-sorter-BrbUg_CV.js} +2 -2
  44. package/dist/radix-sorter-BrbUg_CV.js.map +1 -0
  45. package/dist/{relighting-CSQF3UcL.js → relighting-Tiwep8yd.js} +302 -294
  46. package/dist/relighting-Tiwep8yd.js.map +1 -0
  47. package/dist/{selection-volume.d.ts → selection/selection-volume.d.ts} +1 -1
  48. package/dist/{splat-partition.d.ts → selection/splat-partition.d.ts} +1 -1
  49. package/dist/selection.js.map +1 -1
  50. package/dist/sh-pack-D5wAe5gg.js.map +1 -1
  51. package/dist/splat-budget-DuVZspPQ.js.map +1 -1
  52. package/dist/splat-data-BZM5dhhx.js.map +1 -1
  53. package/dist/{splat-mesh-aQdcWA6v.js → splat-mesh-CsLOQb08.js} +3 -3
  54. package/dist/splat-mesh-CsLOQb08.js.map +1 -0
  55. package/dist/splat-mesh-types-BZIko-_9.js.map +1 -1
  56. package/dist/{static-lod-splat-mesh.d.ts → static-lod/static-lod-splat-mesh.d.ts} +2 -2
  57. package/dist/{static-lod-worker-protocol.d.ts → static-lod/static-lod-worker-protocol.d.ts} +1 -1
  58. package/dist/{static-lod.d.ts → static-lod/static-lod.d.ts} +1 -1
  59. package/dist/static-lod.js +1 -1
  60. package/dist/static-lod.js.map +1 -1
  61. package/dist/{dataset-source.d.ts → streaming/dataset-source.d.ts} +1 -1
  62. package/dist/{streaming.d.ts → streaming/index.d.ts} +3 -3
  63. package/dist/{lod-source.d.ts → streaming/lod-source.d.ts} +4 -4
  64. package/dist/{streamed-splat-mesh-utils.d.ts → streaming/streamed-splat-mesh-utils.d.ts} +2 -2
  65. package/dist/{streamed-splat-mesh.d.ts → streaming/streamed-splat-mesh.d.ts} +45 -5
  66. package/dist/streaming.js +844 -810
  67. package/dist/streaming.js.map +1 -1
  68. package/dist/{unified-splat-mesh.d.ts → unified/unified-splat-mesh.d.ts} +13 -6
  69. package/dist/{work-buffer-gather.d.ts → unified/work-buffer-gather.d.ts} +5 -5
  70. package/dist/{work-buffer-material.d.ts → unified/work-buffer-material.d.ts} +1 -1
  71. package/dist/unified.js +280 -272
  72. package/dist/unified.js.map +1 -1
  73. package/dist/webgpu-limits-Y3CI_6_6.js.map +1 -1
  74. package/package.json +9 -9
  75. package/dist/radix-sorter-R0FCSqKu.js.map +0 -1
  76. package/dist/relighting-CSQF3UcL.js.map +0 -1
  77. package/dist/splat-mesh-aQdcWA6v.js.map +0 -1
  78. /package/dist/{compute-sorter.d.ts → core/compute-sorter.d.ts} +0 -0
  79. /package/dist/{create-splat-renderer.d.ts → core/create-splat-renderer.d.ts} +0 -0
  80. /package/dist/{depth-of-field.d.ts → core/depth-of-field.d.ts} +0 -0
  81. /package/dist/{half-float.d.ts → core/half-float.d.ts} +0 -0
  82. /package/dist/{logging.d.ts → core/logging.d.ts} +0 -0
  83. /package/dist/{merged-splat-mesh.d.ts → core/merged-splat-mesh.d.ts} +0 -0
  84. /package/dist/{orientation.d.ts → core/orientation.d.ts} +0 -0
  85. /package/dist/{radix-sort.d.ts → core/radix-sort.d.ts} +0 -0
  86. /package/dist/{radix-sorter.d.ts → core/radix-sorter.d.ts} +0 -0
  87. /package/dist/{relighting-pass.d.ts → core/relighting-pass.d.ts} +0 -0
  88. /package/dist/{relighting.d.ts → core/relighting.d.ts} +0 -0
  89. /package/dist/{sh-pack.d.ts → core/sh-pack.d.ts} +0 -0
  90. /package/dist/{sort-scheduler.d.ts → core/sort-scheduler.d.ts} +0 -0
  91. /package/dist/{sort-worker-protocol.d.ts → core/sort-worker-protocol.d.ts} +0 -0
  92. /package/dist/{sorter.d.ts → core/sorter.d.ts} +0 -0
  93. /package/dist/{source-transform.d.ts → core/source-transform.d.ts} +0 -0
  94. /package/dist/{splat-depth-pack.d.ts → core/splat-depth-pack.d.ts} +0 -0
  95. /package/dist/{splat-mesh-material.d.ts → core/splat-mesh-material.d.ts} +0 -0
  96. /package/dist/{splat-mesh-picking.d.ts → core/splat-mesh-picking.d.ts} +0 -0
  97. /package/dist/{splat-mesh-pool.d.ts → core/splat-mesh-pool.d.ts} +0 -0
  98. /package/dist/{splat-mesh.d.ts → core/splat-mesh.d.ts} +0 -0
  99. /package/dist/{splat-modifier-stack.d.ts → core/splat-modifier-stack.d.ts} +0 -0
  100. /package/dist/{splat-modifier.d.ts → core/splat-modifier.d.ts} +0 -0
  101. /package/dist/{splat-query.d.ts → core/splat-query.d.ts} +0 -0
  102. /package/dist/{splat-sort-bounds.d.ts → core/splat-sort-bounds.d.ts} +0 -0
  103. /package/dist/{storage-attribute-mirror.d.ts → core/storage-attribute-mirror.d.ts} +0 -0
  104. /package/dist/{webgpu-limits.d.ts → core/webgpu-limits.d.ts} +0 -0
  105. /package/dist/{worker-sorter.d.ts → core/worker-sorter.d.ts} +0 -0
  106. /package/dist/{xr-view.d.ts → core/xr-view.d.ts} +0 -0
  107. /package/dist/{loaders.d.ts → loaders/index.d.ts} +0 -0
  108. /package/dist/{loading.d.ts → loaders/loading.d.ts} +0 -0
  109. /package/dist/{ply-header.d.ts → loaders/ply-header.d.ts} +0 -0
  110. /package/dist/{selection.d.ts → selection/index.d.ts} +0 -0
  111. /package/dist/{static-lod-entry.d.ts → static-lod/index.d.ts} +0 -0
  112. /package/dist/{budget-governor.d.ts → streaming/budget-governor.d.ts} +0 -0
  113. /package/dist/{camera-budget-governor.d.ts → streaming/camera-budget-governor.d.ts} +0 -0
  114. /package/dist/{chunk-cache-budget.d.ts → streaming/chunk-cache-budget.d.ts} +0 -0
  115. /package/dist/{chunk-fetch-scheduler.d.ts → streaming/chunk-fetch-scheduler.d.ts} +0 -0
  116. /package/dist/{lod-manifest.d.ts → streaming/lod-manifest.d.ts} +0 -0
  117. /package/dist/{lod-scheduler.d.ts → streaming/lod-scheduler.d.ts} +0 -0
  118. /package/dist/{unified.d.ts → unified/index.d.ts} +0 -0
  119. /package/dist/{unified-work-buffer.d.ts → unified/unified-work-buffer.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"splat-mesh-types-BZIko-_9.js","sources":["../src/lib/splat-mesh-types.ts"],"sourcesContent":["/** Public configuration and result types for SplatMesh. */\nimport type * as THREE from 'three/webgpu';\nimport type { SplatData } from './splat-data';\nimport type { SplatOrientation } from './orientation';\nimport type { SplatModifier } from './splat-modifier';\nimport {\n detectSplatDeviceProfile,\n isFillConstrainedSplatDevice,\n type SplatDeviceProfile,\n} from './splat-budget';\nimport type { SplatPool } from './splat-mesh-pool';\nimport type { SplatShInputs, Vec3Uniform } from './splat-mesh-material';\n\n/** Construction-time projected-footprint policy selected by a streamed format. */\nexport type ProjectedFilterProfile = 'default' | 'lcc';\n\n/** Canonical `.rad` foveation modes. */\nexport type SplatFoveationMode = 'band' | 'frontier' | 'page-table';\n\n/** Resolve a caller-supplied foveation mode, defaulting when unset. */\nexport function resolveSplatFoveationMode(\n mode: SplatFoveationMode | undefined,\n fallback: SplatFoveationMode = 'band',\n): SplatFoveationMode {\n return mode ?? fallback;\n}\n\n/** True when the mode is the `.rad` page-table pager. */\nexport function isPageTableFoveation(mode: string | undefined): boolean {\n return mode === 'page-table';\n}\n\n/**\n * Opaque handle for a range of splats appended to a {@link SplatMesh},\n * used to remove the range again.\n */\nexport interface SplatRange {\n /** Number of splats in this range. */\n readonly count: number;\n}\n\n/**\n * Storage format of a per-splat channel (see {@link SplatMesh.defineChannel}).\n *\n * - `'byte'`: one `Uint8` per splat (`r8unorm`). Compact - a good fit for\n * masks and labels. `ctx.channel(name)` reads it back **normalized** to\n * `[0, 1]`, so a painted `255` reads as `1.0`.\n * - `'float'`: one `Float32` per splat (`r32float`), read back verbatim.\n */\nexport type SplatChannelType = 'byte' | 'float';\n\n/** Options for {@link SplatMesh.defineChannel}. */\nexport interface SplatChannelOptions {\n /** Storage format; default `'float'`. */\n type?: SplatChannelType;\n /**\n * Value every splat starts at before any {@link SplatMesh.writeChannel}.\n * Default `0`. For `'byte'` channels this is a raw `0..255` value.\n */\n fill?: number;\n}\n\n/** The highest SH order this renderer evaluates (3rd → 15 coefficients). */\nexport const MAX_SH_BANDS = 3;\n\n/**\n * The contribution-culling profile a mesh will use, given an optional\n * explicit override. Exported so callers that must decide something *before*\n * constructing the mesh - such as whether a streamed scene should fetch its\n * SH at all - agree with what the mesh itself will pick.\n */\nexport function resolveSplatPerformanceProfile(\n explicit?: SplatPerformanceProfile,\n profile: SplatDeviceProfile | undefined = detectSplatDeviceProfile(),\n): SplatPerformanceProfile {\n return explicit ?? (isFillConstrainedSplatDevice(profile) ? 'smooth' : 'quality');\n}\n\n/** Construction options for {@link SplatMesh}. */\nexport interface SplatMeshOptions {\n /**\n * Storage for per-splat higher-order SH in a dynamic-capacity pool, in\n * bands (1, 2 or 3 → 3, 8 or 15 coefficients per channel); 0 (default)\n * allocates nothing.\n *\n * Only formats that store SH per splat can fill this - LCC `Quality`, `.rad`, etc.\n * It costs 16 bytes per splat per band-group of four\n * coefficients (64 B/splat at 3 bands), so it is opt-in. On a static mesh\n * this is ignored: packed SH is taken from `source.shPacked` when present,\n * otherwise palette `source.sh` (SOG).\n */\n shBands?: 0 | 1 | 2 | 3;\n /**\n * Minimum interval between WebGPU sorts while the camera moves. When\n * omitted, the interval adapts to the active splat count. Use `0` to sort\n * every changed frame. WebGL worker sorting is unaffected.\n */\n sortIntervalMs?: number;\n /**\n * WebGPU sorter used for A/B validation. Defaults to the proven counting\n * sorter. `'radix'` keeps the fast 24-bit key path; `'exact'` lazy-loads a\n * stable 32-bit Float32-depth radix path that avoids scene-range\n * quantization. The first frames may skip sorting until the module resolves.\n *\n * @experimental Radix strategies may change in a minor release.\n */\n sortStrategy?: SplatSortStrategy;\n /**\n * Render-quality policy. `smooth` rejects negligible projected contributions.\n *\n * The default is device-aware: `smooth` on mobile (where rejecting splats too\n * small or too faint to see is worth far more than it costs), `quality`\n * everywhere else. Passing a value opts out of the detection.\n */\n performanceProfile?: SplatPerformanceProfile;\n /**\n * How far out, in standard deviations, each Gaussian is drawn before it is\n * cut off. Every splat is an alpha-blended quad sized to this radius, so it\n * sets how much each one costs to blend - the dominant cost in a busy view.\n * Lowering it shrinks every quad and clips the faint outer tail of each\n * Gaussian; the falloff within the remaining radius is unchanged.\n *\n * Defaults to `3`, the reference 3DGS rasterizer's radius. Below ~2 the\n * truncation shows as visible splat edges; much above ~5 the extra fill is not\n * worth it. Mobile coverage gaps are handled by `minSplatSizePx` instead of\n * growing every splat.\n */\n maxStdDev?: number;\n /**\n * Floor, in viewport pixels, on each rendered splat's projected quad radius.\n *\n * A screen-space *minimum* size, the counterpart to `maxScreenRadiusPx`'s\n * maximum. When a splat projects smaller than this - because it is distant, or\n * because the whole scene is zoomed out - its quad is grown to this radius and\n * the Gaussian is stretched to fill it (the falloff normalizes to the quad, so\n * no hard edge appears). Splats already larger are untouched, so it costs no\n * extra fill on the near-camera splats that dominate overdraw.\n *\n * This is the fix for the \"dark gaps when zoomed out\" failure mode: a capture\n * whose finest splats are spaced farther apart than their footprint leaves the\n * background showing between them, and the effect is worst at low resolution -\n * i.e. on a phone. Raising `maxStdDev` also closes the gaps but inflates\n * *every* splat's fragment count by its square, paying the coverage cost on the\n * large splats too; this floor spends it only where a gap can actually open.\n *\n * Defaults to `1.5` px on mobile and `0` (disabled) elsewhere, including\n * fill-constrained desktops. Values around 1–3 px close typical gaps; too\n * large a floor blurs distinct small features into discs, so tune it up from\n * small on the target device. An explicit `0` always disables the floor.\n */\n minSplatSizePx?: number;\n /**\n * Apply the Mip-Splatting 2D antialiasing filter - the screen-space low-pass\n * dilation plus the opacity compensation that conserves each Gaussian's\n * integral, so small/distant splats stop over-brightening. Match the\n * exporter: enable it for scenes trained/exported with antialiasing (the SOG\n * `antialias` meta flag sets this automatically). Defaults to `false` (the\n * classic 3DGS dilation without compensation).\n */\n antialias?: boolean;\n /**\n * Internal format-selected reconstruction profile. Classic LCC uses the\n * XGRIDS-compatible 0.1 px² compensated low-pass; callers should leave this\n * unset and select a format through {@link StreamedSplatMesh.load} instead.\n *\n * @internal\n */\n projectedFilterProfile?: ProjectedFilterProfile;\n /**\n * Emit splat colors in sRGB (display) space instead of decoding them to the\n * renderer's linear working space. Pair with a renderer that skips output\n * conversion (`outputColorSpace = LinearSRGBColorSpace`, `NoToneMapping`,\n * inline sRGB encode for other materials via `renderer.contextNode`): splats\n * then alpha-composite on gamma-encoded values - the math 3DGS training\n * optimizes against, and what WebGL splat viewers render. Defaults to\n * `false` (linear working-space compositing).\n */\n srgbOutput?: boolean;\n /**\n * Cull any splat whose projected on-screen radius exceeds this many pixels,\n * rendering a hole instead. A physically large splat close to the camera -\n * a coarse merged LOD node (a Spark `.rad` \"blob\"), or a giant background\n * Gaussian - projects huge while a fine surface splat stays small, so this\n * removes the near-camera blobs without touching detailed geometry. `0` or\n * unset disables it (the default). Baked into the material graph.\n */\n maxSplatScreenRadius?: number;\n /**\n * Foveation band lower bound (px): cull any splat whose projected on-screen\n * radius is *below* this. Paired with {@link maxSplatScreenRadius}, only\n * splats sized `(min, max]` on screen draw. Because a `.rad` LOD tree's node\n * sizes shrink geometrically, exactly one level per view ray lands in the\n * band - near rays on fine leaves, far rays on coarse nodes - giving a\n * camera-distance foveated cut. `0` or unset disables it (the default).\n * Baked into the material graph. See `docs/formats/rad-notes.md` M14.6.\n */\n minSplatScreenRadius?: number;\n /**\n * How a `.rad` foveated mesh picks its per-splat LOD cut:\n * - `'band'` (default): the screen-radius band above\n * ({@link minSplatScreenRadius}, {@link maxSplatScreenRadius}].\n * - `'frontier'`: Spark's exact tree cut - draw splat `i` iff its parent is\n * too big and it is small enough (`parentPixelScale > limit ≥ ownPixelScale`),\n * using per-splat `own_size`/`parent_size`. Full coverage by construction, no\n * band leapfrogging. Baked into the material graph. See `docs/formats/rad-notes.md`.\n * - `'page-table'`: the {@link StreamedSplatMesh} default for `.rad` - a worker\n * owns the tree traversal and pages only the *selected* frontier into the\n * pool (Spark's selected-index model), so the whole splat budget buys\n * on-screen detail. Requires the streamed `.rad` machinery; on a plain\n * `SplatMesh` it has no worker to drive it.\n *\n * @experimental `.rad` foveation option; may change in a minor release.\n */\n foveationMode?: SplatFoveationMode;\n /**\n * Target on-screen size (px) for the frontier / page-table cut: it keeps one\n * LOD level per view ray whose projected node size is about this. Larger =\n * coarser/fewer splats, smaller = finer/denser. Default\n * {@link DEFAULT_FOVEATION_TARGET_PX} (1, matching Spark's `lodRenderScale`),\n * so the draw budget rather than the cut size is what bounds detail. Raise it\n * to trade sharpness for fill rate on weak GPUs.\n * Acts as the *finest* bound: the adaptive limit coarsens above it to hold the\n * draw budget but never dips below it.\n *\n * @experimental `.rad` foveation option; may change in a minor release.\n */\n foveationTargetPx?: number;\n /**\n * Target upper bound on the number of splats the frontier cut *draws*\n * (Spark's `maxSplats`). Each reschedule the cut's `pixelScaleLimit`\n * self-adjusts - coarsening when the estimated drawn count exceeds this - so\n * frame cost stays bounded as detail streams in. Default\n * {@link DEFAULT_FOVEATION_DRAW_BUDGET}. Only used in `'frontier'` mode.\n *\n * @experimental `.rad` foveation option; may change in a minor release.\n */\n foveationDrawBudget?: number;\n /**\n * Cap on a rendered splat's major/minor axis ratio (`0`/unset = off). A very\n * anisotropic Gaussian (a flat 3DGS disk edge-on, or an expansion-enlarged\n * coarse LOD node) otherwise projects to a long needle; this bounds its drawn\n * length to `maxSplatAspect`× its width. Baked into the material graph.\n *\n * @experimental `.rad` foveation option; may change in a minor release.\n */\n maxSplatAspect?: number;\n /**\n * Spark's LOD alpha encoding (`.rad`): the stored opacity is `alpha/2` so the\n * shader recovers `alpha ∈ [0,2]`, and `alpha > 1` marks a merged node rendered\n * with a grown σ-cutoff + super-Gaussian falloff. Set for foveated `.rad`.\n *\n * @experimental `.rad` foveation option; may change in a minor release.\n */\n lodAlpha?: boolean;\n /**\n * How the scene is oriented into the three.js Y-up world. `'y-up'` (default)\n * normalizes every known format to Y-up - 3DGS Y-down formats\n * (PLY/`.splat`/`.ksplat`/SOG) are flipped 180° about X; SPZ/`.rad` are\n * already Y-up; LCC keeps its own Z-up→Y-up matrix. `'source'` applies no\n * cosmetic flip and renders in the data frame (raw Spark / mkkellogg parity);\n * LCC still self-orients (that is format semantics, not part of the switch).\n *\n * For a fully loaded mesh the flip is chosen from {@link SplatData.format}\n * (stamped by the loaders); a dynamic-capacity mesh carries no format, so the\n * caller applies {@link yUpTransformForFormat} itself. See {@link SplatOrientation}.\n */\n orientation?: SplatOrientation;\n /**\n * GPU storage type for the pool's continuous float textures (`centers` and\n * `covarianceA`). `'float16'` uploads them as `rgba16float` (~16 B/splat\n * saved vs the default). CPU backing stays float32 (sorter, query, writes).\n *\n * `covarianceB` is always float32: it packs integer IDs (SOG palette labels,\n * RAD frontier parents) that half floats cannot represent exactly above\n * 2048. Colors and packed SH are unchanged. Construction-time only.\n */\n poolFloatTextures?: 'float32' | 'float16';\n /**\n * An existing pool to draw from instead of allocating one.\n *\n * Several meshes sharing a pool share its memory envelope: rows go to\n * whichever mesh needs them, so a mesh the camera is near can hold far more\n * than an even split would give it, and one that is far away holds almost\n * nothing - without every mesh having reserved a private ceiling up front.\n * This is the multi-mesh analogue of a single streamed mesh's LOD budget.\n *\n * The pool is *not* owned by the mesh: {@link SplatMesh.dispose} releases the\n * mesh's rows and leaves the textures alone, so the pool's creator disposes\n * it once every tenant is gone. `capacity` on the source is then only used\n * for the mesh's own draw list, not to size storage.\n *\n * Sharing costs a whole-pool stall when the pool fragments - see\n * {@link SplatMesh.compact}.\n */\n pool?: SplatPool;\n /**\n * The device's `maxTextureDimension2D`, forwarded to a pool this mesh\n * allocates for itself so an over-tall pool fails at construction with a\n * readable error instead of at first draw. Pass `deviceMaxTextureSize(renderer)`.\n *\n * Ignored when {@link SplatMeshOptions.pool} supplies the pool - that pool\n * was already checked when its creator built it.\n */\n maxTextureSize?: number;\n}\n\n/** Available WebGPU depth-sort implementations. */\nexport type SplatSortStrategy = 'counting' | 'radix' | 'exact';\n\n/** Controls optional work during a per-frame source update. */\nexport interface SplatUpdateOptions {\n /** Leave sorting to {@link UnifiedSplatMesh}; uploads and LOD state still update. */\n sort?: boolean;\n}\n\n/**\n * Read-only GPU-facing view of a mesh's current active pool. It is consumed by\n * the M15.4 unified gather path; streamed meshes expose their current LOD cut\n * through the same view because they inherit {@link SplatMesh}.\n *\n * @experimental May change in a minor release.\n */\nexport interface UnifiedSourceView {\n /** Total addressable pool slots. */\n readonly capacity: number;\n /** Pool indices of active splats, packed from zero. */\n readonly sourceIndex: THREE.StorageBufferAttribute;\n /** Active entries at the front of {@link sourceIndex}. */\n readonly activeCount: number;\n /** Local-space centers, RGBA32F and pool-indexed. */\n readonly centersTexture: THREE.DataTexture;\n /** Source display color and opacity, RGBA8 and pool-indexed. */\n readonly colorsTexture: THREE.DataTexture;\n /** Upper covariance rows, RGBA32F and pool-indexed. */\n readonly covarianceATexture: THREE.DataTexture;\n /** Final covariance row, RGBA32F and pool-indexed. */\n readonly covarianceBTexture: THREE.DataTexture;\n /** Centers texture row width. */\n readonly dataTextureWidth: number;\n /** Current source-local → world transform. */\n readonly matrixWorld: THREE.Matrix4;\n /** Conservative world-space bound for depth quantization. */\n readonly worldBounds: THREE.Sphere;\n /** Higher-order color data resolved by the gather pass when present. */\n readonly sh: SplatShInputs | null;\n /** Effect hooks and their source-local data channels. */\n readonly modifiers: readonly SplatModifier[];\n /**\n * True when this source is itself a unified pool with per-source placement\n * (`MergedSplatMesh`). The gather path cannot resolve nested placement, so\n * `UnifiedSplatMesh` rejects these sources.\n */\n readonly hasSourcePlacement: boolean;\n readonly channels: ReadonlyMap<string, { texture: THREE.DataTexture }>;\n /** Same uniform node the source graph updates each frame. */\n readonly localCameraPosition: Vec3Uniform;\n /** Changes whenever a modifier graph must be rebuilt. */\n readonly graphRevision: number;\n /** Whether this source intentionally composites in display (sRGB) space. */\n readonly srgbOutput: boolean;\n /** Shared draw-path settings that must agree across unified sources. */\n readonly maxStdDev: number;\n /** Screen-space minimum splat radius, px (0 = off). */\n readonly minSplatSizePx: number;\n readonly antialias: boolean;\n /** Construction-time projected-footprint policy shared by one unified pass. */\n readonly projectedFilterProfile: ProjectedFilterProfile;\n /**\n * Whether this source stores Spark LOD alpha (`alpha ÷ 2`, `.rad`). The\n * gather recovers the full `alpha ∈ [0,2]`; the draw material then treats\n * `alpha > 1` as a merged node. Per source, not a compatibility field - a\n * scene may mix `.rad` and non-`.rad` sources.\n */\n readonly lodAlpha: boolean;\n /** Increments whenever pool-backed data or active residency changes. */\n readonly contentRevision: number;\n}\n\n/** Quality-compatible rendering or smoother contribution-culling rendering. */\nexport type SplatPerformanceProfile = 'quality' | 'smooth';\n\n/**\n * Options for {@link SplatMesh.pick}.\n *\n * Picking returns the selected splat's rendered center plane (depth-tested\n * Gaussian coverage), not a persistent splat identifier or a collision mesh.\n */\nexport interface SplatPickOptions {\n /**\n * Minimum Gaussian opacity (after falloff × splat alpha) for a fragment to\n * count as a hit. Default `0.1`.\n */\n alphaThreshold?: number;\n}\n\n/**\n * Result of a successful {@link SplatMesh.pick}.\n *\n * The point lies on the frontmost splat's billboard plane at the picked\n * pixel - suitable for click-to-focus and placement anchors, not physics.\n */\nexport interface SplatPickResult {\n /** Hit position in world space. */\n readonly point: THREE.Vector3;\n /** Distance from the camera position to {@link point}. */\n readonly distance: number;\n}\n\n/**\n * Result of {@link SplatMesh.queryNearest}: the resident splat center closest\n * to the query point, in world space.\n */\nexport interface SplatNearestResult {\n /** The splat's center, in world space. */\n readonly point: THREE.Vector3;\n /** World-space distance from the query point to {@link point}. */\n readonly distance: number;\n}\n\n/** Result of a successful synchronous {@link SplatMesh.queryRay}. */\nexport interface SplatRayResult {\n /** Resident splat center in world space. */\n readonly point: THREE.Vector3;\n /** Distance along the ray from its origin to the center's closest plane. */\n readonly distance: number;\n}\n\n/**\n * Result of {@link SplatMesh.queryHeight}: the supporting surface found beneath\n * the query point (the highest resident splat within the drop and horizontal\n * radius), in world space.\n */\nexport interface SplatHeightResult {\n /** The supporting splat's center, in world space. */\n readonly point: THREE.Vector3;\n /** How far below the query point the surface sits (world units, ≥ 0). */\n readonly drop: number;\n}\n"],"names":["resolveSplatFoveationMode","mode","fallback","isPageTableFoveation","MAX_SH_BANDS","resolveSplatPerformanceProfile","explicit","profile","detectSplatDeviceProfile","isFillConstrainedSplatDevice"],"mappings":";AAoBO,SAASA,EACdC,GACAC,IAA+B,QACX;AACpB,SAAOD,KAAQC;AACjB;AAGO,SAASC,EAAqBF,GAAmC;AACtE,SAAOA,MAAS;AAClB;AAiCO,MAAMG,IAAe;AAQrB,SAASC,EACdC,GACAC,IAA0CC,KACjB;AACzB,SAAOF,MAAaG,EAA6BF,CAAO,IAAI,WAAW;AACzE;"}
1
+ {"version":3,"file":"splat-mesh-types-BZIko-_9.js","sources":["../src/lib/core/splat-mesh-types.ts"],"sourcesContent":["/** Public configuration and result types for SplatMesh. */\nimport type * as THREE from 'three/webgpu';\nimport type { SplatData } from './splat-data';\nimport type { SplatOrientation } from './orientation';\nimport type { SplatModifier } from './splat-modifier';\nimport {\n detectSplatDeviceProfile,\n isFillConstrainedSplatDevice,\n type SplatDeviceProfile,\n} from './splat-budget';\nimport type { SplatPool } from './splat-mesh-pool';\nimport type { SplatShInputs, Vec3Uniform } from './splat-mesh-material';\n\n/** Construction-time projected-footprint policy selected by a streamed format. */\nexport type ProjectedFilterProfile = 'default' | 'lcc';\n\n/** Canonical `.rad` foveation modes. */\nexport type SplatFoveationMode = 'band' | 'frontier' | 'page-table';\n\n/** Resolve a caller-supplied foveation mode, defaulting when unset. */\nexport function resolveSplatFoveationMode(\n mode: SplatFoveationMode | undefined,\n fallback: SplatFoveationMode = 'band',\n): SplatFoveationMode {\n return mode ?? fallback;\n}\n\n/** True when the mode is the `.rad` page-table pager. */\nexport function isPageTableFoveation(mode: string | undefined): boolean {\n return mode === 'page-table';\n}\n\n/**\n * Opaque handle for a range of splats appended to a {@link SplatMesh},\n * used to remove the range again.\n */\nexport interface SplatRange {\n /** Number of splats in this range. */\n readonly count: number;\n}\n\n/**\n * Storage format of a per-splat channel (see {@link SplatMesh.defineChannel}).\n *\n * - `'byte'`: one `Uint8` per splat (`r8unorm`). Compact - a good fit for\n * masks and labels. `ctx.channel(name)` reads it back **normalized** to\n * `[0, 1]`, so a painted `255` reads as `1.0`.\n * - `'float'`: one `Float32` per splat (`r32float`), read back verbatim.\n */\nexport type SplatChannelType = 'byte' | 'float';\n\n/** Options for {@link SplatMesh.defineChannel}. */\nexport interface SplatChannelOptions {\n /** Storage format; default `'float'`. */\n type?: SplatChannelType;\n /**\n * Value every splat starts at before any {@link SplatMesh.writeChannel}.\n * Default `0`. For `'byte'` channels this is a raw `0..255` value.\n */\n fill?: number;\n}\n\n/** The highest SH order this renderer evaluates (3rd → 15 coefficients). */\nexport const MAX_SH_BANDS = 3;\n\n/**\n * The contribution-culling profile a mesh will use, given an optional\n * explicit override. Exported so callers that must decide something *before*\n * constructing the mesh - such as whether a streamed scene should fetch its\n * SH at all - agree with what the mesh itself will pick.\n */\nexport function resolveSplatPerformanceProfile(\n explicit?: SplatPerformanceProfile,\n profile: SplatDeviceProfile | undefined = detectSplatDeviceProfile(),\n): SplatPerformanceProfile {\n return explicit ?? (isFillConstrainedSplatDevice(profile) ? 'smooth' : 'quality');\n}\n\n/** Construction options for {@link SplatMesh}. */\nexport interface SplatMeshOptions {\n /**\n * Storage for per-splat higher-order SH in a dynamic-capacity pool, in\n * bands (1, 2 or 3 → 3, 8 or 15 coefficients per channel); 0 (default)\n * allocates nothing.\n *\n * Only formats that store SH per splat can fill this - LCC `Quality`, `.rad`, etc.\n * It costs 16 bytes per splat per band-group of four\n * coefficients (64 B/splat at 3 bands), so it is opt-in. On a static mesh\n * this is ignored: packed SH is taken from `source.shPacked` when present,\n * otherwise palette `source.sh` (SOG).\n */\n shBands?: 0 | 1 | 2 | 3;\n /**\n * Minimum interval between WebGPU sorts while the camera moves. When\n * omitted, the interval adapts to the active splat count. Use `0` to sort\n * every changed frame. WebGL worker sorting is unaffected.\n */\n sortIntervalMs?: number;\n /**\n * WebGPU sorter used for A/B validation. Defaults to the proven counting\n * sorter. `'radix'` keeps the fast 24-bit key path; `'exact'` lazy-loads a\n * stable 32-bit Float32-depth radix path that avoids scene-range\n * quantization. The first frames may skip sorting until the module resolves.\n *\n * @experimental Radix strategies may change in a minor release.\n */\n sortStrategy?: SplatSortStrategy;\n /**\n * Render-quality policy. `smooth` rejects negligible projected contributions.\n *\n * The default is device-aware: `smooth` on mobile (where rejecting splats too\n * small or too faint to see is worth far more than it costs), `quality`\n * everywhere else. Passing a value opts out of the detection.\n */\n performanceProfile?: SplatPerformanceProfile;\n /**\n * How far out, in standard deviations, each Gaussian is drawn before it is\n * cut off. Every splat is an alpha-blended quad sized to this radius, so it\n * sets how much each one costs to blend - the dominant cost in a busy view.\n * Lowering it shrinks every quad and clips the faint outer tail of each\n * Gaussian; the falloff within the remaining radius is unchanged.\n *\n * Defaults to `3`, the reference 3DGS rasterizer's radius. Below ~2 the\n * truncation shows as visible splat edges; much above ~5 the extra fill is not\n * worth it. Mobile coverage gaps are handled by `minSplatSizePx` instead of\n * growing every splat.\n */\n maxStdDev?: number;\n /**\n * Floor, in viewport pixels, on each rendered splat's projected quad radius.\n *\n * A screen-space *minimum* size, the counterpart to `maxScreenRadiusPx`'s\n * maximum. When a splat projects smaller than this - because it is distant, or\n * because the whole scene is zoomed out - its quad is grown to this radius and\n * the Gaussian is stretched to fill it (the falloff normalizes to the quad, so\n * no hard edge appears). Splats already larger are untouched, so it costs no\n * extra fill on the near-camera splats that dominate overdraw.\n *\n * This is the fix for the \"dark gaps when zoomed out\" failure mode: a capture\n * whose finest splats are spaced farther apart than their footprint leaves the\n * background showing between them, and the effect is worst at low resolution -\n * i.e. on a phone. Raising `maxStdDev` also closes the gaps but inflates\n * *every* splat's fragment count by its square, paying the coverage cost on the\n * large splats too; this floor spends it only where a gap can actually open.\n *\n * Defaults to `1.5` px on mobile and `0` (disabled) elsewhere, including\n * fill-constrained desktops. Values around 1–3 px close typical gaps; too\n * large a floor blurs distinct small features into discs, so tune it up from\n * small on the target device. An explicit `0` always disables the floor.\n */\n minSplatSizePx?: number;\n /**\n * Apply the Mip-Splatting 2D antialiasing filter - the screen-space low-pass\n * dilation plus the opacity compensation that conserves each Gaussian's\n * integral, so small/distant splats stop over-brightening. Match the\n * exporter: enable it for scenes trained/exported with antialiasing (the SOG\n * `antialias` meta flag sets this automatically). Defaults to `false` (the\n * classic 3DGS dilation without compensation).\n */\n antialias?: boolean;\n /**\n * Internal format-selected reconstruction profile. Classic LCC uses the\n * XGRIDS-compatible 0.1 px² compensated low-pass; callers should leave this\n * unset and select a format through {@link StreamedSplatMesh.load} instead.\n *\n * @internal\n */\n projectedFilterProfile?: ProjectedFilterProfile;\n /**\n * Emit splat colors in sRGB (display) space instead of decoding them to the\n * renderer's linear working space. Pair with a renderer that skips output\n * conversion (`outputColorSpace = LinearSRGBColorSpace`, `NoToneMapping`,\n * inline sRGB encode for other materials via `renderer.contextNode`): splats\n * then alpha-composite on gamma-encoded values - the math 3DGS training\n * optimizes against, and what WebGL splat viewers render. Defaults to\n * `false` (linear working-space compositing).\n */\n srgbOutput?: boolean;\n /**\n * Cull any splat whose projected on-screen radius exceeds this many pixels,\n * rendering a hole instead. A physically large splat close to the camera -\n * a coarse merged LOD node (a Spark `.rad` \"blob\"), or a giant background\n * Gaussian - projects huge while a fine surface splat stays small, so this\n * removes the near-camera blobs without touching detailed geometry. `0` or\n * unset disables it (the default). Baked into the material graph.\n */\n maxSplatScreenRadius?: number;\n /**\n * Foveation band lower bound (px): cull any splat whose projected on-screen\n * radius is *below* this. Paired with {@link maxSplatScreenRadius}, only\n * splats sized `(min, max]` on screen draw. Because a `.rad` LOD tree's node\n * sizes shrink geometrically, exactly one level per view ray lands in the\n * band - near rays on fine leaves, far rays on coarse nodes - giving a\n * camera-distance foveated cut. `0` or unset disables it (the default).\n * Baked into the material graph. See `docs/formats/rad-notes.md` M14.6.\n */\n minSplatScreenRadius?: number;\n /**\n * How a `.rad` foveated mesh picks its per-splat LOD cut:\n * - `'band'` (default): the screen-radius band above\n * ({@link minSplatScreenRadius}, {@link maxSplatScreenRadius}].\n * - `'frontier'`: Spark's exact tree cut - draw splat `i` iff its parent is\n * too big and it is small enough (`parentPixelScale > limit ≥ ownPixelScale`),\n * using per-splat `own_size`/`parent_size`. Full coverage by construction, no\n * band leapfrogging. Baked into the material graph. See `docs/formats/rad-notes.md`.\n * - `'page-table'`: the {@link StreamedSplatMesh} default for `.rad` - a worker\n * owns the tree traversal and pages only the *selected* frontier into the\n * pool (Spark's selected-index model), so the whole splat budget buys\n * on-screen detail. Requires the streamed `.rad` machinery; on a plain\n * `SplatMesh` it has no worker to drive it.\n *\n * @experimental `.rad` foveation option; may change in a minor release.\n */\n foveationMode?: SplatFoveationMode;\n /**\n * Target on-screen size (px) for the frontier / page-table cut: it keeps one\n * LOD level per view ray whose projected node size is about this. Larger =\n * coarser/fewer splats, smaller = finer/denser. Default\n * {@link DEFAULT_FOVEATION_TARGET_PX} (1, matching Spark's `lodRenderScale`),\n * so the draw budget rather than the cut size is what bounds detail. Raise it\n * to trade sharpness for fill rate on weak GPUs.\n * Acts as the *finest* bound: the adaptive limit coarsens above it to hold the\n * draw budget but never dips below it.\n *\n * @experimental `.rad` foveation option; may change in a minor release.\n */\n foveationTargetPx?: number;\n /**\n * Target upper bound on the number of splats the frontier cut *draws*\n * (Spark's `maxSplats`). Each reschedule the cut's `pixelScaleLimit`\n * self-adjusts - coarsening when the estimated drawn count exceeds this - so\n * frame cost stays bounded as detail streams in. Default\n * {@link DEFAULT_FOVEATION_DRAW_BUDGET}. Only used in `'frontier'` mode.\n *\n * @experimental `.rad` foveation option; may change in a minor release.\n */\n foveationDrawBudget?: number;\n /**\n * Cap on a rendered splat's major/minor axis ratio (`0`/unset = off). A very\n * anisotropic Gaussian (a flat 3DGS disk edge-on, or an expansion-enlarged\n * coarse LOD node) otherwise projects to a long needle; this bounds its drawn\n * length to `maxSplatAspect`× its width. Baked into the material graph.\n *\n * @experimental `.rad` foveation option; may change in a minor release.\n */\n maxSplatAspect?: number;\n /**\n * Spark's LOD alpha encoding (`.rad`): the stored opacity is `alpha/2` so the\n * shader recovers `alpha ∈ [0,2]` from the original texture channel, and\n * `alpha > 1` marks a merged node rendered with a grown σ-cutoff +\n * super-Gaussian falloff. Visual fades and alpha modifiers scale the completed\n * fragment after that classification; they must not change node type or shape.\n * Set for foveated `.rad`.\n *\n * @experimental `.rad` foveation option; may change in a minor release.\n */\n lodAlpha?: boolean;\n /**\n * How the scene is oriented into the three.js Y-up world. `'y-up'` (default)\n * normalizes every known format to Y-up - 3DGS Y-down formats\n * (PLY/`.splat`/`.ksplat`/SOG) are flipped 180° about X; SPZ/`.rad` are\n * already Y-up; LCC keeps its own Z-up→Y-up matrix. `'source'` applies no\n * cosmetic flip and renders in the data frame (raw Spark / mkkellogg parity);\n * LCC still self-orients (that is format semantics, not part of the switch).\n *\n * For a fully loaded mesh the flip is chosen from {@link SplatData.format}\n * (stamped by the loaders); a dynamic-capacity mesh carries no format, so the\n * caller applies {@link yUpTransformForFormat} itself. See {@link SplatOrientation}.\n */\n orientation?: SplatOrientation;\n /**\n * GPU storage type for the pool's continuous float textures (`centers` and\n * `covarianceA`). `'float16'` uploads them as `rgba16float` (~16 B/splat\n * saved vs the default). CPU backing stays float32 (sorter, query, writes).\n *\n * `covarianceB` is always float32: it packs integer IDs (SOG palette labels,\n * RAD frontier parents) that half floats cannot represent exactly above\n * 2048. Colors and packed SH are unchanged. Construction-time only.\n */\n poolFloatTextures?: 'float32' | 'float16';\n /**\n * An existing pool to draw from instead of allocating one.\n *\n * Several meshes sharing a pool share its memory envelope: rows go to\n * whichever mesh needs them, so a mesh the camera is near can hold far more\n * than an even split would give it, and one that is far away holds almost\n * nothing - without every mesh having reserved a private ceiling up front.\n * This is the multi-mesh analogue of a single streamed mesh's LOD budget.\n *\n * The pool is *not* owned by the mesh: {@link SplatMesh.dispose} releases the\n * mesh's rows and leaves the textures alone, so the pool's creator disposes\n * it once every tenant is gone. `capacity` on the source is then only used\n * for the mesh's own draw list, not to size storage.\n *\n * Sharing costs a whole-pool stall when the pool fragments - see\n * {@link SplatMesh.compact}.\n */\n pool?: SplatPool;\n /**\n * The device's `maxTextureDimension2D`, forwarded to a pool this mesh\n * allocates for itself so an over-tall pool fails at construction with a\n * readable error instead of at first draw. Pass `deviceMaxTextureSize(renderer)`.\n *\n * Ignored when {@link SplatMeshOptions.pool} supplies the pool - that pool\n * was already checked when its creator built it.\n */\n maxTextureSize?: number;\n}\n\n/** Available WebGPU depth-sort implementations. */\nexport type SplatSortStrategy = 'counting' | 'radix' | 'exact';\n\n/** Controls optional work during a per-frame source update. */\nexport interface SplatUpdateOptions {\n /** Leave sorting to {@link UnifiedSplatMesh}; uploads and LOD state still update. */\n sort?: boolean;\n}\n\n/**\n * Read-only GPU-facing view of a mesh's current active pool. It is consumed by\n * the M15.4 unified gather path; streamed meshes expose their current LOD cut\n * through the same view because they inherit {@link SplatMesh}.\n *\n * @experimental May change in a minor release.\n */\nexport interface UnifiedSourceView {\n /** Total addressable pool slots. */\n readonly capacity: number;\n /** Pool indices of active splats, packed from zero. */\n readonly sourceIndex: THREE.StorageBufferAttribute;\n /** Active entries at the front of {@link sourceIndex}. */\n readonly activeCount: number;\n /** Local-space centers, RGBA32F and pool-indexed. */\n readonly centersTexture: THREE.DataTexture;\n /** Source display color and opacity, RGBA8 and pool-indexed. */\n readonly colorsTexture: THREE.DataTexture;\n /** Upper covariance rows, RGBA32F and pool-indexed. */\n readonly covarianceATexture: THREE.DataTexture;\n /** Final covariance row, RGBA32F and pool-indexed. */\n readonly covarianceBTexture: THREE.DataTexture;\n /** Centers texture row width. */\n readonly dataTextureWidth: number;\n /** Current source-local → world transform. */\n readonly matrixWorld: THREE.Matrix4;\n /** Conservative world-space bound for depth quantization. */\n readonly worldBounds: THREE.Sphere;\n /** Higher-order color data resolved by the gather pass when present. */\n readonly sh: SplatShInputs | null;\n /** Effect hooks and their source-local data channels. */\n readonly modifiers: readonly SplatModifier[];\n /**\n * True when this source is itself a unified pool with per-source placement\n * (`MergedSplatMesh`). The gather path cannot resolve nested placement, so\n * `UnifiedSplatMesh` rejects these sources.\n */\n readonly hasSourcePlacement: boolean;\n readonly channels: ReadonlyMap<string, { texture: THREE.DataTexture }>;\n /** Same uniform node the source graph updates each frame. */\n readonly localCameraPosition: Vec3Uniform;\n /** Changes whenever a modifier graph must be rebuilt. */\n readonly graphRevision: number;\n /** Whether this source intentionally composites in display (sRGB) space. */\n readonly srgbOutput: boolean;\n /** Shared draw-path settings that must agree across unified sources. */\n readonly maxStdDev: number;\n /** Screen-space minimum splat radius, px (0 = off). */\n readonly minSplatSizePx: number;\n readonly antialias: boolean;\n /** Construction-time projected-footprint policy shared by one unified pass. */\n readonly projectedFilterProfile: ProjectedFilterProfile;\n /**\n * Whether this source stores Spark LOD alpha (`alpha ÷ 2`, `.rad`). The\n * gather recovers the full `alpha ∈ [0,2]`; the draw material then treats\n * `alpha > 1` as a merged node. Per source, not a compatibility field - a\n * scene may mix `.rad` and non-`.rad` sources.\n */\n readonly lodAlpha: boolean;\n /** Increments whenever pool-backed data or active residency changes. */\n readonly contentRevision: number;\n}\n\n/** Quality-compatible rendering or smoother contribution-culling rendering. */\nexport type SplatPerformanceProfile = 'quality' | 'smooth';\n\n/**\n * Options for {@link SplatMesh.pick}.\n *\n * Picking returns the selected splat's rendered center plane (depth-tested\n * Gaussian coverage), not a persistent splat identifier or a collision mesh.\n */\nexport interface SplatPickOptions {\n /**\n * Minimum Gaussian opacity (after falloff × splat alpha) for a fragment to\n * count as a hit. Default `0.1`.\n */\n alphaThreshold?: number;\n}\n\n/**\n * Result of a successful {@link SplatMesh.pick}.\n *\n * The point lies on the frontmost splat's billboard plane at the picked\n * pixel - suitable for click-to-focus and placement anchors, not physics.\n */\nexport interface SplatPickResult {\n /** Hit position in world space. */\n readonly point: THREE.Vector3;\n /** Distance from the camera position to {@link point}. */\n readonly distance: number;\n}\n\n/**\n * Result of {@link SplatMesh.queryNearest}: the resident splat center closest\n * to the query point, in world space.\n */\nexport interface SplatNearestResult {\n /** The splat's center, in world space. */\n readonly point: THREE.Vector3;\n /** World-space distance from the query point to {@link point}. */\n readonly distance: number;\n}\n\n/** Result of a successful synchronous {@link SplatMesh.queryRay}. */\nexport interface SplatRayResult {\n /** Resident splat center in world space. */\n readonly point: THREE.Vector3;\n /** Distance along the ray from its origin to the center's closest plane. */\n readonly distance: number;\n}\n\n/**\n * Result of {@link SplatMesh.queryHeight}: the supporting surface found beneath\n * the query point (the highest resident splat within the drop and horizontal\n * radius), in world space.\n */\nexport interface SplatHeightResult {\n /** The supporting splat's center, in world space. */\n readonly point: THREE.Vector3;\n /** How far below the query point the surface sits (world units, ≥ 0). */\n readonly drop: number;\n}\n"],"names":["resolveSplatFoveationMode","mode","fallback","isPageTableFoveation","MAX_SH_BANDS","resolveSplatPerformanceProfile","explicit","profile","detectSplatDeviceProfile","isFillConstrainedSplatDevice"],"mappings":";AAoBO,SAASA,EACdC,GACAC,IAA+B,QACX;AACpB,SAAOD,KAAQC;AACjB;AAGO,SAASC,EAAqBF,GAAmC;AACtE,SAAOA,MAAS;AAClB;AAiCO,MAAMG,IAAe;AAQrB,SAASC,EACdC,GACAC,IAA0CC,KACjB;AACzB,SAAOF,MAAaG,EAA6BF,CAAO,IAAI,WAAW;AACzE;"}
@@ -1,7 +1,7 @@
1
1
  /** @role Bridge - Camera-aware rendering for worker-built static splat hierarchies. */
2
2
  import * as THREE from 'three/webgpu';
3
- import { type SplatDataLoadOptions } from './load-splat-data';
4
- import { SplatMesh, type SplatMeshOptions, type SplatUpdateOptions } from './splat-mesh';
3
+ import { type SplatDataLoadOptions } from '../loaders/load-splat-data';
4
+ import { SplatMesh, type SplatMeshOptions, type SplatUpdateOptions } from '../core/splat-mesh';
5
5
  import type { StaticLodBuildProgress } from './static-lod';
6
6
  export interface StaticLodSplatMeshOptions extends SplatMeshOptions {
7
7
  /** Initial selected-frontier budget. Defaults to the build ceiling. */
@@ -1,4 +1,4 @@
1
- import type { SplatData } from './splat-data';
1
+ import type { SplatData } from '../core/splat-data';
2
2
  import type { StaticLodBuildProgress } from './static-lod';
3
3
  export interface StaticLodBuildRequest {
4
4
  readonly type: 'build';
@@ -1,4 +1,4 @@
1
- import type { SplatData } from './splat-data';
1
+ import type { SplatData } from '../core/splat-data';
2
2
  /** Progress emitted while a static scene is spatially ordered and merged. */
3
3
  export interface StaticLodBuildProgress {
4
4
  readonly completed: number;
@@ -3,7 +3,7 @@ var V = (s, r, e) => r in s ? S(s, r, { enumerable: !0, configurable: !0, writab
3
3
  var i = (s, r, e) => V(s, typeof r != "symbol" ? r + "" : r, e);
4
4
  import * as g from "three/webgpu";
5
5
  import { loadSplatData as L } from "./loaders.js";
6
- import { S as P } from "./splat-mesh-aQdcWA6v.js";
6
+ import { S as P } from "./splat-mesh-CsLOQb08.js";
7
7
  const b = 4096, A = 250, x = (s) => {
8
8
  const r = [
9
9
  s.positions.buffer,
@@ -1 +1 @@
1
- {"version":3,"file":"static-lod.js","sources":["../src/lib/static-lod-splat-mesh.ts"],"sourcesContent":["/** @role Bridge - Camera-aware rendering for worker-built static splat hierarchies. */\nimport * as THREE from 'three/webgpu';\nimport { loadSplatData, type SplatDataLoadOptions } from './load-splat-data';\nimport type { SplatData } from './splat-data';\nimport { SplatMesh, type SplatMeshOptions, type SplatUpdateOptions } from './splat-mesh';\nimport type { StaticLodBuildProgress } from './static-lod';\nimport type { StaticLodWorkerRequest, StaticLodWorkerResponse } from './static-lod-worker-protocol';\n\nconst BUDGET_GRANULARITY = 4096;\nconst CAMERA_RESCHEDULE_INTERVAL_MS = 250;\n\nexport interface StaticLodSplatMeshOptions extends SplatMeshOptions {\n /** Initial selected-frontier budget. Defaults to the build ceiling. */\n budget?: number;\n /** Finest frontier retained by the hierarchy and immutable pool ceiling. */\n maxBudget: number;\n /** Reports the spatial ordering and hierarchy-build phase. */\n onLodProgress?: (progress: StaticLodBuildProgress) => void;\n /** Phase-aware progress spanning download, decode completion and LOD build. */\n onAutoLodProgress?: (progress: StaticLodLoadProgress) => void;\n}\n\nexport interface StaticLodLoadProgress {\n readonly phase: 'download' | 'decode' | 'lod-build';\n readonly completed: number;\n readonly total: number;\n}\n\nexport interface StaticLodSplatMeshLoadOptions\n extends StaticLodSplatMeshOptions, SplatDataLoadOptions {}\n\nconst transferablesFor = (data: SplatData): Transferable[] => {\n const transferables: Transferable[] = [\n data.positions.buffer as ArrayBuffer,\n data.colors.buffer as ArrayBuffer,\n data.covariances.buffer as ArrayBuffer,\n ];\n if (data.sh) transferables.push(data.sh.labels.buffer as ArrayBuffer);\n if (data.shPacked) transferables.push(data.shPacked.packed.buffer as ArrayBuffer);\n return transferables;\n};\n\nconst normalizeBudget = (value: number, ceiling: number): number => {\n if (!Number.isFinite(value) || value <= 0) {\n throw new RangeError('StaticLodSplatMesh budget must be a positive finite number.');\n }\n const clamped = Math.min(ceiling, Math.floor(value));\n if (clamped === ceiling || clamped < BUDGET_GRANULARITY) return Math.max(1, clamped);\n return Math.max(\n BUDGET_GRANULARITY,\n Math.floor(clamped / BUDGET_GRANULARITY) * BUDGET_GRANULARITY,\n );\n};\n\nconst buildInWorker = async (\n source: SplatData,\n options: StaticLodSplatMeshOptions,\n signal: AbortSignal | undefined,\n): Promise<{\n data: SplatData;\n contentSplatCount: number;\n finestSplatCount: number;\n worker: Worker;\n}> => {\n const module = await import('./static-lod-worker?worker&inline');\n const WorkerClass = module.default;\n const worker = new WorkerClass();\n return await new Promise((resolve, reject) => {\n const abort = (): void => {\n worker.terminate();\n reject(new DOMException('Static LOD build aborted.', 'AbortError'));\n };\n if (signal?.aborted) {\n abort();\n return;\n }\n signal?.addEventListener('abort', abort, { once: true });\n worker.onerror = (event): void => {\n signal?.removeEventListener('abort', abort);\n worker.terminate();\n reject(new Error(event.message));\n };\n worker.onmessage = (event: MessageEvent<StaticLodWorkerResponse>): void => {\n const response = event.data;\n if (response.type === 'progress') {\n options.onLodProgress?.(response.progress);\n options.onAutoLodProgress?.({ phase: 'lod-build', ...response.progress });\n return;\n }\n if (response.type === 'error') {\n signal?.removeEventListener('abort', abort);\n worker.terminate();\n reject(new Error(response.message));\n return;\n }\n if (response.type !== 'built') return;\n signal?.removeEventListener('abort', abort);\n resolve({\n data: response.data,\n contentSplatCount: response.contentSplatCount,\n finestSplatCount: response.finestSplatCount,\n worker,\n });\n };\n const request: StaticLodWorkerRequest = {\n type: 'build',\n source,\n maxBudget: options.maxBudget,\n };\n worker.postMessage(request, transferablesFor(source));\n });\n};\n\n/**\n * Static splat mesh backed by a merged hierarchy and camera-aware frontier.\n * The full hierarchy is uploaded once; camera/budget cuts only remap the\n * active pool indices and never rewrite resident splat attributes.\n */\nexport class StaticLodSplatMesh extends SplatMesh {\n private readonly worker: Worker;\n private readonly ceilingValue: number;\n private readonly contentCountValue: number;\n private budgetValue: number;\n private sequence = 0;\n private lastScheduleAt = -Infinity;\n private selectionPending = false;\n private readonly cameraLocal = new THREE.Vector3();\n private readonly cameraForward = new THREE.Vector3(0, 0, -1);\n private readonly inverseWorld = new THREE.Matrix4();\n\n private constructor(\n data: SplatData,\n contentSplatCount: number,\n finestSplatCount: number,\n worker: Worker,\n options: StaticLodSplatMeshOptions,\n ) {\n super(data, options);\n this.worker = worker;\n this.ceilingValue = finestSplatCount;\n this.contentCountValue = contentSplatCount;\n this.budgetValue = normalizeBudget(options.budget ?? this.ceilingValue, this.ceilingValue);\n // Hierarchy layout: finest level occupies pool indices `[0, finest)`.\n this.replaceActivePrefix(this.ceilingValue);\n this.worker.onmessage = (event: MessageEvent<StaticLodWorkerResponse>): void => {\n const response = event.data;\n if (response.type === 'error') {\n this.selectionPending = false;\n return;\n }\n if (response.type !== 'selection' || response.sequence !== this.sequence) return;\n this.selectionPending = false;\n this.replaceActiveIndices(response.indices);\n };\n if (this.budgetValue < this.ceilingValue) this.scheduleSelection(true);\n }\n\n /** Loads, decodes and builds a merged static hierarchy without blocking UI. */\n static async load(\n input: string | URL,\n options: StaticLodSplatMeshLoadOptions,\n ): Promise<StaticLodSplatMesh> {\n let decodeReported = false;\n const source = await loadSplatData(input, {\n ...options,\n onProgress: (completed, total) => {\n options.onProgress?.(completed, total);\n options.onAutoLodProgress?.({ phase: 'download', completed, total });\n if (!decodeReported && total > 0 && completed >= total) {\n decodeReported = true;\n options.onAutoLodProgress?.({ phase: 'decode', completed: 0, total: 1 });\n }\n },\n });\n if (!decodeReported) {\n options.onAutoLodProgress?.({ phase: 'decode', completed: 0, total: 1 });\n }\n options.onAutoLodProgress?.({ phase: 'decode', completed: 1, total: 1 });\n const result = await buildInWorker(source, options, options.signal);\n return new StaticLodSplatMesh(\n result.data,\n result.contentSplatCount,\n result.finestSplatCount,\n result.worker,\n options,\n );\n }\n\n get budget(): number {\n return this.budgetValue;\n }\n\n get budgetCeiling(): number {\n return this.ceilingValue;\n }\n\n get maxBudget(): number {\n return this.ceilingValue;\n }\n\n get contentSplatCount(): number {\n return this.contentCountValue;\n }\n\n /** Changes the selected frontier budget within the immutable build ceiling. */\n setBudget(value: number): number {\n const next = normalizeBudget(value, this.ceilingValue);\n if (next === this.budgetValue) return next;\n this.budgetValue = next;\n this.selectionPending = false;\n this.scheduleSelection(true);\n return next;\n }\n\n override update(\n camera: THREE.PerspectiveCamera,\n renderer: THREE.WebGPURenderer,\n options: SplatUpdateOptions = {},\n ): void {\n super.update(camera, renderer, options);\n this.updateLod(camera);\n }\n\n /** Schedules a camera-aware cut when a unified renderer owns drawing/sorting. */\n updateLod(camera: THREE.PerspectiveCamera): void {\n camera.updateMatrixWorld();\n this.updateWorldMatrix(true, false);\n this.inverseWorld.copy(this.matrixWorld).invert();\n this.cameraLocal.setFromMatrixPosition(camera.matrixWorld).applyMatrix4(this.inverseWorld);\n camera.getWorldDirection(this.cameraForward).transformDirection(this.inverseWorld);\n this.scheduleSelection(false);\n }\n\n override dispose(): void {\n if (this.disposed) return;\n this.worker.terminate();\n super.dispose();\n }\n\n private scheduleSelection(immediate: boolean): void {\n if (this.disposed || this.selectionPending) return;\n const now = performance.now();\n if (!immediate && now - this.lastScheduleAt < CAMERA_RESCHEDULE_INTERVAL_MS) return;\n this.lastScheduleAt = now;\n this.selectionPending = true;\n const request: StaticLodWorkerRequest = {\n type: 'select',\n sequence: ++this.sequence,\n budget: this.budgetValue,\n cameraLocal: this.cameraLocal.toArray(),\n cameraForward: this.cameraForward.toArray(),\n };\n this.worker.postMessage(request);\n }\n}\n"],"names":["BUDGET_GRANULARITY","CAMERA_RESCHEDULE_INTERVAL_MS","transferablesFor","data","transferables","normalizeBudget","value","ceiling","clamped","buildInWorker","source","options","signal","WorkerClass","worker","resolve","reject","abort","event","response","_a","_b","request","StaticLodSplatMesh","SplatMesh","contentSplatCount","finestSplatCount","__publicField","THREE","input","decodeReported","loadSplatData","completed","total","_c","result","next","camera","renderer","immediate","now"],"mappings":";;;;;;AAQA,MAAMA,IAAqB,MACrBC,IAAgC,KAsBhCC,IAAmB,CAACC,MAAoC;AAC5D,QAAMC,IAAgC;AAAA,IACpCD,EAAK,UAAU;AAAA,IACfA,EAAK,OAAO;AAAA,IACZA,EAAK,YAAY;AAAA,EAAA;AAEnB,SAAIA,EAAK,MAAIC,EAAc,KAAKD,EAAK,GAAG,OAAO,MAAqB,GAChEA,EAAK,YAAUC,EAAc,KAAKD,EAAK,SAAS,OAAO,MAAqB,GACzEC;AACT,GAEMC,IAAkB,CAACC,GAAeC,MAA4B;AAClE,MAAI,CAAC,OAAO,SAASD,CAAK,KAAKA,KAAS;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,IAAO/B,EAAgBC,GAAO,KAAK,YAAY;AACrD,WAAI8B,MAAS,KAAK,gBAClB,KAAK,cAAcA,GACnB,KAAK,mBAAmB,IACxB,KAAK,kBAAkB,EAAI,IACpBA;AAAA,EACT;AAAA,EAES,OACPC,GACAC,GACA3B,IAA8B,CAAA,GACxB;AACN,UAAM,OAAO0B,GAAQC,GAAU3B,CAAO,GACtC,KAAK,UAAU0B,CAAM;AAAA,EACvB;AAAA;AAAA,EAGA,UAAUA,GAAuC;AAC/C,IAAAA,EAAO,kBAAA,GACP,KAAK,kBAAkB,IAAM,EAAK,GAClC,KAAK,aAAa,KAAK,KAAK,WAAW,EAAE,OAAA,GACzC,KAAK,YAAY,sBAAsBA,EAAO,WAAW,EAAE,aAAa,KAAK,YAAY,GACzFA,EAAO,kBAAkB,KAAK,aAAa,EAAE,mBAAmB,KAAK,YAAY,GACjF,KAAK,kBAAkB,EAAK;AAAA,EAC9B;AAAA,EAES,UAAgB;AACvB,IAAI,KAAK,aACT,KAAK,OAAO,UAAA,GACZ,MAAM,QAAA;AAAA,EACR;AAAA,EAEQ,kBAAkBE,GAA0B;AAClD,QAAI,KAAK,YAAY,KAAK,iBAAkB;AAC5C,UAAMC,IAAM,YAAY,IAAA;AACxB,QAAI,CAACD,KAAaC,IAAM,KAAK,iBAAiBvC,EAA+B;AAC7E,SAAK,iBAAiBuC,GACtB,KAAK,mBAAmB;AACxB,UAAMlB,IAAkC;AAAA,MACtC,MAAM;AAAA,MACN,UAAU,EAAE,KAAK;AAAA,MACjB,QAAQ,KAAK;AAAA,MACb,aAAa,KAAK,YAAY,QAAA;AAAA,MAC9B,eAAe,KAAK,cAAc,QAAA;AAAA,IAAQ;AAE5C,SAAK,OAAO,YAAYA,CAAO;AAAA,EACjC;AACF;"}
1
+ {"version":3,"file":"static-lod.js","sources":["../src/lib/static-lod/static-lod-splat-mesh.ts"],"sourcesContent":["/** @role Bridge - Camera-aware rendering for worker-built static splat hierarchies. */\nimport * as THREE from 'three/webgpu';\nimport { loadSplatData, type SplatDataLoadOptions } from '../loaders/load-splat-data';\nimport type { SplatData } from '../core/splat-data';\nimport { SplatMesh, type SplatMeshOptions, type SplatUpdateOptions } from '../core/splat-mesh';\nimport type { StaticLodBuildProgress } from './static-lod';\nimport type { StaticLodWorkerRequest, StaticLodWorkerResponse } from './static-lod-worker-protocol';\n\nconst BUDGET_GRANULARITY = 4096;\nconst CAMERA_RESCHEDULE_INTERVAL_MS = 250;\n\nexport interface StaticLodSplatMeshOptions extends SplatMeshOptions {\n /** Initial selected-frontier budget. Defaults to the build ceiling. */\n budget?: number;\n /** Finest frontier retained by the hierarchy and immutable pool ceiling. */\n maxBudget: number;\n /** Reports the spatial ordering and hierarchy-build phase. */\n onLodProgress?: (progress: StaticLodBuildProgress) => void;\n /** Phase-aware progress spanning download, decode completion and LOD build. */\n onAutoLodProgress?: (progress: StaticLodLoadProgress) => void;\n}\n\nexport interface StaticLodLoadProgress {\n readonly phase: 'download' | 'decode' | 'lod-build';\n readonly completed: number;\n readonly total: number;\n}\n\nexport interface StaticLodSplatMeshLoadOptions\n extends StaticLodSplatMeshOptions, SplatDataLoadOptions {}\n\nconst transferablesFor = (data: SplatData): Transferable[] => {\n const transferables: Transferable[] = [\n data.positions.buffer as ArrayBuffer,\n data.colors.buffer as ArrayBuffer,\n data.covariances.buffer as ArrayBuffer,\n ];\n if (data.sh) transferables.push(data.sh.labels.buffer as ArrayBuffer);\n if (data.shPacked) transferables.push(data.shPacked.packed.buffer as ArrayBuffer);\n return transferables;\n};\n\nconst normalizeBudget = (value: number, ceiling: number): number => {\n if (!Number.isFinite(value) || value <= 0) {\n throw new RangeError('StaticLodSplatMesh budget must be a positive finite number.');\n }\n const clamped = Math.min(ceiling, Math.floor(value));\n if (clamped === ceiling || clamped < BUDGET_GRANULARITY) return Math.max(1, clamped);\n return Math.max(\n BUDGET_GRANULARITY,\n Math.floor(clamped / BUDGET_GRANULARITY) * BUDGET_GRANULARITY,\n );\n};\n\nconst buildInWorker = async (\n source: SplatData,\n options: StaticLodSplatMeshOptions,\n signal: AbortSignal | undefined,\n): Promise<{\n data: SplatData;\n contentSplatCount: number;\n finestSplatCount: number;\n worker: Worker;\n}> => {\n const module = await import('./static-lod-worker?worker&inline');\n const WorkerClass = module.default;\n const worker = new WorkerClass();\n return await new Promise((resolve, reject) => {\n const abort = (): void => {\n worker.terminate();\n reject(new DOMException('Static LOD build aborted.', 'AbortError'));\n };\n if (signal?.aborted) {\n abort();\n return;\n }\n signal?.addEventListener('abort', abort, { once: true });\n worker.onerror = (event): void => {\n signal?.removeEventListener('abort', abort);\n worker.terminate();\n reject(new Error(event.message));\n };\n worker.onmessage = (event: MessageEvent<StaticLodWorkerResponse>): void => {\n const response = event.data;\n if (response.type === 'progress') {\n options.onLodProgress?.(response.progress);\n options.onAutoLodProgress?.({ phase: 'lod-build', ...response.progress });\n return;\n }\n if (response.type === 'error') {\n signal?.removeEventListener('abort', abort);\n worker.terminate();\n reject(new Error(response.message));\n return;\n }\n if (response.type !== 'built') return;\n signal?.removeEventListener('abort', abort);\n resolve({\n data: response.data,\n contentSplatCount: response.contentSplatCount,\n finestSplatCount: response.finestSplatCount,\n worker,\n });\n };\n const request: StaticLodWorkerRequest = {\n type: 'build',\n source,\n maxBudget: options.maxBudget,\n };\n worker.postMessage(request, transferablesFor(source));\n });\n};\n\n/**\n * Static splat mesh backed by a merged hierarchy and camera-aware frontier.\n * The full hierarchy is uploaded once; camera/budget cuts only remap the\n * active pool indices and never rewrite resident splat attributes.\n */\nexport class StaticLodSplatMesh extends SplatMesh {\n private readonly worker: Worker;\n private readonly ceilingValue: number;\n private readonly contentCountValue: number;\n private budgetValue: number;\n private sequence = 0;\n private lastScheduleAt = -Infinity;\n private selectionPending = false;\n private readonly cameraLocal = new THREE.Vector3();\n private readonly cameraForward = new THREE.Vector3(0, 0, -1);\n private readonly inverseWorld = new THREE.Matrix4();\n\n private constructor(\n data: SplatData,\n contentSplatCount: number,\n finestSplatCount: number,\n worker: Worker,\n options: StaticLodSplatMeshOptions,\n ) {\n super(data, options);\n this.worker = worker;\n this.ceilingValue = finestSplatCount;\n this.contentCountValue = contentSplatCount;\n this.budgetValue = normalizeBudget(options.budget ?? this.ceilingValue, this.ceilingValue);\n // Hierarchy layout: finest level occupies pool indices `[0, finest)`.\n this.replaceActivePrefix(this.ceilingValue);\n this.worker.onmessage = (event: MessageEvent<StaticLodWorkerResponse>): void => {\n const response = event.data;\n if (response.type === 'error') {\n this.selectionPending = false;\n return;\n }\n if (response.type !== 'selection' || response.sequence !== this.sequence) return;\n this.selectionPending = false;\n this.replaceActiveIndices(response.indices);\n };\n if (this.budgetValue < this.ceilingValue) this.scheduleSelection(true);\n }\n\n /** Loads, decodes and builds a merged static hierarchy without blocking UI. */\n static async load(\n input: string | URL,\n options: StaticLodSplatMeshLoadOptions,\n ): Promise<StaticLodSplatMesh> {\n let decodeReported = false;\n const source = await loadSplatData(input, {\n ...options,\n onProgress: (completed, total) => {\n options.onProgress?.(completed, total);\n options.onAutoLodProgress?.({ phase: 'download', completed, total });\n if (!decodeReported && total > 0 && completed >= total) {\n decodeReported = true;\n options.onAutoLodProgress?.({ phase: 'decode', completed: 0, total: 1 });\n }\n },\n });\n if (!decodeReported) {\n options.onAutoLodProgress?.({ phase: 'decode', completed: 0, total: 1 });\n }\n options.onAutoLodProgress?.({ phase: 'decode', completed: 1, total: 1 });\n const result = await buildInWorker(source, options, options.signal);\n return new StaticLodSplatMesh(\n result.data,\n result.contentSplatCount,\n result.finestSplatCount,\n result.worker,\n options,\n );\n }\n\n get budget(): number {\n return this.budgetValue;\n }\n\n get budgetCeiling(): number {\n return this.ceilingValue;\n }\n\n get maxBudget(): number {\n return this.ceilingValue;\n }\n\n get contentSplatCount(): number {\n return this.contentCountValue;\n }\n\n /** Changes the selected frontier budget within the immutable build ceiling. */\n setBudget(value: number): number {\n const next = normalizeBudget(value, this.ceilingValue);\n if (next === this.budgetValue) return next;\n this.budgetValue = next;\n this.selectionPending = false;\n this.scheduleSelection(true);\n return next;\n }\n\n override update(\n camera: THREE.PerspectiveCamera,\n renderer: THREE.WebGPURenderer,\n options: SplatUpdateOptions = {},\n ): void {\n super.update(camera, renderer, options);\n this.updateLod(camera);\n }\n\n /** Schedules a camera-aware cut when a unified renderer owns drawing/sorting. */\n updateLod(camera: THREE.PerspectiveCamera): void {\n camera.updateMatrixWorld();\n this.updateWorldMatrix(true, false);\n this.inverseWorld.copy(this.matrixWorld).invert();\n this.cameraLocal.setFromMatrixPosition(camera.matrixWorld).applyMatrix4(this.inverseWorld);\n camera.getWorldDirection(this.cameraForward).transformDirection(this.inverseWorld);\n this.scheduleSelection(false);\n }\n\n override dispose(): void {\n if (this.disposed) return;\n this.worker.terminate();\n super.dispose();\n }\n\n private scheduleSelection(immediate: boolean): void {\n if (this.disposed || this.selectionPending) return;\n const now = performance.now();\n if (!immediate && now - this.lastScheduleAt < CAMERA_RESCHEDULE_INTERVAL_MS) return;\n this.lastScheduleAt = now;\n this.selectionPending = true;\n const request: StaticLodWorkerRequest = {\n type: 'select',\n sequence: ++this.sequence,\n budget: this.budgetValue,\n cameraLocal: this.cameraLocal.toArray(),\n cameraForward: this.cameraForward.toArray(),\n };\n this.worker.postMessage(request);\n }\n}\n"],"names":["BUDGET_GRANULARITY","CAMERA_RESCHEDULE_INTERVAL_MS","transferablesFor","data","transferables","normalizeBudget","value","ceiling","clamped","buildInWorker","source","options","signal","WorkerClass","worker","resolve","reject","abort","event","response","_a","_b","request","StaticLodSplatMesh","SplatMesh","contentSplatCount","finestSplatCount","__publicField","THREE","input","decodeReported","loadSplatData","completed","total","_c","result","next","camera","renderer","immediate","now"],"mappings":";;;;;;AAQA,MAAMA,IAAqB,MACrBC,IAAgC,KAsBhCC,IAAmB,CAACC,MAAoC;AAC5D,QAAMC,IAAgC;AAAA,IACpCD,EAAK,UAAU;AAAA,IACfA,EAAK,OAAO;AAAA,IACZA,EAAK,YAAY;AAAA,EAAA;AAEnB,SAAIA,EAAK,MAAIC,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A,IAAQ;AAE5C,SAAK,OAAO,YAAYA,CAAO;AAAA,EACjC;AACF;"}
@@ -1,4 +1,4 @@
1
- import { type SplatRequestOptions, type StreamedSplatFormat } from './loading';
1
+ import { type SplatRequestOptions, type StreamedSplatFormat } from '../loaders/loading';
2
2
  /**
3
3
  * Where a streamed dataset's files come from.
4
4
  *
@@ -17,7 +17,7 @@ export { ChunkFetchScheduler, type ChunkFetchSchedulerOptions, type ChunkFetchCl
17
17
  export { ChunkCacheBudget, type ChunkCacheBudgetOptions, type ChunkCacheClient, type ChunkCacheHandle, } from './chunk-cache-budget';
18
18
  export { httpDatasetSource, createLocalDataset } from './dataset-source';
19
19
  export type { SplatDatasetSource, LocalDataset } from './dataset-source';
20
- export type { CollisionMeshTile } from './formats/lcc/collision-mesh';
20
+ export type { CollisionMeshTile } from '../formats/lcc/collision-mesh';
21
21
  export type { SplatCollisionData, CollisionMeshDescriptor, EnvironmentTile } from './lod-source';
22
- export { resolveCpuCacheBytes } from './splat-budget';
23
- export { SplatLoadError, isAbortError, type SplatProgressCallback, type StreamedSplatFormat, type SplatRequestOptions, type SplatLoadPhase, type SplatInputOptions, } from './loading';
22
+ export { resolveCpuCacheBytes } from '../core/splat-budget';
23
+ export { SplatLoadError, isAbortError, type SplatProgressCallback, type StreamedSplatFormat, type SplatRequestOptions, type SplatLoadPhase, type SplatInputOptions, } from '../loaders/loading';
@@ -1,9 +1,9 @@
1
1
  import * as THREE from 'three/webgpu';
2
2
  import { type LodRun } from './lod-scheduler';
3
- import type { ChunkFileFormat } from './loading';
4
- import type { RadChunkRangeRequest } from './load-worker-protocol';
5
- import type { LccChunkParams } from './formats/lcc/parse-lcc';
6
- import type { SplatData } from './splat-data';
3
+ import type { ChunkFileFormat } from '../loaders/loading';
4
+ import type { RadChunkRangeRequest } from '../loaders/load-worker-protocol';
5
+ import type { LccChunkParams } from '../formats/lcc/parse-lcc';
6
+ import type { SplatData } from '../core/splat-data';
7
7
  import type { SplatDatasetSource } from './dataset-source';
8
8
  /**
9
9
  * Per-frame LOD decision maker: given the camera, returns the set of runs
@@ -1,6 +1,6 @@
1
1
  /** Scheduling and data helpers shared by the streamed mesh implementation. */
2
- import type { SplatRange } from './splat-mesh';
3
- import type { SplatData } from './splat-data';
2
+ import type { SplatRange } from '../core/splat-mesh';
3
+ import type { SplatData } from '../core/splat-data';
4
4
  import type { LodRun } from './lod-scheduler';
5
5
  /** One resident entry: the run description plus its pool handle. */
6
6
  type ResidentEntry = [string, {
@@ -1,11 +1,11 @@
1
1
  export * from './streamed-splat-mesh-utils';
2
2
  import * as THREE from 'three/webgpu';
3
- import { SplatMesh, type SplatChannelOptions, type SplatMeshOptions, type SplatUpdateOptions } from './splat-mesh';
3
+ import { SplatMesh, type SplatChannelOptions, type SplatMeshOptions, type SplatUpdateOptions } from '../core/splat-mesh';
4
4
  import { type StreamedScene } from './lod-source';
5
- import type { CollisionMeshTile } from './formats/lcc/collision-mesh';
6
- import { type SplatRequestOptions, type StreamedSplatFormat } from './loading';
7
- import { type SplatDeviceProfile } from './splat-budget';
8
- import { type FrontierFoveation } from './formats/rad/frontier-worker-protocol';
5
+ import type { CollisionMeshTile } from '../formats/lcc/collision-mesh';
6
+ import { type SplatRequestOptions, type StreamedSplatFormat } from '../loaders/loading';
7
+ import { type SplatDeviceProfile } from '../core/splat-budget';
8
+ import { type FrontierFoveation } from '../formats/rad/frontier-worker-protocol';
9
9
  import type { ChunkFetchScheduler } from './chunk-fetch-scheduler';
10
10
  import type { ChunkCacheBudget } from './chunk-cache-budget';
11
11
  /**
@@ -100,6 +100,17 @@ export interface StreamedSplatMeshOptions extends SplatMeshOptions {
100
100
  * number.
101
101
  */
102
102
  maxBudget?: number;
103
+ /**
104
+ * Lets a host that pins {@link budget} and/or {@link maxBudget} still take the
105
+ * finest-level lift for `.rad` strategy selection and pool sizing. Without it,
106
+ * pinning either option disables the lift and a capture whose leaf count sits
107
+ * between the host ceiling and {@link FOVEATION_LEAF_THRESHOLD} incorrectly
108
+ * lands on the foveated page-table path instead of the prefix reader.
109
+ *
110
+ * {@link budgetCap} still vetoes the lift when set. Mobile and fill-constrained
111
+ * desktops remain exempt inside {@link liftBudgetToFinestLevel}.
112
+ */
113
+ allowFinestLevelLift?: boolean;
103
114
  /**
104
115
  * Multiplier on this mesh's LOD detail, matching Spark's per-mesh `lodScale`:
105
116
  * `> 1` refines further (finer cut, more splats drawn), `< 1` coarsens.
@@ -450,6 +461,15 @@ export declare class StreamedSplatMesh extends SplatMesh {
450
461
  /** Last frontier's drawn (non-degenerate) splat count - the true on-screen size
451
462
  * in `page-table` mode, where the slab is fully "active" but mostly degenerate. */
452
463
  private pageTableDrawn;
464
+ private frontierConverged;
465
+ private pendingFrontierSplats;
466
+ private staleResidentSplats;
467
+ private lastPlanAppends;
468
+ private lastPlanMoves;
469
+ private lastPlanGeneration;
470
+ private lastPlanBudget;
471
+ private lastPlanCamera;
472
+ private firstFrontierCamera;
453
473
  /** Monotonic reschedule id; a stale plan (superseded by a newer request) is
454
474
  * dropped. `pageTableInFlight` coalesces to one outstanding traversal. */
455
475
  private pageTableSeq;
@@ -674,6 +694,11 @@ export declare class StreamedSplatMesh extends SplatMesh {
674
694
  * `undefined` when the format does not declare a content size.
675
695
  */
676
696
  get contentSplatCount(): number | undefined;
697
+ /**
698
+ * Which `.rad` streaming strategy this mesh selected at load, or `null` when
699
+ * the scene is not a Spark `.rad` capture.
700
+ */
701
+ get radStrategy(): 'prefix' | 'page-table' | null;
677
702
  /**
678
703
  * The drawn-splat target currently driving the `.rad` page-table frontier -
679
704
  * the governed budget, capped by
@@ -685,6 +710,21 @@ export declare class StreamedSplatMesh extends SplatMesh {
685
710
  * detail: {@link budget} is the pool's allowance, this is what is spent.
686
711
  */
687
712
  get drawBudget(): number;
713
+ /**
714
+ * Page-table frontier coherence for hosts that gate preload/transitions.
715
+ * `undefined` fields stay 0 when this mesh is not in page-table mode.
716
+ */
717
+ get frontierState(): Readonly<{
718
+ frontierConverged: boolean;
719
+ pendingFrontierSplats: number;
720
+ staleResidentSplats: number;
721
+ lastPlanAppends: number;
722
+ lastPlanMoves: number;
723
+ planGeneration: number;
724
+ planBudget: number;
725
+ lastPlanCamera: readonly [number, number, number] | null;
726
+ firstFrontierCamera: readonly [number, number, number] | null;
727
+ }>;
688
728
  /**
689
729
  * Spark's per-mesh `lodScale` (see {@link StreamedSplatMeshOptions.lodScale}).
690
730
  * Mutable: raise it to sharpen a focused mesh, lower it to coarsen a