Compare commits
	
		
			2 Commits 
		
	
	
		
			d4beea0076
			...
			3600a1f4b7
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | 3600a1f4b7 | |
|  | 61c501adcb | 
|  | @ -51,3 +51,7 @@ build/ | ||||||
| 
 | 
 | ||||||
| *.mp4 | *.mp4 | ||||||
| /data/output | /data/output | ||||||
|  | *.glb | ||||||
|  | *.ktx | ||||||
|  | 
 | ||||||
|  | data/output/video/device0/result.mp4 | ||||||
|  |  | ||||||
|  | @ -113,11 +113,11 @@ public: | ||||||
| 	uint32_t lastFPS = 0; | 	uint32_t lastFPS = 0; | ||||||
| 
 | 
 | ||||||
| 	struct Settings { | 	struct Settings { | ||||||
| 		bool validation = true; // 校验层开关
 | 		bool validation = false; // 校验层开关
 | ||||||
| 		bool fullscreen = false; // 全屏开关
 | 		bool fullscreen = false; // 全屏开关
 | ||||||
| 		bool vsync = false; // 垂直同步开关
 | 		bool vsync = false; // 垂直同步开关
 | ||||||
| 		bool multiSampling = true; // 多重采样
 | 		bool multiSampling = true; // 多重采样
 | ||||||
| 		bool rotateModel = true; // 模型自旋转(暂时失效)
 | 		bool rotateModel = false; // 模型自旋转(暂时失效)
 | ||||||
| 		bool headless = false; // 无头开关
 | 		bool headless = false; // 无头开关
 | ||||||
| 		bool outputPNGimage = false; | 		bool outputPNGimage = false; | ||||||
| 		bool enableSaveToImageSequeue = true; // 图片序列开关(暂时弃用)
 | 		bool enableSaveToImageSequeue = true; // 图片序列开关(暂时弃用)
 | ||||||
|  |  | ||||||
|  | @ -203,7 +203,7 @@ PlumageRender::PlumageRender() | ||||||
| 		models.scene.loadFromFile(filename, vulkanDevice, queue); | 		models.scene.loadFromFile(filename, vulkanDevice, queue); | ||||||
| 		auto tFileLoad = std::chrono::duration<double, std::milli>(std::chrono::high_resolution_clock::now() - tStart).count(); | 		auto tFileLoad = std::chrono::duration<double, std::milli>(std::chrono::high_resolution_clock::now() - tStart).count(); | ||||||
| 		std::cout << "Loading took " << tFileLoad << " ms" << std::endl; | 		std::cout << "Loading took " << tFileLoad << " ms" << std::endl; | ||||||
| 		camera.setPosition({ 0.0f, 0.0f, -6.0f }); | 		camera.setPosition({ 0.0f, 0.0f, -2.0f }); | ||||||
| 		camera.setRotation({ 0.0f, 0.0f, 0.0f }); | 		camera.setRotation({ 0.0f, 0.0f, 0.0f }); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -1025,8 +1025,8 @@ PlumageRender::PlumageRender() | ||||||
| 			std::vector<glm::mat4> matrices = { | 			std::vector<glm::mat4> matrices = { | ||||||
| 				glm::rotate(glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), | 				glm::rotate(glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), | ||||||
| 				glm::rotate(glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), | 				glm::rotate(glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), | ||||||
| 				glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), |  | ||||||
| 				glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), | 				glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), | ||||||
|  | 				glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), | ||||||
| 				glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), | 				glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), | ||||||
| 				glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f)), | 				glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f)), | ||||||
| 			}; | 			}; | ||||||
|  | @ -1035,9 +1035,11 @@ PlumageRender::PlumageRender() | ||||||
| 
 | 
 | ||||||
| 			VkViewport viewport{}; | 			VkViewport viewport{}; | ||||||
| 			viewport.width = (float)dim; | 			viewport.width = (float)dim; | ||||||
| 			viewport.height = (float)dim; | 			viewport.height = -(float)dim; | ||||||
| 			viewport.minDepth = 0.0f; | 			viewport.minDepth = 0.0f; | ||||||
| 			viewport.maxDepth = 1.0f; | 			viewport.maxDepth = 1.0f; | ||||||
|  | 			viewport.x = 0; | ||||||
|  | 			viewport.y = -viewport.height; | ||||||
| 			 | 			 | ||||||
| 			VkRect2D scissor{}; | 			VkRect2D scissor{}; | ||||||
| 			scissor.extent.width = dim; | 			scissor.extent.width = dim; | ||||||
|  | @ -1070,7 +1072,9 @@ PlumageRender::PlumageRender() | ||||||
| 					vulkanDevice->beginCommandBuffer(cmdBuf); | 					vulkanDevice->beginCommandBuffer(cmdBuf); | ||||||
| 
 | 
 | ||||||
| 					viewport.width = static_cast<float>(dim * std::pow(0.5f, m)); | 					viewport.width = static_cast<float>(dim * std::pow(0.5f, m)); | ||||||
| 					viewport.height = static_cast<float>(dim * std::pow(0.5f, m)); | 					viewport.height = -static_cast<float>(dim * std::pow(0.5f, m)); | ||||||
|  | 					viewport.x = 0; | ||||||
|  | 					viewport.y = -viewport.height; | ||||||
| 					vkCmdSetViewport(cmdBuf, 0, 1, &viewport); | 					vkCmdSetViewport(cmdBuf, 0, 1, &viewport); | ||||||
| 					vkCmdSetScissor(cmdBuf, 0, 1, &scissor); | 					vkCmdSetScissor(cmdBuf, 0, 1, &scissor); | ||||||
| 
 | 
 | ||||||
|  | @ -1133,7 +1137,7 @@ PlumageRender::PlumageRender() | ||||||
| 					copyRegion.dstOffset = { 0, 0, 0 }; | 					copyRegion.dstOffset = { 0, 0, 0 }; | ||||||
| 
 | 
 | ||||||
| 					copyRegion.extent.width = static_cast<uint32_t>(viewport.width); | 					copyRegion.extent.width = static_cast<uint32_t>(viewport.width); | ||||||
| 					copyRegion.extent.height = static_cast<uint32_t>(viewport.height); | 					copyRegion.extent.height = -static_cast<uint32_t>(viewport.height); | ||||||
| 					copyRegion.extent.depth = 1; | 					copyRegion.extent.depth = 1; | ||||||
| 
 | 
 | ||||||
| 					vkCmdCopyImage( | 					vkCmdCopyImage( | ||||||
|  | @ -1434,6 +1438,8 @@ PlumageRender::PlumageRender() | ||||||
| 		viewport.height = (float)dim; | 		viewport.height = (float)dim; | ||||||
| 		viewport.minDepth = 0.0f; | 		viewport.minDepth = 0.0f; | ||||||
| 		viewport.maxDepth = 1.0f; | 		viewport.maxDepth = 1.0f; | ||||||
|  | 		//viewport.x = 0;
 | ||||||
|  | 		//viewport.y = -viewport.height;
 | ||||||
| 
 | 
 | ||||||
| 		VkRect2D scissor{}; | 		VkRect2D scissor{}; | ||||||
| 		scissor.extent.width = dim; | 		scissor.extent.width = dim; | ||||||
|  | @ -1497,7 +1503,7 @@ PlumageRender::PlumageRender() | ||||||
| 
 | 
 | ||||||
| 		if (settings.rotateModel) | 		if (settings.rotateModel) | ||||||
| 		{ | 		{ | ||||||
| 			shaderDataScene.model = glm::mat4(1.0f); | 			//shaderDataScene.model = glm::mat4(1.0f);
 | ||||||
| 			shaderDataScene.model = glm::rotate(shaderDataScene.model, glm::radians(modelrot), glm::vec3(0, 1, 0)); | 			shaderDataScene.model = glm::rotate(shaderDataScene.model, glm::radians(modelrot), glm::vec3(0, 1, 0)); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | @ -1971,11 +1977,11 @@ PlumageRender::PlumageRender() | ||||||
| 		//outputImageSequeue(swapChainImage,filePath.imageSequenceFilePath);
 | 		//outputImageSequeue(swapChainImage,filePath.imageSequenceFilePath);
 | ||||||
| 
 | 
 | ||||||
| 		 | 		 | ||||||
| 		outputImageSequence(); | 		//outputImageSequence();
 | ||||||
| 		 | 		 | ||||||
| 		VK_CHECK_RESULT(vkWaitForFences(device, 1, &waitFences[frameIndex], VK_TRUE, UINT64_MAX)); | 		VK_CHECK_RESULT(vkWaitForFences(device, 1, &waitFences[frameIndex], VK_TRUE, UINT64_MAX)); | ||||||
| 		 | 		 | ||||||
| 		imageSequenceToVideo(); | 		//imageSequenceToVideo();
 | ||||||
| 		VK_CHECK_RESULT(vkResetFences(device, 1, &waitFences[frameIndex])); | 		VK_CHECK_RESULT(vkResetFences(device, 1, &waitFences[frameIndex])); | ||||||
| 
 | 
 | ||||||
| 		VkResult acquire = swapChain.acquireNextImage(presentCompleteSemaphores[frameIndex], ¤tBuffer); | 		VkResult acquire = swapChain.acquireNextImage(presentCompleteSemaphores[frameIndex], ¤tBuffer); | ||||||
|  | @ -2131,6 +2137,9 @@ PlumageRender::PlumageRender() | ||||||
| 						setupDescriptors(); | 						setupDescriptors(); | ||||||
| 						updateCBs = true; | 						updateCBs = true; | ||||||
| 					} | 					} | ||||||
|  | 					if (gui->checkbox("模型自转", &settings.rotateModel)) { | ||||||
|  | 						updateShaderParams = true; | ||||||
|  | 					} | ||||||
| 					if (gui->checkbox(chineseUI.environmentBackGround, &displayBackground)) { | 					if (gui->checkbox(chineseUI.environmentBackGround, &displayBackground)) { | ||||||
| 						updateShaderParams = true; | 						updateShaderParams = true; | ||||||
| 					} | 					} | ||||||
|  |  | ||||||
|  | @ -144,7 +144,7 @@ public: | ||||||
| 
 | 
 | ||||||
| 	struct FilePath | 	struct FilePath | ||||||
| 	{	//model path
 | 	{	//model path
 | ||||||
| 		std::string glTFModelFilePath = getAssetPath() + "models/sauvage_perfume.glb"; | 		std::string glTFModelFilePath = getAssetPath() + "models/DamagedHelmet/DamagedHelmet.gltf"; | ||||||
| 		std::string modelVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.vert.spv"; | 		std::string modelVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.vert.spv"; | ||||||
| 		std::string modelFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.frag.spv"; | 		std::string modelFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.frag.spv"; | ||||||
| 		 | 		 | ||||||
|  | @ -174,7 +174,7 @@ public: | ||||||
| 		std::string brdfVertShaderPath = getAssetPath() + "shaders/genbrdflut.vert.spv"; | 		std::string brdfVertShaderPath = getAssetPath() + "shaders/genbrdflut.vert.spv"; | ||||||
| 		std::string brdfFragShaderPath = getAssetPath() + "shaders/genbrdflut.frag.spv"; | 		std::string brdfFragShaderPath = getAssetPath() + "shaders/genbrdflut.frag.spv"; | ||||||
| 		// environment map texture
 | 		// environment map texture
 | ||||||
| 		std::string envMapFilePath = getAssetPath() + "environments/kloofendal_43d_clear_puresky_hdr16f_cube.ktx"; | 		std::string envMapFilePath = getAssetPath() + "environments/brown_photostudio_02_4k_hdr16f_cube.ktx"; | ||||||
| 		std::string emptyEnvmapFilePath = getAssetPath() + "textures/empty.ktx"; | 		std::string emptyEnvmapFilePath = getAssetPath() + "textures/empty.ktx"; | ||||||
| 		// pbr shader
 | 		// pbr shader
 | ||||||
| 		std::string pbrVertShaderPath = getAssetPath() + "shaders/pbr.vert.spv"; | 		std::string pbrVertShaderPath = getAssetPath() + "shaders/pbr.vert.spv"; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue