Change to use RenderLayers if OutlineRenderLayers not present.

This commit is contained in:
Robin KAY 2023-01-14 23:51:44 +00:00
parent a50107426b
commit 2d900248f0
2 changed files with 16 additions and 10 deletions

View File

@ -36,7 +36,7 @@ pub(crate) fn queue_outline_stencil_mesh(
&Handle<Mesh>,
&OutlineStencilUniform,
&OutlineStencilFlags,
Option<&OutlineRenderLayers>,
&OutlineRenderLayers,
)>,
mut views: Query<(
&ExtractedView,
@ -59,8 +59,7 @@ pub(crate) fn queue_outline_stencil_mesh(
for (entity, mesh_handle, stencil_uniform, stencil_flags, outline_mask) in
material_meshes.iter()
{
let outline_mask = outline_mask.copied().unwrap_or_default();
if !view_mask.intersects(&outline_mask) {
if !view_mask.intersects(outline_mask) {
continue;
}
if let Some(mesh) = render_meshes.get(mesh_handle) {
@ -108,7 +107,7 @@ pub(crate) fn queue_outline_volume_mesh(
&OutlineVolumeUniform,
&OutlineVolumeFlags,
&OutlineFragmentUniform,
Option<&OutlineRenderLayers>,
&OutlineRenderLayers,
)>,
mut views: Query<(
&ExtractedView,
@ -134,8 +133,7 @@ pub(crate) fn queue_outline_volume_mesh(
for (entity, mesh_handle, volume_uniform, volume_flags, fragment_uniform, outline_mask) in
material_meshes.iter()
{
let outline_mask = outline_mask.copied().unwrap_or_default();
if !view_mask.intersects(&outline_mask) {
if !view_mask.intersects(outline_mask) {
continue;
}
if let Some(mesh) = render_meshes.get(mesh_handle) {

View File

@ -138,11 +138,19 @@ impl Lerp for OutlineVolume {
pub struct OutlineRenderLayers(pub RenderLayers);
impl ExtractComponent for OutlineRenderLayers {
type Query = &'static OutlineRenderLayers;
type Filter = ();
type Query = (
Option<&'static OutlineRenderLayers>,
Option<&'static RenderLayers>,
);
type Filter = Or<(With<OutlineVolume>, With<OutlineStencil>)>;
fn extract_component(item: &OutlineRenderLayers) -> Self {
*item
fn extract_component(
(outline_mask, object_mask): (Option<&OutlineRenderLayers>, Option<&RenderLayers>),
) -> Self {
outline_mask
.copied()
.or_else(|| object_mask.copied().map(OutlineRenderLayers))
.unwrap_or_default()
}
}