From ff0b74cbbe6b0d3ccf9f19318776b6154bdd31fb Mon Sep 17 00:00:00 2001 From: Brandon Reinhart Date: Tue, 5 Mar 2024 15:19:00 -0600 Subject: [PATCH] update to bevy-0.13 (#16) * update to bevy-0.13 * fix more build issues nothing visible atm though * update render asset usages now we get validation errors, so making progress? * fix material * fix doctests * remove unused uuid literals * switch to bind group 2 for custom shader bindings --- Cargo.toml | 8 ++++---- assets/shaders/custom.wgsl | 6 +++--- examples/3d.rs | 8 ++++---- examples/custom_material.rs | 5 ++--- examples/events.rs | 2 +- examples/spineboy/player.rs | 14 +++++++------- src/assets.rs | 14 +++++--------- src/lib.rs | 18 ++++++++++-------- src/materials.rs | 15 +++------------ src/spine.wgsl | 4 ++-- src/test.rs | 1 + 11 files changed, 42 insertions(+), 53 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index abdb30c..7284cd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,13 +13,13 @@ exclude = [ [dependencies] rusty_spine = "0.7" -bevy = { version = "0.12", default-features = false, features = [ "bevy_render", "bevy_asset", "bevy_sprite" ] } -glam = { version = "0.24", features = [ "mint" ] } +bevy = { version = "0.13", default-features = false, features = [ "bevy_render", "bevy_asset", "bevy_sprite" ] } +glam = { version = "0.25", features = [ "mint" ] } thiserror = "1.0.50" [dev-dependencies] -lerp = "0.4" -bevy = { version = "0.12", default-features = true } +lerp = "0.5" +bevy = { version = "0.13", default-features = true } [workspace] resolver = "2" diff --git a/assets/shaders/custom.wgsl b/assets/shaders/custom.wgsl index 84b85cf..1404bdc 100644 --- a/assets/shaders/custom.wgsl +++ b/assets/shaders/custom.wgsl @@ -40,12 +40,12 @@ fn vertex(vertex: Vertex) -> VertexOutput { return out; } -@group(1) @binding(0) +@group(2) @binding(0) var texture: texture_2d; -@group(1) @binding(1) +@group(2) @binding(1) var texture_sampler: sampler; -@group(1) @binding(2) +@group(2) @binding(2) var time: f32; @fragment diff --git a/examples/3d.rs b/examples/3d.rs index e8560c7..ec932d8 100644 --- a/examples/3d.rs +++ b/examples/3d.rs @@ -46,8 +46,8 @@ fn setup( ) { // plane commands.spawn(PbrBundle { - mesh: meshes.add(shape::Plane::from_size(5.0).into()), - material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), + mesh: meshes.add(Plane3d::default().mesh().size(5.0, 5.0)), + material: materials.add(Color::rgb(0.3, 0.5, 0.3)), ..default() }); @@ -107,8 +107,8 @@ fn controls( mut window_query: Query<&mut Window, With>, mut mouse_motion_events: EventReader, mut orbit_query: Query<(&mut Orbit, &mut Transform)>, - mouse_buttons: Res>, - keys: Res>, + mouse_buttons: Res>, + keys: Res>, ) { let mut window = window_query.single_mut(); if mouse_buttons.just_pressed(MouseButton::Left) { diff --git a/examples/custom_material.rs b/examples/custom_material.rs index 9c5252d..a1bdd21 100644 --- a/examples/custom_material.rs +++ b/examples/custom_material.rs @@ -1,7 +1,7 @@ use bevy::{ ecs::system::{StaticSystemParam, SystemParam}, prelude::*, - reflect::{TypePath, TypeUuid}, + reflect::TypePath, render::{ mesh::MeshVertexBufferLayout, render_resource::{ @@ -85,8 +85,7 @@ fn on_spawn( #[derive(Component)] pub struct MySpine; -#[derive(Asset, AsBindGroup, TypeUuid, TypePath, Clone, Default)] -#[uuid = "2e85f9ae-049a-4bb5-9f5d-ebaaa208df60"] +#[derive(Asset, AsBindGroup, TypePath, Clone, Default)] pub struct MyMaterial { #[texture(0)] #[sampler(1)] diff --git a/examples/events.rs b/examples/events.rs index 940c60c..84ecad1 100644 --- a/examples/events.rs +++ b/examples/events.rs @@ -70,7 +70,7 @@ fn on_spine_event( color: Color::WHITE, }, ) - .with_alignment(TextAlignment::Center), + .with_justify(JustifyText::Center), transform: Transform::from_xyz(0., -200., 1.), ..Default::default() }) diff --git a/examples/spineboy/player.rs b/examples/spineboy/player.rs index 35d354c..59c565e 100644 --- a/examples/spineboy/player.rs +++ b/examples/spineboy/player.rs @@ -1,6 +1,5 @@ use bevy::prelude::*; use bevy_spine::prelude::*; -use lerp::Lerp; use crate::bullet::{BulletSpawnEvent, BulletSystem}; @@ -225,7 +224,8 @@ fn player_aim( spine.animation_state.track_at_index_mut(PLAYER_TRACK_AIM) { let alpha = aim_track.alpha() * 2.5; - aim_track.set_alpha(alpha.lerp(1., time.delta_seconds()).clamp(0., 1.)); + aim_track + .set_alpha(lerp::Lerp::lerp(alpha, 1., time.delta_seconds()).clamp(0., 1.)); } } } @@ -237,7 +237,7 @@ fn player_shoot( mut spine_query: Query<(&mut Spine, &Transform)>, mut bullet_spawn_events: EventWriter, global_transform_query: Query<&GlobalTransform>, - mouse_buttons: Res>, + mouse_buttons: Res>, time: Res