Hopefully fully excise streaming

This commit is contained in:
2022-08-22 12:02:42 +01:00
parent b7a77cdbd9
commit aeb22fc9d7
10 changed files with 6 additions and 54 deletions
-4
View File
@@ -18,10 +18,6 @@ import Data.Maybe
import Data.List
import Data.Bifunctor
import Control.Lens
--import qualified Streaming.Prelude as S
--picMap :: (Verx -> Verx) -> Picture -> Picture
--picMap = map
picFormat :: [Verx] -> Picture
picFormat = id
+2 -2
View File
@@ -21,7 +21,7 @@ import qualified Data.Vector.Mutable as MV
import Control.Monad.Primitive
import Graphics.GL.Core43
import Control.Monad
import qualified Streaming.Prelude as S
import qualified Data.Vector.Fusion.Stream.Monadic as VFSM
divideSize :: Int -> Size -> Size
divideSize i (Size x y) = Size (div x $ fromIntegral i) (div y $ fromIntegral i)
@@ -53,7 +53,7 @@ createLightMap pdata lightPoints nWalls nSils nCaps drawObjShads toPos = do
-- to consider: adding normals/a "material" for each fragment
blendFunc $= (Zero, OneMinusSrcColor)
stencilTest $= Enabled
flip S.mapM_ (S.each lightPoints) $ \(V3 x y z,rad,V3 r g b) -> do
flip VFSM.mapM_ (VFSM.fromList lightPoints) $ \(V3 x y z,rad,V3 r g b) -> do
depthFunc $= Just Less
-- setup stencil
colorMask $= Color4 Disabled Disabled Disabled Disabled
+3 -3
View File
@@ -10,9 +10,9 @@ import Graphics.Rendering.OpenGL hiding (Line,translate,scale,imageHeight,Polygo
import Foreign hiding (rotate)
import qualified Data.Vector.Unboxed.Mutable as UMV
import qualified Data.Vector.Mutable as MV
import qualified Data.Vector.Fusion.Stream.Monadic as VFSM
import Control.Monad.Primitive
import Control.Monad
import qualified Streaming.Prelude as S
bindArrayBuffers :: Int -> VBO -> IO ()
{-# INLINABLE bindArrayBuffers #-}
@@ -32,8 +32,8 @@ bindShaderLayers shads counts = MV.imapM_ f shads
let theVBO = _vaoVBO $ _shadVAO shad
stride = sum $ _vboAttribSizes theVBO
bindBuffer ArrayBuffer $= (Just . _vbo $ theVBO)
--VS.mapM_ (g stride theVBO) $ VS.enumFromStepN 0 1 6 -- [0..5]
S.mapM_ (g stride theVBO) $ S.each [0..5]
VFSM.mapM_ (g stride theVBO) $ VFSM.enumFromStepN 0 1 6 -- [0..5]
--S.mapM_ (g stride theVBO) $ S.each [0..5]
where
g stride theVBO lay = do
-1
View File
@@ -21,7 +21,6 @@ module Shape
import Geometry
import Shape.Data
import Color
--import qualified Streaming.Prelude as S
singleShape :: ShapeObj -> Shape
{-# INLINE singleShape #-}
-2
View File
@@ -12,8 +12,6 @@ import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Geometry.Data
--import Streaming
{-# INLINE shVfromList #-}
shVfromList = id
-2
View File
@@ -20,8 +20,6 @@ import Geometry
import Data.Bifunctor
import Control.Lens
--import qualified Streaming.Prelude as S
shMap :: (ShapeObj -> ShapeObj) -> Shape -> Shape
shMap = map
-1
View File
@@ -26,7 +26,6 @@ import qualified SDL.Mixer as Mix
import Data.Maybe
import qualified IntMapHelp as IM
import qualified Data.Map as M
--import qualified Streaming.Prelude as S
import Control.Monad
import Control.Monad.Trans
import Control.Monad.Trans.Maybe
-33
View File
@@ -1,33 +0,0 @@
module StreamingHelp
( minStreamOn
, sortStreamOn
, module Streaming
, module StreamingHelp.Data
) where
import Streaming
import StreamingHelp.Data
import qualified Streaming.Prelude as S
import qualified Control.Foldl as L
import Data.Function (on)
minStreamOn :: Ord a => (b -> a) -> StreamOf b -> Maybe b
{-# INLINE minStreamOn #-}
minStreamOn f = runIdentity
. L.purely S.fold_ (L.minimumBy (compare `on` f))
-- this hopefully also nub the stream in most cases
--orderStreamOn :: Ord b => (a -> b) -> Stream (Of a) Identity () -> Identity (Of (M.Map b a) ())
sortStreamOn :: Ord a => (b -> a) -> StreamOf b -> Stream (Of b) Identity ()
{-# INLINE sortStreamOn #-}
sortStreamOn f = S.each . runIdentity . L.purely S.fold_ L.map . S.map g
where
g x = (f x,x)
--applyUnzip
-- :: (Stream (Of a) IO () -> IO r)
-- -> (Stream (Of b) IO () -> IO ())
-- -> Stream (Of a) (Stream g IO) ()
-- -> IO r
--applyUnzip f g s = h s
-5
View File
@@ -1,5 +0,0 @@
module StreamingHelp.Data where
import Streaming
type StreamOf a = Stream (Of a) Identity ()
newtype StreamOf' a = StreamOf' (Stream (Of a) Identity ())