@manycore/aholo-splat-transform 1.2.8 → 1.2.10
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/CHANGELOG.md +124 -113
- package/README.md +39 -39
- package/THIRD_PARTY_LICENSES.txt +1373 -1373
- package/bin/cli.js +125 -118
- package/dist/SplatData.d.ts +67 -67
- package/dist/SplatData.js +167 -150
- package/dist/constant.d.ts +3 -3
- package/dist/constant.js +13 -13
- package/dist/file/IFile.d.ts +5 -5
- package/dist/file/IFile.js +1 -1
- package/dist/file/esz.d.ts +11 -11
- package/dist/file/esz.js +337 -322
- package/dist/file/index.d.ts +8 -8
- package/dist/file/index.js +7 -7
- package/dist/file/ksplat.d.ts +12 -12
- package/dist/file/ksplat.js +293 -231
- package/dist/file/lcc.d.ts +11 -11
- package/dist/file/lcc.js +161 -158
- package/dist/file/ply.d.ts +13 -13
- package/dist/file/ply.js +439 -390
- package/dist/file/sog.d.ts +80 -80
- package/dist/file/sog.js +525 -494
- package/dist/file/splat.d.ts +6 -6
- package/dist/file/splat.js +119 -99
- package/dist/file/spz.d.ts +11 -11
- package/dist/file/spz.js +597 -583
- package/dist/file/voxel.d.ts +43 -37
- package/dist/file/voxel.js +411 -280
- package/dist/index.d.ts +33 -33
- package/dist/index.js +54 -54
- package/dist/native/index.d.ts +54 -54
- package/dist/native/index.js +122 -129
- package/dist/native/utils.d.ts +1 -0
- package/dist/native/utils.js +54 -0
- package/dist/tasks/AutoChunkLodTask.d.ts +13 -13
- package/dist/tasks/AutoChunkLodTask.js +117 -117
- package/dist/tasks/AutoLodTask.d.ts +10 -10
- package/dist/tasks/AutoLodTask.js +20 -20
- package/dist/tasks/BaseTask.d.ts +15 -15
- package/dist/tasks/BaseTask.js +5 -5
- package/dist/tasks/FlexLodTask.d.ts +12 -12
- package/dist/tasks/FlexLodTask.js +54 -44
- package/dist/tasks/ModifyTask.d.ts +9 -9
- package/dist/tasks/ModifyTask.js +166 -156
- package/dist/tasks/ReadTask.d.ts +9 -9
- package/dist/tasks/ReadTask.js +29 -29
- package/dist/tasks/SkeletonLodTask.d.ts +10 -10
- package/dist/tasks/SkeletonLodTask.js +176 -156
- package/dist/tasks/VoxelTask.d.ts +35 -30
- package/dist/tasks/VoxelTask.js +40 -37
- package/dist/tasks/WriteTask.d.ts +12 -12
- package/dist/tasks/WriteTask.js +70 -70
- package/dist/utils/BufferReader.d.ts +12 -12
- package/dist/utils/BufferReader.js +45 -45
- package/dist/utils/Logger.d.ts +11 -11
- package/dist/utils/Logger.js +40 -40
- package/dist/utils/StreamChunkDecoder.d.ts +16 -16
- package/dist/utils/StreamChunkDecoder.js +31 -31
- package/dist/utils/index.d.ts +27 -27
- package/dist/utils/index.js +101 -101
- package/dist/utils/k-means.d.ts +4 -4
- package/dist/utils/k-means.js +340 -341
- package/dist/utils/math.d.ts +46 -46
- package/dist/utils/math.js +350 -346
- package/dist/utils/quantize-1d.d.ts +4 -4
- package/dist/utils/quantize-1d.js +164 -164
- package/dist/utils/sh-rotate.d.ts +2 -2
- package/dist/utils/sh-rotate.js +236 -175
- package/dist/utils/splat.d.ts +21 -21
- package/dist/utils/splat.js +397 -387
- package/dist/utils/voxel/binary.d.ts +8 -0
- package/dist/utils/voxel/binary.js +176 -0
- package/dist/utils/voxel/common.d.ts +178 -162
- package/dist/utils/voxel/common.js +1752 -1682
- package/dist/utils/voxel/coplanar-merge.d.ts +63 -63
- package/dist/utils/voxel/coplanar-merge.js +818 -819
- package/dist/utils/voxel/filter-cluster.d.ts +20 -0
- package/dist/utils/voxel/filter-cluster.js +628 -0
- package/dist/utils/voxel/gpu-dilation.d.ts +2 -2
- package/dist/utils/voxel/gpu-dilation.js +677 -656
- package/dist/utils/voxel/marching-cubes.d.ts +42 -42
- package/dist/utils/voxel/marching-cubes.js +1645 -1657
- package/dist/utils/voxel/mesh.d.ts +3 -3
- package/dist/utils/voxel/mesh.js +130 -130
- package/dist/utils/voxel/nav.d.ts +29 -29
- package/dist/utils/voxel/nav.js +1068 -1043
- package/dist/utils/voxel/postprocess.d.ts +23 -23
- package/dist/utils/voxel/postprocess.js +408 -375
- package/dist/utils/voxel/voxel-faces.d.ts +18 -18
- package/dist/utils/voxel/voxel-faces.js +662 -663
- package/dist/utils/voxel/voxelize.d.ts +34 -33
- package/dist/utils/voxel/voxelize.js +1208 -1193
- package/dist/utils/webgpu.d.ts +8 -8
- package/dist/utils/webgpu.js +122 -122
- package/package.json +38 -39
- package/dist/native/cpp/bin/linux/binding.node +0 -0
- package/dist/native/cpp/bin/windows/binding.node +0 -0
package/dist/file/splat.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SplatData } from '../SplatData.js';
|
|
2
|
-
import { IFile } from './IFile.js';
|
|
3
|
-
export declare class SplatFile implements IFile {
|
|
4
|
-
read(stream: ReadableStream<Uint8Array>, contentLength: number, data: SplatData): Promise<void>;
|
|
5
|
-
write(stream: WritableStream<Uint8Array>, data: SplatData, indices?: Uint32Array): Promise<void>;
|
|
6
|
-
}
|
|
1
|
+
import type { SplatData } from '../SplatData.js';
|
|
2
|
+
import type { IFile } from './IFile.js';
|
|
3
|
+
export declare class SplatFile implements IFile {
|
|
4
|
+
read(stream: ReadableStream<Uint8Array>, contentLength: number, data: SplatData): Promise<void>;
|
|
5
|
+
write(stream: WritableStream<Uint8Array>, data: SplatData, indices?: Uint32Array): Promise<void>;
|
|
6
|
+
}
|
package/dist/file/splat.js
CHANGED
|
@@ -1,99 +1,119 @@
|
|
|
1
|
-
import { clamp, StreamChunkDecoder, BufferReader, mortonSort } from '../utils/index.js';
|
|
2
|
-
const ItemSize = 32;
|
|
3
|
-
export class SplatFile {
|
|
4
|
-
async read(stream, contentLength, data) {
|
|
5
|
-
const setFn = data.set.bind(data);
|
|
6
|
-
const counts = Math.floor(contentLength / ItemSize);
|
|
7
|
-
const BlockOffset = await data.initBlock(counts, 0);
|
|
8
|
-
const reader = new BufferReader();
|
|
9
|
-
const decoder = new StreamChunkDecoder(reader);
|
|
10
|
-
const single = {
|
|
11
|
-
x: 0,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
single.
|
|
37
|
-
single.
|
|
38
|
-
single.
|
|
39
|
-
single.
|
|
40
|
-
single.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
1
|
+
import { clamp, StreamChunkDecoder, BufferReader, mortonSort } from '../utils/index.js';
|
|
2
|
+
const ItemSize = 32;
|
|
3
|
+
export class SplatFile {
|
|
4
|
+
async read(stream, contentLength, data) {
|
|
5
|
+
const setFn = data.set.bind(data);
|
|
6
|
+
const counts = Math.floor(contentLength / ItemSize);
|
|
7
|
+
const BlockOffset = await data.initBlock(counts, 0);
|
|
8
|
+
const reader = new BufferReader();
|
|
9
|
+
const decoder = new StreamChunkDecoder(reader);
|
|
10
|
+
const single = {
|
|
11
|
+
x: 0,
|
|
12
|
+
y: 0,
|
|
13
|
+
z: 0,
|
|
14
|
+
sx: 0,
|
|
15
|
+
sy: 0,
|
|
16
|
+
sz: 0,
|
|
17
|
+
qx: 0,
|
|
18
|
+
qy: 0,
|
|
19
|
+
qz: 0,
|
|
20
|
+
qw: 0,
|
|
21
|
+
r: 0,
|
|
22
|
+
g: 0,
|
|
23
|
+
b: 0,
|
|
24
|
+
a: 0,
|
|
25
|
+
shN: [],
|
|
26
|
+
};
|
|
27
|
+
decoder.setDecoders([
|
|
28
|
+
{
|
|
29
|
+
init: () => [counts, ItemSize],
|
|
30
|
+
decode: (offset, counts, buffer) => {
|
|
31
|
+
offset += BlockOffset;
|
|
32
|
+
const f32Array = new Float32Array(buffer.buffer);
|
|
33
|
+
let o = 0;
|
|
34
|
+
for (let i = 0; i < counts; i++) {
|
|
35
|
+
o = i * 8;
|
|
36
|
+
single.x = f32Array[o];
|
|
37
|
+
single.y = f32Array[o + 1];
|
|
38
|
+
single.z = f32Array[o + 2];
|
|
39
|
+
single.sx = f32Array[o + 3];
|
|
40
|
+
single.sy = f32Array[o + 4];
|
|
41
|
+
single.sz = f32Array[o + 5];
|
|
42
|
+
o = i * 32;
|
|
43
|
+
single.r = buffer[o + 24] / 255;
|
|
44
|
+
single.g = buffer[o + 25] / 255;
|
|
45
|
+
single.b = buffer[o + 26] / 255;
|
|
46
|
+
single.a = buffer[o + 27] / 255;
|
|
47
|
+
single.qw = (buffer[o + 28] - 128) / 128;
|
|
48
|
+
single.qx = (buffer[o + 29] - 128) / 128;
|
|
49
|
+
single.qy = (buffer[o + 30] - 128) / 128;
|
|
50
|
+
single.qz = (buffer[o + 31] - 128) / 128;
|
|
51
|
+
setFn(offset + i, single);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
]);
|
|
56
|
+
const source = stream.getReader();
|
|
57
|
+
while (true) {
|
|
58
|
+
const { done, value } = await source.read();
|
|
59
|
+
if (done) {
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
reader.write(value);
|
|
63
|
+
decoder.flush();
|
|
64
|
+
}
|
|
65
|
+
data.finishBlock();
|
|
66
|
+
}
|
|
67
|
+
async write(stream, data, indices = mortonSort(data)) {
|
|
68
|
+
const writer = stream.getWriter();
|
|
69
|
+
const chunkSize = 2048;
|
|
70
|
+
const chunkCounts = Math.ceil(data.counts / chunkSize);
|
|
71
|
+
const single = {
|
|
72
|
+
x: 0,
|
|
73
|
+
y: 0,
|
|
74
|
+
z: 0,
|
|
75
|
+
sx: 0,
|
|
76
|
+
sy: 0,
|
|
77
|
+
sz: 0,
|
|
78
|
+
qx: 0,
|
|
79
|
+
qy: 0,
|
|
80
|
+
qz: 0,
|
|
81
|
+
qw: 0,
|
|
82
|
+
r: 0,
|
|
83
|
+
g: 0,
|
|
84
|
+
b: 0,
|
|
85
|
+
a: 0,
|
|
86
|
+
shN: [],
|
|
87
|
+
};
|
|
88
|
+
for (let i = 0; i < chunkCounts; i++) {
|
|
89
|
+
if (writer.desiredSize <= 0) {
|
|
90
|
+
await writer.ready;
|
|
91
|
+
}
|
|
92
|
+
const currentChunkSize = Math.min(chunkSize, data.counts - i * chunkSize);
|
|
93
|
+
const chunk = new Uint8Array(currentChunkSize * ItemSize);
|
|
94
|
+
const dataView = new DataView(chunk.buffer);
|
|
95
|
+
const offset = i * chunkSize;
|
|
96
|
+
for (let j = 0; j < currentChunkSize; j++) {
|
|
97
|
+
data.get(indices[offset + j], single);
|
|
98
|
+
const o = j * ItemSize;
|
|
99
|
+
dataView.setFloat32(o, single.x, true);
|
|
100
|
+
dataView.setFloat32(o + 4, single.y, true);
|
|
101
|
+
dataView.setFloat32(o + 8, single.z, true);
|
|
102
|
+
dataView.setFloat32(o + 12, single.sx, true);
|
|
103
|
+
dataView.setFloat32(o + 16, single.sy, true);
|
|
104
|
+
dataView.setFloat32(o + 20, single.sz, true);
|
|
105
|
+
dataView.setUint8(o + 24, clamp(Math.round(single.r * 255), 0, 255));
|
|
106
|
+
dataView.setUint8(o + 25, clamp(Math.round(single.g * 255), 0, 255));
|
|
107
|
+
dataView.setUint8(o + 26, clamp(Math.round(single.b * 255), 0, 255));
|
|
108
|
+
dataView.setUint8(o + 27, clamp(Math.round(single.a * 255), 0, 255));
|
|
109
|
+
dataView.setUint8(o + 28, clamp(Math.round(single.qw * 128 + 128), 0, 255));
|
|
110
|
+
dataView.setUint8(o + 29, clamp(Math.round(single.qx * 128 + 128), 0, 255));
|
|
111
|
+
dataView.setUint8(o + 30, clamp(Math.round(single.qy * 128 + 128), 0, 255));
|
|
112
|
+
dataView.setUint8(o + 31, clamp(Math.round(single.qz * 128 + 128), 0, 255));
|
|
113
|
+
}
|
|
114
|
+
writer.write(chunk);
|
|
115
|
+
await Promise.resolve();
|
|
116
|
+
}
|
|
117
|
+
await writer.close();
|
|
118
|
+
}
|
|
119
|
+
}
|
package/dist/file/spz.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { SplatData } from '../SplatData.js';
|
|
2
|
-
import { IFile } from './IFile.js';
|
|
3
|
-
export declare class SpzFile implements IFile {
|
|
4
|
-
readonly compressLevel: number;
|
|
5
|
-
readonly spzVersion: number;
|
|
6
|
-
constructor(compressLevel: number, spzVersion?: number);
|
|
7
|
-
read(stream: ReadableStream<Uint8Array>, _contentLength: number, data: SplatData): Promise<void>;
|
|
8
|
-
write(writeStream: WritableStream<Uint8Array>, data: SplatData, indices?: Uint32Array): Promise<void>;
|
|
9
|
-
private writeV3;
|
|
10
|
-
private writeV4;
|
|
11
|
-
}
|
|
1
|
+
import type { SplatData } from '../SplatData.js';
|
|
2
|
+
import type { IFile } from './IFile.js';
|
|
3
|
+
export declare class SpzFile implements IFile {
|
|
4
|
+
readonly compressLevel: number;
|
|
5
|
+
readonly spzVersion: number;
|
|
6
|
+
constructor(compressLevel: number, spzVersion?: number);
|
|
7
|
+
read(stream: ReadableStream<Uint8Array>, _contentLength: number, data: SplatData): Promise<void>;
|
|
8
|
+
write(writeStream: WritableStream<Uint8Array>, data: SplatData, indices?: Uint32Array): Promise<void>;
|
|
9
|
+
private writeV3;
|
|
10
|
+
private writeV4;
|
|
11
|
+
}
|