# dataTableToChunkSource

Function

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/compat/data-table.ts#L153

```ts
dataTableToChunkSource(dataTable: DataTable, chunkSize?: number, indices?: Uint32Array, model?: SplatModel): InMemoryChunkSource
```

Convert a legacy `DataTable` into a `ChunkSource` by repacking its
columnar data into the canonical per-layer interleaved layout.

Detects SH band count from the highest `f_rest_*` index, identifies
non-standard columns as `other`-layer extras, and copies each gaussian's
fields into the appropriate per-layer buffer.

Used during the 3.0 migration by readers that haven't yet been ported to
native chunked decoding — they call this at the end of their existing decode
to upgrade to the new return type.

When `indices` is supplied, only those rows are repacked, in that order — a
direct ordered-subset gather (e.g. the LOD writer's per-unit gather), avoiding
a separate `DataTable.clone({ rows })` copy.

**Parameters**

- `dataTable` ([`DataTable`](https://api.playcanvas.com/splat-transform/classes/DataTable.md)): The legacy table to convert.
- `chunkSize` (`number`, optional, default `DEFAULT_CHUNK_SIZE`): Gaussians per chunk (default DEFAULT_CHUNK_SIZE).
- `indices` (`Uint32Array`, optional): Optional ordered row indices to gather; output row `i` is `dataTable` row `indices[i]`.
- `model` ([`SplatModel`](https://api.playcanvas.com/splat-transform/types/SplatModel.md), optional): How the scene was trained (a `DataTable` carries no tag of its own). Defaults to `default`.

**Returns** `InMemoryChunkSource`: A CPU-resident `InMemoryChunkSource` over the repacked data.
