@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.
Files changed (97) hide show
  1. package/CHANGELOG.md +124 -113
  2. package/README.md +39 -39
  3. package/THIRD_PARTY_LICENSES.txt +1373 -1373
  4. package/bin/cli.js +125 -118
  5. package/dist/SplatData.d.ts +67 -67
  6. package/dist/SplatData.js +167 -150
  7. package/dist/constant.d.ts +3 -3
  8. package/dist/constant.js +13 -13
  9. package/dist/file/IFile.d.ts +5 -5
  10. package/dist/file/IFile.js +1 -1
  11. package/dist/file/esz.d.ts +11 -11
  12. package/dist/file/esz.js +337 -322
  13. package/dist/file/index.d.ts +8 -8
  14. package/dist/file/index.js +7 -7
  15. package/dist/file/ksplat.d.ts +12 -12
  16. package/dist/file/ksplat.js +293 -231
  17. package/dist/file/lcc.d.ts +11 -11
  18. package/dist/file/lcc.js +161 -158
  19. package/dist/file/ply.d.ts +13 -13
  20. package/dist/file/ply.js +439 -390
  21. package/dist/file/sog.d.ts +80 -80
  22. package/dist/file/sog.js +525 -494
  23. package/dist/file/splat.d.ts +6 -6
  24. package/dist/file/splat.js +119 -99
  25. package/dist/file/spz.d.ts +11 -11
  26. package/dist/file/spz.js +597 -583
  27. package/dist/file/voxel.d.ts +43 -37
  28. package/dist/file/voxel.js +411 -280
  29. package/dist/index.d.ts +33 -33
  30. package/dist/index.js +54 -54
  31. package/dist/native/index.d.ts +54 -54
  32. package/dist/native/index.js +122 -129
  33. package/dist/native/utils.d.ts +1 -0
  34. package/dist/native/utils.js +54 -0
  35. package/dist/tasks/AutoChunkLodTask.d.ts +13 -13
  36. package/dist/tasks/AutoChunkLodTask.js +117 -117
  37. package/dist/tasks/AutoLodTask.d.ts +10 -10
  38. package/dist/tasks/AutoLodTask.js +20 -20
  39. package/dist/tasks/BaseTask.d.ts +15 -15
  40. package/dist/tasks/BaseTask.js +5 -5
  41. package/dist/tasks/FlexLodTask.d.ts +12 -12
  42. package/dist/tasks/FlexLodTask.js +54 -44
  43. package/dist/tasks/ModifyTask.d.ts +9 -9
  44. package/dist/tasks/ModifyTask.js +166 -156
  45. package/dist/tasks/ReadTask.d.ts +9 -9
  46. package/dist/tasks/ReadTask.js +29 -29
  47. package/dist/tasks/SkeletonLodTask.d.ts +10 -10
  48. package/dist/tasks/SkeletonLodTask.js +176 -156
  49. package/dist/tasks/VoxelTask.d.ts +35 -30
  50. package/dist/tasks/VoxelTask.js +40 -37
  51. package/dist/tasks/WriteTask.d.ts +12 -12
  52. package/dist/tasks/WriteTask.js +70 -70
  53. package/dist/utils/BufferReader.d.ts +12 -12
  54. package/dist/utils/BufferReader.js +45 -45
  55. package/dist/utils/Logger.d.ts +11 -11
  56. package/dist/utils/Logger.js +40 -40
  57. package/dist/utils/StreamChunkDecoder.d.ts +16 -16
  58. package/dist/utils/StreamChunkDecoder.js +31 -31
  59. package/dist/utils/index.d.ts +27 -27
  60. package/dist/utils/index.js +101 -101
  61. package/dist/utils/k-means.d.ts +4 -4
  62. package/dist/utils/k-means.js +340 -341
  63. package/dist/utils/math.d.ts +46 -46
  64. package/dist/utils/math.js +350 -346
  65. package/dist/utils/quantize-1d.d.ts +4 -4
  66. package/dist/utils/quantize-1d.js +164 -164
  67. package/dist/utils/sh-rotate.d.ts +2 -2
  68. package/dist/utils/sh-rotate.js +236 -175
  69. package/dist/utils/splat.d.ts +21 -21
  70. package/dist/utils/splat.js +397 -387
  71. package/dist/utils/voxel/binary.d.ts +8 -0
  72. package/dist/utils/voxel/binary.js +176 -0
  73. package/dist/utils/voxel/common.d.ts +178 -162
  74. package/dist/utils/voxel/common.js +1752 -1682
  75. package/dist/utils/voxel/coplanar-merge.d.ts +63 -63
  76. package/dist/utils/voxel/coplanar-merge.js +818 -819
  77. package/dist/utils/voxel/filter-cluster.d.ts +20 -0
  78. package/dist/utils/voxel/filter-cluster.js +628 -0
  79. package/dist/utils/voxel/gpu-dilation.d.ts +2 -2
  80. package/dist/utils/voxel/gpu-dilation.js +677 -656
  81. package/dist/utils/voxel/marching-cubes.d.ts +42 -42
  82. package/dist/utils/voxel/marching-cubes.js +1645 -1657
  83. package/dist/utils/voxel/mesh.d.ts +3 -3
  84. package/dist/utils/voxel/mesh.js +130 -130
  85. package/dist/utils/voxel/nav.d.ts +29 -29
  86. package/dist/utils/voxel/nav.js +1068 -1043
  87. package/dist/utils/voxel/postprocess.d.ts +23 -23
  88. package/dist/utils/voxel/postprocess.js +408 -375
  89. package/dist/utils/voxel/voxel-faces.d.ts +18 -18
  90. package/dist/utils/voxel/voxel-faces.js +662 -663
  91. package/dist/utils/voxel/voxelize.d.ts +34 -33
  92. package/dist/utils/voxel/voxelize.js +1208 -1193
  93. package/dist/utils/webgpu.d.ts +8 -8
  94. package/dist/utils/webgpu.js +122 -122
  95. package/package.json +38 -39
  96. package/dist/native/cpp/bin/linux/binding.node +0 -0
  97. package/dist/native/cpp/bin/windows/binding.node +0 -0
package/bin/cli.js CHANGED
@@ -1,118 +1,125 @@
1
- #!/usr/bin/env node
2
- import fs from 'node:fs';
3
- import { program } from 'commander';
4
- import packageJson from '../package.json' with { type: 'json' };
5
- import { runner } from '../dist/index.js';
6
-
7
- const ExtraText = `
8
- Transform Gaussian splats file
9
- ===================================
10
- SUPPORTED INPUTS
11
- .ply .compressed.ply .sog meta.json .ksplat .splat .spz .lcc .esz
12
-
13
- SUPPORTED OUTPUTS
14
- .ply .spz .uspz .splat .sog .esz
15
- `;
16
-
17
- program
18
- .name(packageJson.name)
19
- .version(packageJson.version)
20
- .addHelpText('beforeAll', ExtraText);
21
-
22
- program
23
- .description('Execute a task pipeline from configuration file')
24
- .argument('<path>', 'pipeline config filepath')
25
- .action((path) => {
26
- const content = fs.readFileSync(path, { encoding: 'utf-8' });
27
- runner(JSON.parse(content));
28
- });
29
-
30
- program
31
- .command('create')
32
- .description('Merge & Transform gaussian splat file')
33
- .argument('<input>', 'input filepath')
34
- .argument('<output>', 'output filepath')
35
- .action((input, output) => {
36
- runner({
37
- version: 1,
38
- tasks: [
39
- { id: '0', type: 'Read', config: { inputs: [input], output: 'cache0' } },
40
- { id: '1', type: 'Modify', config: { input: 'cache0', output: 'cache0' } },
41
- { id: '2', type: 'Write', config: { input: 'cache0', output: output } },
42
- ],
43
- });
44
- });
45
-
46
- program
47
- .command('lod:loading')
48
- .description('Generate loading-lod for gaussian splat file')
49
- .option('--ratio <number>')
50
- .argument('<input>', 'input filepath')
51
- .argument('<output>', 'output filepath')
52
- .action(async (input, output, arg) => {
53
- runner({
54
- version: 1,
55
- tasks: [
56
- { id: '0', type: 'Read', config: { inputs: [input], output: 'cache0' } },
57
- { id: '1', type: 'SkeletonLod', config: { input: 'cache0', output: 'cache0', ratio: arg.ratio } },
58
- { id: '2', type: 'Write', config: { input: 'cache0', output: output } },
59
- ],
60
- });
61
- });
62
-
63
- program
64
- .command('lod:flex')
65
- .description('Generate flex-lod for gaussian splat file')
66
- .requiredOption('--score <string>')
67
- .option('--ratio <number>')
68
- .argument('<input>', 'input filepath')
69
- .argument('<output>', 'output filepath')
70
- .action(async (input, output, arg) => {
71
- runner({
72
- version: 1,
73
- tasks: [
74
- { id: '0', type: 'Read', config: { inputs: [input], output: 'cache0' } },
75
- { id: '1', type: 'FlexLod', config: { input: 'cache0', output: 'cache0', ratio: arg.ratio, scorePath: arg.score } },
76
- { id: '2', type: 'Write', config: { input: 'cache0', output: output } },
77
- ],
78
- });
79
- });
80
-
81
- program
82
- .command('lod:auto')
83
- .description('Generate auto-lod for gaussian splat file')
84
- .option('--ratio <number>')
85
- .argument('<input>', 'input filepath')
86
- .argument('<output>', 'output filepath')
87
- .action(async (input, output, arg) => {
88
- runner({
89
- version: 1,
90
- tasks: [
91
- { id: '0', type: 'Read', config: { inputs: [input], output: 'cache0' } },
92
- { id: '1', type: 'AutoLod', config: { input: 'cache0', output: 'cache0', ratio: arg.ratio } },
93
- { id: '2', type: 'Write', config: { input: 'cache0', output: output } },
94
- ],
95
- });
96
- });
97
-
98
- const fileTypeOption = program.createOption('-t, --type <type>', 'output file type').choices(['ply', 'spz', 'splat', 'sog']);
99
- fileTypeOption.required = true;
100
- program
101
- .command('lod:auto-chunk')
102
- .description('Generate auto-chunk-lod for gaussian splat file')
103
- .addOption(fileTypeOption)
104
- .option('--max-chunk-counts <number>')
105
- .argument('<input>', 'input filepath')
106
- .argument('<output>', 'output directory')
107
- .action(async (input, output, arg) => {
108
- runner({
109
- version: 1,
110
- tasks: [
111
- { id: '0', type: 'Read', config: { inputs: [input], output: 'cache0' } },
112
- { id: '1', type: 'AutoChunkLod', config: { input: 'cache0', output: 'cache0', type: arg.type, maxChunkCounts: arg.maxChunkCounts } },
113
- { id: '2', type: 'Write', config: { input: 'cache0', output: output } },
114
- ],
115
- });
116
- });
117
-
118
- program.parse();
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import { program } from 'commander';
4
+ import packageJson from '../package.json' with { type: 'json' };
5
+ import { runner } from '../dist/index.js';
6
+
7
+ const ExtraText = `
8
+ Transform Gaussian splats file
9
+ ===================================
10
+ SUPPORTED INPUTS
11
+ .ply .compressed.ply .sog meta.json .ksplat .splat .spz .lcc .esz
12
+
13
+ SUPPORTED OUTPUTS
14
+ .ply .spz .uspz .splat .sog .esz
15
+ `;
16
+
17
+ program.name(packageJson.name).version(packageJson.version).addHelpText('beforeAll', ExtraText);
18
+
19
+ program
20
+ .description('Execute a task pipeline from configuration file')
21
+ .argument('<path>', 'pipeline config filepath')
22
+ .action(path => {
23
+ const content = fs.readFileSync(path, { encoding: 'utf-8' });
24
+ runner(JSON.parse(content));
25
+ });
26
+
27
+ program
28
+ .command('create')
29
+ .description('Merge & Transform gaussian splat file')
30
+ .argument('<input>', 'input filepath')
31
+ .argument('<output>', 'output filepath')
32
+ .action((input, output) => {
33
+ runner({
34
+ version: 1,
35
+ tasks: [
36
+ { id: '0', type: 'Read', config: { inputs: [input], output: 'cache0' } },
37
+ { id: '1', type: 'Modify', config: { input: 'cache0', output: 'cache0' } },
38
+ { id: '2', type: 'Write', config: { input: 'cache0', output: output } },
39
+ ],
40
+ });
41
+ });
42
+
43
+ program
44
+ .command('lod:loading')
45
+ .description('Generate loading-lod for gaussian splat file')
46
+ .option('--ratio <number>')
47
+ .argument('<input>', 'input filepath')
48
+ .argument('<output>', 'output filepath')
49
+ .action(async (input, output, arg) => {
50
+ runner({
51
+ version: 1,
52
+ tasks: [
53
+ { id: '0', type: 'Read', config: { inputs: [input], output: 'cache0' } },
54
+ { id: '1', type: 'SkeletonLod', config: { input: 'cache0', output: 'cache0', ratio: arg.ratio } },
55
+ { id: '2', type: 'Write', config: { input: 'cache0', output: output } },
56
+ ],
57
+ });
58
+ });
59
+
60
+ program
61
+ .command('lod:flex')
62
+ .description('Generate flex-lod for gaussian splat file')
63
+ .requiredOption('--score <string>')
64
+ .option('--ratio <number>')
65
+ .argument('<input>', 'input filepath')
66
+ .argument('<output>', 'output filepath')
67
+ .action(async (input, output, arg) => {
68
+ runner({
69
+ version: 1,
70
+ tasks: [
71
+ { id: '0', type: 'Read', config: { inputs: [input], output: 'cache0' } },
72
+ {
73
+ id: '1',
74
+ type: 'FlexLod',
75
+ config: { input: 'cache0', output: 'cache0', ratio: arg.ratio, scorePath: arg.score },
76
+ },
77
+ { id: '2', type: 'Write', config: { input: 'cache0', output: output } },
78
+ ],
79
+ });
80
+ });
81
+
82
+ program
83
+ .command('lod:auto')
84
+ .description('Generate auto-lod for gaussian splat file')
85
+ .option('--ratio <number>')
86
+ .argument('<input>', 'input filepath')
87
+ .argument('<output>', 'output filepath')
88
+ .action(async (input, output, arg) => {
89
+ runner({
90
+ version: 1,
91
+ tasks: [
92
+ { id: '0', type: 'Read', config: { inputs: [input], output: 'cache0' } },
93
+ { id: '1', type: 'AutoLod', config: { input: 'cache0', output: 'cache0', ratio: arg.ratio } },
94
+ { id: '2', type: 'Write', config: { input: 'cache0', output: output } },
95
+ ],
96
+ });
97
+ });
98
+
99
+ const fileTypeOption = program
100
+ .createOption('-t, --type <type>', 'output file type')
101
+ .choices(['ply', 'spz', 'splat', 'sog']);
102
+ fileTypeOption.required = true;
103
+ program
104
+ .command('lod:auto-chunk')
105
+ .description('Generate auto-chunk-lod for gaussian splat file')
106
+ .addOption(fileTypeOption)
107
+ .option('--max-chunk-counts <number>')
108
+ .argument('<input>', 'input filepath')
109
+ .argument('<output>', 'output directory')
110
+ .action(async (input, output, arg) => {
111
+ runner({
112
+ version: 1,
113
+ tasks: [
114
+ { id: '0', type: 'Read', config: { inputs: [input], output: 'cache0' } },
115
+ {
116
+ id: '1',
117
+ type: 'AutoChunkLod',
118
+ config: { input: 'cache0', output: 'cache0', type: arg.type, maxChunkCounts: arg.maxChunkCounts },
119
+ },
120
+ { id: '2', type: 'Write', config: { input: 'cache0', output: output } },
121
+ ],
122
+ });
123
+ });
124
+
125
+ program.parse();
@@ -1,67 +1,67 @@
1
- export interface ISingleSplat {
2
- x: number;
3
- y: number;
4
- z: number;
5
- sx: number;
6
- sy: number;
7
- sz: number;
8
- qx: number;
9
- qy: number;
10
- qz: number;
11
- qw: number;
12
- r: number;
13
- g: number;
14
- b: number;
15
- a: number;
16
- shN: number[];
17
- }
18
- export declare const enum ColIdx {
19
- x = 0,
20
- y = 1,
21
- z = 2,
22
- sx = 3,
23
- sy = 4,
24
- sz = 5,
25
- qx = 6,
26
- qy = 7,
27
- qz = 8,
28
- qw = 9,
29
- r = 10,
30
- g = 11,
31
- b = 12,
32
- a = 13,
33
- shOffset = 14
34
- }
35
- export declare class SplatData {
36
- counts: number;
37
- shDegree: number;
38
- shCounts: number;
39
- maxShDegree: number;
40
- table: Float32Array[];
41
- constructor(blockCounts?: number, maxShDegree?: number);
42
- blockOffsets: number[];
43
- blockContentCounts: number[];
44
- private blockCounts;
45
- private totalBlockCounts;
46
- private totalBlockShDegree;
47
- private blockExecs;
48
- private currentBlockIndex;
49
- initBlock(counts: number, shDegree: number): Promise<number>;
50
- finishBlock(): void;
51
- init(counts: number, shDegree: number): this;
52
- set(i: number, single: ISingleSplat): void;
53
- setCenter(i: number, x: number, y: number, z: number): void;
54
- setScale(i: number, sx: number, sy: number, sz: number): void;
55
- setQuat(i: number, qx: number, qy: number, qz: number, qw: number): void;
56
- setColor(i: number, r: number, g: number, b: number): void;
57
- setAlpha(i: number, a: number): void;
58
- setShN(i: number, shN: number[]): void;
59
- get(i: number, single: ISingleSplat): void;
60
- getCenter(i: number, single: ISingleSplat): void;
61
- getScale(i: number, single: ISingleSplat): void;
62
- getQuat(i: number, single: ISingleSplat): void;
63
- getColor(i: number, single: ISingleSplat): void;
64
- getAlpha(i: number, single: ISingleSplat): void;
65
- getShN(i: number, shN: number[]): void;
66
- destroy(): void;
67
- }
1
+ export interface ISingleSplat {
2
+ x: number;
3
+ y: number;
4
+ z: number;
5
+ sx: number;
6
+ sy: number;
7
+ sz: number;
8
+ qx: number;
9
+ qy: number;
10
+ qz: number;
11
+ qw: number;
12
+ r: number;
13
+ g: number;
14
+ b: number;
15
+ a: number;
16
+ shN: number[];
17
+ }
18
+ export declare enum ColIdx {
19
+ x = 0,
20
+ y = 1,
21
+ z = 2,
22
+ sx = 3,
23
+ sy = 4,
24
+ sz = 5,
25
+ qx = 6,
26
+ qy = 7,
27
+ qz = 8,
28
+ qw = 9,
29
+ r = 10,
30
+ g = 11,
31
+ b = 12,
32
+ a = 13,
33
+ shOffset = 14
34
+ }
35
+ export declare class SplatData {
36
+ counts: number;
37
+ shDegree: number;
38
+ shCounts: number;
39
+ maxShDegree: number;
40
+ table: Float32Array[];
41
+ constructor(blockCounts?: number, maxShDegree?: number);
42
+ blockOffsets: number[];
43
+ blockContentCounts: number[];
44
+ private blockCounts;
45
+ private totalBlockCounts;
46
+ private totalBlockShDegree;
47
+ private blockExecs;
48
+ private currentBlockIndex;
49
+ initBlock(counts: number, shDegree: number): Promise<number>;
50
+ finishBlock(): void;
51
+ init(counts: number, shDegree: number): this;
52
+ set(i: number, single: ISingleSplat): void;
53
+ setCenter(i: number, x: number, y: number, z: number): void;
54
+ setScale(i: number, sx: number, sy: number, sz: number): void;
55
+ setQuat(i: number, qx: number, qy: number, qz: number, qw: number): void;
56
+ setColor(i: number, r: number, g: number, b: number): void;
57
+ setAlpha(i: number, a: number): void;
58
+ setShN(i: number, shN: number[]): void;
59
+ get(i: number, single: ISingleSplat): void;
60
+ getCenter(i: number, single: ISingleSplat): void;
61
+ getScale(i: number, single: ISingleSplat): void;
62
+ getQuat(i: number, single: ISingleSplat): void;
63
+ getColor(i: number, single: ISingleSplat): void;
64
+ getAlpha(i: number, single: ISingleSplat): void;
65
+ getShN(i: number, shN: number[]): void;
66
+ destroy(): void;
67
+ }