编写配置文件读写(未完成
							parent
							
								
									26a66c4f0d
								
							
						
					
					
						commit
						014b6e1c4d
					
				| 
						 | 
					@ -82,8 +82,7 @@ public:
 | 
				
			||||||
	static std::vector<const char*> args;
 | 
						static std::vector<const char*> args;
 | 
				
			||||||
	uint32_t selectedPhysicalDeviceIndex = 0;
 | 
						uint32_t selectedPhysicalDeviceIndex = 0;
 | 
				
			||||||
	bool prepared = false;
 | 
						bool prepared = false;
 | 
				
			||||||
	uint32_t width = 1280;
 | 
						
 | 
				
			||||||
	uint32_t height = 720;
 | 
					 | 
				
			||||||
	float frameTimer = 1.0f;
 | 
						float frameTimer = 1.0f;
 | 
				
			||||||
	Camera camera;
 | 
						Camera camera;
 | 
				
			||||||
	glm::vec2 mousePos;
 | 
						glm::vec2 mousePos;
 | 
				
			||||||
| 
						 | 
					@ -102,6 +101,8 @@ public:
 | 
				
			||||||
	}signal;
 | 
						}signal;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct Settings {
 | 
						struct Settings {
 | 
				
			||||||
 | 
							uint32_t width = 1280;
 | 
				
			||||||
 | 
							uint32_t height = 720;
 | 
				
			||||||
		bool validation = true; // 校验层开关
 | 
							bool validation = true; // 校验层开关
 | 
				
			||||||
		bool fullscreen = false; // 全屏开关
 | 
							bool fullscreen = false; // 全屏开关
 | 
				
			||||||
		bool vsync = false; // 垂直同步开关
 | 
							bool vsync = false; // 垂直同步开关
 | 
				
			||||||
| 
						 | 
					@ -118,6 +119,60 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_4_BIT; // 多重采样倍率
 | 
							VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_4_BIT; // 多重采样倍率
 | 
				
			||||||
	} settings;
 | 
						} settings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct FilePath
 | 
				
			||||||
 | 
						{	//model path
 | 
				
			||||||
 | 
							std::string glTFModelFilePath = getAssetPath() + "models/DamagedHelmet/DamagedHelmet.gltf";
 | 
				
			||||||
 | 
							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 skyboxModleFilePath = 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() + "buster_drone/shaders/glsl/genbrdflut.vert.spv";
 | 
				
			||||||
 | 
							std::string tonemappingEnableFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/tonemapping_enable.frag.spv";
 | 
				
			||||||
 | 
							std::string tonemappingDisableFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/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/metro_noord_4k_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";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						} filePath;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	struct DepthStencil {
 | 
						struct DepthStencil {
 | 
				
			||||||
		VkImage image;
 | 
							VkImage image;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    "setting":{
 | 
				
			||||||
 | 
					        "width":1280,
 | 
				
			||||||
 | 
					        "height":720
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "filePath":{
 | 
				
			||||||
 | 
					        "glTFModelFilePath":"models/DamagedHelmet/DamagedHelmet.gltf",
 | 
				
			||||||
 | 
					        "envMapFilePath":"environments/metro_noord_4k_hdr16f_cube.ktx",
 | 
				
			||||||
 | 
					        "imageOutputPath":"output/imageSequence",
 | 
				
			||||||
 | 
					        "videoOutputPath":"output/video"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@ function(buildHomework HOMEWORK_NAME)
 | 
				
			||||||
		"render/glTFModel.h" 
 | 
							"render/glTFModel.h" 
 | 
				
			||||||
		"render/glTFModel.cpp" 
 | 
							"render/glTFModel.cpp" 
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		 "render/renderFoundation.h" "render/renderFoundation.cpp")
 | 
							 "render/renderFoundation.h" "render/renderFoundation.cpp" "render/renderConfig.cpp" "render/renderConfig.h")
 | 
				
			||||||
		target_link_libraries(${HOMEWORK_NAME} base ${Vulkan_LIBRARY})
 | 
							target_link_libraries(${HOMEWORK_NAME} base ${Vulkan_LIBRARY})
 | 
				
			||||||
	else(WIN32)
 | 
						else(WIN32)
 | 
				
			||||||
		add_executable(${HOMEWORK_NAME} ${MAIN_CPP} ${SOURCE} ${MAIN_HEADER} ${SHADERS_GLSL} ${SHADERS_HLSL} ${README_FILES})
 | 
							add_executable(${HOMEWORK_NAME} ${MAIN_CPP} ${SOURCE} ${MAIN_HEADER} ${SHADERS_GLSL} ${SHADERS_HLSL} ${README_FILES})
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,8 +125,8 @@ PlumageRender::PlumageRender()
 | 
				
			||||||
		renderPassBeginInfo.renderPass = renderPass;
 | 
							renderPassBeginInfo.renderPass = renderPass;
 | 
				
			||||||
		renderPassBeginInfo.renderArea.offset.x = 0;
 | 
							renderPassBeginInfo.renderArea.offset.x = 0;
 | 
				
			||||||
		renderPassBeginInfo.renderArea.offset.y = 0;
 | 
							renderPassBeginInfo.renderArea.offset.y = 0;
 | 
				
			||||||
		renderPassBeginInfo.renderArea.extent.width = width;
 | 
							renderPassBeginInfo.renderArea.extent.width = settings.width;
 | 
				
			||||||
		renderPassBeginInfo.renderArea.extent.height = height;
 | 
							renderPassBeginInfo.renderArea.extent.height = settings.height;
 | 
				
			||||||
		renderPassBeginInfo.clearValueCount = settings.multiSampling ? 3 : 2;
 | 
							renderPassBeginInfo.clearValueCount = settings.multiSampling ? 3 : 2;
 | 
				
			||||||
		renderPassBeginInfo.pClearValues = clearValues;
 | 
							renderPassBeginInfo.pClearValues = clearValues;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -141,14 +141,14 @@ PlumageRender::PlumageRender()
 | 
				
			||||||
			vkCmdBeginRenderPass(currentCB, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
 | 
								vkCmdBeginRenderPass(currentCB, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			VkViewport viewport{};
 | 
								VkViewport viewport{};
 | 
				
			||||||
			viewport.width = (float)width;
 | 
								viewport.width = (float)settings.width;
 | 
				
			||||||
			viewport.height = (float)height;
 | 
								viewport.height = (float)settings.height;
 | 
				
			||||||
			viewport.minDepth = 0.0f;
 | 
								viewport.minDepth = 0.0f;
 | 
				
			||||||
			viewport.maxDepth = 1.0f;
 | 
								viewport.maxDepth = 1.0f;
 | 
				
			||||||
			vkCmdSetViewport(currentCB, 0, 1, &viewport);
 | 
								vkCmdSetViewport(currentCB, 0, 1, &viewport);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			VkRect2D scissor{};
 | 
								VkRect2D scissor{};
 | 
				
			||||||
			scissor.extent = { width, height };
 | 
								scissor.extent = { settings.width, settings.height };
 | 
				
			||||||
			vkCmdSetScissor(currentCB, 0, 1, &scissor);
 | 
								vkCmdSetScissor(currentCB, 0, 1, &scissor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			VkDeviceSize offsets[1] = { 0 };
 | 
								VkDeviceSize offsets[1] = { 0 };
 | 
				
			||||||
| 
						 | 
					@ -1544,7 +1544,7 @@ PlumageRender::PlumageRender()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		camera.type = Camera::CameraType::lookat;
 | 
							camera.type = Camera::CameraType::lookat;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		camera.setPerspective(45.0f, (float)width / (float)height, 0.1f, 256.0f);
 | 
							camera.setPerspective(45.0f, (float)settings.width / (float)settings.height, 0.1f, 256.0f);
 | 
				
			||||||
		camera.rotationSpeed = 0.25f;
 | 
							camera.rotationSpeed = 0.25f;
 | 
				
			||||||
		camera.movementSpeed = 0.1f;
 | 
							camera.movementSpeed = 0.1f;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
| 
						 | 
					@ -1647,8 +1647,8 @@ PlumageRender::PlumageRender()
 | 
				
			||||||
		imageCreateCI.imageType = VK_IMAGE_TYPE_2D;
 | 
							imageCreateCI.imageType = VK_IMAGE_TYPE_2D;
 | 
				
			||||||
		// Note that vkCmdBlitImage (if supported) will also do format conversions if the swapchain color format would differ
 | 
							// Note that vkCmdBlitImage (if supported) will also do format conversions if the swapchain color format would differ
 | 
				
			||||||
		imageCreateCI.format = colorFormat;
 | 
							imageCreateCI.format = colorFormat;
 | 
				
			||||||
		imageCreateCI.extent.width = width;
 | 
							imageCreateCI.extent.width = settings.width;
 | 
				
			||||||
		imageCreateCI.extent.height = height;
 | 
							imageCreateCI.extent.height = settings.height;
 | 
				
			||||||
		imageCreateCI.extent.depth = 1;
 | 
							imageCreateCI.extent.depth = 1;
 | 
				
			||||||
		imageCreateCI.arrayLayers = 1;
 | 
							imageCreateCI.arrayLayers = 1;
 | 
				
			||||||
		imageCreateCI.mipLevels = 1;
 | 
							imageCreateCI.mipLevels = 1;
 | 
				
			||||||
| 
						 | 
					@ -1702,8 +1702,8 @@ PlumageRender::PlumageRender()
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			// Define the region to blit (we will blit the whole swapchain image)
 | 
								// Define the region to blit (we will blit the whole swapchain image)
 | 
				
			||||||
			VkOffset3D blitSize;
 | 
								VkOffset3D blitSize;
 | 
				
			||||||
			blitSize.x = width;
 | 
								blitSize.x = settings.width;
 | 
				
			||||||
			blitSize.y = height;
 | 
								blitSize.y = settings.height;
 | 
				
			||||||
			blitSize.z = 1;
 | 
								blitSize.z = 1;
 | 
				
			||||||
			VkImageBlit imageBlitRegion{};
 | 
								VkImageBlit imageBlitRegion{};
 | 
				
			||||||
			imageBlitRegion.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
 | 
								imageBlitRegion.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
 | 
				
			||||||
| 
						 | 
					@ -1730,8 +1730,8 @@ PlumageRender::PlumageRender()
 | 
				
			||||||
			imageCopyRegion.srcSubresource.layerCount = 1;
 | 
								imageCopyRegion.srcSubresource.layerCount = 1;
 | 
				
			||||||
			imageCopyRegion.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
 | 
								imageCopyRegion.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
 | 
				
			||||||
			imageCopyRegion.dstSubresource.layerCount = 1;
 | 
								imageCopyRegion.dstSubresource.layerCount = 1;
 | 
				
			||||||
			imageCopyRegion.extent.width = width;
 | 
								imageCopyRegion.extent.width = settings.width;
 | 
				
			||||||
			imageCopyRegion.extent.height = height;
 | 
								imageCopyRegion.extent.height = settings.height;
 | 
				
			||||||
			imageCopyRegion.extent.depth = 1;
 | 
								imageCopyRegion.extent.depth = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Issue the copy command
 | 
								// Issue the copy command
 | 
				
			||||||
| 
						 | 
					@ -1782,14 +1782,14 @@ PlumageRender::PlumageRender()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (settings.outputPNGimage)
 | 
							if (settings.outputPNGimage)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			stbi_write_png(filePath.c_str(), width, height, 4, data, static_cast<int>(subResourceLayout.rowPitch));
 | 
								stbi_write_png(filePath.c_str(), settings.width, settings.height, 4, data, static_cast<int>(subResourceLayout.rowPitch));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			std::ofstream file(filePath, std::ios::out | std::ios::binary);
 | 
								std::ofstream file(filePath, std::ios::out | std::ios::binary);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// ppm header
 | 
								// ppm header
 | 
				
			||||||
			file << "P6\n" << width << "\n" << height << "\n" << 255 << "\n";
 | 
								file << "P6\n" << settings.width << "\n" << settings.height << "\n" << 255 << "\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// If source is BGR (destination is always RGB) and we can't use blit (which does automatic conversion), we'll have to manually swizzle color components
 | 
								// If source is BGR (destination is always RGB) and we can't use blit (which does automatic conversion), we'll have to manually swizzle color components
 | 
				
			||||||
			bool colorSwizzle = false;
 | 
								bool colorSwizzle = false;
 | 
				
			||||||
| 
						 | 
					@ -1803,10 +1803,10 @@ PlumageRender::PlumageRender()
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			// ppm binary pixel data
 | 
								// ppm binary pixel data
 | 
				
			||||||
			for (uint32_t y = 0; y < height; y++)
 | 
								for (uint32_t y = 0; y < settings.height; y++)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				unsigned int* row = (unsigned int*)data;
 | 
									unsigned int* row = (unsigned int*)data;
 | 
				
			||||||
				for (uint32_t x = 0; x < width; x++)
 | 
									for (uint32_t x = 0; x < settings.width; x++)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					if (colorSwizzle)
 | 
										if (colorSwizzle)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
| 
						 | 
					@ -2082,7 +2082,7 @@ PlumageRender::PlumageRender()
 | 
				
			||||||
		ImGuiIO& io = ImGui::GetIO();
 | 
							ImGuiIO& io = ImGui::GetIO();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ImVec2 lastDisplaySize = io.DisplaySize;
 | 
							ImVec2 lastDisplaySize = io.DisplaySize;
 | 
				
			||||||
		io.DisplaySize = ImVec2((float)width, (float)height);
 | 
							io.DisplaySize = ImVec2((float)settings.width, (float)settings.height);
 | 
				
			||||||
		io.DeltaTime = frameTimer;
 | 
							io.DeltaTime = frameTimer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		io.MousePos = ImVec2(mousePos.x, mousePos.y);
 | 
							io.MousePos = ImVec2(mousePos.x, mousePos.y);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -127,59 +127,7 @@ public:
 | 
				
			||||||
		float alphaMaskCutoff;
 | 
							float alphaMaskCutoff;
 | 
				
			||||||
	} pushConstBlockMaterial;
 | 
						} pushConstBlockMaterial;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct FilePath
 | 
						
 | 
				
			||||||
	{	//model path
 | 
					 | 
				
			||||||
		std::string glTFModelFilePath = getAssetPath() + "models/DamagedHelmet/DamagedHelmet.gltf";
 | 
					 | 
				
			||||||
		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 skyboxModleFilePath = 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() + "buster_drone/shaders/glsl/genbrdflut.vert.spv";
 | 
					 | 
				
			||||||
		std::string tonemappingEnableFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/tonemapping_enable.frag.spv";
 | 
					 | 
				
			||||||
		std::string tonemappingDisableFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/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/metro_noord_4k_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";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	} filePath;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	float modelrot = 0.0f;
 | 
						float modelrot = 0.0f;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,32 @@
 | 
				
			||||||
 | 
					#include "renderConfig.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void PlumageConfig::PlumageConfiguration::writrConfigurationToJson()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						nlohmann::json configJsonFile = nlohmann::json
 | 
				
			||||||
 | 
						{ 
 | 
				
			||||||
 | 
							{"width",settings.width},
 | 
				
			||||||
 | 
							{"height",settings.height},
 | 
				
			||||||
 | 
							{"validation",settings.validation},
 | 
				
			||||||
 | 
							{"fullscreen",settings.fullscreen},
 | 
				
			||||||
 | 
							{"vsync",settings.vsync},
 | 
				
			||||||
 | 
							{"multiSampling",settings.multiSampling},
 | 
				
			||||||
 | 
							{"rotateModel",settings.rotateModel},
 | 
				
			||||||
 | 
							{"headless",settings.headless},
 | 
				
			||||||
 | 
							{"outputPNGimage",settings.outputPNGimage},
 | 
				
			||||||
 | 
							{"enableSaveToImageSequeue",settings.enableSaveToImageSequeue},
 | 
				
			||||||
 | 
							{"outputFrameCount",settings.outputFrameCount},
 | 
				
			||||||
 | 
							{"takeScreenShot",settings.takeScreenShot},
 | 
				
			||||||
 | 
							{"startFrameCount",settings.startFrameCount},
 | 
				
			||||||
 | 
							{"videoFrameRate",settings.videoFrameRate},
 | 
				
			||||||
 | 
							{"sampleCount",settings.sampleCount},
 | 
				
			||||||
 | 
							{"",settings.},
 | 
				
			||||||
 | 
							{"",settings.}
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void PlumageConfig::PlumageConfiguration::readConfigurationToJson(std::string configFilePath)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						nlohmann::json configJsonFile;
 | 
				
			||||||
 | 
						std::ifstream jfile("test.json");
 | 
				
			||||||
 | 
						jfile >> configJsonFile;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,114 @@
 | 
				
			||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <filesystem>
 | 
				
			||||||
 | 
					#include <fstream>
 | 
				
			||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <json.hpp>
 | 
				
			||||||
 | 
					#include <vulkan/vulkan.h>
 | 
				
			||||||
 | 
					#include <VulkanTools.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace PlumageConfig
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						class PlumageConfiguration
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						public:
 | 
				
			||||||
 | 
							PlumageConfiguration();
 | 
				
			||||||
 | 
							~PlumageConfiguration();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							struct Settings {
 | 
				
			||||||
 | 
								uint32_t width = 1280;
 | 
				
			||||||
 | 
								uint32_t height = 720;
 | 
				
			||||||
 | 
								bool validation = true; // 校验层开关
 | 
				
			||||||
 | 
								bool fullscreen = false; // 全屏开关
 | 
				
			||||||
 | 
								bool vsync = false; // 垂直同步开关
 | 
				
			||||||
 | 
								bool multiSampling = false; // 多重采样
 | 
				
			||||||
 | 
								bool rotateModel = true; // 模型自旋转(暂时失效)
 | 
				
			||||||
 | 
								bool headless = false; // 无头开关
 | 
				
			||||||
 | 
								bool outputPNGimage = false;
 | 
				
			||||||
 | 
								bool enableSaveToImageSequeue = true; // 图片序列开关(暂时弃用)
 | 
				
			||||||
 | 
								uint32_t outputFrameCount = 50; // 图片序列结束帧
 | 
				
			||||||
 | 
								bool takeScreenShot = false; // 截屏(暂时弃用)
 | 
				
			||||||
 | 
								uint32_t startFrameCount = 1; // 图片序列开始帧
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								uint32_t videoFrameRate = 25;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_4_BIT; // 多重采样倍率
 | 
				
			||||||
 | 
							} settings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							struct FilePath
 | 
				
			||||||
 | 
							{	//model path
 | 
				
			||||||
 | 
								std::string glTFModelFilePath = getAssetPath() + "models/DamagedHelmet/DamagedHelmet.gltf";
 | 
				
			||||||
 | 
								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 skyboxModleFilePath = 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() + "buster_drone/shaders/glsl/genbrdflut.vert.spv";
 | 
				
			||||||
 | 
								std::string tonemappingEnableFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/tonemapping_enable.frag.spv";
 | 
				
			||||||
 | 
								std::string tonemappingDisableFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/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/metro_noord_4k_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 configFilePath = getAssetPath() + "config/config.json";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							} filePath;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							void writrConfigurationToJson();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							void readConfigurationToJson(std::string configFilePath);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PlumageConfiguration::PlumageConfiguration()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PlumageConfiguration::~PlumageConfiguration()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue