Improve level generation speed
This commit is contained in:
+8
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user