Struct kiss3d_trackball::Trackball [−][src]
pub struct Trackball { pub input: Input<f32>, pub clamp: Clamp<f32>, pub frame: Frame<f32>, pub reset: Frame<f32>, pub scene: Scene<f32>, // some fields omitted }
Trackball camera mode.
A trackball camera is a camera working similarly like a trackball device. The camera eye orbits
around its target, the trackball’s center, and always looks at it. This implementation is split
into several members defined by the trackball
crate categorizing all the methods to control
the different aspects of a camera.
Camera Input
Following default inputs are defined which are customizable via Self::input
:
Mouse | Touch | Action |
---|---|---|
Left Button Press + Drag | One-Finger + Drag | Orbits around target. |
↳ but at trackball’s border | Two-Finger + Roll | Rolls about view direction. |
Drag + Left Shift | Any-Finger + Drag + Left Shift | First person view. |
Right Button Press + Drag | Two-Finger + Drag | Slides trackball on focus plane. |
Scroll In/Out | Two-Finger + Pinch Out/In | Scales distance zooming in/out. |
Left Button Press + Release | Any-Finger + Release | Slides to cursor/finger position. |
Keyboard | Action |
---|---|
O | Switches between orthographic and perspective projection. |
Enter | Resets camera eye and target to Self::reset . |
Camera Alignment
Realign camera via Self::frame
and define user boundary conditions via Self::clamp
like
minimum and maximum target distance from camera eye. Optionally, update the alignment to reset
to when pressing Input::reset_key()
via Self::reset
.
Camera Projection
Adjust camera projection via Self::scene
like setting field of view or clip plane distances.
Fields
input: Input<f32>
Input keys/buttons and their modifiers.
clamp: Clamp<f32>
Clamp as user boundary conditions of Frame
.
frame: Frame<f32>
Frame wrt camera eye and target.
reset: Frame<f32>
Reset frame wrt camera eye and target.
scene: Scene<f32>
Scene wrt enclosing viewing frustum.
Implementations
impl Trackball
[src]
impl Trackball
[src]pub fn new(
target: Point3<f32>,
eye: &Point3<f32>,
up: &Vector3<f32>
) -> Trackball
[src]
target: Point3<f32>,
eye: &Point3<f32>,
up: &Vector3<f32>
) -> Trackball
Creates camera with eye position inclusive its roll attitude and target position.
Default viewing frustum has a fixed vertical field of view of π/4 with near and far clip planes at 1E-1 and 1E+6.
Note: Argument order differs from cameras in kiss3d::camera
.
pub fn new_with_frustum(
target: Point3<f32>,
eye: &Point3<f32>,
up: &Vector3<f32>,
fov: impl Into<Fixed<f32>>,
znear: f32,
zfar: f32
) -> Trackball
[src]
target: Point3<f32>,
eye: &Point3<f32>,
up: &Vector3<f32>,
fov: impl Into<Fixed<f32>>,
znear: f32,
zfar: f32
) -> Trackball
Like Self::new()
but with custom viewing frustum.
For a fixed vertical field of view simply pass an f32
angle in radians as fov
,
otherwise see Fixed
and Scene::set_fov()
.
Note: Argument order differs from cameras in kiss3d::camera
.
Trait Implementations
impl Camera for Trackball
[src]
impl Camera for Trackball
[src]fn clip_planes(&self) -> (f32, f32)
[src]
fn view_transform(&self) -> Isometry3<f32>
[src]
fn eye(&self) -> Point3<f32>
[src]
fn handle_event(&mut self, canvas: &Canvas, event: &WindowEvent)
[src]
fn upload(
&self,
_: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
[src]
&self,
_: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
fn transformation(&self) -> Matrix4<f32>
[src]
fn inverse_transformation(&self) -> Matrix4<f32>
[src]
fn update(&mut self, _: &Canvas)
[src]
pub fn num_passes(&self) -> usize
[src]
pub fn start_pass(&self, _pass: usize, _canvas: &Canvas)
[src]
pub fn render_complete(&self, _canvas: &Canvas)
[src]
pub fn project(
&self,
world_coord: &Point<f32, 3_usize>,
size: &Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 2_usize, 1_usize>>
) -> Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 2_usize, 1_usize>>
[src]
&self,
world_coord: &Point<f32, 3_usize>,
size: &Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 2_usize, 1_usize>>
) -> Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 2_usize, 1_usize>>
pub fn unproject(
&self,
window_coord: &Point<f32, 2_usize>,
size: &Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 2_usize, 1_usize>>
) -> (Point<f32, 3_usize>, Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 3_usize, 1_usize>>)
[src]
&self,
window_coord: &Point<f32, 2_usize>,
size: &Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 2_usize, 1_usize>>
) -> (Point<f32, 3_usize>, Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 3_usize, 1_usize>>)
Auto Trait Implementations
impl RefUnwindSafe for Trackball
impl RefUnwindSafe for Trackball
impl UnwindSafe for Trackball
impl UnwindSafe for Trackball
Blanket Implementations
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,