/* vi: set ft=glsl */ #ifdef USE_TEXMAP uniform sampler2D texmap; #endif uniform sampler2D lightmap; #ifdef USE_MIRROR uniform sampler2D mirrortex; uniform vec2 mirtex_offs; 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_offs) * 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; }