minecraftvulkan/engine/xe_engine.hpp

65 lines
1.5 KiB
C++
Raw Normal View History

2022-09-19 11:08:42 +00:00
#pragma once
#include "xe_window.hpp"
#include "xe_device.hpp"
#include "xe_renderer.hpp"
2022-09-19 16:54:23 +00:00
#include "xe_render_system.hpp"
#include "xe_descriptors.hpp"
2022-09-19 11:08:42 +00:00
2022-09-19 20:35:45 +00:00
#include <string>
2022-09-19 11:08:42 +00:00
namespace xe {
class XeEngine {
public:
XeEngine(int width, int height, std::string name);
~XeEngine() {};
XeEngine(const XeEngine&) = delete;
XeEngine operator=(const XeEngine&) = delete;
2022-09-19 16:54:23 +00:00
XeWindow& getWindow() {
2022-09-19 11:08:42 +00:00
return xeWindow;
};
2022-09-19 16:54:23 +00:00
XeRenderer& getRenderer() {
2022-09-19 11:08:42 +00:00
return xeRenderer;
};
2022-09-19 20:35:45 +00:00
XeCamera& getCamera() {
return xeCamera;
};
2022-09-19 16:54:23 +00:00
std::unique_ptr<XeRenderSystem> createRenderSystem(const std::string &vert, const std::string &frag, uint32_t pushCunstantDataSize, uint32_t uniformBufferDataSize);
2022-09-19 11:08:42 +00:00
2022-09-19 20:35:45 +00:00
std::shared_ptr<XeModel> createModel(const std::string &filename);
bool beginFrame() { return xeRenderer.beginFrame(); }
void endFrame() { return xeRenderer.endFrame(); }
void render(
XeRenderSystem& xeRenderSystem,
std::vector<XeGameObject>& gameObjects,
void* pushConstantData,
uint32_t pushConstantSize,
void* uniformBufferData,
uint32_t uniformBufferSize);
void close() { vkDeviceWaitIdle(xeDevice.device()); }
2022-09-19 11:08:42 +00:00
private:
2022-09-19 16:54:23 +00:00
void loadDescriptors();
2022-09-19 11:08:42 +00:00
XeWindow xeWindow;
XeDevice xeDevice;
XeRenderer xeRenderer;
2022-09-19 20:35:45 +00:00
XeCamera xeCamera;
2022-09-19 11:08:42 +00:00
2022-09-19 16:54:23 +00:00
std::unique_ptr<XeDescriptorPool> xeDescriptorPool;
std::unique_ptr<XeDescriptorSetLayout> xeDescriptorSetLayout;
2022-09-19 11:08:42 +00:00
};
}