Subversion Repositories gelsvn

Rev

Rev 386 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
386 jab 1
#version 120
2
#extension GL_EXT_gpu_shader4 : enable
3
 
4
varying vec3 normal;
5
varying float eig;
6
varying float eig2;
7
uniform float eig_max;
8
uniform float eig_max2;
9
uniform bool do_highlight;
10
uniform bool do_diffuse;
11
const vec3 light_dir = vec3(0,0,1);
12
 
13
void main()
14
{
15
  float dot_ln = dot(light_dir, normal);
16
 
17
  float eig_norm = eig/eig_max;
18
  float stripe_signal = 100 * eig_norm;
19
  vec4 stripe_col = abs(stripe_signal) < 3.14 ? vec4(1,1,0,0) : vec4(.1,.1,.1,0);
20
 
21
  gl_FragColor = eig_norm * vec4(-1,0,1,0);
22
  if(do_diffuse)   gl_FragColor *= dot_ln;
394 jab 23
  if(do_highlight) gl_FragColor += dot_ln*dot_ln*dot_ln*dot_ln*dot_ln*dot_ln*dot_ln*vec4(.5,.5,.5,0);
24
  gl_FragColor += stripe_col * smoothstep(0.8,1.0,cos(stripe_signal));
386 jab 25
}
26
 
27
/*/
28
void main()
29
{
30
 float dot_ln = dot(light_dir, normal);
31
 
32
  float eig_norm = eig/eig_max;
33
  float stripe_signal = 100 * eig_norm;
34
  float eig_norm2 = eig2/eig_max2;
35
  float stripe_signal2 = 60 * eig_norm2;
36
 
37
  bool a = cos(stripe_signal)>0;
38
  bool b = cos(stripe_signal2)>0;
39
  gl_FragColor = vec4(.1,0.6,.2,0) * ((a && b || !a && !b)?1.0:0.0);
40
  if(do_diffuse)   gl_FragColor *= dot_ln;
41
 
42
}*/