Mercurial > repos > blastem
comparison shaders/default.f.glsl @ 1977:f3cca4b3f17a
Allow use of NPOT textures as a config option. Useful for some mobile GPUs
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 09 May 2020 21:15:33 -0700 |
parents | fa9ae059e4d3 |
children |
comparison
equal
deleted
inserted
replaced
1976:3dd9c68472fb | 1977:f3cca4b3f17a |
---|---|
1 | 1 |
2 uniform sampler2D textures[2]; | 2 uniform sampler2D textures[2]; |
3 uniform mediump vec2 texsize; | |
3 | 4 |
4 varying mediump vec2 texcoord; | 5 varying mediump vec2 texcoord; |
5 | 6 |
6 void main() | 7 void main() |
7 { | 8 { |
8 mediump vec2 modifiedCoord0 = vec2(texcoord.x, (floor(texcoord.y * 512.0 + 0.25) + 0.5)/512.0); | 9 mediump vec2 modifiedCoord0 = vec2(texcoord.x, (floor(texcoord.y * texsize.y + 0.25) + 0.5)/texsize.y); |
9 mediump vec2 modifiedCoord1 = vec2(texcoord.x, (floor(texcoord.y * 512.0 - 0.25) + 0.5)/512.0); | 10 mediump vec2 modifiedCoord1 = vec2(texcoord.x, (floor(texcoord.y * texsize.y - 0.25) + 0.5)/texsize.y); |
10 gl_FragColor = mix( | 11 gl_FragColor = mix( |
11 texture2D(textures[1], modifiedCoord1), | 12 texture2D(textures[1], modifiedCoord1), |
12 texture2D(textures[0], modifiedCoord0), | 13 texture2D(textures[0], modifiedCoord0), |
13 (sin(texcoord.y * 1024.0 * 3.14159265359) + 1.0) * 0.5 | 14 (sin(texcoord.y * texsize.y * 6.283185307) + 1.0) * 0.5 |
14 ); | 15 ); |
15 } | 16 } |