65 lines
1.5 KiB
C++
65 lines
1.5 KiB
C++
#ifndef MESHPIPELINE_H
|
|
#define MESHPIPELINE_H
|
|
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include <glm/mat4x4.hpp>
|
|
#include <vulkan/vulkan.h>
|
|
|
|
#include <destrum/Graphics/Pipeline.h>
|
|
#include <destrum/Graphics/Camera.h>
|
|
#include <destrum/Graphics/Resources/Buffer.h>
|
|
#include <destrum/Graphics/MeshDrawCommand.h>
|
|
|
|
class GfxDevice;
|
|
class RenderResources;
|
|
|
|
class MeshPipeline {
|
|
public:
|
|
MeshPipeline();
|
|
~MeshPipeline();
|
|
|
|
void init(
|
|
GfxDevice& gfxDevice,
|
|
RenderResources& resources,
|
|
VkFormat drawImageFormat,
|
|
VkFormat depthImageFormat);
|
|
|
|
void draw(
|
|
VkCommandBuffer cmd,
|
|
VkExtent2D renderExtent,
|
|
const RenderResources& resources,
|
|
const Camera& camera,
|
|
const GPUBuffer& sceneDataBuffer,
|
|
const std::vector<MeshDrawCommand>& drawCommands,
|
|
const std::vector<std::size_t>& sortedDrawCommands);
|
|
|
|
void cleanup(VkDevice device);
|
|
|
|
void setRenderWireframe(bool wireframe) {
|
|
m_renderWireframe = wireframe;
|
|
}
|
|
|
|
bool getRenderWireframe() const {
|
|
return m_renderWireframe;
|
|
}
|
|
|
|
private:
|
|
struct PushConstants {
|
|
glm::mat4 transform;
|
|
VkDeviceAddress sceneDataBuffer;
|
|
VkDeviceAddress vertexBuffer;
|
|
std::uint32_t materialId;
|
|
std::uint32_t padding;
|
|
};
|
|
|
|
private:
|
|
VkPipelineLayout m_pipelineLayout{VK_NULL_HANDLE};
|
|
std::unique_ptr<Pipeline> m_pipeline;
|
|
|
|
bool m_renderWireframe{false};
|
|
};
|
|
|
|
#endif // MESHPIPELINE_H
|