2014-05-02 07:54:23 -04:00
|
|
|
#ifdef UBO_DISABLED
|
|
|
|
uniform mat4 ViewMatrix;
|
|
|
|
uniform mat4 ProjectionMatrix;
|
|
|
|
uniform mat4 InverseViewMatrix;
|
|
|
|
uniform mat4 InverseProjectionMatrix;
|
2014-05-19 11:57:31 -04:00
|
|
|
uniform vec2 screen;
|
2014-05-02 07:54:23 -04:00
|
|
|
#else
|
2014-04-10 11:34:57 -04:00
|
|
|
layout (std140) uniform MatrixesData
|
|
|
|
{
|
|
|
|
mat4 ViewMatrix;
|
|
|
|
mat4 ProjectionMatrix;
|
|
|
|
mat4 InverseViewMatrix;
|
|
|
|
mat4 InverseProjectionMatrix;
|
|
|
|
mat4 ShadowViewProjMatrixes[4];
|
2014-05-16 20:39:55 -04:00
|
|
|
vec2 screen;
|
2014-04-10 11:34:57 -04:00
|
|
|
};
|
2014-05-02 07:54:23 -04:00
|
|
|
#endif
|
2014-04-10 11:34:57 -04:00
|
|
|
|
2014-02-26 15:53:29 -05:00
|
|
|
uniform samplerCube tex;
|
2014-02-28 11:29:05 -05:00
|
|
|
|
|
|
|
#if __VERSION__ >= 130
|
2014-02-26 15:53:29 -05:00
|
|
|
out vec4 FragColor;
|
2014-02-28 11:29:05 -05:00
|
|
|
#else
|
|
|
|
#define FragColor gl_FragColor
|
|
|
|
#endif
|
|
|
|
|
2014-02-26 15:53:29 -05:00
|
|
|
|
|
|
|
void main(void)
|
|
|
|
{
|
|
|
|
vec3 eyedir = gl_FragCoord.xyz / vec3(screen, 1.);
|
|
|
|
eyedir = 2.0 * eyedir - 1.0;
|
2014-04-10 11:34:57 -04:00
|
|
|
vec4 tmp = (InverseViewMatrix * InverseProjectionMatrix * vec4(eyedir, 1.));
|
2014-02-26 15:53:29 -05:00
|
|
|
eyedir = tmp.xyz / tmp.w;
|
|
|
|
vec4 color = texture(tex, eyedir);
|
2014-04-21 18:44:08 -04:00
|
|
|
FragColor = vec4(color.xyz, 1.);
|
2014-02-26 15:53:29 -05:00
|
|
|
}
|