# ReadRequest

Type alias

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/chunk/source.ts#L79

A read request to a [ChunkSource](https://api.playcanvas.com/splat-transform/interfaces/ChunkSource.md), selecting source rows in one of two
ways:

- **Chunk** (`chunkIndex`): the contiguous run
  `[chunkIndex·chunkSize, +chunkSize)` of the chosen LOD, filled into output
  rows `[0, count)`. All passed buffers must have `count` equal to
  `meta.chunkSize` for non-final chunks or the trailing count for the last.
- **Gather** (`indices`/`indexOffset`/`count`): arbitrary source rows
  `indices[indexOffset .. indexOffset + count)` of the chosen LOD, filled into
  output rows `[0, count)`. Indices need not be sorted and may repeat.

Gather underpins the LOD writer's "positions resident, heavy data fetched per
output chunk" pass — for a fixed-stride file source each row is a byte-range
read, so a unit pulls only its own gaussians (≈ 1× total reads, no whole-scene
residency). The two are the same operation with a different row selection; the
decode is identical, which is why a source serves both from one `read`.

The arms are disjoint on the `indices` key, so an implementation discriminates
with `'indices' in request` (gather) vs the chunk path otherwise.

```ts
type ReadRequest = ReadTarget & { chunkIndex: number } | ReadTarget & { count: number; indexOffset: number; indices: Uint32Array }
```
