@@ -3,8 +3,8 @@ use bevy::{camera::visibility::RenderLayers, ecs::query::QueryItem, prelude::*};
33use crate :: {
44 pipeline_key:: ComputedOutlineKey ,
55 uniforms:: { DepthMode , DrawMode } ,
6- InheritOutline , OutlineAlphaMask , OutlineMode , OutlinePlaneDepth , OutlineRenderLayers ,
7- OutlineStencil , OutlineStencilEnabled , OutlineVolume , OutlineWarmUp ,
6+ InheritOutline , OutlineAlphaMask , OutlineFace , OutlineMode , OutlinePlaneDepth ,
7+ OutlineRenderLayers , OutlineStencil , OutlineStencilEnabled , OutlineVolume , OutlineWarmUp ,
88} ;
99
1010#[ derive( Clone ) ]
@@ -24,6 +24,10 @@ pub(crate) struct ComputedStencil {
2424pub ( crate ) struct ComputedMode {
2525 pub ( crate ) depth_mode : DepthMode ,
2626 pub ( crate ) draw_mode : DrawMode ,
27+ }
28+
29+ #[ derive( Clone ) ]
30+ pub ( crate ) struct ComputedFace {
2731 pub ( crate ) double_sided : bool ,
2832}
2933
@@ -124,6 +128,7 @@ pub(crate) struct ComputedInternal {
124128 pub ( crate ) volume : Sourced < ComputedVolume > ,
125129 pub ( crate ) stencil : Sourced < ComputedStencil > ,
126130 pub ( crate ) mode : Sourced < ComputedMode > ,
131+ pub ( crate ) face : Sourced < ComputedFace > ,
127132 pub ( crate ) depth : Sourced < ComputedDepth > ,
128133 pub ( crate ) layers : Sourced < RenderLayers > ,
129134 pub ( crate ) alpha_mask : Sourced < OutlineAlphaMask > ,
@@ -141,6 +146,7 @@ type OutlineComponents<'a> = (
141146 Option < Ref < ' a , OutlineVolume > > ,
142147 Option < Ref < ' a , OutlineStencil > > ,
143148 Option < Ref < ' a , OutlineMode > > ,
149+ Option < Ref < ' a , OutlineFace > > ,
144150 Option < Ref < ' a , OutlinePlaneDepth > > ,
145151 Option < Ref < ' a , OutlineRenderLayers > > ,
146152 Option < Ref < ' a , RenderLayers > > ,
@@ -220,6 +226,7 @@ fn update_computed_outline(
220226 volume,
221227 stencil,
222228 mode,
229+ face,
223230 depth,
224231 layers,
225232 fallback_layers,
@@ -239,6 +246,7 @@ fn update_computed_outline(
239246 || computed. volume . is_changed ( & volume, has_parent)
240247 || computed. stencil . is_changed ( & stencil, has_parent)
241248 || computed. mode . is_changed ( & mode, has_parent)
249+ || computed. face . is_changed ( & face, has_parent)
242250 || computed. depth . is_changed ( & depth, has_parent)
243251 || computed
244252 . layers
@@ -279,32 +287,25 @@ fn update_computed_outline(
279287 OutlineMode :: ExtrudeFlat => ComputedMode {
280288 depth_mode : DepthMode :: Flat ,
281289 draw_mode : DrawMode :: Extrude ,
282- double_sided : false ,
283- } ,
284- OutlineMode :: ExtrudeFlatDoubleSided => ComputedMode {
285- depth_mode : DepthMode :: Flat ,
286- draw_mode : DrawMode :: Extrude ,
287- double_sided : true ,
288290 } ,
289291 OutlineMode :: ExtrudeReal => ComputedMode {
290292 depth_mode : DepthMode :: Real ,
291293 draw_mode : DrawMode :: Extrude ,
292- double_sided : false ,
293294 } ,
294295 #[ cfg( feature = "flood" ) ]
295296 OutlineMode :: FloodFlat => ComputedMode {
296297 depth_mode : DepthMode :: Flat ,
297298 draw_mode : DrawMode :: JumpFlood ,
298- double_sided : false ,
299- } ,
300- #[ cfg( feature = "flood" ) ]
301- OutlineMode :: FloodFlatDoubleSided => ComputedMode {
302- depth_mode : DepthMode :: Flat ,
303- draw_mode : DrawMode :: JumpFlood ,
304- double_sided : true ,
305299 } ,
306300 } ,
307301 ) ,
302+ face : Sourced :: set (
303+ face,
304+ parent_computed. map ( |p| p. face . value . clone ( ) ) ,
305+ |face| ComputedFace {
306+ double_sided : matches ! ( face, OutlineFace :: DoubleSided ) ,
307+ } ,
308+ ) ,
308309 depth : Sourced :: set (
309310 depth,
310311 parent_computed. map ( |p| p. depth . value . clone ( ) ) ,
0 commit comments