A shader that uses "shaders defs", which selectively toggle parts of a shader.
use ;
/// This example uses a shader source file from the assets subdirectory
const SHADER_ASSET_PATH: &str = "shaders/shader_defs.wgsl";
/// set up a simple 3D scene
// This is the struct that will be passed to your shader
// This key is used to identify a specific permutation of this material pipeline.
// In this case, we specialize on whether or not to configure the "IS_RED" shader def.
// Specialization keys should be kept as small / cheap to hash as possible,
// as they will be used to look up the pipeline for each drawn entity with this material type,
#import bevy_pbr::forward_io::VertexOutput
struct CustomMaterial {
color: vec4<f32>,
};
@group(#{MATERIAL_BIND_GROUP}) @binding(0) var<uniform> material: CustomMaterial;
@fragment
#ifdef IS_RED
return ;
#else
return material.color;
#endif
}