Add OutlineBundle.
This commit is contained in:
parent
75dcc9077c
commit
ce228d1c2d
@ -46,12 +46,14 @@ fn setup(
|
||||
transform: Transform::from_xyz(0.0, 1.0, 0.0),
|
||||
..default()
|
||||
})
|
||||
.insert(Outline {
|
||||
visible: true,
|
||||
colour: Color::rgba(0.0, 1.0, 0.0, 1.0),
|
||||
width: 25.0,
|
||||
.insert_bundle(OutlineBundle {
|
||||
outline: Outline {
|
||||
visible: true,
|
||||
colour: Color::rgba(0.0, 1.0, 0.0, 1.0),
|
||||
width: 25.0,
|
||||
},
|
||||
..default()
|
||||
})
|
||||
.insert(OutlineStencil)
|
||||
.insert(Wobbles);
|
||||
|
||||
commands
|
||||
@ -67,12 +69,14 @@ fn setup(
|
||||
.with_rotation(Quat::from_rotation_x(0.5 * PI)),
|
||||
..default()
|
||||
})
|
||||
.insert(Outline {
|
||||
visible: true,
|
||||
colour: Color::rgba(1.0, 0.0, 1.0, 0.3),
|
||||
width: 15.0,
|
||||
.insert_bundle(OutlineBundle {
|
||||
outline: Outline {
|
||||
visible: true,
|
||||
colour: Color::rgba(1.0, 0.0, 1.0, 0.3),
|
||||
width: 15.0,
|
||||
},
|
||||
..default()
|
||||
})
|
||||
.insert(OutlineStencil)
|
||||
.insert(Orbits);
|
||||
commands.spawn_bundle(PointLightBundle {
|
||||
point_light: PointLight {
|
||||
|
11
src/lib.rs
11
src/lib.rs
@ -40,7 +40,7 @@ pub const ATTRIBUTE_OUTLINE_NORMAL: MeshVertexAttribute = MeshVertexAttribute::n
|
||||
);
|
||||
|
||||
/// A component for stenciling meshes during outline rendering.
|
||||
#[derive(Component, Default)]
|
||||
#[derive(Clone, Component, Default)]
|
||||
pub struct OutlineStencil;
|
||||
|
||||
impl ExtractComponent for OutlineStencil {
|
||||
@ -53,7 +53,7 @@ impl ExtractComponent for OutlineStencil {
|
||||
}
|
||||
|
||||
/// A component for rendering outlines around meshes.
|
||||
#[derive(Clone, Component)]
|
||||
#[derive(Clone, Component, Default)]
|
||||
pub struct Outline {
|
||||
/// Enable rendering of the outline
|
||||
pub visible: bool,
|
||||
@ -63,6 +63,13 @@ pub struct Outline {
|
||||
pub colour: Color,
|
||||
}
|
||||
|
||||
/// A bundle for rendering stenciled outlines around meshes.
|
||||
#[derive(Bundle, Clone, Component, Default)]
|
||||
pub struct OutlineBundle {
|
||||
pub outline: Outline,
|
||||
pub stencil: OutlineStencil,
|
||||
}
|
||||
|
||||
/// Failed to generate outline normals for the mesh.
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum GenerateOutlineNormalsError {
|
||||
|
Loading…
Reference in New Issue
Block a user