Crates.io | bevy_procedural_meshes |
lib.rs | bevy_procedural_meshes |
version | 0.14.0 |
source | src |
created_at | 2024-02-26 07:03:14.479285 |
updated_at | 2024-07-08 06:21:37.561075 |
description | Procedural Meshes for the Bevy game engine. |
homepage | https://bevy-procedural.org/meshes |
repository | https://github.com/bevy-procedural/meshes |
max_upload_size | |
id | 1153078 |
size | 224,312 |
The objective of the Bevy Procedural Project is to provide a comprehensive suite of packages for the generation of procedural graphics, unified by a consistent API.
The bevy_procedural_meshes-crate is a procedural mesh builder for bevy. It can use Lyon to generate 2D shapes and extrude them into 3D meshes. Meshes can also be optimized using Meshopt to improve their performance. Plans for future versions also include more advanced mesh operations like 3D boolean operations, parametric surfaces, and L-systems.
This crate is still in a very early stage of development. Expect frequent API modifications, bugs, and missing features. Feel free to contribute by opening issues, pull requests or sharing your ideas in Github Discussion or the Bevy Discord.
Try the live examples!
Or run the examples on your computer like, e.g., cargo run --features="bevy/default" --example 2d
.
For package development, we recommend using the editor
-subcrate. This example has a little egui-editor. Run it using cargo watch -w editor/src -w src -x "run -p editor --profile fast-dev"
. The fast-dev
profile will enable optimizations for the dependencies, but not for the package itself. This will slow down the first build significantly, but incremental builds are slightly faster and bevy's performance improves a lot.
Install using cargo add bevy_procedural_meshes
. Create meshes for bevy like:
use bevy_procedural_meshes::*;
fn setup(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
let mut mesh = PMesh::<u32>::new();
mesh.fill(0.01, |builder| {
builder
.begin_here()
.quadratic_bezier_to(Vec2::new(3.0, 3.0), Vec2::new(1.5, 3.0))
.quadratic_bezier_to(Vec2::new(0.0, 3.0), Vec2::new(0.0, 0.0))
.close();
});
commands.spawn(PbrBundle {
mesh: meshes.add(mesh.to_bevy(RenderAssetUsages::all())),
material: materials.add(StandardMaterial::default()),
..default()
});
}
The following features are available:
meshopt
-- Use Meshopt to optimize the performance of generated meshes.
lyon
-- Use Lyon to tesselate 2D shapes like bezier curves and strokes.
inspector
-- Add bevy-inspector-egui-support to different structs.
dynamic
-- Compiles bevy as a dynamic library. Useful for development builds.
The following table shows the compatibility of bevy_procedural_meshes
with certain versions of Bevy:
bevy | bevy_procedural_meshes |
---|---|
0.14 | 0.14.*, main |
0.13 | 0.1.* |
The bevy-procedural packages are free, open source and permissively licensed. Except where noted (below and/or in individual files), all code in these repositories is dual-licensed, allowing you the flexibility to choose between:
The MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
The Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0).
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.