Fixed rederable_fs.glsl changed after broken merging.

This commit is contained in:
Jonathas Costa
2016-11-11 14:49:23 -05:00
parent cf66bc873b
commit 0bd4e0d160
+34 -2
View File
@@ -46,5 +46,37 @@ in vec4 vs_position;
Fragment getFragment() {
vec4 diffuse = texture(texture1, vs_st);
renderTarget1 = vec4(texture(deltaSTexture, uvw).rgb / phaseFunctionR(nu), 1.0);
}
Fragment frag;
if (_performShading) {
// directional lighting
vec3 origin = vec3(0.0);
vec4 spec = vec4(0.0);
vec3 n = normalize(vs_normal.xyz);
//vec3 e = normalize(camdir);
vec3 l_pos = vec3(sun_pos); // sun.
vec3 l_dir = normalize(l_pos-objpos.xyz);
float intensity = min(max(5*dot(n,l_dir), 0.0), 1);
float shine = 0.0001;
vec4 specular = vec4(0.5);
vec4 ambient = vec4(0.0,0.0,0.0,transparency);
/*
if(intensity > 0.f){
// halfway vector
vec3 h = normalize(l_dir + e);
// specular factor
float intSpec = max(dot(h,n),0.0);
spec = specular * pow(intSpec, shine);
}
*/
diffuse = max(intensity * diffuse, ambient);
}
diffuse[3] = transparency;
frag.color = diffuse;
frag.depth = vs_position.w;
return frag;
}