Options
All
  • Public
  • Public/Protected
  • All
Menu

A shareable WebGL program based upon shader source code in HTML script elements.

This class provides a convenient way of creating custom GLSL programs. The scripts are lazily loaded so that the constructor may be called before the DOM has finished loading.

Hierarchy

  • ShaderMaterial
    • HTMLScriptsMaterial

Implements

Index

Constructors

constructor

  • Parameters

    • contextManager: ContextManager
    • scriptIds: string[]

      The element identifiers for the vertex and fragment shader respectively.

    • Default value attribs: string[] = []

      An array of strings containing the order of attributes.

    • Default value dom: Document = window.document

      The document object model that owns the script elements.

    • Default value levelUp: number = 0

    Returns HTMLScriptsMaterial

Properties

Protected contextManager

contextManager: ContextManager

The ContextManager that will be subscribed to for WebGL rendering context events.

Accessors

attributeNames

  • get attributeNames(): string[]
  • set attributeNames(unused: string[]): void

fragmentShaderSrc

  • get fragmentShaderSrc(): string

gl

  • get gl(): WebGLRenderingContext

vertexShaderSrc

  • get vertexShaderSrc(): string

Methods

activeTexture

addRef

  • addRef(): number

attrib

  • attrib(name: string, value: VertexBuffer, size: number, normalized?: boolean, stride?: number, offset?: number): Material
  • Parameters

    • name: string
    • value: VertexBuffer
    • size: number
    • Default value normalized: boolean = false
    • Default value stride: number = 0
    • Default value offset: number = 0

    Returns Material

cleanUp

  • cleanUp(): void

contextFree

  • contextFree(): void

contextGain

  • contextGain(): void

contextLost

  • contextLost(): void

Protected destructor

  • destructor(levelUp: number): void

disableAttrib

  • disableAttrib(indexOrName: number | string): void

disableAttribs

  • disableAttribs(): void

drawArrays

drawElements

enableAttrib

  • enableAttrib(indexOrName: number | string): void
  • Convenience method for dereferencing the name to an attribute location, followed by enabling the attribute.

    Parameters

    • indexOrName: number | string

    Returns void

enableAttribs

  • enableAttribs(): void

getAttrib

  • getAttrib(indexOrName: number | string): Attrib

getAttribLocation

  • getAttribLocation(name: string): number

getLoggingName

  • getLoggingName(): string
  • Returns the name that was assigned by the call to the setLoggingName method.

    Returns string

getUniform

  • getUniform(name: string): Uniform
  • Returns a Uniform object corresponding to the uniform parameter of the same name in the shader code. If a uniform parameter of the specified name does not exist, this method returns undefined (void 0).

    Parameters

    • name: string

    Returns Uniform

hasUniform

  • hasUniform(name: string): boolean

isZombie

  • isZombie(): boolean
  • An object is a zombie if it has been released by all who have held references. In some cases it may be possible to recycle a zombie.

    Returns boolean

matrix2fv

  • matrix2fv(name: string, matrix: Float32Array, transpose?: boolean): this

matrix3fv

  • matrix3fv(name: string, matrix: Float32Array, transpose?: boolean): this

matrix4fv

  • matrix4fv(name: string, matrix: Float32Array, transpose?: boolean): this

release

  • release(): number

Protected resurrector

  • resurrector(levelUp: number): void

Protected setLoggingName

  • setLoggingName(name: string): void
  • This method is for use within constructors.

    Immediately after a call to the super class constructor, make a call to setLoggingName. This will have the effect of refining the name used for reporting reference counts.

    This method has the secondary purpose of enabling a tally of the number of classes in the constructor chain. This enables the runtime architecture to verify that destructor chains are consistent with constructor chains, which is a good practice for cleaning up resources.

    Notice that this method is intentionally protected to discourage it from being called outside of the constructor.

    Parameters

    • name: string

      This will usually be set to the name of the class.

    Returns void

synchUp

  • synchUp(): void

uniform

  • uniform(name: string, value: number | number[]): Material

uniform1f

  • uniform1f(name: string, x: number): void

uniform1fv

  • uniform1fv(name: string, data: Float32Array, srcOffset?: number, srcLength?: number): void

uniform1i

  • uniform1i(name: string, x: number): void

uniform1iv

  • uniform1iv(name: string, data: Int32Array, srcOffset?: number, srcLength?: number): void

uniform2f

  • uniform2f(name: string, x: number, y: number): void

uniform2fv

  • uniform2fv(name: string, data: Float32Array, srcOffset?: number, srcLength?: number): void

uniform2i

  • uniform2i(name: string, x: number, y: number): void

uniform2iv

  • uniform2iv(name: string, src: Int32Array, srcOffset?: number, srcLength?: number): void

uniform3f

  • uniform3f(name: string, x: number, y: number, z: number): void

uniform3fv

  • uniform3fv(name: string, data: Float32Array, srcOffset: number, srcLength: number): void

uniform3i

  • uniform3i(name: string, x: number, y: number, z: number): void

uniform3iv

  • uniform3iv(name: string, src: Int32Array, srcOffset?: number, srcLength?: number): void

uniform4f

  • uniform4f(name: string, x: number, y: number, z: number, w: number): void

uniform4fv

  • uniform4fv(name: string, data: Float32Array, srcOffset?: number, srcLength?: number): void

uniform4i

  • uniform4i(name: string, x: number, y: number, z: number, w: number): void

uniform4iv

  • uniform4iv(name: string, src: Int32Array, srcOffset?: number, srcLength?: number): void

use

  • use(): ShaderMaterial

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Protected property
  • Protected method
  • Static property
  • Static method

Generated using TypeDoc