minecraftvulkan/engine/xe_render_system.hpp

56 lines
1.5 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_game_object.hpp"
2022-09-19 20:35:45 +00:00
#include "xe_descriptors.hpp"
#include "xe_renderer.hpp"
2022-09-20 01:28:41 +00:00
#include "xe_engine.hpp"
2022-09-19 16:54:23 +00:00
#include <memory>
namespace xe {
class XeRenderSystem {
public:
2022-09-20 01:28:41 +00:00
2022-09-19 16:54:23 +00:00
XeRenderSystem(
2022-09-20 01:28:41 +00:00
XeEngine &xeEngine,
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-20 01:28:41 +00:00
);
2022-09-19 16:54:23 +00:00
~XeRenderSystem();
XeRenderSystem(const XeRenderSystem &) = delete;
XeRenderSystem operator=(const XeRenderSystem &) = delete;
2022-09-20 01:28:41 +00:00
void loadPushConstant(void *pushConstantData, uint32_t pushConstantSize);
void loadUniformObject(void *uniformBufferData, uint32_t uniformBufferSize);
void render(XeGameObject &gameObject);
void stop();
2022-09-19 16:54:23 +00:00
private:
2022-09-20 01:28:41 +00:00
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);
2022-09-20 01:28:41 +00:00
bool boundPipeline{false};
bool boundDescriptor{false};
2022-09-19 16:54:23 +00:00
XeDevice& xeDevice;
2022-09-20 01:28:41 +00:00
XeRenderer& xeRenderer;
2022-09-19 16:54:23 +00:00
std::unique_ptr<XePipeline> xePipeline;
std::vector<std::unique_ptr<XeBuffer>> uboBuffers;
std::vector<VkDescriptorSet> descriptorSets;
VkPipelineLayout pipelineLayout;
};
}