Change to use RenderLayers if OutlineRenderLayers not present.
This commit is contained in:
parent
a50107426b
commit
2d900248f0
10
src/draw.rs
10
src/draw.rs
|
@ -36,7 +36,7 @@ pub(crate) fn queue_outline_stencil_mesh(
|
||||||
&Handle<Mesh>,
|
&Handle<Mesh>,
|
||||||
&OutlineStencilUniform,
|
&OutlineStencilUniform,
|
||||||
&OutlineStencilFlags,
|
&OutlineStencilFlags,
|
||||||
Option<&OutlineRenderLayers>,
|
&OutlineRenderLayers,
|
||||||
)>,
|
)>,
|
||||||
mut views: Query<(
|
mut views: Query<(
|
||||||
&ExtractedView,
|
&ExtractedView,
|
||||||
|
@ -59,8 +59,7 @@ pub(crate) fn queue_outline_stencil_mesh(
|
||||||
for (entity, mesh_handle, stencil_uniform, stencil_flags, outline_mask) in
|
for (entity, mesh_handle, stencil_uniform, stencil_flags, outline_mask) in
|
||||||
material_meshes.iter()
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
if let Some(mesh) = render_meshes.get(mesh_handle) {
|
if let Some(mesh) = render_meshes.get(mesh_handle) {
|
||||||
|
@ -108,7 +107,7 @@ pub(crate) fn queue_outline_volume_mesh(
|
||||||
&OutlineVolumeUniform,
|
&OutlineVolumeUniform,
|
||||||
&OutlineVolumeFlags,
|
&OutlineVolumeFlags,
|
||||||
&OutlineFragmentUniform,
|
&OutlineFragmentUniform,
|
||||||
Option<&OutlineRenderLayers>,
|
&OutlineRenderLayers,
|
||||||
)>,
|
)>,
|
||||||
mut views: Query<(
|
mut views: Query<(
|
||||||
&ExtractedView,
|
&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
|
for (entity, mesh_handle, volume_uniform, volume_flags, fragment_uniform, outline_mask) in
|
||||||
material_meshes.iter()
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
if let Some(mesh) = render_meshes.get(mesh_handle) {
|
if let Some(mesh) = render_meshes.get(mesh_handle) {
|
||||||
|
|
16
src/lib.rs
16
src/lib.rs
|
@ -138,11 +138,19 @@ impl Lerp for OutlineVolume {
|
||||||
pub struct OutlineRenderLayers(pub RenderLayers);
|
pub struct OutlineRenderLayers(pub RenderLayers);
|
||||||
|
|
||||||
impl ExtractComponent for OutlineRenderLayers {
|
impl ExtractComponent for OutlineRenderLayers {
|
||||||
type Query = &'static OutlineRenderLayers;
|
type Query = (
|
||||||
type Filter = ();
|
Option<&'static OutlineRenderLayers>,
|
||||||
|
Option<&'static RenderLayers>,
|
||||||
|
);
|
||||||
|
type Filter = Or<(With<OutlineVolume>, With<OutlineStencil>)>;
|
||||||
|
|
||||||
fn extract_component(item: &OutlineRenderLayers) -> Self {
|
fn extract_component(
|
||||||
*item
|
(outline_mask, object_mask): (Option<&OutlineRenderLayers>, Option<&RenderLayers>),
|
||||||
|
) -> Self {
|
||||||
|
outline_mask
|
||||||
|
.copied()
|
||||||
|
.or_else(|| object_mask.copied().map(OutlineRenderLayers))
|
||||||
|
.unwrap_or_default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue