rever to rotation fix

test-headless
ink-soul 2024-04-28 11:24:37 +08:00
parent deb39f20d7
commit a8b5ebfb4c
5 changed files with 31 additions and 34 deletions

View File

@ -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(

View File

@ -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<glm::vec3> 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);

View File

@ -33,24 +33,24 @@ namespace PlumageConfig
struct Settings {
bool validation = true; // 校验层开关
//bool fullscreen = false; // 全屏开关
bool vsync = false; // 垂直同步开关
bool headless = false; // 无头开关
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 outputPNGimage = false;
bool debugMode = true;
bool cleanUpImageSequece = true; // 图片序列开关(暂时弃用)
bool cleanUpImageSequece = true; // ͼƬ<EFBFBD><EFBFBD><EFBFBD>п<EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>
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; // <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; // ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת
float modelRotateSpeed = 2.0f; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD>ٶ<EFBFBD>
uint32_t startFrameIndex = 1; // 图片序列开始帧
uint32_t endFrameIndex = 50; // 图片序列结束帧
uint32_t videoFrameRate = 25; // 视频帧率
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>
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; // <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>
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";
// 配置文件路径,命令行传入后保存在这
// <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";

View File

@ -3,7 +3,7 @@ width = 1080
height = 720
multiSampling = false
sampleCount = 4
rotateModel = false
rotateModel = true
modelRotateSpeed = 2.0
startFrameIndex = 1
endFrameIndex = 200

View File

@ -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]);