Skip to content

Commit

Permalink
use openxr git version (#62)
Browse files Browse the repository at this point in the history
* fix problems with get version

* a litle Recentering as a treat?

* commit new Cargo.toml

* re export path null so you don't have to import openxr yourself
  • Loading branch information
Schmarni-Dev authored Jan 1, 2024
1 parent 65a30ca commit b2efa80
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
15 changes: 12 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,20 @@ wgpu-core = { version = "0.17.1", features = ["vulkan"] }
wgpu-hal = "0.17.1"

[target.'cfg(windows)'.dependencies]
openxr = { version = "0.17.1", features = ["linked","static","mint"] }
openxr = { git = "https://github.com/Ralith/openxrs", rev = "0177d2d", features = [
"linked",
"static",
"mint",
] }
[target.'cfg(all(target_family = "unix", not(target_arch = "wasm32")) )'.dependencies]
openxr = { version = "0.17.1", features = ["mint"] }
openxr = { git = "https://github.com/Ralith/openxrs", rev = "0177d2d", features = [
"mint",
] }
[target.'cfg(all(not(target_family = "unix"), not(target_arch = "wasm32")))'.dependencies]
openxr = { version = "0.17.1", features = ["mint", "static"] }
openxr = { git = "https://github.com/Ralith/openxrs", rev = "0177d2d", features = [
"mint",
"static",
] }

[dev-dependencies]
bevy = "0.12"
Expand Down
2 changes: 1 addition & 1 deletion examples/android/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ crate-type = ["rlib", "cdylib"]
[dependencies]
bevy_oxr.path = "../.."
bevy = "0.12"
openxr = { git = "https://github.com/Ralith/openxrs", features = ["mint"] }
openxr = { git = "https://github.com/Ralith/openxrs", rev = "0177d2d", features = ["mint"] }

[profile.release]
lto = "fat"
Expand Down
18 changes: 14 additions & 4 deletions src/graphics/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ impl XrExtensions {
self.0.ext_hand_tracking = false;
self
}
pub fn enable_local_floor(&mut self) -> &mut Self {
self.0.ext_local_floor = true;
self
}
pub fn disable_local_floor(&mut self) -> &mut Self {
self.0.ext_local_floor = false;
self
}
}
impl From<ExtensionSet> for XrExtensions {
fn from(value: ExtensionSet) -> Self {
Expand All @@ -41,6 +49,7 @@ impl Default for XrExtensions {
fn default() -> Self {
let mut exts = ExtensionSet::default();
exts.ext_hand_tracking = true;
exts.ext_local_floor = true;
Self(exts)
}
}
Expand All @@ -49,6 +58,7 @@ impl ops::BitAnd for XrExtensions {

fn bitand(self, rhs: Self) -> Self::Output {
let mut out = ExtensionSet::default();
out.ext_local_floor = self.0.ext_local_floor && rhs.0.ext_local_floor;
out.almalence_digital_lens_control =
self.0.almalence_digital_lens_control && rhs.0.almalence_digital_lens_control;
out.epic_view_configuration_fov =
Expand All @@ -73,7 +83,7 @@ impl ops::BitAnd for XrExtensions {
self.0.ext_hp_mixed_reality_controller && rhs.0.ext_hp_mixed_reality_controller;
out.ext_palm_pose = self.0.ext_palm_pose && rhs.0.ext_palm_pose;
out.ext_uuid = self.0.ext_uuid && rhs.0.ext_uuid;
out.extx_overlay = self.0.extx_overlay && rhs.0.extx_overlay;
// out.extx_overlay = self.0.extx_overlay && rhs.0.extx_overlay;
out.fb_composition_layer_image_layout =
self.0.fb_composition_layer_image_layout && rhs.0.fb_composition_layer_image_layout;
out.fb_composition_layer_alpha_blend =
Expand Down Expand Up @@ -122,8 +132,8 @@ impl ops::BitAnd for XrExtensions {
out.htc_hand_interaction = self.0.htc_hand_interaction && rhs.0.htc_hand_interaction;
out.htc_vive_wrist_tracker_interaction =
self.0.htc_vive_wrist_tracker_interaction && rhs.0.htc_vive_wrist_tracker_interaction;
out.htcx_vive_tracker_interaction =
self.0.htcx_vive_tracker_interaction && rhs.0.htcx_vive_tracker_interaction;
// out.htcx_vive_tracker_interaction =
// self.0.htcx_vive_tracker_interaction && rhs.0.htcx_vive_tracker_interaction;
out.huawei_controller_interaction =
self.0.huawei_controller_interaction && rhs.0.huawei_controller_interaction;
out.khr_composition_layer_cube =
Expand Down Expand Up @@ -163,7 +173,7 @@ impl ops::BitAnd for XrExtensions {
out.mnd_swapchain_usage_input_attachment_bit =
self.0.mnd_swapchain_usage_input_attachment_bit
&& rhs.0.mnd_swapchain_usage_input_attachment_bit;
out.mndx_egl_enable = self.0.mndx_egl_enable && rhs.0.mndx_egl_enable;
// out.mndx_egl_enable = self.0.mndx_egl_enable && rhs.0.mndx_egl_enable;
out.msft_unbounded_reference_space =
self.0.msft_unbounded_reference_space && rhs.0.msft_unbounded_reference_space;
out.msft_spatial_anchor = self.0.msft_spatial_anchor && rhs.0.msft_spatial_anchor;
Expand Down
10 changes: 8 additions & 2 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ impl XrInput {
// xr::Posef::IDENTITY,
// )?;

let stage =
session.create_reference_space(xr::ReferenceSpaceType::STAGE, xr::Posef::IDENTITY)?;
let stage = match instance.exts().ext_local_floor {
None => session
.create_reference_space(xr::ReferenceSpaceType::STAGE, xr::Posef::IDENTITY)?,
Some(_) => session.create_reference_space(
xr::ReferenceSpaceType::LOCAL_FLOOR_EXT,
xr::Posef::IDENTITY,
)?,
};
let head =
session.create_reference_space(xr::ReferenceSpaceType::VIEW, xr::Posef::IDENTITY)?;
// let y = stage
Expand Down
2 changes: 2 additions & 0 deletions src/xr_input/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use crate::{

use super::oculus_touch::ActionSets;

pub use xr::sys::NULL_PATH;

pub struct OpenXrActionsPlugin;
impl Plugin for OpenXrActionsPlugin {
fn build(&self, app: &mut App) {
Expand Down

0 comments on commit b2efa80

Please sign in to comment.