Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type PrimitiveName = Int
- type USize = Int
- data PrimitiveStreamData = PrimitiveStreamData PrimitiveName USize
- newtype PrimitiveStream t a = PrimitiveStream [(a, (Maybe PointSize, PrimitiveStreamData))]
- class VertexInput a where
- type VertexFormat a
- toVertex :: ToVertex a (VertexFormat a)
- type UniOffset = Int
- data ToVertex a b = ToVertex !(Kleisli (StateT (Ptr ()) IO) a b) !(Kleisli (StateT (Int, UniOffset, OffsetToSType) (Reader (Int -> ExprM Text))) a b) !(Kleisli (State [Binding -> (IO VAOKey, IO ())]) a b)
- toPrimitiveStream :: forall os f s a p. (PrimitiveTopology p, VertexInput a) => (s -> PrimitiveArray p a) -> Shader os s (PrimitiveStream p (VertexFormat a))
- toPrimitiveStream' :: forall os f s a b p. (PrimitiveTopology p, VertexInput a) => Maybe (s -> Buffer os b) -> (s -> PrimitiveArray p a) -> Shader os s (PrimitiveStream p (VertexFormat a))
- data InputIndices = InputIndices {}
- withInputIndices :: (a -> InputIndices -> b) -> PrimitiveStream p a -> PrimitiveStream p b
- type PointSize = VFloat
- withPointSize :: (a -> PointSize -> (b, PointSize)) -> PrimitiveStream Points a -> PrimitiveStream Points b
- append :: Monad m => a -> StateT [a] m ()
- makeVertexF :: forall (m :: Type -> Type) p1 b1 p2 b2 c. Monad m => p1 -> (SType -> ExprM Text -> b1) -> SType -> p2 -> StateT (Int, b2, c) m b1
- makeBindVertexFx :: forall (m :: Type -> Type) a1 a2 b. (Monad m, Integral a1) => Bool -> GLint -> GLenum -> B a2 -> StateT [a1 -> (IO VAOKey, IO ())] m b
- makeBindVertexFnorm :: GLint -> GLenum -> B a -> StateT [Binding -> (IO VAOKey, IO ())] Identity b
- makeBindVertexF :: GLint -> GLenum -> B a -> StateT [Binding -> (IO VAOKey, IO ())] Identity b
- makeVertexI :: forall (m :: Type -> Type) p1 b1 p2 b2 c. Monad m => p1 -> (SType -> ExprM Text -> b1) -> SType -> p2 -> StateT (Int, b2, c) m b1
- makeBindVertexI :: forall (m :: Type -> Type) a1 a2 b. (Monad m, Integral a1) => GLint -> GLenum -> B a2 -> StateT [a1 -> (IO VAOKey, IO ())] m b
- noWriter :: Kleisli (StateT (Ptr ()) IO) b1 b2
- toUniformVertex :: forall a b. Storable a => SType -> ToVertex a (S V b)
- unBnorm :: Normalized t -> t
Documentation
type PrimitiveName = Int Source #
newtype PrimitiveStream t a Source #
A
is a stream of primitives of
type PrimitiveStream
t a t
where the vertices are values of type a
. You
can operate a stream's vertex values using the Functor
instance (this will result in a shader running on the GPU).
You may also append PrimitiveStream
s using the Monoid
instance, but if possible append the origin PrimitiveArray
s instead, as this will create more optimized
draw calls.
PrimitiveStream [(a, (Maybe PointSize, PrimitiveStreamData))] |
Instances
Functor (PrimitiveStream t) Source # | |
Defined in Graphics.GPipe.Internal.PrimitiveStream fmap :: (a -> b) -> PrimitiveStream t a -> PrimitiveStream t b # (<$) :: a -> PrimitiveStream t b -> PrimitiveStream t a # | |
Semigroup (PrimitiveStream t a) Source # | |
Defined in Graphics.GPipe.Internal.PrimitiveStream (<>) :: PrimitiveStream t a -> PrimitiveStream t a -> PrimitiveStream t a # sconcat :: NonEmpty (PrimitiveStream t a) -> PrimitiveStream t a # stimes :: Integral b => b -> PrimitiveStream t a -> PrimitiveStream t a # | |
Monoid (PrimitiveStream t a) Source # | |
Defined in Graphics.GPipe.Internal.PrimitiveStream mempty :: PrimitiveStream t a # mappend :: PrimitiveStream t a -> PrimitiveStream t a -> PrimitiveStream t a # mconcat :: [PrimitiveStream t a] -> PrimitiveStream t a # |
class VertexInput a where Source #
This class constraints which buffer types can be turned into vertex values, and what type those values have.
type VertexFormat a Source #
The type the buffer value will be turned into once it becomes a vertex value.
toVertex :: ToVertex a (VertexFormat a) Source #
An arrow action that turns a value from it's buffer representation to it's vertex representation. Use toVertex
from
the GPipe provided instances to operate in this arrow. Also note that this arrow needs to be able to return a value
lazily, so ensure you use
proc ~pattern -> do ...
.
Instances
The arrow type for toVertex
.
ToVertex !(Kleisli (StateT (Ptr ()) IO) a b) !(Kleisli (StateT (Int, UniOffset, OffsetToSType) (Reader (Int -> ExprM Text))) a b) !(Kleisli (State [Binding -> (IO VAOKey, IO ())]) a b) |
toPrimitiveStream :: forall os f s a p. (PrimitiveTopology p, VertexInput a) => (s -> PrimitiveArray p a) -> Shader os s (PrimitiveStream p (VertexFormat a)) Source #
Create a primitive stream from a primitive array provided from the shader environment.
TODO No way to constraint b
a bit more?
toPrimitiveStream' :: forall os f s a b p. (PrimitiveTopology p, VertexInput a) => Maybe (s -> Buffer os b) -> (s -> PrimitiveArray p a) -> Shader os s (PrimitiveStream p (VertexFormat a)) Source #
data InputIndices Source #
withInputIndices :: (a -> InputIndices -> b) -> PrimitiveStream p a -> PrimitiveStream p b Source #
Like fmap
, but where the vertex and instance IDs are provided as arguments as well.
withPointSize :: (a -> PointSize -> (b, PointSize)) -> PrimitiveStream Points a -> PrimitiveStream Points b Source #
Like fmap
, but where each point's size is provided as arguments as well, and a new point size is set for each point in addition to the new vertex value.
When a PrimitiveStream
of Points
is created, all points will have the default size of 1.
makeVertexF :: forall (m :: Type -> Type) p1 b1 p2 b2 c. Monad m => p1 -> (SType -> ExprM Text -> b1) -> SType -> p2 -> StateT (Int, b2, c) m b1 Source #
makeBindVertexFx :: forall (m :: Type -> Type) a1 a2 b. (Monad m, Integral a1) => Bool -> GLint -> GLenum -> B a2 -> StateT [a1 -> (IO VAOKey, IO ())] m b Source #
makeBindVertexFnorm :: GLint -> GLenum -> B a -> StateT [Binding -> (IO VAOKey, IO ())] Identity b Source #
makeBindVertexF :: GLint -> GLenum -> B a -> StateT [Binding -> (IO VAOKey, IO ())] Identity b Source #
makeVertexI :: forall (m :: Type -> Type) p1 b1 p2 b2 c. Monad m => p1 -> (SType -> ExprM Text -> b1) -> SType -> p2 -> StateT (Int, b2, c) m b1 Source #
makeBindVertexI :: forall (m :: Type -> Type) a1 a2 b. (Monad m, Integral a1) => GLint -> GLenum -> B a2 -> StateT [a1 -> (IO VAOKey, IO ())] m b Source #
unBnorm :: Normalized t -> t Source #