diff options
Diffstat (limited to 'PointPrimitiveRing.hs')
-rw-r--r-- | PointPrimitiveRing.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/PointPrimitiveRing.hs b/PointPrimitiveRing.hs index bd9a15b..ff55df5 100644 --- a/PointPrimitiveRing.hs +++ b/PointPrimitiveRing.hs | |||
@@ -30,9 +30,9 @@ data Ring = Ring | |||
30 | { rBufferObject :: Word32 | 30 | { rBufferObject :: Word32 |
31 | , rStorage :: GLStorage | 31 | , rStorage :: GLStorage |
32 | , rObject :: Object | 32 | , rObject :: Object |
33 | , rSize :: IORef CPtrdiff | 33 | , rSize :: IORef CPtrdiff -- Current count of Floats in the ring buffer. |
34 | , rStart :: IORef CPtrdiff | 34 | , rStart :: IORef CPtrdiff -- Float-index where next vector will be added. TODO: rename this. |
35 | , ringCapacity :: CPtrdiff | 35 | , ringCapacity :: CPtrdiff -- Maximum number of floats in buffer. |
36 | } | 36 | } |
37 | 37 | ||
38 | addToObjectArray :: GLStorage | 38 | addToObjectArray :: GLStorage |
@@ -210,9 +210,9 @@ updateRingCommands r = do | |||
210 | start <- fmap (fromIntegral . (`div` 3)) $ readIORef $ rStart r | 210 | start <- fmap (fromIntegral . (`div` 3)) $ readIORef $ rStart r |
211 | size <- fmap (fromIntegral . (`div` 3)) $ readIORef $ rSize r | 211 | size <- fmap (fromIntegral . (`div` 3)) $ readIORef $ rSize r |
212 | let mask 0 = [] | 212 | let mask 0 = [] |
213 | mask cnt = if start + size < cnt | 213 | mask cnt = case cnt + start - size of |
214 | then [(start,size)] | 214 | st | st > cnt -> [(st - cnt,size)] |
215 | else [(0,start + size - cnt), (start,cnt-start)] | 215 | | otherwise -> [(0,start), (st,cnt - st)] |
216 | updateCommands (rStorage r) (rObject r) mask | 216 | updateCommands (rStorage r) (rObject r) mask |
217 | readIORef (objCommands $ rObject r) >>= mapM_ print | 217 | readIORef (objCommands $ rObject r) >>= mapM_ print |
218 | return () | 218 | return () |