Fix vulkan projection matrix
This commit is contained in:
parent
53351257fc
commit
7199409de4
@ -30,11 +30,13 @@ void GEVulkanCameraSceneNode::render()
|
|||||||
|
|
||||||
m_ubo_data.m_view_matrix = ViewArea.getTransform(irr::video::ETS_VIEW);
|
m_ubo_data.m_view_matrix = ViewArea.getTransform(irr::video::ETS_VIEW);
|
||||||
m_ubo_data.m_projection_matrix = ViewArea.getTransform(irr::video::ETS_PROJECTION);
|
m_ubo_data.m_projection_matrix = ViewArea.getTransform(irr::video::ETS_PROJECTION);
|
||||||
// Irrlicht matrix4 was originally designed for OpenGL,
|
// https://matthewwellings.com/blog/the-new-vulkan-coordinate-system/
|
||||||
// where the Y coordinate of the clip coordinates is inverted.
|
// Vulkan clip space has inverted Y and half Z
|
||||||
// The easiest way to compensate for that is to flip the sign on the
|
irr::core::matrix4 clip;
|
||||||
// scaling factor of the Y axis in the projection matrix.
|
clip[5] = -1.0f;
|
||||||
m_ubo_data.m_projection_matrix(1, 1) *= -1.0f;
|
clip[10] = 0.5f;
|
||||||
|
clip[14] = 0.5f;
|
||||||
|
m_ubo_data.m_projection_matrix = clip * m_ubo_data.m_projection_matrix;
|
||||||
GEVulkanDriver* vk = getVKDriver();
|
GEVulkanDriver* vk = getVKDriver();
|
||||||
if (!vk->getRTTTexture())
|
if (!vk->getRTTTexture())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user