From 3f77b34e2223092867761b24e3aef7c0c9d401dc Mon Sep 17 00:00:00 2001 From: Krillh Date: Tue, 13 Jan 2026 15:43:03 -0800 Subject: [PATCH 1/3] Update to Bevy 1.18 - Minimal Effort Port --- Cargo.toml | 2 +- examples/simple_example.rs | 41 ++++++++++++++++++--------------- examples/update_mesh_example.rs | 36 +++++++++++++++-------------- src/lib.rs | 2 +- src/meshem.rs | 4 ++-- src/pbs.rs | 3 +-- src/update.rs | 2 +- src/util/mod.rs | 4 ++-- src/util/vav.rs | 4 +++- src/voxel_mesh.rs | 4 ++-- 10 files changed, 55 insertions(+), 47 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8566896..c52cc38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,5 +11,5 @@ documentation = "https://docs.rs/bevy_meshem" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy = "0.16.0" +bevy = "0.18.0" rand = "0.8.5" diff --git a/examples/simple_example.rs b/examples/simple_example.rs index 061de7e..5bf2b6a 100644 --- a/examples/simple_example.rs +++ b/examples/simple_example.rs @@ -23,14 +23,10 @@ fn main() { Some(0.8), 1.0, ), - }) - .insert_resource(AmbientLight { - brightness: 1500.0, - color: Color::WHITE, - ..default() }); - app.add_systems(Startup, setup).add_systems( + app.add_systems(Startup, setup) + .add_systems( Update, ( input_handler, @@ -40,8 +36,8 @@ fn main() { ), ); - app.add_event::() - .add_event::(); + app.add_message::() + .add_message::(); app.run(); } @@ -55,10 +51,10 @@ struct Meshy { #[derive(Component)] struct MeshInfo; -#[derive(Event, Default)] +#[derive(Message, Default)] struct ToggleWireframe; -#[derive(Event, Default)] +#[derive(Message, Default)] struct RegenerateMesh; /// Setting up everything to showcase the mesh. @@ -111,6 +107,15 @@ fn setup( Vec3::Y, ); + // Ambient Light + commands.spawn( + AmbientLight { + brightness: 1500.0, + color: Color::WHITE, + ..default() + } + ); + // Camera in 3D space. commands.spawn(( Camera3d::default(), @@ -190,7 +195,7 @@ impl VoxelRegistry for BlockRegistry { /// The attributes we want to take from out voxels, note that using a lot of different /// attributes will likely lead to performance problems and unpredictable behaviour. /// We chose these 3 because they are very common, the algorithm does preserve UV data. - fn all_attributes(&self) -> Vec { + fn all_attributes(&self) -> Vec { return vec![ Mesh::ATTRIBUTE_POSITION, Mesh::ATTRIBUTE_UV_0, @@ -204,8 +209,8 @@ fn input_handler( keyboard_input: Res>, mut query: Query<&mut Transform, With>, time: Res