diff options
Diffstat (limited to 'src/fshader_post.glsl')
-rw-r--r-- | src/fshader_post.glsl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/fshader_post.glsl b/src/fshader_post.glsl index 6e8a66f..c44371a 100644 --- a/src/fshader_post.glsl +++ b/src/fshader_post.glsl @@ -1,10 +1,16 @@ uniform sampler2D u_main_texture; uniform sampler2D u_menu_texture; uniform float u_paused; +uniform float u_aspect_ratio; +uniform float u_menu_scale; IN vec2 uv; void main() { vec4 color = texture(u_main_texture, uv) * (1.0 - 0.5 * u_paused); - color += texture(u_menu_texture, uv).xxxx * u_paused; + vec2 menu_uv = (uv * 2.0 - 1.0) * vec2(1.0, -1.0); + menu_uv *= 1.0 / u_menu_scale; + menu_uv = menu_uv * vec2(u_aspect_ratio, 1.0); + menu_uv = 0.5 * menu_uv + 0.5; + color = mix(color, vec4(1.0), u_paused * texture(u_menu_texture, menu_uv).x); gl_FragColor = clamp(color, 0.0, 1.0); } |