Debian Codegraph @

shaders/symmplane.frag

raw
1 #version 330
2 in vec3 Normal;
3 in float col;
4 in float transparent;
5
6 uniform vec4 Color[18];
7 uniform vec3 lightPos;
8 uniform float planeTransparence=0.2;
9
10 out vec4 fragColor;
11
12 vec3 blinnPhongDirectional( vec3 n , vec3 kd) {
13 vec3 ambient = kd * 0.5;//Light.La * Material.Ka;
14 vec3 intensity = vec3(0.8, 0.8, 0.8);
15 vec3 s = normalize(lightPos);// directional light
16 float sDotN = abs(dot(s, n));
17 vec3 diffuse = kd * sDotN;
18 vec3 spec = vec3(0.0);
19 float Shininess = 48.0;
20 if (sDotN > 0.0) {
21 spec = vec3(1,1,1) * pow(max(dot(s,n), 0.0), Shininess);
22 }
23 return ambient + intensity * (diffuse + spec);
24 }
25
26 void main( void ){
27 int coli = int(col+0.5);
28 //fragColor = vec4(Color[coli].rgb,1);
29 fragColor = vec4(blinnPhongDirectional( Normal, Color[coli].rgb), (transparent>0.5)?planeTransparence:1.0);
30 }