diff --git a/Source/Engine/Core/Math/Vector3.cpp b/Source/Engine/Core/Math/Vector3.cpp index f66bbcbbd..9c8783dad 100644 --- a/Source/Engine/Core/Math/Vector3.cpp +++ b/Source/Engine/Core/Math/Vector3.cpp @@ -6,7 +6,9 @@ #include "Color.h" #include "Quaternion.h" #include "Matrix.h" +#include "Int2.h" #include "Int3.h" +#include "Int4.h" #include "../Types/String.h" static_assert(sizeof(Vector3) == 12, "Invalid Vector3 type size."); @@ -40,10 +42,24 @@ Vector3::Vector3(const Vector2& xy) { } +Vector3::Vector3(const Int2& xy, float z) + : X(static_cast(xy.X)) + , Y(static_cast(xy.Y)) + , Z(static_cast(z)) +{ +} + Vector3::Vector3(const Int3& xyz) - : X((float)xyz.X) - , Y((float)xyz.Y) - , Z((float)xyz.Z) + : X(static_cast(xyz.X)) + , Y(static_cast(xyz.Y)) + , Z(static_cast(xyz.Z)) +{ +} + +Vector3::Vector3(const Int4& xyzw) + : X(static_cast(xyzw.X)) + , Y(static_cast(xyzw.Y)) + , Z(static_cast(xyzw.Z)) { } diff --git a/Source/Engine/Core/Math/Vector3.h b/Source/Engine/Core/Math/Vector3.h index 1f4792e31..d9a1d6036 100644 --- a/Source/Engine/Core/Math/Vector3.h +++ b/Source/Engine/Core/Math/Vector3.h @@ -12,6 +12,8 @@ struct Vector2; struct Vector4; struct Color; class String; +struct Int3; +struct Int4; /// /// Represents a three dimensional mathematical vector. @@ -138,10 +140,19 @@ public: // @param xy Vector3 value explicit Vector3(const Vector2& xy); + // Init + // @param xy Int22 with X and Y components values + // @param z Z component value + explicit Vector3(const Int2& xy, float z); + // Init // @param xyz Int3 value explicit Vector3(const Int3& xyz); + // Init + // @param xyzw Int4 value + explicit Vector3(const Int4& xyzw); + // Init // @param xyz Vector4 value explicit Vector3(const Vector4& xyz);