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