Safe Haskell | None |
---|---|
Language | Haskell2010 |
Uniform values are constants that you can combine with all vertices or fragments of a PrimitiveStream
or FragmentStream
.
They are loaded from a Buffer
and OpenGl uniform blocks are used under the hood.
Synopsis
- class BufferFormat a => UniformInput a where
- type UniformFormat a x
- toUniform :: ToUniform x a (UniformFormat a x)
- data ToUniform x a b
- getUniform :: forall os s b x. UniformInput b => (s -> (Buffer os (Uniform b), Int)) -> Shader os s (UniformFormat b x)
- newtype Uniform a = Uniform a
Documentation
class BufferFormat a => UniformInput a where Source #
This class constraints which buffer types can be loaded as uniforms, and what type those values have.
type UniformFormat a x Source #
The type the buffer value will be turned into once it becomes a vertex or fragment value (the x
parameter is either V
or F
).
toUniform :: ToUniform x a (UniformFormat a x) Source #
An arrow action that turns a value from it's buffer representation to it's vertex or fragment representation. Use toUniform
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 toUniform
.
getUniform :: forall os s b x. UniformInput b => (s -> (Buffer os (Uniform b), Int)) -> Shader os s (UniformFormat b x) Source #
Any buffer value that is going to be used as a uniform needs to be wrapped in this newtype. This will cause is to be aligned properly for uniform usage. It can still be used as input for vertex arrays, but due to the uniform alignment it will probably be padded quite heavily and thus wasteful.
Uniform a |
Instances
BufferFormat a => BufferFormat (Uniform a) Source # | |
Defined in Graphics.GPipe.Internal.Buffer type HostFormat (Uniform a) Source # | |
type HostFormat (Uniform a) Source # | |
Defined in Graphics.GPipe.Internal.Buffer |