From 55dd3a07a8468bfb3e49309ce1a6ef0e3d507bc2 Mon Sep 17 00:00:00 2001 From: Robin KAY Date: Thu, 17 Nov 2022 22:15:13 +0000 Subject: [PATCH] Rename OutlinePlane to OutlineDepth. --- examples/pieces.rs | 4 ++-- src/computed.rs | 26 +++++++++++++------------- src/lib.rs | 6 +++--- src/uniforms.rs | 6 +++--- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/examples/pieces.rs b/examples/pieces.rs index 0f63213..ebeca88 100644 --- a/examples/pieces.rs +++ b/examples/pieces.rs @@ -83,7 +83,7 @@ fn setup( }, ..default() }) - .insert(InheritOutlinePlane); + .insert(InheritOutlineDepth); parent .spawn_bundle(PbrBundle { mesh: meshes.add( @@ -108,7 +108,7 @@ fn setup( }, ..default() }) - .insert(InheritOutlinePlane); + .insert(InheritOutlineDepth); }); // Add plane, light source, and camera diff --git a/src/computed.rs b/src/computed.rs index 94a8621..f47b0da 100644 --- a/src/computed.rs +++ b/src/computed.rs @@ -1,27 +1,27 @@ use bevy::prelude::*; -/// A component for storing the computed plane on which the outline lies. +/// A component for storing the computed depth at which the outline lies. #[derive(Clone, Component, Default)] -pub struct ComputedOutlinePlane { +pub struct ComputedOutlineDepth { pub(crate) plane: Vec3, } -/// A component which specifies that this entity lies on the same plane as its parent. +/// A component which specifies that this entity lies at the same depth as its parent. #[derive(Clone, Component, Default)] -pub struct InheritOutlinePlane; +pub struct InheritOutlineDepth; #[allow(clippy::type_complexity)] -pub(crate) fn compute_outline_plane( +pub(crate) fn compute_outline_depth( mut root_query: Query< ( - &mut ComputedOutlinePlane, + &mut ComputedOutlineDepth, &GlobalTransform, Changed, Option<(&Children, Changed)>, ), - Without, + Without, >, - mut computed_query: Query<(&mut ComputedOutlinePlane, Changed)>, + mut computed_query: Query<(&mut ComputedOutlineDepth, Changed)>, child_query: Query<(&Children, Changed)>, ) { for (mut computed, transform, changed_transform, children) in root_query.iter_mut() { @@ -32,7 +32,7 @@ pub(crate) fn compute_outline_plane( if let Some((cs, changed_children)) = children { let changed2 = changed_children || changed_transform; for child in cs.iter() { - propagate_outline_planes( + propagate_outline_depth( &computed, changed2, *child, @@ -44,11 +44,11 @@ pub(crate) fn compute_outline_plane( } } -fn propagate_outline_planes( - root_computed: &ComputedOutlinePlane, +fn propagate_outline_depth( + root_computed: &ComputedOutlineDepth, changed: bool, entity: Entity, - computed_query: &mut Query<(&mut ComputedOutlinePlane, Changed)>, + computed_query: &mut Query<(&mut ComputedOutlineDepth, Changed)>, child_query: &Query<(&Children, Changed)>, ) { if let Ok((mut computed, changed_inherit)) = computed_query.get_mut(entity) { @@ -58,7 +58,7 @@ fn propagate_outline_planes( if let Ok((cs, changed_children)) = child_query.get(entity) { let changed2 = changed_children || changed_inherit || changed; for child in cs.iter() { - propagate_outline_planes( + propagate_outline_depth( root_computed, changed2, *child, diff --git a/src/lib.rs b/src/lib.rs index 56b7b51..0355c6b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -94,14 +94,14 @@ pub struct Outline { pub struct OutlineBundle { pub outline: Outline, pub stencil: OutlineStencil, - pub plane: ComputedOutlinePlane, + pub plane: ComputedOutlineDepth, } /// A bundle for stenciling meshes in the outlining pass. #[derive(Bundle, Clone, Default)] pub struct OutlineStencilBundle { pub stencil: OutlineStencil, - pub plane: ComputedOutlinePlane, + pub plane: ComputedOutlineDepth, } /// Adds support for rendering outlines. @@ -130,7 +130,7 @@ impl Plugin for OutlinePlugin { .add_plugin(UniformComponentPlugin::::default()) .add_system_to_stage( CoreStage::PostUpdate, - compute_outline_plane.after(TransformSystem::TransformPropagate), + compute_outline_depth.after(TransformSystem::TransformPropagate), ) .sub_app_mut(RenderApp) .init_resource::>() diff --git a/src/uniforms.rs b/src/uniforms.rs index 41639cf..bf57a1b 100644 --- a/src/uniforms.rs +++ b/src/uniforms.rs @@ -13,7 +13,7 @@ use bevy::{ }, }; -use crate::{pipeline::OutlinePipeline, ComputedOutlinePlane, Outline, OutlineStencil}; +use crate::{pipeline::OutlinePipeline, ComputedOutlineDepth, Outline, OutlineStencil}; #[derive(Clone, Component, ShaderType)] pub struct OutlineStencilUniform { @@ -44,7 +44,7 @@ pub struct OutlineBindGroup { pub fn extract_outline_stencil_uniforms( mut commands: Commands, - query: Extract>>, + query: Extract>>, ) { for (entity, computed) in query.iter() { commands.get_or_spawn(entity).insert(OutlineStencilUniform { @@ -55,7 +55,7 @@ pub fn extract_outline_stencil_uniforms( pub fn extract_outline_uniforms( mut commands: Commands, - query: Extract>, + query: Extract>, ) { for (entity, outline, computed) in query.iter() { if !outline.visible || outline.colour.a() == 0.0 {