FullscreenMaterial

Trait FullscreenMaterial 

Source
pub trait FullscreenMaterial:
    Component
    + ExtractComponent
    + Clone
    + Copy
    + ShaderType
    + WriteInto
    + Default {
    // Required methods
    fn fragment_shader() -> ShaderRef;
    fn node_edges() -> Vec<InternedRenderLabel> ;

    // Provided methods
    fn sub_graph() -> Option<InternedRenderSubGraph> { ... }
    fn node_label() -> impl RenderLabel { ... }
}
Expand description

A trait to define a material that will render to the entire screen using a fullscrene triangle

Required Methods§

Source

fn fragment_shader() -> ShaderRef

The shader that will run on the entire screen using a fullscreen triangle

Source

fn node_edges() -> Vec<InternedRenderLabel>

The list of node_edges. In 3d, for a post processing effect, it would look like this:

vec![
    Node3d::Tonemapping.intern(),
    // Self::sub_graph().intern(), // <--- your own label here
    Node3d::EndMainPassPostProcessing.intern(),
]

This tell the render graph to run your fullscreen effect after the tonemapping pass but before the end of post processing. For 2d, it would be the same but using Node2d. You can specify any edges you want but make sure to include your own label.

Provided Methods§

Source

fn sub_graph() -> Option<InternedRenderSubGraph>

The bevy_render::render_graph::RenderSubGraph the effect will run in

For 2d this is generally crate::core_2d::graph::Core2d and for 3d it’s crate::core_3d::graph::Core3d

Source

fn node_label() -> impl RenderLabel

The label used to represent the render node that will run the pass

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§