pub struct ArcBall { /* private fields */ }
Expand description
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
Implementations
sourceimpl ArcBall
impl ArcBall
sourcepub fn new_with_frustrum(
fov: f32,
znear: f32,
zfar: f32,
eye: Point3<f32>,
at: Point3<f32>
) -> ArcBall
pub fn new_with_frustrum(
fov: f32,
znear: f32,
zfar: f32,
eye: Point3<f32>,
at: Point3<f32>
) -> ArcBall
Creates a new arc ball camera with default sensitivity values.
sourcepub fn set_at(&mut self, at: Point3<f32>)
pub fn set_at(&mut self, at: Point3<f32>)
Get a mutable reference to the point the camera is looking at.
sourcepub fn set_yaw(&mut self, yaw: f32)
pub fn set_yaw(&mut self, yaw: f32)
Sets the camera yaw
. Change this to modify the rotation along the up
axis.
sourcepub fn set_min_pitch(&mut self, min_pitch: f32)
pub fn set_min_pitch(&mut self, min_pitch: f32)
Set the minimum pitch of the camera.
sourcepub fn set_max_pitch(&mut self, max_pitch: f32)
pub fn set_max_pitch(&mut self, max_pitch: f32)
Set the maximum pitch of the camera.
sourcepub fn set_dist(&mut self, dist: f32)
pub fn set_dist(&mut self, dist: f32)
Move the camera such that it is at a given distance from the view point.
sourcepub fn set_min_dist(&mut self, min_dist: f32)
pub fn set_min_dist(&mut self, min_dist: f32)
Set the minimum distance from the camera position to its view point.
sourcepub fn set_max_dist(&mut self, max_dist: f32)
pub fn set_max_dist(&mut self, max_dist: f32)
Set the maximum distance from the camera position to its view point.
sourcepub fn set_dist_step(&mut self, dist_step: f32)
pub fn set_dist_step(&mut self, dist_step: f32)
Set the distance change factor for a unit scroll (default at 1.01).
sourcepub fn look_at(&mut self, eye: Point3<f32>, at: Point3<f32>)
pub 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.
sourcepub fn rotate_modifiers(&self) -> Option<Modifiers>
pub fn rotate_modifiers(&self) -> Option<Modifiers>
Modifiers that must be pressed for the camera rotation to occur.
sourcepub fn set_rotate_modifiers(&mut self, modifiers: Option<Modifiers>)
pub fn set_rotate_modifiers(&mut self, modifiers: Option<Modifiers>)
Sets the modifiers that must be pressed for the camera rotation to occur.
If this is set to None
, then pressing any modifier will not prevent rotation from occurring.
If this is different from None
then rotation will occur only if the exact specified set of modifiers is pressed.
In particular, if this is set to Some(Modifiers::empty())
then, rotation will occur only of no modifier is pressed.
sourcepub fn drag_modifiers(&self) -> Option<Modifiers>
pub fn drag_modifiers(&self) -> Option<Modifiers>
Modifiers that must be pressed for the camera drag to occur.
sourcepub fn set_drag_modifiers(&mut self, modifiers: Option<Modifiers>)
pub fn set_drag_modifiers(&mut self, modifiers: Option<Modifiers>)
Sets the modifiers that must be pressed for the camera drag to occur.
If this is set to None
, then pressing any modifier will not prevent dragging from occurring.
If this is different from None
then drag will occur only if the exact specified set of modifiers is pressed.
In particular, if this is set to Some(Modifiers::empty())
then, drag will occur only of no modifier is pressed.
The button used to drag the ArcBall camera.
Set the button used to drag the ArcBall camera. Use None to disable dragging.
sourcepub fn rebind_reset_key(&mut self, new_key: Option<Key>)
pub fn rebind_reset_key(&mut self, new_key: Option<Key>)
Set the key used to reset the ArcBall camera. Use None to disable reset.
sourcepub fn set_up_axis(&mut self, up_axis: Vector3<f32>)
pub fn set_up_axis(&mut self, up_axis: Vector3<f32>)
Sets the up vector of this camera. Prefer using set_up_axis_dir
if your up vector is already normalized.
sourcepub fn set_up_axis_dir(&mut self, up_axis: Unit<Vector3<f32>>)
pub fn set_up_axis_dir(&mut self, up_axis: Unit<Vector3<f32>>)
Sets the up-axis direction of this camera.
Trait Implementations
sourceimpl Camera for ArcBall
impl Camera for ArcBall
sourcefn clip_planes(&self) -> (f32, f32)
fn clip_planes(&self) -> (f32, f32)
The clipping planes, aka. (znear
, zfar
).
sourcefn view_transform(&self) -> Isometry3<f32>
fn view_transform(&self) -> Isometry3<f32>
The camera view transform.
sourcefn handle_event(&mut self, canvas: &Canvas, event: &WindowEvent)
fn handle_event(&mut self, canvas: &Canvas, event: &WindowEvent)
Handle a mouse event.
sourcefn upload(
&self,
_: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
fn upload(
&self,
_: usize,
proj: &mut ShaderUniform<Matrix4<f32>>,
view: &mut ShaderUniform<Matrix4<f32>>
)
Upload the camera view and projection to the gpu. This can be called multiple times on the render loop. Read more
sourcefn transformation(&self) -> Matrix4<f32>
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
sourcefn inverse_transformation(&self) -> Matrix4<f32>
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
sourcefn update(&mut self, _: &Canvas)
fn update(&mut self, _: &Canvas)
Update the camera. This is called once at the beginning of the render loop.
sourcefn num_passes(&self) -> usize
fn num_passes(&self) -> usize
The number of passes required by this camera.
sourcefn start_pass(&self, _pass: usize, _canvas: &Canvas)
fn start_pass(&self, _pass: usize, _canvas: &Canvas)
Indicates that a pass will begin.
sourcefn render_complete(&self, _canvas: &Canvas)
fn render_complete(&self, _canvas: &Canvas)
Indicates that the scene has been rendered and the post-processing is being run.
Auto Trait Implementations
impl RefUnwindSafe for ArcBall
impl Send for ArcBall
impl Sync for ArcBall
impl Unpin for ArcBall
impl UnwindSafe for ArcBall
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
impl<T> Pointable for T
impl<T> Pointable for T
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.