module Graphics.Rendering.Ombra.Object.Types where
import Data.Proxy (Proxy)
import Data.Monoid
import qualified Graphics.Rendering.Ombra.Blend as Blend
import qualified Graphics.Rendering.Ombra.Stencil as Stencil
import Graphics.Rendering.Ombra.Geometry.Types
import Graphics.Rendering.Ombra.Color
import Graphics.Rendering.Ombra.Internal.GL (ActiveTexture)
import Graphics.Rendering.Ombra.Internal.TList
import Graphics.Rendering.Ombra.Shader.CPU
import Graphics.Rendering.Ombra.Shader.ShaderVar
import Graphics.Rendering.Ombra.Texture.Types
data Object (gs :: [*]) (is :: [*]) where
(:~>) :: Global g -> Object gs is -> Object (g ': gs) is
Mesh :: ((i : is') ~ is) => Geometry (i : is') -> Object '[] is
NoMesh :: Object gs is
Prop :: ObjProp -> Object gs is -> Object gs is
Append :: Object gs is -> Object gs is -> Object gs is
data ObjProp = Blend (Maybe Blend.Mode)
| Stencil (Maybe Stencil.Mode)
| Cull (Maybe CullFace)
| DepthTest Bool
| DepthMask Bool
| ColorMask (Bool, Bool, Bool, Bool)
infixr 2 :~>
data Global g where
Single :: (ShaderVar g, Uniform 'S g)
=> (a -> g) -> (CPU 'S g) -> Global g
Mirror :: (ShaderVar g, Uniform 'M g)
=> Proxy g -> (CPU 'M g) -> Global g
WithTexture :: Texture -> (ActiveTexture -> Global g) -> Global g
WithTextureSize :: Texture -> ((Int, Int) -> Global g) -> Global g
WithFramebufferSize :: ((Int, Int) -> Global g) -> Global g
data CullFace = CullFront | CullBack | CullFrontBack deriving Eq
instance (ShaderVars gs, ShaderVars is) => Monoid (Object gs is) where
mempty = NoMesh
mappend = Append