You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #rb none #ROBOMERGE-OWNER: ryan.durand #ROBOMERGE-AUTHOR: ryan.durand #ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900 #ROBOMERGE-BOT: (v613-10869866) [CL 10870549 by ryan durand in Main branch]
93 lines
2.4 KiB
C++
93 lines
2.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "XRLoadingScreenFunctionLibrary.h"
|
|
#include "EngineGlobals.h"
|
|
#include "TextureResource.h"
|
|
#include "Engine/Texture.h"
|
|
#include "Engine/Engine.h"
|
|
#include "IXRTrackingSystem.h"
|
|
|
|
static IXRLoadingScreen* GetLoadingScreen()
|
|
{
|
|
if (GEngine && GEngine->XRSystem.IsValid())
|
|
{
|
|
return GEngine->XRSystem->GetLoadingScreen();
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
UXRLoadingScreenFunctionLibrary::UXRLoadingScreenFunctionLibrary(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
}
|
|
|
|
void UXRLoadingScreenFunctionLibrary::SetLoadingScreen(class UTexture* Texture, FVector2D Scale, FVector Offset, bool bShowLoadingMovie, bool bShowOnSet)
|
|
{
|
|
IXRLoadingScreen* LoadingSrcreen = GetLoadingScreen();
|
|
if (LoadingSrcreen && Texture && Texture->Resource)
|
|
{
|
|
LoadingSrcreen->ClearSplashes();
|
|
const bool bIsExternal = Texture->GetMaterialType() == MCT_TextureExternal;
|
|
IXRLoadingScreen::FSplashDesc Splash;
|
|
Splash.Transform = FTransform(Offset);
|
|
Splash.QuadSize = Scale;
|
|
Splash.bIsDynamic = bShowLoadingMovie || bIsExternal;
|
|
Splash.bIsExternal = bIsExternal;
|
|
Splash.Texture = Texture->Resource->TextureRHI;
|
|
LoadingSrcreen->AddSplash(Splash);
|
|
|
|
if (bShowOnSet)
|
|
{
|
|
LoadingSrcreen->ShowLoadingScreen();
|
|
}
|
|
}
|
|
}
|
|
|
|
void UXRLoadingScreenFunctionLibrary::ClearLoadingScreenSplashes()
|
|
{
|
|
IXRLoadingScreen* LoadingSrcreen = GetLoadingScreen();
|
|
if (LoadingSrcreen)
|
|
{
|
|
LoadingSrcreen->ClearSplashes();
|
|
}
|
|
|
|
}
|
|
|
|
void UXRLoadingScreenFunctionLibrary::AddLoadingScreenSplash(class UTexture* Texture, FVector Translation, FRotator Rotation, FVector2D Size, FRotator DeltaRotation, bool bClearBeforeAdd)
|
|
{
|
|
IXRLoadingScreen* LoadingSrcreen = GetLoadingScreen();
|
|
if (LoadingSrcreen && Texture && Texture->Resource)
|
|
{
|
|
if (bClearBeforeAdd)
|
|
{
|
|
LoadingSrcreen->ClearSplashes();
|
|
}
|
|
|
|
IXRLoadingScreen::FSplashDesc Splash;
|
|
Splash.Texture = Texture->Resource->TextureRHI;
|
|
Splash.QuadSize = Size;
|
|
Splash.Transform = FTransform(Rotation, Translation);
|
|
Splash.DeltaRotation = FQuat(DeltaRotation);
|
|
LoadingSrcreen->AddSplash(Splash);
|
|
}
|
|
}
|
|
|
|
void UXRLoadingScreenFunctionLibrary::ShowLoadingScreen()
|
|
{
|
|
IXRLoadingScreen* LoadingSrcreen = GetLoadingScreen();
|
|
if (LoadingSrcreen)
|
|
{
|
|
LoadingSrcreen->ShowLoadingScreen();
|
|
}
|
|
}
|
|
|
|
void UXRLoadingScreenFunctionLibrary::HideLoadingScreen()
|
|
{
|
|
IXRLoadingScreen* LoadingSrcreen = GetLoadingScreen();
|
|
if (LoadingSrcreen)
|
|
{
|
|
LoadingSrcreen->HideLoadingScreen();
|
|
}
|
|
}
|