@voluma/vlam 0.1.0 → 0.2.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 (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +60 -0
  3. package/THIRD_PARTY_NOTICES.md +86 -0
  4. package/dist/budget-governor.d.ts +154 -0
  5. package/dist/camera-budget-governor.d.ts +234 -0
  6. package/dist/chunk-cache-budget.d.ts +156 -0
  7. package/dist/chunk-fetch-scheduler.d.ts +168 -0
  8. package/dist/chunk-loader.d.ts +85 -0
  9. package/dist/compute-sorter.d.ts +131 -0
  10. package/dist/create-splat-renderer.d.ts +99 -0
  11. package/dist/dataset-source.d.ts +55 -0
  12. package/dist/depth-of-field.d.ts +73 -0
  13. package/dist/effects.d.ts +337 -0
  14. package/dist/effects.js +180 -0
  15. package/dist/effects.js.map +1 -0
  16. package/dist/formats/ksplat/index.d.ts +8 -0
  17. package/dist/formats/ksplat/parse-ksplat.d.ts +9 -0
  18. package/dist/formats/ksplat.js +167 -0
  19. package/dist/formats/ksplat.js.map +1 -0
  20. package/dist/formats/lcc/collision-mesh.d.ts +37 -0
  21. package/dist/formats/lcc/collision-partition.d.ts +35 -0
  22. package/dist/formats/lcc/index.d.ts +16 -0
  23. package/dist/formats/lcc/lcc.d.ts +28 -0
  24. package/dist/formats/lcc/lcc2-transform.d.ts +18 -0
  25. package/dist/formats/lcc/lcc2.d.ts +4 -0
  26. package/dist/formats/lcc/parse-collision-lci.d.ts +28 -0
  27. package/dist/formats/lcc/parse-lcc.d.ts +177 -0
  28. package/dist/formats/lcc/parse-mesh-ply.d.ts +21 -0
  29. package/dist/formats/lcc.js +969 -0
  30. package/dist/formats/lcc.js.map +1 -0
  31. package/dist/formats/ply/index.d.ts +12 -0
  32. package/dist/formats/ply/parse-compressed-ply.d.ts +16 -0
  33. package/dist/formats/ply/parse-splat-ply.d.ts +46 -0
  34. package/dist/formats/ply.js +230 -0
  35. package/dist/formats/ply.js.map +1 -0
  36. package/dist/formats/rad/frontier-worker-protocol.d.ts +177 -0
  37. package/dist/formats/rad/index.d.ts +10 -0
  38. package/dist/formats/rad/parse-rad.d.ts +88 -0
  39. package/dist/formats/rad/rad-column-decoders.d.ts +15 -0
  40. package/dist/formats/rad/rad-foveated-source.d.ts +71 -0
  41. package/dist/formats/rad/rad-parent-sizes.d.ts +45 -0
  42. package/dist/formats/rad/rad.d.ts +132 -0
  43. package/dist/formats/rad.js +1098 -0
  44. package/dist/formats/rad.js.map +1 -0
  45. package/dist/formats/sog/index.d.ts +9 -0
  46. package/dist/formats/sog/parse-sog.d.ts +45 -0
  47. package/dist/formats/sog.js +257 -0
  48. package/dist/formats/sog.js.map +1 -0
  49. package/dist/formats/splat/index.d.ts +8 -0
  50. package/dist/formats/splat/parse-splat.d.ts +10 -0
  51. package/dist/formats/splat.js +39 -0
  52. package/dist/formats/splat.js.map +1 -0
  53. package/dist/formats/spz/index.d.ts +8 -0
  54. package/dist/formats/spz/parse-spz.d.ts +10 -0
  55. package/dist/formats/spz.js +218 -0
  56. package/dist/formats/spz.js.map +1 -0
  57. package/dist/frontier-worker-CAnK_Cmu.js +566 -0
  58. package/dist/frontier-worker-CAnK_Cmu.js.map +1 -0
  59. package/dist/half-float-Cs4FDq8Q.js +30 -0
  60. package/dist/half-float-Cs4FDq8Q.js.map +1 -0
  61. package/dist/half-float.d.ts +15 -0
  62. package/dist/index.d.ts +54 -0
  63. package/dist/index.js +9054 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/load-scene.d.ts +50 -0
  66. package/dist/load-worker-protocol.d.ts +82 -0
  67. package/dist/loading-wLo8vRbA.js +102 -0
  68. package/dist/loading-wLo8vRbA.js.map +1 -0
  69. package/dist/loading.d.ts +150 -0
  70. package/dist/lod-manifest.d.ts +61 -0
  71. package/dist/lod-scheduler.d.ts +229 -0
  72. package/dist/lod-source.d.ts +207 -0
  73. package/dist/logging-BfPdd7NJ.js +19 -0
  74. package/dist/logging-BfPdd7NJ.js.map +1 -0
  75. package/dist/logging.d.ts +37 -0
  76. package/dist/one-shot-worker-G80btnth.js +664 -0
  77. package/dist/one-shot-worker-G80btnth.js.map +1 -0
  78. package/dist/orientation.d.ts +35 -0
  79. package/dist/ply-header-BwgExCn-.js +125 -0
  80. package/dist/ply-header-BwgExCn-.js.map +1 -0
  81. package/dist/ply-header.d.ts +87 -0
  82. package/dist/radix-sort.d.ts +28 -0
  83. package/dist/radix-sorter.d.ts +46 -0
  84. package/dist/relighting.d.ts +50 -0
  85. package/dist/selection-volume.d.ts +87 -0
  86. package/dist/sh-pack-D5wAe5gg.js +54 -0
  87. package/dist/sh-pack-D5wAe5gg.js.map +1 -0
  88. package/dist/sh-pack.d.ts +49 -0
  89. package/dist/sort-scheduler.d.ts +62 -0
  90. package/dist/sort-worker-protocol.d.ts +37 -0
  91. package/dist/sorter.d.ts +31 -0
  92. package/dist/source-transform.d.ts +57 -0
  93. package/dist/splat-budget-PSojLJPO.js +157 -0
  94. package/dist/splat-budget-PSojLJPO.js.map +1 -0
  95. package/dist/splat-budget.d.ts +404 -0
  96. package/dist/splat-data-BZM5dhhx.js +10 -0
  97. package/dist/splat-data-BZM5dhhx.js.map +1 -0
  98. package/dist/splat-data.d.ts +150 -0
  99. package/dist/splat-depth-pack.d.ts +39 -0
  100. package/dist/splat-mesh-material.d.ts +255 -0
  101. package/dist/splat-mesh-picking.d.ts +87 -0
  102. package/dist/splat-mesh-pool.d.ts +241 -0
  103. package/dist/splat-mesh-types-8QDjTbZO.js +390 -0
  104. package/dist/splat-mesh-types-8QDjTbZO.js.map +1 -0
  105. package/dist/splat-mesh-types.d.ts +390 -0
  106. package/dist/splat-mesh.d.ts +737 -0
  107. package/dist/splat-modifier-stack.d.ts +38 -0
  108. package/dist/splat-modifier.d.ts +156 -0
  109. package/dist/splat-partition.d.ts +37 -0
  110. package/dist/splat-query.d.ts +51 -0
  111. package/dist/splat-scene.d.ts +127 -0
  112. package/dist/splat-sort-bounds.d.ts +11 -0
  113. package/dist/static-lod-splat-mesh.d.ts +53 -0
  114. package/dist/static-lod-worker-D2fyqQZO.js +474 -0
  115. package/dist/static-lod-worker-D2fyqQZO.js.map +1 -0
  116. package/dist/static-lod-worker-protocol.d.ts +37 -0
  117. package/dist/static-lod.d.ts +24 -0
  118. package/dist/storage-attribute-mirror.d.ts +103 -0
  119. package/dist/streamed-splat-mesh-utils.d.ts +146 -0
  120. package/dist/streamed-splat-mesh.d.ts +985 -0
  121. package/dist/unified-splat-renderer.d.ts +205 -0
  122. package/dist/webgpu-limits.d.ts +133 -0
  123. package/dist/work-buffer-gather.d.ts +119 -0
  124. package/dist/work-buffer-material.d.ts +42 -0
  125. package/dist/worker-sorter.d.ts +57 -0
  126. package/dist/xr-view.d.ts +92 -0
  127. package/package.json +135 -21
@@ -0,0 +1,146 @@
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';
4
+ import type { LodRun } from './lod-scheduler';
5
+ /** One resident entry: the run description plus its pool handle. */
6
+ type ResidentEntry = [string, {
7
+ run: LodRun;
8
+ handle: SplatRange;
9
+ }];
10
+ /** A set of adds and removals covering one contiguous leaf region. */
11
+ export interface SwapGroup {
12
+ adds: LodRun[];
13
+ removes: ResidentEntry[];
14
+ leafStart: number;
15
+ leafEnd: number;
16
+ addCount: number;
17
+ }
18
+ /**
19
+ * One swap group per run for the startup hold. The mesh is invisible, so L0
20
+ * cell-atomicity is unnecessary; committing slice-by-slice lets the hold finish
21
+ * as soon as the capped set is resident instead of waiting on sibling subchunks.
22
+ */
23
+ export declare function buildHoldSwapGroups(toAdd: readonly LodRun[]): SwapGroup[];
24
+ /**
25
+ * Groups adds and removals into visible-cell transactions.
26
+ *
27
+ * Classic LCC (`coverageGroup` set on every run): one transaction per sub-leaf
28
+ * interval at every resolved level (including L0), so a cached slice can
29
+ * replace its own prior coverage while siblings still fetch. Hierarchical
30
+ * sources without coverage groups keep interval-overlap grouping.
31
+ */
32
+ export declare function buildSwapGroups(toAdd: LodRun[], toRemove: ResidentEntry[]): SwapGroup[];
33
+ /**
34
+ * Groups that only add coverage first (coarse before fine), then the ones that
35
+ * retire it - pure removals last of all.
36
+ *
37
+ * The order is what makes the wave gate in `reschedule` decidable: by the time a
38
+ * retiring group is reached, every purely additive group has already had its
39
+ * turn, so "have the replacements landed?" is answered rather than guessed.
40
+ * Pure removals free pool rows, so they go last, where they relieve the
41
+ * over-draw the gate deliberately trades for.
42
+ *
43
+ * Exported for tests only - not part of the public API surface.
44
+ */
45
+ export declare function groupPriority(group: SwapGroup): number;
46
+ /** True when every transaction belongs to classic LCC physical coverage. */
47
+ export declare function isClassicLccSwapSet(groups: readonly SwapGroup[]): boolean;
48
+ /**
49
+ * Orders classic display transactions by what the camera can see. This is
50
+ * separate from {@link groupPriority}: its global coarse-before-retirement
51
+ * wave preserves hierarchical RAD coverage, whereas LCC has an independent
52
+ * coarse shell for every L1+ slice and can safely commit a ready centre slice.
53
+ * Exported for tests only - not part of the public API surface.
54
+ */
55
+ export declare function compareClassicSwapGroups(a: SwapGroup, b: SwapGroup): number;
56
+ /** One classic-path chunk want, ranked before {@link StreamedSplatMesh} issues it. */
57
+ export type ClassicFetchPhase = 'finest-target' | 'coverage' | 'target' | 'background';
58
+ export interface ClassicFetchWant {
59
+ /** Cross-mesh scheduler kind derived from {@link phase}. */
60
+ kind: 'priority' | 'base';
61
+ /** Internal classic ranking tier (not exported on ChunkFetchKind). */
62
+ phase: ClassicFetchPhase;
63
+ distance: number;
64
+ level: number;
65
+ /** Prefer in-frustum wants; false means behind-camera / out of view. */
66
+ inView: boolean;
67
+ /** Classic LCC physical cell; `-1` when the source has no coverage groups. */
68
+ coverageGroup: number;
69
+ /** Source interval: L1+ uses this as its progressive display transaction. */
70
+ leafStart: number;
71
+ /** One past {@link leafStart}. */
72
+ leafEnd: number;
73
+ /** Fetch-only angular distance from the screen centre; smaller wins. */
74
+ screenImportance: number;
75
+ /**
76
+ * Min distance among pending wants in this coverage group. Stamped in
77
+ * {@link stampClassicFetchGroups} so a split cell's slices stay together.
78
+ */
79
+ groupDistance: number;
80
+ /** Pending file count in this coverage group; denser near cells win ties. */
81
+ groupPending: number;
82
+ /** True when any pending run in this group is in-frustum. */
83
+ groupInView: boolean;
84
+ /** Best screen-centre score among runs in this fetch transaction. */
85
+ groupScreenImportance: number;
86
+ /** True when this transaction contains a finest-level (L0) target. */
87
+ groupFinest: boolean;
88
+ /** Stable aggregate key: L0 cell, L1+ slice, or singleton file. */
89
+ groupId: string;
90
+ /** Visible(0) / near-out-of-view(1) / background(2) ranking bucket. */
91
+ groupClass: 0 | 1 | 2;
92
+ }
93
+ /**
94
+ * Fills {@link ClassicFetchWant.groupDistance} / `groupPending` so ranking can
95
+ * finish one near cell before sprinkling bandwidth across neighbors.
96
+ */
97
+ export declare function stampClassicFetchGroups(pending: Map<number, ClassicFetchWant>, lodBaseDistance?: number, forceNearPriority?: boolean): void;
98
+ /**
99
+ * Distance inside which classic LCC treats a cut as short-range for fetch
100
+ * ranking. Matches {@link LodSourceOptions.lodBaseDistance} (default 10).
101
+ */
102
+ export declare function nearDisplayDistance(lodBaseDistance: number, _lodMultiplier?: number): number;
103
+ /**
104
+ * True when this deferred group is waiting on resolved finest (L0) - never
105
+ * flash coarsest discs as a stand-in.
106
+ */
107
+ export declare function isWaitingOnFinest(group: SwapGroup): boolean;
108
+ /**
109
+ * Classic fetch phase for a **resolved** desired run. Ambition-only levels are
110
+ * never requested - callers pass runs from `computeDesiredRuns` only.
111
+ */
112
+ export declare function classicFetchPhaseForDesired(run: LodRun, lodBaseDistance: number, lodMultiplier?: number): ClassicFetchPhase;
113
+ /** Classic fetch phase for a pinned coarsest substitute of an L1+ gap. */
114
+ export declare function classicFetchPhaseForCoverage(run: LodRun, lodBaseDistance: number, lodMultiplier?: number): ClassicFetchPhase;
115
+ /**
116
+ * Maps a desired run to the cross-mesh fetch kind. Prefer
117
+ * {@link classicFetchPhaseForDesired} for ranking; this remains for tests.
118
+ */
119
+ export declare function classicFetchKindForDesired(run: LodRun, lodBaseDistance: number, lodMultiplier?: number): ClassicFetchWant['kind'];
120
+ export declare function enqueueClassicFetch(pending: Map<number, ClassicFetchWant>, file: number, phase: ClassicFetchPhase, run: LodRun): void;
121
+ /**
122
+ * Sort by coverage group first: visible groups, then near out-of-view, then
123
+ * background. Within a group: coverage → resolved target (L0/L1+) → background.
124
+ */
125
+ export declare function compareClassicFetches(a: ClassicFetchWant, b: ClassicFetchWant, fileA: number, fileB: number): number;
126
+ /** Zero-copy view of one contiguous splat range within a decoded chunk.
127
+ * Exported for tests only - not part of the public API surface. */
128
+ export declare function sliceSplatData(chunk: SplatData, offset: number, count: number): SplatData;
129
+ export declare function chunkBytes(data: SplatData): number;
130
+ /** An abort signal's reason as an Error, whatever the caller aborted with. */
131
+ export declare function abortReason(signal: AbortSignal): Error;
132
+ export declare function validateAppendCap(value: number | undefined): number;
133
+ /** Validates Spark's per-mesh `lodScale`; `undefined` means the neutral 1. */
134
+ export declare function validateLodScale(value: number | undefined): number;
135
+ /**
136
+ * The decoded-chunk cache cap.
137
+ *
138
+ * Delegates to {@link resolveCpuCacheBytes} rather than re-deriving it. The
139
+ * local copy this replaces read `navigator.deviceMemory ?? 4`, which looks
140
+ * equivalent but is not: **iOS never reports `deviceMemory` at all**, so every
141
+ * iPhone took the `4` fallback and a 128 MiB cache, where the profile-aware
142
+ * policy gives a memory-less device 32 MiB. That is 96 MiB of decoded chunks
143
+ * held on the one platform whose tab gets killed for holding too much.
144
+ */
145
+ export declare function defaultCpuCacheBytes(): number;
146
+ export {};