Open
Description
I'm using nalgebra-glm to do some work with the Vulkan API through Vulkano. The perspective matrix generated by perspective_rh_zo
flips the Z axis in the wrong direction. I chose this function since Vulkan operates with a right handed coordinate system and the Z axis goes from 0 to 1 rather than -1 to 1.
According to these two posts:
Why projection matrices typically used with OpenGL fail with Vulkan
Setting Up a Proper Projection Matrix for Vulkan
Following the math from the second post shows all that needs to change to create a 'proper' Vulkan perspective matrix is change:
//matrix_clip_space.rs
//pub fn perspective_rh_zo
mat[(0, 0)] = one / (aspect * tan_half_fovy);
to
mat[(0, 0)] = aspect / tan_half_fovy;
I'm not sure if a new function should be added or if the existing one should be changed.