1 /*
  2   Copyright (c) 2008 Seneca College
  3   Licenced under the MIT License (http://www.c3dl.org/index.php/mit-license/)
  4 */
  5 
  6 c3dl.gooch_vs =
  7 
  8 "varying vec3 ViewVec;" +
  9 "varying vec3 ecPos;" +
 10 "varying vec3 tnorm;" +
 11 
 12 "attribute vec3 Vertex;" + 
 13 "attribute vec3 Normal;" + 
 14 "attribute vec3 dummyAttrib;" +
 15 
 16 "uniform mat4 modelViewMatrix;" +
 17 "uniform mat4 modelViewProjMatrix;" +
 18 "uniform mat4 normalMatrix;" + 
 19 
 20 "void main(void){" + 
 21 
 22 // Dummy attrib so safari and chrome render
 23 // this object properly.
 24 " vec3 dummy = dummyAttrib;" +
 25 
 26 "	mat3 normalMatrix3x3 = mat3(normalMatrix[0][0],normalMatrix[0][1],normalMatrix[0][2],normalMatrix[1][0],normalMatrix[1][1],normalMatrix[1][2],normalMatrix[2][0],normalMatrix[2][1],normalMatrix[2][2]);" + 
 27 
 28 	// ecPos = vertex in eye coordinate space.
 29 "	ecPos = vec3(modelViewMatrix * vec4(Vertex,1.0));" +
 30 "	tnorm = normalize(normalMatrix3x3 * Normal);" + 
 31 
 32 	// a normalized vector pointing from the vector to the light
 33 
 34 "	ViewVec = normalize(-ecPos);" +
 35 
 36 "	gl_Position =  modelViewProjMatrix * vec4(Vertex, 1.0);" +
 37 "	gl_FrontColor = vec4(0.0, 0.0, 1.0, 1.0); "+
 38 "}";
 39