Add alpha mode implementation to shader_material_2d (#16603)
## Objective Bevy 0.15 introduced new method in `Material2d` trait- `alpha_mode`. Before that when new material was created it had alpha blending, now it does not. ## Solution While I am okay with it, it could be useful to add the new trait method implementation to one of the samples so users are more aware of it. --------- Co-authored-by: IceSentry <IceSentry@users.noreply.github.com>
This commit is contained in:
parent
15f00278e7
commit
68b779c31f
@ -4,7 +4,7 @@ use bevy::{
|
|||||||
prelude::*,
|
prelude::*,
|
||||||
reflect::TypePath,
|
reflect::TypePath,
|
||||||
render::render_resource::{AsBindGroup, ShaderRef},
|
render::render_resource::{AsBindGroup, ShaderRef},
|
||||||
sprite::{Material2d, Material2dPlugin},
|
sprite::{AlphaMode2d, Material2d, Material2dPlugin},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// This example uses a shader source file from the assets subdirectory
|
/// This example uses a shader source file from the assets subdirectory
|
||||||
@ -57,4 +57,8 @@ impl Material2d for CustomMaterial {
|
|||||||
fn fragment_shader() -> ShaderRef {
|
fn fragment_shader() -> ShaderRef {
|
||||||
SHADER_ASSET_PATH.into()
|
SHADER_ASSET_PATH.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn alpha_mode(&self) -> AlphaMode2d {
|
||||||
|
AlphaMode2d::Mask(0.5)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user