finish renaming and move HandBoneEntities to bevy_mod_xr
Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_oxr"
|
name = "bevy_mod_xr_backends"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Community crate for OpenXR in Bevy"
|
description = "Community crate for OpenXR in Bevy"
|
||||||
@@ -7,9 +7,9 @@ repository = "https://github.com/awtterpip/bevy_oxr"
|
|||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy_openxr.path = "./crates/bevy_openxr"
|
bevy_mod_openxr.path = "./crates/bevy_openxr"
|
||||||
bevy_xr.path = "./crates/bevy_xr"
|
bevy_mod_xr.path = "./crates/bevy_xr"
|
||||||
bevy = "0.13.0"
|
bevy.workspace = true
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["crates/*", "crates/bevy_openxr/examples/android"]
|
members = ["crates/*", "crates/bevy_openxr/examples/android"]
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ openxr = "0.18.0"
|
|||||||
thiserror = "1.0.57"
|
thiserror = "1.0.57"
|
||||||
wgpu = "0.19.3"
|
wgpu = "0.19.3"
|
||||||
wgpu-hal = "0.19.3"
|
wgpu-hal = "0.19.3"
|
||||||
bevy_xr.path = "../bevy_xr"
|
bevy_mod_xr.path = "../bevy_xr"
|
||||||
|
|
||||||
ash = { version = "0.37.3", optional = true }
|
ash = { version = "0.37.3", optional = true }
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! A simple 3D scene with light shining over a cube sitting on a plane.
|
//! A simple 3D scene with light shining over a cube sitting on a plane.
|
||||||
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_openxr::add_xr_plugins;
|
use bevy_mod_openxr::add_xr_plugins;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// a simple example showing basic actions using the xr utils actions
|
// a simple example showing basic actions using the xr utils actions
|
||||||
use bevy::{math::vec3, prelude::*};
|
use bevy::{math::vec3, prelude::*};
|
||||||
use bevy_openxr::{add_xr_plugins, helper_traits::ToQuat, resources::OxrViews};
|
use bevy_mod_openxr::{add_xr_plugins, helper_traits::ToQuat, resources::OxrViews};
|
||||||
use bevy_xr::session::XrTrackingRoot;
|
use bevy_mod_xr::session::XrTrackingRoot;
|
||||||
use bevy_xr_utils::xr_utils_actions::{
|
use bevy_xr_utils::xr_utils_actions::{
|
||||||
ActiveSet, XRUtilsAction, XRUtilsActionSet, XRUtilsActionState, XRUtilsActionSystemSet,
|
ActiveSet, XRUtilsAction, XRUtilsActionSet, XRUtilsActionState, XRUtilsActionSystemSet,
|
||||||
XRUtilsActionsPlugin, XRUtilsBinding,
|
XRUtilsActionsPlugin, XRUtilsBinding,
|
||||||
@@ -75,7 +75,7 @@ fn create_action_entities(mut commands: Commands) {
|
|||||||
XRUtilsAction {
|
XRUtilsAction {
|
||||||
action_name: "flight_input".into(),
|
action_name: "flight_input".into(),
|
||||||
localized_name: "flight_input_localized".into(),
|
localized_name: "flight_input_localized".into(),
|
||||||
action_type: bevy_xr::actions::ActionType::Vector,
|
action_type: bevy_mod_xr::actions::ActionType::Vector,
|
||||||
},
|
},
|
||||||
FlightActionMarker, //lets try a marker component
|
FlightActionMarker, //lets try a marker component
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy_openxr.path = "../.."
|
bevy_mod_openxr.path = "../.."
|
||||||
bevy.workspace = true
|
bevy.workspace = true
|
||||||
bevy_xr_utils.path = "../../../bevy_xr_utils"
|
bevy_xr_utils.path = "../../../bevy_xr_utils"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! A simple 3D scene with light shining over a cube sitting on a plane.
|
//! A simple 3D scene with light shining over a cube sitting on a plane.
|
||||||
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_openxr::{add_xr_plugins, init::OxrInitPlugin, types::OxrExtensions};
|
use bevy_mod_openxr::{add_xr_plugins, init::OxrInitPlugin, types::OxrExtensions};
|
||||||
|
|
||||||
#[bevy_main]
|
#[bevy_main]
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
//! A simple 3D scene with light shining over a cube sitting on a plane.
|
//! A simple 3D scene with light shining over a cube sitting on a plane.
|
||||||
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_openxr::{add_xr_plugins, init::OxrInitPlugin, types::OxrExtensions};
|
use bevy_mod_openxr::{add_xr_plugins, init::OxrInitPlugin, types::OxrExtensions};
|
||||||
use bevy_xr::session::XrState;
|
use bevy_mod_xr::session::XrState;
|
||||||
// use openxr::EnvironmentBlendMode;
|
// use openxr::EnvironmentBlendMode;
|
||||||
// use wgpu::TextureFormat;
|
// use wgpu::TextureFormat;
|
||||||
|
|
||||||
@@ -40,11 +40,11 @@ fn main() {
|
|||||||
|
|
||||||
fn handle_input(
|
fn handle_input(
|
||||||
keys: Res<ButtonInput<KeyCode>>,
|
keys: Res<ButtonInput<KeyCode>>,
|
||||||
mut end: EventWriter<bevy_xr::session::XrEndSessionEvent>,
|
mut end: EventWriter<bevy_mod_xr::session::XrEndSessionEvent>,
|
||||||
mut destroy: EventWriter<bevy_xr::session::XrDestroySessionEvent>,
|
mut destroy: EventWriter<bevy_mod_xr::session::XrDestroySessionEvent>,
|
||||||
mut begin: EventWriter<bevy_xr::session::XrBeginSessionEvent>,
|
mut begin: EventWriter<bevy_mod_xr::session::XrBeginSessionEvent>,
|
||||||
mut create: EventWriter<bevy_xr::session::XrCreateSessionEvent>,
|
mut create: EventWriter<bevy_mod_xr::session::XrCreateSessionEvent>,
|
||||||
mut request_exit: EventWriter<bevy_xr::session::XrRequestExitEvent>,
|
mut request_exit: EventWriter<bevy_mod_xr::session::XrRequestExitEvent>,
|
||||||
state: Res<XrState>,
|
state: Res<XrState>,
|
||||||
) {
|
) {
|
||||||
if keys.just_pressed(KeyCode::KeyE) {
|
if keys.just_pressed(KeyCode::KeyE) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_openxr::{
|
use bevy_mod_openxr::{
|
||||||
action_binding::{OxrSendActionBindings, OxrSuggestActionBinding},
|
action_binding::{OxrSendActionBindings, OxrSuggestActionBinding},
|
||||||
action_set_attaching::OxrAttachActionSet,
|
action_set_attaching::OxrAttachActionSet,
|
||||||
action_set_syncing::{OxrActionSetSyncSet, OxrSyncActionSet},
|
action_set_syncing::{OxrActionSetSyncSet, OxrSyncActionSet},
|
||||||
@@ -11,7 +11,7 @@ use bevy_openxr::{
|
|||||||
session::OxrSession,
|
session::OxrSession,
|
||||||
spaces::OxrSpaceExt,
|
spaces::OxrSpaceExt,
|
||||||
};
|
};
|
||||||
use bevy_xr::{
|
use bevy_mod_xr::{
|
||||||
session::{session_available, XrCreateSession, XrTrackingRoot},
|
session::{session_available, XrCreateSession, XrTrackingRoot},
|
||||||
spaces::XrSpace,
|
spaces::XrSpace,
|
||||||
types::XrPose,
|
types::XrPose,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
//! A simple 3D scene with light shining over a cube sitting on a plane.
|
//! A simple 3D scene with light shining over a cube sitting on a plane.
|
||||||
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_openxr::add_xr_plugins;
|
use bevy_mod_openxr::add_xr_plugins;
|
||||||
use bevy_xr::session::{XrSessionPlugin, XrState};
|
use bevy_mod_xr::session::{XrSessionPlugin, XrState};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
@@ -16,11 +16,11 @@ fn main() {
|
|||||||
|
|
||||||
fn handle_input(
|
fn handle_input(
|
||||||
keys: Res<ButtonInput<KeyCode>>,
|
keys: Res<ButtonInput<KeyCode>>,
|
||||||
mut end: EventWriter<bevy_xr::session::XrEndSessionEvent>,
|
mut end: EventWriter<bevy_mod_xr::session::XrEndSessionEvent>,
|
||||||
mut destroy: EventWriter<bevy_xr::session::XrDestroySessionEvent>,
|
mut destroy: EventWriter<bevy_mod_xr::session::XrDestroySessionEvent>,
|
||||||
mut begin: EventWriter<bevy_xr::session::XrBeginSessionEvent>,
|
mut begin: EventWriter<bevy_mod_xr::session::XrBeginSessionEvent>,
|
||||||
mut create: EventWriter<bevy_xr::session::XrCreateSessionEvent>,
|
mut create: EventWriter<bevy_mod_xr::session::XrCreateSessionEvent>,
|
||||||
mut request_exit: EventWriter<bevy_xr::session::XrRequestExitEvent>,
|
mut request_exit: EventWriter<bevy_mod_xr::session::XrRequestExitEvent>,
|
||||||
state: Res<XrState>,
|
state: Res<XrState>,
|
||||||
) {
|
) {
|
||||||
if keys.just_pressed(KeyCode::KeyE) {
|
if keys.just_pressed(KeyCode::KeyE) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! A simple example of how to use the transform utils to set the players position and orientation
|
//! A simple example of how to use the transform utils to set the players position and orientation
|
||||||
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_openxr::add_xr_plugins;
|
use bevy_mod_openxr::add_xr_plugins;
|
||||||
use bevy_xr_utils::transform_utils::{self, SnapToPosition, SnapToRotation};
|
use bevy_xr_utils::transform_utils::{self, SnapToPosition, SnapToRotation};
|
||||||
use bevy_xr_utils::xr_utils_actions::{
|
use bevy_xr_utils::xr_utils_actions::{
|
||||||
ActiveSet, XRUtilsAction, XRUtilsActionSet, XRUtilsActionState, XRUtilsActionSystemSet,
|
ActiveSet, XRUtilsAction, XRUtilsActionSet, XRUtilsActionState, XRUtilsActionSystemSet,
|
||||||
@@ -110,7 +110,7 @@ fn create_action_entities(mut commands: Commands) {
|
|||||||
XRUtilsAction {
|
XRUtilsAction {
|
||||||
action_name: "face_red".into(),
|
action_name: "face_red".into(),
|
||||||
localized_name: "face_red_localized".into(),
|
localized_name: "face_red_localized".into(),
|
||||||
action_type: bevy_xr::actions::ActionType::Bool,
|
action_type: bevy_mod_xr::actions::ActionType::Bool,
|
||||||
},
|
},
|
||||||
FaceRedAction, //lets try a marker component
|
FaceRedAction, //lets try a marker component
|
||||||
))
|
))
|
||||||
@@ -134,7 +134,7 @@ fn create_action_entities(mut commands: Commands) {
|
|||||||
XRUtilsAction {
|
XRUtilsAction {
|
||||||
action_name: "center".into(),
|
action_name: "center".into(),
|
||||||
localized_name: "center_localized".into(),
|
localized_name: "center_localized".into(),
|
||||||
action_type: bevy_xr::actions::ActionType::Bool,
|
action_type: bevy_mod_xr::actions::ActionType::Bool,
|
||||||
},
|
},
|
||||||
Center, //lets try a marker component
|
Center, //lets try a marker component
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use bevy::ecs::schedule::ScheduleLabel;
|
|||||||
use bevy::ecs::system::RunSystemOnce;
|
use bevy::ecs::system::RunSystemOnce;
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy::utils::HashMap;
|
use bevy::utils::HashMap;
|
||||||
use bevy_xr::session::XrSessionCreatedEvent;
|
use bevy_mod_xr::session::XrSessionCreatedEvent;
|
||||||
use openxr::sys::ActionSuggestedBinding;
|
use openxr::sys::ActionSuggestedBinding;
|
||||||
|
|
||||||
use crate::resources::OxrInstance;
|
use crate::resources::OxrInstance;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::{action_binding::run_action_binding_sugestion, session::OxrSession};
|
use crate::{action_binding::run_action_binding_sugestion, session::OxrSession};
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_xr::session::XrSessionCreatedEvent;
|
use bevy_mod_xr::session::XrSessionCreatedEvent;
|
||||||
|
|
||||||
impl Plugin for OxrActionAttachingPlugin {
|
impl Plugin for OxrActionAttachingPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::session::OxrSession;
|
use crate::session::OxrSession;
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_xr::session::session_running;
|
use bevy_mod_xr::session::session_running;
|
||||||
|
|
||||||
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone, Copy)]
|
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone, Copy)]
|
||||||
pub struct OxrActionSetSyncSet;
|
pub struct OxrActionSetSyncSet;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_xr::hands::{LeftHand, RightHand};
|
use bevy_mod_xr::hands::{LeftHand, RightHand, XrHandBoneEntities, HAND_JOINT_COUNT};
|
||||||
use bevy_xr::session::{XrCreateSession, XrDestroySession, XrTrackingRoot};
|
use bevy_mod_xr::session::{XrCreateSession, XrDestroySession, XrTrackingRoot};
|
||||||
use bevy_xr::spaces::{XrPrimaryReferenceSpace, XrReferenceSpace};
|
use bevy_mod_xr::spaces::{XrPrimaryReferenceSpace, XrReferenceSpace};
|
||||||
use bevy_xr::{
|
use bevy_mod_xr::{
|
||||||
hands::{HandBone, HandBoneRadius},
|
hands::{HandBone, HandBoneRadius},
|
||||||
session::session_running,
|
session::session_running,
|
||||||
};
|
};
|
||||||
@@ -39,6 +39,22 @@ impl Plugin for HandTrackingPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn spawn_hand_bones<T: Bundle + Clone>(
|
||||||
|
cmds: &mut Commands,
|
||||||
|
bundle: T,
|
||||||
|
) -> [Entity; HAND_JOINT_COUNT] {
|
||||||
|
let mut bones: [Entity; HAND_JOINT_COUNT] = [Entity::PLACEHOLDER; HAND_JOINT_COUNT];
|
||||||
|
// screw you clippy, i don't see a better way to init this array
|
||||||
|
#[allow(clippy::needless_range_loop)]
|
||||||
|
for bone in HandBone::get_all_bones().into_iter() {
|
||||||
|
bones[bone as usize] = cmds
|
||||||
|
.spawn((SpatialBundle::default(), bone, HandBoneRadius(0.0)))
|
||||||
|
.insert(bundle.clone())
|
||||||
|
.id();
|
||||||
|
}
|
||||||
|
bones
|
||||||
|
}
|
||||||
|
|
||||||
fn spawn_default_hands(
|
fn spawn_default_hands(
|
||||||
mut cmds: Commands,
|
mut cmds: Commands,
|
||||||
session: Res<OxrSession>,
|
session: Res<OxrSession>,
|
||||||
@@ -71,49 +87,27 @@ fn spawn_default_hands(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let mut left_bones = [Entity::PLACEHOLDER; 26];
|
let left_bones = spawn_hand_bones(&mut cmds, (DefaultHandBone, LeftHand));
|
||||||
let mut right_bones = [Entity::PLACEHOLDER; 26];
|
let right_bones = spawn_hand_bones(&mut cmds, (DefaultHandBone, RightHand));
|
||||||
for bone in HandBone::get_all_bones() {
|
cmds.entity(root).push_children(&left_bones);
|
||||||
let bone_left = cmds
|
cmds.entity(root).push_children(&right_bones);
|
||||||
.spawn((
|
|
||||||
DefaultHandBone,
|
|
||||||
SpatialBundle::default(),
|
|
||||||
bone,
|
|
||||||
HandBoneRadius(0.0),
|
|
||||||
LeftHand,
|
|
||||||
))
|
|
||||||
.id();
|
|
||||||
let bone_right = cmds
|
|
||||||
.spawn((
|
|
||||||
DefaultHandBone,
|
|
||||||
SpatialBundle::default(),
|
|
||||||
bone,
|
|
||||||
HandBoneRadius(0.0),
|
|
||||||
RightHand,
|
|
||||||
))
|
|
||||||
.id();
|
|
||||||
cmds.entity(root).push_children(&[bone_left]);
|
|
||||||
cmds.entity(root).push_children(&[bone_right]);
|
|
||||||
left_bones[bone as usize] = bone_left;
|
|
||||||
right_bones[bone as usize] = bone_right;
|
|
||||||
}
|
|
||||||
cmds.spawn((
|
cmds.spawn((
|
||||||
DefaultHandTracker,
|
DefaultHandTracker,
|
||||||
OxrHandTracker(tracker_left),
|
OxrHandTracker(tracker_left),
|
||||||
OxrHandBoneEntities(left_bones),
|
XrHandBoneEntities(left_bones),
|
||||||
LeftHand,
|
LeftHand,
|
||||||
));
|
));
|
||||||
cmds.spawn((
|
cmds.spawn((
|
||||||
DefaultHandTracker,
|
DefaultHandTracker,
|
||||||
OxrHandTracker(tracker_right),
|
OxrHandTracker(tracker_right),
|
||||||
OxrHandBoneEntities(right_bones),
|
XrHandBoneEntities(right_bones),
|
||||||
RightHand,
|
RightHand,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component, Clone, Copy)]
|
||||||
struct DefaultHandTracker;
|
struct DefaultHandTracker;
|
||||||
#[derive(Component)]
|
#[derive(Component, Clone, Copy)]
|
||||||
struct DefaultHandBone;
|
struct DefaultHandBone;
|
||||||
|
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
@@ -127,9 +121,6 @@ fn clean_up_default_hands(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deref, DerefMut, Component, Clone, Copy)]
|
|
||||||
pub struct OxrHandBoneEntities(pub [Entity; 26]);
|
|
||||||
|
|
||||||
#[derive(Deref, DerefMut, Component)]
|
#[derive(Deref, DerefMut, Component)]
|
||||||
pub struct OxrHandTracker(pub openxr::HandTracker);
|
pub struct OxrHandTracker(pub openxr::HandTracker);
|
||||||
|
|
||||||
@@ -139,7 +130,7 @@ fn locate_hands(
|
|||||||
tracker_query: Query<(
|
tracker_query: Query<(
|
||||||
&OxrHandTracker,
|
&OxrHandTracker,
|
||||||
Option<&XrReferenceSpace>,
|
Option<&XrReferenceSpace>,
|
||||||
&OxrHandBoneEntities,
|
&XrHandBoneEntities,
|
||||||
)>,
|
)>,
|
||||||
session: Res<OxrSession>,
|
session: Res<OxrSession>,
|
||||||
mut bone_query: Query<(&HandBone, &mut HandBoneRadius, &mut Transform)>,
|
mut bone_query: Query<(&HandBone, &mut HandBoneRadius, &mut Transform)>,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::{mem, ptr};
|
use std::{mem, ptr};
|
||||||
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_xr::session::session_available;
|
use bevy_mod_xr::session::session_available;
|
||||||
use openxr::sys;
|
use openxr::sys;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_xr::types::XrPose;
|
use bevy_mod_xr::types::XrPose;
|
||||||
|
|
||||||
pub trait ToPosef {
|
pub trait ToPosef {
|
||||||
fn to_posef(&self) -> openxr::Posef;
|
fn to_posef(&self) -> openxr::Posef;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use bevy::render::RenderApp;
|
|||||||
use bevy::render::RenderPlugin;
|
use bevy::render::RenderPlugin;
|
||||||
use bevy::winit::UpdateMode;
|
use bevy::winit::UpdateMode;
|
||||||
use bevy::winit::WinitSettings;
|
use bevy::winit::WinitSettings;
|
||||||
use bevy_xr::session::*;
|
use bevy_mod_xr::session::*;
|
||||||
|
|
||||||
use crate::error::OxrError;
|
use crate::error::OxrError;
|
||||||
use crate::features::overlay::OxrOverlaySessionEvent;
|
use crate::features::overlay::OxrOverlaySessionEvent;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
use bevy::ecs::world::World;
|
use bevy::ecs::world::World;
|
||||||
use bevy_xr::spaces::{XrPrimaryReferenceSpace, XrSpace};
|
use bevy_mod_xr::spaces::{XrPrimaryReferenceSpace, XrSpace};
|
||||||
use openxr::{sys, CompositionLayerFlags, Fovf, Posef, Rect2Di};
|
use openxr::{sys, CompositionLayerFlags, Fovf, Posef, Rect2Di};
|
||||||
|
|
||||||
use crate::graphics::graphics_match;
|
use crate::graphics::graphics_match;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ use bevy::{
|
|||||||
utils::default,
|
utils::default,
|
||||||
window::{PresentMode, Window, WindowPlugin},
|
window::{PresentMode, Window, WindowPlugin},
|
||||||
};
|
};
|
||||||
use bevy_xr::camera::XrCameraPlugin;
|
use bevy_mod_xr::camera::XrCameraPlugin;
|
||||||
use bevy_xr::session::XrSessionPlugin;
|
use bevy_mod_xr::session::XrSessionPlugin;
|
||||||
use init::OxrInitPlugin;
|
use init::OxrInitPlugin;
|
||||||
use render::OxrRenderPlugin;
|
use render::OxrRenderPlugin;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use bevy::{
|
|||||||
prelude::*,
|
prelude::*,
|
||||||
render::{extract_resource::ExtractResourcePlugin, RenderApp},
|
render::{extract_resource::ExtractResourcePlugin, RenderApp},
|
||||||
};
|
};
|
||||||
use bevy_xr::{
|
use bevy_mod_xr::{
|
||||||
session::{XrCreateSession, XrDestroySession},
|
session::{XrCreateSession, XrDestroySession},
|
||||||
spaces::{XrPrimaryReferenceSpace, XrReferenceSpace},
|
spaces::{XrPrimaryReferenceSpace, XrReferenceSpace},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use bevy::{
|
|||||||
},
|
},
|
||||||
transform::TransformSystem,
|
transform::TransformSystem,
|
||||||
};
|
};
|
||||||
use bevy_xr::{
|
use bevy_mod_xr::{
|
||||||
camera::{XrCamera, XrCameraBundle, XrProjection},
|
camera::{XrCamera, XrCameraBundle, XrProjection},
|
||||||
session::{
|
session::{
|
||||||
XrDestroySession, XrFirst, XrHandleEvents, XrRenderSet, XrRootTransform, XrTrackingRoot,
|
XrDestroySession, XrFirst, XrHandleEvents, XrRenderSet, XrRootTransform, XrTrackingRoot,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::{mem::MaybeUninit, ptr, sync::Mutex};
|
use std::{mem::MaybeUninit, ptr, sync::Mutex};
|
||||||
|
|
||||||
use bevy::{prelude::*, utils::hashbrown::HashSet};
|
use bevy::{prelude::*, utils::hashbrown::HashSet};
|
||||||
use bevy_xr::{
|
use bevy_mod_xr::{
|
||||||
session::{session_available, session_running, XrFirst, XrHandleEvents},
|
session::{session_available, session_running, XrFirst, XrHandleEvents},
|
||||||
spaces::{XrDestroySpace, XrPrimaryReferenceSpace, XrReferenceSpace, XrSpace, XrSpatialOffset},
|
spaces::{XrDestroySpace, XrPrimaryReferenceSpace, XrReferenceSpace, XrSpace, XrSpatialOffset},
|
||||||
types::XrPose,
|
types::XrPose,
|
||||||
|
|||||||
@@ -13,4 +13,4 @@ thiserror = "1.0.57"
|
|||||||
wgpu = "0.19.3"
|
wgpu = "0.19.3"
|
||||||
wgpu-hal = "0.19.3"
|
wgpu-hal = "0.19.3"
|
||||||
|
|
||||||
bevy_xr.path = "../bevy_xr"
|
bevy_mod_xr.path = "../bevy_xr"
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
use bevy::{
|
use bevy::{
|
||||||
ecs::component::Component,
|
ecs::{component::Component, entity::Entity},
|
||||||
math::bool,
|
math::bool,
|
||||||
prelude::{Deref, DerefMut},
|
prelude::{Deref, DerefMut},
|
||||||
};
|
};
|
||||||
|
pub const HAND_JOINT_COUNT: usize = 26;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Component, Debug)]
|
#[derive(Clone, Copy, Component, Debug)]
|
||||||
pub struct LeftHand;
|
pub struct LeftHand;
|
||||||
@@ -10,6 +11,9 @@ pub struct LeftHand;
|
|||||||
#[derive(Clone, Copy, Component, Debug)]
|
#[derive(Clone, Copy, Component, Debug)]
|
||||||
pub struct RightHand;
|
pub struct RightHand;
|
||||||
|
|
||||||
|
#[derive(Deref, DerefMut, Component, Clone, Copy)]
|
||||||
|
pub struct XrHandBoneEntities(pub [Entity; HAND_JOINT_COUNT]);
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[derive(Clone, Copy, Component, Debug, DerefMut, Deref)]
|
#[derive(Clone, Copy, Component, Debug, DerefMut, Deref)]
|
||||||
pub struct HandBoneRadius(pub f32);
|
pub struct HandBoneRadius(pub f32);
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy.workspace = true
|
bevy.workspace = true
|
||||||
bevy_xr.path = "../bevy_xr"
|
bevy_mod_xr.path = "../bevy_xr"
|
||||||
openxr = "0.18.0"
|
openxr = "0.18.0"
|
||||||
bevy_openxr.path = "../bevy_openxr"
|
bevy_mod_openxr.path = "../bevy_openxr"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use bevy::{prelude::*, transform::TransformSystem};
|
use bevy::{prelude::*, transform::TransformSystem};
|
||||||
use bevy_xr::hands::{HandBone, HandBoneRadius};
|
use bevy_mod_xr::hands::{HandBone, HandBoneRadius};
|
||||||
pub struct HandGizmosPlugin;
|
pub struct HandGizmosPlugin;
|
||||||
impl Plugin for HandGizmosPlugin {
|
impl Plugin for HandGizmosPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_openxr::{
|
use bevy_mod_openxr::{
|
||||||
helper_traits::{ToQuat, ToVec3},
|
helper_traits::{ToQuat, ToVec3},
|
||||||
resources::OxrViews,
|
resources::OxrViews,
|
||||||
};
|
};
|
||||||
use bevy_xr::session::XrTrackingRoot;
|
use bevy_mod_xr::session::XrTrackingRoot;
|
||||||
|
|
||||||
pub struct TransformUtilitiesPlugin;
|
pub struct TransformUtilitiesPlugin;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
//! XRUtilsAction {
|
//! XRUtilsAction {
|
||||||
//! action_name: "flight_input".into(),
|
//! action_name: "flight_input".into(),
|
||||||
//! localized_name: "flight_input_localized".into(),
|
//! localized_name: "flight_input_localized".into(),
|
||||||
//! action_type: bevy_xr::actions::ActionType::Vector,
|
//! action_type: bevy_mod_xr::actions::ActionType::Vector,
|
||||||
//! },
|
//! },
|
||||||
//! FlightActionMarker, //lets try a marker component
|
//! FlightActionMarker, //lets try a marker component
|
||||||
//! ))
|
//! ))
|
||||||
@@ -54,12 +54,12 @@
|
|||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_openxr::{
|
use bevy_mod_openxr::{
|
||||||
action_binding::OxrSuggestActionBinding, action_set_attaching::OxrAttachActionSet,
|
action_binding::OxrSuggestActionBinding, action_set_attaching::OxrAttachActionSet,
|
||||||
action_set_syncing::OxrActionSetSyncSet, action_set_syncing::OxrSyncActionSet,
|
action_set_syncing::OxrActionSetSyncSet, action_set_syncing::OxrSyncActionSet,
|
||||||
resources::OxrInstance, session::OxrSession,
|
resources::OxrInstance, session::OxrSession,
|
||||||
};
|
};
|
||||||
use bevy_xr::session::{session_available, session_running};
|
use bevy_mod_xr::session::{session_available, session_running};
|
||||||
use openxr::{Path, Vector2f};
|
use openxr::{Path, Vector2f};
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
@@ -131,7 +131,7 @@ fn create_openxr_events(
|
|||||||
let (create_action, bindings) = actions_query.get(child).unwrap();
|
let (create_action, bindings) = actions_query.get(child).unwrap();
|
||||||
//lets create dat action
|
//lets create dat action
|
||||||
match create_action.action_type {
|
match create_action.action_type {
|
||||||
bevy_xr::actions::ActionType::Bool => {
|
bevy_mod_xr::actions::ActionType::Bool => {
|
||||||
let action: openxr::Action<bool> = action_set
|
let action: openxr::Action<bool> = action_set
|
||||||
.create_action::<bool>(
|
.create_action::<bool>(
|
||||||
&create_action.action_name,
|
&create_action.action_name,
|
||||||
@@ -169,7 +169,7 @@ fn create_openxr_events(
|
|||||||
binding_writer.send(sugestion);
|
binding_writer.send(sugestion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bevy_xr::actions::ActionType::Float => {
|
bevy_mod_xr::actions::ActionType::Float => {
|
||||||
let action: openxr::Action<f32> = action_set
|
let action: openxr::Action<f32> = action_set
|
||||||
.create_action::<f32>(
|
.create_action::<f32>(
|
||||||
&create_action.action_name,
|
&create_action.action_name,
|
||||||
@@ -208,7 +208,7 @@ fn create_openxr_events(
|
|||||||
binding_writer.send(sugestion);
|
binding_writer.send(sugestion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bevy_xr::actions::ActionType::Vector => {
|
bevy_mod_xr::actions::ActionType::Vector => {
|
||||||
let action: openxr::Action<Vector2f> = action_set
|
let action: openxr::Action<Vector2f> = action_set
|
||||||
.create_action::<Vector2f>(
|
.create_action::<Vector2f>(
|
||||||
&create_action.action_name,
|
&create_action.action_name,
|
||||||
@@ -368,7 +368,7 @@ pub struct ActiveSet;
|
|||||||
pub struct XRUtilsAction {
|
pub struct XRUtilsAction {
|
||||||
pub action_name: Cow<'static, str>,
|
pub action_name: Cow<'static, str>,
|
||||||
pub localized_name: Cow<'static, str>,
|
pub localized_name: Cow<'static, str>,
|
||||||
pub action_type: bevy_xr::actions::ActionType,
|
pub action_type: bevy_mod_xr::actions::ActionType,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
pub use bevy_openxr;
|
pub use bevy_mod_openxr;
|
||||||
pub use bevy_xr;
|
pub use bevy_mod_xr;
|
||||||
|
|||||||
Reference in New Issue
Block a user