raylib/camera
src/raylib/camera.tur
defn
camera-3d
(camera-3d [px : float py : float pz : float tx : float ty : float tz : float ux : float uy : float uz : float fovy : float proj : int] :)
construct a 3D perspective or orthographic camera.
Parameters
| px py pz -- camera position (world space) | ||
| tx ty tz -- camera target / look-at point (world space) | ||
| ux uy uz -- up vector (usually 0 1 0) | ||
| fovy | vertical field of view in degrees (ignored in ortho mode) | |
| proj | projection mode (0=PERSPECTIVE 1=ORTHOGRAPHIC) |
Returns
Opaque :int handle to a heap-allocated Camera3D struct.
Example
(let [cam (camera-3d 0.0 10.0 10.0
0.0 0.0 0.0
0.0 1.0 0.0
45.0 0)]
...)
Since: P3
defn
camera-2d
(camera-2d [ox : float oy : float tx : float ty : float rotation : float zoom : float] :)
construct a 2D camera with offset, target, rotation, and zoom.
Parameters
| ox oy -- viewport offset (pixels, usually screen-center for centering) | ||
| tx ty -- camera target in world space | ||
| rotation | rotation in degrees | |
| zoom | zoom factor (1.0 = no zoom) |
Returns
Opaque :int handle to a heap-allocated Camera2D struct.
Example
(let [cam (camera-2d 400.0 300.0 0.0 0.0 0.0 1.0)] ...)
Since: P3
defn
update-camera
(update-camera [camera : int mode : int] :)
update a camera's position and orientation each frame.
Parameters
| camera | Camera3D handle to update in place | |
| mode | camera movement mode (see file header for constants) |
Example
(update-camera cam 1) ; 1 = CAMERA_FREE
Since: P3