bevy/crates/bevy_sprite/src/mesh2d
Sludge 908c40dd88 Implement Clone for all pipeline types (#6653)
# Objective

Pipelines can be customized by wrapping an existing pipeline in a newtype and adding custom logic to its implementation of `SpecializedMeshPipeline::specialize`. To make that easier, the wrapped pipeline type needs to implement `Clone`.

For example, the current non-cloneable pipelines require wrapper pipelines to pull apart the wrapped pipeline like this:

```rust
impl FromWorld for Wireframe2dPipeline {
    fn from_world(world: &mut World) -> Self {
        let p = &world.resource::<Material2dPipeline<ColorMaterial>>();
        Self {
            mesh2d_pipeline: p.mesh2d_pipeline.clone(),
            material2d_layout: p.material2d_layout.clone(),
            vertex_shader: p.vertex_shader.clone(),
            fragment_shader: p.fragment_shader.clone(),
        }
    }
}
```

## Solution

Derive or implement `Clone` on all built-in pipeline types. This is easy to do since they mostly just contain cheaply clonable reference-counted types.

---

## Changelog

Implement `Clone` for all pipeline types.
2023-01-14 18:33:38 +00:00
..
color_material.rs add ReflectAsset and ReflectHandle (#5923) 2022-10-28 20:42:33 +00:00
color_material.wgsl bevy_pbr: Fix incorrect and unnecessary normal-mapping code (#5766) 2022-11-03 20:37:32 +00:00
material.rs Implement Clone for all pipeline types (#6653) 2023-01-14 18:33:38 +00:00
mesh2d_bindings.wgsl update wgpu to 0.13 (#5168) 2022-07-14 21:17:16 +00:00
mesh2d_functions.wgsl Add reusable shader functions for transforming position/normal/tangent (#4901) 2022-06-14 00:32:33 +00:00
mesh2d_types.wgsl update wgpu to 0.13 (#5168) 2022-07-14 21:17:16 +00:00
mesh2d_vertex_output.wgsl update wgpu to 0.13 (#5168) 2022-07-14 21:17:16 +00:00
mesh2d_view_bindings.wgsl Add globals struct to mesh2d (#6222) 2022-10-10 19:23:43 +00:00
mesh2d_view_types.wgsl wasm: pad globals uniform also in 2d (#6643) 2022-11-18 21:02:56 +00:00
mesh2d.wgsl bevy_pbr: Fix incorrect and unnecessary normal-mapping code (#5766) 2022-11-03 20:37:32 +00:00
mesh.rs Flatten render commands (#6885) 2023-01-04 01:13:30 +00:00
mod.rs Add 2d meshes and materials (#3460) 2022-01-08 01:29:08 +00:00