pub struct OpenXrActionInput { /* private fields */ }Expand description
OpenXR action set and per-source state used to poll UI pointer frames.
Construction may return Ok(None) when input is disabled. A constructed
value must be attached to exactly one compatible Vulkan session before
polling; polling before attachment returns an empty frame.
§Examples
use ailloli_ui_openxr::OpenXrActionInput;
fn reset(input: &mut OpenXrActionInput) { input.clear(); }Implementations§
Source§impl OpenXrActionInput
impl OpenXrActionInput
Sourcepub fn new_for_runtime(
xr: &OpenXrInstance,
options: OpenXrUiInputOptions,
) -> Result<Option<Self>, OpenXrRuntimeError>
pub fn new_for_runtime( xr: &OpenXrInstance, options: OpenXrUiInputOptions, ) -> Result<Option<Self>, OpenXrRuntimeError>
Creates actions from a runtime’s instance and negotiated capabilities.
§Errors
Returns an OpenXR error when action-set, action, path, or binding setup
fails. Returns Ok(None) when options.enabled is false.
§Examples
use ailloli_ui_openxr::{OpenXrActionInput, OpenXrInstance, OpenXrRuntimeError, OpenXrUiInputOptions};
fn create(instance: &OpenXrInstance) -> Result<Option<OpenXrActionInput>, OpenXrRuntimeError> {
OpenXrActionInput::new_for_runtime(instance, OpenXrUiInputOptions::default())
}Sourcepub fn new_external(
instance: &Instance,
capabilities: OpenXrInputCapabilities,
options: OpenXrUiInputOptions,
) -> Result<Option<Self>, OpenXrRuntimeError>
pub fn new_external( instance: &Instance, capabilities: OpenXrInputCapabilities, options: OpenXrUiInputOptions, ) -> Result<Option<Self>, OpenXrRuntimeError>
Creates actions from externally owned instance capabilities.
§Errors
Returns an OpenXR setup error for rejected action or binding operations.
Disabled input returns Ok(None) without touching the instance.
§Examples
use ailloli_ui_openxr::{OpenXrActionInput, OpenXrInputCapabilities, OpenXrRuntimeError, OpenXrUiInputOptions};
fn create(instance: &openxr::Instance) -> Result<Option<OpenXrActionInput>, OpenXrRuntimeError> {
OpenXrActionInput::new_external(instance, OpenXrInputCapabilities::new(false, false), OpenXrUiInputOptions::default())
}Sourcepub fn attach_session(
&mut self,
session: &Session<Vulkan>,
) -> Result<(), OpenXrRuntimeError>
pub fn attach_session( &mut self, session: &Session<Vulkan>, ) -> Result<(), OpenXrRuntimeError>
Attaches the action set and creates configured source spaces and trackers.
Repeated calls after a successful attachment are a no-op. Hand-tracker creation failures disable the affected tracker rather than failing setup.
§Errors
Returns an error when attaching the action set or creating a controller aim space fails.
§Examples
use ailloli_ui_openxr::{OpenXrActionInput, OpenXrRuntimeError};
fn attach(input: &mut OpenXrActionInput, session: &openxr::Session<openxr::Vulkan>) -> Result<(), OpenXrRuntimeError> {
input.attach_session(session)
}Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears source locks and frame-time history without detaching actions.
§Examples
use ailloli_ui_openxr::OpenXrActionInput;
fn clear(input: &mut OpenXrActionInput) { input.clear(); }Sourcepub fn log_interaction_profiles(
&self,
instance: &Instance,
session: &Session<Vulkan>,
)
pub fn log_interaction_profiles( &self, instance: &Instance, session: &Session<Vulkan>, )
Logs the current left and right interaction-profile paths.
Lookup failures are logged as "<unknown>" and are not returned.
§Examples
use ailloli_ui_openxr::OpenXrActionInput;
fn log(input: &OpenXrActionInput, instance: &openxr::Instance, session: &openxr::Session<openxr::Vulkan>) {
input.log_interaction_profiles(instance, session);
}Sourcepub fn poll_frame(
&mut self,
xr_instance: &Instance,
session: &Session<Vulkan>,
reference_space: &Space,
layer: OpenXrQuadLayerOptions,
time: Time,
logical_size: Size,
) -> Result<OpenXrActionInputFrame, OpenXrRuntimeError>
pub fn poll_frame( &mut self, xr_instance: &Instance, session: &Session<Vulkan>, reference_space: &Space, layer: OpenXrQuadLayerOptions, time: Time, logical_size: Size, ) -> Result<OpenXrActionInputFrame, OpenXrRuntimeError>
Synchronizes actions and selects at most one pointer for the current frame.
Controller scroll is scaled by elapsed time, using 1/60 second on the first poll and clamping later deltas to 100 ms. Logical hit points are clamped to the supplied top-left-origin size. Before attachment, an empty frame is returned without synchronizing actions.
§Errors
Returns failures from action synchronization, action state, space location, or hand-joint location.
§Examples
use ailloli_ui_core::Size;
use ailloli_ui_openxr::{OpenXrActionInput, OpenXrActionInputFrame, OpenXrQuadLayerOptions, OpenXrRuntimeError};
fn poll(input: &mut OpenXrActionInput, instance: &openxr::Instance, session: &openxr::Session<openxr::Vulkan>, space: &openxr::Space, time: openxr::Time) -> Result<OpenXrActionInputFrame, OpenXrRuntimeError> {
input.poll_frame(instance, session, space, OpenXrQuadLayerOptions::default(), time, Size::new(1024.0, 576.0))
}Auto Trait Implementations§
impl Freeze for OpenXrActionInput
impl !RefUnwindSafe for OpenXrActionInput
impl Send for OpenXrActionInput
impl Sync for OpenXrActionInput
impl Unpin for OpenXrActionInput
impl !UnwindSafe for OpenXrActionInput
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> 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<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 more