| 1 | #pragma once |
| 2 | |
| 3 | namespace glm { |
| 4 | |
| 5 | namespace detail { |
| 6 | |
| 7 | template<template<length_t C, length_t R, typename T, qualifier Q> class mat, length_t C, length_t R, typename Ret, typename T, qualifier Q> |
| 8 | struct matrix_functor_1 { |
| 9 | }; |
| 10 | |
| 11 | template<template<length_t C, length_t R, typename T, qualifier Q> class mat, typename Ret, typename T, qualifier Q> |
| 12 | struct matrix_functor_1<mat, 2, 2, Ret, T, Q> { |
| 13 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static mat<2, 2, T, Q> call(Ret (*Func)(T x), mat<2, 2, T, Q> const &x) { |
| 14 | return mat<2, 2, Ret, Q>( |
| 15 | Func(x[0][0]), Func(x[0][1]), |
| 16 | Func(x[1][0]), Func(x[1][1]) |
| 17 | ); |
| 18 | } |
| 19 | }; |
| 20 | |
| 21 | template<template<length_t C, length_t R, typename T, qualifier Q> class mat, typename Ret, typename T, qualifier Q> |
| 22 | struct matrix_functor_1<mat, 2, 3, Ret, T, Q> { |
| 23 | |
| 24 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static mat<2, 3, T, Q> call(Ret (*Func)(T x), mat<2, 3, T, Q> const &x) { |
| 25 | return mat<2, 3, Ret, Q>( |
| 26 | Func(x[0][0]), Func(x[0][1]), Func(x[0][2]), |
| 27 | Func(x[1][0]), Func(x[1][1]), Func(x[1][2]) |
| 28 | ); |
| 29 | } |
| 30 | |
| 31 | }; |
| 32 | |
| 33 | template<template<length_t C, length_t R, typename T, qualifier Q> class mat, typename Ret, typename T, qualifier Q> |
| 34 | struct matrix_functor_1<mat, 2, 4, Ret, T, Q> { |
| 35 | |
| 36 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static mat<2, 4, T, Q> call(Ret (*Func)(T x), mat<2, 4, T, Q> const &x) { |
| 37 | return mat<2, 4, Ret, Q>( |
| 38 | Func(x[0][0]), Func(x[0][1]), Func(x[0][2]), Func(x[0][3]), |
| 39 | Func(x[1][0]), Func(x[1][1]), Func(x[1][2]), Func(x[1][3]) |
| 40 | ); |
| 41 | } |
| 42 | |
| 43 | }; |
| 44 | |
| 45 | template<template<length_t C, length_t R, typename T, qualifier Q> class mat, typename Ret, typename T, qualifier Q> |
| 46 | struct matrix_functor_1<mat, 3, 2, Ret, T, Q> { |
| 47 | |
| 48 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static mat<3, 2, T, Q> call(Ret (*Func)(T x), mat<3, 2, T, Q> const &x) { |
| 49 | return mat<3, 2, Ret, Q>( |
| 50 | Func(x[0][0]), Func(x[0][1]), |
| 51 | Func(x[1][0]), Func(x[1][1]), |
| 52 | Func(x[2][0]), Func(x[2][1]) |
| 53 | ); |
| 54 | } |
| 55 | |
| 56 | }; |
| 57 | |
| 58 | template<template<length_t C, length_t R, typename T, qualifier Q> class mat, typename Ret, typename T, qualifier Q> |
| 59 | struct matrix_functor_1<mat, 3, 3, Ret, T, Q> { |
| 60 | |
| 61 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static mat<3, 3, T, Q> call(Ret (*Func)(T x), mat<3, 3, T, Q> const &x) { |
| 62 | return mat<3, 3, Ret, Q>( |
| 63 | Func(x[0][0]), Func(x[0][1]), Func(x[0][2]), |
| 64 | Func(x[1][0]), Func(x[1][1]), Func(x[1][2]), |
| 65 | Func(x[2][0]), Func(x[2][1]), Func(x[2][2]) |
| 66 | ); |
| 67 | } |
| 68 | |
| 69 | }; |
| 70 | |
| 71 | template<template<length_t C, length_t R, typename T, qualifier Q> class mat, typename Ret, typename T, qualifier Q> |
| 72 | struct matrix_functor_1<mat, 3, 4, Ret, T, Q> { |
| 73 | |
| 74 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static mat<3, 4, T, Q> call(Ret (*Func)(T x), mat<3, 4, T, Q> const &x) { |
| 75 | return mat<3, 4, Ret, Q>( |
| 76 | Func(x[0][0]), Func(x[0][1]), Func(x[0][2]), Func(x[0][3]), |
| 77 | Func(x[1][0]), Func(x[1][1]), Func(x[1][2]), Func(x[1][3]), |
| 78 | Func(x[2][0]), Func(x[2][1]), Func(x[2][2]), Func(x[2][3]) |
| 79 | ); |
| 80 | } |
| 81 | |
| 82 | }; |
| 83 | |
| 84 | template<template<length_t C, length_t R, typename T, qualifier Q> class mat, typename Ret, typename T, qualifier Q> |
| 85 | struct matrix_functor_1<mat, 4, 2, Ret, T, Q> { |
| 86 | |
| 87 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static mat<4, 2, T, Q> call(Ret (*Func)(T x), mat<4, 2, T, Q> const &x) { |
| 88 | return mat<4, 2, Ret, Q>( |
| 89 | Func(x[0][0]), Func(x[0][1]), |
| 90 | Func(x[1][0]), Func(x[1][1]), |
| 91 | Func(x[2][0]), Func(x[2][1]), |
| 92 | Func(x[3][0]), Func(x[3][1]) |
| 93 | ); |
| 94 | } |
| 95 | |
| 96 | }; |
| 97 | |
| 98 | template<template<length_t C, length_t R, typename T, qualifier Q> class mat, typename Ret, typename T, qualifier Q> |
| 99 | struct matrix_functor_1<mat, 4, 3, Ret, T, Q> { |
| 100 | |
| 101 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static mat<4, 3, T, Q> call(Ret (*Func)(T x), mat<4, 3, T, Q> const &x) { |
| 102 | return mat<4, 3, Ret, Q>( |
| 103 | Func(x[0][0]), Func(x[0][1]), Func(x[0][2]), |
| 104 | Func(x[1][0]), Func(x[1][1]), Func(x[1][2]), |
| 105 | Func(x[2][0]), Func(x[2][1]), Func(x[2][2]), |
| 106 | Func(x[3][0]), Func(x[3][1]), Func(x[3][2]) |
| 107 | ); |
| 108 | } |
| 109 | |
| 110 | }; |
| 111 | |
| 112 | template<template<length_t C, length_t R, typename T, qualifier Q> class mat, typename Ret, typename T, qualifier Q> |
| 113 | struct matrix_functor_1<mat, 4, 4, Ret, T, Q> { |
| 114 | |
| 115 | GLM_FUNC_QUALIFIER GLM_CONSTEXPR static mat<4, 4, T, Q> call(Ret (*Func)(T x), mat<4, 4, T, Q> const &x) { |
| 116 | return mat<4, 4, Ret, Q>( |
| 117 | Func(x[0][0]), Func(x[0][1]), Func(x[0][2]), Func(x[0][3]), |
| 118 | Func(x[1][0]), Func(x[1][1]), Func(x[1][2]), Func(x[1][3]), |
| 119 | Func(x[2][0]), Func(x[2][1]), Func(x[2][2]), Func(x[2][3]), |
| 120 | Func(x[3][0]), Func(x[3][1]), Func(x[3][2]), Func(x[3][3]) |
| 121 | ); |
| 122 | } |
| 123 | |
| 124 | }; |
| 125 | |
| 126 | } |
| 127 | |
| 128 | } |