makePoseCache()
Make a cache for baked poses (or anything else keyed by string). When the estimated size goes over maxBytes (default 48 MiB) the least recently used entries are evicted. makeCrowd makes one itself; make your own to share poses between crowds or to cache poses you bake by hand.
function makePoseCache<T>(sizeOf: (value: T) => number, opts?: object): PoseCache<T>;Defined in: engine/src/animation/cache.ts:31
Type Parameters
Parameters
| Parameter | Type | Description |
|---|---|---|
sizeOf | (value: T) => number | Estimated bytes of a value, counted against maxBytes. |
opts? | { maxBytes?: number; onEvict?: (key: string, value: T) => void; } | - |
opts.maxBytes? | number | - |
opts.onEvict? | (key: string, value: T) => void | - |
Returns
PoseCache<T>
makeCrowd()
Animate many rigged entities on a budget. Each update picks every member's pose frame (at fps near the camera, farFps beyond near, frozen beyond freeze), takes the baked pose from a cache shared by members of the same variant, bakes missing ones within budgetMs (a member that does not fit keeps...
mulAffine()
out = a b for 3x4 affines (apply b, then a). out may not alias.