hgeometry-0.11.0.0: Geometric Algorithms, Data structures, and Data types.

Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageHaskell2010

Graphics.Camera

Description

Description : Data type to represent a camera and some functions for working with it.

Synopsis

Documentation

data Camera r Source #

A basic camera data type. The fields stored are:

  • the camera position,
  • the raw camera normal, i.e. a unit vecotr 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.

Constructors

Camera !(Point 3 r) !(Vector 3 r) !(Vector 3 r) !r !r !r !(Vector 2 r) 
Instances
Eq r => Eq (Camera r) Source # 
Instance details

Defined in Graphics.Camera

Methods

(==) :: Camera r -> Camera r -> Bool #

(/=) :: Camera r -> Camera r -> Bool #

Ord r => Ord (Camera r) Source # 
Instance details

Defined in Graphics.Camera

Methods

compare :: Camera r -> Camera r -> Ordering #

(<) :: Camera r -> Camera r -> Bool #

(<=) :: Camera r -> Camera r -> Bool #

(>) :: Camera r -> Camera r -> Bool #

(>=) :: Camera r -> Camera r -> Bool #

max :: Camera r -> Camera r -> Camera r #

min :: Camera r -> Camera r -> Camera r #

Show r => Show (Camera r) Source # 
Instance details

Defined in Graphics.Camera

Methods

showsPrec :: Int -> Camera r -> ShowS #

show :: Camera r -> String #

showList :: [Camera r] -> ShowS #

cameraPosition :: forall r. Lens' (Camera r) (Point 3 r) Source #

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

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

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

nearDist :: forall r. Lens' (Camera r) r Source #

farDist :: forall r. Lens' (Camera r) r Source #

screenDimensions :: forall r. Lens' (Camera r) (Vector 2 r) Source #

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.