Struct kiss3d::camera::FirstPerson
[−]
[src]
pub struct FirstPerson { /* fields omitted */ }
First-person camera mode.
- Left button press + drag - look around
- Right button press + drag - translates the camera position on the plane orthogonal to the view direction
- Scroll in/out - zoom in/out
Methods
impl FirstPerson
[src]
fn new(eye: Point3<f32>, at: Point3<f32>) -> FirstPerson
Creates a first person camera with default sensitivity values.
fn new_with_frustrum(fov: f32,
znear: f32,
zfar: f32,
eye: Point3<f32>,
at: Point3<f32>)
-> FirstPerson
znear: f32,
zfar: f32,
eye: Point3<f32>,
at: Point3<f32>)
-> FirstPerson
Creates a new first person camera with default sensitivity values.
fn set_move_step(&mut self, step: f32)
Sets the translational increment per arrow press.
The default value is 0.5.
fn set_pitch_step(&mut self, step: f32)
Sets the pitch increment per mouse movement.
The default value is 0.005.
fn set_yaw_step(&mut self, step: f32)
Sets the yaw increment per mouse movement.
The default value is 0.005.
fn move_step(&self) -> f32
Gets the translational increment per arrow press.
fn pitch_step(&self) -> f32
Gets the pitch increment per mouse movement.
fn yaw_step(&self) -> f32
Gets the yaw increment per mouse movement.
fn look_at(&mut self, eye: Point3<f32>, at: Point3<f32>)
Changes the orientation and position of the camera to look at the specified point.
fn at(&self) -> Point3<f32>
The point the camera is looking at.
The button used to rotate the FirstPerson camera.
Set the button used to rotate the FirstPerson camera. Use None to disable rotation.
The button used to drag the FirstPerson camera.
Set the button used to drag the FirstPerson camera. Use None to disable dragging.
fn up_key(&self) -> Option<Key>
The movement button for up.
fn down_key(&self) -> Option<Key>
The movement button for down.
fn left_key(&self) -> Option<Key>
The movement button for left.
fn right_key(&self) -> Option<Key>
The movement button for right.
fn rebind_up_key(&mut self, new_key: Option<Key>)
Set the movement button for up. Use None to disable movement in this direction.
fn rebind_down_key(&mut self, new_key: Option<Key>)
Set the movement button for down. Use None to disable movement in this direction.
fn rebind_left_key(&mut self, new_key: Option<Key>)
Set the movement button for left. Use None to disable movement in this direction.
fn rebind_right_key(&mut self, new_key: Option<Key>)
Set the movement button for right. Use None to disable movement in this direction.
fn unbind_movement_keys(&mut self)
Disable the movement buttons for up, down, left and right.
fn eye_dir(&self) -> Vector3<f32>
The direction this camera is looking at.
fn move_dir(&self,
up: bool,
down: bool,
right: bool,
left: bool)
-> Vector3<f32>
up: bool,
down: bool,
right: bool,
left: bool)
-> Vector3<f32>
The direction this camera is being moved by the keyboard keys for a given set of key states.
fn translate_mut(&mut self, t: &Translation3<f32>)
Translates in-place this camera by t
.
fn translate(&self, t: &Translation3<f32>) -> FirstPerson
Translates this camera by t
.
Trait Implementations
impl Debug for FirstPerson
[src]
impl Clone for FirstPerson
[src]
fn clone(&self) -> FirstPerson
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
impl Camera for FirstPerson
[src]
fn clip_planes(&self) -> (f32, f32)
The clipping planes, aka. (znear
, zfar
).
fn view_transform(&self) -> Isometry3<f32>
The camera view transformation (i-e transformation without projection).
fn handle_event(&mut self, window: &Window, event: &WindowEvent)
Handle a mouse event.
fn eye(&self) -> Point3<f32>
The camera position.
fn transformation(&self) -> Matrix4<f32>
The transformation applied by the camera to transform a point in world coordinates to a point in device coordinates. Read more
fn inverse_transformation(&self) -> Matrix4<f32>
The transformation applied by the camera to transform point in device coordinates to a point in world coordinate. Read more
fn update(&mut self, window: &Window)
Update the camera. This is called once at the beginning of the render loop.
fn upload(&self, _pass: usize, uniform: &mut ShaderUniform<Matrix4<f32>>)
Upload the camera transformation to the gpu. This can be called multiple times on the render loop. Read more
fn num_passes(&self) -> usize
The number of passes required by this camera.
fn start_pass(&self, _pass: usize, _window: &Window)
Indicates that a pass will begin.
fn render_complete(&self, _window: &Window)
Indicates that the scene has been rendered and the post-processing is being run.
fn project(&self,
world_coord: &Point3<f32>,
size: &Vector2<f32>)
-> Vector2<f32>
world_coord: &Point3<f32>,
size: &Vector2<f32>)
-> Vector2<f32>
Converts a 3d point to 2d screen coordinates, assuming the screen has the size size
.
fn unproject(&self,
window_coord: &Point2<f32>,
size: &Vector2<f32>)
-> (Point3<f32>, Vector3<f32>)
window_coord: &Point2<f32>,
size: &Vector2<f32>)
-> (Point3<f32>, Vector3<f32>)
Converts a point in 2d screen coordinates to a ray (a 3d position and a direction). Read more