fixed things up for proper 0.16 release
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
@@ -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>()?)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -83,7 +83,7 @@ fn update_stage(
|
||||
root_query: Query<&Transform, (With<XrTrackingRoot>, Without<XrTrackedStage>)>,
|
||||
mut stage_query: Query<&mut Transform, (With<XrTrackedStage>, Without<XrTrackingRoot>)>,
|
||||
) {
|
||||
if let Ok(root) = root_query.get_single() {
|
||||
if let Ok(root) = root_query.single() {
|
||||
for mut transform in &mut stage_query {
|
||||
*transform = *root;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ fn update_view(
|
||||
mut head_query: Query<&mut Transform, (With<HeadXRSpace>, Without<XrTrackedView>)>,
|
||||
mut view_query: Query<&mut Transform, (With<XrTrackedView>, Without<HeadXRSpace>)>,
|
||||
) {
|
||||
let head_transform = head_query.get_single_mut();
|
||||
let head_transform = head_query.single_mut();
|
||||
if let Ok(root) = head_transform {
|
||||
for mut transform in &mut view_query {
|
||||
*transform = *root;
|
||||
@@ -142,7 +142,7 @@ fn update_local_floor_transforms(
|
||||
mut head_space: Query<&mut Transform, (With<HeadXRSpace>, Without<XrTrackedLocalFloor>)>,
|
||||
mut local_floor: Query<&mut Transform, (With<XrTrackedLocalFloor>, Without<HeadXRSpace>)>,
|
||||
) {
|
||||
let head_transform = head_space.get_single_mut();
|
||||
let head_transform = head_space.single_mut();
|
||||
if let Ok(head) = head_transform {
|
||||
let mut calc_floor = *head;
|
||||
calc_floor.translation.y = 0.0;
|
||||
@@ -164,7 +164,7 @@ fn update_left_grip(
|
||||
mut left_grip: Query<&mut Transform, (With<LeftGrip>, Without<XrTrackedLeftGrip>)>,
|
||||
mut tracked_left_grip: Query<&mut Transform, (With<XrTrackedLeftGrip>, Without<LeftGrip>)>,
|
||||
) {
|
||||
let head_transform = left_grip.get_single_mut();
|
||||
let head_transform = left_grip.single_mut();
|
||||
if let Ok(head) = head_transform {
|
||||
for mut transform in &mut tracked_left_grip {
|
||||
*transform = *head;
|
||||
@@ -180,7 +180,7 @@ fn update_right_grip(
|
||||
mut right_grip: Query<&mut Transform, (With<RightGrip>, Without<XrTrackedRightGrip>)>,
|
||||
mut tracked_right_grip: Query<&mut Transform, (With<XrTrackedRightGrip>, Without<RightGrip>)>,
|
||||
) {
|
||||
let head_transform = right_grip.get_single_mut();
|
||||
let head_transform = right_grip.single_mut();
|
||||
if let Ok(head) = head_transform {
|
||||
for mut transform in &mut tracked_right_grip {
|
||||
*transform = *head;
|
||||
@@ -229,12 +229,12 @@ pub fn suggest_action_bindings(
|
||||
actions: Res<ControllerActions>,
|
||||
mut bindings: EventWriter<OxrSuggestActionBinding>,
|
||||
) {
|
||||
bindings.send(OxrSuggestActionBinding {
|
||||
bindings.write(OxrSuggestActionBinding {
|
||||
action: actions.left.as_raw(),
|
||||
interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||
bindings: vec!["/user/hand/left/input/grip/pose".into()],
|
||||
});
|
||||
bindings.send(OxrSuggestActionBinding {
|
||||
bindings.write(OxrSuggestActionBinding {
|
||||
action: actions.right.as_raw(),
|
||||
interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||
bindings: vec!["/user/hand/right/input/grip/pose".into()],
|
||||
@@ -242,11 +242,11 @@ pub fn suggest_action_bindings(
|
||||
}
|
||||
|
||||
fn sync_actions(actions: Res<ControllerActions>, mut sync: EventWriter<OxrSyncActionSet>) {
|
||||
sync.send(OxrSyncActionSet(actions.set.clone()));
|
||||
sync.write(OxrSyncActionSet(actions.set.clone()));
|
||||
}
|
||||
|
||||
fn attach_set(actions: Res<ControllerActions>, mut attach: EventWriter<OxrAttachActionSet>) {
|
||||
attach.send(OxrAttachActionSet(actions.set.clone()));
|
||||
attach.write(OxrAttachActionSet(actions.set.clone()));
|
||||
}
|
||||
|
||||
fn create_actions(instance: Res<OxrInstance>, mut cmds: Commands) {
|
||||
|
||||
@@ -28,7 +28,7 @@ pub fn handle_transform_events(
|
||||
mut position_reader: EventReader<SnapToPosition>,
|
||||
mut rotation_reader: EventReader<SnapToRotation>,
|
||||
) {
|
||||
let result = root_query.get_single_mut();
|
||||
let result = root_query.single_mut();
|
||||
match result {
|
||||
Ok(mut root_transform) => {
|
||||
let view = views.first();
|
||||
|
||||
@@ -171,7 +171,7 @@ fn create_openxr_events(
|
||||
bindings: binding,
|
||||
};
|
||||
//finally send the suggestion
|
||||
binding_writer.send(sugestion);
|
||||
binding_writer.write(sugestion);
|
||||
}
|
||||
}
|
||||
bevy_mod_xr::actions::ActionType::Float => {
|
||||
@@ -210,7 +210,7 @@ fn create_openxr_events(
|
||||
bindings: binding,
|
||||
};
|
||||
//finally send the suggestion
|
||||
binding_writer.send(sugestion);
|
||||
binding_writer.write(sugestion);
|
||||
}
|
||||
}
|
||||
bevy_mod_xr::actions::ActionType::Vector => {
|
||||
@@ -249,13 +249,13 @@ fn create_openxr_events(
|
||||
bindings: binding,
|
||||
};
|
||||
//finally send the suggestion
|
||||
binding_writer.send(sugestion);
|
||||
binding_writer.write(sugestion);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
attach_writer.send(OxrAttachActionSet(action_set));
|
||||
attach_writer.write(OxrAttachActionSet(action_set));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ fn sync_active_action_sets(
|
||||
active_action_set_query: Query<&XRUtilsActionSetReference, With<ActiveSet>>,
|
||||
) {
|
||||
for set in &active_action_set_query {
|
||||
sync_set.send(OxrSyncActionSet(set.0.clone()));
|
||||
sync_set.write(OxrSyncActionSet(set.0.clone()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user