fix compilation errors

This commit is contained in:
ohyzha
2024-09-23 15:59:42 +03:00
parent 69f07f09f9
commit b3d1e87c7b

View File

@@ -36,29 +36,29 @@ namespace OpenVulkano::Math
RGB565() : r(0), g(0), b(0) {}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
RGB565(const Math::Vector3<T>& color) : b(Make5(color.b)), g(Make6(color.g)), r(Make5(color.r))
{
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
RGB565(const Math::Vector4<T>& color) : b(Make5(color.b)), g(Make6(color.g)), r(Make5(color.r))
{
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
RGB565(const Math::Vector3_SIMD<T>& color) : b(Make5(color.b)), g(Make6(color.g)), r(Make5(color.r))
{
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
RGB565(const Math::Vector3<T>& color)
: b(Make5FromFloat(color.b)), g(Make6FromFloat(color.g)), r(Make5FromFloat(color.r))
{
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
RGB565(const Math::Vector4<T>& color)
: b(Make5FromFloat(color.b)), g(Make6FromFloat(color.g)), r(Make5FromFloat(color.r))
{
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
RGB565(const Math::Vector3_SIMD<T>& color)
: b(Make5FromFloat(color.b)), g(Make6FromFloat(color.g)), r(Make5FromFloat(color.r))
{
@@ -68,30 +68,32 @@ namespace OpenVulkano::Math
uint8_t GetG() { return Unmake6(g); }
uint8_t GetB() { return Unmake5(b); }
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
Math::Vector3<T> Get3()
{
return { GetR(), GetG(), GetB() };
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
Math::Vector4<T> Get4()
{
return { GetR(), GetG(), GetB(), 1 };
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
Math::Vector3_SIMD<T> GetSIMD()
{
return { GetR(), GetG(), GetB() };
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>> Math::Vector3<T> Get3Normalized()
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
Math::Vector3<T> Get3Normalized()
{
return { GetR_Normalized(), GetG_Normalized(), GetB_Normalized() };
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>> Math::Vector4<T> Get4Normalized()
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
Math::Vector4<T> Get4Normalized()
{
return { GetR_Normalized(), GetG_Normalized(), GetB_Normalized(), 1 };
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
Math::Vector3_SIMD<T> Get3NormalizedSIMD()
{
return { GetR_Normalized(), GetG_Normalized(), GetB_Normalized() };
@@ -101,7 +103,7 @@ namespace OpenVulkano::Math
void SetG(uint8_t green) { g = Make6(green); }
void SetB(uint8_t blue) { b = Make5(blue); }
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
void Set(const Math::Vector3<T>& color)
{
r = Make5(color.r);
@@ -109,7 +111,7 @@ namespace OpenVulkano::Math
b = Make5(color.b);
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
void Set(const Math::Vector4<T>& color)
{
r = Make5(color.r);
@@ -117,7 +119,7 @@ namespace OpenVulkano::Math
b = Make5(color.b);
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
void SetNormalized(const Math::Vector3<T>& color)
{
r = Make5FromFloat(color.r);
@@ -125,7 +127,7 @@ namespace OpenVulkano::Math
b = Make5FromFloat(color.b);
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
void SetNormalized(const Math::Vector4<T>& color)
{
r = Make5FromFloat(color.r);
@@ -153,133 +155,126 @@ namespace OpenVulkano::Math
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
RGB565& operator=(const Vector3<T>& color)
{
Set(color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
RGB565& operator=(const Vector4<T>& color)
{
Set(color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
RGB565& operator=(const Vector3_SIMD<T>& color)
{
Set(color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
RGB565& operator=(const Vector4_SIMD<T>& color)
{
Set(color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
RGB565& operator=(const Vector3<T>& color)
{
SetNormalized(color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
RGB565& operator=(const Vector4<T>& color)
{
SetNormalized(color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
RGB565& operator=(const Vector3_SIMD<T>& color)
{
SetNormalized(color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
RGB565& operator+=(const Vector3<T>& color)
{
Set(Get3<T>() + color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
RGB565& operator+=(const Vector4<T>& color)
{
Set(Get4<T>() + color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
RGB565& operator+=(const Vector3_SIMD<T>& color)
{
Set(Get3SIMD<T>() + color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
RGB565& operator+=(const Vector3<T>& color)
{
SetNormalized(Get3Normalized<T>() + color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
RGB565& operator+=(const Vector4<T>& color)
{
SetNormalized(Get4Normalized<T>() + color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
RGB565& operator+=(const Vector3_SIMD<T>& color)
{
SetNormalized(Get3NormalizedSIMD<T>() + color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
RGB565& operator-=(const Vector3<T>& color)
{
Set(Get3<T>() - color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
RGB565& operator-=(const Vector4<T>& color)
{
Set(Get4<T>() - color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
RGB565& operator-=(const Vector3_SIMD<T>& color)
{
Set(Get3SIMD<T>() - color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
RGB565& operator-=(const Vector3<T>& color)
{
SetNormalized(Get3Normalized<T>() - color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
RGB565& operator-=(const Vector4<T>& color)
{
SetNormalized(Get4Normalized<T>() - color);
return *this;
}
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
RGB565& operator-=(const Vector3_SIMD<T>& color)
{
SetNormalized(Get3NormalizedSIMD<T>() - color);
@@ -289,15 +284,15 @@ namespace OpenVulkano::Math
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>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
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>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
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>>>
template<typename T, std::enable_if_t<std::is_unsigned_v<T> || std::is_signed_v<T>, bool> = true>
operator Math::Vector3_SIMD<T>() { return Get3SIMD<T>(); }
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
operator Math::Vector4<T>() { return Get4Normalized<T>(); }
template<typename T, typename = std::enable_if_t<std::is_floating_point_v<T>>>
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
operator Math::Vector3<T>() { return Get3Normalized<T>(); }
};