// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "Render/IPDisplayClusterRenderManager.h" class IDisplayClusterPostProcess; class IDisplayClusterPostProcessFactory; class IDisplayClusterProjectionPolicy; class IDisplayClusterProjectionPolicyFactory; class IDisplayClusterRenderDeviceFactory; class IDisplayClusterRenderSyncPolicy; class IDisplayClusterRenderSyncPolicyFactory; class IDisplayClusterVblankMonitor; class UDisplayClusterCameraComponent; /** * Render manager. Responsible for everything related to the visuals. */ class FDisplayClusterRenderManager : public IPDisplayClusterRenderManager { public: FDisplayClusterRenderManager(); virtual ~FDisplayClusterRenderManager(); public: ////////////////////////////////////////////////////////////////////////////////////////////// // IPDisplayClusterManager ////////////////////////////////////////////////////////////////////////////////////////////// virtual bool Init(EDisplayClusterOperationMode OperationMode) override; virtual void Release() override; virtual bool StartSession(UDisplayClusterConfigurationData* InConfigData, const FString& InNodeId) override; virtual void EndSession() override; virtual bool StartScene(UWorld* InWorld) override; virtual void EndScene() override; virtual void PreTick(float DeltaSeconds) override; public: ////////////////////////////////////////////////////////////////////////////////////////////// // IDisplayClusterRenderManager ////////////////////////////////////////////////////////////////////////////////////////////// // Device virtual IDisplayClusterRenderDevice* GetRenderDevice() const override; virtual bool RegisterRenderDeviceFactory(const FString& InDeviceType, TSharedPtr& InFactory) override; virtual bool UnregisterRenderDeviceFactory(const FString& InDeviceType) override; // Synchronization virtual bool RegisterSynchronizationPolicyFactory(const FString& InSyncPolicyType, TSharedPtr& InFactory) override; virtual bool UnregisterSynchronizationPolicyFactory(const FString& InSyncPolicyType) override; virtual TSharedPtr GetCurrentSynchronizationPolicy() override; // Projection virtual bool RegisterProjectionPolicyFactory(const FString& InProjectionType, TSharedPtr& InFactory) override; virtual bool UnregisterProjectionPolicyFactory(const FString& InProjectionType) override; virtual TSharedPtr GetProjectionPolicyFactory(const FString& InProjectionType) override; virtual void GetRegisteredProjectionPolicies(TArray& OutPolicyIDs) const override; // Post-process virtual bool RegisterPostProcessFactory(const FString& InPostProcessType, TSharedPtr& InFactory) override; virtual bool UnregisterPostProcessFactory(const FString& InPostProcessType) override; virtual TSharedPtr GetPostProcessFactory(const FString& InPostProcessType) override; virtual void GetRegisteredPostProcess(TArray& OutPostProcessIDs) const override; // Warp policy virtual bool RegisterWarpPolicyFactory(const FString& InWarpPolicyType, TSharedPtr& Factory) override; virtual bool UnregisterWarpPolicyFactory(const FString& InWarpPolicyType) override; virtual TSharedPtr GetWarpPolicyFactory(const FString& InWarpPolicyType) override; virtual void GetRegisteredWarpPolicies(TArray& OutWarpPolicyIDs) const override; // Resources virtual TSharedPtr CreateMeshComponent() const override; virtual TSharedPtr GetOrCreateCachedTexture(const FString& InUniqueTextureName) const override; virtual TSharedPtr GetVblankMonitor() override { return VBlankMonitor; } virtual IDisplayClusterViewportManager* GetViewportManager() const override; public: ////////////////////////////////////////////////////////////////////////////////////////////// // IPDisplayClusterRenderManager ////////////////////////////////////////////////////////////////////////////////////////////// private: ////////////////////////////////////////////////////////////////////////////////////////////// // FDisplayClusterRenderManager ////////////////////////////////////////////////////////////////////////////////////////////// void ResizeWindow(int32 WinX, int32 WinY, int32 ResX, int32 ResY); void OnViewportCreatedHandler_SetCustomPresent() const; void OnViewportCreatedHandler_CheckViewportClass() const; void OnBeginDrawHandler() const; private: EDisplayClusterOperationMode CurrentOperationMode; // Interface pointer to avoid type casting IDisplayClusterRenderDevice* RenderDevicePtr = nullptr; private: // Rendering device factories TMap> RenderDeviceFactories; // Helper function to instantiate a rendering device TSharedPtr CreateRenderDevice() const; private: // Synchronization internals TMap> SyncPolicyFactories; TSharedPtr CreateRenderSyncPolicy() const; mutable TSharedPtr SyncPolicy; private: // Projection internals TMap> ProjectionPolicyFactories; // Postprocess internals TMap> PostProcessFactories; // Warp internals TMap> WarpPolicyFactories; private: // Internal data access synchronization mutable FCriticalSection CritSecInternals; // This flag is used to auto-focus the UE window once on start bool bWasWindowFocused = false; private: // V-blank monitor TSharedPtr VBlankMonitor; };