| 1 | /// @ref gtc_matrix_access |
| 2 | |
| 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 | |
| 15 | genType Result = m; |
| 16 | for(length_t i = 0; i < m.length(); ++i) |
| 17 | Result[i][index] = x[i]; |
| 18 | return Result; |
| 19 | } |
| 20 | |
| 21 | template<typename genType> |
| 22 | GLM_FUNC_QUALIFIER typename genType::row_type row |
| 23 | ( |
| 24 | genType const& m, |
| 25 | length_t index |
| 26 | ) |
| 27 | { |
| 28 | assert(index >= 0 && index < m[0].length()); |
| 29 | |
| 30 | typename genType::row_type Result(0); |
| 31 | for(length_t i = 0; i < m.length(); ++i) |
| 32 | Result[i] = m[i][index]; |
| 33 | return Result; |
| 34 | } |
| 35 | |
| 36 | template<typename genType> |
| 37 | GLM_FUNC_QUALIFIER genType column |
| 38 | ( |
| 39 | genType const& m, |
| 40 | length_t index, |
| 41 | typename genType::col_type const& x |
| 42 | ) |
| 43 | { |
| 44 | assert(index >= 0 && index < m.length()); |
| 45 | |
| 46 | genType Result = m; |
| 47 | Result[index] = x; |
| 48 | return Result; |
| 49 | } |
| 50 | |
| 51 | template<typename genType> |
| 52 | GLM_FUNC_QUALIFIER typename genType::col_type column |
| 53 | ( |
| 54 | genType const& m, |
| 55 | length_t index |
| 56 | ) |
| 57 | { |
| 58 | assert(index >= 0 && index < m.length()); |
| 59 | |
| 60 | return m[index]; |
| 61 | } |
| 62 | }//namespace glm |