Safe Haskell | None |
---|---|
Language | Haskell98 |
Graphics.GPipe.Uniform
Description
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.
- 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 f s b x. UniformInput b => (s -> (Buffer os (Uniform b), Int)) -> Shader os f 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.
Associated Types
type UniformFormat a x Source
Methods
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
UniformInput a => UniformInput (V3 a) | |
UniformInput a => UniformInput (V2 a) | |
UniformInput a => UniformInput (V4 a) | |
UniformInput a => UniformInput (V1 a) | |
UniformInput a => UniformInput (V0 a) | |
UniformInput a => UniformInput (Quaternion a) | |
UniformInput a => UniformInput (Plucker a) | |
UniformInput (B4 Float) | |
UniformInput (B4 Int32) | |
UniformInput (B4 Word32) | |
UniformInput (B3 Float) | |
UniformInput (B3 Int32) | |
UniformInput (B3 Word32) | |
UniformInput (B2 Float) | |
UniformInput (B2 Int32) | |
UniformInput (B2 Word32) | |
UniformInput (B Float) | |
UniformInput (B Int32) | |
UniformInput (B Word32) | |
(UniformInput a, UniformInput b) => UniformInput (a, b) | |
(UniformInput a, UniformInput b, UniformInput c) => UniformInput (a, b, c) | |
(UniformInput a, UniformInput b, UniformInput c, UniformInput d) => UniformInput (a, b, c, d) |
The arrow type for toUniform
.
getUniform :: forall os f s b x. UniformInput b => (s -> (Buffer os (Uniform b), Int)) -> Shader os f 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.
Constructors
Uniform a |
Instances
BufferFormat a => BufferFormat (Uniform a) | |
type HostFormat (Uniform a) = HostFormat a |