mirror of
https://github.com/patriciogonzalezvivo/thebookofshaders
synced 2024-11-15 18:13:59 +00:00
21 lines
488 B
Markdown
21 lines
488 B
Markdown
## Sign
|
|
Extract the sign of the parameter
|
|
|
|
### Declaration
|
|
```glsl
|
|
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.
|
|
|
|
<div class="simpleFunction" data="y = sign(x); "></div>
|
|
|
|
### See Also
|
|
[abs](index.html#abs.md), [Chapter 05: Shaping Functions](../05/) |