Options
All
  • Public
  • Public/Protected
  • All
Menu

TextureSetManager maintains a set of named/indexed textures and optionally, a FrameBuffer for offscreen rendering.

Hierarchy

  • TextureSetManager

Index

Constructors

constructor

  • Creates a new TextureSetManager

    Parameters

    • rctx: RenderingContext

      the rendering context in which the textures and buffers will be created

    • copier: ShaderProgram

      an instance of a copier program

    • Default value hasFrameBuffer: boolean = false

      if true, then a FrameBuffer is also created

    • Default value texCount: number = 2

      initial number of textures

    Returns TextureSetManager

Properties

Private copier

Private curTex

curTex: number

Private framebuffer

framebuffer: WebGLFramebuffer

Private hasFrameBuffer

hasFrameBuffer: boolean

Private initTexCount

initTexCount: number

Private isRenderTarget

isRenderTarget: boolean

Private names

names: object

Type declaration

Private oldFrameBuffer

oldFrameBuffer: WebGLFramebuffer

Private oldTexture

oldTexture: WebGLTexture

Private rctx

Private textures

textures: WebGLTexture[]

Methods

addTexture

  • addTexture(name?: string): number

copyOver

  • copyOver(): void

destroy

  • destroy(): void

Private findIndex

  • findIndex(arg: string | number): number

getCurrentTexture

  • getCurrentTexture(): WebGLTexture
  • Returns the current texture.

    TextureSetManager has this notion of current texture that it can cycle through the set of all textures.

    Returns WebGLTexture

getTexture

  • getTexture(nameOrIndex: string | number): WebGLTexture
  • Returns the texture at given index or with given nam,e

    Parameters

    • nameOrIndex: string | number

    Returns WebGLTexture

Private init

  • init(): void

removeTexture

  • removeTexture(nameOrIndex: string | number): void
  • Removes a texture

    Parameters

    • nameOrIndex: string | number

      name or index of the texture to be removed

    Returns void

resize

  • resize(): void

setAsRenderTarget

  • setAsRenderTarget(texName?: string): void
  • Sets the current texture as the frame buffer attachment. If hasFrameBuffer is true then the FrameBuffer manager is bound and the texture is set as the frame buffer attachment.

    Parameters

    • Optional texName: string

      name of the texture to set as target. If undefined then we cycle through to next texture

    Returns void

switchTexture

  • switchTexture(nameOrIndex?: string | number): void
  • Sets the current texture and sets it as the current frame buffer attachment

    Parameters

    • Default value nameOrIndex: string | number = (this.curTex + 1) % this.textures.length

      name or index of the texture. If undefined then we cycle through to next texture

    Returns void

unsetAsRenderTarget

  • unsetAsRenderTarget(): void