Skip to content
Snippets Groups Projects
Commit 6edddcbc authored by Simon Oehrl's avatar Simon Oehrl
Browse files

Merge branch 'feature/remove_n_display_dependency' into '4.26'

Remove nDisplay Dependency

See merge request VR-Group/unreal-development/plugins/rwth-vr-toolkit!5
parents 3af3a457 09fccd69
No related branches found
No related tags found
1 merge request!5Remove nDisplay Dependency
Pipeline #167371 passed
Showing
with 293 additions and 155 deletions
No preview for this file type
...@@ -18,7 +18,20 @@ ...@@ -18,7 +18,20 @@
{ {
"Name": "Calibratio", "Name": "Calibratio",
"Type": "Runtime", "Type": "Runtime",
"LoadingPhase": "Default" "LoadingPhase": "Default",
"WhitelistPlatforms": [
"Win64",
"Linux"
]
},
{
"Name": "RWTHVRCluster",
"Type": "Runtime",
"LoadingPhase": "Default",
"WhitelistPlatforms": [
"Win64",
"Linux"
]
}, },
{ {
"Name": "RWTHVRToolkit", "Name": "RWTHVRToolkit",
......
...@@ -62,7 +62,7 @@ private: ...@@ -62,7 +62,7 @@ private:
FVector LastVisiblePosition = FVector(NAN, NAN, NAN); FVector LastVisiblePosition = FVector(NAN, NAN, NAN);
bool FirstPositionSet = false; bool FirstPositionSet = false;
uint32 AcceptedAbscenceTime = 500u; // in Milliseconds uint32 AcceptedAbscenceTime = 500u; // in Milliseconds
UPROPERTY() UDisplayClusterSceneComponent* TrackedClusterComponent = nullptr; UPROPERTY() USceneComponent* TrackedClusterComponent = nullptr;
//Overlay //Overlay
TSubclassOf<class UCalibratioOverlay> Overlay_Class; TSubclassOf<class UCalibratioOverlay> Overlay_Class;
......
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "Cluster/CAVEOverlay/CAVEOverlay.h" #include "CAVEOverlay/CAVEOverlay.h"
void FCAVEOverlay::Register() void FCAVEOverlay::Register()
{ {
......
#include "Cluster/CAVEOverlay/CAVEOverlayController.h" #include "CAVEOverlay/CAVEOverlayController.h"
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Cluster/CAVEOverlay/DoorOverlayData.h" #include "CAVEOverlay/DoorOverlayData.h"
#include "IDisplayCluster.h" #include "IDisplayCluster.h"
#include "IXRTrackingSystem.h" #include "IXRTrackingSystem.h"
#include "Cluster/IDisplayClusterClusterManager.h" #include "Cluster/IDisplayClusterClusterManager.h"
......
#include "Cluster/ClusterConsole.h" #include "ClusterConsole.h"
#include "IDisplayCluster.h" #include "IDisplayCluster.h"
#include "Cluster/DisplayClusterClusterEvent.h" #include "Cluster/DisplayClusterClusterEvent.h"
......
#include "RWTHVRCluster.h"
#define LOCTEXT_NAMESPACE "FRWTHVRClusterModule"
void FRWTHVRClusterModule::StartupModule ()
{
ClusterConsole.Register();
CAVEOverlay.Register();
}
void FRWTHVRClusterModule::ShutdownModule()
{
ClusterConsole.Unregister();
CAVEOverlay.Unregister();
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FRWTHVRClusterModule, RWTHVRCluster)
\ No newline at end of file
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Engine/World.h" #include "Engine/World.h"
#include "Cluster/CAVEOverlay/CAVEOverlaySettings.h" #include "CAVEOverlay/CAVEOverlaySettings.h"
#include "Cluster/CAVEOverlay/CAVEOverlayController.h" #include "CAVEOverlay/CAVEOverlayController.h"
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
#include "CAVEOverlay.generated.h" #include "CAVEOverlay.generated.h"
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* Adds the warning tape, which appears if the user gets too close to the wall for the aixCAVE * Adds the warning tape, which appears if the user gets too close to the wall for the aixCAVE
*/ */
USTRUCT() USTRUCT()
struct RWTHVRTOOLKIT_API FCAVEOverlay struct RWTHVRCLUSTER_API FCAVEOverlay
{ {
GENERATED_BODY() GENERATED_BODY()
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "GameFramework/Actor.h" #include "GameFramework/Actor.h"
#include "Cluster/CAVEOverlay/DoorOverlayData.h" #include "CAVEOverlay/DoorOverlayData.h"
#include "Cluster/IDisplayClusterClusterManager.h" #include "Cluster/IDisplayClusterClusterManager.h"
#include "Cluster/DisplayClusterClusterEvent.h" #include "Cluster/DisplayClusterClusterEvent.h"
#include "CAVEOverlayController.generated.h" #include "CAVEOverlayController.generated.h"
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
DECLARE_LOG_CATEGORY_EXTERN(LogCAVEOverlay, Log, All); DECLARE_LOG_CATEGORY_EXTERN(LogCAVEOverlay, Log, All);
UCLASS() UCLASS()
class RWTHVRTOOLKIT_API ACAVEOverlayController : public AActor class RWTHVRCLUSTER_API ACAVEOverlayController : public AActor
{ {
GENERATED_BODY() GENERATED_BODY()
......
...@@ -11,7 +11,7 @@ enum DefaultActivationType ...@@ -11,7 +11,7 @@ enum DefaultActivationType
}; };
UCLASS(config=Game, defaultconfig, meta=(DisplayName="CAVE Overlay")) UCLASS(config=Game, defaultconfig, meta=(DisplayName="CAVE Overlay"))
class RWTHVRTOOLKIT_API UCAVEOverlaySettings : public UDeveloperSettings class RWTHVRCLUSTER_API UCAVEOverlaySettings : public UDeveloperSettings
{ {
GENERATED_BODY() GENERATED_BODY()
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* Used as a parent-class in the overlay widget. Like this we can access the UMG properties in C++ * Used as a parent-class in the overlay widget. Like this we can access the UMG properties in C++
*/ */
UCLASS() UCLASS()
class RWTHVRTOOLKIT_API UDoorOverlayData : public UUserWidget class RWTHVRCLUSTER_API UDoorOverlayData : public UUserWidget
{ {
GENERATED_BODY() GENERATED_BODY()
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* This class has to be registered and unregistered. This can easily be done in every StartupModule/ShutdownModule functions. * This class has to be registered and unregistered. This can easily be done in every StartupModule/ShutdownModule functions.
*/ */
USTRUCT() USTRUCT()
struct RWTHVRTOOLKIT_API FClusterConsole struct RWTHVRCLUSTER_API FClusterConsole
{ {
GENERATED_BODY() GENERATED_BODY()
private: private:
......
#pragma once
#include "CoreMinimal.h"
#include "CAVEOverlay/CAVEOverlay.h"
#include "Modules/ModuleManager.h"
#include "ClusterConsole.h"
class FRWTHVRClusterModule : public IModuleInterface
{
public:
virtual void StartupModule () override;
virtual void ShutdownModule() override;
private:
FClusterConsole ClusterConsole;
FCAVEOverlay CAVEOverlay;
};
using UnrealBuildTool;
public class RWTHVRCluster : ModuleRules
{
public RWTHVRCluster(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[]{}
);
PrivateIncludePaths.AddRange(
new string[]{}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"Engine",
"RWTHVRToolkit",
"DisplayCluster",
"DeveloperSettings",
"InputCore",
"UMG",
"Slate",
"SlateCore"
}
);
PrivateDependencyModuleNames.AddRange(
new string[]{}
);
DynamicallyLoadedModuleNames.AddRange(
new string[] { }
);
}
}
...@@ -4,14 +4,10 @@ ...@@ -4,14 +4,10 @@
void FRWTHVRToolkitModule::StartupModule () void FRWTHVRToolkitModule::StartupModule ()
{ {
ClusterConsole.Register();
CAVEOverlay.Register();
ConsoleActivation.Register(); ConsoleActivation.Register();
} }
void FRWTHVRToolkitModule::ShutdownModule() void FRWTHVRToolkitModule::ShutdownModule()
{ {
ClusterConsole.Unregister();
CAVEOverlay.Unregister();
ConsoleActivation.Unregister(); ConsoleActivation.Unregister();
} }
......
#include "Utility/VirtualRealityUtilities.h" #include "Utility/VirtualRealityUtilities.h"
#if PLATFORM_SUPPORTS_NDISPLAY
#include "Cluster/IDisplayClusterClusterManager.h" #include "Cluster/IDisplayClusterClusterManager.h"
#include "Components/DisplayClusterCameraComponent.h" #include "Components/DisplayClusterCameraComponent.h"
#include "Config/IDisplayClusterConfigManager.h" #include "Config/IDisplayClusterConfigManager.h"
#include "DisplayClusterRootActor.h" #include "DisplayClusterRootActor.h"
#include "DisplayClusterConfigurationTypes.h" #include "DisplayClusterConfigurationTypes.h"
#include "Engine/Engine.h"
#include "Game/IDisplayClusterGameManager.h" #include "Game/IDisplayClusterGameManager.h"
#include "IDisplayCluster.h" #include "IDisplayCluster.h"
#endif
#include "Engine/Engine.h"
#include "IXRTrackingSystem.h" #include "IXRTrackingSystem.h"
#include "IHeadMountedDisplay.h"
bool UVirtualRealityUtilities::IsDesktopMode() bool UVirtualRealityUtilities::IsDesktopMode()
{ {
return !IsRoomMountedMode() && !IsHeadMountedMode(); return !IsRoomMountedMode() && !IsHeadMountedMode();
} }
bool UVirtualRealityUtilities::IsRoomMountedMode() bool UVirtualRealityUtilities::IsRoomMountedMode()
{ {
#if PLATFORM_SUPPORTS_NDISPLAY
return IDisplayCluster::Get().GetOperationMode() == EDisplayClusterOperationMode::Cluster; return IDisplayCluster::Get().GetOperationMode() == EDisplayClusterOperationMode::Cluster;
#else
return false;
#endif
} }
bool UVirtualRealityUtilities::IsHeadMountedMode() bool UVirtualRealityUtilities::IsHeadMountedMode()
{ {
return GEngine->XRSystem.IsValid() && GEngine->XRSystem->IsHeadTrackingAllowed(); return GEngine->XRSystem.IsValid() && GEngine->XRSystem->IsHeadTrackingAllowed();
...@@ -25,34 +35,47 @@ bool UVirtualRealityUtilities::IsHeadMountedMode() ...@@ -25,34 +35,47 @@ bool UVirtualRealityUtilities::IsHeadMountedMode()
bool UVirtualRealityUtilities::IsCave() bool UVirtualRealityUtilities::IsCave()
{ {
#if PLATFORM_SUPPORTS_NDISPLAY
if(!IsRoomMountedMode()) return false; if(!IsRoomMountedMode()) return false;
const UDisplayClusterConfigurationData* ClusterConfig = IDisplayCluster::Get().GetConfigMgr()->GetConfig(); const UDisplayClusterConfigurationData* ClusterConfig = IDisplayCluster::Get().GetConfigMgr()->GetConfig();
return ClusterConfig->CustomParameters.Contains("Hardware_Platform") return ClusterConfig->CustomParameters.Contains("Hardware_Platform")
&& ClusterConfig->CustomParameters.Find("Hardware_Platform")->Equals("aixcave", ESearchCase::IgnoreCase); && ClusterConfig->CustomParameters.Find("Hardware_Platform")->Equals("aixcave", ESearchCase::IgnoreCase);
#else
return false;
#endif
} }
bool UVirtualRealityUtilities::IsTdw() bool UVirtualRealityUtilities::IsTdw()
{ {
#if PLATFORM_SUPPORTS_NDISPLAY
if(!IsRoomMountedMode()) return false; if(!IsRoomMountedMode()) return false;
const UDisplayClusterConfigurationData* ClusterConfig = IDisplayCluster::Get().GetConfigMgr()->GetConfig(); const UDisplayClusterConfigurationData* ClusterConfig = IDisplayCluster::Get().GetConfigMgr()->GetConfig();
return ClusterConfig->CustomParameters.Contains("Hardware_Platform") return ClusterConfig->CustomParameters.Contains("Hardware_Platform")
&& ClusterConfig->CustomParameters.Find("Hardware_Platform")->Equals("TiledDisplayWall", ESearchCase::IgnoreCase); && ClusterConfig->CustomParameters.Find("Hardware_Platform")->Equals("TiledDisplayWall", ESearchCase::IgnoreCase);
#else
return false;
#endif
} }
bool UVirtualRealityUtilities::IsRolv() bool UVirtualRealityUtilities::IsRolv()
{ {
#if PLATFORM_SUPPORTS_NDISPLAY
if(!IsRoomMountedMode()) return false; if(!IsRoomMountedMode()) return false;
const UDisplayClusterConfigurationData* ClusterConfig = IDisplayCluster::Get().GetConfigMgr()->GetConfig(); const UDisplayClusterConfigurationData* ClusterConfig = IDisplayCluster::Get().GetConfigMgr()->GetConfig();
return ClusterConfig->CustomParameters.Contains("Hardware_Platform") return ClusterConfig->CustomParameters.Contains("Hardware_Platform")
&& ClusterConfig->CustomParameters.Find("Hardware_Platform")->Equals("ROLV", ESearchCase::IgnoreCase); && ClusterConfig->CustomParameters.Find("Hardware_Platform")->Equals("ROLV", ESearchCase::IgnoreCase);
#else
return false;
#endif
} }
/* Return true on the Master in cluster mode and in a normal desktop session. Otherwise false */ /* Return true on the Master in cluster mode and in a normal desktop session. Otherwise false */
bool UVirtualRealityUtilities::IsMaster() bool UVirtualRealityUtilities::IsMaster()
{ {
#if PLATFORM_SUPPORTS_NDISPLAY
if (!IDisplayCluster::IsAvailable()) if (!IDisplayCluster::IsAvailable())
{ {
return true; return true;
...@@ -63,6 +86,9 @@ bool UVirtualRealityUtilities::IsMaster() ...@@ -63,6 +86,9 @@ bool UVirtualRealityUtilities::IsMaster()
return true; // if we are not in cluster mode, we are always the master return true; // if we are not in cluster mode, we are always the master
} }
return Manager->IsMaster() || !Manager->IsSlave(); return Manager->IsMaster() || !Manager->IsSlave();
#else
return true;
#endif
} }
bool UVirtualRealityUtilities::IsSlave() bool UVirtualRealityUtilities::IsSlave()
...@@ -72,27 +98,51 @@ bool UVirtualRealityUtilities::IsSlave() ...@@ -72,27 +98,51 @@ bool UVirtualRealityUtilities::IsSlave()
FString UVirtualRealityUtilities::GetNodeName() FString UVirtualRealityUtilities::GetNodeName()
{ {
#if PLATFORM_SUPPORTS_NDISPLAY
return IsRoomMountedMode() ? IDisplayCluster::Get().GetClusterMgr()->GetNodeId() : FString(TEXT("Localhost")); return IsRoomMountedMode() ? IDisplayCluster::Get().GetClusterMgr()->GetNodeId() : FString(TEXT("Localhost"));
#else
return FString(TEXT("Localhost"));
#endif
} }
float UVirtualRealityUtilities::GetEyeDistance() float UVirtualRealityUtilities::GetEyeDistance()
{ {
if(IsHeadMountedMode())
{
return GEngine->XRSystem->GetHMDDevice()->GetInterpupillaryDistance();
}
else
{
#if PLATFORM_SUPPORTS_NDISPLAY
ADisplayClusterRootActor* RootActor = IDisplayCluster::Get().GetGameMgr()->GetRootActor(); ADisplayClusterRootActor* RootActor = IDisplayCluster::Get().GetGameMgr()->GetRootActor();
return (RootActor) ? RootActor->GetDefaultCamera()->GetInterpupillaryDistance() : 0; return (RootActor) ? RootActor->GetDefaultCamera()->GetInterpupillaryDistance() : 0.0f;
#else
return 0.0f;
#endif
}
} }
EDisplayClusterEyeStereoOffset UVirtualRealityUtilities::GetNodeEyeType() EEyeStereoOffset UVirtualRealityUtilities::GetNodeEyeType()
{ {
#if PLATFORM_SUPPORTS_NDISPLAY
ADisplayClusterRootActor* RootActor = IDisplayCluster::Get().GetGameMgr()->GetRootActor(); ADisplayClusterRootActor* RootActor = IDisplayCluster::Get().GetGameMgr()->GetRootActor();
return (RootActor) ? RootActor->GetDefaultCamera()->GetStereoOffset() : EDisplayClusterEyeStereoOffset::None; return static_cast<EEyeStereoOffset>((RootActor) ? RootActor->GetDefaultCamera()->GetStereoOffset() : EDisplayClusterEyeStereoOffset::None);
#else
return EDisplayClusterEyeStereoOffset::None;
#endif
} }
UDisplayClusterSceneComponent* UVirtualRealityUtilities::GetClusterComponent(const FString& Name) USceneComponent* UVirtualRealityUtilities::GetClusterComponent(const FString& Name)
{ {
#if PLATFORM_SUPPORTS_NDISPLAY
ADisplayClusterRootActor* RootActor = IDisplayCluster::Get().GetGameMgr()->GetRootActor(); ADisplayClusterRootActor* RootActor = IDisplayCluster::Get().GetGameMgr()->GetRootActor();
return (RootActor) ? RootActor->GetComponentById(Name) : nullptr; return (RootActor) ? RootActor->GetComponentById(Name) : nullptr;
#else
return nullptr;
#endif
} }
UDisplayClusterSceneComponent* UVirtualRealityUtilities::GetNamedClusterComponent(const ENamedClusterComponent& Component) USceneComponent* UVirtualRealityUtilities::GetNamedClusterComponent(const ENamedClusterComponent& Component)
{ {
switch(Component) switch(Component)
{ {
...@@ -107,7 +157,7 @@ UDisplayClusterSceneComponent* UVirtualRealityUtilities::GetNamedClusterComponen ...@@ -107,7 +157,7 @@ UDisplayClusterSceneComponent* UVirtualRealityUtilities::GetNamedClusterComponen
case ENamedClusterComponent::NCC_TDW_CENTER: return GetClusterComponent("tdw_center"); case ENamedClusterComponent::NCC_TDW_CENTER: return GetClusterComponent("tdw_center");
case ENamedClusterComponent::NCC_CALIBRATIO: return GetClusterComponent("calibratio"); case ENamedClusterComponent::NCC_CALIBRATIO: return GetClusterComponent("calibratio");
case ENamedClusterComponent::NCC_TRACKING_ORIGIN: case ENamedClusterComponent::NCC_TRACKING_ORIGIN:
UDisplayClusterSceneComponent* Result; USceneComponent* Result;
if((Result = GetClusterComponent("cave_origin"))) return Result; if((Result = GetClusterComponent("cave_origin"))) return Result;
if((Result = GetClusterComponent("rolv_origin"))) return Result; if((Result = GetClusterComponent("rolv_origin"))) return Result;
if((Result = GetClusterComponent("tdw_origin_floor"))) return Result; if((Result = GetClusterComponent("tdw_origin_floor"))) return Result;
......
#pragma once #pragma once
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Cluster/CAVEOverlay/CAVEOverlay.h"
#include "Modules/ModuleManager.h" #include "Modules/ModuleManager.h"
#include "Cluster/ClusterConsole.h"
#include "Fixes/ActivateConsoleInShipping.h" #include "Fixes/ActivateConsoleInShipping.h"
class FRWTHVRToolkitModule : public IModuleInterface class FRWTHVRToolkitModule : public IModuleInterface
{ {
public: public:
...@@ -14,7 +11,5 @@ public: ...@@ -14,7 +11,5 @@ public:
virtual void ShutdownModule() override; virtual void ShutdownModule() override;
private: private:
FClusterConsole ClusterConsole;
FCAVEOverlay CAVEOverlay;
FActivateConsoleInShipping ConsoleActivation; FActivateConsoleInShipping ConsoleActivation;
}; };
#pragma once #pragma once
#include "Components/DisplayClusterCameraComponent.h"
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h" #include "Kismet/BlueprintFunctionLibrary.h"
#include "VirtualRealityUtilities.generated.h" #include "VirtualRealityUtilities.generated.h"
...@@ -28,6 +27,14 @@ enum class ENamedClusterComponent : uint8 ...@@ -28,6 +27,14 @@ enum class ENamedClusterComponent : uint8
NCC_TRACKING_ORIGIN UMETA(DisplayName = "CAVE/ROLV/TDW Origin") NCC_TRACKING_ORIGIN UMETA(DisplayName = "CAVE/ROLV/TDW Origin")
}; };
UENUM()
enum class EEyeStereoOffset
{
None,
Left,
Right
};
UCLASS() UCLASS()
class RWTHVRTOOLKIT_API UVirtualRealityUtilities : public UBlueprintFunctionLibrary class RWTHVRTOOLKIT_API UVirtualRealityUtilities : public UBlueprintFunctionLibrary
{ {
...@@ -45,13 +52,14 @@ public: ...@@ -45,13 +52,14 @@ public:
UFUNCTION(BlueprintPure, Category = "DisplayCluster") static bool IsSlave(); UFUNCTION(BlueprintPure, Category = "DisplayCluster") static bool IsSlave();
UFUNCTION(BlueprintPure, Category = "DisplayCluster") static FString GetNodeName(); UFUNCTION(BlueprintPure, Category = "DisplayCluster") static FString GetNodeName();
/* Distance in meters */
UFUNCTION(BlueprintPure, Category = "DisplayCluster") static float GetEyeDistance(); UFUNCTION(BlueprintPure, Category = "DisplayCluster") static float GetEyeDistance();
UFUNCTION(BlueprintPure, Category = "DisplayCluster") static EDisplayClusterEyeStereoOffset GetNodeEyeType(); UFUNCTION(BlueprintPure, Category = "DisplayCluster") static EEyeStereoOffset GetNodeEyeType();
//Get Compenent of Display Cluster by it's name, which is specified in the nDisplay config //Get Component of Display Cluster by it's name, which is specified in the nDisplay config
UFUNCTION(BlueprintPure, BlueprintCallable, Category = "DisplayCluster") static UDisplayClusterSceneComponent* GetClusterComponent(const FString& Name); UFUNCTION(BlueprintPure, BlueprintCallable, Category = "DisplayCluster") static USceneComponent* GetClusterComponent(const FString& Name);
UFUNCTION(BlueprintPure, BlueprintCallable, Category = "DisplayCluster") static UDisplayClusterSceneComponent* GetNamedClusterComponent(const ENamedClusterComponent& Component); UFUNCTION(BlueprintPure, BlueprintCallable, Category = "DisplayCluster") static USceneComponent* GetNamedClusterComponent(const ENamedClusterComponent& Component);
/* Load and create an Object from an asset path. This only works in the constructor */ /* Load and create an Object from an asset path. This only works in the constructor */
template <class T> template <class T>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment