pre bevy 0.13
This commit is contained in:
19
src/lib.rs
19
src/lib.rs
@@ -120,7 +120,6 @@ impl Plugin for OpenXrPlugin {
|
|||||||
xr_wait_frame.run_if(xr_only()),
|
xr_wait_frame.run_if(xr_only()),
|
||||||
// xr_begin_frame.run_if(xr_only()),
|
// xr_begin_frame.run_if(xr_only()),
|
||||||
locate_views.run_if(xr_only()),
|
locate_views.run_if(xr_only()),
|
||||||
|
|
||||||
apply_deferred,
|
apply_deferred,
|
||||||
)
|
)
|
||||||
.chain()
|
.chain()
|
||||||
@@ -306,23 +305,27 @@ fn xr_begin_frame(swapchain: Res<XrSwapchain>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn xr_wait_frame(
|
pub fn xr_wait_frame(
|
||||||
mut frame_state: ResMut<XrFrameState>,
|
world: &mut World,
|
||||||
mut frame_waiter: ResMut<XrFrameWaiter>,
|
// mut frame_state: ResMut<XrFrameState>,
|
||||||
mut should_render: ResMut<XrShouldRender>,
|
// mut frame_waiter: ResMut<XrFrameWaiter>,
|
||||||
mut waited: ResMut<XrHasWaited>,
|
// mut should_render: ResMut<XrShouldRender>,
|
||||||
|
// mut waited: ResMut<XrHasWaited>,
|
||||||
) {
|
) {
|
||||||
|
let mut frame_waiter = world.get_resource_mut::<XrFrameWaiter>().unwrap();
|
||||||
{
|
{
|
||||||
let _span = info_span!("xr_wait_frame").entered();
|
let _span = info_span!("xr_wait_frame").entered();
|
||||||
*frame_state = match frame_waiter.wait() {
|
|
||||||
|
*world.get_resource_mut::<XrFrameState>().unwrap() = match frame_waiter.wait() {
|
||||||
Ok(a) => a.into(),
|
Ok(a) => a.into(),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!("error: {}", e);
|
warn!("error: {}", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let should_render = world.get_resource::<XrFrameState>().unwrap().should_render;
|
||||||
// frame_state.predicted_display_time = xr::Time::from_nanos(frame_state.predicted_display_time.as_nanos() + frame_state.predicted_display_period.as_nanos());
|
// frame_state.predicted_display_time = xr::Time::from_nanos(frame_state.predicted_display_time.as_nanos() + frame_state.predicted_display_period.as_nanos());
|
||||||
**should_render = frame_state.should_render;
|
**world.get_resource_mut::<XrShouldRender>().unwrap() = should_render;
|
||||||
**waited = true;
|
**world.get_resource_mut::<XrHasWaited>().unwrap() = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ fn check_for_handtracking(
|
|||||||
.supports_hand_tracking(instance.system(FormFactor::HEAD_MOUNTED_DISPLAY).unwrap())
|
.supports_hand_tracking(instance.system(FormFactor::HEAD_MOUNTED_DISPLAY).unwrap())
|
||||||
.is_ok_and(|v| v);
|
.is_ok_and(|v| v);
|
||||||
if hands {
|
if hands {
|
||||||
|
info!("handtracking!");
|
||||||
commands.insert_resource(HandTrackingData::new(&session).unwrap());
|
commands.insert_resource(HandTrackingData::new(&session).unwrap());
|
||||||
} else {
|
} else {
|
||||||
commands.insert_resource(DisableHandTracking::Both);
|
commands.insert_resource(DisableHandTracking::Both);
|
||||||
|
|||||||
Reference in New Issue
Block a user