diff --git a/include/aabb.h b/include/aabb.h index ebaa688..a44c1f6 100644 --- a/include/aabb.h +++ b/include/aabb.h @@ -31,15 +31,14 @@ // Axis aligned bounding box (AABB) -#ifndef KRAKEN_AABB_H -#define KRAKEN_AABB_H +#pragma once #include // for hash<> #include "vector2.h" #include "vector3.h" -namespace kraken { +namespace hydra { class Matrix4; @@ -84,23 +83,20 @@ public: float longest_radius() const; Vector3 nearestPoint(const Vector3& v) const; }; -static_assert(std::is_pod::value, "kraken::AABB must be a POD type."); +static_assert(std::is_pod::value, "hydra::AABB must be a POD type."); -} // namespace kraken +} // namespace hydra namespace std { template<> -struct hash +struct hash { public: - size_t operator()(const kraken::AABB& s) const + size_t operator()(const hydra::AABB& s) const { - size_t h1 = hash()(s.min); - size_t h2 = hash()(s.max); + size_t h1 = hash()(s.min); + size_t h2 = hash()(s.max); return h1 ^ (h2 << 1); } }; } // namespace std - - -#endif /* defined(KRAKEN_AABB_H) */ diff --git a/include/hitinfo.h b/include/hitinfo.h index 4222d78..05c2921 100644 --- a/include/hitinfo.h +++ b/include/hitinfo.h @@ -29,14 +29,13 @@ // or implied, of Kearwood Gilbert. // -#ifndef KRAKEN_HITINFO_H -#define KRAKEN_HITINFO_H +#pragma once #include "vector3.h" class KRNode; -namespace kraken { +namespace hydra { class HitInfo { @@ -61,6 +60,5 @@ private: float m_distance; }; -} // namespace kraken +} // namespace hydra -#endif diff --git a/include/hydra.h b/include/hydra.h index 4e479a0..f2f145e 100644 --- a/include/hydra.h +++ b/include/hydra.h @@ -29,8 +29,7 @@ // or implied, of Kearwood Gilbert. // -#ifndef KRAKEN_HYDRA_H -#define KRAKEN_HYDRA_H +#pragma once #include "scalar.h" #include "vector2.h" @@ -45,5 +44,3 @@ #include "aabb.h" #include "triangle3.h" #include "hitinfo.h" - -#endif // KRAKEN_HYDRA_H diff --git a/include/matrix2.h b/include/matrix2.h index 4d7da2b..6cbb16d 100644 --- a/include/matrix2.h +++ b/include/matrix2.h @@ -31,10 +31,9 @@ #include "vector2.h" -#ifndef KRAKEN_MATRIX2_H -#define KRAKEN_MATRIX2_H +#pragma once -namespace kraken { +namespace hydra { class Matrix2 { @@ -89,22 +88,20 @@ public: static Matrix2 Scaling(const Vector2& v); static Matrix2 Identity(); }; -static_assert(std::is_pod::value, "kraken::Matrix2 must be a POD type."); +static_assert(std::is_pod::value, "hydra::Matrix2 must be a POD type."); -} // namespace kraken +} // namespace hydra namespace std { template<> -struct hash +struct hash { public: - size_t operator()(const kraken::Matrix2& s) const + size_t operator()(const hydra::Matrix2& s) const { - size_t h1 = hash()(s.axis_x); - size_t h2 = hash()(s.axis_y); + size_t h1 = hash()(s.axis_x); + size_t h2 = hash()(s.axis_y); return h1 ^ (h2 << 1); } }; } // namespace std - -#endif // KRAKEN_MATRIX2_H diff --git a/include/matrix2x3.h b/include/matrix2x3.h index 0293840..d2d2b47 100644 --- a/include/matrix2x3.h +++ b/include/matrix2x3.h @@ -32,10 +32,9 @@ #include "vector2.h" #include "vector3.h" -#ifndef KRAKEN_MATRIX2X3_H -#define KRAKEN_MATRIX2X3_H +#pragma once -namespace kraken { +namespace hydra { class Matrix2x3 { @@ -91,23 +90,22 @@ public: static Matrix2x3 Scaling(const Vector2& v); static Matrix2x3 Identity(); }; -static_assert(std::is_pod::value, "kraken::Matrix2x3 must be a POD type."); +static_assert(std::is_pod::value, "hydra::Matrix2x3 must be a POD type."); -} // namespace kraken +} // namespace hydra namespace std { template<> -struct hash +struct hash { public: - size_t operator()(const kraken::Matrix2x3& s) const + size_t operator()(const hydra::Matrix2x3& s) const { - size_t h1 = hash()(s.axis_x); - size_t h2 = hash()(s.axis_y); - size_t h3 = hash()(s.transform); + size_t h1 = hash()(s.axis_x); + size_t h2 = hash()(s.axis_y); + size_t h3 = hash()(s.transform); return h1 ^ (h2 << 1) ^ (h3 << 2); } }; } // namespace std -#endif // KRAKEN_MATRIX2X3_H diff --git a/include/matrix4.h b/include/matrix4.h index ec694d7..c358e3d 100644 --- a/include/matrix4.h +++ b/include/matrix4.h @@ -33,10 +33,9 @@ #include "vector3.h" #include "vector4.h" -#ifndef KRAKEN_MATRIX4_H -#define KRAKEN_MATRIX4_H +#pragma once -namespace kraken { +namespace hydra { enum class AXIS { @@ -114,24 +113,22 @@ public: static Matrix4 Scaling(const Vector3& v); static Matrix4 Identity(); }; -static_assert(std::is_pod::value, "kraken::Matrix4 must be a POD type."); +static_assert(std::is_pod::value, "hydra::Matrix4 must be a POD type."); -} // namespace kraken +} // namespace hydra namespace std { template<> -struct hash +struct hash { public: - size_t operator()(const kraken::Matrix4& s) const + size_t operator()(const hydra::Matrix4& s) const { - size_t h1 = hash()(s.axis_x); - size_t h2 = hash()(s.axis_y); - size_t h3 = hash()(s.axis_z); - size_t h4 = hash()(s.transform); + size_t h1 = hash()(s.axis_x); + size_t h2 = hash()(s.axis_y); + size_t h3 = hash()(s.axis_z); + size_t h4 = hash()(s.transform); return h1 ^ (h2 << 1) ^ (h3 << 2) ^ (h4 << 3); } }; } // namespace std - -#endif // KRAKEN_MATRIX4_H diff --git a/include/quaternion.h b/include/quaternion.h index f655c4a..7b9f42a 100644 --- a/include/quaternion.h +++ b/include/quaternion.h @@ -29,12 +29,11 @@ // or implied, of Kearwood Gilbert. // -#ifndef KRAKEN_QUATERNION_H -#define KRAKEN_QUATERNION_H +#pragma once #include "vector3.h" -namespace kraken { +namespace hydra { class Quaternion { @@ -99,16 +98,16 @@ public: static Quaternion Slerp(const Quaternion& a, const Quaternion& b, float t); static float Dot(const Quaternion& v1, const Quaternion& v2); }; -static_assert(std::is_pod::value, "kraken::Quaternion must be a POD type."); +static_assert(std::is_pod::value, "hydra::Quaternion must be a POD type."); -} // namespace kraken +} // namespace hydra namespace std { template<> -struct hash +struct hash { public: - size_t operator()(const kraken::Quaternion& s) const + size_t operator()(const hydra::Quaternion& s) const { size_t h1 = hash()(s.c[0]); size_t h2 = hash()(s.c[1]); @@ -118,5 +117,3 @@ public: } }; } // namespace std - -#endif // KRAKEN_QUATERNION_H diff --git a/include/scalar.h b/include/scalar.h index d103169..fbbed15 100644 --- a/include/scalar.h +++ b/include/scalar.h @@ -29,14 +29,12 @@ // or implied, of Kearwood Gilbert. // -#ifndef KRAKEN_SCALAR_H -#define KRAKEN_SCALAR_H +#pragma once -namespace kraken { +namespace hydra { float SmoothStep(float a, float b, float t); float Lerp(float a, float b, float t); -}; // namespace kraken +}; // namespace hydra -#endif // KRAKEN_SCALAR_H diff --git a/include/triangle3.h b/include/triangle3.h index b35adc7..a79ee0a 100644 --- a/include/triangle3.h +++ b/include/triangle3.h @@ -29,12 +29,11 @@ // or implied, of Kearwood Gilbert. // -#ifndef KRAKEN_TRIANGLE3_H -#define KRAKEN_TRIANGLE3_H +#pragma once #include "vector3.h" -namespace kraken { +namespace hydra { class Triangle3 { @@ -59,23 +58,21 @@ public: bool containsPoint(const Vector3& p) const; Vector3 closestPointOnTriangle(const Vector3& p) const; }; -static_assert(std::is_pod::value, "kraken::Triangle3 must be a POD type."); +static_assert(std::is_pod::value, "hydra::Triangle3 must be a POD type."); -} // namespace kraken +} // namespace hydra namespace std { template<> -struct hash +struct hash { public: - size_t operator()(const kraken::Triangle3& s) const + size_t operator()(const hydra::Triangle3& s) const { - size_t h1 = hash()(s.vert[0]); - size_t h2 = hash()(s.vert[1]); - size_t h3 = hash()(s.vert[2]); + size_t h1 = hash()(s.vert[0]); + size_t h2 = hash()(s.vert[1]); + size_t h3 = hash()(s.vert[2]); return h1 ^ (h2 << 1) ^ (h3 << 2); } }; } // namespace std - -#endif // KRAKEN_TRIANGLE3_H diff --git a/include/vector2.h b/include/vector2.h index 3940801..3daac06 100644 --- a/include/vector2.h +++ b/include/vector2.h @@ -29,14 +29,13 @@ // or implied, of Kearwood Gilbert. // -#ifndef KRAKEN_VECTOR2_H -#define KRAKEN_VECTOR2_H +#pragma once #include // for hash<> #include // for std::numeric_limits<> #include // for sqrtf -namespace kraken { +namespace hydra { class Vector2 { @@ -105,16 +104,16 @@ public: static Vector2 Zero(); static Vector2 One(); }; -static_assert(std::is_pod::value, "kraken::Vector2 must be a POD type."); +static_assert(std::is_pod::value, "hydra::Vector2 must be a POD type."); -} // namespace kraken +} // namespace hydra namespace std { template<> -struct hash +struct hash { public: - size_t operator()(const kraken::Vector2& s) const + size_t operator()(const hydra::Vector2& s) const { size_t h1 = hash()(s.x); size_t h2 = hash()(s.y); @@ -122,5 +121,3 @@ public: } }; } // namespace std - -#endif // KRAKEN_VECTOR2_H diff --git a/include/vector2i.h b/include/vector2i.h index 9034876..54d39d6 100644 --- a/include/vector2i.h +++ b/include/vector2i.h @@ -35,7 +35,7 @@ #include // for std::numeric_limits<> #include // for sqrtf -namespace kraken { +namespace hydra { class Vector2i { @@ -105,16 +105,16 @@ public: static Vector2i Zero(); static Vector2i One(); }; // class Vector2i -static_assert(std::is_pod::value, "kraken::Vector2i must be a POD type."); +static_assert(std::is_pod::value, "hydra::Vector2i must be a POD type."); -} // namespace kraken +} // namespace hydra namespace std { template<> -struct hash +struct hash { public: - size_t operator()(const kraken::Vector2i& s) const + size_t operator()(const hydra::Vector2i& s) const { size_t h1 = hash()(s.x); size_t h2 = hash()(s.y); diff --git a/include/vector3.h b/include/vector3.h index 01c35af..336b74a 100644 --- a/include/vector3.h +++ b/include/vector3.h @@ -36,7 +36,7 @@ #include "vector2.h" #include "vector4.h" -namespace kraken { +namespace hydra { class Vector3 { @@ -136,16 +136,16 @@ public: static Vector3 Slerp(const Vector3& v1, const Vector3& v2, float d); static void OrthoNormalize(Vector3& normal, Vector3& tangent); // Gram-Schmidt Orthonormalization }; -static_assert(std::is_pod::value, "kraken::Vector3 must be a POD type."); +static_assert(std::is_pod::value, "hydra::Vector3 must be a POD type."); -} // namespace kraken +} // namespace hydra namespace std { template<> -struct hash +struct hash { public: - size_t operator()(const kraken::Vector3& s) const + size_t operator()(const hydra::Vector3& s) const { size_t h1 = hash()(s.x); size_t h2 = hash()(s.y); diff --git a/include/vector3i.h b/include/vector3i.h index a594235..79ff673 100644 --- a/include/vector3i.h +++ b/include/vector3i.h @@ -35,7 +35,7 @@ #include "vector2i.h" -namespace kraken { +namespace hydra { class Vector3i { @@ -125,16 +125,16 @@ public: static Vector3i Right(); static Vector3i Scale(const Vector3i& v1, const Vector3i& v2); }; -static_assert(std::is_pod::value, "kraken::Vector3i must be a POD type."); +static_assert(std::is_pod::value, "hydra::Vector3i must be a POD type."); -} // namespace kraken +} // namespace hydra namespace std { template<> -struct hash +struct hash { public: - size_t operator()(const kraken::Vector3i& s) const + size_t operator()(const hydra::Vector3i& s) const { size_t h1 = hash()(s.x); size_t h2 = hash()(s.y); diff --git a/include/vector4.h b/include/vector4.h index 601e6d2..80d6c6d 100644 --- a/include/vector4.h +++ b/include/vector4.h @@ -33,7 +33,7 @@ #include // for hash<> -namespace kraken { +namespace hydra { class Vector3; @@ -109,16 +109,16 @@ public: static Vector4 Slerp(const Vector4& v1, const Vector4& v2, float d); static void OrthoNormalize(Vector4& normal, Vector4& tangent); // Gram-Schmidt Orthonormalization }; -static_assert(std::is_pod::value, "kraken::Vector4 must be a POD type."); +static_assert(std::is_pod::value, "hydra::Vector4 must be a POD type."); -} // namespace kraken +} // namespace hydra namespace std { template<> -struct hash +struct hash { public: - size_t operator()(const kraken::Vector4& s) const + size_t operator()(const hydra::Vector4& s) const { size_t h1 = hash()(s.x); size_t h2 = hash()(s.y); diff --git a/src/aabb.cpp b/src/aabb.cpp index 855c6ea..4aa2b32 100644 --- a/src/aabb.cpp +++ b/src/aabb.cpp @@ -33,7 +33,7 @@ #include "assert.h" #include "krhelpers.h" -namespace kraken { +namespace hydra { void AABB::init() { @@ -371,5 +371,5 @@ 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)); } -} // namespace kraken +} // namespace hydra diff --git a/src/hitinfo.cpp b/src/hitinfo.cpp index 7d570ab..ef9365c 100644 --- a/src/hitinfo.cpp +++ b/src/hitinfo.cpp @@ -31,7 +31,7 @@ #include "../include/hydra.h" -namespace kraken { +namespace hydra { HitInfo::HitInfo() { @@ -96,5 +96,5 @@ HitInfo& HitInfo::operator =(const HitInfo& b) return *this; } -} // namespace kraken +} // namespace hydra diff --git a/src/matrix2.cpp b/src/matrix2.cpp index aa2019b..08f6cb0 100644 --- a/src/matrix2.cpp +++ b/src/matrix2.cpp @@ -33,7 +33,7 @@ #include -namespace kraken { +namespace hydra { void Matrix2::init() { @@ -216,5 +216,5 @@ Matrix2 Matrix2::Identity() return m; } -} // namespace kraken +} // namespace hydra diff --git a/src/matrix2x3.cpp b/src/matrix2x3.cpp index 38ba1d5..72b6ee0 100644 --- a/src/matrix2x3.cpp +++ b/src/matrix2x3.cpp @@ -33,7 +33,7 @@ #include -namespace kraken { +namespace hydra { void Matrix2x3::init() { @@ -245,5 +245,5 @@ Matrix2x3 Matrix2x3::Identity() return m; } -} // namespace kraken +} // namespace hydra diff --git a/src/matrix4.cpp b/src/matrix4.cpp index f1cb5b6..b07c743 100644 --- a/src/matrix4.cpp +++ b/src/matrix4.cpp @@ -33,7 +33,7 @@ #include -namespace kraken { +namespace hydra { void Matrix4::init() { @@ -484,5 +484,5 @@ Matrix4 Matrix4::Identity() return m; } -} // namespace kraken +} // namespace hydra diff --git a/src/quaternion.cpp b/src/quaternion.cpp index 66651a7..05b2abd 100644 --- a/src/quaternion.cpp +++ b/src/quaternion.cpp @@ -33,7 +33,7 @@ #include "krhelpers.h" -namespace kraken { +namespace hydra { void Quaternion::init() { @@ -458,4 +458,4 @@ Quaternion Quaternion::Slerp(const Quaternion& a, const Quaternion& b, float t) return (c * sinf((1.0f - t) * halftheta) + b * sinf(t * halftheta)) / sinf(halftheta); } -} // namespace kraken +} // namespace hydra diff --git a/src/scalar.cpp b/src/scalar.cpp index 571d064..633561f 100644 --- a/src/scalar.cpp +++ b/src/scalar.cpp @@ -31,7 +31,7 @@ #include "../include/hydra.h" -namespace kraken { +namespace hydra { float SmoothStep(float a, float b, float t) { @@ -44,4 +44,4 @@ float Lerp(float a, float b, float t) return (a + (b - a) * t); } -} // namespace kraken +} // namespace hydra diff --git a/src/triangle3.cpp b/src/triangle3.cpp index efed978..48964e3 100644 --- a/src/triangle3.cpp +++ b/src/triangle3.cpp @@ -31,7 +31,7 @@ #include "../include/hydra.h" -using namespace kraken; +using namespace hydra; namespace { bool _intersectSphere(const Vector3& start, const Vector3& dir, const Vector3& sphere_center, float sphere_radius, float& distance) @@ -96,7 +96,7 @@ Vector3 _closestPointOnLine(const Vector3& a, const Vector3& b, const Vector3& p } } // anonymous namespace -namespace kraken { +namespace hydra { void Triangle3::init(const Vector3& v1, const Vector3& v2, const Vector3& v3) { @@ -350,4 +350,4 @@ bool Triangle3::containsPoint(const Vector3& p) const return (r + t <= 1); } -} // namespace kraken +} // namespace hydra diff --git a/src/vector2.cpp b/src/vector2.cpp index f46052e..db620c6 100644 --- a/src/vector2.cpp +++ b/src/vector2.cpp @@ -32,7 +32,7 @@ #include "../include/hydra.h" #include "krhelpers.h" -namespace kraken { +namespace hydra { void Vector2::init() { @@ -299,4 +299,4 @@ Vector2 Vector2::Max(const Vector2& v1, const Vector2& v2) return Vector2::Create(KRMAX(v1.x, v2.x), KRMAX(v1.y, v2.y)); } -} // namepsace kraken +} // namepsace hydra diff --git a/src/vector2i.cpp b/src/vector2i.cpp index 1bf1477..9f912fe 100644 --- a/src/vector2i.cpp +++ b/src/vector2i.cpp @@ -32,7 +32,7 @@ #include "../include/hydra.h" #include "krhelpers.h" -namespace kraken { +namespace hydra { void Vector2i::init() { @@ -293,4 +293,4 @@ Vector2i Vector2i::Max(const Vector2i& v1, const Vector2i& v2) return Vector2i::Create(KRMAX(v1.x, v2.x), KRMAX(v1.y, v2.y)); } -} // namepsace kraken +} // namepsace hydra diff --git a/src/vector3.cpp b/src/vector3.cpp index de00964..a79689a 100644 --- a/src/vector3.cpp +++ b/src/vector3.cpp @@ -32,7 +32,7 @@ #include "../include/hydra.h" #include "krhelpers.h" -namespace kraken { +namespace hydra { //default constructor void Vector3::init() @@ -502,5 +502,5 @@ bool Vector3::operator <(const Vector3& b) const } } -} // namespace kraken +} // namespace hydra diff --git a/src/vector3i.cpp b/src/vector3i.cpp index 4855d78..177d62e 100644 --- a/src/vector3i.cpp +++ b/src/vector3i.cpp @@ -32,7 +32,7 @@ #include "../include/hydra.h" #include "krhelpers.h" -namespace kraken { +namespace hydra { //default constructor void Vector3i::init() @@ -417,4 +417,4 @@ bool Vector3i::operator <(const Vector3i& b) const } } -} // namespace kraken +} // namespace hydra diff --git a/src/vector4.cpp b/src/vector4.cpp index 9dc0119..7ddb4b0 100644 --- a/src/vector4.cpp +++ b/src/vector4.cpp @@ -32,7 +32,7 @@ #include "../include/hydra.h" #include "krhelpers.h" -namespace kraken { +namespace hydra { //default constructor void Vector4::init() @@ -379,4 +379,4 @@ bool Vector4::operator <(const Vector4& b) const return false; } -} // namespace kraken +} // namespace hydra