/* * Vulkan Example base class * * Copyright (C) 2016 by Sascha Willems - www.saschawillems.de * * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) */ #pragma once #include #include #include #include #include #include #include #include "vulkan/vulkan.h" #include "VulkanTools.h" #include "camera.hpp" #include "keycodes.hpp" #include "VulkanDevice.hpp" #include "VulkanSwapChain.hpp" //#include "imgui/imgui.h" class VulkanExampleBase { private: uint32_t frameCounter = 0; bool resizing = false; //void handleMouseMove(int32_t x, int32_t y); PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallback; PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallback; VkDebugReportCallbackEXT debugReportCallback; protected: VkInstance instance; VkPhysicalDeviceProperties deviceProperties; VkPhysicalDeviceMemoryProperties deviceMemoryProperties; VkQueue queue; VkFormat depthFormat; VkCommandPool cmdPool; std::vectorframeBuffers; uint32_t currentBuffer = 0; //VulkanSwapChain swapChain; void windowResize(); public: static std::vector args; uint32_t selectedPhysicalDeviceIndex = 0; bool prepared = false; uint32_t width = 1280; uint32_t height = 720; bool paused = false; struct GamePadState { glm::vec2 axisLeft = glm::vec2(0.0f); glm::vec2 axisRight = glm::vec2(0.0f); } gamePadState; VulkanExampleBase(); virtual ~VulkanExampleBase(); //virtual void render() = 0; virtual void windowResized(); virtual void setupFrameBuffer(); void createSwapChainFramebuffer(); virtual void prepare(); virtual void fileDropped(std::string filename); void initSwapchain(); void setupSwapChain(); VkFormat findDepthFormat(); VkFormat findSupportedFormat(const std::vector& candidates, VkImageTiling tiling, VkFormatFeatureFlags features); };