UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
StereoRendering.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 StereoRendering.h: Abstract stereoscopic rendering interface
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
10#include "RenderGraphFwd.h"
11
12class FSceneView;
13class IStereoLayers;
15
26
38
40{
41public:
42 virtual ~IStereoRendering() { }
43
47 virtual bool IsStereoEnabled() const = 0;
48
53 virtual bool IsStereoEnabledOnNextFrame() const { return IsStereoEnabled(); }
54
59 virtual bool EnableStereo(bool stereo = true) = 0;
60
65 virtual int32 GetDesiredNumberOfViews(bool bStereoRequested) const { return (bStereoRequested) ? 2 : 1; }
66
71 {
74 else if (ViewIndex == 0)
76 else
78 }
79
87
91 static ENGINE_API bool IsStereoEyeView(const FSceneView& View);
92
100
104 static ENGINE_API bool IsAPrimaryView(const FSceneView& View);
105
113
117 static ENGINE_API bool IsASecondaryView(const FSceneView& View);
118
122 virtual uint32 GetLODViewIndex() const
123 {
124 return 0;
125 }
126
130 virtual bool IsStandaloneStereoOnlyDevice() const
131 {
132 return false;
133 }
134
138 virtual void AdjustViewRect(const int32 ViewIndex, int32& X, int32& Y, uint32& SizeX, uint32& SizeY) const = 0;
139
143 virtual void SetFinalViewRect(class FRHICommandListImmediate& RHICmdList, const int32 ViewIndex, const FIntRect& FinalViewRect) {}
144
149 virtual FVector2D GetTextSafeRegionBounds() const { return FVector2D(0.75f, 0.75f); }
150
155 virtual void CalculateStereoViewOffset(const int32 ViewIndex, FRotator& ViewRotation, const float WorldToMeters, FVector& ViewLocation) = 0;
156
161 virtual FMatrix GetStereoProjectionMatrix(const int32 ViewIndex) const = 0;
162
166 virtual void InitCanvasFromView(class FSceneView* InView, class UCanvas* Canvas) = 0;
167
168 // Renders texture into a backbuffer. Could be empty if no rendertarget texture is used, or if direct-rendering
169 // through RHI bridge is implemented.
170 UE_DEPRECATED(5.6, "Use the FRDGBuilder overload instead")
171 virtual void RenderTexture_RenderThread(class FRHICommandListImmediate& RHICmdList, class FRHITexture* BackBuffer, class FRHITexture* SrcTexture, FVector2D WindowSize) const final {}
172 virtual ENGINE_API void RenderTexture_RenderThread(class FRDGBuilder& GraphBuilder, FRDGTextureRef BackBuffer, FRDGTextureRef SrcTexture, FVector2f WindowSize) const;
173
178
182 virtual IStereoLayers* GetStereoLayers () { return nullptr; }
183
184
186 virtual bool OverrideFinalPostprocessSettings(struct FPostProcessSettings* OverridePostProcessingSettings, const enum EStereoscopicPass StereoPassType, const int32 StereoViewIndex, float& BlendWeight) { return false; }
188
192 static ENGINE_API bool IsStartInVR();
193};
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
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
#define X(Name, Desc)
Definition FormatStringSan.h:47
UE::Math::TVector2< double > FVector2D
Definition MathFwd.h:48
EStereoscopicEye
Definition StereoRendering.h:31
@ eSSE_RIGHT_EYE
Definition StereoRendering.h:34
@ eSSE_LEFT_EYE_SIDE
Definition StereoRendering.h:35
@ eSSE_RIGHT_EYE_SIDE
Definition StereoRendering.h:36
@ eSSE_LEFT_EYE
Definition StereoRendering.h:33
@ eSSE_MONOSCOPIC
Definition StereoRendering.h:32
EStereoscopicPass
Definition StereoRendering.h:21
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition RenderGraphBuilder.h:49
Definition RenderGraphResources.h:571
Definition RHICommandList.h:4626
Definition RHIResources.h:2153
Definition SceneView.h:1425
Definition IStereoLayers.h:18
Definition StereoRenderTargetManager.h:23
Definition StereoRendering.h:40
virtual FMatrix GetStereoProjectionMatrix(const int32 ViewIndex) const =0
virtual void SetFinalViewRect(class FRHICommandListImmediate &RHICmdList, const int32 ViewIndex, const FIntRect &FinalViewRect)
Definition StereoRendering.h:143
virtual bool IsStereoEnabled() const =0
virtual bool IsStereoEnabledOnNextFrame() const
Definition StereoRendering.h:53
virtual void AdjustViewRect(const int32 ViewIndex, int32 &X, int32 &Y, uint32 &SizeX, uint32 &SizeY) const =0
static bool IsASecondaryPass(EStereoscopicPass Pass)
Definition StereoRendering.h:109
virtual void RenderTexture_RenderThread(class FRHICommandListImmediate &RHICmdList, class FRHITexture *BackBuffer, class FRHITexture *SrcTexture, FVector2D WindowSize) const final
Definition StereoRendering.h:171
virtual uint32 GetLODViewIndex() const
Definition StereoRendering.h:122
static bool IsStereoEyePass(EStereoscopicPass Pass)
Definition StereoRendering.h:83
static bool IsAPrimaryPass(EStereoscopicPass Pass)
Definition StereoRendering.h:96
virtual bool EnableStereo(bool stereo=true)=0
static ENGINE_API bool IsAPrimaryView(const FSceneView &View)
Definition StereoRendering.cpp:22
virtual FVector2D GetTextSafeRegionBounds() const
Definition StereoRendering.h:149
static ENGINE_API bool IsASecondaryView(const FSceneView &View)
Definition StereoRendering.cpp:27
virtual ~IStereoRendering()
Definition StereoRendering.h:42
virtual void StartFinalPostprocessSettings(struct FPostProcessSettings *StartPostProcessingSettings, const enum EStereoscopicPass StereoPassType, const int32 StereoViewIndex)
Definition StereoRendering.h:185
virtual int32 GetDesiredNumberOfViews(bool bStereoRequested) const
Definition StereoRendering.h:65
virtual bool OverrideFinalPostprocessSettings(struct FPostProcessSettings *OverridePostProcessingSettings, const enum EStereoscopicPass StereoPassType, const int32 StereoViewIndex, float &BlendWeight)
Definition StereoRendering.h:186
virtual IStereoRenderTargetManager * GetRenderTargetManager()
Definition StereoRendering.h:177
virtual bool IsStandaloneStereoOnlyDevice() const
Definition StereoRendering.h:130
virtual void EndFinalPostprocessSettings(struct FPostProcessSettings *FinalPostProcessingSettings, const enum EStereoscopicPass StereoPassType, const int32 StereoViewIndex)
Definition StereoRendering.h:187
static ENGINE_API bool IsStereoEyeView(const FSceneView &View)
Definition StereoRendering.cpp:17
virtual IStereoLayers * GetStereoLayers()
Definition StereoRendering.h:182
virtual void InitCanvasFromView(class FSceneView *InView, class UCanvas *Canvas)=0
static ENGINE_API bool IsStartInVR()
Definition StereoRendering.cpp:55
virtual void CalculateStereoViewOffset(const int32 ViewIndex, FRotator &ViewRotation, const float WorldToMeters, FVector &ViewLocation)=0
virtual EStereoscopicPass GetViewPassForIndex(bool bStereoRequested, int32 ViewIndex) const
Definition StereoRendering.h:70
Definition Canvas.h:159
Definition Scene.h:693