Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support bevy 0.14.0 #34

Merged
merged 2 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Checks

on:
push:
branches: ["main"]
branches: [ "main" ]
pull_request:

env:
Expand Down Expand Up @@ -35,5 +35,7 @@ jobs:
run: sudo apt-get install libasound2-dev libudev-dev pkg-config
- name: Lint
run: cargo clippy -- -Dwarnings
- name: Build (examples)
run: cargo build --examples
- name: Check format
run: cargo fmt --all -- --check
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ version = "3.2.1"
edition = "2021"
license = "MIT OR Apache-2.0"
readme = "README.md"
keywords = ["bevy", "gamedev", "healthbar", "billboard" ]
keywords = ["bevy", "gamedev", "healthbar", "billboard"]
categories = ["game-development", "rendering"]
repository = "https://github.com/sparten11740/bevy_health_bar3d.git"
homepage = "https://github.com/sparten11740/bevy_health_bar3d"
authors = ["Jan Wendland"]
include = ["/src", "CHANGELOG.md", "/assets", "LICENSE-APACHE", "LICENSE-MIT"]

[dependencies]
bevy = { version = "0.13.1", default-features = false, features = ["bevy_pbr", "bevy_render"] }
bevy = { version = "0.14.0", default-features = false, features = ["bevy_pbr", "bevy_render"] }
ordered-float = "3.9.2"

[dev-dependencies]
bevy = "0.13.1"
bevy-inspector-egui = "0.23.4"
bevy_tweening = "0.10.0"
bevy = "0.14.0"
bevy-inspector-egui = "0.25.0"
bevy_tweening = { git = "https://github.com/BraymatterOrg/bevy_tweening_0_14", rev = "1e46e67938ef21cfd3b80a9bd7f9e3de1edd425c" }
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ or layered cameras out of the box.

| Bevy Version | Crate Version |
|--------------|--------------:|
| `0.13` | >= `3.2.0` |
| `0.14` | >= `3.3.0` |
| `0.13` | `3.2.0` |
| `0.12` | `2.0.0` |
| `0.11` | `1.2.0` |
| `0.10` | `1.1.0` |
Expand Down
10 changes: 5 additions & 5 deletions assets/shaders/bar.wgsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import bevy_pbr::{
mesh_view_bindings::view,
mesh_functions::get_model_matrix
mesh_functions::get_world_from_local
}

@group(2) @binding(0)
Expand Down Expand Up @@ -35,12 +35,12 @@ struct VertexOutput {
fn vertex(vertex: Vertex) -> VertexOutput {
var out: VertexOutput;

let view_proj = view.view_proj;
let camera_right = normalize(vec3<f32>(view_proj.x.x, view_proj.y.x, view_proj.z.x));
let camera_up = normalize(vec3<f32>(view_proj.x.y, view_proj.y.y, view_proj.z.y));
let clip_from_world = view.clip_from_world;
let camera_right = normalize(vec3<f32>(clip_from_world.x.x, clip_from_world.y.x, clip_from_world.z.x));
let camera_up = normalize(vec3<f32>(clip_from_world.x.y, clip_from_world.y.y, clip_from_world.z.y));

let world_space = camera_right * (vertex.position.x + offset.x) + camera_up * (vertex.position.y + offset.y);
let position = view.view_proj * get_model_matrix(vertex.instance_index) * vec4<f32>(world_space, 1.);
let position = view.clip_from_world * get_world_from_local(vertex.instance_index) * vec4<f32>(world_space, 1.);

out.uv = vertex.uv;
out.clip_position = position;
Expand Down
7 changes: 4 additions & 3 deletions examples/border.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use bevy::color::palettes::css::PURPLE;
use bevy::prelude::*;
use bevy_inspector_egui::quick::WorldInspectorPlugin;

Expand Down Expand Up @@ -36,7 +37,7 @@ fn setup(
// Ground
commands.spawn(PbrBundle {
mesh: meshes.add(Plane3d::default().mesh().size(5.0, 5.0)),
material: materials.add(Color::rgb(0.3, 0.5, 0.3)),
material: materials.add(Color::srgba(0.3, 0.5, 0.3, 1.)),
..Default::default()
});

Expand All @@ -52,7 +53,7 @@ fn setup(
commands.spawn((
PbrBundle {
mesh: meshes.add(Sphere { radius }),
material: materials.add(Color::rgb(1., 0.2, 0.2)),
material: materials.add(Color::srgba(1., 0.2, 0.2, 1.)),
transform: Transform::from_xyz(2. * radius, 0.4 + i as f32 / 2., 0.0),
..Default::default()
},
Expand All @@ -65,7 +66,7 @@ fn setup(
width: bar_width,
height: BarHeight::Static(bar_height),
// here is where the border is defined
border: BarBorder::new(bar_height / 4.).color(Color::PURPLE),
border: BarBorder::new(bar_height / 4.).color(PURPLE.into()),
..default()
},
));
Expand Down
7 changes: 4 additions & 3 deletions examples/custom_background.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use bevy::color::palettes::basic::RED;
use bevy::prelude::*;
use bevy_inspector_egui::quick::WorldInspectorPlugin;

Expand All @@ -23,7 +24,7 @@ fn main() {
WorldInspectorPlugin::new(),
HealthBarPlugin::<Health>::default(),
))
.insert_resource(ColorScheme::<Health>::new().background_color(Color::RED))
.insert_resource(ColorScheme::<Health>::new().background_color(RED.into()))
.add_systems(Startup, setup)
.insert_resource(Msaa::Sample4)
.run();
Expand All @@ -36,7 +37,7 @@ fn setup(
) {
commands.spawn(PbrBundle {
mesh: meshes.add(Plane3d::default().mesh().size(5.0, 5.0)),
material: materials.add(Color::rgb(0.3, 0.5, 0.3)),
material: materials.add(Color::srgba(0.3, 0.5, 0.3, 1.)),
..Default::default()
});

Expand All @@ -45,7 +46,7 @@ fn setup(
commands.spawn((
PbrBundle {
mesh: meshes.add(Sphere { radius }),
material: materials.add(Color::rgb(1., 0.2, 0.2)),
material: materials.add(Color::srgba(1., 0.2, 0.2, 1.)),
transform: Transform::from_xyz(0.0, 1., 0.0),
..Default::default()
},
Expand Down
14 changes: 8 additions & 6 deletions examples/custom_foreground.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use bevy::color::palettes::basic::*;
use bevy::color::palettes::css::*;
use bevy::prelude::*;
use bevy_inspector_egui::quick::WorldInspectorPlugin;

Expand Down Expand Up @@ -37,13 +39,13 @@ fn main() {
HealthBarPlugin::<Health>::default(),
))
.insert_resource(
ColorScheme::<Mana>::new().foreground_color(ForegroundColor::Static(Color::BLUE)),
ColorScheme::<Mana>::new().foreground_color(ForegroundColor::Static(BLUE.into())),
)
.insert_resource(ColorScheme::<Health>::new().foreground_color(
ForegroundColor::TriSpectrum {
high: Color::LIME_GREEN,
moderate: Color::ORANGE_RED,
low: Color::PURPLE,
high: LIMEGREEN.into(),
moderate: ORANGE_RED.into(),
low: PURPLE.into(),
},
))
.add_systems(Startup, setup)
Expand All @@ -63,7 +65,7 @@ fn setup(
commands.spawn((
PbrBundle {
mesh: meshes.add(Sphere { radius }),
material: materials.add(Color::rgb(1., 0.2, 0.2)),
material: materials.add(Color::srgba(1., 0.2, 0.2, 1.)),
transform: Transform::from_xyz(-2. * radius, 0.4 + i as f32 / 2., 0.0),
..Default::default()
},
Expand All @@ -81,7 +83,7 @@ fn setup(
commands.spawn((
PbrBundle {
mesh: meshes.add(Sphere { radius }),
material: materials.add(Color::rgb(1., 0.2, 0.2)),
material: materials.add(Color::srgba(1., 0.2, 0.2, 1.)),
transform: Transform::from_xyz(2. * radius, 0.4 + i as f32 / 2., 0.0),
..Default::default()
},
Expand Down
6 changes: 3 additions & 3 deletions examples/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn setup(
) {
commands.spawn(PbrBundle {
mesh: meshes.add(Plane3d::default().mesh().size(5.0, 5.0)),
material: materials.add(Color::rgb(0.3, 0.5, 0.3)),
material: materials.add(Color::srgba(0.3, 0.5, 0.3, 1.)),
..Default::default()
});

Expand All @@ -46,7 +46,7 @@ fn setup(
commands.spawn((
PbrBundle {
mesh: meshes.add(Sphere { radius }),
material: materials.add(Color::rgb(1., 0.2, 0.2)),
material: materials.add(Color::srgba(1., 0.2, 0.2, 1.)),
transform: Transform::from_xyz(0.0, 1., 0.0),
..Default::default()
},
Expand All @@ -64,7 +64,7 @@ fn setup(
commands.spawn((
PbrBundle {
mesh: meshes.add(Sphere { radius }),
material: materials.add(Color::rgb(1., 0.2, 0.2)),
material: materials.add(Color::srgba(1., 0.2, 0.2, 1.)),
transform: Transform::from_xyz(0.0 + 3. * radius, 0.5, 0.0),
..Default::default()
},
Expand Down
Loading
Loading