EntityThumbnailCache
@zylem/game-lib / debug / EntityThumbnailCache
Class: EntityThumbnailCache
Defined in: packages/game-lib/src/lib/debug/entity-thumbnail.ts:72
Generates and caches entity thumbnail previews for the editor entity list. Renders a cloned Object3D into an offscreen RenderTarget on the shared WebGPU renderer.
A rendered URL leaves this cache the moment it is read, and the editor holds it for as long as the entity is listed. Dropping an entry here therefore must not revoke its blob URL — the consumer owns that lifetime and releases it when the thumbnail is replaced, the entity is removed, or the stage changes.
Constructors
Constructor
new EntityThumbnailCache(
size?,maxEntries?):EntityThumbnailCache
Defined in: packages/game-lib/src/lib/debug/entity-thumbnail.ts:81
Parameters
size?
number = DEFAULT_SIZE
maxEntries?
number = DEFAULT_MAX_ENTRIES
Returns
EntityThumbnailCache
Accessors
cacheSize
Get Signature
get cacheSize():
number
Defined in: packages/game-lib/src/lib/debug/entity-thumbnail.ts:116
Number of thumbnails currently cached.
Returns
number
pendingCount
Get Signature
get pendingCount():
number
Defined in: packages/game-lib/src/lib/debug/entity-thumbnail.ts:121
Entities waiting for a render slot.
Returns
number
Methods
clear()
clear():
void
Defined in: packages/game-lib/src/lib/debug/entity-thumbnail.ts:108
Returns
void
ensure()
ensure(
uuid,object):Promise<EntityThumbnailCacheEntry|null>
Defined in: packages/game-lib/src/lib/debug/entity-thumbnail.ts:130
Return a cached thumbnail, or schedule one. Renders are throttled to MAX_CONCURRENT_RENDERS at a time behind a bounded queue, so a burst of spawns cannot flood the renderer with pixel readbacks.
Parameters
uuid
string
object
Object3D<Object3DEventMap> | null | undefined
Returns
Promise<EntityThumbnailCacheEntry | null>
get()
get(
uuid):EntityThumbnailCacheEntry|null
Defined in: packages/game-lib/src/lib/debug/entity-thumbnail.ts:90
Parameters
uuid
string
Returns
EntityThumbnailCacheEntry | null
invalidate()
invalidate(
uuid):void
Defined in: packages/game-lib/src/lib/debug/entity-thumbnail.ts:97
Parameters
uuid
string
Returns
void
setRenderer()
setRenderer(
renderer):void
Defined in: packages/game-lib/src/lib/debug/entity-thumbnail.ts:86
Parameters
renderer
WebGPURenderer | null
Returns
void