thebookofshaders/glossary/sign.md
Patricio Gonzalez Vivo 28f372e311 add glossary
2015-04-17 00:52:51 -04:00

431 B

Sign

Extract the sign of the parameter

float sign(float x)  
vec2 sign(vec2 x)  
vec3 sign(vec3 x)  
vec4 sign(vec4 x)

Parameters

x Specify the value from which to extract the sign.

Description

sign() returns -1.0 if x is less than 0.0, 0.0 if x is equal to 0.0, and +1.0 if x is greater than 0.0.

See Also

abs