UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
HeadMountedDisplayTypes.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
6#include "CoreMinimal.h"
8#include "IMotionController.h"
9#include "InputCoreTypes.h"
11#include "Logging/LogCategory.h"
12#include "Logging/LogMacros.h"
13#include "Math/IntRect.h"
14#include "Math/Quat.h"
15#include "Math/UnrealMathSSE.h"
16#include "Math/Vector.h"
17#include "Math/Vector2D.h"
18#include "Misc/Guid.h"
19#include "RHI.h"
20#include "RHIResources.h"
22#include "UObject/NameTypes.h"
25
26#include "HeadMountedDisplayTypes.generated.h"
27
29class UObject;
30struct FFilterVertex;
31struct FFrame;
32
60
63
64UENUM()
66{
67 enum Type : int
68 {
69 Orientation UMETA(DisplayName = "Orientation"),
70 Position UMETA(DisplayName = "Position"),
71 OrientationAndPosition UMETA(DisplayName = "Orientation and Position")
72 };
73}
74
78UENUM()
80{
81 enum Type : int
82 {
83 View UMETA(ToolTip = "Previously sometimes used Eye space to query for the view transform, this space is fixed to the HMD, meaning that as the hmd moves this space moves relative to other spaces. This isn't used as a tracking origin.")
84 , LocalFloor UMETA(ToolTip = "For standing stationary experiences. Typically centered around HMDs initial position either at app startup or device startup, with Z 0 set to match the floor as in the Stage Space. Falls back to local.")
85 , Local UMETA(ToolTip = "For seated experiences. Always Supported. Typically centered around the HMDs initial position either at app startup or device startup. Useful for seated experiences. Previously called Eye Space. ")
86 , Stage UMETA(ToolTip = "For walking-around experiences. The origin will be at floor level and typically within a defined play areas who's bounds will be available. Falls back to local.")
87 , CustomOpenXR UMETA(ToolTip = "Custom OpenXR tracking space of some kind. You cannot set this space explictly, it is automatically used by some platform plugin extensions.")
88 };
89}
90
94UENUM()
96{
97 enum Type : int
98 {
99 Unknown UMETA(DisplayName = "Unknown"),
100 Worn UMETA(DisplayName = "Worn"),
101 NotWorn UMETA(DisplayName = "Not Worn"),
102 };
103}
104
105
109UENUM(BlueprintType)
121
125UENUM(BlueprintType)
127{
128 enum Type : int
129 {
130 NoFlags = 0x00 UMETA(Hidden),
131 IsAR = 0x01,
132 IsTablet = 0x02,
135 };
136}
143UENUM()
145{
146 Disabled UMETA(DisplayName = "Disabled"),
147 SingleEyeLetterboxed UMETA(DisplayName = "SingleEyeLetterboxed"),
148 Undistorted UMETA(DisplayName = "Undistorted"),
149 Distorted UMETA(DisplayName = "Distorted"),
150 SingleEye UMETA(DisplayName = "SingleEye"),
151 SingleEyeCroppedToFill UMETA(DisplayName = "SingleEyeCroppedToFill"),
152 Texture UMETA(DisplayName = "Texture"),
153 TexturePlusEye UMETA(DisplayName = "TexturePlusEye"),
154};
155const uint8 ESpectatorScreenModeFirst = (uint8)ESpectatorScreenMode::Disabled;
156const uint8 ESpectatorScreenModeLast = (uint8)ESpectatorScreenMode::TexturePlusEye;
157
159{
161 : EyeRectMin(0.0f, 0.0f)
162 , EyeRectMax(1.0f, 1.0f)
163 , TextureRectMin(0.125f, 0.125f)
164 , TextureRectMax(0.25f, 0.25f)
168 {}
169
179
180 bool IsValid() const
181 {
182 bool bValid = true;
183 if ((EyeRectMax.X <= EyeRectMin.X) || (EyeRectMax.Y <= EyeRectMin.Y))
184 {
185 UE_LOG(LogHMD, Warning, TEXT("SpectatorScreenModeTexturePlusEyeLayout EyeRect is invalid! Max is not greater than Min in some dimension."));
186 bValid = false;
187 }
189 {
190 UE_LOG(LogHMD, Warning, TEXT("SpectatorScreenModeTexturePlusEyeLayout TextureRect is invalid! Max is not greater than Min in some dimension."));
191 bValid = false;
192 }
193 if (EyeRectMin.X > 1.0f || EyeRectMin.X < 0.0f ||
194 EyeRectMin.Y > 1.0f || EyeRectMin.Y < 0.0f ||
195 EyeRectMax.X > 1.0f || EyeRectMax.X < 0.0f ||
196 EyeRectMax.Y > 1.0f || EyeRectMax.Y < 0.0f
197 )
198 {
199 UE_LOG(LogHMD, Warning, TEXT("SpectatorScreenModeTexturePlusEyeLayout EyeRect is invalid! All dimensions must be in 0-1 range."));
200 bValid = false;
201 }
202
203 if (TextureRectMin.X > 1.0f || TextureRectMin.X < 0.0f ||
204 TextureRectMin.Y > 1.0f || TextureRectMin.Y < 0.0f ||
205 TextureRectMax.X > 1.0f || TextureRectMax.X < 0.0f ||
206 TextureRectMax.Y > 1.0f || TextureRectMax.Y < 0.0f
207 )
208 {
209 UE_LOG(LogHMD, Warning, TEXT("SpectatorScreenModeTexturePlusEyeLayout TextureRect is invalid! All dimensions must be in 0-1 range."));
210 bValid = false;
211 }
212 return bValid;
213 }
214
215 FIntRect GetScaledEyeRect(int SizeX, int SizeY) const
216 {
218 }
219
224
232};
233
234UENUM(BlueprintType)
236{
244 Tracker,
246 Other,
248 Invalid = (uint8)-2 UMETA(Hidden),
250 Any = (uint8)-1,
251};
252
253
254
259UENUM(BlueprintType)
289
291
292UCLASS(MinimalAPI)
294{
296
297public:
299 UFUNCTION(BlueprintPure, BlueprintInternalUseOnly, meta = (CompactNodeTitle = "->", BlueprintAutocast))
300 static int32 Conv_HandKeypointToInt32(EHandKeypoint input)
301 {
302 return static_cast<int32>(input);
303 }
304};
305
306UENUM(BlueprintType)
308{
310 Hand
311};
312
318UENUM(BlueprintType)
320{
321 /* The unreal coordinate system. Affected by world scaling and the TrackingToWorldTransform.*/
323 /* The coordinate system the XR Device is tracking itself in. Should be fixed relative to the real world over short timescales, not affected by world scaling or the TrackingToWorldTransoform. May change relationship to the physical world through recentering or similar events.*/
325};
326
330UENUM(BlueprintType)
332{
333 /* A pose meant to represent pointing.*/
334 Aim,
335 /* A poose meant to represent holding a stick.*/
336 Grip,
337 /* A pose meant to represent holding an item in the palm of the hand.*/
338 Palm
339};
340
341USTRUCT(BlueprintType)
343{
345
346 UPROPERTY(BlueprintReadOnly, Category = "XR")
347 bool bValid = false;
348 UPROPERTY(BlueprintReadOnly, Category = "XR")
349 FName DeviceName;
350 UPROPERTY(BlueprintReadOnly, Category = "XR")
351 FGuid ApplicationInstanceID;
352
353 UPROPERTY(BlueprintReadOnly, Category = "XR")
355
356 UPROPERTY(BlueprintReadOnly, Category = "XR")
358 UPROPERTY(BlueprintReadOnly, Category = "XR")
360};
361
362USTRUCT(BlueprintType)
364{
366
367 // The state is valid if a pose has ever been provided.
368 UPROPERTY(BlueprintReadOnly, Category = "XR")
369 bool bValid = false;
370 UPROPERTY(BlueprintReadOnly, Category = "XR")
371 FName DeviceName;
372 UPROPERTY(BlueprintReadOnly, Category = "XR")
373 FGuid ApplicationInstanceID;
374
375 UPROPERTY(BlueprintReadOnly, Category = "XR")
377
378 UPROPERTY(BlueprintReadOnly, Category = "XR")
380
381 // If a controller pose has been provided this frame the TrackingStatus will be Tracked.
382 UPROPERTY(BlueprintReadOnly, Category = "XR")
384
385 UPROPERTY(BlueprintReadOnly, Category = "XR")
387
388 UPROPERTY(BlueprintReadOnly, Category = "XR")
389 FVector ControllerLocation = FVector(0.0f);
390
391 UPROPERTY(BlueprintReadOnly, Category = "XR")
392 FQuat ControllerRotation = FQuat(EForceInit::ForceInitToZero);;
393
394 // These are used by the XRVisualizationFunctionLibrary, and are not exposed to blueprint.
395 UPROPERTY()
396 FVector GripUnrealSpaceLocation = FVector(0.0f);
397 UPROPERTY()
398 FQuat GripUnrealSpaceRotation = FQuat(EForceInit::ForceInitToZero);;
399};
400
401USTRUCT(BlueprintType)
403{
405
406 // The state is valid if poses have ever been provided.
407 UPROPERTY(BlueprintReadOnly, Category = "XR")
408 bool bValid = false;
409 UPROPERTY(BlueprintReadOnly, Category = "XR")
410 FName DeviceName;
411 UPROPERTY(BlueprintReadOnly, Category = "XR")
412 FGuid ApplicationInstanceID;
413
414 UPROPERTY(BlueprintReadOnly, Category = "XR")
416
417 UPROPERTY(BlueprintReadOnly, Category = "XR")
419
420 UPROPERTY(BlueprintReadOnly, Category = "XR")
422
423 // The indices of this array are the values of EHandKeypoint (Palm, Wrist, ThumbMetacarpal, etc).
424 UPROPERTY(BlueprintReadOnly, Category = "XR")
425 TArray<FVector> HandKeyLocations;
426
427 // The indices of this array are the values of EHandKeypoint (Palm, Wrist, ThumbMetacarpal, etc).
428 UPROPERTY(BlueprintReadOnly, Category = "XR")
429 TArray<FQuat> HandKeyRotations;
430
431 // The indices of this array are the values of EHandKeypoint (Palm, Wrist, ThumbMetacarpal, etc).
432 UPROPERTY(BlueprintReadOnly, Category = "XR")
433 TArray<float> HandKeyRadii;
434};
EForceInit
Definition CoreMiscDefines.h:154
@ ForceInitToZero
Definition CoreMiscDefines.h:156
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
EXRSpaceType
Definition HeadMountedDisplayTypes.h:320
EXRVisualType
Definition HeadMountedDisplayTypes.h:308
const int32 EHandKeypointCount
Definition HeadMountedDisplayTypes.h:290
EXRControllerPoseType
Definition HeadMountedDisplayTypes.h:332
ESpectatorScreenMode
Definition HeadMountedDisplayTypes.h:145
const uint8 ESpectatorScreenModeFirst
Definition HeadMountedDisplayTypes.h:155
const uint8 ESpectatorScreenModeLast
Definition HeadMountedDisplayTypes.h:156
EXRTrackedDeviceType
Definition HeadMountedDisplayTypes.h:236
EHandKeypoint
Definition HeadMountedDisplayTypes.h:261
ETrackingStatus
Definition IMotionController.h:16
EControllerHand
Definition InputCoreTypes.h:17
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
#define UE_LOG(CategoryName, Verbosity, Format,...)
Definition LogMacros.h:270
UE::Math::TIntRect< int32 > FIntRect
Definition MathFwd.h:133
const bool
Definition NetworkReplayStreaming.h:178
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition HeadMountedDisplayTypes.h:34
HEADMOUNTEDDISPLAY_API ~FHMDViewMesh()
Definition HeadMountedDisplayTypes.cpp:18
bool IsValid() const
Definition HeadMountedDisplayTypes.h:46
unsigned NumTriangles
Definition HeadMountedDisplayTypes.h:58
HEADMOUNTEDDISPLAY_API void BuildMesh(const FVector2D Positions[], uint32 VertexCount, EHMDMeshType MeshType)
Definition HeadMountedDisplayTypes.cpp:22
FBufferRHIRef VertexBufferRHI
Definition HeadMountedDisplayTypes.h:53
unsigned NumIndices
Definition HeadMountedDisplayTypes.h:57
EHMDMeshType
Definition HeadMountedDisplayTypes.h:38
@ MT_HiddenArea
Definition HeadMountedDisplayTypes.h:39
@ MT_VisibleArea
Definition HeadMountedDisplayTypes.h:40
unsigned NumVertices
Definition HeadMountedDisplayTypes.h:56
FBufferRHIRef IndexBufferRHI
Definition HeadMountedDisplayTypes.h:54
HEADMOUNTEDDISPLAY_API FHMDViewMesh()
Definition HeadMountedDisplayTypes.cpp:12
Definition NameTypes.h:617
Definition RHICommandList.h:4626
Definition Array.h:670
Definition BlueprintFunctionLibrary.h:16
Definition HeadMountedDisplayTypes.h:294
Definition Object.h:95
Definition HeadMountedDisplayTypes.h:80
Type
Definition HeadMountedDisplayTypes.h:82
Definition HeadMountedDisplayTypes.h:96
Type
Definition HeadMountedDisplayTypes.h:98
Definition HeadMountedDisplayTypes.h:66
Type
Definition HeadMountedDisplayTypes.h:68
Definition HeadMountedDisplayTypes.h:111
Type
Definition HeadMountedDisplayTypes.h:113
@ NoValidViewport
Definition HeadMountedDisplayTypes.h:116
@ NoTrackingSystem
Definition HeadMountedDisplayTypes.h:114
@ MiscFailure
Definition HeadMountedDisplayTypes.h:117
@ FeatureNotSupported
Definition HeadMountedDisplayTypes.h:115
Definition HeadMountedDisplayTypes.h:127
Type
Definition HeadMountedDisplayTypes.h:129
@ IsTablet
Definition HeadMountedDisplayTypes.h:132
@ IsAR
Definition HeadMountedDisplayTypes.h:131
@ SupportsHandTracking
Definition HeadMountedDisplayTypes.h:134
@ IsHeadMounted
Definition HeadMountedDisplayTypes.h:133
@ false
Definition radaudio_common.h:23
Definition CommonRenderResources.h:30
Definition Stack.h:114
Definition Guid.h:109
Definition HeadMountedDisplayTypes.h:159
FVector2D TextureRectMin
Definition HeadMountedDisplayTypes.h:227
FSpectatorScreenModeTexturePlusEyeLayout()
Definition HeadMountedDisplayTypes.h:160
FIntRect GetScaledTextureRect(int SizeX, int SizeY) const
Definition HeadMountedDisplayTypes.h:220
bool bUseAlpha
Definition HeadMountedDisplayTypes.h:230
bool IsValid() const
Definition HeadMountedDisplayTypes.h:180
FVector2D EyeRectMin
Definition HeadMountedDisplayTypes.h:225
FVector2D TextureRectMax
Definition HeadMountedDisplayTypes.h:228
FSpectatorScreenModeTexturePlusEyeLayout(FVector2D InEyeRectMin, FVector2D InEyeRectMax, FVector2D InTextureRectMin, FVector2D InTextureRectMax, bool InbDrawEyeFirst, bool InbClearBlack, bool InbUseAlpha)
Definition HeadMountedDisplayTypes.h:170
bool bClearBlack
Definition HeadMountedDisplayTypes.h:231
FIntRect GetScaledEyeRect(int SizeX, int SizeY) const
Definition HeadMountedDisplayTypes.h:215
bool bDrawEyeFirst
Definition HeadMountedDisplayTypes.h:229
FVector2D EyeRectMax
Definition HeadMountedDisplayTypes.h:226
Definition HeadMountedDisplayTypes.h:343
GENERATED_USTRUCT_BODY()
Definition HeadMountedDisplayTypes.h:403
Definition HeadMountedDisplayTypes.h:364
int32 IntType
Definition IntRect.h:25
T Y
Definition Vector2D.h:52
T X
Definition Vector2D.h:49