@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "bevy_mod_openxr"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[features]
|
||||
default = ["vulkan", "d3d12", "passthrough"]
|
||||
@@ -24,9 +24,9 @@ bevy.workspace = true
|
||||
[target.'cfg(not(target_family = "wasm"))'.dependencies]
|
||||
openxr = "0.18.0"
|
||||
thiserror = "1.0.57"
|
||||
wgpu = "0.19.3"
|
||||
wgpu-hal = "0.19.3"
|
||||
bevy_mod_xr.path = "../bevy_xr"
|
||||
wgpu = "0.20"
|
||||
wgpu-hal = "0.21"
|
||||
bevy_mod_xr={path = "../bevy_xr",version = "0.1.0-rc1"}
|
||||
|
||||
ash = { version = "0.37.3", optional = true }
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ fn setup(
|
||||
// cube
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
|
||||
material: materials.add(Color::rgb_u8(124, 144, 255)),
|
||||
material: materials.add(Color::srgb_u8(124, 144, 255)),
|
||||
transform: Transform::from_xyz(0.0, 0.5, 0.0),
|
||||
..default()
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ fn setup_scene(
|
||||
// cube
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
|
||||
material: materials.add(Color::rgb_u8(124, 144, 255)),
|
||||
material: materials.add(Color::srgb_u8(124, 144, 255)),
|
||||
transform: Transform::from_xyz(0.0, 0.5, 0.0),
|
||||
..default()
|
||||
});
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[package]
|
||||
name = "bevy_openxr_android"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
publish = false
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ fn setup(
|
||||
transform: Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)),
|
||||
..default()
|
||||
});
|
||||
let mut cube_mat: StandardMaterial = Color::rgb_u8(124, 144, 255).into();
|
||||
let mut cube_mat: StandardMaterial = Color::srgb_u8(124, 144, 255).into();
|
||||
cube_mat.unlit = true;
|
||||
// cube
|
||||
commands.spawn(PbrBundle {
|
||||
|
||||
@@ -88,7 +88,7 @@ fn setup(
|
||||
// cube
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
|
||||
material: materials.add(Color::rgb_u8(124, 144, 255)),
|
||||
material: materials.add(Color::srgb_u8(124, 144, 255)),
|
||||
transform: Transform::from_xyz(0.0, 2.5, 0.0),
|
||||
..default()
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ fn setup(
|
||||
// cube
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
|
||||
material: materials.add(Color::rgb_u8(124, 144, 255)),
|
||||
material: materials.add(Color::srgb_u8(124, 144, 255)),
|
||||
transform: Transform::from_xyz(0.0, 0.5, 0.0),
|
||||
..default()
|
||||
});
|
||||
@@ -132,7 +132,7 @@ fn spawn_hands(
|
||||
.spawn((
|
||||
PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(0.1, 0.1, 0.05)),
|
||||
material: materials.add(Color::rgb_u8(124, 144, 255)),
|
||||
material: materials.add(Color::srgb_u8(124, 144, 255)),
|
||||
transform: Transform::from_xyz(0.0, 0.5, 0.0),
|
||||
..default()
|
||||
},
|
||||
@@ -144,7 +144,7 @@ fn spawn_hands(
|
||||
.spawn((
|
||||
PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(0.1, 0.1, 0.05)),
|
||||
material: materials.add(Color::rgb_u8(124, 144, 255)),
|
||||
material: materials.add(Color::srgb_u8(124, 144, 255)),
|
||||
transform: Transform::from_xyz(0.0, 0.5, 0.0),
|
||||
..default()
|
||||
},
|
||||
|
||||
@@ -64,7 +64,7 @@ fn setup(
|
||||
// cube
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
|
||||
material: materials.add(Color::rgb_u8(124, 144, 255)),
|
||||
material: materials.add(Color::srgb_u8(124, 144, 255)),
|
||||
transform: Transform::from_xyz(0.0, 0.5, 0.0),
|
||||
..default()
|
||||
});
|
||||
|
||||
@@ -50,35 +50,35 @@ fn setup(
|
||||
// red cube
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
|
||||
material: materials.add(Color::rgb_u8(252, 44, 3)),
|
||||
material: materials.add(Color::srgb_u8(252, 44, 3)),
|
||||
transform: Transform::from_xyz(4.0, 0.5, 0.0).with_scale(Vec3::splat(0.5)),
|
||||
..default()
|
||||
});
|
||||
// blue cube
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
|
||||
material: materials.add(Color::rgb_u8(3, 28, 252)),
|
||||
material: materials.add(Color::srgb_u8(3, 28, 252)),
|
||||
transform: Transform::from_xyz(-4.0, 0.5, 0.0).with_scale(Vec3::splat(0.5)),
|
||||
..default()
|
||||
});
|
||||
// green cube
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
|
||||
material: materials.add(Color::rgb_u8(3, 252, 32)),
|
||||
material: materials.add(Color::srgb_u8(3, 252, 32)),
|
||||
transform: Transform::from_xyz(0.0, 0.5, 4.0).with_scale(Vec3::splat(0.5)),
|
||||
..default()
|
||||
});
|
||||
// white cube
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
|
||||
material: materials.add(Color::rgb_u8(250, 250, 250)),
|
||||
material: materials.add(Color::srgb_u8(250, 250, 250)),
|
||||
transform: Transform::from_xyz(0.0, 0.5, -4.0).with_scale(Vec3::splat(0.5)),
|
||||
..default()
|
||||
});
|
||||
// black cube
|
||||
commands.spawn(PbrBundle {
|
||||
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
|
||||
material: materials.add(Color::rgb_u8(0, 0, 0)),
|
||||
material: materials.add(Color::srgb_u8(0, 0, 0)),
|
||||
transform: Transform::from_xyz(0.0, 0.1, 0.0).with_scale(Vec3::splat(0.2)),
|
||||
..default()
|
||||
});
|
||||
|
||||
@@ -15,10 +15,10 @@ pub struct OxrPassthroughPlugin;
|
||||
impl Plugin for OxrPassthroughPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
let resources = app
|
||||
.world
|
||||
.world()
|
||||
.get_resource::<OxrInstance>()
|
||||
.and_then(|instance| {
|
||||
app.world
|
||||
app.world()
|
||||
.get_resource::<OxrSystemId>()
|
||||
.map(|system_id| (instance, system_id))
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy::render::extract_resource::ExtractResourcePlugin;
|
||||
use bevy::render::renderer::RenderAdapter;
|
||||
@@ -5,6 +7,7 @@ use bevy::render::renderer::RenderAdapterInfo;
|
||||
use bevy::render::renderer::RenderDevice;
|
||||
use bevy::render::renderer::RenderInstance;
|
||||
use bevy::render::renderer::RenderQueue;
|
||||
use bevy::render::renderer::WgpuWrapper;
|
||||
use bevy::render::settings::RenderCreation;
|
||||
use bevy::render::MainWorld;
|
||||
use bevy::render::RenderApp;
|
||||
@@ -90,10 +93,10 @@ impl Plugin for OxrInitPlugin {
|
||||
RenderPlugin {
|
||||
render_creation: RenderCreation::manual(
|
||||
device.into(),
|
||||
RenderQueue(queue.into()),
|
||||
RenderAdapterInfo(adapter_info),
|
||||
RenderAdapter(adapter.into()),
|
||||
RenderInstance(wgpu_instance.into()),
|
||||
RenderQueue(Arc::new(WgpuWrapper::new(queue))),
|
||||
RenderAdapterInfo(WgpuWrapper::new(adapter_info)),
|
||||
RenderAdapter(Arc::new(WgpuWrapper::new(adapter))),
|
||||
RenderInstance(Arc::new(WgpuWrapper::new(wgpu_instance))),
|
||||
),
|
||||
synchronous_pipeline_compilation: self.synchronous_pipeline_compilation,
|
||||
},
|
||||
@@ -121,10 +124,10 @@ impl Plugin for OxrInitPlugin {
|
||||
.insert_non_send_resource(session_create_info)
|
||||
.init_non_send_resource::<OxrSessionCreateNextChain>();
|
||||
|
||||
app.world
|
||||
app.world_mut()
|
||||
.spawn((TransformBundle::default(), XrTrackingRoot));
|
||||
|
||||
app.world
|
||||
app.world_mut()
|
||||
.resource_mut::<Events<XrStateChanged>>()
|
||||
.send(XrStateChanged(XrState::Available));
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ pub fn update_views_render_world(
|
||||
let openxr::Vector3f { x, y, z } = view.pose.position;
|
||||
let translation = Vec3::new(x, y, z);
|
||||
transform.translation = translation;
|
||||
extracted_view.transform = root.0.mul_transform(transform);
|
||||
extracted_view.world_from_view = root.0.mul_transform(transform);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user