glam/camera.rs
1// Generated from camera_mod.rs.tera template. Edit the template, not the generated file.
2
3//! View, projection and model transform helpers.
4//!
5//! This module provides view matrix (`look_at`, `look_to`), projection matrix (`perspective`,
6//! `orthographic`, `frustum`) and model (local -> world) transform constructors.
7//!
8//! ## Choosing a sub-module
9//!
10//! Pick [`lh`] or [`rh`] modules based on your world space coordinate system.
11//!
12//! The view functions in each sub-module transform world space points into Y-up view space while
13//! preserving your world's handedness.
14//!
15//! Note that while the view space methods will preserve the handedness of your world's coordinate
16//! systems, view space is a different coordinate system and will not necessarily be the same as
17//! your world coordinate system, especially if your world up is not +Y.
18//!
19//! There are other possible view space coordinate systems, notably Y-down; however, glam only
20//! provides view and projection functions for left- and right-handed view space coordinate systems.
21//!
22//! The corresponding projection functions expect Y-up view space input with the matching
23//! handedness.
24//!
25//! Within each `proj` sub-module, pick the API-specific constructor:
26//!
27//! | Module | NDC Z | NDC Y |
28//! |------------|---------|-------|
29//! | `opengl` | [-1, 1] | Up |
30//! | `directx` | [0, 1] | Up |
31//! | `vulkan` | [0, 1] | Down |
32//!
33//! ## Model transforms
34//!
35//! The [`model`] submodule provides local -> world transforms for orienting objects,
36//! taking the object's local axes as parameters.
37//!
38//! Use [`model`] when orienting objects, and [`rh::view`] or [`lh::view`] when building
39//! camera view matrices.
40
41mod camera_impl;
42
43pub mod model;
44
45/// View functions produce right-handed Y-up view space with
46/// X-right and the negative Z axis pointing forward.
47///
48/// Projection functions expect right-handed Y-up view space input.
49pub mod rh {
50 pub mod proj;
51 pub mod view;
52}
53
54/// View functions produce left-handed Y-up view space with
55/// X-right and the positive Z axis pointing forward.
56///
57/// Projection functions expect left-handed Y-up view space input.
58pub mod lh {
59 pub mod proj;
60 pub mod view;
61}