47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#ifndef DESTRUM_QUADRENDERERPASS_H
|
|
#define DESTRUM_QUADRENDERERPASS_H
|
|
|
|
#include <cstddef>
|
|
#include <memory>
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
#include <destrum/Graphics/Resources/Buffer.h>
|
|
|
|
|
|
class GfxDevice;
|
|
class Pipeline;
|
|
struct GPUImage;
|
|
class RenderResources;
|
|
|
|
class QuadRendererPass final {
|
|
public:
|
|
void init(GfxDevice& gfxDevice, RenderResources& resources, VkFormat drawImageFormat);
|
|
void draw(
|
|
VkCommandBuffer cmd,
|
|
GfxDevice& gfxDevice,
|
|
RenderResources& resources,
|
|
const GPUImage& target,
|
|
const glm::mat4& projection);
|
|
void cleanup(GfxDevice& gfxDevice);
|
|
|
|
private:
|
|
struct QuadVertex {
|
|
glm::vec2 position;
|
|
glm::vec2 uv;
|
|
glm::vec4 color;
|
|
std::uint32_t textureId;
|
|
};
|
|
|
|
void ensureCapacity(GfxDevice& gfxDevice, std::size_t requiredQuads);
|
|
|
|
VkPipelineLayout pipelineLayout{VK_NULL_HANDLE};
|
|
std::unique_ptr<Pipeline> pipeline;
|
|
GPUBuffer vertexBuffer{};
|
|
GPUBuffer indexBuffer{};
|
|
std::size_t quadCapacity{0};
|
|
};
|
|
|
|
#endif // DESTRUM_QUADRENDERERPASS_H
|