diff --git a/Source/Engine/Core/Math/Vector2.cpp b/Source/Engine/Core/Math/Vector2.cpp index c23e79d19..2c6979575 100644 --- a/Source/Engine/Core/Math/Vector2.cpp +++ b/Source/Engine/Core/Math/Vector2.cpp @@ -5,6 +5,8 @@ #include "Vector4.h" #include "Color.h" #include "Int2.h" +#include "Int3.h" +#include "Int4.h" #include "../Types/String.h" static_assert(sizeof(Vector2) == 8, "Invalid Vector2 type size."); @@ -16,21 +18,33 @@ const Vector2 Vector2::UnitY(0, 1); const Vector2 Vector2::Minimum(MIN_float); const Vector2 Vector2::Maximum(MAX_float); -Vector2::Vector2(const Int2& v) - : X((float)v.X) - , Y((float)v.Y) +Vector2::Vector2(const Int2& xy) + : X(static_cast(xy.X)) + , Y(static_cast(xy.Y)) { } -Vector2::Vector2(const Vector3& v) - : X(v.X) - , Y(v.Y) +Vector2::Vector2(const Int3& xyz) + : X(static_cast(xyz.X)) + , Y(static_cast(xyz.Y)) { } -Vector2::Vector2(const Vector4& v) - : X(v.X) - , Y(v.Y) +Vector2::Vector2(const Int4& xyzw) + : X(static_cast(xyzw.X)) + , Y(static_cast(xyzw.Y)) +{ +} + +Vector2::Vector2(const Vector3& xyz) + : X(xyz.X) + , Y(xyz.Y) +{ +} + +Vector2::Vector2(const Vector4& xyzw) + : X(xyzw.X) + , Y(xyzw.Y) { } diff --git a/Source/Engine/Core/Math/Vector2.h b/Source/Engine/Core/Math/Vector2.h index 7a1b1519b..aaea1d73c 100644 --- a/Source/Engine/Core/Math/Vector2.h +++ b/Source/Engine/Core/Math/Vector2.h @@ -8,6 +8,9 @@ struct Vector3; struct Vector4; +struct Int2; +struct Int3; +struct Int4; struct Color; struct Matrix; @@ -85,16 +88,24 @@ public: } // Init - // @param v Vector to use X and Y components - explicit Vector2(const Int2& v); + // @param v Int2 to use X and Y components + explicit Vector2(const Int2& xy); // Init - // @param v Vector to use X and Y components - explicit Vector2(const Vector3& v); + // @param v Int3 to use X and Y components + explicit Vector2(const Int3& xyz); + + // Init + // @param v Int4 to use X and Y components + explicit Vector2(const Int4& xyzw); + + // Init + // @param v Vector3 to use X and Y components + explicit Vector2(const Vector3& xyz); // Init // @param v Vector4 to use X and Y components - explicit Vector2(const Vector4& v); + explicit Vector2(const Vector4& xyzw); // Init // @param color Color value