feat: Update to Bevy 0.18 (#202)
This commit is contained in:
2172
Cargo.lock
generated
2172
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
38
Cargo.toml
38
Cargo.toml
@@ -10,23 +10,23 @@ resolver = "2"
|
|||||||
members = ["crates/*", "crates/bevy_openxr/examples/android"]
|
members = ["crates/*", "crates/bevy_openxr/examples/android"]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
bevy = "0.17"
|
bevy = "0.18"
|
||||||
bevy_ecs = { version = "0.17.0", default-features = false }
|
bevy_ecs = { version = "0.18", default-features = false }
|
||||||
bevy_math = { version = "0.17.0", default-features = false }
|
bevy_math = { version = "0.18", default-features = false }
|
||||||
bevy_render = { version = "0.17.0", default-features = false }
|
bevy_render = { version = "0.18", default-features = false }
|
||||||
bevy_core_pipeline = { version = "0.17.0", default-features = false }
|
bevy_core_pipeline = { version = "0.18", default-features = false }
|
||||||
bevy_window = { version = "0.17.0", default-features = false }
|
bevy_window = { version = "0.18", default-features = false }
|
||||||
bevy_winit = { version = "0.17.0", default-features = false }
|
bevy_winit = { version = "0.18", default-features = false }
|
||||||
bevy_pbr = { version = "0.17.0", default-features = false }
|
bevy_pbr = { version = "0.18", default-features = false }
|
||||||
bevy_app = { version = "0.17.0", default-features = false }
|
bevy_app = { version = "0.18", default-features = false }
|
||||||
bevy_reflect = { version = "0.17.0", default-features = false }
|
bevy_reflect = { version = "0.18", default-features = false }
|
||||||
bevy_log = { version = "0.17.0", default-features = false }
|
bevy_log = { version = "0.18", default-features = false }
|
||||||
bevy_gizmos = { version = "0.17.0", default-features = false }
|
bevy_gizmos = { version = "0.18", default-features = false }
|
||||||
bevy_camera = { version = "0.17.0", default-features = false }
|
bevy_camera = { version = "0.18", default-features = false }
|
||||||
bevy_color = { version = "0.17.0", default-features = false }
|
bevy_color = { version = "0.18", default-features = false }
|
||||||
bevy_transform = { version = "0.17.0", default-features = false }
|
bevy_transform = { version = "0.18", default-features = false }
|
||||||
bevy_derive = { version = "0.17.0", default-features = false }
|
bevy_derive = { version = "0.18", default-features = false }
|
||||||
bevy_platform = { version = "0.17.0", default-features = false }
|
bevy_platform = { version = "0.18", default-features = false }
|
||||||
|
|
||||||
|
|
||||||
bevy_mod_xr = { path = "crates/bevy_xr", version = "0.4.0" }
|
bevy_mod_xr = { path = "crates/bevy_xr", version = "0.4.0" }
|
||||||
@@ -34,8 +34,8 @@ bevy_mod_openxr = { path = "crates/bevy_openxr", version = "0.4.0" }
|
|||||||
bevy_xr_utils = { path = "crates/bevy_xr_utils", version = "0.4.0" }
|
bevy_xr_utils = { path = "crates/bevy_xr_utils", version = "0.4.0" }
|
||||||
openxr = "0.19.0"
|
openxr = "0.19.0"
|
||||||
thiserror = "2.0.3"
|
thiserror = "2.0.3"
|
||||||
wgpu = "26"
|
wgpu = "27"
|
||||||
wgpu-hal = "26"
|
wgpu-hal = "27"
|
||||||
|
|
||||||
# Enable a small amount of optimization in the dev profile.
|
# Enable a small amount of optimization in the dev profile.
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ fn main() {
|
|||||||
.add_plugins(bevy_mod_openxr::features::fb_passthrough::OxrFbPassthroughPlugin)
|
.add_plugins(bevy_mod_openxr::features::fb_passthrough::OxrFbPassthroughPlugin)
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(Update, modify_camera)
|
.add_systems(Update, modify_camera)
|
||||||
.insert_resource(AmbientLight {
|
.insert_resource(GlobalAmbientLight {
|
||||||
color: Default::default(),
|
color: Default::default(),
|
||||||
brightness: 500.0,
|
brightness: 500.0,
|
||||||
affects_lightmapped_meshes: false,
|
affects_lightmapped_meshes: false,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ fn main() -> AppExit {
|
|||||||
.add_plugins(bevy_mod_xr::hand_debug_gizmos::HandGizmosPlugin)
|
.add_plugins(bevy_mod_xr::hand_debug_gizmos::HandGizmosPlugin)
|
||||||
.add_systems(Startup, setup)
|
.add_systems(Startup, setup)
|
||||||
.add_systems(Update, handle_input)
|
.add_systems(Update, handle_input)
|
||||||
.insert_resource(AmbientLight::default())
|
.insert_resource(GlobalAmbientLight::default())
|
||||||
.run()
|
.run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use ash::vk::{self, Handle};
|
|||||||
use bevy_log::{debug, error};
|
use bevy_log::{debug, error};
|
||||||
use bevy_math::UVec2;
|
use bevy_math::UVec2;
|
||||||
use openxr::{sys, Version};
|
use openxr::{sys, Version};
|
||||||
use wgpu::{InstanceFlags, MemoryBudgetThresholds};
|
use wgpu::{ExperimentalFeatures, InstanceFlags, MemoryBudgetThresholds};
|
||||||
use wgpu::TextureUses;
|
use wgpu::TextureUses;
|
||||||
use wgpu_hal::api::Vulkan;
|
use wgpu_hal::api::Vulkan;
|
||||||
use wgpu_hal::Api;
|
use wgpu_hal::Api;
|
||||||
@@ -453,6 +453,7 @@ fn init_from_instance_and_dev(
|
|||||||
required_limits: limits,
|
required_limits: limits,
|
||||||
memory_hints: wgpu::MemoryHints::Performance,
|
memory_hints: wgpu::MemoryHints::Performance,
|
||||||
trace: wgpu::Trace::Off,
|
trace: wgpu::Trace::Off,
|
||||||
|
experimental_features: ExperimentalFeatures::enabled(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}?;
|
}?;
|
||||||
@@ -811,6 +812,7 @@ fn wgpu_to_vulkan(format: wgpu::TextureFormat) -> Option<vk::Format> {
|
|||||||
Tf::EacR11Snorm => F::EAC_R11_SNORM_BLOCK,
|
Tf::EacR11Snorm => F::EAC_R11_SNORM_BLOCK,
|
||||||
Tf::EacRg11Unorm => F::EAC_R11G11_UNORM_BLOCK,
|
Tf::EacRg11Unorm => F::EAC_R11G11_UNORM_BLOCK,
|
||||||
Tf::EacRg11Snorm => F::EAC_R11G11_SNORM_BLOCK,
|
Tf::EacRg11Snorm => F::EAC_R11G11_SNORM_BLOCK,
|
||||||
|
Tf::P010 => F::G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16,
|
||||||
Tf::Astc { block, channel } => match channel {
|
Tf::Astc { block, channel } => match channel {
|
||||||
AstcChannel::Unorm => match block {
|
AstcChannel::Unorm => match block {
|
||||||
AstcBlock::B4x4 => F::ASTC_4X4_UNORM_BLOCK,
|
AstcBlock::B4x4 => F::ASTC_4X4_UNORM_BLOCK,
|
||||||
|
|||||||
@@ -9,22 +9,22 @@ use bevy_ecs::{
|
|||||||
};
|
};
|
||||||
use bevy_log::{debug_span, error, info};
|
use bevy_log::{debug_span, error, info};
|
||||||
use bevy_render::{
|
use bevy_render::{
|
||||||
|
Render, RenderApp,
|
||||||
extract_resource::ExtractResourcePlugin,
|
extract_resource::ExtractResourcePlugin,
|
||||||
pipelined_rendering::PipelinedRenderingPlugin,
|
pipelined_rendering::PipelinedRenderingPlugin,
|
||||||
texture::{ManualTextureView, ManualTextureViews},
|
texture::{ManualTextureView, ManualTextureViews},
|
||||||
view::ExtractedView,
|
view::ExtractedView,
|
||||||
Render, RenderApp,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use bevy_mod_xr::{
|
use bevy_mod_xr::{
|
||||||
camera::{calculate_projection, Fov, XrCamera, XrProjection, XrViewInit},
|
camera::{Fov, XrCamera, XrProjection, XrViewInit, calculate_projection},
|
||||||
session::{
|
session::{
|
||||||
XrFirst, XrHandleEvents, XrPreDestroySession, XrRenderSystems, XrRootTransform,
|
XrFirst, XrHandleEvents, XrPreDestroySession, XrRenderSystems, XrRootTransform,
|
||||||
XrSessionCreated,
|
XrSessionCreated,
|
||||||
},
|
},
|
||||||
spaces::XrPrimaryReferenceSpace,
|
spaces::XrPrimaryReferenceSpace,
|
||||||
};
|
};
|
||||||
use bevy_transform::{components::Transform, TransformSystems};
|
use bevy_transform::{TransformSystems, components::Transform};
|
||||||
use openxr::ViewStateFlags;
|
use openxr::ViewStateFlags;
|
||||||
|
|
||||||
use crate::{helper_traits::ToTransform as _, init::should_run_frame_loop, resources::*};
|
use crate::{helper_traits::ToTransform as _, init::should_run_frame_loop, resources::*};
|
||||||
@@ -158,10 +158,7 @@ pub fn init_views<const SPAWN_CAMERAS: bool>(
|
|||||||
add_texture_view(&mut manual_texture_views, temp_tex, &graphics_info, index);
|
add_texture_view(&mut manual_texture_views, temp_tex, &graphics_info, index);
|
||||||
if SPAWN_CAMERAS {
|
if SPAWN_CAMERAS {
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
Camera {
|
RenderTarget::TextureView(view_handle),
|
||||||
target: RenderTarget::TextureView(view_handle),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
XrCamera(index),
|
XrCamera(index),
|
||||||
Projection::custom(XrProjection::default()),
|
Projection::custom(XrProjection::default()),
|
||||||
// NoFrustumCulling,
|
// NoFrustumCulling,
|
||||||
@@ -177,14 +174,14 @@ pub fn wait_frame(mut frame_waiter: ResMut<OxrFrameWaiter>, mut commands: Comman
|
|||||||
|
|
||||||
pub fn update_cameras(
|
pub fn update_cameras(
|
||||||
frame_state: Res<OxrFrameState>,
|
frame_state: Res<OxrFrameState>,
|
||||||
mut cameras: Query<(&mut Camera, &XrCamera)>,
|
mut cameras: Query<(&mut Camera, &mut RenderTarget, &XrCamera)>,
|
||||||
) {
|
) {
|
||||||
for (mut camera, xr_camera) in &mut cameras {
|
for (_, mut target, xr_camera) in &mut cameras {
|
||||||
camera.target =
|
*target =
|
||||||
RenderTarget::TextureView(ManualTextureViewHandle(XR_TEXTURE_INDEX + xr_camera.0));
|
RenderTarget::TextureView(ManualTextureViewHandle(XR_TEXTURE_INDEX + xr_camera.0));
|
||||||
}
|
}
|
||||||
if frame_state.is_changed() {
|
if frame_state.is_changed() {
|
||||||
for (mut camera, _) in &mut cameras {
|
for (mut camera, _, _) in &mut cameras {
|
||||||
camera.is_active = frame_state.should_render
|
camera.is_active = frame_state.should_render
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -317,7 +314,7 @@ pub fn add_texture_view(
|
|||||||
let view = ManualTextureView {
|
let view = ManualTextureView {
|
||||||
texture_view: view.into(),
|
texture_view: view.into(),
|
||||||
size: info.resolution,
|
size: info.resolution,
|
||||||
format: info.format,
|
view_format: info.format,
|
||||||
};
|
};
|
||||||
let handle = ManualTextureViewHandle(XR_TEXTURE_INDEX + index);
|
let handle = ManualTextureViewHandle(XR_TEXTURE_INDEX + index);
|
||||||
manual_texture_views.insert(handle, view);
|
manual_texture_views.insert(handle, view);
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ fn on_tracker_add(mut world: DeferredWorld, HookContext { entity, .. }: HookCont
|
|||||||
if world
|
if world
|
||||||
.entity(entity)
|
.entity(entity)
|
||||||
.get_components::<Has<Children>>()
|
.get_components::<Has<Children>>()
|
||||||
.is_some_and(identity)
|
.is_ok_and(identity)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ fn main() {
|
|||||||
.add_systems(Update, read_action_with_marker_component)
|
.add_systems(Update, read_action_with_marker_component)
|
||||||
.add_systems(Update, handle_flight_input)
|
.add_systems(Update, handle_flight_input)
|
||||||
// Realtime lighting is expensive, use ambient light instead
|
// Realtime lighting is expensive, use ambient light instead
|
||||||
.insert_resource(AmbientLight {
|
.insert_resource(GlobalAmbientLight {
|
||||||
brightness: 500.0,
|
brightness: 500.0,
|
||||||
..AmbientLight::default()
|
..GlobalAmbientLight::default()
|
||||||
})
|
})
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ fn main() -> AppExit {
|
|||||||
Update,
|
Update,
|
||||||
send_recenter.after(XRUtilsActionSystems::SyncActionStates),
|
send_recenter.after(XRUtilsActionSystems::SyncActionStates),
|
||||||
)
|
)
|
||||||
.insert_resource(AmbientLight {
|
.insert_resource(GlobalAmbientLight {
|
||||||
brightness: 500.0,
|
brightness: 500.0,
|
||||||
..AmbientLight::default()
|
..GlobalAmbientLight::default()
|
||||||
})
|
})
|
||||||
.run()
|
.run()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user