refactor: remove some unneeded stuff
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
pub mod eye_pointer;
|
||||
pub mod mouse_pointer;
|
||||
pub mod sk_controller;
|
||||
pub mod sk_hand;
|
||||
pub mod oxr_controller;
|
||||
pub mod oxr_hand;
|
||||
|
||||
use crate::nodes::{
|
||||
fields::{Field, FieldTrait, Ray},
|
||||
|
||||
@@ -229,8 +229,8 @@ fn setup(instance: Res<OxrInstance>, connection: Res<DbusConnection>, mut cmds:
|
||||
set,
|
||||
};
|
||||
let controllers = Controllers {
|
||||
left: SkController::new(&connection, HandSide::Left).unwrap(),
|
||||
right: SkController::new(&connection, HandSide::Right).unwrap(),
|
||||
left: OxrControllerInput::new(&connection, HandSide::Left).unwrap(),
|
||||
right: OxrControllerInput::new(&connection, HandSide::Right).unwrap(),
|
||||
};
|
||||
cmds.insert_resource(controllers);
|
||||
cmds.insert_resource(actions);
|
||||
@@ -256,11 +256,11 @@ struct Actions {
|
||||
}
|
||||
#[derive(Resource)]
|
||||
struct Controllers {
|
||||
left: SkController,
|
||||
right: SkController,
|
||||
left: OxrControllerInput,
|
||||
right: OxrControllerInput,
|
||||
}
|
||||
|
||||
pub struct SkController {
|
||||
pub struct OxrControllerInput {
|
||||
object_handle: ObjectHandle<SpatialRef>,
|
||||
input: Arc<InputMethod>,
|
||||
side: HandSide,
|
||||
@@ -271,7 +271,7 @@ pub struct SkController {
|
||||
tracked: ObjectHandle<Tracked>,
|
||||
space: Option<XrSpace>,
|
||||
}
|
||||
impl SkController {
|
||||
impl OxrControllerInput {
|
||||
fn new(connection: &Connection, side: HandSide) -> Result<Self> {
|
||||
let path = "/org/stardustxr/Controller/".to_string()
|
||||
+ match side {
|
||||
@@ -290,7 +290,7 @@ impl SkController {
|
||||
tip,
|
||||
Datamap::from_typed(ControllerDatamap::default())?,
|
||||
)?;
|
||||
Ok(SkController {
|
||||
Ok(OxrControllerInput {
|
||||
object_handle,
|
||||
input,
|
||||
side,
|
||||
@@ -62,7 +62,7 @@ fn update_hands(
|
||||
});
|
||||
return;
|
||||
};
|
||||
let get_joints = |hand: &mut SkHand| -> Option<openxr::HandJointLocations> {
|
||||
let get_joints = |hand: &mut OxrHandInput| -> Option<openxr::HandJointLocations> {
|
||||
let Some(tracker) = hand.tracker.as_ref() else {
|
||||
hand.input.spatial.node().unwrap().set_enabled(false);
|
||||
let handle = hand.tracked.clone();
|
||||
@@ -148,8 +148,8 @@ fn setup(
|
||||
}
|
||||
});
|
||||
cmds.insert_resource(Hands {
|
||||
left: SkHand::new(&connection, HandSide::Left, &mut materials).unwrap(),
|
||||
right: SkHand::new(&connection, HandSide::Right, &mut materials).unwrap(),
|
||||
left: OxrHandInput::new(&connection, HandSide::Left, &mut materials).unwrap(),
|
||||
right: OxrHandInput::new(&connection, HandSide::Right, &mut materials).unwrap(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -164,8 +164,8 @@ fn convert_joint(joint: HandJointLocation) -> Joint {
|
||||
|
||||
#[derive(Resource)]
|
||||
struct Hands {
|
||||
left: SkHand,
|
||||
right: SkHand,
|
||||
left: OxrHandInput,
|
||||
right: OxrHandInput,
|
||||
}
|
||||
|
||||
#[derive(Default, Deserialize, Serialize)]
|
||||
@@ -174,7 +174,7 @@ struct HandDatamap {
|
||||
grab_strength: f32,
|
||||
}
|
||||
|
||||
pub struct SkHand {
|
||||
pub struct OxrHandInput {
|
||||
_node: OwnedNode,
|
||||
palm_spatial: Arc<Spatial>,
|
||||
palm_object: ObjectHandle<SpatialRef>,
|
||||
@@ -187,7 +187,7 @@ pub struct SkHand {
|
||||
captured: bool,
|
||||
material: Handle<BevyMaterial>,
|
||||
}
|
||||
impl SkHand {
|
||||
impl OxrHandInput {
|
||||
pub fn new(
|
||||
connection: &Connection,
|
||||
side: HandSide,
|
||||
@@ -225,7 +225,7 @@ impl SkHand {
|
||||
perceptual_roughness: 1.0,
|
||||
..default()
|
||||
});
|
||||
Ok(SkHand {
|
||||
Ok(OxrHandInput {
|
||||
_node: node,
|
||||
palm_spatial,
|
||||
palm_object,
|
||||
@@ -10,8 +10,8 @@ use crate::{
|
||||
};
|
||||
use glam::{Mat4, vec3};
|
||||
use input::{
|
||||
eye_pointer::EyePointer, mouse_pointer::MousePointer, sk_controller::SkController,
|
||||
sk_hand::SkHand,
|
||||
eye_pointer::EyePointer, mouse_pointer::MousePointer, oxr_controller::OxrControllerInput,
|
||||
oxr_hand::OxrHandInput,
|
||||
};
|
||||
use parking_lot::RwLock;
|
||||
use play_space::PlaySpaceBounds;
|
||||
|
||||
Reference in New Issue
Block a user