ailloli_ui_openxr/
lib.rs

1//! Host-side helpers to run the Ailloli UI render/runtime core in XR-like targets.
2//!
3//! The crate intentionally keeps the widget/layout runtime untouched.
4//! It provides:
5//!
6//! - Legacy/generic `wgpu` target adapter helpers for external frame producers.
7//! - A small input converter that maps XR pointer/ray hit state to
8//!   `ailloli_ui_core::event::Event` without introducing desktop-only assumptions.
9//! - Clipboard fallback providers for headless/XR hosts.
10//!
11//! The production VR rendering path is intentionally separate from desktop wgpu:
12//! `ailloli_ui_openxr` owns OpenXR host concerns, while `ailloli_ui_render_vulkan` owns Vulkan/SPIR-V
13//! drawing for `Scene`/`DrawCmd`.
14//!
15//! Feature boundaries:
16//! - `wgpu_target` is the legacy/generic desktop adapter path.
17//! - `openxr` enables the reusable OpenXR/Vulkan host path.
18//! - `smoke_ui` adds the built-in smoke scene used by example APKs.
19//!
20//! This crate is optional and additive. If you need to keep desktop behavior
21//! untouched, continue to use `ailloli_ui_winit`; this crate is for non-desktop
22//! hosts (OpenXR, custom runtimes, overlays).
23
24#![allow(
25    clippy::missing_transmute_annotations,
26    clippy::needless_borrow,
27    clippy::new_without_default,
28    clippy::too_many_arguments
29)]
30
31pub use error::{OpenXrHostError, OpenXrHostResult};
32pub use input::{
33    map_ray_to_openxr_input_events, map_samples_to_openxr_input_events, OpenXrInputMapper,
34    OpenXrPointerFrame, OpenXrPointerHit, OpenXrPointerSample, OpenXrPointerSource, PointHit,
35};
36#[cfg(feature = "wgpu_target")]
37pub use target::{
38    build_callback_source, CallbackImageSource, OpenXrImageFrame, OpenXrImageSource,
39    OpenXrRenderTarget,
40};
41
42pub mod clipboard;
43pub mod error;
44pub mod input;
45pub mod math;
46#[cfg(feature = "wgpu_target")]
47pub mod target;
48
49#[cfg(feature = "openxr")]
50pub mod openxr_runtime;
51#[cfg(all(feature = "openxr", feature = "smoke_ui"))]
52pub use openxr_runtime::{
53    run_openxr_smoke, OpenXrSmokeExitReason, OpenXrSmokeOptions, OpenXrSmokeResult,
54};
55#[cfg(feature = "openxr")]
56pub use openxr_runtime::{
57    OpenXrAcquiredImage, OpenXrActionInput, OpenXrActionInputFrame, OpenXrCurvedLayerBackend,
58    OpenXrCurvedScreenOptions, OpenXrExternalHostFrame, OpenXrExternalUiHost,
59    OpenXrExternalUiHostFrame, OpenXrExternalUiHostFrameParts, OpenXrExternalUiHostFrameResult,
60    OpenXrExternalUiHostOptions, OpenXrExternalUiHostRayOptions, OpenXrExternalVulkanContext,
61    OpenXrInputCapabilities, OpenXrInputHand, OpenXrInputSourceInfo, OpenXrInputSourceKind,
62    OpenXrInstance, OpenXrPanelFacingMode, OpenXrPanelFacingOptions, OpenXrPointerSelectionPolicy,
63    OpenXrQuadComposer, OpenXrQuadFrameLoopOptions, OpenXrQuadLayerOptions,
64    OpenXrQuadPointerMapper, OpenXrQuadSwapchain, OpenXrRayHitKind, OpenXrRayOverlay,
65    OpenXrRayOverlayOptions, OpenXrRaySample, OpenXrRenderVulkanFrameLoopOptions,
66    OpenXrResolvedScreenBackend, OpenXrRuntime, OpenXrRuntimeError, OpenXrRuntimeOptions,
67    OpenXrScreenComposer, OpenXrScreenLayer, OpenXrScreenLayerOptions, OpenXrScreenSurfaceMode,
68    OpenXrSwapchainFormat, OpenXrUiFrameLoopOptions, OpenXrUiInputOptions, OpenXrUiLayer,
69    OpenXrUiLayerOptions, OpenXrVulkanContext, ReferenceSpacePreference, VrApp,
70    DEFAULT_PANEL_PITCH_MAX_RAD, DEFAULT_PANEL_PITCH_MIN_RAD, OPENXR_RAY_MAX_LENGTH_METERS,
71    OPENXR_RAY_MIN_LENGTH_METERS, OPENXR_RAY_TEXTURE_HEIGHT, OPENXR_RAY_TEXTURE_WIDTH,
72    OPENXR_RAY_WIDTH_METERS,
73};
74
75pub use clipboard::VrClipboard;