Last active
July 28, 2021 16:51
-
-
Save nikp123/21ebb38f86f56a151318055bb02e4d55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// input vertex | |
attribute vec4 pos; | |
// foreground color | |
uniform vec4 color; | |
// screen width and height | |
uniform vec2 u_resolution; | |
// projection matrix precalculated by XAVA | |
uniform mat4 projectionMatrix; | |
// output color used by the fragment shader | |
varying vec4 v_color; | |
const float pi = 3.141592653589793; | |
void main() { | |
vec4 mpos = pos*projectionMatrix; | |
mpos.y += 1.0; | |
mpos.y /= 2.0*1.41; | |
mpos.x += 1.0; | |
mpos.x /= 2.0; | |
float angle = pi*(mpos.x*2.0); | |
mpos.x = cos(angle)*mpos.y-sin(angle)*mpos.y; | |
mpos.y = sin(angle)*mpos.y+cos(angle)*mpos.y; | |
gl_Position = mpos; | |
v_color = color; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
well we all miss the obvious things dont we