flip cubemap

test-headless
ink-soul 2024-04-23 10:42:15 +08:00
parent b588fa1636
commit d0ae241479
5 changed files with 13 additions and 8 deletions

View File

@ -41,7 +41,7 @@ private:
} }
else else
{ {
matrices.view = LookAt(position, to, up, true, true); matrices.view = LookAt(position, to, up, false, true);
} }
viewPos = glm::vec4(position, 0.0f) * glm::vec4(-1.0f, 1.0f, -1.0f, 1.0f); viewPos = glm::vec4(position, 0.0f) * glm::vec4(-1.0f, 1.0f, -1.0f, 1.0f);

View File

@ -76,7 +76,7 @@ namespace PlumageConfig
struct FilePath struct FilePath
{ //model path { //model path
std::string glTFModelFilePath = getAssetPath() + "models/DamagedHelmet/DamagedHelmet.gltf"; std::string glTFModelFilePath = getAssetPath() + "models/free_porsche_911_carrera_4s.glb";
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";

View File

@ -331,7 +331,7 @@ void VulkanExampleBase::renderFrame()
void VulkanExampleBase::renderLoop() void VulkanExampleBase::renderLoop()
{ {
uint32_t currentFrame = 0;
while (!signal.imageSequenceToVideoComplete) while (!signal.imageSequenceToVideoComplete)
{ {

View File

@ -92,7 +92,7 @@ public:
uint32_t selectedPhysicalDeviceIndex = 0; uint32_t selectedPhysicalDeviceIndex = 0;
bool prepared = false; bool prepared = false;
uint32_t currentFrame = 0;
float frameTimer = 1.0f; float frameTimer = 1.0f;
Camera camera; Camera camera;
glm::vec2 mousePos; glm::vec2 mousePos;

View File

@ -1047,6 +1047,9 @@ 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;
VkRect2D scissor{}; VkRect2D scissor{};
scissor.extent.width = dim; scissor.extent.width = dim;
@ -1079,7 +1082,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);
@ -1142,7 +1147,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(
@ -1517,7 +1522,7 @@ PlumageRender::PlumageRender()
camera.position.z * cos(glm::radians(camera.rotation.y)) * cos(glm::radians(camera.rotation.x)) camera.position.z * cos(glm::radians(camera.rotation.y)) * cos(glm::radians(camera.rotation.x))
); );
*/ */
shaderDataScene.camPos = settings.cameraTracks[] shaderDataScene.camPos = settings.cameraTracks[currentFrame];
// Skybox // Skybox
@ -1545,7 +1550,7 @@ PlumageRender::PlumageRender()
camera.type = Camera::CameraType::lookat; camera.type = Camera::CameraType::lookat;
camera.setProjectionMatrix(settings.fX,settings.fY,settings.cX,settings.cY,1.f, 256.f,settings.calibrationWidth,settings.calibrationHeight,true,true); camera.setProjectionMatrix(settings.fX,settings.fY,settings.cX,settings.cY,1.f, 256.f,settings.calibrationWidth,settings.calibrationHeight,false,true);
//camera.setPerspective(settings.fX, settings.fY, settings.cX, settings.cY, 1.0f, 256.0f); //camera.setPerspective(settings.fX, settings.fY, settings.cX, settings.cY, 1.0f, 256.0f);
camera.setTo(settings.bottomCenter); camera.setTo(settings.bottomCenter);
camera.setUp(settings.bottomNormal); camera.setUp(settings.bottomNormal);