Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uniform vec3 cam_pos;
- /* uniform vec4 diff_color, spec_color, ambient_color; */
- uniform float spec_power;
- varying vec4 light;
- varying vec4 ambient, diff, spec;
- void main (void)
- {
- vec3 p = vec3(gl_ModelViewMatrix * gl_Vertex),
- v = normalize(cam_pos - p),
- n = normalize(gl_NormalMatrix * gl_Normal),
- r = reflect(-v, n),
- l = normalize(gl_LightSource[0].position.xyz - p);
- /* vec4 ambient, diff, spec; */
- /* gl_FrontMaterial.shininess */
- ambient = gl_FrontLightProduct[0].ambient;
- diff = gl_FrontLightProduct[0].diffuse * max(dot(n, l), 0.0);
- diff = clamp(diff, 0.0, 1.0);
- spec = /* vec4(vec3(gl_FrontLightProduct[0].specular) */
- /* * */vec4(pow(max(dot(l, r), 0.0), 0.3 * spec_power))/* , 1) */;
- spec = clamp(spec, 0.0, 1.0);
- light = ambient + diff + spec;
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- }
Add Comment
Please, Sign In to add comment