minecraftvulkan/engine/xe_engine.hpp

58 lines
1.3 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-20 01:28:41 +00:00
#include "xe_camera.hpp"
2022-09-19 16:54:23 +00:00
#include "xe_descriptors.hpp"
2022-09-21 02:02:58 +00:00
#include "xe_image.hpp"
2022-09-19 11:08:42 +00:00
2022-09-21 02:02:58 +00:00
#include <chrono>
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);
2022-09-20 01:28:41 +00:00
2022-09-22 17:21:30 +00:00
~XeEngine();
2022-09-19 11:08:42 +00:00
XeEngine(const XeEngine&) = delete;
XeEngine operator=(const XeEngine&) = delete;
2022-09-20 01:28:41 +00:00
XeWindow& getWindow() {return xeWindow;}
XeCamera& getCamera() {return xeCamera;}
2022-09-19 20:35:45 +00:00
2022-09-20 01:28:41 +00:00
std::shared_ptr<XeModel> loadModelFromFile(const std::string &filename);
std::shared_ptr<XeModel> loadModelFromData(std::vector<XeModel::Vertex> vertices, std::vector<uint32_t> indices);
2022-09-21 02:02:58 +00:00
std::shared_ptr<XeImage> loadImage(const std::string &filename);
2022-09-19 20:35:45 +00:00
bool beginFrame() { return xeRenderer.beginFrame(); }
2022-09-20 01:28:41 +00:00
void endFrame() { xeRenderer.endFrame(); }
2022-09-19 20:35:45 +00:00
void close() { vkDeviceWaitIdle(xeDevice.device()); }
2022-09-20 01:28:41 +00:00
bool poll();
float getFrameTime() { return frameTime; }
2022-09-19 11:08:42 +00:00
private:
2022-09-21 02:02:58 +00:00
void loadDescriptorPool();
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-20 01:28:41 +00:00
std::chrono::_V2::system_clock::time_point currentTime;
float frameTime;
float FOV = 50.f;
2022-09-19 16:54:23 +00:00
std::unique_ptr<XeDescriptorPool> xeDescriptorPool;
2022-09-20 01:28:41 +00:00
friend class XeRenderSystem;
2022-09-19 11:08:42 +00:00
};
}