TextureCache

View source

ExtendsMap

Provides a world resource for caching browser image values by numeric asset ID.

Canvas2DRendererPlugin installs this resource in the app. It has the ordinary map semantics of Map: keys are numeric AssetId values, such as the identity returned by Handle#id, and values are cached browser image representations. The cache does not load assets or populate entries automatically.

Examples

import { TextureCache } from '@wimaengine/render-core'

// Canvas2DRendererPlugin must be registered before this lookup.
function lookupTexture(world, assetId) {
  const textures = world.getResource(TextureCache)
  return textures.get(assetId) // HTMLImageElement | undefined
}

Constructor


constructor<T>()

View source

Type Parameters

T

Type Parameters

T

Parameters

NameDescriptionDefault
entries?——

Type Parameters

T

Type Parameters

T

Parameters

NameDescriptionDefault
iterable?——