Reset Shapes to be list (not stream) of ShapeObj
This commit is contained in:
+8
-8
@@ -43,16 +43,16 @@ initialAnoTree = OnwardList
|
|||||||
[ IntAnno $ AnTree . startRoom
|
[ IntAnno $ AnTree . startRoom
|
||||||
, AnRoom $ roomCCrits 0
|
, AnRoom $ roomCCrits 0
|
||||||
, AnRoom $ return airlock0
|
, AnRoom $ return airlock0
|
||||||
-- , AnRoom slowDoorRoom
|
, AnRoom slowDoorRoom
|
||||||
-- , AnRoom $ roomCCrits 10
|
-- , AnRoom $ roomCCrits 10
|
||||||
-- , AnTree firstBreather
|
-- , AnTree firstBreather
|
||||||
, AnTree $ telRoomLev 1 >>= rToOnward "telRoomLev" . pure . cleatOnward
|
-- , AnTree $ telRoomLev 1 >>= rToOnward "telRoomLev" . pure . cleatOnward
|
||||||
]
|
-- ]
|
||||||
|
--
|
||||||
extraAnoList :: [Annotation]
|
--extraAnoList :: [Annotation]
|
||||||
extraAnoList =
|
--extraAnoList =
|
||||||
-- , (SpecificRoom . return . tToBTree $ treePost [corridor,corridor,cleatOnward corridor])
|
---- , (SpecificRoom . return . tToBTree $ treePost [corridor,corridor,cleatOnward corridor])
|
||||||
[ AnRoom $ roomCCrits 10
|
-- [ AnRoom $ roomCCrits 10
|
||||||
, AnRoom $ roomCCrits 10
|
, AnRoom $ roomCCrits 10
|
||||||
, AnTree $ tToBTree "spawners" <$> spawnerRoom
|
, AnTree $ tToBTree "spawners" <$> spawnerRoom
|
||||||
, AnRoom pistolerRoom
|
, AnRoom pistolerRoom
|
||||||
|
|||||||
+8
-2
@@ -98,11 +98,17 @@ pokeShape :: Ptr Float -> Ptr GLushort -> Ptr GLushort
|
|||||||
-> IO (Int,Int,Int)
|
-> IO (Int,Int,Int)
|
||||||
pokeShape ptr iptr ieptr = S.foldM_ (pokeShapeObj ptr iptr ieptr) (return (0,0,0)) return
|
pokeShape ptr iptr ieptr = S.foldM_ (pokeShapeObj ptr iptr ieptr) (return (0,0,0)) return
|
||||||
|
|
||||||
|
--pokeShape' :: Ptr Float -> Ptr GLushort -> Ptr GLushort
|
||||||
|
-- -> (Int,Int,Int)
|
||||||
|
-- -> Stream (Of ShapeObj) IO ()
|
||||||
|
-- -> IO (Int,Int,Int)
|
||||||
|
--pokeShape' ptr iptr ieptr is = S.foldM_ (pokeShapeObj ptr iptr ieptr) (return is) return
|
||||||
|
--
|
||||||
pokeShape' :: Ptr Float -> Ptr GLushort -> Ptr GLushort
|
pokeShape' :: Ptr Float -> Ptr GLushort -> Ptr GLushort
|
||||||
-> (Int,Int,Int)
|
-> (Int,Int,Int)
|
||||||
-> Stream (Of ShapeObj) IO ()
|
-> [ShapeObj]
|
||||||
-> IO (Int,Int,Int)
|
-> IO (Int,Int,Int)
|
||||||
pokeShape' ptr iptr ieptr is = S.foldM_ (pokeShapeObj ptr iptr ieptr) (return is) return
|
pokeShape' ptr iptr ieptr is = S.foldM_ (pokeShapeObj ptr iptr ieptr) (return is) return . S.each
|
||||||
|
|
||||||
pokeShapeObj
|
pokeShapeObj
|
||||||
:: Ptr Float
|
:: Ptr Float
|
||||||
|
|||||||
+11
-5
@@ -23,6 +23,12 @@ import Shape.Data
|
|||||||
import Color
|
import Color
|
||||||
import qualified Streaming.Prelude as S
|
import qualified Streaming.Prelude as S
|
||||||
|
|
||||||
|
singleShape :: ShapeObj -> Shape
|
||||||
|
{-# INLINE singleShape #-}
|
||||||
|
singleShape = (:[])
|
||||||
|
|
||||||
|
shMap = map
|
||||||
|
|
||||||
emptySH :: Shape
|
emptySH :: Shape
|
||||||
{-# INLINE emptySH #-}
|
{-# INLINE emptySH #-}
|
||||||
emptySH = mempty
|
emptySH = mempty
|
||||||
@@ -45,7 +51,7 @@ prismPoly
|
|||||||
-> [Point3]
|
-> [Point3]
|
||||||
-> Shape
|
-> Shape
|
||||||
{-# INLINE prismPoly #-}
|
{-# INLINE prismPoly #-}
|
||||||
prismPoly upps downps = S.yield (ShapeObj (TopPrism n) (f upps downps))
|
prismPoly upps downps = singleShape (ShapeObj (TopPrism n) (f upps downps))
|
||||||
where
|
where
|
||||||
n = length upps
|
n = length upps
|
||||||
f (a:as) (b:bs) = g a:g b:f as bs
|
f (a:as) (b:bs) = g a:g b:f as bs
|
||||||
@@ -58,7 +64,7 @@ upperPrismPoly
|
|||||||
-> [Point2]
|
-> [Point2]
|
||||||
-> Shape
|
-> Shape
|
||||||
{-# INLINE upperPrismPoly #-}
|
{-# INLINE upperPrismPoly #-}
|
||||||
upperPrismPoly h ps = S.yield (ShapeObj (TopPrism n) (f ps))
|
upperPrismPoly h ps = singleShape (ShapeObj (TopPrism n) (f ps))
|
||||||
where
|
where
|
||||||
n = length ps
|
n = length ps
|
||||||
g h' (V2 x y) = pairToSV (V3 x y h', black)
|
g h' (V2 x y) = pairToSV (V3 x y h', black)
|
||||||
@@ -70,7 +76,7 @@ upperPrismPolyHalf
|
|||||||
-> [Point2]
|
-> [Point2]
|
||||||
-> Shape
|
-> Shape
|
||||||
{-# INLINE upperPrismPolyHalf #-}
|
{-# INLINE upperPrismPolyHalf #-}
|
||||||
upperPrismPolyHalf h ps = S.yield (ShapeObj (TopPrism n) (f upps downps))
|
upperPrismPolyHalf h ps = singleShape (ShapeObj (TopPrism n) (f upps downps))
|
||||||
where
|
where
|
||||||
n = length ps
|
n = length ps
|
||||||
upps = map f' ps
|
upps = map f' ps
|
||||||
@@ -86,7 +92,7 @@ colorSH = overColSH . const
|
|||||||
|
|
||||||
overColSH :: (Point4 -> Point4) -> Shape -> Shape
|
overColSH :: (Point4 -> Point4) -> Shape -> Shape
|
||||||
{-# INLINE overColSH #-}
|
{-# INLINE overColSH #-}
|
||||||
overColSH = S.map . overColObj
|
overColSH = shMap . overColObj
|
||||||
|
|
||||||
translateSH :: Point3 -> Shape -> Shape
|
translateSH :: Point3 -> Shape -> Shape
|
||||||
{-# INLINE translateSH #-}
|
{-# INLINE translateSH #-}
|
||||||
@@ -106,7 +112,7 @@ rotateSH = overPosSH . rotate3
|
|||||||
|
|
||||||
overPosSH :: (Point3 -> Point3) -> Shape -> Shape
|
overPosSH :: (Point3 -> Point3) -> Shape -> Shape
|
||||||
{-# INLINEABLE overPosSH #-}
|
{-# INLINEABLE overPosSH #-}
|
||||||
overPosSH = S.map . overPosObj
|
overPosSH = shMap . overPosObj
|
||||||
|
|
||||||
rotateSHx :: Float -> Shape -> Shape
|
rotateSHx :: Float -> Shape -> Shape
|
||||||
{-# INLINE rotateSHx #-}
|
{-# INLINE rotateSHx #-}
|
||||||
|
|||||||
+2
-1
@@ -10,7 +10,8 @@ import Geometry.Data
|
|||||||
--import Data.Vector.Fusion.Util
|
--import Data.Vector.Fusion.Util
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Streaming
|
import Streaming
|
||||||
type Shape = Stream (Of ShapeObj) IO ()
|
type Shape' = Stream (Of ShapeObj) IO ()
|
||||||
|
type Shape = [ShapeObj]
|
||||||
|
|
||||||
--_shVertices :: Shape -> [ShapeV]
|
--_shVertices :: Shape -> [ShapeV]
|
||||||
--{-# INLINE _shVertices #-}
|
--{-# INLINE _shVertices #-}
|
||||||
|
|||||||
+4
-2
@@ -23,6 +23,8 @@ import qualified Streaming.Prelude as S
|
|||||||
|
|
||||||
type SPic = (Shape, Picture)
|
type SPic = (Shape, Picture)
|
||||||
|
|
||||||
|
shMap = map
|
||||||
|
|
||||||
-- should all this be inlined/inlinable?
|
-- should all this be inlined/inlinable?
|
||||||
noPic :: Shape -> SPic
|
noPic :: Shape -> SPic
|
||||||
{-# INLINE noPic #-}
|
{-# INLINE noPic #-}
|
||||||
@@ -58,12 +60,12 @@ rotateSP a = bimap (rotateSH a) (rotate a)
|
|||||||
|
|
||||||
mirrorSPxz :: SPic -> SPic
|
mirrorSPxz :: SPic -> SPic
|
||||||
{-# INLINE mirrorSPxz #-}
|
{-# INLINE mirrorSPxz #-}
|
||||||
mirrorSPxz = bimap (S.map (over shVs reverse) . overPosSH flipy) mirrorxz
|
mirrorSPxz = bimap (shMap (over shVs reverse) . overPosSH flipy) mirrorxz
|
||||||
where
|
where
|
||||||
flipy (V3 x y z) = V3 x (negate y) z
|
flipy (V3 x y z) = V3 x (negate y) z
|
||||||
|
|
||||||
mirrorSPyz :: SPic -> SPic
|
mirrorSPyz :: SPic -> SPic
|
||||||
{-# INLINE mirrorSPyz #-}
|
{-# INLINE mirrorSPyz #-}
|
||||||
mirrorSPyz = bimap (S.map (over shVs reverse) . overPosSH flipx) mirroryz
|
mirrorSPyz = bimap (shMap (over shVs reverse) . overPosSH flipx) mirroryz
|
||||||
where
|
where
|
||||||
flipx (V3 x y z) = V3 (negate x) y z
|
flipx (V3 x y z) = V3 (negate x) y z
|
||||||
|
|||||||
Reference in New Issue
Block a user