Skip to content

Instantly share code, notes, and snippets.

@raphaelameaume
Created May 29, 2020 15:03
Show Gist options
  • Save raphaelameaume/c7166932804a7f948d39e353d11ce2e5 to your computer and use it in GitHub Desktop.
Save raphaelameaume/c7166932804a7f948d39e353d11ce2e5 to your computer and use it in GitHub Desktop.
Rotate uv in fragment shader
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