Compare commits
1 Commits
17b4ec2cde
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d87e2f885 |
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required (VERSION 3.16)
|
cmake_minimum_required (VERSION 3.16)
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include "../include/hydra.h"
|
#include "../include/hydra.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "krhelpers.h"
|
#include "krhelpers.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace hydra {
|
namespace hydra {
|
||||||
|
|
||||||
@@ -386,7 +387,7 @@ void AABB::encapsulate(const Vector3& v)
|
|||||||
|
|
||||||
Vector3 AABB::nearestPoint(const Vector3& v) const
|
Vector3 AABB::nearestPoint(const Vector3& v) const
|
||||||
{
|
{
|
||||||
return Vector3::Create(KRCLAMP(v.x, min.x, max.x), KRCLAMP(v.y, min.y, max.y), KRCLAMP(v.z, min.z, max.z));
|
return Vector3::Create(std::clamp(v.x, min.x, max.x), std::clamp(v.y, min.y, max.y), std::clamp(v.z, min.z, max.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace hydra
|
} // namespace hydra
|
||||||
|
|||||||
@@ -33,9 +33,6 @@
|
|||||||
|
|
||||||
#include "../include/hydra.h"
|
#include "../include/hydra.h"
|
||||||
|
|
||||||
#define KRMIN(x,y) ((x) < (y) ? (x) : (y))
|
|
||||||
#define KRMAX(x,y) ((x) > (y) ? (x) : (y))
|
|
||||||
#define KRCLAMP(x, min, max) (KRMAX(KRMIN(x, max), min))
|
|
||||||
#define KRALIGN(x) ((x + 3) & ~0x03)
|
#define KRALIGN(x) ((x + 3) & ~0x03)
|
||||||
|
|
||||||
float const PI = 3.141592653589793f;
|
float const PI = 3.141592653589793f;
|
||||||
|
|||||||
@@ -291,12 +291,12 @@ float Vector2::Dot(const Vector2& v1, const Vector2& v2)
|
|||||||
|
|
||||||
Vector2 Vector2::Min(const Vector2& v1, const Vector2& v2)
|
Vector2 Vector2::Min(const Vector2& v1, const Vector2& v2)
|
||||||
{
|
{
|
||||||
return Vector2::Create(KRMIN(v1.x, v2.x), KRMIN(v1.y, v2.y));
|
return Vector2::Create(std::min(v1.x, v2.x), std::min(v1.y, v2.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 Vector2::Max(const Vector2& v1, const Vector2& v2)
|
Vector2 Vector2::Max(const Vector2& v1, const Vector2& v2)
|
||||||
{
|
{
|
||||||
return Vector2::Create(KRMAX(v1.x, v2.x), KRMAX(v1.y, v2.y));
|
return Vector2::Create(std::max(v1.x, v2.x), std::max(v1.y, v2.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namepsace hydra
|
} // namepsace hydra
|
||||||
|
|||||||
@@ -285,12 +285,12 @@ int Vector2i::Dot(const Vector2i& v1, const Vector2i& v2)
|
|||||||
|
|
||||||
Vector2i Vector2i::Min(const Vector2i& v1, const Vector2i& v2)
|
Vector2i Vector2i::Min(const Vector2i& v1, const Vector2i& v2)
|
||||||
{
|
{
|
||||||
return Vector2i::Create(KRMIN(v1.x, v2.x), KRMIN(v1.y, v2.y));
|
return Vector2i::Create(std::min(v1.x, v2.x), std::min(v1.y, v2.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2i Vector2i::Max(const Vector2i& v1, const Vector2i& v2)
|
Vector2i Vector2i::Max(const Vector2i& v1, const Vector2i& v2)
|
||||||
{
|
{
|
||||||
return Vector2i::Create(KRMAX(v1.x, v2.x), KRMAX(v1.y, v2.y));
|
return Vector2i::Create(std::max(v1.x, v2.x), std::max(v1.y, v2.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namepsace hydra
|
} // namepsace hydra
|
||||||
|
|||||||
@@ -458,12 +458,12 @@ float Vector3::Dot(const Vector3& v1, const Vector3& v2)
|
|||||||
|
|
||||||
Vector3 Vector3::Min(const Vector3& v1, const Vector3& v2)
|
Vector3 Vector3::Min(const Vector3& v1, const Vector3& v2)
|
||||||
{
|
{
|
||||||
return Vector3::Create(KRMIN(v1.x, v2.x), KRMIN(v1.y, v2.y), KRMIN(v1.z, v2.z));
|
return Vector3::Create(std::min(v1.x, v2.x), std::min(v1.y, v2.y), std::min(v1.z, v2.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 Vector3::Max(const Vector3& v1, const Vector3& v2)
|
Vector3 Vector3::Max(const Vector3& v1, const Vector3& v2)
|
||||||
{
|
{
|
||||||
return Vector3::Create(KRMAX(v1.x, v2.x), KRMAX(v1.y, v2.y), KRMAX(v1.z, v2.z));
|
return Vector3::Create(std::max(v1.x, v2.x), std::max(v1.y, v2.y), std::max(v1.z, v2.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Vector3::operator >(const Vector3& b) const
|
bool Vector3::operator >(const Vector3& b) const
|
||||||
|
|||||||
@@ -373,12 +373,12 @@ int Vector3i::Dot(const Vector3i& v1, const Vector3i& v2)
|
|||||||
|
|
||||||
Vector3i Vector3i::Min(const Vector3i& v1, const Vector3i& v2)
|
Vector3i Vector3i::Min(const Vector3i& v1, const Vector3i& v2)
|
||||||
{
|
{
|
||||||
return Vector3i::Create(KRMIN(v1.x, v2.x), KRMIN(v1.y, v2.y), KRMIN(v1.z, v2.z));
|
return Vector3i::Create(std::min(v1.x, v2.x), std::min(v1.y, v2.y), std::min(v1.z, v2.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3i Vector3i::Max(const Vector3i& v1, const Vector3i& v2)
|
Vector3i Vector3i::Max(const Vector3i& v1, const Vector3i& v2)
|
||||||
{
|
{
|
||||||
return Vector3i::Create(KRMAX(v1.x, v2.x), KRMAX(v1.y, v2.y), KRMAX(v1.z, v2.z));
|
return Vector3i::Create(std::max(v1.x, v2.x), std::max(v1.y, v2.y), std::max(v1.z, v2.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Vector3i::operator >(const Vector3i& b) const
|
bool Vector3i::operator >(const Vector3i& b) const
|
||||||
|
|||||||
@@ -351,12 +351,12 @@ float Vector4::Dot(const Vector4& v1, const Vector4& v2)
|
|||||||
|
|
||||||
Vector4 Vector4::Min(const Vector4& v1, const Vector4& v2)
|
Vector4 Vector4::Min(const Vector4& v1, const Vector4& v2)
|
||||||
{
|
{
|
||||||
return Vector4::Create(KRMIN(v1.x, v2.x), KRMIN(v1.y, v2.y), KRMIN(v1.z, v2.z), KRMIN(v1.w, v2.w));
|
return Vector4::Create(std::min(v1.x, v2.x), std::min(v1.y, v2.y), std::min(v1.z, v2.z), std::min(v1.w, v2.w));
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector4 Vector4::Max(const Vector4& v1, const Vector4& v2)
|
Vector4 Vector4::Max(const Vector4& v1, const Vector4& v2)
|
||||||
{
|
{
|
||||||
return Vector4::Create(KRMAX(v1.x, v2.x), KRMAX(v1.y, v2.y), KRMAX(v1.z, v2.z), KRMAX(v1.w, v2.w));
|
return Vector4::Create(std::max(v1.x, v2.x), std::max(v1.y, v2.y), std::max(v1.z, v2.z), std::max(v1.w, v2.w));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Vector4::operator >(const Vector4& b) const
|
bool Vector4::operator >(const Vector4& b) const
|
||||||
|
|||||||
Reference in New Issue
Block a user