@playcanvas/splat-transform 0.16.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +161 -2
- package/bin/cli.mjs +1 -1
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/node-device.d.ts +7 -0
- package/dist/cli/node-file-system.d.ts +16 -0
- package/dist/cli.mjs +16212 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.mjs +1728 -61270
- package/dist/index.mjs.map +1 -1
- package/dist/lib/data-table/combine.d.ts +3 -0
- package/dist/lib/data-table/data-table.d.ts +32 -0
- package/dist/lib/data-table/morton-order.d.ts +3 -0
- package/dist/lib/data-table/summary.d.ts +17 -0
- package/dist/lib/data-table/transform.d.ts +4 -0
- package/dist/lib/gpu/gpu-clustering.d.ts +8 -0
- package/dist/lib/index.d.ts +34 -0
- package/dist/lib/io/read/file-system.d.ts +91 -0
- package/dist/lib/io/read/index.d.ts +5 -0
- package/dist/lib/io/read/memory-file-system.d.ts +22 -0
- package/dist/lib/io/read/url-file-system.d.ts +14 -0
- package/dist/lib/io/read/zip-file-system.d.ts +51 -0
- package/dist/lib/io/write/crc.d.ts +7 -0
- package/dist/lib/io/write/file-system.d.ts +9 -0
- package/dist/lib/io/write/index.d.ts +4 -0
- package/dist/lib/io/write/memory-file-system.d.ts +7 -0
- package/dist/lib/io/write/write-helpers.d.ts +3 -0
- package/dist/lib/io/write/zip-file-system.d.ts +8 -0
- package/dist/lib/process.d.ts +52 -0
- package/dist/lib/read.d.ts +14 -0
- package/dist/lib/readers/decompress-ply.d.ts +5 -0
- package/dist/lib/readers/read-ksplat.d.ts +4 -0
- package/dist/lib/readers/read-lcc.d.ts +5 -0
- package/dist/lib/readers/read-mjs.d.ts +4 -0
- package/dist/lib/readers/read-ply.d.ts +11 -0
- package/dist/lib/readers/read-sog.d.ts +10 -0
- package/dist/lib/readers/read-splat.d.ts +4 -0
- package/dist/lib/readers/read-spz.d.ts +4 -0
- package/dist/lib/spatial/b-tree.d.ts +22 -0
- package/dist/lib/spatial/k-means.d.ts +7 -0
- package/dist/lib/spatial/kd-tree.d.ts +18 -0
- package/dist/lib/types.d.ts +25 -0
- package/dist/lib/utils/base64.d.ts +2 -0
- package/dist/lib/utils/logger.d.ts +66 -0
- package/dist/lib/utils/math.d.ts +2 -0
- package/dist/lib/utils/rotate-sh.d.ts +6 -0
- package/dist/lib/utils/webp-codec.d.ts +21 -0
- package/dist/lib/write.d.ts +16 -0
- package/dist/lib/writers/compressed-chunk.d.ts +14 -0
- package/dist/lib/writers/write-compressed-ply.d.ts +8 -0
- package/dist/lib/writers/write-csv.d.ts +8 -0
- package/dist/lib/writers/write-html.d.ts +13 -0
- package/dist/lib/writers/write-lod.d.ts +14 -0
- package/dist/lib/writers/write-ply.d.ts +8 -0
- package/dist/lib/writers/write-sog.d.ts +18 -0
- package/lib/BUILD.md +1 -1
- package/lib/webp.mjs +1 -1
- package/lib/webp.wasm +0 -0
- package/package.json +28 -12
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
|
2
|
+
type ColumnType = 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'float32' | 'float64';
|
|
3
|
+
declare class Column {
|
|
4
|
+
name: string;
|
|
5
|
+
data: TypedArray;
|
|
6
|
+
constructor(name: string, data: TypedArray);
|
|
7
|
+
get dataType(): ColumnType | null;
|
|
8
|
+
clone(): Column;
|
|
9
|
+
}
|
|
10
|
+
type Row = {
|
|
11
|
+
[colName: string]: number;
|
|
12
|
+
};
|
|
13
|
+
declare class DataTable {
|
|
14
|
+
columns: Column[];
|
|
15
|
+
constructor(columns: Column[]);
|
|
16
|
+
get numRows(): number;
|
|
17
|
+
getRow(index: number, row?: Row, columns?: Column[]): Row;
|
|
18
|
+
setRow(index: number, row: Row, columns?: Column[]): void;
|
|
19
|
+
get numColumns(): number;
|
|
20
|
+
get columnNames(): string[];
|
|
21
|
+
get columnData(): TypedArray[];
|
|
22
|
+
get columnTypes(): ColumnType[];
|
|
23
|
+
getColumn(index: number): Column;
|
|
24
|
+
getColumnIndex(name: string): number;
|
|
25
|
+
getColumnByName(name: string): Column | null;
|
|
26
|
+
hasColumn(name: string): boolean;
|
|
27
|
+
addColumn(column: Column): void;
|
|
28
|
+
removeColumn(name: string): boolean;
|
|
29
|
+
clone(): DataTable;
|
|
30
|
+
permuteRows(indices: Uint32Array | number[]): DataTable;
|
|
31
|
+
}
|
|
32
|
+
export { Column, DataTable, TypedArray, ColumnType, Row };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DataTable } from './data-table';
|
|
2
|
+
type ColumnStats = {
|
|
3
|
+
min: number;
|
|
4
|
+
max: number;
|
|
5
|
+
median: number;
|
|
6
|
+
mean: number;
|
|
7
|
+
stdDev: number;
|
|
8
|
+
nanCount: number;
|
|
9
|
+
infCount: number;
|
|
10
|
+
};
|
|
11
|
+
type SummaryData = {
|
|
12
|
+
version: number;
|
|
13
|
+
rowCount: number;
|
|
14
|
+
columns: Record<string, ColumnStats>;
|
|
15
|
+
};
|
|
16
|
+
declare const computeSummary: (dataTable: DataTable) => SummaryData;
|
|
17
|
+
export { computeSummary, type ColumnStats, type SummaryData };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GraphicsDevice } from 'playcanvas';
|
|
2
|
+
import { DataTable } from '../data-table/data-table.js';
|
|
3
|
+
declare class GpuClustering {
|
|
4
|
+
execute: (points: DataTable, centroids: DataTable, labels: Uint32Array) => Promise<void>;
|
|
5
|
+
destroy: () => void;
|
|
6
|
+
constructor(device: GraphicsDevice, numColumns: number, numCentroids: number);
|
|
7
|
+
}
|
|
8
|
+
export { GpuClustering };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { Column, DataTable } from './data-table/data-table';
|
|
2
|
+
export type { TypedArray, ColumnType, Row } from './data-table/data-table';
|
|
3
|
+
export { combine } from './data-table/combine';
|
|
4
|
+
export { transform } from './data-table/transform';
|
|
5
|
+
export { computeSummary } from './data-table/summary';
|
|
6
|
+
export type { ColumnStats, SummaryData } from './data-table/summary';
|
|
7
|
+
export { readFile, getInputFormat } from './read';
|
|
8
|
+
export type { InputFormat } from './read';
|
|
9
|
+
export { writeFile, getOutputFormat } from './write';
|
|
10
|
+
export type { OutputFormat } from './write';
|
|
11
|
+
export { processDataTable } from './process';
|
|
12
|
+
export type { ProcessAction } from './process';
|
|
13
|
+
export { ReadStream, MemoryReadFileSystem, UrlReadFileSystem, ZipReadFileSystem } from './io/read';
|
|
14
|
+
export type { ReadSource, ReadFileSystem, ProgressCallback } from './io/read';
|
|
15
|
+
export { MemoryFileSystem, ZipFileSystem } from './io/write';
|
|
16
|
+
export type { FileSystem, Writer } from './io/write';
|
|
17
|
+
export { readKsplat } from './readers/read-ksplat';
|
|
18
|
+
export { readLcc } from './readers/read-lcc';
|
|
19
|
+
export { readMjs } from './readers/read-mjs';
|
|
20
|
+
export { readPly } from './readers/read-ply';
|
|
21
|
+
export { readSog } from './readers/read-sog';
|
|
22
|
+
export { readSplat } from './readers/read-splat';
|
|
23
|
+
export { readSpz } from './readers/read-spz';
|
|
24
|
+
export { writeSog } from './writers/write-sog';
|
|
25
|
+
export type { DeviceCreator } from './writers/write-sog';
|
|
26
|
+
export { writePly } from './writers/write-ply';
|
|
27
|
+
export { writeCompressedPly } from './writers/write-compressed-ply';
|
|
28
|
+
export { writeCsv } from './writers/write-csv';
|
|
29
|
+
export { writeHtml } from './writers/write-html';
|
|
30
|
+
export { writeLod } from './writers/write-lod';
|
|
31
|
+
export type { Options, Param } from './types';
|
|
32
|
+
export { logger } from './utils/logger';
|
|
33
|
+
export type { Logger } from './utils/logger';
|
|
34
|
+
export { WebPCodec } from './utils/webp-codec';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base class for streaming data from a source.
|
|
3
|
+
* Uses a pull-based model where the consumer provides the buffer.
|
|
4
|
+
*/
|
|
5
|
+
declare abstract class ReadStream {
|
|
6
|
+
/**
|
|
7
|
+
* Size hint for buffer pre-allocation in readAll().
|
|
8
|
+
* May be undefined if size is unknown.
|
|
9
|
+
*/
|
|
10
|
+
readonly expectedSize: number | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Total bytes read from this stream so far.
|
|
13
|
+
*/
|
|
14
|
+
bytesRead: number;
|
|
15
|
+
/**
|
|
16
|
+
* @param expectedSize - Optional size hint for buffer pre-allocation
|
|
17
|
+
*/
|
|
18
|
+
constructor(expectedSize?: number);
|
|
19
|
+
/**
|
|
20
|
+
* Pull data into the provided buffer.
|
|
21
|
+
* @param target - Buffer to fill with data
|
|
22
|
+
* @returns Number of bytes read, or 0 for EOF
|
|
23
|
+
*/
|
|
24
|
+
abstract pull(target: Uint8Array): Promise<number>;
|
|
25
|
+
/**
|
|
26
|
+
* Read entire stream into a single buffer.
|
|
27
|
+
* Uses expectedSize hint if available, grows dynamically if needed.
|
|
28
|
+
* @returns Complete data as Uint8Array
|
|
29
|
+
*/
|
|
30
|
+
readAll(): Promise<Uint8Array>;
|
|
31
|
+
/**
|
|
32
|
+
* Release resources and abort any pending operations.
|
|
33
|
+
*/
|
|
34
|
+
close(): void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Interface representing a readable data source.
|
|
38
|
+
* Provides size information and creates streams for reading.
|
|
39
|
+
*/
|
|
40
|
+
interface ReadSource {
|
|
41
|
+
/**
|
|
42
|
+
* The size of the source in bytes, or undefined if unknown.
|
|
43
|
+
* For compressed sources (e.g., gzipped HTTP), this may be approximate.
|
|
44
|
+
*/
|
|
45
|
+
readonly size: number | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Whether range reads are supported.
|
|
48
|
+
* If false, read() must be called with no arguments or start=0.
|
|
49
|
+
*/
|
|
50
|
+
readonly seekable: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Create a stream for reading data, optionally with a byte range.
|
|
53
|
+
* @param start - Starting byte offset (inclusive), defaults to 0
|
|
54
|
+
* @param end - Ending byte offset (exclusive), defaults to size/EOF
|
|
55
|
+
* @returns A ReadStream for pulling data
|
|
56
|
+
* @throws Error if range requested on non-seekable source
|
|
57
|
+
*/
|
|
58
|
+
read(start?: number, end?: number): ReadStream;
|
|
59
|
+
/**
|
|
60
|
+
* Release any resources held by this source.
|
|
61
|
+
*/
|
|
62
|
+
close(): void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Progress callback for tracking read operations.
|
|
66
|
+
* @param bytesLoaded - Bytes loaded so far
|
|
67
|
+
* @param totalBytes - Total bytes if known, undefined otherwise
|
|
68
|
+
*/
|
|
69
|
+
type ProgressCallback = (bytesLoaded: number, totalBytes: number | undefined) => void;
|
|
70
|
+
/**
|
|
71
|
+
* Interface for a file system that can create readable sources.
|
|
72
|
+
* Implementations exist for various backends (URL, Node FS, Zip, Memory).
|
|
73
|
+
*/
|
|
74
|
+
interface ReadFileSystem {
|
|
75
|
+
/**
|
|
76
|
+
* Create a readable source for the given path/identifier.
|
|
77
|
+
* @param filename - Path or identifier for the resource
|
|
78
|
+
* @param progress - Optional callback for progress reporting
|
|
79
|
+
* @returns Promise resolving to a ReadSource
|
|
80
|
+
*/
|
|
81
|
+
createSource(filename: string, progress?: ProgressCallback): Promise<ReadSource>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Read an entire file into memory.
|
|
85
|
+
* Convenience helper that handles source creation, reading, and cleanup.
|
|
86
|
+
* @param fs - The file system to read from
|
|
87
|
+
* @param filename - Path or identifier for the resource
|
|
88
|
+
* @returns Promise resolving to file contents as Uint8Array
|
|
89
|
+
*/
|
|
90
|
+
declare const readFile: (fs: ReadFileSystem, filename: string) => Promise<Uint8Array>;
|
|
91
|
+
export { ReadStream, type ReadSource, type ReadFileSystem, type ProgressCallback, readFile };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ReadStream, type ReadSource, type ReadFileSystem, type ProgressCallback, readFile } from './file-system';
|
|
2
|
+
export { dirname, join } from 'pathe';
|
|
3
|
+
export { MemoryReadFileSystem } from './memory-file-system';
|
|
4
|
+
export { UrlReadFileSystem } from './url-file-system';
|
|
5
|
+
export { ZipReadFileSystem } from './zip-file-system';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReadFileSystem, type ProgressCallback, type ReadSource } from './file-system';
|
|
2
|
+
/**
|
|
3
|
+
* ReadFileSystem for reading from named memory buffers.
|
|
4
|
+
* Useful for testing or when data is already in memory.
|
|
5
|
+
*/
|
|
6
|
+
declare class MemoryReadFileSystem implements ReadFileSystem {
|
|
7
|
+
private buffers;
|
|
8
|
+
/**
|
|
9
|
+
* Store a named buffer.
|
|
10
|
+
* @param name - Name/path for the buffer
|
|
11
|
+
* @param data - Data to store
|
|
12
|
+
*/
|
|
13
|
+
set(name: string, data: Uint8Array): void;
|
|
14
|
+
/**
|
|
15
|
+
* Get a stored buffer by name.
|
|
16
|
+
* @param name - Name/path of the buffer
|
|
17
|
+
* @returns The stored data or undefined
|
|
18
|
+
*/
|
|
19
|
+
get(name: string): Uint8Array | undefined;
|
|
20
|
+
createSource(filename: string, progress?: ProgressCallback): Promise<ReadSource>;
|
|
21
|
+
}
|
|
22
|
+
export { MemoryReadFileSystem };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReadFileSystem, type ProgressCallback, type ReadSource } from './file-system';
|
|
2
|
+
/**
|
|
3
|
+
* ReadFileSystem for reading from URLs using fetch.
|
|
4
|
+
* Supports optional base URL for relative paths.
|
|
5
|
+
*/
|
|
6
|
+
declare class UrlReadFileSystem implements ReadFileSystem {
|
|
7
|
+
private baseUrl;
|
|
8
|
+
/**
|
|
9
|
+
* @param baseUrl - Optional base URL to prepend to filenames
|
|
10
|
+
*/
|
|
11
|
+
constructor(baseUrl?: string);
|
|
12
|
+
createSource(filename: string, progress?: ProgressCallback): Promise<ReadSource>;
|
|
13
|
+
}
|
|
14
|
+
export { UrlReadFileSystem };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ReadFileSystem, type ProgressCallback, type ReadSource } from './file-system';
|
|
2
|
+
/**
|
|
3
|
+
* Metadata for a zip file entry.
|
|
4
|
+
*/
|
|
5
|
+
type ZipEntry = {
|
|
6
|
+
name: string;
|
|
7
|
+
compressedSize: number;
|
|
8
|
+
uncompressedSize: number;
|
|
9
|
+
offset: number;
|
|
10
|
+
method: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Virtual filesystem for reading files from a zip archive.
|
|
14
|
+
* Wraps any ReadSource and provides memory-efficient streaming access.
|
|
15
|
+
*/
|
|
16
|
+
declare class ZipReadFileSystem implements ReadFileSystem {
|
|
17
|
+
private source;
|
|
18
|
+
private entries;
|
|
19
|
+
private parsePromise;
|
|
20
|
+
private closed;
|
|
21
|
+
constructor(source: ReadSource);
|
|
22
|
+
/**
|
|
23
|
+
* Parse the central directory from the zip file.
|
|
24
|
+
* Called lazily on first createSource() or list() call.
|
|
25
|
+
* @returns Map of entry names to ZipEntry metadata
|
|
26
|
+
*/
|
|
27
|
+
private parseDirectory;
|
|
28
|
+
/**
|
|
29
|
+
* Get the data offset for an entry by reading its local header.
|
|
30
|
+
* @param entry - Zip entry metadata
|
|
31
|
+
* @returns Byte offset where entry data begins
|
|
32
|
+
*/
|
|
33
|
+
private getDataOffset;
|
|
34
|
+
createSource(filename: string, _progress?: ProgressCallback): Promise<ReadSource>;
|
|
35
|
+
/**
|
|
36
|
+
* List all entries in the zip file.
|
|
37
|
+
* @returns Array of entry names
|
|
38
|
+
*/
|
|
39
|
+
list(): Promise<string[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Get entry metadata.
|
|
42
|
+
* @param filename - Entry name
|
|
43
|
+
* @returns Entry metadata or undefined if not found
|
|
44
|
+
*/
|
|
45
|
+
getEntry(filename: string): Promise<ZipEntry | undefined>;
|
|
46
|
+
/**
|
|
47
|
+
* Close the zip filesystem and underlying source.
|
|
48
|
+
*/
|
|
49
|
+
close(): void;
|
|
50
|
+
}
|
|
51
|
+
export { ZipReadFileSystem };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface Writer {
|
|
2
|
+
write(data: Uint8Array): void | Promise<void>;
|
|
3
|
+
close(): void | Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
interface FileSystem {
|
|
6
|
+
createWriter(filename: string): Writer | Promise<Writer>;
|
|
7
|
+
mkdir(path: string): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export { type FileSystem, type Writer };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type FileSystem, type Writer } from './file-system';
|
|
2
|
+
declare class MemoryFileSystem implements FileSystem {
|
|
3
|
+
results: Map<string, Uint8Array>;
|
|
4
|
+
createWriter(filename: string): Writer;
|
|
5
|
+
mkdir(path: string): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export { MemoryFileSystem };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FileSystem, type Writer } from './file-system';
|
|
2
|
+
declare class ZipFileSystem implements FileSystem {
|
|
3
|
+
close: () => Promise<void>;
|
|
4
|
+
createWriter: (filename: string) => Promise<Writer>;
|
|
5
|
+
mkdir: (path: string) => Promise<void>;
|
|
6
|
+
constructor(writer: Writer);
|
|
7
|
+
}
|
|
8
|
+
export { ZipFileSystem };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Vec3 } from 'playcanvas';
|
|
2
|
+
import { DataTable } from './data-table/data-table';
|
|
3
|
+
type Translate = {
|
|
4
|
+
kind: 'translate';
|
|
5
|
+
value: Vec3;
|
|
6
|
+
};
|
|
7
|
+
type Rotate = {
|
|
8
|
+
kind: 'rotate';
|
|
9
|
+
value: Vec3;
|
|
10
|
+
};
|
|
11
|
+
type Scale = {
|
|
12
|
+
kind: 'scale';
|
|
13
|
+
value: number;
|
|
14
|
+
};
|
|
15
|
+
type FilterNaN = {
|
|
16
|
+
kind: 'filterNaN';
|
|
17
|
+
};
|
|
18
|
+
type FilterByValue = {
|
|
19
|
+
kind: 'filterByValue';
|
|
20
|
+
columnName: string;
|
|
21
|
+
comparator: 'lt' | 'lte' | 'gt' | 'gte' | 'eq' | 'neq';
|
|
22
|
+
value: number;
|
|
23
|
+
};
|
|
24
|
+
type FilterBands = {
|
|
25
|
+
kind: 'filterBands';
|
|
26
|
+
value: 0 | 1 | 2 | 3;
|
|
27
|
+
};
|
|
28
|
+
type FilterBox = {
|
|
29
|
+
kind: 'filterBox';
|
|
30
|
+
min: Vec3;
|
|
31
|
+
max: Vec3;
|
|
32
|
+
};
|
|
33
|
+
type FilterSphere = {
|
|
34
|
+
kind: 'filterSphere';
|
|
35
|
+
center: Vec3;
|
|
36
|
+
radius: number;
|
|
37
|
+
};
|
|
38
|
+
type Param = {
|
|
39
|
+
kind: 'param';
|
|
40
|
+
name: string;
|
|
41
|
+
value: string;
|
|
42
|
+
};
|
|
43
|
+
type Lod = {
|
|
44
|
+
kind: 'lod';
|
|
45
|
+
value: number;
|
|
46
|
+
};
|
|
47
|
+
type Summary = {
|
|
48
|
+
kind: 'summary';
|
|
49
|
+
};
|
|
50
|
+
type ProcessAction = Translate | Rotate | Scale | FilterNaN | FilterByValue | FilterBands | FilterBox | FilterSphere | Param | Lod | Summary;
|
|
51
|
+
declare const processDataTable: (dataTable: DataTable, processActions: ProcessAction[]) => DataTable;
|
|
52
|
+
export { ProcessAction, processDataTable };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DataTable } from './data-table/data-table';
|
|
2
|
+
import { ReadFileSystem } from './io/read';
|
|
3
|
+
import { Options, Param } from './types';
|
|
4
|
+
type InputFormat = 'mjs' | 'ksplat' | 'splat' | 'sog' | 'ply' | 'spz' | 'lcc';
|
|
5
|
+
declare const getInputFormat: (filename: string) => InputFormat;
|
|
6
|
+
type ReadFileOptions = {
|
|
7
|
+
filename: string;
|
|
8
|
+
inputFormat: InputFormat;
|
|
9
|
+
options: Options;
|
|
10
|
+
params: Param[];
|
|
11
|
+
fileSystem: ReadFileSystem;
|
|
12
|
+
};
|
|
13
|
+
declare const readFile: (readFileOptions: ReadFileOptions) => Promise<DataTable[]>;
|
|
14
|
+
export { readFile, getInputFormat, type InputFormat };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DataTable } from '../data-table/data-table';
|
|
2
|
+
import { ReadFileSystem } from '../io/read';
|
|
3
|
+
import { Options } from '../types';
|
|
4
|
+
declare const readLcc: (fileSystem: ReadFileSystem, filename: string, options: Options) => Promise<DataTable[]>;
|
|
5
|
+
export { readLcc };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataTable } from '../data-table/data-table';
|
|
2
|
+
import { ReadSource } from '../io/read';
|
|
3
|
+
type PlyData = {
|
|
4
|
+
comments: string[];
|
|
5
|
+
elements: {
|
|
6
|
+
name: string;
|
|
7
|
+
dataTable: DataTable;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
declare const readPly: (source: ReadSource) => Promise<DataTable>;
|
|
11
|
+
export { PlyData, readPly };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DataTable } from '../data-table/data-table';
|
|
2
|
+
import { ReadFileSystem } from '../io/read';
|
|
3
|
+
/**
|
|
4
|
+
* Read a SOG file from a ReadFileSystem.
|
|
5
|
+
* @param fileSystem - The file system to read from
|
|
6
|
+
* @param filename - Path to meta.json (relative paths resolved from its directory)
|
|
7
|
+
* @returns DataTable with Gaussian splat data
|
|
8
|
+
*/
|
|
9
|
+
declare const readSog: (fileSystem: ReadFileSystem, filename: string) => Promise<DataTable>;
|
|
10
|
+
export { readSog };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DataTable } from '../data-table/data-table';
|
|
2
|
+
declare class Aabb {
|
|
3
|
+
min: number[];
|
|
4
|
+
max: number[];
|
|
5
|
+
constructor(min?: number[], max?: number[]);
|
|
6
|
+
largestAxis(): number;
|
|
7
|
+
largestDim(): number;
|
|
8
|
+
fromCentroids(centroids: DataTable, indices: Uint32Array): this;
|
|
9
|
+
}
|
|
10
|
+
interface BTreeNode {
|
|
11
|
+
count: number;
|
|
12
|
+
aabb: Aabb;
|
|
13
|
+
indices?: Uint32Array;
|
|
14
|
+
left?: BTreeNode;
|
|
15
|
+
right?: BTreeNode;
|
|
16
|
+
}
|
|
17
|
+
declare class BTree {
|
|
18
|
+
centroids: DataTable;
|
|
19
|
+
root: BTreeNode;
|
|
20
|
+
constructor(centroids: DataTable);
|
|
21
|
+
}
|
|
22
|
+
export { BTreeNode, BTree };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GraphicsDevice } from 'playcanvas';
|
|
2
|
+
import { DataTable } from '../data-table/data-table';
|
|
3
|
+
declare const kmeans: (points: DataTable, k: number, iterations: number, device?: GraphicsDevice) => Promise<{
|
|
4
|
+
centroids: DataTable;
|
|
5
|
+
labels: Uint32Array<ArrayBuffer>;
|
|
6
|
+
}>;
|
|
7
|
+
export { kmeans };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DataTable } from '../data-table/data-table';
|
|
2
|
+
interface KdTreeNode {
|
|
3
|
+
index: number;
|
|
4
|
+
count: number;
|
|
5
|
+
left?: KdTreeNode;
|
|
6
|
+
right?: KdTreeNode;
|
|
7
|
+
}
|
|
8
|
+
declare class KdTree {
|
|
9
|
+
centroids: DataTable;
|
|
10
|
+
root: KdTreeNode;
|
|
11
|
+
constructor(centroids: DataTable);
|
|
12
|
+
findNearest(point: Float32Array, filterFunc?: (index: number) => boolean): {
|
|
13
|
+
index: number;
|
|
14
|
+
distanceSqr: number;
|
|
15
|
+
cnt: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export { KdTreeNode, KdTree };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for read/write operations.
|
|
3
|
+
*/
|
|
4
|
+
type Options = {
|
|
5
|
+
/** Number of iterations for SOG SH compression (higher = better quality). Default: 10 */
|
|
6
|
+
iterations: number;
|
|
7
|
+
/** LOD levels to read from LCC input */
|
|
8
|
+
lodSelect: number[];
|
|
9
|
+
/** Viewer settings JSON for HTML output */
|
|
10
|
+
viewerSettingsJson?: any;
|
|
11
|
+
/** Whether to generate unbundled HTML output with separate files */
|
|
12
|
+
unbundled: boolean;
|
|
13
|
+
/** Approximate number of Gaussians per LOD chunk (in thousands). Default: 512 */
|
|
14
|
+
lodChunkCount: number;
|
|
15
|
+
/** Approximate size of an LOD chunk in world units (meters). Default: 16 */
|
|
16
|
+
lodChunkExtent: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Parameter passed to MJS generator scripts.
|
|
20
|
+
*/
|
|
21
|
+
type Param = {
|
|
22
|
+
name: string;
|
|
23
|
+
value: string;
|
|
24
|
+
};
|
|
25
|
+
export type { Options, Param };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger interface for injectable logging implementation.
|
|
3
|
+
*/
|
|
4
|
+
interface Logger {
|
|
5
|
+
/** Log normal messages. */
|
|
6
|
+
log(...args: any[]): void;
|
|
7
|
+
/** Log warning messages. */
|
|
8
|
+
warn(...args: any[]): void;
|
|
9
|
+
/** Log error messages. */
|
|
10
|
+
error(...args: any[]): void;
|
|
11
|
+
/** Log debug/verbose messages. */
|
|
12
|
+
debug(...args: any[]): void;
|
|
13
|
+
/** Output text without newline (for progress indicators). */
|
|
14
|
+
progress(text: string): void;
|
|
15
|
+
/** Output data to stdout (for piping). */
|
|
16
|
+
output(text: string): void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Global logger instance with injectable implementation.
|
|
20
|
+
* Use setLogger() to provide a custom implementation (e.g., Node.js with process.stdout).
|
|
21
|
+
* Use setQuiet() to suppress log/warn/progress output.
|
|
22
|
+
*/
|
|
23
|
+
declare const logger: {
|
|
24
|
+
/**
|
|
25
|
+
* Set a custom logger implementation.
|
|
26
|
+
* @param l - The logger implementation to use.
|
|
27
|
+
*/
|
|
28
|
+
setLogger(l: Logger): void;
|
|
29
|
+
/**
|
|
30
|
+
* Set quiet mode. When quiet, log/warn/progress are suppressed. Errors always show.
|
|
31
|
+
* @param q - Whether to enable quiet mode.
|
|
32
|
+
*/
|
|
33
|
+
setQuiet(q: boolean): void;
|
|
34
|
+
/**
|
|
35
|
+
* Log normal messages. Suppressed in quiet mode.
|
|
36
|
+
* @param args - The arguments to log.
|
|
37
|
+
*/
|
|
38
|
+
log(...args: any[]): void;
|
|
39
|
+
/**
|
|
40
|
+
* Log warning messages. Suppressed in quiet mode.
|
|
41
|
+
* @param args - The arguments to log.
|
|
42
|
+
*/
|
|
43
|
+
warn(...args: any[]): void;
|
|
44
|
+
/**
|
|
45
|
+
* Log error messages. Always shown, even in quiet mode.
|
|
46
|
+
* @param args - The arguments to log.
|
|
47
|
+
*/
|
|
48
|
+
error(...args: any[]): void;
|
|
49
|
+
/**
|
|
50
|
+
* Log debug/verbose messages. Suppressed in quiet mode.
|
|
51
|
+
* @param args - The arguments to log.
|
|
52
|
+
*/
|
|
53
|
+
debug(...args: any[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Output text without newline (for progress indicators). Suppressed in quiet mode.
|
|
56
|
+
* @param text - The text to output.
|
|
57
|
+
*/
|
|
58
|
+
progress(text: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* Output data to stdout (for piping). Always shown, even in quiet mode.
|
|
61
|
+
* @param text - The text to output.
|
|
62
|
+
*/
|
|
63
|
+
output(text: string): void;
|
|
64
|
+
};
|
|
65
|
+
export { logger };
|
|
66
|
+
export type { Logger };
|