diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index edda590..adc159a 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,7 +2,6 @@
-
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 31fdfbc..9af2110 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,10 +21,6 @@ endif()
target_compile_definitions(omath PUBLIC OMATH_EXPORT)
-if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
- target_compile_options(omath PRIVATE /Zc:static_assert-)
-endif()
-
add_subdirectory(source)
if(OMATH_BUILD_TESTS)
diff --git a/include/omath/Angle.hpp b/include/omath/Angle.hpp
index 9b66495..4ae0dee 100644
--- a/include/omath/Angle.hpp
+++ b/include/omath/Angle.hpp
@@ -4,9 +4,7 @@
#pragma once
#include "omath/Angles.hpp"
-
#include
-#include "omath/omath_export.hpp"
namespace omath
{
@@ -18,7 +16,7 @@ namespace omath
template
requires std::is_arithmetic_v
- class OMATH_API Angle
+ class Angle
{
Type m_angle;
constexpr Angle(const Type& degrees)
diff --git a/include/omath/Color.hpp b/include/omath/Color.hpp
index 19185e8..642adcc 100644
--- a/include/omath/Color.hpp
+++ b/include/omath/Color.hpp
@@ -7,11 +7,10 @@
#include "omath/Vector3.hpp"
#include
#include "omath/Vector4.hpp"
-#include "omath/omath_export.hpp"
namespace omath
{
- struct OMATH_API HSV
+ struct HSV
{
float m_hue{};
float m_saturation{};
@@ -19,7 +18,7 @@ namespace omath
};
- class OMATH_API Color final : public Vector4
+ class Color final : public Vector4
{
public:
constexpr Color(float r, float g, float b, float a) : Vector4(r,g,b,a)
diff --git a/include/omath/Mat.hpp b/include/omath/Mat.hpp
index 63cbdef..382d900 100644
--- a/include/omath/Mat.hpp
+++ b/include/omath/Mat.hpp
@@ -8,11 +8,10 @@
#include
#include
#include "Vector3.hpp"
-#include "omath/omath_export.hpp"
namespace omath
{
- struct OMATH_API MatSize
+ struct MatSize
{
size_t rows, columns;
};
@@ -28,15 +27,15 @@ namespace omath
class Mat final
{
public:
- OMATH_API constexpr Mat()
+ constexpr Mat()
{
Clear();
}
- OMATH_API constexpr static MatStoreType GetStoreOrdering()
+ constexpr static MatStoreType GetStoreOrdering()
{
return StoreType;
}
- OMATH_API constexpr Mat(const std::initializer_list>& rows)
+ constexpr Mat(const std::initializer_list>& rows)
{
if (rows.size() != Rows)
throw std::invalid_argument("Initializer list rows size does not match template parameter Rows");
@@ -56,45 +55,45 @@ namespace omath
}
}
- OMATH_API constexpr explicit Mat(const Type* rawData)
+ constexpr explicit Mat(const Type* rawData)
{
std::copy_n(rawData, Rows * Columns, m_data.begin());
}
- OMATH_API constexpr Mat(const Mat& other) noexcept
+ constexpr Mat(const Mat& other) noexcept
{
m_data = other.m_data;
}
- OMATH_API constexpr Type& operator[](const size_t row, const size_t col)
+ constexpr Type& operator[](const size_t row, const size_t col)
{
return At(row, col);
}
- OMATH_API constexpr Mat(Mat&& other) noexcept
+ constexpr Mat(Mat&& other) noexcept
{
m_data = std::move(other.m_data);
}
[[nodiscard]]
- OMATH_API static constexpr size_t RowCount() noexcept
+ static constexpr size_t RowCount() noexcept
{
return Rows;
}
[[nodiscard]]
- OMATH_API static constexpr size_t ColumnsCount() noexcept
+ static constexpr size_t ColumnsCount() noexcept
{
return Columns;
}
[[nodiscard]]
- OMATH_API static consteval MatSize Size() noexcept
+ static consteval MatSize Size() noexcept
{
return {Rows, Columns};
}
- [[nodiscard]] OMATH_API constexpr const Type& At(const size_t rowIndex, const size_t columnIndex) const
+ [[nodiscard]] constexpr const Type& At(const size_t rowIndex, const size_t columnIndex) const
{
if (rowIndex >= Rows || columnIndex >= Columns)
throw std::out_of_range("Index out of range");
@@ -112,13 +111,13 @@ namespace omath
}
}
- [[nodiscard]] OMATH_API constexpr Type& At(const size_t rowIndex, const size_t columnIndex)
+ [[nodiscard]] constexpr Type& At(const size_t rowIndex, const size_t columnIndex)
{
return const_cast(std::as_const(*this).At(rowIndex, columnIndex));
}
[[nodiscard]]
- OMATH_API constexpr Type Sum() const noexcept
+ constexpr Type Sum() const noexcept
{
Type sum = 0;
for (size_t i = 0; i < Rows; ++i)
@@ -128,12 +127,12 @@ namespace omath
return sum;
}
- OMATH_API constexpr void Clear() noexcept
+ constexpr void Clear() noexcept
{
Set(0);
}
- OMATH_API constexpr void Set(const Type& value) noexcept
+ constexpr void Set(const Type& value) noexcept
{
std::ranges::fill(m_data, value);
}
@@ -141,7 +140,7 @@ namespace omath
// Operator overloading for multiplication with another Mat
template
constexpr Mat
- OMATH_API operator*(const Mat& other) const
+ operator*(const Mat& other) const
{
Mat result;
@@ -156,7 +155,7 @@ namespace omath
return result;
}
- OMATH_API constexpr Mat& operator*=(const Type& f) noexcept
+ constexpr Mat& operator*=(const Type& f) noexcept
{
for (size_t i = 0; i < Rows; ++i)
for (size_t j = 0; j < Columns; ++j)
@@ -166,19 +165,19 @@ namespace omath
template
constexpr Mat
- OMATH_API operator*=(const Mat& other)
+ operator*=(const Mat& other)
{
return *this = *this * other;
}
- OMATH_API constexpr Mat operator*(const Type& f) const noexcept
+ constexpr Mat operator*(const Type& f) const noexcept
{
Mat result(*this);
result *= f;
return result;
}
- OMATH_API constexpr Mat& operator/=(const Type& f) noexcept
+ constexpr Mat& operator/=(const Type& f) noexcept
{
for (size_t i = 0; i < Rows; ++i)
for (size_t j = 0; j < Columns; ++j)
@@ -186,14 +185,14 @@ namespace omath
return *this;
}
- OMATH_API constexpr Mat operator/(const Type& f) const noexcept
+ constexpr Mat operator/(const Type& f) const noexcept
{
Mat result(*this);
result /= f;
return result;
}
- OMATH_API constexpr Mat& operator=(const Mat& other) noexcept
+ constexpr Mat& operator=(const Mat& other) noexcept
{
if (this == &other)
return *this;
@@ -203,7 +202,7 @@ namespace omath
return *this;
}
- OMATH_API constexpr Mat& operator=(Mat&& other) noexcept
+ constexpr Mat& operator=(Mat&& other) noexcept
{
if (this == &other)
return *this;
@@ -216,7 +215,7 @@ namespace omath
}
[[nodiscard]]
- OMATH_API constexpr Mat Transposed() const noexcept
+ constexpr Mat Transposed() const noexcept
{
Mat transposed;
for (size_t i = 0; i < Rows; ++i)
@@ -227,7 +226,7 @@ namespace omath
}
[[nodiscard]]
- OMATH_API constexpr Type Determinant() const
+ constexpr Type Determinant() const
{
static_assert(Rows == Columns, "Determinant is only defined for square matrices.");
@@ -249,7 +248,7 @@ namespace omath
}
[[nodiscard]]
- OMATH_API constexpr Mat Minor(const size_t row, const size_t column) const
+ constexpr Mat Minor(const size_t row, const size_t column) const
{
Mat result;
for (size_t i = 0, m = 0; i < Rows; ++i)
@@ -269,19 +268,19 @@ namespace omath
}
[[nodiscard]]
- OMATH_API constexpr const std::array& RawArray() const
+ constexpr const std::array& RawArray() const
{
return m_data;
}
[[nodiscard]]
- OMATH_API constexpr std::array& RawArray()
+ constexpr std::array& RawArray()
{
return const_cast>(std::as_const(*this).RawArray());
}
[[nodiscard]]
- OMATH_API std::string ToString() const noexcept
+ std::string ToString() const noexcept
{
std::ostringstream oss;
for (size_t i = 0; i < Rows; ++i)
@@ -298,20 +297,20 @@ namespace omath
}
[[nodiscard]]
- OMATH_API bool operator==(const Mat& mat) const
+ bool operator==(const Mat& mat) const
{
return m_data == mat.m_data;
}
[[nodiscard]]
- OMATH_API bool operator!=(const Mat& mat) const
+ bool operator!=(const Mat& mat) const
{
return !operator==(mat);
}
// Static methods that return fixed-size matrices
[[nodiscard]]
- OMATH_API constexpr static Mat<4, 4> ToScreenMat(const Type& screenWidth, const Type& screenHeight) noexcept
+ constexpr static Mat<4, 4> ToScreenMat(const Type& screenWidth, const Type& screenHeight) noexcept
{
return {
{screenWidth / 2, 0, 0, 0},
@@ -341,7 +340,7 @@ namespace omath
template
[[nodiscard]]
- OMATH_API constexpr Mat<4, 4, Type, St> MatTranslation(const Vector3& diff) noexcept
+ constexpr Mat<4, 4, Type, St> MatTranslation(const Vector3& diff) noexcept
{
return
{
@@ -354,7 +353,7 @@ namespace omath
template
[[nodiscard]]
- OMATH_API Mat<4, 4, Type, St> MatRotationAxisX(const Angle& angle) noexcept
+ Mat<4, 4, Type, St> MatRotationAxisX(const Angle& angle) noexcept
{
return
{
@@ -367,7 +366,7 @@ namespace omath
template
[[nodiscard]]
- OMATH_API Mat<4, 4, Type, St> MatRotationAxisY(const Angle& angle) noexcept
+ Mat<4, 4, Type, St> MatRotationAxisY(const Angle& angle) noexcept
{
return
{
@@ -380,7 +379,7 @@ namespace omath
template
[[nodiscard]]
- OMATH_API Mat<4, 4, Type, St> MatRotationAxisZ(const Angle& angle) noexcept
+ Mat<4, 4, Type, St> MatRotationAxisZ(const Angle& angle) noexcept
{
return
{
@@ -408,7 +407,7 @@ namespace omath
template
[[nodiscard]]
- OMATH_API Mat<4, 4, Type, St> MatRotation(const ViewAngles& angles) noexcept
+ Mat<4, 4, Type, St> MatRotation(const ViewAngles& angles) noexcept
{
return MatRotationAxisZ(angles.yaw) * MatRotationAxisY(angles.pitch) * MatRotationAxisX(angles.roll);
}
diff --git a/include/omath/Matrix.hpp b/include/omath/Matrix.hpp
index 78314a3..6e7e409 100644
--- a/include/omath/Matrix.hpp
+++ b/include/omath/Matrix.hpp
@@ -2,7 +2,6 @@
#include
#include
#include
-#include "omath/omath_export.hpp"
namespace omath
{
@@ -11,98 +10,98 @@ namespace omath
class Matrix final
{
public:
- OMATH_API Matrix();
- OMATH_API Matrix(size_t rows, size_t columns);
+ Matrix();
+ Matrix(size_t rows, size_t columns);
- OMATH_API Matrix(const std::initializer_list>& rows);
+ Matrix(const std::initializer_list>& rows);
[[nodiscard]]
- OMATH_API static Matrix ToScreenMatrix(float screenWidth, float screenHeight);
+ static Matrix ToScreenMatrix(float screenWidth, float screenHeight);
[[nodiscard]]
- OMATH_API static Matrix TranslationMatrix(const Vector3& diff);
+ static Matrix TranslationMatrix(const Vector3& diff);
[[nodiscard]]
- OMATH_API static Matrix OrientationMatrix(const Vector3& forward, const Vector3& right, const Vector3& up);
+ static Matrix OrientationMatrix(const Vector3& forward, const Vector3& right, const Vector3& up);
[[nodiscard]]
- OMATH_API static Matrix ProjectionMatrix(float fieldOfView, float aspectRatio, float near, float far);
+ static Matrix ProjectionMatrix(float fieldOfView, float aspectRatio, float near, float far);
- OMATH_API Matrix(const Matrix& other);
+ Matrix(const Matrix& other);
- OMATH_API Matrix(size_t rows, size_t columns, const float* pRaw);
+ Matrix(size_t rows, size_t columns, const float* pRaw);
- OMATH_API Matrix(Matrix&& other) noexcept;
+ Matrix(Matrix&& other) noexcept;
[[nodiscard]]
- OMATH_API size_t RowCount() const noexcept;
+ size_t RowCount() const noexcept;
[[nodiscard]]
- OMATH_API float& operator[](size_t row, size_t column)
+ float& operator[](size_t row, size_t column)
{
return At(row, column);
}
[[nodiscard]]
- OMATH_API size_t ColumnsCount() const noexcept;
+ size_t ColumnsCount() const noexcept;
[[nodiscard]]
- OMATH_API std::pair Size() const noexcept;
+ std::pair Size() const noexcept;
[[nodiscard]]
- OMATH_API float& At(size_t iRow, size_t iCol);
+ float& At(size_t iRow, size_t iCol);
[[nodiscard]]
- OMATH_API float Sum();
+ float Sum();
- OMATH_API void SetDataFromRaw(const float* pRawMatrix);
+ void SetDataFromRaw(const float* pRawMatrix);
[[nodiscard]]
- OMATH_API Matrix Transpose() const;
+ Matrix Transpose() const;
- OMATH_API void Set(float val);
+ void Set(float val);
[[nodiscard]]
- OMATH_API const float& At(size_t iRow, size_t iCol) const;
+ const float& At(size_t iRow, size_t iCol) const;
- OMATH_API Matrix operator*(const Matrix& other) const;
+ Matrix operator*(const Matrix& other) const;
- OMATH_API Matrix& operator*=(const Matrix& other);
+ Matrix& operator*=(const Matrix& other);
- OMATH_API Matrix operator*(float f) const;
+ Matrix operator*(float f) const;
- OMATH_API Matrix& operator*=(float f);
+ Matrix& operator*=(float f);
- OMATH_API Matrix& operator/=(float f);
+ Matrix& operator/=(float f);
- OMATH_API void Clear();
+ void Clear();
[[nodiscard]]
- OMATH_API Matrix Strip(size_t row, size_t column) const;
+ Matrix Strip(size_t row, size_t column) const;
[[nodiscard]]
- OMATH_API float Minor(size_t i, size_t j) const;
+ float Minor(size_t i, size_t j) const;
[[nodiscard]]
- OMATH_API float AlgComplement(size_t i, size_t j) const;
+ float AlgComplement(size_t i, size_t j) const;
[[nodiscard]]
- OMATH_API float Determinant() const;
+ float Determinant() const;
[[nodiscard]]
- OMATH_API const float* Raw() const;
+ const float* Raw() const;
- OMATH_API Matrix& operator=(const Matrix& other);
+ Matrix& operator=(const Matrix& other);
- OMATH_API Matrix& operator=(Matrix&& other) noexcept;
+ Matrix& operator=(Matrix&& other) noexcept;
- OMATH_API Matrix operator/(float f) const;
+ Matrix operator/(float f) const;
[[nodiscard]]
- OMATH_API std::string ToString() const;
+ std::string ToString() const;
- OMATH_API ~Matrix();
+ ~Matrix();
private:
size_t m_rows;
diff --git a/include/omath/Triangle3d.hpp b/include/omath/Triangle3d.hpp
index af94482..370aa95 100644
--- a/include/omath/Triangle3d.hpp
+++ b/include/omath/Triangle3d.hpp
@@ -3,11 +3,10 @@
//
#pragma once
#include "omath/Vector3.hpp"
-#include "omath/omath_export.hpp"
namespace omath
{
- class OMATH_API Triangle3d final
+ class Triangle3d final
{
public:
Triangle3d(const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3);
diff --git a/include/omath/Vector2.hpp b/include/omath/Vector2.hpp
index 7c49135..db028cd 100644
--- a/include/omath/Vector2.hpp
+++ b/include/omath/Vector2.hpp
@@ -5,11 +5,10 @@
#pragma once
#include
#include
-#include "omath/omath_export.hpp"
namespace omath
{
- class OMATH_API Vector2
+ class Vector2
{
public:
float x = 0.f;
diff --git a/include/omath/Vector3.hpp b/include/omath/Vector3.hpp
index 9b80bc3..b24ad66 100644
--- a/include/omath/Vector3.hpp
+++ b/include/omath/Vector3.hpp
@@ -7,11 +7,10 @@
#include
#include
#include "omath/Vector2.hpp"
-#include "omath/omath_export.hpp"
namespace omath
{
- class OMATH_API Vector3 : public Vector2
+ class Vector3 : public Vector2
{
public:
float z = 0.f;
diff --git a/include/omath/Vector4.hpp b/include/omath/Vector4.hpp
index 2a6fc32..c70e2d3 100644
--- a/include/omath/Vector4.hpp
+++ b/include/omath/Vector4.hpp
@@ -5,11 +5,10 @@
#include
#include
-#include "omath/omath_export.hpp"
namespace omath
{
- class OMATH_API Vector4 : public Vector3
+ class Vector4 : public Vector3
{
public:
float w;
diff --git a/include/omath/ViewAngles.hpp b/include/omath/ViewAngles.hpp
index 164feb4..d744f6b 100644
--- a/include/omath/ViewAngles.hpp
+++ b/include/omath/ViewAngles.hpp
@@ -3,12 +3,10 @@
//
#pragma once
-#include "omath/omath_export.hpp"
-
namespace omath
{
template
- struct OMATH_API ViewAngles
+ struct ViewAngles
{
PitchType pitch;
YawType yaw;
diff --git a/include/omath/collision/LineTracer.hpp b/include/omath/collision/LineTracer.hpp
index d067562..e86f1dd 100644
--- a/include/omath/collision/LineTracer.hpp
+++ b/include/omath/collision/LineTracer.hpp
@@ -5,11 +5,10 @@
#include "omath/Vector3.hpp"
#include "omath/Triangle3d.hpp"
-#include "omath/omath_export.hpp"
namespace omath::collision
{
- class OMATH_API Ray
+ class Ray
{
public:
Vector3 start;
@@ -21,7 +20,7 @@ namespace omath::collision
[[nodiscard]]
Vector3 DirectionVectorNormalized() const;
};
- class OMATH_API LineTracer
+ class LineTracer
{
public:
LineTracer() = delete;
diff --git a/include/omath/engines/Source/Camera.hpp b/include/omath/engines/Source/Camera.hpp
index 1250d96..7298cfe 100644
--- a/include/omath/engines/Source/Camera.hpp
+++ b/include/omath/engines/Source/Camera.hpp
@@ -4,11 +4,10 @@
#pragma once
#include "Constants.h"
#include "omath/projection/Camera.hpp"
-#include "omath/omath_export.hpp"
namespace omath::source
{
- class OMATH_API Camera final : public projection::Camera
+ class Camera final : public projection::Camera
{
public:
Camera(const Vector3& position, const ViewAngles& viewAngles, const projection::ViewPort& viewPort,
diff --git a/include/omath/omath_export.hpp b/include/omath/omath_export.hpp
deleted file mode 100644
index b0949e7..0000000
--- a/include/omath/omath_export.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-/* Export prefix for functions */
-#ifdef _MSC_VER
- /* MSVC */
-# define OMATH_API_EXPORT __declspec(dllexport)
-#else
- /* GCC/Clang */
-# define OMATH_API_EXPORT __attribute__((visibility("default")))
-#endif
-
-/* Import prefix for functions */
-#ifdef _MSC_VER
-# define OMATH_API_IMPORT __declspec(dllimport)
-#else
-# define OMATH_API_IMPORT extern
-#endif
-
-/* Resolve import/export */
-#ifdef OMATH_EXPORT
-# define OMATH_API OMATH_API_EXPORT
-#else
-# define OMATH_API OMATH_API_IMPORT
-#endif
diff --git a/include/omath/pathfinding/Astar.hpp b/include/omath/pathfinding/Astar.hpp
index 435bd5d..921375c 100644
--- a/include/omath/pathfinding/Astar.hpp
+++ b/include/omath/pathfinding/Astar.hpp
@@ -6,11 +6,10 @@
#include
#include "NavigationMesh.hpp"
#include "omath/Vector3.hpp"
-#include "omath/omath_export.hpp"
namespace omath::pathfinding
{
- class OMATH_API Astar final
+ class Astar final
{
public:
[[nodiscard]]
diff --git a/include/omath/pathfinding/NavigationMesh.hpp b/include/omath/pathfinding/NavigationMesh.hpp
index 8ab5c24..5fc34d2 100644
--- a/include/omath/pathfinding/NavigationMesh.hpp
+++ b/include/omath/pathfinding/NavigationMesh.hpp
@@ -8,7 +8,6 @@
#include
#include
#include
-#include "omath/omath_export.hpp"
namespace omath::pathfinding
{
@@ -23,16 +22,16 @@ namespace omath::pathfinding
public:
[[nodiscard]]
- OMATH_API std::expected GetClosestVertex(const Vector3& point) const;
+ std::expected GetClosestVertex(const Vector3& point) const;
[[nodiscard]]
- OMATH_API const std::vector& GetNeighbors(const Vector3& vertex) const;
+ const std::vector& GetNeighbors(const Vector3& vertex) const;
[[nodiscard]]
- OMATH_API bool Empty() const;
+ bool Empty() const;
[[nodiscard]] std::vector Serialize() const;
- OMATH_API void Deserialize(const std::vector& raw);
+ void Deserialize(const std::vector& raw);
std::unordered_map> m_verTextMap;
};
diff --git a/include/omath/prediction/Engine.hpp b/include/omath/prediction/Engine.hpp
index c48456c..2571cc5 100644
--- a/include/omath/prediction/Engine.hpp
+++ b/include/omath/prediction/Engine.hpp
@@ -8,11 +8,10 @@
#include "omath/Vector3.hpp"
#include "omath/prediction/Projectile.hpp"
#include "omath/prediction/Target.hpp"
-#include "omath/omath_export.hpp"
namespace omath::prediction
{
- class OMATH_API Engine final
+ class Engine final
{
public:
explicit Engine(float gravityConstant, float simulationTimeStep,
diff --git a/include/omath/prediction/Projectile.hpp b/include/omath/prediction/Projectile.hpp
index 51f6ebc..5499815 100644
--- a/include/omath/prediction/Projectile.hpp
+++ b/include/omath/prediction/Projectile.hpp
@@ -4,11 +4,10 @@
#pragma once
#include "omath/Vector3.hpp"
-#include "omath/omath_export.hpp"
namespace omath::prediction
{
- class OMATH_API Projectile final
+ class Projectile final
{
public:
diff --git a/include/omath/prediction/Target.hpp b/include/omath/prediction/Target.hpp
index 083d3bd..f3a775e 100644
--- a/include/omath/prediction/Target.hpp
+++ b/include/omath/prediction/Target.hpp
@@ -4,11 +4,10 @@
#pragma once
#include "omath/Vector3.hpp"
-#include "omath/omath_export.hpp"
namespace omath::prediction
{
- class OMATH_API Target final
+ class Target final
{
public:
diff --git a/include/omath/projection/Camera.hpp b/include/omath/projection/Camera.hpp
index 59f6fe8..1b93b4a 100644
--- a/include/omath/projection/Camera.hpp
+++ b/include/omath/projection/Camera.hpp
@@ -10,11 +10,10 @@
#include "ErrorCodes.hpp"
#include
#include
-#include "omath/omath_export.hpp"
namespace omath::projection
{
- class OMATH_API ViewPort final
+ class ViewPort final
{
public:
float m_width;
@@ -28,7 +27,7 @@ namespace omath::projection
using FieldOfView = const Angle;
template
- class OMATH_API Camera
+ class Camera
{
public: