Files
phy/bevy_render/render_graph/trait.Node.html
Orion Kindel 0ce894e6b0 doc
2025-03-18 10:30:23 -05:00

50 lines
19 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A render node that can be added to a `RenderGraph`."><title>Node in bevy_render::render_graph - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="bevy_render" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="icon" href="https://bevyengine.org/assets/icon.png"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../../bevy_render/index.html"><img src="https://bevyengine.org/assets/icon.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../bevy_render/index.html"><img src="https://bevyengine.org/assets/icon.png" alt="logo"></a><h2><a href="../../bevy_render/index.html">bevy_<wbr>render</a><span class="version">0.15.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Node</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.run" title="run">run</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.input" title="input">input</a></li><li><a href="#method.output" title="output">output</a></li><li><a href="#method.update" title="update">update</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.downcast" title="downcast">downcast</a></li><li><a href="#method.downcast_mut" title="downcast_mut">downcast_mut</a></li><li><a href="#method.downcast_rc" title="downcast_rc">downcast_rc</a></li><li><a href="#method.downcast_ref" title="downcast_ref">downcast_ref</a></li><li><a href="#method.is" title="is">is</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In bevy_<wbr>render::<wbr>render_<wbr>graph</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">bevy_render</a>::<wbr><a href="index.html">render_graph</a></span><h1>Trait <span class="trait">Node</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/bevy_render/render_graph/node.rs.html#72-97">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Node:
<a class="trait" href="../../downcast_rs/trait.Downcast.html" title="trait downcast_rs::Downcast">Downcast</a>
+ <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>
+ <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>
+ 'static {
// Required method
fn <a href="#tymethod.run" class="fn">run</a>&lt;'w&gt;(
&amp;self,
graph: &amp;mut <a class="struct" href="struct.RenderGraphContext.html" title="struct bevy_render::render_graph::RenderGraphContext">RenderGraphContext</a>&lt;'_&gt;,
render_context: &amp;mut <a class="struct" href="../renderer/struct.RenderContext.html" title="struct bevy_render::renderer::RenderContext">RenderContext</a>&lt;'w&gt;,
world: &amp;'w <a class="struct" href="../../bevy_ecs/world/struct.World.html" title="struct bevy_ecs::world::World">World</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.unit.html">()</a>, <a class="enum" href="enum.NodeRunError.html" title="enum bevy_render::render_graph::NodeRunError">NodeRunError</a>&gt;;
// Provided methods
fn <a href="#method.input" class="fn">input</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="struct.SlotInfo.html" title="struct bevy_render::render_graph::SlotInfo">SlotInfo</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.output" class="fn">output</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="struct.SlotInfo.html" title="struct bevy_render::render_graph::SlotInfo">SlotInfo</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.update" class="fn">update</a>(&amp;mut self, _world: &amp;mut <a class="struct" href="../../bevy_ecs/world/struct.World.html" title="struct bevy_ecs::world::World">World</a>) { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A render node that can be added to a <a href="struct.RenderGraph.html" title="struct bevy_render::render_graph::RenderGraph"><code>RenderGraph</code></a>.</p>
<p>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 <code>render_graph::add_node(my_node)</code> method.</p>
<p>To determine their position in the graph and ensure that all required dependencies (inputs)
are already executed, <a href="enum.Edge.html" title="enum bevy_render::render_graph::Edge"><code>Edges</code></a> are used.</p>
<p>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 <a href="enum.SlotType.html" title="enum bevy_render::render_graph::SlotType"><code>SlotType</code></a>.</p>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.run" class="method"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#91-96">Source</a><h4 class="code-header">fn <a href="#tymethod.run" class="fn">run</a>&lt;'w&gt;(
&amp;self,
graph: &amp;mut <a class="struct" href="struct.RenderGraphContext.html" title="struct bevy_render::render_graph::RenderGraphContext">RenderGraphContext</a>&lt;'_&gt;,
render_context: &amp;mut <a class="struct" href="../renderer/struct.RenderContext.html" title="struct bevy_render::renderer::RenderContext">RenderContext</a>&lt;'w&gt;,
world: &amp;'w <a class="struct" href="../../bevy_ecs/world/struct.World.html" title="struct bevy_ecs::world::World">World</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.unit.html">()</a>, <a class="enum" href="enum.NodeRunError.html" title="enum bevy_render::render_graph::NodeRunError">NodeRunError</a>&gt;</h4></section></summary><div class="docblock"><p>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 <a href="struct.RenderGraphContext.html" title="struct bevy_render::render_graph::RenderGraphContext"><code>RenderGraphContext</code></a>.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.input" class="method"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#75-77">Source</a><h4 class="code-header">fn <a href="#method.input" class="fn">input</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="struct.SlotInfo.html" title="struct bevy_render::render_graph::SlotInfo">SlotInfo</a>&gt;</h4></section></summary><div class="docblock"><p>Specifies the required input slots for this node.
They will then be available during the run method inside the <a href="struct.RenderGraphContext.html" title="struct bevy_render::render_graph::RenderGraphContext"><code>RenderGraphContext</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.output" class="method"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#81-83">Source</a><h4 class="code-header">fn <a href="#method.output" class="fn">output</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="struct.SlotInfo.html" title="struct bevy_render::render_graph::SlotInfo">SlotInfo</a>&gt;</h4></section></summary><div class="docblock"><p>Specifies the produced output slots for this node.
They can then be passed one inside <a href="struct.RenderGraphContext.html" title="struct bevy_render::render_graph::RenderGraphContext"><code>RenderGraphContext</code></a> during the run method.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.update" class="method"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#86">Source</a><h4 class="code-header">fn <a href="#method.update" class="fn">update</a>(&amp;mut self, _world: &amp;mut <a class="struct" href="../../bevy_ecs/world/struct.World.html" title="struct bevy_ecs::world::World">World</a>)</h4></section></summary><div class="docblock"><p>Updates internal node state using the current render <a href="../../bevy_ecs/world/struct.World.html" title="struct bevy_ecs::world::World"><code>World</code></a> prior to the run method.</p>
</div></details></div><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-dyn+Node" class="impl"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#99">Source</a><a href="#impl-dyn+Node" class="anchor">§</a><h3 class="code-header">impl dyn <a class="trait" href="trait.Node.html" title="trait bevy_render::render_graph::Node">Node</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.is" class="method"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#99">Source</a><h4 class="code-header">pub fn <a href="#method.is" class="fn">is</a>&lt;__T: <a class="trait" href="trait.Node.html" title="trait bevy_render::render_graph::Node">Node</a>&gt;(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns true if the trait object wraps an object of type <code>__T</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.downcast" class="method"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#99">Source</a><h4 class="code-header">pub fn <a href="#method.downcast" class="fn">downcast</a>&lt;__T: <a class="trait" href="trait.Node.html" title="trait bevy_render::render_graph::Node">Node</a>&gt;(self: <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;Self&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;__T&gt;, <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;Self&gt;&gt;</h4></section></summary><div class="docblock"><p>Returns a boxed object from a boxed trait object if the underlying object is of type
<code>__T</code>. Returns the original boxed trait if it isnt.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.downcast_rc" class="method"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#99">Source</a><h4 class="code-header">pub fn <a href="#method.downcast_rc" class="fn">downcast_rc</a>&lt;__T: <a class="trait" href="trait.Node.html" title="trait bevy_render::render_graph::Node">Node</a>&gt;(self: <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a>&lt;Self&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a>&lt;__T&gt;, <a class="struct" href="https://doc.rust-lang.org/1.84.0/alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a>&lt;Self&gt;&gt;</h4></section></summary><div class="docblock"><p>Returns an <code>Rc</code>-ed object from an <code>Rc</code>-ed trait object if the underlying object is of
type <code>__T</code>. Returns the original <code>Rc</code>-ed trait if it isnt.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.downcast_ref" class="method"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#99">Source</a><h4 class="code-header">pub fn <a href="#method.downcast_ref" class="fn">downcast_ref</a>&lt;__T: <a class="trait" href="trait.Node.html" title="trait bevy_render::render_graph::Node">Node</a>&gt;(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&amp;__T</a>&gt;</h4></section></summary><div class="docblock"><p>Returns a reference to the object within the trait object if it is of type <code>__T</code>, or
<code>None</code> if it isnt.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.downcast_mut" class="method"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#99">Source</a><h4 class="code-header">pub fn <a href="#method.downcast_mut" class="fn">downcast_mut</a>&lt;__T: <a class="trait" href="trait.Node.html" title="trait bevy_render::render_graph::Node">Node</a>&gt;(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.reference.html">&amp;mut __T</a>&gt;</h4></section></summary><div class="docblock"><p>Returns a mutable reference to the object within the trait object if it is of type
<code>__T</code>, or <code>None</code> if it isnt.</p>
</div></details></div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-Node-for-CameraDriverNode" class="impl"><a class="src rightside" href="../../src/bevy_render/camera/camera_driver_node.rs.html#23-97">Source</a><a href="#impl-Node-for-CameraDriverNode" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Node.html" title="trait bevy_render::render_graph::Node">Node</a> for <a class="struct" href="../camera/struct.CameraDriverNode.html" title="struct bevy_render::camera::CameraDriverNode">CameraDriverNode</a></h3></section><section id="impl-Node-for-EmptyNode" class="impl"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#311-320">Source</a><a href="#impl-Node-for-EmptyNode" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Node.html" title="trait bevy_render::render_graph::Node">Node</a> for <a class="struct" href="struct.EmptyNode.html" title="struct bevy_render::render_graph::EmptyNode">EmptyNode</a></h3></section><section id="impl-Node-for-GraphInputNode" class="impl"><a class="src rightside" href="../../src/bevy_render/render_graph/graph.rs.html#647-668">Source</a><a href="#impl-Node-for-GraphInputNode" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Node.html" title="trait bevy_render::render_graph::Node">Node</a> for <a class="struct" href="struct.GraphInputNode.html" title="struct bevy_render::render_graph::GraphInputNode">GraphInputNode</a></h3></section><section id="impl-Node-for-RunGraphOnViewNode" class="impl"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#336-346">Source</a><a href="#impl-Node-for-RunGraphOnViewNode" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Node.html" title="trait bevy_render::render_graph::Node">Node</a> for <a class="struct" href="struct.RunGraphOnViewNode.html" title="struct bevy_render::render_graph::RunGraphOnViewNode">RunGraphOnViewNode</a></h3></section><section id="impl-Node-for-ViewNodeRunner%3CT%3E" class="impl"><a class="src rightside" href="../../src/bevy_render/render_graph/node.rs.html#395-417">Source</a><a href="#impl-Node-for-ViewNodeRunner%3CT%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="trait.Node.html" title="trait bevy_render::render_graph::Node">Node</a> for <a class="struct" href="struct.ViewNodeRunner.html" title="struct bevy_render::render_graph::ViewNodeRunner">ViewNodeRunner</a>&lt;T&gt;<div class="where">where
T: <a class="trait" href="trait.ViewNode.html" title="trait bevy_render::render_graph::ViewNode">ViewNode</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static,</div></h3></section></div><script src="../../trait.impl/bevy_render/render_graph/node/trait.Node.js" async></script></section></div></main></body></html>