Merge pull request #189 from Schmarni-Dev/non_default_wait_frame_system
allow for custom wait_frame system
This commit is contained in:
@@ -30,16 +30,21 @@ pub struct OxrRenderEnd;
|
|||||||
|
|
||||||
pub struct OxrRenderPlugin {
|
pub struct OxrRenderPlugin {
|
||||||
pub spawn_cameras: bool,
|
pub spawn_cameras: bool,
|
||||||
|
pub default_wait_frame: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for OxrRenderPlugin {
|
impl Default for OxrRenderPlugin {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
spawn_cameras: true,
|
spawn_cameras: true,
|
||||||
|
default_wait_frame: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone, Copy)]
|
||||||
|
pub struct OxrWaitFrameSystem;
|
||||||
|
|
||||||
impl Plugin for OxrRenderPlugin {
|
impl Plugin for OxrRenderPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
if app.is_plugin_added::<PipelinedRenderingPlugin>() {
|
if app.is_plugin_added::<PipelinedRenderingPlugin>() {
|
||||||
@@ -52,14 +57,21 @@ impl Plugin for OxrRenderPlugin {
|
|||||||
ExtractResourcePlugin::<OxrSwapchainImages>::default(),
|
ExtractResourcePlugin::<OxrSwapchainImages>::default(),
|
||||||
ExtractResourcePlugin::<OxrViews>::default(),
|
ExtractResourcePlugin::<OxrViews>::default(),
|
||||||
))
|
))
|
||||||
.add_systems(XrPreDestroySession, clean_views)
|
.add_systems(XrPreDestroySession, clean_views);
|
||||||
.add_systems(
|
if self.default_wait_frame {
|
||||||
|
app.add_systems(
|
||||||
XrFirst,
|
XrFirst,
|
||||||
(
|
wait_frame
|
||||||
wait_frame.run_if(should_run_frame_loop),
|
.run_if(should_run_frame_loop)
|
||||||
update_cameras.run_if(should_run_frame_loop),
|
.in_set(OxrWaitFrameSystem)
|
||||||
)
|
.in_set(XrHandleEvents::FrameLoop),
|
||||||
.chain()
|
);
|
||||||
|
}
|
||||||
|
app.add_systems(
|
||||||
|
XrFirst,
|
||||||
|
update_cameras
|
||||||
|
.run_if(should_run_frame_loop)
|
||||||
|
.after(OxrWaitFrameSystem)
|
||||||
.in_set(XrHandleEvents::FrameLoop),
|
.in_set(XrHandleEvents::FrameLoop),
|
||||||
)
|
)
|
||||||
.add_systems(
|
.add_systems(
|
||||||
|
|||||||
Reference in New Issue
Block a user