From a8b5ebfb4c05d885eb1056bf94a5386f4c5fce8e Mon Sep 17 00:00:00 2001 From: ink-soul Date: Sun, 28 Apr 2024 11:24:37 +0800 Subject: [PATCH] rever to rotation fix --- base/camera.hpp | 4 +-- base/renderConfig.cpp | 13 +++----- base/renderConfig.h | 42 +++++++++++++------------- data/config/yukino_original_coord.toml | 2 +- src/render/render.cpp | 4 +-- 5 files changed, 31 insertions(+), 34 deletions(-) diff --git a/base/camera.hpp b/base/camera.hpp index 0e84c4b..b5f5860 100644 --- a/base/camera.hpp +++ b/base/camera.hpp @@ -225,13 +225,13 @@ public: glm::vec3 t = -R * from; // t = -R * from; //R = glm::transpose(R); - + /**/ glm::mat4 m = glm::mat4( xAxis.x, xAxis.y, xAxis.z, t.x, yAxis.x, yAxis.y, yAxis.z, t.y, zAxis.x, zAxis.y, zAxis.z, t.z, 0, 0, 0, 1); - /**/ + /* //R = glm::transpose(R); glm::mat4 m = glm::mat4( diff --git a/base/renderConfig.cpp b/base/renderConfig.cpp index de46de2..6ef3af4 100644 --- a/base/renderConfig.cpp +++ b/base/renderConfig.cpp @@ -47,14 +47,12 @@ void PlumageConfig::PlumageConfiguration::readConfigurationFromToml(std::string settings.fY = std::stof(fY, &sz); settings.cX = std::stof(cX, &sz); settings.cY = std::stof(cY, &sz); - settings.bottomCenter = glm::vec3(bottomCenter[0], bottomCenter[1], -bottomCenter[2]); - settings.bottomNormal = glm::vec3(bottomNormal[0], bottomNormal[1], -bottomNormal[2]); - settings.cameraFixation = glm::vec3(cameraFixation[0], cameraFixation[1], -cameraFixation[2]); - std::vector cameraTrackToFixation; + settings.bottomCenter = glm::vec3(bottomCenter[0], -bottomCenter[1], -bottomCenter[2]); + settings.bottomNormal = glm::vec3(bottomNormal[0], -bottomNormal[1], -bottomNormal[2]); + settings.cameraFixation = glm::vec3(cameraFixation[0], -cameraFixation[1], -cameraFixation[2]); auto cameraTracksAndAngleSize = std::min(cameraTracks.size(), cameraAngle.size()); settings.cameraTracks.resize(cameraTracksAndAngleSize); settings.cameraAngle.resize(cameraTracksAndAngleSize); - cameraTrackToFixation.resize(cameraTracksAndAngleSize); for (uint64_t i = 0; i < cameraTracksAndAngleSize; i++) { @@ -80,11 +78,10 @@ void PlumageConfig::PlumageConfiguration::readConfigurationFromToml(std::string settings.cameraFixation = cameraTracksRotationMatrix * glm::vec4(settings.cameraFixation, 1.0f); settings.bottomCenter = cameraTracksRotationMatrix * glm::vec4(settings.bottomCenter, 1.0f); - glm::vec3 translate =glm::vec3(0.0f,0.0f,0.0f) - settings.bottomCenter; + glm::vec3 translate =glm::vec3(0.f,0.f,0.f) - settings.bottomCenter; glm::mat4 trans = glm::mat4(1.0f); trans = glm::translate(trans, translate); settings.cameraFixation = trans * glm::vec4(settings.cameraFixation, 1.0f); - settings.bottomCenter = trans * glm::vec4(settings.bottomCenter, 1.0f); for (uint64_t i = 0; i < cameraTracksAndAngleSize; i++) { cameraTrackToFixation[i] = cameraTracksRotationMatrix * glm::vec4(cameraTrackToFixation[i], 1.0f); @@ -94,7 +91,7 @@ void PlumageConfig::PlumageConfiguration::readConfigurationFromToml(std::string settings.cameraAngle[i] = cameraTracksRotationMatrix * glm::mat4(settings.cameraAngle[i]) ; } //translate = settings.bottomCenter - ; - trans = glm::translate(trans, translate); + //trans = glm::translate(trans, translate); diff --git a/base/renderConfig.h b/base/renderConfig.h index 66d7048..52380e0 100644 --- a/base/renderConfig.h +++ b/base/renderConfig.h @@ -33,24 +33,24 @@ namespace PlumageConfig struct Settings { - bool validation = true; // УÑé²ã¿ª¹Ø - //bool fullscreen = false; // È«ÆÁ¿ª¹Ø - bool vsync = false; // ´¹Ö±Í¬²½¿ª¹Ø - bool headless = false; // ÎÞÍ·¿ª¹Ø + bool validation = true; // У��㿪�� + //bool fullscreen = false; // ȫ������ + bool vsync = false; // ��ֱͬ������ + bool headless = false; // ��ͷ���� bool outputPNGimage = false; bool debugMode = true; - bool cleanUpImageSequece = true; // ͼƬÐòÁпª¹Ø£¨ÔÝʱÆúÓã© + bool cleanUpImageSequece = true; // ͼƬ���п��أ���ʱ���ã� uint32_t width = 1280; uint32_t height = 720; - bool multiSampling = false; // ¶àÖزÉÑù - VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_4_BIT; // ¶àÖزÉÑù±¶ÂÊ - bool rotateModel = false; // Ä£ÐÍ×ÔÐýת - float modelRotateSpeed = 2.0f; // ×ÔÐýתËÙ¶È + bool multiSampling = false; // ���ز��� + VkSampleCountFlagBits sampleCount = VK_SAMPLE_COUNT_4_BIT; // ���ز������� + bool rotateModel = true; // ģ������ת + float modelRotateSpeed = 2.0f; // ����ת�ٶ� - uint32_t startFrameIndex = 1; // ͼƬÐòÁпªÊ¼Ö¡ - uint32_t endFrameIndex = 50; // ͼƬÐòÁнáÊøÖ¡ - uint32_t videoFrameRate = 25; // ÊÓƵ֡ÂÊ + uint32_t startFrameIndex = 1; // ͼƬ���п�ʼ֡ + uint32_t endFrameIndex = 50; // ͼƬ���н���֡ + uint32_t videoFrameRate = 25; // ��Ƶ֡�� uint32_t selectedPhysicalDeviceIndex = 7; float fX = 565.5f; @@ -76,13 +76,13 @@ namespace PlumageConfig { uint32_t width = 1280; uint32_t height = 720; - bool multiSampling = false; // ¶àÖزÉÑù - uint32_t sampleCount = VK_SAMPLE_COUNT_4_BIT; // ¶àÖزÉÑù±¶ÂÊ - bool rotateModel = false; // Ä£ÐÍ×ÔÐýת - float modelRotateSpeed = 2.0f; // ×ÔÐýתËÙ¶È - uint32_t startFrameIndex = 1; // ͼƬÐòÁпªÊ¼Ö¡ - uint32_t endFrameIndex = 50; // ͼƬÐòÁнáÊøÖ¡ - uint32_t videoFrameRate = 25; // ÊÓƵ֡ÂÊ + bool multiSampling = false; // ���ز��� + uint32_t sampleCount = VK_SAMPLE_COUNT_4_BIT; // ���ز������� + bool rotateModel = false; // ģ������ת + float modelRotateSpeed = 2.0f; // ����ת�ٶ� + uint32_t startFrameIndex = 1; // ͼƬ���п�ʼ֡ + uint32_t endFrameIndex = 50; // ͼƬ���н���֡ + uint32_t videoFrameRate = 25; // ��Ƶ֡�� uint32_t selectedPhysicalDeviceIndex = 7; }; @@ -90,7 +90,7 @@ namespace PlumageConfig struct FilePath { //model path - std::string glTFModelFilePath = getAssetPath() + "models/cube.gltf"; + std::string glTFModelFilePath = getAssetPath() + "models/classic_round_side_table.glb"; std::string modelVertShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.vert.spv"; std::string modelFragShaderPath = getAssetPath() + "buster_drone/shaders/glsl/mesh.frag.spv"; @@ -142,7 +142,7 @@ namespace PlumageConfig 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"; diff --git a/data/config/yukino_original_coord.toml b/data/config/yukino_original_coord.toml index 856f0ea..77836e7 100644 --- a/data/config/yukino_original_coord.toml +++ b/data/config/yukino_original_coord.toml @@ -3,7 +3,7 @@ width = 1080 height = 720 multiSampling = false sampleCount = 4 -rotateModel = false +rotateModel = true modelRotateSpeed = 2.0 startFrameIndex = 1 endFrameIndex = 200 diff --git a/src/render/render.cpp b/src/render/render.cpp index e173d18..170c96e 100644 --- a/src/render/render.cpp +++ b/src/render/render.cpp @@ -1538,13 +1538,13 @@ PlumageRender::PlumageRender() //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)); - translate = glm::vec3(-0.0f, -5.0f, -0.0f); + shaderDataScene.model = glm::mat4(1.0f); //translate += glm::vec3(0.0f, 0.f, 0.f) - settings.cameraFixation; shaderDataScene.model[0][0] = scale; shaderDataScene.model[1][1] = scale; shaderDataScene.model[2][2] = scale; - shaderDataScene.model = glm::translate(shaderDataScene.model, translate); + //shaderDataScene.model = glm::translate(shaderDataScene.model, translate); //camera.setPosition(glm::vec3(0, 0, -modelSize - 2)); //glm::vec3 aabbMax = glm::vec3(models.scene.aabb[0][0], models.scene.aabb[1][1], models.scene.aabb[2][2]); //glm::vec3 aabbMin = glm::vec3(models.scene.aabb[3][0], models.scene.aabb[3][1], models.scene.aabb[3][2]);