Improve documentation slightly.

This commit is contained in:
Robin KAY 2022-06-13 23:23:35 +01:00
parent 95d093220e
commit e13eef50cb
2 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,7 @@
# bevy_mod_outline # bevy_mod_outline
This crate provides a plugin for drawing outlines around meshes. This crate provides a Bevy plugin for drawing outlines around meshes using the
vertex extrusion method.
## Dependency ## Dependency
@ -22,3 +23,8 @@ cargo run --example cube
| This Version | Bevy version | | This Version | Bevy version |
|--------------|--------------| |--------------|--------------|
| 0.1.x | 0.7.x | | 0.1.x | 0.7.x |
## Known Issues
Vertex extrusion only works for meshes with smooth surface normals. Hard edges
will cause visual artefacts.

View File

@ -26,13 +26,18 @@ use bevy::render::view::ExtractedView;
use bevy::render::{RenderApp, RenderStage}; use bevy::render::{RenderApp, RenderStage};
use libm::nextafterf; use libm::nextafterf;
// See https://alexanderameye.github.io/notes/rendering-outlines/
const OUTLINE_SHADER_HANDLE: HandleUntyped = const OUTLINE_SHADER_HANDLE: HandleUntyped =
HandleUntyped::weak_from_u64(Shader::TYPE_UUID, 2101625026478770097); HandleUntyped::weak_from_u64(Shader::TYPE_UUID, 2101625026478770097);
/// An asset for rendering outlines around meshes.
#[derive(Clone, TypeUuid)] #[derive(Clone, TypeUuid)]
#[uuid = "552e416b-2766-4e6a-9ee5-9ebd0e8c0230"] #[uuid = "552e416b-2766-4e6a-9ee5-9ebd0e8c0230"]
pub struct Outline { pub struct Outline {
/// Colour of the outline
pub colour: Color, pub colour: Color,
/// Width of the outline in pixels
pub width: f32, pub width: f32,
} }
@ -109,6 +114,7 @@ pub struct GpuOutline {
transparent: bool, transparent: bool,
} }
/// Adds support for the [Outline] asset type.
pub struct OutlinePlugin; pub struct OutlinePlugin;
impl Plugin for OutlinePlugin { impl Plugin for OutlinePlugin {