mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
Export
This commit is contained in:
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.26)
|
|||||||
|
|
||||||
project(omath VERSION 1.0.0)
|
project(omath VERSION 1.0.0)
|
||||||
|
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 26)
|
set(CMAKE_CXX_STANDARD 26)
|
||||||
|
|
||||||
@@ -19,10 +19,16 @@ else()
|
|||||||
add_library(omath STATIC source/Vector3.cpp)
|
add_library(omath STATIC source/Vector3.cpp)
|
||||||
endif()
|
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(source)
|
||||||
add_subdirectory(extlibs)
|
|
||||||
|
|
||||||
if(OMATH_BUILD_TESTS)
|
if(OMATH_BUILD_TESTS)
|
||||||
|
add_subdirectory(extlibs)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -79,4 +85,4 @@ install(FILES
|
|||||||
"${CMAKE_CURRENT_BINARY_DIR}/omathConfig.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/omathConfig.cmake"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/omathConfigVersion.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/omathConfigVersion.cmake"
|
||||||
DESTINATION lib/cmake/omath
|
DESTINATION lib/cmake/omath
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "omath/Angles.hpp"
|
#include "omath/Angles.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "omath_export.h"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
@@ -18,7 +18,7 @@ namespace omath
|
|||||||
|
|
||||||
template<class Type = float, Type min = Type(0), Type max = Type(360), AngleFlags flags = AngleFlags::Normalized>
|
template<class Type = float, Type min = Type(0), Type max = Type(360), AngleFlags flags = AngleFlags::Normalized>
|
||||||
requires std::is_arithmetic_v<Type>
|
requires std::is_arithmetic_v<Type>
|
||||||
class Angle
|
class OMATH_API Angle
|
||||||
{
|
{
|
||||||
Type m_angle;
|
Type m_angle;
|
||||||
constexpr Angle(const Type& degrees)
|
constexpr Angle(const Type& degrees)
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include <numbers>
|
#include <numbers>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
namespace omath::angles
|
namespace omath::angles
|
||||||
{
|
{
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
#include "omath/Vector3.hpp"
|
#include "omath/Vector3.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "omath/Vector4.hpp"
|
#include "omath/Vector4.hpp"
|
||||||
|
#include "omath_export.h"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
struct HSV
|
struct OMATH_API HSV
|
||||||
{
|
{
|
||||||
float m_hue{};
|
float m_hue{};
|
||||||
float m_saturation{};
|
float m_saturation{};
|
||||||
@@ -19,7 +19,7 @@ namespace omath
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Color final : public Vector4
|
class OMATH_API Color final : public Vector4
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
constexpr Color(float r, float g, float b, float a) : Vector4(r,g,b,a)
|
constexpr Color(float r, float g, float b, float a) : Vector4(r,g,b,a)
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "Vector3.hpp"
|
#include "Vector3.hpp"
|
||||||
|
#include "omath_export.h"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
struct MatSize
|
struct OMATH_API MatSize
|
||||||
{
|
{
|
||||||
size_t rows, columns;
|
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>
|
template<size_t Rows = 0, size_t Columns = 0, class Type = float, MatStoreType StoreType = MatStoreType::ROW_MAJOR>
|
||||||
requires std::is_arithmetic_v<Type>
|
requires std::is_arithmetic_v<Type>
|
||||||
class Mat final
|
class OMATH_API Mat final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
constexpr Mat()
|
constexpr Mat()
|
||||||
|
|||||||
@@ -2,12 +2,13 @@
|
|||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "omath_export.h"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
class Vector3;
|
class Vector3;
|
||||||
|
|
||||||
class Matrix final
|
class OMATH_API Matrix final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Matrix();
|
Matrix();
|
||||||
|
|||||||
@@ -3,10 +3,11 @@
|
|||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/Vector3.hpp"
|
#include "omath/Vector3.hpp"
|
||||||
|
#include "omath_export.h"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
class Triangle3d final
|
class OMATH_API Triangle3d final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Triangle3d(const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3);
|
Triangle3d(const Vector3& vertex1, const Vector3& vertex2, const Vector3& vertex3);
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include "omath_export.h"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
class Vector2
|
class OMATH_API Vector2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float x = 0.f;
|
float x = 0.f;
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "omath/Vector2.hpp"
|
#include "omath/Vector2.hpp"
|
||||||
|
#include "omath_export.h"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
class Vector3 : public Vector2
|
class OMATH_API Vector3 : public Vector2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float z = 0.f;
|
float z = 0.f;
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
#include <omath/Vector3.hpp>
|
#include <omath/Vector3.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "omath_export.h"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
class Vector4 : public Vector3
|
class OMATH_API Vector4 : public Vector3
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float w;
|
float w;
|
||||||
|
|||||||
@@ -3,10 +3,12 @@
|
|||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "omath_export.h"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
template<class PitchType, class YawType, class RollType>
|
template<class PitchType, class YawType, class RollType>
|
||||||
struct ViewAngles
|
struct OMATH_API ViewAngles
|
||||||
{
|
{
|
||||||
PitchType pitch;
|
PitchType pitch;
|
||||||
YawType yaw;
|
YawType yaw;
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
#include "omath/Vector3.hpp"
|
#include "omath/Vector3.hpp"
|
||||||
#include "omath/Triangle3d.hpp"
|
#include "omath/Triangle3d.hpp"
|
||||||
|
#include "../omath_export.h"
|
||||||
|
|
||||||
namespace omath::collision
|
namespace omath::collision
|
||||||
{
|
{
|
||||||
class Ray
|
class OMATH_API Ray
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Vector3 start;
|
Vector3 start;
|
||||||
@@ -21,7 +21,7 @@ namespace omath::collision
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
Vector3 DirectionVectorNormalized() const;
|
Vector3 DirectionVectorNormalized() const;
|
||||||
};
|
};
|
||||||
class LineTracer
|
class OMATH_API LineTracer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LineTracer() = delete;
|
LineTracer() = delete;
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
#include "omath/projection/Camera.hpp"
|
#include "omath/projection/Camera.hpp"
|
||||||
|
#include "../../omath_export.h"
|
||||||
|
|
||||||
namespace omath::source
|
namespace omath::source
|
||||||
{
|
{
|
||||||
class Camera final : public projection::Camera<Mat4x4, ViewAngles>
|
class OMATH_API Camera final : public projection::Camera<Mat4x4, ViewAngles>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Camera(const Vector3& position, const ViewAngles& viewAngles, const projection::ViewPort& viewPort,
|
Camera(const Vector3& position, const ViewAngles& viewAngles, const projection::ViewPort& viewPort,
|
||||||
|
|||||||
24
include/omath/omath_export.h
Normal file
24
include/omath/omath_export.h
Normal 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
|
||||||
@@ -6,11 +6,11 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "NavigationMesh.hpp"
|
#include "NavigationMesh.hpp"
|
||||||
#include "omath/Vector3.hpp"
|
#include "omath/Vector3.hpp"
|
||||||
|
#include "../omath_export.h"
|
||||||
|
|
||||||
namespace omath::pathfinding
|
namespace omath::pathfinding
|
||||||
{
|
{
|
||||||
class Astar final
|
class OMATH_API Astar final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <expected>
|
#include <expected>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "../omath_export.h"
|
||||||
|
|
||||||
namespace omath::pathfinding
|
namespace omath::pathfinding
|
||||||
{
|
{
|
||||||
@@ -18,7 +18,7 @@ namespace omath::pathfinding
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NavigationMesh final
|
class OMATH_API NavigationMesh final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,11 @@
|
|||||||
#include "omath/Vector3.hpp"
|
#include "omath/Vector3.hpp"
|
||||||
#include "omath/prediction/Projectile.hpp"
|
#include "omath/prediction/Projectile.hpp"
|
||||||
#include "omath/prediction/Target.hpp"
|
#include "omath/prediction/Target.hpp"
|
||||||
|
#include "../omath_export.h"
|
||||||
|
|
||||||
namespace omath::prediction
|
namespace omath::prediction
|
||||||
{
|
{
|
||||||
class Engine final
|
class OMATH_API Engine final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Engine(float gravityConstant, float simulationTimeStep,
|
explicit Engine(float gravityConstant, float simulationTimeStep,
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/Vector3.hpp"
|
#include "omath/Vector3.hpp"
|
||||||
|
#include "../omath_export.h"
|
||||||
|
|
||||||
namespace omath::prediction
|
namespace omath::prediction
|
||||||
{
|
{
|
||||||
class Projectile final
|
class OMATH_API Projectile final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/Vector3.hpp"
|
#include "omath/Vector3.hpp"
|
||||||
|
#include "../omath_export.h"
|
||||||
|
|
||||||
namespace omath::prediction
|
namespace omath::prediction
|
||||||
{
|
{
|
||||||
class Target final
|
class OMATH_API Target final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
#include "ErrorCodes.hpp"
|
#include "ErrorCodes.hpp"
|
||||||
#include <omath/Angle.hpp>
|
#include <omath/Angle.hpp>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
#include "../omath_export.h"
|
||||||
|
|
||||||
namespace omath::projection
|
namespace omath::projection
|
||||||
{
|
{
|
||||||
class ViewPort final
|
class OMATH_API ViewPort final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float m_width;
|
float m_width;
|
||||||
@@ -28,7 +28,7 @@ namespace omath::projection
|
|||||||
using FieldOfView = const Angle<float, 0.f, 180.f, AngleFlags::Clamped>;
|
using FieldOfView = const Angle<float, 0.f, 180.f, AngleFlags::Clamped>;
|
||||||
|
|
||||||
template<class Mat4x4Type, class ViewAnglesType>
|
template<class Mat4x4Type, class ViewAnglesType>
|
||||||
class Camera
|
class OMATH_API Camera
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user