feat: update to bevy 0.17 and use individual bevy crates
Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
use core::panic;
|
||||
|
||||
use bevy::app::{App, Plugin};
|
||||
use bevy::core_pipeline::core_3d::Camera3d;
|
||||
use bevy::ecs::component::Component;
|
||||
use bevy::math::{Mat4, Vec3A, Vec4};
|
||||
use bevy::prelude::SystemSet;
|
||||
use bevy::reflect::std_traits::ReflectDefault;
|
||||
use bevy::reflect::Reflect;
|
||||
use bevy::render::camera::CameraProjection;
|
||||
use bevy::render::extract_component::{ExtractComponent, ExtractComponentPlugin};
|
||||
use bevy_app::{App, Plugin};
|
||||
use bevy_camera::{Camera3d, CameraProjection};
|
||||
use bevy_ecs::{component::Component, schedule::SystemSet};
|
||||
use bevy_math::{Mat4, Vec3A, Vec4};
|
||||
// use bevy::prelude::SystemSet;
|
||||
#[cfg(feature = "reflect")]
|
||||
use bevy_reflect::std_traits::ReflectDefault;
|
||||
#[cfg(feature = "reflect")]
|
||||
use bevy_reflect::Reflect;
|
||||
use bevy_render::extract_component::{ExtractComponent, ExtractComponentPlugin};
|
||||
|
||||
use crate::session::XrTracker;
|
||||
|
||||
@@ -23,8 +24,9 @@ impl Plugin for XrCameraPlugin {
|
||||
#[derive(Clone, Copy, Default, PartialEq, Eq, Debug, Hash, SystemSet)]
|
||||
pub struct XrViewInit;
|
||||
|
||||
#[derive(Debug, Clone, Reflect)]
|
||||
#[reflect(Default)]
|
||||
#[derive(Debug, Clone)]
|
||||
#[cfg_attr(feature = "reflect", derive(Reflect))]
|
||||
#[cfg_attr(feature = "reflect", reflect(Default))]
|
||||
pub struct XrProjection {
|
||||
pub projection_matrix: Mat4,
|
||||
pub near: f32,
|
||||
@@ -83,7 +85,7 @@ impl CameraProjection for XrProjection {
|
||||
self.projection_matrix
|
||||
}
|
||||
|
||||
fn get_clip_from_view_for_sub(&self, _sub_view: &bevy::render::camera::SubCameraView) -> Mat4 {
|
||||
fn get_clip_from_view_for_sub(&self, _sub_view: &bevy_camera::SubCameraView) -> Mat4 {
|
||||
panic!("sub view not supported for xr camera");
|
||||
}
|
||||
}
|
||||
@@ -194,11 +196,8 @@ pub fn calculate_projection(near_z: f32, fov: Fov) -> Mat4 {
|
||||
mod tests {
|
||||
use std::f32::{self, consts::PI};
|
||||
|
||||
use bevy::{
|
||||
math::{Mat4, Vec3A},
|
||||
render::camera::{CameraProjection, PerspectiveProjection},
|
||||
utils::default,
|
||||
};
|
||||
use bevy_math::{Mat4,Vec3A};
|
||||
use bevy_camera::{CameraProjection, PerspectiveProjection};
|
||||
|
||||
const TEST_VALUES: &[(f32, f32)] = &[(0.5, 100.0), (50.0, 200.0)];
|
||||
|
||||
@@ -230,7 +229,7 @@ mod tests {
|
||||
fn test_get_frustum_corners_symmetrical() {
|
||||
let control_proj = PerspectiveProjection {
|
||||
near: 0.1,
|
||||
..default()
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let projection = XrProjection {
|
||||
@@ -252,7 +251,7 @@ mod tests {
|
||||
fn test_get_frustum_corners_symmetrical_far_plane() {
|
||||
let control_proj = PerspectiveProjection {
|
||||
near: 0.1,
|
||||
..default()
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let projection = XrProjection {
|
||||
|
||||
Reference in New Issue
Block a user