A perspective camera looking at a target.
The camera is plain data; orbit/3 and zoom/2 are pure helpers that return a
new camera, so an application drives them from key events and keeps the result
in its own state.
Fields
:position-{x, y, z}eye position:target-{x, y, z}look-at point:up-{x, y, z}up vector (defaults to+Y):fov- vertical field of view in radians (defaults topi/4):near- near clip plane (defaults to0.1):far- far clip plane (defaults to100.0)
Examples
iex> %ExRatatui.ThreeD.Camera{}
%ExRatatui.ThreeD.Camera{
position: {0.0, 2.0, 5.0},
target: {0.0, 0.0, 0.0},
up: {0.0, 1.0, 0.0},
fov: 0.7853981633974483,
near: 0.1,
far: 100.0
}
iex> cam = %ExRatatui.ThreeD.Camera{position: {0.0, 0.0, 5.0}}
iex> ExRatatui.ThreeD.Camera.zoom(cam, -2.0).position
{0.0, 0.0, 3.0}
Summary
Functions
Orbit the camera around its target by yaw and pitch deltas (radians).
Move the camera toward or away from its target along the view direction.
Types
Functions
Orbit the camera around its target by yaw and pitch deltas (radians).
Pitch is clamped to avoid gimbal lock at the poles.
Move the camera toward or away from its target along the view direction.
A positive delta moves farther; the distance is clamped to a small minimum.