Subversion Repositories gelsvn

Rev

Rev 393 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#version 120
#extension GL_EXT_gpu_shader4 : enable

varying vec3 normal;
varying float eig;
varying float eig2;
uniform float eig_max;
uniform float eig_max2;
uniform bool do_highlight;
uniform bool do_diffuse;
const vec3 light_dir = vec3(0,0,1);

void main()
{
  float dot_ln = dot(light_dir, normal);

  float eig_norm = eig/eig_max;
  float stripe_signal = 100 * eig_norm;
  vec4 stripe_col = abs(stripe_signal) < 3.14 ? vec4(1,1,0,0) : vec4(.1,.1,.1,0);

  gl_FragColor = eig_norm * vec4(-1,0,1,0);
  if(do_diffuse)   gl_FragColor *= dot_ln;
  if(do_highlight) gl_FragColor += dot_ln*dot_ln*dot_ln*dot_ln*dot_ln*dot_ln*dot_ln*vec4(.5,.5,.5,0);
  gl_FragColor += stripe_col * smoothstep(0.8,1.0,cos(stripe_signal));
}

/*/
void main()
{
 float dot_ln = dot(light_dir, normal);

  float eig_norm = eig/eig_max;
  float stripe_signal = 100 * eig_norm;
  float eig_norm2 = eig2/eig_max2;
  float stripe_signal2 = 60 * eig_norm2;

  bool a = cos(stripe_signal)>0;
  bool b = cos(stripe_signal2)>0;
  gl_FragColor = vec4(.1,0.6,.2,0) * ((a && b || !a && !b)?1.0:0.0);
  if(do_diffuse)   gl_FragColor *= dot_ln;

}*/

Generated by GNU Enscript 1.6.6.