add compatibility for both pipelined and unpipelined

This commit is contained in:
awtterpip
2024-06-02 19:30:12 -05:00
parent 41399d83a9
commit 32fa13b4fd
2 changed files with 14 additions and 4 deletions

View File

@@ -150,9 +150,9 @@ impl Plugin for OxrInitPlugin {
.insert_non_send_resource(session_create_info)
.configure_sets(OxrLast, OxrHandleEvents);
// app.world
// .resource_mut::<MainScheduleOrder>()
// .insert_after(Last, OxrLast);
app.world
.resource_mut::<MainScheduleOrder>()
.insert_after(Last, OxrLast);
app.world
.spawn((TransformBundle::default(), OxrTrackingRoot));

View File

@@ -1,5 +1,5 @@
use bevy::{
app::SubApp,
app::{MainScheduleOrder, SubApp},
ecs::{query::QuerySingleError, schedule::MainThreadExecutor},
prelude::*,
render::{
@@ -33,6 +33,16 @@ impl Plugin for OxrRenderPlugin {
if app.is_plugin_added::<PipelinedRenderingPlugin>() {
app.init_resource::<Pipelined>();
let mut schedule_order = app.world.resource_mut::<MainScheduleOrder>();
if let Some(pos) = schedule_order
.labels
.iter()
.position(|label| (**label).eq(&OxrLast))
{
schedule_order.labels.remove(pos);
}
if let Some(sub_app) = app.remove_sub_app(RenderExtractApp) {
app.insert_sub_app(RenderExtractApp, SubApp::new(sub_app.app, update_rendering));
}