From 43a41e5e58ee5a0a2db79fd559881e2d4193717b Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Wed, 13 Jan 2021 14:38:11 +0100 Subject: [PATCH] Make framebuffer clear color an engine config option --- openVulkanoCpp/Base/EngineConfiguration.hpp | 18 ++++++++++++++++++ openVulkanoCpp/Vulkan/RenderPass.hpp | 10 +++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/openVulkanoCpp/Base/EngineConfiguration.hpp b/openVulkanoCpp/Base/EngineConfiguration.hpp index 23df0e4..64557d8 100644 --- a/openVulkanoCpp/Base/EngineConfiguration.hpp +++ b/openVulkanoCpp/Base/EngineConfiguration.hpp @@ -1,4 +1,11 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + #pragma once + #include #include @@ -11,6 +18,7 @@ namespace openVulkanoCpp ~EngineConfiguration() = default; uint32_t numThreads = 1; + std::array frameBufferClearColor = { 0.39f, 0.58f, 0.93f, 1.0f }; public: static EngineConfiguration* GetEngineConfiguration() @@ -28,5 +36,15 @@ namespace openVulkanoCpp { return std::max(static_cast(1), numThreads); } + + void SetFrameBufferClearColor(std::array frameBufferClearColor) + { + this->frameBufferClearColor = frameBufferClearColor; + } + + std::array GetFrameBufferClearColor() const + { + return frameBufferClearColor; + } }; } \ No newline at end of file diff --git a/openVulkanoCpp/Vulkan/RenderPass.hpp b/openVulkanoCpp/Vulkan/RenderPass.hpp index 10e6423..211abd7 100644 --- a/openVulkanoCpp/Vulkan/RenderPass.hpp +++ b/openVulkanoCpp/Vulkan/RenderPass.hpp @@ -1,7 +1,15 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + #pragma once + #include #include "Device.hpp" #include "FrameBuffer.hpp" +#include "Base/EngineConfiguration.hpp" namespace openVulkanoCpp { @@ -34,7 +42,7 @@ namespace openVulkanoCpp this->frameBuffer = frameBuffer; CreateRenderPass(); frameBuffer->InitRenderPass(this); - SetClearColor(); + SetClearColor(EngineConfiguration::GetEngineConfiguration()->GetFrameBufferClearColor()); SetClearDepth(); }