added android example
This commit is contained in:
@@ -14,6 +14,7 @@ bevy.workspace = true
|
||||
|
||||
# all other dependencies are placed under this since on wasm, this crate is completely empty
|
||||
[target.'cfg(not(target_family = "wasm"))'.dependencies]
|
||||
openxr = "0.18.0"
|
||||
thiserror = "1.0.57"
|
||||
wgpu = "0.19.3"
|
||||
wgpu-hal = "0.19.3"
|
||||
|
||||
1
crates/bevy_openxr/examples/android/.gitignore
vendored
Normal file
1
crates/bevy_openxr/examples/android/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/runtime_libs
|
||||
63
crates/bevy_openxr/examples/android/Cargo.toml
Normal file
63
crates/bevy_openxr/examples/android/Cargo.toml
Normal file
@@ -0,0 +1,63 @@
|
||||
[package]
|
||||
name = "bevy_openxr_android"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
bevy_openxr.path = "../.."
|
||||
bevy.workspace = true
|
||||
|
||||
|
||||
[lib]
|
||||
name = "bevy_openxr_android"
|
||||
crate-type = ["rlib", "cdylib"]
|
||||
|
||||
|
||||
# This metadata is used by `cargo-apk` - `xbuild` uses the `manifest.yaml` instead.
|
||||
[package.metadata.android]
|
||||
package = "org.bevyengine.example_openxr_android"
|
||||
build_targets = ["aarch64-linux-android"]
|
||||
runtime_libs = "runtime_libs"
|
||||
apk_name = "bevyopenxr"
|
||||
# assets = "assets"
|
||||
# res = "assets/android-res"
|
||||
icon = "@mipmap/ic_launcher"
|
||||
label = "Bevy Openxr Android"
|
||||
strip = "strip"
|
||||
|
||||
# [package.metadata.android.application]
|
||||
# icon = "@mipmap/ic_launcher"
|
||||
# label = "Bevy Example"
|
||||
|
||||
[package.metadata.android.sdk]
|
||||
target_sdk_version = 32
|
||||
|
||||
[package.metadata.android.application.activity]
|
||||
theme = "@android:style/Theme.Black.NoTitleBar.Fullscreen"
|
||||
config_changes = "density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
|
||||
launch_mode = "singleTask"
|
||||
orientation = "landscape"
|
||||
resizeable_activity = false
|
||||
|
||||
[[package.metadata.android.application.activity.intent_filter]]
|
||||
actions = ["android.intent.action.MAIN"]
|
||||
categories = [
|
||||
"com.oculus.intent.category.VR",
|
||||
"android.intent.category.LAUNCHER",
|
||||
]
|
||||
|
||||
# !! IMPORTANT !!
|
||||
#
|
||||
# When creating your own apps, make sure to generate your own keystore, rather than using our example one!
|
||||
# You can use `keytool` like so:
|
||||
# keytool -genkey -v -keystore my-release-key.keystore -keyalg RSA -keysize 2048 -validity 10000
|
||||
#
|
||||
# For more information on key signing and why it's so important, check out this article:
|
||||
# https://developer.android.com/studio/publish/app-signing
|
||||
#
|
||||
# !! IMPORTANT !!
|
||||
[package.metadata.android.signing.release]
|
||||
path = "./hotham_examples.keystore"
|
||||
keystore_password = "chomsky-vigilant-spa"
|
||||
BIN
crates/bevy_openxr/examples/android/hotham_examples.keystore
Normal file
BIN
crates/bevy_openxr/examples/android/hotham_examples.keystore
Normal file
Binary file not shown.
39
crates/bevy_openxr/examples/android/manifest.yaml
Normal file
39
crates/bevy_openxr/examples/android/manifest.yaml
Normal file
@@ -0,0 +1,39 @@
|
||||
android:
|
||||
runtime_libs:
|
||||
- "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
|
||||
uses_permission:
|
||||
- name: "com.oculus.permission.HAND_TRACKING"
|
||||
application:
|
||||
label: "Bevy Openxr Android"
|
||||
theme: "@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen"
|
||||
meta_data:
|
||||
- name: "com.oculus.intent.category.VR"
|
||||
value: "vr_only"
|
||||
- name: "com.samsung.android.vr.application.mode"
|
||||
value: "vr_only"
|
||||
- name: "com.oculus.supportedDevices"
|
||||
value: "quest|quest2|quest3|questpro"
|
||||
activities:
|
||||
- config_changes: "density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode|screenLayout"
|
||||
launch_mode: "singleTask"
|
||||
orientation: "landscape"
|
||||
intent_filters:
|
||||
- actions:
|
||||
- "android.intent.action.MAIN"
|
||||
categories:
|
||||
- "com.oculus.intent.category.VR"
|
||||
- "android.intent.category.LAUNCHER"
|
||||
- "org.khronos.openxr.intent.category.IMMERSIVE_HMD"
|
||||
sdk:
|
||||
target_sdk_version: 32
|
||||
43
crates/bevy_openxr/examples/android/src/lib.rs
Normal file
43
crates/bevy_openxr/examples/android/src/lib.rs
Normal file
@@ -0,0 +1,43 @@
|
||||
//! A simple 3D scene with light shining over a cube sitting on a plane.
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_openxr::add_xr_plugins;
|
||||
|
||||
#[bevy_main]
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(add_xr_plugins(DefaultPlugins))
|
||||
.add_systems(Startup, setup)
|
||||
.run();
|
||||
}
|
||||
|
||||
/// set up a simple 3D scene
|
||||
fn setup(
|
||||
mut commands: Commands,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
) {
|
||||
// circular base
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Circle::new(4.0)),
|
||||
material: materials.add(Color::WHITE),
|
||||
transform: Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)),
|
||||
..default()
|
||||
});
|
||||
// cube
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
|
||||
material: materials.add(Color::rgb_u8(124, 144, 255)),
|
||||
transform: Transform::from_xyz(0.0, 0.5, 0.0),
|
||||
..default()
|
||||
});
|
||||
// light
|
||||
commands.spawn(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
..default()
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user