Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hakolao committed Jan 30, 2022
1 parent bfae1df commit 7bafa55
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 34 deletions.
70 changes: 40 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,32 @@
# bevy_vulkano

This plugin replaces core loop & rendering in bevy with Vulkano backend. Currenlty you can only use it for a single window.
This plugin replaces core loop & rendering in bevy with Vulkano backend.

Provides a `Renderer` to organize target images and exposes an api to `start_frame` and `end_frame`.
However, you'll have handle rendering yourself in between. Resizing is handled as well. Provide your own camera though.
The plugin contains functionality for resizing, multiple windows & utility for beginning and ending the frame.
However, you'll need to do everything in between yourself (rendering).

See example `circle` for how to use this.

1. Add `VulkanoWinitPlugin`. You'll need bevy's `WindowPlugin`
1. Add `VulkanoWinitPlugin`. It also adds `WindowPlugin` and anything that's needed.
2. Then create your own rendering systems using vulkano's pipelines (See example.). You'll need to know how to use Vulkano.
3. If you want to use `egui` library with this, add `egui_winit_vulkano` & `egui` to your dependencies and `bevy_vulkano` with feature `gui`
3. If you want to use `egui` library with this, add `egui_winit_vulkano` & `egui` to your dependencies and `bevy_vulkano` with feature `gui`.

## Usage

```rust
pub struct PluginBundle;

impl PluginGroup for PluginBundle {
fn build(&mut self, group: &mut PluginGroupBuilder) {
group.add(bevy::log::LogPlugin::default());
group.add(bevy::core::CorePlugin::default());
group.add(bevy::transform::TransformPlugin::default());
group.add(bevy::diagnostic::DiagnosticsPlugin::default());
group.add(bevy::diagnostic::FrameTimeDiagnosticsPlugin::default());
group.add(bevy::asset::AssetPlugin::default());
group.add(bevy::scene::ScenePlugin::default());
group.add(bevy::input::InputPlugin::default());
group.add(bevy::window::WindowPlugin::default());
// Don't add default bevy plugins or WinitPlugin. This owns "core loop" (runner)
group.add(VulkanoWinitPlugin::default());
// See here how rendering is orchestrated
group.add(MainRenderPlugin::default());
}
}

fn main() {
App::new()
// Vulkano configs
.insert_resource(VulkanoWinitConfig {
features: Features {
fill_mode_non_solid: true,
..Features::none()
},
present_mode: PresentMode::Immediate,
..VulkanoWinitConfig::default()
})
// Window configs
// Vulkano configs (Modify this if you want to add features to vulkano (vulkan backend).
// You can also disable primary window opening here
.insert_resource(VulkanoWinitConfig::default())
// Window configs for primary window
.insert_resource(WindowDescriptor {
width: 1920.0,
height: 1080.0,
Expand All @@ -54,16 +37,43 @@ fn main() {
..WindowDescriptor::default()
})
.add_plugins(PluginBundle)
.add_system(exit_on_esc_system)
.run();
}
```

## Dependencies

Add following to your `Cargo.toml`:
```toml
[dependencies.bevy]
version = "0.6"
default-features = false
# Add features you need, but don't add "render". This might disable a lot of features you wanted... e.g SpritePlugin
features = []

[dependencies.bevy_vulkano]
version = "*"
default-features = false
# gui or no gui...
features = ["gui"]

# For gui
egui = "0.16.0"
egui_winit_vulkano = "0.15"
# For render pipelines etc.
vulkano-shaders = "0.28"
vulkano = "0.28"
vulkano-win = "0.28"
vulkano-win = "0.28"

```

## Examples:
```bash
cargo run --example circle --features example_has_gui
cargo run --example circle
cargo run --example multi_window_gui --features example_has_gui
```

ToDo:
- [ ] Multi-window
- [ ] Update Cargo.toml to new crates once Vulkano 0.28 is out...
4 changes: 0 additions & 4 deletions examples/multi_window_gui/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ pub struct PluginBundle;
impl PluginGroup for PluginBundle {
fn build(&mut self, group: &mut PluginGroupBuilder) {
// Minimum plugins for the demo
group.add(bevy::log::LogPlugin::default());
group.add(bevy::core::CorePlugin::default());
group.add(bevy::diagnostic::DiagnosticsPlugin::default());
group.add(bevy::diagnostic::FrameTimeDiagnosticsPlugin::default());
group.add(bevy::input::InputPlugin::default());
// Don't add default bevy plugins or WinitPlugin. This owns "core loop" (runner).
// Bevy winit and render should be excluded
Expand Down

0 comments on commit 7bafa55

Please sign in to comment.