| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Geomancy.Vulkan.Projection
Documentation
reverseDepthRH :: Float -> Float -> Float -> Float -> Transform Source #
Construct a view-to-NDC transformation.
This will shove a camera frustum (an expanding pyramid) into a Vulkan "clip space" box with the dimensions [-1; 1] left-to-right, [-1; 1] top-to-bottom, and [1; 0] into the screen.
That is, things further away in the view will be pulled into [0; 0; 0] point on the *back* of the box. And things that on the near plane set by the argument to this function will be scaled to match the aspect ratio and the field of view.
When using FoV pi/2 and width=@height the points with Z=near will keep their positions in the XY plane.
NOTE: To update your code using a vanilla perspective:
Change your depth buffer's clear value. Instead of clearing to 1.0 (farthest), you now clear to 0.0. Change your depth comparison function. Instead of VK_COMPARE_OP_LESS, you must use VK_COMPARE_OP_GREATER.