@voluma/vlam 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +68 -0
- package/THIRD_PARTY_NOTICES.md +86 -0
- package/dist/budget-governor.d.ts +154 -0
- package/dist/camera-budget-governor.d.ts +234 -0
- package/dist/chunk-cache-budget.d.ts +156 -0
- package/dist/chunk-fetch-scheduler.d.ts +168 -0
- package/dist/chunk-loader.d.ts +85 -0
- package/dist/compute-sorter.d.ts +131 -0
- package/dist/create-splat-renderer.d.ts +99 -0
- package/dist/dataset-source.d.ts +55 -0
- package/dist/depth-of-field.d.ts +73 -0
- package/dist/effects.d.ts +337 -0
- package/dist/effects.js +180 -0
- package/dist/effects.js.map +1 -0
- package/dist/formats/ksplat/index.d.ts +8 -0
- package/dist/formats/ksplat/parse-ksplat.d.ts +9 -0
- package/dist/formats/ksplat.js +167 -0
- package/dist/formats/ksplat.js.map +1 -0
- package/dist/formats/lcc/collision-mesh.d.ts +37 -0
- package/dist/formats/lcc/collision-partition.d.ts +35 -0
- package/dist/formats/lcc/index.d.ts +16 -0
- package/dist/formats/lcc/lcc.d.ts +28 -0
- package/dist/formats/lcc/lcc2-transform.d.ts +18 -0
- package/dist/formats/lcc/lcc2.d.ts +4 -0
- package/dist/formats/lcc/parse-collision-lci.d.ts +28 -0
- package/dist/formats/lcc/parse-lcc.d.ts +177 -0
- package/dist/formats/lcc/parse-mesh-ply.d.ts +21 -0
- package/dist/formats/lcc.js +969 -0
- package/dist/formats/lcc.js.map +1 -0
- package/dist/formats/ply/index.d.ts +12 -0
- package/dist/formats/ply/parse-compressed-ply.d.ts +16 -0
- package/dist/formats/ply/parse-splat-ply.d.ts +46 -0
- package/dist/formats/ply.js +230 -0
- package/dist/formats/ply.js.map +1 -0
- package/dist/formats/rad/frontier-worker-protocol.d.ts +177 -0
- package/dist/formats/rad/index.d.ts +10 -0
- package/dist/formats/rad/parse-rad.d.ts +88 -0
- package/dist/formats/rad/rad-column-decoders.d.ts +15 -0
- package/dist/formats/rad/rad-foveated-source.d.ts +71 -0
- package/dist/formats/rad/rad-parent-sizes.d.ts +45 -0
- package/dist/formats/rad/rad.d.ts +132 -0
- package/dist/formats/rad.js +1098 -0
- package/dist/formats/rad.js.map +1 -0
- package/dist/formats/sog/index.d.ts +9 -0
- package/dist/formats/sog/parse-sog.d.ts +45 -0
- package/dist/formats/sog.js +257 -0
- package/dist/formats/sog.js.map +1 -0
- package/dist/formats/splat/index.d.ts +8 -0
- package/dist/formats/splat/parse-splat.d.ts +10 -0
- package/dist/formats/splat.js +39 -0
- package/dist/formats/splat.js.map +1 -0
- package/dist/formats/spz/index.d.ts +8 -0
- package/dist/formats/spz/parse-spz.d.ts +10 -0
- package/dist/formats/spz.js +218 -0
- package/dist/formats/spz.js.map +1 -0
- package/dist/frontier-worker-CAnK_Cmu.js +566 -0
- package/dist/frontier-worker-CAnK_Cmu.js.map +1 -0
- package/dist/half-float-Cs4FDq8Q.js +30 -0
- package/dist/half-float-Cs4FDq8Q.js.map +1 -0
- package/dist/half-float.d.ts +15 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +9054 -0
- package/dist/index.js.map +1 -0
- package/dist/load-scene.d.ts +50 -0
- package/dist/load-worker-protocol.d.ts +82 -0
- package/dist/loading-wLo8vRbA.js +102 -0
- package/dist/loading-wLo8vRbA.js.map +1 -0
- package/dist/loading.d.ts +150 -0
- package/dist/lod-manifest.d.ts +61 -0
- package/dist/lod-scheduler.d.ts +229 -0
- package/dist/lod-source.d.ts +207 -0
- package/dist/logging-BfPdd7NJ.js +19 -0
- package/dist/logging-BfPdd7NJ.js.map +1 -0
- package/dist/logging.d.ts +37 -0
- package/dist/one-shot-worker-G80btnth.js +664 -0
- package/dist/one-shot-worker-G80btnth.js.map +1 -0
- package/dist/orientation.d.ts +35 -0
- package/dist/ply-header-BwgExCn-.js +125 -0
- package/dist/ply-header-BwgExCn-.js.map +1 -0
- package/dist/ply-header.d.ts +87 -0
- package/dist/radix-sort.d.ts +28 -0
- package/dist/radix-sorter.d.ts +46 -0
- package/dist/relighting.d.ts +50 -0
- package/dist/selection-volume.d.ts +87 -0
- package/dist/sh-pack-D5wAe5gg.js +54 -0
- package/dist/sh-pack-D5wAe5gg.js.map +1 -0
- package/dist/sh-pack.d.ts +49 -0
- package/dist/sort-scheduler.d.ts +62 -0
- package/dist/sort-worker-protocol.d.ts +37 -0
- package/dist/sorter.d.ts +31 -0
- package/dist/source-transform.d.ts +57 -0
- package/dist/splat-budget-PSojLJPO.js +157 -0
- package/dist/splat-budget-PSojLJPO.js.map +1 -0
- package/dist/splat-budget.d.ts +404 -0
- package/dist/splat-data-BZM5dhhx.js +10 -0
- package/dist/splat-data-BZM5dhhx.js.map +1 -0
- package/dist/splat-data.d.ts +150 -0
- package/dist/splat-depth-pack.d.ts +39 -0
- package/dist/splat-mesh-material.d.ts +255 -0
- package/dist/splat-mesh-picking.d.ts +87 -0
- package/dist/splat-mesh-pool.d.ts +241 -0
- package/dist/splat-mesh-types-8QDjTbZO.js +390 -0
- package/dist/splat-mesh-types-8QDjTbZO.js.map +1 -0
- package/dist/splat-mesh-types.d.ts +390 -0
- package/dist/splat-mesh.d.ts +737 -0
- package/dist/splat-modifier-stack.d.ts +38 -0
- package/dist/splat-modifier.d.ts +156 -0
- package/dist/splat-partition.d.ts +37 -0
- package/dist/splat-query.d.ts +51 -0
- package/dist/splat-scene.d.ts +127 -0
- package/dist/splat-sort-bounds.d.ts +11 -0
- package/dist/static-lod-splat-mesh.d.ts +53 -0
- package/dist/static-lod-worker-D2fyqQZO.js +474 -0
- package/dist/static-lod-worker-D2fyqQZO.js.map +1 -0
- package/dist/static-lod-worker-protocol.d.ts +37 -0
- package/dist/static-lod.d.ts +24 -0
- package/dist/storage-attribute-mirror.d.ts +103 -0
- package/dist/streamed-splat-mesh-utils.d.ts +146 -0
- package/dist/streamed-splat-mesh.d.ts +985 -0
- package/dist/unified-splat-renderer.d.ts +205 -0
- package/dist/webgpu-limits.d.ts +133 -0
- package/dist/work-buffer-gather.d.ts +119 -0
- package/dist/work-buffer-material.d.ts +42 -0
- package/dist/worker-sorter.d.ts +57 -0
- package/dist/xr-view.d.ts +92 -0
- package/package.json +135 -21
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { type SplatData } from '../../splat-data';
|
|
2
|
+
/**
|
|
3
|
+
* Decoder for XGRIDS' older LCC datasets (`.lcc` / `meta.lcc`; see
|
|
4
|
+
* `docs/formats/lcc-notes.md`). Manifest versions **2.x** through **5.x** share the
|
|
5
|
+
* same binary layout; v2/v3 omit `fileType` and v3 often names the manifest `meta.lcc`.
|
|
6
|
+
*
|
|
7
|
+
* Unlike `.lcc2` - which delivers SOG/WebP tiles and reuses {@link parseSog} -
|
|
8
|
+
* an LCC dataset is raw binary: a JSON manifest, an `index.bin` of per-cell
|
|
9
|
+
* per-level ranges, and one large `data.bin` of fixed 32-byte splat records
|
|
10
|
+
* that chunks are cut out of with HTTP range requests.
|
|
11
|
+
*
|
|
12
|
+
* Implemented from XGRIDS' openly published spec (Data Organization Format
|
|
13
|
+
* originated from XGRIDS); no XGRIDS code is used, and their capture data is
|
|
14
|
+
* never redistributed. Where the whitepaper's field table disagrees with real
|
|
15
|
+
* captures the bytes win - see `docs/formats/lcc-notes.md` for the verification.
|
|
16
|
+
*/
|
|
17
|
+
/** Bytes per splat in `data.bin`. */
|
|
18
|
+
export declare const LCC_RECORD_BYTES = 32;
|
|
19
|
+
/** Bytes per splat in `shcoef.bin`, and of the SH block inside an env record. */
|
|
20
|
+
export declare const LCC_SH_RECORD_BYTES = 64;
|
|
21
|
+
/** SH coefficients per channel in a `Quality` capture (3rd order). */
|
|
22
|
+
export declare const LCC_SH_COEFFICIENTS = 15;
|
|
23
|
+
/** A `[min, max]` dequantization range from the manifest's `attributes`. */
|
|
24
|
+
export interface LccRange {
|
|
25
|
+
readonly min: readonly [number, number, number];
|
|
26
|
+
readonly max: readonly [number, number, number];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Where a capture's local origin sits in the real world. Purely informational
|
|
30
|
+
* - the splat data is local and is rendered as-is (see `parseGeoreference`).
|
|
31
|
+
*/
|
|
32
|
+
export interface LccGeoreference {
|
|
33
|
+
/** The local origin's coordinates in {@link epsg}, from manifest `offset`. */
|
|
34
|
+
readonly origin: readonly [number, number, number];
|
|
35
|
+
/** The projection's EPSG code, when the manifest names one. */
|
|
36
|
+
readonly epsg?: number;
|
|
37
|
+
}
|
|
38
|
+
/** The manifest fields this loader consumes. */
|
|
39
|
+
export interface LccManifest {
|
|
40
|
+
readonly totalSplats: number;
|
|
41
|
+
readonly totalLevel: number;
|
|
42
|
+
readonly cellLengthX: number;
|
|
43
|
+
readonly cellLengthY: number;
|
|
44
|
+
readonly indexDataSize: number;
|
|
45
|
+
/** Per-level splat totals; index 0 is the finest level. */
|
|
46
|
+
readonly splats: readonly number[];
|
|
47
|
+
readonly bounds: {
|
|
48
|
+
min: [number, number, number];
|
|
49
|
+
max: [number, number, number];
|
|
50
|
+
};
|
|
51
|
+
/** `Quality` captures carry `shcoef.bin`; `Portable` ones have no SH. */
|
|
52
|
+
readonly fileType: 'Portable' | 'Quality';
|
|
53
|
+
readonly scale: LccRange;
|
|
54
|
+
readonly shcoef: LccRange;
|
|
55
|
+
readonly envScale: LccRange;
|
|
56
|
+
readonly envShcoef: LccRange;
|
|
57
|
+
/** Set when the capture is georeferenced; absent for a purely local one. */
|
|
58
|
+
readonly georeference?: LccGeoreference;
|
|
59
|
+
}
|
|
60
|
+
/** One cell's range within `data.bin` at one LOD level. */
|
|
61
|
+
export interface LccLevelRange {
|
|
62
|
+
readonly count: number;
|
|
63
|
+
readonly byteOffset: number;
|
|
64
|
+
readonly byteSize: number;
|
|
65
|
+
}
|
|
66
|
+
/** One `index.bin` record: a cell of the 2D grid, at every LOD level. */
|
|
67
|
+
export interface LccIndexCell {
|
|
68
|
+
readonly cellX: number;
|
|
69
|
+
readonly cellY: number;
|
|
70
|
+
/** Range per level; index 0 is the finest. */
|
|
71
|
+
readonly levels: readonly LccLevelRange[];
|
|
72
|
+
}
|
|
73
|
+
/** Everything the worker needs to turn fetched bytes into splats. */
|
|
74
|
+
export interface LccChunkParams {
|
|
75
|
+
/** `splats` decodes `data.bin`; `environment` decodes `environment.bin`. */
|
|
76
|
+
readonly kind: 'splats' | 'environment';
|
|
77
|
+
/** Byte range within the source file. */
|
|
78
|
+
readonly start: number;
|
|
79
|
+
readonly length: number;
|
|
80
|
+
/**
|
|
81
|
+
* Bytes per record. Always 32 in `data.bin`; `environment.bin` interleaves
|
|
82
|
+
* a 64-byte SH block per splat in a `Quality` capture, making it 96.
|
|
83
|
+
*
|
|
84
|
+
* This is a property of the *file*, not of whether the SH is wanted - a
|
|
85
|
+
* `Quality` environment stays 96 bytes per record even with SH disabled.
|
|
86
|
+
*/
|
|
87
|
+
readonly stride: number;
|
|
88
|
+
/** Dequantization range for the scale field (`scale` or `envscale`). */
|
|
89
|
+
readonly scale: LccRange;
|
|
90
|
+
/** Present when this chunk's SH should be decoded (see `LccShParams`). */
|
|
91
|
+
readonly sh?: LccShParams;
|
|
92
|
+
}
|
|
93
|
+
/** How to obtain (and dequantize) a chunk's higher-order SH. */
|
|
94
|
+
export interface LccShParams {
|
|
95
|
+
/** SH bands to keep: 1, 2 or 3 → 3, 8 or 15 coefficients. */
|
|
96
|
+
readonly bands: 1 | 2 | 3;
|
|
97
|
+
readonly range: LccRange;
|
|
98
|
+
/**
|
|
99
|
+
* Where the SH bytes come from. `sidecar` fetches `shcoef.bin` over the
|
|
100
|
+
* given range (`data.bin` offset × 2); `inline` reads the 64-byte block
|
|
101
|
+
* that follows each base record inside a 96-byte environment record.
|
|
102
|
+
*/
|
|
103
|
+
readonly source: 'sidecar' | 'inline';
|
|
104
|
+
/** Absolute `shcoef.bin` URL; only for `source: 'sidecar'`. */
|
|
105
|
+
readonly url?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Re-encode the decoded words into this range instead of {@link range}.
|
|
108
|
+
*
|
|
109
|
+
* An LCC capture quantizes base SH (`shcoef`) and environment SH
|
|
110
|
+
* (`envshcoef`) against *different* ranges, but the shared pool decodes the
|
|
111
|
+
* whole scene through one range uniform. Left alone, whichever chunk lands
|
|
112
|
+
* first wins and the other's coefficients are read against the wrong span -
|
|
113
|
+
* the environment range is wider, so base SH gets amplified into a
|
|
114
|
+
* view-dependent "flashlight." So the environment chunk is requantized into
|
|
115
|
+
* the base range here, letting every chunk agree on `shcoef`. Values outside
|
|
116
|
+
* the base range clip (only decorative sky highlights, and only the few
|
|
117
|
+
* thousand environment splats pay the re-encode).
|
|
118
|
+
*/
|
|
119
|
+
readonly requantizeTo?: LccRange;
|
|
120
|
+
}
|
|
121
|
+
/** Coefficients carried by each SH band count. */
|
|
122
|
+
export declare function lccShCoefficientCount(bands: 1 | 2 | 3): number;
|
|
123
|
+
/**
|
|
124
|
+
* Validates an untrusted `.lcc` manifest and extracts the fields the loader
|
|
125
|
+
* needs. Everything downstream (index record size, chunk byte ranges, pool
|
|
126
|
+
* sizing) derives from these, so they are checked up front.
|
|
127
|
+
*
|
|
128
|
+
* @throws {Error} on an unsupported version or a malformed manifest.
|
|
129
|
+
*/
|
|
130
|
+
export declare function parseLccManifest(json: unknown): LccManifest;
|
|
131
|
+
/**
|
|
132
|
+
* Parses `index.bin` into one record per cell.
|
|
133
|
+
*
|
|
134
|
+
* @param buffer - The whole file (a few KB even for large captures).
|
|
135
|
+
* @param manifest - Supplies the record size and level count.
|
|
136
|
+
* @throws {Error} if the file length or any record is inconsistent.
|
|
137
|
+
*/
|
|
138
|
+
export declare function parseLccIndex(buffer: ArrayBuffer, manifest: LccManifest): LccIndexCell[];
|
|
139
|
+
/**
|
|
140
|
+
* Decodes a packed rotation into a quaternion `[w, x, y, z]`.
|
|
141
|
+
*
|
|
142
|
+
* Smallest-three: bits 30-31 name the omitted (largest-magnitude) component
|
|
143
|
+
* as an index into `(x, y, z, w)`, and three 10-bit fields hold the others in
|
|
144
|
+
* ascending index order as offset binary with bias 511, spanning `[-√½, +√½]`.
|
|
145
|
+
* The omitted component is recovered from unit length.
|
|
146
|
+
*
|
|
147
|
+
* Note this is neither the whitepaper's `QLut`/`DecodeRotation` nor the
|
|
148
|
+
* LCC-Web SDK's sign-magnitude `parseQuat` (which decodes the SDK's own
|
|
149
|
+
* repacked GPU texture, not the file) - see `docs/formats/lcc-notes.md`.
|
|
150
|
+
*
|
|
151
|
+
* The result is unit-length for any word a real encoder produces. A corrupt
|
|
152
|
+
* word whose three stored components already exceed unit length yields a
|
|
153
|
+
* non-unit (but always finite) quaternion, as in {@link parseSog}'s
|
|
154
|
+
* equivalent decode; {@link writeCovariance} normalizes.
|
|
155
|
+
*/
|
|
156
|
+
export declare function decodeLccRotation(encoded: number): [number, number, number, number];
|
|
157
|
+
/**
|
|
158
|
+
* Decodes one packed SH word into its three channel values.
|
|
159
|
+
*
|
|
160
|
+
* `DecodePacked_11_10_11`: R is bits 0-10, G bits 11-20, B bits 21-31, each a
|
|
161
|
+
* unit fraction of its field's maximum, dequantized across `range`.
|
|
162
|
+
*/
|
|
163
|
+
export declare function decodeLccShWord(word: number, range: LccRange, out: Float32Array, at: number): void;
|
|
164
|
+
/**
|
|
165
|
+
* Decodes a range of `data.bin` (or the base records of `environment.bin`)
|
|
166
|
+
* into the flat arrays the pool uploads.
|
|
167
|
+
*
|
|
168
|
+
* @param buffer - Exactly the chunk's bytes: `count * 32` for `splats`, or
|
|
169
|
+
* `count * stride` for `environment`.
|
|
170
|
+
* @param params - Byte range and dequantization ranges from the scene builder.
|
|
171
|
+
* @param sh - Optional SH bytes: the matching `shcoef.bin` range for
|
|
172
|
+
* `source: 'sidecar'`, or unused when the SH is inline in `buffer`.
|
|
173
|
+
* @param signal - Checked inside the decode loop so a superseded chunk can be
|
|
174
|
+
* abandoned mid-decode.
|
|
175
|
+
* @throws a `DOMException` named `AbortError` when cancelled.
|
|
176
|
+
*/
|
|
177
|
+
export declare function parseLccChunk(buffer: ArrayBuffer, params: LccChunkParams, sh?: ArrayBuffer, signal?: AbortSignal): Promise<SplatData>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** A plain indexed triangle mesh decoded from a PLY. */
|
|
2
|
+
export interface TriangleMeshData {
|
|
3
|
+
readonly vertexCount: number;
|
|
4
|
+
readonly triangleCount: number;
|
|
5
|
+
/** `x, y, z` per vertex, in the file's own coordinate frame. */
|
|
6
|
+
readonly positions: Float32Array;
|
|
7
|
+
/** Three vertex indices per triangle, into {@link positions}. */
|
|
8
|
+
readonly indices: Uint32Array;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Parses a binary little-endian triangle-mesh PLY.
|
|
12
|
+
*
|
|
13
|
+
* Faces with more than three vertices are fan-triangulated; degenerate faces
|
|
14
|
+
* (fewer than three) are dropped. Coordinates are passed through untouched, so
|
|
15
|
+
* a source-local frame stays source-local - an LCC2 mesh needs the same
|
|
16
|
+
* `createLcc2ToThreeMatrix` correction its splats get.
|
|
17
|
+
*
|
|
18
|
+
* @throws {Error} if the file is not a binary little-endian PLY, lacks a
|
|
19
|
+
* usable vertex or face element, or is truncated.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseMeshPly(buffer: ArrayBuffer): TriangleMeshData;
|