summary refs log tree commit diff stats
path: root/shaders/final.fragment
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-02-19 22:54:40 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-02-19 22:54:40 -0500
commite3e5a247c58c6e0b45d81ab61314bd8d1bd530ac (patch)
tree261c046c1dac2ee0473fae547b9a15b0ee46f0c4 /shaders/final.fragment
parentcd48894563052baeddff64f6bbc13ccc7fa6e081 (diff)
downloadtherapy-e3e5a247c58c6e0b45d81ab61314bd8d1bd530ac.tar.gz
therapy-e3e5a247c58c6e0b45d81ab61314bd8d1bd530ac.tar.bz2
therapy-e3e5a247c58c6e0b45d81ab61314bd8d1bd530ac.zip
Added ability to resize window (full screen is really laggy though!)
Diffstat (limited to 'shaders/final.fragment')
-rw-r--r--shaders/final.fragment14
1 files changed, 5 insertions, 9 deletions
diff --git a/shaders/final.fragment b/shaders/final.fragment index 7eeb78e..4a51ad3 100644 --- a/shaders/final.fragment +++ b/shaders/final.fragment
@@ -11,10 +11,6 @@ out vec3 color;
11uniform sampler2D rendertex; 11uniform sampler2D rendertex;
12uniform sampler2D scanlinestex; 12uniform sampler2D scanlinestex;
13 13
14const vec2 UVScalar = vec2(1.0, 1.0);
15const vec2 UVOffset = vec2(0.0, 0.0);
16const vec2 CRTMask_Scale = vec2(85.0, 153.6)*4.0;
17const vec2 CRTMask_Offset = vec2(0.0, 0.0);
18const float Tuning_Overscan = 1.08; 14const float Tuning_Overscan = 1.08;
19const float Tuning_Dimming = 0.0; 15const float Tuning_Dimming = 0.0;
20const float Tuning_Satur = 1.0; 16const float Tuning_Satur = 1.0;
@@ -27,18 +23,18 @@ const float Tuning_Spec_Brightness = 0.35;
27const float Tuning_Spec_Power = 50.0; 23const float Tuning_Spec_Power = 50.0;
28const float Tuning_Fres_Brightness = 1.0; 24const float Tuning_Fres_Brightness = 1.0;
29 25
26uniform vec2 resolution;
27
30vec4 sampleCRT(vec2 uv) 28vec4 sampleCRT(vec2 uv)
31{ 29{
32 vec2 ScaledUV = uv; 30 vec2 CRTMask_Scale = resolution / vec2(6.0, 5.0);
33 ScaledUV *= UVScalar;
34 ScaledUV += UVOffset;
35 31
36 vec2 scanuv = ScaledUV * CRTMask_Scale; 32 vec2 scanuv = uv * CRTMask_Scale;
37 vec3 scantex = texture(scanlinestex, scanuv).rgb; 33 vec3 scantex = texture(scanlinestex, scanuv).rgb;
38 scantex += Tuning_Scanline_Brightness; 34 scantex += Tuning_Scanline_Brightness;
39 scantex = mix(vec3(1,1,1), scantex, Tuning_Scanline_Opacity); 35 scantex = mix(vec3(1,1,1), scantex, Tuning_Scanline_Opacity);
40 36
41 vec2 overscanuv = (ScaledUV * Tuning_Overscan) - ((Tuning_Overscan - 1.0f) * 0.5f); 37 vec2 overscanuv = (uv * Tuning_Overscan) - ((Tuning_Overscan - 1.0f) * 0.5f);
42 overscanuv = overscanuv - vec2(0.5, 0.5); 38 overscanuv = overscanuv - vec2(0.5, 0.5);
43 float rsq = (overscanuv.x*overscanuv.x) + (overscanuv.y*overscanuv.y); 39 float rsq = (overscanuv.x*overscanuv.x) + (overscanuv.y*overscanuv.y);
44 overscanuv = overscanuv + (overscanuv * (Tuning_Barrel * rsq)) + vec2(0.5,0.5); 40 overscanuv = overscanuv + (overscanuv * (Tuning_Barrel * rsq)) + vec2(0.5,0.5);