Skip to content

Commit fc164b3

Browse files
committed
fix
1 parent 58fb6a0 commit fc164b3

File tree

3 files changed

+78
-78
lines changed

3 files changed

+78
-78
lines changed

include/omath/Mat.hpp

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ namespace omath
2525

2626
template<size_t Rows = 0, size_t Columns = 0, class Type = float, MatStoreType StoreType = MatStoreType::ROW_MAJOR>
2727
requires std::is_arithmetic_v<Type>
28-
class OMATH_API Mat final
28+
class Mat final
2929
{
3030
public:
31-
constexpr Mat()
31+
OMATH_API constexpr Mat()
3232
{
3333
Clear();
3434
}
35-
constexpr static MatStoreType GetStoreOrdering()
35+
OMATH_API constexpr static MatStoreType GetStoreOrdering()
3636
{
3737
return StoreType;
3838
}
39-
constexpr Mat(const std::initializer_list<std::initializer_list<Type>>& rows)
39+
OMATH_API constexpr Mat(const std::initializer_list<std::initializer_list<Type>>& rows)
4040
{
4141
if (rows.size() != Rows)
4242
throw std::invalid_argument("Initializer list rows size does not match template parameter Rows");
@@ -56,40 +56,40 @@ namespace omath
5656
}
5757
}
5858

59-
constexpr explicit Mat(const Type* rawData)
59+
OMATH_API constexpr explicit Mat(const Type* rawData)
6060
{
6161
std::copy_n(rawData, Rows * Columns, m_data.begin());
6262
}
6363

64-
constexpr Mat(const Mat& other) noexcept
64+
OMATH_API constexpr Mat(const Mat& other) noexcept
6565
{
6666
m_data = other.m_data;
6767
}
6868

69-
constexpr Mat(Mat&& other) noexcept
69+
OMATH_API constexpr Mat(Mat&& other) noexcept
7070
{
7171
m_data = std::move(other.m_data);
7272
}
7373

7474
[[nodiscard]]
75-
static constexpr size_t RowCount() noexcept
75+
OMATH_API static constexpr size_t RowCount() noexcept
7676
{
7777
return Rows;
7878
}
7979

8080
[[nodiscard]]
81-
static constexpr size_t ColumnsCount() noexcept
81+
OMATH_API static constexpr size_t ColumnsCount() noexcept
8282
{
8383
return Columns;
8484
}
8585

8686
[[nodiscard]]
87-
static consteval MatSize Size() noexcept
87+
OMATH_API static consteval MatSize Size() noexcept
8888
{
8989
return {Rows, Columns};
9090
}
9191

92-
[[nodiscard]] constexpr const Type& At(const size_t rowIndex, const size_t columnIndex) const
92+
[[nodiscard]] OMATH_API constexpr const Type& At(const size_t rowIndex, const size_t columnIndex) const
9393
{
9494
if (rowIndex >= Rows || columnIndex >= Columns)
9595
throw std::out_of_range("Index out of range");
@@ -107,13 +107,13 @@ namespace omath
107107
}
108108
}
109109

110-
[[nodiscard]] constexpr Type& At(const size_t rowIndex, const size_t columnIndex)
110+
[[nodiscard]] OMATH_API constexpr Type& At(const size_t rowIndex, const size_t columnIndex)
111111
{
112112
return const_cast<Type&>(std::as_const(*this).At(rowIndex, columnIndex));
113113
}
114114

115115
[[nodiscard]]
116-
constexpr Type Sum() const noexcept
116+
OMATH_API constexpr Type Sum() const noexcept
117117
{
118118
Type sum = 0;
119119
for (size_t i = 0; i < Rows; ++i)
@@ -123,20 +123,20 @@ namespace omath
123123
return sum;
124124
}
125125

126-
constexpr void Clear() noexcept
126+
OMATH_API constexpr void Clear() noexcept
127127
{
128128
Set(0);
129129
}
130130

131-
constexpr void Set(const Type& value) noexcept
131+
OMATH_API constexpr void Set(const Type& value) noexcept
132132
{
133133
std::ranges::fill(m_data, value);
134134
}
135135

136136
// Operator overloading for multiplication with another Mat
137137
template<size_t OtherColumns>
138138
constexpr Mat<Rows, OtherColumns, Type, StoreType>
139-
operator*(const Mat<Columns, OtherColumns, Type, StoreType>& other) const
139+
OMATH_API operator*(const Mat<Columns, OtherColumns, Type, StoreType>& other) const
140140
{
141141
Mat<Rows, OtherColumns, Type, StoreType> result;
142142

@@ -151,7 +151,7 @@ namespace omath
151151
return result;
152152
}
153153

154-
constexpr Mat& operator*=(const Type& f) noexcept
154+
OMATH_API constexpr Mat& operator*=(const Type& f) noexcept
155155
{
156156
for (size_t i = 0; i < Rows; ++i)
157157
for (size_t j = 0; j < Columns; ++j)
@@ -161,34 +161,34 @@ namespace omath
161161

162162
template<size_t OtherColumns>
163163
constexpr Mat<Rows, OtherColumns, Type, StoreType>
164-
operator*=(const Mat<Columns, OtherColumns, Type, StoreType>& other)
164+
OMATH_API operator*=(const Mat<Columns, OtherColumns, Type, StoreType>& other)
165165
{
166166
return *this = *this * other;
167167
}
168168

169-
constexpr Mat operator*(const Type& f) const noexcept
169+
OMATH_API constexpr Mat operator*(const Type& f) const noexcept
170170
{
171171
Mat result(*this);
172172
result *= f;
173173
return result;
174174
}
175175

176-
constexpr Mat& operator/=(const Type& f) noexcept
176+
OMATH_API constexpr Mat& operator/=(const Type& f) noexcept
177177
{
178178
for (size_t i = 0; i < Rows; ++i)
179179
for (size_t j = 0; j < Columns; ++j)
180180
At(i, j) /= f;
181181
return *this;
182182
}
183183

184-
constexpr Mat operator/(const Type& f) const noexcept
184+
OMATH_API constexpr Mat operator/(const Type& f) const noexcept
185185
{
186186
Mat result(*this);
187187
result /= f;
188188
return result;
189189
}
190190

191-
constexpr Mat& operator=(const Mat& other) noexcept
191+
OMATH_API constexpr Mat& operator=(const Mat& other) noexcept
192192
{
193193
if (this == &other)
194194
return *this;
@@ -198,7 +198,7 @@ namespace omath
198198
return *this;
199199
}
200200

201-
constexpr Mat& operator=(Mat&& other) noexcept
201+
OMATH_API constexpr Mat& operator=(Mat&& other) noexcept
202202
{
203203
if (this == &other)
204204
return *this;
@@ -211,7 +211,7 @@ namespace omath
211211
}
212212

213213
[[nodiscard]]
214-
constexpr Mat<Columns, Rows, Type, StoreType> Transposed() const noexcept
214+
OMATH_API constexpr Mat<Columns, Rows, Type, StoreType> Transposed() const noexcept
215215
{
216216
Mat<Columns, Rows, Type, StoreType> transposed;
217217
for (size_t i = 0; i < Rows; ++i)
@@ -222,7 +222,7 @@ namespace omath
222222
}
223223

224224
[[nodiscard]]
225-
constexpr Type Determinant() const
225+
OMATH_API constexpr Type Determinant() const
226226
{
227227
static_assert(Rows == Columns, "Determinant is only defined for square matrices.");
228228

@@ -244,7 +244,7 @@ namespace omath
244244
}
245245

246246
[[nodiscard]]
247-
constexpr Mat<Rows - 1, Columns - 1, Type, StoreType> Minor(const size_t row, const size_t column) const
247+
OMATH_API constexpr Mat<Rows - 1, Columns - 1, Type, StoreType> Minor(const size_t row, const size_t column) const
248248
{
249249
Mat<Rows - 1, Columns - 1, Type, StoreType> result;
250250
for (size_t i = 0, m = 0; i < Rows; ++i)
@@ -264,19 +264,19 @@ namespace omath
264264
}
265265

266266
[[nodiscard]]
267-
constexpr const std::array<Type, Rows * Columns>& RawArray() const
267+
OMATH_API constexpr const std::array<Type, Rows * Columns>& RawArray() const
268268
{
269269
return m_data;
270270
}
271271

272272
[[nodiscard]]
273-
constexpr std::array<Type, Rows * Columns>& RawArray()
273+
OMATH_API constexpr std::array<Type, Rows * Columns>& RawArray()
274274
{
275275
return const_cast<std::array<Type, Rows * Columns>>(std::as_const(*this).RawArray());
276276
}
277277

278278
[[nodiscard]]
279-
std::string ToString() const noexcept
279+
OMATH_API std::string ToString() const noexcept
280280
{
281281
std::ostringstream oss;
282282
for (size_t i = 0; i < Rows; ++i)
@@ -293,20 +293,20 @@ namespace omath
293293
}
294294

295295
[[nodiscard]]
296-
bool operator==(const Mat& mat) const
296+
OMATH_API bool operator==(const Mat& mat) const
297297
{
298298
return m_data == mat.m_data;
299299
}
300300

301301
[[nodiscard]]
302-
bool operator!=(const Mat& mat) const
302+
OMATH_API bool operator!=(const Mat& mat) const
303303
{
304304
return !operator==(mat);
305305
}
306306

307307
// Static methods that return fixed-size matrices
308308
[[nodiscard]]
309-
constexpr static Mat<4, 4> ToScreenMat(const Type& screenWidth, const Type& screenHeight) noexcept
309+
OMATH_API constexpr static Mat<4, 4> ToScreenMat(const Type& screenWidth, const Type& screenHeight) noexcept
310310
{
311311
return {
312312
{screenWidth / 2, 0, 0, 0},
@@ -336,7 +336,7 @@ namespace omath
336336

337337
template<class Type = float, MatStoreType St = MatStoreType::ROW_MAJOR>
338338
[[nodiscard]]
339-
constexpr Mat<4, 4, Type, St> MatTranslation(const Vector3& diff) noexcept
339+
OMATH_API constexpr Mat<4, 4, Type, St> MatTranslation(const Vector3& diff) noexcept
340340
{
341341
return
342342
{
@@ -349,7 +349,7 @@ namespace omath
349349

350350
template<class Type = float, MatStoreType St = MatStoreType::ROW_MAJOR, class Angle>
351351
[[nodiscard]]
352-
Mat<4, 4, Type, St> MatRotationAxisX(const Angle& angle) noexcept
352+
OMATH_API Mat<4, 4, Type, St> MatRotationAxisX(const Angle& angle) noexcept
353353
{
354354
return
355355
{
@@ -362,7 +362,7 @@ namespace omath
362362

363363
template<class Type = float, MatStoreType St = MatStoreType::ROW_MAJOR, class Angle>
364364
[[nodiscard]]
365-
Mat<4, 4, Type, St> MatRotationAxisY(const Angle& angle) noexcept
365+
OMATH_API Mat<4, 4, Type, St> MatRotationAxisY(const Angle& angle) noexcept
366366
{
367367
return
368368
{
@@ -375,7 +375,7 @@ namespace omath
375375

376376
template<class Type = float, MatStoreType St = MatStoreType::ROW_MAJOR, class Angle>
377377
[[nodiscard]]
378-
Mat<4, 4, Type, St> MatRotationAxisZ(const Angle& angle) noexcept
378+
OMATH_API Mat<4, 4, Type, St> MatRotationAxisZ(const Angle& angle) noexcept
379379
{
380380
return
381381
{
@@ -403,7 +403,7 @@ namespace omath
403403

404404
template<class Type = float, MatStoreType St = MatStoreType::ROW_MAJOR, class ViewAngles>
405405
[[nodiscard]]
406-
Mat<4, 4, Type, St> MatRotation(const ViewAngles& angles) noexcept
406+
OMATH_API Mat<4, 4, Type, St> MatRotation(const ViewAngles& angles) noexcept
407407
{
408408
return MatRotationAxisZ(angles.yaw) * MatRotationAxisY(angles.pitch) * MatRotationAxisX(angles.roll);
409409
}

0 commit comments

Comments
 (0)