unpackEntity()
Rebuild an entity from packEntity's output. Every array is copied out of bytes, unless opts.views: then a sparse model's bricks are views into bytes (which the entity then owns; one allocation per brick rather than one copy each, which is what the generator pool does with the packed entities its...
function unpackEntity(
head: Record<string, unknown>,
bytes: Uint8Array,
opts?: object
): Entity;Defined in: engine/src/worker/cache.ts:526
Rebuild an entity from packEntity's output. Every array is copied out of bytes, unless
opts.views: then a sparse model's bricks are views into bytes (which the entity then owns;
one allocation per brick rather than one copy each, which is what the generator pool does with
the packed entities its workers post). Dense data and bones are always copies.
Parameters
| Parameter | Type |
|---|---|
head | Record<string, unknown> |
bytes | Uint8Array |
opts? | { views?: boolean; } |
opts.views? | boolean |
Returns
serveScene()
Serve model encodes and placement bakes on this worker until it is terminated: the worker side of makeSceneWorker. Encodes run the renderer's encodeModel; bakes run a PlacementBaker holding the registered models. Each job is answered with its result, buffers transferred, after progress messages...
CacheRecord
A packed model as stored: the header and the deflated bytes.