Skip to content

Commit f533905

Browse files
authored
Merge branch 'main' into thin-resources-and-sparse-sets
2 parents ff85a63 + 7fa4f74 commit f533905

File tree

45 files changed

+561
-594
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+561
-594
lines changed

crates/bevy_anti_aliasing/src/smaa/smaa.wgsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ fn area(dist: vec2<f32>, e1: f32, e2: f32, offset: f32) -> vec2<f32> {
894894
tex_coord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;
895895

896896
// Do it!
897-
return textureSample(area_texture, edges_sampler, tex_coord).rg;
897+
return textureSampleLevel(area_texture, edges_sampler, tex_coord, 0.0).rg;
898898
}
899899

900900
//-----------------------------------------------------------------------------

crates/bevy_ecs/src/entity_disabling.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
//! even if they have a `Position` component,
4545
//! but `Query<&Position, With<Disabled>>` or `Query<(&Position, Has<Disabled>)>` will see them.
4646
//!
47-
//! The [`Allows`](crate::query::Allows) query filter is designed to be used with default query filters,
47+
//! The [`Allow`](crate::query::Allow) query filter is designed to be used with default query filters,
4848
//! and ensures that the query will include entities both with and without the specified disabling component.
4949
//!
5050
//! Entities with disabling components are still present in the [`World`] and can be accessed directly,
@@ -161,9 +161,9 @@ pub struct Internal;
161161
/// To be more precise, this checks if the query's [`FilteredAccess`] contains the component,
162162
/// and if it does not, adds a [`Without`](crate::prelude::Without) filter for that component to the query.
163163
///
164-
/// [`Allows`](crate::query::Allows) and [`Has`](crate::prelude::Has) can be used to include entities
164+
/// [`Allow`](crate::query::Allow) and [`Has`](crate::prelude::Has) can be used to include entities
165165
/// with and without the disabling component.
166-
/// [`Allows`](crate::query::Allows) is a [`QueryFilter`](crate::query::QueryFilter) and will simply change
166+
/// [`Allow`](crate::query::Allow) is a [`QueryFilter`](crate::query::QueryFilter) and will simply change
167167
/// the list of shown entities, while [`Has`](crate::prelude::Has) is a [`QueryData`](crate::query::QueryData)
168168
/// and will allow you to see if each entity has the disabling component or not.
169169
///

crates/bevy_ecs/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub mod prelude {
8989
},
9090
name::{Name, NameOrEntity},
9191
observer::{Observer, On, Trigger},
92-
query::{Added, Allows, AnyOf, Changed, Has, Or, QueryBuilder, QueryState, With, Without},
92+
query::{Added, Allow, AnyOf, Changed, Has, Or, QueryBuilder, QueryState, With, Without},
9393
related,
9494
relationship::RelationshipTarget,
9595
resource::Resource,

crates/bevy_ecs/src/observer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ mod tests {
718718
assert_eq!(world.query::<&A>().query(&world).count(), 1);
719719
assert_eq!(
720720
world
721-
.query_filtered::<&Observer, Allows<Internal>>()
721+
.query_filtered::<&Observer, Allow<Internal>>()
722722
.query(&world)
723723
.count(),
724724
2

crates/bevy_ecs/src/query/access.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,10 @@ impl Access {
263263
/// This is for components whose values are not accessed (and thus will never cause conflicts),
264264
/// but whose presence in an archetype may affect query results.
265265
///
266-
/// Currently, this is only used for [`Has<T>`] and [`Allows<T>`].
266+
/// Currently, this is only used for [`Has<T>`] and [`Allow<T>`].
267267
///
268268
/// [`Has<T>`]: crate::query::Has
269-
/// [`Allows<T>`]: crate::query::filter::Allows
269+
/// [`Allow<T>`]: crate::query::filter::Allow
270270
pub fn add_archetypal(&mut self, index: ComponentId) {
271271
self.archetypal.grow_and_insert(index.index());
272272
}

crates/bevy_ecs/src/query/filter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,14 @@ all_tuples!(
569569
/// Allows a query to contain entities with the component `T`, bypassing [`DefaultQueryFilters`].
570570
///
571571
/// [`DefaultQueryFilters`]: crate::entity_disabling::DefaultQueryFilters
572-
pub struct Allows<T>(PhantomData<T>);
572+
pub struct Allow<T>(PhantomData<T>);
573573

574574
/// SAFETY:
575575
/// `update_component_access` does not add any accesses.
576576
/// This is sound because [`QueryFilter::filter_fetch`] does not access any components.
577577
/// `update_component_access` adds an archetypal filter for `T`.
578578
/// This is sound because it doesn't affect the query
579-
unsafe impl<T: Component> WorldQuery for Allows<T> {
579+
unsafe impl<T: Component> WorldQuery for Allow<T> {
580580
type Fetch<'w> = ();
581581
type State = ComponentId;
582582

@@ -608,13 +608,13 @@ unsafe impl<T: Component> WorldQuery for Allows<T> {
608608
}
609609

610610
fn matches_component_set(_: &ComponentId, _: &impl Fn(ComponentId) -> bool) -> bool {
611-
// Allows<T> always matches
611+
// Allow<T> always matches
612612
true
613613
}
614614
}
615615

616616
// SAFETY: WorldQuery impl performs no access at all
617-
unsafe impl<T: Component> QueryFilter for Allows<T> {
617+
unsafe impl<T: Component> QueryFilter for Allow<T> {
618618
const IS_ARCHETYPAL: bool = true;
619619

620620
#[inline(always)]

crates/bevy_ecs/src/query/state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2186,8 +2186,8 @@ mod tests {
21862186
let mut query = QueryState::<Has<C>>::new(&mut world);
21872187
assert_eq!(3, query.iter(&world).count());
21882188

2189-
// Allows should bypass the filter entirely
2190-
let mut query = QueryState::<(), Allows<C>>::new(&mut world);
2189+
// Allow should bypass the filter entirely
2190+
let mut query = QueryState::<(), Allow<C>>::new(&mut world);
21912191
assert_eq!(3, query.iter(&world).count());
21922192

21932193
// Other filters should still be respected

crates/bevy_feathers/src/lib.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
//! Please report issues, submit fixes and propose changes.
1919
//! Thanks for stress-testing; let's build something better together.
2020
21-
use bevy_app::{HierarchyPropagatePlugin, Plugin, PostUpdate, Update};
21+
use bevy_app::{HierarchyPropagatePlugin, Plugin, PostUpdate, PropagateSet};
2222
use bevy_asset::embedded_asset;
23-
use bevy_ecs::query::With;
23+
use bevy_ecs::{query::With, schedule::IntoScheduleConfigs};
2424
use bevy_text::{TextColor, TextFont};
25+
use bevy_ui::UiSystems;
2526
use bevy_ui_render::UiMaterialPlugin;
2627

2728
use crate::{
@@ -63,11 +64,18 @@ impl Plugin for FeathersPlugin {
6364
app.add_plugins((
6465
ControlsPlugin,
6566
CursorIconPlugin,
66-
HierarchyPropagatePlugin::<TextColor, With<ThemedText>>::new(Update),
67-
HierarchyPropagatePlugin::<TextFont, With<ThemedText>>::new(Update),
67+
HierarchyPropagatePlugin::<TextColor, With<ThemedText>>::new(PostUpdate),
68+
HierarchyPropagatePlugin::<TextFont, With<ThemedText>>::new(PostUpdate),
6869
UiMaterialPlugin::<AlphaPatternMaterial>::default(),
6970
));
7071

72+
// This needs to run in UiSystems::Propagate so the fonts are up-to-date for `measure_text_system`
73+
// and `detect_text_needs_rerender` in UiSystems::Content
74+
app.configure_sets(
75+
PostUpdate,
76+
PropagateSet::<TextFont>::default().in_set(UiSystems::Propagate),
77+
);
78+
7179
app.insert_resource(DefaultCursor(EntityCursor::System(
7280
bevy_window::SystemCursorIcon::Default,
7381
)));

crates/bevy_gizmos/src/primitives/dim2.rs

Lines changed: 7 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use super::helpers::*;
77
use bevy_color::Color;
88
use bevy_math::{
99
primitives::{
10-
Annulus, Arc2d, BoxedPolygon, BoxedPolyline2d, Capsule2d, Circle, CircularSector,
11-
CircularSegment, Ellipse, Line2d, Plane2d, Polygon, Polyline2d, Primitive2d, Rectangle,
12-
RegularPolygon, Rhombus, Segment2d, Triangle2d,
10+
Annulus, Arc2d, Capsule2d, Circle, CircularSector, CircularSegment, Ellipse, Line2d,
11+
Plane2d, Polygon, Polyline2d, Primitive2d, Rectangle, RegularPolygon, Rhombus, Segment2d,
12+
Triangle2d,
1313
},
1414
Dir2, Isometry2d, Rot2, Vec2,
1515
};
@@ -648,7 +648,7 @@ where
648648

649649
// polyline 2d
650650

651-
impl<const N: usize, Config, Clear> GizmoPrimitive2d<Polyline2d<N>> for GizmoBuffer<Config, Clear>
651+
impl<Config, Clear> GizmoPrimitive2d<Polyline2d> for GizmoBuffer<Config, Clear>
652652
where
653653
Config: GizmoConfigGroup,
654654
Clear: 'static + Send + Sync,
@@ -660,42 +660,7 @@ where
660660

661661
fn primitive_2d(
662662
&mut self,
663-
primitive: &Polyline2d<N>,
664-
isometry: impl Into<Isometry2d>,
665-
color: impl Into<Color>,
666-
) -> Self::Output<'_> {
667-
if !self.enabled {
668-
return;
669-
}
670-
671-
let isometry = isometry.into();
672-
673-
self.linestrip_2d(
674-
primitive
675-
.vertices
676-
.iter()
677-
.copied()
678-
.map(|vec2| isometry * vec2),
679-
color,
680-
);
681-
}
682-
}
683-
684-
// boxed polyline 2d
685-
686-
impl<Config, Clear> GizmoPrimitive2d<BoxedPolyline2d> for GizmoBuffer<Config, Clear>
687-
where
688-
Config: GizmoConfigGroup,
689-
Clear: 'static + Send + Sync,
690-
{
691-
type Output<'a>
692-
= ()
693-
where
694-
Self: 'a;
695-
696-
fn primitive_2d(
697-
&mut self,
698-
primitive: &BoxedPolyline2d,
663+
primitive: &Polyline2d,
699664
isometry: impl Into<Isometry2d>,
700665
color: impl Into<Color>,
701666
) -> Self::Output<'_> {
@@ -784,7 +749,7 @@ where
784749

785750
// polygon 2d
786751

787-
impl<const N: usize, Config, Clear> GizmoPrimitive2d<Polygon<N>> for GizmoBuffer<Config, Clear>
752+
impl<Config, Clear> GizmoPrimitive2d<Polygon> for GizmoBuffer<Config, Clear>
788753
where
789754
Config: GizmoConfigGroup,
790755
Clear: 'static + Send + Sync,
@@ -796,7 +761,7 @@ where
796761

797762
fn primitive_2d(
798763
&mut self,
799-
primitive: &Polygon<N>,
764+
primitive: &Polygon,
800765
isometry: impl Into<Isometry2d>,
801766
color: impl Into<Color>,
802767
) -> Self::Output<'_> {
@@ -827,49 +792,6 @@ where
827792
}
828793
}
829794

830-
// boxed polygon 2d
831-
832-
impl<Config, Clear> GizmoPrimitive2d<BoxedPolygon> for GizmoBuffer<Config, Clear>
833-
where
834-
Config: GizmoConfigGroup,
835-
Clear: 'static + Send + Sync,
836-
{
837-
type Output<'a>
838-
= ()
839-
where
840-
Self: 'a;
841-
842-
fn primitive_2d(
843-
&mut self,
844-
primitive: &BoxedPolygon,
845-
isometry: impl Into<Isometry2d>,
846-
color: impl Into<Color>,
847-
) -> Self::Output<'_> {
848-
if !self.enabled {
849-
return;
850-
}
851-
852-
let isometry = isometry.into();
853-
854-
let closing_point = {
855-
let first = primitive.vertices.first();
856-
(primitive.vertices.last() != first)
857-
.then_some(first)
858-
.flatten()
859-
.cloned()
860-
};
861-
self.linestrip_2d(
862-
primitive
863-
.vertices
864-
.iter()
865-
.copied()
866-
.chain(closing_point)
867-
.map(|vec2| isometry * vec2),
868-
color,
869-
);
870-
}
871-
}
872-
873795
// regular polygon 2d
874796

875797
impl<Config, Clear> GizmoPrimitive2d<RegularPolygon> for GizmoBuffer<Config, Clear>

crates/bevy_gizmos/src/primitives/dim3.rs

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use super::helpers::*;
55
use bevy_color::Color;
66
use bevy_math::{
77
primitives::{
8-
BoxedPolyline3d, Capsule3d, Cone, ConicalFrustum, Cuboid, Cylinder, Line3d, Plane3d,
9-
Polyline3d, Primitive3d, Segment3d, Sphere, Tetrahedron, Torus, Triangle3d,
8+
Capsule3d, Cone, ConicalFrustum, Cuboid, Cylinder, Line3d, Plane3d, Polyline3d,
9+
Primitive3d, Segment3d, Sphere, Tetrahedron, Torus, Triangle3d,
1010
},
1111
Dir3, Isometry3d, Quat, UVec2, Vec2, Vec3,
1212
};
@@ -235,7 +235,7 @@ where
235235

236236
// polyline 3d
237237

238-
impl<const N: usize, Config, Clear> GizmoPrimitive3d<Polyline3d<N>> for GizmoBuffer<Config, Clear>
238+
impl<Config, Clear> GizmoPrimitive3d<Polyline3d> for GizmoBuffer<Config, Clear>
239239
where
240240
Config: GizmoConfigGroup,
241241
Clear: 'static + Send + Sync,
@@ -247,34 +247,7 @@ where
247247

248248
fn primitive_3d(
249249
&mut self,
250-
primitive: &Polyline3d<N>,
251-
isometry: impl Into<Isometry3d>,
252-
color: impl Into<Color>,
253-
) -> Self::Output<'_> {
254-
if !self.enabled {
255-
return;
256-
}
257-
258-
let isometry = isometry.into();
259-
self.linestrip(primitive.vertices.map(|vec3| isometry * vec3), color);
260-
}
261-
}
262-
263-
// boxed polyline 3d
264-
265-
impl<Config, Clear> GizmoPrimitive3d<BoxedPolyline3d> for GizmoBuffer<Config, Clear>
266-
where
267-
Config: GizmoConfigGroup,
268-
Clear: 'static + Send + Sync,
269-
{
270-
type Output<'a>
271-
= ()
272-
where
273-
Self: 'a;
274-
275-
fn primitive_3d(
276-
&mut self,
277-
primitive: &BoxedPolyline3d,
250+
primitive: &Polyline3d,
278251
isometry: impl Into<Isometry3d>,
279252
color: impl Into<Color>,
280253
) -> Self::Output<'_> {
@@ -284,11 +257,7 @@ where
284257

285258
let isometry = isometry.into();
286259
self.linestrip(
287-
primitive
288-
.vertices
289-
.iter()
290-
.copied()
291-
.map(|vec3| isometry * vec3),
260+
primitive.vertices.iter().map(|vec3| isometry * *vec3),
292261
color,
293262
);
294263
}

0 commit comments

Comments
 (0)