Last active
July 6, 2021 06:53
-
-
Save SabinT/623d95550f79c21d19b76ef4ebfb18db to your computer and use it in GitHub Desktop.
GLSL texture wrapping/repeating
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
vec2 clamp(vec2 p) { | |
return clamp(p, 0, 1); | |
} | |
vec2 repeat(vec2 p) { | |
return fract(p); | |
} | |
vec2 mirrorRepeat(vec2 p) { | |
vec2 q = fract(p * 0.5) * 2.0; | |
return 1 - abs(q - 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment