#pragma once #define GLFW_INCLUDE_VULKAN #include #define GLM_FORCE_RADIANS #define GLM_FORCE_DEPTH_ZERO_TO_ONE #include #include #include #include #include namespace hibis::aethiopicus { /** \class Aethiopicus * Vulkan-based renderer for the Hibis game engine. * * @param title Application window title * @param internalName Application internal name (used by Aethiopicus::mVulkanInstance) * @param version A semantic version stored in an std::string * @param size Size of the application window * @param callback Logging callback */ class Aethiopicus : public Renderer { public: Aethiopicus(std::string title, std::string internalName, std::string version, IntVec2 size, LoggerCallback callback, bool useValidationLayers = true); ~Aethiopicus(); // Draw void clearScreen(Color col = Color {0, 0, 0, 255}) override; void renderCurrent() override; void drawText(Resource* resource, std::string text, IntVec2 pos, Color color) override; void drawTexture(Resource* resource, IntRect size) override; void useShader(Shader* shader, Point2D points[3]) override; void stopUsingShaders() override; // Pre and Post draw void preDraw() override; void postDraw() override; // Update void update() override; // Util void compileShader(Shader* shader) override; void toggleWireframe() override; void setWindowTitle(std::string title) override; void resize(unsigned int width, unsigned int height); std::vector mGLFWExtensionVector; uint32_t mGLFWExtensionCount = 0; const char** mGLFWExtensions; std::vector mVulkanExtensions; private: // Functions bool checkValidationLayerSupport(); int rateDeviceSuitability(VkPhysicalDevice device, VkPhysicalDeviceProperties deviceProperties); bool checkDeviceExtensionSupport(VkPhysicalDevice device); VkResult createDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugUtilsMessengerEXT* pDebugMessenger); void destroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT debugMessenger, const VkAllocationCallbacks* pAllocator); // GLFW GLFWwindow* mWindow; // Vulkan VkInstance mVulkanInstance; VkPhysicalDevice mVulkanGraphicsDevice = VK_NULL_HANDLE; VkDevice mVulkanLogicalDevice; VkQueue mVulkanGraphicsQueue; VkQueue mVulkanPresentQueue; VkSurfaceKHR mVulkanSurface; VkSwapchainKHR mVulkanSwapchain; VkDebugUtilsMessengerEXT mDebugMessenger; VkFormat mSwapChainImageFormat; VkExtent2D mSwapChainExtent; std::vector mSwapchainImages; std::vector mSwapChainImageViews; bool mUseValidationLayers = false; const std::vector mValidationLayers = { "VK_LAYER_KHRONOS_validation" }; const std::vector mRequiredDeviceExtensions = { VK_KHR_SWAPCHAIN_EXTENSION_NAME }; }; }