Skip to content

Commit

Permalink
bevy 0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
stillonearth committed Jul 1, 2024
1 parent 08e2be1 commit cb8f4cc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
[package]
edition = "2021"
name = "bevy_rl"
version = "0.13.0"
version = "0.14.0-rc.1"
license = "MIT OR Apache-2.0"
description = "Build environments for reinforcement learning with bevy"
keywords = ["ai", "bevy", "gym", "rl"]
repository = "https://github.com/stillonearth/bevy_rl"

[dependencies]
bevy = { version = "0.13" }
bevy = { version = "0.14.0-rc.4" }
bytemuck = "1.12.3"
crossbeam = "0.8.2"
crossbeam-channel = "0.5.6"
futures = "0.3.23"
gotham = "0.7.1"
hyper = "0.14.20"
image = "0.24.3"
hyper = "0.14.20" # this dependencie is due to gotham no longer in development
image = "0.25.1"
mime = "0.3.16"
serde = "1.0.89"
serde_derive = "1.0.143"
serde_json = "1.0.83"
wgpu = "0.19.1"
wgpu = "0.20.1"

[dev-dependencies]
bitflags = "2.0.2"
reqwest = { version = "0.11.13", features = ["blocking"] }
reqwest = { version = "0.12.5", features = ["blocking"] }

[profile.dev]
opt-level = 3
2 changes: 1 addition & 1 deletion src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ fn visual_observations<
}

all_agents_image
.write_to(&mut Cursor::new(&mut bytes), image::ImageOutputFormat::Png)
.write_to(&mut Cursor::new(&mut bytes), image::ImageFormat::Png)
.unwrap();

let response = create_response::<Vec<u8>>(&state, StatusCode::OK, mime::IMAGE_PNG, bytes);
Expand Down
20 changes: 10 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<
app.add_systems(Startup, setup::<T, P>);

let ai_gym_state = app
.world
.world()
.get_resource::<state::AIGymState<T, P>>()
.unwrap()
.clone();
Expand Down Expand Up @@ -101,13 +101,13 @@ impl<
.in_set(SimulationState::PausedForControl),
);

if let Ok(render_app) = app.get_sub_app_mut(RenderApp) {
render_app.add_systems(
Update,
copy_from_gpu_to_ram::<T, P>.in_set(RenderSet::Render),
);
render_app.insert_resource(ai_gym_state);
}
let render_app = app.get_sub_app_mut(RenderApp).unwrap();

render_app.add_systems(
Update,
copy_from_gpu_to_ram::<T, P>.in_set(RenderSet::Render),
);
render_app.insert_resource(ai_gym_state);
}
}

Expand Down Expand Up @@ -169,7 +169,7 @@ pub(crate) fn setup<

commands
.spawn(Camera2dBundle::default())
.insert(second_pass_layer);
.insert(second_pass_layer.clone());

// Show all camera views in tiled mode
// let window = windows.get_primary_mut().unwrap();
Expand Down Expand Up @@ -199,7 +199,7 @@ pub(crate) fn setup<
transform: Transform::from_xyz(x - offset_x, y - offset_y, 0.0),
..default()
})
.insert(second_pass_layer);
.insert(second_pass_layer.clone());
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use bevy::{
Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages,
},
renderer::{RenderDevice, RenderQueue},
texture::GpuImage,
},
};

Expand Down Expand Up @@ -37,7 +38,7 @@ pub(crate) fn copy_from_gpu_to_ram<
T: 'static + Send + Sync + Clone + std::panic::RefUnwindSafe,
P: 'static + Send + Sync + Clone + std::panic::RefUnwindSafe + serde::Serialize,
>(
gpu_images: Res<RenderAssets<Image>>,
gpu_images: Res<RenderAssets<GpuImage>>,
render_device: Res<RenderDevice>,
render_queue: Res<RenderQueue>,
ai_gym_state: Res<state::AIGymState<T, P>>,
Expand Down

0 comments on commit cb8f4cc

Please sign in to comment.