Add Vector3 constructor for IntX.
This commit is contained in:
@@ -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<float>(xy.X))
|
||||
, Y(static_cast<float>(xy.Y))
|
||||
, Z(static_cast<float>(z))
|
||||
{
|
||||
}
|
||||
|
||||
Vector3::Vector3(const Int3& xyz)
|
||||
: X((float)xyz.X)
|
||||
, Y((float)xyz.Y)
|
||||
, Z((float)xyz.Z)
|
||||
: X(static_cast<float>(xyz.X))
|
||||
, Y(static_cast<float>(xyz.Y))
|
||||
, Z(static_cast<float>(xyz.Z))
|
||||
{
|
||||
}
|
||||
|
||||
Vector3::Vector3(const Int4& xyzw)
|
||||
: X(static_cast<float>(xyzw.X))
|
||||
, Y(static_cast<float>(xyzw.Y))
|
||||
, Z(static_cast<float>(xyzw.Z))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ struct Vector2;
|
||||
struct Vector4;
|
||||
struct Color;
|
||||
class String;
|
||||
struct Int3;
|
||||
struct Int4;
|
||||
|
||||
/// <summary>
|
||||
/// 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);
|
||||
|
||||
Reference in New Issue
Block a user