bevy/crates/bevy_render/src/mesh
Lynn 450a9202d0
Common MeshBuilder trait (#13411)
# Objective

- All `ShapeMeshBuilder`s have some methods/implementations in common.
These are `fn build(&self) -> Mesh` and this implementation:
```rust
impl From<ShapeMeshBuilder> for Mesh { 
    fn from(builder: ShapeMeshBuilder) -> { 
        builder.build() 
    } 
}
``` 

- For the sake of consistency, these can be moved into a shared trait

## Solution

- Add `trait MeshBuilder` containing a `fn build(&self) -> Mesh` and
implementing `MeshBuilder for ShapeMeshBuilder`
- Implement `From<T: MeshBuilder> for Mesh`

## Migration Guide

- When calling `.build()` you need to import
`bevy_render::mesh::primitives::MeshBuilder`
2024-05-18 11:58:11 +00:00
..
mesh Revert "Support calculating normals for indexed meshes" (#12716) and add support for calculating smooth normals (#13333) 2024-05-16 14:54:35 +00:00
primitives Common MeshBuilder trait (#13411) 2024-05-18 11:58:11 +00:00
mod.rs Enable clippy::ref_as_ptr (#12918) 2024-04-10 20:16:48 +00:00
morph.rs Reflect default in some types on bevy_render (#12580) 2024-03-19 22:50:17 +00:00