vector_ulp.inl 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. namespace glm
  2. {
  3. template<length_t L, typename T, qualifier Q>
  4. GLM_FUNC_QUALIFIER vec<L, T, Q> nextFloat(vec<L, T, Q> const& x)
  5. {
  6. vec<L, T, Q> Result;
  7. for(length_t i = 0, n = Result.length(); i < n; ++i)
  8. Result[i] = nextFloat(x[i]);
  9. return Result;
  10. }
  11. template<length_t L, typename T, qualifier Q>
  12. GLM_FUNC_QUALIFIER vec<L, T, Q> nextFloat(vec<L, T, Q> const& x, int ULPs)
  13. {
  14. vec<L, T, Q> Result;
  15. for(length_t i = 0, n = Result.length(); i < n; ++i)
  16. Result[i] = nextFloat(x[i], ULPs);
  17. return Result;
  18. }
  19. template<length_t L, typename T, qualifier Q>
  20. GLM_FUNC_QUALIFIER vec<L, T, Q> nextFloat(vec<L, T, Q> const& x, vec<L, int, Q> const& ULPs)
  21. {
  22. vec<L, T, Q> Result;
  23. for(length_t i = 0, n = Result.length(); i < n; ++i)
  24. Result[i] = nextFloat(x[i], ULPs[i]);
  25. return Result;
  26. }
  27. template<length_t L, typename T, qualifier Q>
  28. GLM_FUNC_QUALIFIER vec<L, T, Q> prevFloat(vec<L, T, Q> const& x)
  29. {
  30. vec<L, T, Q> Result;
  31. for(length_t i = 0, n = Result.length(); i < n; ++i)
  32. Result[i] = prevFloat(x[i]);
  33. return Result;
  34. }
  35. template<length_t L, typename T, qualifier Q>
  36. GLM_FUNC_QUALIFIER vec<L, T, Q> prevFloat(vec<L, T, Q> const& x, int ULPs)
  37. {
  38. vec<L, T, Q> Result;
  39. for(length_t i = 0, n = Result.length(); i < n; ++i)
  40. Result[i] = prevFloat(x[i], ULPs);
  41. return Result;
  42. }
  43. template<length_t L, typename T, qualifier Q>
  44. GLM_FUNC_QUALIFIER vec<L, T, Q> prevFloat(vec<L, T, Q> const& x, vec<L, int, Q> const& ULPs)
  45. {
  46. vec<L, T, Q> Result;
  47. for(length_t i = 0, n = Result.length(); i < n; ++i)
  48. Result[i] = prevFloat(x[i], ULPs[i]);
  49. return Result;
  50. }
  51. template<length_t L, qualifier Q>
  52. GLM_FUNC_QUALIFIER vec<L, int, Q> floatDistance(vec<L, float, Q> const& x, vec<L, float, Q> const& y)
  53. {
  54. vec<L, int, Q> Result;
  55. for(length_t i = 0, n = Result.length(); i < n; ++i)
  56. Result[i] = floatDistance(x[i], y[i]);
  57. return Result;
  58. }
  59. template<length_t L, qualifier Q>
  60. GLM_FUNC_QUALIFIER vec<L, int64, Q> floatDistance(vec<L, double, Q> const& x, vec<L, double, Q> const& y)
  61. {
  62. vec<L, int64, Q> Result;
  63. for(length_t i = 0, n = Result.length(); i < n; ++i)
  64. Result[i] = floatDistance(x[i], y[i]);
  65. return Result;
  66. }
  67. }//namespace glm