Safe Haskell | None |
---|---|
Language | Haskell2010 |
Simplified 3D graphics system.
- module FWGL.Graphics.Generic
- type Object3D = Object Uniforms3D Geometry3D
- type IsObject3D globals inputs = (Subset Geometry3D inputs, Subset Uniforms3D globals, Set inputs, Set globals)
- type Group3D = Group (View3 : Uniforms3D) Geometry3D
- type IsGroup3D gs is = (Subset Geometry3D is, Subset (View3 : Uniforms3D) gs, Set is, Set gs)
- cube :: Backend => Texture -> Object3D
- type Geometry3D = `[Position3, UV, Normal3]`
- mesh :: (IsObject3D Uniforms3D is, Backend) => Texture -> Geometry is -> Object Uniforms3D is
- mkGeometry3D :: GLES => [Vec3] -> [Vec2] -> [Vec3] -> [Word16] -> Geometry Geometry3D
- trans :: (MemberGlobal Transform3 gs, GLES) => Vec3 -> Object gs is -> Object gs is
- rotX :: (MemberGlobal Transform3 gs, GLES) => Float -> Object gs is -> Object gs is
- rotY :: (MemberGlobal Transform3 gs, GLES) => Float -> Object gs is -> Object gs is
- rotZ :: (MemberGlobal Transform3 gs, GLES) => Float -> Object gs is -> Object gs is
- rot :: (MemberGlobal Transform3 gs, GLES) => Vec3 -> Float -> Object gs is -> Object gs is
- scale :: (MemberGlobal Transform3 gs, GLES) => Float -> Object gs is -> Object gs is
- scaleV :: (MemberGlobal Transform3 gs, GLES) => Vec3 -> Object gs is -> Object gs is
- transform :: (MemberGlobal Transform3 gs, GLES) => Mat4 -> Object gs is -> Object gs is
- view :: (IsObject3D gs is, Backend) => Mat4 -> [Object gs is] -> Group (View3 : gs) is
- viewPersp :: (IsObject3D gs is, Backend) => Float -> Float -> Float -> Mat4 -> [Object gs is] -> Group (View3 : gs) is
- viewOrtho :: (IsObject3D gs is, Backend) => Float -> Float -> Float -> Float -> Float -> Float -> Mat4 -> [Object gs is] -> Group (View3 : gs) is
- viewVP :: (IsObject3D gs is, Backend) => (Vec2 -> Mat4) -> [Object gs is] -> Group (View3 : gs) is
- layerS :: IsGroup3D gs is => Group gs is -> Layer
- perspectiveMat4 :: Float -> Float -> Float -> Float -> Mat4
- perspectiveMat4Size :: Float -> Float -> Float -> Vec2 -> Mat4
- orthoMat4 :: Float -> Float -> Float -> Float -> Float -> Float -> Mat4
- cameraMat4 :: Vec3 -> Float -> Float -> Mat4
- lookAtMat4 :: Vec3 -> Vec3 -> Vec3 -> Mat4
- transMat4 :: Vec3 -> Mat4
- rotXMat4 :: Float -> Mat4
- rotYMat4 :: Float -> Mat4
- rotZMat4 :: Float -> Mat4
- rotMat4 :: Vec3 -> Float -> Mat4
- scaleMat4 :: Vec3 -> Mat4
- type Uniforms3D = `[Transform3, Texture2]`
- newtype Texture2 = Texture2 Sampler2D
- newtype Transform3 = Transform3 Mat4
- newtype View3 = View3 Mat4
Documentation
module FWGL.Graphics.Generic
3D Objects
type Object3D = Object Uniforms3D Geometry3D Source
A standard 3D object.
type IsObject3D globals inputs = (Subset Geometry3D inputs, Subset Uniforms3D globals, Set inputs, Set globals) Source
3D objects compatible with the standard 3D shader program.
type Group3D = Group (View3 : Uniforms3D) Geometry3D Source
A standard 3D group.
type IsGroup3D gs is = (Subset Geometry3D is, Subset (View3 : Uniforms3D) gs, Set is, Set gs) Source
3D object groups compatible with the standard 3D shader program.
Geometry
type Geometry3D = `[Position3, UV, Normal3]` Source
A 3D geometry.
mesh :: (IsObject3D Uniforms3D is, Backend) => Texture -> Geometry is -> Object Uniforms3D is Source
A 3D object with a specified Geometry
.
:: GLES | |
=> [Vec3] | List of vertices. |
-> [Vec2] | List of UV coordinates. |
-> [Vec3] | List of normals. |
-> [Word16] | Triangles expressed as triples of indices to the three lists above. |
-> Geometry Geometry3D |
Create a 3D Geometry
. The first three lists should have the same length.
Transformations
trans :: (MemberGlobal Transform3 gs, GLES) => Vec3 -> Object gs is -> Object gs is Source
Translate a 3D Object.
rotX :: (MemberGlobal Transform3 gs, GLES) => Float -> Object gs is -> Object gs is Source
Rotate a 3D Object
around the X axis.
rotY :: (MemberGlobal Transform3 gs, GLES) => Float -> Object gs is -> Object gs is Source
Rotate a 3D Object
around the X axis.
rotZ :: (MemberGlobal Transform3 gs, GLES) => Float -> Object gs is -> Object gs is Source
Rotate a 3D Object
around the X axis.
rot :: (MemberGlobal Transform3 gs, GLES) => Vec3 -> Float -> Object gs is -> Object gs is Source
Rotate a 3D Object
around a vector.
scale :: (MemberGlobal Transform3 gs, GLES) => Float -> Object gs is -> Object gs is Source
Scale a 3D Object
.
scaleV :: (MemberGlobal Transform3 gs, GLES) => Vec3 -> Object gs is -> Object gs is Source
Scale a 3D Object
in three dimensions.
transform :: (MemberGlobal Transform3 gs, GLES) => Mat4 -> Object gs is -> Object gs is Source
Transform a 3D Object
.
Layers
view :: (IsObject3D gs is, Backend) => Mat4 -> [Object gs is] -> Group (View3 : gs) is Source
Create a group of objects with a view matrix.
:: (IsObject3D gs is, Backend) | |
=> Float | Near |
-> Float | Far |
-> Float | FOV |
-> Mat4 | View matrix |
-> [Object gs is] | |
-> Group (View3 : gs) is |
Create a group of objects with a view matrix and perspective projection.
:: (IsObject3D gs is, Backend) | |
=> Float | Near |
-> Float | Far |
-> Float | Left |
-> Float | Right |
-> Float | Bottom |
-> Float | Top |
-> Mat4 | View matrix |
-> [Object gs is] | |
-> Group (View3 : gs) is |
Create a group of objects with a view matrix and orthographic projection.
viewVP :: (IsObject3D gs is, Backend) => (Vec2 -> Mat4) -> [Object gs is] -> Group (View3 : gs) is Source
Create a group of objects with a view matrix, depending on the size of the framebuffer.
Matrices
View matrices
4x4 perspective projection matrix.
4x4 perspective projection matrix, using width and height instead of the aspect ratio.
4x4 orthographic projection matrix.
Transformation matrices
Uniforms
type Uniforms3D = `[Transform3, Texture2]` Source
newtype Transform3 Source