master
ブランチ master
VulkanExample / dep / include / glm / detail / type_mat4x4.hpp
7.4 KB、191行 生 Blame 履歴
1/// @ref core
2/// @file glm/detail/type_mat4x4.hpp
3
4#pragma once
5
6#include "type_vec4.hpp"
7#include <limits>
8#include <cstddef>
9
10namespace glm
11{
12 template<typename T, qualifier Q>
13 struct mat<4, 4, T, Q>
14 {
15 typedef vec<4, T, Q> col_type;
16 typedef vec<4, T, Q> row_type;
17 typedef mat<4, 4, T, Q> type;
18 typedef mat<4, 4, T, Q> transpose_type;
19 typedef T value_type;
20
21 private:
22 col_type value[4];
23
24 public:
25 // -- Accesses --
26
27 typedef length_t length_type;
28 GLM_FUNC_DECL static constexpr length_type length(){return 4;}
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<4, 4, T, Q> const& m) = default;
37 template<qualifier P>
38 GLM_CTOR_DECL mat(mat<4, 4, T, P> const& m);
39
40 GLM_CTOR_DECL GLM_EXPLICIT mat(T s);
41 GLM_CTOR_DECL mat(
42 T const& x0, T const& y0, T const& z0, T const& w0,
43 T const& x1, T const& y1, T const& z1, T const& w1,
44 T const& x2, T const& y2, T const& z2, T const& w2,
45 T const& x3, T const& y3, T const& z3, T const& w3);
46 GLM_CTOR_DECL mat(
47 col_type const& v0,
48 col_type const& v1,
49 col_type const& v2,
50 col_type const& v3);
51
52 // -- Conversions --
53
54 template<
55 typename X1, typename Y1, typename Z1, typename W1,
56 typename X2, typename Y2, typename Z2, typename W2,
57 typename X3, typename Y3, typename Z3, typename W3,
58 typename X4, typename Y4, typename Z4, typename W4>
59 GLM_CTOR_DECL mat(
60 X1 const& x1, Y1 const& y1, Z1 const& z1, W1 const& w1,
61 X2 const& x2, Y2 const& y2, Z2 const& z2, W2 const& w2,
62 X3 const& x3, Y3 const& y3, Z3 const& z3, W3 const& w3,
63 X4 const& x4, Y4 const& y4, Z4 const& z4, W4 const& w4);
64
65 template<typename V1, typename V2, typename V3, typename V4>
66 GLM_CTOR_DECL mat(
67 vec<4, V1, Q> const& v1,
68 vec<4, V2, Q> const& v2,
69 vec<4, V3, Q> const& v3,
70 vec<4, V4, Q> const& v4);
71
72 // -- Matrix conversions --
73
74 template<typename U, qualifier P>
75 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<4, 4, U, P> const& m);
76
77 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<2, 2, T, Q> const& x);
78 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<3, 3, T, Q> const& x);
79 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<2, 3, T, Q> const& x);
80 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<3, 2, T, Q> const& x);
81 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<2, 4, T, Q> const& x);
82 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<4, 2, T, Q> const& x);
83 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<3, 4, T, Q> const& x);
84 GLM_CTOR_DECL GLM_EXPLICIT mat(mat<4, 3, T, Q> const& x);
85
86 // -- Unary arithmetic operators --
87
88 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q>& operator=(mat<4, 4, T, Q> const& m) = default;
89 template<typename U>
90 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q>& operator=(mat<4, 4, U, Q> const& m);
91 template<typename U>
92 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q>& operator+=(U s);
93 template<typename U>
94 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q>& operator+=(mat<4, 4, U, Q> const& m);
95 template<typename U>
96 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q>& operator-=(U s);
97 template<typename U>
98 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q>& operator-=(mat<4, 4, U, Q> const& m);
99 template<typename U>
100 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q>& operator*=(U s);
101 template<typename U>
102 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q>& operator*=(mat<4, 4, U, Q> const& m);
103 template<typename U>
104 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q>& operator/=(U s);
105 template<typename U>
106 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q>& operator/=(mat<4, 4, U, Q> const& m);
107
108 // -- Increment and decrement operators --
109
110 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q>& operator++();
111 GLM_FUNC_DISCARD_DECL GLM_CONSTEXPR mat<4, 4, T, Q>& operator--();
112 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator++(int);
113 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator--(int);
114 };
115
116 // -- Unary operators --
117
118 template<typename T, qualifier Q>
119 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m);
120
121 template<typename T, qualifier Q>
122 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m);
123
124 // -- Binary operators --
125
126 template<typename T, qualifier Q>
127 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m, T scalar);
128
129 template<typename T, qualifier Q>
130 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator+(T scalar, mat<4, 4, T, Q> const& m);
131
132 template<typename T, qualifier Q>
133 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator+(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
134
135 template<typename T, qualifier Q>
136 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m, T scalar);
137
138 template<typename T, qualifier Q>
139 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator-(T scalar, mat<4, 4, T, Q> const& m);
140
141 template<typename T, qualifier Q>
142 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator-(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
143
144 template<typename T, qualifier Q>
145 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m, T scalar);
146
147 template<typename T, qualifier Q>
148 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator*(T scalar, mat<4, 4, T, Q> const& m);
149
150 template<typename T, qualifier Q>
151 GLM_FUNC_DECL GLM_CONSTEXPR typename mat<4, 4, T, Q>::col_type operator*(mat<4, 4, T, Q> const& m, typename mat<4, 4, T, Q>::row_type const& v);
152
153 template<typename T, qualifier Q>
154 GLM_FUNC_DECL GLM_CONSTEXPR typename mat<4, 4, T, Q>::row_type operator*(typename mat<4, 4, T, Q>::col_type const& v, mat<4, 4, T, Q> const& m);
155
156 template<typename T, qualifier Q>
157 GLM_FUNC_DECL GLM_CONSTEXPR mat<2, 4, T, Q> operator*(mat<4, 4, T, Q> const& m1, mat<2, 4, T, Q> const& m2);
158
159 template<typename T, qualifier Q>
160 GLM_FUNC_DECL GLM_CONSTEXPR mat<3, 4, T, Q> operator*(mat<4, 4, T, Q> const& m1, mat<3, 4, T, Q> const& m2);
161
162 template<typename T, qualifier Q>
163 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator*(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
164
165 template<typename T, qualifier Q>
166 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m, T scalar);
167
168 template<typename T, qualifier Q>
169 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator/(T scalar, mat<4, 4, T, Q> const& m);
170
171 template<typename T, qualifier Q>
172 GLM_FUNC_DECL GLM_CONSTEXPR typename mat<4, 4, T, Q>::col_type operator/(mat<4, 4, T, Q> const& m, typename mat<4, 4, T, Q>::row_type const& v);
173
174 template<typename T, qualifier Q>
175 GLM_FUNC_DECL GLM_CONSTEXPR typename mat<4, 4, T, Q>::row_type operator/(typename mat<4, 4, T, Q>::col_type const& v, mat<4, 4, T, Q> const& m);
176
177 template<typename T, qualifier Q>
178 GLM_FUNC_DECL GLM_CONSTEXPR mat<4, 4, T, Q> operator/(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
179
180 // -- Boolean operators --
181
182 template<typename T, qualifier Q>
183 GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
184
185 template<typename T, qualifier Q>
186 GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(mat<4, 4, T, Q> const& m1, mat<4, 4, T, Q> const& m2);
187}//namespace glm
188
189#ifndef GLM_EXTERNAL_TEMPLATE
190#include "type_mat4x4.inl"
191#endif//GLM_EXTERNAL_TEMPLATE