@loaders.gl/splats 5.0.0-beta.1 → 5.0.0-beta.11

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 (84) hide show
  1. package/README.md +4 -2
  2. package/dist/bundled.d.ts +1 -1
  3. package/dist/bundled.d.ts.map +1 -1
  4. package/dist/bundled.js +1 -1
  5. package/dist/bundled.js.map +1 -1
  6. package/dist/dist.dev.js +550 -431
  7. package/dist/dist.min.js +20 -20
  8. package/dist/index.cjs +437 -365
  9. package/dist/index.cjs.map +3 -3
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/ksplat-loader-types.d.ts +11 -7
  15. package/dist/ksplat-loader-types.d.ts.map +1 -1
  16. package/dist/ksplat-loader-types.js +4 -2
  17. package/dist/ksplat-loader-types.js.map +1 -1
  18. package/dist/ksplat-loader.d.ts +7 -5
  19. package/dist/ksplat-loader.d.ts.map +1 -1
  20. package/dist/ksplat-loader.js.map +1 -1
  21. package/dist/lib/parse-ksplat.d.ts +2 -2
  22. package/dist/lib/parse-ksplat.d.ts.map +1 -1
  23. package/dist/lib/parse-rad-chunk.d.ts +2 -2
  24. package/dist/lib/parse-rad-chunk.d.ts.map +1 -1
  25. package/dist/lib/parse-splat.d.ts +2 -2
  26. package/dist/lib/parse-splat.d.ts.map +1 -1
  27. package/dist/lib/parse-spz.d.ts +2 -2
  28. package/dist/lib/parse-spz.d.ts.map +1 -1
  29. package/dist/lib/parse-spz.js.map +1 -1
  30. package/dist/lib/splats-arrow-table.d.ts +2 -2
  31. package/dist/lib/splats-arrow-table.d.ts.map +1 -1
  32. package/dist/lib/splats-arrow-table.js +30 -35
  33. package/dist/lib/splats-arrow-table.js.map +1 -1
  34. package/dist/rad-loader-types.d.ts +5 -0
  35. package/dist/rad-loader-types.d.ts.map +1 -1
  36. package/dist/rad-loader-types.js +3 -1
  37. package/dist/rad-loader-types.js.map +1 -1
  38. package/dist/rad-loader.d.ts +4 -0
  39. package/dist/rad-loader.d.ts.map +1 -1
  40. package/dist/rad-loader.js +2 -0
  41. package/dist/rad-loader.js.map +1 -1
  42. package/dist/rad-source-loader.d.ts +5 -36
  43. package/dist/rad-source-loader.d.ts.map +1 -1
  44. package/dist/rad-source-loader.js +10 -33
  45. package/dist/rad-source-loader.js.map +1 -1
  46. package/dist/splat-loader-types.d.ts +11 -7
  47. package/dist/splat-loader-types.d.ts.map +1 -1
  48. package/dist/splat-loader-types.js +4 -2
  49. package/dist/splat-loader-types.js.map +1 -1
  50. package/dist/splat-loader.d.ts +7 -5
  51. package/dist/splat-loader.d.ts.map +1 -1
  52. package/dist/splat-loader.js.map +1 -1
  53. package/dist/spz-loader-types.d.ts +10 -6
  54. package/dist/spz-loader-types.d.ts.map +1 -1
  55. package/dist/spz-loader-types.js +4 -2
  56. package/dist/spz-loader-types.js.map +1 -1
  57. package/dist/spz-loader.d.ts +6 -4
  58. package/dist/spz-loader.d.ts.map +1 -1
  59. package/dist/spz-loader.js.map +1 -1
  60. package/dist/types.d.ts +2 -2
  61. package/dist/types.d.ts.map +1 -1
  62. package/dist/unbundled.d.ts +1 -1
  63. package/dist/unbundled.d.ts.map +1 -1
  64. package/dist/unbundled.js +1 -1
  65. package/dist/unbundled.js.map +1 -1
  66. package/package.json +8 -5
  67. package/src/bundled.ts +1 -1
  68. package/src/index.ts +1 -1
  69. package/src/ksplat-loader-types.ts +6 -4
  70. package/src/ksplat-loader.ts +2 -2
  71. package/src/lib/parse-ksplat.ts +2 -2
  72. package/src/lib/parse-rad-chunk.ts +2 -2
  73. package/src/lib/parse-splat.ts +2 -2
  74. package/src/lib/parse-spz.ts +2 -5
  75. package/src/lib/splats-arrow-table.ts +32 -46
  76. package/src/rad-loader-types.ts +2 -0
  77. package/src/rad-loader.ts +2 -0
  78. package/src/rad-source-loader.ts +19 -48
  79. package/src/splat-loader-types.ts +6 -4
  80. package/src/splat-loader.ts +2 -2
  81. package/src/spz-loader-types.ts +6 -4
  82. package/src/spz-loader.ts +2 -2
  83. package/src/types.ts +2 -2
  84. package/src/unbundled.ts +1 -1
@@ -3,55 +3,43 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import * as arrow from 'apache-arrow';
6
- import type {Field, MeshArrowTable, Schema} from '@loaders.gl/core/schema';
6
+ import {encodeArrayBufferToBase64} from '@loaders.gl/core/loader-utils';
7
7
  import type {GaussianSplats} from '../types';
8
8
  import {convertColorByteToSphericalHarmonicDc} from './splat-utils';
9
9
 
10
10
  /** Builds a Mesh Arrow table from decoded Gaussian splat values. */
11
- export function makeGaussianSplatsArrowTable(splats: GaussianSplats): MeshArrowTable {
11
+ export function makeGaussianSplatsArrowTable(splats: GaussianSplats): arrow.Table {
12
12
  const columns: Record<string, arrow.Vector> = {};
13
13
  const fields: arrow.Field[] = [];
14
- const schemaFields: Field[] = [];
15
14
 
16
- addColumn(
17
- columns,
18
- fields,
19
- schemaFields,
20
- 'POSITION',
21
- makeFixedSizeListVector(splats.positions, 3),
22
- {
23
- type: 'fixed-size-list',
24
- listSize: 3,
25
- children: [{name: 'value', type: 'float32'}]
26
- }
27
- );
15
+ addColumn(columns, fields, 'POSITION', makeFixedSizeListVector(splats.positions, 3));
28
16
 
29
17
  const colorCoefficients = getColorCoefficients(splats);
30
- addScalarColumn(columns, fields, schemaFields, 'f_dc_0', colorCoefficients[0], {
18
+ addScalarColumn(columns, fields, 'f_dc_0', colorCoefficients[0], {
31
19
  'loaders_gl.gaussian_splats.semantic': 'spherical_harmonic_dc',
32
20
  'loaders_gl.gaussian_splats.component': '0',
33
21
  'loaders_gl.gaussian_splats.encoding': 'coefficient'
34
22
  });
35
- addScalarColumn(columns, fields, schemaFields, 'f_dc_1', colorCoefficients[1], {
23
+ addScalarColumn(columns, fields, 'f_dc_1', colorCoefficients[1], {
36
24
  'loaders_gl.gaussian_splats.semantic': 'spherical_harmonic_dc',
37
25
  'loaders_gl.gaussian_splats.component': '1',
38
26
  'loaders_gl.gaussian_splats.encoding': 'coefficient'
39
27
  });
40
- addScalarColumn(columns, fields, schemaFields, 'f_dc_2', colorCoefficients[2], {
28
+ addScalarColumn(columns, fields, 'f_dc_2', colorCoefficients[2], {
41
29
  'loaders_gl.gaussian_splats.semantic': 'spherical_harmonic_dc',
42
30
  'loaders_gl.gaussian_splats.component': '2',
43
31
  'loaders_gl.gaussian_splats.encoding': 'coefficient'
44
32
  });
45
33
 
46
- addScalarColumn(columns, fields, schemaFields, 'opacity', splats.opacities, {
34
+ addScalarColumn(columns, fields, 'opacity', splats.opacities, {
47
35
  'loaders_gl.gaussian_splats.semantic': 'opacity',
48
36
  'loaders_gl.gaussian_splats.encoding': 'linear'
49
37
  });
50
- addVectorComponents(columns, fields, schemaFields, 'scale', splats.scales, 3, {
38
+ addVectorComponents(columns, fields, 'scale', splats.scales, 3, {
51
39
  'loaders_gl.gaussian_splats.semantic': 'scale',
52
40
  'loaders_gl.gaussian_splats.encoding': 'linear'
53
41
  });
54
- addVectorComponents(columns, fields, schemaFields, 'rot', splats.rotations, 4, {
42
+ addVectorComponents(columns, fields, 'rot', splats.rotations, 4, {
55
43
  'loaders_gl.gaussian_splats.semantic': 'rotation',
56
44
  'loaders_gl.gaussian_splats.encoding': 'quaternion'
57
45
  });
@@ -60,7 +48,6 @@ export function makeGaussianSplatsArrowTable(splats: GaussianSplats): MeshArrowT
60
48
  addSphericalHarmonicRestColumns(
61
49
  columns,
62
50
  fields,
63
- schemaFields,
64
51
  splats.sphericalHarmonics,
65
52
  splats.sphericalHarmonicsComponentCount
66
53
  );
@@ -73,26 +60,30 @@ export function makeGaussianSplatsArrowTable(splats: GaussianSplats): MeshArrowT
73
60
  ['topology', 'point-list'],
74
61
  ['mode', '0']
75
62
  ]);
76
- const arrowSchema = new arrow.Schema(fields, metadata);
77
- const schema: Schema = {
78
- fields: schemaFields,
79
- metadata: Object.fromEntries(metadata)
80
- };
81
-
82
- return {
83
- shape: 'arrow-table',
84
- schema,
85
- data: new arrow.Table(arrowSchema, columns),
86
- topology: 'point-list',
87
- loaderData: splats.loaderData
88
- } as MeshArrowTable;
63
+ if (splats.loaderData) {
64
+ const {extensionBytes, childCounts, childStarts, ...header} = splats.loaderData;
65
+ metadata.set(
66
+ 'loaders_gl.gaussian_splats.loader_data',
67
+ JSON.stringify({
68
+ ...header,
69
+ childCounts: childCounts instanceof Uint16Array ? Array.from(childCounts) : childCounts,
70
+ childStarts: childStarts instanceof Uint32Array ? Array.from(childStarts) : childStarts
71
+ })
72
+ );
73
+ if (extensionBytes instanceof Uint8Array) {
74
+ metadata.set(
75
+ 'loaders_gl.gaussian_splats.extension_bytes',
76
+ encodeArrayBufferToBase64(extensionBytes.slice().buffer)
77
+ );
78
+ }
79
+ }
80
+ return new arrow.Table(new arrow.Schema(fields, metadata), columns);
89
81
  }
90
82
 
91
83
  /** Adds one scalar Arrow column per component of an interleaved vector array. */
92
84
  function addVectorComponents(
93
85
  columns: Record<string, arrow.Vector>,
94
86
  fields: arrow.Field[],
95
- schemaFields: Field[],
96
87
  prefix: string,
97
88
  values: Float32Array,
98
89
  size: number,
@@ -103,7 +94,7 @@ function addVectorComponents(
103
94
  for (let rowIndex = 0; rowIndex < componentValues.length; rowIndex++) {
104
95
  componentValues[rowIndex] = values[rowIndex * size + component];
105
96
  }
106
- addScalarColumn(columns, fields, schemaFields, `${prefix}_${component}`, componentValues, {
97
+ addScalarColumn(columns, fields, `${prefix}_${component}`, componentValues, {
107
98
  ...metadata,
108
99
  'loaders_gl.gaussian_splats.component': String(component)
109
100
  });
@@ -114,7 +105,6 @@ function addVectorComponents(
114
105
  function addSphericalHarmonicRestColumns(
115
106
  columns: Record<string, arrow.Vector>,
116
107
  fields: arrow.Field[],
117
- schemaFields: Field[],
118
108
  sphericalHarmonics: Float32Array,
119
109
  componentCount: number
120
110
  ): void {
@@ -123,7 +113,7 @@ function addSphericalHarmonicRestColumns(
123
113
  for (let rowIndex = 0; rowIndex < componentValues.length; rowIndex++) {
124
114
  componentValues[rowIndex] = sphericalHarmonics[rowIndex * componentCount + component];
125
115
  }
126
- addScalarColumn(columns, fields, schemaFields, `f_rest_${component}`, componentValues, {
116
+ addScalarColumn(columns, fields, `f_rest_${component}`, componentValues, {
127
117
  'loaders_gl.gaussian_splats.semantic': 'spherical_harmonic_rest',
128
118
  'loaders_gl.gaussian_splats.component': String(component),
129
119
  'loaders_gl.gaussian_splats.encoding': 'coefficient'
@@ -131,31 +121,27 @@ function addSphericalHarmonicRestColumns(
131
121
  }
132
122
  }
133
123
 
134
- /** Adds a Float32 scalar Arrow column and matching loaders.gl schema field. */
124
+ /** Adds a Float32 scalar Arrow column. */
135
125
  function addScalarColumn(
136
126
  columns: Record<string, arrow.Vector>,
137
127
  fields: arrow.Field[],
138
- schemaFields: Field[],
139
128
  name: string,
140
129
  values: Float32Array,
141
130
  metadata: Record<string, string>
142
131
  ): void {
143
- addColumn(columns, fields, schemaFields, name, arrow.makeVector(values), 'float32', metadata);
132
+ addColumn(columns, fields, name, arrow.makeVector(values), metadata);
144
133
  }
145
134
 
146
- /** Adds an Arrow column, Arrow field, and loaders.gl schema field. */
135
+ /** Adds an Arrow column and its field metadata. */
147
136
  function addColumn(
148
137
  columns: Record<string, arrow.Vector>,
149
138
  fields: arrow.Field[],
150
- schemaFields: Field[],
151
139
  name: string,
152
140
  column: arrow.Vector,
153
- schemaType: Field['type'],
154
141
  metadata: Record<string, string> = {}
155
142
  ): void {
156
143
  columns[name] = column;
157
144
  fields.push(new arrow.Field(name, column.type, false, new Map(Object.entries(metadata))));
158
- schemaFields.push({name, type: schemaType, nullable: false, metadata});
159
145
  }
160
146
 
161
147
  /** Builds a FixedSizeList Arrow vector from an interleaved Float32 array. */
@@ -23,5 +23,7 @@ export const RADLoader = {
23
23
  ...RADFormat,
24
24
  version: VERSION,
25
25
  options: {},
26
+ fromUrl: true,
27
+ fromBlob: true,
26
28
  preload
27
29
  } as const satisfies Loader<RADMetadata, never, LoaderOptions>;
package/src/rad-loader.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
+ import {createRADSource} from './rad-source-loader';
5
6
  import type {LoaderOptions, LoaderWithParser} from '@loaders.gl/core/loader-utils';
6
7
  import {parseRADHeader} from './lib/parse-rad';
7
8
  import type {RADMetadata} from './lib/parse-rad';
@@ -19,6 +20,7 @@ const {preload: _RADLoaderPreload, ...RADLoaderMetadataWithoutPreload} = RADLoad
19
20
 
20
21
  /** Parser-bearing loader for Spark `.rad` paged LoD Gaussian splat container metadata. */
21
22
  export const RADLoaderWithParser = {
23
+ createDataSourceSync: createRADSource,
22
24
  ...RADLoaderMetadataWithoutPreload,
23
25
  parse: async (arrayBuffer: ArrayBuffer) => parseRADHeader(arrayBuffer),
24
26
  parseSync: (arrayBuffer: ArrayBuffer) => parseRADHeader(arrayBuffer)
@@ -2,10 +2,9 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import type {CoreAPI, DataSourceOptions, SourceLoader} from '@loaders.gl/core/loader-utils';
5
+ import type {CoreAPI, DataSourceOptions} from '@loaders.gl/core/loader-utils';
6
6
  import {DataSource} from '@loaders.gl/core/loader-utils';
7
- import type {MeshArrowTable} from '@loaders.gl/core/schema';
8
- import {RADFormat} from './splats-format';
7
+ import type {Table} from 'apache-arrow';
9
8
  import {
10
9
  parseRADChunkHeader,
11
10
  tryParseRADHeader,
@@ -25,10 +24,6 @@ import type {GaussianSplats} from './types';
25
24
  const DEFAULT_RAD_HEADER_BYTE_LENGTHS = [64 * 1024, 256 * 1024, 1024 * 1024];
26
25
  const DEFAULT_RAD_MAX_CONCURRENT_CHUNK_REQUESTS = 4;
27
26
 
28
- // __VERSION__ is injected by babel-plugin-version-inline
29
- // @ts-ignore TS2304: Cannot find name '__VERSION__'.
30
- const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
31
-
32
27
  /** Options for creating a Spark RAD source. */
33
28
  export type RADSourceLoaderOptions = DataSourceOptions & {
34
29
  rad?: {
@@ -61,40 +56,19 @@ export type RADChunkTableIteratorOptions = RADChunkRequestOptions & {
61
56
  pruneLoadedLoDParents?: boolean;
62
57
  };
63
58
 
64
- /** Source factory for Spark `.rad` paged LoD Gaussian splat containers. */
65
- export const RADSourceLoader = {
66
- dataType: null as unknown as RADSource,
67
- batchType: null as never,
68
- ...RADFormat,
69
- name: 'RADSourceLoader',
70
- version: VERSION,
71
- type: 'rad',
72
- fromUrl: true,
73
- fromBlob: true,
74
-
75
- options: {
76
- rad: {
77
- headers: undefined!,
78
- withCredentials: false,
79
- headerByteLengths: undefined!
80
- }
81
- },
82
-
83
- defaultOptions: {
84
- rad: {
85
- headers: undefined!,
86
- withCredentials: false,
87
- headerByteLengths: undefined!
88
- }
89
- },
59
+ /** Default request options for a RAD source. */
60
+ const RAD_SOURCE_DEFAULT_OPTIONS = {
61
+ rad: {headers: undefined!, withCredentials: false, headerByteLengths: undefined!}
62
+ };
90
63
 
91
- testURL: (url: string): boolean => /\.rad(?:$|[?#])/i.test(url),
92
- createDataSource: (
93
- data: string | Blob,
94
- options: RADSourceLoaderOptions,
95
- coreApi?: CoreAPI
96
- ): RADSource => new RADSource(data, options, coreApi)
97
- } as const satisfies SourceLoader<RADSource>;
64
+ /** Opens a RAD source over a URL or Blob. */
65
+ export function createRADSource(
66
+ data: string | Blob,
67
+ options: RADSourceLoaderOptions,
68
+ coreApi?: CoreAPI
69
+ ): RADSource {
70
+ return new RADSource(data, options, coreApi);
71
+ }
98
72
 
99
73
  /** Runtime source for RAD metadata and chunk-byte access. */
100
74
  export class RADSource extends DataSource<string | Blob, RADSourceLoaderOptions> {
@@ -107,7 +81,7 @@ export class RADSource extends DataSource<string | Blob, RADSourceLoaderOptions>
107
81
  private _chunkMetadataPromises: Map<number, Promise<RADChunkMetadata>> = new Map();
108
82
 
109
83
  constructor(data: string | Blob, options: RADSourceLoaderOptions, coreApi?: CoreAPI) {
110
- super(data, options, RADSourceLoader.defaultOptions, coreApi);
84
+ super(data, options, RAD_SOURCE_DEFAULT_OPTIONS, coreApi);
111
85
  this.metadata = this.getMetadata();
112
86
  }
113
87
 
@@ -199,10 +173,7 @@ export class RADSource extends DataSource<string | Blob, RADSourceLoaderOptions>
199
173
  }
200
174
 
201
175
  /** Fetches and decodes one RADC chunk into a Mesh Arrow table. */
202
- async getChunkTable(
203
- chunkIndex: number,
204
- options: RADChunkRequestOptions = {}
205
- ): Promise<MeshArrowTable> {
176
+ async getChunkTable(chunkIndex: number, options: RADChunkRequestOptions = {}): Promise<Table> {
206
177
  const metadata = await this.getMetadata();
207
178
  await preloadRADCompression();
208
179
  return parseRADChunk(
@@ -212,7 +183,7 @@ export class RADSource extends DataSource<string | Blob, RADSourceLoaderOptions>
212
183
  }
213
184
 
214
185
  /** Iterates decoded RADC chunks as Mesh Arrow tables. */
215
- async *getChunkTables(options: RADChunkTableIteratorOptions = {}): AsyncIterable<MeshArrowTable> {
186
+ async *getChunkTables(options: RADChunkTableIteratorOptions = {}): AsyncIterable<Table> {
216
187
  const metadata = await this.getMetadata();
217
188
  const startChunkIndex = options.startChunkIndex ?? 0;
218
189
  const maxChunks = options.maxChunks ?? Number.POSITIVE_INFINITY;
@@ -248,7 +219,7 @@ export class RADSource extends DataSource<string | Blob, RADSourceLoaderOptions>
248
219
  ) {
249
220
  const table = await this.getChunkTable(chunkIndex, options);
250
221
  chunkCount++;
251
- splatCount += table.data.numRows;
222
+ splatCount += table.numRows;
252
223
  yield table;
253
224
  }
254
225
  }
@@ -363,7 +334,7 @@ export class RADSource extends DataSource<string | Blob, RADSourceLoaderOptions>
363
334
 
364
335
  /** Returns true when source options supplied an explicit fetch override. */
365
336
  private _hasCustomFetch(): boolean {
366
- return Boolean(this.loadOptions?.core?.fetch || this.loadOptions?.fetch);
337
+ return Boolean(this.loadOptions?.core?.fetch);
367
338
  }
368
339
 
369
340
  /** Builds request options for RAD fetches. */
@@ -3,7 +3,7 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {Loader} from '@loaders.gl/core/loader-utils';
6
- import type {MeshArrowTable} from '@loaders.gl/core/schema';
6
+ import type {Table} from 'apache-arrow';
7
7
  import type {SplatsLoaderOptions} from './types';
8
8
  import {SPLATFormat} from './splats-format';
9
9
 
@@ -19,14 +19,16 @@ async function preload() {
19
19
 
20
20
  /** Metadata-only loader for raw `.splat` Gaussian splat files. */
21
21
  export const SPLATLoader = {
22
- dataType: null as unknown as MeshArrowTable,
22
+ defaultShape: 'arrow',
23
+ supportsNativeArrow: true,
24
+ dataType: null as unknown as Table,
23
25
  batchType: null as never,
24
26
  ...SPLATFormat,
25
27
  version: VERSION,
26
28
  options: {
27
29
  splats: {
28
- shape: 'arrow-table'
30
+ shape: 'arrow'
29
31
  }
30
32
  },
31
33
  preload
32
- } as const satisfies Loader<MeshArrowTable, never, SplatsLoaderOptions>;
34
+ } as const satisfies Loader<Table, never, SplatsLoaderOptions>;
@@ -3,7 +3,7 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {LoaderWithParser} from '@loaders.gl/core/loader-utils';
6
- import type {MeshArrowTable} from '@loaders.gl/core/schema';
6
+ import type {Table} from 'apache-arrow';
7
7
  import type {SplatsLoaderOptions} from './types';
8
8
  import {parseSPLAT} from './lib/parse-splat';
9
9
  import {SPLATLoader as SPLATLoaderMetadata} from './splat-loader-types';
@@ -15,4 +15,4 @@ export const SPLATLoaderWithParser = {
15
15
  ...SPLATLoaderMetadataWithoutPreload,
16
16
  parse: async (arrayBuffer: ArrayBuffer) => parseSPLAT(arrayBuffer),
17
17
  parseSync: (arrayBuffer: ArrayBuffer) => parseSPLAT(arrayBuffer)
18
- } as const satisfies LoaderWithParser<MeshArrowTable, never, SplatsLoaderOptions>;
18
+ } as const satisfies LoaderWithParser<Table, never, SplatsLoaderOptions>;
@@ -3,7 +3,7 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {Loader} from '@loaders.gl/core/loader-utils';
6
- import type {MeshArrowTable} from '@loaders.gl/core/schema';
6
+ import type {Table} from 'apache-arrow';
7
7
  import type {SplatsLoaderOptions} from './types';
8
8
  import {SPZFormat} from './splats-format';
9
9
 
@@ -19,14 +19,16 @@ async function preload() {
19
19
 
20
20
  /** Metadata-only loader for Niantic Spatial `.spz` Gaussian splat files. */
21
21
  export const SPZLoader = {
22
- dataType: null as unknown as MeshArrowTable,
22
+ defaultShape: 'arrow',
23
+ supportsNativeArrow: true,
24
+ dataType: null as unknown as Table,
23
25
  batchType: null as never,
24
26
  ...SPZFormat,
25
27
  version: VERSION,
26
28
  options: {
27
29
  splats: {
28
- shape: 'arrow-table'
30
+ shape: 'arrow'
29
31
  }
30
32
  },
31
33
  preload
32
- } as const satisfies Loader<MeshArrowTable, never, SplatsLoaderOptions>;
34
+ } as const satisfies Loader<Table, never, SplatsLoaderOptions>;
package/src/spz-loader.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import type {LoaderWithParser} from '@loaders.gl/core/loader-utils';
6
- import type {MeshArrowTable} from '@loaders.gl/core/schema';
6
+ import type {Table} from 'apache-arrow';
7
7
  import type {SplatsLoaderOptions} from './types';
8
8
  import {parseSPZ} from './lib/parse-spz';
9
9
  import {SPZLoader as SPZLoaderMetadata} from './spz-loader-types';
@@ -15,4 +15,4 @@ export const SPZLoaderWithParser = {
15
15
  ...SPZLoaderMetadataWithoutPreload,
16
16
  parse: async (arrayBuffer: ArrayBuffer, options?: SplatsLoaderOptions) =>
17
17
  parseSPZ(arrayBuffer, options)
18
- } as const satisfies LoaderWithParser<MeshArrowTable, never, SplatsLoaderOptions>;
18
+ } as const satisfies LoaderWithParser<Table, never, SplatsLoaderOptions>;
package/src/types.ts CHANGED
@@ -7,8 +7,8 @@ import type {LoaderOptions} from '@loaders.gl/core/loader-utils';
7
7
  /** Options shared by Gaussian splat loaders. */
8
8
  export type SplatsLoaderOptions = LoaderOptions & {
9
9
  splats?: {
10
- /** Output shape. V1 supports loaders.gl Mesh Arrow tables. */
11
- shape?: 'arrow-table';
10
+ /** Output shape. Returns a native Apache Arrow table. */
11
+ shape?: 'arrow';
12
12
  /** Coordinate frame stored in the source SPZ payload. */
13
13
  sourceCoordinateSystem?: SPZCoordinateSystem;
14
14
  /** Coordinate frame expected by the caller. Defaults to the source frame. */
package/src/unbundled.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- export {SPLATLoader, KSPLATLoader, SPZLoader, RADLoader, RADSourceLoader} from './index';
5
+ export {SPLATLoader, KSPLATLoader, SPZLoader, RADLoader} from './index';