refactor: cleanup for bevy 0.16
Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
@@ -27,7 +27,7 @@ impl Plugin for OxrOverlayPlugin {
|
||||
|
||||
fn handle_overlay_event(event: OxrEventIn, mut writer: EventWriter<OxrOverlaySessionEvent>) {
|
||||
if let Event::MainSessionVisibilityChangedEXTX(event) = *event {
|
||||
writer.send(OxrOverlaySessionEvent::MainSessionVisibilityChanged {
|
||||
writer.write(OxrOverlaySessionEvent::MainSessionVisibilityChanged {
|
||||
visible: event.visible(),
|
||||
flags: event.flags(),
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::resources::*;
|
||||
use crate::spaces::OxrSpaceExt as _;
|
||||
|
||||
pub trait LayerProvider {
|
||||
fn get<'a>(&'a self, world: &'a World) -> Option<Box<dyn CompositionLayer + 'a>>;
|
||||
fn get<'a>(&'a self, world: &'a World) -> Option<Box<dyn CompositionLayer<'a> + 'a>>;
|
||||
}
|
||||
|
||||
pub struct ProjectionLayer;
|
||||
@@ -117,7 +117,7 @@ impl<'a> SwapchainSubImage<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Default for SwapchainSubImage<'a> {
|
||||
impl Default for SwapchainSubImage<'_> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
@@ -165,11 +165,15 @@ impl<'a> CompositionLayerProjectionView<'a> {
|
||||
self
|
||||
}
|
||||
}
|
||||
impl<'a> Default for CompositionLayerProjectionView<'a> {
|
||||
impl Default for CompositionLayerProjectionView<'_> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
/// # Safety
|
||||
/// the header function must return a ref to a valid Composition Layer struct.
|
||||
/// it has to use `repr(C)` and it has to follow the shape of a Composition Layer struct from the
|
||||
/// OpenXR specification
|
||||
pub unsafe trait CompositionLayer<'a> {
|
||||
fn swapchain(&self) -> Option<&'a OxrSwapchain>;
|
||||
fn header(&self) -> &sys::CompositionLayerBaseHeader;
|
||||
@@ -227,7 +231,7 @@ unsafe impl<'a> CompositionLayer<'a> for CompositionLayerProjection<'a> {
|
||||
unsafe { mem::transmute(&self.inner) }
|
||||
}
|
||||
}
|
||||
impl<'a> Default for CompositionLayerProjection<'a> {
|
||||
impl Default for CompositionLayerProjection<'_> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
|
||||
@@ -20,18 +20,10 @@ impl Default for OxrReferenceSpacePlugin {
|
||||
}
|
||||
}
|
||||
|
||||
/// Resource specifying what the type should be for [`OxrPrimaryReferenceSpace`]. Set through [`OxrReferenceSpacePlugin`].
|
||||
/// Resource specifying what the type should used be for the [`XrPrimaryReferenceSpace`]. Set through [`OxrReferenceSpacePlugin`].
|
||||
#[derive(Resource)]
|
||||
struct OxrDefaultPrimaryReferenceSpaceType(openxr::ReferenceSpaceType);
|
||||
|
||||
/// The Default Reference space used for locating things
|
||||
// #[derive(Resource, Deref, ExtrctResource, Clone)]
|
||||
// pub struct OxrPrimaryReferenceSpace(pub Arc<openxr::Space>);
|
||||
|
||||
/// The Reference space used for locating spaces on this entity
|
||||
#[derive(Component)]
|
||||
pub struct OxrReferenceSpace(pub openxr::Space);
|
||||
|
||||
impl Plugin for OxrReferenceSpacePlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins(ExtractResourcePlugin::<XrPrimaryReferenceSpace>::default())
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
use bevy::{
|
||||
prelude::*,
|
||||
render::{
|
||||
@@ -251,7 +250,6 @@ pub fn update_views(
|
||||
views: ResMut<OxrViews>,
|
||||
) {
|
||||
for (mut transform, mut projection, camera) in query.iter_mut() {
|
||||
println!("we have this query");
|
||||
let Some(view) = views.get(camera.0 as usize) else {
|
||||
continue;
|
||||
};
|
||||
@@ -271,11 +269,6 @@ pub fn update_views(
|
||||
);
|
||||
projection.projection_matrix = projection_matrix;
|
||||
|
||||
println!(
|
||||
"Updateing projectinon matrix to: {:#?}",
|
||||
projection.projection_matrix
|
||||
);
|
||||
|
||||
let openxr::Quaternionf { x, y, z, w } = view.pose.orientation;
|
||||
let rotation = Quat::from_xyzw(x, y, z, w);
|
||||
transform.rotation = rotation;
|
||||
|
||||
@@ -288,10 +288,6 @@ impl OxrSwapchain {
|
||||
#[derive(Debug, Deref, Resource, Clone, Copy, ExtractResource)]
|
||||
pub struct OxrSwapchainImages(pub &'static [wgpu::Texture]);
|
||||
|
||||
/// Thread safe wrapper around [openxr::Space] representing the stage.
|
||||
// #[derive(Deref, Clone, Resource)]
|
||||
// pub struct OxrStage(pub Arc<openxr::Space>);
|
||||
|
||||
/// Stores the latest generated [OxrViews]
|
||||
#[derive(Clone, Resource, ExtractResource, Deref, DerefMut, Default)]
|
||||
pub struct OxrViews(pub Vec<openxr::View>);
|
||||
|
||||
Reference in New Issue
Block a user