Skip to content

Commit

Permalink
Upgrade to Bevy v0.7 (djeedai#24)
Browse files Browse the repository at this point in the history
Switch the library to build against Bevy v0.7 instead of v0.6, and
disable all plugins in examples as they're not ported to v0.7 yet.
  • Loading branch information
djeedai authored Apr 16, 2022
1 parent 3e587ec commit 00419b1
Show file tree
Hide file tree
Showing 14 changed files with 85 additions and 72 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Switch to Bevy v0.7.
- Tighter set of dependencies, removing the general `bevy/render` and instead depending on `bevy/bevy_core_pipeline` and `bevy/bevy_render` only.

### Fixed
Expand Down
14 changes: 9 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_hanabi"
version = "0.1.2"
version = "0.2.0"
authors = ["Jerome Humbert <[email protected]>"]
edition = "2021"
description = "Hanabi GPU particle system for the Bevy game engine"
Expand All @@ -26,13 +26,17 @@ ron = "0.7"
bitflags = "1.3"

[dependencies.bevy]
version = "0.6"
version = "0.7"
default-features = false
features = [ "bevy_core_pipeline", "bevy_render" ]

[dev-dependencies]
bevy-inspector-egui = "0.8"
smooth-bevy-cameras = "0.2"
[package.metadata.docs.rs]
# Document only 3D by default. There's no public API difference anyway.
features = [ "3d" ]

#[dev-dependencies]
#bevy-inspector-egui = "0.8"
#smooth-bevy-cameras = "0.2"

[[example]]
name = "spawn"
Expand Down
9 changes: 5 additions & 4 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.6-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.7-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 @@ -17,15 +17,15 @@ The Hanabi particle system is a modern GPU-based particle system for the Bevy ga

## Usage

The 🎆 Bevy Hanabi plugin is only compatible with Bevy v0.6.
The 🎆 Bevy Hanabi plugin is compatible with Bevy >= v0.6; see the list of compatible versions below.

### Add the dependency

Add the `bevy_hanabi` dependency to `Cargo.toml`:

```
```toml
[dependencies]
bevy_hanabi = { version = "0.1", features = ["3d"] }
bevy_hanabi = { version = "0.2", features = ["3d"] }
```

If you're using a 2D camera, add the `2d` feature instead.
Expand Down Expand Up @@ -249,4 +249,5 @@ Compatibility of `bevy_hanabi` versions:

| `bevy_hanabi` | `bevy` |
| :-- | :-- |
| `0.2` | `0.7` |
| `0.1` | `0.6` |
8 changes: 4 additions & 4 deletions examples/2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
use bevy::{
prelude::*,
render::{camera::ScalingMode, options::WgpuOptions, render_resource::WgpuFeatures},
render::{camera::ScalingMode, render_resource::WgpuFeatures, settings::WgpuSettings},
sprite::MaterialMesh2dBundle,
};
use bevy_inspector_egui::WorldInspectorPlugin;
//use bevy_inspector_egui::WorldInspectorPlugin;

use bevy_hanabi::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut options = WgpuOptions::default();
let mut options = WgpuSettings::default();
options
.features
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);
Expand All @@ -24,7 +24,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.add_plugins(DefaultPlugins)
.add_system(bevy::input::system::exit_on_esc_system)
.add_plugin(HanabiPlugin)
.add_plugin(WorldInspectorPlugin::new())
//.add_plugin(WorldInspectorPlugin::new())
.add_startup_system(setup)
.run();

Expand Down
8 changes: 4 additions & 4 deletions examples/activate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
//!
use bevy::{
prelude::*,
render::{options::WgpuOptions, render_resource::WgpuFeatures},
render::{render_resource::WgpuFeatures, settings::WgpuSettings},
};
use bevy_inspector_egui::WorldInspectorPlugin;
//use bevy_inspector_egui::WorldInspectorPlugin;

use bevy_hanabi::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut options = WgpuOptions::default();
let mut options = WgpuSettings::default();
options
.features
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);
Expand All @@ -24,7 +24,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.add_plugins(DefaultPlugins)
.add_system(bevy::input::system::exit_on_esc_system)
.add_plugin(HanabiPlugin)
.add_plugin(WorldInspectorPlugin::new())
//.add_plugin(WorldInspectorPlugin::new())
.add_startup_system(setup)
.add_system(update)
.run();
Expand Down
8 changes: 4 additions & 4 deletions examples/circle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
use bevy::{
prelude::*,
render::{options::WgpuOptions, render_resource::WgpuFeatures},
render::{render_resource::WgpuFeatures, settings::WgpuSettings},
};

use bevy_hanabi::*;
use bevy_inspector_egui::WorldInspectorPlugin;
//use bevy_inspector_egui::WorldInspectorPlugin;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut options = WgpuOptions::default();
let mut options = WgpuSettings::default();
options
.features
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);
Expand All @@ -27,7 +27,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.add_plugins(DefaultPlugins)
.add_system(bevy::input::system::exit_on_esc_system)
.add_plugin(HanabiPlugin)
.add_plugin(WorldInspectorPlugin::new())
//.add_plugin(WorldInspectorPlugin::new())
.add_startup_system(setup)
.run();

Expand Down
44 changes: 23 additions & 21 deletions examples/force_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
//! Mouse scroll wheel zooms the camera.
use bevy::{
prelude::*,
render::{options::WgpuOptions, render_resource::WgpuFeatures},
render::{render_resource::WgpuFeatures, settings::WgpuSettings},
};
use bevy_inspector_egui::WorldInspectorPlugin;
//use bevy_inspector_egui::WorldInspectorPlugin;

use bevy_hanabi::*;
use smooth_bevy_cameras::{
controllers::orbit::{OrbitCameraBundle, OrbitCameraController, OrbitCameraPlugin},
LookTransformPlugin,
};
// use smooth_bevy_cameras::{
// controllers::orbit::{OrbitCameraBundle, OrbitCameraController, OrbitCameraPlugin},
// LookTransformPlugin,
// };

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut options = WgpuOptions::default();
let mut options = WgpuSettings::default();
options
.features
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);
Expand All @@ -27,10 +27,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
})
.add_plugins(DefaultPlugins)
.add_system(bevy::input::system::exit_on_esc_system)
.add_plugin(LookTransformPlugin)
.add_plugin(OrbitCameraPlugin::default())
//.add_plugin(LookTransformPlugin)
//.add_plugin(OrbitCameraPlugin::default())
.add_plugin(HanabiPlugin)
.add_plugin(WorldInspectorPlugin::new())
//.add_plugin(WorldInspectorPlugin::new())
.add_startup_system(setup)
.add_system(update)
.run();
Expand All @@ -46,16 +46,19 @@ fn setup(
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
let orbit_controller = OrbitCameraController {
mouse_translate_sensitivity: Vec2::ZERO,
..Default::default()
};
commands.spawn_bundle(OrbitCameraBundle::new(
orbit_controller,
PerspectiveCameraBundle::default(),
Vec3::new(0.0, 0.0, 6.0), // eye of the camera
Vec3::new(0., 0., 0.),
));
// let orbit_controller = OrbitCameraController {
// mouse_translate_sensitivity: Vec2::ZERO,
// ..Default::default()
// };
// commands.spawn_bundle(OrbitCameraBundle::new(
// orbit_controller,
// PerspectiveCameraBundle::default(),
// Vec3::new(0.0, 0.0, 6.0), // eye of the camera
// Vec3::new(0., 0., 0.),
// ));
let mut bundle = PerspectiveCameraBundle::new_3d();
bundle.transform.translation = Vec3::new(0.0, 0.0, 6.0);
commands.spawn_bundle(bundle);

let attractor1_position = Vec3::new(0.01, 0.0, 0.0);
let attractor2_position = Vec3::new(1.0, 0.5, 0.0);
Expand Down Expand Up @@ -152,7 +155,6 @@ fn setup(
fn update(
mut effect: Query<(&mut ParticleEffect, &mut Transform), Without<PerspectiveProjection>>,
mouse_button_input: Res<Input<MouseButton>>,

camera_query: Query<&Transform, With<PerspectiveProjection>>,
windows: Res<Windows>,
) {
Expand Down
8 changes: 4 additions & 4 deletions examples/gradient.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use bevy::{
prelude::*,
render::{mesh::shape::Cube, options::WgpuOptions, render_resource::WgpuFeatures},
render::{mesh::shape::Cube, render_resource::WgpuFeatures, settings::WgpuSettings},
};
use bevy_inspector_egui::WorldInspectorPlugin;
//use bevy_inspector_egui::WorldInspectorPlugin;
use std::f32::consts::PI;

use bevy_hanabi::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut options = WgpuOptions::default();
let mut options = WgpuSettings::default();
options
.features
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);
Expand All @@ -25,7 +25,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.add_plugins(DefaultPlugins)
.add_system(bevy::input::system::exit_on_esc_system)
.add_plugin(HanabiPlugin)
.add_plugin(WorldInspectorPlugin::new())
//.add_plugin(WorldInspectorPlugin::new())
.add_startup_system(setup)
.add_system(update)
.run();
Expand Down
9 changes: 5 additions & 4 deletions examples/random.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
use bevy::{
prelude::*,
render::{mesh::shape::Cube, options::WgpuOptions, render_resource::WgpuFeatures},
render::{mesh::shape::Cube, render_resource::WgpuFeatures, settings::WgpuSettings},
};
use bevy_inspector_egui::WorldInspectorPlugin;
//use bevy_inspector_egui::WorldInspectorPlugin;

use bevy_hanabi::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut options = WgpuOptions::default();
let mut options = WgpuSettings::default();
options
.features
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);
Expand All @@ -25,8 +25,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
filter: "bevy_hanabi=error,spawn=trace".to_string(),
})
.add_plugins(DefaultPlugins)
.add_system(bevy::input::system::exit_on_esc_system)
.add_plugin(HanabiPlugin)
.add_plugin(WorldInspectorPlugin::new())
//.add_plugin(WorldInspectorPlugin::new())
.add_startup_system(setup)
.run();

Expand Down
8 changes: 4 additions & 4 deletions examples/spawn.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use bevy::{
prelude::*,
render::{mesh::shape::Cube, options::WgpuOptions, render_resource::WgpuFeatures},
render::{mesh::shape::Cube, render_resource::WgpuFeatures, settings::WgpuSettings},
};
use bevy_inspector_egui::WorldInspectorPlugin;
//use bevy_inspector_egui::WorldInspectorPlugin;

use bevy_hanabi::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut options = WgpuOptions::default();
let mut options = WgpuSettings::default();
options
.features
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);
Expand All @@ -24,7 +24,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.add_plugins(DefaultPlugins)
.add_system(bevy::input::system::exit_on_esc_system)
.add_plugin(HanabiPlugin)
.add_plugin(WorldInspectorPlugin::new())
//.add_plugin(WorldInspectorPlugin::new())
.add_startup_system(setup)
.run();

Expand Down
8 changes: 4 additions & 4 deletions examples/spawn_on_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
use bevy::{
math::Vec3Swizzles,
prelude::*,
render::{options::WgpuOptions, render_resource::WgpuFeatures},
render::{render_resource::WgpuFeatures, settings::WgpuSettings},
};
use bevy_inspector_egui::WorldInspectorPlugin;
//use bevy_inspector_egui::WorldInspectorPlugin;

use bevy_hanabi::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut options = WgpuOptions::default();
let mut options = WgpuSettings::default();
options
.features
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);
Expand All @@ -24,7 +24,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.add_plugins(DefaultPlugins)
.add_system(bevy::input::system::exit_on_esc_system)
.add_plugin(HanabiPlugin)
.add_plugin(WorldInspectorPlugin::new())
//.add_plugin(WorldInspectorPlugin::new())
.add_startup_system(setup)
.add_system(update)
.run();
Expand Down
5 changes: 3 additions & 2 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use bevy::{
prelude::*,
render::{
render_graph::RenderGraph, render_phase::DrawFunctions,
render_resource::SpecializedPipelines, renderer::RenderDevice, RenderApp, RenderStage,
render_resource::SpecializedRenderPipelines, renderer::RenderDevice, RenderApp,
RenderStage,
},
};

Expand Down Expand Up @@ -67,7 +68,7 @@ impl Plugin for HanabiPlugin {
.init_resource::<ParticlesUpdatePipeline>()
.init_resource::<ComputeCache<ParticlesUpdatePipeline>>()
.init_resource::<ParticlesRenderPipeline>()
.init_resource::<SpecializedPipelines<ParticlesRenderPipeline>>()
.init_resource::<SpecializedRenderPipelines<ParticlesRenderPipeline>>()
.init_resource::<ExtractedEffects>()
.init_resource::<EffectAssetEvents>()
.init_resource::<SimParams>()
Expand Down
2 changes: 1 addition & 1 deletion src/render/effect_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use bevy::core_pipeline::Transparent2d as Transparent;
use bevy::core_pipeline::Transparent3d as Transparent;
use bevy::{
asset::{AssetEvent, Assets, Handle, HandleUntyped},
core::{cast_slice, FloatOrd, Pod, Time, Zeroable},
core::{cast_slice, FloatOrd, Time},
ecs::{
prelude::*,
system::{lifetimeless::*, SystemState},
Expand Down
Loading

0 comments on commit 00419b1

Please sign in to comment.