完成图片序列输出
parent
8a36a4d721
commit
6e791134d7
|
@ -42,3 +42,6 @@ vulkan_asset_pack_gltf.zip
|
|||
|
||||
# vscode build file
|
||||
build/
|
||||
|
||||
# output ppm image sequence
|
||||
*.ppm
|
|
@ -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 )
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "VulkanExampleBase.h"
|
||||
|
||||
|
||||
std::vector<const char*> 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<double, std::milli>(tEnd - tStart).count();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<glTFModel::Model*> 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)
|
||||
{
|
||||
_mkdir(deviceFilePath.c_str());
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < settings.outputFrameCount; i++)
|
||||
if (savedFrameCounter == settings.outputFrameCount)
|
||||
{
|
||||
std::string fileName = "/" + std::to_string(i) + "result.pmm";
|
||||
return;
|
||||
}
|
||||
if (_access(deviceFilePath.c_str(), 0) == -1)
|
||||
{
|
||||
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);
|
||||
}
|
||||
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);
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
#include <locale>
|
||||
#include <codecvt>
|
||||
#include "algorithm"
|
||||
|
||||
#include <iostream>
|
||||
#include <sys/stat.h>
|
||||
#include <filesystem>
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "VulkanExampleBase.h"
|
||||
|
@ -276,6 +278,8 @@ public:
|
|||
|
||||
UI* gui;
|
||||
|
||||
uint64_t savedFrameCounter = 0;
|
||||
|
||||
|
||||
PlumageRender();
|
||||
~PlumageRender()
|
||||
|
|
Loading…
Reference in New Issue