Graphics/RenderSystem: Add support for external swapchains
This commit is contained in:
@@ -41,8 +41,13 @@ namespace Nz
|
||||
RenderSystem(RenderSystem&&) = delete;
|
||||
~RenderSystem();
|
||||
|
||||
inline void AttachExternalSwapchain(WindowSwapchain& swapchain);
|
||||
|
||||
WindowSwapchain& CreateSwapchain(Window& window, const SwapchainParameters& parameters = SwapchainParameters{});
|
||||
|
||||
void DestroySwapchain(WindowSwapchain& swapchain);
|
||||
inline void DetachExternalSwapchain(WindowSwapchain& swapchain);
|
||||
|
||||
inline FramePipeline& GetFramePipeline();
|
||||
inline const FramePipeline& GetFramePipeline() const;
|
||||
|
||||
@@ -136,6 +141,7 @@ namespace Nz
|
||||
std::unordered_map<entt::entity, GraphicsEntity*> m_graphicsEntities;
|
||||
std::unordered_map<entt::entity, LightEntity*> m_lightEntities;
|
||||
std::unordered_map<Skeleton*, SharedSkeleton> m_sharedSkeletonInstances;
|
||||
std::vector<std::reference_wrapper<WindowSwapchain>> m_externalSwapchains;
|
||||
std::vector<std::unique_ptr<WindowSwapchain>> m_windowSwapchains;
|
||||
ElementRendererRegistry m_elementRegistry;
|
||||
MemoryPool<CameraEntity> m_cameraEntityPool;
|
||||
|
||||
@@ -2,11 +2,23 @@
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <type_traits>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline void RenderSystem::AttachExternalSwapchain(WindowSwapchain& swapchain)
|
||||
{
|
||||
m_windowSwapchains.emplace_back(&swapchain);
|
||||
}
|
||||
|
||||
inline void RenderSystem::DetachExternalSwapchain(WindowSwapchain& swapchain)
|
||||
{
|
||||
auto it = std::find_if(m_externalSwapchains.begin(), m_externalSwapchains.end(), [&](WindowSwapchain& externalSwapchain) { return &externalSwapchain == &swapchain; });
|
||||
NazaraAssert(it != m_externalSwapchains.end(), "external swapchain is not part of this render system");
|
||||
m_externalSwapchains.erase(it);
|
||||
}
|
||||
|
||||
inline FramePipeline& RenderSystem::GetFramePipeline()
|
||||
{
|
||||
return *m_pipeline;
|
||||
@@ -19,3 +31,4 @@ namespace Nz
|
||||
}
|
||||
|
||||
#include <Nazara/Graphics/DebugOff.hpp>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user