Hi! Thanks for the wonderful work.
I think in many cases, especially in 3D, it is not needed to create a separate material and write a custom wgsl script for each displayed element. Indeed, bevy has the MaterialExtension trait exactly for that purpose.
However, currently render_animation<MeshMaterial3d<T>> only takes T such that they implement Material. It would be great if we could also use MaterialExtension, this way we can just use standard materials for most use cases like this:
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone, Default)]
pub struct WorldStandardAnimatedMaterial {
pub base_color_texture: Option<Handle<Image>>,
}
impl MaterialExtension for WorldStandardAnimatedMaterial {}
impl RenderAnimation for WorldStandardAnimatedMaterial {
type Extra<'e> = (Res<'e, Time>, Res<'e, Assets<TextureAtlasLayout>>);
fn render_animation(
&mut self,
aseprite: &Aseprite,
state: &AnimationState,
extra: &mut Self::Extra<'_>,
) {
let Some(atlas_layout) = extra.1.get(&aseprite.atlas_layout) else {
return;
};
self.base_color_texture = Some(aseprite.atlas_image.clone());
}
}
Hi! Thanks for the wonderful work.
I think in many cases, especially in 3D, it is not needed to create a separate material and write a custom wgsl script for each displayed element. Indeed, bevy has the
MaterialExtensiontrait exactly for that purpose.However, currently
render_animation<MeshMaterial3d<T>>only takesTsuch that they implementMaterial. It would be great if we could also useMaterialExtension, this way we can just use standard materials for most use cases like this: