GLM  0.9.5
func_common.hpp
1 
36 #ifndef GLM_FUNC_COMMON_INCLUDED
37 #define GLM_FUNC_COMMON_INCLUDED
38 
39 #include "setup.hpp"
40 #include "precision.hpp"
41 #include "type_int.hpp"
42 #include "_fixes.hpp"
43 
44 namespace glm
45 {
48 
55  template <typename genType>
56  GLM_FUNC_DECL genType abs(genType const & x);
57 
64  template <typename genType>
65  GLM_FUNC_DECL genType sign(genType const & x);
66 
73  template <typename genType>
74  GLM_FUNC_DECL genType floor(genType const & x);
75 
83  template <typename genType>
84  GLM_FUNC_DECL genType trunc(genType const & x);
85 
96  template <typename genType>
97  GLM_FUNC_DECL genType round(genType const & x);
98 
108  template <typename genType>
109  GLM_FUNC_DECL genType roundEven(genType const & x);
110 
118  template <typename genType>
119  GLM_FUNC_DECL genType ceil(genType const & x);
120 
127  template <typename genType>
128  GLM_FUNC_DECL genType fract(genType const & x);
129 
137  template <typename genType>
138  GLM_FUNC_DECL genType mod(
139  genType const & x,
140  genType const & y);
141 
149  template <typename genType>
150  GLM_FUNC_DECL genType mod(
151  genType const & x,
152  typename genType::value_type const & y);
153 
163  template <typename genType>
164  GLM_FUNC_DECL genType modf(
165  genType const & x,
166  genType & i);
167 
174  template <typename genType>
175  GLM_FUNC_DECL genType min(
176  genType const & x,
177  genType const & y);
178 
179  template <typename genType>
180  GLM_FUNC_DECL genType min(
181  genType const & x,
182  typename genType::value_type const & y);
183 
190  template <typename genType>
191  GLM_FUNC_DECL genType max(
192  genType const & x,
193  genType const & y);
194 
195  template <typename genType>
196  GLM_FUNC_DECL genType max(
197  genType const & x,
198  typename genType::value_type const & y);
199 
207  template <typename genType>
208  GLM_FUNC_DECL genType clamp(
209  genType const & x,
210  genType const & minVal,
211  genType const & maxVal);
212 
213  template <typename genType, precision P>
214  GLM_FUNC_DECL genType clamp(
215  genType const & x,
216  typename genType::value_type const & minVal,
217  typename genType::value_type const & maxVal);
218 
261  template <typename genTypeT, typename genTypeU>
262  GLM_FUNC_DECL genTypeT mix(
263  genTypeT const & x,
264  genTypeT const & y,
265  genTypeU const & a);
266 
271  template <typename genType>
272  GLM_FUNC_DECL genType step(
273  genType const & edge,
274  genType const & x);
275 
280  template <template <typename, precision> class vecType, typename T, precision P>
281  GLM_FUNC_DECL vecType<T, P> step(
282  T const & edge,
283  vecType<T, P> const & x);
284 
299  template <typename genType>
300  GLM_FUNC_DECL genType smoothstep(
301  genType const & edge0,
302  genType const & edge1,
303  genType const & x);
304 
305  template <typename genType>
306  GLM_FUNC_DECL genType smoothstep(
307  typename genType::value_type const & edge0,
308  typename genType::value_type const & edge1,
309  genType const & x);
310 
323  template <typename genType>
324  GLM_FUNC_DECL typename genType::bool_type isnan(genType const & x);
325 
336  template <typename genType>
337  GLM_FUNC_DECL typename genType::bool_type isinf(genType const & x);
338 
345  GLM_FUNC_DECL int floatBitsToInt(float const & v);
346 
353  template <template <typename, precision> class vecType, precision P>
354  GLM_FUNC_DECL vecType<int, P> floatBitsToInt(vecType<float, P> const & v);
355 
362  GLM_FUNC_DECL uint floatBitsToUint(float const & v);
363 
370  template <template <typename, precision> class vecType, precision P>
371  GLM_FUNC_DECL vecType<uint, P> floatBitsToUint(vecType<float, P> const & v);
372 
381  GLM_FUNC_DECL float intBitsToFloat(int const & v);
382 
391  template <template <typename, precision> class vecType, precision P>
392  GLM_FUNC_DECL vecType<float, P> intBitsToFloat(vecType<int, P> const & v);
393 
402  GLM_FUNC_DECL float uintBitsToFloat(uint const & v);
403 
412  template <template <typename, precision> class vecType, precision P>
413  GLM_FUNC_DECL vecType<float, P> uintBitsToFloat(vecType<uint, P> const & v);
414 
421  template <typename genType>
422  GLM_FUNC_DECL genType fma(genType const & a, genType const & b, genType const & c);
423 
438  template <typename genType, typename genIType>
439  GLM_FUNC_DECL genType frexp(genType const & x, genIType & exp);
440 
452  template <typename genType, typename genIType>
453  GLM_FUNC_DECL genType ldexp(genType const & x, genIType const & exp);
454 
456 }//namespace glm
457 
458 #include "func_common.inl"
459 
460 #endif//GLM_FUNC_COMMON_INCLUDED
GLM_FUNC_DECL genType floor(genType const &x)
Returns a value equal to the nearest integer that is less then or equal to x.
GLM_FUNC_DECL genTypeT mix(genTypeT const &x, genTypeT const &y, genTypeU const &a)
If genTypeU is a floating scalar or vector: Returns x * (1.0 - a) + y * a, i.e., the linear blend of ...
unsigned int uint
Unsigned integer type.
Definition: type_int.hpp:171
GLM_FUNC_DECL genType mod(genType const &x, genType const &y)
Modulus.
GLM_FUNC_DECL genType modf(genType const &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 genType exp(genType const &x)
Returns the natural exponentiation of x, i.e., e^x.
GLM_FUNC_DECL genType fract(genType const &x)
Return x - floor(x).
GLM_FUNC_DECL genType ceil(genType const &x)
Returns a value equal to the nearest integer that is greater than or equal to x.
GLM_FUNC_DECL genType::bool_type isnan(genType const &x)
Returns true if x holds a NaN (not a number) representation in the underlying implementation&#39;s set of...
GLM_FUNC_DECL genType fma(genType const &a, genType const &b, genType const &c)
Computes and returns a * b + c.
GLM_FUNC_DECL float intBitsToFloat(int const &v)
Returns a floating-point value corresponding to a signed integer encoding of a floating-point value...
GLM_FUNC_DECL genType step(genType const &edge, genType const &x)
Returns 0.0 if x &lt; edge, otherwise it returns 1.0 for each component of a genType.
GLM_FUNC_DECL int floatBitsToInt(float const &v)
Returns a signed integer value representing the encoding of a floating-point value.
GLM_FUNC_DECL genType trunc(genType const &x)
Returns a value equal to the nearest integer to x whose absolute value is not larger than the absolut...
GLM_FUNC_DECL genType roundEven(genType const &x)
Returns a value equal to the nearest integer to x.
GLM_FUNC_DECL genType round(genType const &x)
Returns a value equal to the nearest integer to x.
GLM_FUNC_DECL float uintBitsToFloat(uint const &v)
Returns a floating-point value corresponding to a unsigned integer encoding of a floating-point value...
GLM_FUNC_DECL uint floatBitsToUint(float const &v)
Returns a unsigned integer value representing the encoding of a floating-point value.
GLM_FUNC_DECL genType abs(genType const &x)
Returns x if x &gt;= 0; otherwise, it returns -x.
GLM_FUNC_DECL genType::bool_type isinf(genType const &x)
Returns true if x holds a positive infinity or negative infinity representation in the underlying imp...
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 const &edge0, genType const &edge1, genType const &x)
Returns 0.0 if x &lt;= edge0 and 1.0 if x &gt;= edge1 and performs smooth Hermite interpolation between 0 a...
GLM_FUNC_DECL genType clamp(genType const &x, genType const &minVal, genType const &maxVal)
Returns min(max(x, minVal), maxVal) for each component in x using the floating-point values minVal an...
GLM_FUNC_DECL genType max(genType const &x, genType const &y)
Returns y if x &lt; y; otherwise, it returns x.
GLM_FUNC_DECL genType sign(genType const &x)
Returns 1.0 if x &gt; 0, 0.0 if x == 0, or -1.0 if x &lt; 0.
GLM_FUNC_DECL genType min(genType const &x, genType const &y)
Returns y if y &lt; x; 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...