Options
All
  • Public
  • Public/Protected
  • All
Menu

Helps to avoid doubled Textures and so hopefully preserves some GPU-Memory.

Hierarchy

Index

Constructors

Private constructor

Properties

keys

keys: string[]

Used to show the available keys in the Manager. Mostly used for import.

lookup

lookup: {}

Represents the store of the data.

Type declaration

  • [key: string]: WebGLTexture

Static Private _instance

_instance: TextureManager

Holds the instance of the Manager.

Accessors

values

  • get values(): WebGLTexture[]
  • Returns all saved values.

    Returns WebGLTexture[]

Static Instance

  • Holds the instance of the InputManager.

    Returns TextureManager

Methods

add

  • add(key: string, value: WebGLTexture): void
  • Saves a value in the Manager. Overrides existing values of the key.

    Parameters

    • key: string

      The key of the value

    • value: WebGLTexture

      The value to be saved

    Returns void

addFromSrc

  • addFromSrc(key: string, source: string, gl: WebGL2RenderingContext): void
  • Creates a new Texture and asynchronously loads the data from the url supplied into it.

    Parameters

    • key: string

      The key to be added.

    • source: string

      The url from were the picture should be loaded.

    • gl: WebGL2RenderingContext

      WebGLContext to create the new Texture.

    Returns void

addIfNotExists

  • addIfNotExists(key: string, value: WebGLTexture): void
  • Adds a value if it not already exists within the storage.

    Parameters

    • key: string

      The key of the value

    • value: WebGLTexture

      The value to be saved

    Returns void

exists

  • exists(key: string): boolean
  • Checks if a key exists in the storage.

    Parameters

    • key: string

      The key to be checked.

    Returns boolean

get

  • get(key: string): WebGLTexture | undefined
  • Returns the value of a key or undefined if the key not exists.

    Parameters

    • key: string

      The key of the value to be returned.

    Returns WebGLTexture | undefined

getOrAdd

  • getOrAdd(key: string, def: WebGLTexture): WebGLTexture
  • Checks for a key and returns its value or adds the default provided.

    Parameters

    • key: string

      The key of the value to be returned.

    • def: WebGLTexture

      Defaultvalue that should be added and returned, if the key not exists.

    Returns WebGLTexture

remove

  • remove(key: string): void
  • Removes a certain key from the storage.

    Parameters

    • key: string

      The key of the value to be removed.

    Returns void

Generated using TypeDoc