Skip to content

Commit 4dcff51

Browse files
SarahIhmembrea-c
andauthored
Update to Bevy 0.17 (#44)
Co-authored-by: Manuel Brea <[email protected]>
1 parent b98b29c commit 4dcff51

File tree

14 files changed

+1129
-962
lines changed

14 files changed

+1129
-962
lines changed

Cargo.lock

Lines changed: 918 additions & 738 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_firework"
3-
version = "0.7.0"
3+
version = "0.8.0"
44
edition = "2024"
55
readme = "README.md"
66
license = "MIT OR Apache-2.0"
@@ -9,26 +9,29 @@ description = "CPU-driven, batch-rendered particle system for the Bevy game engi
99
keywords = ["bevy", "gamedev", "particles", "graphics"]
1010

1111
[dependencies]
12-
bevy = { version = "0.16", default-features = false, features = [
12+
bevy = { version = "0.17", default-features = false, features = [
1313
"bevy_render",
1414
"bevy_core_pipeline",
1515
"bevy_pbr",
1616
"tonemapping_luts",
1717
"bevy_winit",
1818
"x11",
19+
"zstd_rust",
1920
] }
2021
bytemuck = "1.14.3"
2122
rand = "0.9.1"
22-
bevy_utilitarian = "0.7"
23+
bevy_utilitarian = "0.8"
2324
serde = { version = "1.0", features = ["derive"] }
24-
avian3d = { version = "0.3", features = ["serialize"], optional = true }
25+
avian3d = { version = "0.4", features = ["serialize"], optional = true }
2526

2627
[dev-dependencies]
27-
bevy = { version = "0.16", default-features = false, features = [
28+
bevy = { version = "0.17", default-features = false, features = [
2829
"bevy_text",
2930
"bevy_ui",
3031
"default_font",
3132
"png",
33+
"bevy_post_process",
34+
"bevy_ui_render",
3235
] }
3336

3437
[features]

examples/collision.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use avian3d::prelude::*;
2-
use bevy::{core_pipeline::bloom::Bloom, prelude::*};
2+
use bevy::{post_process::bloom::Bloom, prelude::*, render::view::Hdr};
33
use bevy_firework::{
44
core::{
55
BlendMode, EmissionPacing, EmissionSettings, ParticleCollisionSettings, ParticleSettings,
@@ -122,10 +122,7 @@ fn setup(
122122
// camera
123123
commands.spawn((
124124
Camera3d::default(),
125-
Camera {
126-
hdr: true,
127-
..default()
128-
},
125+
Hdr,
129126
Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
130127
Bloom::default(),
131128
// For now,Msaa must be disabled on the web due to this:

examples/on_demand.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! ejected shells from a gun in a shooter game; this will be more efficient than creating a new
44
//! particle system every time, and simpler than manually restarting a long-living one-shot particle system.
55
6-
use bevy::{core_pipeline::bloom::Bloom, prelude::*};
6+
use bevy::{post_process::bloom::Bloom, prelude::*, render::view::Hdr};
77
use bevy_firework::{
88
core::{
99
BlendMode, EmissionPacing, EmissionSettings, ParticleSettings, ParticleSpawner,
@@ -108,10 +108,7 @@ fn setup(
108108
// camera
109109
commands.spawn((
110110
Camera3d::default(),
111-
Camera {
112-
hdr: true,
113-
..default()
114-
},
111+
Hdr,
115112
Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
116113
Bloom::default(),
117114
// For now,Msaa must be disabled on the web due to this:

examples/one_shot.rs

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
use avian3d::prelude::{
2-
Collider, CollisionEventsEnabled, Collisions, Friction, LinearVelocity, OnCollisionStart,
3-
Position, Restitution, RigidBody, Rotation,
2+
Collider, CollisionEventsEnabled, CollisionStart, Collisions, Friction, LinearVelocity,
3+
Restitution, RigidBody,
44
};
55
use bevy::{
6-
core_pipeline::{bloom::Bloom, prepass::DepthPrepass},
7-
prelude::*,
6+
core_pipeline::prepass::DepthPrepass, post_process::bloom::Bloom, prelude::*, render::view::Hdr,
87
};
98
use bevy_firework::{
109
core::{
@@ -74,28 +73,20 @@ fn setup(
7473
CollisionEventsEnabled,
7574
))
7675
.observe(
77-
|trigger: Trigger<OnCollisionStart>,
78-
mut commands: Commands,
79-
collisions: Collisions,
80-
collider: Query<(&Position, &Rotation)>| {
76+
|trigger: On<CollisionStart>, mut commands: Commands, collisions: Collisions| {
8177
collisions
82-
.collisions_with(trigger.collider)
78+
.collisions_with(trigger.collider1)
8379
.for_each(|pair| {
84-
let (impulse, mut normal) = pair.max_normal_impulse();
85-
if pair.collider1 != trigger.collider {
80+
let (impulse, mut normal) = (
81+
pair.max_normal_impulse_magnitude(),
82+
pair.max_normal_impulse().normalize_or_zero(),
83+
);
84+
if pair.collider1 == trigger.collider1 {
8685
normal = -normal;
8786
}
8887

89-
let Ok((position, rotation)) = collider.get(trigger.collider) else {
90-
return;
91-
};
92-
let translation = pair.find_deepest_contact().map_or(Vec3::ZERO, |c| {
93-
if pair.collider1 == trigger.collider {
94-
c.global_point1(position, rotation)
95-
} else {
96-
c.global_point2(position, rotation)
97-
}
98-
});
88+
let translation =
89+
pair.find_deepest_contact().map_or(Vec3::ZERO, |c| c.point);
9990

10091
commands
10192
.spawn((
@@ -144,9 +135,8 @@ fn setup(
144135
},
145136
))
146137
.observe(
147-
|trigger: Trigger<ParticleSpawnerFinished>,
148-
mut commands: Commands| {
149-
commands.entity(trigger.target()).despawn();
138+
|trigger: On<ParticleSpawnerFinished>, mut commands: Commands| {
139+
commands.entity(trigger.event_target()).despawn();
150140
},
151141
);
152142
});
@@ -166,10 +156,7 @@ fn setup(
166156
// camera
167157
commands.spawn((
168158
Camera3d::default(),
169-
Camera {
170-
hdr: true,
171-
..default()
172-
},
159+
Hdr,
173160
Transform::from_xyz(-2.5, 10., 4.0).looking_at(Vec3::new(0., -3., 0.), Vec3::Y),
174161
Bloom::default(),
175162
DepthPrepass::default(),

examples/pbr.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use bevy::{
2-
core_pipeline::{bloom::Bloom, prepass::DepthPrepass},
3-
prelude::*,
2+
core_pipeline::prepass::DepthPrepass, post_process::bloom::Bloom, prelude::*, render::view::Hdr,
43
};
54
use bevy_firework::{
65
core::{BlendMode, EmissionPacing, EmissionSettings, ParticleSettings, ParticleSpawner},
@@ -104,10 +103,7 @@ fn setup(
104103
// camera
105104
commands.spawn((
106105
Camera3d::default(),
107-
Camera {
108-
hdr: true,
109-
..default()
110-
},
106+
Hdr,
111107
Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
112108
Bloom::default(),
113109
DepthPrepass::default(),

examples/sparks.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use bevy::{core_pipeline::bloom::Bloom, prelude::*};
1+
use bevy::{post_process::bloom::Bloom, prelude::*, render::view::Hdr};
22
use bevy_firework::{
33
core::{BlendMode, EmissionPacing, EmissionSettings, ParticleSettings, ParticleSpawner},
44
curve::{FireworkCurve, FireworkGradient},
@@ -99,10 +99,7 @@ fn setup(
9999
// camera
100100
commands.spawn((
101101
Camera3d::default(),
102-
Camera {
103-
hdr: true,
104-
..default()
105-
},
102+
Hdr,
106103
Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
107104
Bloom::default(),
108105
// For now,Msaa must be disabled on the web due to this:

examples/stress_test.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use avian3d::PhysicsPlugins;
22
// use avian3d::plugins::PhysicsPlugins;
33
use bevy::{
4-
core_pipeline::bloom::Bloom,
54
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin},
5+
post_process::bloom::Bloom,
66
prelude::*,
7+
render::view::Hdr,
78
};
89
use bevy_firework::{
910
core::{
@@ -139,10 +140,7 @@ fn setup(
139140
// camera
140141
commands.spawn((
141142
Camera3d::default(),
142-
Camera {
143-
hdr: true,
144-
..default()
145-
},
143+
Hdr,
146144
Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
147145
Bloom::default(),
148146
// For now,Msaa must be disabled on the web due to this:

examples/stress_test_collision.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use avian3d::{PhysicsPlugins, prelude::Collider, spatial_query::SpatialQueryFilter};
22
use bevy::{
3-
core_pipeline::bloom::Bloom,
43
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin},
4+
post_process::bloom::Bloom,
55
prelude::*,
6+
render::view::Hdr,
67
};
78
use bevy_firework::{
89
core::{
@@ -162,11 +163,7 @@ fn setup(
162163
commands.spawn((
163164
Camera3d::default(),
164165
Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
165-
Camera {
166-
hdr: true,
167-
168-
..default()
169-
},
166+
Hdr,
170167
Bloom::default(),
171168
// For now,Msaa must be disabled on the web due to this:
172169
// https://github.com/gfx-rs/wgpu/issues/5263

examples/textures.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ use std::f32::consts::FRAC_PI_2;
22

33
use avian3d::prelude::{Collider, SpatialQueryFilter};
44
use bevy::{
5-
core_pipeline::{bloom::Bloom, prepass::DepthPrepass},
5+
core_pipeline::prepass::DepthPrepass,
66
image::{ImageLoaderSettings, ImageSamplerDescriptor},
7+
post_process::bloom::Bloom,
78
prelude::*,
9+
render::view::Hdr,
810
};
911
use bevy_firework::{
1012
core::{
@@ -214,10 +216,7 @@ fn setup(
214216
// camera
215217
commands.spawn((
216218
Camera3d::default(),
217-
Camera {
218-
hdr: true,
219-
..default()
220-
},
219+
Hdr,
221220
Transform::from_xyz(0., 8., 0.).looking_at(Vec3::ZERO, Vec3::NEG_Z),
222221
Bloom::default(),
223222
DepthPrepass::default(),

0 commit comments

Comments
 (0)