@@ -33,7 +33,7 @@ internal void GroupEnd()
33
33
_groupControls . RemoveAt ( _groupControls . Count - 1 ) ;
34
34
}
35
35
36
- private PointF [ ] GetBezierApproximation ( PointF [ ] controlPoints , int outputSegmentCount )
36
+ public static PointF [ ] GetBezierApproximation ( PointF [ ] controlPoints , int outputSegmentCount )
37
37
{
38
38
PointF [ ] points = new PointF [ outputSegmentCount + 1 ] ;
39
39
for ( int i = 0 ; i <= outputSegmentCount ; i ++ )
@@ -43,7 +43,7 @@ private PointF[] GetBezierApproximation(PointF[] controlPoints, int outputSegmen
43
43
}
44
44
return points ;
45
45
}
46
- private PointF GetBezierPoint ( float t , PointF [ ] controlPoints , int index , int count )
46
+ private static PointF GetBezierPoint ( float t , PointF [ ] controlPoints , int index , int count )
47
47
{
48
48
if ( count == 1 )
49
49
return controlPoints [ index ] ;
@@ -64,7 +64,7 @@ private static int GUI_SetLabelFont(Font font)
64
64
else
65
65
{
66
66
GUI . skin . label . font = null ;
67
- UnityEngine . Debug . LogWarning ( font . Name ) ;
67
+ UnityEngine . Debug . Log ( font . Name ) ;
68
68
}
69
69
}
70
70
else
@@ -102,7 +102,7 @@ public void Dispose()
102
102
public void Clear ( System . Drawing . Color color )
103
103
{
104
104
}
105
- public void DrawCurve ( Pen pen , PointF [ ] points ) // very slow.
105
+ public void DrawCurve ( Pen pen , PointF [ ] points , int segments = 32 ) // very slow.
106
106
{
107
107
if ( points == null || points . Length <= 1 ) return ;
108
108
if ( points . Length == 2 )
@@ -111,7 +111,7 @@ public void DrawCurve(Pen pen, PointF[] points) // very slow.
111
111
return ;
112
112
}
113
113
114
- var bPoints = GetBezierApproximation ( points , 32 ) ; // decrease segments for better fps.
114
+ var bPoints = GetBezierApproximation ( points , segments ) ; // decrease segments for better fps.
115
115
for ( int i = 0 ; i + 1 < bPoints . Length ; i ++ )
116
116
DrawLine ( pen , bPoints [ i ] . X , bPoints [ i ] . Y , bPoints [ i + 1 ] . X , bPoints [ i + 1 ] . Y ) ;
117
117
}
@@ -130,6 +130,11 @@ public void DrawLine(Pen pen, float x1, float y1, float x2, float y2)
130
130
131
131
if ( GL_Lines )
132
132
{
133
+ GL . PushMatrix ( ) ;
134
+ if ( DefaultMaterial != null )
135
+ DefaultMaterial . SetPass ( 0 ) ;
136
+ GL . LoadOrtho ( ) ;
137
+
133
138
GL . Begin ( GL . LINES ) ;
134
139
GL . Color ( pen . Color . ToUColor ( ) ) ;
135
140
@@ -139,6 +144,7 @@ public void DrawLine(Pen pen, float x1, float y1, float x2, float y2)
139
144
GL . Vertex3 ( x2 , y2 , 0 ) ;
140
145
141
146
GL . End ( ) ;
147
+ GL . PopMatrix ( ) ;
142
148
return ;
143
149
}
144
150
@@ -155,7 +161,7 @@ public void DrawLine(Pen pen, float x1, float y1, float x2, float y2)
155
161
float yDiff = y2 - y1 ;
156
162
var angle = Math . Atan2 ( yDiff , xDiff ) * 180.0 / Math . PI ;
157
163
158
- DrawTexture ( System . Windows . Forms . ApplicationBehaviour . DefaultSpriteSmoothLine , x1 , y1 , ( float ) Math . Sqrt ( xDiff * xDiff + yDiff * yDiff ) , pen . Width , pen . Color , ( float ) angle , new PointF ( ) ) ;
164
+ DrawTexture ( System . Windows . Forms . ApplicationBehaviour . Resources . Reserved . Circle , x1 , y1 , ( float ) Math . Sqrt ( xDiff * xDiff + yDiff * yDiff ) , pen . Width , pen . Color , ( float ) angle , new PointF ( ) ) ;
159
165
return ;
160
166
}
161
167
@@ -424,7 +430,7 @@ public void DrawRectangle(Pen pen, float x, float y, float width, float height)
424
430
}
425
431
426
432
427
- //UnityEngine.Debug .Log(width.ToString() + " " + height.ToString());
433
+ //Application .Log(width.ToString() + " " + height.ToString());
428
434
//return;
429
435
430
436
// Batching
0 commit comments