nightshade 0.10.0

A cross-platform data-oriented game engine.
Documentation
//! OpenXR virtual reality support for head-mounted displays.
//!
//! Run applications in VR with full 6DOF tracking and controller input:
//!
//! - [`XrContext`]: OpenXR session management and device access
//! - [`XrInput`]: Controller state including thumbsticks, triggers, and hand poses
//! - [`XrResources`]: World resource for VR state and locomotion settings
//! - [`XrRenderer`]: Stereo rendering pipeline for VR
//! - `launch_xr`: Entry point to run an application in VR mode
//!
//! Requires the `openxr` feature and a connected VR headset with OpenXR runtime.
//!
//! # Quick Start
//!
//! Launch your application in VR mode:
//!
//! ```ignore
//! use nightshade::xr::launch_xr;
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//!     let state = MyGameState::new();
//!     launch_xr(state)
//! }
//! ```
//!
//! # Reading Controller Input
//!
//! Access VR controller state through [`XrResources`]:
//!
//! ```ignore
//! fn run_systems(&mut self, world: &mut World) {
//!     if let Some(input) = &world.resources.xr.input {
//!         // Thumbstick movement (left controller)
//!         let move_x = input.thumbstick.x;
//!         let move_y = input.thumbstick.y;
//!
//!         // Trigger and grip (0.0 - 1.0)
//!         if input.left_trigger_pressed() {
//!             // Left trigger held
//!         }
//!         if input.right_grip_pressed() {
//!             // Right grip held
//!         }
//!
//!         // Face buttons
//!         if input.a_button_pressed() {
//!             // A button pressed
//!         }
//!
//!         // Hand tracking
//!         if let Some(left_pos) = input.left_hand_position() {
//!             // World-space left hand position
//!         }
//!         if let Some(left_rot) = input.left_hand_rotation() {
//!             // Left hand orientation as quaternion
//!         }
//!
//!         // Head tracking
//!         let head_pos = input.head_position;
//!         let head_rot = input.head_orientation;
//!     }
//! }
//! ```
//!
//! # Locomotion
//!
//! Enable thumbstick-based movement:
//!
//! ```ignore
//! fn initialize(&mut self, world: &mut World) {
//!     // Enable smooth locomotion with left thumbstick
//!     world.resources.xr.locomotion_enabled = true;
//!     world.resources.xr.locomotion_speed = 3.0;  // Units per second
//!
//!     // Set initial player position
//!     world.resources.xr.initial_player_position = Some(Vec3::new(0.0, 0.0, 5.0));
//!     world.resources.xr.initial_player_yaw = Some(0.0);
//! }
//! ```
//!
//! # Syncing with Character Controller
//!
//! If your scene has a character controller, the VR player position automatically
//! syncs to it. The headset tracks relative to the character's floor position.
//!
//! # Input Properties
//!
//! | Property | Type | Description |
//! |----------|------|-------------|
//! | `thumbstick` | Vec2 | Left thumbstick X/Y (-1 to 1) |
//! | `right_thumbstick` | Vec2 | Right thumbstick X/Y (-1 to 1) |
//! | `left_trigger` | f32 | Left trigger (0 to 1) |
//! | `right_trigger` | f32 | Right trigger (0 to 1) |
//! | `left_grip` | f32 | Left grip (0 to 1) |
//! | `right_grip` | f32 | Right grip (0 to 1) |
//! | `a_button` | bool | A button state |
//! | `b_button` | bool | B button state |
//! | `left_hand_pose` | Option | Left controller pose |
//! | `right_hand_pose` | Option | Right controller pose |
//! | `head_position` | Vec3 | World-space head position |
//! | `head_orientation` | Quat | Head rotation |
//! | `player_yaw` | f32 | Player body rotation |
//!
//! # Supported Controllers
//!
//! Currently configured for Oculus Touch controllers. The input mapping:
//!
//! | Input | Binding |
//! |-------|---------|
//! | Movement | Left thumbstick |
//! | Turn | Right thumbstick |
//! | Left trigger | Left index trigger |
//! | Right trigger | Right index trigger |
//! | Left grip | Left squeeze |
//! | Right grip | Right squeeze |
//! | A button | Right controller A |
//! | B button | Right controller B |
//!
//! # Render Pipeline
//!
//! The VR renderer uses the same passes as the desktop renderer but renders
//! to each eye separately at the headset's native resolution. HDR rendering,
//! bloom, and tone mapping are all supported.

mod context;
mod frame;
mod input;
mod launch;
mod renderer;
mod resources;

pub use context::XrContext;
pub use frame::XrFrameContext;
pub use input::XrInput;
pub use launch::launch_xr;
pub use renderer::XrRenderer;
pub use resources::XrResources;