update to bevy 0.13. TODO: fix view weirdness and do a pass over most of xr_input to turn the modules into plugins

This commit is contained in:
Schmarni
2024-02-20 09:15:21 +01:00
parent a95462b91d
commit df71c7931d
16 changed files with 179 additions and 177 deletions

View File

@@ -13,7 +13,7 @@ crate-type = ["rlib", "cdylib"]
[dependencies]
bevy_oxr.path = "../.."
bevy = "0.12"
bevy = "0.13"
openxr = { git = "https://github.com/Ralith/openxrs", rev = "0177d2d", features = ["mint"] }
# [profile.release]

View File

@@ -17,7 +17,7 @@ use bevy_oxr::DefaultXrPlugins;
#[bevy_main]
fn main() {
let mut xr_extensions = XrExtensions::default();
xr_extensions.enable_fb_passthrough();
// xr_extensions.enable_fb_passthrough();
xr_extensions.enable_hand_tracking();
App::new()
.add_plugins(DefaultXrPlugins {
@@ -31,7 +31,7 @@ fn main() {
.add_plugins(LogDiagnosticsPlugin::default())
.add_plugins(FrameTimeDiagnosticsPlugin)
.add_plugins(HandInputDebugRenderer)
.add_plugins(bevy_oxr::passthrough::EnablePassthroughStartup)
// .add_plugins(bevy_oxr::passthrough::EnablePassthroughStartup)
.add_systems(Startup, setup)
.add_systems(
Update,
@@ -57,21 +57,21 @@ fn setup(
) {
// plane
commands.spawn(PbrBundle {
mesh: meshes.add(shape::Plane::from_size(5.0).into()),
material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()),
mesh: meshes.add(Plane3d::new(Vec3::Y)),
material: materials.add(StandardMaterial::from(Color::rgb(0.3, 0.5, 0.3))),
..default()
});
// cube
commands.spawn(PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 0.1 })),
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()),
mesh: meshes.add(Cuboid::from_size(Vec3::splat(0.1)).mesh()),
material: materials.add(StandardMaterial::from(Color::rgb(0.8, 0.7, 0.6))),
transform: Transform::from_xyz(0.0, 0.5, 0.0),
..default()
});
// cube
commands.spawn(PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 0.1 })),
material: materials.add(Color::rgb(0.8, 0.0, 0.0).into()),
mesh: meshes.add(Mesh::from(Cuboid::from_size(Vec3::splat(0.1)))),
material: materials.add(StandardMaterial::from(Color::rgb(0.8, 0.0, 0.0))),
transform: Transform::from_xyz(0.0, 0.5, 1.0),
..default()
});
@@ -106,7 +106,7 @@ fn spawn_controllers_example(mut commands: Commands) {
// TODO: make this a vr button
fn toggle_passthrough(
keys: Res<Input<KeyCode>>,
keys: Res<ButtonInput<KeyCode>>,
passthrough_state: Res<XrPassthroughState>,
mut resume: EventWriter<ResumePassthrough>,
mut pause: EventWriter<PausePassthrough>,
@@ -114,8 +114,12 @@ fn toggle_passthrough(
if keys.just_pressed(KeyCode::Space) {
match *passthrough_state {
XrPassthroughState::Unsupported => {}
XrPassthroughState::Running => pause.send_default(),
XrPassthroughState::Paused => resume.send_default(),
XrPassthroughState::Running => {
pause.send_default();
}
XrPassthroughState::Paused => {
resume.send_default();
}
}
}
}