namespace Sandbox;
///
/// This component should be added to stuff you want to be outlined. You will also need to
/// add the Highlight component to the camera you want to render the outlines.
///
[Title( "Highlight Outline" )]
[Category( "Rendering" )]
[Icon( "lightbulb_outline" )]
public class HighlightOutline : Component
{
///
/// If defined, the glow will use this material rather than a generated one.
///
[Property] public Material Material { get; set; }
///
/// The colour of the glow outline
///
[Property] public Color Color { get; set; } = Color.White;
///
/// The colour of the glow when the mesh is obscured by something closer.
///
[Property] public Color ObscuredColor { get; set; } = Color.Black * 0.4f;
///
/// Color of the inside of the glow
///
[Property] public Color InsideColor { get; set; } = Color.Transparent;
///
/// Color of the inside of the glow when the mesh is obscured by something closer.
///
[Property] public Color InsideObscuredColor { get; set; } = Color.Transparent;
///
/// The width of the line of the glow
///
[Property] public float Width { get; set; } = 0.25f;
///
/// Specify targets of the outline manually
///
[Property, FeatureEnabled( "Manual Targets" )] public bool OverrideTargets { get; set; } = false;
///
/// Specify targets of the outline manually
///
[Property, Feature( "Manual Targets" )] public List Targets { get; set; }
///
/// Get a list of targets that we want to draw the outline around
///
public IEnumerable GetOutlineTargets()
{
if ( OverrideTargets )
{
return Targets ?? Enumerable.Empty();
}
return Components.GetAll( FindMode.EnabledInSelfAndDescendants );
}
}