0.9.9 API documenation
func_common.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 
13 #include "setup.hpp"
14 #include "qualifier.hpp"
15 #include "type_int.hpp"
16 #include "_fixes.hpp"
17 
18 namespace glm
19 {
22 
30  template<typename genType>
31  GLM_FUNC_DECL genType abs(genType x);
32 
41  template<length_t L, typename T, qualifier P>
42  GLM_FUNC_DECL vec<L, T, P> abs(vec<L, T, P> const& x);
43 
52  template<length_t L, typename T, qualifier P>
53  GLM_FUNC_DECL vec<L, T, P> sign(vec<L, T, P> const& x);
54 
63  template<length_t L, typename T, qualifier P>
64  GLM_FUNC_DECL vec<L, T, P> floor(vec<L, T, P> const& x);
65 
75  template<length_t L, typename T, qualifier P>
76  GLM_FUNC_DECL vec<L, T, P> trunc(vec<L, T, P> const& x);
77 
90  template<length_t L, typename T, qualifier P>
91  GLM_FUNC_DECL vec<L, T, P> round(vec<L, T, P> const& x);
92 
104  template<length_t L, typename T, qualifier P>
105  GLM_FUNC_DECL vec<L, T, P> roundEven(vec<L, T, P> const& x);
106 
116  template<length_t L, typename T, qualifier P>
117  GLM_FUNC_DECL vec<L, T, P> ceil(vec<L, T, P> const& x);
118 
125  template<typename genType>
126  GLM_FUNC_DECL genType fract(genType x);
127 
136  template<length_t L, typename T, qualifier P>
137  GLM_FUNC_DECL vec<L, T, P> fract(vec<L, T, P> const& x);
138 
146  template<typename genType>
147  GLM_FUNC_DECL genType mod(genType x, genType y);
148 
158  template<length_t L, typename T, qualifier P>
159  GLM_FUNC_DECL vec<L, T, P> mod(vec<L, T, P> const& x, T y);
160 
170  template<length_t L, typename T, qualifier P>
171  GLM_FUNC_DECL vec<L, T, P> mod(vec<L, T, P> const& x, vec<L, T, P> const& y);
172 
182  template<typename genType>
183  GLM_FUNC_DECL genType modf(genType x, genType& i);
184 
191  template<typename genType>
192  GLM_FUNC_DECL genType min(genType x, genType y);
193 
202  template<length_t L, typename T, qualifier P>
203  GLM_FUNC_DECL vec<L, T, P> min(vec<L, T, P> const& x, T y);
204 
213  template<length_t L, typename T, qualifier P>
214  GLM_FUNC_DECL vec<L, T, P> min(vec<L, T, P> const& x, vec<L, T, P> const& y);
215 
222  template<typename genType>
223  GLM_FUNC_DECL genType max(genType x, genType y);
224 
233  template<length_t L, typename T, qualifier P>
234  GLM_FUNC_DECL vec<L, T, P> max(vec<L, T, P> const& x, T y);
235 
244  template<length_t L, typename T, qualifier P>
245  GLM_FUNC_DECL vec<L, T, P> max(vec<L, T, P> const& x, vec<L, T, P> const& y);
246 
254  template<typename genType>
255  GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal);
256 
266  template<length_t L, typename T, qualifier P>
267  GLM_FUNC_DECL vec<L, T, P> clamp(vec<L, T, P> const & x, T minVal, T maxVal);
268 
278  template<length_t L, typename T, qualifier P>
279  GLM_FUNC_DECL vec<L, T, P> clamp(vec<L, T, P> const& x, vec<L, T, P> const& minVal, vec<L, T, P> const& maxVal);
280 
323  template<typename genTypeT, typename genTypeU>
324  GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a);
325 
326  template<length_t L, typename T, typename U, qualifier P>
327  GLM_FUNC_DECL vec<L, T, P> mix(vec<L, T, P> const& x, vec<L, T, P> const& y, vec<L, U, P> const& a);
328 
329  template<length_t L, typename T, typename U, qualifier P>
330  GLM_FUNC_DECL vec<L, T, P> mix(vec<L, T, P> const& x, vec<L, T, P> const& y, U a);
331 
336  template<typename genType>
337  GLM_FUNC_DECL genType step(genType edge, genType x);
338 
347  template<length_t L, typename T, qualifier P>
348  GLM_FUNC_DECL vec<L, T, P> step(T edge, vec<L, T, P> const& x);
349 
358  template<length_t L, typename T, qualifier P>
359  GLM_FUNC_DECL vec<L, T, P> step(vec<L, T, P> const& edge, vec<L, T, P> const& x);
360 
375  template<typename genType>
376  GLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x);
377 
378  template<length_t L, typename T, qualifier P>
379  GLM_FUNC_DECL vec<L, T, P> smoothstep(T edge0, T edge1, vec<L, T, P> const& x);
380 
381  template<length_t L, typename T, qualifier P>
382  GLM_FUNC_DECL vec<L, T, P> smoothstep(vec<L, T, P> const& edge0, vec<L, T, P> const& edge1, vec<L, T, P> const& x);
383 
398  template<length_t L, typename T, qualifier P>
399  GLM_FUNC_DECL vec<L, bool, P> isnan(vec<L, T, P> const& x);
400 
413  template<length_t L, typename T, qualifier P>
414  GLM_FUNC_DECL vec<L, bool, P> isinf(vec<L, T, P> const& x);
415 
422  GLM_FUNC_DECL int floatBitsToInt(float const & v);
423 
433  template<length_t L, qualifier P>
434  GLM_FUNC_DECL vec<L, int, P> floatBitsToInt(vec<L, float, P> const& v);
435 
442  GLM_FUNC_DECL uint floatBitsToUint(float const & v);
443 
453  template<length_t L, qualifier P>
454  GLM_FUNC_DECL vec<L, uint, P> floatBitsToUint(vec<L, float, P> const& v);
455 
464  GLM_FUNC_DECL float intBitsToFloat(int const & v);
465 
477  template<length_t L, qualifier P>
478  GLM_FUNC_DECL vec<L, float, P> intBitsToFloat(vec<L, int, P> const& v);
479 
488  GLM_FUNC_DECL float uintBitsToFloat(uint const & v);
489 
501  template<length_t L, qualifier P>
502  GLM_FUNC_DECL vec<L, float, P> uintBitsToFloat(vec<L, uint, P> const& v);
503 
510  template<typename genType>
511  GLM_FUNC_DECL genType fma(genType const& a, genType const& b, genType const& c);
512 
527  template<typename genType, typename genIType>
528  GLM_FUNC_DECL genType frexp(genType const& x, genIType& exp);
529 
541  template<typename genType, typename genIType>
542  GLM_FUNC_DECL genType ldexp(genType const& x, genIType const& exp);
543 
545 }//namespace glm
546 
547 #include "func_common.inl"
548 
GLM_FUNC_DECL vec< L, T, P > abs(vec< L, T, P > const &x)
Returns x if x >= 0; otherwise, it returns -x.
GLM_FUNC_DECL vec< L, T, P > exp(vec< L, T, P > const &v)
Returns the natural exponentiation of x, i.e., e^x.
GLM_FUNC_DECL vec< L, float, P > intBitsToFloat(vec< L, int, P > const &v)
Returns a floating-point value corresponding to a signed integer encoding of a floating-point value...
GLM_FUNC_DECL vec< L, T, P > fract(vec< L, T, P > const &x)
Return x - floor(x).
GLM_FUNC_DECL genType ldexp(genType const &x, genIType const &exp)
Builds a floating-point number from x and the corresponding integral exponent of two in exp...
GLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x)
Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and performs smooth Hermite interpolation between 0 a...
GLM_FUNC_DECL vec< L, T, P > mod(vec< L, T, P > const &x, vec< L, T, P > const &y)
Modulus.
GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a)
If genTypeU is a floating scalar or vector: Returns x * (1.0 - a) + y * a, i.e., the linear blend of ...
GLM_FUNC_DECL vec< L, T, P > clamp(vec< L, T, P > const &x, vec< L, T, P > const &minVal, vec< L, T, P > const &maxVal)
Returns min(max(x, minVal), maxVal) for each component in x using the floating-point values minVal an...
Definition: _noise.hpp:11
GLM_FUNC_DECL vec< L, T, P > round(vec< L, T, P > const &x)
Returns a value equal to the nearest integer to x.
GLM_FUNC_DECL genType modf(genType x, genType &i)
Returns the fractional part of x and sets i to the integer part (as a whole number floating point val...
GLM_FUNC_DECL vec< L, bool, P > isnan(vec< L, T, P > const &x)
Returns true if x holds a NaN (not a number) representation in the underlying implementation's set of...
GLM Core
GLM Core
GLM_FUNC_DECL vec< L, T, P > min(vec< L, T, P > const &x, vec< L, T, P > const &y)
Returns y if y < x; otherwise, it returns x.
GLM_FUNC_DECL vec< L, T, P > sign(vec< L, T, P > const &x)
Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
GLM_FUNC_DECL vec< L, T, P > ceil(vec< L, T, P > const &x)
Returns a value equal to the nearest integer that is greater than or equal to x.
GLM_FUNC_DECL vec< L, T, P > trunc(vec< L, T, P > const &x)
Returns a value equal to the nearest integer to x whose absolute value is not larger than the absolut...
GLM_FUNC_DECL vec< L, T, P > max(vec< L, T, P > const &x, vec< L, T, P > const &y)
Returns y if x < y; otherwise, it returns x.
GLM_FUNC_DECL genType frexp(genType const &x, genIType &exp)
Splits x into a floating-point significand in the range [0.5, 1.0) and an integral exponent of two...
GLM_FUNC_DECL vec< L, T, P > floor(vec< L, T, P > const &x)
Returns a value equal to the nearest integer that is less then or equal to x.
GLM_FUNC_DECL vec< L, T, P > step(vec< L, T, P > const &edge, vec< L, T, P > const &x)
Returns 0.0 if x < edge, otherwise it returns 1.0.
GLM_FUNC_DECL vec< L, uint, P > floatBitsToUint(vec< L, float, P > const &v)
Returns a unsigned integer value representing the encoding of a floating-point value.
GLM_FUNC_DECL vec< L, T, P > roundEven(vec< L, T, P > const &x)
Returns a value equal to the nearest integer to x.
GLM_FUNC_DECL genType fma(genType const &a, genType const &b, genType const &c)
Computes and returns a * b + c.
GLM_FUNC_DECL vec< L, int, P > floatBitsToInt(vec< L, float, P > const &v)
Returns a signed integer value representing the encoding of a floating-point value.
GLM_FUNC_DECL vec< L, bool, P > isinf(vec< L, T, P > const &x)
Returns true if x holds a positive infinity or negative infinity representation in the underlying imp...
GLM_FUNC_DECL vec< L, float, P > uintBitsToFloat(vec< L, uint, P > const &v)
Returns a floating-point value corresponding to a unsigned integer encoding of a floating-point value...
unsigned int uint
Unsigned integer type.
Definition: type_int.hpp:288
GLM Core
GLM Core