This commit is contained in:
Saikari
2024-12-17 04:55:13 +03:00
committed by GitHub
parent c0efa35e8a
commit 075c553521
20 changed files with 72 additions and 38 deletions

View File

@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.26)
project(omath VERSION 1.0.0)
include(CMakePackageConfigHelpers)
set(CMAKE_CXX_STANDARD 26)
@@ -19,10 +19,16 @@ else()
add_library(omath STATIC source/Vector3.cpp)
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)
add_subdirectory(extlibs)
if(OMATH_BUILD_TESTS)
add_subdirectory(extlibs)
add_subdirectory(tests)
endif()

View File

@@ -6,7 +6,7 @@
#include "omath/Angles.hpp"
#include <algorithm>
#include "omath_export.h"
namespace omath
{
@@ -18,7 +18,7 @@ namespace omath
template<class Type = float, Type min = Type(0), Type max = Type(360), AngleFlags flags = AngleFlags::Normalized>
requires std::is_arithmetic_v<Type>
class Angle
class OMATH_API Angle
{
Type m_angle;
constexpr Angle(const Type& degrees)

View File

@@ -6,7 +6,6 @@
#include <numbers>
#include <cmath>
namespace omath::angles
{
template<class Type>

View File

@@ -7,11 +7,11 @@
#include "omath/Vector3.hpp"
#include <cstdint>
#include "omath/Vector4.hpp"
#include "omath_export.h"
namespace omath
{
struct HSV
struct OMATH_API HSV
{
float m_hue{};
float m_saturation{};
@@ -19,7 +19,7 @@ namespace omath
};
class Color final : public Vector4
class OMATH_API Color final : public Vector4
{
public:
constexpr Color(float r, float g, float b, float a) : Vector4(r,g,b,a)

View File

@@ -8,11 +8,11 @@
#include <stdexcept>
#include <utility>
#include "Vector3.hpp"
#include "omath_export.h"
namespace omath
{
struct MatSize
struct OMATH_API MatSize
{
size_t rows, columns;
};
@@ -25,7 +25,7 @@ namespace omath
template<size_t Rows = 0, size_t Columns = 0, class Type = float, MatStoreType StoreType = MatStoreType::ROW_MAJOR>
requires std::is_arithmetic_v<Type>
class Mat final
class OMATH_API Mat final
{
public:
constexpr Mat()

View File

@@ -2,12 +2,13 @@
#include <initializer_list>
#include <memory>
#include <string>
#include "omath_export.h"
namespace omath
{
class Vector3;
class Matrix final
class OMATH_API Matrix final
{
public:
Matrix();

View File

@@ -3,10 +3,11 @@
//
#pragma once
#include "omath/Vector3.hpp"
#include "omath_export.h"
namespace omath
{
class Triangle3d final
class OMATH_API Triangle3d final
{
public:
Triangle3d(const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3);

View File

@@ -5,11 +5,11 @@
#pragma once
#include <tuple>
#include <cmath>
#include "omath_export.h"
namespace omath
{
class Vector2
class OMATH_API Vector2
{
public:
float x = 0.f;

View File

@@ -7,11 +7,11 @@
#include <cstdint>
#include <functional>
#include "omath/Vector2.hpp"
#include "omath_export.h"
namespace omath
{
class Vector3 : public Vector2
class OMATH_API Vector3 : public Vector2
{
public:
float z = 0.f;

View File

@@ -5,11 +5,11 @@
#include <omath/Vector3.hpp>
#include <algorithm>
#include "omath_export.h"
namespace omath
{
class Vector4 : public Vector3
class OMATH_API Vector4 : public Vector3
{
public:
float w;

View File

@@ -3,10 +3,12 @@
//
#pragma once
#include "omath_export.h"
namespace omath
{
template<class PitchType, class YawType, class RollType>
struct ViewAngles
struct OMATH_API ViewAngles
{
PitchType pitch;
YawType yaw;

View File

@@ -5,11 +5,11 @@
#include "omath/Vector3.hpp"
#include "omath/Triangle3d.hpp"
#include "../omath_export.h"
namespace omath::collision
{
class Ray
class OMATH_API Ray
{
public:
Vector3 start;
@@ -21,7 +21,7 @@ namespace omath::collision
[[nodiscard]]
Vector3 DirectionVectorNormalized() const;
};
class LineTracer
class OMATH_API LineTracer
{
public:
LineTracer() = delete;

View File

@@ -4,10 +4,11 @@
#pragma once
#include "Constants.h"
#include "omath/projection/Camera.hpp"
#include "../../omath_export.h"
namespace omath::source
{
class Camera final : public projection::Camera<Mat4x4, ViewAngles>
class OMATH_API Camera final : public projection::Camera<Mat4x4, ViewAngles>
{
public:
Camera(const Vector3& position, const ViewAngles& viewAngles, const projection::ViewPort& viewPort,

View File

@@ -0,0 +1,24 @@
#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

View File

@@ -6,11 +6,11 @@
#include <vector>
#include "NavigationMesh.hpp"
#include "omath/Vector3.hpp"
#include "../omath_export.h"
namespace omath::pathfinding
{
class Astar final
class OMATH_API Astar final
{
public:
[[nodiscard]]

View File

@@ -8,7 +8,7 @@
#include <expected>
#include <vector>
#include <string>
#include "../omath_export.h"
namespace omath::pathfinding
{
@@ -18,7 +18,7 @@ namespace omath::pathfinding
};
class NavigationMesh final
class OMATH_API NavigationMesh final
{
public:

View File

@@ -8,11 +8,11 @@
#include "omath/Vector3.hpp"
#include "omath/prediction/Projectile.hpp"
#include "omath/prediction/Target.hpp"
#include "../omath_export.h"
namespace omath::prediction
{
class Engine final
class OMATH_API Engine final
{
public:
explicit Engine(float gravityConstant, float simulationTimeStep,

View File

@@ -4,11 +4,11 @@
#pragma once
#include "omath/Vector3.hpp"
#include "../omath_export.h"
namespace omath::prediction
{
class Projectile final
class OMATH_API Projectile final
{
public:

View File

@@ -4,11 +4,11 @@
#pragma once
#include "omath/Vector3.hpp"
#include "../omath_export.h"
namespace omath::prediction
{
class Target final
class OMATH_API Target final
{
public:

View File

@@ -10,11 +10,11 @@
#include "ErrorCodes.hpp"
#include <omath/Angle.hpp>
#include <type_traits>
#include "../omath_export.h"
namespace omath::projection
{
class ViewPort final
class OMATH_API ViewPort final
{
public:
float m_width;
@@ -28,7 +28,7 @@ namespace omath::projection
using FieldOfView = const Angle<float, 0.f, 180.f, AngleFlags::Clamped>;
template<class Mat4x4Type, class ViewAnglesType>
class Camera
class OMATH_API Camera
{
public: