GPipe-2.2.5: Typesafe functional GPU graphics programming

Safe HaskellNone
LanguageHaskell98

Graphics.GPipe.PrimitiveStream

Contents

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.

Synopsis

The data type

data PrimitiveStream t a Source #

A PrimitiveStream t a is a stream of primitives of type 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 PrimitiveStreams using the Monoid instance, but if possible append the origin PrimitiveArrays instead, as this will create more optimized draw calls.

class 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
VertexInput Float Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat Float :: Type Source #

VertexInput Int32 Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat Int32 :: Type Source #

VertexInput Word32 Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat Word32 :: Type Source #

VertexInput () Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat () :: Type Source #

VertexInput a => VertexInput (Plucker a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Plucker a) :: Type Source #

VertexInput a => VertexInput (Quaternion a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Quaternion a) :: Type Source #

VertexInput a => VertexInput (V0 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (V0 a) :: Type Source #

Methods

toVertex :: ToVertex (V0 a) (VertexFormat (V0 a)) Source #

VertexInput a => VertexInput (V4 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (V4 a) :: Type Source #

Methods

toVertex :: ToVertex (V4 a) (VertexFormat (V4 a)) Source #

VertexInput a => VertexInput (V3 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (V3 a) :: Type Source #

Methods

toVertex :: ToVertex (V3 a) (VertexFormat (V3 a)) Source #

VertexInput a => VertexInput (V2 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (V2 a) :: Type Source #

Methods

toVertex :: ToVertex (V2 a) (VertexFormat (V2 a)) Source #

VertexInput a => VertexInput (V1 a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (V1 a) :: Type Source #

Methods

toVertex :: ToVertex (V1 a) (VertexFormat (V1 a)) Source #

VertexInput (Normalized (B4 Int8)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B4 Int8)) :: Type Source #

VertexInput (Normalized (B4 Int16)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B4 Int16)) :: Type Source #

VertexInput (Normalized (B4 Int32)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B4 Int32)) :: Type Source #

VertexInput (Normalized (B4 Word8)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B4 Word8)) :: Type Source #

VertexInput (Normalized (B4 Word16)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B4 Word16)) :: Type Source #

VertexInput (Normalized (B4 Word32)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B4 Word32)) :: Type Source #

VertexInput (Normalized (B3 Int8)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B3 Int8)) :: Type Source #

VertexInput (Normalized (B3 Int16)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B3 Int16)) :: Type Source #

VertexInput (Normalized (B3 Int32)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B3 Int32)) :: Type Source #

VertexInput (Normalized (B3 Word8)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B3 Word8)) :: Type Source #

VertexInput (Normalized (B3 Word16)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B3 Word16)) :: Type Source #

VertexInput (Normalized (B3 Word32)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B3 Word32)) :: Type Source #

VertexInput (Normalized (B2 Int16)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B2 Int16)) :: Type Source #

VertexInput (Normalized (B2 Int32)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B2 Int32)) :: Type Source #

VertexInput (Normalized (B2 Word16)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B2 Word16)) :: Type Source #

VertexInput (Normalized (B2 Word32)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B2 Word32)) :: Type Source #

VertexInput (Normalized (B Int32)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B Int32)) :: Type Source #

VertexInput (Normalized (B Word32)) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Normalized (B Word32)) :: Type Source #

VertexInput (B4 Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B4 Float) :: Type Source #

VertexInput (B4 Int8) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B4 Int8) :: Type Source #

VertexInput (B4 Int16) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B4 Int16) :: Type Source #

VertexInput (B4 Int32) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B4 Int32) :: Type Source #

VertexInput (B4 Word8) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B4 Word8) :: Type Source #

VertexInput (B4 Word16) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B4 Word16) :: Type Source #

VertexInput (B4 Word32) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B4 Word32) :: Type Source #

VertexInput (B3 Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B3 Float) :: Type Source #

VertexInput (B3 Int8) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B3 Int8) :: Type Source #

VertexInput (B3 Int16) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B3 Int16) :: Type Source #

VertexInput (B3 Int32) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B3 Int32) :: Type Source #

VertexInput (B3 Word8) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B3 Word8) :: Type Source #

VertexInput (B3 Word16) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B3 Word16) :: Type Source #

VertexInput (B3 Word32) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B3 Word32) :: Type Source #

VertexInput (B2 Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B2 Float) :: Type Source #

VertexInput (B2 Int16) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B2 Int16) :: Type Source #

VertexInput (B2 Int32) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B2 Int32) :: Type Source #

VertexInput (B2 Word16) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B2 Word16) :: Type Source #

VertexInput (B2 Word32) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B2 Word32) :: Type Source #

VertexInput (B Float) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B Float) :: Type Source #

VertexInput (B Int32) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B Int32) :: Type Source #

VertexInput (B Word32) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (B Word32) :: Type Source #

(VertexInput a, VertexInput b) => VertexInput (a, b) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (a, b) :: Type Source #

Methods

toVertex :: ToVertex (a, b) (VertexFormat (a, b)) Source #

(VertexInput (f a), VertexInput a, HostFormat (f a) ~ f (HostFormat a), VertexFormat (f a) ~ f (VertexFormat a)) => VertexInput (Point f a) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (Point f a) :: Type Source #

Methods

toVertex :: ToVertex (Point f a) (VertexFormat (Point f a)) Source #

(VertexInput a, VertexInput b, VertexInput c) => VertexInput (a, b, c) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (a, b, c) :: Type Source #

Methods

toVertex :: ToVertex (a, b, c) (VertexFormat (a, b, c)) Source #

(VertexInput a, VertexInput b, VertexInput c, VertexInput d) => VertexInput (a, b, c, d) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (a, b, c, d) :: Type Source #

Methods

toVertex :: ToVertex (a, b, c, d) (VertexFormat (a, b, c, d)) Source #

(VertexInput a, VertexInput b, VertexInput c, VertexInput d, VertexInput e) => VertexInput (a, b, c, d, e) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (a, b, c, d, e) :: Type Source #

Methods

toVertex :: ToVertex (a, b, c, d, e) (VertexFormat (a, b, c, d, e)) Source #

(VertexInput a, VertexInput b, VertexInput c, VertexInput d, VertexInput e, VertexInput f) => VertexInput (a, b, c, d, e, f) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (a, b, c, d, e, f) :: Type Source #

Methods

toVertex :: ToVertex (a, b, c, d, e, f) (VertexFormat (a, b, c, d, e, f)) Source #

(VertexInput a, VertexInput b, VertexInput c, VertexInput d, VertexInput e, VertexInput f, VertexInput g) => VertexInput (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Associated Types

type VertexFormat (a, b, c, d, e, f, g) :: Type Source #

Methods

toVertex :: ToVertex (a, b, c, d, e, f, g) (VertexFormat (a, b, c, d, e, f, g)) Source #

data ToVertex a b Source #

The arrow type for toVertex.

Instances
Arrow ToVertex Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Methods

arr :: (b -> c) -> ToVertex b c #

first :: ToVertex b c -> ToVertex (b, d) (c, d) #

second :: ToVertex b c -> ToVertex (d, b) (d, c) #

(***) :: ToVertex b c -> ToVertex b' c' -> ToVertex (b, b') (c, c') #

(&&&) :: ToVertex b c -> ToVertex b c' -> ToVertex b (c, c') #

Category ToVertex Source # 
Instance details

Defined in Graphics.GPipe.Internal.PrimitiveStream

Methods

id :: ToVertex a a #

(.) :: ToVertex b c -> ToVertex a b -> ToVertex a c #

Creating PrimitiveStreams

toPrimitiveStream :: forall os f s a 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.

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.

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.