mirror of https://github.com/AxioDL/zeus.git
Remove athena types
This commit is contained in:
parent
e53b380f42
commit
e9c0fe7a6e
|
@ -60,10 +60,5 @@ add_library(zeus
|
|||
include/zeus/simd/parallelism_v2_simd.hpp)
|
||||
|
||||
target_include_directories(zeus PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
|
||||
if(TARGET athena-core)
|
||||
target_link_libraries(zeus PUBLIC athena-core)
|
||||
target_compile_definitions(zeus PUBLIC ZE_ATHENA_TYPES=1)
|
||||
endif()
|
||||
|
||||
add_subdirectory(test)
|
||||
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
#include "zeus/CVector3f.hpp"
|
||||
#include "zeus/Math.hpp"
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
#include <athena/IStreamReader.hpp>
|
||||
#endif
|
||||
|
||||
namespace zeus {
|
||||
class CAABox {
|
||||
public:
|
||||
|
@ -40,21 +36,6 @@ public:
|
|||
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
|
||||
|
||||
void readBoundingBoxBig(athena::io::IStreamReader& in) {
|
||||
min.readBig(in);
|
||||
max.readBig(in);
|
||||
}
|
||||
|
||||
[[nodiscard]] static CAABox ReadBoundingBoxBig(athena::io::IStreamReader& in) {
|
||||
CAABox ret;
|
||||
ret.readBoundingBoxBig(in);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
[[nodiscard]] bool intersects(const CAABox& other) const {
|
||||
const auto mmax = max >= other.min;
|
||||
const auto mmin = min <= other.max;
|
||||
|
@ -183,13 +164,13 @@ public:
|
|||
}
|
||||
|
||||
[[nodiscard]] CVector3f closestPointAlongVector(const CVector3f& other) const {
|
||||
return {(other.x() >= 0.f ? min.x() : max.x()), (other.y() >= 0.f ? min.y() : max.y()),
|
||||
(other.z() >= 0.f ? min.z() : max.z())};
|
||||
return {(other.x() > 0.f ? min.x() : max.x()), (other.y() > 0.f ? min.y() : max.y()),
|
||||
(other.z() > 0.f ? min.z() : max.z())};
|
||||
}
|
||||
|
||||
[[nodiscard]] CVector3f furthestPointAlongVector(const CVector3f& other) const {
|
||||
return {(other.x() >= 0.f ? max.x() : min.x()), (other.y() >= 0.f ? max.y() : min.y()),
|
||||
(other.z() >= 0.f ? max.z() : min.z())};
|
||||
return {(other.x() > 0.f ? max.x() : min.x()), (other.y() > 0.f ? max.y() : min.y()),
|
||||
(other.z() > 0.f ? max.z() : min.z())};
|
||||
}
|
||||
|
||||
[[nodiscard]] float distanceBetween(const CAABox& other) const {
|
||||
|
|
|
@ -8,11 +8,6 @@
|
|||
#include "zeus/Global.hpp"
|
||||
#include "zeus/Math.hpp"
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
#include <athena/FileReader.hpp>
|
||||
#include <athena/FileWriter.hpp>
|
||||
#endif
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
|
@ -48,12 +43,6 @@ public:
|
|||
|
||||
constexpr CColor(float r, float g, float b, float a = 1.0f) : mSimd(r, g, b, a) {}
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
|
||||
constexpr CColor(const atVec4f& vec) : mSimd(vec.simd) {}
|
||||
|
||||
#endif
|
||||
|
||||
constexpr CColor(Comp32 rgba) : mSimd(((COLOR(rgba) >> 0) & 0xff) * OneOver255,
|
||||
((COLOR(rgba) >> 8) & 0xff) * OneOver255,
|
||||
((COLOR(rgba) >> 16) & 0xff) * OneOver255,
|
||||
|
|
|
@ -4,28 +4,9 @@
|
|||
#include "zeus/CTransform.hpp"
|
||||
#include "zeus/CVector3f.hpp"
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
#include <athena/IStreamReader.hpp>
|
||||
#endif
|
||||
|
||||
namespace zeus {
|
||||
class COBBox {
|
||||
public:
|
||||
#if ZE_ATHENA_TYPES
|
||||
|
||||
void readBig(athena::io::IStreamReader& in) {
|
||||
transform.read34RowMajor(in);
|
||||
extents.readBig(in);
|
||||
}
|
||||
|
||||
[[nodiscard]] static COBBox ReadBig(athena::io::IStreamReader& in) {
|
||||
COBBox out;
|
||||
out.readBig(in);
|
||||
return out;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
CTransform transform;
|
||||
CVector3f extents;
|
||||
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
#include "zeus/CVector4f.hpp"
|
||||
#include "zeus/Global.hpp"
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
#include <athena/IStreamReader.hpp>
|
||||
#endif
|
||||
|
||||
namespace zeus {
|
||||
|
||||
class CNUQuaternion;
|
||||
|
@ -32,25 +28,6 @@ public:
|
|||
template <typename T>
|
||||
constexpr CQuaternion(const simd<T>& s) : mSimd(s) {}
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
|
||||
void readBig(athena::io::IStreamReader& input) {
|
||||
simd_floats f;
|
||||
f[0] = input.readFloatBig();
|
||||
f[1] = input.readFloatBig();
|
||||
f[2] = input.readFloatBig();
|
||||
f[3] = input.readFloatBig();
|
||||
mSimd.copy_from(f);
|
||||
}
|
||||
|
||||
constexpr CQuaternion(const atVec4f& vec) : mSimd(vec.simd) {}
|
||||
|
||||
operator atVec4f&() { return *reinterpret_cast<atVec4f*>(this); }
|
||||
|
||||
operator const atVec4f&() const { return *reinterpret_cast<const atVec4f*>(this); }
|
||||
|
||||
#endif
|
||||
|
||||
CQuaternion(const CMatrix3f& mat);
|
||||
|
||||
CQuaternion(const CVector3f& vec) { fromVector3f(vec); }
|
||||
|
|
|
@ -17,22 +17,6 @@ public:
|
|||
constexpr CTransform(const CMatrix3f& basis, const CVector3f& offset = {})
|
||||
: basis(basis), origin(offset) {}
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
|
||||
CTransform(const atVec4f* mtx)
|
||||
: basis(mtx[0], mtx[1], mtx[2]), origin(mtx[0].simd[3], mtx[1].simd[3], mtx[2].simd[3]) {}
|
||||
|
||||
void read34RowMajor(athena::io::IStreamReader& r) {
|
||||
atVec4f r0 = r.readVec4fBig();
|
||||
atVec4f r1 = r.readVec4fBig();
|
||||
atVec4f r2 = r.readVec4fBig();
|
||||
basis = CMatrix3f(r0, r1, r2);
|
||||
basis.transpose();
|
||||
origin = CVector3f(r0.simd[3], r1.simd[3], r2.simd[3]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Column constructor */
|
||||
constexpr CTransform(const CVector3f& c0, const CVector3f& c1, const CVector3f& c2, const CVector3f& c3)
|
||||
: basis(c0, c1, c2), origin(c3) {}
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
#include "zeus/Global.hpp"
|
||||
#include "zeus/Math.hpp"
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
#include <athena/IStreamReader.hpp>
|
||||
#endif
|
||||
|
||||
namespace zeus {
|
||||
class CVector2d {
|
||||
public:
|
||||
|
@ -18,29 +14,6 @@ public:
|
|||
template <typename T>
|
||||
constexpr CVector2d(const simd<T>& s) : mSimd(s) {}
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
|
||||
constexpr CVector2d(const atVec2f& vec) : mSimd(vec.simd) {}
|
||||
|
||||
operator atVec2f&() { return *reinterpret_cast<atVec2f*>(this); }
|
||||
|
||||
operator const atVec2f&() const { return *reinterpret_cast<const atVec2f*>(this); }
|
||||
|
||||
void readBig(athena::io::IStreamReader& input) {
|
||||
mSimd[0] = input.readDoubleBig();
|
||||
mSimd[1] = input.readDoubleBig();
|
||||
mSimd[2] = 0.0;
|
||||
mSimd[3] = 0.0;
|
||||
}
|
||||
|
||||
[[nodiscard]] static CVector2d ReadBig(athena::io::IStreamReader& input) {
|
||||
CVector2d ret;
|
||||
ret.readBig(input);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
explicit constexpr CVector2d(double xy) : mSimd(xy) {}
|
||||
|
||||
constexpr void assign(double x, double y) {
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
#include "zeus/Global.hpp"
|
||||
#include "zeus/Math.hpp"
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
#include <athena/IStreamReader.hpp>
|
||||
#endif
|
||||
|
||||
namespace zeus {
|
||||
class CVector2f {
|
||||
public:
|
||||
|
@ -18,29 +14,6 @@ public:
|
|||
template <typename T>
|
||||
constexpr CVector2f(const simd<T>& s) : mSimd(s) {}
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
|
||||
constexpr CVector2f(const atVec2f& vec) : mSimd(vec.simd) {}
|
||||
|
||||
operator atVec2f&() { return *reinterpret_cast<atVec2f*>(this); }
|
||||
|
||||
operator const atVec2f&() const { return *reinterpret_cast<const atVec2f*>(this); }
|
||||
|
||||
void readBig(athena::io::IStreamReader& input) {
|
||||
mSimd[0] = input.readFloatBig();
|
||||
mSimd[1] = input.readFloatBig();
|
||||
mSimd[2] = 0.0f;
|
||||
mSimd[3] = 0.0f;
|
||||
}
|
||||
|
||||
[[nodiscard]] static CVector2f ReadBig(athena::io::IStreamReader& input) {
|
||||
CVector2f ret;
|
||||
ret.readBig(input);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
explicit constexpr CVector2f(float xy) : mSimd(xy) {}
|
||||
|
||||
constexpr void assign(float x, float y) {
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
#include "zeus/CVector3f.hpp"
|
||||
#include "zeus/Global.hpp"
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
#include <athena/Types.hpp>
|
||||
#endif
|
||||
|
||||
namespace zeus {
|
||||
|
||||
class CVector3d {
|
||||
|
@ -19,10 +15,6 @@ public:
|
|||
template <typename T>
|
||||
constexpr CVector3d(const simd<T>& s) : mSimd(s) {}
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
constexpr CVector3d(const atVec3d& vec) : mSimd(vec.simd) {}
|
||||
#endif
|
||||
|
||||
explicit constexpr CVector3d(double xyz) : mSimd(xyz) {}
|
||||
|
||||
CVector3d(const CVector3f& vec) : mSimd(vec.mSimd) {}
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
#include "zeus/Global.hpp"
|
||||
#include "zeus/Math.hpp"
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
#include <athena/IStreamReader.hpp>
|
||||
#endif
|
||||
|
||||
namespace zeus {
|
||||
class CVector3d;
|
||||
class CRelAngle;
|
||||
|
@ -24,31 +20,6 @@ public:
|
|||
template <typename T>
|
||||
constexpr CVector3f(const simd<T>& s) : mSimd(s) {}
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
|
||||
constexpr CVector3f(const atVec3f& vec) : mSimd(vec.simd) {}
|
||||
|
||||
operator atVec3f&() { return *reinterpret_cast<atVec3f*>(this); }
|
||||
|
||||
operator const atVec3f&() const { return *reinterpret_cast<const atVec3f*>(this); }
|
||||
|
||||
void readBig(athena::io::IStreamReader& input) {
|
||||
simd_floats f;
|
||||
f[0] = input.readFloatBig();
|
||||
f[1] = input.readFloatBig();
|
||||
f[2] = input.readFloatBig();
|
||||
f[3] = 0.0f;
|
||||
mSimd.copy_from(f);
|
||||
}
|
||||
|
||||
[[nodiscard]] static CVector3f ReadBig(athena::io::IStreamReader& input) {
|
||||
CVector3f ret;
|
||||
ret.readBig(input);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline CVector3f(const CVector3d& vec);
|
||||
|
||||
explicit constexpr CVector3f(float xyz) : mSimd(xyz) {}
|
||||
|
|
|
@ -23,25 +23,6 @@ public:
|
|||
template <typename T>
|
||||
constexpr CVector4d(const simd<T>& s) : mSimd(s) {}
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
|
||||
constexpr CVector4d(const atVec4f& vec) : mSimd(vec.simd) {}
|
||||
|
||||
operator atVec4f&() { return *reinterpret_cast<atVec4f*>(this); }
|
||||
|
||||
operator const atVec4f&() const { return *reinterpret_cast<const atVec4f*>(this); }
|
||||
|
||||
void readBig(athena::io::IStreamReader& input) {
|
||||
simd_doubles f;
|
||||
f[0] = input.readDoubleBig();
|
||||
f[1] = input.readDoubleBig();
|
||||
f[2] = input.readDoubleBig();
|
||||
f[3] = input.readDoubleBig();
|
||||
mSimd.copy_from(f);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
explicit constexpr CVector4d(double xyzw) : mSimd(xyzw) {}
|
||||
|
||||
void assign(double x, double y, double z, double w) { mSimd = simd<double>(x, y, z, w); }
|
||||
|
|
|
@ -23,25 +23,6 @@ public:
|
|||
template <typename T>
|
||||
constexpr CVector4f(const simd<T>& s) : mSimd(s) {}
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
|
||||
constexpr CVector4f(const atVec4f& vec) : mSimd(vec.simd) {}
|
||||
|
||||
operator atVec4f&() { return *reinterpret_cast<atVec4f*>(this); }
|
||||
|
||||
operator const atVec4f&() const { return *reinterpret_cast<const atVec4f*>(this); }
|
||||
|
||||
void readBig(athena::io::IStreamReader& input) {
|
||||
simd_floats f;
|
||||
f[0] = input.readFloatBig();
|
||||
f[1] = input.readFloatBig();
|
||||
f[2] = input.readFloatBig();
|
||||
f[3] = input.readFloatBig();
|
||||
mSimd.copy_from(f);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
explicit constexpr CVector4f(float xyzw) : mSimd(xyzw) {}
|
||||
|
||||
void assign(float x, float y, float z, float w) { mSimd = simd<float>(x, y, z, w); }
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#if ZE_ATHENA_TYPES
|
||||
#include "athena/IStreamReader.hpp"
|
||||
#include "athena/simd/simd.hpp"
|
||||
#else
|
||||
#include "simd/simd.hpp"
|
||||
#endif
|
||||
|
||||
namespace zeus {
|
||||
#if ZE_ATHENA_TYPES
|
||||
template <typename T>
|
||||
using simd = athena::simd<T>;
|
||||
using simd_floats = athena::simd_floats;
|
||||
using simd_doubles = athena::simd_doubles;
|
||||
#endif
|
||||
|
||||
template <typename SizeT>
|
||||
constexpr void hash_combine_impl(SizeT& seed, SizeT value) noexcept {
|
||||
seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
|
|
Loading…
Reference in New Issue