Upgrade to Rust Edition 2024 (#17967)
# Objective - Fixes #17960 ## Solution - Followed the [edition upgrade guide](https://doc.rust-lang.org/edition-guide/editions/transitioning-an-existing-project-to-a-new-edition.html) ## Testing - CI --- ## Summary of Changes ### Documentation Indentation When using lists in documentation, proper indentation is now linted for. This means subsequent lines within the same list item must start at the same indentation level as the item. ```rust /* Valid */ /// - Item 1 /// Run-on sentence. /// - Item 2 struct Foo; /* Invalid */ /// - Item 1 /// Run-on sentence. /// - Item 2 struct Foo; ``` ### Implicit `!` to `()` Conversion `!` (the never return type, returned by `panic!`, etc.) no longer implicitly converts to `()`. This is particularly painful for systems with `todo!` or `panic!` statements, as they will no longer be functions returning `()` (or `Result<()>`), making them invalid systems for functions like `add_systems`. The ideal fix would be to accept functions returning `!` (or rather, _not_ returning), but this is blocked on the [stabilisation of the `!` type itself](https://doc.rust-lang.org/std/primitive.never.html), which is not done. The "simple" fix would be to add an explicit `-> ()` to system signatures (e.g., `|| { todo!() }` becomes `|| -> () { todo!() }`). However, this is _also_ banned, as there is an existing lint which (IMO, incorrectly) marks this as an unnecessary annotation. So, the "fix" (read: workaround) is to put these kinds of `|| -> ! { ... }` closuers into variables and give the variable an explicit type (e.g., `fn()`). ```rust // Valid let system: fn() = || todo!("Not implemented yet!"); app.add_systems(..., system); // Invalid app.add_systems(..., || todo!("Not implemented yet!")); ``` ### Temporary Variable Lifetimes The order in which temporary variables are dropped has changed. The simple fix here is _usually_ to just assign temporaries to a named variable before use. ### `gen` is a keyword We can no longer use the name `gen` as it is reserved for a future generator syntax. This involved replacing uses of the name `gen` with `r#gen` (the raw-identifier syntax). ### Formatting has changed Use statements have had the order of imports changed, causing a substantial +/-3,000 diff when applied. For now, I have opted-out of this change by amending `rustfmt.toml` ```toml style_edition = "2021" ``` This preserves the original formatting for now, reducing the size of this PR. It would be a simple followup to update this to 2024 and run `cargo fmt`. ### New `use<>` Opt-Out Syntax Lifetimes are now implicitly included in RPIT types. There was a handful of instances where it needed to be added to satisfy the borrow checker, but there may be more cases where it _should_ be added to avoid breakages in user code. ### `MyUnitStruct { .. }` is an invalid pattern Previously, you could match against unit structs (and unit enum variants) with a `{ .. }` destructuring. This is no longer valid. ### Pretty much every use of `ref` and `mut` are gone Pattern binding has changed to the point where these terms are largely unused now. They still serve a purpose, but it is far more niche now. ### `iter::repeat(...).take(...)` is bad New lint recommends using the more explicit `iter::repeat_n(..., ...)` instead. ## Migration Guide The lifetimes of functions using return-position impl-trait (RPIT) are likely _more_ conservative than they had been previously. If you encounter lifetime issues with such a function, please create an issue to investigate the addition of `+ use<...>`. ## Notes - Check the individual commits for a clearer breakdown for what _actually_ changed. --------- Co-authored-by: François Mockers <francois.mockers@vleue.com>
This commit is contained in:
parent
2953db7f8f
commit
5241e09671
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -335,6 +335,7 @@ jobs:
|
|||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- name: check for missing metadata
|
- name: check for missing metadata
|
||||||
id: missing-metadata
|
id: missing-metadata
|
||||||
run: cargo run -p build-templated-pages -- check-missing examples
|
run: cargo run -p build-templated-pages -- check-missing examples
|
||||||
@ -369,6 +370,7 @@ jobs:
|
|||||||
needs: check-missing-examples-in-docs
|
needs: check-missing-examples-in-docs
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- name: check for missing features
|
- name: check for missing features
|
||||||
id: missing-features
|
id: missing-features
|
||||||
run: cargo run -p build-templated-pages -- check-missing features
|
run: cargo run -p build-templated-pages -- check-missing features
|
||||||
@ -412,6 +414,7 @@ jobs:
|
|||||||
~/.cargo/git/db/
|
~/.cargo/git/db/
|
||||||
target/
|
target/
|
||||||
key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.toml') }}
|
key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.toml') }}
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- name: get MSRV
|
- name: get MSRV
|
||||||
id: msrv
|
id: msrv
|
||||||
run: |
|
run: |
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy"
|
name = "bevy"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
categories = ["game-engines", "graphics", "gui", "rendering"]
|
categories = ["game-engines", "graphics", "gui", "rendering"]
|
||||||
description = "A refreshingly simple data-driven game engine and app framework"
|
description = "A refreshingly simple data-driven game engine and app framework"
|
||||||
exclude = ["assets/", "tools/", ".github/", "crates/", "examples/wasm/assets/"]
|
exclude = ["assets/", "tools/", ".github/", "crates/", "examples/wasm/assets/"]
|
||||||
@ -10,7 +10,7 @@ keywords = ["game", "engine", "gamedev", "graphics", "bevy"]
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
documentation = "https://docs.rs/bevy"
|
documentation = "https://docs.rs/bevy"
|
||||||
rust-version = "1.83.0"
|
rust-version = "1.85.0"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "benches"
|
name = "benches"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Benchmarks that test Bevy's performance"
|
description = "Benchmarks that test Bevy's performance"
|
||||||
publish = false
|
publish = false
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
@ -95,7 +95,7 @@ fn all_added_detection_generic<T: Component + Default>(group: &mut BenchGroup, e
|
|||||||
let query = generic_filter_query::<Added<T>>(&mut world);
|
let query = generic_filter_query::<Added<T>>(&mut world);
|
||||||
(world, query)
|
(world, query)
|
||||||
},
|
},
|
||||||
|(ref mut world, ref mut query)| {
|
|(world, query)| {
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
for entity in query.iter(world) {
|
for entity in query.iter(world) {
|
||||||
black_box(entity);
|
black_box(entity);
|
||||||
@ -143,7 +143,7 @@ fn all_changed_detection_generic<T: Component<Mutability = Mutable> + Default +
|
|||||||
let query = generic_filter_query::<Changed<T>>(&mut world);
|
let query = generic_filter_query::<Changed<T>>(&mut world);
|
||||||
(world, query)
|
(world, query)
|
||||||
},
|
},
|
||||||
|(ref mut world, ref mut query)| {
|
|(world, query)| {
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
for entity in query.iter(world) {
|
for entity in query.iter(world) {
|
||||||
black_box(entity);
|
black_box(entity);
|
||||||
@ -196,7 +196,7 @@ fn few_changed_detection_generic<T: Component<Mutability = Mutable> + Default +
|
|||||||
let query = generic_filter_query::<Changed<T>>(&mut world);
|
let query = generic_filter_query::<Changed<T>>(&mut world);
|
||||||
(world, query)
|
(world, query)
|
||||||
},
|
},
|
||||||
|(ref mut world, ref mut query)| {
|
|(world, query)| {
|
||||||
for entity in query.iter(world) {
|
for entity in query.iter(world) {
|
||||||
black_box(entity);
|
black_box(entity);
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ fn none_changed_detection_generic<T: Component<Mutability = Mutable> + Default>(
|
|||||||
let query = generic_filter_query::<Changed<T>>(&mut world);
|
let query = generic_filter_query::<Changed<T>>(&mut world);
|
||||||
(world, query)
|
(world, query)
|
||||||
},
|
},
|
||||||
|(ref mut world, ref mut query)| {
|
|(world, query)| {
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
for entity in query.iter(world) {
|
for entity in query.iter(world) {
|
||||||
black_box(entity);
|
black_box(entity);
|
||||||
@ -343,7 +343,7 @@ fn multiple_archetype_none_changed_detection_generic<
|
|||||||
let query = generic_filter_query::<Changed<T>>(&mut world);
|
let query = generic_filter_query::<Changed<T>>(&mut world);
|
||||||
(world, query)
|
(world, query)
|
||||||
},
|
},
|
||||||
|(ref mut world, ref mut query)| {
|
|(world, query)| {
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
for entity in query.iter(world) {
|
for entity in query.iter(world) {
|
||||||
black_box(entity);
|
black_box(entity);
|
||||||
|
@ -12,7 +12,7 @@ impl Benchmark {
|
|||||||
let mut world = World::default();
|
let mut world = World::default();
|
||||||
|
|
||||||
let entities = world
|
let entities = world
|
||||||
.spawn_batch(core::iter::repeat(A(0.)).take(10000))
|
.spawn_batch(core::iter::repeat_n(A(0.), 10_000))
|
||||||
.collect();
|
.collect();
|
||||||
Self(world, entities)
|
Self(world, entities)
|
||||||
}
|
}
|
||||||
|
@ -19,15 +19,15 @@ impl<'w> Benchmark<'w> {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
|
|
||||||
world.spawn_batch(
|
world.spawn_batch(core::iter::repeat_n(
|
||||||
core::iter::repeat((
|
(
|
||||||
Transform(Mat4::from_scale(Vec3::ONE)),
|
Transform(Mat4::from_scale(Vec3::ONE)),
|
||||||
Position(Vec3::X),
|
Position(Vec3::X),
|
||||||
Rotation(Vec3::X),
|
Rotation(Vec3::X),
|
||||||
Velocity(Vec3::X),
|
Velocity(Vec3::X),
|
||||||
))
|
),
|
||||||
.take(10_000),
|
10_000,
|
||||||
);
|
));
|
||||||
|
|
||||||
let query = world.query::<(&Velocity, &mut Position)>();
|
let query = world.query::<(&Velocity, &mut Position)>();
|
||||||
Self(world, query)
|
Self(world, query)
|
||||||
|
@ -19,15 +19,15 @@ impl<'w> Benchmark<'w> {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
|
|
||||||
world.spawn_batch(
|
world.spawn_batch(core::iter::repeat_n(
|
||||||
core::iter::repeat((
|
(
|
||||||
Transform(Mat4::from_scale(Vec3::ONE)),
|
Transform(Mat4::from_scale(Vec3::ONE)),
|
||||||
Position(Vec3::X),
|
Position(Vec3::X),
|
||||||
Rotation(Vec3::X),
|
Rotation(Vec3::X),
|
||||||
Velocity(Vec3::X),
|
Velocity(Vec3::X),
|
||||||
))
|
),
|
||||||
.take(10_000),
|
10_000,
|
||||||
);
|
));
|
||||||
|
|
||||||
let query = world.query::<(&Velocity, &mut Position)>();
|
let query = world.query::<(&Velocity, &mut Position)>();
|
||||||
Self(world, query)
|
Self(world, query)
|
||||||
|
@ -21,15 +21,15 @@ impl<'w> Benchmark<'w> {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
|
|
||||||
world.spawn_batch(
|
world.spawn_batch(core::iter::repeat_n(
|
||||||
core::iter::repeat((
|
(
|
||||||
Transform(Mat4::from_scale(Vec3::ONE)),
|
Transform(Mat4::from_scale(Vec3::ONE)),
|
||||||
Position(Vec3::X),
|
Position(Vec3::X),
|
||||||
Rotation(Vec3::X),
|
Rotation(Vec3::X),
|
||||||
Velocity(Vec3::X),
|
Velocity(Vec3::X),
|
||||||
))
|
),
|
||||||
.take(10_000),
|
10_000,
|
||||||
);
|
));
|
||||||
|
|
||||||
let query = world.query::<(&Velocity, &mut Position)>();
|
let query = world.query::<(&Velocity, &mut Position)>();
|
||||||
Self(world, query)
|
Self(world, query)
|
||||||
|
@ -33,8 +33,8 @@ impl<'w> Benchmark<'w> {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
|
|
||||||
world.spawn_batch(
|
world.spawn_batch(core::iter::repeat_n(
|
||||||
core::iter::repeat((
|
(
|
||||||
Transform(Mat4::from_scale(Vec3::ONE)),
|
Transform(Mat4::from_scale(Vec3::ONE)),
|
||||||
Rotation(Vec3::X),
|
Rotation(Vec3::X),
|
||||||
Position::<0>(Vec3::X),
|
Position::<0>(Vec3::X),
|
||||||
@ -47,9 +47,9 @@ impl<'w> Benchmark<'w> {
|
|||||||
Velocity::<3>(Vec3::X),
|
Velocity::<3>(Vec3::X),
|
||||||
Position::<4>(Vec3::X),
|
Position::<4>(Vec3::X),
|
||||||
Velocity::<4>(Vec3::X),
|
Velocity::<4>(Vec3::X),
|
||||||
))
|
),
|
||||||
.take(10_000),
|
10_000,
|
||||||
);
|
));
|
||||||
|
|
||||||
let query = world.query();
|
let query = world.query();
|
||||||
Self(world, query)
|
Self(world, query)
|
||||||
|
@ -35,8 +35,8 @@ impl<'w> Benchmark<'w> {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
|
|
||||||
world.spawn_batch(
|
world.spawn_batch(core::iter::repeat_n(
|
||||||
core::iter::repeat((
|
(
|
||||||
Transform(Mat4::from_scale(Vec3::ONE)),
|
Transform(Mat4::from_scale(Vec3::ONE)),
|
||||||
Rotation(Vec3::X),
|
Rotation(Vec3::X),
|
||||||
Position::<0>(Vec3::X),
|
Position::<0>(Vec3::X),
|
||||||
@ -49,9 +49,9 @@ impl<'w> Benchmark<'w> {
|
|||||||
Velocity::<3>(Vec3::X),
|
Velocity::<3>(Vec3::X),
|
||||||
Position::<4>(Vec3::X),
|
Position::<4>(Vec3::X),
|
||||||
Velocity::<4>(Vec3::X),
|
Velocity::<4>(Vec3::X),
|
||||||
))
|
),
|
||||||
.take(10_000),
|
10_000,
|
||||||
);
|
));
|
||||||
|
|
||||||
let query = world.query();
|
let query = world.query();
|
||||||
Self(world, query)
|
Self(world, query)
|
||||||
|
@ -21,15 +21,15 @@ impl<'w> Benchmark<'w> {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
|
|
||||||
world.spawn_batch(
|
world.spawn_batch(core::iter::repeat_n(
|
||||||
core::iter::repeat((
|
(
|
||||||
Transform(Mat4::from_scale(Vec3::ONE)),
|
Transform(Mat4::from_scale(Vec3::ONE)),
|
||||||
Position(Vec3::X),
|
Position(Vec3::X),
|
||||||
Rotation(Vec3::X),
|
Rotation(Vec3::X),
|
||||||
Velocity(Vec3::X),
|
Velocity(Vec3::X),
|
||||||
))
|
),
|
||||||
.take(10_000),
|
10_000,
|
||||||
);
|
));
|
||||||
|
|
||||||
let query = world.query::<(&Velocity, &mut Position)>();
|
let query = world.query::<(&Velocity, &mut Position)>();
|
||||||
Self(world, query)
|
Self(world, query)
|
||||||
|
@ -19,15 +19,15 @@ impl Benchmark {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
|
|
||||||
world.spawn_batch(
|
world.spawn_batch(core::iter::repeat_n(
|
||||||
core::iter::repeat((
|
(
|
||||||
Transform(Mat4::from_scale(Vec3::ONE)),
|
Transform(Mat4::from_scale(Vec3::ONE)),
|
||||||
Position(Vec3::X),
|
Position(Vec3::X),
|
||||||
Rotation(Vec3::X),
|
Rotation(Vec3::X),
|
||||||
Velocity(Vec3::X),
|
Velocity(Vec3::X),
|
||||||
))
|
),
|
||||||
.take(10_000),
|
10_000,
|
||||||
);
|
));
|
||||||
|
|
||||||
fn query_system(mut query: Query<(&Velocity, &mut Position)>) {
|
fn query_system(mut query: Query<(&Velocity, &mut Position)>) {
|
||||||
for (velocity, mut position) in &mut query {
|
for (velocity, mut position) in &mut query {
|
||||||
|
@ -33,8 +33,8 @@ impl<'w> Benchmark<'w> {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
|
|
||||||
world.spawn_batch(
|
world.spawn_batch(core::iter::repeat_n(
|
||||||
core::iter::repeat((
|
(
|
||||||
Transform(Mat4::from_scale(Vec3::ONE)),
|
Transform(Mat4::from_scale(Vec3::ONE)),
|
||||||
Rotation(Vec3::X),
|
Rotation(Vec3::X),
|
||||||
Position::<0>(Vec3::X),
|
Position::<0>(Vec3::X),
|
||||||
@ -47,9 +47,9 @@ impl<'w> Benchmark<'w> {
|
|||||||
Velocity::<3>(Vec3::X),
|
Velocity::<3>(Vec3::X),
|
||||||
Position::<4>(Vec3::X),
|
Position::<4>(Vec3::X),
|
||||||
Velocity::<4>(Vec3::X),
|
Velocity::<4>(Vec3::X),
|
||||||
))
|
),
|
||||||
.take(10_000),
|
10_000,
|
||||||
);
|
));
|
||||||
|
|
||||||
let query = world.query();
|
let query = world.query();
|
||||||
Self(world, query)
|
Self(world, query)
|
||||||
|
@ -35,8 +35,8 @@ impl<'w> Benchmark<'w> {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
|
|
||||||
world.spawn_batch(
|
world.spawn_batch(core::iter::repeat_n(
|
||||||
core::iter::repeat((
|
(
|
||||||
Transform(Mat4::from_scale(Vec3::ONE)),
|
Transform(Mat4::from_scale(Vec3::ONE)),
|
||||||
Rotation(Vec3::X),
|
Rotation(Vec3::X),
|
||||||
Position::<0>(Vec3::X),
|
Position::<0>(Vec3::X),
|
||||||
@ -49,9 +49,9 @@ impl<'w> Benchmark<'w> {
|
|||||||
Velocity::<3>(Vec3::X),
|
Velocity::<3>(Vec3::X),
|
||||||
Position::<4>(Vec3::X),
|
Position::<4>(Vec3::X),
|
||||||
Velocity::<4>(Vec3::X),
|
Velocity::<4>(Vec3::X),
|
||||||
))
|
),
|
||||||
.take(10_000),
|
10_000,
|
||||||
);
|
));
|
||||||
|
|
||||||
let query = world.query();
|
let query = world.query();
|
||||||
Self(world, query)
|
Self(world, query)
|
||||||
|
@ -30,15 +30,15 @@ impl<'w> Benchmark<'w> {
|
|||||||
|
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
|
|
||||||
let iter = world.spawn_batch(
|
let iter = world.spawn_batch(core::iter::repeat_n(
|
||||||
core::iter::repeat((
|
(
|
||||||
Transform(Mat4::from_scale(Vec3::ONE)),
|
Transform(Mat4::from_scale(Vec3::ONE)),
|
||||||
Position(Vec3::X),
|
Position(Vec3::X),
|
||||||
Rotation(Vec3::X),
|
Rotation(Vec3::X),
|
||||||
Velocity(Vec3::X),
|
Velocity(Vec3::X),
|
||||||
))
|
),
|
||||||
.take(100_000),
|
100_000,
|
||||||
);
|
));
|
||||||
let entities = iter.into_iter().collect::<Vec<Entity>>();
|
let entities = iter.into_iter().collect::<Vec<Entity>>();
|
||||||
for i in 0..fragment {
|
for i in 0..fragment {
|
||||||
let mut e = world.entity_mut(entities[i as usize]);
|
let mut e = world.entity_mut(entities[i as usize]);
|
||||||
|
@ -11,16 +11,16 @@ fn make_entity(rng: &mut impl Rng, size: usize) -> Entity {
|
|||||||
// * For ids, half are in [0, size), half are unboundedly larger.
|
// * For ids, half are in [0, size), half are unboundedly larger.
|
||||||
// * For generations, half are in [1, 3), half are unboundedly larger.
|
// * For generations, half are in [1, 3), half are unboundedly larger.
|
||||||
|
|
||||||
let x: f64 = rng.gen();
|
let x: f64 = rng.r#gen();
|
||||||
let id = -(1.0 - x).log2() * (size as f64);
|
let id = -(1.0 - x).log2() * (size as f64);
|
||||||
let x: f64 = rng.gen();
|
let x: f64 = rng.r#gen();
|
||||||
let gen = 1.0 + -(1.0 - x).log2() * 2.0;
|
let generation = 1.0 + -(1.0 - x).log2() * 2.0;
|
||||||
|
|
||||||
// this is not reliable, but we're internal so a hack is ok
|
// this is not reliable, but we're internal so a hack is ok
|
||||||
let bits = ((gen as u64) << 32) | (id as u64);
|
let bits = ((generation as u64) << 32) | (id as u64);
|
||||||
let e = Entity::from_bits(bits);
|
let e = Entity::from_bits(bits);
|
||||||
assert_eq!(e.index(), id as u32);
|
assert_eq!(e.index(), id as u32);
|
||||||
assert_eq!(e.generation(), gen as u32);
|
assert_eq!(e.generation(), generation as u32);
|
||||||
e
|
e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,8 @@ fn concrete_list_apply(criterion: &mut Criterion) {
|
|||||||
let mut group = create_group(criterion, bench!("concrete_list_apply"));
|
let mut group = create_group(criterion, bench!("concrete_list_apply"));
|
||||||
|
|
||||||
let empty_base = |_: usize| Vec::<u64>::new;
|
let empty_base = |_: usize| Vec::<u64>::new;
|
||||||
let full_base = |size: usize| move || iter::repeat(0).take(size).collect::<Vec<u64>>();
|
let full_base = |size: usize| move || iter::repeat_n(0, size).collect::<Vec<u64>>();
|
||||||
let patch = |size: usize| iter::repeat(1).take(size).collect::<Vec<u64>>();
|
let patch = |size: usize| iter::repeat_n(1, size).collect::<Vec<u64>>();
|
||||||
|
|
||||||
list_apply(&mut group, "empty_base_concrete_patch", empty_base, patch);
|
list_apply(&mut group, "empty_base_concrete_patch", empty_base, patch);
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ fn concrete_list_clone_dynamic(criterion: &mut Criterion) {
|
|||||||
BenchmarkId::from_parameter(size),
|
BenchmarkId::from_parameter(size),
|
||||||
&size,
|
&size,
|
||||||
|bencher, &size| {
|
|bencher, &size| {
|
||||||
let v = iter::repeat(0).take(size).collect::<Vec<_>>();
|
let v = iter::repeat_n(0, size).collect::<Vec<_>>();
|
||||||
|
|
||||||
bencher.iter(|| black_box(&v).clone_dynamic());
|
bencher.iter(|| black_box(&v).clone_dynamic());
|
||||||
},
|
},
|
||||||
@ -123,7 +123,7 @@ fn dynamic_list_push(criterion: &mut Criterion) {
|
|||||||
BenchmarkId::from_parameter(size),
|
BenchmarkId::from_parameter(size),
|
||||||
&size,
|
&size,
|
||||||
|bencher, &size| {
|
|bencher, &size| {
|
||||||
let src = iter::repeat(()).take(size).collect::<Vec<_>>();
|
let src = iter::repeat_n((), size).collect::<Vec<_>>();
|
||||||
let dst = DynamicList::default();
|
let dst = DynamicList::default();
|
||||||
|
|
||||||
bencher.iter_batched(
|
bencher.iter_batched(
|
||||||
@ -146,8 +146,8 @@ fn dynamic_list_apply(criterion: &mut Criterion) {
|
|||||||
let mut group = create_group(criterion, bench!("dynamic_list_apply"));
|
let mut group = create_group(criterion, bench!("dynamic_list_apply"));
|
||||||
|
|
||||||
let empty_base = |_: usize| || Vec::<u64>::new().clone_dynamic();
|
let empty_base = |_: usize| || Vec::<u64>::new().clone_dynamic();
|
||||||
let full_base = |size: usize| move || iter::repeat(0).take(size).collect::<Vec<u64>>();
|
let full_base = |size: usize| move || iter::repeat_n(0, size).collect::<Vec<u64>>();
|
||||||
let patch = |size: usize| iter::repeat(1).take(size).collect::<Vec<u64>>();
|
let patch = |size: usize| iter::repeat_n(1, size).collect::<Vec<u64>>();
|
||||||
|
|
||||||
list_apply(&mut group, "empty_base_concrete_patch", empty_base, patch);
|
list_apply(&mut group, "empty_base_concrete_patch", empty_base, patch);
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ fn u64_to_n_byte_key(k: u64, n: usize) -> String {
|
|||||||
write!(&mut key, "{}", k).unwrap();
|
write!(&mut key, "{}", k).unwrap();
|
||||||
|
|
||||||
// Pad key to n bytes.
|
// Pad key to n bytes.
|
||||||
key.extend(iter::repeat('\0').take(n - key.len()));
|
key.extend(iter::repeat_n('\0', n - key.len()));
|
||||||
key
|
key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_a11y"
|
name = "bevy_a11y"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides accessibility support for Bevy Engine"
|
description = "Provides accessibility support for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_animation"
|
name = "bevy_animation"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides animation functionality for Bevy Engine"
|
description = "Provides animation functionality for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -884,10 +884,10 @@ impl ThreadedAnimationGraph {
|
|||||||
|
|
||||||
self.sorted_edge_ranges.clear();
|
self.sorted_edge_ranges.clear();
|
||||||
self.sorted_edge_ranges
|
self.sorted_edge_ranges
|
||||||
.extend(iter::repeat(0..0).take(node_count));
|
.extend(iter::repeat_n(0..0, node_count));
|
||||||
|
|
||||||
self.computed_masks.clear();
|
self.computed_masks.clear();
|
||||||
self.computed_masks.extend(iter::repeat(0).take(node_count));
|
self.computed_masks.extend(iter::repeat_n(0, node_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Recursively constructs the [`ThreadedAnimationGraph`] for the subtree
|
/// Recursively constructs the [`ThreadedAnimationGraph`] for the subtree
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_app"
|
name = "bevy_app"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides core App functionality for Bevy Engine"
|
description = "Provides core App functionality for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1435,7 +1435,7 @@ impl Termination for AppExit {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use core::{iter, marker::PhantomData};
|
use core::marker::PhantomData;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
@ -1659,7 +1659,7 @@ mod tests {
|
|||||||
struct Foo;
|
struct Foo;
|
||||||
|
|
||||||
let mut app = App::new();
|
let mut app = App::new();
|
||||||
app.world_mut().spawn_batch(iter::repeat(Foo).take(5));
|
app.world_mut().spawn_batch(core::iter::repeat_n(Foo, 5));
|
||||||
|
|
||||||
fn despawn_one_foo(mut commands: Commands, foos: Query<Entity, With<Foo>>) {
|
fn despawn_one_foo(mut commands: Commands, foos: Query<Entity, With<Foo>>) {
|
||||||
if let Some(e) = foos.iter().next() {
|
if let Some(e) = foos.iter().next() {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_asset"
|
name = "bevy_asset"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides asset functionality for Bevy Engine"
|
description = "Provides asset functionality for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_asset_macros"
|
name = "bevy_asset_macros"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Derive implementations for bevy_asset"
|
description = "Derive implementations for bevy_asset"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -552,8 +552,8 @@ impl<'a> LoadContext<'a> {
|
|||||||
let path = path.into();
|
let path = path.into();
|
||||||
let source = self.asset_server.get_source(path.source())?;
|
let source = self.asset_server.get_source(path.source())?;
|
||||||
let asset_reader = match self.asset_server.mode() {
|
let asset_reader = match self.asset_server.mode() {
|
||||||
AssetServerMode::Unprocessed { .. } => source.reader(),
|
AssetServerMode::Unprocessed => source.reader(),
|
||||||
AssetServerMode::Processed { .. } => source.processed_reader()?,
|
AssetServerMode::Processed => source.processed_reader()?,
|
||||||
};
|
};
|
||||||
let mut reader = asset_reader.read(path.path()).await?;
|
let mut reader = asset_reader.read(path.path()).await?;
|
||||||
let hash = if self.populate_hashes {
|
let hash = if self.populate_hashes {
|
||||||
|
@ -207,9 +207,12 @@ impl AssetProcessor {
|
|||||||
/// Processes all assets. This will:
|
/// Processes all assets. This will:
|
||||||
/// * For each "processed [`AssetSource`]:
|
/// * For each "processed [`AssetSource`]:
|
||||||
/// * Scan the [`ProcessorTransactionLog`] and recover from any failures detected
|
/// * Scan the [`ProcessorTransactionLog`] and recover from any failures detected
|
||||||
/// * Scan the processed [`AssetReader`](crate::io::AssetReader) to build the current view of already processed assets.
|
/// * Scan the processed [`AssetReader`](crate::io::AssetReader) to build the current view of
|
||||||
/// * Scan the unprocessed [`AssetReader`](crate::io::AssetReader) and remove any final processed assets that are invalid or no longer exist.
|
/// already processed assets.
|
||||||
/// * For each asset in the unprocessed [`AssetReader`](crate::io::AssetReader), kick off a new "process job", which will process the asset
|
/// * Scan the unprocessed [`AssetReader`](crate::io::AssetReader) and remove any final
|
||||||
|
/// processed assets that are invalid or no longer exist.
|
||||||
|
/// * For each asset in the unprocessed [`AssetReader`](crate::io::AssetReader), kick off a new
|
||||||
|
/// "process job", which will process the asset
|
||||||
/// (if the latest version of the asset has not been processed).
|
/// (if the latest version of the asset has not been processed).
|
||||||
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
|
||||||
pub fn process_assets(&self) {
|
pub fn process_assets(&self) {
|
||||||
|
@ -38,12 +38,13 @@ use std::path::{Path, PathBuf};
|
|||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
|
|
||||||
/// Loads and tracks the state of [`Asset`] values from a configured [`AssetReader`](crate::io::AssetReader). This can be used to kick off new asset loads and
|
/// Loads and tracks the state of [`Asset`] values from a configured [`AssetReader`](crate::io::AssetReader).
|
||||||
/// retrieve their current load states.
|
/// This can be used to kick off new asset loads and retrieve their current load states.
|
||||||
///
|
///
|
||||||
/// The general process to load an asset is:
|
/// The general process to load an asset is:
|
||||||
/// 1. Initialize a new [`Asset`] type with the [`AssetServer`] via [`AssetApp::init_asset`], which will internally call [`AssetServer::register_asset`]
|
/// 1. Initialize a new [`Asset`] type with the [`AssetServer`] via [`AssetApp::init_asset`], which
|
||||||
/// and set up related ECS [`Assets`] storage and systems.
|
/// will internally call [`AssetServer::register_asset`] and set up related ECS [`Assets`]
|
||||||
|
/// storage and systems.
|
||||||
/// 2. Register one or more [`AssetLoader`]s for that asset with [`AssetApp::init_asset_loader`]
|
/// 2. Register one or more [`AssetLoader`]s for that asset with [`AssetApp::init_asset_loader`]
|
||||||
/// 3. Add the asset to your asset folder (defaults to `assets`).
|
/// 3. Add the asset to your asset folder (defaults to `assets`).
|
||||||
/// 4. Call [`AssetServer::load`] with a path to your asset.
|
/// 4. Call [`AssetServer::load`] with a path to your asset.
|
||||||
@ -923,8 +924,8 @@ impl AssetServer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let asset_reader = match server.data.mode {
|
let asset_reader = match server.data.mode {
|
||||||
AssetServerMode::Unprocessed { .. } => source.reader(),
|
AssetServerMode::Unprocessed => source.reader(),
|
||||||
AssetServerMode::Processed { .. } => match source.processed_reader() {
|
AssetServerMode::Processed => match source.processed_reader() {
|
||||||
Ok(reader) => reader,
|
Ok(reader) => reader,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
error!(
|
error!(
|
||||||
@ -1235,8 +1236,8 @@ impl AssetServer {
|
|||||||
// Then the meta reader, if meta exists, will correspond to the meta for the current "version" of the asset.
|
// Then the meta reader, if meta exists, will correspond to the meta for the current "version" of the asset.
|
||||||
// See ProcessedAssetInfo::file_transaction_lock for more context
|
// See ProcessedAssetInfo::file_transaction_lock for more context
|
||||||
let asset_reader = match self.data.mode {
|
let asset_reader = match self.data.mode {
|
||||||
AssetServerMode::Unprocessed { .. } => source.reader(),
|
AssetServerMode::Unprocessed => source.reader(),
|
||||||
AssetServerMode::Processed { .. } => source.processed_reader()?,
|
AssetServerMode::Processed => source.processed_reader()?,
|
||||||
};
|
};
|
||||||
let reader = asset_reader.read(asset_path.path()).await?;
|
let reader = asset_reader.read(asset_path.path()).await?;
|
||||||
let read_meta = match &self.data.meta_check {
|
let read_meta = match &self.data.meta_check {
|
||||||
@ -1584,14 +1585,14 @@ pub fn handle_internal_asset_events(world: &mut World) {
|
|||||||
|
|
||||||
for source in server.data.sources.iter() {
|
for source in server.data.sources.iter() {
|
||||||
match server.data.mode {
|
match server.data.mode {
|
||||||
AssetServerMode::Unprocessed { .. } => {
|
AssetServerMode::Unprocessed => {
|
||||||
if let Some(receiver) = source.event_receiver() {
|
if let Some(receiver) = source.event_receiver() {
|
||||||
for event in receiver.try_iter() {
|
for event in receiver.try_iter() {
|
||||||
handle_event(source.id(), event);
|
handle_event(source.id(), event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AssetServerMode::Processed { .. } => {
|
AssetServerMode::Processed => {
|
||||||
if let Some(receiver) = source.processed_event_receiver() {
|
if let Some(receiver) = source.processed_event_receiver() {
|
||||||
for event in receiver.try_iter() {
|
for event in receiver.try_iter() {
|
||||||
handle_event(source.id(), event);
|
handle_event(source.id(), event);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_audio"
|
name = "bevy_audio"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides audio functionality for Bevy Engine"
|
description = "Provides audio functionality for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_color"
|
name = "bevy_color"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Types for representing and manipulating color values"
|
description = "Types for representing and manipulating color values"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
keywords = ["bevy", "color"]
|
keywords = ["bevy", "color"]
|
||||||
rust-version = "1.83.0"
|
rust-version = "1.85.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy_math = { path = "../bevy_math", version = "0.16.0-dev", default-features = false, features = [
|
bevy_math = { path = "../bevy_math", version = "0.16.0-dev", default-features = false, features = [
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "gen_tests"
|
name = "gen_tests"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_core_pipeline"
|
name = "bevy_core_pipeline"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
authors = [
|
authors = [
|
||||||
"Bevy Contributors <bevyengine@gmail.com>",
|
"Bevy Contributors <bevyengine@gmail.com>",
|
||||||
"Carter Anderson <mcanders1@gmail.com>",
|
"Carter Anderson <mcanders1@gmail.com>",
|
||||||
|
@ -152,7 +152,8 @@ impl ViewNode for BloomNode {
|
|||||||
render_context.command_encoder().push_debug_group("bloom");
|
render_context.command_encoder().push_debug_group("bloom");
|
||||||
|
|
||||||
let diagnostics = render_context.diagnostic_recorder();
|
let diagnostics = render_context.diagnostic_recorder();
|
||||||
let time_span = diagnostics.time_span(render_context.command_encoder(), "bloom");
|
let command_encoder = render_context.command_encoder();
|
||||||
|
let time_span = diagnostics.time_span(command_encoder, "bloom");
|
||||||
|
|
||||||
// First downsample pass
|
// First downsample pass
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_derive"
|
name = "bevy_derive"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides derive implementations for Bevy Engine"
|
description = "Provides derive implementations for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_derive_compile_fail"
|
name = "bevy_derive_compile_fail"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Compile fail tests for Bevy Engine's various macros"
|
description = "Compile fail tests for Bevy Engine's various macros"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -10,14 +10,20 @@ pub fn bevy_main(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
);
|
);
|
||||||
|
|
||||||
TokenStream::from(quote! {
|
TokenStream::from(quote! {
|
||||||
#[no_mangle]
|
// SAFETY: `#[bevy_main]` should only be placed on a single `main` function
|
||||||
|
// TODO: Potentially make `bevy_main` and unsafe attribute as there is a safety
|
||||||
|
// guarantee required from the caller.
|
||||||
|
#[unsafe(no_mangle)]
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
fn android_main(android_app: bevy::window::android_activity::AndroidApp) {
|
fn android_main(android_app: bevy::window::android_activity::AndroidApp) {
|
||||||
let _ = bevy::window::ANDROID_APP.set(android_app);
|
let _ = bevy::window::ANDROID_APP.set(android_app);
|
||||||
main();
|
main();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
// SAFETY: `#[bevy_main]` should only be placed on a single `main` function
|
||||||
|
// TODO: Potentially make `bevy_main` and unsafe attribute as there is a safety
|
||||||
|
// guarantee required from the caller.
|
||||||
|
#[unsafe(no_mangle)]
|
||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_os = "ios")]
|
||||||
extern "C" fn main_rs() {
|
extern "C" fn main_rs() {
|
||||||
main();
|
main();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_dev_tools"
|
name = "bevy_dev_tools"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Collection of developer tools for the Bevy Engine"
|
description = "Collection of developer tools for the Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_diagnostic"
|
name = "bevy_diagnostic"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides diagnostic functionality for Bevy Engine"
|
description = "Provides diagnostic functionality for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_dylib"
|
name = "bevy_dylib"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Force the Bevy Engine to be dynamically linked for faster linking"
|
description = "Force the Bevy Engine to be dynamically linked for faster linking"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_ecs"
|
name = "bevy_ecs"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Bevy Engine's entity component system"
|
description = "Bevy Engine's entity component system"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
keywords = ["ecs", "game", "bevy"]
|
keywords = ["ecs", "game", "bevy"]
|
||||||
categories = ["game-engines", "data-structures"]
|
categories = ["game-engines", "data-structures"]
|
||||||
rust-version = "1.83.0"
|
rust-version = "1.85.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "bevy_reflect", "async_executor"]
|
default = ["std", "bevy_reflect", "async_executor"]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_ecs_compile_fail"
|
name = "bevy_ecs_compile_fail"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Compile fail tests for Bevy Engine's entity component system"
|
description = "Compile fail tests for Bevy Engine's entity component system"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "bevy_ecs_macros"
|
name = "bevy_ecs_macros"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
description = "Bevy ECS Macros"
|
description = "Bevy ECS Macros"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -257,7 +257,7 @@ pub fn derive_component(input: TokenStream) -> TokenStream {
|
|||||||
|
|
||||||
fn visit_entities(data: &Data, bevy_ecs_path: &Path, is_relationship: bool) -> TokenStream2 {
|
fn visit_entities(data: &Data, bevy_ecs_path: &Path, is_relationship: bool) -> TokenStream2 {
|
||||||
match data {
|
match data {
|
||||||
Data::Struct(DataStruct { ref fields, .. }) => {
|
Data::Struct(DataStruct { fields, .. }) => {
|
||||||
let mut visited_fields = Vec::new();
|
let mut visited_fields = Vec::new();
|
||||||
let mut visited_indices = Vec::new();
|
let mut visited_indices = Vec::new();
|
||||||
match fields {
|
match fields {
|
||||||
@ -343,8 +343,8 @@ fn visit_entities(data: &Data, bevy_ecs_path: &Path, is_relationship: bool) -> T
|
|||||||
let field_member = ident_or_index(field.ident.as_ref(), index);
|
let field_member = ident_or_index(field.ident.as_ref(), index);
|
||||||
let field_ident = format_ident!("field_{}", field_member);
|
let field_ident = format_ident!("field_{}", field_member);
|
||||||
|
|
||||||
variant_fields.push(quote!(#field_member: ref #field_ident));
|
variant_fields.push(quote!(#field_member: #field_ident));
|
||||||
variant_fields_mut.push(quote!(#field_member: ref mut #field_ident));
|
variant_fields_mut.push(quote!(#field_member: #field_ident));
|
||||||
|
|
||||||
visit_variant_fields.push(quote!(#field_ident.visit_entities(&mut func);));
|
visit_variant_fields.push(quote!(#field_ident.visit_entities(&mut func);));
|
||||||
visit_variant_fields_mut
|
visit_variant_fields_mut
|
||||||
|
@ -1280,7 +1280,6 @@ impl<T: TrustedEntityBorrow> IndexMut<RangeToInclusive<usize>> for UniqueEntityS
|
|||||||
/// the [`IntoIterator`] impls on it and [`UniqueEntityVec`].
|
/// the [`IntoIterator`] impls on it and [`UniqueEntityVec`].
|
||||||
///
|
///
|
||||||
/// [`iter`]: `UniqueEntitySlice::iter`
|
/// [`iter`]: `UniqueEntitySlice::iter`
|
||||||
/// [`into_iter`]: UniqueEntitySlice::into_iter
|
|
||||||
pub type Iter<'a, T> = UniqueEntityIter<slice::Iter<'a, T>>;
|
pub type Iter<'a, T> = UniqueEntityIter<slice::Iter<'a, T>>;
|
||||||
|
|
||||||
impl<'a, T: TrustedEntityBorrow> UniqueEntityIter<slice::Iter<'a, T>> {
|
impl<'a, T: TrustedEntityBorrow> UniqueEntityIter<slice::Iter<'a, T>> {
|
||||||
|
@ -809,7 +809,7 @@ impl<T: TrustedEntityBorrow> Extend<T> for UniqueEntityVec<T> {
|
|||||||
let reserve = if self.is_empty() {
|
let reserve = if self.is_empty() {
|
||||||
iter.size_hint().0
|
iter.size_hint().0
|
||||||
} else {
|
} else {
|
||||||
(iter.size_hint().0 + 1) / 2
|
iter.size_hint().0.div_ceil(2)
|
||||||
};
|
};
|
||||||
self.reserve(reserve);
|
self.reserve(reserve);
|
||||||
// Internal iteration (fold/for_each) is known to result in better code generation
|
// Internal iteration (fold/for_each) is known to result in better code generation
|
||||||
@ -836,7 +836,7 @@ impl<'a, T: TrustedEntityBorrow + Copy + 'a> Extend<&'a T> for UniqueEntityVec<T
|
|||||||
let reserve = if self.is_empty() {
|
let reserve = if self.is_empty() {
|
||||||
iter.size_hint().0
|
iter.size_hint().0
|
||||||
} else {
|
} else {
|
||||||
(iter.size_hint().0 + 1) / 2
|
iter.size_hint().0.div_ceil(2)
|
||||||
};
|
};
|
||||||
self.reserve(reserve);
|
self.reserve(reserve);
|
||||||
// Internal iteration (fold/for_each) is known to result in better code generation
|
// Internal iteration (fold/for_each) is known to result in better code generation
|
||||||
|
@ -2,13 +2,6 @@
|
|||||||
unsafe_op_in_unsafe_fn,
|
unsafe_op_in_unsafe_fn,
|
||||||
reason = "See #11590. To be removed once all applicable unsafe code has an unsafe block with a safety comment."
|
reason = "See #11590. To be removed once all applicable unsafe code has an unsafe block with a safety comment."
|
||||||
)]
|
)]
|
||||||
#![cfg_attr(
|
|
||||||
test,
|
|
||||||
expect(
|
|
||||||
dependency_on_unit_never_type_fallback,
|
|
||||||
reason = "See #17340. To be removed once Edition 2024 is released"
|
|
||||||
)
|
|
||||||
)]
|
|
||||||
#![doc = include_str!("../README.md")]
|
#![doc = include_str!("../README.md")]
|
||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
any(docsrs, docsrs_dep),
|
any(docsrs, docsrs_dep),
|
||||||
|
@ -1115,11 +1115,10 @@ mod tests {
|
|||||||
fn observer_despawn() {
|
fn observer_despawn() {
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
|
|
||||||
let observer = world
|
let system: fn(Trigger<OnAdd, A>) = |_| {
|
||||||
.add_observer(|_: Trigger<OnAdd, A>| {
|
panic!("Observer triggered after being despawned.");
|
||||||
panic!("Observer triggered after being despawned.")
|
};
|
||||||
})
|
let observer = world.add_observer(system).id();
|
||||||
.id();
|
|
||||||
world.despawn(observer);
|
world.despawn(observer);
|
||||||
world.spawn(A).flush();
|
world.spawn(A).flush();
|
||||||
}
|
}
|
||||||
@ -1136,11 +1135,11 @@ mod tests {
|
|||||||
res.observed("remove_a");
|
res.observed("remove_a");
|
||||||
});
|
});
|
||||||
|
|
||||||
let observer = world
|
let system: fn(Trigger<OnRemove, B>) = |_: Trigger<OnRemove, B>| {
|
||||||
.add_observer(|_: Trigger<OnRemove, B>| {
|
panic!("Observer triggered after being despawned.");
|
||||||
panic!("Observer triggered after being despawned.")
|
};
|
||||||
})
|
|
||||||
.flush();
|
let observer = world.add_observer(system).flush();
|
||||||
world.despawn(observer);
|
world.despawn(observer);
|
||||||
|
|
||||||
world.despawn(entity);
|
world.despawn(entity);
|
||||||
@ -1166,9 +1165,10 @@ mod tests {
|
|||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
world.init_resource::<Order>();
|
world.init_resource::<Order>();
|
||||||
|
|
||||||
world
|
let system: fn(Trigger<EventA>) = |_| {
|
||||||
.spawn_empty()
|
panic!("Trigger routed to non-targeted entity.");
|
||||||
.observe(|_: Trigger<EventA>| panic!("Trigger routed to non-targeted entity."));
|
};
|
||||||
|
world.spawn_empty().observe(system);
|
||||||
world.add_observer(move |obs: Trigger<EventA>, mut res: ResMut<Order>| {
|
world.add_observer(move |obs: Trigger<EventA>, mut res: ResMut<Order>| {
|
||||||
assert_eq!(obs.target(), Entity::PLACEHOLDER);
|
assert_eq!(obs.target(), Entity::PLACEHOLDER);
|
||||||
res.observed("event_a");
|
res.observed("event_a");
|
||||||
@ -1187,9 +1187,11 @@ mod tests {
|
|||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
world.init_resource::<Order>();
|
world.init_resource::<Order>();
|
||||||
|
|
||||||
world
|
let system: fn(Trigger<EventA>) = |_| {
|
||||||
.spawn_empty()
|
panic!("Trigger routed to non-targeted entity.");
|
||||||
.observe(|_: Trigger<EventA>| panic!("Trigger routed to non-targeted entity."));
|
};
|
||||||
|
|
||||||
|
world.spawn_empty().observe(system);
|
||||||
let entity = world
|
let entity = world
|
||||||
.spawn_empty()
|
.spawn_empty()
|
||||||
.observe(|_: Trigger<EventA>, mut res: ResMut<Order>| res.observed("a_1"))
|
.observe(|_: Trigger<EventA>, mut res: ResMut<Order>| res.observed("a_1"))
|
||||||
|
@ -66,9 +66,7 @@ use variadics_please::all_tuples;
|
|||||||
/// # bevy_ecs::system::assert_is_system(my_system);
|
/// # bevy_ecs::system::assert_is_system(my_system);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [`matches_component_set`]: Self::matches_component_set
|
|
||||||
/// [`Query`]: crate::system::Query
|
/// [`Query`]: crate::system::Query
|
||||||
/// [`State`]: Self::State
|
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
|
@ -276,7 +276,7 @@ pub fn simple_cycles_in_component(graph: &DiGraph, scc: &[NodeId]) -> Vec<Vec<No
|
|||||||
stack.clear();
|
stack.clear();
|
||||||
stack.push((root, subgraph.neighbors(root)));
|
stack.push((root, subgraph.neighbors(root)));
|
||||||
while !stack.is_empty() {
|
while !stack.is_empty() {
|
||||||
let (ref node, successors) = stack.last_mut().unwrap();
|
let &mut (ref node, ref mut successors) = stack.last_mut().unwrap();
|
||||||
if let Some(next) = successors.next() {
|
if let Some(next) = successors.next() {
|
||||||
if next == root {
|
if next == root {
|
||||||
// found a cycle
|
// found a cycle
|
||||||
|
@ -1192,7 +1192,7 @@ mod tests {
|
|||||||
let mut schedule = Schedule::new(TestSchedule);
|
let mut schedule = Schedule::new(TestSchedule);
|
||||||
schedule
|
schedule
|
||||||
.set_executor_kind($executor)
|
.set_executor_kind($executor)
|
||||||
.add_systems(|| panic!("Executor ignored Stepping"));
|
.add_systems(|| -> () { panic!("Executor ignored Stepping") });
|
||||||
|
|
||||||
// Add our schedule to stepping & and enable stepping; this should
|
// Add our schedule to stepping & and enable stepping; this should
|
||||||
// prevent any systems in the schedule from running
|
// prevent any systems in the schedule from running
|
||||||
|
@ -2062,12 +2062,12 @@ mod tests {
|
|||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
let mut schedule = Schedule::default();
|
let mut schedule = Schedule::default();
|
||||||
|
|
||||||
|
let system: fn() = || {
|
||||||
|
panic!("This system must not run");
|
||||||
|
};
|
||||||
|
|
||||||
schedule.configure_sets(Set.run_if(|| false));
|
schedule.configure_sets(Set.run_if(|| false));
|
||||||
schedule.add_systems(
|
schedule.add_systems(system.ambiguous_with(|| ()).in_set(Set));
|
||||||
(|| panic!("This system must not run"))
|
|
||||||
.ambiguous_with(|| ())
|
|
||||||
.in_set(Set),
|
|
||||||
);
|
|
||||||
schedule.run(&mut world);
|
schedule.run(&mut world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1348,7 +1348,9 @@ mod tests {
|
|||||||
//
|
//
|
||||||
// first system will be configured as `run_if(|| false)`, so it can
|
// first system will be configured as `run_if(|| false)`, so it can
|
||||||
// just panic if called
|
// just panic if called
|
||||||
let first_system = move || panic!("first_system should not be run");
|
let first_system: fn() = move || {
|
||||||
|
panic!("first_system should not be run");
|
||||||
|
};
|
||||||
|
|
||||||
// The second system, we need to know when it has been called, so we'll
|
// The second system, we need to know when it has been called, so we'll
|
||||||
// add a resource for tracking if it has been run. The system will
|
// add a resource for tracking if it has been run. The system will
|
||||||
|
@ -82,7 +82,6 @@ use crate::{
|
|||||||
/// // NOTE: type inference fails here, so annotations are required on the closure.
|
/// // NOTE: type inference fails here, so annotations are required on the closure.
|
||||||
/// commands.queue(|w: &mut World| {
|
/// commands.queue(|w: &mut World| {
|
||||||
/// // Mutate the world however you want...
|
/// // Mutate the world however you want...
|
||||||
/// # todo!();
|
|
||||||
/// });
|
/// });
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -1648,7 +1648,10 @@ mod tests {
|
|||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn panic_inside_system() {
|
fn panic_inside_system() {
|
||||||
let mut world = World::new();
|
let mut world = World::new();
|
||||||
run_system(&mut world, || panic!("this system panics"));
|
let system: fn() = || {
|
||||||
|
panic!("this system panics");
|
||||||
|
};
|
||||||
|
run_system(&mut world, system);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_encase_derive"
|
name = "bevy_encase_derive"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Bevy derive macro for encase"
|
description = "Bevy derive macro for encase"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_gilrs"
|
name = "bevy_gilrs"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Gamepad system made using Gilrs for Bevy Engine"
|
description = "Gamepad system made using Gilrs for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_gizmos"
|
name = "bevy_gizmos"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides gizmos for Bevy Engine"
|
description = "Provides gizmos for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_gizmos_macros"
|
name = "bevy_gizmos_macros"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Derive implementations for bevy_gizmos"
|
description = "Derive implementations for bevy_gizmos"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -820,8 +820,7 @@ where
|
|||||||
let polymorphic_color: Color = color.into();
|
let polymorphic_color: Color = color.into();
|
||||||
let linear_color = LinearRgba::from(polymorphic_color);
|
let linear_color = LinearRgba::from(polymorphic_color);
|
||||||
|
|
||||||
self.list_colors
|
self.list_colors.extend(iter::repeat_n(linear_color, count));
|
||||||
.extend(iter::repeat(linear_color).take(count));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -187,9 +187,8 @@ where
|
|||||||
///
|
///
|
||||||
/// - `isometry` defines the translation and rotation of the grid.
|
/// - `isometry` defines the translation and rotation of the grid.
|
||||||
/// - the translation specifies the center of the grid
|
/// - the translation specifies the center of the grid
|
||||||
/// - defines the orientation of the grid, by default
|
/// - defines the orientation of the grid, by default we assume the grid is contained in a
|
||||||
/// we assume the grid is contained in a plane parallel
|
/// plane parallel to the XY plane
|
||||||
/// to the XY plane
|
|
||||||
/// - `cell_count`: defines the amount of cells in the x and y axes
|
/// - `cell_count`: defines the amount of cells in the x and y axes
|
||||||
/// - `spacing`: defines the distance between cells along the x and y axes
|
/// - `spacing`: defines the distance between cells along the x and y axes
|
||||||
/// - `color`: color of the grid
|
/// - `color`: color of the grid
|
||||||
@ -242,8 +241,7 @@ where
|
|||||||
///
|
///
|
||||||
/// - `isometry` defines the translation and rotation of the grid.
|
/// - `isometry` defines the translation and rotation of the grid.
|
||||||
/// - the translation specifies the center of the grid
|
/// - the translation specifies the center of the grid
|
||||||
/// - defines the orientation of the grid, by default
|
/// - defines the orientation of the grid, by default we assume the grid is aligned with all axes
|
||||||
/// we assume the grid is aligned with all axes
|
|
||||||
/// - `cell_count`: defines the amount of cells in the x, y and z axes
|
/// - `cell_count`: defines the amount of cells in the x, y and z axes
|
||||||
/// - `spacing`: defines the distance between cells along the x, y and z axes
|
/// - `spacing`: defines the distance between cells along the x, y and z axes
|
||||||
/// - `color`: color of the grid
|
/// - `color`: color of the grid
|
||||||
@ -296,8 +294,7 @@ where
|
|||||||
///
|
///
|
||||||
/// - `isometry` defines the translation and rotation of the grid.
|
/// - `isometry` defines the translation and rotation of the grid.
|
||||||
/// - the translation specifies the center of the grid
|
/// - the translation specifies the center of the grid
|
||||||
/// - defines the orientation of the grid, by default
|
/// - defines the orientation of the grid, by default we assume the grid is aligned with all axes
|
||||||
/// we assume the grid is aligned with all axes
|
|
||||||
/// - `cell_count`: defines the amount of cells in the x and y axes
|
/// - `cell_count`: defines the amount of cells in the x and y axes
|
||||||
/// - `spacing`: defines the distance between cells along the x and y axes
|
/// - `spacing`: defines the distance between cells along the x and y axes
|
||||||
/// - `color`: color of the grid
|
/// - `color`: color of the grid
|
||||||
|
@ -239,9 +239,8 @@ where
|
|||||||
///
|
///
|
||||||
/// - `isometry` defines the translation and rotation of the rectangle.
|
/// - `isometry` defines the translation and rotation of the rectangle.
|
||||||
/// - the translation specifies the center of the rectangle
|
/// - the translation specifies the center of the rectangle
|
||||||
/// - defines orientation of the rectangle, by default we
|
/// - defines orientation of the rectangle, by default we assume the rectangle is contained in
|
||||||
/// assume the rectangle is contained in a plane parallel
|
/// a plane parallel to the XY plane.
|
||||||
/// to the XY plane.
|
|
||||||
/// - `size`: defines the size of the rectangle. This refers to the 'outer size', similar to a bounding box.
|
/// - `size`: defines the size of the rectangle. This refers to the 'outer size', similar to a bounding box.
|
||||||
/// - `color`: color of the rectangle
|
/// - `color`: color of the rectangle
|
||||||
///
|
///
|
||||||
@ -294,8 +293,7 @@ where
|
|||||||
///
|
///
|
||||||
/// - `isometry` defines the translation and rotation of the rectangle.
|
/// - `isometry` defines the translation and rotation of the rectangle.
|
||||||
/// - the translation specifies the center of the rectangle
|
/// - the translation specifies the center of the rectangle
|
||||||
/// - defines orientation of the rectangle, by default we
|
/// - defines orientation of the rectangle, by default we assume the rectangle aligned with all axes.
|
||||||
/// assume the rectangle aligned with all axes.
|
|
||||||
/// - `size`: defines the size of the rectangle. This refers to the 'outer size', similar to a bounding box.
|
/// - `size`: defines the size of the rectangle. This refers to the 'outer size', similar to a bounding box.
|
||||||
/// - `color`: color of the rectangle
|
/// - `color`: color of the rectangle
|
||||||
///
|
///
|
||||||
@ -352,8 +350,7 @@ where
|
|||||||
///
|
///
|
||||||
/// - `isometry` defines the translation and rotation of the cuboid.
|
/// - `isometry` defines the translation and rotation of the cuboid.
|
||||||
/// - the translation specifies the center of the cuboid
|
/// - the translation specifies the center of the cuboid
|
||||||
/// - defines orientation of the cuboid, by default we
|
/// - defines orientation of the cuboid, by default we assume the cuboid aligned with all axes.
|
||||||
/// assume the cuboid aligned with all axes.
|
|
||||||
/// - `size`: defines the size of the cuboid. This refers to the 'outer size', similar to a bounding box.
|
/// - `size`: defines the size of the cuboid. This refers to the 'outer size', similar to a bounding box.
|
||||||
/// - `color`: color of the cuboid
|
/// - `color`: color of the cuboid
|
||||||
///
|
///
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_gltf"
|
name = "bevy_gltf"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Bevy Engine GLTF loading"
|
description = "Bevy Engine GLTF loading"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_image"
|
name = "bevy_image"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides image types for Bevy Engine"
|
description = "Provides image types for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_input"
|
name = "bevy_input"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides input functionality for Bevy Engine"
|
description = "Provides input functionality for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_input_focus"
|
name = "bevy_input_focus"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Keyboard focus management"
|
description = "Keyboard focus management"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
keywords = ["bevy"]
|
keywords = ["bevy"]
|
||||||
rust-version = "1.83.0"
|
rust-version = "1.85.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "bevy_reflect", "bevy_ecs/async_executor"]
|
default = ["std", "bevy_reflect", "bevy_ecs/async_executor"]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_internal"
|
name = "bevy_internal"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "An internal Bevy crate used to facilitate optional dynamic linking via the 'dynamic_linking' feature"
|
description = "An internal Bevy crate used to facilitate optional dynamic linking via the 'dynamic_linking' feature"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_log"
|
name = "bevy_log"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides logging for Bevy Engine"
|
description = "Provides logging for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -117,7 +117,10 @@ pub(crate) struct FlushGuard(SyncCell<tracing_chrome::FlushGuard>);
|
|||||||
/// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, PluginGroup};
|
/// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, PluginGroup};
|
||||||
/// # use bevy_log::LogPlugin;
|
/// # use bevy_log::LogPlugin;
|
||||||
/// fn main() {
|
/// fn main() {
|
||||||
|
/// # // SAFETY: Single-threaded
|
||||||
|
/// # unsafe {
|
||||||
/// std::env::set_var("NO_COLOR", "1");
|
/// std::env::set_var("NO_COLOR", "1");
|
||||||
|
/// # }
|
||||||
/// App::new()
|
/// App::new()
|
||||||
/// .add_plugins(DefaultPlugins)
|
/// .add_plugins(DefaultPlugins)
|
||||||
/// .run();
|
/// .run();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_macro_utils"
|
name = "bevy_macro_utils"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "A collection of utils for Bevy Engine"
|
description = "A collection of utils for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_math"
|
name = "bevy_math"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides math functionality for Bevy Engine"
|
description = "Provides math functionality for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
keywords = ["bevy"]
|
keywords = ["bevy"]
|
||||||
rust-version = "1.83.0"
|
rust-version = "1.85.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
glam = { version = "0.29", default-features = false, features = ["bytemuck"] }
|
glam = { version = "0.29", default-features = false, features = ["bytemuck"] }
|
||||||
|
@ -746,10 +746,9 @@ impl<P: VectorSpace> CubicNurbs<P> {
|
|||||||
}
|
}
|
||||||
let last_knots_value = control_points - 3;
|
let last_knots_value = control_points - 3;
|
||||||
Some(
|
Some(
|
||||||
core::iter::repeat(0.0)
|
core::iter::repeat_n(0.0, 4)
|
||||||
.take(4)
|
|
||||||
.chain((1..last_knots_value).map(|v| v as f32))
|
.chain((1..last_knots_value).map(|v| v as f32))
|
||||||
.chain(core::iter::repeat(last_knots_value as f32).take(4))
|
.chain(core::iter::repeat_n(last_knots_value as f32, 4))
|
||||||
.collect(),
|
.collect(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ impl ShapeSample for Rectangle {
|
|||||||
|
|
||||||
fn sample_boundary<R: Rng + ?Sized>(&self, rng: &mut R) -> Vec2 {
|
fn sample_boundary<R: Rng + ?Sized>(&self, rng: &mut R) -> Vec2 {
|
||||||
let primary_side = rng.gen_range(-1.0..1.0);
|
let primary_side = rng.gen_range(-1.0..1.0);
|
||||||
let other_side = if rng.gen() { -1.0 } else { 1.0 };
|
let other_side = if rng.r#gen() { -1.0 } else { 1.0 };
|
||||||
|
|
||||||
if self.half_size.x + self.half_size.y > 0.0 {
|
if self.half_size.x + self.half_size.y > 0.0 {
|
||||||
if rng.gen_bool((self.half_size.x / (self.half_size.x + self.half_size.y)) as f64) {
|
if rng.gen_bool((self.half_size.x / (self.half_size.x + self.half_size.y)) as f64) {
|
||||||
@ -261,7 +261,7 @@ impl ShapeSample for Cuboid {
|
|||||||
fn sample_boundary<R: Rng + ?Sized>(&self, rng: &mut R) -> Vec3 {
|
fn sample_boundary<R: Rng + ?Sized>(&self, rng: &mut R) -> Vec3 {
|
||||||
let primary_side1 = rng.gen_range(-1.0..1.0);
|
let primary_side1 = rng.gen_range(-1.0..1.0);
|
||||||
let primary_side2 = rng.gen_range(-1.0..1.0);
|
let primary_side2 = rng.gen_range(-1.0..1.0);
|
||||||
let other_side = if rng.gen() { -1.0 } else { 1.0 };
|
let other_side = if rng.r#gen() { -1.0 } else { 1.0 };
|
||||||
|
|
||||||
if let Ok(dist) = WeightedIndex::new([
|
if let Ok(dist) = WeightedIndex::new([
|
||||||
self.half_size.y * self.half_size.z,
|
self.half_size.y * self.half_size.z,
|
||||||
@ -425,7 +425,7 @@ impl ShapeSample for Cylinder {
|
|||||||
if self.radius + 2.0 * self.half_height > 0.0 {
|
if self.radius + 2.0 * self.half_height > 0.0 {
|
||||||
if rng.gen_bool((self.radius / (self.radius + 2.0 * self.half_height)) as f64) {
|
if rng.gen_bool((self.radius / (self.radius + 2.0 * self.half_height)) as f64) {
|
||||||
let Vec2 { x, y: z } = self.base().sample_interior(rng);
|
let Vec2 { x, y: z } = self.base().sample_interior(rng);
|
||||||
if rng.gen() {
|
if rng.r#gen() {
|
||||||
Vec3::new(x, self.half_height, z)
|
Vec3::new(x, self.half_height, z)
|
||||||
} else {
|
} else {
|
||||||
Vec3::new(x, -self.half_height, z)
|
Vec3::new(x, -self.half_height, z)
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
//! let random_direction1: Dir3 = random();
|
//! let random_direction1: Dir3 = random();
|
||||||
//!
|
//!
|
||||||
//! // Random direction using the rng constructed above
|
//! // Random direction using the rng constructed above
|
||||||
//! let random_direction2: Dir3 = rng.gen();
|
//! let random_direction2: Dir3 = rng.r#gen();
|
||||||
//!
|
//!
|
||||||
//! // The same as the previous but with different syntax
|
//! // The same as the previous but with different syntax
|
||||||
//! let random_direction3 = Dir3::from_rng(&mut rng);
|
//! let random_direction3 = Dir3::from_rng(&mut rng);
|
||||||
@ -49,7 +49,7 @@ where
|
|||||||
{
|
{
|
||||||
/// Construct a value of this type uniformly at random using `rng` as the source of randomness.
|
/// Construct a value of this type uniformly at random using `rng` as the source of randomness.
|
||||||
fn from_rng<R: Rng + ?Sized>(rng: &mut R) -> Self {
|
fn from_rng<R: Rng + ?Sized>(rng: &mut R) -> Self {
|
||||||
rng.gen()
|
rng.r#gen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_mesh"
|
name = "bevy_mesh"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides mesh types for Bevy Engine"
|
description = "Provides mesh types for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -881,7 +881,7 @@ impl Mesh {
|
|||||||
"mesh transform scale cannot be zero on more than one axis"
|
"mesh transform scale cannot be zero on more than one axis"
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(VertexAttributeValues::Float32x3(ref mut positions)) =
|
if let Some(VertexAttributeValues::Float32x3(positions)) =
|
||||||
self.attribute_mut(Mesh::ATTRIBUTE_POSITION)
|
self.attribute_mut(Mesh::ATTRIBUTE_POSITION)
|
||||||
{
|
{
|
||||||
// Apply scale, rotation, and translation to vertex positions
|
// Apply scale, rotation, and translation to vertex positions
|
||||||
@ -898,7 +898,7 @@ impl Mesh {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(VertexAttributeValues::Float32x3(ref mut normals)) =
|
if let Some(VertexAttributeValues::Float32x3(normals)) =
|
||||||
self.attribute_mut(Mesh::ATTRIBUTE_NORMAL)
|
self.attribute_mut(Mesh::ATTRIBUTE_NORMAL)
|
||||||
{
|
{
|
||||||
// Transform normals, taking into account non-uniform scaling and rotation
|
// Transform normals, taking into account non-uniform scaling and rotation
|
||||||
@ -909,7 +909,7 @@ impl Mesh {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(VertexAttributeValues::Float32x3(ref mut tangents)) =
|
if let Some(VertexAttributeValues::Float32x3(tangents)) =
|
||||||
self.attribute_mut(Mesh::ATTRIBUTE_TANGENT)
|
self.attribute_mut(Mesh::ATTRIBUTE_TANGENT)
|
||||||
{
|
{
|
||||||
// Transform tangents, taking into account non-uniform scaling and rotation
|
// Transform tangents, taking into account non-uniform scaling and rotation
|
||||||
@ -936,7 +936,7 @@ impl Mesh {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(VertexAttributeValues::Float32x3(ref mut positions)) =
|
if let Some(VertexAttributeValues::Float32x3(positions)) =
|
||||||
self.attribute_mut(Mesh::ATTRIBUTE_POSITION)
|
self.attribute_mut(Mesh::ATTRIBUTE_POSITION)
|
||||||
{
|
{
|
||||||
// Apply translation to vertex positions
|
// Apply translation to vertex positions
|
||||||
@ -958,7 +958,7 @@ impl Mesh {
|
|||||||
///
|
///
|
||||||
/// `Aabb` of entities with modified mesh are not updated automatically.
|
/// `Aabb` of entities with modified mesh are not updated automatically.
|
||||||
pub fn rotate_by(&mut self, rotation: Quat) {
|
pub fn rotate_by(&mut self, rotation: Quat) {
|
||||||
if let Some(VertexAttributeValues::Float32x3(ref mut positions)) =
|
if let Some(VertexAttributeValues::Float32x3(positions)) =
|
||||||
self.attribute_mut(Mesh::ATTRIBUTE_POSITION)
|
self.attribute_mut(Mesh::ATTRIBUTE_POSITION)
|
||||||
{
|
{
|
||||||
// Apply rotation to vertex positions
|
// Apply rotation to vertex positions
|
||||||
@ -972,7 +972,7 @@ impl Mesh {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(VertexAttributeValues::Float32x3(ref mut normals)) =
|
if let Some(VertexAttributeValues::Float32x3(normals)) =
|
||||||
self.attribute_mut(Mesh::ATTRIBUTE_NORMAL)
|
self.attribute_mut(Mesh::ATTRIBUTE_NORMAL)
|
||||||
{
|
{
|
||||||
// Transform normals
|
// Transform normals
|
||||||
@ -981,7 +981,7 @@ impl Mesh {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(VertexAttributeValues::Float32x3(ref mut tangents)) =
|
if let Some(VertexAttributeValues::Float32x3(tangents)) =
|
||||||
self.attribute_mut(Mesh::ATTRIBUTE_TANGENT)
|
self.attribute_mut(Mesh::ATTRIBUTE_TANGENT)
|
||||||
{
|
{
|
||||||
// Transform tangents
|
// Transform tangents
|
||||||
@ -1010,7 +1010,7 @@ impl Mesh {
|
|||||||
"mesh transform scale cannot be zero on more than one axis"
|
"mesh transform scale cannot be zero on more than one axis"
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(VertexAttributeValues::Float32x3(ref mut positions)) =
|
if let Some(VertexAttributeValues::Float32x3(positions)) =
|
||||||
self.attribute_mut(Mesh::ATTRIBUTE_POSITION)
|
self.attribute_mut(Mesh::ATTRIBUTE_POSITION)
|
||||||
{
|
{
|
||||||
// Apply scale to vertex positions
|
// Apply scale to vertex positions
|
||||||
@ -1024,7 +1024,7 @@ impl Mesh {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(VertexAttributeValues::Float32x3(ref mut normals)) =
|
if let Some(VertexAttributeValues::Float32x3(normals)) =
|
||||||
self.attribute_mut(Mesh::ATTRIBUTE_NORMAL)
|
self.attribute_mut(Mesh::ATTRIBUTE_NORMAL)
|
||||||
{
|
{
|
||||||
// Transform normals, taking into account non-uniform scaling
|
// Transform normals, taking into account non-uniform scaling
|
||||||
@ -1033,7 +1033,7 @@ impl Mesh {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(VertexAttributeValues::Float32x3(ref mut tangents)) =
|
if let Some(VertexAttributeValues::Float32x3(tangents)) =
|
||||||
self.attribute_mut(Mesh::ATTRIBUTE_TANGENT)
|
self.attribute_mut(Mesh::ATTRIBUTE_TANGENT)
|
||||||
{
|
{
|
||||||
// Transform tangents, taking into account non-uniform scaling
|
// Transform tangents, taking into account non-uniform scaling
|
||||||
@ -1096,7 +1096,7 @@ impl Mesh {
|
|||||||
/// Normalize joint weights so they sum to 1.
|
/// Normalize joint weights so they sum to 1.
|
||||||
pub fn normalize_joint_weights(&mut self) {
|
pub fn normalize_joint_weights(&mut self) {
|
||||||
if let Some(joints) = self.attribute_mut(Self::ATTRIBUTE_JOINT_WEIGHT) {
|
if let Some(joints) = self.attribute_mut(Self::ATTRIBUTE_JOINT_WEIGHT) {
|
||||||
let VertexAttributeValues::Float32x4(ref mut joints) = joints else {
|
let VertexAttributeValues::Float32x4(joints) = joints else {
|
||||||
panic!("unexpected joint weight format");
|
panic!("unexpected joint weight format");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ use bevy_image::Image;
|
|||||||
use bevy_math::Vec3;
|
use bevy_math::Vec3;
|
||||||
use bevy_reflect::prelude::*;
|
use bevy_reflect::prelude::*;
|
||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
use core::iter;
|
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use wgpu_types::{Extent3d, TextureDimension, TextureFormat};
|
use wgpu_types::{Extent3d, TextureDimension, TextureFormat};
|
||||||
|
|
||||||
@ -77,7 +76,7 @@ impl MorphTargetImage {
|
|||||||
buffer.extend_from_slice(bytemuck::bytes_of(&to_add));
|
buffer.extend_from_slice(bytemuck::bytes_of(&to_add));
|
||||||
}
|
}
|
||||||
// Pad each layer so that they fit width * height
|
// Pad each layer so that they fit width * height
|
||||||
buffer.extend(iter::repeat(0).take(padding as usize * size_of::<f32>()));
|
buffer.extend(core::iter::repeat_n(0, padding as usize * size_of::<f32>()));
|
||||||
debug_assert_eq!(buffer.len(), layer_byte_count);
|
debug_assert_eq!(buffer.len(), layer_byte_count);
|
||||||
buffer
|
buffer
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_mikktspace"
|
name = "bevy_mikktspace"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
authors = [
|
authors = [
|
||||||
"Benjamin Wasty <benny.wasty@gmail.com>",
|
"Benjamin Wasty <benny.wasty@gmail.com>",
|
||||||
"David Harvey-Macaulay <alteous@outlook.com>",
|
"David Harvey-Macaulay <alteous@outlook.com>",
|
||||||
@ -13,7 +13,7 @@ homepage = "https://bevyengine.org"
|
|||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
license = "Zlib AND (MIT OR Apache-2.0)"
|
license = "Zlib AND (MIT OR Apache-2.0)"
|
||||||
keywords = ["bevy", "3D", "graphics", "algorithm", "tangent"]
|
keywords = ["bevy", "3D", "graphics", "algorithm", "tangent"]
|
||||||
rust-version = "1.76.0"
|
rust-version = "1.85.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
//! This example demonstrates how to generate a mesh.
|
//! This example demonstrates how to generate a mesh.
|
||||||
|
|
||||||
#![allow(clippy::bool_assert_comparison, clippy::useless_conversion)]
|
#![allow(
|
||||||
|
clippy::bool_assert_comparison,
|
||||||
|
clippy::useless_conversion,
|
||||||
|
reason = "Crate auto-generated with many non-idiomatic decisions. See #7372 for details."
|
||||||
|
)]
|
||||||
|
|
||||||
use glam::{Vec2, Vec3};
|
use glam::{Vec2, Vec3};
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
#![expect(
|
#![expect(
|
||||||
clippy::bool_assert_comparison,
|
clippy::bool_assert_comparison,
|
||||||
clippy::semicolon_if_nothing_returned,
|
clippy::semicolon_if_nothing_returned,
|
||||||
clippy::useless_conversion
|
clippy::useless_conversion,
|
||||||
|
reason = "Crate auto-generated with many non-idiomatic decisions. See #7372 for details."
|
||||||
)]
|
)]
|
||||||
|
|
||||||
use bevy_mikktspace::{generate_tangents, Geometry};
|
use bevy_mikktspace::{generate_tangents, Geometry};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_pbr"
|
name = "bevy_pbr"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Adds PBR rendering to Bevy Engine"
|
description = "Adds PBR rendering to Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -496,7 +496,7 @@ pub(crate) fn assign_objects_to_clusters(
|
|||||||
|
|
||||||
// initialize empty cluster bounding spheres
|
// initialize empty cluster bounding spheres
|
||||||
cluster_aabb_spheres.clear();
|
cluster_aabb_spheres.clear();
|
||||||
cluster_aabb_spheres.extend(core::iter::repeat(None).take(cluster_count));
|
cluster_aabb_spheres.extend(core::iter::repeat_n(None, cluster_count));
|
||||||
|
|
||||||
// Calculate the x/y/z cluster frustum planes in view space
|
// Calculate the x/y/z cluster frustum planes in view space
|
||||||
let mut x_planes = Vec::with_capacity(clusters.dimensions.x as usize + 1);
|
let mut x_planes = Vec::with_capacity(clusters.dimensions.x as usize + 1);
|
||||||
@ -845,7 +845,7 @@ pub(crate) fn assign_objects_to_clusters(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClusterableObjectType::Decal { .. } => {
|
ClusterableObjectType::Decal => {
|
||||||
// Decals currently affect all clusters in their
|
// Decals currently affect all clusters in their
|
||||||
// bounding sphere.
|
// bounding sphere.
|
||||||
//
|
//
|
||||||
|
@ -1229,8 +1229,8 @@ impl<M: Material> RenderAsset for PreparedMaterial<M> {
|
|||||||
render_device,
|
render_device,
|
||||||
pipeline,
|
pipeline,
|
||||||
default_opaque_render_method,
|
default_opaque_render_method,
|
||||||
ref mut bind_group_allocator,
|
bind_group_allocator,
|
||||||
ref mut render_material_bindings,
|
render_material_bindings,
|
||||||
opaque_draw_functions,
|
opaque_draw_functions,
|
||||||
alpha_mask_draw_functions,
|
alpha_mask_draw_functions,
|
||||||
transmissive_draw_functions,
|
transmissive_draw_functions,
|
||||||
@ -1239,7 +1239,7 @@ impl<M: Material> RenderAsset for PreparedMaterial<M> {
|
|||||||
alpha_mask_prepass_draw_functions,
|
alpha_mask_prepass_draw_functions,
|
||||||
opaque_deferred_draw_functions,
|
opaque_deferred_draw_functions,
|
||||||
alpha_mask_deferred_draw_functions,
|
alpha_mask_deferred_draw_functions,
|
||||||
ref mut material_param,
|
material_param,
|
||||||
): &mut SystemParamItem<Self::Param>,
|
): &mut SystemParamItem<Self::Param>,
|
||||||
) -> Result<Self, PrepareAssetError<Self::SourceAsset>> {
|
) -> Result<Self, PrepareAssetError<Self::SourceAsset>> {
|
||||||
let draw_opaque_pbr = opaque_draw_functions.read().id::<DrawMaterial<M>>();
|
let draw_opaque_pbr = opaque_draw_functions.read().id::<DrawMaterial<M>>();
|
||||||
@ -1394,14 +1394,9 @@ impl<M: Material> RenderAsset for PreparedMaterial<M> {
|
|||||||
|
|
||||||
fn unload_asset(
|
fn unload_asset(
|
||||||
source_asset: AssetId<Self::SourceAsset>,
|
source_asset: AssetId<Self::SourceAsset>,
|
||||||
(
|
(_, _, _, bind_group_allocator, render_material_bindings, ..): &mut SystemParamItem<
|
||||||
_,
|
Self::Param,
|
||||||
_,
|
>,
|
||||||
_,
|
|
||||||
ref mut bind_group_allocator,
|
|
||||||
ref mut render_material_bindings,
|
|
||||||
..,
|
|
||||||
): &mut SystemParamItem<Self::Param>,
|
|
||||||
) {
|
) {
|
||||||
let Some(material_binding_id) = render_material_bindings.remove(&source_asset.untyped())
|
let Some(material_binding_id) = render_material_bindings.remove(&source_asset.untyped())
|
||||||
else {
|
else {
|
||||||
|
@ -102,11 +102,13 @@ impl MeshletMesh {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let mut simplification_errors = iter::repeat(MeshletSimplificationError {
|
let mut simplification_errors = iter::repeat_n(
|
||||||
|
MeshletSimplificationError {
|
||||||
group_error: f16::ZERO,
|
group_error: f16::ZERO,
|
||||||
parent_group_error: f16::MAX,
|
parent_group_error: f16::MAX,
|
||||||
})
|
},
|
||||||
.take(meshlets.len())
|
meshlets.len(),
|
||||||
|
)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut vertex_locks = vec![false; vertices.vertex_count];
|
let mut vertex_locks = vec![false; vertices.vertex_count];
|
||||||
@ -187,13 +189,13 @@ impl MeshletMesh {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
simplification_errors.extend(
|
simplification_errors.extend(iter::repeat_n(
|
||||||
iter::repeat(MeshletSimplificationError {
|
MeshletSimplificationError {
|
||||||
group_error,
|
group_error,
|
||||||
parent_group_error: f16::MAX,
|
parent_group_error: f16::MAX,
|
||||||
})
|
},
|
||||||
.take(new_meshlet_ids.len()),
|
new_meshlet_ids.len(),
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set simplification queue to the list of newly created meshlets
|
// Set simplification queue to the list of newly created meshlets
|
||||||
|
@ -455,7 +455,7 @@ pub fn prepare_meshlet_per_frame_resources(
|
|||||||
let index = instance_index / 32;
|
let index = instance_index / 32;
|
||||||
let bit = instance_index - index * 32;
|
let bit = instance_index - index * 32;
|
||||||
if vec.len() <= index {
|
if vec.len() <= index {
|
||||||
vec.extend(iter::repeat(0).take(index - vec.len() + 1));
|
vec.extend(iter::repeat_n(0, index - vec.len() + 1));
|
||||||
}
|
}
|
||||||
vec[index] |= 1 << bit;
|
vec[index] |= 1 << bit;
|
||||||
}
|
}
|
||||||
|
@ -918,8 +918,8 @@ impl Node for LateGpuPreprocessNode {
|
|||||||
..
|
..
|
||||||
},
|
},
|
||||||
Some(PhasePreprocessBindGroups::IndirectOcclusionCulling {
|
Some(PhasePreprocessBindGroups::IndirectOcclusionCulling {
|
||||||
late_indexed: ref maybe_late_indexed_bind_group,
|
late_indexed: maybe_late_indexed_bind_group,
|
||||||
late_non_indexed: ref maybe_late_non_indexed_bind_group,
|
late_non_indexed: maybe_late_non_indexed_bind_group,
|
||||||
..
|
..
|
||||||
}),
|
}),
|
||||||
Some(late_indexed_indirect_parameters_buffer),
|
Some(late_indexed_indirect_parameters_buffer),
|
||||||
@ -1747,9 +1747,9 @@ pub fn prepare_preprocess_bind_groups(
|
|||||||
) {
|
) {
|
||||||
// Grab the `BatchedInstanceBuffers`.
|
// Grab the `BatchedInstanceBuffers`.
|
||||||
let BatchedInstanceBuffers {
|
let BatchedInstanceBuffers {
|
||||||
current_input_buffer: ref current_input_buffer_vec,
|
current_input_buffer: current_input_buffer_vec,
|
||||||
previous_input_buffer: ref previous_input_buffer_vec,
|
previous_input_buffer: previous_input_buffer_vec,
|
||||||
ref phase_instance_buffers,
|
phase_instance_buffers,
|
||||||
} = batched_instance_buffers.into_inner();
|
} = batched_instance_buffers.into_inner();
|
||||||
|
|
||||||
let (Some(current_input_buffer), Some(previous_input_buffer)) = (
|
let (Some(current_input_buffer), Some(previous_input_buffer)) = (
|
||||||
|
@ -1675,7 +1675,7 @@ pub fn collect_meshes_for_gpu_building(
|
|||||||
frame_count: Res<FrameCount>,
|
frame_count: Res<FrameCount>,
|
||||||
mut meshes_to_reextract_next_frame: ResMut<MeshesToReextractNextFrame>,
|
mut meshes_to_reextract_next_frame: ResMut<MeshesToReextractNextFrame>,
|
||||||
) {
|
) {
|
||||||
let RenderMeshInstances::GpuBuilding(ref mut render_mesh_instances) =
|
let RenderMeshInstances::GpuBuilding(render_mesh_instances) =
|
||||||
render_mesh_instances.into_inner()
|
render_mesh_instances.into_inner()
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
@ -1686,8 +1686,8 @@ pub fn collect_meshes_for_gpu_building(
|
|||||||
|
|
||||||
// Collect render mesh instances. Build up the uniform buffer.
|
// Collect render mesh instances. Build up the uniform buffer.
|
||||||
let gpu_preprocessing::BatchedInstanceBuffers {
|
let gpu_preprocessing::BatchedInstanceBuffers {
|
||||||
ref mut current_input_buffer,
|
current_input_buffer,
|
||||||
ref mut previous_input_buffer,
|
previous_input_buffer,
|
||||||
..
|
..
|
||||||
} = batched_instance_buffers.into_inner();
|
} = batched_instance_buffers.into_inner();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_picking"
|
name = "bevy_picking"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides screen picking functionality for Bevy Engine"
|
description = "Provides screen picking functionality for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_platform_support"
|
name = "bevy_platform_support"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Platform compatibility support for Bevy Engine"
|
description = "Platform compatibility support for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_ptr"
|
name = "bevy_ptr"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Utilities for working with untyped pointers in a more safe way"
|
description = "Utilities for working with untyped pointers in a more safe way"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
keywords = ["bevy", "no_std"]
|
keywords = ["bevy", "no_std"]
|
||||||
rust-version = "1.81.0"
|
rust-version = "1.85.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
||||||
|
@ -413,9 +413,10 @@ impl<'a> OwningPtr<'a> {
|
|||||||
/// Consumes a value and creates an [`OwningPtr`] to it while ensuring a double drop does not happen.
|
/// Consumes a value and creates an [`OwningPtr`] to it while ensuring a double drop does not happen.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn make<T, F: FnOnce(OwningPtr<'_>) -> R, R>(val: T, f: F) -> R {
|
pub fn make<T, F: FnOnce(OwningPtr<'_>) -> R, R>(val: T, f: F) -> R {
|
||||||
|
let mut val = ManuallyDrop::new(val);
|
||||||
// SAFETY: The value behind the pointer will not get dropped or observed later,
|
// SAFETY: The value behind the pointer will not get dropped or observed later,
|
||||||
// so it's safe to promote it to an owning pointer.
|
// so it's safe to promote it to an owning pointer.
|
||||||
f(unsafe { Self::make_internal(&mut ManuallyDrop::new(val)) })
|
f(unsafe { Self::make_internal(&mut val) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_reflect"
|
name = "bevy_reflect"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Dynamically interact with rust types"
|
description = "Dynamically interact with rust types"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
keywords = ["bevy"]
|
keywords = ["bevy"]
|
||||||
rust-version = "1.81.0"
|
rust-version = "1.85.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "smallvec", "debug"]
|
default = ["std", "smallvec", "debug"]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_reflect_compile_fail"
|
name = "bevy_reflect_compile_fail"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Compile fail tests for Bevy Engine's reflection system"
|
description = "Compile fail tests for Bevy Engine's reflection system"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_reflect_derive"
|
name = "bevy_reflect_derive"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Derive implementations for bevy_reflect"
|
description = "Derive implementations for bevy_reflect"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -206,7 +206,6 @@ macro_rules! hash_error {
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.as_str()
|
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +243,7 @@ impl DynamicMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn internal_hash(value: &dyn PartialReflect) -> u64 {
|
fn internal_hash(value: &dyn PartialReflect) -> u64 {
|
||||||
value.reflect_hash().expect(hash_error!(value))
|
value.reflect_hash().expect(&hash_error!(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn internal_eq<'a>(
|
fn internal_eq<'a>(
|
||||||
|
@ -167,7 +167,7 @@ impl DynamicSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn internal_hash(value: &dyn PartialReflect) -> u64 {
|
fn internal_hash(value: &dyn PartialReflect) -> u64 {
|
||||||
value.reflect_hash().expect(hash_error!(value))
|
value.reflect_hash().expect(&hash_error!(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn internal_eq(
|
fn internal_eq(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_remote"
|
name = "bevy_remote"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "The Bevy Remote Protocol"
|
description = "The Bevy Remote Protocol"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_render"
|
name = "bevy_render"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Provides rendering functionality for Bevy Engine"
|
description = "Provides rendering functionality for Bevy Engine"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bevy_render_macros"
|
name = "bevy_render_macros"
|
||||||
version = "0.16.0-dev"
|
version = "0.16.0-dev"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
description = "Derive implementations for bevy_render"
|
description = "Derive implementations for bevy_render"
|
||||||
homepage = "https://bevyengine.org"
|
homepage = "https://bevyengine.org"
|
||||||
repository = "https://github.com/bevyengine/bevy"
|
repository = "https://github.com/bevyengine/bevy"
|
||||||
|
@ -1580,7 +1580,7 @@ pub fn batch_and_prepare_binned_render_phase<BPI, GFBD>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reserve space in the occlusion culling buffers, if necessary.
|
// Reserve space in the occlusion culling buffers, if necessary.
|
||||||
if let Some(ref mut gpu_occlusion_culling_buffers) = gpu_occlusion_culling_buffers {
|
if let Some(gpu_occlusion_culling_buffers) = gpu_occlusion_culling_buffers {
|
||||||
gpu_occlusion_culling_buffers
|
gpu_occlusion_culling_buffers
|
||||||
.late_indexed
|
.late_indexed
|
||||||
.add_multiple(indexed_preparer.work_item_count);
|
.add_multiple(indexed_preparer.work_item_count);
|
||||||
@ -1985,9 +1985,9 @@ pub fn write_batched_instance_buffers<GFBD>(
|
|||||||
GFBD: GetFullBatchData,
|
GFBD: GetFullBatchData,
|
||||||
{
|
{
|
||||||
let BatchedInstanceBuffers {
|
let BatchedInstanceBuffers {
|
||||||
ref mut current_input_buffer,
|
current_input_buffer,
|
||||||
ref mut previous_input_buffer,
|
previous_input_buffer,
|
||||||
ref mut phase_instance_buffers,
|
phase_instance_buffers,
|
||||||
} = gpu_array_buffer.into_inner();
|
} = gpu_array_buffer.into_inner();
|
||||||
|
|
||||||
current_input_buffer
|
current_input_buffer
|
||||||
|
@ -409,7 +409,7 @@ impl MeshAllocator {
|
|||||||
slab_id: SlabId,
|
slab_id: SlabId,
|
||||||
) -> Option<MeshBufferSlice> {
|
) -> Option<MeshBufferSlice> {
|
||||||
match self.slabs.get(&slab_id)? {
|
match self.slabs.get(&slab_id)? {
|
||||||
Slab::General(ref general_slab) => {
|
Slab::General(general_slab) => {
|
||||||
let slab_allocation = general_slab.resident_allocations.get(mesh_id)?;
|
let slab_allocation = general_slab.resident_allocations.get(mesh_id)?;
|
||||||
Some(MeshBufferSlice {
|
Some(MeshBufferSlice {
|
||||||
buffer: general_slab.buffer.as_ref()?,
|
buffer: general_slab.buffer.as_ref()?,
|
||||||
@ -420,7 +420,7 @@ impl MeshAllocator {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
Slab::LargeObject(ref large_object_slab) => {
|
Slab::LargeObject(large_object_slab) => {
|
||||||
let buffer = large_object_slab.buffer.as_ref()?;
|
let buffer = large_object_slab.buffer.as_ref()?;
|
||||||
Some(MeshBufferSlice {
|
Some(MeshBufferSlice {
|
||||||
buffer,
|
buffer,
|
||||||
@ -555,7 +555,7 @@ impl MeshAllocator {
|
|||||||
|
|
||||||
match *slab {
|
match *slab {
|
||||||
Slab::General(ref mut general_slab) => {
|
Slab::General(ref mut general_slab) => {
|
||||||
let (Some(ref buffer), Some(allocated_range)) = (
|
let (Some(buffer), Some(allocated_range)) = (
|
||||||
&general_slab.buffer,
|
&general_slab.buffer,
|
||||||
general_slab.pending_allocations.remove(mesh_id),
|
general_slab.pending_allocations.remove(mesh_id),
|
||||||
) else {
|
) else {
|
||||||
@ -706,7 +706,7 @@ impl MeshAllocator {
|
|||||||
// that succeeds.
|
// that succeeds.
|
||||||
let mut mesh_allocation = None;
|
let mut mesh_allocation = None;
|
||||||
for &slab_id in &*candidate_slabs {
|
for &slab_id in &*candidate_slabs {
|
||||||
let Some(Slab::General(ref mut slab)) = self.slabs.get_mut(&slab_id) else {
|
let Some(Slab::General(slab)) = self.slabs.get_mut(&slab_id) else {
|
||||||
unreachable!("Slab not found")
|
unreachable!("Slab not found")
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -763,9 +763,7 @@ impl MeshAllocator {
|
|||||||
// Mark the allocation as pending. Don't copy it in just yet; further
|
// Mark the allocation as pending. Don't copy it in just yet; further
|
||||||
// meshes loaded this frame may result in its final allocation location
|
// meshes loaded this frame may result in its final allocation location
|
||||||
// changing.
|
// changing.
|
||||||
if let Some(Slab::General(ref mut general_slab)) =
|
if let Some(Slab::General(general_slab)) = self.slabs.get_mut(&mesh_allocation.slab_id) {
|
||||||
self.slabs.get_mut(&mesh_allocation.slab_id)
|
|
||||||
{
|
|
||||||
general_slab
|
general_slab
|
||||||
.pending_allocations
|
.pending_allocations
|
||||||
.insert(*mesh_id, mesh_allocation.slab_allocation);
|
.insert(*mesh_id, mesh_allocation.slab_allocation);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user