File: default.fs

package info (click to toggle)
pymol 1.7.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 42,668 kB
  • ctags: 25,775
  • sloc: ansic: 494,779; python: 75,446; cpp: 20,088; makefile: 351; sh: 172; csh: 21
file content (44 lines) | stat: -rw-r--r-- 982 bytes parent folder | download | duplicates (4)
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
41
42
43
44
varying vec3 N, L0, H0, L1, H1;
varying vec4 D0, A0, D1, A1;

uniform float fog_r;
uniform float fog_g;
uniform float fog_b;
uniform float fog_enabled;

uniform bool lighting_enabled;

varying float fog;

void main()
{
  vec3 n, h;
  float NdotL, NdotH;
  vec4 color;
  n = normalize(N);
  NdotL = max(dot(n, normalize(L0)), 0.0);
  float shininess = gl_FrontMaterial.shininess;

  color = A0;

  if (lighting_enabled){
    color = A0 + A1;
    if (NdotL > 0.0) {
      color += D0 * NdotL;
      h = normalize(H0);
      NdotH = max(dot(n, h), 0.0);
      color += gl_LightSource[0].specular * pow(NdotH, shininess);
    }
    NdotL = max(dot(n, normalize(L1)), 0.0);
    if (NdotL > 0.0) {
      color += D1 * NdotL;
      h = normalize(H1);
      NdotH = max(dot(n, h), 0.0);
      color += gl_LightSource[1].specular * pow(NdotH, shininess);
    }
  }

  float cfog = mix(1.0, clamp(fog, 0.0, 1.0), fog_enabled);
  gl_FragColor = vec4(mix(color.rgb, fog_color, cfog), A0.a);
}