GPipe-2.2.3: 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.

Minimal complete definition

toVertex

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 # 

Associated Types

type VertexFormat Float :: * Source #

VertexInput Int32 Source # 

Associated Types

type VertexFormat Int32 :: * Source #

VertexInput Word32 Source # 
VertexInput () Source # 

Associated Types

type VertexFormat () :: * Source #

VertexInput a => VertexInput (Quaternion a) Source # 

Associated Types

type VertexFormat (Quaternion a) :: * Source #

VertexInput a => VertexInput (Plucker a) Source # 

Associated Types

type VertexFormat (Plucker a) :: * Source #

VertexInput a => VertexInput (V4 a) Source # 

Associated Types

type VertexFormat (V4 a) :: * Source #

Methods

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

VertexInput a => VertexInput (V3 a) Source # 

Associated Types

type VertexFormat (V3 a) :: * Source #

Methods

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

VertexInput a => VertexInput (V2 a) Source # 

Associated Types

type VertexFormat (V2 a) :: * Source #

Methods

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

VertexInput a => VertexInput (V1 a) Source # 

Associated Types

type VertexFormat (V1 a) :: * Source #

Methods

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

VertexInput a => VertexInput (V0 a) Source # 

Associated Types

type VertexFormat (V0 a) :: * Source #

Methods

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

VertexInput (Normalized (B4 Int8)) Source # 
VertexInput (Normalized (B4 Int16)) Source # 
VertexInput (Normalized (B4 Int32)) Source # 
VertexInput (Normalized (B4 Word8)) Source # 
VertexInput (Normalized (B4 Word16)) Source # 
VertexInput (Normalized (B4 Word32)) Source # 
VertexInput (Normalized (B3 Int8)) Source # 
VertexInput (Normalized (B3 Int16)) Source # 
VertexInput (Normalized (B3 Int32)) Source # 
VertexInput (Normalized (B3 Word8)) Source # 
VertexInput (Normalized (B3 Word16)) Source # 
VertexInput (Normalized (B3 Word32)) Source # 
VertexInput (Normalized (B2 Int16)) Source # 
VertexInput (Normalized (B2 Int32)) Source # 
VertexInput (Normalized (B2 Word16)) Source # 
VertexInput (Normalized (B2 Word32)) Source # 
VertexInput (Normalized (B Int32)) Source # 
VertexInput (Normalized (B Word32)) Source # 
VertexInput (B4 Float) Source # 

Associated Types

type VertexFormat (B4 Float) :: * Source #

VertexInput (B4 Int8) Source # 

Associated Types

type VertexFormat (B4 Int8) :: * Source #

VertexInput (B4 Int16) Source # 

Associated Types

type VertexFormat (B4 Int16) :: * Source #

VertexInput (B4 Int32) Source # 

Associated Types

type VertexFormat (B4 Int32) :: * Source #

VertexInput (B4 Word8) Source # 

Associated Types

type VertexFormat (B4 Word8) :: * Source #

VertexInput (B4 Word16) Source # 

Associated Types

type VertexFormat (B4 Word16) :: * Source #

VertexInput (B4 Word32) Source # 

Associated Types

type VertexFormat (B4 Word32) :: * Source #

VertexInput (B3 Float) Source # 

Associated Types

type VertexFormat (B3 Float) :: * Source #

VertexInput (B3 Int8) Source # 

Associated Types

type VertexFormat (B3 Int8) :: * Source #

VertexInput (B3 Int16) Source # 

Associated Types

type VertexFormat (B3 Int16) :: * Source #

VertexInput (B3 Int32) Source # 

Associated Types

type VertexFormat (B3 Int32) :: * Source #

VertexInput (B3 Word8) Source # 

Associated Types

type VertexFormat (B3 Word8) :: * Source #

VertexInput (B3 Word16) Source # 

Associated Types

type VertexFormat (B3 Word16) :: * Source #

VertexInput (B3 Word32) Source # 

Associated Types

type VertexFormat (B3 Word32) :: * Source #

VertexInput (B2 Float) Source # 

Associated Types

type VertexFormat (B2 Float) :: * Source #

VertexInput (B2 Int16) Source # 

Associated Types

type VertexFormat (B2 Int16) :: * Source #

VertexInput (B2 Int32) Source # 

Associated Types

type VertexFormat (B2 Int32) :: * Source #

VertexInput (B2 Word16) Source # 

Associated Types

type VertexFormat (B2 Word16) :: * Source #

VertexInput (B2 Word32) Source # 

Associated Types

type VertexFormat (B2 Word32) :: * Source #

VertexInput (B Float) Source # 

Associated Types

type VertexFormat (B Float) :: * Source #

VertexInput (B Int32) Source # 

Associated Types

type VertexFormat (B Int32) :: * Source #

VertexInput (B Word32) Source # 

Associated Types

type VertexFormat (B Word32) :: * Source #

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

Associated Types

type VertexFormat (a, b) :: * 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 # 

Associated Types

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

Methods

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

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

Associated Types

type VertexFormat (a, b, c) :: * 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 # 

Associated Types

type VertexFormat (a, b, c, d) :: * 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 # 

Associated Types

type VertexFormat (a, b, c, d, e) :: * 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 # 

Associated Types

type VertexFormat (a, b, c, d, e, f) :: * 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 # 

Associated Types

type VertexFormat (a, b, c, d, e, f, g) :: * 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 # 

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 # 

Methods

id :: cat a a #

(.) :: cat b c -> cat a b -> cat 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.