Add a workaround for skybox.

The problem was with shader-based pipeline with disabled "advanced effects" in options.

In this case we don't use RTTs and gl_FragCoord contains values in range of whole window. So fo 2 players we still get gl_FragCoord.y = 0..window_size instead of gl_FragCoord.y = 0..window_size/2.

The easiest way to solve it seems to be modulo it by current viewport size. It should be compatible with advanced pipeline as well as single-player games.

Atm. I'm not sure if this should be applied to 0.9.2 branch. It should work fine, but needs some testing.
This commit is contained in:
Deve 2016-05-08 21:38:24 +02:00
parent bb01c83d6e
commit 58f7424b4f

View File

@ -4,7 +4,7 @@ out vec4 FragColor;
void main(void)
{
vec3 eyedir = vec3(gl_FragCoord.xy / screen, 1.);
vec3 eyedir = vec3(mod(gl_FragCoord.xy, screen) / screen, 1.);
eyedir = 2.0 * eyedir - 1.0;
vec4 tmp = (InverseProjectionMatrix * vec4(eyedir, 1.));
tmp /= tmp.w;