From 048612c65cac8c10f6d6dad656155a10d2c5864a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Perrier Date: Thu, 8 Apr 2021 18:51:09 +0200 Subject: [PATCH] Add Int3.cpp. --- Source/Engine/Core/Math/Int3.cpp | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Source/Engine/Core/Math/Int3.cpp diff --git a/Source/Engine/Core/Math/Int3.cpp b/Source/Engine/Core/Math/Int3.cpp new file mode 100644 index 000000000..327437d70 --- /dev/null +++ b/Source/Engine/Core/Math/Int3.cpp @@ -0,0 +1,56 @@ +// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. + +#include "Int2.h" +#include "Int3.h" +#include "Int4.h" +#include "Vector2.h" +#include "Vector3.h" +#include "Vector4.h" +#include "Engine/Core/Types/String.h" + +static_assert(sizeof(Int3) == 12, "Invalid Int3 type size."); + +const Int3 Int3::Zero(0); +const Int3 Int3::One(1); +const Int3 Int3::Minimum(MIN_int32); +const Int3 Int3::Maximum(MAX_int32); + +Int3::Int3(const Int2& xy, int32 z) + : X(xy.X) + , Y(xy.Y) + , Z(z) +{ +} + +Int3::Int3(const Int4& xyzw) + : X(xyzw.X) + , Y(xyzw.Y) + , Z(xyzw.Z) +{ +} + +Int3::Int3(const Vector2& xy, int32 z) + : X(static_cast(xy.X)) + , Y(static_cast(xy.Y)) + , Z(z) +{ +} + +Int3::Int3(const Vector3& xyz) + : X(static_cast(xyz.X)) + , Y(static_cast(xyz.Y)) + , Z(static_cast(xyz.Z)) +{ +} + +Int3::Int3(const Vector4& xyzw) + : X(static_cast(xyzw.X)) + , Y(static_cast(xyzw.Y)) + , Z(static_cast(xyzw.Z)) +{ +} + +String Int3::ToString() const +{ + return String::Format(TEXT("{}"), *this); +}