Skip to content

Instantly share code, notes, and snippets.

@defmech
Forked from companje/map.glsl
Created October 24, 2019 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save defmech/7e61c3296bdf4fc73e688c8e94835905 to your computer and use it in GitHub Desktop.
Save defmech/7e61c3296bdf4fc73e688c8e94835905 to your computer and use it in GitHub Desktop.
map() function for GLSL known from Processing & openFrameworks
float map(float value, float min1, float max1, float min2, float max2) {
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment