Agrarsense
Public Member Functions | Public Attributes | List of all members
FUnrealWindowViewportClient Class Reference

#include <UnrealWindowViewportClient.h>

Inheritance diagram for FUnrealWindowViewportClient:
Inheritance graph
[legend]
Collaboration diagram for FUnrealWindowViewportClient:
Collaboration graph
[legend]

Public Member Functions

virtual void Draw (FViewport *Viewport, FCanvas *Canvas) override
 
virtual bool InputKey (FViewport *Viewport, int32 ControllerId, FKey Key, EInputEvent Event, float AmountDepressed=1.0f, bool bGamepad=false) override
 
virtual bool InputAxis (FViewport *Viewport, int32 ControllerId, FKey Key, float Delta, float DeltaTime, int32 NumSamples=1, bool bGamepad=false) override
 
virtual bool InputGesture (FViewport *Viewport, EGestureEvent GestureType, const FVector2D &GestureDelta, bool bIsDirectionInvertedFromDevice) override
 
virtual UWorld * GetWorld () const override
 
virtual void RedrawRequested (FViewport *Viewport) override
 

Public Attributes

TWeakObjectPtr< UTextureRenderTarget2D > TextRenderTarget2D
 
FTexture * texture = nullptr
 
int width = 1280
 
int height = 720
 

Detailed Description

Custom Viewport client, where we have access to canvas on Draw function. This is the place where we issue canvas draw call to present SceneCaptureComponent Texture to custom window

Definition at line 20 of file UnrealWindowViewportClient.h.

Member Function Documentation

◆ Draw()

void FUnrealWindowViewportClient::Draw ( FViewport *  Viewport,
FCanvas *  Canvas 
)
overridevirtual

FViewportClient interface

Definition at line 11 of file UnrealWindowViewportClient.cpp.

12{
13 if (texture != nullptr)
14 {
15 // Draw texture to canvas
16 FCanvasTileItem TileItem(FVector2D(0, 0), texture, FVector2D(width, height), FLinearColor::White);
17 TileItem.BlendMode = ESimpleElementBlendMode::SE_BLEND_Opaque;
18 Canvas->DrawItem(TileItem);
19 }
20 else
21 {
22 Canvas->Clear(FLinearColor::Black);
23 }
24}

References height, texture, and width.

◆ GetWorld()

virtual UWorld * FUnrealWindowViewportClient::GetWorld ( ) const
inlineoverridevirtual

Definition at line 30 of file UnrealWindowViewportClient.h.

30{ return nullptr; }

◆ InputAxis()

bool FUnrealWindowViewportClient::InputAxis ( FViewport *  Viewport,
int32  ControllerId,
FKey  Key,
float  Delta,
float  DeltaTime,
int32  NumSamples = 1,
bool  bGamepad = false 
)
overridevirtual

Definition at line 31 of file UnrealWindowViewportClient.cpp.

32{
33 return false;
34}

◆ InputGesture()

bool FUnrealWindowViewportClient::InputGesture ( FViewport *  Viewport,
EGestureEvent  GestureType,
const FVector2D &  GestureDelta,
bool  bIsDirectionInvertedFromDevice 
)
overridevirtual

Definition at line 36 of file UnrealWindowViewportClient.cpp.

37{
38 return false;
39}

◆ InputKey()

bool FUnrealWindowViewportClient::InputKey ( FViewport *  Viewport,
int32  ControllerId,
FKey  Key,
EInputEvent  Event,
float  AmountDepressed = 1.0f,
bool  bGamepad = false 
)
overridevirtual

Definition at line 26 of file UnrealWindowViewportClient.cpp.

27{
28 return false;
29}

◆ RedrawRequested()

virtual void FUnrealWindowViewportClient::RedrawRequested ( FViewport *  Viewport)
inlineoverridevirtual

Definition at line 31 of file UnrealWindowViewportClient.h.

31{ Viewport->Draw(); }

Member Data Documentation

◆ height

int FUnrealWindowViewportClient::height = 720

Definition at line 36 of file UnrealWindowViewportClient.h.

Referenced by Draw().

◆ TextRenderTarget2D

TWeakObjectPtr<UTextureRenderTarget2D> FUnrealWindowViewportClient::TextRenderTarget2D

Definition at line 33 of file UnrealWindowViewportClient.h.

◆ texture

FTexture* FUnrealWindowViewportClient::texture = nullptr

Definition at line 34 of file UnrealWindowViewportClient.h.

Referenced by Draw().

◆ width

int FUnrealWindowViewportClient::width = 1280

Definition at line 35 of file UnrealWindowViewportClient.h.

Referenced by Draw().


The documentation for this class was generated from the following files: