From 405378c467bd3b73532bb6a0ea45ff6bf712f539 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Sun, 18 Mar 2018 14:47:08 +0200 Subject: [PATCH] forgot to add the new shader --- sdr/lightmap.p.glsl | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 sdr/lightmap.p.glsl diff --git a/sdr/lightmap.p.glsl b/sdr/lightmap.p.glsl new file mode 100644 index 0000000..37b2abb --- /dev/null +++ b/sdr/lightmap.p.glsl @@ -0,0 +1,32 @@ +/* vi: set ft=glsl */ +#ifdef USE_TEXMAP +uniform sampler2D texmap; +#endif +uniform sampler2D lightmap; +#ifdef USE_MIRROR +uniform sampler2D mirrortex; +uniform vec2 mirtex_scale; +uniform float reflectivity; +#endif + +void main() +{ + vec3 lumel = texture2D(lightmap, gl_TexCoord[1].st).rgb; + +#ifdef USE_TEXMAP + vec3 texel = texture2D(texmap, gl_TexCoord[0].st).rgb; + vec3 ambient = gl_LightModel.ambient.rgb * texel; + vec3 diffuse = lumel * texel * 1.8; +#else + vec3 ambient = gl_LightModel.ambient.rgb * gl_FrontMaterial.diffuse.rgb; + vec3 diffuse = gl_FrontMaterial.diffuse.rgb * lumel * 1.8; +#endif + +#ifdef USE_MIRROR + vec3 refl = texture2D(mirrortex, gl_FragCoord.xy * mirtex_scale).rgb; + diffuse += refl * reflectivity; // just add it to diffuse until we get another source of specularity +#endif + + gl_FragColor.rgb = ambient + diffuse; + gl_FragColor.a = gl_FrontMaterial.diffuse.a; +} -- 1.7.10.4