component_wise.hpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /// @ref gtx_component_wise
  2. /// @file glm/gtx/component_wise.hpp
  3. /// @date 2007-05-21 / 2011-06-07
  4. /// @author Christophe Riccio
  5. ///
  6. /// @see core (dependence)
  7. ///
  8. /// @defgroup gtx_component_wise GLM_GTX_component_wise
  9. /// @ingroup gtx
  10. ///
  11. /// Include <glm/gtx/component_wise.hpp> to use the features of this extension.
  12. ///
  13. /// Operations between components of a type
  14. #pragma once
  15. // Dependencies
  16. #include "../detail/setup.hpp"
  17. #include "../detail/qualifier.hpp"
  18. #ifndef GLM_ENABLE_EXPERIMENTAL
  19. // # error "GLM: GLM_GTX_component_wise 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."
  20. #elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  21. # pragma message("GLM: GLM_GTX_component_wise extension included")
  22. #endif
  23. namespace glm
  24. {
  25. /// @addtogroup gtx_component_wise
  26. /// @{
  27. /// Convert an integer vector to a normalized float vector.
  28. /// If the parameter value type is already a floating qualifier type, the value is passed through.
  29. /// @see gtx_component_wise
  30. template<typename floatType, length_t L, typename T, qualifier Q>
  31. GLM_FUNC_DECL vec<L, floatType, Q> compNormalize(vec<L, T, Q> const& v);
  32. /// Convert a normalized float vector to an integer vector.
  33. /// If the parameter value type is already a floating qualifier type, the value is passed through.
  34. /// @see gtx_component_wise
  35. template<length_t L, typename T, typename floatType, qualifier Q>
  36. GLM_FUNC_DECL vec<L, T, Q> compScale(vec<L, floatType, Q> const& v);
  37. /// Add all vector components together.
  38. /// @see gtx_component_wise
  39. template<typename genType>
  40. GLM_FUNC_DECL typename genType::value_type compAdd(genType const& v);
  41. /// Multiply all vector components together.
  42. /// @see gtx_component_wise
  43. template<typename genType>
  44. GLM_FUNC_DECL typename genType::value_type compMul(genType const& v);
  45. /// Find the minimum value between single vector components.
  46. /// @see gtx_component_wise
  47. template<typename genType>
  48. GLM_FUNC_DECL typename genType::value_type compMin(genType const& v);
  49. /// Find the maximum value between single vector components.
  50. /// @see gtx_component_wise
  51. template<typename genType>
  52. GLM_FUNC_DECL typename genType::value_type compMax(genType const& v);
  53. /// Find the minimum float between single vector components.
  54. /// @see gtx_component_wise
  55. template<typename genType>
  56. GLM_FUNC_DECL typename genType::value_type fcompMin(genType const& v);
  57. /// Find the maximum float between single vector components.
  58. /// @see gtx_component_wise
  59. template<typename genType>
  60. GLM_FUNC_DECL typename genType::value_type fcompMax(genType const& v);
  61. /// @}
  62. }//namespace glm
  63. #include "component_wise.inl"