Graphics Reference
In-Depth Information
Table B-3
Common Functions
(continued)
Syntax
Description
genType
step
(genType
edge,
genType
x
)
genType
step
float
edge,
genType
x
)
Returns 0.0 if
x
<
edge
; otherwise, it
returns 1.0.
genType
smoothstep
(genType
edge0,
genType
edgel,
genType
x
)
genType
smoothstep
float
edge0,
loat
edgel,
gemType
x
)
Returns 0.0 if
x
<=
edge0
and 1.0 if
x
>=
edgel
and performs smooth Hermite
interpolation between 0 and 1 when
edge0
<
x
<
edgel.
This is useful in cases where
you would want a threshold function with
a smooth transition. This is equivalent to:
/ / genType is float, vec2, vec3,
/ / or vec4
genType t;
t = clamp((x - edge0)/
(edgel - edge0), 0, 1);
return t * t * (3 − 2 * t);
Results are undefined if
edge0
>=
edgel
.
genBType
isnan
(genType
x
)
Returns
true
if
x
holds a NaN. Returns
false
otherwise.
genBType
isinf
(genType
x
)
Returns
true
if
x
holds a positive infinity
or negative infinity. Returns
false
otherwise.
genIType
floatBitsToInt
(genType
value
)
genUType
floatBitsToUint
(genType
value
)
Returns a signed or unsigned highp
integer value representing the encoding
of a floating-point value. For highp
floating point, the value's bit-level
representation is preserved. For
mediump and lowp, the value is first
converted to highp floating point and
the encoding of that value is returned.
genType
intBitsToFloat
(genIType
value
)
genType
uintBitsToFloat
(genUType
Returns a highp floating-point value
corresponding to a signed or unsigned
integer encoding of a floating-point value.
If an inf or NaN is passed in, it will not
signal, and the resulting floating-point
value is unspecified. Otherwise, the bit-
level representation is preserved. For lowp
and mediump, the value is first converted
to the corresponding signed or unsigned
highp integer and then reinterpreted as a
highp floating-point value as before.
value
)