diff --git a/.gitignore b/.gitignore index ef7dd0f..6864f8a 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,7 @@ vulkan_asset_pack_gltf.zip *.zip # vscode build file -build/ \ No newline at end of file +build/ + +# output ppm image sequence +*.ppm \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 1272b1c..4a75a8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,7 @@ endif() add_definitions(-D_CRT_SECURE_NO_WARNINGS) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) file(GLOB SOURCE *.cpp ) diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index fe687cb..50d896b 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -8,6 +8,7 @@ #include "VulkanExampleBase.h" + std::vector VulkanExampleBase::args; VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t srcObject, size_t location, int32_t msgCode, const char * pLayerPrefix, const char * pMsg, void * pUserData) @@ -317,6 +318,7 @@ void VulkanExampleBase::renderFrame() auto tStart = std::chrono::high_resolution_clock::now(); render(); + frameCounter++; auto tEnd = std::chrono::high_resolution_clock::now(); auto tDiff = std::chrono::duration(tEnd - tStart).count(); diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index 6bc8f0c..1744b7f 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -113,7 +113,7 @@ public: uint32_t lastFPS = 0; struct Settings { - bool validation = true; + bool validation = false; bool fullscreen = false; bool vsync = false; bool multiSampling = true; diff --git a/src/render/render.cpp b/src/render/render.cpp index 8243d77..2a15cdf 100644 --- a/src/render/render.cpp +++ b/src/render/render.cpp @@ -303,7 +303,7 @@ PlumageRender::PlumageRender() uint32_t materialCount = 0; uint32_t meshCount = 0; - // Environment samplers (radiance, irradiance, brdf lut) + // Environment samplers (radiance, irradiance, brdflut) imageSamplerCount += 3; std::vector modellist = { &models.skybox, &models.scene }; @@ -1792,7 +1792,7 @@ PlumageRender::PlumageRender() } file.close(); - std::cout << "Screenshot saved to disk" << std::endl; + std::cout << "Screenshot saved to " << filePath << std::endl; // Clean up resources vkUnmapMemory(device, dstImageMemory); @@ -1807,18 +1807,20 @@ PlumageRender::PlumageRender() { std::string deviceFilePath = filePath.outputPath + "/device" + std::to_string(selectedPhysicalDeviceIndex); - if (_access(deviceFilePath.c_str(),0) == -1) + + if (savedFrameCounter == settings.outputFrameCount) { - _mkdir(deviceFilePath.c_str()); + return; } - - for (uint32_t i = 0; i < settings.outputFrameCount; i++) + if (_access(deviceFilePath.c_str(), 0) == -1) { - std::string fileName = "/" + std::to_string(i) + "result.pmm"; - std::string outputPath = deviceFilePath + fileName; - //std::cout << outputPath << std::endl; - writeImageToFile(outputPath); + std::filesystem::create_directories(deviceFilePath.c_str()); } + std::string fileName = "/" + std::to_string(savedFrameCounter) + "result.ppm"; + std::string outputPath = deviceFilePath + fileName; + //std::cout << outputPath << std::endl; + writeImageToFile(outputPath.c_str()); + savedFrameCounter++; } uint32_t PlumageRender::getMemoryTypeIndex(uint32_t typeBits, VkMemoryPropertyFlags properties) @@ -1853,6 +1855,7 @@ PlumageRender::PlumageRender() VK_CHECK_RESULT(vkWaitForFences(device, 1, &waitFences[frameIndex], VK_TRUE, UINT64_MAX)); + outputImageSequence(); VK_CHECK_RESULT(vkResetFences(device, 1, &waitFences[frameIndex])); VkResult acquire = swapChain.acquireNextImage(presentCompleteSemaphores[frameIndex], ¤tBuffer); diff --git a/src/render/render.h b/src/render/render.h index d07db61..846e9dd 100644 --- a/src/render/render.h +++ b/src/render/render.h @@ -12,7 +12,9 @@ #include #include #include "algorithm" - +#include +#include +#include #include #include "VulkanExampleBase.h" @@ -275,6 +277,8 @@ public: } prefilterPushBlock; UI* gui; + + uint64_t savedFrameCounter = 0; PlumageRender();