Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Use Time resource instead of Extracting Time #7316

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions examples/stress_tests/many_lights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bevy::{
math::{DVec2, DVec3},
pbr::{ExtractedPointLight, GlobalLightMeta},
prelude::*,
render::{camera::ScalingMode, Extract, RenderApp, RenderStage},
render::{camera::ScalingMode, RenderApp, RenderStage},
window::{PresentMode, WindowPlugin},
};
use rand::{thread_rng, Rng};
Expand Down Expand Up @@ -156,15 +156,13 @@ impl Plugin for LogVisibleLights {
Err(_) => return,
};

render_app
.add_system_to_stage(RenderStage::Extract, extract_time)
.add_system_to_stage(RenderStage::Prepare, print_visible_light_count);
render_app.add_system_to_stage(RenderStage::Prepare, print_visible_light_count);
}
}

// System for printing the number of meshes on every tick of the timer
fn print_visible_light_count(
time: Res<ExtractedTime>,
time: Res<Time>,
mut timer: Local<PrintingTimer>,
visible: Query<&ExtractedPointLight>,
global_light_meta: Res<GlobalLightMeta>,
Expand All @@ -180,13 +178,6 @@ fn print_visible_light_count(
}
}

#[derive(Resource, Deref, DerefMut)]
pub struct ExtractedTime(Time);

fn extract_time(mut commands: Commands, time: Extract<Res<Time>>) {
commands.insert_resource(ExtractedTime(time.clone()));
}

struct PrintingTimer(Timer);

impl Default for PrintingTimer {
Expand Down