Struct veloren_voxygen::scene::camera::Camera
source · pub struct Camera {}
Fields§
§tgt_focus: Vec3<f32>
§focus: Vec3<f32>
§tgt_ori: Vec3<f32>
§ori: Vec3<f32>
§tgt_dist: f32
§dist: f32
§tgt_fov: f32
§fov: f32
§tgt_fixate: f32
§fixate: f32
§aspect: f32
§mode: CameraMode
§last_time: Option<f64>
§dependents: Dependents
§frustum: Frustum<f32>
Implementations§
source§impl Camera
impl Camera
sourcepub fn new(aspect: f32, mode: CameraMode) -> Self
pub fn new(aspect: f32, mode: CameraMode) -> Self
Create a new Camera
with default parameters.
sourcepub fn compute_dependents(&mut self, terrain: &TerrainGrid)
pub fn compute_dependents(&mut self, terrain: &TerrainGrid)
Compute the transformation matrices (view matrix and projection matrix) and position of the camera.
sourcepub fn compute_dependents_full<V: ReadVol>(
&mut self,
terrain: &V,
is_transparent: fn(_: &V::Vox) -> bool
)
pub fn compute_dependents_full<V: ReadVol>( &mut self, terrain: &V, is_transparent: fn(_: &V::Vox) -> bool )
The is_fluid argument should return true for transparent voxels.
fn compute_dependents_near<V: ReadVol>( &mut self, terrain: &V, is_transparent: fn(_: &V::Vox) -> bool )
fn compute_dependents_far<V: ReadVol>( &mut self, terrain: &V, is_transparent: fn(_: &V::Vox) -> bool )
fn compute_dependents_helper(&self, dist: f32) -> Dependents
fn compute_frustum(&mut self, dependents: &Dependents) -> Frustum<f32>
pub fn frustum(&self) -> &Frustum<f32>
pub fn dependents(&self) -> Dependents
sourcepub fn rotate_by(&mut self, delta: Vec3<f32>)
pub fn rotate_by(&mut self, delta: Vec3<f32>)
Rotate the camera about its focus by the given delta, limiting the input accordingly.
sourcepub fn set_orientation(&mut self, ori: Vec3<f32>)
pub fn set_orientation(&mut self, ori: Vec3<f32>)
Set the orientation of the camera about its focus.
sourcepub fn set_orientation_instant(&mut self, ori: Vec3<f32>)
pub fn set_orientation_instant(&mut self, ori: Vec3<f32>)
Set the orientation of the camera about its focus without lerping.
sourcepub fn zoom_by(&mut self, delta: f32, cap: Option<f32>)
pub fn zoom_by(&mut self, delta: f32, cap: Option<f32>)
Zoom the camera by the given delta, limiting the input accordingly.
sourcepub fn zoom_switch(&mut self, delta: f32, cap: f32, scale: f32)
pub fn zoom_switch(&mut self, delta: f32, cap: f32, scale: f32)
Zoom with the ability to switch between first and third-person mode.
Note that cap > 18237958000000.0 can cause panic due to float overflow
sourcepub fn get_distance(&self) -> f32
pub fn get_distance(&self) -> f32
Get the distance of the camera from the focus
sourcepub fn set_distance(&mut self, dist: f32)
pub fn set_distance(&mut self, dist: f32)
Set the distance of the camera from the focus (i.e., zoom).
pub fn update(&mut self, time: f64, dt: f32, smoothing_enabled: bool)
pub fn interp_time(&self) -> f32
sourcepub fn get_focus_pos(&self) -> Vec3<f32>
pub fn get_focus_pos(&self) -> Vec3<f32>
Get the focus position of the camera.
sourcepub fn set_focus_pos(&mut self, focus: Vec3<f32>)
pub fn set_focus_pos(&mut self, focus: Vec3<f32>)
Set the focus position of the camera.
sourcepub fn force_focus_pos(&mut self, focus: Vec3<f32>)
pub fn force_focus_pos(&mut self, focus: Vec3<f32>)
Set the focus position of the camera, without lerping.
sourcepub fn get_aspect_ratio(&self) -> f32
pub fn get_aspect_ratio(&self) -> f32
Get the aspect ratio of the camera.
sourcepub fn set_aspect_ratio(&mut self, aspect: f32)
pub fn set_aspect_ratio(&mut self, aspect: f32)
Set the aspect ratio of the camera.
sourcepub fn get_orientation(&self) -> Vec3<f32>
pub fn get_orientation(&self) -> Vec3<f32>
Get the orientation of the camera.
sourcepub fn get_tgt_orientation(&self) -> Vec3<f32>
pub fn get_tgt_orientation(&self) -> Vec3<f32>
Get the orientation that the camera is moving toward.
sourcepub fn get_effective_fov(&self) -> f32
pub fn get_effective_fov(&self) -> f32
Get the field of view of the camera in radians, taking into account fixation.
sourcepub fn set_fixate(&mut self, fixate: f32)
pub fn set_fixate(&mut self, fixate: f32)
Set the ‘fixation’ proportion, allowing the camera to focus in with precise aiming. Fixation is applied on top of the regular FoV.
sourcepub fn set_fov_deg(&mut self, fov: u16)
pub fn set_fov_deg(&mut self, fov: u16)
Set the FOV in degrees
sourcepub fn set_mode(&mut self, mode: CameraMode)
pub fn set_mode(&mut self, mode: CameraMode)
Set the mode of the camera.
sourcepub fn get_mode(&self) -> CameraMode
pub fn get_mode(&self) -> CameraMode
Get the mode of the camera
sourcepub fn next_mode(&mut self, is_admin: bool, has_target: bool)
pub fn next_mode(&mut self, is_admin: bool, has_target: bool)
Cycle the camera to its next valid mode. If is_admin is false then only modes which are accessible without admin access will be cycled to.
sourcepub fn forward(&self) -> Vec3<f32>
pub fn forward(&self) -> Vec3<f32>
Return a unit vector in the forward direction for the current camera orientation
sourcepub fn right(&self) -> Vec3<f32>
pub fn right(&self) -> Vec3<f32>
Return a unit vector in the right direction for the current camera orientation
sourcepub fn forward_xy(&self) -> Vec2<f32>
pub fn forward_xy(&self) -> Vec2<f32>
Return a unit vector in the forward direction on the XY plane for the current camera orientation
Auto Trait Implementations§
impl RefUnwindSafe for Camera
impl Send for Camera
impl Sync for Camera
impl Unpin for Camera
impl UnwindSafe for Camera
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self
file descriptor.§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Pointee for T
impl<T> Pointee for T
source§impl<Context> SubContext<Context> for Context
impl<Context> SubContext<Context> for Context
fn sub_context(self) -> Context
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.