Struct kiss3d_trackball::Trackball [−][src]
Trackball camera mode.
A trackball camera is a camera working similarly like a trackball device. The camera eye is
orbited around its target, the trackball’s center, and always looking 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 Controls
Following default controls are defined which are customizable via Self::input
:
Mouse | Touch | Action |
---|---|---|
Left Button Press + Drag | One-Finger + Drag | Orbits eye around target. |
⮱ but at trackball’s border | Two-Finger + Roll | Purely rolls eye about view direction. |
Right Button Press + Drag | Two-Finger + Drag | Slides trackball along 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. |
Key | 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]
pub fn new(eye: &Point3<f32>, at: &Point3<f32>, up: &Vector3<f32>) -> Trackball
[src]
Creates camera with eye position inclusive its roll attitude and target position.
Default frustum has field of view of π/4 with near and far clip planes at 1E-1 and 1E+6.
pub fn new_with_frustum(
fov: f32,
znear: f32,
zfar: f32,
eye: &Point3<f32>,
at: &Point3<f32>,
up: &Vector3<f32>
) -> Trackball
[src]
fov: f32,
znear: f32,
zfar: f32,
eye: &Point3<f32>,
at: &Point3<f32>,
up: &Vector3<f32>
) -> Trackball
Like Self::new()
but with custom frustum.
Trait Implementations
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, U3>,
size: &Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>
) -> Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>
[src]
&self,
world_coord: &Point<f32, U3>,
size: &Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>
) -> Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>
pub fn unproject(
&self,
window_coord: &Point<f32, U2>,
size: &Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>
) -> (Point<f32, U3>, Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>)
[src]
&self,
window_coord: &Point<f32, U2>,
size: &Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>
) -> (Point<f32, U3>, Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>)
impl Clone for Trackball
[src]
Auto Trait Implementations
impl RefUnwindSafe for Trackball
impl Send for Trackball
impl Sync for Trackball
impl Unpin for Trackball
impl UnwindSafe for Trackball
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Any + Send + Sync,
T: Any + Send + Sync,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,