Files
UnrealEngineUWP/Engine/Plugins/Runtime/nDisplay/Source/DisplayClusterProjection/Private/DisplayClusterProjectionModule.cpp
simon tourangeau 9889ad055a nDisplay features
- warp & blend support
- in camera pixel
- pfm generation
- mpcdi support

#jira UE-77525
#rb none

#ROBOMERGE-SOURCE: CL 7438705 in //UE4/Release-4.23/...
#ROBOMERGE-BOT: RELEASE (Release-4.23 -> Main) (v371-7306989)

[CL 7438706 by simon tourangeau in Main branch]
2019-07-18 12:00:53 -04:00

111 lines
4.0 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "DisplayClusterProjectionModule.h"
#include "DisplayClusterProjectionLog.h"
#include "Policy/Camera/DisplayClusterProjectionCameraPolicyFactory.h"
#include "Policy/EasyBlend/DisplayClusterProjectionEasyBlendPolicyFactory.h"
#include "Policy/Simple/DisplayClusterProjectionSimplePolicyFactory.h"
#include "Policy/MPCDI/DisplayClusterProjectionMPCDIPolicyFactory.h"
#include "IDisplayCluster.h"
#include "Render/IDisplayClusterRenderManager.h"
FDisplayClusterProjectionModule::FDisplayClusterProjectionModule()
{
TSharedPtr<IDisplayClusterProjectionPolicyFactory> Factory;
// Camera projection
Factory = MakeShareable(new FDisplayClusterProjectionCameraPolicyFactory);
ProjectionPolicyFactories.Emplace(DisplayClusterStrings::projection::Camera, Factory);
// Simple projection
Factory = MakeShareable(new FDisplayClusterProjectionSimplePolicyFactory);
ProjectionPolicyFactories.Emplace(DisplayClusterStrings::projection::Simple, Factory);
// MPCDI projection
Factory = MakeShareable(new FDisplayClusterProjectionMPCDIPolicyFactory);
ProjectionPolicyFactories.Emplace(DisplayClusterStrings::projection::MPCDI, Factory);
// EasyBlend projection
Factory = MakeShareable(new FDisplayClusterProjectionEasyBlendPolicyFactory);
ProjectionPolicyFactories.Emplace(DisplayClusterStrings::projection::EasyBlend, Factory);
UE_LOG(LogDisplayClusterProjection, Log, TEXT("Projection module has been instantiated"));
}
FDisplayClusterProjectionModule::~FDisplayClusterProjectionModule()
{
UE_LOG(LogDisplayClusterProjection, Log, TEXT("Projection module has been destroyed"));
}
//////////////////////////////////////////////////////////////////////////////////////////////
// IModuleInterface
//////////////////////////////////////////////////////////////////////////////////////////////
void FDisplayClusterProjectionModule::StartupModule()
{
UE_LOG(LogDisplayClusterProjection, Log, TEXT("Projection module startup"));
IDisplayClusterRenderManager* RenderMgr = IDisplayCluster::Get().GetRenderMgr();
if (RenderMgr)
{
for (auto it = ProjectionPolicyFactories.CreateIterator(); it; ++it)
{
UE_LOG(LogDisplayClusterProjection, Log, TEXT("Registering <%s> projection policy factory..."), *it->Key);
if (!RenderMgr->RegisterProjectionPolicyFactory(it->Key, it->Value))
{
UE_LOG(LogDisplayClusterProjection, Warning, TEXT("Couldn't register <%s> projection policy factory"), *it->Key);
}
}
}
UE_LOG(LogDisplayClusterProjection, Log, TEXT("Projection module has started"));
}
void FDisplayClusterProjectionModule::ShutdownModule()
{
UE_LOG(LogDisplayClusterProjection, Log, TEXT("Projection module shutdown"));
IDisplayClusterRenderManager* RenderMgr = IDisplayCluster::Get().GetRenderMgr();
if (RenderMgr)
{
for (auto it = ProjectionPolicyFactories.CreateConstIterator(); it; ++it)
{
UE_LOG(LogDisplayClusterProjection, Log, TEXT("Un-registering <%s> projection factory..."), *it->Key);
if (!RenderMgr->UnregisterProjectionPolicyFactory(it->Key))
{
UE_LOG(LogDisplayClusterProjection, Warning, TEXT("An error occurred during un-registering the <%s> projection factory"), *it->Key);
}
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////
// IDisplayClusterProjection
//////////////////////////////////////////////////////////////////////////////////////////////
void FDisplayClusterProjectionModule::GetSupportedProjectionTypes(TArray<FString>& OutProjectionTypes)
{
ProjectionPolicyFactories.GenerateKeyArray(OutProjectionTypes);
}
TSharedPtr<IDisplayClusterProjectionPolicyFactory> FDisplayClusterProjectionModule::GetProjectionFactory(const FString& ProjectionType)
{
if (ProjectionPolicyFactories.Contains(ProjectionType))
{
return ProjectionPolicyFactories[ProjectionType];
}
UE_LOG(LogDisplayClusterProjection, Warning, TEXT("No <%s> projection factory available"), *ProjectionType);
return nullptr;
}
IMPLEMENT_MODULE(FDisplayClusterProjectionModule, DisplayClusterProjection)