Name Edit

Saturate - returns smallest integer not less than a scalar or each vector component.

Synopsis Edit

vector1 saturate(vector1 v);
vector2 saturate(vector2 v);
vector3 saturate(vector3 v);
vector4 saturate(vector4 v);

Parameters Edit

Vector or scalar to saturate.

Description Edit

Returns v saturated to the range [0,1] as follows

1) Returns 0 if v is less than 0; else

2) Returns 1 if v is greater than 1; else

3) Returns v otherwise.

For vectors, the returned vector contains the saturated result of each element of the vector v saturated to [0,1].