6 Commits
v1.0.0 ... main

Author SHA1 Message Date
516e143901 Added missing <type_traits> include
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
2026-07-25 14:59:56 -07:00
7e38a43301 Bump to C++23 standard.
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
2026-06-16 00:38:22 -07:00
3d87e2f885 Bump to c++20
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
Remove KRMIN, KRMAX, and KRCLAMP helpers.
2026-05-17 14:23:26 -07:00
17b4ec2cde Add AABB::encapsulate(const Vector3& v)
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
Add AABB::Create(const AABB& modelSpaceExtents, const Matrix4& modelMatrix)
2026-05-17 12:50:26 -07:00
cc7dffbb9a Bump Copyright year
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
2026-05-17 12:22:00 -07:00
5c24fb9fbb Bump Copyright year 2024-01-20 18:58:55 -08:00
29 changed files with 77 additions and 49 deletions

View File

@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 3.16)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

View File

@@ -2,7 +2,7 @@
// KRAABB.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -34,6 +34,7 @@
#pragma once
#include <functional> // for hash<>
#include <type_traits>
#include "vector2.h"
#include "vector3.h"
@@ -53,6 +54,7 @@ public:
void init();
static AABB Create(const Vector3& minPoint, const Vector3& maxPoint);
static AABB Create(const Vector3& corner1, const Vector3& corner2, const Matrix4& modelMatrix);
static AABB Create(const AABB& modelSpaceExtents, const Matrix4& modelMatrix);
static AABB Create();
void scale(const Vector3& s);
@@ -69,6 +71,7 @@ public:
bool intersectsRay(const Vector3& v1, const Vector3& dir) const;
bool intersectsSphere(const Vector3& center, float radius) const;
void encapsulate(const AABB& b);
void encapsulate(const Vector3& v);
bool operator ==(const AABB& b) const;
bool operator !=(const AABB& b) const;

View File

@@ -2,7 +2,7 @@
// hitinfo.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -32,6 +32,7 @@
#pragma once
#include "vector3.h"
#include <type_traits>
class KRNode;

View File

@@ -2,7 +2,7 @@
// hydra.h
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:

View File

@@ -2,7 +2,7 @@
// Matrix2.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -28,10 +28,10 @@
// authors and should not be interpreted as representing official policies, either expressed
// or implied, of Kearwood Gilbert.
//
#pragma once
#include "vector2.h"
#pragma once
#include <type_traits>
namespace hydra {

View File

@@ -2,7 +2,7 @@
// Matrix2x3.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -29,10 +29,11 @@
// or implied, of Kearwood Gilbert.
//
#pragma once
#include "vector2.h"
#include "vector3.h"
#pragma once
#include <type_traits>
namespace hydra {

View File

@@ -2,7 +2,7 @@
// Matrix4.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -29,11 +29,11 @@
// or implied, of Kearwood Gilbert.
//
#pragma once
#include "vector3.h"
#include "vector4.h"
#pragma once
#include <type_traits>
namespace hydra {

View File

@@ -2,7 +2,7 @@
// Quaternion.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -32,6 +32,7 @@
#pragma once
#include "vector3.h"
#include <type_traits>
namespace hydra {

View File

@@ -2,7 +2,7 @@
// KRFloat.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:

View File

@@ -2,7 +2,7 @@
// KRTriangle.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -32,6 +32,7 @@
#pragma once
#include "vector3.h"
#include <type_traits>
namespace hydra {

View File

@@ -2,7 +2,7 @@
// vector2.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -34,6 +34,7 @@
#include <functional> // for hash<>
#include <limits> // for std::numeric_limits<>
#include <math.h> // for sqrtf
#include <type_traits>
namespace hydra {

View File

@@ -2,7 +2,7 @@
// vector2i.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -34,6 +34,7 @@
#include <functional> // for hash<>
#include <limits> // for std::numeric_limits<>
#include <math.h> // for sqrtf
#include <type_traits>
namespace hydra {

View File

@@ -2,7 +2,7 @@
// Vector3.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -32,6 +32,7 @@
#pragma once
#include <functional> // for hash<>
#include <type_traits>
#include "vector2.h"
#include "vector4.h"

View File

@@ -2,7 +2,7 @@
// Vector3i.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -32,6 +32,7 @@
#pragma once
#include <functional> // for hash<>
#include <type_traits>
#include "vector2i.h"

View File

@@ -2,7 +2,7 @@
// Vector4.h
// Kraken Engine / Hydra
//
// Copyright 2022 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -32,6 +32,7 @@
#pragma once
#include <functional> // for hash<>
#include <type_traits>
namespace hydra {

View File

@@ -2,7 +2,7 @@
// aabb.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -32,6 +32,7 @@
#include "../include/hydra.h"
#include "assert.h"
#include "krhelpers.h"
#include <algorithm>
namespace hydra {
@@ -91,6 +92,13 @@ AABB AABB::Create(const Vector3& corner1, const Vector3& corner2, const Matrix4&
return r;
}
AABB AABB::Create(const AABB& modelSpaceExtents, const Matrix4& modelMatrix)
{
AABB r;
r.init(modelSpaceExtents.min, modelSpaceExtents.max, modelMatrix);
return r;
}
bool AABB::operator ==(const AABB& b) const
{
return min == b.min && max == b.max;
@@ -366,9 +374,20 @@ void AABB::encapsulate(const AABB& b)
if (b.max.z > max.z) max.z = b.max.z;
}
void AABB::encapsulate(const Vector3& v)
{
if (v.x < min.x) min.x = v.x;
if (v.y < min.y) min.y = v.y;
if (v.z < min.z) min.z = v.z;
if (v.x > max.x) max.x = v.x;
if (v.y > max.y) max.y = v.y;
if (v.z > max.z) max.z = v.z;
}
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

View File

@@ -2,7 +2,7 @@
// hitinfo.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:

View File

@@ -2,7 +2,7 @@
// krhelpers.h
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -33,9 +33,6 @@
#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)
float const PI = 3.141592653589793f;

View File

@@ -2,7 +2,7 @@
// matrix2.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:

View File

@@ -2,7 +2,7 @@
// matrix23.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:

View File

@@ -2,7 +2,7 @@
// matrix4.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:

View File

@@ -2,7 +2,7 @@
// quaternion.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:

View File

@@ -2,7 +2,7 @@
// scalar.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:

View File

@@ -2,7 +2,7 @@
// KRTriangle.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:

View File

@@ -2,7 +2,7 @@
// Vector2.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -291,12 +291,12 @@ float Vector2::Dot(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)
{
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

View File

@@ -2,7 +2,7 @@
// Vector2i.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -285,12 +285,12 @@ int Vector2i::Dot(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)
{
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

View File

@@ -2,7 +2,7 @@
// Vector3.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -458,12 +458,12 @@ float Vector3::Dot(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)
{
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

View File

@@ -2,7 +2,7 @@
// Vector3i.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -373,12 +373,12 @@ int Vector3i::Dot(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)
{
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

View File

@@ -2,7 +2,7 @@
// Vector4.cpp
// Kraken Engine / Hydra
//
// Copyright 2023 Kearwood Gilbert. All rights reserved.
// Copyright 2026 Kearwood Gilbert. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
@@ -351,12 +351,12 @@ float Vector4::Dot(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)
{
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