dungeon_crawler

diff prototype/sdr/multi2.p.glsl @ 60:aa86119e3295

added multipass deferred
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 25 Sep 2012 06:19:37 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/prototype/sdr/multi2.p.glsl	Tue Sep 25 06:19:37 2012 +0300
     1.3 @@ -0,0 +1,20 @@
     1.4 +/* multipass renderer shader 2: RGB: diffuse color, A: shininess str. */
     1.5 +
     1.6 +uniform sampler2D tex_dif;
     1.7 +
     1.8 +varying vec3 pos, norm, tang;
     1.9 +
    1.10 +const float fog_start = 3.0;
    1.11 +const float fog_end = 6.0;
    1.12 +
    1.13 +void main()
    1.14 +{
    1.15 +	float fog = clamp((fog_end + pos.z) / (fog_end - fog_start), 0.0, 1.0);
    1.16 +
    1.17 +	vec4 texel = texture2D(tex_dif, gl_TexCoord[0].st);
    1.18 +	vec3 diffuse = fog * (gl_FrontMaterial.diffuse * texel).xyz;
    1.19 +	vec3 spec = fog * gl_FrontMaterial.specular.xyz;
    1.20 +	float sstr = (spec.x + spec.y + spec.z) / 3.0;
    1.21 +
    1.22 +	gl_FragColor = vec4(diffuse, sstr);
    1.23 +}