Introduces the nannou specific trait ShaderModel, as well as a convenient attribute macro #[shader_model] that can be used to generate the bevy boilerplate derives needed for implementing Material.
Although Material is used to drive much of the bevy ecosystem, including it in our public api and examples couples us too tightly to the bevy pbr pipeline. It's also confusing, because while we ask users to implement things from the trait like fragment and vertex shaders, there's a ton of additional features included in this trait that they would not want to touch.
As such, the nannou trait ShaderModel is a simple trait that specifies which shaders to use, as well as adding all the required bounds to make everything work. Users can implement this themselves, but can also use the macro as such:
// This struct defines the data that will be passed to your shader
#[shader_model(fragment = "draw_custom_material.wgsl")]
struct ShaderModel {
#[uniform(0)]
color: LinearRgba,
}
Additionally, this will help future extensions, like supporting indirect drawing in compute shaders, where we do not want to depend directly on T: Material but instead T: AsBindGroup.
Other changes:
Removes the nightly feature and init_fragment_shader experiment. While this is cool, we want to focus on making ShaderModel the first class way to interact with these apis.
Introduces the nannou specific trait
ShaderModel
, as well as a convenient attribute macro#[shader_model]
that can be used to generate the bevy boilerplate derives needed for implementingMaterial
.Although
Material
is used to drive much of the bevy ecosystem, including it in our public api and examples couples us too tightly to the bevy pbr pipeline. It's also confusing, because while we ask users to implement things from the trait like fragment and vertex shaders, there's a ton of additional features included in this trait that they would not want to touch.As such, the nannou trait
ShaderModel
is a simple trait that specifies which shaders to use, as well as adding all the required bounds to make everything work. Users can implement this themselves, but can also use the macro as such:Additionally, this will help future extensions, like supporting indirect drawing in compute shaders, where we do not want to depend directly on
T: Material
but insteadT: AsBindGroup
.Other changes:
nightly
feature andinit_fragment_shader
experiment. While this is cool, we want to focus on makingShaderModel
the first class way to interact with these apis.