working pipelined rendering

This commit is contained in:
awtterpip
2024-06-02 05:23:02 -05:00
parent e17262ab46
commit a0099bc4a7
4 changed files with 24 additions and 29 deletions

View File

@@ -6,6 +6,7 @@ use bevy_xr::{
};
use openxr::SpaceLocationFlags;
use crate::resources::Pipelined;
use crate::{
init::OxrTrackingRoot,
reference_space::{OxrPrimaryReferenceSpace, OxrReferenceSpace},
@@ -139,12 +140,22 @@ fn locate_hands(
&OxrHandBoneEntities,
)>,
mut bone_query: Query<(&HandBone, &mut HandBoneRadius, &mut Transform)>,
pipelined: Option<Res<Pipelined>>,
) {
for (tracker, ref_space, hand_entities) in &tracker_query {
let ref_space = ref_space.map(|v| &v.0).unwrap_or(&default_ref_space.0);
// relate_hand_joints also provides velocities
let joints = match ref_space.locate_hand_joints(tracker, frame_state.predicted_display_time)
{
let joints = match ref_space.locate_hand_joints(
tracker,
if pipelined.is_some() {
openxr::Time::from_nanos(
frame_state.predicted_display_time.as_nanos()
+ frame_state.predicted_display_period.as_nanos(),
)
} else {
frame_state.predicted_display_time
},
) {
Ok(Some(v)) => v,
Ok(None) => continue,
Err(openxr::sys::Result::ERROR_EXTENSION_NOT_PRESENT) => {