# ChunkSource

Interface

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

Lazy, chunked, layered view onto gaussian splat data.

Sources are opened over a file (or derived from another source via a
combinator) and expose only metadata up front — no gaussian data is loaded
at open time except for formats whose decode is fundamentally whole-blob
(SPZ, MJS). Data is materialized into caller-allocated `ChunkData` buffers
on demand via [ChunkSource.read](https://api.playcanvas.com/splat-transform/interfaces/ChunkSource.md#read).

Memory ownership is on the caller: buffers are acquired from a
`ChunkDataPool`, filled by `read`, used, and released back to the pool. The
source itself never holds long-lived buffer memory on the caller's behalf.

## Methods

### close

```ts
close(): Promise<void>
```

Release any open file handles or internal decode state.
Idempotent; safe to call multiple times.

**Returns** `Promise<void>`

### read

```ts
read(request: ReadRequest): Promise<void>
```

Fill the caller's destination buffers from the source, selecting rows
either by chunk index or by an explicit index list (see
[ReadRequest](https://api.playcanvas.com/splat-transform/types/ReadRequest.md)). Layers present in the request are filled; absent
layers are skipped. All passed buffers must share the same `count` —
the chunk size for a chunk request, or `count` for a gather.

Every source supports both selections: a chunk is a contiguous range and
a gather is an arbitrary one, but the per-row decode is the same.

**Parameters**

- `request` ([`ReadRequest`](https://api.playcanvas.com/splat-transform/types/ReadRequest.md))

**Returns** `Promise<void>`
