home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / share / k3d / shaders / glsl / gooch_vertex.glsl < prev    next >
Encoding:
Text File  |  2008-01-23  |  449 b   |  17 lines

  1. varying float NdotL;
  2. varying vec3 ReflectVec;
  3. varying vec3 ViewVec;
  4.  
  5. void main()
  6. {
  7.     const vec3 LightPosition = vec3(0.0, 10.0, 4.0);
  8.  
  9.     vec3 ecPos = vec3(gl_ModelViewMatrix * gl_Vertex);
  10.     vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal);
  11.     vec3 lightVec = normalize(LightPosition - ecPos);
  12.     ReflectVec = normalize(reflect(-lightVec, tnorm));
  13.     ViewVec = normalize(-ecPos);
  14.     NdotL = (dot(lightVec, tnorm) + 1.0) * 0.5;
  15.     gl_Position = ftransform();
  16. }
  17.