| 1 | /// @ref gtc_integer |
| 2 | /// @file glm/gtc/integer.hpp |
| 3 | /// |
| 4 | /// @see core (dependence) |
| 5 | /// @see gtc_integer (dependence) |
| 6 | /// |
| 7 | /// @defgroup gtc_integer GLM_GTC_integer |
| 8 | /// @ingroup gtc |
| 9 | /// |
| 10 | /// Include <glm/gtc/integer.hpp> to use the features of this extension. |
| 11 | /// |
| 12 | /// @brief Allow to perform bit operations on integer values |
| 13 | |
| 14 | #pragma once |
| 15 | |
| 16 | // Dependencies |
| 17 | #include "../detail/setup.hpp" |
| 18 | #include "../detail/qualifier.hpp" |
| 19 | #include "../common.hpp" |
| 20 | #include "../integer.hpp" |
| 21 | #include "../exponential.hpp" |
| 22 | #include <limits> |
| 23 | |
| 24 | #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) |
| 25 | # pragma message("GLM: GLM_GTC_integer extension included") |
| 26 | #endif |
| 27 | |
| 28 | namespace glm |
| 29 | { |
| 30 | /// @addtogroup gtc_integer |
| 31 | /// @{ |
| 32 | |
| 33 | /// Returns the log2 of x for integer values. Can be reliably using to compute mipmap count from the texture size. |
| 34 | /// @see gtc_integer |
| 35 | template<typename genIUType> |
| 36 | GLM_FUNC_DECL genIUType log2(genIUType x); |
| 37 | |
| 38 | /// Returns a value equal to the nearest integer to x. |
| 39 | /// The fraction 0.5 will round in a direction chosen by the |
| 40 | /// implementation, presumably the direction that is fastest. |
| 41 | /// |
| 42 | /// @param x The values of the argument must be greater or equal to zero. |
| 43 | /// @tparam T floating point scalar types. |
| 44 | /// |
| 45 | /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a> |
| 46 | /// @see gtc_integer |
| 47 | template<length_t L, typename T, qualifier Q> |
| 48 | GLM_FUNC_DECL vec<L, int, Q> iround(vec<L, T, Q> const& x); |
| 49 | |
| 50 | /// Returns a value equal to the nearest integer to x. |
| 51 | /// The fraction 0.5 will round in a direction chosen by the |
| 52 | /// implementation, presumably the direction that is fastest. |
| 53 | /// |
| 54 | /// @param x The values of the argument must be greater or equal to zero. |
| 55 | /// @tparam T floating point scalar types. |
| 56 | /// |
| 57 | /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a> |
| 58 | /// @see gtc_integer |
| 59 | template<length_t L, typename T, qualifier Q> |
| 60 | GLM_FUNC_DECL vec<L, uint, Q> uround(vec<L, T, Q> const& x); |
| 61 | |
| 62 | /// @} |
| 63 | } //namespace glm |
| 64 | |
| 65 | #include "integer.inl" |