Skip to content
Snippets Groups Projects
Select Git revision
  • ddc96ece7e09beacd716c5314777f519d5ebb2d8
  • main default protected
  • leveleditor
  • david-author
  • clang-tidy-cleanup
  • architecture-refactoring
  • cleanUpMenus
  • doxygen-cleanup
  • project-structure-refactoring
  • interpolation
  • buildingFeatures
  • win_end_screen
  • helpMenu
  • leveleditor-placement
  • text-rendering
  • updated_unit_contextmenu
  • level-from-commandline
  • unit_contextmenu
  • player
  • engine-scaling
  • clang-tidy
21 results

CMakeLists.txt

Blame
  • RWTHVRUtilities.cpp 1.43 KiB
    #include "Utility/RWTHVRUtilities.h"
    
    #include "AudioDevice.h"
    #include "HeadMountedDisplayFunctionLibrary.h"
    #include "IHeadMountedDisplay.h"
    #include "IXRTrackingSystem.h"
    #include "Engine/Engine.h"
    #include "Engine/LocalPlayer.h"
    #include "Kismet/GameplayStatics.h"
    
    #if PLATFORM_SUPPORTS_CLUSTER
    #include "Utility/RWTHVRClusterUtilities.h"
    #endif
    
    
    DEFINE_LOG_CATEGORY(Toolkit);
    
    bool URWTHVRUtilities::IsDesktopMode() { return !IsRoomMountedMode() && !IsHeadMountedMode(); }
    
    bool URWTHVRUtilities::IsHeadMountedMode() { return UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled(); }
    
    bool URWTHVRUtilities::IsRoomMountedMode()
    {
    #if PLATFORM_SUPPORTS_CLUSTER
    	return URWTHVRClusterUtilities::IsRoomMountedMode();
    #else
    	return false;
    #endif
    }
    
    bool URWTHVRUtilities::IsPrimaryNode()
    {
    #if PLATFORM_SUPPORTS_CLUSTER
    	return URWTHVRClusterUtilities::IsPrimaryNode();
    #else
    	return false;
    #endif
    }
    
    float URWTHVRUtilities::GetEyeDistance()
    {
    	if (IsHeadMountedMode())
    	{
    		return GEngine->XRSystem->GetHMDDevice()->GetInterpupillaryDistance();
    	}
    	return 0;
    }
    
    void URWTHVRUtilities::ShowErrorAndQuit(UWorld* WorldContext, const FString& Message)
    {
    	UE_LOG(Toolkit, Error, TEXT("%s"), *Message)
    #if WITH_EDITOR
    	const FText Title = FText::FromString(FString("RUNTIME ERROR"));
    	FMessageDialog::Open(EAppMsgType::Ok, FText::FromString(Message), Title);
    #endif
    	UKismetSystemLibrary::QuitGame(WorldContext, nullptr, EQuitPreference::Quit, false);
    }