Mercurial > repos > blastem
comparison shaders/sharp.f.glsl @ 1856:be1da0a68d1e
Added "sharp" shader
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 27 Apr 2019 17:37:12 -0700 |
parents | |
children | f3cca4b3f17a |
comparison
equal
deleted
inserted
replaced
1855:92532eb6986d | 1856:be1da0a68d1e |
---|---|
1 | |
2 uniform sampler2D textures[2]; | |
3 | |
4 varying mediump vec2 texcoord; | |
5 | |
6 void main() | |
7 { | |
8 mediump float x0 = (floor(texcoord.x * 512.0 - 0.25) + 0.5)/512.0; | |
9 mediump float x1 = (floor(texcoord.x * 512.0 + 0.25) + 0.5)/512.0; | |
10 mediump float y0 = (floor(texcoord.y * 512.0 + 0.25) + 0.5)/512.0; | |
11 mediump float y1 = (floor(texcoord.y * 512.0 - 0.25) + 0.5)/512.0; | |
12 | |
13 | |
14 mediump vec2 modifiedCoord0 = vec2(texcoord.x, (floor(texcoord.y * 512.0 + 0.25) + 0.5)/512.0); | |
15 mediump vec2 modifiedCoord1 = vec2(texcoord.x, (floor(texcoord.y * 512.0 - 0.25) + 0.5)/512.0); | |
16 mediump float ymix = (sin(texcoord.y * 1024.0 * 3.14159265359) + 1.0) * 0.5; | |
17 mediump float xmix = (sin(texcoord.x * 1024.0 * 3.14159265359) + 1.0) * 0.5; | |
18 gl_FragColor = mix( | |
19 mix( | |
20 texture2D(textures[1], vec2(x0, y1)), | |
21 texture2D(textures[0], vec2(x0, y0)), | |
22 ymix | |
23 ), | |
24 mix( | |
25 texture2D(textures[1], vec2(x1, y1)), | |
26 texture2D(textures[0], vec2(x1, y0)), | |
27 ymix | |
28 ), | |
29 xmix | |
30 ); | |
31 } |