Struct gl_utils::camera3d::Camera3d[][src]

pub struct Camera3d {
    pub position: Point3<f32>,
    pub yaw: Rad<f32>,
    pub pitch: Rad<f32>,
    pub orientation: Basis3<f32>,
    pub transform_mat_world_to_view: Matrix4<f32>,
    pub projection3d: Projection3d,
}

Represents a camera ("view") positioned and oriented in a 3D scene with a 3D transformation and a 3D projection.

Fields

Position in 3D world space

Yaw represents a clockwise rotation restricted to the range $[0, 2\pi)$.

Pitch represents a rotation up or down restricted to the range $[-\pi/2, \pi/2]$.

Basis derived from yaw and pitch.

Transforms points from world space to camera (view, eye) space as specified by the camera position and orientation.

Note that world space is assumed to have 'up' vector Z while in OpenGL the negative Z axis is 'into' the screen so this matrix performs the required transform mapping positive Y to negative Z and positive Z to positive Y.

Methods

impl Camera3d
[src]

Create a new camera centered at the origin looking down the positive Y axis with 'up' vector aligned with the Z axis.

Create a new 3D camera with the given viewport, position, and orientation.

Should be called when the screen resolution changes.

Moves the view position relative to the X/Y plane with X and Y direction determined by heading and Z always aligned with the Z axis, i.e. the translated position is only determined by the current yaw not the pitch.

Returns the raw world to view transform and view to clip projection matrix data, suitable for use as shader uniforms.

Auto Trait Implementations

impl Send for Camera3d

impl Sync for Camera3d