October 2018
Intermediate to advanced
500 pages
12h 40m
English
Let's revisit the Phong vertex shader, which was introduced in Chapter 3, Lights. Please remember that matrices are defined as uniform mat4.
In this shader, we have defined three matrices:
#version 300 esprecision mediump float;uniform mat4 uModelViewMatrix;uniform mat4 uProjectionMatrix;uniform mat4 uNormalMatrix;in vec3 aVertexPosition;in vec3 aVertexNormal;out vec3 vVertexNormal;out vec3 vEyeVector;void main(void) { // Transformed vertex position vec4 vertex = uModelViewMatrix * vec4(aVertexPosition, 1.0); // Transformed normal position vVertexNormal = vec3(uNormalMatrix * vec4(aVertexNormal ...