integer.hpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #pragma once
  14. // Dependencies
  15. #include "../detail/setup.hpp"
  16. #include "../detail/qualifier.hpp"
  17. #include "../common.hpp"
  18. #include "../integer.hpp"
  19. #include "../exponential.hpp"
  20. #include <limits>
  21. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  22. # pragma message("GLM: GLM_GTC_integer extension included")
  23. #endif
  24. namespace glm
  25. {
  26. /// @addtogroup gtc_integer
  27. /// @{
  28. /// Returns the log2 of x for integer values. Can be reliably using to compute mipmap count from the texture size.
  29. /// @see gtc_integer
  30. template<typename genIUType>
  31. GLM_FUNC_DECL genIUType log2(genIUType x);
  32. /// Returns a value equal to the nearest integer to x.
  33. /// The fraction 0.5 will round in a direction chosen by the
  34. /// implementation, presumably the direction that is fastest.
  35. ///
  36. /// @param x The values of the argument must be greater or equal to zero.
  37. /// @tparam T floating point scalar types.
  38. ///
  39. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
  40. /// @see gtc_integer
  41. template<length_t L, typename T, qualifier Q>
  42. GLM_FUNC_DECL vec<L, int, Q> iround(vec<L, T, Q> const& x);
  43. /// Returns a value equal to the nearest integer to x.
  44. /// The fraction 0.5 will round in a direction chosen by the
  45. /// implementation, presumably the direction that is fastest.
  46. ///
  47. /// @param x The values of the argument must be greater or equal to zero.
  48. /// @tparam T floating point scalar types.
  49. ///
  50. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
  51. /// @see gtc_integer
  52. template<length_t L, typename T, qualifier Q>
  53. GLM_FUNC_DECL vec<L, uint, Q> uround(vec<L, T, Q> const& x);
  54. /// @}
  55. } //namespace glm
  56. #include "integer.inl"