diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index 0cfa246..51ff02e 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -68,18 +68,7 @@ private: PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallback; PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallback; VkDebugReportCallbackEXT debugReportCallback; - struct MultisampleTarget { - struct { - VkImage image; - VkImageView view; - VkDeviceMemory memory; - } color; - struct { - VkImage image; - VkImageView view; - VkDeviceMemory memory; - } depth; - } multisampleTarget; + protected: VkInstance instance; VkPhysicalDevice physicalDevice; @@ -106,9 +95,9 @@ public: bool prepared = false; Camera camera; - glm::vec2 mousePos; + bool paused = false; - uint32_t lastFPS = 0; + diff --git a/src/render/render.h b/src/render/render.h index 2753713..afed5d9 100644 --- a/src/render/render.h +++ b/src/render/render.h @@ -53,32 +53,19 @@ namespace PlumageRender } info; - struct Signal - { - bool imageSequenceOutputComplete = false; - bool imageSequenceToVideoComplete = false; - - }signal; + glm::vec3 modelrot = glm::vec3(0.0f); glm::vec3 modelPos = glm::vec3(0.0f); - std::map environments; - std::string selectedEnvironment = "papermill"; - std::map scenes; - std::string selectedScene = "DamagedHelmet"; + - int32_t debugViewInputs = 0; - int32_t debugViewEquation = 0; + - struct StagingBuffer { - VkBuffer buffer; - VkDeviceMemory memory; - } vertexStaging, indexStaging; - - std::vector commandBuffers; + + uint32_t frameIndex = 0; @@ -88,7 +75,7 @@ namespace PlumageRender float animationTimer = 0.0f; bool animate = true; - bool displayBackground = true; + struct LightSource { glm::vec3 color = glm::vec3(1.0f); diff --git a/src/render/renderIO.h b/src/render/renderIO.h index 6f70f09..93021c8 100644 --- a/src/render/renderIO.h +++ b/src/render/renderIO.h @@ -1 +1,57 @@ #pragma once + +#include +#include + +namespace PlumageRender +{ + class RenderInput + { + public: + RenderInput(); + ~RenderInput(); + + struct Signal + { + bool imageSequenceOutputComplete = false; + bool imageSequenceToVideoComplete = false; + }; + static Signal signal; + + std::map environments; + std::string selectedEnvironment = "papermill"; + std::map scenes; + std::string selectedScene = "DamagedHelmet"; + + private: + + }; + + RenderInput::RenderInput() + { + } + + RenderInput::~RenderInput() + { + } + + + + class RenderOutput + { + public: + RenderOutput(); + ~RenderOutput(); + + private: + + }; + + RenderOutput::RenderOutput() + { + } + + RenderOutput::~RenderOutput() + { + } +} diff --git a/src/render/renderUI.cpp b/src/render/renderUI.cpp index 73b1a54..52f300d 100644 --- a/src/render/renderUI.cpp +++ b/src/render/renderUI.cpp @@ -54,14 +54,14 @@ void PlumageRender::PlumageGUI::updateUIOverlay() } if (!filename.empty()) { - vkDeviceWaitIdle(vulkanBasic.device); + vkDeviceWaitIdle(VulkanBackend::VulkanFoundation::device); std::wstring_convert> converter; std::string stringFilename = converter.to_bytes(filename); loadScene(stringFilename); setupDescriptors(); updateCBs = true; - signal.imageSequenceOutputComplete = false; - signal.imageSequenceToVideoComplete = false; + PlumageRender::RenderInput::signal.imageSequenceOutputComplete = false; + PlumageRender::RenderInput::signal.imageSequenceToVideoComplete = false; savedFrameCounter = 1; } } @@ -71,8 +71,8 @@ void PlumageRender::PlumageGUI::updateUIOverlay() { if (gui->beginMenu(chineseUI.menuEnvironmentConfig)) { - if (gui->combo(chineseUI.environmentMap, selectedEnvironment, environments)) { - vkDeviceWaitIdle(device); + if (gui->combo(chineseUI.environmentMap, PlumageRender::RenderInput::selectedEnvironment, PlumageRender::RenderInput::environments)) { + vkDeviceWaitIdle(VulkanBackend::VulkanFoundation::device); loadEnvironment(environments[selectedEnvironment]); setupDescriptors(); updateCBs = true; @@ -80,13 +80,13 @@ void PlumageRender::PlumageGUI::updateUIOverlay() if (gui->checkbox(chineseUI.environmentBackGround, &setter.settings.displayBackground)) { updateShaderParams = true; } - if (gui->slider("Exposure", &shaderData.exposure, 0.1f, 10.0f)) { + if (gui->slider("Exposure", &VulkanBackend::VulkanFoundation::shaderData.exposure, 0.1f, 10.0f)) { updateShaderParams = true; } - if (gui->slider("Gamma", &shaderData.gamma, 0.1f, 4.0f)) { + if (gui->slider("Gamma", &VulkanBackend::VulkanFoundation::shaderData.gamma, 0.1f, 4.0f)) { updateShaderParams = true; } - if (gui->slider("IBL", &shaderData.scaleIBLAmbient, 0.0f, 1.0f)) { + if (gui->slider("IBL", &VulkanBackend::VulkanFoundation::shaderData.scaleIBLAmbient, 0.0f, 1.0f)) { updateShaderParams = true; } gui->endMenu(); @@ -100,8 +100,8 @@ void PlumageRender::PlumageGUI::updateUIOverlay() const std::vector debugNamesInputs = { "none", "Base color", "Normal", "Occlusion", "Emissive", "Metallic", "Roughness" }; - if (gui->combo(chineseUI.debugInput, &debugViewInputs, debugNamesInputs)) { - shaderData.debugViewInputs = static_cast(debugViewInputs); + if (gui->combo(chineseUI.debugInput, &debugView.debugViewInputs, debugNamesInputs)) { + VulkanBackend::VulkanFoundation::shaderData.debugViewInputs = static_cast(debugView.debugViewInputs); updateShaderParams = true; } gui->endMenu(); @@ -111,8 +111,8 @@ void PlumageRender::PlumageGUI::updateUIOverlay() const std::vector debugNamesEquation = { "none", "Diff (l,n)", "F (l,h)", "G (l,v,h)", "D (h)", "Specular" }; - if (gui->combo(chineseUI.debugPBREquation, &debugViewEquation, debugNamesEquation)) { - shaderData.debugViewEquation = static_cast(debugViewEquation); + if (gui->combo(chineseUI.debugPBREquation, &debugView.debugViewEquation, debugNamesEquation)) { + VulkanBackend::VulkanFoundation::shaderData.debugViewEquation = static_cast(debugView.debugViewEquation); updateShaderParams = true; } gui->endMenu(); diff --git a/src/render/renderUI.h b/src/render/renderUI.h index 61778fe..5ad06c1 100644 --- a/src/render/renderUI.h +++ b/src/render/renderUI.h @@ -5,6 +5,7 @@ #include "VulkanDevice.hpp" #include "vulkanFoundation.h" #include "renderSetter.h" +#include "renderIO.h" namespace PlumageRender { @@ -18,11 +19,19 @@ namespace PlumageRender void updateUIOverlay(); + struct DebugView + { + int32_t debugViewInputs = 0; + int32_t debugViewEquation = 0; + }; + static DebugView debugView; + + private: PlumageRender::Setter setter; - VulkanBackend::VulkanFoundation vulkanBasic; - + + uint32_t lastFPS = 0; float frameTimer = 1.0f; struct GamePadState { diff --git a/src/render/vulkanFoundation.h b/src/render/vulkanFoundation.h index 7bafbfb..50810e4 100644 --- a/src/render/vulkanFoundation.h +++ b/src/render/vulkanFoundation.h @@ -38,9 +38,23 @@ namespace VulkanBackend const int frameRange = setter.settings.endFrameIndex - setter.settings.startFrameCount; - void initVulkan(); + static VkDevice device; + + struct ShaderData { + glm::vec4 lightDir; + float exposure = 4.5f; + float gamma = 2.2f; + float prefilteredCubeMipLevels; + float scaleIBLAmbient = 1.0f; + float debugViewInputs = 0; + float debugViewEquation = 0; + }; + + static ShaderData shaderData; + + void initVulkan(); + - VkDevice device; private: @@ -177,15 +191,7 @@ namespace VulkanBackend glm::vec3 camPos; } shaderDataScene, shaderDataSkybox; - struct ShaderData { - glm::vec4 lightDir; - float exposure = 4.5f; - float gamma = 2.2f; - float prefilteredCubeMipLevels; - float scaleIBLAmbient = 1.0f; - float debugViewInputs = 0; - float debugViewEquation = 0; - } shaderData; + std::vector uniformBuffers;