Skip to content

Commit

Permalink
Applying cargo fmt
Browse files Browse the repository at this point in the history
Applying cargo fmt
  • Loading branch information
korejan committed Feb 23, 2022
1 parent 70e691d commit c10df5d
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 210 deletions.
22 changes: 16 additions & 6 deletions alvr/openxr-client/alxr-common/src/connection.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
use crate::{
connection_utils::{self, ConnectionError},
HapticsFeedback,
INPUT_SENDER
HapticsFeedback, INPUT_SENDER,
};
use alvr_common::{prelude::*, Haptics, TrackedDeviceType, ALVR_NAME, ALVR_VERSION};
use alvr_session::{SessionDesc, TrackingSpace};
use alvr_sockets::{
spawn_cancelable, ClientConfigPacket, ClientControlPacket, ClientHandshakePacket,
HeadsetInfoPacket, PeerType, PrivateIdentity, ProtoControlSocket, ServerControlPacket,
PlayspaceSyncPacket, ServerHandshakePacket, StreamSocketBuilder, HAPTICS, INPUT, //VIDEO,
spawn_cancelable,
ClientConfigPacket,
ClientControlPacket,
ClientHandshakePacket,
HeadsetInfoPacket,
PeerType,
PlayspaceSyncPacket,
PrivateIdentity,
ProtoControlSocket,
ServerControlPacket,
ServerHandshakePacket,
StreamSocketBuilder,
HAPTICS,
INPUT, //VIDEO,
};
use futures::future::BoxFuture;
use glam::{Quat, Vec2, Vec3};
Expand Down Expand Up @@ -474,7 +484,7 @@ async fn connection_pipeline(
area_height: guardian_data.areaHeight,
perimeter_points,
};

control_sender
.lock()
.await
Expand Down
15 changes: 7 additions & 8 deletions alvr/openxr-client/alxr-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod connection;
mod connection_utils;

use alvr_common::{prelude::*, Fov, MotionData, ALVR_VERSION};
use alvr_sockets::{HeadsetInfoPacket,Input,ViewConfig,HandPoseInput,LegacyInput};
use alvr_sockets::{HandPoseInput, HeadsetInfoPacket, Input, LegacyInput, ViewConfig};
pub use alxr_engine_sys::*;
use lazy_static::lazy_static;
use local_ipaddress;
Expand All @@ -11,8 +11,8 @@ use std::ffi::CStr;
use std::{slice, sync::atomic::AtomicBool};
use tokio::{runtime::Runtime, sync::mpsc, sync::Notify};
//#[cfg(not(target_os = "android"))]
use structopt::StructOpt;
use glam::{Quat, Vec2, Vec3};
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
#[structopt(name = "openxr_client", about = "An OpenXR based ALVR client.")]
Expand Down Expand Up @@ -185,14 +185,13 @@ pub fn shutdown() {
drop(RUNTIME.lock().take());
}

const OCULUS_HANDS_FLAG : ::std::os::raw::c_uint = 1 << 5;
const OCULUS_HANDS_FLAG: ::std::os::raw::c_uint = 1 << 5;

pub extern "C" fn input_send(data_ptr: *const TrackingInfo) {

#[inline(always)]
fn from_tracking_quat(quat: &TrackingQuat) -> Quat {
Quat::from_xyzw(quat.x, quat.y, quat.z, quat.w)
}
}
#[inline(always)]
fn from_tracking_quat_val(quat: TrackingQuat) -> Quat {
from_tracking_quat(&quat)
Expand All @@ -205,9 +204,9 @@ pub extern "C" fn input_send(data_ptr: *const TrackingInfo) {
fn from_tracking_vector3_val(vec: TrackingVector3) -> Vec3 {
from_tracking_vector3(&vec)
}

unsafe {
let data : &TrackingInfo = &*data_ptr;
let data: &TrackingInfo = &*data_ptr;

if let Some(sender) = &*INPUT_SENDER.lock() {
let head_orientation = from_tracking_quat(&data.HeadPose_Pose_Orientation);
Expand Down Expand Up @@ -246,7 +245,7 @@ pub extern "C" fn input_send(data_ptr: *const TrackingInfo) {
if data.controller[0].flags & OCULUS_HANDS_FLAG > 0 {
&data.controller[0].boneRootOrientation
} else {
&data.controller[0].orientation
&data.controller[0].orientation
},
),
position: from_tracking_vector3(
Expand Down
Loading

0 comments on commit c10df5d

Please sign in to comment.