Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.1KB

  1. /// @ref gtc_matrix_access
  2. /// @file glm/gtc/matrix_access.inl
  3. namespace glm
  4. {
  5. template<typename genType>
  6. GLM_FUNC_QUALIFIER genType row
  7. (
  8. genType const& m,
  9. length_t index,
  10. typename genType::row_type const& x
  11. )
  12. {
  13. assert(index >= 0 && index < m[0].length());
  14. genType Result = m;
  15. for(length_t i = 0; i < m.length(); ++i)
  16. Result[i][index] = x[i];
  17. return Result;
  18. }
  19. template<typename genType>
  20. GLM_FUNC_QUALIFIER typename genType::row_type row
  21. (
  22. genType const& m,
  23. length_t index
  24. )
  25. {
  26. assert(index >= 0 && index < m[0].length());
  27. typename genType::row_type Result(0);
  28. for(length_t i = 0; i < m.length(); ++i)
  29. Result[i] = m[i][index];
  30. return Result;
  31. }
  32. template<typename genType>
  33. GLM_FUNC_QUALIFIER genType column
  34. (
  35. genType const& m,
  36. length_t index,
  37. typename genType::col_type const& x
  38. )
  39. {
  40. assert(index >= 0 && index < m.length());
  41. genType Result = m;
  42. Result[index] = x;
  43. return Result;
  44. }
  45. template<typename genType>
  46. GLM_FUNC_QUALIFIER typename genType::col_type column
  47. (
  48. genType const& m,
  49. length_t index
  50. )
  51. {
  52. assert(index >= 0 && index < m.length());
  53. return m[index];
  54. }
  55. }//namespace glm