Trait bevy_pbr::MaterialExtension
source · pub trait MaterialExtension: Asset + AsBindGroup + Clone + Sized {
// Provided methods
fn vertex_shader() -> ShaderRef { ... }
fn fragment_shader() -> ShaderRef { ... }
fn prepass_vertex_shader() -> ShaderRef { ... }
fn prepass_fragment_shader() -> ShaderRef { ... }
fn deferred_vertex_shader() -> ShaderRef { ... }
fn deferred_fragment_shader() -> ShaderRef { ... }
fn specialize(
pipeline: &MaterialExtensionPipeline,
descriptor: &mut RenderPipelineDescriptor,
layout: &MeshVertexBufferLayout,
key: MaterialExtensionKey<Self>
) -> Result<(), SpecializedMeshPipelineError> { ... }
}
Expand description
A subset of the Material
trait for defining extensions to a base Material
, such as the builtin StandardMaterial
.
A user type implementing the trait should be used as the E
generic param in an ExtendedMaterial
struct.
Provided Methods§
sourcefn vertex_shader() -> ShaderRef
fn vertex_shader() -> ShaderRef
Returns this material’s vertex shader. If ShaderRef::Default
is returned, the base material mesh vertex shader
will be used.
sourcefn fragment_shader() -> ShaderRef
fn fragment_shader() -> ShaderRef
Returns this material’s fragment shader. If ShaderRef::Default
is returned, the base material mesh fragment shader
will be used.
sourcefn prepass_vertex_shader() -> ShaderRef
fn prepass_vertex_shader() -> ShaderRef
Returns this material’s prepass vertex shader. If ShaderRef::Default
is returned, the base material prepass vertex shader
will be used.
sourcefn prepass_fragment_shader() -> ShaderRef
fn prepass_fragment_shader() -> ShaderRef
Returns this material’s prepass fragment shader. If ShaderRef::Default
is returned, the base material prepass fragment shader
will be used.
sourcefn deferred_vertex_shader() -> ShaderRef
fn deferred_vertex_shader() -> ShaderRef
Returns this material’s deferred vertex shader. If ShaderRef::Default
is returned, the base material deferred vertex shader
will be used.
sourcefn deferred_fragment_shader() -> ShaderRef
fn deferred_fragment_shader() -> ShaderRef
Returns this material’s prepass fragment shader. If ShaderRef::Default
is returned, the base material deferred fragment shader
will be used.
sourcefn specialize(
pipeline: &MaterialExtensionPipeline,
descriptor: &mut RenderPipelineDescriptor,
layout: &MeshVertexBufferLayout,
key: MaterialExtensionKey<Self>
) -> Result<(), SpecializedMeshPipelineError>
fn specialize( pipeline: &MaterialExtensionPipeline, descriptor: &mut RenderPipelineDescriptor, layout: &MeshVertexBufferLayout, key: MaterialExtensionKey<Self> ) -> Result<(), SpecializedMeshPipelineError>
Customizes the default RenderPipelineDescriptor
for a specific entity using the entity’s
MaterialPipelineKey
and MeshVertexBufferLayout
as input.
Specialization for the base material is applied before this function is called.