Safe Haskell | None |
---|---|
Language | Haskell98 |
FFI and hmatrix helpers.
Sample usage, to upload a perspective matrix to a shader.
glUniformMatrix4fv 0 1 (fromIntegral gl_TRUE) `appMatrix` perspective 0.01 100 (pi/2) (4/3)
- app :: (a -> b) -> a -> b
- appVector :: Storable a => (Ptr a -> b) -> Vector a -> b
- appVectorLen :: Storable a => (CInt -> Ptr a -> b) -> Vector a -> b
- appMatrix :: Element a => (Ptr a -> b) -> Matrix a -> b
- appMatrixLen :: Element a => (CInt -> CInt -> Ptr a -> b) -> Matrix a -> b
- appMatrixRaw :: Storable a => (Ptr a -> b) -> Matrix a -> b
- appMatrixRawLen :: Element a => (CInt -> CInt -> Ptr a -> b) -> Matrix a -> b
- unsafeMatrixToVector :: Matrix a -> Vector a
- unsafeMatrixToForeignPtr :: Storable a => Matrix a -> (ForeignPtr a, Int)
Documentation
app :: (a -> b) -> a -> b infixl 1 Source
Only useful since it is left associated with a precedence of 1, unlike $
, which is right associative.
e.g.
someFunction `appMatrixLen` m `appVectorLen` v `app` other `app` arguments `app` go here
One could also write:
(someFunction `appMatrixLen` m `appVectorLen` v) other arguments (go here)
appMatrixRaw :: Storable a => (Ptr a -> b) -> Matrix a -> b infixl 1 Source
unsafeMatrixToVector :: Matrix a -> Vector a Source
This will disregard the order of the matrix, and simply return it as-is.
If the order of the matrix is RowMajor, this function is identical to flatten
.
unsafeMatrixToForeignPtr :: Storable a => Matrix a -> (ForeignPtr a, Int) Source