5#include "CoreMinimal.h"
6#include "Engine/Engine.h"
9#include "Components/WidgetComponent.h"
10#include "Components/StereoLayerComponent.h"
11#include "Slate/WidgetRenderer.h"
12#include "Blueprint/UserWidget.h"
13#include "Components/StereoLayerComponent.h"
14#include "Engine/TextureRenderTarget2D.h"
16#include "Engine/GameViewportClient.h"
17#include "StereoLayerShapes.h"
19#include "VRStereoWidgetComponent.generated.h"
24UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent), ClassGroup = (
VRExpansionPlugin), HideCategories = (
"Stereoscopic Properties", Collision))
33 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "WidgetSettings", meta = (ExposeOnSpawn = true))
37 UPROPERTY(Transient, DuplicateTransient)
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "WidgetSettings", meta = (ExposeOnSpawn = true))
42 bool bDrawAtDesiredSize;
45 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "WidgetSettings", meta = (ExposeOnSpawn = true))
46 float WidgetRenderScale;
49 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "WidgetSettings", meta = (ExposeOnSpawn = true))
50 float WidgetRenderGamma;
53 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "WidgetSettings", meta = (ExposeOnSpawn = true))
54 bool bUseGammaCorrection;
57 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "WidgetSettings", meta = (ExposeOnSpawn = true))
58 FLinearColor RenderTargetClearColor;
61 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "WidgetSettings", meta = (ExposeOnSpawn = true))
62 bool bDrawWithoutStereo;
65 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "WidgetSettings", meta = (ExposeOnSpawn = true))
72 TSharedPtr<SWidget> SlateWidget;
74 class FWidgetRenderer* WidgetRenderer;
77 UPROPERTY(BlueprintReadOnly, Transient, DuplicateTransient, Category = "WidgetSettings")
78 UTextureRenderTarget2D* RenderTarget;
81 TSharedPtr<class SVirtualWindow> SlateWindow;
83 virtual
void TickComponent(
float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
84 virtual
void BeginPlay() override;
85 virtual
void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
86 virtual
void DestroyComponent(
bool bPromoteChildren) override;
88 UFUNCTION(BlueprintCallable, Category = "WidgetSettings")
89 void SetWidgetAndInit(TSubclassOf<
UUserWidget> NewWidgetClass);
91 void OnLevelRemovedFromWorld(ULevel* InLevel, UWorld* InWorld);
93 void RenderWidget(
float DeltaTime);
94 void ReleaseResources();
103UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent), ClassGroup = (
VRExpansionPlugin))
111 friend class FStereoLayerComponentVisualizer;
117 UPROPERTY(EditAnywhere, BlueprintReadOnly, NoClear, Instanced, Category = "StereoLayer",
DisplayName = "Stereo Layer Shape")
118 UStereoLayerShape* Shape;
120 void BeginDestroy() override;
121 void OnUnregister() override;
122 virtual
void TickComponent(
float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
123 virtual
void DrawWidgetToRenderTarget(
float DeltaTime) override;
127 virtual
void UpdateRenderTarget(FIntPoint DesiredRenderTargetSize) override;
133 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "StereoLayer")
134 bool bRenderBothStereoAndWorld;
137 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "StereoLayer")
138 bool bDrawWithoutStereo;
141 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "StereoLayer")
142 bool bUseEpicsWorldLockedStereo;
146 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "StereoLayer")
147 bool bDelayForRenderThread;
150 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "StereoLayer")
157 UFUNCTION(BlueprintCallable, Category = "Components|Stereo Layer")
158 void SetPriority(int32 InPriority);
161 UFUNCTION(BlueprintCallable, Category = "Components|Stereo Layer")
162 int32 GetPriority()
const {
return Priority; }
165 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category =
"StereoLayer")
166 uint32 bSupportsDepth : 1;
169 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "StereoLayer")
170 uint32 bNoAlphaChannel : 1;
173 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "StereoLayer")
174 uint32 bQuadPreserveTextureRatio : 1;
217 UPROPERTY(EditAnywhere, BlueprintReadOnly, export, Category = "StereoLayer")
220 bool bShouldCreateProxy;
225 bool bDirtyRenderTarget;
228 bool bTextureNeedsUpdate;
234 FTransform LastTransform;