diff options
author | Joe Crayne <joe@jerkface.net> | 2019-05-19 22:44:20 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-05-19 22:44:20 -0400 |
commit | 2d89afcf5a50aac49709c90a293374b18aaa2db2 (patch) | |
tree | 99369681aae2cc0430a57f90adf93474bba07507 | |
parent | dc5aecfffbe071e9b8714988b9824c4f445f8dfc (diff) |
Interface tweak to PointPrimitive ring buffer.
-rw-r--r-- | MeshSketch.hs | 3 | ||||
-rw-r--r-- | PointPrimitiveRing.hs | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/MeshSketch.hs b/MeshSketch.hs index cca9524..2b29f0a 100644 --- a/MeshSketch.hs +++ b/MeshSketch.hs | |||
@@ -573,8 +573,7 @@ pushRing w st h k = do | |||
573 | plane <- readIORef (stPlane st) | 573 | plane <- readIORef (stPlane st) |
574 | d <- worldCoordinates st h k plane | 574 | d <- worldCoordinates st h k plane |
575 | Just win <- getWidgetWindow w | 575 | Just win <- getWidgetWindow w |
576 | pushBack (stRingBuffer st) $ do | 576 | pushBack (stRingBuffer st) $ \RingPoint{..} -> do |
577 | RingPoint{..} <- return $ rKeys (stRingBuffer st) | ||
578 | rpPosition @<- d | 577 | rpPosition @<- d |
579 | windowInvalidateRect win Nothing False | 578 | windowInvalidateRect win Nothing False |
580 | return d | 579 | return d |
diff --git a/PointPrimitiveRing.hs b/PointPrimitiveRing.hs index 47819e3..3647d4a 100644 --- a/PointPrimitiveRing.hs +++ b/PointPrimitiveRing.hs | |||
@@ -84,11 +84,11 @@ updateRingCommands r = do | |||
84 | readIORef (objCommands $ rObject r) >>= mapM_ print | 84 | readIORef (objCommands $ rObject r) >>= mapM_ print |
85 | return () | 85 | return () |
86 | 86 | ||
87 | pushBack :: Ring keys -> Writer [DSum AttributeKey GLUniformValue] a -> IO () | 87 | pushBack :: Ring keys -> (keys -> Writer [DSum AttributeKey GLUniformValue] a) -> IO () |
88 | pushBack r attrs = do | 88 | pushBack r attrs = do |
89 | back <- readIORef $ rBack r | 89 | back <- readIORef $ rBack r |
90 | writeIORef (rBack r) (mod (back + 1) (ringCapacity r)) | 90 | writeIORef (rBack r) (mod (back + 1) (ringCapacity r)) |
91 | updateAttributes back attrs | 91 | updateAttributes back $ attrs (rKeys r) |
92 | sz <- readIORef (rSize r) | 92 | sz <- readIORef (rSize r) |
93 | when (sz < ringCapacity r) $ writeIORef (rSize r) (sz + 1) | 93 | when (sz < ringCapacity r) $ writeIORef (rSize r) (sz + 1) |
94 | updateRingCommands r | 94 | updateRingCommands r |