//! Mesh generation for [primitive shapes](bevy_math::primitives).1//!2//! Primitives that support meshing implement the [`Meshable`] trait.3//! Calling [`mesh`](Meshable::mesh) will return either a [`Mesh`] or a builder4//! that can be used to specify shape-specific configuration for creating the [`Mesh`].5//!6//! ```7//! # use bevy_asset::Assets;8//! # use bevy_ecs::prelude::ResMut;9//! # use bevy_math::prelude::Circle;10//! # use bevy_mesh::*;11//! #12//! # fn setup(mut meshes: ResMut<Assets<Mesh>>) {13//! // Create circle mesh with default configuration14//! let circle = meshes.add(Circle { radius: 25.0 });15//!16//! // Specify number of vertices17//! let circle = meshes.add(Circle { radius: 25.0 }.mesh().resolution(64));18//! # }19//! ```2021mod dim2;22pub use dim2::*;2324mod dim3;25pub use dim3::*;2627mod extrusion;28pub use extrusion::*;2930use super::Mesh;3132/// A trait for shapes that can be turned into a [`Mesh`].33pub trait Meshable {34/// The output of [`Self::mesh`]. This will be a [`MeshBuilder`] used for creating a [`Mesh`].35type Output: MeshBuilder;3637/// Creates a [`Mesh`] for a shape.38fn mesh(&self) -> Self::Output;39}4041/// A trait used to build [`Mesh`]es from a configuration42pub trait MeshBuilder {43/// Builds a [`Mesh`] based on the configuration in `self`.44fn build(&self) -> Mesh;45}4647impl<T: MeshBuilder> From<T> for Mesh {48fn from(builder: T) -> Self {49builder.build()50}51}525354