Replace RenderWindow with swapchains
This commit is contained in:
committed by
Jérôme Leclercq
parent
8db1c04568
commit
18851c9185
57
include/Nazara/OpenGLRenderer/OpenGLSwapchain.hpp
Normal file
57
include/Nazara/OpenGLRenderer/OpenGLSwapchain.hpp
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - OpenGL renderer"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_OPENGLRENDERER_OPENGLRENDERWINDOW_HPP
|
||||
#define NAZARA_OPENGLRENDERER_OPENGLRENDERWINDOW_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Config.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLRenderImage.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLRenderPass.hpp>
|
||||
#include <Nazara/OpenGLRenderer/OpenGLWindowFramebuffer.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
|
||||
#include <Nazara/Renderer/Swapchain.hpp>
|
||||
#include <Nazara/Renderer/SwapchainParameters.hpp>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_OPENGLRENDERER_API OpenGLSwapchain final : public Swapchain
|
||||
{
|
||||
public:
|
||||
OpenGLSwapchain(OpenGLDevice& device, WindowHandle windowHandle, const Vector2ui& windowSize, const SwapchainParameters& parameters);
|
||||
~OpenGLSwapchain() = default;
|
||||
|
||||
RenderFrame AcquireFrame() override;
|
||||
|
||||
std::shared_ptr<CommandPool> CreateCommandPool(QueueType queueType) override;
|
||||
|
||||
inline GL::Context& GetContext();
|
||||
const OpenGLFramebuffer& GetFramebuffer(std::size_t i) const override;
|
||||
std::size_t GetFramebufferCount() const override;
|
||||
const OpenGLRenderPass& GetRenderPass() const override;
|
||||
const Vector2ui& GetSize() const override;
|
||||
|
||||
void NotifyResize(const Vector2ui& newSize) override;
|
||||
|
||||
void Present();
|
||||
|
||||
private:
|
||||
std::optional<OpenGLRenderPass> m_renderPass;
|
||||
std::size_t m_currentFrame;
|
||||
std::vector<std::unique_ptr<OpenGLRenderImage>> m_renderImage;
|
||||
std::unique_ptr<GL::Context> m_context;
|
||||
OpenGLWindowFramebuffer m_framebuffer;
|
||||
Vector2ui m_size;
|
||||
bool m_sizeInvalidated;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/OpenGLRenderer/OpenGLSwapchain.inl>
|
||||
|
||||
#endif // NAZARA_OPENGLRENDERER_OPENGLRENDERWINDOW_HPP
|
||||
Reference in New Issue
Block a user