module Graphics.Rendering.Ombra.Layer.Types where
import Data.Word (Word8)
import Graphics.Rendering.Ombra.Color
import Graphics.Rendering.Ombra.Internal.TList
import Graphics.Rendering.Ombra.Object.Types
import Graphics.Rendering.Ombra.Shader.Program
import Graphics.Rendering.Ombra.Texture.Types
import Graphics.Rendering.Ombra.Texture.Internal
type Layer = Layer' Drawable () ()
data Layer' (s :: LayerStatus) t a where
Layer :: (Subset pi oi, Subset pg og)
=> Program pg pi
-> Object og oi
-> Layer' s t ()
TextureLayer :: Bool
-> [LayerType]
-> (Int, Int)
-> (Int, Int, Int, Int)
-> Bool
-> Bool
-> Layer' s t a
-> Layer' NonDrawable t
(a, [TTexture t], Maybe [Color], Maybe [Word8])
Permanent :: TTexture t -> Layer' NonDrawable t Texture
WithTTextures :: [TTexture t]
-> ([Texture] -> Layer)
-> Layer' NonDrawable t ()
Free :: (forall t. Layer' NonDrawable t a) -> Layer' s t a
Clear :: [Buffer] -> Layer' s t ()
Cast :: Layer' Drawable t a -> Layer' Drawable t' a
Bind :: Layer' s t a -> (a -> Layer' s t b) -> Layer' s t b
Return :: a -> Layer' s t a
newtype TTexture t = TTexture LoadedTexture deriving Eq
data LayerStatus = Drawable | NonDrawable
data Buffer = ColorBuffer | DepthBuffer | StencilBuffer
data LayerType = ColorLayer
| DepthLayer
| DepthStencilLayer
| BufferLayer Int deriving Eq
instance Functor (Layer' s t) where
fmap f = flip Bind $ Return . f
instance Applicative (Layer' s t) where
lf <*> lx = Bind lf $ \f -> Bind lx $ \x -> Return $ f x
pure = Return
instance Monad (Layer' s t) where
(>>=) = Bind
return = Return