chore: cleanup
Some checks failed
CI / Check Ubuntu (push) Has been cancelled
CI / Check Windows (push) Has been cancelled
CI / Check Wasm (push) Has been cancelled

This commit is contained in:
2026-02-19 22:01:09 +01:00
parent 93fe370f12
commit 7936b53a02
8 changed files with 1239 additions and 29 deletions

1233
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,11 +6,11 @@ repository = "https://github.com/awtterpip/bevy_oxr"
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
[workspace] [workspace]
resolver = "2" resolver = "3"
members = ["crates/*", "crates/bevy_openxr/examples/android"] members = ["crates/*", "crates/bevy_openxr/examples/android"]
[workspace.dependencies] [workspace.dependencies]
bevy = "0.18" bevy = { version = "0.18", features = ["debug"] }
bevy_ecs = { version = "0.18", default-features = false } bevy_ecs = { version = "0.18", default-features = false }
bevy_math = { version = "0.18", default-features = false } bevy_math = { version = "0.18", default-features = false }
bevy_render = { version = "0.18", default-features = false } bevy_render = { version = "0.18", default-features = false }

View File

@@ -2,3 +2,15 @@
mod openxr; mod openxr;
#[cfg(not(target_family = "wasm"))] #[cfg(not(target_family = "wasm"))]
pub use openxr::*; pub use openxr::*;
pub mod prelude {
pub use crate::{
action_binding::OxrSendActionBindings, action_binding::OxrSuggestActionBinding,
action_set_attaching::OxrAttachActionSet, action_set_syncing::OxrActionSetSyncSet,
action_set_syncing::OxrSyncActionSet, add_xr_plugins, exts::OxrExtensions,
features::handtracking::HandTrackingPlugin, init::OxrInitPlugin, openxr_session_running,
resources::OxrInstance, resources::OxrSessionConfig, session::OxrSession,
spaces::OxrSpaceExt,
};
pub use openxr::EnvironmentBlendMode;
}

View File

@@ -42,12 +42,12 @@ impl OxrExtensions {
} }
/// returns true if all of the extensions enabled are also available in `available_exts` /// returns true if all of the extensions enabled are also available in `available_exts`
pub fn is_available(&self, available_exts: &OxrExtensions) -> bool { pub fn is_available(&self, available_exts: &OxrExtensions) -> bool {
self.0.intersection(&available_exts) == self.0 self.0.intersection(available_exts) == self.0
} }
/// Returns any extensions needed by `required_exts` that aren't available in `self` /// Returns any extensions needed by `required_exts` that aren't available in `self`
pub fn unavailable_exts(&self, required_exts: &Self) -> Vec<String> { pub fn unavailable_exts(&self, required_exts: &Self) -> Vec<String> {
required_exts required_exts
.difference(&self) .difference(self)
.names() .names()
.into_iter() .into_iter()
.filter_map(|v| { .filter_map(|v| {
@@ -69,13 +69,7 @@ impl BitOr for OxrExtensions {
// this is horribly slow, but doesn't require a bunch of code duplication // this is horribly slow, but doesn't require a bunch of code duplication
fn bitor(self, rhs: Self) -> Self::Output { fn bitor(self, rhs: Self) -> Self::Output {
Self( Self(self.0.names().into_iter().chain(rhs.names()).collect())
self.0
.names()
.into_iter()
.chain(rhs.names().into_iter())
.collect(),
)
} }
} }
impl BitAnd for OxrExtensions { impl BitAnd for OxrExtensions {

View File

@@ -14,6 +14,7 @@ use crate::{
types::{AppInfo, OxrExtensions, Result, WgpuGraphics}, types::{AppInfo, OxrExtensions, Result, WgpuGraphics},
}; };
#[allow(clippy::missing_safety_doc)]
/// This is an extension trait to the [`Graphics`](openxr::Graphics) trait and is how the graphics API should be interacted with. /// This is an extension trait to the [`Graphics`](openxr::Graphics) trait and is how the graphics API should be interacted with.
pub unsafe trait GraphicsExt: openxr::Graphics { pub unsafe trait GraphicsExt: openxr::Graphics {
/// Wrap the graphics specific type into the [GraphicsWrap] enum /// Wrap the graphics specific type into the [GraphicsWrap] enum

View File

@@ -2,7 +2,7 @@ use std::mem;
use bevy_ecs::world::World; use bevy_ecs::world::World;
use bevy_mod_xr::spaces::{XrPrimaryReferenceSpace, XrSpace}; use bevy_mod_xr::spaces::{XrPrimaryReferenceSpace, XrSpace};
use openxr::{sys, CompositionLayerFlags, Fovf, Posef, Rect2Di}; use openxr::{CompositionLayerFlags, Fovf, Posef, Rect2Di, sys};
use crate::graphics::graphics_match; use crate::graphics::graphics_match;
use crate::resources::*; use crate::resources::*;

View File

@@ -21,7 +21,7 @@ pub struct OxrReferenceSpacePlugin {
impl Default for OxrReferenceSpacePlugin { impl Default for OxrReferenceSpacePlugin {
fn default() -> Self { fn default() -> Self {
Self { Self {
default_primary_ref_space: openxr::ReferenceSpaceType::STAGE, default_primary_ref_space: openxr::ReferenceSpaceType::LOCAL,
} }
} }
} }

View File

@@ -47,7 +47,7 @@ impl OxrEntry {
application_version: app_info.version.to_u32(), application_version: app_info.version.to_u32(),
engine_name: "Bevy", engine_name: "Bevy",
engine_version: Version::BEVY.to_u32(), engine_version: Version::BEVY.to_u32(),
api_version: openxr::Version::new(1, 0, 34), api_version: openxr::Version::new(1, 1, 54),
}, },
&required_exts.into(), &required_exts.into(),
layers, layers,