Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TranslationMatrix.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Math/Vector.h"
7#include "Math/Plane.h"
8#include "Math/Matrix.h"
9
10namespace UE {
11namespace Math {
12
13template<typename T>
14struct TTranslationMatrix
15 : public TMatrix<T>
16{
17public:
18
19 /** Constructor translation matrix based on given vector */
20 TTranslationMatrix(const TVector<T>& Delta);
21
22 // Conversion to other type.
23 template<typename FArg, TEMPLATE_REQUIRES(!std::is_same_v<T, FArg>)>
24 explicit TTranslationMatrix(const TTranslationMatrix<FArg>& From) : TMatrix<T>(From) {}
25
26 /** Matrix factory. Return an FMatrix so we don't have type conversion issues in expressions. */
27 static TMatrix<T> Make(TVector<T> const& Delta)
28 {
29 return TTranslationMatrix<T>(Delta);
30 }
31};
32
33template<typename T>
34FORCEINLINE TTranslationMatrix<T>::TTranslationMatrix(const TVector<T>& Delta)
35 : TMatrix<T>(
36 TPlane<T>(1.0f, 0.0f, 0.0f, 0.0f),
37 TPlane<T>(0.0f, 1.0f, 0.0f, 0.0f),
38 TPlane<T>(0.0f, 0.0f, 1.0f, 0.0f),
39 TPlane<T>(Delta.X, Delta.Y,Delta.Z,1.0f)
40 )
41{ }
42
43} // namespace Math
44} // namespace UE
45
46UE_DECLARE_LWC_TYPE(TranslationMatrix, 44);
47
48template<> struct TIsUECoreVariant<FTranslationMatrix44f> { enum { Value = true }; };
49template<> struct TIsUECoreVariant<FTranslationMatrix44d> { enum { Value = true }; };
#define UE_DECLARE_LWC_TYPE(...)
#define FORCEINLINE
Definition Platform.h:644
#define TEMPLATE_REQUIRES(...)