minecraftvulkan/engine/xe_render_system.hpp

62 lines
1.6 KiB
C++
Raw Normal View History

2022-09-19 16:54:23 +00:00
#pragma once
#include <vulkan/vulkan.h>
#include "xe_device.hpp"
#include "xe_pipeline.hpp"
#include "xe_frame_info.hpp"
#include "xe_game_object.hpp"
2022-09-19 20:35:45 +00:00
#include "xe_descriptors.hpp"
#include "xe_renderer.hpp"
2022-09-19 16:54:23 +00:00
#include <memory>
namespace xe {
class XeRenderSystem {
public:
struct XeData{};
XeRenderSystem(
XeDevice &device,
XeRenderer &renderer,
2022-09-19 20:35:45 +00:00
XeDescriptorPool &xeDescriptorPool,
XeDescriptorSetLayout &xeDescriptorSetLayout,
2022-09-19 16:54:23 +00:00
std::string vert,
std::string frag,
2022-09-19 20:35:45 +00:00
uint32_t pushCunstantDataSize,
uint32_t uniformBufferDataSize
);
2022-09-19 16:54:23 +00:00
~XeRenderSystem();
XeRenderSystem(const XeRenderSystem &) = delete;
XeRenderSystem operator=(const XeRenderSystem &) = delete;
2022-09-19 20:35:45 +00:00
void setUnifroms(XeFrameInfo & frameInfo);
void renderGameObjects(
int frameIndex,
VkCommandBuffer commandBuffer,
std::vector<XeGameObject> &gameObjects,
void *pushConstantData,
uint32_t pushConstantSize,
void* uniformBufferData,
uint32_t uniformBufferSize);
2022-09-19 16:54:23 +00:00
private:
2022-09-19 20:35:45 +00:00
void createUniformBuffers(XeDescriptorPool &xeDescriptorPool, XeDescriptorSetLayout &xeDescriptorSetLayout, uint32_t uniformBufferDataSize);
void createPipelineLayout(XeDescriptorSetLayout &xeDescriptorSetLayout, uint32_t pushCunstantDataSize, uint32_t uniformBufferDataSize);
2022-09-19 16:54:23 +00:00
void createPipeline(VkRenderPass renderPass, std::string vert, std::string frag);
XeDevice& xeDevice;
std::unique_ptr<XePipeline> xePipeline;
std::vector<std::unique_ptr<XeBuffer>> uboBuffers;
std::vector<VkDescriptorSet> descriptorSets;
VkPipelineLayout pipelineLayout;
};
}