Draw barrels properly

This commit is contained in:
2025-06-14 23:38:46 +01:00
parent 078a3cc7ea
commit 3f9b76b8d0
3 changed files with 19 additions and 14 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+15 -10
View File
@@ -37,21 +37,26 @@ worldSPic cfig u =
pointIsClose = cullPoint cfig w pointIsClose = cullPoint cfig w
drawCreature :: Creature -> SPic drawCreature :: Creature -> SPic
drawCreature cr = case _crType cr of drawCreature cr = case cr ^. crType of
BarrelCrit{} -> BarrelCrit{} ->
picAtCrPos1 uncurryV translateSPxy (_crPos cr) $ rotateSP (_crDir cr)
( setDepth 20 $ $ barrelShape
fold -- picAtCrPos1
[ color orange $ circleSolid 10 -- ( setDepth 20 $
, setDepth 0.049 . color (greyN 0.5) $ circleSolid 8 -- fold
, color (greyN 0.5) $ circleSolid 8 -- [ color orange $ circleSolid 10
] -- , setDepth 0.049 . color (greyN 0.5) $ circleSolid 8
) -- , color (greyN 0.5) $ circleSolid 8
cr -- ]
-- )
-- cr
LampCrit{_lampHeight = h} -> uncurryV translateSPxy (_crPos cr) $ lampCrSPic h LampCrit{_lampHeight = h} -> uncurryV translateSPxy (_crPos cr) $ lampCrSPic h
_ -> basicCrPict cr _ -> basicCrPict cr
-- NonDrawnCreature -> mempty -- NonDrawnCreature -> mempty
barrelShape :: SPic
barrelShape = noPic $ upperPrismPoly Medium Important 20 $ polyCirc 3 10
lampCrSPic :: Float -> SPic lampCrSPic :: Float -> SPic
lampCrSPic h = lampCrSPic h =
colorSH blue (upperBox Small Typical h $ rectWH 5 5) colorSH blue (upperBox Small Typical h $ rectWH 5 5)
+2 -2
View File
@@ -42,7 +42,7 @@ import Geometry
import qualified Quaternion as Q import qualified Quaternion as Q
import Shape.Data import Shape.Data
-- - approximate a circle by a polygon with n*2 points of radius x -- - approximate a circle around the z axis by a polygon with n*2 points of radius x
polyCirc :: Int -> Float -> [Point2] polyCirc :: Int -> Float -> [Point2]
{-# INLINE polyCirc #-} {-# INLINE polyCirc #-}
polyCirc n x = map (\a -> rotateV a (V2 x 0)) $ take (n * 2) [0, pi / fromIntegral n ..] polyCirc n x = map (\a -> rotateV a (V2 x 0)) $ take (n * 2) [0, pi / fromIntegral n ..]
@@ -120,9 +120,9 @@ upperPrismPolyTS :: Float -> [Point2] -> Shape
upperPrismPolyTS = upperPrismPoly Tiny Superfluous upperPrismPolyTS = upperPrismPoly Tiny Superfluous
upperPrismPoly :: upperPrismPoly ::
-- | height, expected to be strictly positive
Size -> Size ->
Importance -> Importance ->
-- | height, expected to be strictly positive
Float -> Float ->
-- | Should be anticlockwise -- | Should be anticlockwise
[Point2] -> [Point2] ->