# gizlang/meshopt

the decoders of the meshoptimizer bitstreams that EXT_meshopt_compression names: vertex attributes (header 0xa0), triangle indices (0xe1), index sequences (0xd1) and the filters of the extension's Appendix B. Every byte is checked before it is read, and malformed input throws. The encoder is not here.

```gizlang
import * as Meshopt from "gizlang/meshopt";
```

## Functions

### `indices`

```gizlang
function indices(data: bytes, count: i64, size: i64): bytes throws string
```

Decodes a TRIANGLES stream of COUNT indices of SIZE bytes (2 or 4): a triangle list, COUNT divisible by 3.

Effects: fail, alloc.

### `sequence`

```gizlang
function sequence(data: bytes, count: i64, size: i64): bytes throws string
```

Decodes an INDICES stream of COUNT indices of SIZE bytes (2 or 4): deltas against two baselines, for any index order.

Effects: fail, alloc.

### `vertices`

```gizlang
function vertices(data: bytes, count: i64, stride: i64): bytes throws string
```

Decodes an ATTRIBUTES stream of COUNT elements of STRIDE bytes (the version 0 vertex codec, header 0xa0).

Effects: fail, alloc.

### `filtered`

```gizlang
function filtered(data: bytes, count: i64, stride: i64, filter: string): bytes throws string
```

Undoes a filter on DATA of COUNT elements of STRIDE bytes. NONE gives DATA.

Effects: fail, alloc.

