Rename Outline component to OutlineVolume.

This commit is contained in:
Robin KAY 2022-11-22 19:11:36 +00:00
parent 5ae478efe1
commit 4a292ca6bc
5 changed files with 13 additions and 11 deletions

View File

@ -1,7 +1,9 @@
use std::f32::consts::PI;
use bevy::{prelude::*, window::close_on_esc};
use bevy_mod_outline::{AutoGenerateOutlineNormalsPlugin, Outline, OutlineBundle, OutlinePlugin};
use bevy_mod_outline::{
AutoGenerateOutlineNormalsPlugin, OutlineBundle, OutlinePlugin, OutlineVolume,
};
#[derive(Resource)]
struct Fox(Handle<AnimationClip>);
@ -74,7 +76,7 @@ fn setup_scene_once_loaded(
player.play(animation.0.clone_weak()).repeat();
for entity in entities.iter() {
commands.entity(entity).insert(OutlineBundle {
outline: Outline {
outline: OutlineVolume {
visible: true,
width: 3.0,
colour: Color::RED,

View File

@ -48,7 +48,7 @@ fn setup(
..default()
})
.insert(OutlineBundle {
outline: Outline {
outline: OutlineVolume {
visible: true,
colour: Color::WHITE,
width: 10.0,
@ -77,7 +77,7 @@ fn setup(
..default()
})
.insert(OutlineBundle {
outline: Outline {
outline: OutlineVolume {
visible: true,
colour: Color::WHITE,
width: 10.0,
@ -103,7 +103,7 @@ fn setup(
..default()
})
.insert(OutlineBundle {
outline: Outline {
outline: OutlineVolume {
visible: true,
colour: Color::WHITE,
width: 10.0,

View File

@ -46,7 +46,7 @@ fn setup(
..default()
})
.insert(OutlineBundle {
outline: Outline {
outline: OutlineVolume {
visible: true,
colour: Color::rgba(0.0, 1.0, 0.0, 1.0),
width: 25.0,
@ -70,7 +70,7 @@ fn setup(
..default()
})
.insert(OutlineBundle {
outline: Outline {
outline: OutlineVolume {
visible: true,
colour: Color::rgba(1.0, 0.0, 1.0, 0.3),
width: 15.0,

View File

@ -83,7 +83,7 @@ impl ExtractComponent for OutlineStencil {
/// A component for rendering outlines around meshes.
#[derive(Clone, Component, Default)]
pub struct Outline {
pub struct OutlineVolume {
/// Enable rendering of the outline
pub visible: bool,
/// Width of the outline in logical pixels
@ -95,7 +95,7 @@ pub struct Outline {
/// A bundle for rendering stenciled outlines around meshes.
#[derive(Bundle, Clone, Default)]
pub struct OutlineBundle {
pub outline: Outline,
pub outline: OutlineVolume,
pub stencil: OutlineStencil,
pub plane: ComputedOutlineDepth,
}

View File

@ -13,7 +13,7 @@ use bevy::{
},
};
use crate::{pipeline::OutlinePipeline, ComputedOutlineDepth, Outline, OutlineStencil};
use crate::{pipeline::OutlinePipeline, ComputedOutlineDepth, OutlineStencil, OutlineVolume};
macro_rules! outline_vertex_uniform {
($x:ident) => {
@ -59,7 +59,7 @@ pub fn extract_outline_stencil_uniforms(
pub fn extract_outline_volume_uniforms(
mut commands: Commands,
query: Extract<Query<(Entity, &Outline, &ComputedOutlineDepth)>>,
query: Extract<Query<(Entity, &OutlineVolume, &ComputedOutlineDepth)>>,
) {
for (entity, outline, computed) in query.iter() {
if !outline.visible || outline.colour.a() == 0.0 {