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 {
|
|
|
|
|
2022-09-25 01:16:13 +00:00
|
|
|
class Engine {
|
2022-09-19 11:08:42 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2022-09-25 01:16:13 +00:00
|
|
|
Engine(int width, int height, std::string name);
|
2022-09-20 01:28:41 +00:00
|
|
|
|
2022-09-25 01:16:13 +00:00
|
|
|
~Engine();
|
2022-09-19 11:08:42 +00:00
|
|
|
|
2022-09-25 01:16:13 +00:00
|
|
|
Engine(const Engine&) = delete;
|
|
|
|
Engine operator=(const Engine&) = delete;
|
2022-09-19 11:08:42 +00:00
|
|
|
|
2022-09-25 01:16:13 +00:00
|
|
|
Window& getWindow() {return xeWindow;}
|
|
|
|
Camera& getCamera() {return xeCamera;}
|
2022-09-19 20:35:45 +00:00
|
|
|
|
2022-09-25 01:16:13 +00:00
|
|
|
std::shared_ptr<Model> loadModelFromFile(const std::string &filename);
|
2022-09-25 16:07:49 +00:00
|
|
|
std::shared_ptr<Model> loadModelFromData(std::vector<float> vertexData, uint32_t vertexSize, std::vector<uint32_t> indices);
|
|
|
|
std::shared_ptr<Image> loadImageFromFile(const std::string &filename);
|
2022-09-21 02:02:58 +00:00
|
|
|
|
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
|
|
|
|
2022-09-25 01:16:13 +00:00
|
|
|
Window xeWindow;
|
|
|
|
Device xeDevice;
|
|
|
|
Renderer xeRenderer;
|
|
|
|
Camera 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-25 01:16:13 +00:00
|
|
|
std::unique_ptr<DescriptorPool> xeDescriptorPool;
|
2022-09-20 01:28:41 +00:00
|
|
|
|
2022-09-25 01:16:13 +00:00
|
|
|
friend class RenderSystem;
|
2022-09-19 11:08:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|