Trait bevy::pbr::MaterialExtension

pub trait MaterialExtension: Sized + Asset + AsBindGroup + Clone {
    // 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 meshlet_mesh_fragment_shader() -> ShaderRef { ... }
    fn meshlet_mesh_prepass_fragment_shader() -> ShaderRef { ... }
    fn meshlet_mesh_deferred_fragment_shader() -> ShaderRef { ... }
    fn specialize(
        pipeline: &MaterialExtensionPipeline,
        descriptor: &mut RenderPipelineDescriptor,
        layout: &MeshVertexBufferLayoutRef,
        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§

fn vertex_shader() -> ShaderRef

Returns this material’s vertex shader. If ShaderRef::Default is returned, the base material mesh vertex shader will be used.

fn fragment_shader() -> ShaderRef

Returns this material’s fragment shader. If ShaderRef::Default is returned, the base material mesh fragment shader will be used.

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.

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.

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.

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.

fn meshlet_mesh_fragment_shader() -> ShaderRef

Available on crate feature meshlet only.

Returns this material’s crate::meshlet::MeshletMesh fragment shader. If ShaderRef::Default is returned, the default meshlet mesh fragment shader will be used.

fn meshlet_mesh_prepass_fragment_shader() -> ShaderRef

Available on crate feature meshlet only.

Returns this material’s crate::meshlet::MeshletMesh prepass fragment shader. If ShaderRef::Default is returned, the default meshlet mesh prepass fragment shader will be used.

fn meshlet_mesh_deferred_fragment_shader() -> ShaderRef

Available on crate feature meshlet only.

Returns this material’s crate::meshlet::MeshletMesh deferred fragment shader. If ShaderRef::Default is returned, the default meshlet mesh deferred fragment shader will be used.

fn specialize( pipeline: &MaterialExtensionPipeline, descriptor: &mut RenderPipelineDescriptor, layout: &MeshVertexBufferLayoutRef, key: MaterialExtensionKey<Self>, ) -> Result<(), SpecializedMeshPipelineError>

Customizes the default RenderPipelineDescriptor for a specific entity using the entity’s MaterialPipelineKey and MeshVertexBufferLayoutRef as input. Specialization for the base material is applied before this function is called.

Object Safety§

This trait is not object safe.

Implementors§