| 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 | #endif |
| 22 | |
| 23 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) |
| 24 | # pragma message("GLM: GLM_GTX_integer extension included") |
| 25 | #endif |
| 26 | |
| 27 | namespace glm |
| 28 | { |
| 29 | /// @addtogroup gtx_integer |
| 30 | /// @{ |
| 31 | |
| 32 | //! Returns x raised to the y power. |
| 33 | //! From GLM_GTX_integer extension. |
| 34 | GLM_FUNC_DECL int pow(int x, uint y); |
| 35 | |
| 36 | //! Returns the positive square root of x. |
| 37 | //! From GLM_GTX_integer extension. |
| 38 | GLM_FUNC_DECL int sqrt(int x); |
| 39 | |
| 40 | //! Returns the floor log2 of x. |
| 41 | //! From GLM_GTX_integer extension. |
| 42 | GLM_FUNC_DECL unsigned int floor_log2(unsigned int x); |
| 43 | |
| 44 | //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. |
| 45 | //! From GLM_GTX_integer extension. |
| 46 | GLM_FUNC_DECL int mod(int x, int y); |
| 47 | |
| 48 | //! Return the factorial value of a number (!12 max, integer only) |
| 49 | //! From GLM_GTX_integer extension. |
| 50 | template<typename genType> |
| 51 | GLM_FUNC_DECL genType factorial(genType const& x); |
| 52 | |
| 53 | //! 32bit signed integer. |
| 54 | //! From GLM_GTX_integer extension. |
| 55 | typedef signed int sint; |
| 56 | |
| 57 | //! Returns x raised to the y power. |
| 58 | //! From GLM_GTX_integer extension. |
| 59 | GLM_FUNC_DECL uint pow(uint x, uint y); |
| 60 | |
| 61 | //! Returns the positive square root of x. |
| 62 | //! From GLM_GTX_integer extension. |
| 63 | GLM_FUNC_DECL uint sqrt(uint x); |
| 64 | |
| 65 | //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. |
| 66 | //! From GLM_GTX_integer extension. |
| 67 | GLM_FUNC_DECL uint mod(uint x, uint y); |
| 68 | |
| 69 | //! Returns the number of leading zeros. |
| 70 | //! From GLM_GTX_integer extension. |
| 71 | GLM_FUNC_DECL uint nlz(uint x); |
| 72 | |
| 73 | /// @} |
| 74 | }//namespace glm |
| 75 | |
| 76 | #include "integer.inl" |