Safe Haskell | None |
---|
Graphics.GLMatrix
Description
Modified from / based on: https:github.comkigtomtegebrablobmasterTomtegebraMatrix.hs
- translationMatrix :: Vector3 -> Matrix4x4
- frustumMatrix :: GLfloat -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> Matrix4x4
- identityMatrix :: Matrix4x4
- toGLFormat :: Matrix4x4 -> [GLfloat]
- withMatrix :: Matrix4x4 -> (Ptr GLfloat -> IO a) -> IO a
- matrixMulVec :: Matrix4x4 -> Vector4 -> Vector4
- matrix4x4To3x3 :: Matrix4x4 -> Matrix3x3
- matrix3x3To4x4 :: Matrix3x3 -> Matrix4x4
- invertMatrix4x4ON :: Matrix4x4 -> Matrix4x4
- scalingMatrix :: Vector3 -> Matrix4x4
- rotationMatrix :: GLfloat -> Vector3 -> Matrix4x4
- lookAtMatrixG :: Vector3 -> Vector3 -> Vector3 -> Matrix4x4
- orthoMatrix :: GLfloat -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> Matrix4x4
- perspectiveMatrix :: GLfloat -> GLfloat -> GLfloat -> GLfloat -> Matrix4x4
- addVec :: [GLfloat] -> [GLfloat] -> [GLfloat]
- setMatrix4x4Uniform :: GLuint -> Matrix4x4 -> String -> IO ()
- type Matrix4x4 = [[GLfloat]]
- type Matrix3x3 = [[GLfloat]]
- type Vector4 = [GLfloat]
- type Vector3 = [GLfloat]
Documentation
translationMatrix :: Vector3 -> Matrix4x4Source
Creates the translation matrix that translates points by the given vector.
frustumMatrix :: GLfloat -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> GLfloat -> Matrix4x4Source
Creates a frustumMatrix from the given left, right, bottom, top, znear and zfar values for the view frustum.
identityMatrix :: Matrix4x4Source
The Matrix4x4
identity matrix.
toGLFormat :: Matrix4x4 -> [GLfloat]Source
matrixMulVec :: Matrix4x4 -> Vector4 -> Vector4Source
Multiplies a vector by a matrix.
matrix4x4To3x3 :: Matrix4x4 -> Matrix3x3Source
Returns the upper-left 3x3 matrix of a 4x4 matrix.
matrix3x3To4x4 :: Matrix3x3 -> Matrix4x4Source
Pads the 3x3 matrix to a 4x4 matrix with a 1 in bottom right corner and 0 elsewhere.
invertMatrix4x4ON :: Matrix4x4 -> Matrix4x4Source
Inverts a 4x4 orthonormal matrix with the special case trick.
scalingMatrix :: Vector3 -> Matrix4x4Source
Creates the scaling matrix that scales points by the factors given by the vector components.
rotationMatrix :: GLfloat -> Vector3 -> Matrix4x4Source
lookAtMatrixG :: Vector3 -> Vector3 -> Vector3 -> Matrix4x4Source
Creates a lookAt matrix from three vectors: the eye position, the point the eye is looking at and the up vector of the eye.
perspectiveMatrix :: GLfloat -> GLfloat -> GLfloat -> GLfloat -> Matrix4x4Source
Creates a perspective projection matrix for the given field-of-view, screen aspect ratio, znear and zfar.