Skip to content

Commit dbe9b36

Browse files
fix: <path> only displayed the last line
1 parent ef4c00d commit dbe9b36

2 files changed

Lines changed: 21 additions & 47 deletions

File tree

FreeFrame/Components/Shapes/SVGPath.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ public override float[] GetVertices()
153153
// Edges
154154
List<float> vertices = new List<float>();
155155
DrawAttribute? previous = null;
156+
DrawAttribute.LastX = 0;
157+
DrawAttribute.LastY = 0;
158+
DrawAttribute.LastControlPointX = 0;
159+
DrawAttribute.LastControlPointY = 0;
160+
156161
foreach (DrawAttribute current in DrawAttributes)
157162
{
158163
if (current.GetType() == typeof(LineTo) ||

FreeFrame/Components/Shapes/Shape.cs

Lines changed: 16 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -105,53 +105,22 @@ public void Draw()
105105
GL.DrawElements(PrimitiveType.LineStrip, _indexCount, DrawElementsType.UnsignedInt, 0);
106106

107107
// Can't do a switch because a switch need a const and a type is not
108-
//if (GetType() == typeof(SVGLine))
109-
//{
110-
// GL.Enable(EnableCap.LineSmooth);
111-
// GL.LineWidth(1.0f); // TODO: Lines are not really great (needed anti aliasing)
112-
// GL.DrawElements(PrimitiveType.Lines, _indexCount, DrawElementsType.UnsignedInt, 0);
113-
// GL.Disable(EnableCap.LineSmooth);
114-
//}
115-
//else if (GetType() == typeof(SVGPath))
116-
//{
117-
// //Console.WriteLine("Draw pathttttttttttttttttt");
118-
// /*
119-
// foreach (DrawAttribute attr in ((SVGPath)this).DrawAttributes)
120-
// {
121-
// // Can't do a switch because a switch need a const and a type is not
122-
// if (attr.GetType() == typeof(MoveTo))
123-
// continue;
124-
// else if (attr.GetType() == typeof(LineTo))
125-
// {
126-
// //((LineTo)attr).
127-
// continue;
128-
129-
// }
130-
// else if (attr.GetType() == typeof(HorizontalLineTo))
131-
// continue;
132-
// else if (attr.GetType() == typeof(VerticalLineTo))
133-
// continue;
134-
// else if (attr.GetType() == typeof(CurveTo))
135-
// continue;
136-
// else if (attr.GetType() == typeof(SmoothCurveTo))
137-
// continue;
138-
// else if (attr.GetType() == typeof(QuadraticBezierCurveTo))
139-
// continue;
140-
// else if (attr.GetType() == typeof(SmoothQuadraticBezierCurveTo))
141-
// continue;
142-
// else if (attr.GetType() == typeof(EllipticalArc))
143-
// continue;
144-
// else if (attr.GetType() == typeof(ClosePath))
145-
// continue;
146-
// }
147-
// */
148-
// //GL.Enable(EnableCap.LineSmooth);
149-
// //GL.LineWidth(1.0f); // TODO: Lines are not really great (needed anti aliasing)
150-
// GL.DrawElements(PrimitiveType.LineStrip, _indexCount, DrawElementsType.UnsignedInt, 0);
151-
// //GL.Disable(EnableCap.LineSmooth);
152-
//}
153-
//else
154-
// GL.DrawElements(PrimitiveType.Triangles, _indexCount, DrawElementsType.UnsignedInt, 0);
108+
if (GetType() == typeof(SVGLine))
109+
{
110+
GL.Enable(EnableCap.LineSmooth);
111+
GL.LineWidth(1.0f); // TODO: Lines are not really great (needed anti aliasing)
112+
GL.DrawElements(PrimitiveType.Lines, _indexCount, DrawElementsType.UnsignedInt, 0);
113+
GL.Disable(EnableCap.LineSmooth);
114+
}
115+
else if (GetType() == typeof(SVGPath))
116+
{
117+
GL.Enable(EnableCap.LineSmooth);
118+
GL.LineWidth(1.0f); // TODO: Lines are not really great (needed anti aliasing)
119+
GL.DrawElements(PrimitiveType.LineStrip, _indexCount, DrawElementsType.UnsignedInt, 0);
120+
GL.Disable(EnableCap.LineSmooth);
121+
}
122+
else
123+
GL.DrawElements(PrimitiveType.Triangles, _indexCount, DrawElementsType.UnsignedInt, 0);
155124
}
156125
public void DeleteObjects()
157126
{

0 commit comments

Comments
 (0)