mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-30 07:31:13 +00:00
362d8f820f
added r_part_classic_square, cl_demoreel. fixed a couple of things that the ever vigilant gb spotted. I guess I don't play quake enough. fixed a load of random warnings reported by gcc. many many many warnings remain. I got bored. internal mrt feature implemented, not properly tested yet. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4719 fc73d0e0-1445-4013-8a0c-d673dee63da5
34 lines
894 B
GLSL
34 lines
894 B
GLSL
//the final defered lighting pass.
|
|
//the lighting values were written to some render target, which is fed into this shader, and now we draw all the wall textures with it.
|
|
|
|
varying vec2 tc, lm;
|
|
varying vec4 tf;
|
|
#ifdef VERTEX_SHADER
|
|
attribute vec2 v_texcoord;
|
|
attribute vec2 v_lmcoord;
|
|
void main ()
|
|
{
|
|
tc = v_texcoord;
|
|
lm = v_lmcoord;
|
|
gl_Position = tf = ftetransform();
|
|
}
|
|
#endif
|
|
#ifdef FRAGMENT_SHADER
|
|
uniform sampler2D s_t0;
|
|
uniform sampler2D s_t1;
|
|
uniform sampler2D s_t2;
|
|
uniform vec4 e_lmscale;
|
|
void main ()
|
|
{
|
|
vec2 nst;
|
|
nst = tf.xy / tf.w;
|
|
nst = (1.0 + nst) / 2.0;
|
|
vec4 l = texture2D(s_t0, nst)*5.0;
|
|
vec4 c = texture2D(s_t1, tc);
|
|
vec3 lmsamp = texture2D(s_t2, lm).rgb*e_lmscale;
|
|
vec3 diff = l.rgb;
|
|
vec3 chrom = diff / (0.001 + dot(diff, vec3(0.3, 0.59, 0.11)));
|
|
vec3 spec = chrom * l.a;
|
|
gl_FragColor = vec4((diff + lmsamp) * c.xyz, 1.0);
|
|
}
|
|
#endif
|