Class: LightShader

LightShader(vertexShaderPath, fragmentShaderPath) → {LightShader}

Supports light illumination of sprites

Found in Chapter 8, page 417 of the textbook

Examples: 8.2 Simple Light Shader, 8.3 Multiple Lights, 8.6 Directional and Spot Lights

Constructor

new LightShader(vertexShaderPath, fragmentShaderPath) → {LightShader}

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

Extends

Methods

activate(pixelColor, trsMatrix, cameraMatrix)

Overrides shader activation to support
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
Overrides:
Source:

cleanUp()

Delete the texture coordinate buffer and clean up the resources
Inherited From:
Source:

setCameraAndLights(c, l)

Set the Camera and list of Lights for this LightShader, the length of argument l can not be greater than GLSL light array size
Parameters:
Name Type Description
c Camera the Camera this LightShader illuminates
l Array.<Lights> List of Light objects for this LightShader
Source:

setTextureCoordinate(texCoord)

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