pub fn inverse_perspective_vulkan(fov_rad: f32, near: f32, far: f32, aspect: f32) -> Self {
        let mut res = Self::identity();

        let thfov = (fov_rad * 0.5).tan();
        let c = far / (far - near);
        let d = (-far * near) / (far - near);

        res.values[cr(0, 0)] = thfov * aspect;
        res.values[cr(1, 1)] = thfov;

        res.values[cr(3, 2)] = 1.0;

        res.values[cr(2, 2)] = 0.0;
        res.values[cr(2, 3)] = 1.0 / d;
        res.values[cr(3, 3)] = -c / d;

        res
    }
/// Creates an inverse perspective matrix
/// with z mapped to \[0; 1\], as expected by Vulkan.
///
/// This matrix can be used to reconstruct the world position from a uv/depth pair in a shader.
/// This pseudo code can be used:
/// ```GLSL
/// vec4 clipPos = vec4(uv.xy, depth, 1.0);
/// vec4 worldPos = invProjection * clipPos;
/// worldPos /= worldPos.w;
/// ```
Creates an inverse perspective matrix
with z mapped to \[0; 1\], as expected by Vulkan.

This matrix can be used to reconstruct the world position from a uv/depth pair in a shader.
Creates an inverse perspective matrix with z mapped to \ [ 0 ; 1 \ ] as expected by Vulkan . This matrix can be used to reconstruct the world position from a uv / depth pair in a shader .
pub fn inverse_perspective_vulkan(fov_rad: f32, near: f32, far: f32, aspect: f32) -> Self {
        let mut res = Self::identity();
        let thfov = (fov_rad * 0.5).tan();
        let c = far / (far - near);
        let d = (-far * near) / (far - near);
        res.values[cr(0, 0)] = thfov * aspect;
        res.values[cr(1, 1)] = thfov;
        res.values[cr(3, 2)] = 1.0;
        res.values[cr(2, 2)] = 0.0;
        res.values[cr(2, 3)] = 1.0 / d;
        res.values[cr(3, 3)] = -c / d;
        res
    }
pub fn inverse_perspective_vulkan ( fov_rad : f32 , near : f32 , far : f32 , aspect : f32 ) -> Self { let mut res = Self :: identity ( ) ; let thfov = ( fov_rad * 0.5 ) . tan ( ) ; let c = far / ( far - near ) ; let d = ( - far * near ) / ( far - near ) ; res . values [ cr ( 0 , 0 ) ] = thfov * aspect ; res . values [ cr ( 1 , 1 ) ] = thfov ; res . values [ cr ( 3 , 2 ) ] = 1.0 ; res . values [ cr ( 2 , 2 ) ] = 0.0 ; res . values [ cr ( 2 , 3 ) ] = 1.0 / d ; res . values [ cr ( 3 , 3 ) ] = - c / d ; res }
Creates an inverse perspective matrix
with z mapped to \[0; 1\], as expected by Vulkan.
Creates an inverse perspective matrix with z mapped to \ [ 0 ; 1 \ ] as expected by Vulkan .
fov_rad
f32
near
f32
far
f32
aspect
f32
fov_rad
f32
near
f32
far
f32
aspect
f32