Update DenseVector3i class

This commit is contained in:
2023-09-04 19:03:11 +02:00
parent 446e11e3b8
commit 11e207774b

View File

@@ -11,6 +11,7 @@
#include <type_traits> #include <type_traits>
#include <typeinfo> #include <typeinfo>
#include <stdexcept> #include <stdexcept>
#include <string>
namespace openVulkanoCpp::Math namespace openVulkanoCpp::Math
{ {
@@ -108,44 +109,49 @@ namespace openVulkanoCpp::Math
data = (data & !(BITMASK << BITS)) | ((z & BITMASK) << BITS); data = (data & !(BITMASK << BITS)) | ((z & BITMASK) << BITS);
} }
constexpr operator T() const { return data; } [[nodiscard]] std::string ToString(const std::string& separator = ", ") const
{
return std::to_string(X()) + "," + std::to_string(Y()) + "," + std::to_string(Z());
}
constexpr bool operator <(DenseVec3 rhs) const [[nodiscard]] constexpr operator T() const { return data; }
[[nodiscard]] constexpr bool operator <(DenseVec3 rhs) const
{ {
return data < rhs.data; return data < rhs.data;
} }
bool operator>(DenseVec3 rhs) const [[nodiscard]] bool operator>(DenseVec3 rhs) const
{ {
return rhs < *this; return rhs < *this;
} }
bool operator>=(DenseVec3 rhs) const [[nodiscard]] bool operator>=(DenseVec3 rhs) const
{ {
return !(*this < rhs); return !(*this < rhs);
} }
bool operator<=(DenseVec3 rhs) const [[nodiscard]] bool operator<=(DenseVec3 rhs) const
{ {
return !(rhs < *this); return !(rhs < *this);
} }
constexpr bool operator ==(DenseVec3 rhs) [[nodiscard]] constexpr bool operator ==(DenseVec3 rhs) const
{ {
return data == rhs.data; return data == rhs.data;
} }
constexpr bool operator !=(DenseVec3 rhs) [[nodiscard]] constexpr bool operator !=(DenseVec3 rhs) const
{ {
return data == rhs.data; return data == rhs.data;
} }
explicit constexpr operator Math::Vector3i() [[nodiscard]] explicit constexpr operator Math::Vector3i() const
{ {
return { X(), Y(), Z() }; return { X(), Y(), Z() };
} }
explicit constexpr operator Math::Vector3i_SIMD() [[nodiscard]] explicit constexpr operator Math::Vector3i_SIMD() const
{ {
return { X(), Y(), Z() }; return { X(), Y(), Z() };
} }