Safe Haskell | None |
---|---|
Language | Haskell98 |
Graphics.GLUtil.Camera3D
Description
A Camera
represents a coordinate frame into which 3D points may
be transformed. For rendering purposes, it is often helpful to
combine a transformation matrix computed from a Camera
by
camMatrix
-- that transforms points into the camera's coordinate
frame -- with a perspective projection matrix, as created by
projectionMatrix
.
- data Camera a = Camera {
- forward :: V3 a
- upward :: V3 a
- rightward :: V3 a
- orientation :: Quaternion a
- location :: V3 a
- panRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a
- pan :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a
- tiltRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a
- tilt :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a
- rollRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a
- roll :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a
- dolly :: (Conjugate a, Epsilon a, RealFloat a) => V3 a -> Camera a -> Camera a
- panGlobalRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a
- panGlobal :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a
- tiltGlobalRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a
- tiltGlobal :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a
- rollGlobalRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a
- rollGlobal :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a
- rosCamera :: (Epsilon a, RealFloat a) => Camera a
- fpsCamera :: (Epsilon a, RealFloat a) => Camera a
- projectionMatrix :: (Conjugate a, Epsilon a, RealFloat a) => a -> a -> a -> a -> M44 a
- orthoMatrix :: (Num a, Fractional a) => a -> a -> a -> a -> a -> a -> M44 a
- camMatrix :: (Conjugate a, Epsilon a, RealFloat a) => Camera a -> M44 a
- deg2rad :: RealFloat a => a -> a
Camera movement
A Camera
may be translated and rotated to provide a coordinate
frame into which 3D points may be transformed.
panRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a Source #
Pan a camera view (turn side-to-side) by an angle given in
radians. Panning is about the camera's up-axis (e.g. the positive
Y axis for fpsCamera
).
pan :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a Source #
Pan a camera view (turn side-to-side) by an angle given in
degrees. Panning is about the camera's up-axis (e.g. the positive
Y axis for fpsCamera
).
tiltRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a Source #
Tilt a camera view (up-and-down) by an angle given in
radians. Tilting is about the camera's horizontal axis (e.g. the
positive X axis for fpsCamera
).
tilt :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a Source #
Tilt a camera view (up-and-down) by an angle given in degrees.
Tilting is about the camera's horizontal axis (e.g. the positive X
axis for fpsCamera
).
rollRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a Source #
Roll a camera view about its view direction by an angle given in
radians. Rolling is about the camera's forward axis (e.g. the
negative Z axis for fpsCamera
).
roll :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a Source #
Roll a camera view about its view direction by an angle given in
degrees. Rolling is about the camera's forward axis (e.g. the
negative Z axis for fpsCamera
).
dolly :: (Conjugate a, Epsilon a, RealFloat a) => V3 a -> Camera a -> Camera a Source #
Translate a camera's position by the given vector.
panGlobalRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a Source #
Pan a camera view (turn side-to-side) by an angle given in
radians. Panning is about the world's up-axis as captured by the
initial camera state (e.g. the positive Y axis for fpsCamera
).
panGlobal :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a Source #
Pan a camera view (turn side-to-side) by an angle given in
degrees. Panning is about the world's up-axis as captured by the
initial camera state (e.g. the positive Y axis for fpsCamera
).
tiltGlobalRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a Source #
Tilt a camera view (up-and-down) by an angle given in
radians. Tilting is about the world's horizontal axis as captured by
the initial camera state (e.g. the positive X axis for fpsCamera
).
tiltGlobal :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a Source #
Tilt a camera view (up-and-down) by an angle given in degrees.
Tilting is about the world's horizontal axis as captured by the
initial camera state (e.g. the positive X axis for fpsCamera
).
rollGlobalRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a Source #
Roll a camera view about its view direction by an angle given in
radians. Rolling is about the world's forward axis as captured by
the initial camera state (e.g. the negative Z axis for fpsCamera
).
rollGlobal :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a Source #
Roll a camera view about its view direction by an angle given in
degrees. Rolling is about the world's forward axis as captured by the
initial camera state (e.g. the negative Z axis for fpsCamera
).
Camera initialization
rosCamera :: (Epsilon a, RealFloat a) => Camera a Source #
A camera at the origin with its up-axis coincident with the positive Z axis. This is the convention used by the ROS robotics platform.
fpsCamera :: (Epsilon a, RealFloat a) => Camera a Source #
A camera at the origin with its up-axis coincident with the positive Y axis. This is the convention used by "first-person shooter" (fps) video games.
Matrices
projectionMatrix :: (Conjugate a, Epsilon a, RealFloat a) => a -> a -> a -> a -> M44 a Source #
projectionMatrix fov aspect near far
produces a perspective
projection matrix with the specified vertical field of view (FOV),
given in radians, aspect ratio, and near and far clipping planes.
orthoMatrix :: (Num a, Fractional a) => a -> a -> a -> a -> a -> a -> M44 a Source #
orthoMatrix left right top bottom near far
produces a parallel
projection matrix with the specified left, right, top, bottom, near and
far clipping planes.
camMatrix :: (Conjugate a, Epsilon a, RealFloat a) => Camera a -> M44 a Source #
Produce a transformation matrix from a Camera
. This matrix
transforms homogenous points into the camera's coordinate frame.