2012-04-04 20:26:03 +00:00
|
|
|
uniform sampler2D color_tex;
|
2012-05-09 21:52:26 +00:00
|
|
|
uniform sampler2D ao_tex;
|
2012-04-04 20:26:03 +00:00
|
|
|
uniform sampler2D normal_tex;
|
|
|
|
uniform sampler2D spec_emis_tex;
|
|
|
|
uniform vec4 fg_SunAmbientColor;
|
2012-05-11 22:29:40 +00:00
|
|
|
uniform bool ambientOcclusion;
|
2012-05-18 07:00:48 +00:00
|
|
|
uniform float ambientOcclusionStrength;
|
|
|
|
|
2012-04-04 20:26:03 +00:00
|
|
|
void main() {
|
|
|
|
vec2 coords = gl_TexCoord[0].xy;
|
|
|
|
float initialized = texture2D( spec_emis_tex, coords ).a;
|
|
|
|
if ( initialized < 0.1 )
|
|
|
|
discard;
|
|
|
|
vec3 tcolor = texture2D( color_tex, coords ).rgb;
|
2012-05-11 22:29:40 +00:00
|
|
|
float ao = 1.0;
|
|
|
|
if (ambientOcclusion) {
|
2012-05-18 07:00:48 +00:00
|
|
|
ao = 1.0 - ambientOcclusionStrength * (1.0 - texture2D( ao_tex, coords ).r);
|
2012-05-11 22:29:40 +00:00
|
|
|
}
|
2012-05-18 07:00:48 +00:00
|
|
|
gl_FragColor = vec4(tcolor * fg_SunAmbientColor.rgb * ao, 1.0);
|
2012-04-04 20:26:03 +00:00
|
|
|
}
|