Class: SpriteShader

SpriteShader(vertexShaderPath, fragmentShaderPath) → {SpriteShader}

Wraps over GLSL texture shader, supporting the defintion of one sprite element from a texture file

Found in Chapter 5, page 222 of the textbook

Examples: 5.2 Sprite Shaders, 5.3 Sprite Animation

Constructor

new SpriteShader(vertexShaderPath, fragmentShaderPath) → {SpriteShader}

Parameters:
Name Type Description
vertexShaderPath string path to the vertex shader file
fragmentShaderPath string path to the fragment shader file
Source:
Returns:
a new SpriteShader instance
Type
SpriteShader

Extends

Methods

activate(pixelColor, trsMatrix, cameraMatrix)

Overrides the activation of this shader for rending
Parameters:
Name Type Description
pixelColor vec4 [R,G,B,A] color array for the pixels
trsMatrix mat4 translation, rotation, and scaling matrix for the object being rendered
cameraMatrix mat4 translation, rotation, and scaling matrix for the Camera
Inherited From:
Source:

cleanUp()

Delete the texture coordinate buffer and clean up the resources
Overrides:
Source:

setTextureCoordinate(texCoord)

Sets the texture coordinates in UV space for a sprite
Parameters:
Name Type Description
texCoord Array.<float> UV texture coordinate array
Source: