The following methods are all part of the func_common methods.
It contains common GLSL functions.
- abs function
- ceil function
- clamp function
- floatBitsToInt function
- floatBitsToUint function
- floor function
- fma function
- fmax function
- fmin function
- fract function
- frexp function
- intBitsToFloat function
- isinf function
- isnan function
- ldexp function
- max function
- min function
- mix function
- mod function
- modf function
- round function
- roundEven function
- sign function
- smoothstep function
- step function
- trunc function
- uintBitsToFloat function
Returns x
if x >= 0
; otherwise it returns -x
.
For each component c
of x
,
Returns c
if c >= 0
; otherwise it returns -c
.
Returns a value equal to the nearest integer that is greater than or equal to x
.
For each component c
of x
,
Returns a value equal to the nearest integer that is greater than or equal to c
.
Returns min(max(x, minVal), maxVal)
.
Returns min(max(x, minVal), maxVal)
for each component in x
using the floating-point values
minVal
and maxVal
.
Returns min(max(x, minVal), maxVal)
for each component in x
using the floating-point values
minVal
and maxVal
.
Returns a signed integer value representing the encoding of a floating-point value.
The floating-point value's bit-level representation is preserved.
Returns a signed integer value representing the encoding of a floating-point value.
The floating-point value's bit-level representation is preserved.
Returns an unsigned integer value representing the encoding of a floating-point value.
The floating-point value's bit-level representation is preserved.
Returns an unsigned integer value representing the encoding of a floating-point value.
The floating-point value's bit-level representation is preserved.
Returns a value equal to the nearest integer that is less then or equal to x
.
For each component c
of v
:
Returns a value equal to the nearest integer that is less then or equal to c
.
Computes and returns a * b + c
.
Returns y
if x < y
; otherwise, it returns x
. If one of the two arguments is NaN
, the value
of the other argument is returned.
For each component c
of x
:
Returns y
if c < y
; otherwise, it returns c
. If one of the two arguments is NaN
, the value
of the other argument is returned.
For every index i
:
Returns y[i]
if x[i] < y[i]
; otherwise, it returns x[i]
. If one of the two arguments is
NaN
, the value of the other argument is returned.
Returns fmax(fmax(a, b), c)
.
Returns fmax(fmax(a, b), fmax(c, d))
.
Returns y
if y < x
; otherwise, it returns x
. If one of the two arguments is NaN
, the value
of the other argument is returned.
For each component c
of x
:
Returns y
if y < c
; otherwise, it returns c
. If one of the two arguments is NaN
, the value
of the other argument is returned.
For every index i
:
Returns y[i]
if y[i] < x[i]
; otherwise, it returns x[i]
. If one of the two arguments is
NaN
, the value of the other argument is returned.
Returns fmin(fmin(a, b), c)
.
Returns fmin(fmin(a, b), fmin(c, d))
.
Returns x - floor(x)
.
Returns x - floor(x)
.
Splits x
into a floating-point significand in the range [0.5, 1.0)
and an integral exponent
of two, such that: x = significand * exp(2, exponent)
Splits x
into a floating-point significand in the range [0.5, 1.0)
and an integral exponent
of two, such that: x = significand * exp(2, exponent)
The significand is returned by the function and the exponent is returned in the parameter
exp
. For a floating-point value of zero, the significantand exponent are both zero. For a
floating-point value that is an infinity or is not a number, the results are undefined.
Returns a floating-point value corresponding to a signed 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.
Returns a floating-point value corresponding to a signed 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.
Returns True
if x
holds a positive infinity or negative infinity representation in the
underlying implementation's set of floating point representations.
Returns False
otherwise, including for implementations with no infinity representations.
Returns True
if x
holds a positive infinity or negative infinity representation in the
underlying implementation's set of floating point representations.
Returns False
otherwise, including for implementations with no infinity representations.
Returns True
if x
holds a positive infinity or negative infinity representation in the
underlying implementation's set of floating point representations.
Returns False
otherwise, including for implementations with no infinity representations.
Returns True
if x
holds a NaN
(not a number) representation in the underlying
implementation's set of floating point representations.
Returns False
otherwise, including for implementations with no NaN
representations.
Returns True
if x
holds a NaN
(not a number) representation in the underlying
implementation's set of floating point representations.
Returns False
otherwise, including for implementations with no NaN
representations.
Returns True
if x
holds a NaN
(not a number) representation in the underlying
implementation's set of floating point representations.
Returns False
otherwise, including for implementations with no NaN
representations.
Builds a floating-point number from x
and the corresponding integral exponent of two in
exp
, returning: significand * exp(2, exponent)
. If this product is too large to be
represented in the floating-point type, the result is undefined.
Builds a floating-point number from x
and the corresponding integral exponent of two in
exp
, returning: significand * exp(2, exponent)
. If this product is too large to be
represented in the floating-point type, the result is undefined.
Returns y
if x < y
; otherwise, it returns x
.
Returns y
if x < y
; otherwise, it returns x
.
Returns y
if x < y
; otherwise, it returns x
.
Returns the maximum value of 3 inputs.
Returns the maximum component wise value of 3 inputs.
Returns the maximum value of 4 inputs.
Returns the maximum component wise value of 4 inputs.
Returns the greatest number or the maximum component wise value respectively.
Returns y
if y < x
; otherwise, it returns x
.
Returns y
if y < x
; otherwise, it returns x
.
Returns y
if y < x
; otherwise, it returns x
.
Returns the minimum value of 3 inputs.
Returns the minimum component wise value of 3 inputs.
Returns the minimum value of 4 inputs.
Returns the minimum component wise value of 4 inputs.
Returns the smallest number or the minimum component wise value respectively.
Returns x * (1.0 - a) + y * a
, i.e., the linear blend of x
and y
using the floating-point
value a
. The value for a
is not restricted to the range [0, 1]
.
Returns y
if a
is True
and x
otherwise.
Returns x * (1.0 - a) + y * a
, i.e., the linear blend of x
and y
using the floating-point
value a
. The value for a
is not restricted to the range [0, 1]
.
For each component index i
:
Returns y[i]
if a[i]
is True
and x[i]
otherwise.
Returns x * (1.0 - a) + y * a
, i.e., the linear blend of x
and y
using the floating-point
value a
for each component. The value for a
is not restricted to the range [0, 1]
.
Returns x * (1.0 - a) + y * a
, i.e., the linear blend of x
and y
using the floating-point
value a
for each component. The value for a
is not restricted to the range [0, 1]
.
Spherical linear interpolation of two quaternions. The interpolation is oriented and the
rotation is performed at constant speed. For short path spherical linear interpolation, use
the slerp
function.
Equivalent to a % b
.
Returns the fractional part of x
and the integer part (as a whole number floating point value).
Returns the fractional part of x
and sets i
to the integer part (as a whole number floating
point value).
Returns a value equal to the nearest integer to x
. The fraction 0.5
will round in a
direction chosen by the implementation, presumably the direction that is fastest. This
includes the possibility that round(x)
returns the same value as roundEven(x)
Returns a value equal to the nearest integer to x
. The fraction 0.5
will round in a
direction chosen by the implementation, presumably the direction that is fastest. This
includes the possibility that round(x)
returns the same value as roundEven(x)
for all
values of x
.
Returns a value equal to the nearest integer to x
. A fractional part of 0.5
will round
toward the nearest even integer. (Both 3.5
and 4.5
for x
will return 4.0
.)
Returns a value equal to the nearest integer to x
. A fractional part of 0.5
will round
toward the nearest even integer. (Both 3.5
and 4.5
for x
will return 4.0
.)
Returns 1.0
if x > 0
, 0.0
if x == 0
, or -1.0
if x < 0
.
For every component c
of x
:
Returns 1.0
if x > 0
, 0.0
if x == 0
, or -1.0
if x < 0
.
Returns 0.0
if x <= edge0
and 1.0
if x >= edge1
and performs smooth Hermite interpolation
between 0
and 1
when edge0 < x < edge1
. This is useful in cases where you would want a
threshold function with a smooth transition. This is equivalent to :
t = clamp((x - edge0) / (edge1 - edge0), 0, 1)
return t * t * (3 - 2 * t)
Results are undefined if edge0 >= edge1
.
Returns 0.0
if x <= edge0
and 1.0
if x >= edge1
and performs smooth Hermite interpolation
between 0
and 1
when edge0 < x < edge1
. This is useful in cases where you would want a
threshold function with a smooth transition. This is equivalent to :
t = clamp((x - edge0) / (edge1 - edge0), 0, 1)
return t * t * (3 - 2 * t)
Results are undefined if edge0 >= edge1
.
Returns 0.0
if x <= edge0
and 1.0
if x >= edge1
and performs smooth Hermite interpolation
between 0
and 1
when edge0 < x < edge1
. This is useful in cases where you would want a
threshold function with a smooth transition. This is equivalent to :
t = clamp((x - edge0) / (edge1 - edge0), 0, 1)
return t * t * (3 - 2 * t)
Results are undefined if edge0 >= edge1
.
Returns 0.0
if x < edge
, otherwise it returns 1.0
.
For every component c
of x
:
Returns 0.0
if c < edge
, otherwise it returns 1.0
.
For every index i
:
Returns 0.0
if x[i] < edge[i]
, otherwise it returns 1.0
.
Returns a value equal to the nearest integer to x
whose absolute value is not larger than
the absolute value of x
.
For every component c
of x
:
Returns a value equal to the nearest integer to c
whose absolute value is not larger than
the absolute value of c
.
Returns a floating-point value corresponding to an 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.
Returns a floating-point value corresponding to an 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.