From 1609736ba25eb6f16cedde2d6393c1a1d27021e3 Mon Sep 17 00:00:00 2001 From: Robin KAY Date: Wed, 10 Aug 2022 21:16:26 +0100 Subject: [PATCH] Add constant to expose outline pass node name. --- src/lib.rs | 17 +++++++++++++---- src/node.rs | 1 - 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1ac7955..6913044 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -54,6 +54,12 @@ pub const ATTRIBUTE_OUTLINE_NORMAL: MeshVertexAttribute = MeshVertexAttribute::n VertexFormat::Float32x3, ); +/// Name of the render graph node which draws the outlines. +/// +/// This node runs after the main 3D passes and before the UI pass. The name can be used to +/// add additional constrants on node execution order with respect to other passes. +pub const OUTLINE_PASS_NODE_NAME: &str = "bevy_mod_outline_node"; + /// A component for stenciling meshes during outline rendering. #[derive(Clone, Component, Default)] pub struct OutlineStencil; @@ -213,12 +219,12 @@ impl Plugin for OutlinePlugin { let draw_3d_graph = graph .get_sub_graph_mut(bevy::core_pipeline::core_3d::graph::NAME) .unwrap(); - draw_3d_graph.add_node(OutlineNode::NAME, node); + draw_3d_graph.add_node(OUTLINE_PASS_NODE_NAME, node); draw_3d_graph .add_slot_edge( draw_3d_graph.input_node().unwrap().id, bevy::core_pipeline::core_3d::graph::input::VIEW_ENTITY, - OutlineNode::NAME, + OUTLINE_PASS_NODE_NAME, OutlineNode::IN_VIEW, ) .unwrap(); @@ -227,11 +233,14 @@ impl Plugin for OutlinePlugin { draw_3d_graph .add_node_edge( bevy::core_pipeline::core_3d::graph::node::MAIN_PASS, - OutlineNode::NAME, + OUTLINE_PASS_NODE_NAME, ) .unwrap(); draw_3d_graph - .add_node_edge(OutlineNode::NAME, bevy::ui::draw_ui_graph::node::UI_PASS) + .add_node_edge( + OUTLINE_PASS_NODE_NAME, + bevy::ui::draw_ui_graph::node::UI_PASS, + ) .unwrap(); } } diff --git a/src/node.rs b/src/node.rs index ade7269..f3faaf2 100644 --- a/src/node.rs +++ b/src/node.rs @@ -135,7 +135,6 @@ pub struct OutlineNode { } impl OutlineNode { - pub const NAME: &'static str = "outline_node"; pub const IN_VIEW: &'static str = "view"; pub fn new(world: &mut World) -> Self {