#[non_exhaustive]pub struct CameraFrustumItem {
pub pose: [[f32; 4]; 4],
pub fov_y: f32,
pub aspect: f32,
pub near: f32,
pub far: f32,
pub colour: [f32; 4],
pub line_width: f32,
pub image_plane_depth: Option<f32>,
}Expand description
A renderable camera frustum wireframe item.
Converted to PolylineItem geometry in prepare.rs (no new GPU pipeline).
The frustum is drawn as near quad + far quad + 4 lateral edges, with an
optional image-plane quad at a configurable depth.
Use CameraFrustumItem::camera_target to get a fly-to target that frames
the frustum from a comfortable standoff distance.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.pose: [[f32; 4]; 4]View-to-world transform (the camera’s world-space pose).
Pass camera.view_matrix().inverse().to_cols_array_2d() for the current
viewport camera, or any other camera-world transform.
fov_y: f32Vertical field of view in radians.
aspect: f32Viewport aspect ratio (width / height).
near: f32Near clip distance (world units).
far: f32Far clip distance (world units).
colour: [f32; 4]RGBA line colour. Default: [0.8, 0.8, 0.9, 1.0] (light blue-grey).
line_width: f32Screen-space line width in pixels. Default: 2.0.
image_plane_depth: Option<f32>If Some(d), draw a closed quad at depth d (world units) inside the frustum.
Useful to visualise the image plane of a camera.
Implementations§
Source§impl CameraFrustumItem
impl CameraFrustumItem
Sourcepub fn camera_target(&self, standoff_factor: f32) -> CameraTarget
pub fn camera_target(&self, standoff_factor: f32) -> CameraTarget
Compute a crate::camera::CameraTarget that frames this frustum.
standoff_factor controls how far back the viewing camera sits relative
to the frustum diagonal (2.5 is a comfortable default). The returned
orientation faces the frustum from its front (along the frustum’s +Z axis).
Feed the result directly into [crate::camera::CameraAnimator::fly_to]:
let t = frustum.camera_target(2.5);
animator.fly_to(&camera, t.center, t.distance, t.orientation, 1.0);Sourcepub fn camera_view_target(&self) -> CameraTarget
pub fn camera_view_target(&self) -> CameraTarget
Compute a crate::camera::CameraTarget that adopts this frustum’s own viewpoint.
Unlike camera_target, which frames the frustum from outside,
this places the orbit camera exactly at the frustum’s eye position looking in the
frustum’s forward direction. Use it for “look through this camera” functionality.
let t = frustum.camera_view_target();
animator.fly_to(&camera, t.center, t.distance, t.orientation, 1.0);Trait Implementations§
Source§impl Clone for CameraFrustumItem
impl Clone for CameraFrustumItem
Source§fn clone(&self) -> CameraFrustumItem
fn clone(&self) -> CameraFrustumItem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CameraFrustumItem
impl Debug for CameraFrustumItem
Auto Trait Implementations§
impl Freeze for CameraFrustumItem
impl RefUnwindSafe for CameraFrustumItem
impl Send for CameraFrustumItem
impl Sync for CameraFrustumItem
impl Unpin for CameraFrustumItem
impl UnsafeUnpin for CameraFrustumItem
impl UnwindSafe for CameraFrustumItem
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.