all repos — mgba @ d119fc0fe312978802f5b5d30ecc24522108248f

mGBA Game Boy Advance Emulator

res/shaders/vignette.shader/vignette.fs (view raw)

 1/*
 2   Vignette Shader
 3
 4   Copyright (C) 2017 Dominus Iniquitatis - zerosaiko@gmail.com
 5
 6   Permission is hereby granted, free of charge, to any person obtaining a copy
 7   of this software and associated documentation files (the "Software"), to deal
 8   in the Software without restriction, including without limitation the rights
 9   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10   copies of the Software, and to permit persons to whom the Software is
11   furnished to do so, subject to the following conditions:
12   The above copyright notice and this permission notice shall be included in
13   all copies or substantial portions of the Software.
14   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20   THE SOFTWARE.
21*/
22
23uniform sampler2D tex;
24uniform vec2 texSize;
25varying vec2 texCoord;
26
27uniform float intensity;
28
29void main()
30{
31	vec4 color = texture2D(tex, texCoord);
32	color = mix(color, vec4(0.0, 0.0, 0.0, 1.0), length(texCoord - 0.5) * intensity);
33
34	gl_FragColor = color;
35}