File: label.vs

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 (49 lines) | stat: -rw-r--r-- 1,607 bytes parent folder | download | duplicates (3)
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

attribute vec4 attr_worldpos;
attribute vec3 attr_screenoffset;
attribute vec2 attr_texcoords;
attribute vec3 attr_screenworldoffset;
attribute vec4 attr_t_pickcolor; // changed name for ATI, optional attribute
                                 // cannot be first/0 index, ATI sets index
                                 // alphabetically
varying vec2 textureLookup ;
varying vec3 normalizedViewCoordinate;
varying vec4 pickcolor ;

uniform vec2 screenSize;
uniform vec2 pixelSize;

uniform float aspectRatioAdjustment;

uniform float screenOriginVertexScale;

varying float fog;
uniform float fog_enabled; // actually bool

void main()
{
  vec4 pos = gl_ModelViewProjectionMatrix * attr_worldpos;
  pos /= pos.w;
  pos.xy += attr_screenworldoffset.xy / (screenSize.xy * screenOriginVertexScale);
  pos.xy += attr_screenoffset.xy * 2. / screenSize * vec2(aspectRatioAdjustment, 1.);

  // rounding to nearest pixel
  pos.xy = (pixelSize * floor((pos.xy + 1.) / pixelSize)) - 1.;

  vec3 viewVector = vec3(gl_ModelViewMatrixTranspose * vec4(0.,0., -1.,0.));
  vec4 a_center = (attr_worldpos + attr_screenworldoffset.z * vec4(viewVector, 0.));
  vec4 transformedPositionZ = gl_ModelViewProjectionMatrix * a_center;
  pos.z = transformedPositionZ.z / transformedPositionZ.w;

  gl_Position = pos;
  textureLookup = attr_texcoords;
  normalizedViewCoordinate = pos.xyz / 2.0 + 0.5;

  if (fog_enabled > 0.5) {
    vec3 eye_pos = vec3(gl_ModelViewMatrix * attr_worldpos);
    fog = max(0.0, (gl_Fog.end - abs(eye_pos.z)) * gl_Fog.scale);
  } else {
    fog = 1.1; // >= 1.0
  }
  pickcolor = attr_t_pickcolor;
}