Performance improvements, combine cap and geometry buffer

This commit is contained in:
2021-09-18 19:48:35 +01:00
parent 80aa67015c
commit c605ac74ff
8 changed files with 48 additions and 20 deletions
+6
View File
@@ -24,6 +24,7 @@ import Picture.Data
import Tile
import Polyhedra
import Polyhedra.Data
import Shape
import Control.Monad.State
import Control.Lens
@@ -78,6 +79,11 @@ setupWorldBounds w = w
setupForegroundEdgeVerxs :: World -> World
setupForegroundEdgeVerxs w = w & foregroundEdgeVerx .~ polyhedrasToEdges (_foregroundDecorations w)
& foregroundShape .~ Shape vs es
where
vs = shVfromList $ concatMap (polyToTris . map toShape) $ concatMap _pyFaces $ _foregroundDecorations w
es = shEfromList $ polyhedrasToEdges (_foregroundDecorations w)
toShape (p3,p4) = ShapeV p3 p4
polyhedrasToEdges :: [Polyhedra] -> [Point3]
polyhedrasToEdges = concatMap tflat4 . concatMap polyToEdges