packages feed

geomancy-0.4.1.0 / src / Geomancy / Vulkan / DProjection.hs

module Geomancy.Vulkan.DProjection  ( reverseDepthRH  , reverseDepthOrthoRH  , orthoRH  ) whereimport Geomancy.DMat4 (colMajor)import Geomancy.DTransform (DTransform(..))reverseDepthRH  :: Double  -> Double  -> Double -> Double  -> DTransformreverseDepthRH fovRads zn width height =  colMajor    sx  0 0  0    0  sy 0  0    0   0 0 zn    0   0 1  0  where    sx = sy * recipAspect      where        recipAspect = height / width    sy = 1 / tan (fovRads / 2)orthoRH :: Double -> Double -> Double -> Double -> DTransformorthoRH near far width height =  colMajor    sx 0 0 0    0 sy 0 0    0  0 z w    0  0 0 1  where    sx = 2 / width    sy = 2 / height    z = 1 / (far - near)    w = near / (near - far)reverseDepthOrthoRH :: Double -> Double -> Double -> Double -> DTransformreverseDepthOrthoRH near far width height =  colMajor    sx 0 0 0    0 sy 0 0    0  0 z w    0  0 0 1  where    sx = 2 / width    sy = 2 / height    z = 1 / (near - far)    w = far / (far - near)