constexpr refactor

This commit is contained in:
Jack Andersen 2019-02-23 21:15:32 -10:00
parent 9b4434e6e0
commit b854e76dc9
39 changed files with 196 additions and 251 deletions

View File

@ -10,7 +10,6 @@ endif()
include_directories(include ${ATHENA_INCLUDE_DIR})
set(SOURCES
src/CAxisAngle.cpp
src/CVector3f.cpp
src/Math.cpp
src/CQuaternion.cpp
@ -21,7 +20,6 @@ set(SOURCES
src/CTransform.cpp
src/CColor.cpp
src/CVector2f.cpp
src/CVector4f.cpp
src/CMatrix4f.cpp
src/CAABox.cpp
src/COBBox.cpp

View File

@ -20,20 +20,17 @@ public:
enum class EBoxFaceID {};
static const CAABox skInvertedBox;
static const CAABox skNullBox;
CVector3f min;
CVector3f max;
// set default AABox to insane inverse min/max to allow for accumulation
CAABox() : CAABox(1e16f, -1e16f) {}
constexpr CAABox() : CAABox(1e16f, -1e16f) {}
CAABox(const CVector3f& min, const CVector3f& max) : min(min), max(max) {}
constexpr CAABox(const CVector3f& min, const CVector3f& max) : min(min), max(max) {}
CAABox(float min, float max) : min(CVector3f(min)), max(CVector3f(max)) {}
constexpr CAABox(float min, float max) : min(CVector3f(min)), max(CVector3f(max)) {}
CAABox(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
constexpr CAABox(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
: min(minX, minY, minZ), max(maxX, maxY, maxZ) {}
#if ZE_ATHENA_TYPES
@ -299,6 +296,8 @@ public:
return max[idx - 3];
}
};
constexpr CAABox skInvertedBox;
constexpr CAABox skNullBox(CVector3f{}, CVector3f{});
inline bool operator==(const CAABox& left, const CAABox& right) {
return (left.min == right.min && left.max == right.max);

View File

@ -6,12 +6,11 @@
namespace zeus {
struct CAxisAngle : CVector3f {
CAxisAngle() = default;
CAxisAngle(float x, float y, float z) : CVector3f(x, y, z) {}
constexpr CAxisAngle() = default;
constexpr CAxisAngle(float x, float y, float z) : CVector3f(x, y, z) {}
CAxisAngle(const CUnitVector3f& axis, float angle) : CVector3f(angle * axis) {}
CAxisAngle(const CVector3f& axisAngle) : CVector3f(axisAngle) {}
constexpr CAxisAngle(const CVector3f& axisAngle) : CVector3f(axisAngle) {}
float angle() const { return magnitude(); }
const CVector3f& getVector() const { return *this; }
static const CAxisAngle sIdentity;
};
} // namespace zeus

View File

@ -42,37 +42,33 @@ class CVector4f;
class CColor {
public:
simd<float> mSimd;
static const CColor skRed;
static const CColor skBlack;
static const CColor skBlue;
static const CColor skGreen;
static const CColor skGrey;
static const CColor skOrange;
static const CColor skPurple;
static const CColor skYellow;
static const CColor skWhite;
static const CColor skClear;
CColor() : mSimd(1.f) {}
constexpr CColor() : mSimd(1.f) {}
CColor(float rgb, float a = 1.0) { splat(rgb, a); }
constexpr CColor(float rgb, float a = 1.0) : mSimd(rgb, rgb, rgb, a) {}
CColor(float r, float g, float b, float a = 1.0f) : mSimd(r, g, b, a) {}
constexpr CColor(float r, float g, float b, float a = 1.0f) : mSimd(r, g, b, a) {}
#if ZE_ATHENA_TYPES
CColor(const atVec4f& vec) : mSimd(vec.simd) {}
constexpr CColor(const atVec4f& vec) : mSimd(vec.simd) {}
#endif
CColor(Comp32 rgba) { fromRGBA32(rgba); }
constexpr CColor(Comp32 rgba) : mSimd(((COLOR(rgba) >> 0) & 0xff) * OneOver255,
((COLOR(rgba) >> 8) & 0xff) * OneOver255,
((COLOR(rgba) >> 16) & 0xff) * OneOver255,
((COLOR(rgba) >> 24) & 0xff) * OneOver255) {}
CColor(const Comp8* rgba) { fromRGBA8(rgba[0], rgba[1], rgba[2], rgba[3]); }
constexpr CColor(const Comp8* rgba) : mSimd(rgba[0] * OneOver255,
rgba[1] * OneOver255,
rgba[2] * OneOver255,
rgba[3] * OneOver255) {}
CColor(const CVector4f& other) : mSimd(other.mSimd) {}
constexpr CColor(const CVector4f& other) : mSimd(other.mSimd) {}
template <typename T>
CColor(const simd<T>& s) : mSimd(s) {}
constexpr CColor(const simd<T>& s) : mSimd(s) {}
CColor& operator=(const CVector4f& other) {
mSimd = other.mSimd;
@ -237,7 +233,7 @@ public:
}
void fromRGBA32(Comp32 rgba) {
static RGBA32 tmp;
RGBA32 tmp;
tmp.rgba = COLOR(rgba);
fromRGBA8(tmp.r, tmp.g, tmp.b, tmp.a);
}
@ -300,12 +296,29 @@ public:
simd<float>::reference b() { return mSimd[2]; }
simd<float>::reference a() { return mSimd[3]; }
};
constexpr CVector4f::CVector4f(const zeus::CColor& other) : mSimd(other.mSimd) {}
static inline CColor operator+(float lhs, const CColor& rhs) { return simd<float>(lhs) + rhs.mSimd; }
constexpr CVector4f& CVector4f::operator=(const CColor& other) {
mSimd = other.mSimd;
return *this;
}
static inline CColor operator-(float lhs, const CColor& rhs) { return simd<float>(lhs) - rhs.mSimd; }
constexpr CColor skRed(1.f, 0.f, 0.f, 1.f);
constexpr CColor skBlack(0.f, 0.f, 0.f, 1.f);
constexpr CColor skBlue(0.f, 0.f, 1.f, 1.f);
constexpr CColor skGreen(0.f, 1.f, 0.f, 1.f);
constexpr CColor skGrey(0.5f, 0.5f, 0.5f, 1.f);
constexpr CColor skOrange(1.f, 0.43f, 0.f, 1.f);
constexpr CColor skPurple(0.63f, 0.f, 1.f, 1.f);
constexpr CColor skYellow(1.f, 1.f, 0.f, 1.f);
constexpr CColor skWhite(1.f, 1.f, 1.f, 1.f);
constexpr CColor skClear(0.f, 0.f, 0.f, 0.f);
static inline CColor operator*(float lhs, const CColor& rhs) { return simd<float>(lhs) * rhs.mSimd; }
inline CColor operator+(float lhs, const CColor& rhs) { return simd<float>(lhs) + rhs.mSimd; }
static inline CColor operator/(float lhs, const CColor& rhs) { return simd<float>(lhs) / rhs.mSimd; }
inline CColor operator-(float lhs, const CColor& rhs) { return simd<float>(lhs) - rhs.mSimd; }
inline CColor operator*(float lhs, const CColor& rhs) { return simd<float>(lhs) * rhs.mSimd; }
inline CColor operator/(float lhs, const CColor& rhs) { return simd<float>(lhs) / rhs.mSimd; }
} // namespace zeus

View File

@ -7,7 +7,7 @@ class CQuaternion;
class CEulerAngles : public CVector3f {
public:
CEulerAngles(float x, float y, float z) { assign(x, y, z); }
constexpr CEulerAngles(float x, float y, float z) : CVector3f(x, y, z) {}
CEulerAngles(const CQuaternion& quat);
CEulerAngles(const CTransform& xf);
};

View File

@ -6,7 +6,7 @@
namespace zeus {
class CLine {
public:
CLine(const CVector3f& origin, const CVector3f& dir) : origin(origin), dir(dir) {}
constexpr CLine(const CVector3f& origin, const CVector3f& dir) : origin(origin), dir(dir) {}
CVector3f origin;
CVector3f dir;

View File

@ -11,7 +11,7 @@ public:
if (tmp.x() != 0.f || tmp.y() != 0.f || tmp.z() != 0.f)
xc_dir = tmp.normalized();
else
xc_dir = CVector3f::skZero;
xc_dir = CVector3f();
}
CVector3f x0_start;

View File

@ -11,10 +11,7 @@ class CQuaternion;
class CMatrix3f {
public:
explicit CMatrix3f(bool zero = false) {
m[0] = simd<float>(0.f);
m[1] = simd<float>(0.f);
m[2] = simd<float>(0.f);
explicit constexpr CMatrix3f(bool zero = false) {
if (!zero) {
m[0][0] = 1.0;
m[1][1] = 1.0;
@ -22,33 +19,30 @@ public:
}
}
CMatrix3f(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
constexpr CMatrix3f(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
: m{{m00, m10, m20}, {m01, m11, m21}, {m02, m12, m22}} {}
CMatrix3f(const CVector3f& scaleVec) {
m[0] = simd<float>(0.f);
m[1] = simd<float>(0.f);
m[2] = simd<float>(0.f);
constexpr CMatrix3f(const CVector3f& scaleVec) {
m[0][0] = scaleVec[0];
m[1][1] = scaleVec[1];
m[2][2] = scaleVec[2];
}
CMatrix3f(float scale) : CMatrix3f(CVector3f(scale)) {}
constexpr CMatrix3f(float scale) : CMatrix3f(CVector3f(scale)) {}
CMatrix3f(const CVector3f& r0, const CVector3f& r1, const CVector3f& r2) {
constexpr CMatrix3f(const CVector3f& r0, const CVector3f& r1, const CVector3f& r2) {
m[0] = r0;
m[1] = r1;
m[2] = r2;
}
CMatrix3f(const CMatrix3f& other) {
constexpr CMatrix3f(const CMatrix3f& other) {
m[0] = other.m[0];
m[1] = other.m[1];
m[2] = other.m[2];
}
CMatrix3f(const simd<float>& r0, const simd<float>& r1, const simd<float>& r2) {
constexpr CMatrix3f(const simd<float>& r0, const simd<float>& r1, const simd<float>& r2) {
m[0].mSimd = r0;
m[1].mSimd = r1;
m[2].mSimd = r2;
@ -56,7 +50,7 @@ public:
#if ZE_ATHENA_TYPES
CMatrix3f(const atVec4f& r0, const atVec4f& r1, const atVec4f& r2) {
constexpr CMatrix3f(const atVec4f& r0, const atVec4f& r1, const atVec4f& r2) {
m[0].mSimd = r0.simd;
m[1].mSimd = r1.simd;
m[2].mSimd = r2.simd;
@ -82,8 +76,6 @@ public:
#endif
CMatrix3f(const CVector3f& axis, float angle);
CMatrix3f(const CQuaternion& quat);
CMatrix3f& operator=(const CMatrix3f& other) {
@ -121,8 +113,6 @@ public:
return m[0] == other.m[0] && m[1] == other.m[1] && m[2] == other.m[2];
}
static const CMatrix3f skIdentityMatrix3f;
void transpose();
CMatrix3f transposed() const;
@ -167,7 +157,7 @@ public:
CVector3f m[3];
};
static inline CMatrix3f operator*(const CMatrix3f& lhs, const CMatrix3f& rhs) {
inline CMatrix3f operator*(const CMatrix3f& lhs, const CMatrix3f& rhs) {
simd<float> v[3];
for (int i = 0; i < 3; ++i)
v[i] = lhs.m[0].mSimd * rhs[i].mSimd.shuffle<0, 0, 0, 0>() + lhs.m[1].mSimd * rhs[i].mSimd.shuffle<1, 1, 1, 1>() +

View File

@ -7,9 +7,7 @@
namespace zeus {
class CMatrix4f {
public:
static const CMatrix4f skIdentityMatrix4f;
explicit CMatrix4f(bool zero = false) {
explicit constexpr CMatrix4f(bool zero = false) {
if (!zero) {
m[0][0] = 1.0;
m[1][1] = 1.0;
@ -18,39 +16,39 @@ public:
}
}
CMatrix4f(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20,
constexpr CMatrix4f(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20,
float m21, float m22, float m23, float m30, float m31, float m32, float m33)
: m{{m00, m10, m20, m30}, {m01, m11, m21, m31}, {m02, m12, m22, m32}, {m03, m13, m23, m33}} {}
CMatrix4f(const CVector3f& scaleVec) {
constexpr CMatrix4f(const CVector3f& scaleVec) {
m[0][0] = scaleVec[0];
m[1][1] = scaleVec[1];
m[2][2] = scaleVec[2];
m[3][3] = 1.0f;
}
CMatrix4f(const CVector4f& r0, const CVector4f& r1, const CVector4f& r2, const CVector4f& r3) {
constexpr CMatrix4f(const CVector4f& r0, const CVector4f& r1, const CVector4f& r2, const CVector4f& r3) {
m[0] = r0;
m[1] = r1;
m[2] = r2;
m[3] = r3;
}
CMatrix4f(const CMatrix4f& other) {
constexpr CMatrix4f(const CMatrix4f& other) {
m[0] = other.m[0];
m[1] = other.m[1];
m[2] = other.m[2];
m[3] = other.m[3];
}
CMatrix4f(const simd<float>& r0, const simd<float>& r1, const simd<float>& r2, const simd<float>& r3) {
constexpr CMatrix4f(const simd<float>& r0, const simd<float>& r1, const simd<float>& r2, const simd<float>& r3) {
m[0].mSimd = r0;
m[1].mSimd = r1;
m[2].mSimd = r2;
m[3].mSimd = r3;
}
CMatrix4f(const CMatrix3f& other) {
constexpr CMatrix4f(const CMatrix3f& other) {
m[0] = other.m[0];
m[1] = other.m[1];
m[2] = other.m[2];
@ -95,8 +93,9 @@ public:
CVector4f m[4];
};
extern const CMatrix4f skIdentityMatrix4f;
static inline CMatrix4f operator*(const CMatrix4f& lhs, const CMatrix4f& rhs) {
inline CMatrix4f operator*(const CMatrix4f& lhs, const CMatrix4f& rhs) {
simd<float> v[4];
for (int i = 0; i < 4; ++i)
v[i] = lhs.m[0].mSimd * rhs[i].mSimd.shuffle<0, 0, 0, 0>() + lhs.m[1].mSimd * rhs[i].mSimd.shuffle<1, 1, 1, 1>() +

View File

@ -26,11 +26,11 @@ public:
CTransform transform;
CVector3f extents;
COBBox() = default;
constexpr COBBox() = default;
COBBox(const CAABox& aabb) : extents(aabb.extents()) { transform.origin = aabb.center(); }
COBBox(const CTransform& xf, const CVector3f& extents) : transform(xf), extents(extents) {}
constexpr COBBox(const CTransform& xf, const CVector3f& extents) : transform(xf), extents(extents) {}
CAABox calculateAABox(const CTransform& worldXf = CTransform()) const;
@ -42,6 +42,6 @@ public:
bool OBBIntersectsBox(const COBBox& other) const;
bool AABoxIntersectsBox(const CAABox& other) { return OBBIntersectsBox(FromAABox(other, CTransform::Identity())); }
bool AABoxIntersectsBox(const CAABox& other) { return OBBIntersectsBox(FromAABox(other, CTransform())); }
};
} // namespace zeus

View File

@ -7,9 +7,9 @@
namespace zeus {
class CPlane {
public:
CPlane() : mSimd(1.0, 0.f, 0.f, 0.f) {}
constexpr CPlane() : mSimd(1.f, 0.f, 0.f, 0.f) {}
CPlane(float a, float b, float c, float d) : mSimd(a, b, c, d) {}
constexpr CPlane(float a, float b, float c, float d) : mSimd(a, b, c, d) {}
CPlane(const CVector3f& a, const CVector3f& b, const CVector3f& c) {
mSimd = (b - a).cross(c - a).normalized().mSimd;

View File

@ -34,7 +34,7 @@ public:
CProjection() {
m_projType = EProjType::Orthographic;
m_ortho = SProjOrtho();
m_mtx = CMatrix4f::skIdentityMatrix4f;
m_mtx = CMatrix4f();
}
CProjection(const CProjection& other) { *this = other; }

View File

@ -31,16 +31,16 @@ class CNUQuaternion;
/** Unit quaternion, used for all quaternion arithmetic */
class CQuaternion {
public:
CQuaternion() : mSimd(1.f, 0.f, 0.f, 0.f) {}
constexpr CQuaternion() : mSimd(1.f, 0.f, 0.f, 0.f) {}
CQuaternion(float wi, float xi, float yi, float zi) : mSimd(wi, xi, yi, zi) {}
constexpr CQuaternion(float wi, float xi, float yi, float zi) : mSimd(wi, xi, yi, zi) {}
CQuaternion(float xi, float yi, float zi) { fromVector3f(CVector3f(xi, yi, zi)); }
CQuaternion(float wi, const CVector3f& vec) : mSimd(vec.mSimd.shuffle<0, 0, 1, 2>()) { mSimd[0] = wi; }
template <typename T>
CQuaternion(const simd<T>& s) : mSimd(s) {}
constexpr CQuaternion(const simd<T>& s) : mSimd(s) {}
#if ZE_ATHENA_TYPES
@ -53,7 +53,7 @@ public:
mSimd.copy_from(f);
}
CQuaternion(const atVec4f& vec) : mSimd(vec.simd) {}
constexpr CQuaternion(const atVec4f& vec) : mSimd(vec.simd) {}
operator atVec4f&() { return *reinterpret_cast<atVec4f*>(this); }
@ -65,7 +65,7 @@ public:
CQuaternion(const CVector3f& vec) { fromVector3f(vec); }
CQuaternion(const CVector4f& vec) : mSimd(vec.mSimd) {}
constexpr CQuaternion(const CVector4f& vec) : mSimd(vec.mSimd) {}
CQuaternion(const CVector3f& vecA, const CVector3f& vecB) {
CVector3f vecAN = vecA.normalized();
@ -216,8 +216,6 @@ public:
simd<float> mSimd;
static const CQuaternion skNoRotation;
static CQuaternion fromNUQuaternion(const CNUQuaternion& q);
};

View File

@ -5,9 +5,9 @@
namespace zeus {
class CRectangle {
public:
CRectangle() {}
constexpr CRectangle() = default;
CRectangle(float x, float y, float w, float h) : position(x, y), size(w, h) {}
constexpr CRectangle(float x, float y, float w, float h) : position(x, y), size(w, h) {}
bool contains(const CVector2f& point) const {
if (point.x() < position.x() || point.x() > position.x() + size.x())

View File

@ -19,9 +19,9 @@ public:
return ret;
}
CRelAngle() = default;
constexpr CRelAngle() = default;
CRelAngle(float angle) : angle(angle) {}
constexpr CRelAngle(float angle) : angle(angle) {}
CRelAngle& operator=(float ang) {
angle = ang;

View File

@ -5,7 +5,7 @@
namespace zeus {
class CSphere {
public:
CSphere(const CVector3f& position, float radius) : position(position), radius(radius) {}
constexpr CSphere(const CVector3f& position, float radius) : position(position), radius(radius) {}
CVector3f getSurfaceNormal(const CVector3f& coord) const { return (coord - position).normalized(); }

View File

@ -11,9 +11,10 @@
namespace zeus {
class CTransform {
public:
CTransform() : basis(false) {}
constexpr CTransform() : basis(false) {}
CTransform(const CMatrix3f& basis, const CVector3f& offset = CVector3f::skZero) : basis(basis), origin(offset) {}
constexpr CTransform(const CMatrix3f& basis, const CVector3f& offset = {})
: basis(basis), origin(offset) {}
#if ZE_ATHENA_TYPES
@ -32,13 +33,9 @@ public:
#endif
/* Column constructor */
CTransform(const CVector3f& c0, const CVector3f& c1, const CVector3f& c2, const CVector3f& c3)
constexpr CTransform(const CVector3f& c0, const CVector3f& c1, const CVector3f& c2, const CVector3f& c3)
: basis(c0, c1, c2), origin(c3) {}
static const CTransform skIdentityTransform;
static const CTransform& Identity() { return skIdentityTransform; }
bool operator==(const CTransform& other) const { return origin == other.origin && basis == other.basis; }
CTransform operator*(const CTransform& rhs) const {
@ -50,7 +47,7 @@ public:
return CTransform(inv, inv * -origin);
}
static CTransform Translate(const CVector3f& position) { return {CMatrix3f::skIdentityMatrix3f, position}; }
static CTransform Translate(const CVector3f& position) { return {CMatrix3f(), position}; }
static CTransform Translate(float x, float y, float z) { return Translate({x, y, z}); }
@ -224,17 +221,17 @@ public:
else
i = 1;
CVector3f v = CVector3f::skZero;
CVector3f v;
v[i] = 1.f;
CUnitVector3f newUVec(uVec.cross(v));
return {newUVec, uVec, uVec.cross(newUVec), CVector3f::skZero};
return {newUVec, uVec, uVec.cross(newUVec), CVector3f()};
}
CMatrix3f basis;
CVector3f origin;
};
static inline CTransform CTransformFromScaleVector(const CVector3f& scale) { return CTransform(CMatrix3f(scale)); }
constexpr CTransform CTransformFromScaleVector(const CVector3f& scale) { return CTransform(CMatrix3f(scale)); }
CTransform CTransformFromEditorEuler(const CVector3f& eulerVec);
@ -242,5 +239,5 @@ CTransform CTransformFromEditorEulers(const CVector3f& eulerVec, const CVector3f
CTransform CTransformFromAxisAngle(const CVector3f& axis, float angle);
CTransform lookAt(const CVector3f& pos, const CVector3f& lookPos, const CVector3f& up = CVector3f::skUp);
CTransform lookAt(const CVector3f& pos, const CVector3f& lookPos, const CVector3f& up = skUp);
} // namespace zeus

View File

@ -5,14 +5,14 @@
namespace zeus {
class CUnitVector3f : public CVector3f {
public:
CUnitVector3f() : CVector3f(0.f, 1.f, 0.f) {}
constexpr CUnitVector3f() : CVector3f(0.f, 1.f, 0.f) {}
CUnitVector3f(float x, float y, float z, bool doNormalize = true) : CVector3f(x, y, z) {
constexpr CUnitVector3f(float x, float y, float z, bool doNormalize = true) : CVector3f(x, y, z) {
if (doNormalize && canBeNormalized())
normalize();
}
CUnitVector3f(const CVector3f& vec, bool doNormalize = true) : CVector3f(vec) {
constexpr CUnitVector3f(const CVector3f& vec, bool doNormalize = true) : CVector3f(vec) {
if (doNormalize && canBeNormalized())
normalize();
}

View File

@ -9,14 +9,14 @@ namespace zeus {
class CVector2f {
public:
simd<float> mSimd;
CVector2f() : mSimd(0.f) {}
constexpr CVector2f() : mSimd(0.f) {}
template <typename T>
CVector2f(const simd<T>& s) : mSimd(s) {}
constexpr CVector2f(const simd<T>& s) : mSimd(s) {}
#if ZE_ATHENA_TYPES
CVector2f(const atVec2f& vec) : mSimd(vec.simd) {}
constexpr CVector2f(const atVec2f& vec) : mSimd(vec.simd) {}
operator atVec2f&() { return *reinterpret_cast<atVec2f*>(this); }
@ -37,7 +37,7 @@ public:
#endif
explicit CVector2f(float xy) { splat(xy); }
explicit constexpr CVector2f(float xy) : mSimd(xy) {}
void assign(float x, float y) {
mSimd[0] = x;
@ -46,7 +46,7 @@ public:
mSimd[3] = 0.0f;
}
CVector2f(float x, float y) { assign(x, y); }
constexpr CVector2f(float x, float y) : mSimd(x, y, 0.f, 0.f) {}
bool operator==(const CVector2f& rhs) const { return mSimd[0] == rhs.mSimd[0] && mSimd[1] == rhs.mSimd[1]; }
@ -144,7 +144,7 @@ public:
float magnitude() const { return std::sqrt(magSquared()); }
void zeroOut() { *this = CVector2f::skZero; }
void zeroOut() { mSimd = zeus::simd<float>(0.f); }
void splat(float xy) { mSimd = zeus::simd<float>(xy); }
@ -188,17 +188,16 @@ public:
simd<float>::reference x() { return mSimd[0]; }
simd<float>::reference y() { return mSimd[1]; }
static const CVector2f skOne;
static const CVector2f skNegOne;
static const CVector2f skZero;
};
constexpr CVector2f skOne2f(1.f);
constexpr CVector2f skNegOne2f(-1.f);
constexpr CVector2f skZero2f(0.f);
static inline CVector2f operator+(float lhs, const CVector2f& rhs) { return zeus::simd<float>(lhs) + rhs.mSimd; }
inline CVector2f operator+(float lhs, const CVector2f& rhs) { return zeus::simd<float>(lhs) + rhs.mSimd; }
static inline CVector2f operator-(float lhs, const CVector2f& rhs) { return zeus::simd<float>(lhs) - rhs.mSimd; }
inline CVector2f operator-(float lhs, const CVector2f& rhs) { return zeus::simd<float>(lhs) - rhs.mSimd; }
static inline CVector2f operator*(float lhs, const CVector2f& rhs) { return zeus::simd<float>(lhs) * rhs.mSimd; }
inline CVector2f operator*(float lhs, const CVector2f& rhs) { return zeus::simd<float>(lhs) * rhs.mSimd; }
static inline CVector2f operator/(float lhs, const CVector2f& rhs) { return zeus::simd<float>(lhs) / rhs.mSimd; }
inline CVector2f operator/(float lhs, const CVector2f& rhs) { return zeus::simd<float>(lhs) / rhs.mSimd; }
} // namespace zeus

View File

@ -21,9 +21,9 @@ public:
int v[2];
};
CVector2i() = default;
constexpr CVector2i() : x(0), y(0) {}
CVector2i(int xin, int yin) : x(xin), y(yin) {}
constexpr CVector2i(int xin, int yin) : x(xin), y(yin) {}
CVector2i(const CVector2f& vec) : x(int(vec.x())), y(int(vec.y())) {}

View File

@ -10,20 +10,20 @@ namespace zeus {
class CVector3d {
public:
zeus::simd<double> mSimd;
CVector3d() : mSimd(0.0) {}
constexpr CVector3d() : mSimd(0.0) {}
template <typename T>
CVector3d(const simd<T>& s) : mSimd(s) {}
constexpr CVector3d(const simd<T>& s) : mSimd(s) {}
#if ZE_ATHENA_TYPES
CVector3d(const atVec3d& vec) : mSimd(vec.simd) {}
constexpr CVector3d(const atVec3d& vec) : mSimd(vec.simd) {}
#endif
explicit CVector3d(double xyz) : mSimd(xyz) {}
explicit constexpr CVector3d(double xyz) : mSimd(xyz) {}
CVector3d(const CVector3f& vec) : mSimd(vec.mSimd) {}
CVector3d(double x, double y, double z) : mSimd(x, y, z) {}
constexpr CVector3d(double x, double y, double z) : mSimd(x, y, z) {}
CVector3f asCVector3f() { return mSimd; }
@ -45,7 +45,7 @@ public:
void splat(double xyz) { mSimd = zeus::simd<double>(xyz); }
void zeroOut() { *this = skZero; }
void zeroOut() { mSimd = zeus::simd<double>(0.0); }
CVector3d operator+(const CVector3d& rhs) const { return mSimd + rhs.mSimd; }
@ -72,16 +72,17 @@ public:
simd<double>::reference x() { return mSimd[0]; }
simd<double>::reference y() { return mSimd[1]; }
simd<double>::reference z() { return mSimd[2]; }
static const CVector3d skZero;
};
inline CVector3f::CVector3f(const CVector3d& vec) : mSimd(vec.mSimd) {}
static inline CVector3d operator+(double lhs, const CVector3d& rhs) { return zeus::simd<double>(lhs) + rhs.mSimd; }
constexpr CVector3d skZero3d(0.0);
static inline CVector3d operator-(double lhs, const CVector3d& rhs) { return zeus::simd<double>(lhs) - rhs.mSimd; }
inline CVector3d operator+(double lhs, const CVector3d& rhs) { return zeus::simd<double>(lhs) + rhs.mSimd; }
static inline CVector3d operator*(double lhs, const CVector3d& rhs) { return zeus::simd<double>(lhs) * rhs.mSimd; }
inline CVector3d operator-(double lhs, const CVector3d& rhs) { return zeus::simd<double>(lhs) - rhs.mSimd; }
static inline CVector3d operator/(double lhs, const CVector3d& rhs) { return zeus::simd<double>(lhs) / rhs.mSimd; }
inline CVector3d operator*(double lhs, const CVector3d& rhs) { return zeus::simd<double>(lhs) * rhs.mSimd; }
inline CVector3d operator/(double lhs, const CVector3d& rhs) { return zeus::simd<double>(lhs) / rhs.mSimd; }
} // namespace zeus

View File

@ -15,14 +15,14 @@ class CRelAngle;
class CVector3f {
public:
zeus::simd<float> mSimd;
CVector3f() : mSimd(0.f) {}
constexpr CVector3f() : mSimd(0.f) {}
template <typename T>
CVector3f(const simd<T>& s) : mSimd(s) {}
constexpr CVector3f(const simd<T>& s) : mSimd(s) {}
#if ZE_ATHENA_TYPES
CVector3f(const atVec3f& vec) : mSimd(vec.simd) {}
constexpr CVector3f(const atVec3f& vec) : mSimd(vec.simd) {}
operator atVec3f&() { return *reinterpret_cast<atVec3f*>(this); }
@ -45,20 +45,20 @@ public:
#endif
CVector3f(const CVector3d& vec);
inline CVector3f(const CVector3d& vec);
explicit CVector3f(float xyz) : mSimd(xyz) {}
explicit constexpr CVector3f(float xyz) : mSimd(xyz) {}
void assign(float x, float y, float z) { mSimd = zeus::simd<float>(x, y, z); }
CVector3f(float x, float y, float z) : mSimd(x, y, z) {}
constexpr CVector3f(float x, float y, float z) : mSimd(x, y, z) {}
CVector3f(const float* floats) : mSimd(floats[0], floats[1], floats[2]) {}
constexpr CVector3f(const float* floats) : mSimd(floats[0], floats[1], floats[2]) {}
CVector3f(const CVector2f& other, float z = 0.f) {
mSimd = other.mSimd;
mSimd[2] = z;
mSimd[3] = 0.0f;
mSimd[3] = 0.f;
}
CVector2f toVec2f() const { return CVector2f(mSimd); }
@ -134,7 +134,7 @@ public:
bool isMagnitudeSafe() const { return isNotInf() && magSquared() >= 9.9999994e-29; }
void zeroOut() { *this = CVector3f::skZero; }
void zeroOut() { mSimd = zeus::simd<float>(0.f); }
void splat(float xyz) { mSimd = zeus::simd<float>(xyz); }
@ -199,29 +199,32 @@ public:
simd<float>::reference y() { return mSimd[1]; }
simd<float>::reference z() { return mSimd[2]; }
static const CVector3f skOne;
static const CVector3f skNegOne;
static const CVector3f skZero;
static const CVector3f skForward;
static const CVector3f skBack;
static const CVector3f skLeft;
static const CVector3f skRight;
static const CVector3f skUp;
static const CVector3f skDown;
static const CVector3f skRadToDegVec;
static const CVector3f skDegToRadVec;
static inline CVector3f radToDeg(const CVector3f& rad);
static CVector3f radToDeg(const CVector3f& rad) { return rad * skRadToDegVec; }
static CVector3f degToRad(const CVector3f& deg) { return deg * skDegToRadVec; }
static inline CVector3f degToRad(const CVector3f& deg);
};
constexpr CVector3f skOne3f(1.f);
constexpr CVector3f skNegOne3f(-1.f);
constexpr CVector3f skZero3f(0.f);
constexpr CVector3f skForward(0.f, 1.f, 0.f);
constexpr CVector3f skBack(0.f, -1.f, 0.f);
constexpr CVector3f skLeft(-1.f, 0.f, 0.f);
constexpr CVector3f skRight(1.f, 0.f, 0.f);
constexpr CVector3f skUp(0.f, 0.f, 1.f);
constexpr CVector3f skDown(0.f, 0.f, -1.f);
constexpr CVector3f skRadToDegVec(180.f / M_PIF);
constexpr CVector3f skDegToRadVec(M_PIF / 180.f);
static inline CVector3f operator+(float lhs, const CVector3f& rhs) { return zeus::simd<float>(lhs) + rhs.mSimd; }
inline CVector3f operator+(float lhs, const CVector3f& rhs) { return zeus::simd<float>(lhs) + rhs.mSimd; }
static inline CVector3f operator-(float lhs, const CVector3f& rhs) { return zeus::simd<float>(lhs) - rhs.mSimd; }
inline CVector3f operator-(float lhs, const CVector3f& rhs) { return zeus::simd<float>(lhs) - rhs.mSimd; }
static inline CVector3f operator*(float lhs, const CVector3f& rhs) { return zeus::simd<float>(lhs) * rhs.mSimd; }
inline CVector3f operator*(float lhs, const CVector3f& rhs) { return zeus::simd<float>(lhs) * rhs.mSimd; }
static inline CVector3f operator/(float lhs, const CVector3f& rhs) { return zeus::simd<float>(lhs) / rhs.mSimd; }
inline CVector3f operator/(float lhs, const CVector3f& rhs) { return zeus::simd<float>(lhs) / rhs.mSimd; }
inline CVector3f CVector3f::radToDeg(const CVector3f& rad) { return rad * skRadToDegVec; }
inline CVector3f CVector3f::degToRad(const CVector3f& deg) { return deg * skDegToRadVec; }
} // namespace zeus

View File

@ -20,14 +20,14 @@ class CVector4f {
public:
zeus::simd<float> mSimd;
CVector4f() : mSimd(0.f) {}
constexpr CVector4f() : mSimd(0.f) {}
template <typename T>
CVector4f(const simd<T>& s) : mSimd(s) {}
constexpr CVector4f(const simd<T>& s) : mSimd(s) {}
#if ZE_ATHENA_TYPES
CVector4f(const atVec4f& vec) : mSimd(vec.simd) {}
constexpr CVector4f(const atVec4f& vec) : mSimd(vec.simd) {}
operator atVec4f&() { return *reinterpret_cast<atVec4f*>(this); }
@ -44,21 +44,21 @@ public:
#endif
explicit CVector4f(float xyzw) : mSimd(xyzw) {}
explicit constexpr CVector4f(float xyzw) : mSimd(xyzw) {}
void assign(float x, float y, float z, float w) { mSimd = simd<float>(x, y, z, w); }
CVector4f(float x, float y, float z, float w) : mSimd(x, y, z, w) {}
constexpr CVector4f(float x, float y, float z, float w) : mSimd(x, y, z, w) {}
CVector4f(const CColor& other);
constexpr CVector4f(const CColor& other);
CVector4f(const CVector3f& other, float wIn = 1.f) : mSimd(other.mSimd) { mSimd[3] = wIn; }
constexpr CVector4f(const CVector3f& other, float wIn = 1.f) : mSimd(other.mSimd) { mSimd[3] = wIn; }
static CVector4f ToClip(const zeus::CVector3f& v, float w) { return CVector4f(v * w, w); }
CVector3f toVec3f() const { return CVector3f(mSimd); }
CVector4f& operator=(const CColor& other);
constexpr CVector4f& operator=(const CColor& other);
bool operator==(const CVector4f& rhs) const {
auto eq_mask = mSimd == rhs.mSimd;
@ -149,7 +149,7 @@ public:
float magnitude() const { return std::sqrt(magSquared()); }
void zeroOut() { *this = CVector4f::skZero; }
void zeroOut() { mSimd = zeus::simd<float>(0.f); }
void splat(float xyzw) { mSimd = zeus::simd<float>(xyzw); }
@ -192,18 +192,17 @@ public:
simd<float>::reference y() { return mSimd[1]; }
simd<float>::reference z() { return mSimd[2]; }
simd<float>::reference w() { return mSimd[3]; }
static const CVector4f skOne;
static const CVector4f skNegOne;
static const CVector4f skZero;
};
constexpr CVector4f skOne4f(1.f);
constexpr CVector4f skNegOne4f(-1.f);
constexpr CVector4f skZero4f(0.f);
static CVector4f operator+(float lhs, const CVector4f& rhs) { return zeus::simd<float>(lhs) + rhs.mSimd; }
inline CVector4f operator+(float lhs, const CVector4f& rhs) { return zeus::simd<float>(lhs) + rhs.mSimd; }
static CVector4f operator-(float lhs, const CVector4f& rhs) { return zeus::simd<float>(lhs) - rhs.mSimd; }
inline CVector4f operator-(float lhs, const CVector4f& rhs) { return zeus::simd<float>(lhs) - rhs.mSimd; }
static CVector4f operator*(float lhs, const CVector4f& rhs) { return zeus::simd<float>(lhs) * rhs.mSimd; }
inline CVector4f operator*(float lhs, const CVector4f& rhs) { return zeus::simd<float>(lhs) * rhs.mSimd; }
static CVector4f operator/(float lhs, const CVector4f& rhs) { return zeus::simd<float>(lhs) / rhs.mSimd; }
inline CVector4f operator/(float lhs, const CVector4f& rhs) { return zeus::simd<float>(lhs) / rhs.mSimd; }
} // namespace zeus

View File

@ -16,5 +16,5 @@ using simd_doubles = athena::simd_doubles;
#endif
} // namespace zeus
inline int rotr(int x, int n) { return ((x >> n) | (x << (32 - n))); }
inline int rotl(int x, int n) { return ((x << n) | (x >> (32 - n))); }
constexpr int rotr(int x, int n) { return ((x >> n) | (x << (32 - n))); }
constexpr int rotl(int x, int n) { return ((x << n) | (x >> (32 - n))); }

View File

@ -81,12 +81,12 @@ class CVector2f;
class CTransform;
template <typename T>
inline constexpr T min(const T& a, const T& b) {
constexpr T min(const T& a, const T& b) {
return a < b ? a : b;
}
template <typename T>
inline constexpr T max(const T& a, const T& b) {
constexpr T max(const T& a, const T& b) {
return a > b ? a : b;
}
@ -97,17 +97,17 @@ template <>
CVector3f max(const CVector3f& a, const CVector3f& b);
template <typename T>
inline constexpr T clamp(const T& a, const T& val, const T& b) {
constexpr T clamp(const T& a, const T& val, const T& b) {
return max<T>(a, min<T>(b, val));
}
inline constexpr float radToDeg(float rad) { return rad * (180.f / M_PIF); }
inline constexpr float degToRad(float deg) { return deg * (M_PIF / 180.f); }
constexpr float degToRad(float deg) { return deg * (M_PIF / 180.f); }
inline constexpr double radToDeg(double rad) { return rad * (180.0 / M_PI); }
constexpr double radToDeg(double rad) { return rad * (180.0 / M_PI); }
inline constexpr double degToRad(double deg) { return deg * (M_PI / 180.0); }
constexpr double degToRad(double deg) { return deg * (M_PI / 180.0); }
CVector3f baryToWorld(const CVector3f& p0, const CVector3f& p1, const CVector3f& p2, const CVector3f& bary);

View File

@ -1274,9 +1274,10 @@ public:
__s_.__broadcast(v);
}
#endif
simd(_Tp __rv) { __s_.__broadcast(__rv); }
simd(_Tp a, _Tp b, _Tp c = {}, _Tp d = {}) { __s_.__set4(a, b, c, d); }
constexpr simd(_Tp __rv) : __s_(__rv) {}
constexpr simd(_Tp a, _Tp b, _Tp c = {}, _Tp d = {}) : __s_(a, b, c, d) {}
// generator constructor
template <class _Generator,

View File

@ -22,7 +22,9 @@ public:
sse_data[__index] = __val;
__storage_ = _mm256_load_pd(sse_data.data());
}
constexpr __simd_storage(double a, double b, double c, double d) : __storage_{a, b, c, d} {}
void __set4(double a, double b, double c, double d) noexcept { __storage_ = _mm256_set_pd(d, c, b, a); }
constexpr __simd_storage(double rv) : __storage_{rv, rv, rv, rv} {}
void __broadcast(double __val) noexcept { __storage_ = _mm256_set1_pd(__val); }
double __dot2(const __simd_storage<double, m256d_abi>& other) const noexcept {
alignas(32) std::array<double, 4> sse_data;

View File

@ -41,7 +41,9 @@ public:
sse_data[__index] = __val;
__storage_ = _mm_load_ps(sse_data.data());
}
constexpr __simd_storage(float a, float b, float c, float d) : __storage_{a, b, c, d} {}
void __set4(float a, float b, float c, float d) noexcept { __storage_ = _mm_set_ps(d, c, b, a); }
constexpr __simd_storage(float rv) : __storage_{rv, rv, rv, rv} {}
void __broadcast(float __val) noexcept { __storage_ = _mm_set1_ps(__val); }
float __dot2(const __simd_storage<float, m128_abi>& other) const noexcept {
#if __SSE4_1__
@ -219,10 +221,12 @@ public:
sse_data[__index % 2] = __val;
__storage_[__index / 2] = _mm_load_pd(sse_data.data());
}
constexpr __simd_storage(double a, double b, double c, double d) : __storage_{__m128d{a, b}, __m128d{c, d}} {}
void __set4(double a, double b, double c, double d) noexcept {
__storage_[0] = _mm_set_pd(b, a);
__storage_[1] = _mm_set_pd(d, c);
}
constexpr __simd_storage(double rv) : __storage_{__m128d{rv, rv}, __m128d{rv, rv}} {}
void __broadcast(double __val) noexcept {
for (int i = 0; i < 2; ++i)
__storage_[i] = _mm_set1_pd(__val);

View File

@ -2,9 +2,6 @@
#include "zeus/CVector3f.hpp"
namespace zeus {
const CAABox CAABox::skInvertedBox = CAABox();
const CAABox CAABox::skNullBox = CAABox(CVector3f::skZero, CVector3f::skZero);
static const int ProjWindings[6][4] = {
{2, 0, 4, 6}, // -X
{0, 1, 5, 4}, // -Y
@ -91,8 +88,8 @@ float CAABox::intersectionRadius(const CSphere& other) const {
}
CAABox CAABox::booleanIntersection(const CAABox& other) const {
CVector3f minVec = CVector3f::skZero;
CVector3f maxVec = CVector3f::skZero;
CVector3f minVec;
CVector3f maxVec;
for (int i = 0; i < 3; ++i) {
if (min[i] <= other.min[i] && max[i] >= other.max[i]) {

View File

@ -1,5 +0,0 @@
#include "zeus/CAxisAngle.hpp"
namespace zeus {
const CAxisAngle CAxisAngle::sIdentity = {};
}

View File

@ -2,17 +2,6 @@
#include "zeus/CVector4f.hpp"
namespace zeus {
const CColor CColor::skRed(Comp32(0xFF0000FFul));
const CColor CColor::skBlack(Comp32(0x000000FFul));
const CColor CColor::skBlue(Comp32(0x0000FFFFul));
const CColor CColor::skGreen(Comp32(0x00FF00FFul));
const CColor CColor::skGrey(Comp32(0x808080FFul));
const CColor CColor::skOrange(Comp32(0xFF7000FFul));
const CColor CColor::skPurple(Comp32(0xA000FFFFul));
const CColor CColor::skYellow(Comp32(0xFFFF00FFul));
const CColor CColor::skWhite(Comp32(0xFFFFFFFFul));
const CColor CColor::skClear(Comp32(0x00000000ul));
float hueToRgb(float p, float q, float t) {
if (t < 0.0f)
t += 1.0f;

View File

@ -3,7 +3,6 @@
#include "zeus/Global.hpp"
namespace zeus {
const CMatrix3f CMatrix3f::skIdentityMatrix3f = CMatrix3f();
CMatrix3f::CMatrix3f(const CQuaternion& quat) {
CQuaternion nq = quat.normalized();

View File

@ -1,8 +1,7 @@
#include "zeus/CMatrix4f.hpp"
namespace zeus {
const CMatrix4f CMatrix4f::skIdentityMatrix4f = CMatrix4f();
const CMatrix4f skIdentityMatrix4f;
CMatrix4f CMatrix4f::transposed() const {
CMatrix4f ret;

View File

@ -3,7 +3,7 @@
namespace zeus {
CAABox COBBox::calculateAABox(const CTransform& worldXf) const {
CAABox ret = CAABox::skInvertedBox;
CAABox ret;
CTransform trans = worldXf * transform;
static const CVector3f basis[8] = {{1.f, 1.f, 1.f}, {1.f, 1.f, -1.f}, {1.f, -1.f, 1.f}, {1.f, -1.f, -1.f},

View File

@ -2,8 +2,6 @@
#include "zeus/Math.hpp"
namespace zeus {
const CQuaternion CQuaternion::skNoRotation;
CQuaternion::CQuaternion(const CMatrix3f& mat) {
float trace = mat[0][0] + mat[1][1] + mat[2][2];
if (trace >= 0.f) {
@ -234,10 +232,10 @@ CQuaternion CQuaternion::shortestRotationArc(const zeus::CVector3f& v0, const ze
if (cross.magSquared() < 0.001f) {
if (v0N.dot(v1N) > 0.f)
return CQuaternion::skNoRotation;
return CQuaternion();
if (cross.canBeNormalized())
return CQuaternion(0.0f, cross.normalized());
return CQuaternion::skNoRotation;
return CQuaternion();
} else {
float w = std::sqrt((1.f + zeus::clamp(-1.f, v0N.dot(v1N), 1.f)) * 2.f);
return CQuaternion(0.5f * w, cross * (1.f / w));
@ -278,7 +276,7 @@ CRelAngle CQuaternion::angleFrom(const zeus::CQuaternion& other) {
}
CQuaternion CQuaternion::lookAt(const CUnitVector3f& source, const CUnitVector3f& dest, const CRelAngle& maxAng) {
CQuaternion q = skNoRotation;
CQuaternion q;
zeus::CVector3f destNoZ = dest;
zeus::CVector3f sourceNoZ = source;
destNoZ.z() = 0.f;
@ -300,11 +298,11 @@ CQuaternion CQuaternion::lookAt(const CUnitVector3f& source, const CUnitVector3f
else if (destNoZ.magSquared() > 0.0001f)
tmp = destNoZ.normalized();
else
return skNoRotation;
return CQuaternion();
float realAngle = zeus::clamp(-maxAng.asRadians(), normalize_angle(std::acos(dest.z()) - std::acos(source.z())),
maxAng.asRadians());
return CQuaternion::fromAxisAngle(tmp.cross(CVector3f::skUp), -realAngle) * q;
return CQuaternion::fromAxisAngle(tmp.cross(skUp), -realAngle) * q;
}
} // namespace zeus

View File

@ -1,8 +1,6 @@
#include "zeus/CTransform.hpp"
namespace zeus {
const CTransform CTransform::skIdentityTransform;
CTransform CTransformFromEditorEuler(const CVector3f& eulerVec) {
CTransform result;
double ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss;

View File

@ -5,10 +5,6 @@
#include "zeus/Math.hpp"
namespace zeus {
const CVector2f CVector2f::skOne = CVector2f(1.0);
const CVector2f CVector2f::skNegOne = CVector2f(-1.0);
const CVector2f CVector2f::skZero(0.f, 0.f);
float CVector2f::getAngleDiff(const CVector2f& a, const CVector2f& b) {
float mag1 = a.magnitude();
float mag2 = b.magnitude();

View File

@ -7,21 +7,6 @@
#include "zeus/CRelAngle.hpp"
namespace zeus {
const CVector3f CVector3f::skOne(1.f);
const CVector3f CVector3f::skNegOne(-1.f);
const CVector3f CVector3f::skZero;
const CVector3f CVector3f::skForward(0.f, 1.f, 0.f);
const CVector3f CVector3f::skBack(0.f, -1.f, 0.f);
const CVector3f CVector3f::skLeft(-1.f, 0.f, 0.f);
const CVector3f CVector3f::skRight(1.f, 0.f, 0.f);
const CVector3f CVector3f::skUp(0.f, 0.f, 1.f);
const CVector3f CVector3f::skDown(0.f, 0.f, -1.f);
const CVector3f CVector3f::skRadToDegVec(180.0f / M_PIF);
const CVector3f CVector3f::skDegToRadVec(M_PIF / 180.0f);
const CVector3d CVector3d::skZero(0.0, 0.0, 0.0);
CVector3f::CVector3f(const CVector3d& vec) : mSimd(vec.mSimd) {}
float CVector3f::getAngleDiff(const CVector3f& a, const CVector3f& b) {
float mag1 = a.magnitude();
float mag2 = b.magnitude();

View File

@ -1,13 +0,0 @@
#include "zeus/CVector4f.hpp"
#include "zeus/CColor.hpp"
namespace zeus {
const CVector4f CVector4f::skZero(0.f, 0.f, 0.f, 0.f);
CVector4f::CVector4f(const zeus::CColor& other) : mSimd(other.mSimd) {}
CVector4f& CVector4f::operator=(const CColor& other) {
mSimd = other.mSimd;
return *this;
}
} // namespace zeus