Fallback to flat when no oxr runtime is found (#51)

* basics done? now to the fun part: changing the ENTIRE lib to work with xr and non xr

* updated stuff and renamed file

* actually add the renamed file into git lol :3

* made lib fallback to flat when no runtime is found but can't compile with default settings under those circumstances
This commit is contained in:
Schmarni
2023-12-09 06:09:48 +01:00
committed by GitHub
parent d9ebd5bf0c
commit 28008f7964
15 changed files with 547 additions and 783 deletions

View File

@@ -9,13 +9,14 @@ pub mod prototype_locomotion;
pub mod trackers;
pub mod xr_camera;
use crate::xr_init::{XrPostSetup, XrSetup, xr_only};
use crate::resources::{XrInstance, XrSession};
use crate::xr_begin_frame;
use crate::xr_input::controllers::XrControllerType;
use crate::xr_input::oculus_touch::setup_oculus_controller;
use crate::xr_input::xr_camera::{xr_camera_head_sync, Eye, XRProjection, XrCameraBundle};
use bevy::app::{App, PostUpdate, Startup};
use bevy::log::warn;
use bevy::log::{warn, info};
use bevy::prelude::{BuildChildren, Component, Deref, DerefMut, IntoSystemConfigs, Resource};
use bevy::prelude::{Commands, Plugin, PreUpdate, Quat, Res, SpatialBundle, Update, Vec3};
use bevy::render::camera::CameraProjectionPlugin;
@@ -52,27 +53,27 @@ impl Plugin for OpenXrInput {
app.add_plugins(CameraProjectionPlugin::<XRProjection>::default());
app.add_plugins(OpenXrActionsPlugin);
app.add_systems(
PreUpdate,
(post_action_setup_oculus_controller.after(setup_oxr_actions),),
XrPostSetup,
post_action_setup_oculus_controller,
);
match self.controller_type {
XrControllerType::OculusTouch => {
app.add_systems(Startup, setup_oculus_controller);
app.add_systems(XrSetup, setup_oculus_controller);
}
}
//adopt any new trackers
app.add_systems(PreUpdate, adopt_open_xr_trackers);
app.add_systems(PreUpdate, action_set_system);
app.add_systems(PreUpdate, xr_camera_head_sync.after(xr_begin_frame));
app.add_systems(PreUpdate, adopt_open_xr_trackers.run_if(xr_only()));
// app.add_systems(PreUpdate, action_set_system);
app.add_systems(PreUpdate, xr_camera_head_sync.run_if(xr_only()).after(xr_begin_frame));
//update controller trackers
app.add_systems(Update, update_open_xr_controllers);
app.add_systems(Update, update_open_xr_controllers.run_if(xr_only()));
app.add_systems(
PostUpdate,
update_frusta::<XRProjection>
.after(TransformSystem::TransformPropagate)
.before(VisibilitySystems::UpdatePerspectiveFrusta),
);
app.add_systems(Startup, setup_xr_cameras);
app.add_systems(XrSetup, setup_xr_cameras);
}
}
@@ -88,6 +89,7 @@ fn setup_binding_recommendations(
}
fn setup_xr_cameras(mut commands: Commands) {
info!("WTF?!");
//this needs to do the whole xr tracking volume not just cameras
//get the root?
let tracking_root = commands