You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
490 B
Markdown
21 lines
490 B
Markdown
10 years ago
|
## Sign
|
||
|
Extract the sign of the parameter
|
||
|
|
||
10 years ago
|
### Declaration
|
||
10 years ago
|
```glsl
|
||
|
float sign(float x)
|
||
|
vec2 sign(vec2 x)
|
||
|
vec3 sign(vec3 x)
|
||
|
vec4 sign(vec4 x)
|
||
|
```
|
||
|
|
||
|
### Parameters
|
||
10 years ago
|
```x``` specify the value from which to extract the sign.
|
||
10 years ago
|
|
||
|
### 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
|
||
9 years ago
|
[abs](/glossary/?search=abs), [Chapter 05: Shaping Functions](/05/)
|