Skip to content

Instantly share code, notes, and snippets.

@AndrewRayCode
Created July 17, 2015 21:50
Show Gist options
  • Select an option

  • Save AndrewRayCode/35fff50453abf5d0cf4e to your computer and use it in GitHub Desktop.

Select an option

Save AndrewRayCode/35fff50453abf5d0cf4e to your computer and use it in GitHub Desktop.
/* vertex */
uniform mat4 modelMatrix;
varying mat4 matrix;
...
void main() {
vPosition = position;
matrix = modelMatrix;
/* fragment */
uniform vec3 vLightPosition;
varying vec3 vPosition;
varying mat4 matrix;
void main() {
vec3 lightVectorW = normalize(vec3(vec4( vLightPosition, 1.0) * matrix) - vPosition);
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment