Moved hydra to its own namespace
This commit is contained in:
@@ -31,15 +31,14 @@
|
||||
|
||||
// Axis aligned bounding box (AABB)
|
||||
|
||||
#ifndef KRAKEN_AABB_H
|
||||
#define KRAKEN_AABB_H
|
||||
#pragma once
|
||||
|
||||
#include <functional> // 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<AABB>::value, "kraken::AABB must be a POD type.");
|
||||
static_assert(std::is_pod<AABB>::value, "hydra::AABB must be a POD type.");
|
||||
|
||||
} // namespace kraken
|
||||
} // namespace hydra
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<kraken::AABB>
|
||||
struct hash<hydra::AABB>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const kraken::AABB& s) const
|
||||
size_t operator()(const hydra::AABB& s) const
|
||||
{
|
||||
size_t h1 = hash<kraken::Vector3>()(s.min);
|
||||
size_t h2 = hash<kraken::Vector3>()(s.max);
|
||||
size_t h1 = hash<hydra::Vector3>()(s.min);
|
||||
size_t h2 = hash<hydra::Vector3>()(s.max);
|
||||
return h1 ^ (h2 << 1);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
|
||||
#endif /* defined(KRAKEN_AABB_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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<Matrix2>::value, "kraken::Matrix2 must be a POD type.");
|
||||
static_assert(std::is_pod<Matrix2>::value, "hydra::Matrix2 must be a POD type.");
|
||||
|
||||
} // namespace kraken
|
||||
} // namespace hydra
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<kraken::Matrix2>
|
||||
struct hash<hydra::Matrix2>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const kraken::Matrix2& s) const
|
||||
size_t operator()(const hydra::Matrix2& s) const
|
||||
{
|
||||
size_t h1 = hash<kraken::Vector2>()(s.axis_x);
|
||||
size_t h2 = hash<kraken::Vector2>()(s.axis_y);
|
||||
size_t h1 = hash<hydra::Vector2>()(s.axis_x);
|
||||
size_t h2 = hash<hydra::Vector2>()(s.axis_y);
|
||||
return h1 ^ (h2 << 1);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#endif // KRAKEN_MATRIX2_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<Matrix2x3>::value, "kraken::Matrix2x3 must be a POD type.");
|
||||
static_assert(std::is_pod<Matrix2x3>::value, "hydra::Matrix2x3 must be a POD type.");
|
||||
|
||||
} // namespace kraken
|
||||
} // namespace hydra
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<kraken::Matrix2x3>
|
||||
struct hash<hydra::Matrix2x3>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const kraken::Matrix2x3& s) const
|
||||
size_t operator()(const hydra::Matrix2x3& s) const
|
||||
{
|
||||
size_t h1 = hash<kraken::Vector2>()(s.axis_x);
|
||||
size_t h2 = hash<kraken::Vector2>()(s.axis_y);
|
||||
size_t h3 = hash<kraken::Vector2>()(s.transform);
|
||||
size_t h1 = hash<hydra::Vector2>()(s.axis_x);
|
||||
size_t h2 = hash<hydra::Vector2>()(s.axis_y);
|
||||
size_t h3 = hash<hydra::Vector2>()(s.transform);
|
||||
return h1 ^ (h2 << 1) ^ (h3 << 2);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#endif // KRAKEN_MATRIX2X3_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<Matrix4>::value, "kraken::Matrix4 must be a POD type.");
|
||||
static_assert(std::is_pod<Matrix4>::value, "hydra::Matrix4 must be a POD type.");
|
||||
|
||||
} // namespace kraken
|
||||
} // namespace hydra
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<kraken::Matrix4>
|
||||
struct hash<hydra::Matrix4>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const kraken::Matrix4& s) const
|
||||
size_t operator()(const hydra::Matrix4& s) const
|
||||
{
|
||||
size_t h1 = hash<kraken::Vector4>()(s.axis_x);
|
||||
size_t h2 = hash<kraken::Vector4>()(s.axis_y);
|
||||
size_t h3 = hash<kraken::Vector4>()(s.axis_z);
|
||||
size_t h4 = hash<kraken::Vector4>()(s.transform);
|
||||
size_t h1 = hash<hydra::Vector4>()(s.axis_x);
|
||||
size_t h2 = hash<hydra::Vector4>()(s.axis_y);
|
||||
size_t h3 = hash<hydra::Vector4>()(s.axis_z);
|
||||
size_t h4 = hash<hydra::Vector4>()(s.transform);
|
||||
return h1 ^ (h2 << 1) ^ (h3 << 2) ^ (h4 << 3);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#endif // KRAKEN_MATRIX4_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<Quaternion>::value, "kraken::Quaternion must be a POD type.");
|
||||
static_assert(std::is_pod<Quaternion>::value, "hydra::Quaternion must be a POD type.");
|
||||
|
||||
} // namespace kraken
|
||||
} // namespace hydra
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<kraken::Quaternion>
|
||||
struct hash<hydra::Quaternion>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const kraken::Quaternion& s) const
|
||||
size_t operator()(const hydra::Quaternion& s) const
|
||||
{
|
||||
size_t h1 = hash<float>()(s.c[0]);
|
||||
size_t h2 = hash<float>()(s.c[1]);
|
||||
@@ -118,5 +117,3 @@ public:
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#endif // KRAKEN_QUATERNION_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
|
||||
|
||||
@@ -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<Triangle3>::value, "kraken::Triangle3 must be a POD type.");
|
||||
static_assert(std::is_pod<Triangle3>::value, "hydra::Triangle3 must be a POD type.");
|
||||
|
||||
} // namespace kraken
|
||||
} // namespace hydra
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<kraken::Triangle3>
|
||||
struct hash<hydra::Triangle3>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const kraken::Triangle3& s) const
|
||||
size_t operator()(const hydra::Triangle3& s) const
|
||||
{
|
||||
size_t h1 = hash<kraken::Vector3>()(s.vert[0]);
|
||||
size_t h2 = hash<kraken::Vector3>()(s.vert[1]);
|
||||
size_t h3 = hash<kraken::Vector3>()(s.vert[2]);
|
||||
size_t h1 = hash<hydra::Vector3>()(s.vert[0]);
|
||||
size_t h2 = hash<hydra::Vector3>()(s.vert[1]);
|
||||
size_t h3 = hash<hydra::Vector3>()(s.vert[2]);
|
||||
return h1 ^ (h2 << 1) ^ (h3 << 2);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#endif // KRAKEN_TRIANGLE3_H
|
||||
|
||||
@@ -29,14 +29,13 @@
|
||||
// or implied, of Kearwood Gilbert.
|
||||
//
|
||||
|
||||
#ifndef KRAKEN_VECTOR2_H
|
||||
#define KRAKEN_VECTOR2_H
|
||||
#pragma once
|
||||
|
||||
#include <functional> // for hash<>
|
||||
#include <limits> // for std::numeric_limits<>
|
||||
#include <math.h> // for sqrtf
|
||||
|
||||
namespace kraken {
|
||||
namespace hydra {
|
||||
|
||||
class Vector2
|
||||
{
|
||||
@@ -105,16 +104,16 @@ public:
|
||||
static Vector2 Zero();
|
||||
static Vector2 One();
|
||||
};
|
||||
static_assert(std::is_pod<Vector2>::value, "kraken::Vector2 must be a POD type.");
|
||||
static_assert(std::is_pod<Vector2>::value, "hydra::Vector2 must be a POD type.");
|
||||
|
||||
} // namespace kraken
|
||||
} // namespace hydra
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<kraken::Vector2>
|
||||
struct hash<hydra::Vector2>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const kraken::Vector2& s) const
|
||||
size_t operator()(const hydra::Vector2& s) const
|
||||
{
|
||||
size_t h1 = hash<float>()(s.x);
|
||||
size_t h2 = hash<float>()(s.y);
|
||||
@@ -122,5 +121,3 @@ public:
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
#endif // KRAKEN_VECTOR2_H
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <limits> // for std::numeric_limits<>
|
||||
#include <math.h> // 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<Vector2i>::value, "kraken::Vector2i must be a POD type.");
|
||||
static_assert(std::is_pod<Vector2i>::value, "hydra::Vector2i must be a POD type.");
|
||||
|
||||
} // namespace kraken
|
||||
} // namespace hydra
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<kraken::Vector2i>
|
||||
struct hash<hydra::Vector2i>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const kraken::Vector2i& s) const
|
||||
size_t operator()(const hydra::Vector2i& s) const
|
||||
{
|
||||
size_t h1 = hash<int>()(s.x);
|
||||
size_t h2 = hash<int>()(s.y);
|
||||
|
||||
@@ -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<Vector3>::value, "kraken::Vector3 must be a POD type.");
|
||||
static_assert(std::is_pod<Vector3>::value, "hydra::Vector3 must be a POD type.");
|
||||
|
||||
} // namespace kraken
|
||||
} // namespace hydra
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<kraken::Vector3>
|
||||
struct hash<hydra::Vector3>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const kraken::Vector3& s) const
|
||||
size_t operator()(const hydra::Vector3& s) const
|
||||
{
|
||||
size_t h1 = hash<float>()(s.x);
|
||||
size_t h2 = hash<float>()(s.y);
|
||||
|
||||
@@ -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<Vector3i>::value, "kraken::Vector3i must be a POD type.");
|
||||
static_assert(std::is_pod<Vector3i>::value, "hydra::Vector3i must be a POD type.");
|
||||
|
||||
} // namespace kraken
|
||||
} // namespace hydra
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<kraken::Vector3i>
|
||||
struct hash<hydra::Vector3i>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const kraken::Vector3i& s) const
|
||||
size_t operator()(const hydra::Vector3i& s) const
|
||||
{
|
||||
size_t h1 = hash<int>()(s.x);
|
||||
size_t h2 = hash<int>()(s.y);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include <functional> // 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<Vector4>::value, "kraken::Vector4 must be a POD type.");
|
||||
static_assert(std::is_pod<Vector4>::value, "hydra::Vector4 must be a POD type.");
|
||||
|
||||
} // namespace kraken
|
||||
} // namespace hydra
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<kraken::Vector4>
|
||||
struct hash<hydra::Vector4>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const kraken::Vector4& s) const
|
||||
size_t operator()(const hydra::Vector4& s) const
|
||||
{
|
||||
size_t h1 = hash<float>()(s.x);
|
||||
size_t h2 = hash<float>()(s.y);
|
||||
|
||||
Reference in New Issue
Block a user