reckfellENGINE

Line2D

A 2D polyline that can optionally be textured.

On this page
class Line2DReckfellSharpInherits Entity2D

A 2D polyline that can optionally be textured.

This node draws a 2D polyline, i.e. a shape consisting of several points connected by segments. Line2D is not a mathematical polyline, i.e. the segments are not infinitely thin. It is intended for rendering and it can be colored and optionally textured. Warning: Certain configurations may be impossible to draw nicely, such as very sharp angles. In these situations, the node uses fallback drawing logic to look decent. Note: Line2D is drawn using a 2D mesh.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

Line2DConstructor
# Line2D
C#
public Line2D();

Properties14

AntialiasedProperty
# Antialiased
C#
public bool Antialiased { get; set; }

If true, the polyline's border will be anti-aliased. Note: Line2D is not accelerated by batching when being anti-aliased.

BeginCapModeProperty
# BeginCapMode
C#
public Line2D.LineCapMode BeginCapMode { get; set; }

The style of the beginning of the polyline, if Line2D.Closed is false.

ClosedProperty
# Closed
C#
public bool Closed { get; set; }

If true and the polyline has more than 2 points, the last point and the first one will be connected by a segment. Note: The shape of the closing segment is not guaranteed to be seamless if a Line2D.WidthCurve is provided. Note: The joint between the closing segment and the first segment is drawn first and it samples the Line2D.Gradient and the Line2D.WidthCurve at the beginning. This is an implementation detail that might change in a future version.

DefaultColorProperty
# DefaultColor
C#
public Color DefaultColor { get; set; }

The color of the polyline. Will not be used if a gradient is set.

EndCapModeProperty
# EndCapMode
C#
public Line2D.LineCapMode EndCapMode { get; set; }

The style of the end of the polyline, if Line2D.Closed is false.

GradientProperty
# Gradient
C#
public Gradient Gradient { get; set; }

The gradient is drawn through the whole line from start to finish. The Line2D.DefaultColor will not be used if this property is set.

JointModeProperty
# JointMode
C#
public Line2D.LineJointMode JointMode { get; set; }

The style of the connections between segments of the polyline.

PointsProperty
# Points
C#
public Vector2[] Points { get; set; }

The points of the polyline, interpreted in local 2D coordinates. Segments are drawn between the adjacent points in this array.

RoundPrecisionProperty
# RoundPrecision
C#
public int RoundPrecision { get; set; }

The smoothness used for rounded joints and caps. Higher values result in smoother corners, but are more demanding to render and update.

SharpLimitProperty
# SharpLimit
C#
public float SharpLimit { get; set; }

Determines the miter limit of the polyline. Normally, when Line2D.JointMode is set to Line2D.LineJointMode.Sharp, sharp angles fall back to using the logic of Line2D.LineJointMode.Bevel joints to prevent very long miters. Higher values of this property mean that the fallback to a bevel joint will happen at sharper angles.

TextureProperty
# Texture
C#
public Texture2D Texture { get; set; }

The texture used for the polyline. Uses Line2D.TextureMode for drawing style.

TextureModeProperty
# TextureMode
C#
public Line2D.LineTextureMode TextureMode { get; set; }

The style to render the Line2D.Texture of the polyline.

WidthProperty
# Width
C#
public float Width { get; set; }

The polyline's width.

WidthCurveProperty
# WidthCurve
C#
public Curve WidthCurve { get; set; }

The polyline's width curve. The width of the polyline over its length will be equivalent to the value of the width curve over its domain. The width curve should be a unit Curve.

Methods35

AddPointvoid
# AddPoint
C#
public void AddPoint(Vector2 position, int index = -1);

Adds a point with the specified position relative to the polyline's own position. If no index is provided, the new point will be added to the end of the points array. If index is given, the new point is inserted before the existing point identified by index index. The indices of the points after the new point get increased by 1. The provided index must not exceed the number of existing points in the polyline. See Line2D.GetPointCount.

Parameters
NameTypeDefault
positionVector2—
indexint-1
ClearPointsvoid
# ClearPoints
C#
public void ClearPoints();

Removes all points from the polyline, making it empty.

GetAntialiasedbool
# GetAntialiased
C#
public bool GetAntialiased();
Returns bool
GetBeginCapModeLine2D.LineCapMode
# GetBeginCapMode
C#
public Line2D.LineCapMode GetBeginCapMode();
Returns Line2D.LineCapMode
GetCurveCurve
# GetCurve
C#
public Curve GetCurve();
Returns Curve
GetDefaultColorColor
# GetDefaultColor
C#
public Color GetDefaultColor();
Returns Color
GetEndCapModeLine2D.LineCapMode
# GetEndCapMode
C#
public Line2D.LineCapMode GetEndCapMode();
Returns Line2D.LineCapMode
GetGradientGradient
# GetGradient
C#
public Gradient GetGradient();
Returns Gradient
GetJointModeLine2D.LineJointMode
# GetJointMode
C#
public Line2D.LineJointMode GetJointMode();
Returns Line2D.LineJointMode
GetPointCountint
# GetPointCount
C#
public int GetPointCount();

Returns the number of points in the polyline.

Returns int
GetPointPositionVector2
# GetPointPosition
C#
public Vector2 GetPointPosition(int index);

Returns the position of the point at index index.

Parameters
NameTypeDefault
indexint—
Returns Vector2
GetPointsVector2[]
# GetPoints
C#
public Vector2[] GetPoints();
Returns Vector2[]
GetRoundPrecisionint
# GetRoundPrecision
C#
public int GetRoundPrecision();
Returns int
GetSharpLimitfloat
# GetSharpLimit
C#
public float GetSharpLimit();
Returns float
GetTextureTexture2D
# GetTexture
C#
public Texture2D GetTexture();
Returns Texture2D
GetTextureModeLine2D.LineTextureMode
# GetTextureMode
C#
public Line2D.LineTextureMode GetTextureMode();
Returns Line2D.LineTextureMode
GetWidthfloat
# GetWidth
C#
public float GetWidth();
Returns float
IsClosedbool
# IsClosed
C#
public bool IsClosed();
Returns bool
RemovePointvoid
# RemovePoint
C#
public void RemovePoint(int index);

Removes the point at index index from the polyline.

Parameters
NameTypeDefault
indexint—
SetAntialiasedvoid
# SetAntialiased
C#
public void SetAntialiased(bool antialiased);
Parameters
NameTypeDefault
antialiasedbool—
SetBeginCapModevoid
# SetBeginCapMode
C#
public void SetBeginCapMode(Line2D.LineCapMode mode);
Parameters
NameTypeDefault
modeLine2D.LineCapMode—
SetClosedvoid
# SetClosed
C#
public void SetClosed(bool closed);
Parameters
NameTypeDefault
closedbool—
SetCurvevoid
# SetCurve
C#
public void SetCurve(Curve curve);
Parameters
NameTypeDefault
curveCurve—
SetDefaultColorvoid
# SetDefaultColor
C#
public void SetDefaultColor(Color color);
Parameters
NameTypeDefault
colorColor—
SetEndCapModevoid
# SetEndCapMode
C#
public void SetEndCapMode(Line2D.LineCapMode mode);
Parameters
NameTypeDefault
modeLine2D.LineCapMode—
SetGradientvoid
# SetGradient
C#
public void SetGradient(Gradient color);
Parameters
NameTypeDefault
colorGradient—
SetJointModevoid
# SetJointMode
C#
public void SetJointMode(Line2D.LineJointMode mode);
Parameters
NameTypeDefault
modeLine2D.LineJointMode—
SetPointPositionvoid
# SetPointPosition
C#
public void SetPointPosition(int index, Vector2 position);

Overwrites the position of the point at the given index with the supplied position.

Parameters
NameTypeDefault
indexint—
positionVector2—
SetPoints2 overloads
# SetPoints · 1/2
C#
public void SetPoints(Vector2[] points);
Parameters
NameTypeDefault
pointsVector2[]—
# SetPoints · 2/2
C#
public void SetPoints(ReadOnlySpan<Vector2> points);
Parameters
NameTypeDefault
pointsReadOnlySpan<Vector2>—
SetRoundPrecisionvoid
# SetRoundPrecision
C#
public void SetRoundPrecision(int precision);
Parameters
NameTypeDefault
precisionint—
SetSharpLimitvoid
# SetSharpLimit
C#
public void SetSharpLimit(float limit);
Parameters
NameTypeDefault
limitfloat—
SetTexturevoid
# SetTexture
C#
public void SetTexture(Texture2D texture);
Parameters
NameTypeDefault
textureTexture2D—
SetTextureModevoid
# SetTextureMode
C#
public void SetTextureMode(Line2D.LineTextureMode mode);
Parameters
NameTypeDefault
modeLine2D.LineTextureMode—
SetWidthvoid
# SetWidth
C#
public void SetWidth(float width);
Parameters
NameTypeDefault
widthfloat—

Line2D.LineCapMode

ValueDescription
Box = 1

Draws the line cap as a box, slightly extending the first/last segment.

None = 0

Draws no line cap.

Round = 2

Draws the line cap as a semicircle attached to the first/last segment.

Line2D.LineJointMode

ValueDescription
Bevel = 1

Makes the polyline's joints bevelled/chamfered, connecting the sides of the two segments with a simple line.

Round = 2

Makes the polyline's joints rounded, connecting the sides of the two segments with an arc. The detail of this arc depends on Line2D.RoundPrecision.

Sharp = 0

Makes the polyline's joints pointy, connecting the sides of the two segments by extending them until they intersect. If the rotation of a joint is too big (based on Line2D.SharpLimit), the joint falls back to Line2D.LineJointMode.Bevel to prevent very long miters.

Line2D.LineTextureMode

ValueDescription
None = 0

Takes the left pixels of the texture and renders them over the whole polyline.

Stretch = 2

Stretches the texture across the polyline. CanvasItem.TextureRepeat of the Line2D node must be CanvasItem.TextureRepeatEnum.Disabled for best results.

Tile = 1

Tiles the texture over the polyline. CanvasItem.TextureRepeat of the Line2D node must be CanvasItem.TextureRepeatEnum.Enabled or CanvasItem.TextureRepeatEnum.Mirror for it to work properly.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.