| 1 | /// @ref gtx_integer |
| 2 | /// @file glm/gtx/integer.hpp |
| 3 | /// |
| 4 | /// @see core (dependence) |
| 5 | /// |
| 6 | /// @defgroup gtx_integer GLM_GTX_integer |
| 7 | /// @ingroup gtx |
| 8 | /// |
| 9 | /// Include <glm/gtx/integer.hpp> to use the features of this extension. |
| 10 | /// |
| 11 | /// Add support for integer for core functions |
| 12 | |
| 13 | #pragma once |
| 14 | |
| 15 | // Dependency: |
| 16 | #include "../glm.hpp" |
| 17 | #include "../gtc/integer.hpp" |
| 18 | |
| 19 | #ifndef GLM_ENABLE_EXPERIMENTAL |
| 20 | # error "GLM: GLM_GTX_integer is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." |
| 21 | #elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) |
| 22 | # pragma message("GLM: GLM_GTX_integer extension included") |
| 23 | #endif |
| 24 | |
| 25 | namespace glm |
| 26 | { |
| 27 | /// @addtogroup gtx_integer |
| 28 | /// @{ |
| 29 | |
| 30 | //! Returns x raised to the y power. |
| 31 | //! From GLM_GTX_integer extension. |
| 32 | GLM_FUNC_DECL int pow(int x, uint y); |
| 33 | |
| 34 | //! Returns the positive square root of x. |
| 35 | //! From GLM_GTX_integer extension. |
| 36 | GLM_FUNC_DECL int sqrt(int x); |
| 37 | |
| 38 | //! Returns the floor log2 of x. |
| 39 | //! From GLM_GTX_integer extension. |
| 40 | GLM_FUNC_DECL unsigned int floor_log2(unsigned int x); |
| 41 | |
| 42 | //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. |
| 43 | //! From GLM_GTX_integer extension. |
| 44 | GLM_FUNC_DECL int mod(int x, int y); |
| 45 | |
| 46 | //! Return the factorial value of a number (!12 max, integer only) |
| 47 | //! From GLM_GTX_integer extension. |
| 48 | template<typename genType> |
| 49 | GLM_FUNC_DECL genType factorial(genType const& x); |
| 50 | |
| 51 | //! 32bit signed integer. |
| 52 | //! From GLM_GTX_integer extension. |
| 53 | typedef signed int sint; |
| 54 | |
| 55 | //! Returns x raised to the y power. |
| 56 | //! From GLM_GTX_integer extension. |
| 57 | GLM_FUNC_DECL uint pow(uint x, uint y); |
| 58 | |
| 59 | //! Returns the positive square root of x. |
| 60 | //! From GLM_GTX_integer extension. |
| 61 | GLM_FUNC_DECL uint sqrt(uint x); |
| 62 | |
| 63 | //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. |
| 64 | //! From GLM_GTX_integer extension. |
| 65 | GLM_FUNC_DECL uint mod(uint x, uint y); |
| 66 | |
| 67 | //! Returns the number of leading zeros. |
| 68 | //! From GLM_GTX_integer extension. |
| 69 | GLM_FUNC_DECL uint nlz(uint x); |
| 70 | |
| 71 | /// @} |
| 72 | }//namespace glm |
| 73 | |
| 74 | #include "integer.inl" |