mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-14 07:23:26 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 68ac7f7b3d | |||
| 17de6d407c | |||
| 59d686e252 | |||
| 713af1b772 | |||
| a8922230b3 | |||
| b8d79eb8b4 | |||
| 5acd166d8f | |||
| c7dda0ff10 | |||
| 2688d977a9 | |||
|
|
b9ac44a901 | ||
| 35658b1f6d | |||
| 8f4b61319f | |||
| 832c2ea5ef | |||
| 50c336e044 | |||
|
|
e80e22bd5b | ||
| 27576ed761 | |||
| f85243e892 | |||
| 9b6d0beb03 |
@@ -10,13 +10,16 @@ option(OMATH_THREAT_WARNING_AS_ERROR "Set highest level of warnings and force co
|
|||||||
option(OMATH_BUILD_AS_SHARED_LIBRARY "Build Omath as .so or .dll" OFF)
|
option(OMATH_BUILD_AS_SHARED_LIBRARY "Build Omath as .so or .dll" OFF)
|
||||||
option(OMATH_USE_AVX2 "Omath will use AVX2 to boost performance" ON)
|
option(OMATH_USE_AVX2 "Omath will use AVX2 to boost performance" ON)
|
||||||
option(OMATH_IMGUI_INTEGRATION "Omath will define method to convert omath types to imgui types" OFF)
|
option(OMATH_IMGUI_INTEGRATION "Omath will define method to convert omath types to imgui types" OFF)
|
||||||
|
option(OMATH_BUILD_EXAMPLES "Build example projects with you can learn & play" OFF)
|
||||||
|
|
||||||
if (OMATH_BUILD_AS_SHARED_LIBRARY)
|
if (OMATH_BUILD_AS_SHARED_LIBRARY)
|
||||||
add_library(omath SHARED source/Vector3.cpp)
|
add_library(omath SHARED source/Matrix.cpp)
|
||||||
else()
|
else()
|
||||||
add_library(omath STATIC source/Matrix.cpp)
|
add_library(omath STATIC source/Matrix.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_library(omath::omath ALIAS omath)
|
||||||
|
|
||||||
if (OMATH_IMGUI_INTEGRATION)
|
if (OMATH_IMGUI_INTEGRATION)
|
||||||
target_compile_definitions(omath PUBLIC OMATH_IMGUI_INTEGRATION)
|
target_compile_definitions(omath PUBLIC OMATH_IMGUI_INTEGRATION)
|
||||||
endif()
|
endif()
|
||||||
@@ -47,6 +50,10 @@ if(OMATH_BUILD_TESTS)
|
|||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (OMATH_BUILD_EXAMPLES)
|
||||||
|
add_subdirectory(examples)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND OMATH_THREAT_WARNING_AS_ERROR)
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND OMATH_THREAT_WARNING_AS_ERROR)
|
||||||
target_compile_options(omath PRIVATE /W4 /WX)
|
target_compile_options(omath PRIVATE /W4 /WX)
|
||||||
elseif(OMATH_THREAT_WARNING_AS_ERROR)
|
elseif(OMATH_THREAT_WARNING_AS_ERROR)
|
||||||
|
|||||||
@@ -12,14 +12,14 @@
|
|||||||
Oranges's Math Library (omath) is a comprehensive, open-source library aimed at providing efficient, reliable, and versatile mathematical functions and algorithms. Developed primarily in C++, this library is designed to cater to a wide range of mathematical operations essential in scientific computing, engineering, and academic research.
|
Oranges's Math Library (omath) is a comprehensive, open-source library aimed at providing efficient, reliable, and versatile mathematical functions and algorithms. Developed primarily in C++, this library is designed to cater to a wide range of mathematical operations essential in scientific computing, engineering, and academic research.
|
||||||
|
|
||||||
## 👁🗨 Features
|
## 👁🗨 Features
|
||||||
- **Efficiency**: Optimized for performance, ensuring quick computations.
|
- **Efficiency**: Optimized for performance, ensuring quick computations using AVX2.
|
||||||
- **Versatility**: Includes a wide array of mathematical functions and algorithms.
|
- **Versatility**: Includes a wide array of mathematical functions and algorithms.
|
||||||
- **Ease of Use**: Simplified interface for convenient integration into various projects.
|
- **Ease of Use**: Simplified interface for convenient integration into various projects.
|
||||||
- **Projectile Prediction**: Projectile prediction engine with O(N) algo complexity, that can power you projectile aim-bot.
|
- **Projectile Prediction**: Projectile prediction engine with O(N) algo complexity, that can power you projectile aim-bot.
|
||||||
- **3D Projection**: No need to find view-projection matrix anymore you can make your own projection pipeline.
|
- **3D Projection**: No need to find view-projection matrix anymore you can make your own projection pipeline.
|
||||||
- **Collision Detection**: Production ready code to handle collision detection by using simple interfaces.
|
- **Collision Detection**: Production ready code to handle collision detection by using simple interfaces.
|
||||||
- **No Additional Dependencies**: No additional dependencies need to use OMath except unit test execution
|
- **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!
|
||||||
## ⏬ Getting Started
|
## ⏬ Getting Started
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
- C++ Compiler
|
- C++ Compiler
|
||||||
@@ -72,8 +72,11 @@ TEST(UnitTestProjection, IsPointOnScreen)
|
|||||||
With `omath/projection` module you can achieve simple ESP hack for powered by Source/Unreal/Unity engine games, like [Apex Legends](https://store.steampowered.com/app/1172470/Apex_Legends/).
|
With `omath/projection` module you can achieve simple ESP hack for powered by Source/Unreal/Unity engine games, like [Apex Legends](https://store.steampowered.com/app/1172470/Apex_Legends/).
|
||||||
|
|
||||||

|

|
||||||

|
Or for InfinityWard Engine based games. Like Call of Duty Black Ops 2!
|
||||||
|

|
||||||
|
|
||||||
|
Or even advanced projectile aimbot
|
||||||
|
[Watch Video](https://youtu.be/lM_NJ1yCunw?si=5E87OrQMeypxSJ3E)
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## 🫵🏻 Contributing
|
## 🫵🏻 Contributing
|
||||||
|
|||||||
4
examples/CMakeLists.txt
Normal file
4
examples/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
project(examples)
|
||||||
|
|
||||||
|
add_executable(ExampleProjectionMatrixBuilder example_proj_mat_builder.cpp)
|
||||||
|
target_link_libraries(ExampleProjectionMatrixBuilder PRIVATE omath::omath)
|
||||||
40
examples/example_proj_mat_builder.cpp
Normal file
40
examples/example_proj_mat_builder.cpp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
//
|
||||||
|
// Created by Vlad on 3/19/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <print>
|
||||||
|
#include <omath/engines/opengl_engine/formulas.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::println("OMATH Projection Matrix Builder");
|
||||||
|
|
||||||
|
float fov = 0;
|
||||||
|
float near = 0;
|
||||||
|
float far = 0;
|
||||||
|
float viewPortWidth = 0;
|
||||||
|
float viewPortHeight = 0;
|
||||||
|
|
||||||
|
std::print("Enter camera fov: ");
|
||||||
|
std::cin >> fov;
|
||||||
|
|
||||||
|
std::print("Enter camera z near: ");
|
||||||
|
std::cin >> near;
|
||||||
|
|
||||||
|
std::print("Enter camera z far: ");
|
||||||
|
std::cin >> far;
|
||||||
|
|
||||||
|
std::print("Enter camera screen width: ");
|
||||||
|
std::cin >> viewPortWidth;
|
||||||
|
|
||||||
|
std::print("Enter camera screen height: ");
|
||||||
|
std::cin >> viewPortHeight;
|
||||||
|
|
||||||
|
const auto mat =
|
||||||
|
omath::opengl_engine::CalcPerspectiveProjectionMatrix(fov, viewPortWidth / viewPortHeight, near, far);
|
||||||
|
|
||||||
|
std::print("{}", mat.ToString());
|
||||||
|
};
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/Angles.hpp"
|
#include "omath/angles.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <numbers>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <numbers>
|
||||||
|
|
||||||
namespace omath::angles
|
namespace omath::angles
|
||||||
{
|
{
|
||||||
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "omath/Vector3.hpp"
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "omath/Vector4.hpp"
|
#include "omath/vector3.hpp"
|
||||||
|
#include "omath/vector4.hpp"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Constants.hpp"
|
#include "omath/engines/iw_engine/constants.hpp"
|
||||||
#include "omath/projection/Camera.hpp"
|
#include "omath/projection/camera.hpp"
|
||||||
|
|
||||||
namespace omath::iw_engine
|
namespace omath::iw_engine
|
||||||
{
|
{
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <omath/Vector3.hpp>
|
#include <omath/vector3.hpp>
|
||||||
#include <omath/Mat.hpp>
|
#include <omath/mat.hpp>
|
||||||
#include <omath/Angle.hpp>
|
#include <omath/angle.hpp>
|
||||||
#include <omath/ViewAngles.hpp>
|
#include <omath/view_angles.hpp>
|
||||||
|
|
||||||
namespace omath::iw_engine
|
namespace omath::iw_engine
|
||||||
{
|
{
|
||||||
24
include/omath/engines/iw_engine/formulas.hpp
Normal file
24
include/omath/engines/iw_engine/formulas.hpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// Created by Vlad on 3/17/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "omath/engines/iw_engine/constants.hpp"
|
||||||
|
|
||||||
|
namespace omath::iw_engine
|
||||||
|
{
|
||||||
|
[[nodiscard]]
|
||||||
|
Vector3<float> ForwardVector(const ViewAngles& angles);
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
Vector3<float> RightVector(const ViewAngles& angles);
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
Vector3<float> UpVector(const ViewAngles& angles);
|
||||||
|
|
||||||
|
[[nodiscard]] Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin);
|
||||||
|
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
Mat4x4 CalcPerspectiveProjectionMatrix(float fieldOfView, float aspectRatio, float near, float far);
|
||||||
|
} // namespace omath::iw_engine
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by Orange on 12/23/2024.
|
|
||||||
//
|
|
||||||
#pragma once
|
|
||||||
#include "Constants.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
namespace omath::opengl_engine
|
|
||||||
{
|
|
||||||
[[nodiscard]]
|
|
||||||
inline Vector3<float> ForwardVector(const ViewAngles& angles)
|
|
||||||
{
|
|
||||||
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsForward);
|
|
||||||
|
|
||||||
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]]
|
|
||||||
inline Vector3<float> RightVector(const ViewAngles& angles)
|
|
||||||
{
|
|
||||||
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsRight);
|
|
||||||
|
|
||||||
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]]
|
|
||||||
inline Vector3<float> UpVector(const ViewAngles& angles)
|
|
||||||
{
|
|
||||||
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsUp);
|
|
||||||
|
|
||||||
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] inline Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin)
|
|
||||||
{
|
|
||||||
return MatCameraView<float, MatStoreType::COLUMN_MAJOR>(-ForwardVector(angles), RightVector(angles), UpVector(angles), cam_origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[[nodiscard]]
|
|
||||||
inline Mat4x4 CalcPerspectiveProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near,
|
|
||||||
const float far)
|
|
||||||
{
|
|
||||||
const float fovHalfTan = std::tan(angles::DegreesToRadians(fieldOfView) / 2.f);
|
|
||||||
|
|
||||||
return {
|
|
||||||
{1.f / (aspectRatio * fovHalfTan), 0, 0, 0},
|
|
||||||
{0, 1.f / (fovHalfTan), 0, 0},
|
|
||||||
{0, 0, -(far + near) / (far - near), -(2.f * far * near) / (far - near)},
|
|
||||||
{0, 0, -1, 0},
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
// Created by Orange on 12/23/2024.
|
// Created by Orange on 12/23/2024.
|
||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Constants.hpp"
|
#include "omath/engines/opengl_engine/constants.hpp"
|
||||||
#include "omath/projection/Camera.hpp"
|
#include "omath/projection/camera.hpp"
|
||||||
|
|
||||||
namespace omath::opengl_engine
|
namespace omath::opengl_engine
|
||||||
{
|
{
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <omath/Vector3.hpp>
|
#include <omath/angle.hpp>
|
||||||
#include <omath/Mat.hpp>
|
#include <omath/mat.hpp>
|
||||||
#include <omath/Angle.hpp>
|
#include <omath/vector3.hpp>
|
||||||
#include <omath/ViewAngles.hpp>
|
#include <omath/view_angles.hpp>
|
||||||
|
|
||||||
namespace omath::opengl_engine
|
namespace omath::opengl_engine
|
||||||
{
|
{
|
||||||
24
include/omath/engines/opengl_engine/formulas.hpp
Normal file
24
include/omath/engines/opengl_engine/formulas.hpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// Created by Orange on 12/23/2024.
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
#include "omath/engines/opengl_engine/constants.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
namespace omath::opengl_engine
|
||||||
|
{
|
||||||
|
[[nodiscard]]
|
||||||
|
Vector3<float> ForwardVector(const ViewAngles& angles);
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
Vector3<float> RightVector(const ViewAngles& angles);
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
Vector3<float> UpVector(const ViewAngles& angles);
|
||||||
|
|
||||||
|
[[nodiscard]] Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin);
|
||||||
|
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
Mat4x4 CalcPerspectiveProjectionMatrix(float fieldOfView, float aspectRatio, float near, float far);
|
||||||
|
} // namespace omath::opengl_engine
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
// Created by Orange on 12/4/2024.
|
// Created by Orange on 12/4/2024.
|
||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Constants.hpp"
|
#include "omath/engines/source_engine/constants.hpp"
|
||||||
#include "omath/projection/Camera.hpp"
|
#include "omath/projection/camera.hpp"
|
||||||
|
|
||||||
namespace omath::source_engine
|
namespace omath::source_engine
|
||||||
{
|
{
|
||||||
@@ -3,10 +3,10 @@
|
|||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <omath/Vector3.hpp>
|
#include <omath/vector3.hpp>
|
||||||
#include <omath/Mat.hpp>
|
#include <omath/mat.hpp>
|
||||||
#include <omath/Angle.hpp>
|
#include <omath/angle.hpp>
|
||||||
#include <omath/ViewAngles.hpp>
|
#include <omath/view_angles.hpp>
|
||||||
|
|
||||||
namespace omath::source_engine
|
namespace omath::source_engine
|
||||||
{
|
{
|
||||||
23
include/omath/engines/source_engine/formulas.hpp
Normal file
23
include/omath/engines/source_engine/formulas.hpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
//
|
||||||
|
// Created by Orange on 12/4/2024.
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
#include "omath/engines/source_engine/constants.hpp"
|
||||||
|
|
||||||
|
namespace omath::source_engine
|
||||||
|
{
|
||||||
|
[[nodiscard]]
|
||||||
|
Vector3<float> ForwardVector(const ViewAngles& angles);
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
Vector3<float> RightVector(const ViewAngles& angles);
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
Vector3<float> UpVector(const ViewAngles& angles);
|
||||||
|
|
||||||
|
[[nodiscard]] Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin);
|
||||||
|
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
Mat4x4 CalcPerspectiveProjectionMatrix(float fieldOfView, float aspectRatio, float near, float far);
|
||||||
|
} // namespace omath::source
|
||||||
@@ -4,10 +4,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <iomanip>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include "Vector3.hpp"
|
#include "omath/vector3.hpp"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
@@ -296,15 +297,20 @@ namespace omath
|
|||||||
std::string ToString() const noexcept
|
std::string ToString() const noexcept
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
|
oss << "[[";
|
||||||
|
|
||||||
for (size_t i = 0; i < Rows; ++i)
|
for (size_t i = 0; i < Rows; ++i)
|
||||||
{
|
{
|
||||||
|
if (i > 0)
|
||||||
|
oss << " [";
|
||||||
|
|
||||||
for (size_t j = 0; j < Columns; ++j)
|
for (size_t j = 0; j < Columns; ++j)
|
||||||
{
|
{
|
||||||
oss << At(i, j);
|
oss << std::setw(9) << std::fixed << std::setprecision(3) << At(i, j);
|
||||||
if (j != Columns - 1)
|
if (j != Columns - 1)
|
||||||
oss << ' ';
|
oss << ", ";
|
||||||
}
|
}
|
||||||
oss << '\n';
|
oss << (i == Rows - 1 ? "]]" : "]\n");
|
||||||
}
|
}
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Vector3.hpp"
|
#include "omath/vector3.hpp"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "NavigationMesh.hpp"
|
#include "omath/pathfinding/navigation_mesh.hpp"
|
||||||
#include "omath/Vector3.hpp"
|
#include "omath/vector3.hpp"
|
||||||
|
|
||||||
namespace omath::pathfinding
|
namespace omath::pathfinding
|
||||||
{
|
{
|
||||||
@@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "omath/Vector3.hpp"
|
|
||||||
#include <expected>
|
#include <expected>
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include "omath/vector3.hpp"
|
||||||
|
|
||||||
namespace omath::pathfinding
|
namespace omath::pathfinding
|
||||||
{
|
{
|
||||||
@@ -20,19 +20,19 @@ namespace omath::pathfinding
|
|||||||
class NavigationMesh final
|
class NavigationMesh final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
std::expected<Vector3<float>, std::string> GetClosestVertex(const Vector3<float>& point) const;
|
std::expected<Vector3<float>, std::string> GetClosestVertex(const Vector3<float>& point) const;
|
||||||
|
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
const std::vector<Vector3<float>>& GetNeighbors(const Vector3<float>& vertex) const;
|
const std::vector<Vector3<float>>& GetNeighbors(const Vector3<float>& vertex) const;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
bool Empty() const;
|
bool Empty() const;
|
||||||
|
|
||||||
[[nodiscard]] std::vector<uint8_t> Serialize() const;
|
[[nodiscard]] std::vector<uint8_t> Serialize() const;
|
||||||
|
|
||||||
void Deserialize(const std::vector<uint8_t>& raw);
|
void Deserialize(const std::vector<uint8_t>& raw);
|
||||||
|
|
||||||
std::unordered_map<Vector3<float>, std::vector<Vector3<float>>> m_verTextMap;
|
std::unordered_map<Vector3<float>, std::vector<Vector3<float>>> m_verTextMap;
|
||||||
};
|
};
|
||||||
}
|
} // namespace omath::pathfinding
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
// Created by Vlad on 2/23/2025.
|
// Created by Vlad on 2/23/2025.
|
||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Projectile.hpp"
|
#include "omath/projectile_prediction/projectile.hpp"
|
||||||
#include "Target.hpp"
|
#include "omath/projectile_prediction/target.hpp"
|
||||||
#include "omath/Vector3.hpp"
|
#include "omath/vector3.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace omath::projectile_prediction
|
namespace omath::projectile_prediction
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Vlad on 2/23/2025.
|
// Created by Vlad on 2/23/2025.
|
||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "ProjPredEngine.hpp"
|
#include "omath/projectile_prediction/proj_pred_engine.hpp"
|
||||||
|
|
||||||
namespace omath::projectile_prediction
|
namespace omath::projectile_prediction
|
||||||
{
|
{
|
||||||
@@ -5,10 +5,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include "omath/Vector3.hpp"
|
#include "omath/projectile_prediction/proj_pred_engine.hpp"
|
||||||
#include "omath/projectile_prediction/ProjPredEngine.hpp"
|
#include "omath/projectile_prediction/projectile.hpp"
|
||||||
#include "omath/projectile_prediction/Projectile.hpp"
|
#include "omath/projectile_prediction/target.hpp"
|
||||||
#include "omath/projectile_prediction/Target.hpp"
|
#include "omath/vector3.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace omath::projectile_prediction
|
namespace omath::projectile_prediction
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/Vector3.hpp"
|
#include "omath/vector3.hpp"
|
||||||
|
|
||||||
namespace omath::projectile_prediction
|
namespace omath::projectile_prediction
|
||||||
{
|
{
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/Vector3.hpp"
|
#include "omath/vector3.hpp"
|
||||||
|
|
||||||
namespace omath::projectile_prediction
|
namespace omath::projectile_prediction
|
||||||
{
|
{
|
||||||
@@ -5,11 +5,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <expected>
|
#include <expected>
|
||||||
#include <omath/Mat.hpp>
|
|
||||||
#include <omath/Vector3.hpp>
|
|
||||||
#include "ErrorCodes.hpp"
|
|
||||||
#include <omath/Angle.hpp>
|
#include <omath/Angle.hpp>
|
||||||
|
#include <omath/Mat.hpp>
|
||||||
|
#include <omath/vector3.hpp>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
#include "omath/projection/error_codes.hpp"
|
||||||
|
|
||||||
namespace omath::projection
|
namespace omath::projection
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Orange on 11/13/2024.
|
// Created by Orange on 11/13/2024.
|
||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/Vector3.hpp"
|
#include "omath/vector3.hpp"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
@@ -4,12 +4,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Vector2.hpp"
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <expected>
|
#include <expected>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "omath/Angle.hpp"
|
#include "omath/angle.hpp"
|
||||||
#include "omath/Vector2.hpp"
|
#include "omath/vector2.hpp"
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
//
|
//
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <omath/Vector3.hpp>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <omath/vector3.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
target_sources(omath PRIVATE
|
target_sources(omath PRIVATE
|
||||||
Matrix.cpp
|
matrix.cpp
|
||||||
color.cpp
|
color.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
target_sources(omath PRIVATE
|
target_sources(omath PRIVATE
|
||||||
LineTracer.cpp
|
line_tracer.cpp
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Created by Orange on 11/13/2024.
|
// Created by Orange on 11/13/2024.
|
||||||
//
|
//
|
||||||
#include "omath/collision/LineTracer.hpp"
|
#include "omath/collision/line_tracer.hpp"
|
||||||
|
|
||||||
namespace omath::collision
|
namespace omath::collision
|
||||||
{
|
{
|
||||||
@@ -1 +1 @@
|
|||||||
target_sources(omath PRIVATE Camera.cpp)
|
target_sources(omath PRIVATE camera.cpp formulas.cpp)
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
//
|
//
|
||||||
// Created by Vlad on 3/17/2025.
|
// Created by Vlad on 3/17/2025.
|
||||||
//
|
//
|
||||||
#include "omath/engines/iw_engine/Camera.hpp"
|
#include "omath/engines/iw_engine/camera.hpp"
|
||||||
#include "omath/engines/iw_engine/Formulas.hpp"
|
#include "omath/engines/iw_engine/formulas.hpp"
|
||||||
|
|
||||||
namespace omath::iw_engine
|
namespace omath::iw_engine
|
||||||
{
|
{
|
||||||
@@ -1,56 +1,47 @@
|
|||||||
//
|
//
|
||||||
// Created by Vlad on 3/17/2025.
|
// Created by Vlad on 3/19/2025.
|
||||||
//
|
//
|
||||||
|
#include "omath/engines/iw_engine/formulas.hpp"
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "Constants.hpp"
|
|
||||||
|
|
||||||
namespace omath::iw_engine
|
namespace omath::iw_engine
|
||||||
{
|
{
|
||||||
[[nodiscard]]
|
|
||||||
inline Vector3<float> ForwardVector(const ViewAngles& angles)
|
Vector3<float> ForwardVector(const ViewAngles& angles)
|
||||||
{
|
{
|
||||||
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsForward);
|
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsForward);
|
||||||
|
|
||||||
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
Vector3<float> RightVector(const ViewAngles& angles)
|
||||||
inline Vector3<float> RightVector(const ViewAngles& angles)
|
|
||||||
{
|
{
|
||||||
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsRight);
|
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsRight);
|
||||||
|
|
||||||
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
||||||
}
|
}
|
||||||
|
Vector3<float> UpVector(const ViewAngles& angles)
|
||||||
[[nodiscard]]
|
|
||||||
inline Vector3<float> UpVector(const ViewAngles& angles)
|
|
||||||
{
|
{
|
||||||
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsUp);
|
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsUp);
|
||||||
|
|
||||||
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
||||||
}
|
}
|
||||||
|
Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin)
|
||||||
[[nodiscard]] inline Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin)
|
|
||||||
{
|
{
|
||||||
return MatCameraView(ForwardVector(angles), RightVector(angles), UpVector(angles), cam_origin);
|
return MatCameraView(ForwardVector(angles), RightVector(angles), UpVector(angles), cam_origin);
|
||||||
}
|
}
|
||||||
|
Mat4x4 CalcPerspectiveProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near,
|
||||||
|
|
||||||
[[nodiscard]]
|
|
||||||
inline Mat4x4 CalcPerspectiveProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near,
|
|
||||||
const float far)
|
const float far)
|
||||||
{
|
{
|
||||||
// NOTE: Need magic number to fix fov calculation, since source inherit Quake proj matrix calculation
|
// NOTE: Need magic number to fix fov calculation, since source inherit Quake proj matrix calculation
|
||||||
constexpr auto kMultiplyFactor = 0.75f;
|
constexpr auto kMultiplyFactor = 0.75f;
|
||||||
const float fovHalfTan = std::tan(angles::DegreesToRadians(fieldOfView) / 2.f) * kMultiplyFactor;
|
const float fovHalfTan = std::tan(angles::DegreesToRadians(fieldOfView) / 2.f) * kMultiplyFactor;
|
||||||
|
|
||||||
return
|
return {
|
||||||
{
|
|
||||||
{1.f / (aspectRatio * fovHalfTan), 0, 0, 0},
|
{1.f / (aspectRatio * fovHalfTan), 0, 0, 0},
|
||||||
{0, 1.f / fovHalfTan, 0, 0},
|
{0, 1.f / fovHalfTan, 0, 0},
|
||||||
{0, 0, (far + near) / (far - near), -(2.f * far * near) / (far - near)},
|
{0, 0, (far + near) / (far - near), -(2.f * far * near) / (far - near)},
|
||||||
{0, 0, 1, 0},
|
{0, 0, 1, 0},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} // namespace omath::source
|
} // namespace omath::iw_engine
|
||||||
@@ -1 +1 @@
|
|||||||
target_sources(omath PRIVATE Camera.cpp)
|
target_sources(omath PRIVATE camera.cpp formulas.cpp)
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
//
|
//
|
||||||
// Created by Orange on 12/23/2024.
|
// Created by Orange on 12/23/2024.
|
||||||
//
|
//
|
||||||
#include "omath/engines/opengl_engine/Camera.hpp"
|
#include "omath/engines/opengl_engine/camera.hpp"
|
||||||
#include "omath/engines/opengl_engine/Formulas.hpp"
|
#include "omath/engines/opengl_engine/formulas.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace omath::opengl_engine
|
namespace omath::opengl_engine
|
||||||
46
source/engines/opengl_engine/formulas.cpp
Normal file
46
source/engines/opengl_engine/formulas.cpp
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
//
|
||||||
|
// Created by Vlad on 3/19/2025.
|
||||||
|
//
|
||||||
|
#include "omath/engines/opengl_engine/formulas.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
namespace omath::opengl_engine
|
||||||
|
{
|
||||||
|
|
||||||
|
Vector3<float> ForwardVector(const ViewAngles& angles)
|
||||||
|
{
|
||||||
|
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsForward);
|
||||||
|
|
||||||
|
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
||||||
|
}
|
||||||
|
Vector3<float> RightVector(const ViewAngles& angles)
|
||||||
|
{
|
||||||
|
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsRight);
|
||||||
|
|
||||||
|
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
||||||
|
}
|
||||||
|
Vector3<float> UpVector(const ViewAngles& angles)
|
||||||
|
{
|
||||||
|
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsUp);
|
||||||
|
|
||||||
|
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
||||||
|
}
|
||||||
|
Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin)
|
||||||
|
{
|
||||||
|
return MatCameraView<float, MatStoreType::COLUMN_MAJOR>(-ForwardVector(angles), RightVector(angles),
|
||||||
|
UpVector(angles), cam_origin);
|
||||||
|
}
|
||||||
|
Mat4x4 CalcPerspectiveProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near,
|
||||||
|
const float far)
|
||||||
|
{
|
||||||
|
const float fovHalfTan = std::tan(angles::DegreesToRadians(fieldOfView) / 2.f);
|
||||||
|
|
||||||
|
return {
|
||||||
|
{1.f / (aspectRatio * fovHalfTan), 0, 0, 0},
|
||||||
|
{0, 1.f / (fovHalfTan), 0, 0},
|
||||||
|
{0, 0, -(far + near) / (far - near), -(2.f * far * near) / (far - near)},
|
||||||
|
{0, 0, -1, 0},
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} // namespace omath::opengl_engine
|
||||||
@@ -1 +1 @@
|
|||||||
target_sources(omath PRIVATE Camera.cpp)
|
target_sources(omath PRIVATE camera.cpp formulas.cpp)
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
//
|
//
|
||||||
// Created by Orange on 12/4/2024.
|
// Created by Orange on 12/4/2024.
|
||||||
//
|
//
|
||||||
#include "omath/engines/source_engine/Camera.hpp"
|
#include "omath/engines/source_engine/camera.hpp"
|
||||||
#include "omath/engines/source_engine/Formulas.hpp"
|
#include "omath/engines/source_engine/formulas.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace omath::source_engine
|
namespace omath::source_engine
|
||||||
@@ -1,43 +1,36 @@
|
|||||||
//
|
//
|
||||||
// Created by Orange on 12/4/2024.
|
// Created by Vlad on 3/19/2025.
|
||||||
//
|
//
|
||||||
#pragma once
|
#include <omath/engines/source_engine/formulas.hpp>
|
||||||
#include "Constants.hpp"
|
|
||||||
|
|
||||||
namespace omath::source_engine
|
namespace omath::source_engine
|
||||||
{
|
{
|
||||||
[[nodiscard]]
|
Vector3<float> ForwardVector(const ViewAngles& angles)
|
||||||
inline Vector3<float> ForwardVector(const ViewAngles& angles)
|
|
||||||
{
|
{
|
||||||
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsForward);
|
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsForward);
|
||||||
|
|
||||||
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
Vector3<float> RightVector(const ViewAngles& angles)
|
||||||
inline Vector3<float> RightVector(const ViewAngles& angles)
|
|
||||||
{
|
{
|
||||||
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsRight);
|
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsRight);
|
||||||
|
|
||||||
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
||||||
}
|
}
|
||||||
|
Vector3<float> UpVector(const ViewAngles& angles)
|
||||||
[[nodiscard]]
|
|
||||||
inline Vector3<float> UpVector(const ViewAngles& angles)
|
|
||||||
{
|
{
|
||||||
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsUp);
|
const auto vec = MatRotation(angles) * MatColumnFromVector(kAbsUp);
|
||||||
|
|
||||||
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
return {vec.At(0, 0), vec.At(1, 0), vec.At(2, 0)};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] inline Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin)
|
Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3<float>& cam_origin)
|
||||||
{
|
{
|
||||||
return MatCameraView(ForwardVector(angles), RightVector(angles), UpVector(angles), cam_origin);
|
return MatCameraView(ForwardVector(angles), RightVector(angles), UpVector(angles), cam_origin);
|
||||||
}
|
}
|
||||||
|
Mat4x4 CalcPerspectiveProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near,
|
||||||
|
|
||||||
[[nodiscard]]
|
|
||||||
inline Mat4x4 CalcPerspectiveProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near,
|
|
||||||
const float far)
|
const float far)
|
||||||
{
|
{
|
||||||
// NOTE: Need magic number to fix fov calculation, since source inherit Quake proj matrix calculation
|
// NOTE: Need magic number to fix fov calculation, since source inherit Quake proj matrix calculation
|
||||||
@@ -53,4 +46,4 @@ namespace omath::source_engine
|
|||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} // namespace omath::source
|
} // namespace omath::source_engine
|
||||||
@@ -1 +1 @@
|
|||||||
target_sources(omath PRIVATE NavigationMesh.cpp Astar.cpp)
|
target_sources(omath PRIVATE navigation_mesh.cpp a_star.cpp)
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Created by Vlad on 28.07.2024.
|
// Created by Vlad on 28.07.2024.
|
||||||
//
|
//
|
||||||
#include "omath/pathfinding/Astar.hpp"
|
#include "omath/pathfinding/a_star.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
//
|
//
|
||||||
// Created by Vlad on 28.07.2024.
|
// Created by Vlad on 28.07.2024.
|
||||||
//
|
//
|
||||||
#include "omath/pathfinding/NavigationMesh.hpp"
|
#include "omath/pathfinding/navigation_mesh.hpp"
|
||||||
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <stdexcept>
|
||||||
namespace omath::pathfinding
|
namespace omath::pathfinding
|
||||||
{
|
{
|
||||||
std::expected<Vector3<float>, std::string> NavigationMesh::GetClosestVertex(const Vector3<float> &point) const
|
std::expected<Vector3<float>, std::string> NavigationMesh::GetClosestVertex(const Vector3<float> &point) const
|
||||||
@@ -1 +1 @@
|
|||||||
target_sources(omath PRIVATE ProjPredEngineLegacy.cpp Projectile.cpp Target.cpp ProjPredEngineAVX2.cpp ProjPredEngine.cpp)
|
target_sources(omath PRIVATE proj_pred_engine_legacy.cpp projectile.cpp target.cpp proj_pred_engine_avx2.cpp proj_pred_engine.cpp)
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Created by Vlad on 2/23/2025.
|
// Created by Vlad on 2/23/2025.
|
||||||
//
|
//
|
||||||
#include "omath/projectile_prediction/ProjPredEngine.hpp"
|
#include "omath/projectile_prediction/proj_pred_engine.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace omath::projectile_prediction
|
namespace omath::projectile_prediction
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Created by Vlad on 2/23/2025.
|
// Created by Vlad on 2/23/2025.
|
||||||
//
|
//
|
||||||
#include "omath/projectile_prediction/ProjPredEngineAVX2.hpp"
|
#include "omath/projectile_prediction/proj_pred_engine_avx2.hpp"
|
||||||
#include "source_location"
|
#include "source_location"
|
||||||
|
|
||||||
namespace omath::projectile_prediction
|
namespace omath::projectile_prediction
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "omath/projectile_prediction/ProjPredEngineLegacy.hpp"
|
#include "omath/projectile_prediction/proj_pred_engine_legacy.hpp"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <omath/Angles.hpp>
|
#include <omath/angles.hpp>
|
||||||
|
|
||||||
namespace omath::projectile_prediction
|
namespace omath::projectile_prediction
|
||||||
{
|
{
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
// Created by Vlad on 6/9/2024.
|
// Created by Vlad on 6/9/2024.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "omath/projectile_prediction/Projectile.hpp"
|
#include "omath/projectile_prediction/projectile.hpp"
|
||||||
|
|
||||||
#include <omath/engines/source_engine/Formulas.hpp>
|
#include <omath/engines/source_engine/formulas.hpp>
|
||||||
|
|
||||||
namespace omath::projectile_prediction
|
namespace omath::projectile_prediction
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Vlad on 6/9/2024.
|
// Created by Vlad on 6/9/2024.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "omath/projectile_prediction/Projectile.hpp"
|
#include "omath/projectile_prediction/projectile.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace omath::prediction
|
namespace omath::prediction
|
||||||
@@ -1 +1 @@
|
|||||||
target_sources(omath PRIVATE Camera.cpp)
|
target_sources(omath PRIVATE camera.cpp)
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Created by Vlad on 27.08.2024.
|
// Created by Vlad on 27.08.2024.
|
||||||
//
|
//
|
||||||
#include "omath/projection/Camera.hpp"
|
#include "omath/projection/camera.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace omath::projection
|
namespace omath::projection
|
||||||
@@ -4,25 +4,25 @@ project(unit-tests)
|
|||||||
|
|
||||||
include(GoogleTest)
|
include(GoogleTest)
|
||||||
add_executable(unit-tests
|
add_executable(unit-tests
|
||||||
general/UnitTestPrediction.cpp
|
general/unit_test_prediction.cpp
|
||||||
general/UnitTestMatrix.cpp
|
general/unit_test_matrix.cpp
|
||||||
general/UnitTestMat.cpp
|
general/unit_test_mat.cpp
|
||||||
general/UnitTestAstar.cpp
|
general/unit_test_a_star.cpp
|
||||||
general/UnitTestProjection.cpp
|
general/unit_test_projection.cpp
|
||||||
general/UnitTestVector3.cpp
|
general/unit_test_vector3.cpp
|
||||||
general/UnitTestVector2.cpp
|
general/unit_test_vector2.cpp
|
||||||
general/UnitTestColor.cpp
|
general/unit_test_color.cpp
|
||||||
general/UnitTestVector4.cpp
|
general/unit_test_vector4.cpp
|
||||||
general/UnitTestLineTrace.cpp
|
general/unit_test_line_trace.cpp
|
||||||
general/UnitTestAngles.cpp
|
general/unit_test_angles.cpp
|
||||||
general/UnitTestViewAngles.cpp
|
general/unit_test_view_angles.cpp
|
||||||
general/UnitTestAngle.cpp
|
general/unit_test_angle.cpp
|
||||||
general/UnitTestTriangle.cpp
|
general/unit_test_triangle.cpp
|
||||||
|
|
||||||
engines/UnitTestOpenGL.cpp
|
engines/unit_test_open_gl.cpp
|
||||||
engines/UnitTestUnityEngine.cpp
|
engines/unit_test_unity_engine.cpp
|
||||||
engines/UnitTestSourceEngine.cpp
|
engines/unit_test_source_engine.cpp
|
||||||
engines/UnitTestIwEngine.cpp
|
engines/unit_test_iw_engine.cpp
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -35,6 +35,6 @@ set_target_properties(unit-tests PROPERTIES
|
|||||||
CXX_STANDARD_REQUIRED ON)
|
CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
|
||||||
target_link_libraries(unit-tests PRIVATE gtest gtest_main omath)
|
target_link_libraries(unit-tests PRIVATE gtest gtest_main omath::omath)
|
||||||
|
|
||||||
gtest_discover_tests(unit-tests)
|
gtest_discover_tests(unit-tests)
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// Created by Vlad on 18.08.2024.
|
// Created by Vlad on 18.08.2024.
|
||||||
//
|
//
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <omath/pathfinding/Astar.hpp>
|
#include <omath/pathfinding/a_star.hpp>
|
||||||
|
|
||||||
|
|
||||||
TEST(UnitTestAstar, FindingRightPath)
|
TEST(UnitTestAstar, FindingRightPath)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "omath/collision/LineTracer.hpp"
|
#include "omath/collision/line_tracer.hpp"
|
||||||
#include "omath/Triangle.hpp"
|
#include "omath/Triangle.hpp"
|
||||||
#include "omath/Vector3.hpp"
|
#include "omath/Vector3.hpp"
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ TEST_F(UnitTestMat, ToString)
|
|||||||
{
|
{
|
||||||
const std::string str = m2.ToString();
|
const std::string str = m2.ToString();
|
||||||
EXPECT_FALSE(str.empty());
|
EXPECT_FALSE(str.empty());
|
||||||
EXPECT_EQ(str, "1 2\n3 4\n");
|
EXPECT_EQ(str, "[[ 1.000, 2.000]\n [ 3.000, 4.000]]");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test assignment operators
|
// Test assignment operators
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <omath/projectile_prediction/ProjPredEngineLegacy.hpp>
|
#include <omath/projectile_prediction/proj_pred_engine_legacy.hpp>
|
||||||
|
|
||||||
TEST(UnitTestPrediction, PredictionTest)
|
TEST(UnitTestPrediction, PredictionTest)
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
//
|
//
|
||||||
// Created by Orange on 11/30/2024.
|
// Created by Orange on 11/30/2024.
|
||||||
//
|
//
|
||||||
#include <omath/ViewAngles.hpp>
|
#include <omath/view_angles.hpp>
|
||||||
Reference in New Issue
Block a user