mirror of
https://github.com/AxioDL/zeus.git
synced 2025-12-08 13:15:14 +00:00
Compare commits
4 Commits
bb9b4c83af
...
hsh
| Author | SHA1 | Date | |
|---|---|---|---|
| 801b024811 | |||
| 6d47b07859 | |||
| 542e3e4279 | |||
|
|
e64b7c4d17 |
@@ -63,5 +63,10 @@ if(TARGET athena-core)
|
||||
target_compile_definitions(zeus PUBLIC ZE_ATHENA_TYPES=1)
|
||||
endif()
|
||||
|
||||
if(TARGET hsh)
|
||||
target_link_libraries(zeus PUBLIC hsh)
|
||||
target_compile_definitions(zeus PUBLIC ZE_HSH_TYPES=1)
|
||||
endif()
|
||||
|
||||
add_subdirectory(test)
|
||||
|
||||
|
||||
@@ -124,6 +124,15 @@ public:
|
||||
writer.writeUByte(atUint8(f[3] * 255));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if ZE_HSH_TYPES
|
||||
|
||||
operator hsh::float4() const {
|
||||
simd_floats floats(mSimd);
|
||||
return hsh::float4{floats[0], floats[1], floats[2], floats[3]};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
[[nodiscard]] bool operator==(const CColor& rhs) const {
|
||||
|
||||
@@ -67,6 +67,16 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if ZE_HSH_TYPES
|
||||
|
||||
operator hsh::float3x3() const {
|
||||
return hsh::float3x3{hsh::float3(m[0]), hsh::float3(m[1]), hsh::float3(m[2])};
|
||||
}
|
||||
|
||||
constexpr CMatrix3f(const hsh::float3x3& vec) : m{vec.cols[0], vec.cols[1], vec.cols[2]} {}
|
||||
|
||||
#endif
|
||||
|
||||
CMatrix3f(const CQuaternion& quat);
|
||||
|
||||
@@ -49,6 +49,16 @@ public:
|
||||
m[3].mSimd = CVector4f(0.f, 0.f, 0.f, 1.0f).mSimd;
|
||||
}
|
||||
|
||||
#if ZE_HSH_TYPES
|
||||
|
||||
operator hsh::float4x4() const {
|
||||
return hsh::float4x4{hsh::float4(m[0]), hsh::float4(m[1]), hsh::float4(m[2]), hsh::float4(m[3])};
|
||||
}
|
||||
|
||||
constexpr CMatrix4f(const hsh::float4x4& vec) : m{vec.cols[0], vec.cols[1], vec.cols[2], vec.cols[3]} {}
|
||||
|
||||
#endif
|
||||
|
||||
constexpr CMatrix4f& operator=(const CMatrix4f& other) = default;
|
||||
|
||||
[[nodiscard]] CVector4f operator*(const CVector4f& other) const {
|
||||
|
||||
@@ -39,6 +39,17 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if ZE_HSH_TYPES
|
||||
|
||||
operator hsh::float2() const {
|
||||
simd_floats floats(mSimd);
|
||||
return hsh::float2{floats[0], floats[1]};
|
||||
}
|
||||
|
||||
constexpr CVector2f(const hsh::float2& vec) : mSimd(vec.x, vec.y) {}
|
||||
|
||||
#endif
|
||||
|
||||
explicit constexpr CVector2f(float xy) : mSimd(xy) {}
|
||||
|
||||
@@ -47,6 +47,17 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if ZE_HSH_TYPES
|
||||
|
||||
operator hsh::float3() const {
|
||||
simd_floats floats(mSimd);
|
||||
return hsh::float3{floats[0], floats[1], floats[2]};
|
||||
}
|
||||
|
||||
constexpr CVector3f(const hsh::float3& vec) : mSimd(vec.x, vec.y, vec.z) {}
|
||||
|
||||
#endif
|
||||
|
||||
inline CVector3f(const CVector3d& vec);
|
||||
|
||||
@@ -40,6 +40,17 @@ public:
|
||||
mSimd.copy_from(f);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if ZE_HSH_TYPES
|
||||
|
||||
operator hsh::float4() const {
|
||||
simd_floats floats(mSimd);
|
||||
return hsh::float4{floats[0], floats[1], floats[2], floats[3]};
|
||||
}
|
||||
|
||||
constexpr CVector4f(const hsh::float4& vec) : mSimd(vec.x, vec.y, vec.z, vec.w) {}
|
||||
|
||||
#endif
|
||||
|
||||
explicit constexpr CVector4f(float xyzw) : mSimd(xyzw) {}
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
#include "simd/simd.hpp"
|
||||
#endif
|
||||
|
||||
#if ZE_HSH_TYPES
|
||||
#include "hsh/bits/builtin_types.h"
|
||||
#endif
|
||||
|
||||
namespace zeus {
|
||||
#if ZE_ATHENA_TYPES
|
||||
template <typename T>
|
||||
|
||||
@@ -718,54 +718,78 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
__simd_reference operator++() && { return std::move(*this) = __ptr_->__get(__index_) + 1; }
|
||||
__simd_reference operator++() && { return std::move(*this) = _Vp(*this) + 1; }
|
||||
|
||||
_Vp operator++(int) && {
|
||||
auto __val = __ptr_->__get(__index_);
|
||||
auto __val = _Vp(*this);
|
||||
__ptr_->__set(__index_, __val + 1);
|
||||
return __val;
|
||||
}
|
||||
|
||||
__simd_reference operator--() && { return std::move(*this) = __ptr_->__get(__index_) - 1; }
|
||||
__simd_reference operator--() && { return std::move(*this) = _Vp(*this) - 1; }
|
||||
|
||||
_Vp operator--(int) && {
|
||||
auto __val = __ptr_->__get(__index_);
|
||||
auto __val = _Vp(*this);
|
||||
__ptr_->__set(__index_, __val - 1);
|
||||
return __val;
|
||||
}
|
||||
|
||||
__simd_reference operator+=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) + __value; }
|
||||
__simd_reference operator+=(_Vp __value) && { return std::move(*this) = _Vp(*this) + __value; }
|
||||
|
||||
__simd_reference operator-=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) - __value; }
|
||||
__simd_reference operator-=(_Vp __value) && { return std::move(*this) = _Vp(*this) - __value; }
|
||||
|
||||
__simd_reference operator*=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) * __value; }
|
||||
__simd_reference operator*=(_Vp __value) && { return std::move(*this) = _Vp(*this) * __value; }
|
||||
|
||||
__simd_reference operator/=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) / __value; }
|
||||
__simd_reference operator/=(_Vp __value) && { return std::move(*this) = _Vp(*this) / __value; }
|
||||
|
||||
__simd_reference operator%=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) % __value; }
|
||||
__simd_reference operator%=(_Vp __value) && { return std::move(*this) = _Vp(*this) % __value; }
|
||||
|
||||
__simd_reference operator>>=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) >> __value; }
|
||||
__simd_reference operator>>=(_Vp __value) && { return std::move(*this) = _Vp(*this) >> __value; }
|
||||
|
||||
__simd_reference operator<<=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) << __value; }
|
||||
__simd_reference operator<<=(_Vp __value) && { return std::move(*this) = _Vp(*this) << __value; }
|
||||
|
||||
__simd_reference operator&=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) & __value; }
|
||||
__simd_reference operator&=(_Vp __value) && { return std::move(*this) = _Vp(*this) & __value; }
|
||||
|
||||
__simd_reference operator|=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) | __value; }
|
||||
__simd_reference operator|=(_Vp __value) && { return std::move(*this) = _Vp(*this) | __value; }
|
||||
|
||||
__simd_reference operator^=(_Vp __value) && { return std::move(*this) = __ptr_->__get(__index_) ^ __value; }
|
||||
__simd_reference operator^=(_Vp __value) && { return std::move(*this) = _Vp(*this) ^ __value; }
|
||||
|
||||
bool operator<(_Vp __value) const { return __ptr_->__get(__index_) < __value; }
|
||||
bool operator<(const __simd_reference& __value) const { return _Vp(*this) < _Vp(__value); }
|
||||
|
||||
bool operator<=(_Vp __value) const { return __ptr_->__get(__index_) <= __value; }
|
||||
bool operator<=(const __simd_reference& __value) const { return _Vp(*this) <= _Vp(__value); }
|
||||
|
||||
bool operator>(_Vp __value) const { return __ptr_->__get(__index_) > __value; }
|
||||
bool operator>(const __simd_reference& __value) const { return _Vp(*this) > _Vp(__value); }
|
||||
|
||||
bool operator>=(_Vp __value) const { return __ptr_->__get(__index_) >= __value; }
|
||||
bool operator>=(const __simd_reference& __value) const { return _Vp(*this) >= _Vp(__value); }
|
||||
|
||||
bool operator==(_Vp __value) const { return __ptr_->__get(__index_) == __value; }
|
||||
bool operator==(const __simd_reference& __value) const { return _Vp(*this) == _Vp(__value); }
|
||||
|
||||
bool operator!=(_Vp __value) const { return __ptr_->__get(__index_) != __value; }
|
||||
bool operator!=(const __simd_reference& __value) const { return _Vp(*this) != _Vp(__value); }
|
||||
|
||||
bool operator<(_Vp __value) const { return _Vp(*this) < __value; }
|
||||
|
||||
bool operator<=(_Vp __value) const { return _Vp(*this) <= __value; }
|
||||
|
||||
bool operator>(_Vp __value) const { return _Vp(*this) > __value; }
|
||||
|
||||
bool operator>=(_Vp __value) const { return _Vp(*this) >= __value; }
|
||||
|
||||
bool operator==(_Vp __value) const { return _Vp(*this) == __value; }
|
||||
|
||||
bool operator!=(_Vp __value) const { return _Vp(*this) != __value; }
|
||||
};
|
||||
template <class _Vp, class _Tp, class _Abi>
|
||||
inline bool operator<(_Vp a, const __simd_reference<_Vp, _Tp, _Abi>& b) { return a < _Vp(b); }
|
||||
template <class _Vp, class _Tp, class _Abi>
|
||||
inline bool operator<=(_Vp a, const __simd_reference<_Vp, _Tp, _Abi>& b) { return a <= _Vp(b); }
|
||||
template <class _Vp, class _Tp, class _Abi>
|
||||
inline bool operator>(_Vp a, const __simd_reference<_Vp, _Tp, _Abi>& b) { return a > _Vp(b); }
|
||||
template <class _Vp, class _Tp, class _Abi>
|
||||
inline bool operator>=(_Vp a, const __simd_reference<_Vp, _Tp, _Abi>& b) { return a >= _Vp(b); }
|
||||
template <class _Vp, class _Tp, class _Abi>
|
||||
inline bool operator==(_Vp a, const __simd_reference<_Vp, _Tp, _Abi>& b) { return a == _Vp(b); }
|
||||
template <class _Vp, class _Tp, class _Abi>
|
||||
inline bool operator!=(_Vp a, const __simd_reference<_Vp, _Tp, _Abi>& b) { return a != _Vp(b); }
|
||||
|
||||
template <class _Tp, class _Abi>
|
||||
class __simd_mask_reference {
|
||||
|
||||
Reference in New Issue
Block a user