File: surface.vs

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 (64 lines) | stat: -rw-r--r-- 1,889 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include webgl_header.vs

uniform bool isPicking;

attribute vec4 a_Vertex;
attribute vec3 a_Normal;
attribute vec4 a_Color;
attribute float a_Accessibility; /* This is for ambient occlusion, 1.0 by default */

varying vec3 packed_data_0 ;
varying vec4 packed_data_1 ;
varying vec4 packed_data_2 ;
varying vec4 packed_data_4 ;

//varying vec3 N;
#define NORMAL  packed_data_0

#ifdef PURE_OPENGL_ES_2
varying vec4 COLOR;
#else
// using the built-in allows to use glShadeModel
#define COLOR gl_FrontColor
#endif

//#define fog packed_data_1.w
#define E 2.718281828459045
/* this doesn't work for setting fog_color, need to set the values independently */
//#define fog_color ( packed_data_1.x, packed_data_1.y, packed_data_1.z )

varying float fog;
varying vec2 bgTextureLookup;

uniform bool lighting_enabled;

uniform float ambient_occlusion_scale;
uniform int accessibility_mode;
uniform float accessibility_mode_on;

void main()
{
  NORMAL = normalize(g_NormalMatrix * a_Normal);
  vec3 eye_pos = vec3(g_ModelViewMatrix * a_Vertex);

#ifdef PYMOL_WEBGL_IOS
  gl_PointSize = g_PointSize;
#endif

  if (isPicking){
    COLOR = a_Color; // no lighting
  } else {
    vec4 COLORa;
    if (accessibility_mode == 1){
      COLORa = vec4(clamp(a_Color.xyz * (1.-(ambient_occlusion_scale*a_Accessibility)), 0., 1.), a_Color.w);
    } else if (accessibility_mode == 2){
      COLORa = vec4(a_Color.xyz * cos(90.*radians(clamp(ambient_occlusion_scale*a_Accessibility, 0., 1.))), a_Color.w);
    } else {
      COLORa = vec4(clamp(a_Color.xyz * (1. / (1. + pow(E, 0.5 * ( (ambient_occlusion_scale * a_Accessibility) - 10.)))), 0., 1.), a_Color.w);
    }
    COLOR = mix(a_Color, COLORa, accessibility_mode_on);
    fog = (g_Fog_end + eye_pos.z) * g_Fog_scale;
  }
  gl_Position = g_ProjectionMatrix * g_ModelViewMatrix * a_Vertex;
  bgTextureLookup = (gl_Position.xy/gl_Position.w) / 2.0 + 0.5;
}