diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-02-19 22:54:40 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-02-19 22:54:40 -0500 |
commit | e3e5a247c58c6e0b45d81ab61314bd8d1bd530ac (patch) | |
tree | 261c046c1dac2ee0473fae547b9a15b0ee46f0c4 /shaders/final.fragment | |
parent | cd48894563052baeddff64f6bbc13ccc7fa6e081 (diff) | |
download | therapy-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.fragment | 14 |
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; | |||
11 | uniform sampler2D rendertex; | 11 | uniform sampler2D rendertex; |
12 | uniform sampler2D scanlinestex; | 12 | uniform sampler2D scanlinestex; |
13 | 13 | ||
14 | const vec2 UVScalar = vec2(1.0, 1.0); | ||
15 | const vec2 UVOffset = vec2(0.0, 0.0); | ||
16 | const vec2 CRTMask_Scale = vec2(85.0, 153.6)*4.0; | ||
17 | const vec2 CRTMask_Offset = vec2(0.0, 0.0); | ||
18 | const float Tuning_Overscan = 1.08; | 14 | const float Tuning_Overscan = 1.08; |
19 | const float Tuning_Dimming = 0.0; | 15 | const float Tuning_Dimming = 0.0; |
20 | const float Tuning_Satur = 1.0; | 16 | const float Tuning_Satur = 1.0; |
@@ -27,18 +23,18 @@ const float Tuning_Spec_Brightness = 0.35; | |||
27 | const float Tuning_Spec_Power = 50.0; | 23 | const float Tuning_Spec_Power = 50.0; |
28 | const float Tuning_Fres_Brightness = 1.0; | 24 | const float Tuning_Fres_Brightness = 1.0; |
29 | 25 | ||
26 | uniform vec2 resolution; | ||
27 | |||
30 | vec4 sampleCRT(vec2 uv) | 28 | vec4 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); |