Skip to content

Commit

Permalink
Upgrade to Bevy 0.14 (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
djeedai authored Jul 8, 2024
1 parent 8a20894 commit 4874c48
Show file tree
Hide file tree
Showing 64 changed files with 632 additions and 307 deletions.
4 changes: 3 additions & 1 deletion .github/example-run/2d/2d.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/activate.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/expr.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(8)
events: [
(480, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/firework.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/force_field.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/init.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(6)
events: [
(360, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/lifetime.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(7)
events: [
(420, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/multicam.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(10)
events: [
(600, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/ordering.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/portal.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/random.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(8)
events: [
(480, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/ribbon.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/spawn.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/spawn_on_command.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3d/visibility.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3dpng/billboard.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3dpng/circle.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3dpng/gradient.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3dpng/instancing.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 3 additions & 1 deletion .github/example-run/3dpng/worms.ron
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
(
exit_after: Some(5)
events: [
(300, AppExit),
]
)
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `BuiltInOperator::IsAlive` exposing the current state of the `is_alive` particle flag,
which represents whether a particle is still alive or will be deallocated at the end of the update pass.

### Changed

- Compatible with Bevy 0.14.

### Fixed

- Prevented an error from being emitted when a GPU pipeline is still being created. (#341)
Expand Down
26 changes: 14 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_hanabi"
version = "0.11.0"
version = "0.12.0"
authors = ["Jerome Humbert <[email protected]>"]
edition = "2021"
description = "Hanabi GPU particle system for the Bevy game engine"
Expand Down Expand Up @@ -40,7 +40,7 @@ examples_world_inspector = []

[dependencies]
bytemuck = { version = "1", features = ["derive"] }
fixedbitset = "0.4"
fixedbitset = "0.5"
copyless = "0.1"
rand = "0.8"
rand_pcg = "0.3"
Expand All @@ -50,29 +50,31 @@ ron = "0.8"
bitflags = "2.3"
typetag = "0.2"
thiserror = "1.0"
# Same versions as Bevy 0.13 (bevy_render)
naga = "0.19"
naga_oil = { version = "0.13", default-features = false, features = ["test_shader"] }
# Same versions as Bevy 0.14 (bevy_render)
naga = "0.20"
naga_oil = { version = "0.14", default-features = false, features = ["test_shader"] }

[dependencies.bevy]
version = "0.13"
version = "0.14.0"
default-features = false
features = [ "bevy_core_pipeline", "bevy_render", "bevy_asset", "x11" ]

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

[dev-dependencies]
# Same versions as Bevy 0.13 (bevy_render)
wgpu = "0.19.1"
# Same versions as Bevy 0.14 (bevy_render)
wgpu = "0.20"

# For world inspector; required if "examples_world_inspector" is used.
bevy-inspector-egui = "0.23"
bevy_egui = "0.25"
egui = "0.26"
bevy-inspector-egui = "0.25"
bevy_egui = { version = "0.28", default-features = false, features = [
"manage_clipboard", "open_url"
] }
egui = "0.28"

# For procedural texture generation in examples
noise = "0.8"
noise = "0.9"

futures = "0.3"

Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Crate](https://img.shields.io/crates/v/bevy_hanabi.svg)](https://crates.io/crates/bevy_hanabi)
[![Build Status](https://github.com/djeedai/bevy_hanabi/actions/workflows/ci.yaml/badge.svg)](https://github.com/djeedai/bevy_hanabi/actions/workflows/ci.yaml)
[![Coverage Status](https://coveralls.io/repos/github/djeedai/bevy_hanabi/badge.svg?branch=main)](https://coveralls.io/github/djeedai/bevy_hanabi?branch=main)
[![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)
[![Bevy tracking](https://img.shields.io/badge/Bevy%20tracking-v0.14-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)

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

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

```toml
[dependencies]
bevy_hanabi = "0.11"
bevy_hanabi = "0.12"
```

See also [Features](#features) below for the list of supported features.
Expand Down Expand Up @@ -353,8 +353,8 @@ This list contains the major fixed features provided by 🎆 Hanabi. Beyond that
- [x] Trails / Ribbons
- [x] Camera support
- [x] Render layers
- [x] 2D cameras ([`Camera2dBundle`](https://docs.rs/bevy/0.13.0/bevy/core_pipeline/core_2d/struct.Camera2dBundle.html)) only
- [x] 3D cameras ([`Camera3dBundle`](https://docs.rs/bevy/0.13.0/bevy/core_pipeline/core_3d/struct.Camera3dBundle.html)) only
- [x] 2D cameras ([`Camera2dBundle`](https://docs.rs/bevy/0.14.0/bevy/core_pipeline/core_2d/struct.Camera2dBundle.html)) only
- [x] 3D cameras ([`Camera3dBundle`](https://docs.rs/bevy/0.14.0/bevy/core_pipeline/core_3d/struct.Camera3dBundle.html)) only
- [x] Simultaneous dual 2D/3D cameras
- [x] Multiple viewports (split screen)
- [x] HDR camera and bloom
Expand All @@ -376,13 +376,13 @@ This list contains the major fixed features provided by 🎆 Hanabi. Beyond that

| Feature | Default | Description |
|---|:-:|---|
| `2d` || Enable rendering through 2D cameras ([`Camera2dBundle`](https://docs.rs/bevy/0.13.0/bevy/core_pipeline/core_2d/struct.Camera2dBundle.html)) |
| `3d` || Enable rendering through 3D cameras ([`Camera3dBundle`](https://docs.rs/bevy/0.13.0/bevy/core_pipeline/core_3d/struct.Camera3dBundle.html)) |
| `2d` || Enable rendering through 2D cameras ([`Camera2dBundle`](https://docs.rs/bevy/0.14.0/bevy/core_pipeline/core_2d/struct.Camera2dBundle.html)) |
| `3d` || Enable rendering through 3D cameras ([`Camera3dBundle`](https://docs.rs/bevy/0.14.0/bevy/core_pipeline/core_3d/struct.Camera3dBundle.html)) |

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:

```toml
bevy_hanabi = { version = "0.11", default-features = false, features = [ "3d" ] }
bevy_hanabi = { version = "0.12", default-features = false, features = [ "3d" ] }
```

## Compatible Bevy versions
Expand All @@ -393,6 +393,7 @@ Compatibility of `bevy_hanabi` versions:

| `bevy_hanabi` | `bevy` |
| :-- | :-- |
| `0.12` | `0.14` |
| `0.10`-`0.11` | `0.13` |
| `0.8`-`0.9` | `0.12` |
| `0.7` | `0.11` |
Expand All @@ -406,8 +407,8 @@ Compatibility of `bevy_hanabi` versions:

🎆 Hanabi is dual-licensed under either:

* MIT License ([`LICENSE-MIT`](./LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
* Apache License, Version 2.0 ([`LICENSE-APACHE2`](./LICENSE-APACHE2) or <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT License ([`LICENSE-MIT`](./LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
- Apache License, Version 2.0 ([`LICENSE-APACHE2`](./LICENSE-APACHE2) or <http://www.apache.org/licenses/LICENSE-2.0>)

at your option.

Expand Down
8 changes: 5 additions & 3 deletions examples/2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@ use bevy_hanabi::prelude::*;
#[cfg(feature = "examples_world_inspector")]
use bevy_inspector_egui::quick::WorldInspectorPlugin;

mod utils;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut wgpu_settings = WgpuSettings::default();
wgpu_settings
.features
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);

let mut app = App::default();
app.insert_resource(ClearColor(Color::DARK_GRAY))
app.insert_resource(ClearColor(Color::BLACK))
.add_plugins(
DefaultPlugins
.set(LogPlugin {
level: bevy::log::Level::WARN,
filter: "bevy_hanabi=warn,2d=trace".to_string(),
update_subscriber: None,
..default()
})
.set(RenderPlugin {
render_creation: wgpu_settings.into(),
Expand All @@ -49,7 +51,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
app.add_plugins(WorldInspectorPlugin::default());

app.add_systems(Startup, setup)
.add_systems(Update, (bevy::window::close_on_esc, update_plane))
.add_systems(Update, (utils::close_on_esc, update_plane))
.run();

Ok(())
Expand Down
10 changes: 6 additions & 4 deletions examples/activate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,22 @@ use bevy_hanabi::prelude::*;
#[cfg(feature = "examples_world_inspector")]
use bevy_inspector_egui::quick::WorldInspectorPlugin;

mod utils;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut wgpu_settings = WgpuSettings::default();
wgpu_settings
.features
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);

let mut app = App::default();
app.insert_resource(ClearColor(Color::DARK_GRAY))
app.insert_resource(ClearColor(Color::BLACK))
.add_plugins(
DefaultPlugins
.set(LogPlugin {
level: bevy::log::Level::WARN,
filter: "bevy_hanabi=warn,activate=trace".to_string(),
update_subscriber: None,
..default()
})
.set(RenderPlugin {
render_creation: wgpu_settings.into(),
Expand All @@ -55,7 +57,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
app.add_plugins(WorldInspectorPlugin::default());

app.add_systems(Startup, setup)
.add_systems(Update, (bevy::window::close_on_esc, update))
.add_systems(Update, (utils::close_on_esc, update))
.run();

Ok(())
Expand Down Expand Up @@ -93,7 +95,7 @@ fn setup(
half_size: Vec2::splat(2.0),
}),
material: materials.add(StandardMaterial {
base_color: Color::BLUE,
base_color: utils::COLOR_BLUE,
unlit: true,
..Default::default()
}),
Expand Down
10 changes: 6 additions & 4 deletions examples/billboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,22 @@ use bevy_hanabi::prelude::*;
#[cfg(feature = "examples_world_inspector")]
use bevy_inspector_egui::quick::WorldInspectorPlugin;

mod utils;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut wgpu_settings = WgpuSettings::default();
wgpu_settings
.features
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);

let mut app = App::default();
app.insert_resource(ClearColor(Color::DARK_GRAY))
app.insert_resource(ClearColor(Color::BLACK))
.add_plugins(
DefaultPlugins
.set(LogPlugin {
level: bevy::log::Level::WARN,
filter: "bevy_hanabi=warn,billboard=trace".to_string(),
update_subscriber: None,
..default()
})
.set(RenderPlugin {
render_creation: wgpu_settings.into(),
Expand All @@ -74,7 +76,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
app.add_plugins(WorldInspectorPlugin::default());

app.add_systems(Startup, setup)
.add_systems(Update, (bevy::window::close_on_esc, rotate_camera))
.add_systems(Update, (utils::close_on_esc, rotate_camera))
.run();

Ok(())
Expand Down Expand Up @@ -178,7 +180,7 @@ fn setup(
mesh: meshes.add(Rectangle {
half_size: Vec2::splat(2.0),
}),
material: materials.add(Color::BLUE),
material: materials.add(utils::COLOR_BLUE),
transform: Transform::from_xyz(0.0, -0.5, 0.0)
* Transform::from_rotation(Quat::from_rotation_x(-FRAC_PI_2)),
..Default::default()
Expand Down
Loading

0 comments on commit 4874c48

Please sign in to comment.