This commit is contained in:
2025-03-17 04:07:21 +03:00
parent 6dd72d2448
commit 8fc107ec0f
2 changed files with 11 additions and 31 deletions

View File

@@ -7,7 +7,7 @@
#include <tuple> #include <tuple>
#ifdef OMATH_IMGUI_INTEGRATION #ifdef OMATH_IMGUI_INTEGRATION
class ImVec2; #include <imgui.h>
#endif #endif
@@ -159,17 +159,6 @@ namespace omath
return *this; return *this;
} }
template<class type>
[[nodiscard]] constexpr const type& As() const
{
return *reinterpret_cast<const type*>(this);
}
template<class type>
[[nodiscard]] constexpr type& As()
{
return *reinterpret_cast<type*>(this);
}
[[nodiscard]] constexpr Vector2 operator-() const [[nodiscard]] constexpr Vector2 operator-() const
{ {
return {-x, -y}; return {-x, -y};
@@ -210,15 +199,9 @@ namespace omath
#ifdef OMATH_IMGUI_INTEGRATION #ifdef OMATH_IMGUI_INTEGRATION
[[nodiscard]] [[nodiscard]]
const ImVec2& ToImVec2() const ImVec2 ToImVec2() const
{ {
return *reinterpret_cast<const ImVec2*>(this); return {static_cast<float>(this->x), static_cast<float>(this->y)};
}
[[nodiscard]]
ImVec2& ToImVec2()
{
return *reinterpret_cast<ImVec2*>(this);
} }
#endif #endif
}; };

View File

@@ -6,9 +6,6 @@
#include <omath/Vector3.hpp> #include <omath/Vector3.hpp>
#include <algorithm> #include <algorithm>
#ifdef OMATH_IMGUI_INTEGRATION
class ImVec4;
#endif
namespace omath namespace omath
{ {
@@ -161,15 +158,15 @@ namespace omath
#ifdef OMATH_IMGUI_INTEGRATION #ifdef OMATH_IMGUI_INTEGRATION
[[nodiscard]] [[nodiscard]]
constexpr ImVec4& ToImVec4() const ImVec4 ToImVec4() const
{ {
return *reinterpret_cast<const ImVec4*>(this); return
} {
static_cast<float>(this->x),
[[nodiscard]] static_cast<float>(this->y),
constexpr ImVec2& ToImVec2() static_cast<float>(this->z),
{ static_cast<float>(w),
return *reinterpret_cast<ImVec4*>(this); };
} }
#endif #endif
}; };