Add DoubleX constructors for VectorX
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
#include "Double2.h"
|
||||||
|
#include "Double3.h"
|
||||||
|
#include "Double4.h"
|
||||||
#include "Vector2.h"
|
#include "Vector2.h"
|
||||||
#include "Vector3.h"
|
#include "Vector3.h"
|
||||||
#include "Vector4.h"
|
#include "Vector4.h"
|
||||||
@@ -48,6 +51,24 @@ Vector2::Vector2(const Vector4& xyzw)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector2::Vector2(const Double2& xy)
|
||||||
|
: X(static_cast<float>(xy.X))
|
||||||
|
, Y(static_cast<float>(xy.Y))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2::Vector2(const Double3& xyz)
|
||||||
|
: X(static_cast<float>(xyz.X))
|
||||||
|
, Y(static_cast<float>(xyz.Y))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2::Vector2(const Double4& xyzw)
|
||||||
|
: X(static_cast<float>(xyzw.X))
|
||||||
|
, Y(static_cast<float>(xyzw.Y))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Vector2::Vector2(const Color& color)
|
Vector2::Vector2(const Color& color)
|
||||||
: X(color.R)
|
: X(color.R)
|
||||||
, Y(color.G)
|
, Y(color.G)
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
#include "Engine/Core/Formatting.h"
|
#include "Engine/Core/Formatting.h"
|
||||||
#include "Engine/Core/Templates.h"
|
#include "Engine/Core/Templates.h"
|
||||||
|
|
||||||
|
struct Double2;
|
||||||
|
struct Double3;
|
||||||
|
struct Double4;
|
||||||
struct Vector3;
|
struct Vector3;
|
||||||
struct Vector4;
|
struct Vector4;
|
||||||
struct Int2;
|
struct Int2;
|
||||||
@@ -107,6 +110,18 @@ public:
|
|||||||
// @param v Vector4 to use X and Y components
|
// @param v Vector4 to use X and Y components
|
||||||
explicit Vector2(const Vector4& xyzw);
|
explicit Vector2(const Vector4& xyzw);
|
||||||
|
|
||||||
|
// Init
|
||||||
|
// @param xy Double2 to use X and Y components
|
||||||
|
explicit Vector2(const Double2& xy);
|
||||||
|
|
||||||
|
// Init
|
||||||
|
// @param xyz Double3 to use X and Y components
|
||||||
|
explicit Vector2(const Double3& xyz);
|
||||||
|
|
||||||
|
// Init
|
||||||
|
// @param xyzw Double4 to use X and Y components
|
||||||
|
explicit Vector2(const Double4& xyzw);
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
// @param color Color value
|
// @param color Color value
|
||||||
explicit Vector2(const Color& color);
|
explicit Vector2(const Color& color);
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
#include "Double2.h"
|
||||||
|
#include "Double3.h"
|
||||||
|
#include "Double4.h"
|
||||||
#include "Vector2.h"
|
#include "Vector2.h"
|
||||||
#include "Vector3.h"
|
#include "Vector3.h"
|
||||||
#include "Vector4.h"
|
#include "Vector4.h"
|
||||||
@@ -70,6 +73,27 @@ Vector3::Vector3(const Vector4& xyz)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector3::Vector3(const Double2& xy, float z)
|
||||||
|
: X(static_cast<float>(xy.X))
|
||||||
|
, Y(static_cast<float>(xy.Y))
|
||||||
|
, Z(z)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3::Vector3(const Double3& xyz)
|
||||||
|
: X(static_cast<float>(xyz.X))
|
||||||
|
, Y(static_cast<float>(xyz.Y))
|
||||||
|
, Z(static_cast<float>(xyz.Z))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3::Vector3(const Double4& xyzw)
|
||||||
|
: X(static_cast<float>(xyzw.X))
|
||||||
|
, Y(static_cast<float>(xyzw.Y))
|
||||||
|
, Z(static_cast<float>(xyzw.Z))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Vector3::Vector3(const Color& color)
|
Vector3::Vector3(const Color& color)
|
||||||
: X(color.R)
|
: X(color.R)
|
||||||
, Y(color.G)
|
, Y(color.G)
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
#include "Engine/Core/Formatting.h"
|
#include "Engine/Core/Formatting.h"
|
||||||
#include "Engine/Core/Templates.h"
|
#include "Engine/Core/Templates.h"
|
||||||
|
|
||||||
|
struct Double2;
|
||||||
|
struct Double3;
|
||||||
|
struct Double4;
|
||||||
struct Quaternion;
|
struct Quaternion;
|
||||||
struct Matrix;
|
struct Matrix;
|
||||||
struct Vector2;
|
struct Vector2;
|
||||||
@@ -134,7 +137,7 @@ public:
|
|||||||
// Init
|
// Init
|
||||||
// @param xy Vector2 with X and Y components values
|
// @param xy Vector2 with X and Y components values
|
||||||
// @param z Z component value
|
// @param z Z component value
|
||||||
Vector3(const Vector2& xy, float z);
|
explicit Vector3(const Vector2& xy, float z);
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
// @param xy Vector3 value
|
// @param xy Vector3 value
|
||||||
@@ -157,6 +160,19 @@ public:
|
|||||||
// @param xyz Vector4 value
|
// @param xyz Vector4 value
|
||||||
explicit Vector3(const Vector4& xyz);
|
explicit Vector3(const Vector4& xyz);
|
||||||
|
|
||||||
|
// Init
|
||||||
|
// @param xy Double2 with X and Y components values
|
||||||
|
// @param z Z component value
|
||||||
|
explicit Vector3(const Double2& xy, float z);
|
||||||
|
|
||||||
|
// Init
|
||||||
|
// @param xyz Double3 value
|
||||||
|
explicit Vector3(const Double3& xyz);
|
||||||
|
|
||||||
|
// Init
|
||||||
|
// @param xyzw Double4 value
|
||||||
|
explicit Vector3(const Double4& xyzw);
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
// @param color Color value
|
// @param color Color value
|
||||||
explicit Vector3(const Color& color);
|
explicit Vector3(const Color& color);
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
#include "Double4.h"
|
||||||
|
#include "Double3.h"
|
||||||
|
#include "Double2.h"
|
||||||
#include "Vector4.h"
|
#include "Vector4.h"
|
||||||
#include "Vector2.h"
|
#include "Vector2.h"
|
||||||
#include "Vector3.h"
|
#include "Vector3.h"
|
||||||
@@ -70,8 +73,32 @@ Vector4::Vector4(const Int3& xyz, float w)
|
|||||||
Vector4::Vector4(const Int4& xyzw)
|
Vector4::Vector4(const Int4& xyzw)
|
||||||
: X(static_cast<float>(xyzw.X))
|
: X(static_cast<float>(xyzw.X))
|
||||||
, Y(static_cast<float>(xyzw.Y))
|
, Y(static_cast<float>(xyzw.Y))
|
||||||
, Z(static_cast<float>(xyzw.X))
|
, Z(static_cast<float>(xyzw.Z))
|
||||||
, W(static_cast<float>(xyzw.Y))
|
, W(static_cast<float>(xyzw.W))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector4::Vector4(const Double2& xy, float z, float w)
|
||||||
|
: X(static_cast<float>(xy.X))
|
||||||
|
, Y(static_cast<float>(xy.Y))
|
||||||
|
, Z(z)
|
||||||
|
, W(w)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector4::Vector4(const Double3& xyz, float w)
|
||||||
|
: X(static_cast<float>(xyz.X))
|
||||||
|
, Y(static_cast<float>(xyz.Y))
|
||||||
|
, Z(static_cast<float>(xyz.Z))
|
||||||
|
, W(w)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector4::Vector4(const Double4& xyzw)
|
||||||
|
: X(static_cast<float>(xyzw.X))
|
||||||
|
, Y(static_cast<float>(xyzw.Y))
|
||||||
|
, Z(static_cast<float>(xyzw.Z))
|
||||||
|
, W(static_cast<float>(xyzw.W))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
#include "Engine/Core/Templates.h"
|
#include "Engine/Core/Templates.h"
|
||||||
#include "Math.h"
|
#include "Math.h"
|
||||||
|
|
||||||
|
struct Double2;
|
||||||
|
struct Double3;
|
||||||
|
struct Double4;
|
||||||
struct Vector2;
|
struct Vector2;
|
||||||
struct Vector3;
|
struct Vector3;
|
||||||
struct Color;
|
struct Color;
|
||||||
@@ -151,6 +154,21 @@ public:
|
|||||||
// @param color Int4 value
|
// @param color Int4 value
|
||||||
explicit Vector4(const Int4& xyzw);
|
explicit Vector4(const Int4& xyzw);
|
||||||
|
|
||||||
|
// Init
|
||||||
|
// @param xy Double2. X and Y values in the vector
|
||||||
|
// @param z Z component value
|
||||||
|
// @param w W component value
|
||||||
|
explicit Vector4(const Double2& xy, float z, float w);
|
||||||
|
|
||||||
|
// Init
|
||||||
|
// @param xyz Double3. X, Y and Z values in the vector
|
||||||
|
// @param w W component value
|
||||||
|
explicit Vector4(const Double3& xyz, float w);
|
||||||
|
|
||||||
|
// Init
|
||||||
|
// @param xyzw Double4 value
|
||||||
|
explicit Vector4(const Double4& xyzw);
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
// @param color Color value
|
// @param color Color value
|
||||||
explicit Vector4(const Color& color);
|
explicit Vector4(const Color& color);
|
||||||
|
|||||||
Reference in New Issue
Block a user