diff --git a/examples/with_bevy/Cargo.toml b/examples/with_bevy/Cargo.toml index 17f84b034..1257adc9e 100644 --- a/examples/with_bevy/Cargo.toml +++ b/examples/with_bevy/Cargo.toml @@ -10,5 +10,5 @@ repository.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bevy = { git = "https://github.com/bevyengine/bevy", rev = "4d54ce14aaee8d7432380df37c41c03c28594b27" } +bevy = "0.11" vello = { path = "../../" } diff --git a/examples/with_bevy/src/main.rs b/examples/with_bevy/src/main.rs index 2e3dd917d..39d50d59f 100644 --- a/examples/with_bevy/src/main.rs +++ b/examples/with_bevy/src/main.rs @@ -21,8 +21,8 @@ struct VelloRenderer(Renderer); impl FromWorld for VelloRenderer { fn from_world(world: &mut World) -> Self { - let device = world.get_resource::().unwrap(); - let queue = world.get_resource::().unwrap(); + let device = world.resource::(); + let queue = world.resource::(); VelloRenderer( Renderer::new( @@ -42,10 +42,14 @@ struct VelloPlugin; impl Plugin for VelloPlugin { fn build(&self, app: &mut App) { let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; - render_app.init_resource::(); // This should probably use the render graph, but working out the dependencies there is awkward render_app.add_systems(Render, render_scenes.in_set(RenderSet::Render)); } + + fn finish(&self, app: &mut App) { + let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return }; + render_app.init_resource::(); + } } fn render_scenes( @@ -78,11 +82,11 @@ fn render_scenes( fn main() { App::new() .add_plugins(DefaultPlugins) - .add_plugin(VelloPlugin) + .add_plugins(VelloPlugin) .add_systems(Startup, setup) .add_systems(Update, bevy::window::close_on_esc) .add_systems(Update, cube_rotator_system) - .add_plugin(ExtractComponentPlugin::::default()) + .add_plugins(ExtractComponentPlugin::::default()) .add_systems(Update, render_fragment) .run() }