Skip to content

Commit d66c53a

Browse files
committed
Upgrade to Bevy v0.15.0
1 parent 19aee8d commit d66c53a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1169
-942
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [Unreleased]
7+
8+
### Added
9+
10+
- Added a `TextureLayout::get_slot_by_name()` helper to retrieve the index of a texture slot.
11+
12+
### Changed
13+
14+
- Compatible with Bevy 0.15
15+
- Renamed `Module::add_texture()` to `add_texture_slot()` for clarity.
16+
The actual texture is bound to the slot through the `MaterialEffect` component.
17+
618
## [0.13.1] 2024-11-16
719

820
### Fixed

Cargo.toml

+59-35
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bevy_hanabi"
3-
version = "0.13.1"
3+
version = "0.14.0-dev"
44
authors = ["Jerome Humbert <djeedai@gmail.com>"]
55
edition = "2021"
66
description = "Hanabi GPU particle system for the Bevy game engine"
@@ -16,10 +16,10 @@ autoexamples = false
1616
[features]
1717
default = ["2d", "3d", "serde", "gpu_tests", "examples_world_inspector"]
1818

19-
# Enable support for rendering through a 2D camera (Camera2dBundle)
19+
# Enable support for rendering through a 2D camera (Camera2d)
2020
2d = []
2121

22-
# Enable support for rendering through a 3D camera (Camera3dBundle)
22+
# Enable support for rendering through a 3D camera (Camera3d)
2323
3d = []
2424

2525
# Enable serializing and deserializing of assets. This doesn't work on WASM,
@@ -54,29 +54,48 @@ ron = "0.8"
5454
bitflags = "2.3"
5555
typetag = { version = "0.2", optional = true }
5656
thiserror = "1.0"
57-
# Same versions as Bevy 0.14 (bevy_render)
58-
wgpu = "0.20"
59-
naga = "0.20"
60-
naga_oil = { version = "0.14", default-features = false, features = ["test_shader"] }
57+
# Same versions as Bevy 0.15 (bevy_render)
58+
wgpu = { version = "23.0.1", default-features = false, features = [
59+
"wgsl",
60+
"dx12",
61+
"metal",
62+
"naga-ir",
63+
"fragile-send-sync-non-atomic-wasm",
64+
] }
65+
naga = { version = "23", features = ["wgsl-in"] }
66+
naga_oil = { version = "0.16", default-features = false, features = ["test_shader"] }
6167

6268
[dependencies.bevy]
63-
version = "0.14"
69+
version = "0.15"
6470
default-features = false
65-
features = [ "bevy_core_pipeline", "bevy_render", "bevy_asset", "x11" ]
71+
features = [
72+
"bevy_core_pipeline",
73+
"bevy_render",
74+
"bevy_asset",
75+
"x11",
76+
# Bug in Bevy 0.15 [16563]
77+
"png"
78+
]
6679

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

7083
[dev-dependencies]
84+
# TEMP - Waiting for crates to update to Bevy 0.15...
7185
# For world inspector; required if "examples_world_inspector" is used.
72-
bevy-inspector-egui = "0.27"
73-
bevy_egui = { version = "0.30", default-features = false, features = [
74-
"manage_clipboard", "open_url"
75-
] }
76-
egui = "0.29"
86+
#bevy-inspector-egui = "0.27"
87+
#bevy_egui = { version = "0.30", default-features = false, features = [
88+
# "manage_clipboard", "open_url"
89+
#] }
90+
#egui = "0.29"
91+
92+
bevy_sprite = "0.15"
93+
bevy_text = "0.15"
94+
bevy_ui = "0.15"
95+
bevy_window = "0.15"
7796

7897
# For glTF animations (Fox.glb)
79-
bevy_gltf = { version = "0.14", features = [ "bevy_animation" ] }
98+
bevy_gltf = { version = "0.15", features = [ "bevy_animation" ] }
8099

81100
# For procedural texture generation in examples
82101
noise = "0.9"
@@ -85,88 +104,89 @@ futures = "0.3"
85104

86105
[[example]]
87106
name = "firework"
88-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
107+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
89108

90109
[[example]]
91110
name = "portal"
92-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
111+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
93112

94113
[[example]]
95114
name = "expr"
96-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
115+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
97116

98117
[[example]]
99118
name = "spawn"
100-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
119+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
101120

102121
[[example]]
103122
name = "multicam"
104-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
123+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
105124

106125
[[example]]
107126
name = "visibility"
108-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
127+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
109128

110129
[[example]]
111130
name = "random"
112-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
131+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
113132

114133
[[example]]
115134
name = "spawn_on_command"
116-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
135+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
117136

118137
[[example]]
119138
name = "activate"
120-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "bevy/bevy_ui", "bevy/default_font", "3d" ]
139+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "bevy/bevy_ui", "bevy/default_font", "3d" ]
121140

122141
[[example]]
123142
name = "force_field"
124-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
143+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
125144

126145
[[example]]
127146
name = "lifetime"
128-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
147+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
129148

130149
[[example]]
131150
name = "init"
132-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
151+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
133152

134153
[[example]]
135154
name = "instancing"
136-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "bevy/png", "3d" ]
155+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "bevy/png", "3d" ]
137156

138157
[[example]]
139158
name = "gradient"
140-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "bevy/png", "3d" ]
159+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "bevy/png", "3d" ]
141160

142161
[[example]]
143162
name = "circle"
144-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "bevy/png", "3d" ]
163+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "bevy/png", "3d" ]
145164

146165
[[example]]
147166
name = "billboard"
148-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "bevy/png", "3d" ]
167+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "bevy/png", "3d" ]
149168

150169
[[example]]
151170
name = "2d"
152-
required-features = [ "bevy/bevy_winit", "bevy/bevy_sprite", "2d" ]
171+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_sprite", "2d" ]
153172

154173
[[example]]
155174
name = "worms"
156-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "bevy/png", "3d" ]
175+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "bevy/png", "3d" ]
157176

158177
[[example]]
159178
name = "ribbon"
160-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
179+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
161180

162181
[[example]]
163182
name = "ordering"
164-
required-features = [ "bevy/bevy_winit", "bevy/bevy_pbr", "3d" ]
183+
required-features = [ "bevy/bevy_winit", "bevy/bevy_window", "bevy/bevy_pbr", "3d" ]
165184

166185
[[example]]
167186
name = "puffs"
168187
required-features = [
169188
"bevy/bevy_winit",
189+
"bevy/bevy_window",
170190
"bevy/bevy_pbr",
171191
"bevy/bevy_scene",
172192
"bevy/bevy_gltf",
@@ -179,6 +199,10 @@ required-features = [
179199
name = "empty_effect"
180200
path = "gpu_tests/empty_effect.rs"
181201
harness = false
202+
required-features = [
203+
"bevy/bevy_winit",
204+
"bevy/bevy_window",
205+
]
182206

183207
[workspace]
184208
resolver = "2"

README.md

+5-5
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.14-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.15-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

@@ -190,8 +190,8 @@ This list contains the major fixed features provided by 🎆 Hanabi. Beyond that
190190
- [x] Trails / Ribbons
191191
- [x] Camera support
192192
- [x] Render layers
193-
- [x] 2D cameras ([`Camera2dBundle`](https://docs.rs/bevy/0.14.0/bevy/core_pipeline/core_2d/struct.Camera2dBundle.html)) only
194-
- [x] 3D cameras ([`Camera3dBundle`](https://docs.rs/bevy/0.14.0/bevy/core_pipeline/core_3d/struct.Camera3dBundle.html)) only
193+
- [x] 2D cameras ([`Camera2d`](https://docs.rs/bevy/0.15.0/bevy/core_pipeline/core_2d/struct.Camera2d.html)) only
194+
- [x] 3D cameras ([`Camera3d`](https://docs.rs/bevy/0.15.0/bevy/core_pipeline/core_3d/struct.Camera3d.html)) only
195195
- [x] Simultaneous dual 2D/3D cameras
196196
- [x] Multiple viewports (split screen)
197197
- [x] HDR camera and bloom
@@ -213,8 +213,8 @@ This list contains the major fixed features provided by 🎆 Hanabi. Beyond that
213213

214214
| Feature | Default | Description |
215215
|---|:-:|---|
216-
| `2d` || Enable rendering through 2D cameras ([`Camera2dBundle`](https://docs.rs/bevy/0.14.0/bevy/core_pipeline/core_2d/struct.Camera2dBundle.html)) |
217-
| `3d` || Enable rendering through 3D cameras ([`Camera3dBundle`](https://docs.rs/bevy/0.14.0/bevy/core_pipeline/core_3d/struct.Camera3dBundle.html)) |
216+
| `2d` || Enable rendering through 2D cameras ([`Camera2d`](https://docs.rs/bevy/0.15.0/bevy/core_pipeline/core_2d/struct.Camera2d.html)) |
217+
| `3d` || Enable rendering through 3D cameras ([`Camera3d`](https://docs.rs/bevy/0.15.0/bevy/core_pipeline/core_3d/struct.Camera3d.html)) |
218218
| `serde`* || Use `serde` to derive `Serialization` and `Deserialization` on asset-related types. |
219219

220220
(*) `serde` is not compatible with WASM (due to the `typetag` dependency not being available on `wasm`).

examples/2d.rs

+18-24
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
//! tweaked at runtime via the egui inspector to move the 2D rendering layer of
55
//! particle above or below the reference square.
66
7-
use bevy::{
8-
prelude::*,
9-
render::camera::ScalingMode,
10-
sprite::{MaterialMesh2dBundle, Mesh2dHandle},
11-
};
7+
use bevy::{prelude::*, render::camera::ScalingMode};
128
use bevy_hanabi::prelude::*;
139

1410
mod utils;
@@ -29,26 +25,24 @@ fn setup(
2925
mut materials: ResMut<Assets<ColorMaterial>>,
3026
) {
3127
// Spawn a 2D camera
32-
let mut camera = Camera2dBundle::default();
33-
camera.projection.scale = 1.0;
34-
camera.projection.scaling_mode = ScalingMode::FixedVertical(1.);
35-
commands.spawn(camera);
28+
let mut proj = OrthographicProjection::default_2d();
29+
proj.scale = 1.0;
30+
proj.scaling_mode = ScalingMode::FixedVertical {
31+
viewport_height: 1.,
32+
};
33+
commands.spawn((Camera2d::default(), proj));
3634

3735
// Spawn a reference white square in the center of the screen at Z=0
38-
commands
39-
.spawn(MaterialMesh2dBundle {
40-
mesh: meshes
41-
.add(Rectangle {
42-
half_size: Vec2::splat(0.1),
43-
})
44-
.into(),
45-
material: materials.add(ColorMaterial {
46-
color: Color::WHITE,
47-
..Default::default()
48-
}),
36+
commands.spawn((
37+
Mesh2d(meshes.add(Rectangle {
38+
half_size: Vec2::splat(0.1),
39+
})),
40+
MeshMaterial2d(materials.add(ColorMaterial {
41+
color: Color::WHITE,
4942
..Default::default()
50-
})
51-
.insert(Name::new("square"));
43+
})),
44+
Name::new("square"),
45+
));
5246

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

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

0 commit comments

Comments
 (0)