Refactor lighting shaders

This commit is contained in:
jgk
2021-06-25 00:44:45 +02:00
parent 6320093473
commit b451953b99
13 changed files with 44 additions and 80 deletions
+4 -9
View File
@@ -48,7 +48,6 @@ setupLoop
initParams
paramCleanup
$ doLoop window startWorld sideEffects eventFn worldFn
-- | The internal loop.
doLoop
:: Window -- ^ The SDL window.
@@ -81,7 +80,6 @@ doLoop
doLoop window updatedWorld worldSideEffects eventFn worldUpdate newParams
Nothing -> return ()
-- | Handle quit events in a manner to exit the loop. Other events handled as
-- determined by the custom function, although resize events also change the viewport.
applyEventIO :: (world -> Event -> Maybe world) -> Maybe world -> Event -> IO (Maybe world)
@@ -91,16 +89,13 @@ applyEventIO fn mw e = case eventPayload e of
WindowSizeChangedEvent WindowSizeChangedEventData {windowSizeChangedEventSize = V2 x y}
-> GL.viewport $= (GL.Position 0 0,GL.Size x y) >> return (mw >>= \w -> fn w e)
_ -> return $ mw >>= flip fn e
-- | Create an OpenGL SDL window configuration with a given x and y size.
winConfig :: Int -> Int -> WindowConfig
winConfig x y = defaultWindow
{ windowGraphicsContext
= OpenGLContext (defaultOpenGL { glProfile = Core Normal 4 3
, glColorPrecision = V4 8 8 8 8
}
)
{ windowGraphicsContext = OpenGLContext $ defaultOpenGL
{ glProfile = Core Normal 4 3
, glColorPrecision = V4 8 8 8 8
}
, windowInitialSize = V2 (fromIntegral x) (fromIntegral y)
, windowResizable =True
}