fixed things up for proper 0.16 release

This commit is contained in:
Malek
2025-04-25 17:20:05 -04:00
committed by Schmarni
parent 4528529417
commit ae54de3db9
13 changed files with 168 additions and 145 deletions

View File

@@ -3,7 +3,7 @@ use std::ptr;
use bevy::ecs::schedule::ScheduleLabel;
use bevy::ecs::system::RunSystemOnce;
use bevy::platform_support::collections::HashMap;
use bevy::platform::collections::HashMap;
use bevy::prelude::*;
use bevy_mod_xr::session::XrSessionCreatedEvent;
use openxr::sys::ActionSuggestedBinding;

View File

@@ -110,7 +110,7 @@ fn clean_up_default_hands(
) {
for e in &query {
debug!("removing default hand entity");
cmds.entity(e).despawn_recursive();
cmds.entity(e).despawn();
}
}

View File

@@ -8,7 +8,6 @@ use openxr::PassthroughCapabilityFlagsFB;
use crate::layer_builder::PassthroughLayer;
use crate::resources::*;
use crate::session::OxrSession;
use crate::types::*;
pub struct OxrPassthroughPlugin;

View File

@@ -198,7 +198,7 @@ fn detect_session_destroyed(
let state = state.0.load(Ordering::Relaxed);
if *last_state && !state {
debug!("XrSession was fully destroyed!");
sender.send_default();
sender.write_default();
cmds.insert_resource(XrState::Available);
}
*last_state = state;
@@ -327,14 +327,14 @@ pub fn handle_events(
},
_ => unreachable!(),
};
changed_event.send(XrStateChanged(new_status));
changed_event.write(XrStateChanged(new_status));
*status = new_status;
}
InstanceLossPending(_) => {}
EventsLost(e) => warn!("lost {} XR events", e.lost_event_count()),
// we might want to check if this is the correct session?
Event::InteractionProfileChanged(_) => {
interaction_profile_changed_event.send_default();
interaction_profile_changed_event.write_default();
}
_ => {}
}

View File

@@ -9,7 +9,7 @@ use crate::resources::*;
use crate::spaces::OxrSpaceExt as _;
pub trait LayerProvider {
fn get<'a>(&'a self, world: &'a World) -> Option<Box<dyn CompositionLayer + '_>>;
fn get<'a>(&'a self, world: &'a World) -> Option<Box<dyn CompositionLayer + 'a>>;
}
pub struct ProjectionLayer;
@@ -63,7 +63,7 @@ impl LayerProvider for ProjectionLayer {
}
impl LayerProvider for PassthroughLayer {
fn get<'a>(&'a self, world: &'a World) -> Option<Box<dyn CompositionLayer + '_>> {
fn get(&self, world: &World) -> Option<Box<dyn CompositionLayer>> {
Some(Box::new(
CompositionLayerPassthrough::new()
.layer_handle(world.get_resource::<OxrPassthroughLayer>()?)

View File

@@ -6,7 +6,6 @@ use bevy::{
utils::default,
window::{PresentMode, Window, WindowPlugin},
};
use bevy::render::camera::CameraPlugin;
use bevy_mod_xr::session::XrSessionPlugin;
use bevy_mod_xr::{camera::XrCameraPlugin, session::XrState};
use init::OxrInitPlugin;

View File

@@ -1,4 +1,4 @@
use bevy::render::camera::CustomProjection;
use bevy::{
prelude::*,
render::{
@@ -147,7 +147,7 @@ pub fn clean_views(
) {
for (e, cam) in &cam_query {
manual_texture_views.remove(&ManualTextureViewHandle(XR_TEXTURE_INDEX + cam.0));
commands.entity(e).despawn_recursive();
commands.entity(e).despawn();
}
}

View File

@@ -1,8 +1,6 @@
use std::{mem::MaybeUninit, ptr, sync::Mutex};
use bevy::{prelude::*};
use bevy::platform_support::*;
use bevy::platform_support::hash::FixedHasher;
use bevy_mod_xr::{
session::{XrFirst, XrHandleEvents},
spaces::{
@@ -66,7 +64,7 @@ fn destroy_space_event(instance: Res<OxrInstance>, mut events: EventReader<XrDes
}
}
pub static OXR_DO_NOT_CALL_DESTOY_SPACE_FOR_SPACES: Mutex<Option<bevy::platform_support::collections::hash_set::HashSet<u64, bevy::platform_support::hash::RandomState>>> = Mutex::new(None);
pub static OXR_DO_NOT_CALL_DESTOY_SPACE_FOR_SPACES: Mutex<Option<bevy::platform::collections::hash_set::HashSet<u64>>> = Mutex::new(None);
pub static OXR_ORIGINAL_DESTOY_SPACE: Mutex<Option<openxr::sys::pfn::DestroySpace>> =
Mutex::new(None);
@@ -74,7 +72,7 @@ fn patch_destroy_space(instance: ResMut<OxrInstance>) {
OXR_DO_NOT_CALL_DESTOY_SPACE_FOR_SPACES
.lock()
.unwrap()
.replace(bevy::platform_support::collections::hash_set::HashSet::new());
.replace(bevy::platform::collections::hash_set::HashSet::new());
let raw_instance_ptr = instance.fp() as *const _ as *mut openxr::raw::Instance;
unsafe {
OXR_ORIGINAL_DESTOY_SPACE