完成基本的文件路径接入和COS判断

test-headless
ink-soul 2024-04-29 18:00:34 +08:00
parent 088b8adfaf
commit 702098c8d0
14 changed files with 67 additions and 315 deletions

View File

@ -53,13 +53,21 @@ void PlumageConfig::PlumageConfiguration::readConfigurationFromToml(std::string
//settings.cleanUpImageSequece = toml::find_or<bool>(debug, "cleanUpImageSequece");
/*
get fielPath
get filePath
*/
auto& tomlFilePath = toml::find(config, "filePath");
auto& tomlFilePath = toml::find(config, "FilePath");
//gltf model path
filePath.glTFModelFilePath = setFilePathFromToml(tomlFilePath, "glTFModelFilePath");
filePath.envMapFilePath = setFilePathFromToml(tomlFilePath,"envMapFilePath");
filePath.imageOutputPath = setFilePathFromToml(tomlFilePath, "imageOutputPath");
filePath.videoOutputPath = setFilePathFromToml(tomlFilePath, "videoOutputPath");
//filePath. = setFilePathFromToml(tomlFilePath, );
//filePath. = setFilePathFromToml(tomlFilePath, );
//filePath. = setFilePathFromToml(tomlFilePath, );
//filePath.imageOutputPath = setFilePathFromToml(tomlFilePath, "imageOutputPath");
//filePath.videoOutputPath = setFilePathFromToml(tomlFilePath, "videoOutputPath");
/*
conversion: type and coordinate system
@ -114,38 +122,40 @@ void PlumageConfig::PlumageConfiguration::readConfigurationFromToml(std::string
settings.cameraTracks[i] = settings.bottomCenter + cameraTrackToFixation[i] ;
settings.cameraAngle[i] = cameraTracksRotationMatrix * glm::mat4(settings.cameraAngle[i]) ;
}
//translate = settings.bottomCenter - ;
//trans = glm::translate(trans, translate);
//settings.bottomNormal = cameraTracksRotationMatrix * glm::vec4(settings.bottomNormal, 1.0f);
//float ratioX =(float)settings.width / (float)settings.calibrationWidth;
//float ratioY = (float)settings.height / (float)settings.calibrationHeight;
//settings.fX = settings.fX * ratioX;
//settings.fY = settings.fY * ratioY;
//settings.cX = settings.cX * ratioX;
//settings.cY = settings.cY * ratioY;
}
std::string PlumageConfig::PlumageConfiguration::checkFilePath(std::string configFilePath)
/**/
std::string PlumageConfig::PlumageConfiguration::setFilePathFromToml(toml::value & tomlValue,std::string tomlValueName)
{
std::string filePathFromToml = toml::find<std::string>(tomlValue,tomlValueName);
std::string pattern = "https?://[a-zA-Z0-9-]+\\.cos\\.ap-guangzhou\\.myqcloud\\.com";
std::regex urlRegex(pattern);
std::filesystem::path filesystemConfigFilePath ;
if (std::regex_search(filePathFromToml,urlRegex))
{
filesystemConfigFilePath = filePathFromToml;
return filesystemConfigFilePath.generic_string();
}
else
{
std::filesystem::path filesystemConfigFilePath = configFilePath;
if (std::filesystem::exists(filesystemConfigFilePath))
{
return filesystemConfigFilePath.generic_string();
}
else
{
filesystemConfigFilePath = getAssetPath() + configFilePath;
return filesystemConfigFilePath.generic_string();
std::filesystem::path assetPath = getAssetPath();
assetPath += filesystemConfigFilePath;
return assetPath.generic_string();
}
}
}
glm::vec3 PlumageConfig::PlumageConfiguration::getTranslatedVector(glm::vec3 currentVector,glm::vec3 targetVector)
{
glm::vec3 translate = glm::vec3(0.f,0.f,0.f) - targetVector;

View File

@ -17,10 +17,11 @@
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <regex>
#include <toml/toml.hpp>
#include <vulkan/vulkan.h>
#include <VulkanTools.h>
#include <filesystem>
namespace PlumageConfig
@ -33,24 +34,24 @@ namespace PlumageConfig
struct Settings {
bool validation = true; // У<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//bool fullscreen = false; // ȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool vsync = false; // <EFBFBD><EFBFBD>ֱͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool headless = false; // <EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool validation = true; // vulkan validation switch
//bool fullscreen = false; // fullscreen
bool vsync = false; // vsync switch
bool headless = false; // headless render enable
bool outputPNGimage = false;
bool debugMode = true;
bool cleanUpImageSequece = true; // ͼƬ<EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>
bool cleanUpImageSequece = true; // clean up image sequence after video codec complete
uint32_t width = 1280;
uint32_t height = 720;
bool multiSampling = false; // <EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>
VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_4_BIT; // <EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool rotateModel = true; // ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת
float modelRotateSpeed = 2.0f; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD>ٶ<EFBFBD>
bool multiSampling = false; // mutisampling switch
VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_4_BIT; // mutisampling pixel number
bool rotateModel = true; // model self rotation
float modelRotateSpeed = 2.0f; // model self rotation speed
uint32_t startFrameIndex = 1; // ͼƬ<EFBFBD><EFBFBD><EFBFBD>п<EFBFBD>ʼ֡
uint32_t endFrameIndex = 50; // ͼƬ<EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><EFBFBD><EFBFBD>֡
uint32_t videoFrameRate = 25; // video decode frameRate
uint32_t startFrameIndex = 1; // mark the frame start to record video
uint32_t endFrameIndex = 50; // mark the frame stop to record video
uint32_t videoFrameRate = 25; // video encode frameRate
uint32_t selectedPhysicalDeviceIndex = 7;
float fX = 565.5f;
@ -77,13 +78,13 @@ namespace PlumageConfig
{
uint32_t width = 1280;
uint32_t height = 720;
bool multiSampling = false; // <EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD>
uint32_t sampleCount = VK_SAMPLE_COUNT_4_BIT; // <EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool rotateModel = false; // ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת
float modelRotateSpeed = 2.0f; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD>ٶ<EFBFBD>
uint32_t startFrameIndex = 1; // ͼƬ<EFBFBD><EFBFBD><EFBFBD>п<EFBFBD>ʼ֡
uint32_t endFrameIndex = 50; // ͼƬ<EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><EFBFBD><EFBFBD>֡
uint32_t videoFrameRate = 25; // <EFBFBD><EFBFBD>Ƶ֡<EFBFBD><EFBFBD>
bool multiSampling = false; // mutisampling switch
uint32_t sampleCount = VK_SAMPLE_COUNT_4_BIT; // mutisampling pixel number
bool rotateModel = false; // model self rotation
float modelRotateSpeed = 2.0f; // model self rotation speed
uint32_t startFrameIndex = 1; // mark the frame start to record video
uint32_t endFrameIndex = 50; // mark the frame stop to record video
uint32_t videoFrameRate = 25; // video encode frameRate
uint32_t selectedPhysicalDeviceIndex = 7;
};
@ -91,7 +92,7 @@ namespace PlumageConfig
struct FilePath
{ //model path
std::string glTFModelFilePath = getAssetPath() + "models/cube.gltf";
std::string glTFModelFilePath = getAssetPath() + "models/wooden_table_top_center.glb";
std::string modelVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.vert.spv";
std::string modelFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.frag.spv";
@ -121,7 +122,7 @@ namespace PlumageConfig
std::string brdfVertShaderPath = getAssetPath() + "shaders/genbrdflut.vert.spv";
std::string brdfFragShaderPath = getAssetPath() + "shaders/genbrdflut.frag.spv";
// environment map texture
std::string envMapFilePath = getAssetPath() + "environments/metro_noord_4k_hdr16f_cube.ktx";
std::string envMapFilePath = getAssetPath() + "environments/brown_photostudio_hdr16f_cube.ktx";
std::string emptyEnvmapFilePath = getAssetPath() + "textures/empty.ktx";
// pbr shader
std::string pbrVertShaderPath = getAssetPath() + "shaders/pbr.vert.spv";
@ -143,7 +144,7 @@ namespace PlumageConfig
std::string hdr2ktxBatFilePath = getAssetPath() + "script/hdr2ktxBatFilePath.bat";
std::string hdr2ktxShFilePath = getAssetPath() + "script/hdr2ktxShFilePath.sh";
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>󱣴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//
//std::string configFilePath = getAssetPath() + "config/guanzi.toml";
std::string configFilePath = getAssetPath() + "config/yukino_rotate_trans_matrix.toml";
@ -153,7 +154,7 @@ namespace PlumageConfig
void readConfigurationFromToml(std::string configFilePath,Settings& settings);
std::string checkFilePath(std::string configFilePath);
std::string setFilePathFromToml(toml::value& tomlValue, std::string tomlValueName);
void convertIntToVkSampleCount(uint32_t sampleCount);

View File

@ -1,11 +0,0 @@
{
"endFrameIndex": 50,
"height": 720,
"multiSampling": false,
"rotateModel": true,
"sampleCount": 4,
"selectedPhysicalDeviceIndex": 7,
"startFrameIndex": 1,
"videoFrameRate": 25,
"width": 1280
}

View File

@ -1,65 +0,0 @@
[settings]
width =1280
height =720
multiSampling =false
sampleCount =4
rotateModel =true
modelRotateSpeed =2.0
startFrameIndex =1
endFrameIndex =50
videoFrameRate =25
selectedPhysicalDeviceIndex =7
[settings.camera]
fovX =1.0
fovY =1.0
cX =2.0
cY =0.0
bottomCenter =[0.0,0.0,-6.0]
bottomNormal =[0.0,1.0,0.0]
cameraTracks =[[0.0,0.0,-6.0],[1.0,0.0,-3.0]]
cameraAngle =[[0.0,0.0,0.0],[45.0,0.0,0.0]]
[settings.debug]
validation = true
vsync = false
headless = false
outputPNGimage = false
debugMode = true
cleanUpImageSequence = true
configFilePath ="./data/config/config.toml"
[FilePath]
glTFModelFilePath ="./data/models/DamagedHelmet/DamagedHelmet.gltf"
envMapFilePath ="./data/environments/metro_noord_4k_hdr16f_cube.ktx"
imageOutputPath ="./data/output/imageSequence"
videoOutputPath ="./data/output/video"
[FilePath.ui]
uiVertShaderPath ="./data/shaders/ui.vert.spv"
uiFragShaderPath ="./data/shaders/ui.frag.spv"
[FilePath.skybox]
skyboxModelFilePath ="./data/models/cube.gltf"
skyboxVertShaderPath ="./data/shaders/skybox.vert.spv"
skyboxFragShaderPath ="./data/shaders/skybox.frag.spv"
[FilePath.tonemapping]
[FilePath.ibl]
[FilePath.pbr]
[FilePath.image2video]
[FilePath.hdr2ktx]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1532,13 +1532,13 @@ PlumageRender::PlumageRender()
float modelSize = std::max(models.scene.aabb[0][0], std::max(models.scene.aabb[1][1], models.scene.aabb[2][2]));
// Center and scale model
//float scale = 0.25f;
float scale =(1.0f / modelSize) * 4;
float scale = 5.f;
//float scale =(1.0f / modelSize) * 4;
//glm::vec3 translate = glm::vec3(models.scene.aabb[3][0], models.scene.aabb[3][1], models.scene.aabb[3][2]);
//translate += - modelSize / 4 * glm::vec3(models.scene.aabb[0][0], models.scene.aabb[1][1], models.scene.aabb[2][2]);
//glm::vec3 translate = glm::vec3(0.f, 0.f, 0.f);
//camera.setPosition(glm::vec3(0, 0, -modelSize - 2));
glm::vec3 translate = glm::vec3(0.f, -5.0f, 0.f);
glm::vec3 translate = glm::vec3(0.f, 0.0f, 0.f);
shaderDataScene.model = glm::mat4(1.0f);
//translate += glm::vec3(0.0f, 0.f, 0.f) - settings.cameraFixation;
shaderDataScene.model[0][0] = scale;
@ -2022,11 +2022,11 @@ PlumageRender::PlumageRender()
std::cout << "vidoe codec complete,saved in:" << resultVideoPath << std::endl;
std::cout << "star to clean up image sequence" << std::endl;
if (settings.cleanUpImageSequece = true)
if (settings.cleanUpImageSequece == true)
{
removeImageSequence();
}
signal.imageSequenceToVideoComplete = true;
signal.imageSequenceToVideoComplete == true;
}
void PlumageRender::removeImageSequence()