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>(&self) -> bool
where __T: Node,

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

source

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

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>(self: Rc<dyn Node>) -> Result<Rc<__T>, Rc<dyn Node>>
where __T: Node,

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>(&self) -> Option<&__T>
where __T: Node,

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>(&mut self) -> Option<&mut __T>
where __T: Node,

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

Implementors§