Files
sbox-public/game/addons/tools/Code/Curves/Graphics/RangePolygon.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

33 lines
710 B
C#

namespace Editor.GraphicsItems;
public partial class RangePolygon : GraphicsItem
{
public EditableCurve CurveA { get; set; }
public EditableCurve CurveB { get; set; }
public RangePolygon( EditableCurve a, EditableCurve b ) : base( null )
{
CurveA = a;
CurveB = b;
}
protected override void OnPaint()
{
Paint.SetBrushAndPen( CurveA.CurveColor.WithAlpha( 0.2f ) );
CurveRange cr = new( CurveA.GetViewportAdjustedCurve(), CurveB.GetViewportAdjustedCurve() );
cr.DrawArea( LocalRect, 3.0f );
Paint.SetPen( CurveA.CurveColor.WithAlpha( 0.1f ), 1 );
float steps = 6;
for ( float i = 0; i <= steps; i++ )
{
cr.DrawLine( LocalRect, (1 / steps) + i / (steps + 2), 10 );
}
}
}