pub struct OpenXrRaySample {
pub origin: Vec3,
pub direction: Vec3,
pub hit_kind: OpenXrRayHitKind,
pub hit_distance: f32,
}Expand description
World-space ray selected for optional visualization.
Origin and distance use metres. Direction is normalized when building the layer, with negative Z fallback for a near-zero vector.
§Examples
use ailloli_ui_openxr::{OpenXrRayHitKind, OpenXrRaySample};
use ailloli_ui_openxr::math::Vec3;
let sample = OpenXrRaySample::new(Vec3::default(), Vec3::new(0.0, 0.0, -1.0), OpenXrRayHitKind::Ui, 1.5);
assert_eq!(sample.hit_distance, 1.5);Fields§
§origin: Vec3Ray origin in world metres.
direction: Vec3World-space ray direction.
hit_kind: OpenXrRayHitKindMiss/UI color classification.
hit_distance: f32Unclamped hit or display distance in metres.
Implementations§
Source§impl OpenXrRaySample
impl OpenXrRaySample
Sourcepub fn new(
origin: Vec3,
direction: Vec3,
hit_kind: OpenXrRayHitKind,
hit_distance: f32,
) -> Self
pub fn new( origin: Vec3, direction: Vec3, hit_kind: OpenXrRayHitKind, hit_distance: f32, ) -> Self
Creates a ray sample without normalizing or clamping values.
§Examples
use ailloli_ui_openxr::{OpenXrRayHitKind, OpenXrRaySample};
use ailloli_ui_openxr::math::Vec3;
let sample = OpenXrRaySample::new(Vec3::new(1.0, 2.0, 3.0), Vec3::default(), OpenXrRayHitKind::Miss, 99.0);
assert_eq!(sample.origin.x, 1.0);Trait Implementations§
Source§impl Clone for OpenXrRaySample
impl Clone for OpenXrRaySample
Source§fn clone(&self) -> OpenXrRaySample
fn clone(&self) -> OpenXrRaySample
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OpenXrRaySample
impl Debug for OpenXrRaySample
impl Copy for OpenXrRaySample
Auto Trait Implementations§
impl Freeze for OpenXrRaySample
impl RefUnwindSafe for OpenXrRaySample
impl Send for OpenXrRaySample
impl Sync for OpenXrRaySample
impl Unpin for OpenXrRaySample
impl UnwindSafe for OpenXrRaySample
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
Source§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
Source§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.
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>
Converts
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>
Converts
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 more