Model loading · function

unpackBlend

The plain bytes of a .blend, decompressing first where the file says it is compressed.

Explained in Importing models.

function unpackBlend(bytes: Uint8Array, decompress: BlendDecompress | undefined): Promise<Uint8Array>
import { unpackBlend } from '@driftengine/assets';

Parameters

ParameterTypeDescription
bytesUint8Array
decompressBlendDecompress | undefined

In depth

Allocated once, from the seek table. The table states every frame's decompressed length, so the output is sized before the first frame is decoded and each frame is copied into place and dropped. Collecting the frames and joining them afterwards held the file twice at its peak, which is 14 GB for a 7 GB city and was the difference between reading it and not.