Add Vector2 constructors for IntX.
This commit is contained in:
@@ -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<float>(xy.X))
|
||||
, Y(static_cast<float>(xy.Y))
|
||||
{
|
||||
}
|
||||
|
||||
Vector2::Vector2(const Vector3& v)
|
||||
: X(v.X)
|
||||
, Y(v.Y)
|
||||
Vector2::Vector2(const Int3& xyz)
|
||||
: X(static_cast<float>(xyz.X))
|
||||
, Y(static_cast<float>(xyz.Y))
|
||||
{
|
||||
}
|
||||
|
||||
Vector2::Vector2(const Vector4& v)
|
||||
: X(v.X)
|
||||
, Y(v.Y)
|
||||
Vector2::Vector2(const Int4& xyzw)
|
||||
: X(static_cast<float>(xyzw.X))
|
||||
, Y(static_cast<float>(xyzw.Y))
|
||||
{
|
||||
}
|
||||
|
||||
Vector2::Vector2(const Vector3& xyz)
|
||||
: X(xyz.X)
|
||||
, Y(xyz.Y)
|
||||
{
|
||||
}
|
||||
|
||||
Vector2::Vector2(const Vector4& xyzw)
|
||||
: X(xyzw.X)
|
||||
, Y(xyzw.Y)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user