Skip to content
Snippets Groups Projects
Commit efb586db authored by Sebastian Pape's avatar Sebastian Pape
Browse files

WIP before moving cluster folder into own module

parent 34847e37
Branches main
No related tags found
1 merge request!5Remove nDisplay Dependency
#include "Utility/VirtualRealityUtilities.h"
#if PLATFORM_SUPPORTS_NDISPLAY
#include "Cluster/IDisplayClusterClusterManager.h"
#include "Components/DisplayClusterCameraComponent.h"
#include "Config/IDisplayClusterConfigManager.h"
#include "DisplayClusterRootActor.h"
#include "DisplayClusterConfigurationTypes.h"
#include "Engine/Engine.h"
#include "Game/IDisplayClusterGameManager.h"
#include "IDisplayCluster.h"
#endif
#include "Engine/Engine.h"
#include "IXRTrackingSystem.h"
bool UVirtualRealityUtilities::IsDesktopMode()
......@@ -16,7 +19,11 @@ bool UVirtualRealityUtilities::IsDesktopMode()
}
bool UVirtualRealityUtilities::IsRoomMountedMode()
{
#if PLATFORM_SUPPORTS_NDISPLAY
return IDisplayCluster::Get().GetOperationMode() == EDisplayClusterOperationMode::Cluster;
#else
return false;
#endif
}
bool UVirtualRealityUtilities::IsHeadMountedMode()
{
......@@ -25,34 +32,47 @@ bool UVirtualRealityUtilities::IsHeadMountedMode()
bool UVirtualRealityUtilities::IsCave()
{
#if PLATFORM_SUPPORTS_NDISPLAY
if(!IsRoomMountedMode()) return false;
const UDisplayClusterConfigurationData* ClusterConfig = IDisplayCluster::Get().GetConfigMgr()->GetConfig();
return ClusterConfig->CustomParameters.Contains("Hardware_Platform")
&& ClusterConfig->CustomParameters.Find("Hardware_Platform")->Equals("aixcave", ESearchCase::IgnoreCase);
#else
return false;
#endif
}
bool UVirtualRealityUtilities::IsTdw()
{
#if PLATFORM_SUPPORTS_NDISPLAY
if(!IsRoomMountedMode()) return false;
const UDisplayClusterConfigurationData* ClusterConfig = IDisplayCluster::Get().GetConfigMgr()->GetConfig();
return ClusterConfig->CustomParameters.Contains("Hardware_Platform")
&& ClusterConfig->CustomParameters.Find("Hardware_Platform")->Equals("TiledDisplayWall", ESearchCase::IgnoreCase);
#else
return false;
#endif
}
bool UVirtualRealityUtilities::IsRolv()
{
#if PLATFORM_SUPPORTS_NDISPLAY
if(!IsRoomMountedMode()) return false;
const UDisplayClusterConfigurationData* ClusterConfig = IDisplayCluster::Get().GetConfigMgr()->GetConfig();
return ClusterConfig->CustomParameters.Contains("Hardware_Platform")
&& 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 */
bool UVirtualRealityUtilities::IsMaster()
{
#if PLATFORM_SUPPORTS_NDISPLAY
if (!IDisplayCluster::IsAvailable())
{
return true;
......@@ -63,6 +83,9 @@ bool UVirtualRealityUtilities::IsMaster()
return true; // if we are not in cluster mode, we are always the master
}
return Manager->IsMaster() || !Manager->IsSlave();
#else
return true;
#endif
}
bool UVirtualRealityUtilities::IsSlave()
......@@ -72,24 +95,40 @@ bool UVirtualRealityUtilities::IsSlave()
FString UVirtualRealityUtilities::GetNodeName()
{
#if PLATFORM_SUPPORTS_NDISPLAY
return IsRoomMountedMode() ? IDisplayCluster::Get().GetClusterMgr()->GetNodeId() : FString(TEXT("Localhost"));
#else
return FString(TEXT("Localhost"));
#endif
}
float UVirtualRealityUtilities::GetEyeDistance()
{
#if PLATFORM_SUPPORTS_NDISPLAY
return IDisplayCluster::Get().GetGameMgr()->GetRootActor()->GetDefaultCamera()->GetInterpupillaryDistance();
#else
return 0;
#endif
}
EDisplayClusterEyeStereoOffset UVirtualRealityUtilities::GetNodeEyeType()
EEyeStereoOffset UVirtualRealityUtilities::GetNodeEyeType()
{
return IDisplayCluster::Get().GetGameMgr()->GetRootActor()->GetDefaultCamera()->GetStereoOffset();
#if PLATFORM_SUPPORTS_NDISPLAY
return static_cast<EEyeStereoOffset>(IDisplayCluster::Get().GetGameMgr()->GetRootActor()->GetDefaultCamera()->GetStereoOffset());
#else
return None;
#endif
}
UDisplayClusterSceneComponent* UVirtualRealityUtilities::GetClusterComponent(const FString& Name)
USceneComponent* UVirtualRealityUtilities::GetClusterComponent(const FString& Name)
{
#if PLATFORM_SUPPORTS_NDISPLAY
return IDisplayCluster::Get().GetGameMgr()->GetRootActor()->GetComponentById(Name);
#else
return nullptr;
#endif
}
UDisplayClusterSceneComponent* UVirtualRealityUtilities::GetNamedClusterComponent(const ENamedClusterComponent& Component)
USceneComponent* UVirtualRealityUtilities::GetNamedClusterComponent(const ENamedClusterComponent& Component)
{
switch(Component)
{
......@@ -103,7 +142,7 @@ UDisplayClusterSceneComponent* UVirtualRealityUtilities::GetNamedClusterComponen
case ENamedClusterComponent::NCC_TDW_ORIGIN: return GetClusterComponent("tdw_origin_floor");
case ENamedClusterComponent::NCC_TDW_CENTER: return GetClusterComponent("tdw_center");
case ENamedClusterComponent::NCC_TRACKING_ORIGIN:
UDisplayClusterSceneComponent* Result;
USceneComponent* Result;
if((Result = GetClusterComponent("cave_origin"))) return Result;
if((Result = GetClusterComponent("rolv_origin"))) return Result;
if((Result = GetClusterComponent("tdw_origin_floor"))) return Result;
......
#pragma once
#include "Components/DisplayClusterCameraComponent.h"
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "VirtualRealityUtilities.generated.h"
......@@ -27,6 +26,14 @@ enum class ENamedClusterComponent : uint8
NCC_TRACKING_ORIGIN UMETA(DisplayName = "CAVE/ROLV/TDW Origin")
};
UENUM()
enum EEyeStereoOffset
{
None,
Left,
Right
};
UCLASS()
class RWTHVRTOOLKIT_API UVirtualRealityUtilities : public UBlueprintFunctionLibrary
{
......@@ -46,9 +53,9 @@ public:
UFUNCTION(BlueprintPure, Category = "DisplayCluster") static FString GetNodeName();
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
UFUNCTION(BlueprintPure, BlueprintCallable, Category = "DisplayCluster") static UDisplayClusterSceneComponent* GetClusterComponent(const FString& Name);
UFUNCTION(BlueprintPure, BlueprintCallable, Category = "DisplayCluster") static UDisplayClusterSceneComponent* GetNamedClusterComponent(const ENamedClusterComponent& Component);
UFUNCTION(BlueprintPure, BlueprintCallable, Category = "DisplayCluster") static USceneComponent* GetClusterComponent(const FString& Name);
UFUNCTION(BlueprintPure, BlueprintCallable, Category = "DisplayCluster") static USceneComponent* GetNamedClusterComponent(const ENamedClusterComponent& Component);
};
......@@ -7,27 +7,18 @@ public class RWTHVRToolkit : ModuleRules
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[]
{
}
new string[]{}
);
PrivateIncludePaths.AddRange(
new string[]
{
}
new string[]{}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"DisplayCluster",
"Engine",
"HeadMountedDisplay",
"InputCore",
......@@ -39,20 +30,22 @@ public class RWTHVRToolkit : ModuleRules
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
}
new string[]{}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
new string[]{}
);
if(Target.Platform == UnrealTargetPlatform.Win64 || Target.Platform == UnrealTargetPlatform.Linux)
{
//PublicDependencyModuleNames.Add("DisplayCluster");
PublicDefinitions.Add("PLATFORM_SUPPORTS_NDISPLAY=0");
}
else
{
PublicDefinitions.Add("PLATFORM_SUPPORTS_NDISPLAY=0");
}
);
}
}
......@@ -11,7 +11,6 @@ public class RWTHVRToolkitEditor : ModuleRules
{
"Core",
"CoreUObject",
"DisplayCluster",
"Engine",
"UnrealEd",
"ComponentVisualizers",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment