plumageRender/base/renderConfig.h

179 lines
5.9 KiB
C++

#pragma once
#include <filesystem>
#include <fstream>
#include <iostream>
#ifndef GLM_FORCE_RADIANS
#define GLM_FORCE_RADIANS
#endif
#ifndef GLM_FORCE_DEPTH_ZERO_TO_ONE
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#endif
#include <glm/glm.hpp>
#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
{
class PlumageConfiguration
{
public:
struct Settings {
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; // clean up image sequence after video codec complete
uint32_t width = 1280;
uint32_t height = 720;
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; // 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;
float fY = 516.3f;
float fovX = 1.f;
float fovY = 1.f;
float cX = 328.2f;
float cY = 238.8f;
int calibrationWidth = 640.0f;
int calibrationHeight = 480.0f;
glm::vec3 pedestledModelTopCenter = { 0.f,-5.f,0.f };
glm::vec3 bottomCenter = { 0.f,0.f,-6.f };
//std::vector<float> bottomCenter = { 0.f,0.f,-6.f };
glm::vec3 bottomNormal = { 0,1,0 };
glm::vec3 cameraFixation = { -0.5f,1.5f,1.79f };
std::vector<glm::vec3> cameraTracks = { {0.f,0.f,-6.f},{1.f,0.f,-3.f} };
std::vector<glm::mat3> cameraAngle = { {{0.f,0.f,0.f},{45.f,0.f,0.f},{0.f,0.f,0.f}},{{0.f,0.f,0.f},{45.f,0.f,0.f},{0.f,0.f,0.f}} };
}settings;
struct RenderSettings
{
uint32_t width = 1280;
uint32_t height = 720;
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;
};
struct FilePath
{ //model path
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";
//ui
std::string uiVertShaderPath = getAssetPath() + "shaders/ui.vert.spv";
std::string uiFragShaderPath = getAssetPath() + "shaders/ui.frag.spv";
// skybox path
std::string skyboxModelFilePath = getAssetPath() + "models/cube.gltf";
std::string skyboxVertShaderPath = getAssetPath() + "shaders/skybox.vert.spv";
std::string skyboxFragShaderPath = getAssetPath() + "shaders/skybox.frag.spv";
//std::string iblTexturesFilePath = getAssetPath() + "textures/hdr/gcanyon_cube.ktx";
//tonemapping
std::string tonemappingVertShaderPath = getAssetPath() + "shaders/genbrdflut.vert.spv";
std::string tonemappingEnableFragShaderPath = getAssetPath() + "shaders/tonemapping_enable.frag.spv";
std::string tonemappingDisableFragShaderPath = getAssetPath() + "shaders/tonemapping_disable.frag.spv";
// cube map
std::string irradianceFragShaderPath = getAssetPath() + "shaders/irradiancecube.frag.spv";
std::string filterVertShaderPath = getAssetPath() + "shaders/filtercube.vert.spv";
std::string prefilterEnvmapFragShaderPath = getAssetPath() + "shaders/prefilterenvmap.frag.spv";
//brdf cube map
std::string brdfVertShaderPath = getAssetPath() + "shaders/genbrdflut.vert.spv";
std::string brdfFragShaderPath = getAssetPath() + "shaders/genbrdflut.frag.spv";
// environment map texture
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";
std::string pbrFragShaderPath = getAssetPath() + "shaders/pbr_khr.frag.spv";
//ttf file path
std::string ttfFilePath = getAssetPath() + "/data/Roboto-Medium.ttf";
// output file path
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";
std::string image2videoShFilePath = getAssetPath() + "script/image2video.sh";
std::string hdr2ktxBatFilePath = getAssetPath() + "script/hdr2ktxBatFilePath.bat";
std::string hdr2ktxShFilePath = getAssetPath() + "script/hdr2ktxShFilePath.sh";
//
//std::string configFilePath = getAssetPath() + "config/guanzi.toml";
std::string configFilePath = getAssetPath() + "config/yukino_rotate_trans_matrix.toml";
} filePath;
void writrConfigurationToJson();
void readConfigurationFromToml(std::string configFilePath,Settings& settings);
std::string setFilePathFromToml(toml::value& tomlValue, std::string tomlValueName);
void convertIntToVkSampleCount(uint32_t sampleCount);
glm::vec3 getTranslatedVector(glm::vec3 beforeVector, glm::vec3 afterVector);
glm::mat4 getVectorRotationMatrix(glm::vec3 vectorBefore, glm::vec3 vectorAfter);
PlumageConfiguration();
~PlumageConfiguration();
private:
};
}