Created
May 29, 2020 15:03
-
-
Save raphaelameaume/c7166932804a7f948d39e353d11ce2e5 to your computer and use it in GitHub Desktop.
Rotate uv in fragment shader
This file contains 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
vec2 uvRotate (vec2 baseUv, float angle, vec2 center) { | |
vec2 uv = baseUv; | |
uv -= center; | |
mat2 m = mat2(cos(angle), -sin(angle), sin(angle), cos(angle)); | |
uv = m * uv; | |
uv += center; | |
return uv; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment