File: line.fs

package info (click to toggle)
pymol 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 74,084 kB
  • sloc: cpp: 482,660; python: 89,328; ansic: 29,512; javascript: 6,792; sh: 84; makefile: 25
file content (43 lines) | stat: -rw-r--r-- 1,118 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
#include webgl_header.fs

//#ifndef use_geometry_shaders

#define bgTextureLookup a_bgTextureLookup

varying vec3 a_NORMAL ;
varying vec4 a_COLOR ;
varying vec4 a_COLOR2 ;
varying vec4 a_COLOR_INTERP ;
varying float a_INTERPOLATE;
varying float a_LINE_POSITION;
varying float a_fog;
varying vec2 a_bgTextureLookup;
 
uniform bool lighting_enabled;
uniform bool two_sided_lighting_enabled;

#include anaglyph_header.fs
#include compute_fog_color.fs
#include compute_color_for_light.fs

void main()
{
  float whichColor = step(.5, a_LINE_POSITION);
  vec4 color_step = whichColor * a_COLOR2 / a_LINE_POSITION + (1.-whichColor) * a_COLOR / (1.-a_LINE_POSITION);
  vec4 icolor = a_INTERPOLATE * a_COLOR_INTERP + (1.-a_INTERPOLATE) * color_step;
  vec4 color = ApplyColorEffects(icolor, gl_FragCoord.z);
  if (!isPicking && lighting_enabled){
    vec3 normal = a_NORMAL;
    if (two_sided_lighting_enabled){
       bool ff = gl_FrontFacing ? true : false;
       if (!ff)
          normal = -normal;
    }
    color = ApplyLighting(color, normal);
  }

  gl_FragColor = ApplyFog(color, a_fog);

  PostLightingEffects();
}