Compare commits

...

8 Commits

Author SHA1 Message Date
b58956efe3 added missing header 2025-04-11 22:59:56 +03:00
fc1e0c62b8 disabled tests 2025-04-05 20:03:39 +03:00
Orange
8e861b8a85 updated read me 2025-04-05 13:28:28 +03:00
Orange
55085604fd added include 2025-04-05 13:20:18 +03:00
Orange
7b712ed960 fixed for clang 2025-04-05 13:00:00 +03:00
138c996393 oops 2025-03-29 22:03:30 +03:00
0f2a858306 fixed in some cases confilcting with win api 2025-03-29 21:57:35 +03:00
ea6c1cc929 fix 2025-03-29 18:20:17 +03:00
10 changed files with 87 additions and 17 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/cmake-build/
/.idea
/out
*.DS_Store

View File

@@ -14,11 +14,12 @@ option(OMATH_BUILD_EXAMPLES "Build example projects with you can learn & play" O
option(OMATH_STATIC_MSVC_RUNTIME_LIBRARY "Force Omath to link static runtime" OFF)
if (OMATH_BUILD_AS_SHARED_LIBRARY)
add_library(omath SHARED source/Matrix.cpp)
add_library(omath SHARED source/matrix.cpp)
else()
add_library(omath STATIC source/Matrix.cpp)
add_library(omath STATIC source/matrix.cpp
source/matrix.cpp)
endif()
message(STATUS "Building on ${CMAKE_HOST_SYSTEM_NAME}")
add_library(omath::omath ALIAS omath)
if (OMATH_IMGUI_INTEGRATION)

View File

@@ -64,6 +64,38 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "darwin-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/cmake-build/build/${presetName}",
"installDir": "${sourceDir}/cmake-build/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "darwin-debug",
"displayName": "Darwin Debug",
"inherits": "darwin-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "darwin-release",
"displayName": "Darwin Release",
"inherits": "darwin-debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
}
]
}

View File

@@ -21,12 +21,21 @@ Oranges's Math Library (omath) is a comprehensive, open-source library aimed at
- **No Additional Dependencies**: No additional dependencies need to use OMath except unit test execution
- **Ready for meta-programming**: Omath use templates for common types like Vectors, Matrixes etc, to handle all types!
|ENGINE |SUPPORT|
|--------|-------|
|Source |✅YES |
|Unity |✅YES |
|IWEngine|✅YES |
|Unreal |❌NO |
## Supported Render Pipelines
| ENGINE | SUPPORT |
|----------|---------|
| Source | ✅YES |
| Unity | ✅YES |
| IWEngine | ✅YES |
| Unreal | ❌NO |
## Supported Operating Systems
| OS | SUPPORT |
|----------------|---------|
| Windows 10/11 | ✅YES |
| Linux | ✅YES |
| Darwin (MacOS) | ✅YES |
## ⏬ Getting Started
### Prerequisites

View File

@@ -5,6 +5,8 @@
#pragma once
#include "omath/angles.hpp"
#include <algorithm>
#include <utility>
namespace omath
{

View File

@@ -8,6 +8,15 @@
#include "omath/vector3.hpp"
#include "omath/vector4.hpp"
#ifdef max
#undef max
#endif
#ifdef min
#undef min
#endif
namespace omath
{
struct HSV
@@ -118,7 +127,7 @@ namespace omath
{
Clamp(0.f, 1.f);
}
consteval void SetHue(const float hue)
constexpr void SetHue(const float hue)
{
auto hsv = ToHSV();
hsv.hue = hue;
@@ -126,7 +135,7 @@ namespace omath
*this = FromHSV(hsv);
}
consteval void SetSaturation(const float saturation)
constexpr void SetSaturation(const float saturation)
{
auto hsv = ToHSV();
hsv.saturation = saturation;
@@ -134,7 +143,7 @@ namespace omath
*this = FromHSV(hsv);
}
consteval void SetValue(const float value)
constexpr void SetValue(const float value)
{
auto hsv = ToHSV();
hsv.value = value;

View File

@@ -10,6 +10,16 @@
#include <utility>
#include "omath/vector3.hpp"
#ifdef near
#undef near
#endif
#ifdef far
#undef far
#endif
namespace omath
{
struct MatSize

View File

@@ -124,9 +124,9 @@ namespace omath
}
#ifndef _MSC_VER
[[nodiscard]] constexpr Type& Length() const
[[nodiscard]] constexpr Type Length() const
{
return std::hypot(x, y);
return std::hypot(this->x, this->y);
}
[[nodiscard]] constexpr Vector2 Normalized() const

View File

@@ -121,12 +121,12 @@ namespace omath
#ifndef _MSC_VER
[[nodiscard]] constexpr Type Length() const
{
return std::hypot(x, y, z);
return std::hypot(this->x, this->y, z);
}
[[nodiscard]] constexpr Type Length2D() const
{
return Vector2::Length();
return Vector2<Type>::Length();
}
[[nodiscard]] Type DistTo(const Vector3& vOther) const
{

View File

@@ -4,13 +4,19 @@
#include "omath/projectile_prediction/proj_pred_engine_avx2.hpp"
#include "source_location"
#if defined(OMATH_USE_AVX2) && defined(__i386__) && defined(__x86_64__)
#include <immintrin.h>
#include <format>
#endif
namespace omath::projectile_prediction
{
std::optional<Vector3<float>>
ProjPredEngineAVX2::MaybeCalculateAimPoint([[maybe_unused]] const Projectile& projectile,
[[maybe_unused]] const Target& target) const
{
#ifdef OMATH_USE_AVX2
#if defined(OMATH_USE_AVX2) && defined(__i386__) && defined(__x86_64__)
const float bulletGravity = m_gravityConstant * projectile.m_gravityScale;
const float v0 = projectile.m_launchSpeed;
const float v0Sqr = v0 * v0;