Skip to content

Commit

Permalink
Upgrade to Bevy v0.15.0 (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
djeedai authored Dec 3, 2024
1 parent 19aee8d commit d40741e
Show file tree
Hide file tree
Showing 47 changed files with 1,217 additions and 1,007 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:
key: ${{ runner.os }}-cargo-build-msrv-stable-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.79
toolchain: 1.82
components: rustfmt, clippy
- name: Check
run: cargo check --lib --all-features
Expand Down Expand Up @@ -178,19 +178,19 @@ jobs:
for example in .github/example-run/3d/*.ron; do
example_name=`basename $example .ron`
echo "running $example_name - "`date`
time CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --no-default-features --features="bevy/bevy_winit bevy/bevy_pbr bevy/bevy_ui bevy/default_font 3d serde bevy/bevy_ci_testing"
time CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --no-default-features --features="bevy/bevy_winit bevy/bevy_window bevy/bevy_pbr bevy/bevy_ui bevy/default_font 3d serde bevy/bevy_ci_testing"
sleep 10
done
for example in .github/example-run/3dpng/*.ron; do
example_name=`basename $example .ron`
echo "running $example_name - "`date`
time CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --no-default-features --features="bevy/bevy_winit bevy/bevy_pbr bevy/bevy_ui bevy/default_font bevy/png 3d serde bevy/bevy_ci_testing"
time CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --no-default-features --features="bevy/bevy_winit bevy/bevy_window bevy/bevy_pbr bevy/bevy_ui bevy/default_font bevy/png 3d serde bevy/bevy_ci_testing"
sleep 10
done
for example in .github/example-run/2d/*.ron; do
example_name=`basename $example .ron`
echo "running $example_name - "`date`
time CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --no-default-features --features="bevy/bevy_winit bevy/bevy_sprite bevy/bevy_ui bevy/default_font 2d serde bevy/bevy_ci_testing"
time CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --no-default-features --features="bevy/bevy_winit bevy/bevy_window bevy/bevy_sprite bevy/bevy_ui bevy/default_font 2d serde bevy/bevy_ci_testing"
sleep 10
done
env:
Expand All @@ -202,19 +202,19 @@ jobs:
for example in .github/example-run/3d/*.ron; do
example_name=`basename $example .ron`
echo "running $example_name - "`date`
time WGPU_BACKEND=dx12 CI_TESTING_CONFIG=$example cargo run --example $example_name --no-default-features --features="bevy/bevy_winit bevy/bevy_pbr bevy/bevy_ui bevy/default_font 3d serde bevy/bevy_ci_testing"
time WGPU_BACKEND=dx12 CI_TESTING_CONFIG=$example cargo run --example $example_name --no-default-features --features="bevy/bevy_winit bevy/bevy_window bevy/bevy_pbr bevy/bevy_ui bevy/default_font 3d serde bevy/bevy_ci_testing"
sleep 10
done
for example in .github/example-run/3dpng/*.ron; do
example_name=`basename $example .ron`
echo "running $example_name - "`date`
time WGPU_BACKEND=dx12 CI_TESTING_CONFIG=$example cargo run --example $example_name --no-default-features --features="bevy/bevy_winit bevy/bevy_pbr bevy/bevy_ui bevy/default_font bevy/png 3d serde bevy/bevy_ci_testing"
time WGPU_BACKEND=dx12 CI_TESTING_CONFIG=$example cargo run --example $example_name --no-default-features --features="bevy/bevy_winit bevy/bevy_window bevy/bevy_pbr bevy/bevy_ui bevy/default_font bevy/png 3d serde bevy/bevy_ci_testing"
sleep 10
done
for example in .github/example-run/2d/*.ron; do
example_name=`basename $example .ron`
echo "running $example_name - "`date`
time WGPU_BACKEND=dx12 CI_TESTING_CONFIG=$example cargo run --example $example_name --no-default-features --features="bevy/bevy_winit bevy/bevy_sprite bevy/bevy_ui bevy/default_font 2d serde bevy/bevy_ci_testing"
time WGPU_BACKEND=dx12 CI_TESTING_CONFIG=$example cargo run --example $example_name --no-default-features --features="bevy/bevy_winit bevy/bevy_window bevy/bevy_sprite bevy/bevy_ui bevy/default_font 2d serde bevy/bevy_ci_testing"
sleep 10
done
env:
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Added a `TextureLayout::get_slot_by_name()` helper to retrieve the index of a texture slot.

### Changed

- Compatible with Bevy 0.15
- MSRV updated to 1.82 to follow Bevy.
- Renamed `Module::add_texture()` to `add_texture_slot()` for clarity.
The actual texture is bound to the slot through the `MaterialEffect` component.

## [0.13.1] 2024-11-16

### Fixed
Expand Down
87 changes: 55 additions & 32 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_hanabi"
version = "0.13.1"
version = "0.14.0-dev"
authors = ["Jerome Humbert <[email protected]>"]
edition = "2021"
description = "Hanabi GPU particle system for the Bevy game engine"
Expand All @@ -16,10 +16,10 @@ autoexamples = false
[features]
default = ["2d", "3d", "serde", "gpu_tests", "examples_world_inspector"]

# Enable support for rendering through a 2D camera (Camera2dBundle)
# Enable support for rendering through a 2D camera (Camera2d)
2d = []

# Enable support for rendering through a 3D camera (Camera3dBundle)
# Enable support for rendering through a 3D camera (Camera3d)
3d = []

# Enable serializing and deserializing of assets. This doesn't work on WASM,
Expand Down Expand Up @@ -54,29 +54,47 @@ ron = "0.8"
bitflags = "2.3"
typetag = { version = "0.2", optional = true }
thiserror = "1.0"
# Same versions as Bevy 0.14 (bevy_render)
wgpu = "0.20"
naga = "0.20"
naga_oil = { version = "0.14", default-features = false, features = ["test_shader"] }
# Same versions as Bevy 0.15 (bevy_render)
wgpu = { version = "23.0.1", default-features = false, features = [
"wgsl",
"dx12",
"metal",
"naga-ir",
"fragile-send-sync-non-atomic-wasm",
] }
naga = { version = "23", features = ["wgsl-in"] }
naga_oil = { version = "0.16", default-features = false, features = ["test_shader"] }

[dependencies.bevy]
version = "0.14"
version = "0.15"
default-features = false
features = [ "bevy_core_pipeline", "bevy_render", "bevy_asset", "x11" ]
features = [
"bevy_core_pipeline",
"bevy_render",
"bevy_asset",
"x11",
# Bug in Bevy 0.15 [16563]
"png"
]

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

[dev-dependencies]
# For world inspector; required if "examples_world_inspector" is used.
bevy-inspector-egui = "0.27"
bevy_egui = { version = "0.30", default-features = false, features = [
bevy-inspector-egui = "0.28"
bevy_egui = { version = "0.31", default-features = false, features = [
"manage_clipboard", "open_url"
] }
egui = "0.29"

bevy_sprite = "0.15"
bevy_text = "0.15"
bevy_ui = "0.15"
bevy_window = "0.15"

# For glTF animations (Fox.glb)
bevy_gltf = { version = "0.14", features = [ "bevy_animation" ] }
bevy_gltf = { version = "0.15", features = [ "bevy_animation" ] }

# For procedural texture generation in examples
noise = "0.9"
Expand All @@ -85,88 +103,89 @@ futures = "0.3"

[[example]]
name = "firework"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "portal"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "expr"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "spawn"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "multicam"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "visibility"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "random"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "spawn_on_command"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "activate"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "bevy/bevy_ui", "bevy/default_font", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "bevy/bevy_ui", "bevy/default_font", "3d" ]

[[example]]
name = "force_field"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "lifetime"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "init"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "instancing"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "bevy/png", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "bevy/png", "3d" ]

[[example]]
name = "gradient"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "bevy/png", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "bevy/png", "3d" ]

[[example]]
name = "circle"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "bevy/png", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "bevy/png", "3d" ]

[[example]]
name = "billboard"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "bevy/png", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "bevy/png", "3d" ]

[[example]]
name = "2d"
required-features = [ "bevy/bevy_winit", "bevy/bevy_sprite", "2d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_sprite", "2d" ]

[[example]]
name = "worms"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "bevy/png", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "bevy/png", "3d" ]

[[example]]
name = "ribbon"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "ordering"
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]

[[example]]
name = "puffs"
required-features = [
"bevy/bevy_winit",
"bevy/bevy_window",
"bevy/bevy_pbr",
"bevy/bevy_scene",
"bevy/bevy_gltf",
Expand All @@ -179,6 +198,10 @@ required-features = [
name = "empty_effect"
path = "gpu_tests/empty_effect.rs"
harness = false
required-features = [
"bevy/bevy_winit",
"bevy/bevy_window",
]

[workspace]
resolver = "2"
Expand Down
10 changes: 5 additions & 5 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.14-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.15-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 Down Expand Up @@ -190,8 +190,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.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] 2D cameras ([`Camera2d`](https://docs.rs/bevy/0.15.0/bevy/core_pipeline/core_2d/struct.Camera2d.html)) only
- [x] 3D cameras ([`Camera3d`](https://docs.rs/bevy/0.15.0/bevy/core_pipeline/core_3d/struct.Camera3d.html)) only
- [x] Simultaneous dual 2D/3D cameras
- [x] Multiple viewports (split screen)
- [x] HDR camera and bloom
Expand All @@ -213,8 +213,8 @@ 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.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)) |
| `2d` || Enable rendering through 2D cameras ([`Camera2d`](https://docs.rs/bevy/0.15.0/bevy/core_pipeline/core_2d/struct.Camera2d.html)) |
| `3d` || Enable rendering through 3D cameras ([`Camera3d`](https://docs.rs/bevy/0.15.0/bevy/core_pipeline/core_3d/struct.Camera3d.html)) |
| `serde`* || Use `serde` to derive `Serialization` and `Deserialization` on asset-related types. |

(*) `serde` is not compatible with WASM (due to the `typetag` dependency not being available on `wasm`).
Expand Down
5 changes: 4 additions & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ allow = [
"Zlib",
]
exceptions = [
{ name = "unicode-ident", allow = ["Unicode-DFS-2016"] },
{ name = "unicode-ident", allow = [
"Unicode-DFS-2016",
"Unicode-3.0",
] },
]

[bans]
Expand Down
42 changes: 18 additions & 24 deletions examples/2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
//! tweaked at runtime via the egui inspector to move the 2D rendering layer of
//! particle above or below the reference square.
use bevy::{
prelude::*,
render::camera::ScalingMode,
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
};
use bevy::{prelude::*, render::camera::ScalingMode};
use bevy_hanabi::prelude::*;

mod utils;
Expand All @@ -29,26 +25,24 @@ fn setup(
mut materials: ResMut<Assets<ColorMaterial>>,
) {
// Spawn a 2D camera
let mut camera = Camera2dBundle::default();
camera.projection.scale = 1.0;
camera.projection.scaling_mode = ScalingMode::FixedVertical(1.);
commands.spawn(camera);
let mut proj = OrthographicProjection::default_2d();
proj.scale = 1.0;
proj.scaling_mode = ScalingMode::FixedVertical {
viewport_height: 1.,
};
commands.spawn((Camera2d::default(), proj));

// Spawn a reference white square in the center of the screen at Z=0
commands
.spawn(MaterialMesh2dBundle {
mesh: meshes
.add(Rectangle {
half_size: Vec2::splat(0.1),
})
.into(),
material: materials.add(ColorMaterial {
color: Color::WHITE,
..Default::default()
}),
commands.spawn((
Mesh2d(meshes.add(Rectangle {
half_size: Vec2::splat(0.1),
})),
MeshMaterial2d(materials.add(ColorMaterial {
color: Color::WHITE,
..Default::default()
})
.insert(Name::new("square"));
})),
Name::new("square"),
));

// Create a color gradient for the particles
let mut gradient = Gradient::new();
Expand Down Expand Up @@ -110,8 +104,8 @@ fn setup(
.insert(Name::new("effect:2d"));
}

fn update_plane(time: Res<Time>, mut query: Query<&mut Transform, With<Mesh2dHandle>>) {
fn update_plane(time: Res<Time>, mut query: Query<&mut Transform, With<Mesh2d>>) {
let mut transform = query.single_mut();
// Move the plane back and forth to show particles ordering relative to it
transform.translation.z = (time.elapsed_seconds() * 2.5).sin() * 0.045 + 0.1;
transform.translation.z = (time.elapsed_secs() * 2.5).sin() * 0.045 + 0.1;
}
Loading

0 comments on commit d40741e

Please sign in to comment.