6#include "Math/UnrealMathUtility.h"
8#include "Math/Matrix.h"
14struct TPerspectiveMatrix
20#define Z_PRECISION 0.0f
23
24
25
26
27
28
29
30
31
32 TPerspectiveMatrix(T HalfFOVX, T HalfFOVY, T MultFOVX, T MultFOVY, T MinZ, T MaxZ);
35
36
37
38
39
40
41
42
43
44 TPerspectiveMatrix(T HalfFOV, T Width, T Height, T MinZ, T MaxZ);
47
48
49
50
51
52
53
54
55 TPerspectiveMatrix(T HalfFOV, T Width, T Height, T MinZ);
59 explicit TPerspectiveMatrix(
const TPerspectiveMatrix<FArg>& From) : TMatrix<T>(From) {}
64struct TReversedZPerspectiveMatrix :
public TMatrix<T>
67 TReversedZPerspectiveMatrix(T HalfFOVX, T HalfFOVY, T MultFOVX, T MultFOVY, T MinZ, T MaxZ);
68 TReversedZPerspectiveMatrix(T HalfFOV, T Width, T Height, T MinZ, T MaxZ);
69 TReversedZPerspectiveMatrix(T HalfFOV, T Width, T Height, T MinZ);
73 explicit TReversedZPerspectiveMatrix(
const TReversedZPerspectiveMatrix<FArg>& From) : TMatrix<T>(From) {}
80#pragma warning (disable : 4723
)
85FORCEINLINE TPerspectiveMatrix<T>::TPerspectiveMatrix(T HalfFOVX, T HalfFOVY, T MultFOVX, T MultFOVY, T MinZ, T MaxZ)
87 TPlane<T>(MultFOVX / FMath::Tan(HalfFOVX), 0.0f, 0.0f, 0.0f),
88 TPlane<T>(0.0f, MultFOVY / FMath::Tan(HalfFOVY), 0.0f, 0.0f),
89 TPlane<T>(0.0f, 0.0f, ((MinZ == MaxZ) ? (1.0f -
Z_PRECISION) : MaxZ / (MaxZ - MinZ)), 1.0f),
90 TPlane<T>(0.0f, 0.0f, -MinZ * ((MinZ == MaxZ) ? (1.0f -
Z_PRECISION) : MaxZ / (MaxZ - MinZ)), 0.0f)
96FORCEINLINE TPerspectiveMatrix<T>::TPerspectiveMatrix(T HalfFOV, T Width, T Height, T MinZ, T MaxZ)
98 TPlane<T>(1.0f / FMath::Tan(HalfFOV), 0.0f, 0.0f, 0.0f),
99 TPlane<T>(0.0f, Width / FMath::Tan(HalfFOV) / Height, 0.0f, 0.0f),
100 TPlane<T>(0.0f, 0.0f, ((MinZ == MaxZ) ? (1.0f -
Z_PRECISION) : MaxZ / (MaxZ - MinZ)), 1.0f),
101 TPlane<T>(0.0f, 0.0f, -MinZ * ((MinZ == MaxZ) ? (1.0f -
Z_PRECISION) : MaxZ / (MaxZ - MinZ)), 0.0f)
107FORCEINLINE TPerspectiveMatrix<T>::TPerspectiveMatrix(T HalfFOV, T Width, T Height, T MinZ)
109 TPlane<T>(1.0f / FMath::Tan(HalfFOV), 0.0f, 0.0f, 0.0f),
110 TPlane<T>(0.0f, Width / FMath::Tan(HalfFOV) / Height, 0.0f, 0.0f),
112 TPlane<T>(0.0f, 0.0f, -MinZ * (1.0f -
Z_PRECISION), 0.0f)
118FORCEINLINE TReversedZPerspectiveMatrix<T>::TReversedZPerspectiveMatrix(T HalfFOVX, T HalfFOVY, T MultFOVX, T MultFOVY, T MinZ, T MaxZ)
120 TPlane<T>(MultFOVX / FMath::Tan(HalfFOVX), 0.0f, 0.0f, 0.0f),
121 TPlane<T>(0.0f, MultFOVY / FMath::Tan(HalfFOVY), 0.0f, 0.0f),
122 TPlane<T>(0.0f, 0.0f, ((MinZ == MaxZ) ? 0.0f : MinZ / (MinZ - MaxZ)), 1.0f),
123 TPlane<T>(0.0f, 0.0f, ((MinZ == MaxZ) ? MinZ : -MaxZ * MinZ / (MinZ - MaxZ)), 0.0f)
129FORCEINLINE TReversedZPerspectiveMatrix<T>::TReversedZPerspectiveMatrix(T HalfFOV, T Width, T Height, T MinZ, T MaxZ)
131 TPlane<T>(1.0f / FMath::Tan(HalfFOV), 0.0f, 0.0f, 0.0f),
132 TPlane<T>(0.0f, Width / FMath::Tan(HalfFOV) / Height, 0.0f, 0.0f),
133 TPlane<T>(0.0f, 0.0f, ((MinZ == MaxZ) ? 0.0f : MinZ / (MinZ - MaxZ)), 1.0f),
134 TPlane<T>(0.0f, 0.0f, ((MinZ == MaxZ) ? MinZ : -MaxZ * MinZ / (MinZ - MaxZ)), 0.0f)
140FORCEINLINE TReversedZPerspectiveMatrix<T>::TReversedZPerspectiveMatrix(T HalfFOV, T Width, T Height, T MinZ)
142 TPlane<T>(1.0f / FMath::Tan(HalfFOV), 0.0f, 0.0f, 0.0f),
143 TPlane<T>(0.0f, Width / FMath::Tan(HalfFOV) / Height, 0.0f, 0.0f),
144 TPlane<T>(0.0f, 0.0f, 0.0f, 1.0f),
145 TPlane<T>(0.0f, 0.0f, MinZ, 0.0f)
160template<>
struct TIsUECoreVariant<FPerspectiveMatrix44f> {
enum { Value =
true }; };
161template<>
struct TIsUECoreVariant<FPerspectiveMatrix44d> {
enum { Value =
true }; };
162template<>
struct TIsUECoreVariant<FReversedZPerspectiveMatrix44f> {
enum { Value =
true }; };
163template<>
struct TIsUECoreVariant<FReversedZPerspectiveMatrix44d> {
enum { Value =
true }; };
#define UE_DECLARE_LWC_TYPE(...)
#define TEMPLATE_REQUIRES(...)