UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
OrthoMatrix.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/Plane.h"
7#include "Math/Matrix.h"
8
9namespace UE {
10namespace Math {
11
12
13template<typename T>
15 : public TMatrix<T>
16{
17public:
18
27 TOrthoMatrix(T Width,T Height,T ZScale,T ZOffset);
28
29 // Conversion to other type.
30 template<typename FArg UE_REQUIRES(!std::is_same_v<T, FArg>)>
31 explicit TOrthoMatrix(const TOrthoMatrix<FArg>& From)
32 : TMatrix<T>(From)
33 {
34 }
35};
36
37
38template<typename T>
40{
41public:
42 TReversedZOrthoMatrix(T Width,T Height,T ZScale,T ZOffset);
43 TReversedZOrthoMatrix(T Left, T Right, T Bottom, T Top, T ZScale, T ZOffset);
44
45 // Conversion to other type.
46 template<typename FArg UE_REQUIRES(!std::is_same_v<T, FArg>)>
48 : TMatrix<T>(From)
49 {
50 }
51};
52
53template<typename T>
54inline TOrthoMatrix<T>::TOrthoMatrix(T Width, T Height, T ZScale, T ZOffset)
55 : TMatrix<T>(
56 TPlane<T>((Width != 0.0f) ? (1.0f / Width) : 1.0f, 0.0f, 0.0f, 0.0f),
57 TPlane<T>(0.0f, (Height != 0.0f) ? (1.0f / Height) : 1.f, 0.0f, 0.0f),
58 TPlane<T>(0.0f, 0.0f, ZScale, 0.0f),
59 TPlane<T>(0.0f, 0.0f, ZOffset * ZScale, 1.0f)
60 )
61{ }
62
63
64template<typename T>
65inline TReversedZOrthoMatrix<T>::TReversedZOrthoMatrix(T Width, T Height, T ZScale, T ZOffset)
66 : TMatrix<T>(
67 TPlane<T>((Width != 0.0f) ? (1.0f / Width) : 1.0f, 0.0f, 0.0f, 0.0f),
68 TPlane<T>(0.0f, (Height != 0.0f) ? (1.0f / Height) : 1.f, 0.0f, 0.0f),
69 TPlane<T>(0.0f, 0.0f, -ZScale, 0.0f),
70 TPlane<T>(0.0f, 0.0f, 1.0f - ZOffset * ZScale, 1.0f)
71 )
72{ }
73
74template<typename T>
76 : TMatrix<T>(
77 TPlane<T>(1.0f / (Right - Left), 0.0f, 0.0f, 0.0f),
78 TPlane<T>(0.0f, 1.0f / (Top - Bottom), 0.0f, 0.0f),
79 TPlane<T>(0.0f, 0.0f, -ZScale, 0.0f),
80 TPlane<T>((Left + Right) / (Left - Right), (Top + Bottom) / (Bottom - Top), 1.0f - ZOffset * ZScale, 1.0f)
81 )
82{ }
83
84 } // namespace Math
85 } // namespace UE
86
89
90template<> struct TIsUECoreVariant<FOrthoMatrix44f> { enum { Value = true }; };
91template<> struct TIsUECoreVariant<FOrthoMatrix44d> { enum { Value = true }; };
92template<> struct TIsUECoreVariant<FReversedZOrthoMatrix44f> { enum { Value = true }; };
93template<> struct TIsUECoreVariant<FReversedZOrthoMatrix44d> { enum { Value = true }; };
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UE_DECLARE_LWC_TYPE(...)
Definition LargeWorldCoordinates.h:27
@ Bottom
Definition MaterialExpressionFunctionInput.h:43
@ Top
Definition MaterialExpressionFunctionInput.h:42
Definition AdvancedWidgetsModule.cpp:13
Definition IsUECoreType.h:19
@ Value
Definition IsUECoreType.h:20
Definition Matrix.h:43
Definition OrthoMatrix.h:16
TOrthoMatrix(const TOrthoMatrix< FArg > &From)
Definition OrthoMatrix.h:31
TOrthoMatrix(T Width, T Height, T ZScale, T ZOffset)
Definition OrthoMatrix.h:54
Definition Plane.h:35
Definition OrthoMatrix.h:40
TReversedZOrthoMatrix(const TReversedZOrthoMatrix< FArg > &From)
Definition OrthoMatrix.h:47
TReversedZOrthoMatrix(T Width, T Height, T ZScale, T ZOffset)
Definition OrthoMatrix.h:65