Skip to content
Snippets Groups Projects
Select Git revision
  • a6899eada6bc9b5cc60d97ba933f7ad9f9b08480
  • 5.4 default protected
  • 5.5
  • dev/5.5
  • dev/5.4
  • dev/5.3_downgrade
  • feature/experimenttime_hack
  • 5.3 protected
  • _IntenSelect5.3
  • IntenSelect5.3
  • 4.27 protected
  • 4.26 protected
  • 5.0 protected
  • 4.22 protected
  • 4.21 protected
  • UE5.4-2024.1
  • UE5.4-2024.1-rc1
  • UE5.3-2023.1-rc3
  • UE5.3-2023.1-rc2
  • UE5.3-2023.1-rc
20 results

Interior.uasset

Blame
  • RWTHVRUtilities.cpp 1.50 KiB
    #include "Utility/RWTHVRUtilities.h"
    
    #include "AudioDevice.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()
    {
    	// In editor builds: checks for EdEngine->IsVRPreviewActive()
    	// In packaged builds: checks for `-vr` in commandline or bStartInVR in UGeneralProjectSettings
    	return FAudioDevice::CanUseVRAudioDevice();
    }
    
    bool URWTHVRUtilities::IsRoomMountedMode()
    {
    #if PLATFORM_SUPPORTS_CLUSTER
    	return URWTHVRClusterUtilities::IsRoomMountedMode();
    #endif
    	return false;
    }
    
    bool URWTHVRUtilities::IsPrimaryNode()
    {
    #if PLATFORM_SUPPORTS_CLUSTER
    	return URWTHVRClusterUtilities::IsPrimaryNode();
    #endif
    	return false;
    }
    
    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);
    }