mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
908c40dd88
# 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. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |