Class QuadCompositor

A WebGL Compositor object. This class handles all of the WebGL state
Pushes texture regions or shape geometry into WebGL buffers, automatically flushes to GPU

Hierarchy (view full)

Constructors

constructor

  • new QuadCompositor(renderer, settings): QuadCompositor
  • Parameters

    • renderer: WebGLRenderer

      the current WebGL renderer session

    • settings: {
      attribute: {
      name: string;
      normalized: boolean;
      offset: number;
      size: number;
      type: number;
      }[];
      shader: {
      fragment: string;
      vertex: string;
      };
      }

      additional settings to initialize this compositors

      • attribute: {
        name: string;
        normalized: boolean;
        offset: number;
        size: number;
        type: number;
        }[]

        an array of attributes definition

      • shader: {
        fragment: string;
        vertex: string;
        }

        an array of attributes definition

        • fragment: string
        • vertex: string

    Returns QuadCompositor

Properties

attributes

attributes: undefined | Object []

an array of vertex attribute properties

See

WebGLCompositor.addAttribute

boundTextures

boundTextures: undefined | any[]

color

color: any

currentShader

currentShader: undefined | GLShader

the shader currently used by this compositor

currentTextureUnit

currentTextureUnit: any

defaultShader

defaultShader: undefined | GLShader

the default shader created by this compositor

gl

gl: any

mode

mode: undefined | number

primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)

Default

gl.TRIANGLES

renderer

renderer: any

vertexByteSize

vertexByteSize: undefined | number

the size of a single vertex in bytes (will automatically be calculated as attributes definitions are added)

See

WebGLCompositor.addAttribute

vertexData

vertexData: undefined | VertexArrayBuffer

the vertex data buffer used by this compositor

vertexSize

vertexSize: undefined | number

the size of a single vertex in floats (will automatically be calculated as attributes definitions are added)

See

WebGLCompositor.addAttribute

viewMatrix

viewMatrix: any

Methods

addAttribute

  • addAttribute(name, size, type, normalized, offset): void
  • add vertex attribute property definition to the compositor

    Parameters

    • name: string

      name of the attribute in the vertex shader

    • size: number

      number of components per vertex attribute. Must be 1, 2, 3, or 4.

    • type: number

      data type of each component in the array

    • normalized: boolean

      whether integer data values should be normalized into a certain range when being cast to a float

    • offset: number

      offset in bytes of the first component in the vertex attribute array

    Returns void

addQuad

  • addQuad(texture, x, y, w, h, u0, v0, u1, v1, tint, reupload?): void
  • Add a textured quad

    Parameters

    • texture: TextureAtlas

      Source texture atlas

    • x: number

      Destination x-coordinate

    • y: number

      Destination y-coordinate

    • w: number

      Destination width

    • h: number

      Destination height

    • u0: number

      Texture UV (u0) value.

    • v0: number

      Texture UV (v0) value.

    • u1: number

      Texture UV (u1) value.

    • v1: number

      Texture UV (v1) value.

    • tint: number

      tint color to be applied to the texture in UINT32 (argb) format

    • reupload: boolean = false

      Force the texture to be reuploaded even if already bound

    Returns void

bind

bindTexture2D

createTexture2D

  • createTexture2D(unit, pixels?, filter, repeat?, w?, h?, premultipliedAlpha?, mipmap?, texture): WebGLTexture
  • Create a WebGL texture from an image

    Parameters

    • unit: number

      Destination texture unit

    • Optionalpixels:
      | HTMLCanvasElement
      | ImageData
      | (new (width?: number, height?: number) => HTMLImageElement )
      | Uint8Array[]
      | Float32Array[] = null

      Source image

    • filter: number

      gl.LINEAR or gl.NEAREST

    • Optionalrepeat: string = "no-repeat"

      Image repeat behavior (see ImageLayer#repeat)

    • Optionalw: number = pixels.width

      Source image width (Only use with UInt8Array[] or Float32Array[] source image)

    • Optionalh: number = pixels.height

      Source image height (Only use with UInt8Array[] or Float32Array[] source image)

    • OptionalpremultipliedAlpha: boolean = true

      Multiplies the alpha channel into the other color channels

    • Optionalmipmap: boolean = true

      Whether mipmap levels should be generated for this texture

    • texture: any

    Returns WebGLTexture

    a WebGL texture

deleteTexture2D

flush

getTexture2D

setProjection

unbindTexture2D

useShader

Settings

Member Visibility

On This Page

AltStyle によって変換されたページ (->オリジナル) /