Copyright | (C) Frank Staals |
---|---|

License | see the LICENSE file |

Maintainer | Frank Staals |

Safe Haskell | None |

Language | Haskell2010 |

## Synopsis

- data Camera r = Camera !(Point 3 r) !(Vector 3 r) !(Vector 3 r) !r !r !r !(Vector 2 r)
- cameraPosition :: Lens' (Camera r) (Point 3 r)
- rawCameraNormal :: Lens' (Camera r) (Vector 3 r)
- rawViewUp :: Lens' (Camera r) (Vector 3 r)
- viewPlaneDepth :: Lens' (Camera r) r
- nearDist :: Lens' (Camera r) r
- farDist :: Lens' (Camera r) r
- screenDimensions :: Lens' (Camera r) (Vector 2 r)
- cameraNormal :: Floating r => Lens' (Camera r) (Vector 3 r)
- viewUp :: Floating r => Lens' (Camera r) (Vector 3 r)
- cameraTransform :: Fractional r => Camera r -> Transformation 3 r
- worldToView :: Fractional r => Camera r -> Transformation 3 r
- toViewPort :: Fractional r => Camera r -> Transformation 3 r
- perspectiveProjection :: Fractional r => Camera r -> Transformation 3 r
- rotateCoordSystem :: Num r => Camera r -> Transformation 3 r
- flipAxes :: Num r => Transformation 3 r

# Documentation

A basic camera data type. The fields stored are:

- the camera position,
- the raw camera normal, i.e. a unit vector into the center of the screen,
- the raw view up vector indicating which side points "upwards" in the scene,
- the viewplane depth (i.e. the distance from the camera position to the plane on which we project),
- the near distance (everything closer than this is clipped),
- the far distance (everything further away than this is clipped), and
- the screen dimensions.

rawCameraNormal :: Lens' (Camera r) (Vector 3 r) Source #

Raw camera normal, i.e. a unit vector into the center of the screen.

rawViewUp :: Lens' (Camera r) (Vector 3 r) Source #

Raw view up vector indicating which side points "upwards" in the scene.

viewPlaneDepth :: Lens' (Camera r) r Source #

Viewplane depth (i.e. the distance from the camera position to the plane on which we project).

cameraNormal :: Floating r => Lens' (Camera r) (Vector 3 r) Source #

Lens to get and set the Camera normal, makes sure that the vector remains normalized.

viewUp :: Floating r => Lens' (Camera r) (Vector 3 r) Source #

Lens to get and set the viewUp vector. Makes sure the vector remains normalized.

cameraTransform :: Fractional r => Camera r -> Transformation 3 r Source #

Full transformation that renders the figure

worldToView :: Fractional r => Camera r -> Transformation 3 r Source #

Translates world coordinates into view coordinates

toViewPort :: Fractional r => Camera r -> Transformation 3 r Source #

Transformation into viewport coordinates

perspectiveProjection :: Fractional r => Camera r -> Transformation 3 r Source #

constructs a perspective projection

rotateCoordSystem :: Num r => Camera r -> Transformation 3 r Source #

Rotates coordinate system around the camera, such that we look in the negative z direction

flipAxes :: Num r => Transformation 3 r Source #

Flips the y and z axis.