Streamlined UI overlay, code cleanup

Refs #496
This commit is contained in:
saschawillems 2018-08-31 21:15:43 +02:00
parent c1c4f06a23
commit 69c3f62b9a
7 changed files with 75 additions and 131 deletions

View file

@ -30,28 +30,22 @@
namespace vks
{
struct UIOverlayCreateInfo
{
vks::VulkanDevice *device;
VkQueue copyQueue;
uint32_t width;
uint32_t height;
std::vector<VkPipelineShaderStageCreateInfo> shaders;
VkSampleCountFlagBits rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
uint32_t targetSubpass = 0;
uint32_t subpassCount = 1;
std::vector<VkClearValue> clearValues = {};
uint32_t attachmentCount = 1;
};
class UIOverlay
{
public:
vks::VulkanDevice *device;
VkQueue queue;
VkSampleCountFlagBits rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
uint32_t subpass = 0;
vks::Buffer vertexBuffer;
vks::Buffer indexBuffer;
int32_t vertexCount = 0;
int32_t indexCount = 0;
std::vector<VkPipelineShaderStageCreateInfo> shaders;
VkDescriptorPool descriptorPool;
VkDescriptorSetLayout descriptorSetLayout;
VkDescriptorSet descriptorSet;
@ -68,22 +62,21 @@ namespace vks
glm::vec2 translate;
} pushConstBlock;
UIOverlayCreateInfo createInfo = {};
void prepareResources();
public:
bool visible = true;
float scale = 1.0f;
UIOverlay(vks::UIOverlayCreateInfo createInfo);
UIOverlay();
~UIOverlay();
void preparePipeline(const VkPipelineCache pipelineCache, const VkRenderPass renderPass);
void prepareResources();
bool update();
void draw(const VkCommandBuffer commandBuffer);
void resize(uint32_t width, uint32_t height);
void freeResources();
bool header(const char* caption);
bool checkBox(const char* caption, bool* value);
bool checkBox(const char* caption, int32_t* value);