casting operators

This commit is contained in:
Metehan Tuncbilek
2024-08-08 15:53:18 +03:00
parent 2df7280057
commit c7a9730897

View File

@@ -340,6 +340,20 @@ namespace OpenVulkano::Math
bool operator==(const RGB565& other) const { return value == other.value; } bool operator==(const RGB565& other) const { return value == other.value; }
bool operator!=(const RGB565& other) const { return value != other.value; } bool operator!=(const RGB565& other) const { return value != other.value; }
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
operator Math::Vector4<T>() { return Get4<T>(); }
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
operator Math::Vector3<T>() { return Get3<T>(); }
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
operator Math::Vector4_SIMD<T>() { return Get4SIMD<T>(); }
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
operator Math::Vector3_SIMD<T>() { return Get3SIMD<T>(); }
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
operator Math::Vector4<T>() { return Get4Normalized<T>(); }
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
operator Math::Vector3<T>() { return Get3Normalized<T>(); }
}; };
static_assert(sizeof(RGB565) == 2); static_assert(sizeof(RGB565) == 2);