Compare commits
3 Commits
9a5958088e
...
aff5dee7d4
Author | SHA1 | Date |
---|---|---|
|
aff5dee7d4 | |
|
3396694bed | |
|
1adef63b80 |
|
@ -44,4 +44,10 @@ vulkan_asset_pack_gltf.zip
|
|||
build/
|
||||
|
||||
# output ppm image sequence
|
||||
*.ppm
|
||||
*.ppm
|
||||
|
||||
# video
|
||||
*.mp4
|
||||
|
||||
*.mp4
|
||||
/data/output
|
||||
|
|
|
@ -121,7 +121,7 @@ public:
|
|||
bool headless = false; // 无头开关
|
||||
|
||||
bool enableSaveToImageSequeue = false; // 图片序列开关(暂时弃用)
|
||||
uint32_t outputFrameCount = 10; // 图片序列结束帧
|
||||
uint32_t outputFrameCount = 75; // 图片序列结束帧
|
||||
bool takeScreenShot = false; // 截屏(暂时弃用)
|
||||
uint32_t startFrameCount = 1; // 图片序列开始帧
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1806,7 +1806,13 @@ PlumageRender::PlumageRender()
|
|||
void PlumageRender::outputImageSequence()
|
||||
{
|
||||
|
||||
std::string deviceFilePath = filePath.imageOutputPath + "/device" + std::to_string(selectedPhysicalDeviceIndex);
|
||||
if (savedFrameCounter == settings.startFrameCount)
|
||||
{
|
||||
std::cout << "clean up directory for image sequence generation" << std::endl;
|
||||
removeImageSequence();
|
||||
}
|
||||
|
||||
filePath.deviceSpecFilePath = filePath.imageOutputPath + "/device" + std::to_string(selectedPhysicalDeviceIndex);
|
||||
|
||||
if (savedFrameCounter > settings.outputFrameCount)
|
||||
{
|
||||
|
@ -1816,15 +1822,15 @@ PlumageRender::PlumageRender()
|
|||
}
|
||||
signal.imageSequenceOutputComplete = true;
|
||||
std::string fileName = "/%dresult.ppm";
|
||||
filePath.totalImageOutputPath = deviceFilePath + fileName;
|
||||
filePath.totalImageOutputPath = filePath.deviceSpecFilePath + fileName;
|
||||
return;
|
||||
}
|
||||
if (_access(deviceFilePath.c_str(), 0) == -1)
|
||||
if (_access(filePath.deviceSpecFilePath.c_str(), 0) == -1)
|
||||
{
|
||||
std::filesystem::create_directories(deviceFilePath.c_str());
|
||||
std::filesystem::create_directories(filePath.deviceSpecFilePath.c_str());
|
||||
}
|
||||
std::string fileName = "/" + std::to_string(savedFrameCounter) + "result.ppm";
|
||||
filePath.totalImageOutputPath = deviceFilePath + fileName;
|
||||
std::string fileName ="/" + std::to_string(savedFrameCounter) + "result.ppm";
|
||||
filePath.totalImageOutputPath = filePath.deviceSpecFilePath + fileName;
|
||||
//std::cout << outputPath << std::endl;
|
||||
writeImageToFile(filePath.totalImageOutputPath.c_str());
|
||||
savedFrameCounter++;
|
||||
|
@ -1861,6 +1867,38 @@ PlumageRender::PlumageRender()
|
|||
|
||||
signal.imageSequenceToVideoComplete = true;
|
||||
std::cout << "vidoe codec complete,saved in:" << resultVideoPath << std::endl;
|
||||
std::cout << "star to clean up image sequence" << std::endl;
|
||||
removeImageSequence();
|
||||
}
|
||||
|
||||
void PlumageRender::removeImageSequence()
|
||||
{
|
||||
if (savedFrameCounter != settings.startFrameCount)
|
||||
{
|
||||
if (!signal.imageSequenceToVideoComplete)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
if (std::filesystem::exists(filePath.deviceSpecFilePath))
|
||||
{
|
||||
for (const auto& entry : std::filesystem::directory_iterator(filePath.deviceSpecFilePath))
|
||||
{
|
||||
if (std::filesystem::is_directory(entry.path()))
|
||||
{
|
||||
std::filesystem::remove_all(entry.path());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::filesystem::remove(entry.path());
|
||||
}
|
||||
}
|
||||
std::filesystem::remove(filePath.deviceSpecFilePath);
|
||||
std::cout << "clean up complete" << std::endl;
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
uint32_t PlumageRender::getMemoryTypeIndex(uint32_t typeBits, VkMemoryPropertyFlags properties)
|
||||
|
@ -1974,6 +2012,7 @@ PlumageRender::PlumageRender()
|
|||
loadScene(filename);
|
||||
setupDescriptors();
|
||||
buildCommandBuffers();
|
||||
|
||||
}
|
||||
|
||||
void PlumageRender::updateUIOverlay()
|
||||
|
@ -2034,6 +2073,9 @@ PlumageRender::PlumageRender()
|
|||
loadScene(stringFilename);
|
||||
setupDescriptors();
|
||||
updateCBs = true;
|
||||
signal.imageSequenceOutputComplete = false;
|
||||
signal.imageSequenceToVideoComplete = false;
|
||||
savedFrameCounter = 1;
|
||||
}
|
||||
}
|
||||
gui->endMenu();
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdio>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <vector>
|
||||
|
@ -153,7 +154,7 @@ public:
|
|||
std::string skyboxVertShaderPath = getAssetPath() + "shaders/skybox.vert.spv";
|
||||
std::string skyboxFragShaderPath = getAssetPath() + "shaders/skybox.frag.spv";
|
||||
|
||||
std::string iblTexturesFilePath = getAssetPath() + "textures/hdr/pisa_cube.ktx";
|
||||
std::string iblTexturesFilePath = getAssetPath() + "textures/hdr/gcanyon_cube.ktx";
|
||||
//tonemapping
|
||||
std::string tonemappingVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/genbrdflut.vert.spv";
|
||||
std::string tonemappingEnableFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/tonemapping_enable.frag.spv";
|
||||
|
@ -184,6 +185,7 @@ public:
|
|||
std::string imageOutputPath = getAssetPath() + "output/imageSequence";
|
||||
std::string videoOutputPath = getAssetPath() + "output/video";
|
||||
std::string totalImageOutputPath;
|
||||
std::string deviceSpecFilePath;
|
||||
|
||||
// script file path
|
||||
std::string image2videoBatFilePath = getAssetPath() + "script/image2video.bat";
|
||||
|
@ -365,6 +367,7 @@ public:
|
|||
void writeImageToFile(std::string filePath);
|
||||
void outputImageSequence();
|
||||
void imageSequenceToVideo();
|
||||
void removeImageSequence();
|
||||
//void outputScreenShot();
|
||||
uint32_t getMemoryTypeIndex(uint32_t typeBits, VkMemoryPropertyFlags properties);
|
||||
virtual void render();
|
||||
|
|
Loading…
Reference in New Issue