Struct kiss3d::camera::ArcBall
[−]
[src]
pub struct ArcBall { /* fields omitted */ }
Arc-ball camera mode.
An arc-ball camera is a camera rotating around a fixed point (the focus point) and always looking at it. The following inputs are handled:
- Left button press + drag - rotates the camera around the focus point
- Right button press + drag - translates the focus point on the plane orthogonal to the view direction
- Scroll in/out - zoom in/out
- Enter key - set the focus point to the origin
Methods
impl ArcBall
[src]
fn new(eye: Point3<f32>, at: Point3<f32>) -> ArcBall
Create a new arc-ball camera.
fn new_with_frustrum(fov: f32,
znear: f32,
zfar: f32,
eye: Point3<f32>,
at: Point3<f32>)
-> ArcBall
znear: f32,
zfar: f32,
eye: Point3<f32>,
at: Point3<f32>)
-> ArcBall
Creates a new arc ball camera with default sensitivity values.
fn at(&self) -> Point3<f32>
The point the arc-ball is looking at.
fn set_at(&mut self, at: Point3<f32>)
Get a mutable reference to the point the camera is looking at.
fn yaw(&self) -> f32
The arc-ball camera yaw
.
fn set_yaw(&mut self, yaw: f32)
Sets the camera yaw
. Change this to modify the rotation along the up
axis.
fn pitch(&self) -> f32
The arc-ball camera pitch
.
fn set_pitch(&mut self, pitch: f32)
Sets the camera pitch
.
fn dist(&self) -> f32
The distance from the camera position to its view point.
fn set_dist(&mut self, dist: f32)
Move the camera such that it is at a given distance from the view point.
fn look_at(&mut self, eye: Point3<f32>, at: Point3<f32>)
Move and orient the camera such that it looks at a specific point.
The button used to rotate the ArcBall camera.
Set the button used to rotate the ArcBall camera. Use None to disable rotation.
The button used to drag the ArcBall camera.
Set the button used to drag the ArcBall camera. Use None to disable dragging.
fn reset_key(&self) -> Option<Key>
The key used to reset the ArcBall camera.
fn rebind_reset_key(&mut self, new_key: Option<Key>)
Set the key used to reset the ArcBall camera. Use None to disable reset.
Trait Implementations
impl Clone for ArcBall
[src]
fn clone(&self) -> ArcBall
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 Debug for ArcBall
[src]
impl Camera for ArcBall
[src]
fn clip_planes(&self) -> (f32, f32)
The clipping planes, aka. (znear
, zfar
).
fn view_transform(&self) -> Isometry3<f32>
The camera view transform.
fn eye(&self) -> Point3<f32>
The camera position.
fn handle_event(&mut self, window: &Window, event: &WindowEvent)
Handle a mouse event.
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)
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