voxolith

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

ParameterType
headRecord<string, unknown>
bytesUint8Array
opts?{ views?: boolean; }
opts.views?boolean

Returns

Entity

On this page