remove XrSpatialTransform in favor of making XrSpace a Component and adding XrSpatialOffset

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2024-06-23 00:07:28 +02:00
parent 6003cc7ac6
commit b7c4a05482
5 changed files with 47 additions and 34 deletions

View File

@@ -3,21 +3,19 @@ use bevy::{
render::{extract_component::ExtractComponent, extract_resource::ExtractResource},
};
use crate::types::XrPose;
/// Any Spaces will be invalid after the owning session exits
#[repr(transparent)]
#[derive(Clone, Copy, Hash, PartialEq, Eq, Reflect, Debug)]
#[derive(Clone, Copy, Hash, PartialEq, Eq, Reflect, Debug, Component, ExtractComponent)]
pub struct XrSpace(u64);
#[derive(Clone, Copy, PartialEq, Reflect, Debug, Component, ExtractComponent)]
pub struct XrSpatialTransform {
pub space: XrSpace,
pub offset: Transform,
}
impl XrSpatialTransform {
pub const fn from_space(space: XrSpace) -> Self {
Self { space, offset: Transform::IDENTITY }
}
}
// Does repr(transparent) even make sense here?
#[repr(transparent)]
#[derive(
Clone, Copy, PartialEq, Reflect, Debug, Component, ExtractComponent, Default, Deref, DerefMut,
)]
pub struct XrSpatialOffset(pub XrPose);
#[derive(Event, Clone, Copy, Deref, DerefMut)]
pub struct XrDestroySpace(pub XrSpace);