2022-09-19 11:08:42 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#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-23 17:20:30 +00:00
|
|
|
#include "xe_input.hpp"
|
|
|
|
#include "xe_sound.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-23 17:20:30 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <AL/alc.h>
|
|
|
|
#include <AL/alut.h>
|
|
|
|
|
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-27 01:24:28 +00:00
|
|
|
Engine(int width, int height, std::string name, const char *icon);
|
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 16:13:07 +00:00
|
|
|
Input& getInput() {return xeInput;}
|
2022-09-25 01:16:13 +00:00
|
|
|
Camera& getCamera() {return xeCamera;}
|
2022-09-25 23:05:56 +00:00
|
|
|
Device& getDevice() {return xeDevice;}
|
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-27 00:57:53 +00:00
|
|
|
std::shared_ptr<Model> loadModelFromData(std::vector<unsigned char> vertexData, uint32_t vertexSize, std::vector<uint32_t> indices);
|
2022-09-27 03:34:05 +00:00
|
|
|
Image* loadImageFromFile(const std::string &filename, bool anisotropic = true);
|
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-25 23:05:56 +00:00
|
|
|
static Engine* getInstance();
|
|
|
|
|
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-25 16:13:07 +00:00
|
|
|
Input xeInput;
|
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
|
|
|
};
|
|
|
|
|
|
|
|
}
|