master
ブランチ master
VulkanExample / dep / include / glm / detail / type_mat2x2.hpp
6.7 KB、180行 生 Blame 履歴
1/// @ref core
2/// @file glm/detail/type_mat2x2.hpp
3
4#pragma once
5
6#include "type_vec2.hpp"
7#include <limits>
8#include <cstddef>
9
10namespace glm
11{
12 template<typename T, qualifier Q>
13 struct mat<2, 2, T, Q>
14 {
15 typedef vec<2, T, Q> col_type;
16 typedef vec<2, T, Q> row_type;
17 typedef mat<2, 2, T, Q> type;
18 typedef mat<2, 2, T, Q> transpose_type;
19 typedef T value_type;
20
21 private:
22 col_type value[2];
23
24 public:
25 // -- Accesses --
26
27 typedef length_t length_type;
28 GLM_FUNC_DECL static constexpr length_type length() { return 2; }
29
30 GLM_FUNC_DECL GLM_CONSTEXPR col_type & operator[](length_type i) noexcept;
31 GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const noexcept;
32
33 // -- Constructors --
34
35 GLM_DEFAULTED_DEFAULT_CTOR_DECL GLM_CONSTEXPR mat() GLM_DEFAULT_CTOR;
36 GLM_CTOR_DECL mat(mat<2, 2, T, Q> const& m) = default;
37 template<qualifier P>
38 GLM_CTOR_DECL mat(mat<2, 2, T, P> const& m);
39
40 GLM_CTOR_DECL GLM_EXPLICIT mat(T scalar);
41 GLM_CTOR_DECL mat(
42 T const& x1, T const& y1,
43 T const& x2, T const& y2);
44 GLM_CTOR_DECL mat(
45 col_type const& v1,
46 col_type const& v2);
47
48 // -- Conversions --
49
50 template<typename U, typename V, typename M, typename N>
51 GLM_CTOR_DECL mat(
52 U const& x1, V const& y1,
53 M const& x2, N const& y2);
54
55 template<typename U, typename V>
56 GLM_CTOR_DECL mat(
57 vec<2, U, Q> const& v1,
58 vec<2, V, Q> const& v2);
59
60 // -- Matrix conversions --
61
62 template<typename U, qualifier P>
63 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<2, 2, U, P> const& m);
64
65 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<3, 3, T, Q> const& x);
66 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<4, 4, T, Q> const& x);
67 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<2, 3, T, Q> const& x);
68 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<3, 2, T, Q> const& x);
69 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<2, 4, T, Q> const& x);
70 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<4, 2, T, Q> const& x);
71 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<3, 4, T, Q> const& x);
72 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<4, 3, T, Q> const& x);
73
74 // -- Unary arithmetic operators --
75
76 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q>& operator=(mat<2, 2, T, Q> const& m) = default;
77
78 template<typename U>
79 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q>& operator=(mat<2, 2, U, Q> const& m);
80 template<typename U>
81 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q>& operator+=(U s);
82 template<typename U>
83 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q>& operator+=(mat<2, 2, U, Q> const& m);
84 template<typename U>
85 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q>& operator-=(U s);
86 template<typename U>
87 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q>& operator-=(mat<2, 2, U, Q> const& m);
88 template<typename U>
89 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q>& operator*=(U s);
90 template<typename U>
91 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q>& operator*=(mat<2, 2, U, Q> const& m);
92 template<typename U>
93 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q>& operator/=(U s);
94 template<typename U>
95 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q>& operator/=(mat<2, 2, U, Q> const& m);
96
97 // -- Increment and decrement operators --
98
99 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator++ ();
100 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<2, 2, T, Q> & operator-- ();
101 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator++(int);
102 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator--(int);
103 };
104
105 // -- Unary operators --
106
107 template<typename T, qualifier Q>
108 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m);
109
110 template<typename T, qualifier Q>
111 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m);
112
113 // -- Binary operators --
114
115 template<typename T, qualifier Q>
116 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m, T scalar);
117
118 template<typename T, qualifier Q>
119 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator+(T scalar, mat<2, 2, T, Q> const& m);
120
121 template<typename T, qualifier Q>
122 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator+(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
123
124 template<typename T, qualifier Q>
125 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m, T scalar);
126
127 template<typename T, qualifier Q>
128 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator-(T scalar, mat<2, 2, T, Q> const& m);
129
130 template<typename T, qualifier Q>
131 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator-(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
132
133 template<typename T, qualifier Q>
134 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator*(mat<2, 2, T, Q> const& m, T scalar);
135
136 template<typename T, qualifier Q>
137 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator*(T scalar, mat<2, 2, T, Q> const& m);
138
139 template<typename T, qualifier Q>
140 GLM_FUNC_DECL GLM_CONSTEXPR typename mat<2, 2, T, Q>::col_type operator*(mat<2, 2, T, Q> const& m, typename mat<2, 2, T, Q>::row_type const& v);
141
142 template<typename T, qualifier Q>
143 GLM_FUNC_DECL GLM_CONSTEXPR typename mat<2, 2, T, Q>::row_type operator*(typename mat<2, 2, T, Q>::col_type const& v, mat<2, 2, T, Q> const& m);
144
145 template<typename T, qualifier Q>
146 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
147
148 template<typename T, qualifier Q>
149 GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);
150
151 template<typename T, qualifier Q>
152 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 2, T, Q> operator*(mat<2, 2, T, Q> const& m1, mat<4, 2, T, Q> const& m2);
153
154 template<typename T, qualifier Q>
155 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m, T scalar);
156
157 template<typename T, qualifier Q>
158 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator/(T scalar, mat<2, 2, T, Q> const& m);
159
160 template<typename T, qualifier Q>
161 GLM_FUNC_DECL GLM_CONSTEXPR typename mat<2, 2, T, Q>::col_type operator/(mat<2, 2, T, Q> const& m, typename mat<2, 2, T, Q>::row_type const& v);
162
163 template<typename T, qualifier Q>
164 GLM_FUNC_DECL GLM_CONSTEXPR typename mat<2, 2, T, Q>::row_type operator/(typename mat<2, 2, T, Q>::col_type const& v, mat<2, 2, T, Q> const& m);
165
166 template<typename T, qualifier Q>
167 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 2, T, Q> operator/(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
168
169 // -- Boolean operators --
170
171 template<typename T, qualifier Q>
172 GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
173
174 template<typename T, qualifier Q>
175 GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(mat<2, 2, T, Q> const& m1, mat<2, 2, T, Q> const& m2);
176} //namespace glm
177
178#ifndef GLM_EXTERNAL_TEMPLATE
179#include "type_mat2x2.inl"
180#endif