Implement foreground correctly, not with shadows though

This commit is contained in:
jgk
2021-06-10 13:53:03 +02:00
parent 21a4393ad9
commit aa30f6b969
7 changed files with 34 additions and 74 deletions
+16
View File
@@ -16,11 +16,13 @@ module Shader
, resetShaderUniforms
, extractProgAndUnis
, freeShaderPointers
, setPerpMatUniform
, module Shader.Data
)
where
import Geometry
import Shader.Data
import MatrixHelper
import Foreign
import Codec.Picture
@@ -250,6 +252,20 @@ setShaderUniforms rot czoom (tranx,trany) (winx,winy) fss = do
uniform (snd shad !! 3) $= Vector2 tranx trany
uniform (snd shad !! 4) $= wmata
setPerpMatUniform
:: Float -- ^ rotation
-> Float -- ^ zoom
-> Point2 -- ^ translation
-> Point2 -- ^ window size
-> Point2 -- ^ viewfrom point
-> FullShader a
-> IO ()
setPerpMatUniform rot czoom trans wins vFrom shad = do
pmat <- (newMatrix RowMajor $ perspectiveMatrix rot czoom trans wins vFrom) :: IO (GLmatrix GLfloat)
currentProgram $= Just (_shaderProgram shad)
uniform (_shaderUniforms shad !! 4) $= pmat
return ()
freeShaderPointers :: FullShader a -> IO ()
freeShaderPointers fs = do
forM_ (_vaoBufferTargets $ _shaderVAO fs) $ \(_,ptr,_) ->