Struct client::Camera
[−]
[src]
pub struct Camera { pub position: Point3f, pub theta: f32, pub phi: f32, pub aspect_ratio: f32, // some fields omitted }
Fields
position: Point3f
theta: f32
phi: f32
aspect_ratio: f32
Methods
impl Camera
[src]
fn new(aspect_ratio: f32) -> Camera
Create new Camera with given aspect ratio
fn new_from_vector(pos: Point3f, look: Vector3f, aspect_ratio: f32) -> Self
returns a camera based on a vector to look at
fn proj_matrix(&self) -> Matrix4<f32>
Returns the projection matrix
fn set_proj_matrix(&mut self, proj: Matrix4<f32>)
fn view_matrix(&self) -> Matrix4<f32>
Returns view matrix
fn get_look_at_point(&self) -> Point3f
Calculates the look_at_point by adding the current position to the look_at_vector
fn get_look_at_vector(&self) -> Vector3f
Calculates the look_at_vector by using theta and phi on the unit sphere
fn move_by(&mut self, pos_diff: Vector3f)
Internal function to move the position of the camera Will be called by the other functions (move_forwars etc)
fn move_forward(&mut self, factor: f32)
Method to call when forward movement is needed
factor
is a factor to scale the movement speed
factor
has to be positive for foward movement
fn move_backward(&mut self, factor: f32)
Method to call when backward movement is needed
factor
is a factor to scale the movement speed
factor
has to be positive for backward movement
fn move_left(&mut self, factor: f32)
Method to call when left movement is needed
factor
is a factor to scale the movement speed
factor
has to be positive for left movement
fn move_right(&mut self, factor: f32)
Method to call when right movement is needed
factor
is a factor to scale the movement speed
factor
has to be positive for right movement
fn move_up(&mut self, factor: f32)
Method to call when upward movement is needed
factor
is a factor to scale the movement speed
factor
has to be positive for upward movement
fn move_down(&mut self, factor: f32)
Method to call when downward movement is needed
factor
is a factor to scale the movement speed
factor
has to be positive for downward movement
fn change_dir(&mut self, theta_diff: f32, phi_diff: f32)
Changes theta
and phi
to essentially change the direction the
camera looks
Trait Implementations
impl Copy for Camera
[src]
impl Clone for Camera
[src]
fn clone(&self) -> Camera
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more