From 45be43cfa5c4dad9a6f0ca6887d237dade816260 Mon Sep 17 00:00:00 2001 From: MevLyshkin Date: Mon, 2 Dec 2024 11:20:44 +0100 Subject: [PATCH] Add alpha mode implementation to shader_material_2d to raise awareness of it --- examples/shader/shader_material_2d.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/shader/shader_material_2d.rs b/examples/shader/shader_material_2d.rs index 22bc1732ae713..98257d5954252 100644 --- a/examples/shader/shader_material_2d.rs +++ b/examples/shader/shader_material_2d.rs @@ -4,7 +4,7 @@ use bevy::{ prelude::*, reflect::TypePath, render::render_resource::{AsBindGroup, ShaderRef}, - sprite::{Material2d, Material2dPlugin}, + sprite::{AlphaMode2d, Material2d, Material2dPlugin}, }; /// This example uses a shader source file from the assets subdirectory @@ -57,4 +57,8 @@ impl Material2d for CustomMaterial { fn fragment_shader() -> ShaderRef { SHADER_ASSET_PATH.into() } + + fn alpha_mode(&self) -> AlphaMode2d { + AlphaMode2d::Blend + } }