Improve level generation speed

This commit is contained in:
jgk
2021-08-16 20:56:49 +02:00
parent 37db056f23
commit 650e58bdfa
11 changed files with 168 additions and 133 deletions
+8 -2
View File
@@ -23,6 +23,7 @@ module Picture
, lineCol
, text
, pictures
, tranRot
, translate
, rotate
, scale
@@ -161,7 +162,11 @@ translate3 !a !b (V3 x y z) = V3 (x+a) (y+b) z
translate :: Float -> Float -> Picture -> Picture
{-# INLINE translate #-}
translate !x !y = map $! overPos $! translate3 x y
translate x = map . overPos . translate3 x
tranRot :: V2 Float -> Float -> Picture -> Picture
{-# INLINE tranRot #-}
tranRot (V2 x y) r = map $ overPos (translate3 x y . rotate3 r)
setDepth :: Float -> Picture -> Picture
{-# INLINE setDepth #-}
@@ -190,7 +195,7 @@ scale x y = map $ overPos $ scale3 x y
rotate :: Float -> Picture -> Picture
{-# INLINE rotate #-}
rotate a = map $ overPos $ rotate3 a
rotate = map . overPos . rotate3
pictures :: [Picture] -> Picture
{-# INLINE pictures #-}
@@ -372,6 +377,7 @@ greyN :: Float -> Color
{-# INLINE greyN #-}
greyN x = toV4 (x,x,x,1)
-- Currently the lens version is much slower
overPos :: (Point3 -> Point3) -> Verx -> Verx
{-# INLINE overPos #-}
--overPos = over vxPos