Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ResourceManager

todo

add description

Hierarchy

  • ResourceManager

Index

Constructors

constructor

  • Creates a resource manager that can be used to fetch and store resources such as textures, geometries, etc.

    Parameters

    • context: Context

      Valid context to created fetched objects for. Note that add external resources are expected to belong to that same context.

    Returns ResourceManager

Properties

Protected _buffers

_buffers: Map<string, Buffer> = ...

Internal storage of buffers.

Protected _context

_context: Context

Context, used to get context information and WebGL API access.

Protected _geometries

_geometries: Map<string, Geometry> = ...

Internal storage of geometries.

Protected _materials

_materials: Map<string, Material> = ...

Internal storage of material.

Protected _texture2Ds

_texture2Ds: Map<string, Texture2D> = ...

Internal storage of 2D textures.

Methods

add

  • Allows to add a resource that, e.g., was not fetched by this resource manager but was loaded or generated somewhere else instead. Please note that by adding the resource, the manager assumes 'taking ownership'. If all given identifiers are already in use, the resource manager does not take ownership of the resource.

    Parameters

    • resource: Buffer | Texture2D | Geometry | Material

      Resource to add.

    • identifiers: string[]

      The identifiers by which the resource can be queried from the ResourceManager.

    Returns string[]

    • The array of added indentifiers. If an identifier already exists for another resource it is not added.

fetchTexture2D

  • fetchTexture2D(identifier: string, url: string, crossOrigin?: boolean): undefined | Promise<void>
  • Creates a Texture2D object and asynchronously loads its image via URL or data URI (@see Texture2D.fetch).

    Parameters

    • identifier: string

      Meaningful name for identification of this instance.

    • url: string

      Uniform resource locator string referencing the image that should be loaded (data URI supported).

    • crossOrigin: boolean = false

      Enable cross origin data loading.

    Returns undefined | Promise<void>

    • Promise for handling image load status. Returns undefined if identifier already exists.

get

uninitialize

  • uninitialize(): void