Adopt consistent FooSystems
naming convention for system sets (#18900)
# Objective Fixes a part of #14274. Bevy has an incredibly inconsistent naming convention for its system sets, both internally and across the ecosystem. <img alt="System sets in Bevy" src="https://github.com/user-attachments/assets/d16e2027-793f-4ba4-9cc9-e780b14a5a1b" width="450" /> *Names of public system set types in Bevy* Most Bevy types use a naming of `FooSystem` or just `Foo`, but there are also a few `FooSystems` and `FooSet` types. In ecosystem crates on the other hand, `FooSet` is perhaps the most commonly used name in general. Conventions being so wildly inconsistent can make it harder for users to pick names for their own types, to search for system sets on docs.rs, or to even discern which types *are* system sets. To reign in the inconsistency a bit and help unify the ecosystem, it would be good to establish a common recommended naming convention for system sets in Bevy itself, similar to how plugins are commonly suffixed with `Plugin` (ex: `TimePlugin`). By adopting a consistent naming convention in first-party Bevy, we can softly nudge ecosystem crates to follow suit (for types where it makes sense to do so). Choosing a naming convention is also relevant now, as the [`bevy_cli` recently adopted lints](https://github.com/TheBevyFlock/bevy_cli/pull/345) to enforce naming for plugins and system sets, and the recommended naming used for system sets is still a bit open. ## Which Name To Use? Now the contentious part: what naming convention should we actually adopt? This was discussed on the Bevy Discord at the end of last year, starting [here](<https://discord.com/channels/691052431525675048/692572690833473578/1310659954683936789>). `FooSet` and `FooSystems` were the clear favorites, with `FooSet` very narrowly winning an unofficial poll. However, it seems to me like the consensus was broadly moving towards `FooSystems` at the end and after the poll, with Cart ([source](https://discord.com/channels/691052431525675048/692572690833473578/1311140204974706708)) and later Alice ([source](https://discord.com/channels/691052431525675048/692572690833473578/1311092530732859533)) and also me being in favor of it. Let's do a quick pros and cons list! Of course these are just what I thought of, so take it with a grain of salt. `FooSet`: - Pro: Nice and short! - Pro: Used by many ecosystem crates. - Pro: The `Set` suffix comes directly from the trait name `SystemSet`. - Pro: Pairs nicely with existing APIs like `in_set` and `configure_sets`. - Con: `Set` by itself doesn't actually indicate that it's related to systems *at all*, apart from the implemented trait. A set of what? - Con: Is `FooSet` a set of `Foo`s or a system set related to `Foo`? Ex: `ContactSet`, `MeshSet`, `EnemySet`... `FooSystems`: - Pro: Very clearly indicates that the type represents a collection of systems. The actual core concept, system(s), is in the name. - Pro: Parallels nicely with `FooPlugins` for plugin groups. - Pro: Low risk of conflicts with other names or misunderstandings about what the type is. - Pro: In most cases, reads *very* nicely and clearly. Ex: `PhysicsSystems` and `AnimationSystems` as opposed to `PhysicsSet` and `AnimationSet`. - Pro: Easy to search for on docs.rs. - Con: Usually results in longer names. - Con: Not yet as widely used. Really the big problem with `FooSet` is that it doesn't actually describe what it is. It describes what *kind of thing* it is (a set of something), but not *what it is a set of*, unless you know the type or check its docs or implemented traits. `FooSystems` on the other hand is much more self-descriptive in this regard, at the cost of being a bit longer to type. Ultimately, in some ways it comes down to preference and how you think of system sets. Personally, I was originally in favor of `FooSet`, but have been increasingly on the side of `FooSystems`, especially after seeing what the new names would actually look like in Avian and now Bevy. I prefer it because it usually reads better, is much more clearly related to groups of systems than `FooSet`, and overall *feels* more correct and natural to me in the long term. For these reasons, and because Alice and Cart also seemed to share a preference for it when it was previously being discussed, I propose that we adopt a `FooSystems` naming convention where applicable. ## Solution Rename Bevy's system set types to use a consistent `FooSet` naming where applicable. - `AccessibilitySystem` → `AccessibilitySystems` - `GizmoRenderSystem` → `GizmoRenderSystems` - `PickSet` → `PickingSystems` - `RunFixedMainLoopSystem` → `RunFixedMainLoopSystems` - `TransformSystem` → `TransformSystems` - `RemoteSet` → `RemoteSystems` - `RenderSet` → `RenderSystems` - `SpriteSystem` → `SpriteSystems` - `StateTransitionSteps` → `StateTransitionSystems` - `RenderUiSystem` → `RenderUiSystems` - `UiSystem` → `UiSystems` - `Animation` → `AnimationSystems` - `AssetEvents` → `AssetEventSystems` - `TrackAssets` → `AssetTrackingSystems` - `UpdateGizmoMeshes` → `GizmoMeshSystems` - `InputSystem` → `InputSystems` - `InputFocusSet` → `InputFocusSystems` - `ExtractMaterialsSet` → `MaterialExtractionSystems` - `ExtractMeshesSet` → `MeshExtractionSystems` - `RumbleSystem` → `RumbleSystems` - `CameraUpdateSystem` → `CameraUpdateSystems` - `ExtractAssetsSet` → `AssetExtractionSystems` - `Update2dText` → `Text2dUpdateSystems` - `TimeSystem` → `TimeSystems` - `AudioPlaySet` → `AudioPlaybackSystems` - `SendEvents` → `EventSenderSystems` - `EventUpdates` → `EventUpdateSystems` A lot of the names got slightly longer, but they are also a lot more consistent, and in my opinion the majority of them read much better. For a few of the names I took the liberty of rewording things a bit; definitely open to any further naming improvements. There are still also cases where the `FooSystems` naming doesn't really make sense, and those I left alone. This primarily includes system sets like `Interned<dyn SystemSet>`, `EnterSchedules<S>`, `ExitSchedules<S>`, or `TransitionSchedules<S>`, where the type has some special purpose and semantics. ## Todo - [x] Should I keep all the old names as deprecated type aliases? I can do this, but to avoid wasting work I'd prefer to first reach consensus on whether these renames are even desired. - [x] Migration guide - [x] Release notes
This commit is contained in:
parent
775fae5b62
commit
7b1c9f192e
@ -137,11 +137,15 @@ impl From<Node> for AccessibilityNode {
|
||||
all(feature = "bevy_reflect", feature = "serialize"),
|
||||
reflect(Serialize, Deserialize, Clone)
|
||||
)]
|
||||
pub enum AccessibilitySystem {
|
||||
pub enum AccessibilitySystems {
|
||||
/// Update the accessibility tree
|
||||
Update,
|
||||
}
|
||||
|
||||
/// Deprecated alias for [`AccessibilitySystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `AccessibilitySystems`.")]
|
||||
pub type AccessibilitySystem = AccessibilitySystems;
|
||||
|
||||
/// Plugin managing non-GUI aspects of integrating with accessibility APIs.
|
||||
#[derive(Default)]
|
||||
pub struct AccessibilityPlugin;
|
||||
|
@ -31,14 +31,14 @@ use crate::{
|
||||
prelude::EvaluatorId,
|
||||
};
|
||||
|
||||
use bevy_app::{Animation, App, Plugin, PostUpdate};
|
||||
use bevy_asset::{Asset, AssetApp, AssetEvents, Assets};
|
||||
use bevy_app::{AnimationSystems, App, Plugin, PostUpdate};
|
||||
use bevy_asset::{Asset, AssetApp, AssetEventSystems, Assets};
|
||||
use bevy_ecs::{prelude::*, world::EntityMutExcept};
|
||||
use bevy_math::FloatOrd;
|
||||
use bevy_platform::{collections::HashMap, hash::NoOpHash};
|
||||
use bevy_reflect::{prelude::ReflectDefault, Reflect, TypePath};
|
||||
use bevy_time::Time;
|
||||
use bevy_transform::TransformSystem;
|
||||
use bevy_transform::TransformSystems;
|
||||
use bevy_utils::{PreHashMap, PreHashMapExt, TypeIdMap};
|
||||
use petgraph::graph::NodeIndex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -1244,7 +1244,7 @@ impl Plugin for AnimationPlugin {
|
||||
.add_systems(
|
||||
PostUpdate,
|
||||
(
|
||||
graph::thread_animation_graphs.before(AssetEvents),
|
||||
graph::thread_animation_graphs.before(AssetEventSystems),
|
||||
advance_transitions,
|
||||
advance_animations,
|
||||
// TODO: `animate_targets` can animate anything, so
|
||||
@ -1260,8 +1260,8 @@ impl Plugin for AnimationPlugin {
|
||||
expire_completed_transitions,
|
||||
)
|
||||
.chain()
|
||||
.in_set(Animation)
|
||||
.before(TransformSystem::TransformPropagate),
|
||||
.in_set(AnimationSystems)
|
||||
.before(TransformSystems::Propagate),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ use bevy_render::{
|
||||
},
|
||||
renderer::RenderDevice,
|
||||
view::{ExtractedView, ViewTarget},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
mod node;
|
||||
@ -121,7 +121,7 @@ impl Plugin for CasPlugin {
|
||||
};
|
||||
render_app
|
||||
.init_resource::<SpecializedRenderPipelines<CasPipeline>>()
|
||||
.add_systems(Render, prepare_cas_pipelines.in_set(RenderSet::Prepare));
|
||||
.add_systems(Render, prepare_cas_pipelines.in_set(RenderSystems::Prepare));
|
||||
|
||||
{
|
||||
render_app
|
||||
|
@ -18,7 +18,7 @@ use bevy_render::{
|
||||
},
|
||||
renderer::RenderDevice,
|
||||
view::{ExtractedView, ViewTarget},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_utils::default;
|
||||
|
||||
@ -96,7 +96,10 @@ impl Plugin for FxaaPlugin {
|
||||
};
|
||||
render_app
|
||||
.init_resource::<SpecializedRenderPipelines<FxaaPipeline>>()
|
||||
.add_systems(Render, prepare_fxaa_pipelines.in_set(RenderSet::Prepare))
|
||||
.add_systems(
|
||||
Render,
|
||||
prepare_fxaa_pipelines.in_set(RenderSystems::Prepare),
|
||||
)
|
||||
.add_render_graph_node::<ViewNodeRunner<FxaaNode>>(Core3d, Node3d::Fxaa)
|
||||
.add_render_graph_edges(
|
||||
Core3d,
|
||||
|
@ -76,7 +76,7 @@ use bevy_render::{
|
||||
renderer::{RenderContext, RenderDevice, RenderQueue},
|
||||
texture::{CachedTexture, GpuImage, TextureCache},
|
||||
view::{ExtractedView, ViewTarget},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_utils::prelude::default;
|
||||
|
||||
@ -346,10 +346,10 @@ impl Plugin for SmaaPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
prepare_smaa_pipelines.in_set(RenderSet::Prepare),
|
||||
prepare_smaa_uniforms.in_set(RenderSet::PrepareResources),
|
||||
prepare_smaa_textures.in_set(RenderSet::PrepareResources),
|
||||
prepare_smaa_bind_groups.in_set(RenderSet::PrepareBindGroups),
|
||||
prepare_smaa_pipelines.in_set(RenderSystems::Prepare),
|
||||
prepare_smaa_uniforms.in_set(RenderSystems::PrepareResources),
|
||||
prepare_smaa_textures.in_set(RenderSystems::PrepareResources),
|
||||
prepare_smaa_bind_groups.in_set(RenderSystems::PrepareBindGroups),
|
||||
),
|
||||
)
|
||||
.add_render_graph_node::<ViewNodeRunner<SmaaNode>>(Core3d, Node3d::Smaa)
|
||||
|
@ -36,7 +36,7 @@ use bevy_render::{
|
||||
sync_world::RenderEntity,
|
||||
texture::{CachedTexture, TextureCache},
|
||||
view::{ExtractedView, Msaa, ViewTarget},
|
||||
ExtractSchedule, MainWorld, Render, RenderApp, RenderSet,
|
||||
ExtractSchedule, MainWorld, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use tracing::warn;
|
||||
|
||||
@ -64,9 +64,9 @@ impl Plugin for TemporalAntiAliasPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
prepare_taa_jitter_and_mip_bias.in_set(RenderSet::ManageViews),
|
||||
prepare_taa_pipelines.in_set(RenderSet::Prepare),
|
||||
prepare_taa_history_textures.in_set(RenderSet::PrepareResources),
|
||||
prepare_taa_jitter_and_mip_bias.in_set(RenderSystems::ManageViews),
|
||||
prepare_taa_pipelines.in_set(RenderSystems::Prepare),
|
||||
prepare_taa_history_textures.in_set(RenderSystems::PrepareResources),
|
||||
),
|
||||
)
|
||||
.add_render_graph_node::<ViewNodeRunner<TemporalAntiAliasNode>>(Core3d, Node3d::Taa)
|
||||
|
@ -117,7 +117,7 @@ impl Default for App {
|
||||
app.add_systems(
|
||||
First,
|
||||
event_update_system
|
||||
.in_set(bevy_ecs::event::EventUpdates)
|
||||
.in_set(bevy_ecs::event::EventUpdateSystems)
|
||||
.run_if(bevy_ecs::event::event_update_condition),
|
||||
);
|
||||
app.add_event::<AppExit>();
|
||||
|
@ -55,7 +55,7 @@ pub mod prelude {
|
||||
main_schedule::{
|
||||
First, FixedFirst, FixedLast, FixedPostUpdate, FixedPreUpdate, FixedUpdate, Last, Main,
|
||||
PostStartup, PostUpdate, PreStartup, PreUpdate, RunFixedMainLoop,
|
||||
RunFixedMainLoopSystem, SpawnScene, Startup, Update,
|
||||
RunFixedMainLoopSystems, SpawnScene, Startup, Update,
|
||||
},
|
||||
sub_app::SubApp,
|
||||
Plugin, PluginGroup, TaskPoolOptions, TaskPoolPlugin,
|
||||
|
@ -92,8 +92,8 @@ pub struct PreUpdate;
|
||||
|
||||
/// Runs the [`FixedMain`] schedule in a loop according until all relevant elapsed time has been "consumed".
|
||||
///
|
||||
/// If you need to order your variable timestep systems
|
||||
/// before or after the fixed update logic, use the [`RunFixedMainLoopSystem`] system set.
|
||||
/// If you need to order your variable timestep systems before or after
|
||||
/// the fixed update logic, use the [`RunFixedMainLoopSystems`] system set.
|
||||
///
|
||||
/// Note that in contrast to most other Bevy schedules, systems added directly to
|
||||
/// [`RunFixedMainLoop`] will *not* be parallelized between each other.
|
||||
@ -149,7 +149,7 @@ pub struct FixedLast;
|
||||
/// The schedule that contains systems which only run after a fixed period of time has elapsed.
|
||||
///
|
||||
/// This is run by the [`RunFixedMainLoop`] schedule. If you need to order your variable timestep systems
|
||||
/// before or after the fixed update logic, use the [`RunFixedMainLoopSystem`] system set.
|
||||
/// before or after the fixed update logic, use the [`RunFixedMainLoopSystems`] system set.
|
||||
///
|
||||
/// Frequency of execution is configured by inserting `Time<Fixed>` resource, 64 Hz by default.
|
||||
/// See [this example](https://github.com/bevyengine/bevy/blob/latest/examples/time/time.rs).
|
||||
@ -196,7 +196,11 @@ pub struct Last;
|
||||
|
||||
/// Animation system set. This exists in [`PostUpdate`].
|
||||
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone)]
|
||||
pub struct Animation;
|
||||
pub struct AnimationSystems;
|
||||
|
||||
/// Deprecated alias for [`AnimationSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `AnimationSystems`.")]
|
||||
pub type Animation = AnimationSystems;
|
||||
|
||||
/// Defines the schedules to be run for the [`Main`] schedule, including
|
||||
/// their order.
|
||||
@ -318,9 +322,9 @@ impl Plugin for MainSchedulePlugin {
|
||||
.configure_sets(
|
||||
RunFixedMainLoop,
|
||||
(
|
||||
RunFixedMainLoopSystem::BeforeFixedMainLoop,
|
||||
RunFixedMainLoopSystem::FixedMainLoop,
|
||||
RunFixedMainLoopSystem::AfterFixedMainLoop,
|
||||
RunFixedMainLoopSystems::BeforeFixedMainLoop,
|
||||
RunFixedMainLoopSystems::FixedMainLoop,
|
||||
RunFixedMainLoopSystems::AfterFixedMainLoop,
|
||||
)
|
||||
.chain(),
|
||||
);
|
||||
@ -400,7 +404,7 @@ impl FixedMain {
|
||||
/// Note that in contrast to most other Bevy schedules, systems added directly to
|
||||
/// [`RunFixedMainLoop`] will *not* be parallelized between each other.
|
||||
#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone, SystemSet)]
|
||||
pub enum RunFixedMainLoopSystem {
|
||||
pub enum RunFixedMainLoopSystems {
|
||||
/// Runs before the fixed update logic.
|
||||
///
|
||||
/// A good example of a system that fits here
|
||||
@ -419,7 +423,7 @@ pub enum RunFixedMainLoopSystem {
|
||||
/// App::new()
|
||||
/// .add_systems(
|
||||
/// RunFixedMainLoop,
|
||||
/// update_camera_rotation.in_set(RunFixedMainLoopSystem::BeforeFixedMainLoop))
|
||||
/// update_camera_rotation.in_set(RunFixedMainLoopSystems::BeforeFixedMainLoop))
|
||||
/// .add_systems(FixedUpdate, update_physics);
|
||||
///
|
||||
/// # fn update_camera_rotation() {}
|
||||
@ -432,7 +436,7 @@ pub enum RunFixedMainLoopSystem {
|
||||
///
|
||||
/// Don't place systems here, use [`FixedUpdate`] and friends instead.
|
||||
/// Use this system instead to order your systems to run specifically inbetween the fixed update logic and all
|
||||
/// other systems that run in [`RunFixedMainLoopSystem::BeforeFixedMainLoop`] or [`RunFixedMainLoopSystem::AfterFixedMainLoop`].
|
||||
/// other systems that run in [`RunFixedMainLoopSystems::BeforeFixedMainLoop`] or [`RunFixedMainLoopSystems::AfterFixedMainLoop`].
|
||||
///
|
||||
/// [`Time<Virtual>`]: https://docs.rs/bevy/latest/bevy/prelude/struct.Virtual.html
|
||||
/// [`Time::overstep`]: https://docs.rs/bevy/latest/bevy/time/struct.Time.html#method.overstep
|
||||
@ -448,8 +452,8 @@ pub enum RunFixedMainLoopSystem {
|
||||
/// // This system will be called before all interpolation systems
|
||||
/// // that third-party plugins might add.
|
||||
/// prepare_for_interpolation
|
||||
/// .after(RunFixedMainLoopSystem::FixedMainLoop)
|
||||
/// .before(RunFixedMainLoopSystem::AfterFixedMainLoop),
|
||||
/// .after(RunFixedMainLoopSystems::FixedMainLoop)
|
||||
/// .before(RunFixedMainLoopSystems::AfterFixedMainLoop),
|
||||
/// )
|
||||
/// );
|
||||
///
|
||||
@ -473,10 +477,14 @@ pub enum RunFixedMainLoopSystem {
|
||||
/// .add_systems(FixedUpdate, update_physics)
|
||||
/// .add_systems(
|
||||
/// RunFixedMainLoop,
|
||||
/// interpolate_transforms.in_set(RunFixedMainLoopSystem::AfterFixedMainLoop));
|
||||
/// interpolate_transforms.in_set(RunFixedMainLoopSystems::AfterFixedMainLoop));
|
||||
///
|
||||
/// # fn interpolate_transforms() {}
|
||||
/// # fn update_physics() {}
|
||||
/// ```
|
||||
AfterFixedMainLoop,
|
||||
}
|
||||
|
||||
/// Deprecated alias for [`RunFixedMainLoopSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `RunFixedMainLoopSystems`.")]
|
||||
pub type RunFixedMainLoopSystem = RunFixedMainLoopSystems;
|
||||
|
@ -22,10 +22,10 @@ use tracing::error;
|
||||
/// the [`AssetChanged`] filter to determine if an asset has changed since the last time
|
||||
/// a query ran.
|
||||
///
|
||||
/// This resource is automatically managed by the [`AssetEvents`](crate::AssetEvents) schedule and
|
||||
/// should not be exposed to the user in order to maintain safety guarantees. Any additional uses of
|
||||
/// this resource should be carefully audited to ensure that they do not introduce any safety
|
||||
/// issues.
|
||||
/// This resource is automatically managed by the [`AssetEventSystems`](crate::AssetEventSystems)
|
||||
/// system set and should not be exposed to the user in order to maintain safety guarantees.
|
||||
/// Any additional uses of this resource should be carefully audited to ensure that they do not
|
||||
/// introduce any safety issues.
|
||||
#[derive(Resource)]
|
||||
pub(crate) struct AssetChanges<A: Asset> {
|
||||
change_ticks: HashMap<AssetId<A>, Tick>,
|
||||
@ -102,14 +102,13 @@ impl<'w, A: AsAssetId> AssetChangeCheck<'w, A> {
|
||||
///
|
||||
/// # Quirks
|
||||
///
|
||||
/// - Asset changes are registered in the [`AssetEvents`] schedule.
|
||||
/// - Asset changes are registered in the [`AssetEventSystems`] system set.
|
||||
/// - Removed assets are not detected.
|
||||
///
|
||||
/// The list of changed assets only gets updated in the
|
||||
/// [`AssetEvents`] schedule which runs in `Last`. Therefore, `AssetChanged`
|
||||
/// will only pick up asset changes in schedules following `AssetEvents` or the
|
||||
/// next frame. Consider adding the system in the `Last` schedule after [`AssetEvents`] if you need
|
||||
/// to react without frame delay to asset changes.
|
||||
/// The list of changed assets only gets updated in the [`AssetEventSystems`] system set,
|
||||
/// which runs in `Last`. Therefore, `AssetChanged` will only pick up asset changes in schedules
|
||||
/// following [`AssetEventSystems`] or the next frame. Consider adding the system in the `Last` schedule
|
||||
/// after [`AssetEventSystems`] if you need to react without frame delay to asset changes.
|
||||
///
|
||||
/// # Performance
|
||||
///
|
||||
@ -120,7 +119,7 @@ impl<'w, A: AsAssetId> AssetChangeCheck<'w, A> {
|
||||
///
|
||||
/// If no `A` asset updated since the last time the system ran, then no lookups occur.
|
||||
///
|
||||
/// [`AssetEvents`]: crate::AssetEvents
|
||||
/// [`AssetEventSystems`]: crate::AssetEventSystems
|
||||
/// [`Assets<Mesh>::get_mut`]: crate::Assets::get_mut
|
||||
pub struct AssetChanged<A: AsAssetId>(PhantomData<A>);
|
||||
|
||||
@ -166,7 +165,7 @@ unsafe impl<A: AsAssetId> WorldQuery for AssetChanged<A> {
|
||||
this_run: Tick,
|
||||
) -> Self::Fetch<'w> {
|
||||
// SAFETY:
|
||||
// - `AssetChanges` is private and only accessed mutably in the `AssetEvents` schedule
|
||||
// - `AssetChanges` is private and only accessed mutably in the `AssetEventSystems` system set.
|
||||
// - `resource_id` was obtained from the type ID of `AssetChanges<A::Asset>`.
|
||||
let Some(changes) = (unsafe {
|
||||
world
|
||||
@ -283,7 +282,7 @@ unsafe impl<A: AsAssetId> QueryFilter for AssetChanged<A> {
|
||||
#[cfg(test)]
|
||||
#[expect(clippy::print_stdout, reason = "Allowed in tests.")]
|
||||
mod tests {
|
||||
use crate::{AssetEvents, AssetPlugin, Handle};
|
||||
use crate::{AssetEventSystems, AssetPlugin, Handle};
|
||||
use alloc::{vec, vec::Vec};
|
||||
use core::num::NonZero;
|
||||
use std::println;
|
||||
@ -406,7 +405,7 @@ mod tests {
|
||||
.init_asset::<MyAsset>()
|
||||
.insert_resource(Counter(vec![0, 0, 0, 0]))
|
||||
.add_systems(Update, add_some)
|
||||
.add_systems(PostUpdate, count_update.after(AssetEvents));
|
||||
.add_systems(PostUpdate, count_update.after(AssetEventSystems));
|
||||
|
||||
// First run of the app, `add_systems(Startup…)` runs.
|
||||
app.update(); // run_count == 0
|
||||
@ -441,7 +440,7 @@ mod tests {
|
||||
},
|
||||
)
|
||||
.add_systems(Update, update_some)
|
||||
.add_systems(PostUpdate, count_update.after(AssetEvents));
|
||||
.add_systems(PostUpdate, count_update.after(AssetEventSystems));
|
||||
|
||||
// First run of the app, `add_systems(Startup…)` runs.
|
||||
app.update(); // run_count == 0
|
||||
|
@ -414,7 +414,10 @@ impl Plugin for AssetPlugin {
|
||||
.init_asset::<LoadedUntypedAsset>()
|
||||
.init_asset::<()>()
|
||||
.add_event::<UntypedAssetLoadFailedEvent>()
|
||||
.configure_sets(PreUpdate, TrackAssets.after(handle_internal_asset_events))
|
||||
.configure_sets(
|
||||
PreUpdate,
|
||||
AssetTrackingSystems.after(handle_internal_asset_events),
|
||||
)
|
||||
// `handle_internal_asset_events` requires the use of `&mut World`,
|
||||
// and as a result has ambiguous system ordering with all other systems in `PreUpdate`.
|
||||
// This is virtually never a real problem: asset loading is async and so anything that interacts directly with it
|
||||
@ -611,9 +614,12 @@ impl AssetApp for App {
|
||||
PostUpdate,
|
||||
Assets::<A>::asset_events
|
||||
.run_if(Assets::<A>::asset_events_condition)
|
||||
.in_set(AssetEvents),
|
||||
.in_set(AssetEventSystems),
|
||||
)
|
||||
.add_systems(
|
||||
PreUpdate,
|
||||
Assets::<A>::track_assets.in_set(AssetTrackingSystems),
|
||||
)
|
||||
.add_systems(PreUpdate, Assets::<A>::track_assets.in_set(TrackAssets))
|
||||
}
|
||||
|
||||
fn register_asset_reflect<A>(&mut self) -> &mut Self
|
||||
@ -643,13 +649,21 @@ impl AssetApp for App {
|
||||
|
||||
/// A system set that holds all "track asset" operations.
|
||||
#[derive(SystemSet, Hash, Debug, PartialEq, Eq, Clone)]
|
||||
pub struct TrackAssets;
|
||||
pub struct AssetTrackingSystems;
|
||||
|
||||
/// Deprecated alias for [`AssetTrackingSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `AssetTrackingSystems`.")]
|
||||
pub type TrackAssets = AssetTrackingSystems;
|
||||
|
||||
/// A system set where events accumulated in [`Assets`] are applied to the [`AssetEvent`] [`Events`] resource.
|
||||
///
|
||||
/// [`Events`]: bevy_ecs::event::Events
|
||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
|
||||
pub struct AssetEvents;
|
||||
pub struct AssetEventSystems;
|
||||
|
||||
/// Deprecated alias for [`AssetEventSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `AssetEventSystems`.")]
|
||||
pub type AssetEvents = AssetEventSystems;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
@ -58,13 +58,13 @@ pub use sinks::*;
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::{Asset, AssetApp};
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_transform::TransformSystem;
|
||||
use bevy_transform::TransformSystems;
|
||||
|
||||
use audio_output::*;
|
||||
|
||||
/// Set for the audio playback systems, so they can share a run condition
|
||||
#[derive(SystemSet, Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
struct AudioPlaySet;
|
||||
struct AudioPlaybackSystems;
|
||||
|
||||
/// Adds support for audio playback to a Bevy Application
|
||||
///
|
||||
@ -90,13 +90,13 @@ impl Plugin for AudioPlugin {
|
||||
.insert_resource(DefaultSpatialScale(self.default_spatial_scale))
|
||||
.configure_sets(
|
||||
PostUpdate,
|
||||
AudioPlaySet
|
||||
AudioPlaybackSystems
|
||||
.run_if(audio_output_available)
|
||||
.after(TransformSystem::TransformPropagate), // For spatial audio transforms
|
||||
.after(TransformSystems::Propagate), // For spatial audio transforms
|
||||
)
|
||||
.add_systems(
|
||||
PostUpdate,
|
||||
(update_emitter_positions, update_listener_positions).in_set(AudioPlaySet),
|
||||
(update_emitter_positions, update_listener_positions).in_set(AudioPlaybackSystems),
|
||||
)
|
||||
.init_resource::<AudioOutput>();
|
||||
|
||||
@ -118,7 +118,8 @@ impl AddAudioSource for App {
|
||||
{
|
||||
self.init_asset::<T>().add_systems(
|
||||
PostUpdate,
|
||||
(play_queued_audio_system::<T>, cleanup_finished_audio::<T>).in_set(AudioPlaySet),
|
||||
(play_queued_audio_system::<T>, cleanup_finished_audio::<T>)
|
||||
.in_set(AudioPlaybackSystems),
|
||||
);
|
||||
self
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ use bevy_render::{
|
||||
Buffer, BufferDescriptor, BufferUsages, PipelineCache, Shader, SpecializedComputePipelines,
|
||||
},
|
||||
renderer::RenderDevice,
|
||||
ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
mod buffers;
|
||||
@ -72,8 +72,8 @@ impl Plugin for AutoExposurePlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
prepare_buffers.in_set(RenderSet::Prepare),
|
||||
queue_view_auto_exposure_pipelines.in_set(RenderSet::Queue),
|
||||
prepare_buffers.in_set(RenderSystems::Prepare),
|
||||
queue_view_auto_exposure_pipelines.in_set(RenderSystems::Queue),
|
||||
),
|
||||
)
|
||||
.add_render_graph_node::<AutoExposureNode>(Core3d, node::AutoExposure)
|
||||
|
@ -24,7 +24,7 @@ use bevy_render::{
|
||||
renderer::{RenderContext, RenderDevice},
|
||||
texture::{CachedTexture, TextureCache},
|
||||
view::ViewTarget,
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use downsampling_pipeline::{
|
||||
prepare_downsampling_pipeline, BloomDownsamplingPipeline, BloomDownsamplingPipelineIds,
|
||||
@ -63,10 +63,10 @@ impl Plugin for BloomPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
prepare_downsampling_pipeline.in_set(RenderSet::Prepare),
|
||||
prepare_upsampling_pipeline.in_set(RenderSet::Prepare),
|
||||
prepare_bloom_textures.in_set(RenderSet::PrepareResources),
|
||||
prepare_bloom_bind_groups.in_set(RenderSet::PrepareBindGroups),
|
||||
prepare_downsampling_pipeline.in_set(RenderSystems::Prepare),
|
||||
prepare_upsampling_pipeline.in_set(RenderSystems::Prepare),
|
||||
prepare_bloom_textures.in_set(RenderSystems::PrepareResources),
|
||||
prepare_bloom_bind_groups.in_set(RenderSystems::PrepareBindGroups),
|
||||
),
|
||||
)
|
||||
// Add bloom to the 3d render graph
|
||||
|
@ -65,7 +65,7 @@ use bevy_render::{
|
||||
sync_world::MainEntity,
|
||||
texture::TextureCache,
|
||||
view::{Msaa, ViewDepthTexture},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
use self::graph::{Core2d, Node2d};
|
||||
@ -93,8 +93,8 @@ impl Plugin for Core2dPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
sort_phase_system::<Transparent2d>.in_set(RenderSet::PhaseSort),
|
||||
prepare_core_2d_depth_textures.in_set(RenderSet::PrepareResources),
|
||||
sort_phase_system::<Transparent2d>.in_set(RenderSystems::PhaseSort),
|
||||
prepare_core_2d_depth_textures.in_set(RenderSystems::PrepareResources),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -106,7 +106,7 @@ use bevy_render::{
|
||||
sync_world::{MainEntity, RenderEntity},
|
||||
texture::{ColorAttachment, TextureCache},
|
||||
view::{ExtractedView, ViewDepthTexture, ViewTarget},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use nonmax::NonMaxU32;
|
||||
use tracing::warn;
|
||||
@ -167,14 +167,14 @@ impl Plugin for Core3dPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
sort_phase_system::<Transmissive3d>.in_set(RenderSet::PhaseSort),
|
||||
sort_phase_system::<Transparent3d>.in_set(RenderSet::PhaseSort),
|
||||
sort_phase_system::<Transmissive3d>.in_set(RenderSystems::PhaseSort),
|
||||
sort_phase_system::<Transparent3d>.in_set(RenderSystems::PhaseSort),
|
||||
configure_occlusion_culling_view_targets
|
||||
.after(prepare_view_targets)
|
||||
.in_set(RenderSet::ManageViews),
|
||||
prepare_core_3d_depth_textures.in_set(RenderSet::PrepareResources),
|
||||
prepare_core_3d_transmission_textures.in_set(RenderSet::PrepareResources),
|
||||
prepare_prepass_textures.in_set(RenderSet::PrepareResources),
|
||||
.in_set(RenderSystems::ManageViews),
|
||||
prepare_core_3d_depth_textures.in_set(RenderSystems::PrepareResources),
|
||||
prepare_core_3d_transmission_textures.in_set(RenderSystems::PrepareResources),
|
||||
prepare_prepass_textures.in_set(RenderSystems::PrepareResources),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -12,7 +12,7 @@ use bevy_render::{
|
||||
renderer::RenderDevice,
|
||||
texture::{CachedTexture, TextureCache},
|
||||
view::ViewTarget,
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
use bevy_ecs::query::QueryItem;
|
||||
@ -40,7 +40,7 @@ impl Plugin for CopyDeferredLightingIdPlugin {
|
||||
};
|
||||
render_app.add_systems(
|
||||
Render,
|
||||
(prepare_deferred_lighting_id_textures.in_set(RenderSet::PrepareResources),),
|
||||
(prepare_deferred_lighting_id_textures.in_set(RenderSystems::PrepareResources),),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ use bevy_render::{
|
||||
prepare_view_targets, ExtractedView, Msaa, ViewDepthTexture, ViewTarget, ViewUniform,
|
||||
ViewUniformOffset, ViewUniforms,
|
||||
},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_utils::{default, once};
|
||||
use smallvec::SmallVec;
|
||||
@ -229,7 +229,7 @@ impl Plugin for DepthOfFieldPlugin {
|
||||
prepare_auxiliary_depth_of_field_textures,
|
||||
)
|
||||
.after(prepare_view_targets)
|
||||
.in_set(RenderSet::ManageViews),
|
||||
.in_set(RenderSystems::ManageViews),
|
||||
)
|
||||
.add_systems(
|
||||
Render,
|
||||
@ -238,11 +238,11 @@ impl Plugin for DepthOfFieldPlugin {
|
||||
prepare_depth_of_field_pipelines,
|
||||
)
|
||||
.chain()
|
||||
.in_set(RenderSet::Prepare),
|
||||
.in_set(RenderSystems::Prepare),
|
||||
)
|
||||
.add_systems(
|
||||
Render,
|
||||
prepare_depth_of_field_global_bind_group.in_set(RenderSet::PrepareBindGroups),
|
||||
prepare_depth_of_field_global_bind_group.in_set(RenderSystems::PrepareBindGroups),
|
||||
)
|
||||
.add_render_graph_node::<ViewNodeRunner<DepthOfFieldNode>>(Core3d, Node3d::DepthOfField)
|
||||
.add_render_graph_edges(
|
||||
|
@ -44,7 +44,7 @@ use bevy_render::{
|
||||
renderer::{RenderContext, RenderDevice},
|
||||
texture::TextureCache,
|
||||
view::{ExtractedView, NoIndirectDrawing, ViewDepthTexture},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bitflags::bitflags;
|
||||
use tracing::debug;
|
||||
@ -103,7 +103,7 @@ impl Plugin for MipGenerationPlugin {
|
||||
)
|
||||
.add_systems(
|
||||
Render,
|
||||
create_downsample_depth_pipelines.in_set(RenderSet::Prepare),
|
||||
create_downsample_depth_pipelines.in_set(RenderSystems::Prepare),
|
||||
)
|
||||
.add_systems(
|
||||
Render,
|
||||
@ -112,7 +112,7 @@ impl Plugin for MipGenerationPlugin {
|
||||
prepare_downsample_depth_view_bind_groups,
|
||||
)
|
||||
.chain()
|
||||
.in_set(RenderSet::PrepareResources)
|
||||
.in_set(RenderSystems::PrepareResources)
|
||||
.run_if(resource_exists::<DownsampleDepthPipelines>)
|
||||
.after(prepare_core_3d_depth_textures),
|
||||
);
|
||||
|
@ -20,7 +20,7 @@ use bevy_render::{
|
||||
extract_component::{ExtractComponent, ExtractComponentPlugin, UniformComponentPlugin},
|
||||
render_graph::{RenderGraphApp, ViewNodeRunner},
|
||||
render_resource::{Shader, ShaderType, SpecializedRenderPipelines},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
pub mod node;
|
||||
@ -152,7 +152,7 @@ impl Plugin for MotionBlurPlugin {
|
||||
.init_resource::<SpecializedRenderPipelines<pipeline::MotionBlurPipeline>>()
|
||||
.add_systems(
|
||||
Render,
|
||||
pipeline::prepare_motion_blur_pipelines.in_set(RenderSet::Prepare),
|
||||
pipeline::prepare_motion_blur_pipelines.in_set(RenderSystems::Prepare),
|
||||
);
|
||||
|
||||
render_app
|
||||
|
@ -12,7 +12,7 @@ use bevy_render::{
|
||||
render_resource::*,
|
||||
renderer::RenderContext,
|
||||
view::{Msaa, ViewTarget},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
/// This enables "msaa writeback" support for the `core_2d` and `core_3d` pipelines, which can be enabled on cameras
|
||||
@ -26,7 +26,7 @@ impl Plugin for MsaaWritebackPlugin {
|
||||
};
|
||||
render_app.add_systems(
|
||||
Render,
|
||||
prepare_msaa_writeback_pipelines.in_set(RenderSet::Prepare),
|
||||
prepare_msaa_writeback_pipelines.in_set(RenderSystems::Prepare),
|
||||
);
|
||||
{
|
||||
render_app
|
||||
|
@ -16,7 +16,7 @@ use bevy_render::{
|
||||
},
|
||||
renderer::{RenderDevice, RenderQueue},
|
||||
view::Msaa,
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_window::PrimaryWindow;
|
||||
use resolve::{
|
||||
@ -126,7 +126,7 @@ impl Plugin for OrderIndependentTransparencyPlugin {
|
||||
|
||||
render_app.add_systems(
|
||||
Render,
|
||||
prepare_oit_buffers.in_set(RenderSet::PrepareResources),
|
||||
prepare_oit_buffers.in_set(RenderSystems::PrepareResources),
|
||||
);
|
||||
|
||||
render_app
|
||||
|
@ -20,7 +20,7 @@ use bevy_render::{
|
||||
},
|
||||
renderer::{RenderAdapter, RenderDevice},
|
||||
view::{ExtractedView, ViewTarget, ViewUniform, ViewUniforms},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use tracing::warn;
|
||||
|
||||
@ -65,8 +65,8 @@ impl Plugin for OitResolvePlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
queue_oit_resolve_pipeline.in_set(RenderSet::Queue),
|
||||
prepare_oit_resolve_bind_group.in_set(RenderSet::PrepareBindGroups),
|
||||
queue_oit_resolve_pipeline.in_set(RenderSystems::Queue),
|
||||
prepare_oit_resolve_bind_group.in_set(RenderSystems::PrepareBindGroups),
|
||||
),
|
||||
)
|
||||
.init_resource::<OitResolvePipeline>();
|
||||
|
@ -36,7 +36,7 @@ use bevy_render::{
|
||||
renderer::{RenderContext, RenderDevice, RenderQueue},
|
||||
texture::GpuImage,
|
||||
view::{ExtractedView, ViewTarget},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_utils::prelude::default;
|
||||
|
||||
@ -234,7 +234,7 @@ impl Plugin for PostProcessingPlugin {
|
||||
prepare_post_processing_pipelines,
|
||||
prepare_post_processing_uniforms,
|
||||
)
|
||||
.in_set(RenderSet::Prepare),
|
||||
.in_set(RenderSystems::Prepare),
|
||||
)
|
||||
.add_render_graph_node::<ViewNodeRunner<PostProcessingNode>>(
|
||||
Core3d,
|
||||
|
@ -25,7 +25,7 @@ use bevy_render::{
|
||||
renderer::RenderDevice,
|
||||
texture::GpuImage,
|
||||
view::{ExtractedView, Msaa, ViewTarget, ViewUniform, ViewUniforms},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_transform::components::Transform;
|
||||
use prepass::{SkyboxPrepassPipeline, SKYBOX_PREPASS_SHADER_HANDLE};
|
||||
@ -63,11 +63,11 @@ impl Plugin for SkyboxPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
prepare_skybox_pipelines.in_set(RenderSet::Prepare),
|
||||
prepass::prepare_skybox_prepass_pipelines.in_set(RenderSet::Prepare),
|
||||
prepare_skybox_bind_groups.in_set(RenderSet::PrepareBindGroups),
|
||||
prepare_skybox_pipelines.in_set(RenderSystems::Prepare),
|
||||
prepass::prepare_skybox_prepass_pipelines.in_set(RenderSystems::Prepare),
|
||||
prepare_skybox_bind_groups.in_set(RenderSystems::PrepareBindGroups),
|
||||
prepass::prepare_skybox_prepass_bind_groups
|
||||
.in_set(RenderSet::PrepareBindGroups),
|
||||
.in_set(RenderSystems::PrepareBindGroups),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ use bevy_render::{
|
||||
renderer::RenderDevice,
|
||||
texture::{FallbackImage, GpuImage},
|
||||
view::{ExtractedView, ViewTarget, ViewUniform},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bitflags::bitflags;
|
||||
#[cfg(not(feature = "tonemapping_luts"))]
|
||||
@ -118,7 +118,7 @@ impl Plugin for TonemappingPlugin {
|
||||
.init_resource::<SpecializedRenderPipelines<TonemappingPipeline>>()
|
||||
.add_systems(
|
||||
Render,
|
||||
prepare_view_tonemapping_pipelines.in_set(RenderSet::Prepare),
|
||||
prepare_view_tonemapping_pipelines.in_set(RenderSystems::Prepare),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ use bevy_render::{
|
||||
camera::{CameraOutputMode, ExtractedCamera},
|
||||
render_resource::*,
|
||||
view::ViewTarget,
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
mod node;
|
||||
@ -26,7 +26,7 @@ impl Plugin for UpscalingPlugin {
|
||||
// and aversion to extensive and intrusive system ordering.
|
||||
// See https://github.com/bevyengine/bevy/issues/14770 for more context.
|
||||
prepare_view_upscaling_pipelines
|
||||
.in_set(RenderSet::Prepare)
|
||||
.in_set(RenderSystems::Prepare)
|
||||
.ambiguous_with_all(),
|
||||
);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ impl Plugin for CiTestingPlugin {
|
||||
systems::send_events
|
||||
.before(trigger_screenshots)
|
||||
.before(bevy_window::close_when_requested)
|
||||
.in_set(SendEvents)
|
||||
.in_set(EventSenderSystems)
|
||||
.ambiguous_with_all(),
|
||||
);
|
||||
|
||||
@ -66,10 +66,10 @@ impl Plugin for CiTestingPlugin {
|
||||
#[cfg(any(unix, windows))]
|
||||
app.configure_sets(
|
||||
Update,
|
||||
SendEvents.before(bevy_app::TerminalCtrlCHandlerPlugin::exit_on_flag),
|
||||
EventSenderSystems.before(bevy_app::TerminalCtrlCHandlerPlugin::exit_on_flag),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
|
||||
struct SendEvents;
|
||||
struct EventSenderSystems;
|
||||
|
@ -8,7 +8,7 @@ use bevy_picking::backend::HitData;
|
||||
use bevy_picking::hover::HoverMap;
|
||||
use bevy_picking::pointer::{Location, PointerId, PointerPress};
|
||||
use bevy_picking::prelude::*;
|
||||
use bevy_picking::{pointer, PickSet};
|
||||
use bevy_picking::{pointer, PickingSystems};
|
||||
use bevy_reflect::prelude::*;
|
||||
use bevy_render::prelude::*;
|
||||
use bevy_text::prelude::*;
|
||||
@ -85,7 +85,7 @@ impl Plugin for DebugPickingPlugin {
|
||||
app.init_resource::<DebugPickingMode>()
|
||||
.add_systems(
|
||||
PreUpdate,
|
||||
pointer_debug_visibility.in_set(PickSet::PostHover),
|
||||
pointer_debug_visibility.in_set(PickingSystems::PostHover),
|
||||
)
|
||||
.add_systems(
|
||||
PreUpdate,
|
||||
@ -108,7 +108,7 @@ impl Plugin for DebugPickingPlugin {
|
||||
log_pointer_event_debug::<DragDrop>,
|
||||
)
|
||||
.distributive_run_if(DebugPickingMode::is_enabled)
|
||||
.in_set(PickSet::Last),
|
||||
.in_set(PickingSystems::Last),
|
||||
);
|
||||
|
||||
app.add_systems(
|
||||
@ -116,7 +116,7 @@ impl Plugin for DebugPickingPlugin {
|
||||
(add_pointer_debug, update_debug_data, debug_draw)
|
||||
.chain()
|
||||
.distributive_run_if(DebugPickingMode::is_enabled)
|
||||
.in_set(PickSet::Last),
|
||||
.in_set(PickingSystems::Last),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -29,11 +29,11 @@ fn main() {
|
||||
// Add systems to the Schedule to execute our app logic
|
||||
// We can label our systems to force a specific run-order between some of them
|
||||
schedule.add_systems((
|
||||
spawn_entities.in_set(SimulationSet::Spawn),
|
||||
print_counter_when_changed.after(SimulationSet::Spawn),
|
||||
age_all_entities.in_set(SimulationSet::Age),
|
||||
remove_old_entities.after(SimulationSet::Age),
|
||||
print_changed_entities.after(SimulationSet::Age),
|
||||
spawn_entities.in_set(SimulationSystems::Spawn),
|
||||
print_counter_when_changed.after(SimulationSystems::Spawn),
|
||||
age_all_entities.in_set(SimulationSystems::Age),
|
||||
remove_old_entities.after(SimulationSystems::Age),
|
||||
print_changed_entities.after(SimulationSystems::Age),
|
||||
));
|
||||
|
||||
// Simulate 10 frames in our world
|
||||
@ -57,7 +57,7 @@ struct Age {
|
||||
|
||||
// System sets can be used to group systems and configured to control relative ordering
|
||||
#[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
|
||||
enum SimulationSet {
|
||||
enum SimulationSystems {
|
||||
Spawn,
|
||||
Age,
|
||||
}
|
||||
|
@ -19,13 +19,13 @@ fn main() {
|
||||
// This update should happen before we use the events.
|
||||
// Here, we use system sets to control the ordering.
|
||||
#[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct FlushEvents;
|
||||
pub struct EventFlusherSystems;
|
||||
|
||||
schedule.add_systems(bevy_ecs::event::event_update_system.in_set(FlushEvents));
|
||||
schedule.add_systems(bevy_ecs::event::event_update_system.in_set(EventFlusherSystems));
|
||||
|
||||
// Add systems sending and receiving events after the events are flushed.
|
||||
schedule.add_systems((
|
||||
sending_system.after(FlushEvents),
|
||||
sending_system.after(EventFlusherSystems),
|
||||
receiving_system.after(sending_system),
|
||||
));
|
||||
|
||||
|
@ -24,8 +24,13 @@ pub use mut_iterators::{EventMutIterator, EventMutIteratorWithId};
|
||||
pub use mutator::EventMutator;
|
||||
pub use reader::EventReader;
|
||||
pub use registry::{EventRegistry, ShouldUpdateEvents};
|
||||
#[expect(
|
||||
deprecated,
|
||||
reason = "`EventUpdates` was renamed to `EventUpdateSystems`."
|
||||
)]
|
||||
pub use update::{
|
||||
event_update_condition, event_update_system, signal_event_update_system, EventUpdates,
|
||||
event_update_condition, event_update_system, signal_event_update_system, EventUpdateSystems,
|
||||
EventUpdates,
|
||||
};
|
||||
pub use writer::EventWriter;
|
||||
|
||||
|
@ -13,7 +13,11 @@ use super::registry::ShouldUpdateEvents;
|
||||
|
||||
#[doc(hidden)]
|
||||
#[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct EventUpdates;
|
||||
pub struct EventUpdateSystems;
|
||||
|
||||
/// Deprecated alias for [`EventUpdateSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `EventUpdateSystems`.")]
|
||||
pub type EventUpdates = EventUpdateSystems;
|
||||
|
||||
/// Signals the [`event_update_system`] to run after `FixedUpdate` systems.
|
||||
///
|
||||
|
@ -37,7 +37,7 @@ mod tests {
|
||||
};
|
||||
|
||||
#[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
enum TestSet {
|
||||
enum TestSystems {
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
@ -142,7 +142,7 @@ mod tests {
|
||||
make_function_system(1).before(named_system),
|
||||
make_function_system(0)
|
||||
.after(named_system)
|
||||
.in_set(TestSet::A),
|
||||
.in_set(TestSystems::A),
|
||||
));
|
||||
schedule.run(&mut world);
|
||||
|
||||
@ -153,12 +153,12 @@ mod tests {
|
||||
assert_eq!(world.resource::<SystemOrder>().0, vec![]);
|
||||
|
||||
// modify the schedule after it's been initialized and test ordering with sets
|
||||
schedule.configure_sets(TestSet::A.after(named_system));
|
||||
schedule.configure_sets(TestSystems::A.after(named_system));
|
||||
schedule.add_systems((
|
||||
make_function_system(3)
|
||||
.before(TestSet::A)
|
||||
.before(TestSystems::A)
|
||||
.after(named_system),
|
||||
make_function_system(4).after(TestSet::A),
|
||||
make_function_system(4).after(TestSystems::A),
|
||||
));
|
||||
schedule.run(&mut world);
|
||||
|
||||
@ -347,14 +347,14 @@ mod tests {
|
||||
|
||||
world.init_resource::<Counter>();
|
||||
|
||||
schedule.configure_sets(TestSet::A.run_if(|| false).run_if(|| false));
|
||||
schedule.add_systems(counting_system.in_set(TestSet::A));
|
||||
schedule.configure_sets(TestSet::B.run_if(|| true).run_if(|| false));
|
||||
schedule.add_systems(counting_system.in_set(TestSet::B));
|
||||
schedule.configure_sets(TestSet::C.run_if(|| false).run_if(|| true));
|
||||
schedule.add_systems(counting_system.in_set(TestSet::C));
|
||||
schedule.configure_sets(TestSet::D.run_if(|| true).run_if(|| true));
|
||||
schedule.add_systems(counting_system.in_set(TestSet::D));
|
||||
schedule.configure_sets(TestSystems::A.run_if(|| false).run_if(|| false));
|
||||
schedule.add_systems(counting_system.in_set(TestSystems::A));
|
||||
schedule.configure_sets(TestSystems::B.run_if(|| true).run_if(|| false));
|
||||
schedule.add_systems(counting_system.in_set(TestSystems::B));
|
||||
schedule.configure_sets(TestSystems::C.run_if(|| false).run_if(|| true));
|
||||
schedule.add_systems(counting_system.in_set(TestSystems::C));
|
||||
schedule.configure_sets(TestSystems::D.run_if(|| true).run_if(|| true));
|
||||
schedule.add_systems(counting_system.in_set(TestSystems::D));
|
||||
|
||||
schedule.run(&mut world);
|
||||
assert_eq!(world.resource::<Counter>().0.load(Ordering::Relaxed), 1);
|
||||
@ -367,14 +367,14 @@ mod tests {
|
||||
|
||||
world.init_resource::<Counter>();
|
||||
|
||||
schedule.configure_sets(TestSet::A.run_if(|| false));
|
||||
schedule.add_systems(counting_system.in_set(TestSet::A).run_if(|| false));
|
||||
schedule.configure_sets(TestSet::B.run_if(|| true));
|
||||
schedule.add_systems(counting_system.in_set(TestSet::B).run_if(|| false));
|
||||
schedule.configure_sets(TestSet::C.run_if(|| false));
|
||||
schedule.add_systems(counting_system.in_set(TestSet::C).run_if(|| true));
|
||||
schedule.configure_sets(TestSet::D.run_if(|| true));
|
||||
schedule.add_systems(counting_system.in_set(TestSet::D).run_if(|| true));
|
||||
schedule.configure_sets(TestSystems::A.run_if(|| false));
|
||||
schedule.add_systems(counting_system.in_set(TestSystems::A).run_if(|| false));
|
||||
schedule.configure_sets(TestSystems::B.run_if(|| true));
|
||||
schedule.add_systems(counting_system.in_set(TestSystems::B).run_if(|| false));
|
||||
schedule.configure_sets(TestSystems::C.run_if(|| false));
|
||||
schedule.add_systems(counting_system.in_set(TestSystems::C).run_if(|| true));
|
||||
schedule.configure_sets(TestSystems::D.run_if(|| true));
|
||||
schedule.add_systems(counting_system.in_set(TestSystems::D).run_if(|| true));
|
||||
|
||||
schedule.run(&mut world);
|
||||
assert_eq!(world.resource::<Counter>().0.load(Ordering::Relaxed), 1);
|
||||
@ -440,12 +440,12 @@ mod tests {
|
||||
let mut schedule = Schedule::default();
|
||||
|
||||
schedule.configure_sets(
|
||||
TestSet::A
|
||||
TestSystems::A
|
||||
.run_if(|res1: Res<RunConditionBool>| res1.is_changed())
|
||||
.run_if(|res2: Res<Bool2>| res2.is_changed()),
|
||||
);
|
||||
|
||||
schedule.add_systems(counting_system.in_set(TestSet::A));
|
||||
schedule.add_systems(counting_system.in_set(TestSystems::A));
|
||||
|
||||
// both resource were just added.
|
||||
schedule.run(&mut world);
|
||||
@ -489,13 +489,14 @@ mod tests {
|
||||
world.init_resource::<Bool2>();
|
||||
let mut schedule = Schedule::default();
|
||||
|
||||
schedule
|
||||
.configure_sets(TestSet::A.run_if(|res1: Res<RunConditionBool>| res1.is_changed()));
|
||||
schedule.configure_sets(
|
||||
TestSystems::A.run_if(|res1: Res<RunConditionBool>| res1.is_changed()),
|
||||
);
|
||||
|
||||
schedule.add_systems(
|
||||
counting_system
|
||||
.run_if(|res2: Res<Bool2>| res2.is_changed())
|
||||
.in_set(TestSet::A),
|
||||
.in_set(TestSystems::A),
|
||||
);
|
||||
|
||||
// both resource were just added.
|
||||
@ -537,7 +538,7 @@ mod tests {
|
||||
#[should_panic]
|
||||
fn dependency_loop() {
|
||||
let mut schedule = Schedule::default();
|
||||
schedule.configure_sets(TestSet::X.after(TestSet::X));
|
||||
schedule.configure_sets(TestSystems::X.after(TestSystems::X));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -545,8 +546,8 @@ mod tests {
|
||||
let mut world = World::new();
|
||||
let mut schedule = Schedule::default();
|
||||
|
||||
schedule.configure_sets(TestSet::A.after(TestSet::B));
|
||||
schedule.configure_sets(TestSet::B.after(TestSet::A));
|
||||
schedule.configure_sets(TestSystems::A.after(TestSystems::B));
|
||||
schedule.configure_sets(TestSystems::B.after(TestSystems::A));
|
||||
|
||||
let result = schedule.initialize(&mut world);
|
||||
assert!(matches!(
|
||||
@ -572,7 +573,7 @@ mod tests {
|
||||
#[should_panic]
|
||||
fn hierarchy_loop() {
|
||||
let mut schedule = Schedule::default();
|
||||
schedule.configure_sets(TestSet::X.in_set(TestSet::X));
|
||||
schedule.configure_sets(TestSystems::X.in_set(TestSystems::X));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -580,8 +581,8 @@ mod tests {
|
||||
let mut world = World::new();
|
||||
let mut schedule = Schedule::default();
|
||||
|
||||
schedule.configure_sets(TestSet::A.in_set(TestSet::B));
|
||||
schedule.configure_sets(TestSet::B.in_set(TestSet::A));
|
||||
schedule.configure_sets(TestSystems::A.in_set(TestSystems::B));
|
||||
schedule.configure_sets(TestSystems::B.in_set(TestSystems::A));
|
||||
|
||||
let result = schedule.initialize(&mut world);
|
||||
assert!(matches!(result, Err(ScheduleBuildError::HierarchyCycle(_))));
|
||||
@ -647,13 +648,13 @@ mod tests {
|
||||
});
|
||||
|
||||
// Add `A`.
|
||||
schedule.configure_sets(TestSet::A);
|
||||
schedule.configure_sets(TestSystems::A);
|
||||
|
||||
// Add `B` as child of `A`.
|
||||
schedule.configure_sets(TestSet::B.in_set(TestSet::A));
|
||||
schedule.configure_sets(TestSystems::B.in_set(TestSystems::A));
|
||||
|
||||
// Add `X` as child of both `A` and `B`.
|
||||
schedule.configure_sets(TestSet::X.in_set(TestSet::A).in_set(TestSet::B));
|
||||
schedule.configure_sets(TestSystems::X.in_set(TestSystems::A).in_set(TestSystems::B));
|
||||
|
||||
// `X` cannot be the `A`'s child and grandchild at the same time.
|
||||
let result = schedule.initialize(&mut world);
|
||||
@ -669,8 +670,8 @@ mod tests {
|
||||
let mut schedule = Schedule::default();
|
||||
|
||||
// Add `B` and give it both kinds of relationships with `A`.
|
||||
schedule.configure_sets(TestSet::B.in_set(TestSet::A));
|
||||
schedule.configure_sets(TestSet::B.after(TestSet::A));
|
||||
schedule.configure_sets(TestSystems::B.in_set(TestSystems::A));
|
||||
schedule.configure_sets(TestSystems::B.after(TestSystems::A));
|
||||
let result = schedule.initialize(&mut world);
|
||||
assert!(matches!(
|
||||
result,
|
||||
@ -686,13 +687,13 @@ mod tests {
|
||||
fn foo() {}
|
||||
|
||||
// Add `foo` to both `A` and `C`.
|
||||
schedule.add_systems(foo.in_set(TestSet::A).in_set(TestSet::C));
|
||||
schedule.add_systems(foo.in_set(TestSystems::A).in_set(TestSystems::C));
|
||||
|
||||
// Order `A -> B -> C`.
|
||||
schedule.configure_sets((
|
||||
TestSet::A,
|
||||
TestSet::B.after(TestSet::A),
|
||||
TestSet::C.after(TestSet::B),
|
||||
TestSystems::A,
|
||||
TestSystems::B.after(TestSystems::A),
|
||||
TestSystems::C.after(TestSystems::B),
|
||||
));
|
||||
|
||||
let result = schedule.initialize(&mut world);
|
||||
|
@ -23,7 +23,7 @@ use core::cell::RefCell;
|
||||
use bevy_app::{App, Plugin, PostUpdate, PreStartup, PreUpdate};
|
||||
use bevy_ecs::entity::EntityHashMap;
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_input::InputSystem;
|
||||
use bevy_input::InputSystems;
|
||||
use bevy_platform::collections::HashMap;
|
||||
use gilrs::GilrsBuilder;
|
||||
use gilrs_system::{gilrs_event_startup_system, gilrs_event_system};
|
||||
@ -84,7 +84,11 @@ pub struct GilrsPlugin;
|
||||
|
||||
/// Updates the running gamepad rumble effects.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash, SystemSet)]
|
||||
pub struct RumbleSystem;
|
||||
pub struct RumbleSystems;
|
||||
|
||||
/// Deprecated alias for [`RumbleSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `RumbleSystems`.")]
|
||||
pub type RumbleSystem = RumbleSystems;
|
||||
|
||||
impl Plugin for GilrsPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
@ -106,8 +110,8 @@ impl Plugin for GilrsPlugin {
|
||||
app.init_resource::<GilrsGamepads>();
|
||||
app.init_resource::<RunningRumbleEffects>()
|
||||
.add_systems(PreStartup, gilrs_event_startup_system)
|
||||
.add_systems(PreUpdate, gilrs_event_system.before(InputSystem))
|
||||
.add_systems(PostUpdate, play_gilrs_rumble.in_set(RumbleSystem));
|
||||
.add_systems(PreUpdate, gilrs_event_system.before(InputSystems))
|
||||
.add_systems(PostUpdate, play_gilrs_rumble.in_set(RumbleSystems));
|
||||
}
|
||||
Err(err) => error!("Failed to start Gilrs. {}", err),
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||
use bevy_render::primitives::Aabb;
|
||||
use bevy_transform::{
|
||||
components::{GlobalTransform, Transform},
|
||||
TransformSystem,
|
||||
TransformSystems,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@ -39,7 +39,7 @@ impl Plugin for AabbGizmoPlugin {
|
||||
}),
|
||||
)
|
||||
.after(bevy_render::view::VisibilitySystems::CalculateBounds)
|
||||
.after(TransformSystem::TransformPropagate),
|
||||
.after(TransformSystems::Propagate),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ pub struct Swap<Clear>(PhantomData<Clear>);
|
||||
/// .add_systems(EndOfMyContext, end_gizmo_context::<DefaultGizmoConfigGroup, MyContext>)
|
||||
/// .add_systems(
|
||||
/// Last,
|
||||
/// propagate_gizmos::<DefaultGizmoConfigGroup, MyContext>.before(UpdateGizmoMeshes),
|
||||
/// propagate_gizmos::<DefaultGizmoConfigGroup, MyContext>.before(GizmoMeshSystems),
|
||||
/// );
|
||||
/// }
|
||||
/// }
|
||||
|
@ -24,7 +24,7 @@ extern crate self as bevy_gizmos;
|
||||
|
||||
/// System set label for the systems handling the rendering of gizmos.
|
||||
#[derive(SystemSet, Clone, Debug, Hash, PartialEq, Eq)]
|
||||
pub enum GizmoRenderSystem {
|
||||
pub enum GizmoRenderSystems {
|
||||
/// Adds gizmos to the [`Transparent2d`](bevy_core_pipeline::core_2d::Transparent2d) render phase
|
||||
#[cfg(feature = "bevy_sprite")]
|
||||
QueueLineGizmos2d,
|
||||
@ -33,6 +33,10 @@ pub enum GizmoRenderSystem {
|
||||
QueueLineGizmos3d,
|
||||
}
|
||||
|
||||
/// Deprecated alias for [`GizmoRenderSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `GizmoRenderSystems`.")]
|
||||
pub type GizmoRenderSystem = GizmoRenderSystems;
|
||||
|
||||
#[cfg(feature = "bevy_render")]
|
||||
pub mod aabb;
|
||||
pub mod arcs;
|
||||
@ -120,7 +124,7 @@ use {
|
||||
},
|
||||
renderer::RenderDevice,
|
||||
sync_world::{MainEntity, TemporaryRenderEntity},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
},
|
||||
bytemuck::cast_slice,
|
||||
};
|
||||
@ -185,7 +189,7 @@ impl Plugin for GizmoPlugin {
|
||||
if let Some(render_app) = app.get_sub_app_mut(RenderApp) {
|
||||
render_app.add_systems(
|
||||
Render,
|
||||
prepare_line_gizmo_bind_group.in_set(RenderSet::PrepareBindGroups),
|
||||
prepare_line_gizmo_bind_group.in_set(RenderSystems::PrepareBindGroups),
|
||||
);
|
||||
|
||||
render_app.add_systems(ExtractSchedule, (extract_gizmo_data, extract_linegizmos));
|
||||
@ -268,20 +272,20 @@ impl AppGizmoBuilder for App {
|
||||
.add_systems(
|
||||
RunFixedMainLoop,
|
||||
start_gizmo_context::<Config, Fixed>
|
||||
.in_set(bevy_app::RunFixedMainLoopSystem::BeforeFixedMainLoop),
|
||||
.in_set(bevy_app::RunFixedMainLoopSystems::BeforeFixedMainLoop),
|
||||
)
|
||||
.add_systems(FixedFirst, clear_gizmo_context::<Config, Fixed>)
|
||||
.add_systems(FixedLast, collect_requested_gizmos::<Config, Fixed>)
|
||||
.add_systems(
|
||||
RunFixedMainLoop,
|
||||
end_gizmo_context::<Config, Fixed>
|
||||
.in_set(bevy_app::RunFixedMainLoopSystem::AfterFixedMainLoop),
|
||||
.in_set(bevy_app::RunFixedMainLoopSystems::AfterFixedMainLoop),
|
||||
)
|
||||
.add_systems(
|
||||
Last,
|
||||
(
|
||||
propagate_gizmos::<Config, Fixed>.before(UpdateGizmoMeshes),
|
||||
update_gizmo_meshes::<Config>.in_set(UpdateGizmoMeshes),
|
||||
propagate_gizmos::<Config, Fixed>.before(GizmoMeshSystems),
|
||||
update_gizmo_meshes::<Config>.in_set(GizmoMeshSystems),
|
||||
),
|
||||
);
|
||||
|
||||
@ -332,7 +336,7 @@ pub fn start_gizmo_context<Config, Clear>(
|
||||
///
|
||||
/// Pop the default gizmos context out of the [`Swap<Clear>`] gizmo storage.
|
||||
///
|
||||
/// This must be called before [`UpdateGizmoMeshes`] in the [`Last`] schedule.
|
||||
/// This must be called before [`GizmoMeshSystems`] in the [`Last`] schedule.
|
||||
pub fn end_gizmo_context<Config, Clear>(
|
||||
mut swap: ResMut<GizmoStorage<Config, Swap<Clear>>>,
|
||||
mut default: ResMut<GizmoStorage<Config, ()>>,
|
||||
@ -367,7 +371,7 @@ where
|
||||
|
||||
/// Propagate the contextual gizmo into the `Update` storage for rendering.
|
||||
///
|
||||
/// This should be before [`UpdateGizmoMeshes`].
|
||||
/// This should be before [`GizmoMeshSystems`].
|
||||
pub fn propagate_gizmos<Config, Clear>(
|
||||
mut update_storage: ResMut<GizmoStorage<Config, ()>>,
|
||||
contextual_storage: Res<GizmoStorage<Config, Clear>>,
|
||||
@ -380,7 +384,11 @@ pub fn propagate_gizmos<Config, Clear>(
|
||||
|
||||
/// System set for updating the rendering meshes for drawing gizmos.
|
||||
#[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct UpdateGizmoMeshes;
|
||||
pub struct GizmoMeshSystems;
|
||||
|
||||
/// Deprecated alias for [`GizmoMeshSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `GizmoMeshSystems`.")]
|
||||
pub type UpdateGizmoMeshes = GizmoMeshSystems;
|
||||
|
||||
/// Prepare gizmos for rendering.
|
||||
///
|
||||
|
@ -24,7 +24,7 @@ use bevy_math::{
|
||||
};
|
||||
use bevy_pbr::{DirectionalLight, PointLight, SpotLight};
|
||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||
use bevy_transform::{components::GlobalTransform, TransformSystem};
|
||||
use bevy_transform::{components::GlobalTransform, TransformSystems};
|
||||
|
||||
use crate::{
|
||||
config::{GizmoConfigGroup, GizmoConfigStore},
|
||||
@ -126,7 +126,7 @@ impl Plugin for LightGizmoPlugin {
|
||||
config.config::<LightGizmoConfigGroup>().1.draw_all
|
||||
}),
|
||||
)
|
||||
.after(TransformSystem::TransformPropagate),
|
||||
.after(TransformSystems::Propagate),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
config::{GizmoLineJoint, GizmoLineStyle, GizmoMeshConfig},
|
||||
line_gizmo_vertex_buffer_layouts, line_joint_gizmo_vertex_buffer_layouts, DrawLineGizmo,
|
||||
DrawLineJointGizmo, GizmoRenderSystem, GpuLineGizmo, LineGizmoUniformBindgroupLayout,
|
||||
DrawLineJointGizmo, GizmoRenderSystems, GpuLineGizmo, LineGizmoUniformBindgroupLayout,
|
||||
SetLineGizmoBindGroup, LINE_JOINT_SHADER_HANDLE, LINE_SHADER_HANDLE,
|
||||
};
|
||||
use bevy_app::{App, Plugin};
|
||||
@ -25,7 +25,7 @@ use bevy_render::{
|
||||
},
|
||||
render_resource::*,
|
||||
view::{ExtractedView, Msaa, RenderLayers, ViewTarget},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_sprite::{Mesh2dPipeline, Mesh2dPipelineKey, SetMesh2dViewBindGroup};
|
||||
use tracing::error;
|
||||
@ -46,8 +46,8 @@ impl Plugin for LineGizmo2dPlugin {
|
||||
.init_resource::<SpecializedRenderPipelines<LineJointGizmoPipeline>>()
|
||||
.configure_sets(
|
||||
Render,
|
||||
GizmoRenderSystem::QueueLineGizmos2d
|
||||
.in_set(RenderSet::Queue)
|
||||
GizmoRenderSystems::QueueLineGizmos2d
|
||||
.in_set(RenderSystems::Queue)
|
||||
.ambiguous_with(bevy_sprite::queue_sprites)
|
||||
.ambiguous_with(
|
||||
bevy_sprite::queue_material2d_meshes::<bevy_sprite::ColorMaterial>,
|
||||
@ -56,7 +56,7 @@ impl Plugin for LineGizmo2dPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(queue_line_gizmos_2d, queue_line_joint_gizmos_2d)
|
||||
.in_set(GizmoRenderSystem::QueueLineGizmos2d)
|
||||
.in_set(GizmoRenderSystems::QueueLineGizmos2d)
|
||||
.after(prepare_assets::<GpuLineGizmo>),
|
||||
);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
config::{GizmoLineJoint, GizmoLineStyle, GizmoMeshConfig},
|
||||
line_gizmo_vertex_buffer_layouts, line_joint_gizmo_vertex_buffer_layouts, DrawLineGizmo,
|
||||
DrawLineJointGizmo, GizmoRenderSystem, GpuLineGizmo, LineGizmoUniformBindgroupLayout,
|
||||
DrawLineJointGizmo, GizmoRenderSystems, GpuLineGizmo, LineGizmoUniformBindgroupLayout,
|
||||
SetLineGizmoBindGroup, LINE_JOINT_SHADER_HANDLE, LINE_SHADER_HANDLE,
|
||||
};
|
||||
use bevy_app::{App, Plugin};
|
||||
@ -30,7 +30,7 @@ use bevy_render::{
|
||||
},
|
||||
render_resource::*,
|
||||
view::{ExtractedView, Msaa, RenderLayers, ViewTarget},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use tracing::error;
|
||||
|
||||
@ -49,14 +49,14 @@ impl Plugin for LineGizmo3dPlugin {
|
||||
.init_resource::<SpecializedRenderPipelines<LineJointGizmoPipeline>>()
|
||||
.configure_sets(
|
||||
Render,
|
||||
GizmoRenderSystem::QueueLineGizmos3d
|
||||
.in_set(RenderSet::Queue)
|
||||
GizmoRenderSystems::QueueLineGizmos3d
|
||||
.in_set(RenderSystems::Queue)
|
||||
.ambiguous_with(bevy_pbr::queue_material_meshes::<bevy_pbr::StandardMaterial>),
|
||||
)
|
||||
.add_systems(
|
||||
Render,
|
||||
(queue_line_gizmos_3d, queue_line_joint_gizmos_3d)
|
||||
.in_set(GizmoRenderSystem::QueueLineGizmos3d)
|
||||
.in_set(GizmoRenderSystems::QueueLineGizmos3d)
|
||||
.after(prepare_assets::<GpuLineGizmo>),
|
||||
);
|
||||
}
|
||||
|
@ -76,7 +76,11 @@ pub struct InputPlugin;
|
||||
|
||||
/// Label for systems that update the input data.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash, SystemSet)]
|
||||
pub struct InputSystem;
|
||||
pub struct InputSystems;
|
||||
|
||||
/// Deprecated alias for [`InputSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `InputSystems`.")]
|
||||
pub type InputSystem = InputSystems;
|
||||
|
||||
impl Plugin for InputPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
@ -85,7 +89,7 @@ impl Plugin for InputPlugin {
|
||||
.add_event::<KeyboardInput>()
|
||||
.add_event::<KeyboardFocusLost>()
|
||||
.init_resource::<ButtonInput<KeyCode>>()
|
||||
.add_systems(PreUpdate, keyboard_input_system.in_set(InputSystem))
|
||||
.add_systems(PreUpdate, keyboard_input_system.in_set(InputSystems))
|
||||
// mouse
|
||||
.add_event::<MouseButtonInput>()
|
||||
.add_event::<MouseMotion>()
|
||||
@ -98,7 +102,7 @@ impl Plugin for InputPlugin {
|
||||
accumulate_mouse_motion_system,
|
||||
accumulate_mouse_scroll_system,
|
||||
)
|
||||
.in_set(InputSystem),
|
||||
.in_set(InputSystems),
|
||||
)
|
||||
.add_event::<PinchGesture>()
|
||||
.add_event::<RotationGesture>()
|
||||
@ -122,12 +126,12 @@ impl Plugin for InputPlugin {
|
||||
gamepad_connection_system,
|
||||
gamepad_event_processing_system.after(gamepad_connection_system),
|
||||
)
|
||||
.in_set(InputSystem),
|
||||
.in_set(InputSystems),
|
||||
)
|
||||
// touch
|
||||
.add_event::<TouchInput>()
|
||||
.init_resource::<Touches>()
|
||||
.add_systems(PreUpdate, touch_screen_input_system.in_set(InputSystem));
|
||||
.add_systems(PreUpdate, touch_screen_input_system.in_set(InputSystems));
|
||||
|
||||
#[cfg(feature = "bevy_reflect")]
|
||||
{
|
||||
|
@ -136,7 +136,7 @@ pub struct InputFocusVisible(pub bool);
|
||||
/// If no entity has input focus, then the event is dispatched to the main window.
|
||||
///
|
||||
/// To set up your own bubbling input event, add the [`dispatch_focused_input::<MyEvent>`](dispatch_focused_input) system to your app,
|
||||
/// in the [`InputFocusSet::Dispatch`] system set during [`PreUpdate`].
|
||||
/// in the [`InputFocusSystems::Dispatch`] system set during [`PreUpdate`].
|
||||
#[derive(Clone, Debug, Component)]
|
||||
#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Component, Clone))]
|
||||
pub struct FocusedInput<E: Event + Clone> {
|
||||
@ -195,7 +195,7 @@ impl Plugin for InputDispatchPlugin {
|
||||
dispatch_focused_input::<GamepadButtonChangedEvent>,
|
||||
dispatch_focused_input::<MouseWheel>,
|
||||
)
|
||||
.in_set(InputFocusSet::Dispatch),
|
||||
.in_set(InputFocusSystems::Dispatch),
|
||||
);
|
||||
|
||||
#[cfg(feature = "bevy_reflect")]
|
||||
@ -209,11 +209,15 @@ impl Plugin for InputDispatchPlugin {
|
||||
///
|
||||
/// These systems run in the [`PreUpdate`] schedule.
|
||||
#[derive(SystemSet, Debug, PartialEq, Eq, Hash, Clone)]
|
||||
pub enum InputFocusSet {
|
||||
pub enum InputFocusSystems {
|
||||
/// System which dispatches bubbled input events to the focused entity, or to the primary window.
|
||||
Dispatch,
|
||||
}
|
||||
|
||||
/// Deprecated alias for [`InputFocusSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `InputFocusSystems`.")]
|
||||
pub type InputFocusSet = InputFocusSystems;
|
||||
|
||||
/// Sets the initial focus to the primary window, if any.
|
||||
pub fn set_initial_focus(
|
||||
mut input_focus: ResMut<InputFocus>,
|
||||
|
@ -56,7 +56,7 @@ use bevy_render::{
|
||||
render_graph::{RenderGraphApp, ViewNodeRunner},
|
||||
render_resource::{Shader, TextureFormat, TextureUsages},
|
||||
renderer::RenderAdapter,
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
use bevy_core_pipeline::core_3d::{graph::Core3d, Camera3d};
|
||||
@ -190,11 +190,11 @@ impl Plugin for AtmospherePlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
configure_camera_depth_usages.in_set(RenderSet::ManageViews),
|
||||
queue_render_sky_pipelines.in_set(RenderSet::Queue),
|
||||
prepare_atmosphere_textures.in_set(RenderSet::PrepareResources),
|
||||
prepare_atmosphere_transforms.in_set(RenderSet::PrepareResources),
|
||||
prepare_atmosphere_bind_groups.in_set(RenderSet::PrepareBindGroups),
|
||||
configure_camera_depth_usages.in_set(RenderSystems::ManageViews),
|
||||
queue_render_sky_pipelines.in_set(RenderSystems::Queue),
|
||||
prepare_atmosphere_textures.in_set(RenderSystems::PrepareResources),
|
||||
prepare_atmosphere_transforms.in_set(RenderSystems::PrepareResources),
|
||||
prepare_atmosphere_bind_groups.in_set(RenderSystems::PrepareBindGroups),
|
||||
),
|
||||
)
|
||||
.add_render_graph_node::<ViewNodeRunner<AtmosphereLutsNode>>(
|
||||
|
@ -43,7 +43,7 @@ use bevy_render::{
|
||||
sync_world::RenderEntity,
|
||||
texture::{FallbackImage, GpuImage},
|
||||
view::{self, ViewVisibility, Visibility, VisibilityClass},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_transform::{components::GlobalTransform, prelude::Transform};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
@ -173,10 +173,13 @@ impl Plugin for ClusteredDecalPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
prepare_decals
|
||||
.in_set(RenderSet::ManageViews)
|
||||
.in_set(RenderSystems::ManageViews)
|
||||
.after(prepare_lights),
|
||||
)
|
||||
.add_systems(Render, upload_decals.in_set(RenderSet::PrepareResources));
|
||||
.add_systems(
|
||||
Render,
|
||||
upload_decals.in_set(RenderSystems::PrepareResources),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ use bevy_render::{
|
||||
render_resource::{binding_types::uniform_buffer, *},
|
||||
renderer::{RenderContext, RenderDevice},
|
||||
view::{ExtractedView, ViewTarget, ViewUniformOffset},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
pub struct DeferredPbrLightingPlugin;
|
||||
@ -115,7 +115,7 @@ impl Plugin for DeferredPbrLightingPlugin {
|
||||
.init_resource::<SpecializedRenderPipelines<DeferredLightingLayout>>()
|
||||
.add_systems(
|
||||
Render,
|
||||
(prepare_deferred_lighting_pipelines.in_set(RenderSet::Prepare),),
|
||||
(prepare_deferred_lighting_pipelines.in_set(RenderSystems::Prepare),),
|
||||
)
|
||||
.add_render_graph_node::<ViewNodeRunner<DeferredOpaquePass3dPbrLightingNode>>(
|
||||
Core3d,
|
||||
|
@ -130,17 +130,17 @@ use bevy_ecs::prelude::*;
|
||||
use bevy_image::Image;
|
||||
use bevy_render::{
|
||||
alpha::AlphaMode,
|
||||
camera::{sort_cameras, CameraUpdateSystem, Projection},
|
||||
camera::{sort_cameras, CameraUpdateSystems, Projection},
|
||||
extract_component::ExtractComponentPlugin,
|
||||
extract_resource::ExtractResourcePlugin,
|
||||
render_graph::RenderGraph,
|
||||
render_resource::Shader,
|
||||
sync_component::SyncComponentPlugin,
|
||||
view::VisibilitySystems,
|
||||
ExtractSchedule, Render, RenderApp, RenderDebugFlags, RenderSet,
|
||||
ExtractSchedule, Render, RenderApp, RenderDebugFlags, RenderSystems,
|
||||
};
|
||||
|
||||
use bevy_transform::TransformSystem;
|
||||
use bevy_transform::TransformSystems;
|
||||
|
||||
pub const PBR_TYPES_SHADER_HANDLE: Handle<Shader> =
|
||||
weak_handle!("b0330585-2335-4268-9032-a6c4c2d932f6");
|
||||
@ -401,21 +401,21 @@ impl Plugin for PbrPlugin {
|
||||
(
|
||||
add_clusters
|
||||
.in_set(SimulationLightSystems::AddClusters)
|
||||
.after(CameraUpdateSystem),
|
||||
.after(CameraUpdateSystems),
|
||||
assign_objects_to_clusters
|
||||
.in_set(SimulationLightSystems::AssignLightsToClusters)
|
||||
.after(TransformSystem::TransformPropagate)
|
||||
.after(TransformSystems::Propagate)
|
||||
.after(VisibilitySystems::CheckVisibility)
|
||||
.after(CameraUpdateSystem),
|
||||
.after(CameraUpdateSystems),
|
||||
clear_directional_light_cascades
|
||||
.in_set(SimulationLightSystems::UpdateDirectionalLightCascades)
|
||||
.after(TransformSystem::TransformPropagate)
|
||||
.after(CameraUpdateSystem),
|
||||
.after(TransformSystems::Propagate)
|
||||
.after(CameraUpdateSystems),
|
||||
update_directional_light_frusta
|
||||
.in_set(SimulationLightSystems::UpdateLightFrusta)
|
||||
// This must run after CheckVisibility because it relies on `ViewVisibility`
|
||||
.after(VisibilitySystems::CheckVisibility)
|
||||
.after(TransformSystem::TransformPropagate)
|
||||
.after(TransformSystems::Propagate)
|
||||
.after(SimulationLightSystems::UpdateDirectionalLightCascades)
|
||||
// We assume that no entity will be both a directional light and a spot light,
|
||||
// so these systems will run independently of one another.
|
||||
@ -423,11 +423,11 @@ impl Plugin for PbrPlugin {
|
||||
.ambiguous_with(update_spot_light_frusta),
|
||||
update_point_light_frusta
|
||||
.in_set(SimulationLightSystems::UpdateLightFrusta)
|
||||
.after(TransformSystem::TransformPropagate)
|
||||
.after(TransformSystems::Propagate)
|
||||
.after(SimulationLightSystems::AssignLightsToClusters),
|
||||
update_spot_light_frusta
|
||||
.in_set(SimulationLightSystems::UpdateLightFrusta)
|
||||
.after(TransformSystem::TransformPropagate)
|
||||
.after(TransformSystems::Propagate)
|
||||
.after(SimulationLightSystems::AssignLightsToClusters),
|
||||
(
|
||||
check_dir_light_mesh_visibility,
|
||||
@ -435,7 +435,7 @@ impl Plugin for PbrPlugin {
|
||||
)
|
||||
.in_set(SimulationLightSystems::CheckLightVisibility)
|
||||
.after(VisibilitySystems::CalculateBounds)
|
||||
.after(TransformSystem::TransformPropagate)
|
||||
.after(TransformSystems::Propagate)
|
||||
.after(SimulationLightSystems::UpdateLightFrusta)
|
||||
// NOTE: This MUST be scheduled AFTER the core renderer visibility check
|
||||
// because that resets entity `ViewVisibility` for the first view
|
||||
@ -478,9 +478,9 @@ impl Plugin for PbrPlugin {
|
||||
Render,
|
||||
(
|
||||
prepare_lights
|
||||
.in_set(RenderSet::ManageViews)
|
||||
.in_set(RenderSystems::ManageViews)
|
||||
.after(sort_cameras),
|
||||
prepare_clusters.in_set(RenderSet::PrepareResources),
|
||||
prepare_clusters.in_set(RenderSystems::PrepareResources),
|
||||
),
|
||||
)
|
||||
.init_resource::<LightMeta>()
|
||||
|
@ -27,7 +27,7 @@ use bevy_render::{
|
||||
sync_world::RenderEntity,
|
||||
texture::{FallbackImage, GpuImage},
|
||||
view::{ExtractedView, Visibility},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_transform::{components::Transform, prelude::GlobalTransform};
|
||||
use tracing::error;
|
||||
@ -383,7 +383,7 @@ impl Plugin for LightProbePlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(upload_light_probes, prepare_environment_uniform_buffer)
|
||||
.in_set(RenderSet::PrepareResources),
|
||||
.in_set(RenderSystems::PrepareResources),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ use fixedbitset::FixedBitSet;
|
||||
use nonmax::{NonMaxU16, NonMaxU32};
|
||||
use tracing::error;
|
||||
|
||||
use crate::{binding_arrays_are_usable, ExtractMeshesSet};
|
||||
use crate::{binding_arrays_are_usable, MeshExtractionSystems};
|
||||
|
||||
/// The ID of the lightmap shader.
|
||||
pub const LIGHTMAP_SHADER_HANDLE: Handle<Shader> =
|
||||
@ -201,9 +201,10 @@ impl Plugin for LightmapPlugin {
|
||||
return;
|
||||
};
|
||||
|
||||
render_app
|
||||
.init_resource::<RenderLightmaps>()
|
||||
.add_systems(ExtractSchedule, extract_lightmaps.after(ExtractMeshesSet));
|
||||
render_app.init_resource::<RenderLightmaps>().add_systems(
|
||||
ExtractSchedule,
|
||||
extract_lightmaps.after(MeshExtractionSystems),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ use crate::meshlet::{
|
||||
};
|
||||
use crate::*;
|
||||
use bevy_asset::prelude::AssetChanged;
|
||||
use bevy_asset::{Asset, AssetEvents, AssetId, AssetServer, UntypedAssetId};
|
||||
use bevy_asset::{Asset, AssetEventSystems, AssetId, AssetServer, UntypedAssetId};
|
||||
use bevy_core_pipeline::deferred::{AlphaMask3dDeferred, Opaque3dDeferred};
|
||||
use bevy_core_pipeline::prepass::{AlphaMask3dPrepass, Opaque3dPrepass};
|
||||
use bevy_core_pipeline::{
|
||||
@ -288,7 +288,7 @@ where
|
||||
PostUpdate,
|
||||
(
|
||||
mark_meshes_as_changed_if_their_materials_changed::<M>.ambiguous_with_all(),
|
||||
check_entities_needing_specialization::<M>.after(AssetEvents),
|
||||
check_entities_needing_specialization::<M>.after(AssetEventSystems),
|
||||
)
|
||||
.after(mark_3d_meshes_as_changed_if_their_assets_changed),
|
||||
);
|
||||
@ -316,9 +316,9 @@ where
|
||||
.add_systems(
|
||||
ExtractSchedule,
|
||||
(
|
||||
extract_mesh_materials::<M>.in_set(ExtractMaterialsSet),
|
||||
extract_mesh_materials::<M>.in_set(MaterialExtractionSystems),
|
||||
early_sweep_material_instances::<M>
|
||||
.after(ExtractMaterialsSet)
|
||||
.after(MaterialExtractionSystems)
|
||||
.before(late_sweep_material_instances),
|
||||
extract_entities_needs_specialization::<M>.after(extract_cameras),
|
||||
),
|
||||
@ -327,13 +327,13 @@ where
|
||||
Render,
|
||||
(
|
||||
specialize_material_meshes::<M>
|
||||
.in_set(RenderSet::PrepareMeshes)
|
||||
.in_set(RenderSystems::PrepareMeshes)
|
||||
.after(prepare_assets::<PreparedMaterial<M>>)
|
||||
.after(prepare_assets::<RenderMesh>)
|
||||
.after(collect_meshes_for_gpu_building)
|
||||
.after(set_mesh_motion_vector_flags),
|
||||
queue_material_meshes::<M>
|
||||
.in_set(RenderSet::QueueMeshes)
|
||||
.in_set(RenderSystems::QueueMeshes)
|
||||
.after(prepare_assets::<PreparedMaterial<M>>),
|
||||
),
|
||||
)
|
||||
@ -344,7 +344,7 @@ where
|
||||
write_material_bind_group_buffers::<M>,
|
||||
)
|
||||
.chain()
|
||||
.in_set(RenderSet::PrepareBindGroups)
|
||||
.in_set(RenderSystems::PrepareBindGroups)
|
||||
.after(prepare_assets::<PreparedMaterial<M>>),
|
||||
);
|
||||
|
||||
@ -356,14 +356,15 @@ where
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
check_views_lights_need_specialization.in_set(RenderSet::PrepareAssets),
|
||||
check_views_lights_need_specialization
|
||||
.in_set(RenderSystems::PrepareAssets),
|
||||
// specialize_shadows::<M> also needs to run after prepare_assets::<PreparedMaterial<M>>,
|
||||
// which is fine since ManageViews is after PrepareAssets
|
||||
specialize_shadows::<M>
|
||||
.in_set(RenderSet::ManageViews)
|
||||
.in_set(RenderSystems::ManageViews)
|
||||
.after(prepare_lights),
|
||||
queue_shadows::<M>
|
||||
.in_set(RenderSet::QueueMeshes)
|
||||
.in_set(RenderSystems::QueueMeshes)
|
||||
.after(prepare_assets::<PreparedMaterial<M>>),
|
||||
),
|
||||
);
|
||||
@ -373,7 +374,7 @@ where
|
||||
render_app.add_systems(
|
||||
Render,
|
||||
queue_material_meshlet_meshes::<M>
|
||||
.in_set(RenderSet::QueueMeshes)
|
||||
.in_set(RenderSystems::QueueMeshes)
|
||||
.run_if(resource_exists::<InstanceManager>),
|
||||
);
|
||||
|
||||
@ -381,7 +382,7 @@ where
|
||||
render_app.add_systems(
|
||||
Render,
|
||||
prepare_material_meshlet_meshes_main_opaque_pass::<M>
|
||||
.in_set(RenderSet::QueueMeshes)
|
||||
.in_set(RenderSystems::QueueMeshes)
|
||||
.after(prepare_assets::<PreparedMaterial<M>>)
|
||||
.before(queue_material_meshlet_meshes::<M>)
|
||||
.run_if(resource_exists::<InstanceManager>),
|
||||
@ -637,7 +638,11 @@ pub struct RenderMaterialInstance {
|
||||
|
||||
/// A [`SystemSet`] that contains all `extract_mesh_materials` systems.
|
||||
#[derive(SystemSet, Clone, PartialEq, Eq, Debug, Hash)]
|
||||
pub struct ExtractMaterialsSet;
|
||||
pub struct MaterialExtractionSystems;
|
||||
|
||||
/// Deprecated alias for [`MaterialExtractionSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `MaterialExtractionSystems`.")]
|
||||
pub type ExtractMaterialsSet = MaterialExtractionSystems;
|
||||
|
||||
pub const fn alpha_mode_pipeline_key(alpha_mode: AlphaMode, msaa: &Msaa) -> MeshPipelineKey {
|
||||
match alpha_mode {
|
||||
|
@ -79,7 +79,7 @@ use bevy_render::{
|
||||
renderer::RenderDevice,
|
||||
settings::WgpuFeatures,
|
||||
view::{self, prepare_view_targets, Msaa, Visibility, VisibilityClass},
|
||||
ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_transform::components::Transform;
|
||||
use derive_more::From;
|
||||
@ -277,12 +277,12 @@ impl Plugin for MeshletPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
perform_pending_meshlet_mesh_writes.in_set(RenderSet::PrepareAssets),
|
||||
perform_pending_meshlet_mesh_writes.in_set(RenderSystems::PrepareAssets),
|
||||
configure_meshlet_views
|
||||
.after(prepare_view_targets)
|
||||
.in_set(RenderSet::ManageViews),
|
||||
prepare_meshlet_per_frame_resources.in_set(RenderSet::PrepareResources),
|
||||
prepare_meshlet_view_bind_groups.in_set(RenderSet::PrepareBindGroups),
|
||||
.in_set(RenderSystems::ManageViews),
|
||||
prepare_meshlet_per_frame_resources.in_set(RenderSystems::PrepareResources),
|
||||
prepare_meshlet_view_bind_groups.in_set(RenderSystems::PrepareBindGroups),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ use bevy_render::{
|
||||
renderer::RenderAdapter,
|
||||
sync_world::RenderEntity,
|
||||
view::{RenderVisibilityRanges, RetainedViewEntity, VISIBILITY_RANGES_STORAGE_BUFFER_COUNT},
|
||||
ExtractSchedule, Render, RenderApp, RenderDebugFlags, RenderSet,
|
||||
ExtractSchedule, Render, RenderApp, RenderDebugFlags, RenderSystems,
|
||||
};
|
||||
pub use prepass_bindings::*;
|
||||
|
||||
@ -60,7 +60,7 @@ use bevy_ecs::system::SystemChangeTick;
|
||||
use bevy_platform::collections::HashMap;
|
||||
use bevy_render::sync_world::MainEntityHashMap;
|
||||
use bevy_render::view::RenderVisibleEntities;
|
||||
use bevy_render::RenderSet::{PrepareAssets, PrepareResources};
|
||||
use bevy_render::RenderSystems::{PrepareAssets, PrepareResources};
|
||||
use core::{hash::Hash, marker::PhantomData};
|
||||
|
||||
pub const PREPASS_SHADER_HANDLE: Handle<Shader> =
|
||||
@ -126,7 +126,7 @@ where
|
||||
render_app
|
||||
.add_systems(
|
||||
Render,
|
||||
prepare_prepass_view_bind_group::<M>.in_set(RenderSet::PrepareBindGroups),
|
||||
prepare_prepass_view_bind_group::<M>.in_set(RenderSystems::PrepareBindGroups),
|
||||
)
|
||||
.init_resource::<PrepassViewBindGroup>()
|
||||
.init_resource::<SpecializedMeshPipelines<PrepassPipeline<M>>>()
|
||||
@ -216,13 +216,13 @@ where
|
||||
(
|
||||
check_prepass_views_need_specialization.in_set(PrepareAssets),
|
||||
specialize_prepass_material_meshes::<M>
|
||||
.in_set(RenderSet::PrepareMeshes)
|
||||
.in_set(RenderSystems::PrepareMeshes)
|
||||
.after(prepare_assets::<PreparedMaterial<M>>)
|
||||
.after(prepare_assets::<RenderMesh>)
|
||||
.after(collect_meshes_for_gpu_building)
|
||||
.after(set_mesh_motion_vector_flags),
|
||||
queue_prepass_material_meshes::<M>
|
||||
.in_set(RenderSet::QueueMeshes)
|
||||
.in_set(RenderSystems::QueueMeshes)
|
||||
.after(prepare_assets::<PreparedMaterial<M>>)
|
||||
// queue_material_meshes only writes to `material_bind_group_id`, which `queue_prepass_material_meshes` doesn't read
|
||||
.ambiguous_with(queue_material_meshes::<StandardMaterial>),
|
||||
@ -233,7 +233,7 @@ where
|
||||
render_app.add_systems(
|
||||
Render,
|
||||
prepare_material_meshlet_meshes_prepass::<M>
|
||||
.in_set(RenderSet::QueueMeshes)
|
||||
.in_set(RenderSystems::QueueMeshes)
|
||||
.after(prepare_assets::<PreparedMaterial<M>>)
|
||||
.before(queue_material_meshlet_meshes::<M>)
|
||||
.run_if(resource_exists::<InstanceManager>),
|
||||
|
@ -8,7 +8,7 @@ use bevy_render::{
|
||||
render_resource::{DynamicUniformBuffer, Shader, ShaderType},
|
||||
renderer::{RenderDevice, RenderQueue},
|
||||
view::ExtractedView,
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
use crate::{DistanceFog, FogFalloff};
|
||||
@ -142,7 +142,7 @@ impl Plugin for FogPlugin {
|
||||
if let Some(render_app) = app.get_sub_app_mut(RenderApp) {
|
||||
render_app
|
||||
.init_resource::<FogMeta>()
|
||||
.add_systems(Render, prepare_fog.in_set(RenderSet::PrepareResources));
|
||||
.add_systems(Render, prepare_fog.in_set(RenderSystems::PrepareResources));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ use bevy_render::{
|
||||
renderer::{RenderContext, RenderDevice, RenderQueue},
|
||||
settings::WgpuFeatures,
|
||||
view::{ExtractedView, NoIndirectDrawing, ViewUniform, ViewUniformOffset, ViewUniforms},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_utils::TypeIdMap;
|
||||
use bitflags::bitflags;
|
||||
@ -471,14 +471,14 @@ impl Plugin for GpuMeshPreprocessPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
prepare_preprocess_pipelines.in_set(RenderSet::Prepare),
|
||||
prepare_preprocess_pipelines.in_set(RenderSystems::Prepare),
|
||||
prepare_preprocess_bind_groups
|
||||
.run_if(resource_exists::<BatchedInstanceBuffers<
|
||||
MeshUniform,
|
||||
MeshInputUniform
|
||||
>>)
|
||||
.in_set(RenderSet::PrepareBindGroups),
|
||||
write_mesh_culling_data_buffer.in_set(RenderSet::PrepareResourcesFlush),
|
||||
.in_set(RenderSystems::PrepareBindGroups),
|
||||
write_mesh_culling_data_buffer.in_set(RenderSystems::PrepareResourcesFlush),
|
||||
),
|
||||
)
|
||||
.add_render_graph_node::<ClearIndirectParametersMetadataNode>(
|
||||
|
@ -74,7 +74,7 @@ use bevy_render::camera::TemporalJitter;
|
||||
use bevy_render::prelude::Msaa;
|
||||
use bevy_render::sync_world::{MainEntity, MainEntityHashMap};
|
||||
use bevy_render::view::ExtractedView;
|
||||
use bevy_render::RenderSet::PrepareAssets;
|
||||
use bevy_render::RenderSystems::PrepareAssets;
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use nonmax::{NonMaxU16, NonMaxU32};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
@ -196,7 +196,7 @@ impl Plugin for MeshRenderPlugin {
|
||||
.init_resource::<RenderMaterialInstances>()
|
||||
.configure_sets(
|
||||
ExtractSchedule,
|
||||
ExtractMeshesSet
|
||||
MeshExtractionSystems
|
||||
.after(view::extract_visibility_ranges)
|
||||
.after(late_sweep_material_instances),
|
||||
)
|
||||
@ -206,22 +206,22 @@ impl Plugin for MeshRenderPlugin {
|
||||
extract_skins,
|
||||
extract_morphs,
|
||||
gpu_preprocessing::clear_batched_gpu_instance_buffers::<MeshPipeline>
|
||||
.before(ExtractMeshesSet),
|
||||
.before(MeshExtractionSystems),
|
||||
),
|
||||
)
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
set_mesh_motion_vector_flags.in_set(RenderSet::PrepareMeshes),
|
||||
prepare_skins.in_set(RenderSet::PrepareResources),
|
||||
prepare_morphs.in_set(RenderSet::PrepareResources),
|
||||
prepare_mesh_bind_groups.in_set(RenderSet::PrepareBindGroups),
|
||||
set_mesh_motion_vector_flags.in_set(RenderSystems::PrepareMeshes),
|
||||
prepare_skins.in_set(RenderSystems::PrepareResources),
|
||||
prepare_morphs.in_set(RenderSystems::PrepareResources),
|
||||
prepare_mesh_bind_groups.in_set(RenderSystems::PrepareBindGroups),
|
||||
prepare_mesh_view_bind_groups
|
||||
.in_set(RenderSet::PrepareBindGroups)
|
||||
.in_set(RenderSystems::PrepareBindGroups)
|
||||
.after(prepare_oit_buffers),
|
||||
no_gpu_preprocessing::clear_batched_cpu_instance_buffers::<MeshPipeline>
|
||||
.in_set(RenderSet::Cleanup)
|
||||
.after(RenderSet::Render),
|
||||
.in_set(RenderSystems::Cleanup)
|
||||
.after(RenderSystems::Render),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -259,17 +259,17 @@ impl Plugin for MeshRenderPlugin {
|
||||
.init_resource::<MeshesToReextractNextFrame>()
|
||||
.add_systems(
|
||||
ExtractSchedule,
|
||||
extract_meshes_for_gpu_building.in_set(ExtractMeshesSet),
|
||||
extract_meshes_for_gpu_building.in_set(MeshExtractionSystems),
|
||||
)
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
gpu_preprocessing::write_batched_instance_buffers::<MeshPipeline>
|
||||
.in_set(RenderSet::PrepareResourcesFlush),
|
||||
.in_set(RenderSystems::PrepareResourcesFlush),
|
||||
gpu_preprocessing::delete_old_work_item_buffers::<MeshPipeline>
|
||||
.in_set(RenderSet::PrepareResources),
|
||||
.in_set(RenderSystems::PrepareResources),
|
||||
collect_meshes_for_gpu_building
|
||||
.in_set(RenderSet::PrepareMeshes)
|
||||
.in_set(RenderSystems::PrepareMeshes)
|
||||
// This must be before
|
||||
// `set_mesh_motion_vector_flags` so it doesn't
|
||||
// overwrite those flags.
|
||||
@ -284,12 +284,12 @@ impl Plugin for MeshRenderPlugin {
|
||||
.insert_resource(cpu_batched_instance_buffer)
|
||||
.add_systems(
|
||||
ExtractSchedule,
|
||||
extract_meshes_for_cpu_building.in_set(ExtractMeshesSet),
|
||||
extract_meshes_for_cpu_building.in_set(MeshExtractionSystems),
|
||||
)
|
||||
.add_systems(
|
||||
Render,
|
||||
no_gpu_preprocessing::write_batched_instance_buffer::<MeshPipeline>
|
||||
.in_set(RenderSet::PrepareResourcesFlush),
|
||||
.in_set(RenderSystems::PrepareResourcesFlush),
|
||||
);
|
||||
};
|
||||
|
||||
@ -1296,7 +1296,11 @@ pub struct RenderMeshQueueData<'a> {
|
||||
/// A [`SystemSet`] that encompasses both [`extract_meshes_for_cpu_building`]
|
||||
/// and [`extract_meshes_for_gpu_building`].
|
||||
#[derive(SystemSet, Clone, PartialEq, Eq, Debug, Hash)]
|
||||
pub struct ExtractMeshesSet;
|
||||
pub struct MeshExtractionSystems;
|
||||
|
||||
/// Deprecated alias for [`MeshExtractionSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `MeshExtractionSystems`.")]
|
||||
pub type ExtractMeshesSet = MeshExtractionSystems;
|
||||
|
||||
/// Extracts meshes from the main world into the render world, populating the
|
||||
/// [`RenderMeshInstances`].
|
||||
|
@ -33,7 +33,7 @@ use bevy_render::{
|
||||
sync_world::RenderEntity,
|
||||
texture::{CachedTexture, TextureCache},
|
||||
view::{Msaa, ViewUniform, ViewUniformOffset, ViewUniforms},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_utils::prelude::default;
|
||||
use core::mem;
|
||||
@ -111,9 +111,9 @@ impl Plugin for ScreenSpaceAmbientOcclusionPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
prepare_ssao_pipelines.in_set(RenderSet::Prepare),
|
||||
prepare_ssao_textures.in_set(RenderSet::PrepareResources),
|
||||
prepare_ssao_bind_groups.in_set(RenderSet::PrepareBindGroups),
|
||||
prepare_ssao_pipelines.in_set(RenderSystems::Prepare),
|
||||
prepare_ssao_textures.in_set(RenderSystems::PrepareResources),
|
||||
prepare_ssao_bind_groups.in_set(RenderSystems::PrepareBindGroups),
|
||||
),
|
||||
)
|
||||
.add_render_graph_node::<ViewNodeRunner<SsaoNode>>(
|
||||
|
@ -37,7 +37,7 @@ use bevy_render::{
|
||||
},
|
||||
renderer::{RenderAdapter, RenderContext, RenderDevice, RenderQueue},
|
||||
view::{ExtractedView, Msaa, ViewTarget, ViewUniformOffset},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_utils::{once, prelude::default};
|
||||
use tracing::info;
|
||||
@ -196,10 +196,10 @@ impl Plugin for ScreenSpaceReflectionsPlugin {
|
||||
|
||||
render_app
|
||||
.init_resource::<ScreenSpaceReflectionsBuffer>()
|
||||
.add_systems(Render, prepare_ssr_pipelines.in_set(RenderSet::Prepare))
|
||||
.add_systems(Render, prepare_ssr_pipelines.in_set(RenderSystems::Prepare))
|
||||
.add_systems(
|
||||
Render,
|
||||
prepare_ssr_settings.in_set(RenderSet::PrepareResources),
|
||||
prepare_ssr_settings.in_set(RenderSystems::PrepareResources),
|
||||
)
|
||||
.add_render_graph_node::<ViewNodeRunner<ScreenSpaceReflectionsNode>>(
|
||||
Core3d,
|
||||
|
@ -51,7 +51,7 @@ use bevy_render::{
|
||||
render_resource::{Shader, SpecializedRenderPipelines},
|
||||
sync_component::SyncComponentPlugin,
|
||||
view::Visibility,
|
||||
ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_transform::components::Transform;
|
||||
use render::{
|
||||
@ -216,10 +216,10 @@ impl Plugin for VolumetricFogPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
render::prepare_volumetric_fog_pipelines.in_set(RenderSet::Prepare),
|
||||
render::prepare_volumetric_fog_uniforms.in_set(RenderSet::Prepare),
|
||||
render::prepare_volumetric_fog_pipelines.in_set(RenderSystems::Prepare),
|
||||
render::prepare_volumetric_fog_uniforms.in_set(RenderSystems::Prepare),
|
||||
render::prepare_view_depth_textures_for_volumetric_fog
|
||||
.in_set(RenderSet::Prepare)
|
||||
.in_set(RenderSystems::Prepare)
|
||||
.before(prepare_core_3d_depth_textures),
|
||||
),
|
||||
);
|
||||
|
@ -5,7 +5,7 @@ use crate::{
|
||||
use bevy_app::{App, Plugin, PostUpdate, Startup, Update};
|
||||
use bevy_asset::{
|
||||
load_internal_asset, prelude::AssetChanged, weak_handle, AsAssetId, Asset, AssetApp,
|
||||
AssetEvents, AssetId, Assets, Handle, UntypedAssetId,
|
||||
AssetEventSystems, AssetId, Assets, Handle, UntypedAssetId,
|
||||
};
|
||||
use bevy_color::{Color, ColorToComponents};
|
||||
use bevy_core_pipeline::core_3d::{
|
||||
@ -51,7 +51,7 @@ use bevy_render::{
|
||||
ExtractedView, NoIndirectDrawing, RenderVisibilityRanges, RenderVisibleEntities,
|
||||
RetainedViewEntity, ViewDepthTexture, ViewTarget,
|
||||
},
|
||||
Extract, Render, RenderApp, RenderDebugFlags, RenderSet,
|
||||
Extract, Render, RenderApp, RenderDebugFlags, RenderSystems,
|
||||
};
|
||||
use core::{hash::Hash, ops::Range};
|
||||
use tracing::error;
|
||||
@ -115,7 +115,7 @@ impl Plugin for WireframePlugin {
|
||||
.add_systems(
|
||||
PostUpdate,
|
||||
check_wireframe_entities_needing_specialization
|
||||
.after(AssetEvents)
|
||||
.after(AssetEventSystems)
|
||||
.run_if(resource_exists::<WireframeConfig>),
|
||||
);
|
||||
|
||||
@ -151,11 +151,11 @@ impl Plugin for WireframePlugin {
|
||||
Render,
|
||||
(
|
||||
specialize_wireframes
|
||||
.in_set(RenderSet::PrepareMeshes)
|
||||
.in_set(RenderSystems::PrepareMeshes)
|
||||
.after(prepare_assets::<RenderWireframeMaterial>)
|
||||
.after(prepare_assets::<RenderMesh>),
|
||||
queue_wireframes
|
||||
.in_set(RenderSet::QueueMeshes)
|
||||
.in_set(RenderSystems::QueueMeshes)
|
||||
.after(prepare_assets::<RenderWireframeMaterial>),
|
||||
),
|
||||
);
|
||||
|
@ -42,7 +42,7 @@ pub mod prelude {
|
||||
pub use super::{ray::RayMap, HitData, PointerHits};
|
||||
pub use crate::{
|
||||
pointer::{PointerId, PointerLocation},
|
||||
PickSet, Pickable,
|
||||
Pickable, PickingSystems,
|
||||
};
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ pub mod prelude {
|
||||
///
|
||||
/// Note that systems reading these events in [`PreUpdate`](bevy_app::PreUpdate) will not report ordering
|
||||
/// ambiguities with picking backends. Take care to ensure such systems are explicitly ordered
|
||||
/// against [`PickSet::Backend`](crate::PickSet::Backend), or better, avoid reading `PointerHits` in `PreUpdate`.
|
||||
/// against [`PickingSystems::Backend`](crate::PickingSystems::Backend), or better, avoid reading `PointerHits` in `PreUpdate`.
|
||||
#[derive(Event, Debug, Clone, Reflect)]
|
||||
#[reflect(Debug, Clone)]
|
||||
pub struct PointerHits {
|
||||
|
@ -23,7 +23,7 @@
|
||||
//!
|
||||
//! The order in which interaction events are received is extremely important, and you can read more
|
||||
//! about it on the docs for the dispatcher system: [`pointer_events`]. This system runs in
|
||||
//! [`PreUpdate`](bevy_app::PreUpdate) in [`PickSet::Hover`](crate::PickSet::Hover). All pointer-event
|
||||
//! [`PreUpdate`](bevy_app::PreUpdate) in [`PickingSystems::Hover`](crate::PickingSystems::Hover). All pointer-event
|
||||
//! observers resolve during the sync point between [`pointer_events`] and
|
||||
//! [`update_interactions`](crate::hover::update_interactions).
|
||||
//!
|
||||
|
@ -30,7 +30,7 @@ use crate::pointer::{
|
||||
Location, PointerAction, PointerButton, PointerId, PointerInput, PointerLocation,
|
||||
};
|
||||
|
||||
use crate::PickSet;
|
||||
use crate::PickingSystems;
|
||||
|
||||
/// The picking input prelude.
|
||||
///
|
||||
@ -86,7 +86,7 @@ impl Plugin for PointerInputPlugin {
|
||||
touch_pick_events.run_if(PointerInputPlugin::is_touch_enabled),
|
||||
)
|
||||
.chain()
|
||||
.in_set(PickSet::Input),
|
||||
.in_set(PickingSystems::Input),
|
||||
)
|
||||
.add_systems(
|
||||
Last,
|
||||
|
@ -256,7 +256,7 @@ impl Default for Pickable {
|
||||
|
||||
/// Groups the stages of the picking process under shared labels.
|
||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
|
||||
pub enum PickSet {
|
||||
pub enum PickingSystems {
|
||||
/// Produces pointer input events. In the [`First`] schedule.
|
||||
Input,
|
||||
/// Runs after input events are generated but before commands are flushed. In the [`First`]
|
||||
@ -269,13 +269,17 @@ pub enum PickSet {
|
||||
/// Reads [`backend::PointerHits`]s, and updates the hovermap, selection, and highlighting states. In
|
||||
/// the [`PreUpdate`] schedule.
|
||||
Hover,
|
||||
/// Runs after all the [`PickSet::Hover`] systems are done, before event listeners are triggered. In the
|
||||
/// Runs after all the [`PickingSystems::Hover`] systems are done, before event listeners are triggered. In the
|
||||
/// [`PreUpdate`] schedule.
|
||||
PostHover,
|
||||
/// Runs after all other picking sets. In the [`PreUpdate`] schedule.
|
||||
Last,
|
||||
}
|
||||
|
||||
/// Deprecated alias for [`PickingSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `PickingSystems`.")]
|
||||
pub type PickSet = PickingSystems;
|
||||
|
||||
/// One plugin that contains the [`PointerInputPlugin`](input::PointerInputPlugin), [`PickingPlugin`]
|
||||
/// and the [`InteractionPlugin`], this is probably the plugin that will be most used.
|
||||
///
|
||||
@ -359,29 +363,29 @@ impl Plugin for PickingPlugin {
|
||||
pointer::PointerInput::receive,
|
||||
backend::ray::RayMap::repopulate.after(pointer::PointerInput::receive),
|
||||
)
|
||||
.in_set(PickSet::ProcessInput),
|
||||
.in_set(PickingSystems::ProcessInput),
|
||||
)
|
||||
.add_systems(
|
||||
PreUpdate,
|
||||
window::update_window_hits
|
||||
.run_if(Self::window_picking_should_run)
|
||||
.in_set(PickSet::Backend),
|
||||
.in_set(PickingSystems::Backend),
|
||||
)
|
||||
.configure_sets(
|
||||
First,
|
||||
(PickSet::Input, PickSet::PostInput)
|
||||
.after(bevy_time::TimeSystem)
|
||||
.after(bevy_ecs::event::EventUpdates)
|
||||
(PickingSystems::Input, PickingSystems::PostInput)
|
||||
.after(bevy_time::TimeSystems)
|
||||
.after(bevy_ecs::event::EventUpdateSystems)
|
||||
.chain(),
|
||||
)
|
||||
.configure_sets(
|
||||
PreUpdate,
|
||||
(
|
||||
PickSet::ProcessInput.run_if(Self::input_should_run),
|
||||
PickSet::Backend,
|
||||
PickSet::Hover.run_if(Self::hover_should_run),
|
||||
PickSet::PostHover,
|
||||
PickSet::Last,
|
||||
PickingSystems::ProcessInput.run_if(Self::input_should_run),
|
||||
PickingSystems::Backend,
|
||||
PickingSystems::Hover.run_if(Self::hover_should_run),
|
||||
PickingSystems::PostHover,
|
||||
PickingSystems::Last,
|
||||
)
|
||||
.chain(),
|
||||
)
|
||||
@ -427,7 +431,7 @@ impl Plugin for InteractionPlugin {
|
||||
PreUpdate,
|
||||
(generate_hovermap, update_interactions, pointer_events)
|
||||
.chain()
|
||||
.in_set(PickSet::Hover),
|
||||
.in_set(PickingSystems::Hover),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ pub mod ray_cast;
|
||||
use crate::{
|
||||
backend::{ray::RayMap, HitData, PointerHits},
|
||||
prelude::*,
|
||||
PickSet,
|
||||
PickingSystems,
|
||||
};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::prelude::*;
|
||||
@ -71,7 +71,7 @@ impl Plugin for MeshPickingPlugin {
|
||||
app.init_resource::<MeshPickingSettings>()
|
||||
.register_type::<MeshPickingSettings>()
|
||||
.register_type::<SimplifiedMesh>()
|
||||
.add_systems(PreUpdate, update_hits.in_set(PickSet::Backend));
|
||||
.add_systems(PreUpdate, update_hits.in_set(PickingSystems::Backend));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -543,15 +543,15 @@ impl Plugin for RemotePlugin {
|
||||
.add_systems(PreStartup, setup_mailbox_channel)
|
||||
.configure_sets(
|
||||
RemoteLast,
|
||||
(RemoteSet::ProcessRequests, RemoteSet::Cleanup).chain(),
|
||||
(RemoteSystems::ProcessRequests, RemoteSystems::Cleanup).chain(),
|
||||
)
|
||||
.add_systems(
|
||||
RemoteLast,
|
||||
(
|
||||
(process_remote_requests, process_ongoing_watching_requests)
|
||||
.chain()
|
||||
.in_set(RemoteSet::ProcessRequests),
|
||||
remove_closed_watching_requests.in_set(RemoteSet::Cleanup),
|
||||
.in_set(RemoteSystems::ProcessRequests),
|
||||
remove_closed_watching_requests.in_set(RemoteSystems::Cleanup),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -565,13 +565,17 @@ pub struct RemoteLast;
|
||||
///
|
||||
/// These can be useful for ordering.
|
||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
|
||||
pub enum RemoteSet {
|
||||
pub enum RemoteSystems {
|
||||
/// Processing of remote requests.
|
||||
ProcessRequests,
|
||||
/// Cleanup (remove closed watchers etc)
|
||||
Cleanup,
|
||||
}
|
||||
|
||||
/// Deprecated alias for [`RemoteSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `RemoteSystems`.")]
|
||||
pub type RemoteSet = RemoteSystems;
|
||||
|
||||
/// A type to hold the allowed types of systems to be used as method handlers.
|
||||
#[derive(Debug)]
|
||||
pub enum RemoteMethodHandler {
|
||||
|
@ -36,7 +36,7 @@ use crate::{
|
||||
renderer::{RenderAdapter, RenderDevice, RenderQueue},
|
||||
sync_world::MainEntity,
|
||||
view::{ExtractedView, NoIndirectDrawing, RetainedViewEntity},
|
||||
Render, RenderApp, RenderDebugFlags, RenderSet,
|
||||
Render, RenderApp, RenderDebugFlags, RenderSystems,
|
||||
};
|
||||
|
||||
use super::{BatchMeta, GetBatchData, GetFullBatchData};
|
||||
@ -60,11 +60,11 @@ impl Plugin for BatchingPlugin {
|
||||
))
|
||||
.add_systems(
|
||||
Render,
|
||||
write_indirect_parameters_buffers.in_set(RenderSet::PrepareResourcesFlush),
|
||||
write_indirect_parameters_buffers.in_set(RenderSystems::PrepareResourcesFlush),
|
||||
)
|
||||
.add_systems(
|
||||
Render,
|
||||
clear_indirect_parameters_buffers.in_set(RenderSet::ManageViews),
|
||||
clear_indirect_parameters_buffers.in_set(RenderSystems::ManageViews),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ pub use projection::*;
|
||||
|
||||
use crate::{
|
||||
extract_component::ExtractComponentPlugin, extract_resource::ExtractResourcePlugin,
|
||||
render_graph::RenderGraph, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
render_graph::RenderGraph, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_app::{App, Plugin};
|
||||
use bevy_ecs::schedule::IntoScheduleConfigs;
|
||||
@ -42,7 +42,7 @@ impl Plugin for CameraPlugin {
|
||||
render_app
|
||||
.init_resource::<SortedCameras>()
|
||||
.add_systems(ExtractSchedule, extract_cameras)
|
||||
.add_systems(Render, sort_cameras.in_set(RenderSet::ManageViews));
|
||||
.add_systems(Render, sort_cameras.in_set(RenderSystems::ManageViews));
|
||||
let camera_driver_node = CameraDriverNode::new(render_app.world_mut());
|
||||
let mut render_graph = render_app.world_mut().resource_mut::<RenderGraph>();
|
||||
render_graph.add_node(crate::graph::CameraDriverLabel, camera_driver_node);
|
||||
|
@ -2,12 +2,12 @@ use core::fmt::Debug;
|
||||
|
||||
use crate::{primitives::Frustum, view::VisibilitySystems};
|
||||
use bevy_app::{App, Plugin, PostStartup, PostUpdate};
|
||||
use bevy_asset::AssetEvents;
|
||||
use bevy_asset::AssetEventSystems;
|
||||
use bevy_derive::{Deref, DerefMut};
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_math::{ops, AspectRatio, Mat4, Rect, Vec2, Vec3A, Vec4};
|
||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect, ReflectDeserialize, ReflectSerialize};
|
||||
use bevy_transform::{components::GlobalTransform, TransformSystem};
|
||||
use bevy_transform::{components::GlobalTransform, TransformSystems};
|
||||
use derive_more::derive::From;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -25,18 +25,18 @@ impl Plugin for CameraProjectionPlugin {
|
||||
.register_type::<CustomProjection>()
|
||||
.add_systems(
|
||||
PostStartup,
|
||||
crate::camera::camera_system.in_set(CameraUpdateSystem),
|
||||
crate::camera::camera_system.in_set(CameraUpdateSystems),
|
||||
)
|
||||
.add_systems(
|
||||
PostUpdate,
|
||||
(
|
||||
crate::camera::camera_system
|
||||
.in_set(CameraUpdateSystem)
|
||||
.before(AssetEvents),
|
||||
.in_set(CameraUpdateSystems)
|
||||
.before(AssetEventSystems),
|
||||
crate::view::update_frusta
|
||||
.in_set(VisibilitySystems::UpdateFrusta)
|
||||
.after(crate::camera::camera_system)
|
||||
.after(TransformSystem::TransformPropagate),
|
||||
.after(TransformSystems::Propagate),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -46,7 +46,11 @@ impl Plugin for CameraProjectionPlugin {
|
||||
///
|
||||
/// [`camera_system<T>`]: crate::camera::camera_system
|
||||
#[derive(SystemSet, Clone, Eq, PartialEq, Hash, Debug)]
|
||||
pub struct CameraUpdateSystem;
|
||||
pub struct CameraUpdateSystems;
|
||||
|
||||
/// Deprecated alias for [`CameraUpdateSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `CameraUpdateSystems`.")]
|
||||
pub type CameraUpdateSystem = CameraUpdateSystems;
|
||||
|
||||
/// Describes a type that can generate a projection matrix, allowing it to be added to a
|
||||
/// [`Camera`]'s [`Projection`] component.
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
sync_component::SyncComponentPlugin,
|
||||
sync_world::RenderEntity,
|
||||
view::ViewVisibility,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_app::{App, Plugin};
|
||||
use bevy_ecs::{
|
||||
@ -70,7 +70,7 @@ pub trait ExtractComponent: Component {
|
||||
/// For referencing the newly created uniforms a [`DynamicUniformIndex`] is inserted
|
||||
/// for every processed entity.
|
||||
///
|
||||
/// Therefore it sets up the [`RenderSet::Prepare`] step
|
||||
/// Therefore it sets up the [`RenderSystems::Prepare`] step
|
||||
/// for the specified [`ExtractComponent`].
|
||||
pub struct UniformComponentPlugin<C>(PhantomData<fn() -> C>);
|
||||
|
||||
@ -87,7 +87,7 @@ impl<C: Component + ShaderType + WriteInto + Clone> Plugin for UniformComponentP
|
||||
.insert_resource(ComponentUniforms::<C>::default())
|
||||
.add_systems(
|
||||
Render,
|
||||
prepare_uniform_components::<C>.in_set(RenderSet::PrepareResources),
|
||||
prepare_uniform_components::<C>.in_set(RenderSystems::PrepareResources),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ use crate::{
|
||||
prelude::Shader,
|
||||
render_resource::{ShaderType, UniformBuffer},
|
||||
renderer::{RenderDevice, RenderQueue},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_app::{App, Plugin};
|
||||
use bevy_asset::{load_internal_asset, weak_handle, Handle};
|
||||
@ -29,7 +29,7 @@ impl Plugin for GlobalsPlugin {
|
||||
.add_systems(ExtractSchedule, (extract_frame_count, extract_time))
|
||||
.add_systems(
|
||||
Render,
|
||||
prepare_globals_buffer.in_set(RenderSet::PrepareResources),
|
||||
prepare_globals_buffer.in_set(RenderSystems::PrepareResources),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
render_resource::{GpuArrayBuffer, GpuArrayBufferable},
|
||||
renderer::{RenderDevice, RenderQueue},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_app::{App, Plugin};
|
||||
use bevy_ecs::{
|
||||
@ -20,7 +20,7 @@ impl<C: Component + GpuArrayBufferable> Plugin for GpuComponentArrayBufferPlugin
|
||||
if let Some(render_app) = app.get_sub_app_mut(RenderApp) {
|
||||
render_app.add_systems(
|
||||
Render,
|
||||
prepare_gpu_component_array_buffers::<C>.in_set(RenderSet::PrepareResources),
|
||||
prepare_gpu_component_array_buffers::<C>.in_set(RenderSystems::PrepareResources),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
storage::{GpuShaderStorageBuffer, ShaderStorageBuffer},
|
||||
sync_world::MainEntity,
|
||||
texture::GpuImage,
|
||||
ExtractSchedule, MainWorld, Render, RenderApp, RenderSet,
|
||||
ExtractSchedule, MainWorld, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use async_channel::{Receiver, Sender};
|
||||
use bevy_app::{App, Plugin};
|
||||
@ -60,8 +60,10 @@ impl Plugin for GpuReadbackPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
prepare_buffers.in_set(RenderSet::PrepareResources),
|
||||
map_buffers.after(render_system).in_set(RenderSet::Render),
|
||||
prepare_buffers.in_set(RenderSystems::PrepareResources),
|
||||
map_buffers
|
||||
.after(render_system)
|
||||
.in_set(RenderSystems::Render),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ bitflags! {
|
||||
///
|
||||
/// These can be useful for ordering, but you almost never want to add your systems to these sets.
|
||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
|
||||
pub enum RenderSet {
|
||||
pub enum RenderSystems {
|
||||
/// This is used for applying the commands from the [`ExtractSchedule`]
|
||||
ExtractCommands,
|
||||
/// Prepare assets that have been created/modified/removed this frame.
|
||||
@ -156,9 +156,9 @@ pub enum RenderSet {
|
||||
/// Queue drawable entities as phase items in render phases ready for
|
||||
/// sorting (if necessary)
|
||||
Queue,
|
||||
/// A sub-set within [`Queue`](RenderSet::Queue) where mesh entity queue systems are executed. Ensures `prepare_assets::<RenderMesh>` is completed.
|
||||
/// A sub-set within [`Queue`](RenderSystems::Queue) where mesh entity queue systems are executed. Ensures `prepare_assets::<RenderMesh>` is completed.
|
||||
QueueMeshes,
|
||||
/// A sub-set within [`Queue`](RenderSet::Queue) where meshes that have
|
||||
/// A sub-set within [`Queue`](RenderSystems::Queue) where meshes that have
|
||||
/// become invisible or changed phases are removed from the bins.
|
||||
QueueSweep,
|
||||
// TODO: This could probably be moved in favor of a system ordering
|
||||
@ -169,14 +169,14 @@ pub enum RenderSet {
|
||||
/// Prepare render resources from extracted data for the GPU based on their sorted order.
|
||||
/// Create [`BindGroups`](render_resource::BindGroup) that depend on those data.
|
||||
Prepare,
|
||||
/// A sub-set within [`Prepare`](RenderSet::Prepare) for initializing buffers, textures and uniforms for use in bind groups.
|
||||
/// A sub-set within [`Prepare`](RenderSystems::Prepare) for initializing buffers, textures and uniforms for use in bind groups.
|
||||
PrepareResources,
|
||||
/// Collect phase buffers after
|
||||
/// [`PrepareResources`](RenderSet::PrepareResources) has run.
|
||||
/// [`PrepareResources`](RenderSystems::PrepareResources) has run.
|
||||
PrepareResourcesCollectPhaseBuffers,
|
||||
/// Flush buffers after [`PrepareResources`](RenderSet::PrepareResources), but before [`PrepareBindGroups`](RenderSet::PrepareBindGroups).
|
||||
/// Flush buffers after [`PrepareResources`](RenderSystems::PrepareResources), but before [`PrepareBindGroups`](RenderSystems::PrepareBindGroups).
|
||||
PrepareResourcesFlush,
|
||||
/// A sub-set within [`Prepare`](RenderSet::Prepare) for constructing bind groups, or other data that relies on render resources prepared in [`PrepareResources`](RenderSet::PrepareResources).
|
||||
/// A sub-set within [`Prepare`](RenderSystems::Prepare) for constructing bind groups, or other data that relies on render resources prepared in [`PrepareResources`](RenderSystems::PrepareResources).
|
||||
PrepareBindGroups,
|
||||
/// Actual rendering happens here.
|
||||
/// In most cases, only the render backend should insert resources here.
|
||||
@ -185,10 +185,14 @@ pub enum RenderSet {
|
||||
Cleanup,
|
||||
/// Final cleanup occurs: all entities will be despawned.
|
||||
///
|
||||
/// Runs after [`Cleanup`](RenderSet::Cleanup).
|
||||
/// Runs after [`Cleanup`](RenderSystems::Cleanup).
|
||||
PostCleanup,
|
||||
}
|
||||
|
||||
/// Deprecated alias for [`RenderSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `RenderSystems`.")]
|
||||
pub type RenderSet = RenderSystems;
|
||||
|
||||
/// The main render schedule.
|
||||
#[derive(ScheduleLabel, Debug, Hash, PartialEq, Eq, Clone, Default)]
|
||||
pub struct Render;
|
||||
@ -198,7 +202,7 @@ impl Render {
|
||||
///
|
||||
/// The sets defined in this enum are configured to run in order.
|
||||
pub fn base_schedule() -> Schedule {
|
||||
use RenderSet::*;
|
||||
use RenderSystems::*;
|
||||
|
||||
let mut schedule = Schedule::new(Self);
|
||||
|
||||
@ -293,7 +297,7 @@ pub const BINDLESS_SHADER_HANDLE: Handle<Shader> =
|
||||
weak_handle!("13f1baaa-41bf-448e-929e-258f9307a522");
|
||||
|
||||
impl Plugin for RenderPlugin {
|
||||
/// Initializes the renderer, sets up the [`RenderSet`] and creates the rendering sub-app.
|
||||
/// Initializes the renderer, sets up the [`RenderSystems`] and creates the rendering sub-app.
|
||||
fn build(&self, app: &mut App) {
|
||||
app.init_asset::<Shader>()
|
||||
.init_asset_loader::<ShaderLoader>();
|
||||
@ -417,7 +421,7 @@ impl Plugin for RenderPlugin {
|
||||
.add_systems(ExtractSchedule, extract_render_asset_bytes_per_frame)
|
||||
.add_systems(
|
||||
Render,
|
||||
reset_render_asset_bytes_per_frame.in_set(RenderSet::Cleanup),
|
||||
reset_render_asset_bytes_per_frame.in_set(RenderSystems::Cleanup),
|
||||
);
|
||||
}
|
||||
|
||||
@ -528,11 +532,11 @@ unsafe fn initialize_render_app(app: &mut App) {
|
||||
(
|
||||
// This set applies the commands from the extract schedule while the render schedule
|
||||
// is running in parallel with the main app.
|
||||
apply_extract_commands.in_set(RenderSet::ExtractCommands),
|
||||
apply_extract_commands.in_set(RenderSystems::ExtractCommands),
|
||||
(PipelineCache::process_pipeline_queue_system, render_system)
|
||||
.chain()
|
||||
.in_set(RenderSet::Render),
|
||||
despawn_temporary_render_entities.in_set(RenderSet::PostCleanup),
|
||||
.in_set(RenderSystems::Render),
|
||||
despawn_temporary_render_entities.in_set(RenderSystems::PostCleanup),
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -30,7 +30,7 @@ use crate::{
|
||||
render_asset::{prepare_assets, ExtractedAssets},
|
||||
render_resource::Buffer,
|
||||
renderer::{RenderAdapter, RenderDevice, RenderQueue},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
/// A plugin that manages GPU memory for mesh data.
|
||||
@ -311,7 +311,7 @@ impl Plugin for MeshAllocatorPlugin {
|
||||
.add_systems(
|
||||
Render,
|
||||
allocate_and_free_meshes
|
||||
.in_set(RenderSet::PrepareAssets)
|
||||
.in_set(RenderSystems::PrepareAssets)
|
||||
.before(prepare_assets::<RenderMesh>),
|
||||
);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use crate::{
|
||||
};
|
||||
use allocator::MeshAllocatorPlugin;
|
||||
use bevy_app::{App, Plugin, PostUpdate};
|
||||
use bevy_asset::{AssetApp, AssetEvents, AssetId, RenderAssetUsages};
|
||||
use bevy_asset::{AssetApp, AssetEventSystems, AssetId, RenderAssetUsages};
|
||||
use bevy_ecs::{
|
||||
prelude::*,
|
||||
system::{
|
||||
@ -73,7 +73,7 @@ impl Plugin for MeshPlugin {
|
||||
PostUpdate,
|
||||
mark_3d_meshes_as_changed_if_their_assets_changed
|
||||
.ambiguous_with(VisibilitySystems::CalculateBounds)
|
||||
.before(AssetEvents),
|
||||
.before(AssetEventSystems),
|
||||
);
|
||||
|
||||
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
|
||||
|
@ -97,7 +97,7 @@ impl Drop for RenderAppChannels {
|
||||
/// This is run on the main app's thread.
|
||||
/// - On the render thread, we first apply the `extract commands`. This is not run during extract, so the
|
||||
/// main schedule can start sooner.
|
||||
/// - Then the `rendering schedule` is run. See [`RenderSet`](crate::RenderSet) for the standard steps in this process.
|
||||
/// - Then the `rendering schedule` is run. See [`RenderSystems`](crate::RenderSystems) for the standard steps in this process.
|
||||
/// - In parallel to the rendering thread the [`RenderExtractApp`] schedule runs. By
|
||||
/// default, this schedule is empty. But it is useful if you need something to run before I/O processing.
|
||||
/// - Next all the `winit events` are processed.
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
render_resource::AsBindGroupError, Extract, ExtractSchedule, MainWorld, Render, RenderApp,
|
||||
RenderSet, Res,
|
||||
RenderSystems, Res,
|
||||
};
|
||||
use bevy_app::{App, Plugin, SubApp};
|
||||
pub use bevy_asset::RenderAssetUsages;
|
||||
@ -27,14 +27,18 @@ pub enum PrepareAssetError<E: Send + Sync + 'static> {
|
||||
|
||||
/// The system set during which we extract modified assets to the render world.
|
||||
#[derive(SystemSet, Clone, PartialEq, Eq, Debug, Hash)]
|
||||
pub struct ExtractAssetsSet;
|
||||
pub struct AssetExtractionSystems;
|
||||
|
||||
/// Deprecated alias for [`AssetExtractionSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `AssetExtractionSystems`.")]
|
||||
pub type ExtractAssetsSet = AssetExtractionSystems;
|
||||
|
||||
/// Describes how an asset gets extracted and prepared for rendering.
|
||||
///
|
||||
/// In the [`ExtractSchedule`] step the [`RenderAsset::SourceAsset`] is transferred
|
||||
/// from the "main world" into the "render world".
|
||||
///
|
||||
/// After that in the [`RenderSet::PrepareAssets`] step the extracted asset
|
||||
/// After that in the [`RenderSystems::PrepareAssets`] step the extracted asset
|
||||
/// is transformed into its GPU-representation of type [`RenderAsset`].
|
||||
pub trait RenderAsset: Send + Sync + 'static + Sized {
|
||||
/// The representation of the asset in the "main world".
|
||||
@ -88,7 +92,7 @@ pub trait RenderAsset: Send + Sync + 'static + Sized {
|
||||
/// and prepares them for the GPU. They can then be accessed from the [`RenderAssets`] resource.
|
||||
///
|
||||
/// Therefore it sets up the [`ExtractSchedule`] and
|
||||
/// [`RenderSet::PrepareAssets`] steps for the specified [`RenderAsset`].
|
||||
/// [`RenderSystems::PrepareAssets`] steps for the specified [`RenderAsset`].
|
||||
///
|
||||
/// The `AFTER` generic parameter can be used to specify that `A::prepare_asset` should not be run until
|
||||
/// `prepare_assets::<AFTER>` has completed. This allows the `prepare_asset` function to depend on another
|
||||
@ -120,11 +124,11 @@ impl<A: RenderAsset, AFTER: RenderAssetDependency + 'static> Plugin
|
||||
.init_resource::<PrepareNextFrameAssets<A>>()
|
||||
.add_systems(
|
||||
ExtractSchedule,
|
||||
extract_render_asset::<A>.in_set(ExtractAssetsSet),
|
||||
extract_render_asset::<A>.in_set(AssetExtractionSystems),
|
||||
);
|
||||
AFTER::register_system(
|
||||
render_app,
|
||||
prepare_assets::<A>.in_set(RenderSet::PrepareAssets),
|
||||
prepare_assets::<A>.in_set(RenderSystems::PrepareAssets),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,10 @@
|
||||
//!
|
||||
//! To draw an entity, a corresponding [`PhaseItem`] has to be added to one or multiple of these
|
||||
//! render phases for each view that it is visible in.
|
||||
//! This must be done in the [`RenderSet::Queue`].
|
||||
//! After that the render phase sorts them in the [`RenderSet::PhaseSort`].
|
||||
//! This must be done in the [`RenderSystems::Queue`].
|
||||
//! After that the render phase sorts them in the [`RenderSystems::PhaseSort`].
|
||||
//! Finally the items are rendered using a single [`TrackedRenderPass`], during
|
||||
//! the [`RenderSet::Render`].
|
||||
//! the [`RenderSystems::Render`].
|
||||
//!
|
||||
//! Therefore each phase item is assigned a [`Draw`] function.
|
||||
//! These set up the state of the [`TrackedRenderPass`] (i.e. select the
|
||||
@ -59,7 +59,7 @@ use crate::{
|
||||
GetFullBatchData,
|
||||
},
|
||||
render_resource::{CachedRenderPipelineId, GpuArrayBufferIndex, PipelineCache},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_ecs::{
|
||||
prelude::*,
|
||||
@ -1134,7 +1134,7 @@ where
|
||||
.add_systems(
|
||||
Render,
|
||||
(
|
||||
batching::sort_binned_render_phase::<BPI>.in_set(RenderSet::PhaseSort),
|
||||
batching::sort_binned_render_phase::<BPI>.in_set(RenderSystems::PhaseSort),
|
||||
(
|
||||
no_gpu_preprocessing::batch_and_prepare_binned_render_phase::<BPI, GFBD>
|
||||
.run_if(resource_exists::<BatchedInstanceBuffer<GFBD::BufferData>>),
|
||||
@ -1145,15 +1145,15 @@ where
|
||||
>,
|
||||
),
|
||||
)
|
||||
.in_set(RenderSet::PrepareResources),
|
||||
sweep_old_entities::<BPI>.in_set(RenderSet::QueueSweep),
|
||||
.in_set(RenderSystems::PrepareResources),
|
||||
sweep_old_entities::<BPI>.in_set(RenderSystems::QueueSweep),
|
||||
gpu_preprocessing::collect_buffers_for_phase::<BPI, GFBD>
|
||||
.run_if(
|
||||
resource_exists::<
|
||||
BatchedInstanceBuffers<GFBD::BufferData, GFBD::BufferInputData>,
|
||||
>,
|
||||
)
|
||||
.in_set(RenderSet::PrepareResourcesCollectPhaseBuffers),
|
||||
.in_set(RenderSystems::PrepareResourcesCollectPhaseBuffers),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -1250,14 +1250,14 @@ where
|
||||
>,
|
||||
),
|
||||
)
|
||||
.in_set(RenderSet::PrepareResources),
|
||||
.in_set(RenderSystems::PrepareResources),
|
||||
gpu_preprocessing::collect_buffers_for_phase::<SPI, GFBD>
|
||||
.run_if(
|
||||
resource_exists::<
|
||||
BatchedInstanceBuffers<GFBD::BufferData, GFBD::BufferInputData>,
|
||||
>,
|
||||
)
|
||||
.in_set(RenderSet::PrepareResourcesCollectPhaseBuffers),
|
||||
.in_set(RenderSystems::PrepareResourcesCollectPhaseBuffers),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -1465,10 +1465,10 @@ where
|
||||
///
|
||||
/// The data required for rendering an entity is extracted from the main world in the
|
||||
/// [`ExtractSchedule`](crate::ExtractSchedule).
|
||||
/// Then it has to be queued up for rendering during the [`RenderSet::Queue`],
|
||||
/// Then it has to be queued up for rendering during the [`RenderSystems::Queue`],
|
||||
/// by adding a corresponding phase item to a render phase.
|
||||
/// Afterwards it will be possibly sorted and rendered automatically in the
|
||||
/// [`RenderSet::PhaseSort`] and [`RenderSet::Render`], respectively.
|
||||
/// [`RenderSystems::PhaseSort`] and [`RenderSystems::Render`], respectively.
|
||||
///
|
||||
/// `PhaseItem`s come in two flavors: [`BinnedPhaseItem`]s and
|
||||
/// [`SortedPhaseItem`]s.
|
||||
|
@ -555,13 +555,13 @@ impl LayoutCache {
|
||||
/// The cache stores existing render and compute pipelines allocated on the GPU, as well as
|
||||
/// pending creation. Pipelines inserted into the cache are identified by a unique ID, which
|
||||
/// can be used to retrieve the actual GPU object once it's ready. The creation of the GPU
|
||||
/// pipeline object is deferred to the [`RenderSet::Render`] step, just before the render
|
||||
/// pipeline object is deferred to the [`RenderSystems::Render`] step, just before the render
|
||||
/// graph starts being processed, as this requires access to the GPU.
|
||||
///
|
||||
/// Note that the cache does not perform automatic deduplication of identical pipelines. It is
|
||||
/// up to the user not to insert the same pipeline twice to avoid wasting GPU resources.
|
||||
///
|
||||
/// [`RenderSet::Render`]: crate::RenderSet::Render
|
||||
/// [`RenderSystems::Render`]: crate::RenderSystems::Render
|
||||
#[derive(Resource)]
|
||||
pub struct PipelineCache {
|
||||
layout_cache: Arc<Mutex<LayoutCache>>,
|
||||
@ -959,10 +959,10 @@ impl PipelineCache {
|
||||
|
||||
/// Process the pipeline queue and create all pending pipelines if possible.
|
||||
///
|
||||
/// This is generally called automatically during the [`RenderSet::Render`] step, but can
|
||||
/// This is generally called automatically during the [`RenderSystems::Render`] step, but can
|
||||
/// be called manually to force creation at a different time.
|
||||
///
|
||||
/// [`RenderSet::Render`]: crate::RenderSet::Render
|
||||
/// [`RenderSystems::Render`]: crate::RenderSystems::Render
|
||||
pub fn process_queue(&mut self) {
|
||||
let mut waiting_pipelines = mem::take(&mut self.waiting_pipelines);
|
||||
let mut pipelines = mem::take(&mut self.pipelines);
|
||||
|
@ -15,7 +15,7 @@ pub use texture_attachment::*;
|
||||
pub use texture_cache::*;
|
||||
|
||||
use crate::{
|
||||
render_asset::RenderAssetPlugin, renderer::RenderDevice, Render, RenderApp, RenderSet,
|
||||
render_asset::RenderAssetPlugin, renderer::RenderDevice, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_app::{App, Plugin};
|
||||
use bevy_asset::{weak_handle, AssetApp, Assets, Handle};
|
||||
@ -100,7 +100,7 @@ impl Plugin for ImagePlugin {
|
||||
if let Some(render_app) = app.get_sub_app_mut(RenderApp) {
|
||||
render_app.init_resource::<TextureCache>().add_systems(
|
||||
Render,
|
||||
update_texture_cache_system.in_set(RenderSet::Cleanup),
|
||||
update_texture_cache_system.in_set(RenderSystems::Cleanup),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ use crate::{
|
||||
CachedTexture, ColorAttachment, DepthAttachment, GpuImage, OutputColorAttachment,
|
||||
TextureCache,
|
||||
},
|
||||
Render, RenderApp, RenderSet,
|
||||
Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use alloc::sync::Arc;
|
||||
use bevy_app::{App, Plugin};
|
||||
@ -126,18 +126,18 @@ impl Plugin for ViewPlugin {
|
||||
(
|
||||
// `TextureView`s need to be dropped before reconfiguring window surfaces.
|
||||
clear_view_attachments
|
||||
.in_set(RenderSet::ManageViews)
|
||||
.in_set(RenderSystems::ManageViews)
|
||||
.before(create_surfaces),
|
||||
prepare_view_attachments
|
||||
.in_set(RenderSet::ManageViews)
|
||||
.in_set(RenderSystems::ManageViews)
|
||||
.before(prepare_view_targets)
|
||||
.after(prepare_windows),
|
||||
prepare_view_targets
|
||||
.in_set(RenderSet::ManageViews)
|
||||
.in_set(RenderSystems::ManageViews)
|
||||
.after(prepare_windows)
|
||||
.after(crate::render_asset::prepare_assets::<GpuImage>)
|
||||
.ambiguous_with(crate::camera::sort_cameras), // doesn't use `sorted_camera_index_for_target`
|
||||
prepare_view_uniforms.in_set(RenderSet::PrepareResources),
|
||||
prepare_view_uniforms.in_set(RenderSystems::PrepareResources),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ use bevy_app::{Plugin, PostUpdate};
|
||||
use bevy_asset::Assets;
|
||||
use bevy_ecs::{hierarchy::validate_parent_has_component, prelude::*};
|
||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||
use bevy_transform::{components::GlobalTransform, TransformSystem};
|
||||
use bevy_transform::{components::GlobalTransform, TransformSystems};
|
||||
use bevy_utils::{Parallel, TypeIdMap};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
@ -342,7 +342,7 @@ impl Plugin for VisibilityPlugin {
|
||||
PostUpdate,
|
||||
(CalculateBounds, UpdateFrusta, VisibilityPropagate)
|
||||
.before(CheckVisibility)
|
||||
.after(TransformSystem::TransformPropagate),
|
||||
.after(TransformSystems::Propagate),
|
||||
)
|
||||
.configure_sets(
|
||||
PostUpdate,
|
||||
|
@ -32,7 +32,7 @@ use crate::{
|
||||
primitives::Aabb,
|
||||
render_resource::BufferVec,
|
||||
renderer::{RenderDevice, RenderQueue},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
/// We need at least 4 storage buffer bindings available to enable the
|
||||
@ -72,7 +72,7 @@ impl Plugin for VisibilityRangePlugin {
|
||||
.add_systems(ExtractSchedule, extract_visibility_ranges)
|
||||
.add_systems(
|
||||
Render,
|
||||
write_render_visibility_ranges.in_set(RenderSet::PrepareResourcesFlush),
|
||||
write_render_visibility_ranges.in_set(RenderSystems::PrepareResourcesFlush),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
render_resource::{SurfaceTexture, TextureView},
|
||||
renderer::{RenderAdapter, RenderDevice, RenderInstance},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet, WgpuWrapper,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems, WgpuWrapper,
|
||||
};
|
||||
use bevy_app::{App, Plugin};
|
||||
use bevy_ecs::{entity::EntityHashMap, prelude::*};
|
||||
@ -40,7 +40,7 @@ impl Plugin for WindowRenderPlugin {
|
||||
.run_if(need_surface_configuration)
|
||||
.before(prepare_windows),
|
||||
)
|
||||
.add_systems(Render, prepare_windows.in_set(RenderSet::ManageViews));
|
||||
.add_systems(Render, prepare_windows.in_set(RenderSystems::ManageViews));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use crate::{
|
||||
renderer::RenderDevice,
|
||||
texture::{GpuImage, OutputColorAttachment},
|
||||
view::{prepare_view_attachments, prepare_view_targets, ViewTargetAttachments, WindowSurfaces},
|
||||
ExtractSchedule, MainWorld, Render, RenderApp, RenderSet,
|
||||
ExtractSchedule, MainWorld, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use alloc::{borrow::Cow, sync::Arc};
|
||||
use bevy_app::{First, Plugin, Update};
|
||||
@ -432,7 +432,7 @@ impl Plugin for ScreenshotPlugin {
|
||||
prepare_screenshots
|
||||
.after(prepare_view_attachments)
|
||||
.before(prepare_view_targets)
|
||||
.in_set(RenderSet::ManageViews),
|
||||
.in_set(RenderSystems::ManageViews),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ pub use sprite::*;
|
||||
pub use texture_slice::*;
|
||||
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::{load_internal_asset, weak_handle, AssetEvents, Assets, Handle};
|
||||
use bevy_asset::{load_internal_asset, weak_handle, AssetEventSystems, Assets, Handle};
|
||||
use bevy_core_pipeline::core_2d::{AlphaMask2d, Opaque2d, Transparent2d};
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_image::{prelude::*, TextureAtlasPlugin};
|
||||
@ -53,7 +53,7 @@ use bevy_render::{
|
||||
render_phase::AddRenderCommand,
|
||||
render_resource::{Shader, SpecializedRenderPipelines},
|
||||
view::{NoFrustumCulling, VisibilitySystems},
|
||||
ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
|
||||
/// Adds support for 2D sprite rendering.
|
||||
@ -67,11 +67,15 @@ pub const SPRITE_VIEW_BINDINGS_SHADER_HANDLE: Handle<Shader> =
|
||||
|
||||
/// System set for sprite rendering.
|
||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
|
||||
pub enum SpriteSystem {
|
||||
pub enum SpriteSystems {
|
||||
ExtractSprites,
|
||||
ComputeSlices,
|
||||
}
|
||||
|
||||
/// Deprecated alias for [`SpriteSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `SpriteSystems`.")]
|
||||
pub type SpriteSystem = SpriteSystems;
|
||||
|
||||
impl Plugin for SpritePlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
load_internal_asset!(
|
||||
@ -102,10 +106,10 @@ impl Plugin for SpritePlugin {
|
||||
(
|
||||
calculate_bounds_2d.in_set(VisibilitySystems::CalculateBounds),
|
||||
(
|
||||
compute_slices_on_asset_event.before(AssetEvents),
|
||||
compute_slices_on_asset_event.before(AssetEventSystems),
|
||||
compute_slices_on_sprite_change,
|
||||
)
|
||||
.in_set(SpriteSystem::ComputeSlices),
|
||||
.in_set(SpriteSystems::ComputeSlices),
|
||||
),
|
||||
);
|
||||
|
||||
@ -124,7 +128,7 @@ impl Plugin for SpritePlugin {
|
||||
.add_systems(
|
||||
ExtractSchedule,
|
||||
(
|
||||
extract_sprites.in_set(SpriteSystem::ExtractSprites),
|
||||
extract_sprites.in_set(SpriteSystems::ExtractSprites),
|
||||
extract_sprite_events,
|
||||
),
|
||||
)
|
||||
@ -132,12 +136,12 @@ impl Plugin for SpritePlugin {
|
||||
Render,
|
||||
(
|
||||
queue_sprites
|
||||
.in_set(RenderSet::Queue)
|
||||
.in_set(RenderSystems::Queue)
|
||||
.ambiguous_with(queue_material2d_meshes::<ColorMaterial>),
|
||||
prepare_sprite_image_bind_groups.in_set(RenderSet::PrepareBindGroups),
|
||||
prepare_sprite_view_bind_groups.in_set(RenderSet::PrepareBindGroups),
|
||||
sort_binned_render_phase::<Opaque2d>.in_set(RenderSet::PhaseSort),
|
||||
sort_binned_render_phase::<AlphaMask2d>.in_set(RenderSet::PhaseSort),
|
||||
prepare_sprite_image_bind_groups.in_set(RenderSystems::PrepareBindGroups),
|
||||
prepare_sprite_view_bind_groups.in_set(RenderSystems::PrepareBindGroups),
|
||||
sort_binned_render_phase::<Opaque2d>.in_set(RenderSystems::PhaseSort),
|
||||
sort_binned_render_phase::<AlphaMask2d>.in_set(RenderSystems::PhaseSort),
|
||||
),
|
||||
);
|
||||
};
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
};
|
||||
use bevy_app::{App, Plugin, PostUpdate};
|
||||
use bevy_asset::prelude::AssetChanged;
|
||||
use bevy_asset::{AsAssetId, Asset, AssetApp, AssetEvents, AssetId, AssetServer, Handle};
|
||||
use bevy_asset::{AsAssetId, Asset, AssetApp, AssetEventSystems, AssetId, AssetServer, Handle};
|
||||
use bevy_core_pipeline::{
|
||||
core_2d::{
|
||||
AlphaMask2d, AlphaMask2dBinKey, BatchSetKey2d, Opaque2d, Opaque2dBinKey, Transparent2d,
|
||||
@ -43,7 +43,7 @@ use bevy_render::{
|
||||
renderer::RenderDevice,
|
||||
sync_world::{MainEntity, MainEntityHashMap},
|
||||
view::{ExtractedView, ViewVisibility},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_utils::Parallel;
|
||||
use core::{hash::Hash, marker::PhantomData};
|
||||
@ -273,7 +273,7 @@ where
|
||||
.add_plugins(RenderAssetPlugin::<PreparedMaterial2d<M>>::default())
|
||||
.add_systems(
|
||||
PostUpdate,
|
||||
check_entities_needing_specialization::<M>.after(AssetEvents),
|
||||
check_entities_needing_specialization::<M>.after(AssetEventSystems),
|
||||
);
|
||||
|
||||
if let Some(render_app) = app.get_sub_app_mut(RenderApp) {
|
||||
@ -296,11 +296,11 @@ where
|
||||
Render,
|
||||
(
|
||||
specialize_material2d_meshes::<M>
|
||||
.in_set(RenderSet::PrepareMeshes)
|
||||
.in_set(RenderSystems::PrepareMeshes)
|
||||
.after(prepare_assets::<PreparedMaterial2d<M>>)
|
||||
.after(prepare_assets::<RenderMesh>),
|
||||
queue_material2d_meshes::<M>
|
||||
.in_set(RenderSet::QueueMeshes)
|
||||
.in_set(RenderSystems::QueueMeshes)
|
||||
.after(prepare_assets::<PreparedMaterial2d<M>>),
|
||||
),
|
||||
);
|
||||
|
@ -21,7 +21,7 @@ use bevy_image::{BevyDefault, Image, ImageSampler, TextureFormatPixelInfo};
|
||||
use bevy_math::{Affine3, Vec4};
|
||||
use bevy_render::mesh::MeshTag;
|
||||
use bevy_render::prelude::Msaa;
|
||||
use bevy_render::RenderSet::PrepareAssets;
|
||||
use bevy_render::RenderSystems::PrepareAssets;
|
||||
use bevy_render::{
|
||||
batching::{
|
||||
gpu_preprocessing::IndirectParametersCpuMetadata,
|
||||
@ -48,7 +48,7 @@ use bevy_render::{
|
||||
view::{
|
||||
ExtractedView, ViewTarget, ViewUniform, ViewUniformOffset, ViewUniforms, ViewVisibility,
|
||||
},
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSet,
|
||||
Extract, ExtractSchedule, Render, RenderApp, RenderSystems,
|
||||
};
|
||||
use bevy_transform::components::GlobalTransform;
|
||||
use nonmax::NonMaxU32;
|
||||
@ -119,20 +119,20 @@ impl Plugin for Mesh2dRenderPlugin {
|
||||
sweep_old_entities::<Opaque2d>,
|
||||
sweep_old_entities::<AlphaMask2d>,
|
||||
)
|
||||
.in_set(RenderSet::QueueSweep),
|
||||
.in_set(RenderSystems::QueueSweep),
|
||||
batch_and_prepare_binned_render_phase::<Opaque2d, Mesh2dPipeline>
|
||||
.in_set(RenderSet::PrepareResources),
|
||||
.in_set(RenderSystems::PrepareResources),
|
||||
batch_and_prepare_binned_render_phase::<AlphaMask2d, Mesh2dPipeline>
|
||||
.in_set(RenderSet::PrepareResources),
|
||||
.in_set(RenderSystems::PrepareResources),
|
||||
batch_and_prepare_sorted_render_phase::<Transparent2d, Mesh2dPipeline>
|
||||
.in_set(RenderSet::PrepareResources),
|
||||
.in_set(RenderSystems::PrepareResources),
|
||||
write_batched_instance_buffer::<Mesh2dPipeline>
|
||||
.in_set(RenderSet::PrepareResourcesFlush),
|
||||
prepare_mesh2d_bind_group.in_set(RenderSet::PrepareBindGroups),
|
||||
prepare_mesh2d_view_bind_groups.in_set(RenderSet::PrepareBindGroups),
|
||||
.in_set(RenderSystems::PrepareResourcesFlush),
|
||||
prepare_mesh2d_bind_group.in_set(RenderSystems::PrepareBindGroups),
|
||||
prepare_mesh2d_view_bind_groups.in_set(RenderSystems::PrepareBindGroups),
|
||||
no_gpu_preprocessing::clear_batched_cpu_instance_buffers::<Mesh2dPipeline>
|
||||
.in_set(RenderSet::Cleanup)
|
||||
.after(RenderSet::Render),
|
||||
.in_set(RenderSystems::Cleanup)
|
||||
.after(RenderSystems::Render),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use crate::{
|
||||
use bevy_app::{App, Plugin, PostUpdate, Startup, Update};
|
||||
use bevy_asset::{
|
||||
load_internal_asset, prelude::AssetChanged, weak_handle, AsAssetId, Asset, AssetApp,
|
||||
AssetEvents, AssetId, Assets, Handle, UntypedAssetId,
|
||||
AssetEventSystems, AssetId, Assets, Handle, UntypedAssetId,
|
||||
};
|
||||
use bevy_color::{Color, ColorToComponents};
|
||||
use bevy_core_pipeline::core_2d::{
|
||||
@ -49,7 +49,7 @@ use bevy_render::{
|
||||
view::{
|
||||
ExtractedView, RenderVisibleEntities, RetainedViewEntity, ViewDepthTexture, ViewTarget,
|
||||
},
|
||||
Extract, Render, RenderApp, RenderDebugFlags, RenderSet,
|
||||
Extract, Render, RenderApp, RenderDebugFlags, RenderSystems,
|
||||
};
|
||||
use core::{hash::Hash, ops::Range};
|
||||
use tracing::error;
|
||||
@ -113,7 +113,7 @@ impl Plugin for Wireframe2dPlugin {
|
||||
.add_systems(
|
||||
PostUpdate,
|
||||
check_wireframe_entities_needing_specialization
|
||||
.after(AssetEvents)
|
||||
.after(AssetEventSystems)
|
||||
.run_if(resource_exists::<Wireframe2dConfig>),
|
||||
);
|
||||
|
||||
@ -149,11 +149,11 @@ impl Plugin for Wireframe2dPlugin {
|
||||
Render,
|
||||
(
|
||||
specialize_wireframes
|
||||
.in_set(RenderSet::PrepareMeshes)
|
||||
.in_set(RenderSystems::PrepareMeshes)
|
||||
.after(prepare_assets::<RenderWireframeMaterial>)
|
||||
.after(prepare_assets::<RenderMesh>),
|
||||
queue_wireframes
|
||||
.in_set(RenderSet::QueueMeshes)
|
||||
.in_set(RenderSystems::QueueMeshes)
|
||||
.after(prepare_assets::<RenderWireframeMaterial>),
|
||||
),
|
||||
);
|
||||
|
@ -79,7 +79,7 @@ impl Plugin for SpritePickingPlugin {
|
||||
.register_type::<SpritePickingCamera>()
|
||||
.register_type::<SpritePickingMode>()
|
||||
.register_type::<SpritePickingSettings>()
|
||||
.add_systems(PreUpdate, sprite_picking.in_set(PickSet::Backend));
|
||||
.add_systems(PreUpdate, sprite_picking.in_set(PickingSystems::Backend));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ use log::warn;
|
||||
use crate::{
|
||||
state::{
|
||||
setup_state_transitions_in_world, ComputedStates, FreelyMutableState, NextState, State,
|
||||
StateTransition, StateTransitionEvent, StateTransitionSteps, States, SubStates,
|
||||
StateTransition, StateTransitionEvent, StateTransitionSystems, States, SubStates,
|
||||
},
|
||||
state_scoped::{despawn_entities_on_enter_state, despawn_entities_on_exit_state},
|
||||
};
|
||||
@ -224,18 +224,18 @@ impl AppExtStates for SubApp {
|
||||
}
|
||||
|
||||
// Note: We work with `StateTransition` in set
|
||||
// `StateTransitionSteps::ExitSchedules` rather than `OnExit`, because
|
||||
// `StateTransitionSystems::ExitSchedules` rather than `OnExit`, because
|
||||
// `OnExit` only runs for one specific variant of the state.
|
||||
self.add_systems(
|
||||
StateTransition,
|
||||
despawn_entities_on_exit_state::<S>.in_set(StateTransitionSteps::ExitSchedules),
|
||||
despawn_entities_on_exit_state::<S>.in_set(StateTransitionSystems::ExitSchedules),
|
||||
)
|
||||
// Note: We work with `StateTransition` in set
|
||||
// `StateTransitionSteps::EnterSchedules` rather than `OnEnter`, because
|
||||
// `StateTransitionSystems::EnterSchedules` rather than `OnEnter`, because
|
||||
// `OnEnter` only runs for one specific variant of the state.
|
||||
.add_systems(
|
||||
StateTransition,
|
||||
despawn_entities_on_enter_state::<S>.in_set(StateTransitionSteps::EnterSchedules),
|
||||
despawn_entities_on_enter_state::<S>.in_set(StateTransitionSystems::EnterSchedules),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@ pub trait FreelyMutableState: States {
|
||||
fn register_state(schedule: &mut Schedule) {
|
||||
schedule.configure_sets((
|
||||
ApplyStateTransition::<Self>::default()
|
||||
.in_set(StateTransitionSteps::DependentTransitions),
|
||||
ExitSchedules::<Self>::default().in_set(StateTransitionSteps::ExitSchedules),
|
||||
.in_set(StateTransitionSystems::DependentTransitions),
|
||||
ExitSchedules::<Self>::default().in_set(StateTransitionSystems::ExitSchedules),
|
||||
TransitionSchedules::<Self>::default()
|
||||
.in_set(StateTransitionSteps::TransitionSchedules),
|
||||
EnterSchedules::<Self>::default().in_set(StateTransitionSteps::EnterSchedules),
|
||||
.in_set(StateTransitionSystems::TransitionSchedules),
|
||||
EnterSchedules::<Self>::default().in_set(StateTransitionSystems::EnterSchedules),
|
||||
));
|
||||
|
||||
schedule
|
||||
|
@ -10,7 +10,7 @@ use self::sealed::StateSetSealed;
|
||||
use super::{
|
||||
computed_states::ComputedStates, internal_apply_state_transition, last_transition, run_enter,
|
||||
run_exit, run_transition, sub_states::SubStates, take_next_state, ApplyStateTransition,
|
||||
EnterSchedules, ExitSchedules, NextState, State, StateTransitionEvent, StateTransitionSteps,
|
||||
EnterSchedules, ExitSchedules, NextState, State, StateTransitionEvent, StateTransitionSystems,
|
||||
States, TransitionSchedules,
|
||||
};
|
||||
|
||||
@ -117,14 +117,14 @@ impl<S: InnerStateSet> StateSet for S {
|
||||
|
||||
schedule.configure_sets((
|
||||
ApplyStateTransition::<T>::default()
|
||||
.in_set(StateTransitionSteps::DependentTransitions)
|
||||
.in_set(StateTransitionSystems::DependentTransitions)
|
||||
.after(ApplyStateTransition::<S::RawState>::default()),
|
||||
ExitSchedules::<T>::default()
|
||||
.in_set(StateTransitionSteps::ExitSchedules)
|
||||
.in_set(StateTransitionSystems::ExitSchedules)
|
||||
.before(ExitSchedules::<S::RawState>::default()),
|
||||
TransitionSchedules::<T>::default().in_set(StateTransitionSteps::TransitionSchedules),
|
||||
TransitionSchedules::<T>::default().in_set(StateTransitionSystems::TransitionSchedules),
|
||||
EnterSchedules::<T>::default()
|
||||
.in_set(StateTransitionSteps::EnterSchedules)
|
||||
.in_set(StateTransitionSystems::EnterSchedules)
|
||||
.after(EnterSchedules::<S::RawState>::default()),
|
||||
));
|
||||
|
||||
@ -197,14 +197,14 @@ impl<S: InnerStateSet> StateSet for S {
|
||||
|
||||
schedule.configure_sets((
|
||||
ApplyStateTransition::<T>::default()
|
||||
.in_set(StateTransitionSteps::DependentTransitions)
|
||||
.in_set(StateTransitionSystems::DependentTransitions)
|
||||
.after(ApplyStateTransition::<S::RawState>::default()),
|
||||
ExitSchedules::<T>::default()
|
||||
.in_set(StateTransitionSteps::ExitSchedules)
|
||||
.in_set(StateTransitionSystems::ExitSchedules)
|
||||
.before(ExitSchedules::<S::RawState>::default()),
|
||||
TransitionSchedules::<T>::default().in_set(StateTransitionSteps::TransitionSchedules),
|
||||
TransitionSchedules::<T>::default().in_set(StateTransitionSystems::TransitionSchedules),
|
||||
EnterSchedules::<T>::default()
|
||||
.in_set(StateTransitionSteps::EnterSchedules)
|
||||
.in_set(StateTransitionSystems::EnterSchedules)
|
||||
.after(EnterSchedules::<S::RawState>::default()),
|
||||
));
|
||||
|
||||
@ -264,15 +264,15 @@ macro_rules! impl_state_set_sealed_tuples {
|
||||
|
||||
schedule.configure_sets((
|
||||
ApplyStateTransition::<T>::default()
|
||||
.in_set(StateTransitionSteps::DependentTransitions)
|
||||
.in_set(StateTransitionSystems::DependentTransitions)
|
||||
$(.after(ApplyStateTransition::<$param::RawState>::default()))*,
|
||||
ExitSchedules::<T>::default()
|
||||
.in_set(StateTransitionSteps::ExitSchedules)
|
||||
.in_set(StateTransitionSystems::ExitSchedules)
|
||||
$(.before(ExitSchedules::<$param::RawState>::default()))*,
|
||||
TransitionSchedules::<T>::default()
|
||||
.in_set(StateTransitionSteps::TransitionSchedules),
|
||||
.in_set(StateTransitionSystems::TransitionSchedules),
|
||||
EnterSchedules::<T>::default()
|
||||
.in_set(StateTransitionSteps::EnterSchedules)
|
||||
.in_set(StateTransitionSystems::EnterSchedules)
|
||||
$(.after(EnterSchedules::<$param::RawState>::default()))*,
|
||||
));
|
||||
|
||||
@ -318,15 +318,15 @@ macro_rules! impl_state_set_sealed_tuples {
|
||||
|
||||
schedule.configure_sets((
|
||||
ApplyStateTransition::<T>::default()
|
||||
.in_set(StateTransitionSteps::DependentTransitions)
|
||||
.in_set(StateTransitionSystems::DependentTransitions)
|
||||
$(.after(ApplyStateTransition::<$param::RawState>::default()))*,
|
||||
ExitSchedules::<T>::default()
|
||||
.in_set(StateTransitionSteps::ExitSchedules)
|
||||
.in_set(StateTransitionSystems::ExitSchedules)
|
||||
$(.before(ExitSchedules::<$param::RawState>::default()))*,
|
||||
TransitionSchedules::<T>::default()
|
||||
.in_set(StateTransitionSteps::TransitionSchedules),
|
||||
.in_set(StateTransitionSystems::TransitionSchedules),
|
||||
EnterSchedules::<T>::default()
|
||||
.in_set(StateTransitionSteps::EnterSchedules)
|
||||
.in_set(StateTransitionSystems::EnterSchedules)
|
||||
$(.after(EnterSchedules::<$param::RawState>::default()))*,
|
||||
));
|
||||
|
||||
|
@ -71,7 +71,7 @@ pub struct StateTransitionEvent<S: States> {
|
||||
///
|
||||
/// These system sets are run sequentially, in the order of the enum variants.
|
||||
#[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum StateTransitionSteps {
|
||||
pub enum StateTransitionSystems {
|
||||
/// States apply their transitions from [`NextState`](super::NextState)
|
||||
/// and compute functions based on their parent states.
|
||||
DependentTransitions,
|
||||
@ -83,6 +83,10 @@ pub enum StateTransitionSteps {
|
||||
EnterSchedules,
|
||||
}
|
||||
|
||||
/// Deprecated alias for [`StateTransitionSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `StateTransitionSystems`.")]
|
||||
pub type StateTransitionSteps = StateTransitionSystems;
|
||||
|
||||
#[derive(SystemSet, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
/// System set that runs exit schedule(s) for state `S`.
|
||||
pub struct ExitSchedules<S: States>(PhantomData<S>);
|
||||
@ -191,10 +195,10 @@ pub fn setup_state_transitions_in_world(world: &mut World) {
|
||||
let mut schedule = Schedule::new(StateTransition);
|
||||
schedule.configure_sets(
|
||||
(
|
||||
StateTransitionSteps::DependentTransitions,
|
||||
StateTransitionSteps::ExitSchedules,
|
||||
StateTransitionSteps::TransitionSchedules,
|
||||
StateTransitionSteps::EnterSchedules,
|
||||
StateTransitionSystems::DependentTransitions,
|
||||
StateTransitionSystems::ExitSchedules,
|
||||
StateTransitionSystems::TransitionSchedules,
|
||||
StateTransitionSystems::EnterSchedules,
|
||||
)
|
||||
.chain(),
|
||||
);
|
||||
|
@ -93,7 +93,7 @@ pub trait StateScopedEventsAppExt {
|
||||
/// and [`DespawnOnExitState`](crate::prelude::DespawnOnExitState) entity
|
||||
/// cleanup and the [`OnExit`] schedule for the target state. All of these (state scoped
|
||||
/// entities and events cleanup, and `OnExit`) occur within schedule [`StateTransition`](crate::prelude::StateTransition)
|
||||
/// and system set `StateTransitionSteps::ExitSchedules`.
|
||||
/// and system set `StateTransitionSystems::ExitSchedules`.
|
||||
fn add_state_scoped_event<E: Event>(&mut self, state: impl FreelyMutableState) -> &mut Self;
|
||||
}
|
||||
|
||||
|
@ -66,15 +66,15 @@ pub mod prelude {
|
||||
};
|
||||
}
|
||||
|
||||
use bevy_app::{prelude::*, Animation};
|
||||
use bevy_app::{prelude::*, AnimationSystems};
|
||||
#[cfg(feature = "default_font")]
|
||||
use bevy_asset::{load_internal_binary_asset, Handle};
|
||||
use bevy_asset::{AssetApp, AssetEvents};
|
||||
use bevy_asset::{AssetApp, AssetEventSystems};
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_render::{
|
||||
camera::CameraUpdateSystem, view::VisibilitySystems, ExtractSchedule, RenderApp,
|
||||
camera::CameraUpdateSystems, view::VisibilitySystems, ExtractSchedule, RenderApp,
|
||||
};
|
||||
use bevy_sprite::SpriteSystem;
|
||||
use bevy_sprite::SpriteSystems;
|
||||
|
||||
/// The raw data for the default font used by `bevy_text`
|
||||
#[cfg(feature = "default_font")]
|
||||
@ -101,7 +101,11 @@ pub enum YAxisOrientation {
|
||||
|
||||
/// System set in [`PostUpdate`] where all 2d text update systems are executed.
|
||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
|
||||
pub struct Update2dText;
|
||||
pub struct Text2dUpdateSystems;
|
||||
|
||||
/// Deprecated alias for [`Text2dUpdateSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `Text2dUpdateSystems`.")]
|
||||
pub type Update2dText = Text2dUpdateSystems;
|
||||
|
||||
impl Plugin for TextPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
@ -125,26 +129,26 @@ impl Plugin for TextPlugin {
|
||||
.add_systems(
|
||||
PostUpdate,
|
||||
(
|
||||
remove_dropped_font_atlas_sets.before(AssetEvents),
|
||||
remove_dropped_font_atlas_sets.before(AssetEventSystems),
|
||||
detect_text_needs_rerender::<Text2d>,
|
||||
update_text2d_layout
|
||||
// Potential conflict: `Assets<Image>`
|
||||
// In practice, they run independently since `bevy_render::camera_update_system`
|
||||
// will only ever observe its own render target, and `update_text2d_layout`
|
||||
// will never modify a pre-existing `Image` asset.
|
||||
.ambiguous_with(CameraUpdateSystem),
|
||||
.ambiguous_with(CameraUpdateSystems),
|
||||
calculate_bounds_text2d.in_set(VisibilitySystems::CalculateBounds),
|
||||
)
|
||||
.chain()
|
||||
.in_set(Update2dText)
|
||||
.after(Animation),
|
||||
.in_set(Text2dUpdateSystems)
|
||||
.after(AnimationSystems),
|
||||
)
|
||||
.add_systems(Last, trim_cosmic_cache);
|
||||
|
||||
if let Some(render_app) = app.get_sub_app_mut(RenderApp) {
|
||||
render_app.add_systems(
|
||||
ExtractSchedule,
|
||||
extract_text2d_sprite.after(SpriteSystem::ExtractSprites),
|
||||
extract_text2d_sprite.after(SpriteSystems::ExtractSprites),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ impl Default for Fixed {
|
||||
/// Runs [`FixedMain`] zero or more times based on delta of
|
||||
/// [`Time<Virtual>`](Virtual) and [`Time::overstep`].
|
||||
/// You can order your systems relative to this by using
|
||||
/// [`RunFixedMainLoopSystem`](bevy_app::prelude::RunFixedMainLoopSystem).
|
||||
/// [`RunFixedMainLoopSystems`](bevy_app::prelude::RunFixedMainLoopSystems).
|
||||
pub(super) fn run_fixed_main_schedule(world: &mut World) {
|
||||
let delta = world.resource::<Time<Virtual>>().delta();
|
||||
world.resource_mut::<Time<Fixed>>().accumulate(delta);
|
||||
|
@ -57,7 +57,11 @@ pub struct TimePlugin;
|
||||
/// Updates the elapsed time. Any system that interacts with [`Time`] component should run after
|
||||
/// this.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash, SystemSet)]
|
||||
pub struct TimeSystem;
|
||||
pub struct TimeSystems;
|
||||
|
||||
/// Deprecated alias for [`TimeSystems`].
|
||||
#[deprecated(since = "0.17.0", note = "Renamed to `TimeSystems`.")]
|
||||
pub type TimeSystem = TimeSystems;
|
||||
|
||||
impl Plugin for TimePlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
@ -79,12 +83,12 @@ impl Plugin for TimePlugin {
|
||||
app.add_systems(
|
||||
First,
|
||||
time_system
|
||||
.in_set(TimeSystem)
|
||||
.in_set(TimeSystems)
|
||||
.ambiguous_with(event_update_system),
|
||||
)
|
||||
.add_systems(
|
||||
RunFixedMainLoop,
|
||||
run_fixed_main_schedule.in_set(RunFixedMainLoopSystem::FixedMainLoop),
|
||||
run_fixed_main_schedule.in_set(RunFixedMainLoopSystems::FixedMainLoop),
|
||||
);
|
||||
|
||||
// Ensure the events are not dropped until `FixedMain` systems can observe them
|
||||
@ -109,7 +113,7 @@ pub enum TimeUpdateStrategy {
|
||||
/// [`Time`] will be updated to the specified [`Instant`] value each frame.
|
||||
/// In order for time to progress, this value must be manually updated each frame.
|
||||
///
|
||||
/// Note that the `Time` resource will not be updated until [`TimeSystem`] runs.
|
||||
/// Note that the `Time` resource will not be updated until [`TimeSystems`] runs.
|
||||
ManualInstant(Instant),
|
||||
/// [`Time`] will be incremented by the specified [`Duration`] each frame.
|
||||
ManualDuration(Duration),
|
||||
|
@ -31,13 +31,15 @@ use {
|
||||
/// if it doesn't have a [`ChildOf`](bevy_ecs::hierarchy::ChildOf) component.
|
||||
///
|
||||
/// [`GlobalTransform`] is managed by Bevy; it is computed by successively applying the [`Transform`] of each ancestor
|
||||
/// entity which has a Transform. This is done automatically by Bevy-internal systems in the system set
|
||||
/// [`TransformPropagate`](crate::TransformSystem::TransformPropagate).
|
||||
/// entity which has a Transform. This is done automatically by Bevy-internal systems in the [`TransformSystems::Propagate`]
|
||||
/// system set.
|
||||
///
|
||||
/// This system runs during [`PostUpdate`](bevy_app::PostUpdate). If you
|
||||
/// update the [`Transform`] of an entity in this schedule or after, you will notice a 1 frame lag
|
||||
/// before the [`GlobalTransform`] is updated.
|
||||
///
|
||||
/// [`TransformSystems::Propagate`]: crate::TransformSystems::Propagate
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// - [`transform`][transform_example]
|
||||
|
@ -49,13 +49,15 @@ fn assert_is_normalized(message: &str, length_squared: f32) {
|
||||
///
|
||||
/// [`GlobalTransform`] is the position of an entity relative to the reference frame.
|
||||
///
|
||||
/// [`GlobalTransform`] is updated from [`Transform`] by systems in the system set
|
||||
/// [`TransformPropagate`](crate::TransformSystem::TransformPropagate).
|
||||
/// [`GlobalTransform`] is updated from [`Transform`] in the [`TransformSystems::Propagate`]
|
||||
/// system set.
|
||||
///
|
||||
/// This system runs during [`PostUpdate`](bevy_app::PostUpdate). If you
|
||||
/// update the [`Transform`] of an entity during this set or after, you will notice a 1 frame lag
|
||||
/// before the [`GlobalTransform`] is updated.
|
||||
///
|
||||
/// [`TransformSystems::Propagate`]: crate::TransformSystems::Propagate
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// - [`transform`][transform_example]
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user