1.0.0 • Published 11 years ago
glsl-range v1.0.0
glsl-range 
The opposite of mix in GLSL: pass in a min/max/actual value and recieve a range value describing how far the actual is between min and max.
Another way to describe it would be:
c == mix(a, b, t);
t == range(a, b, c);Usage
float range(float min, float max, float value)
vec2 range(vec2 min, vec2 max, vec2 value)
vec3 range(vec3 min, vec3 max, vec3 value)
vec4 range(vec4 min, vec4 max, vec4 value)
Returns how far a value is between min and max. For example:
- If
valueis equal tomin, you'll get0.0in return. - If
valueis equal tomax, you'll get1.0in return. - If
valueis halfway betweenminandmax, you'll get0.5in return.
License
MIT. See LICENSE.md for details.
1.0.0
11 years ago
