diff --git a/Source/Engine/Core/Math/Vector4.cpp b/Source/Engine/Core/Math/Vector4.cpp index 34fa27aac..5da725c20 100644 --- a/Source/Engine/Core/Math/Vector4.cpp +++ b/Source/Engine/Core/Math/Vector4.cpp @@ -3,10 +3,12 @@ #include "Vector4.h" #include "Vector2.h" #include "Vector3.h" +#include "Int2.h" +#include "Int3.h" +#include "Int4.h" #include "Color.h" #include "Matrix.h" #include "Rectangle.h" -#include "Int4.h" #include "../Types/String.h" static_assert(sizeof(Vector4) == 16, "Invalid Vector4 type size."); @@ -49,11 +51,27 @@ Vector4::Vector4(const Vector3& xyz, float w) { } +Vector4::Vector4(const Int2& xy, float z, float w) + : X(static_cast(xy.X)) + , Y(static_cast(xy.Y)) + , Z(z) + , W(w) +{ +} + +Vector4::Vector4(const Int3& xyz, float w) + : X(static_cast(xyz.X)) + , Y(static_cast(xyz.Y)) + , Z(static_cast(xyz.Z)) + , W(w) +{ +} + Vector4::Vector4(const Int4& xyzw) - : X((float)xyzw.X) - , Y((float)xyzw.Y) - , Z((float)xyzw.X) - , W((float)xyzw.Y) + : X(static_cast(xyzw.X)) + , Y(static_cast(xyzw.Y)) + , Z(static_cast(xyzw.X)) + , W(static_cast(xyzw.Y)) { } diff --git a/Source/Engine/Core/Math/Vector4.h b/Source/Engine/Core/Math/Vector4.h index c7771aa67..fe25a80bd 100644 --- a/Source/Engine/Core/Math/Vector4.h +++ b/Source/Engine/Core/Math/Vector4.h @@ -13,6 +13,9 @@ struct Color; struct Matrix; struct Rectangle; class String; +struct Int2; +struct Int3; +struct Int4; /// /// Represents a four dimensional mathematical vector. @@ -133,6 +136,17 @@ public: // @param w W component value Vector4(const Vector3& xyz, float w); + // Init + // @param xy X and Y values in the vector + // @param z Z component value + // @param w W component value + explicit Vector4(const Int2& xy, float z, float w); + + // Init + // @param xyz X, Y and Z values in the vector + // @param w W component value + explicit Vector4(const Int3& xyz, float w); + // Init // @param color Int4 value explicit Vector4(const Int4& xyzw);