Agrarsense
UnrealWindowViewport.cpp
Go to the documentation of this file.
1// Copyright (c) 2023 FrostBit Software Lab at the Lapland University of Applied Sciences
2//
3// This work is licensed under the terms of the MIT license.
4// For a copy, see <https://opensource.org/licenses/MIT>.
5
7
8void SUnrealWindowViewport::Construct(const FArguments& InArgs)
9{
10 // Create viewport widget
11 Viewport = SNew(SViewport)
12 .IsEnabled(true)
13 .EnableGammaCorrection(false)
14 .ShowEffectWhenDisabled(false)
15 .EnableBlending(true);
16 //.ToolTip(SNew(SToolTip).Text(FText::FromString("SUnrealWindowViewport")));
17
18 // Create viewport client
19 ViewportClient = MakeShareable(new FUnrealWindowViewportClient());
20
21 // Create scene viewport
22 SceneViewport = MakeShareable(new FSceneViewport(ViewportClient.Get(), Viewport));
23
24 // Assign SceneViewport to Viewport widget. Needed for rendering
25 Viewport->SetViewportInterface(SceneViewport.ToSharedRef());
26
27 // Assign Viewport widget for our custom Viewport
28 this->ChildSlot
29 [
30 Viewport.ToSharedRef()
31 ];
32}
33
34void SUnrealWindowViewport::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime)
35{
36 if (DrawToScreen)
37 {
38 SceneViewport->Draw();
39 }
40}
void Construct(const FArguments &InArgs)
virtual void Tick(const FGeometry &AllottedGeometry, const double InCurrentTime, const float InDeltaTime) override
TSharedPtr< FSceneViewport > SceneViewport
TSharedPtr< FUnrealWindowViewportClient > ViewportClient
TSharedPtr< SViewport > Viewport