diff options
| author | vaxerski <vaxry@vaxry.net> | 2023-04-04 14:49:58 +0100 |
|---|---|---|
| committer | vaxerski <vaxry@vaxry.net> | 2023-04-04 14:50:03 +0100 |
| commit | 7d9977d02815d3111b8cb97da4695d1c39f4d808 (patch) | |
| tree | 9e242ccc4830b0992b6c9d477d668f47c4f69131 /src/render/shaders | |
| parent | 882be7765b820d075bbeecde12695f1696f577cf (diff) | |
debug: added manual_crash
Diffstat (limited to 'src/render/shaders')
| -rw-r--r-- | src/render/shaders/Textures.hpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/render/shaders/Textures.hpp b/src/render/shaders/Textures.hpp index 52e77fae..097c30a8 100644 --- a/src/render/shaders/Textures.hpp +++ b/src/render/shaders/Textures.hpp @@ -258,3 +258,36 @@ void main() { gl_FragColor = pixColor * alpha; } )#"; + +static const std::string FRAGGLITCH = R"#( +precision mediump float; +varying vec2 v_texcoord; +uniform sampler2D tex; +uniform float time; +uniform float distort; +uniform vec2 screenSize; + +float rand(float co){ + return fract(sin(dot(vec2(co, co), vec2(12.9898, 78.233))) * 43758.5453); +} + +void main() { + float ABERR_OFFSET = 4.0 * (distort / 5.5); + float TEAR_AMOUNT = 9000.0 * (1.0 - (distort / 5.5)); + float TEAR_BANDS = 108.0 / 2.0 * (distort / 5.5) * 2.0; + + float offset = (mod(rand(floor(v_texcoord.y * TEAR_BANDS)) * 318.772 * time, 20.0) - 10.0) / TEAR_AMOUNT; + + vec2 pixCoord = vec2(v_texcoord.x + offset, v_texcoord.y); + vec4 pixColor = texture2D(tex, pixCoord); + vec4 pixColorLeft = texture2D(tex, pixCoord + vec2(ABERR_OFFSET / screenSize.x, 0)); + vec4 pixColorRight = texture2D(tex, pixCoord + vec2(-ABERR_OFFSET / screenSize.x, 0)); + + pixColor[0] = pixColorLeft[0]; + pixColor[2] = pixColorRight[2]; + + pixColor[0] += distort / 90.0; + + gl_FragColor = pixColor; +} +)#";
\ No newline at end of file |
