Class ProgramCache

Singleton cache for parsed and loaded GL programs, indexed by name

Constructors

Properties

_default: ProgramInfo
cache: Map<string, ProgramInfo>
PROG_BILLBOARD: string = 'billboard'
PROG_PHONG: string = 'phong'
PROG_SHADOWMAP: string = 'shadowmap'
_instance: ProgramCache
initialized: boolean = false

Accessors

Methods

  • Parameters

    • name: string
    • program: ProgramInfo

    Returns void

  • Compile a custom shader and add it to the cache

    Parameters

    • name: string

      Assign a name to the shader

    • vert: string

      URL path to vertex shader

    • frag: string

      URL path to fragment shader

    Returns Promise<void>

  • Return a program from the cache by name

    Parameters

    • name: string

      Name of program

    Returns ProgramInfo

  • Parameters

    • name: string

    Returns void

  • Initialise the program cache with a default program. This MUST be called before using the cache

    Parameters

    • defaultProg: ProgramInfo

      The default program that can be used by most things

    Returns void

Generated using TypeDoc