bevy_render::render_graph

Trait Node

Source
pub trait Node:
    Downcast
    + Send
    + Sync
    + 'static {
    // Required method
    fn run<'w>(
        &self,
        graph: &mut RenderGraphContext<'_>,
        render_context: &mut RenderContext<'w>,
        world: &'w World,
    ) -> Result<(), NodeRunError>;

    // Provided methods
    fn input(&self) -> Vec<SlotInfo> { ... }
    fn output(&self) -> Vec<SlotInfo> { ... }
    fn update(&mut self, _world: &mut World) { ... }
}
Expand description

A render node that can be added to a RenderGraph.

Nodes are the fundamental part of the graph and used to extend its functionality, by generating draw calls and/or running subgraphs. They are added via the render_graph::add_node(my_node) method.

To determine their position in the graph and ensure that all required dependencies (inputs) are already executed, Edges are used.

A node can produce outputs used as dependencies by other nodes. Those inputs and outputs are called slots and are the default way of passing render data inside the graph. For more information see SlotType.

Required Methods§

Source

fn run<'w>( &self, graph: &mut RenderGraphContext<'_>, render_context: &mut RenderContext<'w>, world: &'w World, ) -> Result<(), NodeRunError>

Runs the graph node logic, issues draw calls, updates the output slots and optionally queues up subgraphs for execution. The graph data, input and output values are passed via the RenderGraphContext.

Provided Methods§

Source

fn input(&self) -> Vec<SlotInfo>

Specifies the required input slots for this node. They will then be available during the run method inside the RenderGraphContext.

Source

fn output(&self) -> Vec<SlotInfo>

Specifies the produced output slots for this node. They can then be passed one inside RenderGraphContext during the run method.

Source

fn update(&mut self, _world: &mut World)

Updates internal node state using the current render World prior to the run method.

Implementations§

Source§

impl dyn Node

Source

pub fn is<__T: Node>(&self) -> bool

Returns true if the trait object wraps an object of type __T.

Source

pub fn downcast<__T: Node>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

Source

pub fn downcast_rc<__T: Node>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

Source

pub fn downcast_ref<__T: Node>(&self) -> Option<&__T>

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

Source

pub fn downcast_mut<__T: Node>(&mut self) -> Option<&mut __T>

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

Implementors§