corrected compile-mistakes due to indentation
This commit is contained in:
parent
6bb915c25c
commit
fc72fd8095
18
src/Main.hs
18
src/Main.hs
@ -243,8 +243,8 @@ run = do
|
|||||||
|
|
||||||
(mt,tc,sleepAmount,frameTime) <- liftIO $ do
|
(mt,tc,sleepAmount,frameTime) <- liftIO $ do
|
||||||
let double = fromRational.toRational :: (Real a) => a -> Double
|
let double = fromRational.toRational :: (Real a) => a -> Double
|
||||||
targetFramerate = 60.0
|
targetFramerate = 60.0
|
||||||
targetFrametime = 1.0/targetFramerate
|
targetFrametime = 1.0/targetFramerate
|
||||||
--targetFrametimeμs = targetFrametime * 1000000.0
|
--targetFrametimeμs = targetFrametime * 1000000.0
|
||||||
now <- getCurrentTime
|
now <- getCurrentTime
|
||||||
let diff = diffUTCTime now (state ^. io.clock) -- get time-diffs
|
let diff = diffUTCTime now (state ^. io.clock) -- get time-diffs
|
||||||
@ -253,14 +253,14 @@ run = do
|
|||||||
SDL.setWindowTitle (env ^. windowObject) title
|
SDL.setWindowTitle (env ^. windowObject) title
|
||||||
let sleepAmount = floor ((targetFrametime - double diff)*1000000) :: Int -- get time until next frame in microseconds
|
let sleepAmount = floor ((targetFrametime - double diff)*1000000) :: Int -- get time until next frame in microseconds
|
||||||
clockFactor = (state ^. io.tessClockFactor)
|
clockFactor = (state ^. io.tessClockFactor)
|
||||||
tessChange
|
tessChange
|
||||||
| (clockFactor < (75*targetFrametime)) && (state ^. gl.glMap.stateTessellationFactor < 5) = ((+)1 :: Int -> Int)
|
| (clockFactor < (75*targetFrametime)) && (state ^. gl.glMap.stateTessellationFactor < 5) = ((+)1 :: Int -> Int)
|
||||||
-- > last 100 frames had > 25% leftover (on avg.)
|
-- > last 100 frames had > 25% leftover (on avg.)
|
||||||
| (clockFactor > (110*targetFrametime)) && (state ^. gl.glMap.stateTessellationFactor > 1) = (flip (-) 1 :: Int -> Int)
|
| (clockFactor > (110*targetFrametime)) && (state ^. gl.glMap.stateTessellationFactor > 1) = (flip (-) 1 :: Int -> Int)
|
||||||
-- > last 100 frames had < 90% of target-fps
|
-- > last 100 frames had < 90% of target-fps
|
||||||
| otherwise = ((+)0 :: Int -> Int) -- 0ms > x > 10% -> keep settings
|
| otherwise = ((+)0 :: Int -> Int) -- 0ms > x > 10% -> keep settings
|
||||||
when (sleepAmount > 0) $ threadDelay sleepAmount
|
when (sleepAmount > 0) $ threadDelay sleepAmount
|
||||||
now' <- getCurrentTime
|
now' <- getCurrentTime
|
||||||
return (now',tessChange,sleepAmount,ddiff)
|
return (now',tessChange,sleepAmount,ddiff)
|
||||||
-- set state with new clock-time
|
-- set state with new clock-time
|
||||||
--liftIO $ putStrLn $ unwords ["clockFactor:",show (state ^. io.tessClockFactor),"\ttc:", show (tc (state ^. gl.glMap.stateTessellationFactor)),"\tsleep ",show frameTime,"ms"]
|
--liftIO $ putStrLn $ unwords ["clockFactor:",show (state ^. io.tessClockFactor),"\ttc:", show (tc (state ^. gl.glMap.stateTessellationFactor)),"\tsleep ",show frameTime,"ms"]
|
||||||
|
@ -128,7 +128,7 @@ initMapShader tessFac (buf, vertDes) = do
|
|||||||
|
|
||||||
smap <- genObjectName
|
smap <- genObjectName
|
||||||
|
|
||||||
testobj <- parseIQM "sample.iqm"
|
testobj <- parseIQM "models/box.iqm"
|
||||||
|
|
||||||
let
|
let
|
||||||
objs = [MapObject testobj (L.V3 0 10 0) (MapObjectState ())]
|
objs = [MapObject testobj (L.V3 0 10 0) (MapObjectState ())]
|
||||||
|
Loading…
Reference in New Issue
Block a user