mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-15 21:33:25 +00:00
modified output dir
This commit is contained in:
@@ -6,6 +6,9 @@ project(omath VERSION 1.0.0)
|
|||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 26)
|
set(CMAKE_CXX_STANDARD 26)
|
||||||
|
|
||||||
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}")
|
||||||
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}")
|
||||||
|
|
||||||
option(OMATH_BUILD_TESTS "Build unit tests" ON)
|
option(OMATH_BUILD_TESTS "Build unit tests" ON)
|
||||||
option(OMATH_THREAT_WARNING_AS_ERROR "Set highest level of warnings and force compiler to treat them as errors" ON)
|
option(OMATH_THREAT_WARNING_AS_ERROR "Set highest level of warnings and force compiler to treat them as errors" ON)
|
||||||
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)
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
#include "omath/Matrix.hpp"
|
#include "omath/Matrix.hpp"
|
||||||
#include "omath/Vector3.hpp"
|
|
||||||
#include "omath/Angles.hpp"
|
#include "omath/Angles.hpp"
|
||||||
|
#include "omath/Vector3.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
#include <complex>
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <utility>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <complex>
|
|
||||||
|
|
||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
@@ -69,7 +68,6 @@ namespace omath
|
|||||||
|
|
||||||
for (size_t i = 0; i < rows * columns; ++i)
|
for (size_t i = 0; i < rows * columns; ++i)
|
||||||
At(i / rows, i % columns) = pRaw[i];
|
At(i / rows, i % columns) = pRaw[i];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Matrix::RowCount() const noexcept
|
size_t Matrix::RowCount() const noexcept
|
||||||
@@ -175,7 +173,6 @@ namespace omath
|
|||||||
At(i, j) = other.At(i, j);
|
At(i, j) = other.At(i, j);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix& Matrix::operator=(Matrix&& other) noexcept
|
Matrix& Matrix::operator=(Matrix&& other) noexcept
|
||||||
@@ -191,7 +188,6 @@ namespace omath
|
|||||||
other.m_columns = 0;
|
other.m_columns = 0;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix& Matrix::operator/=(const float f)
|
Matrix& Matrix::operator/=(const float f)
|
||||||
@@ -306,8 +302,7 @@ namespace omath
|
|||||||
|
|
||||||
Matrix Matrix::ToScreenMatrix(const float screenWidth, const float screenHeight)
|
Matrix Matrix::ToScreenMatrix(const float screenWidth, const float screenHeight)
|
||||||
{
|
{
|
||||||
return
|
return {
|
||||||
{
|
|
||||||
{screenWidth / 2.f, 0.f, 0.f, 0.f},
|
{screenWidth / 2.f, 0.f, 0.f, 0.f},
|
||||||
{0.f, -screenHeight / 2.f, 0.f, 0.f},
|
{0.f, -screenHeight / 2.f, 0.f, 0.f},
|
||||||
{0.f, 0.f, 1.f, 0.f},
|
{0.f, 0.f, 1.f, 0.f},
|
||||||
@@ -317,8 +312,7 @@ namespace omath
|
|||||||
|
|
||||||
Matrix Matrix::TranslationMatrix(const Vector3& diff)
|
Matrix Matrix::TranslationMatrix(const Vector3& diff)
|
||||||
{
|
{
|
||||||
return
|
return {
|
||||||
{
|
|
||||||
{1.f, 0.f, 0.f, 0.f},
|
{1.f, 0.f, 0.f, 0.f},
|
||||||
{0.f, 1.f, 0.f, 0.f},
|
{0.f, 1.f, 0.f, 0.f},
|
||||||
{0.f, 0.f, 1.f, 0.f},
|
{0.f, 0.f, 1.f, 0.f},
|
||||||
@@ -328,8 +322,7 @@ namespace omath
|
|||||||
|
|
||||||
Matrix Matrix::OrientationMatrix(const Vector3& forward, const Vector3& right, const Vector3& up)
|
Matrix Matrix::OrientationMatrix(const Vector3& forward, const Vector3& right, const Vector3& up)
|
||||||
{
|
{
|
||||||
return
|
return {
|
||||||
{
|
|
||||||
{right.x, up.x, forward.x, 0.f},
|
{right.x, up.x, forward.x, 0.f},
|
||||||
{right.y, up.y, forward.y, 0.f},
|
{right.y, up.y, forward.y, 0.f},
|
||||||
{right.z, up.z, forward.z, 0.f},
|
{right.z, up.z, forward.z, 0.f},
|
||||||
@@ -337,18 +330,14 @@ namespace omath
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix Matrix::ProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near,
|
Matrix Matrix::ProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near, const float far)
|
||||||
const float far)
|
|
||||||
{
|
{
|
||||||
const float fovHalfTan = std::tan(angles::DegreesToRadians(fieldOfView) / 2.f);
|
const float fovHalfTan = std::tan(angles::DegreesToRadians(fieldOfView) / 2.f);
|
||||||
|
|
||||||
return
|
return {{1.f / (aspectRatio * fovHalfTan), 0.f, 0.f, 0.f},
|
||||||
{
|
|
||||||
{1.f / (aspectRatio*fovHalfTan), 0.f, 0.f, 0.f},
|
|
||||||
{0.f, 1.f / fovHalfTan, 0.f, 0.f},
|
{0.f, 1.f / fovHalfTan, 0.f, 0.f},
|
||||||
{0.f, 0.f, (far + near) / (far - near), 2.f * near * far / (far - near)},
|
{0.f, 0.f, (far + near) / (far - near), 2.f * near * far / (far - near)},
|
||||||
{0.f, 0.f, -1.f, 0.f}
|
{0.f, 0.f, -1.f, 0.f}};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const float* Matrix::Raw() const
|
const float* Matrix::Raw() const
|
||||||
@@ -368,4 +357,4 @@ namespace omath
|
|||||||
m_rows = 0;
|
m_rows = 0;
|
||||||
m_data = nullptr;
|
m_data = nullptr;
|
||||||
}
|
}
|
||||||
}
|
} // namespace omath
|
||||||
|
|||||||
Reference in New Issue
Block a user