Tweak single bind pass
This commit is contained in:
+39
-13
@@ -148,23 +148,27 @@ extrapolate (ox,oy) (ax,ay) (bx,by) (x,y) =
|
|||||||
|
|
||||||
color :: RGBA -> Picture -> Picture
|
color :: RGBA -> Picture -> Picture
|
||||||
{-# INLINE color #-}
|
{-# INLINE color #-}
|
||||||
color c = map $ second $ overCol (const c)
|
--color c = map $ second $ overCol (const c)
|
||||||
|
color c = map $ overCol' (const c)
|
||||||
|
|
||||||
translate3 :: Float -> Float -> Point3 -> Point3
|
translate3 :: Float -> Float -> Point3 -> Point3
|
||||||
{-# INLINE translate3 #-}
|
{-# INLINE translate3 #-}
|
||||||
translate3 a b (x,y,z) = (x+a,y+b,z)
|
translate3 a b (x,y,z) = (x+a,y+b,z)
|
||||||
|
|
||||||
translate :: Float -> Float -> Picture -> Picture
|
translate :: Float -> Float -> Picture -> Picture
|
||||||
{-# INLINE translate #-}
|
--{-# INLINE translate #-}
|
||||||
translate x y = map $ second $ overPos (translate3 x y)
|
--translate x y = map $ second $ overPos (translate3 x y)
|
||||||
|
translate x y = map $ overPos' (translate3 x y)
|
||||||
|
|
||||||
setDepth :: Float -> Picture -> Picture
|
setDepth :: Float -> Picture -> Picture
|
||||||
{-# INLINE setDepth #-}
|
--{-# INLINE setDepth #-}
|
||||||
setDepth d = map $ second $ overPos (\(x,y,_) -> (x,y,d))
|
--setDepth d = map $ second $ overPos (\(x,y,_) -> (x,y,d))
|
||||||
|
setDepth d = map $ overPos' (\(x,y,_) -> (x,y,d))
|
||||||
|
|
||||||
addDepth :: Float -> Picture -> Picture
|
addDepth :: Float -> Picture -> Picture
|
||||||
{-# INLINE addDepth #-}
|
--{-# INLINE addDepth #-}
|
||||||
addDepth d = map $ second $ overPos (\(x,y,z) -> (x,y,z+d))
|
--addDepth d = map $ second $ overPos (\(x,y,z) -> (x,y,z+d))
|
||||||
|
addDepth d = map $ overPos' (\(x,y,z) -> (x,y,z+d))
|
||||||
|
|
||||||
setLayer :: Int -> Picture -> Picture
|
setLayer :: Int -> Picture -> Picture
|
||||||
{-# INLINE setLayer #-}
|
{-# INLINE setLayer #-}
|
||||||
@@ -175,12 +179,14 @@ scale3 :: Float -> Float -> Point3 -> Point3
|
|||||||
scale3 a b (x,y,z) = (x*a,y*b,z)
|
scale3 a b (x,y,z) = (x*a,y*b,z)
|
||||||
|
|
||||||
scale :: Float -> Float -> Picture -> Picture
|
scale :: Float -> Float -> Picture -> Picture
|
||||||
{-# INLINE scale #-}
|
--{-# INLINE scale #-}
|
||||||
scale x y = map . second . overPos $ scale3 x y
|
--scale x y = map . second . overPos $ scale3 x y
|
||||||
|
scale x y = map $ overPos' $ scale3 x y
|
||||||
|
|
||||||
rotate :: Float -> Picture -> Picture
|
rotate :: Float -> Picture -> Picture
|
||||||
{-# INLINE rotate #-}
|
--{-# INLINE rotate #-}
|
||||||
rotate a = map . second . overPos $ rotate3 a
|
--rotate a = map . second . overPos $ rotate3 a
|
||||||
|
rotate a = map $ overPos' $ rotate3 a
|
||||||
|
|
||||||
pictures :: [Picture] -> Picture
|
pictures :: [Picture] -> Picture
|
||||||
{-# INLINE pictures #-}
|
{-# INLINE pictures #-}
|
||||||
@@ -336,15 +342,35 @@ bright (r,g,b,a) = (r*1.2,g*1.2,b*1.2,a)
|
|||||||
greyN :: Float -> Color
|
greyN :: Float -> Color
|
||||||
greyN x = (x,x,x,1)
|
greyN x = (x,x,x,1)
|
||||||
|
|
||||||
|
overPos' :: (Point3 -> Point3) -> (Int,RenderType) -> (Int,RenderType)
|
||||||
|
--{-# INLINE overPos' #-}
|
||||||
|
overPos' f (i,RenderPoly vs) = (i, RenderPoly $ map (first f) vs )
|
||||||
|
overPos' f (i,RenderText vs) = (i, RenderText $ map (\(a,b,c) -> (f a,b,c)) vs )
|
||||||
|
overPos' f (i,RenderBezQ vs) = (i, RenderBezQ $ map (\(a,b,c) -> (f a,b,c)) vs )
|
||||||
|
overPos' f (i,RenderEllipse vs) = (i, RenderEllipse $ map (first f) vs )
|
||||||
|
overPos' f (i,RenderArc vs) = (i, RenderArc $ map (\(a,b,c) -> (f a,b,c)) vs )
|
||||||
|
overPos' f (i,RenderPolyZ vs) = (i, RenderPolyZ $ map (\(a,b,c) -> (f a,b,c)) vs )
|
||||||
|
overPos' _ rt = rt
|
||||||
|
|
||||||
overPos :: (Point3 -> Point3) -> RenderType -> RenderType
|
overPos :: (Point3 -> Point3) -> RenderType -> RenderType
|
||||||
--{-# INLINE overPos #-}
|
{-# INLINE overPos #-}
|
||||||
overPos f (RenderPoly vs) = RenderPoly $ map (first f) vs
|
overPos f (RenderPoly vs) = RenderPoly $ map (first f) vs
|
||||||
overPos f (RenderText vs) = RenderText $ map (\(a,b,c) -> (f a,b,c)) vs
|
overPos f (RenderText vs) = RenderText $ map (\(a,b,c) -> (f a,b,c)) vs
|
||||||
overPos f (RenderBezQ vs) = RenderBezQ $ map (\(a,b,c) -> (f a,b,c)) vs
|
overPos f (RenderBezQ vs) = RenderBezQ $ map (\(a,b,c) -> (f a,b,c)) vs
|
||||||
overPos f (RenderEllipse vs) = RenderEllipse $ map (first f) vs
|
overPos f (RenderEllipse vs) = RenderEllipse $ map (first f) vs
|
||||||
overPos f (RenderArc vs) = RenderArc $ map (\(a,b,c) -> (f a,b,c)) vs
|
overPos f (RenderArc vs) = RenderArc $ map (\(a,b,c) -> (f a,b,c)) vs
|
||||||
overPos f (RenderPolyZ vs) = RenderPolyZ $ map (\(a,b,c) -> (f a,b,c)) vs
|
overPos f (RenderPolyZ vs) = RenderPolyZ $ map (\(a,b,c) -> (f a,b,c)) vs
|
||||||
overPos _ _ = undefined
|
overPos _ rt = rt
|
||||||
|
|
||||||
|
overCol' :: (Point4 -> Point4) -> (Int,RenderType) -> (Int,RenderType)
|
||||||
|
--{-# INLINE overCol #-}
|
||||||
|
overCol' f (i,(RenderPoly vs) ) = (i,RenderPoly $ map (second f) vs )
|
||||||
|
overCol' f (i,(RenderEllipse vs)) = (i,RenderEllipse $ map (second f) vs )
|
||||||
|
overCol' f (i,(RenderText vs) ) = (i,RenderText $ map (\(a,b,c) -> (a,f b,c)) vs )
|
||||||
|
overCol' f (i,(RenderBezQ vs) ) = (i,RenderBezQ $ map (\(a,b,c) -> (a,f b,c)) vs )
|
||||||
|
overCol' f (i,(RenderArc vs) ) = (i,RenderArc $ map (\(a,b,c) -> (a,f b,c)) vs )
|
||||||
|
overCol' f (i,(RenderPolyZ vs) ) = (i,RenderPolyZ $ map (\(a,b,c) -> (a,f b,c)) vs )
|
||||||
|
overCol' _ _ = undefined
|
||||||
|
|
||||||
overCol :: (Point4 -> Point4) -> RenderType -> RenderType
|
overCol :: (Point4 -> Point4) -> RenderType -> RenderType
|
||||||
--{-# INLINE overCol #-}
|
--{-# INLINE overCol #-}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ floatSize = sizeOf (0.5 :: GLfloat)
|
|||||||
|
|
||||||
numDrawableElements :: Int
|
numDrawableElements :: Int
|
||||||
{-# INLINE numDrawableElements #-}
|
{-# INLINE numDrawableElements #-}
|
||||||
numDrawableElements = 70000
|
numDrawableElements = 60000
|
||||||
|
|
||||||
numSubElements :: Int
|
numSubElements :: Int
|
||||||
{-# INLINE numSubElements #-}
|
{-# INLINE numSubElements #-}
|
||||||
|
|||||||
Reference in New Issue
Block a user