Safe Haskell | None |
---|---|
Language | Haskell98 |
Graphics.GPipe.PrimitiveStream
Description
A PrimitiveArray
can be turned into a PrimitiveStream
in a Shader
, in order to operate on the vertices of it and ultimately rasterize it into
a FragmentStream
.
- data PrimitiveStream t a
- class BufferFormat a => VertexInput a where
- type VertexFormat a
- toVertex :: ToVertex a (VertexFormat a)
- data ToVertex a b
- toPrimitiveStream :: forall os f s a p. VertexInput a => (s -> PrimitiveArray p a) -> Shader os f s (PrimitiveStream p (VertexFormat a))
- withInputIndices :: (a -> InputIndices -> b) -> PrimitiveStream p a -> PrimitiveStream p b
- data InputIndices = InputIndices {}
The data type
data 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.
Instances
Functor (PrimitiveStream t) | |
Monoid (PrimitiveStream t a) |
class BufferFormat a => VertexInput a where Source
This class constraints which buffer types can be turned into vertex values, and what type those values have.
Associated Types
type VertexFormat a Source
The type the buffer value will be turned into once it becomes a vertex value.
Methods
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
Creating PrimitiveStreams
toPrimitiveStream :: forall os f s a p. VertexInput a => (s -> PrimitiveArray p a) -> Shader os f s (PrimitiveStream p (VertexFormat a)) Source
Create a primitive stream from a primitive array provided from the shader environment.
Various PrimitiveStream operations
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.
data InputIndices Source
Constructors
InputIndices | |
Fields
|