Working passthrough for Meta Quest 3 (#66)

* Window is None

* Builds but check manifest

* debug prints

* Started, not passing last "cvt"

* Passthrough works, bevy not visible

* Passthrough working

* Passthrough working

* Working passthrough
This commit is contained in:
Rasmus Hogslätt
2024-02-01 05:05:24 +01:00
committed by GitHub
parent 53af86b073
commit 71a08798ef
9 changed files with 398 additions and 137 deletions

View File

@@ -3,6 +3,15 @@ android:
- "runtime_libs"
manifest:
package: "org.bevyengine.example_openxr_android"
uses_feature:
- name: "android.hardware.vr.headtracking"
required: true
- name: "oculus.software.handtracking"
required: true
- name: "com.oculus.feature.PASSTHROUGH"
required: true
- name: "com.oculus.experimental.enabled"
required: true
application:
label: "Bevy Openxr Android"
theme: "@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen"
@@ -14,7 +23,7 @@ android:
- name: "com.oculus.supportedDevices"
value: "quest|quest2|quest3|questpro"
activities:
- config_changes: "density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
- config_changes: "density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode|screenLayout"
launch_mode: "singleTask"
orientation: "landscape"
intent_filters:
@@ -23,5 +32,6 @@ android:
categories:
- "com.oculus.intent.category.VR"
- "android.intent.category.LAUNCHER"
- "org.khronos.openxr.intent.category.IMMERSIVE_HMD"
sdk:
target_sdk_version: 32

View File

@@ -1,7 +1,11 @@
use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin};
use bevy::prelude::*;
use bevy::transform::components::Transform;
use bevy_oxr::graphics::extensions::XrExtensions;
use bevy_oxr::graphics::XrAppInfo;
use bevy_oxr::graphics::XrPreferdBlendMode::AlphaBlend;
use bevy_oxr::passthrough::{passthrough_layer_pause, passthrough_layer_resume};
use bevy_oxr::xr_init::XrRenderData;
use bevy_oxr::xr_input::debug_gizmos::OpenXrDebugRenderer;
use bevy_oxr::xr_input::prototype_locomotion::{proto_locomotion, PrototypeLocomotionConfig};
use bevy_oxr::xr_input::trackers::{
@@ -11,18 +15,21 @@ use bevy_oxr::DefaultXrPlugins;
#[bevy_main]
fn main() {
let mut xr_extensions = XrExtensions::default();
xr_extensions.enable_fb_passthrough();
App::new()
.add_plugins(DefaultXrPlugins {
reqeusted_extensions: xr_extensions,
app_info: XrAppInfo {
name: "Bevy OXR Android Example".into(),
},
..default()
prefered_blend_mode: bevy_oxr::graphics::XrPreferdBlendMode::Opaque,
})
.add_plugins(OpenXrDebugRenderer)
.add_plugins(LogDiagnosticsPlugin::default())
.add_plugins(FrameTimeDiagnosticsPlugin)
.add_systems(Startup, setup)
.add_systems(Update, proto_locomotion)
.add_systems(Update, (proto_locomotion, toggle_passthrough))
.add_systems(Startup, spawn_controllers_example)
.insert_resource(PrototypeLocomotionConfig::default())
.run();
@@ -64,11 +71,6 @@ fn setup(
transform: Transform::from_xyz(4.0, 8.0, 4.0),
..default()
});
// camera
// commands.spawn((Camera3dBundle {
// transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
// ..default()
// },));
}
fn spawn_controllers_example(mut commands: Commands) {
@@ -87,3 +89,16 @@ fn spawn_controllers_example(mut commands: Commands) {
SpatialBundle::default(),
));
}
// Does this work? Not getting logs
fn toggle_passthrough(keys: Res<Input<KeyCode>>, mut xr_data: ResMut<XrRenderData>) {
if keys.just_pressed(KeyCode::Space) {
if xr_data.xr_passthrough_active {
passthrough_layer_pause(xr_data);
bevy::log::info!("Passthrough paused");
} else {
passthrough_layer_resume(xr_data);
bevy::log::info!("Passthrough resumed");
}
}
}