2016-08-03 07:59:29 +00:00
|
|
|
#version 120
|
|
|
|
|
2012-03-25 16:51:41 +00:00
|
|
|
uniform sampler2D lighting_tex;
|
2012-05-12 11:06:45 +00:00
|
|
|
uniform sampler2D bloom_tex;
|
2012-05-18 10:42:34 +00:00
|
|
|
|
|
|
|
uniform sampler2D bufferNW_tex;
|
|
|
|
uniform sampler2D bufferNE_tex;
|
|
|
|
uniform sampler2D bufferSW_tex;
|
|
|
|
uniform sampler2D bufferSE_tex;
|
|
|
|
|
2012-03-25 16:51:41 +00:00
|
|
|
uniform bool showBuffers;
|
2012-05-18 10:42:34 +00:00
|
|
|
|
2012-05-12 11:06:45 +00:00
|
|
|
uniform bool bloomEnabled;
|
2012-06-26 07:02:21 +00:00
|
|
|
uniform float bloomStrength;
|
2012-05-18 10:42:34 +00:00
|
|
|
uniform bool bloomBuffers;
|
|
|
|
|
|
|
|
uniform bool bufferNW_enabled;
|
|
|
|
uniform bool bufferNE_enabled;
|
|
|
|
uniform bool bufferSW_enabled;
|
|
|
|
uniform bool bufferSE_enabled;
|
2012-03-25 16:51:41 +00:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
vec2 coords = gl_TexCoord[0].xy;
|
|
|
|
vec4 color;
|
2012-05-01 07:34:14 +00:00
|
|
|
if (showBuffers) {
|
2012-05-18 10:42:34 +00:00
|
|
|
if (coords.x < 0.2 && coords.y < 0.2 && bufferSW_enabled) {
|
|
|
|
color = texture2D( bufferSW_tex, coords * 5.0 );
|
|
|
|
} else if (coords.x >= 0.8 && coords.y >= 0.8 && bufferNE_enabled) {
|
|
|
|
color = texture2D( bufferNE_tex, (coords - vec2( 0.8, 0.8 )) * 5.0 );
|
|
|
|
} else if (coords.x >= 0.8 && coords.y < 0.2 && bufferSE_enabled) {
|
|
|
|
color = texture2D( bufferSE_tex, (coords - vec2( 0.8, 0.0 )) * 5.0 );
|
|
|
|
} else if (coords.x < 0.2 && coords.y >= 0.8 && bufferNW_enabled) {
|
|
|
|
color = texture2D( bufferNW_tex, (coords - vec2( 0.0, 0.8 )) * 5.0 );
|
2012-05-01 07:34:14 +00:00
|
|
|
} else {
|
2012-05-12 11:06:45 +00:00
|
|
|
color = texture2D( lighting_tex, coords );
|
2012-05-18 10:42:34 +00:00
|
|
|
if (bloomEnabled && bloomBuffers)
|
2012-06-26 07:02:21 +00:00
|
|
|
color = color + bloomStrength * texture2D( bloom_tex, coords );
|
2012-05-01 07:34:14 +00:00
|
|
|
}
|
|
|
|
} else {
|
2012-05-12 11:06:45 +00:00
|
|
|
color = texture2D( lighting_tex, coords );
|
2012-05-18 10:42:34 +00:00
|
|
|
if (bloomEnabled && bloomBuffers)
|
2012-06-26 07:02:21 +00:00
|
|
|
color = color + bloomStrength * texture2D( bloom_tex, coords );
|
2012-05-01 07:34:14 +00:00
|
|
|
}
|
2012-03-25 16:51:41 +00:00
|
|
|
gl_FragColor = color;
|
|
|
|
}
|