Cleanup, start to add creature silhouettes

This commit is contained in:
2021-09-02 11:06:04 +01:00
parent 02193add68
commit 9d2f42dbc9
16 changed files with 142 additions and 94 deletions
+4 -4
View File
@@ -6,9 +6,9 @@ import Geometry
import qualified Data.IntMap as IM
crToBox :: Creature -> [[Point3]]
crToBox cr = map (map f . polyToTris) $ boxXYZ 10 10 15
crToBox cr = map (map f . polyToTris) $ boxXYZ 8 8 15
where
f = (+ V3 (x-5) (y-5) 1)
f = (+ V3 (x-4) (y-4) 1)
V2 x y = _crPos cr
youBox' :: World -> [[Point3]]
youBox' w = crToBox' $ _creatures w IM.! 0
@@ -17,9 +17,9 @@ youBox :: World -> [Point3]
youBox = concat . youBox'
crToBox' :: Creature -> [[Point3]]
crToBox' cr = map (map f . polyToTris) $ boxXYZ 20 20 15
crToBox' cr = map (map f . polyToTris) $ boxXYZ 12 12 15
where
f = (+ V3 (x-10) (y-10) 1)
f = (+ V3 (x-6) (y-6) 0)
V2 x y = _crPos cr
youSil :: World -> [Point3]
+26
View File
@@ -0,0 +1,26 @@
module Dodge.Creature.Silhouette
( creatureSilhouettes
, basicCrSilhouette
)
where
import Dodge.Data
import Polyhedra
import Geometry
import qualified Data.IntMap as IM
creatureSilhouettes :: World -> [Point3]
creatureSilhouettes w = concatMap f . IM.elems $ _creatures w
where
f cr = _crSilhouette cr cr
crBox :: [Point3]
crBox = constructEdgesList . map (map f . polyToTris) $ boxXYZ 12 12 15
where
f = (+ V3 (-6) (-6) 0)
basicCrSilhouette :: Creature -> [Point3]
basicCrSilhouette cr = map theTrans crBox
where
theTrans = (+ V3 x y 0)
V2 x y = _crPos cr