blob: c862641f13ad4c8623cb26f4a4d18d6a12cacc15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/*
* light-pp.frag
*
* Lighting per pixel
*
* (c) 2007 Thomas White <taw27@cam.ac.uk>
*
* dtr - Diffraction Tomography Reconstruction
*
*/
varying vec4 col_ambi;
varying vec4 col_diff;
varying vec4 col_spec;
varying float shininess;
varying vec3 normal;
varying vec3 halfvc;
void main() {
vec4 ambi;
vec4 diff;
vec4 spec;
/* Ambient contribution */
ambi = col_ambi * gl_LightModel.ambient;
ambi += col_ambi * gl_LightSource[0].ambient;
/* Diffuse contribution */
diff = col_diff * clamp(dot( vec3(normalize(gl_LightSource[0].position)), normal ), 0.0, 1.0);
/* Specular contribution */
spec = col_spec * pow(dot( vec3(normal), halfvc ), shininess);
gl_FragColor = ambi + diff + spec;
gl_FragColor.a = 1.0;
}
|