Simplify facade shape coloring
This commit is contained in:
@@ -84,7 +84,7 @@ drawTurret lw tu mc = fold $ do
|
|||||||
return $ overPosSP (turretItemOffset itm tu mc) (itemSPic itm)
|
return $ overPosSP (turretItemOffset itm tu mc) (itemSPic itm)
|
||||||
|
|
||||||
sensorSPic :: (PaletteColor, DecorationShape) -> SPic
|
sensorSPic :: (PaletteColor, DecorationShape) -> SPic
|
||||||
sensorSPic (pc, ds) = noPic $ decorationToShape ds w w 25 col
|
sensorSPic (pc, ds) = noPic $ colorSH col $ decorationToShape ds w w 25
|
||||||
where
|
where
|
||||||
col = paletteToColor pc
|
col = paletteToColor pc
|
||||||
w = 10
|
w = 10
|
||||||
|
|||||||
@@ -13,25 +13,24 @@ import Geometry
|
|||||||
import Shape
|
import Shape
|
||||||
|
|
||||||
tankSquareDec ::
|
tankSquareDec ::
|
||||||
(Float -> Float -> Float -> Color -> Shape) ->
|
(Float -> Float -> Float -> Shape) ->
|
||||||
Color ->
|
Color ->
|
||||||
Color ->
|
Color ->
|
||||||
Placement
|
Placement
|
||||||
--tankSquareDec dec = tankShape (reverse . orderPolygon $ square 20) (dec 20 20 31)
|
--tankSquareDec dec = tankShape (reverse . orderPolygon $ square 20) (dec 20 20 31)
|
||||||
tankSquareDec dec = tankShape (orderPolygon $ square 20) (dec 20 20 31)
|
tankSquareDec dec = tankShape (orderPolygon $ square 20) (dec 20 20 31)
|
||||||
|
|
||||||
tankShape :: [Point2] -> (Color -> Shape) -> Color -> Color -> Placement
|
tankShape :: [Point2] -> Shape -> Color -> Color -> Placement
|
||||||
tankShape baseshape facade col col' = sps0 $ decoratedBlock (facade col') Metal col 31 baseshape
|
tankShape baseshape facade col col' = sps0 $ decoratedBlock (colorSH col' facade) Metal col 31 baseshape
|
||||||
|
|
||||||
roundTank :: Color -> Color -> Placement
|
roundTank :: Color -> Color -> Placement
|
||||||
roundTank = tankShape (polyCirc 4 20) $
|
roundTank c c' = tankShape (polyCirc 4 20)
|
||||||
\c' -> colorSH c' $ foldMap toprail (take 8 [0, pi / 4 ..])
|
(colorSH c' $ foldMap toprail (take 8 [0, pi / 4 ..])) c c'
|
||||||
where
|
where
|
||||||
toprail a = rotateSH a $ thinHighBar 31 (V2 0 20) (rotateV (pi / 4) $ V2 0 20)
|
toprail a = rotateSH a $ thinHighBar 31 (V2 0 20) (rotateV (pi / 4) $ V2 0 20)
|
||||||
|
|
||||||
roundTankCross :: Color -> Color -> Placement
|
roundTankCross :: Color -> Color -> Placement
|
||||||
roundTankCross = tankShape (polyCirc 4 20) $
|
roundTankCross c' c = tankShape (polyCirc 4 20)
|
||||||
\c ->
|
(colorSH c $
|
||||||
colorSH c $
|
|
||||||
thinHighBar 31 (V2 20 0) (V2 (-20) 0)
|
thinHighBar 31 (V2 20 0) (V2 (-20) 0)
|
||||||
<> thinHighBar 31 (V2 0 20) (V2 0 (-20))
|
<> thinHighBar 31 (V2 0 20) (V2 0 (-20))) c' c
|
||||||
|
|||||||
@@ -8,49 +8,45 @@ module Dodge.Placement.TopDecoration (
|
|||||||
plusDecoration,
|
plusDecoration,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Color
|
|
||||||
import Dodge.Data.GenParams
|
import Dodge.Data.GenParams
|
||||||
import Dodge.Room.Foreground
|
import Dodge.Room.Foreground
|
||||||
import Geometry
|
import Geometry
|
||||||
import Shape
|
import Shape
|
||||||
|
|
||||||
decorationToShape :: DecorationShape -> Float -> Float -> Float -> Color -> Shape
|
decorationToShape :: DecorationShape -> Float -> Float -> Float -> Shape
|
||||||
decorationToShape = \case
|
decorationToShape = \case
|
||||||
PLUS -> plusDecoration
|
PLUS -> plusDecoration
|
||||||
SQUARE -> squareDecoration
|
SQUARE -> squareDecoration
|
||||||
CIRCLE -> circleDecoration
|
CIRCLE -> circleDecoration
|
||||||
THREELINES -> threeLineDecoration
|
THREELINES -> threeLineDecoration
|
||||||
|
|
||||||
midBarDecoration :: Float -> Float -> Float -> Color -> Shape
|
midBarDecoration :: Float -> Float -> Float -> Shape
|
||||||
midBarDecoration w h z c =
|
midBarDecoration w h z =
|
||||||
embossingR
|
embossingR
|
||||||
<> rotateSH pi embossingR
|
<> rotateSH pi embossingR
|
||||||
<> colorSH c (thinHighBar (z + 7) (V2 (-0.3 * w) 0) (V2 (0.3 * w) 0))
|
<> thinHighBar (z + 7) (V2 (-0.3 * w) 0) (V2 (0.3 * w) 0)
|
||||||
where
|
where
|
||||||
w' = 0.3 * w
|
w' = 0.3 * w
|
||||||
embossingR =
|
embossingR =
|
||||||
colorSH c $
|
|
||||||
prismPoly
|
prismPoly
|
||||||
Medium
|
Medium
|
||||||
Typical
|
Typical
|
||||||
[V3 w h z, V3 w (0.3 * h) 41, V3 w (-0.3 * h) 41, V3 w (- h) z]
|
[V3 w h z, V3 w (0.3 * h) 41, V3 w (-0.3 * h) 41, V3 w (- h) z]
|
||||||
[V3 w' h z, V3 w' (0.3 * h) 41, V3 w' (-0.3 * h) 41, V3 w' (- h) z]
|
[V3 w' h z, V3 w' (0.3 * h) 41, V3 w' (-0.3 * h) 41, V3 w' (- h) z]
|
||||||
|
|
||||||
fourEmbossDecoration :: Float -> Float -> Float -> Color -> Shape
|
fourEmbossDecoration :: Float -> Float -> Float -> Shape
|
||||||
fourEmbossDecoration w h z c = colorSH c $ foldMap f [(w, h), (- w, h), (w, - h), (- w, - h)]
|
fourEmbossDecoration w h z = foldMap f [(w, h), (- w, h), (w, - h), (- w, - h)]
|
||||||
where
|
where
|
||||||
f (a, b) = translateSH (V3 (a / 2) (b / 2) z) embossing
|
f (a, b) = translateSH (V3 (a / 2) (b / 2) z) embossing
|
||||||
embossing = upperBoxHalf Large Typical 10 $ rectNSWE (h / 2) (- h / 2) (- w / 2) (w / 2)
|
embossing = upperBoxHalf Large Typical 10 $ rectNSWE (h / 2) (- h / 2) (- w / 2) (w / 2)
|
||||||
|
|
||||||
plusDecoration :: Float -> Float -> Float -> Color -> Shape
|
plusDecoration :: Float -> Float -> Float -> Shape
|
||||||
plusDecoration w h z c =
|
plusDecoration w h z =
|
||||||
colorSH c $
|
|
||||||
thinHighBar z (V2 w 0) (V2 (- w) 0)
|
thinHighBar z (V2 w 0) (V2 (- w) 0)
|
||||||
<> thinHighBar z (V2 0 h) (V2 0 (- h))
|
<> thinHighBar z (V2 0 h) (V2 0 (- h))
|
||||||
|
|
||||||
squareDecoration :: Float -> Float -> Float -> Color -> Shape
|
squareDecoration :: Float -> Float -> Float -> Shape
|
||||||
squareDecoration w h z col =
|
squareDecoration w h z =
|
||||||
colorSH col $
|
|
||||||
foldMap
|
foldMap
|
||||||
f
|
f
|
||||||
[ (w', - w', h', h')
|
[ (w', - w', h', h')
|
||||||
@@ -63,14 +59,13 @@ squareDecoration w h z col =
|
|||||||
h' = h - 1.5
|
h' = h - 1.5
|
||||||
f (a, c, b, d) = thinHighBar z (V2 a b) (V2 c d)
|
f (a, c, b, d) = thinHighBar z (V2 a b) (V2 c d)
|
||||||
|
|
||||||
circleDecoration :: Float -> Float -> Float -> Color -> Shape
|
circleDecoration :: Float -> Float -> Float -> Shape
|
||||||
circleDecoration w _ z c = colorSH c $ foldMap toprail (take 8 [0, pi / 4 ..])
|
circleDecoration w _ z = foldMap toprail (take 8 [0, pi / 4 ..])
|
||||||
where
|
where
|
||||||
toprail a = rotateSH a $ thinHighBar z (V2 0 w) (rotateV (pi / 4) $ V2 0 w)
|
toprail a = rotateSH a $ thinHighBar z (V2 0 w) (rotateV (pi / 4) $ V2 0 w)
|
||||||
|
|
||||||
threeLineDecoration :: Float -> Float -> Float -> Color -> Shape
|
threeLineDecoration :: Float -> Float -> Float -> Shape
|
||||||
threeLineDecoration w h z col =
|
threeLineDecoration w h z =
|
||||||
colorSH col $
|
|
||||||
foldMap
|
foldMap
|
||||||
f
|
f
|
||||||
[ (w', - w', h', h')
|
[ (w', - w', h', h')
|
||||||
|
|||||||
Reference in New Issue
Block a user