For one of my personal projects i needed a way to load and display some simple SVG files/shapes in [Bevy],
so i took inspiration from [bevy_prototype_lyon] and modified and extended it to...well...load and display
simple SVG files. SVGs can be used/displayed in 2D as well as in 3D.
Files are loaded through [AssetLoader], then parsed and simplified with [usvg] and then tessellated with [Lyon]
into a vertex buffer, which lastly is convert into a [Bevy] mesh and drawn with custom shaders.
Note: The SVG support is currently rather basic, i'd like to expand that in the future.
| Bevy version | bevy_svg version | Branch |
|----------------|--------------------|-------------|
| |
|
bevy-0.10 |
| |
|
bevy-0.9 |
| |
|
main |
Old versions
| Bevy version | bevy_svg version | Branch |
|----------------|--------------------|-------------|
| |
|
bevy-0.8 |
| |
|
bevy-0.7 |
| |
|
bevy-0.6 |
| |
|
bevy-0.5 |
| Complex shapes | Multiple colors | Fonts | |----------------------|-----------------|------------| | ![complexonecolor] | ![two_colors] | ![twinkle] |
Copy this to your Cargo.toml
```toml
bevy_svg = "0.10.1"
bevy_svg = { version = "0.10.1", default-features = false, features = ["2d"] }
bevy_svg = { version = "0.10.1", default-features = false, features = ["3d"] }
bevysvg = { git = "https://github.com/Weasy666/bevysvg", branch = "main" } ```
Then use it like this.
```rust use bevy_svg::prelude::*;
fn main() { App::new() .insertresource(Msaa::Sample4) .addplugins(DefaultPlugins.set(WindowPlugin { primarywindow: Some(Window { title: "SVG Plugin".tostring(), ..Default::default() }), ..Default::default() })) .addplugin(bevysvg::prelude::SvgPlugin) .addstartupsystem(setup) .run(); }
fn setup(
mut commands: Commands,
assetserver: Res
```rust use bevy_svg::prelude::*;
fn main() { App::new() .insertresource(Msaa::Sample4) .addplugins(DefaultPlugins.set(WindowPlugin { primarywindow: Some(Window { title: "SVG Plugin".tostring(), ..Default::default() }), ..Default::default() })) .addplugin(bevysvg::prelude::SvgPlugin) .addstartupsystem(setup) .run(); }
fn setup(
mut commands: Commands,
assetserver: Res
bevy_svg is licensed under either of the following, at your option: