Add Int4.cpp.

This commit is contained in:
Jean-Baptiste Perrier
2021-04-08 18:50:59 +02:00
parent 6c4ca6c01a
commit 866105631e

View File

@@ -1,42 +1,51 @@
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
#include "VectorInt.h"
#include "Int2.h"
#include "Int3.h"
#include "Int4.h"
#include "Vector2.h"
#include "Vector3.h"
#include "Vector4.h"
#include "Engine/Core/Types/String.h"
const Int2 Int2::Zero(0);
const Int2 Int2::One(1);
Int2::Int2(const Vector2& v)
: X(static_cast<int32>(v.X))
, Y(static_cast<int32>(v.Y))
{
}
String Int2::ToString() const
{
return String::Format(TEXT("{}"), *this);
}
const Int3 Int3::Zero(0);
const Int3 Int3::One(1);
Int3::Int3(const Vector3& v)
: X(static_cast<int32>(v.X))
, Y(static_cast<int32>(v.Y))
, Z(static_cast<int32>(v.Z))
{
}
String Int3::ToString() const
{
return String::Format(TEXT("{}"), *this);
}
static_assert(sizeof(Int4) == 16, "Invalid Int4 type size.");
const Int4 Int4::Zero(0);
const Int4 Int4::One(1);
const Int4 Int4::Minimum(MIN_int32);
const Int4 Int4::Maximum(MAX_int32);
Int4::Int4(const Int2& xy, int32 z, int32 w)
: X(xy.X)
, Y(xy.Y)
, Z(z)
, W(w)
{
}
Int4::Int4(const Int3& xyz, int32 w)
: X(xyz.X)
, Y(xyz.Y)
, Z(xyz.Z)
, W(w)
{
}
Int4::Int4(const Vector2& v, int32 z, int32 w)
: X(static_cast<int32>(v.X))
, Y(static_cast<int32>(v.Y))
, Z(z)
, W(w)
{
}
Int4::Int4(const Vector3& v, int32 w)
: X(static_cast<int32>(v.X))
, Y(static_cast<int32>(v.Y))
, Z(static_cast<int32>(v.Z))
, W(w)
{
}
Int4::Int4(const Vector4& v)
: X(static_cast<int32>(v.X))