Skip to content

Commit 7c466c6

Browse files
committed
Upgrade to Bevy 0.13
1 parent 561a2da commit 7c466c6

30 files changed

+567
-488
lines changed

Cargo.toml

+18-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_hanabi"
3-
version = "0.10.0-dev"
3+
version = "0.10.0"
44
authors = ["Jerome Humbert <djeedai@gmail.com>"]
55
edition = "2021"
66
description = "Hanabi GPU particle system for the Bevy game engine"
@@ -27,6 +27,10 @@ default = ["2d", "3d", "gpu_tests"]
2727
# This is a testing-only feature, which has no effect on the build.
2828
gpu_tests = []
2929

30+
# Enable world inspector in examples, via bevy-inspector-egui.
31+
# This has no effect on the crate itself, only affects examples.
32+
examples_world_inspector = []
33+
3034
[dependencies]
3135
bytemuck = { version = "1", features = ["derive"] }
3236
copyless = "0.1"
@@ -38,27 +42,33 @@ ron = "0.8"
3842
bitflags = "2.3"
3943
typetag = "0.2"
4044
thiserror = "1.0"
41-
# Same versions as Bevy 0.12 (bevy_render)
42-
naga = "0.13"
43-
naga_oil = "0.10"
45+
# Same versions as Bevy 0.13 (bevy_render)
46+
naga = "0.19"
47+
naga_oil = { version = "0.13", default-features = false, features = ["test_shader"] }
4448

4549
[dependencies.bevy]
46-
version = "0.12"
50+
version = "0.13"
4751
default-features = false
4852
features = [ "bevy_core_pipeline", "bevy_render", "bevy_asset", "x11" ]
4953

5054
[package.metadata.docs.rs]
5155
all-features = true
5256

5357
[dev-dependencies]
54-
# Same versions as Bevy 0.12 (bevy_render)
55-
wgpu = "0.17.1"
58+
# Same versions as Bevy 0.13 (bevy_render)
59+
wgpu = "0.19.1"
5660

5761
# For procedural texture generation in examples
5862
noise = "0.8"
5963

6064
futures = "0.3"
61-
bevy-inspector-egui = "0.21"
65+
66+
# For world inspector
67+
#bevy-inspector-egui = "0.21" # waiting for 0.13-compatible version
68+
69+
# Bug in 0.13, need explicit dependency
70+
bevy_gizmos_macros = "0.13"
71+
bevy_sprite = "0.13"
6272

6373
[[example]]
6474
name = "firework"

README.md

+21-20
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Crate](https://img.shields.io/crates/v/bevy_hanabi.svg)](https://crates.io/crates/bevy_hanabi)
66
[![Build Status](https://github.com/djeedai/bevy_hanabi/actions/workflows/ci.yaml/badge.svg)](https://github.com/djeedai/bevy_hanabi/actions/workflows/ci.yaml)
77
[![Coverage Status](https://coveralls.io/repos/github/djeedai/bevy_hanabi/badge.svg?branch=main)](https://coveralls.io/github/djeedai/bevy_hanabi?branch=main)
8-
[![Bevy tracking](https://img.shields.io/badge/Bevy%20tracking-v0.12-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)
8+
[![Bevy tracking](https://img.shields.io/badge/Bevy%20tracking-v0.13-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)
99

1010
🎆 Hanabi — a GPU particle system for the Bevy game engine.
1111

@@ -15,7 +15,7 @@ The Hanabi particle system is a modern GPU-based particle system for the Bevy ga
1515

1616
🚧 _This project is under heavy development, and is currently lacking both features and performance / usability polish. However, for moderate-size effects, it can already be used in your project. Feedback and contributions on both design and features are very much welcome._
1717

18-
🎆 Hanabi makes heavy use of compute shaders to offload work to the GPU in a performant way. Support for compute shaders on the `wasm` target (WebAssembly) via WebGPU is only available since the newly-released Bevy v0.11, and is not yet available in 🎆 Hanabi. See [#41](https://github.com/djeedai/bevy_hanabi/issues/41) for details on progress.
18+
🎆 Hanabi makes heavy use of compute shaders to offload work to the GPU in a performant way. Support for compute shaders on the `wasm` target (WebAssembly) via WebGPU is only available since Bevy v0.11, and is not yet available in 🎆 Hanabi. See [#41](https://github.com/djeedai/bevy_hanabi/issues/41) for details on progress.
1919

2020
## Usage
2121

@@ -27,7 +27,7 @@ Add the `bevy_hanabi` dependency to `Cargo.toml`:
2727

2828
```toml
2929
[dependencies]
30-
bevy_hanabi = "0.9"
30+
bevy_hanabi = "0.10"
3131
```
3232

3333
See also [Features](#features) below for the list of supported features.
@@ -124,7 +124,7 @@ commands
124124

125125
## Examples
126126

127-
See the [`examples/`](https://github.com/djeedai/bevy_hanabi/tree/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples) folder.
127+
See the [`examples/`](https://github.com/djeedai/bevy_hanabi/tree/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples) folder.
128128

129129
Note for Linux users: The examples build with the `bevy/x11` feature by default to enable support for the X11 display server. If you want to use the Wayland display server instead, add the `bevy/wayland` feature.
130130

@@ -136,7 +136,7 @@ Combine the `SetPositionSphereModifier` for spawning and `LinearDragModifier` to
136136
cargo run --example firework --features="bevy/bevy_winit bevy/bevy_pbr bevy/png 3d"
137137
```
138138

139-
![firework](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/firework.gif)
139+
![firework](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/firework.gif)
140140

141141
### Portal
142142

@@ -146,7 +146,7 @@ Combine the `SetVelocityTangentModifier` for tangential rotation of particles ar
146146
cargo run --example portal --features="bevy/bevy_winit bevy/bevy_pbr bevy/png 3d"
147147
```
148148

149-
![portal](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/portal.gif)
149+
![portal](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/portal.gif)
150150

151151
### Expressions
152152

@@ -156,7 +156,7 @@ Demonstrate the use of the Expression API to build a visual effect simulated and
156156
cargo run --example expr --features="bevy/bevy_winit bevy/bevy_pbr 3d"
157157
```
158158

159-
![expr](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/expr.gif)
159+
![expr](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/expr.gif)
160160

161161
### Gradient
162162

@@ -166,7 +166,7 @@ Animate an emitter by moving its `Transform` component, and emit textured quad p
166166
cargo run --example gradient --features="bevy/bevy_winit bevy/bevy_pbr bevy/png 3d"
167167
```
168168

169-
![gradient](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/gradient.gif)
169+
![gradient](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/gradient.gif)
170170

171171
### Force Field
172172

@@ -176,7 +176,7 @@ This example demonstrates the force field modifier `ForceFieldModifier`, which a
176176
cargo run --example force_field --features="bevy/bevy_winit bevy/bevy_pbr 3d"
177177
```
178178

179-
![force_field](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/force_field.gif)
179+
![force_field](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/force_field.gif)
180180

181181
### 2D
182182

@@ -188,7 +188,7 @@ The white square mesh is moving forward and backward along the camera depth. The
188188
cargo run --example 2d --features="bevy/bevy_winit bevy/bevy_sprite 2d"
189189
```
190190

191-
![2d](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/2d.gif)
191+
![2d](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/2d.gif)
192192

193193
### Multi-camera
194194

@@ -198,7 +198,7 @@ The example demonstrates the use of multiple cameras and render layers to select
198198
cargo run --example multicam --features="bevy/bevy_winit bevy/bevy_pbr 3d"
199199
```
200200

201-
![multicam](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/multicam.gif)
201+
![multicam](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/multicam.gif)
202202

203203
### Activate
204204

@@ -208,7 +208,7 @@ This example demonstrates manual activation and deactivation of a spawner, from
208208
cargo run --example activate --features="bevy/bevy_winit bevy/bevy_pbr 3d"
209209
```
210210

211-
![activate](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/activate.gif)
211+
![activate](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/activate.gif)
212212

213213
### Spawn
214214

@@ -224,7 +224,7 @@ It also shows the applying of constant acceleration to all particles. The right
224224
cargo run --example spawn --features="bevy/bevy_winit bevy/bevy_pbr 3d"
225225
```
226226

227-
![spawn](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/spawn.gif)
227+
![spawn](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/spawn.gif)
228228

229229
### Spawn on command
230230

@@ -234,7 +234,7 @@ This example demonstrates how to emit a burst of particles when an event occurs.
234234
cargo run --example spawn_on_command --features="bevy/bevy_winit bevy/bevy_pbr 3d"
235235
```
236236

237-
![spawn_on_command](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/spawn_on_command.gif)
237+
![spawn_on_command](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/spawn_on_command.gif)
238238

239239
### Circle
240240

@@ -246,7 +246,7 @@ The example also uses the `FlipbookModifier` to animate the particles with a spr
246246
cargo run --example circle --features="bevy/bevy_winit bevy/bevy_pbr bevy/png 3d"
247247
```
248248

249-
![circle](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/circle.gif)
249+
![circle](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/circle.gif)
250250

251251
### Visibility
252252

@@ -259,7 +259,7 @@ This example demonstrates the difference between the default `SimulationConditio
259259
cargo run --example visibility --features="bevy/bevy_winit bevy/bevy_pbr 3d"
260260
```
261261

262-
![circle](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/visibility.gif)
262+
![circle](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/visibility.gif)
263263

264264
### Random
265265

@@ -269,7 +269,7 @@ This example spawns particles with randomized parameters.
269269
cargo run --example random --features="bevy/bevy_winit bevy/bevy_pbr 3d"
270270
```
271271

272-
![random](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/random.gif)
272+
![random](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/random.gif)
273273

274274
### Lifetime
275275

@@ -283,7 +283,7 @@ This example demonstrates particle effects with different lifetimes. Each effect
283283
cargo run --example lifetime --features="bevy/bevy_winit bevy/bevy_pbr 3d"
284284
```
285285

286-
![lifetime](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/lifetime.gif)
286+
![lifetime](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/lifetime.gif)
287287

288288
### Billboard
289289

@@ -293,7 +293,7 @@ This example demonstrates particles with the billboard render modifier, making t
293293
cargo run --example billboard --features="bevy/bevy_winit bevy/bevy_pbr bevy/png 3d"
294294
```
295295

296-
![billboard](https://raw.githubusercontent.com/djeedai/bevy_hanabi/26bd4d2f204a9fbc015adab5bbf0215ab965d5b0/examples/billboard.gif)
296+
![billboard](https://raw.githubusercontent.com/djeedai/bevy_hanabi/561a2da55a75288b51f6ac7ed8f86867102c06ca/examples/billboard.gif)
297297

298298
## Feature List
299299

@@ -381,7 +381,7 @@ This list contains the major fixed features provided by 🎆 Hanabi. Beyond that
381381
For optimization purpose, users of a single type of camera can disable the other type by skipping default features in their `Cargo.toml`. For example to use only the 3D mode:
382382

383383
```toml
384-
bevy_hanabi = { version = "0.9", default-features = false, features = [ "3d" ] }
384+
bevy_hanabi = { version = "0.10", default-features = false, features = [ "3d" ] }
385385
```
386386

387387
## Compatible Bevy versions
@@ -392,6 +392,7 @@ Compatibility of `bevy_hanabi` versions:
392392

393393
| `bevy_hanabi` | `bevy` |
394394
| :-- | :-- |
395+
| `0.10` | `0.13` |
395396
| `0.8`-`0.9` | `0.12` |
396397
| `0.7` | `0.11` |
397398
| `0.6` | `0.10` |

examples/2d.rs

+13-8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use bevy::{
1212
},
1313
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
1414
};
15+
#[cfg(feature = "examples_world_inspector")]
1516
use bevy_inspector_egui::quick::WorldInspectorPlugin;
1617

1718
use bevy_hanabi::prelude::*;
@@ -22,16 +23,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2223
.features
2324
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);
2425

25-
App::default()
26-
.insert_resource(ClearColor(Color::DARK_GRAY))
26+
let mut app = App::default();
27+
app.insert_resource(ClearColor(Color::DARK_GRAY))
2728
.add_plugins(
2829
DefaultPlugins
2930
.set(LogPlugin {
3031
level: bevy::log::Level::WARN,
3132
filter: "bevy_hanabi=warn,2d=trace".to_string(),
33+
update_subscriber: None,
3234
})
3335
.set(RenderPlugin {
3436
render_creation: wgpu_settings.into(),
37+
synchronous_pipeline_compilation: false,
3538
})
3639
.set(WindowPlugin {
3740
primary_window: Some(Window {
@@ -41,9 +44,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
4144
..default()
4245
}),
4346
)
44-
.add_plugins(HanabiPlugin)
45-
.add_plugins(WorldInspectorPlugin::default())
46-
.add_systems(Startup, setup)
47+
.add_plugins(HanabiPlugin);
48+
49+
#[cfg(feature = "examples_world_inspector")]
50+
app.add_plugins(WorldInspectorPlugin::default());
51+
52+
app.add_systems(Startup, setup)
4753
.add_systems(Update, (bevy::window::close_on_esc, update_plane))
4854
.run();
4955

@@ -66,9 +72,8 @@ fn setup(
6672
commands
6773
.spawn(MaterialMesh2dBundle {
6874
mesh: meshes
69-
.add(Mesh::from(shape::Quad {
70-
size: Vec2::splat(0.2),
71-
..Default::default()
75+
.add(Mesh::from(Rectangle {
76+
half_size: Vec2::splat(0.1),
7277
}))
7378
.into(),
7479
material: materials.add(ColorMaterial {

examples/activate.rs

+14-13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use bevy::{
1717
RenderPlugin,
1818
},
1919
};
20+
#[cfg(feature = "examples_world_inspector")]
2021
use bevy_inspector_egui::quick::WorldInspectorPlugin;
2122

2223
use bevy_hanabi::prelude::*;
@@ -27,16 +28,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2728
.features
2829
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);
2930

30-
App::default()
31-
.insert_resource(ClearColor(Color::DARK_GRAY))
31+
let mut app = App::default();
32+
app.insert_resource(ClearColor(Color::DARK_GRAY))
3233
.add_plugins(
3334
DefaultPlugins
3435
.set(LogPlugin {
3536
level: bevy::log::Level::WARN,
3637
filter: "bevy_hanabi=warn,activate=trace".to_string(),
38+
update_subscriber: None,
3739
})
3840
.set(RenderPlugin {
3941
render_creation: wgpu_settings.into(),
42+
synchronous_pipeline_compilation: false,
4043
})
4144
.set(WindowPlugin {
4245
primary_window: Some(Window {
@@ -46,9 +49,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
4649
..default()
4750
}),
4851
)
49-
.add_plugins(HanabiPlugin)
50-
.add_plugins(WorldInspectorPlugin::default())
51-
.add_systems(Startup, setup)
52+
.add_plugins(HanabiPlugin);
53+
54+
#[cfg(feature = "examples_world_inspector")]
55+
app.add_plugins(WorldInspectorPlugin::default());
56+
57+
app.add_systems(Startup, setup)
5258
.add_systems(Update, (bevy::window::close_on_esc, update))
5359
.run();
5460

@@ -79,9 +85,8 @@ fn setup(
7985

8086
commands
8187
.spawn(PbrBundle {
82-
mesh: meshes.add(Mesh::from(shape::Quad {
83-
size: Vec2::splat(4.0),
84-
..Default::default()
88+
mesh: meshes.add(Mesh::from(Rectangle {
89+
half_size: Vec2::splat(2.0),
8590
})),
8691
material: materials.add(StandardMaterial {
8792
base_color: Color::BLUE,
@@ -94,11 +99,7 @@ fn setup(
9499
.insert(Name::new("water"));
95100

96101
let mut ball = commands.spawn(PbrBundle {
97-
mesh: meshes.add(Mesh::from(shape::UVSphere {
98-
sectors: 32,
99-
stacks: 2,
100-
radius: 0.05,
101-
})),
102+
mesh: meshes.add(Mesh::from(Sphere { radius: 0.05 })),
102103
material: materials.add(StandardMaterial {
103104
base_color: Color::WHITE,
104105
unlit: true,

0 commit comments

Comments
 (0)