| 1 | namespace glm |
| 2 | { |
| 3 | template<length_t I, length_t L, typename T, qualifier Q> |
| 4 | GLM_CONSTEXPR T& get(vec<L, T, Q>& v) { |
| 5 | static_assert(I < L, "Index out of bounds"); |
| 6 | return v[I]; |
| 7 | } |
| 8 | template<length_t I, length_t L, typename T, qualifier Q> |
| 9 | GLM_CONSTEXPR T const& get(vec<L, T, Q> const& v) { |
| 10 | static_assert(I < L, "Index out of bounds"); |
| 11 | return v[I]; |
| 12 | } |
| 13 | |
| 14 | template<length_t I, length_t C, length_t R, typename T, qualifier Q> |
| 15 | GLM_CONSTEXPR vec<R, T, Q>& get(mat<C, R, T, Q>& m) { |
| 16 | static_assert(I < C, "Index out of bounds"); |
| 17 | return m[I]; |
| 18 | } |
| 19 | template<length_t I, length_t C, length_t R, typename T, qualifier Q> |
| 20 | GLM_CONSTEXPR vec<R, T, Q> const& get(mat<C, R, T, Q> const& m) { |
| 21 | static_assert(I < C, "Index out of bounds"); |
| 22 | return m[I]; |
| 23 | } |
| 24 | |
| 25 | template<length_t I, typename T, qualifier Q> |
| 26 | GLM_CONSTEXPR T& get(qua<T, Q>& q) { |
| 27 | static_assert(I < 4, "Index out of bounds"); |
| 28 | return q[I]; |
| 29 | } |
| 30 | template<length_t I, typename T, qualifier Q> |
| 31 | GLM_CONSTEXPR T const& get(qua<T, Q> const& q) { |
| 32 | static_assert(I < 4, "Index out of bounds"); |
| 33 | return q[I]; |
| 34 | } |
| 35 | |
| 36 | template<length_t I, length_t L, typename T, qualifier Q> |
| 37 | GLM_CONSTEXPR T get(vec<L, T, Q> const&& v) |
| 38 | { |
| 39 | static_assert(I < L, "Index out of bounds"); |
| 40 | return v[I]; |
| 41 | } |
| 42 | template<length_t I, length_t C, length_t R, typename T, qualifier Q> |
| 43 | GLM_CONSTEXPR vec<R, T, Q> get(mat<C, R, T, Q> const&& m) { |
| 44 | static_assert(I < C, "Index out of bounds"); |
| 45 | return m[I]; |
| 46 | } |
| 47 | template<length_t I, typename T, qualifier Q> |
| 48 | GLM_CONSTEXPR T get(qua<T, Q> const&& q) { |
| 49 | static_assert(I < 4, "Index out of bounds"); |
| 50 | return q[I]; |
| 51 | } |
| 52 | }//namespace glm |
| 53 | |