https://github.com/james-j-obrien/bevy_vector_shapes
A library for rendering vector shapes using the Bevy game engine
https://github.com/james-j-obrien/bevy_vector_shapes
Last synced: about 2 months ago
JSON representation
A library for rendering vector shapes using the Bevy game engine
- Host: GitHub
- URL: https://github.com/james-j-obrien/bevy_vector_shapes
- Owner: james-j-obrien
- License: other
- Created: 2023-04-24T01:44:14.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-14T02:41:38.000Z (7 months ago)
- Last Synced: 2025-04-14T06:49:21.861Z (3 months ago)
- Language: Rust
- Size: 42.4 MB
- Stars: 377
- Watchers: 3
- Forks: 25
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-bevy - `bevy_vector_shapes`
README
Bevy Vector Shapes[](https://crates.io/crates/bevy_vector_shapes)
[](https://docs.rs/bevy_vector_shapes)
[](https://github.com/james-j-obrien/bevy_vector_shapes/actions?query=workflow%3A%22Rust%22+branch%3Amain)
[](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)
![]()
## What is Bevy Vector Shapes?
Bevy Vector Shapes is a library for easily and ergonomically creating instanced vector shapes in [Bevy](https://bevyengine.org/).## WARNING
Bevy Vector Shapes is in the early stages of development. You may encounter issues, but feel free to report them.## Features
- Variety of built in shape types: lines, rectangles, circles, arcs and regular polygons.
- Traits to allow implementation of custom shape types.
- Supports various bevy rendering features: 2D and 3D pipelines, transparency, alpha modes, render layers, bloom.
- Canvas API for rendering shapes to a texture.
- Ability to draw textures on shapes, including canvas textures.
- Immediate and retained mode.
- Local anti-aliasing for smoother looking shapes.
- Optional billboarding for each shape type to ensure they are always facing the camera.
- Shapes of the same type and rendering configuration are fully instanced together.
- Compilation to wasm to run your projects in the browser.## Usage
See basic usage below and the [examples](https://github.com/james-j-obrien/bevy_vector_shapes/tree/main/examples) for more details on all supported features.```rust
use bevy::prelude::*;
// Import commonly used items
use bevy_vector_shapes::prelude::*;fn main() {
App::new()
.add_plugins(DefaultPlugins)
// Add the shape plugin:
// - Shape2dPlugin for 2D cameras
// - ShapePlugin for both 3D and 2D cameras
.add_plugins(Shape2dPlugin::default())
.add_systems(Startup, setup)
.add_systems(Update, draw)
.run();
}fn setup(mut commands: Commands) {
// Spawn the camera
commands.spawn(Camera2dBundle::default());
}fn draw(mut painter: ShapePainter) {
// Draw a circle
painter.circle(100.0);
}
```| bevy | bevy_vector_shapes |
| ---- | ------------------ |
| 0.16 | 0.10.0 |
| 0.15 | 0.9.3 |
| 0.14 | 0.8.2 |
| 0.13 | 0.7.0 |
| 0.12 | 0.6.0 |
| 0.11 | 0.5.2 |
| 0.10 | 0.4.6 |## Alternatives
- [bevy_smud](https://github.com/johanhelsing/bevy_smud): for generating custom sdf expressions at run time.
- [bevy_prototype_lyon](https://github.com/Nilirad/bevy_prototype_lyon): for generating meshes from 2D shapes and paths.
- [vello](https://github.com/linebender/vello): for very efficient 2D shape rendering to images.