Esempio n. 1
0
        void DrawTrianglesAndLines(GuiRenderer renderer)
        {
            List <GuiRenderer.TriangleVertex> vertices = new List <GuiRenderer.TriangleVertex>(32);

            Vec2  center = new Vec2(.7f, .4f);
            float radius = .1f;

            float step      = MathFunctions.PI * 2 / 16;
            Vec2  lastPoint = Vec2.Zero;

            for (float angle = 0; angle <= MathFunctions.PI * 2 + step * .5f; angle += step)
            {
                Vec2 point = center + new Vec2(
                    MathFunctions.Cos(angle) * radius / renderer.AspectRatio,
                    MathFunctions.Sin(angle) * radius);

                if (angle != 0)
                {
                    vertices.Add(new GuiRenderer.TriangleVertex(center, new ColorValue(1, 0, 0)));
                    vertices.Add(new GuiRenderer.TriangleVertex(lastPoint, new ColorValue(0, 1, 0)));
                    vertices.Add(new GuiRenderer.TriangleVertex(point, new ColorValue(0, 1, 0)));
                }

                lastPoint = point;
            }

            renderer.AddTriangles(vertices);

            Rect rect = new Rect(
                center.X - radius / renderer.AspectRatio, center.Y - radius,
                center.X + radius / renderer.AspectRatio, center.Y + radius);

            renderer.AddRectangle(rect, new ColorValue(1, 1, 0));
        }
Esempio n. 2
0
        void RotateGuiControl(EControl sender, float alpha, Texture guiTexture, GuiRenderer renderer)
        {
            Rect controlRect = sender.GetScreenRectangle();
            Rect screenMapRect = sender.GetScreenRectangle();
            Vec2 size = controlRect.GetSize();
            float angle = MathFunctions.DegToRad(alpha);
            float smallRadius = 0.03f;
            float bigRadius = 0.8f;
            float width = 0.15f;

            Vec2 U = new Vec2(+(float)Math.Cos(angle), +(float)Math.Sin(angle));
            Vec2 V = new Vec2(-(float)Math.Sin(angle), +(float)Math.Cos(angle));
            Vec2 P1 = bigRadius * U + V * width / 2;
            Vec2 P2 = bigRadius * U - V * width / 2;
            Vec2 P3 = smallRadius * U + V * width / 2;
            Vec2 P4 = smallRadius * U - V * width / 2;

            float X1 = Vec2.Dot(P1, Vec2.XAxis);
            float Y1 = Vec2.Dot(P1, Vec2.YAxis);
            float X2 = Vec2.Dot(P2, Vec2.XAxis);
            float Y2 = Vec2.Dot(P2, Vec2.YAxis);
            float X3 = Vec2.Dot(P3, Vec2.XAxis);
            float Y3 = Vec2.Dot(P3, Vec2.YAxis);
            float X4 = Vec2.Dot(P4, Vec2.XAxis);
            float Y4 = Vec2.Dot(P4, Vec2.YAxis);

            X1 = controlRect.Left + (X1 + 1) / 2 * size.X ;
            Y1 = controlRect.Top + (Y1 + 1) / 2 * size.Y ;
            X2 = controlRect.Left + (X2 + 1) / 2 * size.X;
            Y2 = controlRect.Top + (Y2 + 1) / 2 * size.Y ;
            X3 = controlRect.Left + (X3 + 1) / 2 * size.X;
            Y3 = controlRect.Top + (Y3 + 1) / 2 * size.Y ;
            X4 = controlRect.Left + (X4 + 1) / 2 * size.X;
            Y4 = controlRect.Top + (Y4 + 1) / 2 * size.Y ;

            List<GuiRenderer.TriangleVertex> vert = new List<GuiRenderer.TriangleVertex>(6);
            vert.Add(new GuiRenderer.TriangleVertex(new Vec2(X1, Y1), new ColorValue(1, 1, 1, 1), new Vec2(0, 0)));
            vert.Add(new GuiRenderer.TriangleVertex(new Vec2(X2, Y2), new ColorValue(1, 1, 1, 1), new Vec2(1, 0)));
            vert.Add(new GuiRenderer.TriangleVertex(new Vec2(X4, Y4), new ColorValue(1, 1, 1, 1), new Vec2(0, 1)));
            vert.Add(new GuiRenderer.TriangleVertex(new Vec2(X3, Y3), new ColorValue(1, 1, 1, 1), new Vec2(1, 1)));
            vert.Add(new GuiRenderer.TriangleVertex(new Vec2(X4, Y4), new ColorValue(1, 1, 1, 1), new Vec2(0, 1)));
            vert.Add(new GuiRenderer.TriangleVertex(new Vec2(X2, Y2), new ColorValue(1, 1, 1, 1), new Vec2(1, 0)));
            renderer.AddTriangles(vert, guiTexture, false);
        }
Esempio n. 3
0
        void DrawArea_RenderUI( Control sender, GuiRenderer renderer )
        {
            Rect rectangle = sender.GetScreenRectangle();
            bool clipRectangle = true;
            ColorValue[] colors = new ColorValue[]{
                new ColorValue( 1 ,0, 0 ),
                new ColorValue( 0, 1, 0 ),
                new ColorValue( 0, 0, 1 ),
                new ColorValue( 1, 1, 0 ),
                new ColorValue( 1, 1, 1 )};

            if( clipRectangle )
                renderer.PushClipRectangle( rectangle );

            //draw triangles
            if( GetDrawAreaMode() == DrawAreaModes.Triangles )
            {
                float distance = rectangle.GetSize().X / 2;

                List<GuiRenderer.TriangleVertex> triangles = new List<GuiRenderer.TriangleVertex>( 256 );

                Radian angle = -EngineApp.Instance.Time;

                const int steps = 30;
                Vec2 lastPosition = Vec2.Zero;
                for( int step = 0; step < steps + 1; step++ )
                {
                    Vec2 localPos = new Vec2( MathFunctions.Cos( angle ), MathFunctions.Sin( angle ) ) * distance;
                    Vec2 pos = rectangle.GetCenter() + new Vec2( localPos.X, localPos.Y * renderer.AspectRatio );

                    if( step != 0 )
                    {
                        ColorValue color = colors[ step % colors.Length ];
                        ColorValue color2 = color;
                        color2.Alpha = 0;
                        triangles.Add( new GuiRenderer.TriangleVertex( rectangle.GetCenter(), color ) );
                        triangles.Add( new GuiRenderer.TriangleVertex( lastPosition, color2 ) );
                        triangles.Add( new GuiRenderer.TriangleVertex( pos, color2 ) );
                    }

                    angle += ( MathFunctions.PI * 2 ) / steps;
                    lastPosition = pos;
                }

                renderer.AddTriangles( triangles );
            }

            //draw quads
            if( GetDrawAreaMode() == DrawAreaModes.Quads )
            {
                //draw background
                {
                    Texture texture = TextureManager.Instance.Load( "Gui\\Various\\Logo.png" );
                    renderer.AddQuad( rectangle, new Rect( 0, -.3f, 1, 1.4f ), texture,
                        new ColorValue( 1, 1, 1 ), true );
                }

                //draw bars
                {
                    float time = EngineApp.Instance.Time;

                    EngineRandom random = new EngineRandom( 0 );

                    int count = 15;
                    float stepOffset = rectangle.GetSize().X / count;
                    float size = stepOffset * .9f;
                    for( int n = 0; n < count; n++ )
                    {
                        float v = MathFunctions.Cos( time * random.NextFloat() );
                        float v2 = ( v + 1 ) / 2;

                        ColorValue color = colors[ n % colors.Length ];
                        Rect rect = new Rect(
                            rectangle.Left + stepOffset * n, rectangle.Bottom - rectangle.GetSize().Y * v2,
                            rectangle.Left + stepOffset * n + size, rectangle.Bottom );
                        renderer.AddQuad( rect, color );
                    }
                }
            }

            //draw lines
            if( GetDrawAreaMode() == DrawAreaModes.Lines )
            {
                float maxDistance;
                {
                    Vec2 s = rectangle.GetSize() / 2;
                    maxDistance = MathFunctions.Sqrt( s.X * s.X + s.Y * s.Y );
                }

                int step = 0;
                float distance = 0;
                Radian angle = -EngineApp.Instance.Time;
                Vec2 lastPosition = Vec2.Zero;

                while( distance < maxDistance )
                {
                    Vec2 localPos = new Vec2( MathFunctions.Cos( angle ), MathFunctions.Sin( angle ) ) * distance;
                    Vec2 pos = rectangle.GetCenter() + new Vec2( localPos.X, localPos.Y * renderer.AspectRatio );

                    if( step != 0 )
                    {
                        ColorValue color = colors[ step % colors.Length ];
                        renderer.AddLine( lastPosition, pos, color );
                    }

                    step++;
                    angle += MathFunctions.PI / 10;
                    distance += .001f;
                    lastPosition = pos;
                }
            }

            //draw text
            if( GetDrawAreaMode() == DrawAreaModes.Text )
            {
                //draw text with specified font.
                renderer.AddText( drawAreaBigFont, "Big Font Sample", rectangle.LeftTop, HorizontalAlign.Left,
                    VerticalAlign.Top, new ColorValue( 1, 1, 1 ) );

                //draw text with word wrap.
                string text = "Test Test Test.\n\nThe expandable user interface system is a unified system " +
                    "for the creation of end-user controls, menus, dialogues, windows and HUD screens. " +
                    "With the help of this system the end-user exercises control over the application.";
                renderer.AddTextWordWrap( text, rectangle, HorizontalAlign.Right, false, VerticalAlign.Bottom, 0,
                    new ColorValue( 1, 1, 0 ) );
            }

            if( clipRectangle )
                renderer.PopClipRectangle();
        }
Esempio n. 4
0
        private void DrawArea_RenderUI(Control sender, GuiRenderer renderer)
        {
            Rect rectangle     = sender.GetScreenRectangle();
            bool clipRectangle = true;

            ColorValue[] colors = new ColorValue[] {
                new ColorValue(1, 0, 0),
                new ColorValue(0, 1, 0),
                new ColorValue(0, 0, 1),
                new ColorValue(1, 1, 0),
                new ColorValue(1, 1, 1)
            };

            if (clipRectangle)
            {
                renderer.PushClipRectangle(rectangle);
            }

            //draw triangles
            if (GetDrawAreaMode() == DrawAreaModes.Triangles)
            {
                float distance = rectangle.GetSize().X / 2;

                List <GuiRenderer.TriangleVertex> triangles = new List <GuiRenderer.TriangleVertex>(256);

                Radian angle = -EngineApp.Instance.Time;

                const int steps        = 30;
                Vec2      lastPosition = Vec2.Zero;
                for (int step = 0; step < steps + 1; step++)
                {
                    Vec2 localPos = new Vec2(MathFunctions.Cos(angle), MathFunctions.Sin(angle)) * distance;
                    Vec2 pos      = rectangle.GetCenter() + new Vec2(localPos.X, localPos.Y * renderer.AspectRatio);

                    if (step != 0)
                    {
                        ColorValue color  = colors[step % colors.Length];
                        ColorValue color2 = color;
                        color2.Alpha = 0;
                        triangles.Add(new GuiRenderer.TriangleVertex(rectangle.GetCenter(), color));
                        triangles.Add(new GuiRenderer.TriangleVertex(lastPosition, color2));
                        triangles.Add(new GuiRenderer.TriangleVertex(pos, color2));
                    }

                    angle       += (MathFunctions.PI * 2) / steps;
                    lastPosition = pos;
                }

                renderer.AddTriangles(triangles);
            }

            //draw quads
            if (GetDrawAreaMode() == DrawAreaModes.Quads)
            {
                //draw background
                {
                    Texture texture = TextureManager.Instance.Load("GUI\\Textures\\NeoAxisLogo.png");
                    renderer.AddQuad(rectangle, new Rect(0, -.3f, 1, 1.4f), texture,
                                     new ColorValue(1, 1, 1), true);
                }

                //draw bars
                {
                    float time = EngineApp.Instance.Time;

                    EngineRandom random = new EngineRandom(0);

                    int   count      = 15;
                    float stepOffset = rectangle.GetSize().X / count;
                    float size       = stepOffset * .9f;
                    for (int n = 0; n < count; n++)
                    {
                        float v  = MathFunctions.Cos(time * random.NextFloat());
                        float v2 = (v + 1) / 2;

                        ColorValue color = colors[n % colors.Length];
                        Rect       rect  = new Rect(
                            rectangle.Left + stepOffset * n, rectangle.Bottom - rectangle.GetSize().Y *v2,
                            rectangle.Left + stepOffset * n + size, rectangle.Bottom);
                        renderer.AddQuad(rect, color);
                    }
                }
            }

            //draw lines
            if (GetDrawAreaMode() == DrawAreaModes.Lines)
            {
                float maxDistance;
                {
                    Vec2 s = rectangle.GetSize() / 2;
                    maxDistance = MathFunctions.Sqrt(s.X * s.X + s.Y * s.Y);
                }

                int    step         = 0;
                float  distance     = 0;
                Radian angle        = -EngineApp.Instance.Time;
                Vec2   lastPosition = Vec2.Zero;

                while (distance < maxDistance)
                {
                    Vec2 localPos = new Vec2(MathFunctions.Cos(angle), MathFunctions.Sin(angle)) * distance;
                    Vec2 pos      = rectangle.GetCenter() + new Vec2(localPos.X, localPos.Y * renderer.AspectRatio);

                    if (step != 0)
                    {
                        ColorValue color = colors[step % colors.Length];
                        renderer.AddLine(lastPosition, pos, color);
                    }

                    step++;
                    angle       += MathFunctions.PI / 10;
                    distance    += .001f;
                    lastPosition = pos;
                }
            }

            //draw text
            if (GetDrawAreaMode() == DrawAreaModes.Text)
            {
                string text;

                //draw text with specified font.
                text = "Map Editor is a tool to create worlds for your project. The tool is a complex editor to manage " +
                       "objects on the map.";
                renderer.AddTextWordWrap(drawAreaBigFont, text, rectangle, HorizontalAlign.Left, false, VerticalAlign.Top, 0,
                                         new ColorValue(1, 1, 1));

                //draw text with word wrap.
                text = "Deployment Tool is a tool to deploy the final version of your application to specified platforms. " +
                       "This utility is useful to automate the final product's creation.";
                renderer.AddTextWordWrap(drawAreaSmallFont, text, rectangle, HorizontalAlign.Right, false, VerticalAlign.Bottom, 0,
                                         new ColorValue(1, 1, 0));
            }

            if (clipRectangle)
            {
                renderer.PopClipRectangle();
            }
        }
        private void DrawArea_RenderUI(Control sender, GuiRenderer renderer)
        {
            Rect rectangle = sender.GetScreenRectangle();
            bool clipRectangle = true;
            ColorValue[] colors = new ColorValue[]{
				new ColorValue( 1 ,0, 0 ),
				new ColorValue( 0, 1, 0 ),
				new ColorValue( 0, 0, 1 ),
				new ColorValue( 1, 1, 0 ),
				new ColorValue( 1, 1, 1 )};

            if (clipRectangle)
                renderer.PushClipRectangle(rectangle);

            //draw triangles
            if (GetDrawAreaMode() == DrawAreaModes.Triangles)
            {
                float distance = rectangle.GetSize().X / 2;

                List<GuiRenderer.TriangleVertex> triangles = new List<GuiRenderer.TriangleVertex>(256);

                Radian angle = -EngineApp.Instance.Time;

                const int steps = 30;
                Vec2 lastPosition = Vec2.Zero;
                for (int step = 0; step < steps + 1; step++)
                {
                    Vec2 localPos = new Vec2(MathFunctions.Cos(angle), MathFunctions.Sin(angle)) * distance;
                    Vec2 pos = rectangle.GetCenter() + new Vec2(localPos.X, localPos.Y * renderer.AspectRatio);

                    if (step != 0)
                    {
                        ColorValue color = colors[step % colors.Length];
                        ColorValue color2 = color;
                        color2.Alpha = 0;
                        triangles.Add(new GuiRenderer.TriangleVertex(rectangle.GetCenter(), color));
                        triangles.Add(new GuiRenderer.TriangleVertex(lastPosition, color2));
                        triangles.Add(new GuiRenderer.TriangleVertex(pos, color2));
                    }

                    angle += (MathFunctions.PI * 2) / steps;
                    lastPosition = pos;
                }

                renderer.AddTriangles(triangles);
            }

            //draw quads
            if (GetDrawAreaMode() == DrawAreaModes.Quads)
            {
                //draw background
                {
                    Texture texture = TextureManager.Instance.Load("GUI\\Textures\\NeoAxisLogo.png");
                    renderer.AddQuad(rectangle, new Rect(0, -.3f, 1, 1.4f), texture,
                        new ColorValue(1, 1, 1), true);
                }

                //draw bars
                {
                    float time = EngineApp.Instance.Time;

                    EngineRandom random = new EngineRandom(0);

                    int count = 15;
                    float stepOffset = rectangle.GetSize().X / count;
                    float size = stepOffset * .9f;
                    for (int n = 0; n < count; n++)
                    {
                        float v = MathFunctions.Cos(time * random.NextFloat());
                        float v2 = (v + 1) / 2;

                        ColorValue color = colors[n % colors.Length];
                        Rect rect = new Rect(
                            rectangle.Left + stepOffset * n, rectangle.Bottom - rectangle.GetSize().Y * v2,
                            rectangle.Left + stepOffset * n + size, rectangle.Bottom);
                        renderer.AddQuad(rect, color);
                    }
                }
            }

            //draw lines
            if (GetDrawAreaMode() == DrawAreaModes.Lines)
            {
                float maxDistance;
                {
                    Vec2 s = rectangle.GetSize() / 2;
                    maxDistance = MathFunctions.Sqrt(s.X * s.X + s.Y * s.Y);
                }

                int step = 0;
                float distance = 0;
                Radian angle = -EngineApp.Instance.Time;
                Vec2 lastPosition = Vec2.Zero;

                while (distance < maxDistance)
                {
                    Vec2 localPos = new Vec2(MathFunctions.Cos(angle), MathFunctions.Sin(angle)) * distance;
                    Vec2 pos = rectangle.GetCenter() + new Vec2(localPos.X, localPos.Y * renderer.AspectRatio);

                    if (step != 0)
                    {
                        ColorValue color = colors[step % colors.Length];
                        renderer.AddLine(lastPosition, pos, color);
                    }

                    step++;
                    angle += MathFunctions.PI / 10;
                    distance += .001f;
                    lastPosition = pos;
                }
            }

            //draw text
            if (GetDrawAreaMode() == DrawAreaModes.Text)
            {
                string text;

                //draw text with specified font.
                text = "Map Editor is a tool to create worlds for your project. The tool is a complex editor to manage " +
                    "objects on the map.";
                renderer.AddTextWordWrap(drawAreaBigFont, text, rectangle, HorizontalAlign.Left, false, VerticalAlign.Top, 0,
                    new ColorValue(1, 1, 1));

                //draw text with word wrap.
                text = "Deployment Tool is a tool to deploy the final version of your application to specified platforms. " +
                    "This utility is useful to automate the final product's creation.";
                renderer.AddTextWordWrap(drawAreaSmallFont, text, rectangle, HorizontalAlign.Right, false, VerticalAlign.Bottom, 0,
                    new ColorValue(1, 1, 0));
            }

            if (clipRectangle)
                renderer.PopClipRectangle();
        }
Esempio n. 6
0
		protected override void OnRenderUI(GuiRenderer renderer)
		{
			Rect r = new Rect();
			var pos = this.GetScreenPosition();
			var sz = this.GetScreenSize();
			r.Left = pos.X;
			r.Right = r.Left + sz.X;
			r.Top = pos.Y;
			r.Bottom = r.Top + sz.Y;
			if (mBorderRadius.Value != Vec2.Zero)
			{
#if DebugDraw
				ColorValue debugColor = new ColorValue(0f, 1f, 0f, .5f);
				ColorValue debugColor2 = new ColorValue(0f, 0f, 1f, .5f);
#endif

				Vec2 screenRelRad = this.ScreenFromValue(mBorderRadius);

				// By using clipping and a set of 3 rectangles, we ensure that each point
				// on the screen is only drawn once, thus allowing the alpha value to be
				// used in the color without it looking weird.

				// Top-Left
#if DebugDraw
				renderer.AddCircle(r.LeftTop + screenRelRad, debugColor, screenRelRad, (float)Math.PI, (float)(Math.PI * 1.5f));
#else
				renderer.AddCircle(r.LeftTop + screenRelRad, mColor, screenRelRad, (float)Math.PI, (float)(Math.PI * 1.5f));
#endif

				// Top-Right
#if DebugDraw
				renderer.AddCircle(new Vec2(r.Right - screenRelRad.X, r.Top + screenRelRad.Y), debugColor, screenRelRad, (float)(Math.PI * 1.5f));
#else
				renderer.AddCircle(new Vec2(r.Right - screenRelRad.X, r.Top + screenRelRad.Y), mColor, screenRelRad, (float)(Math.PI * 1.5f));
#endif

				// Bottom-Right
#if DebugDraw
				renderer.AddCircle(new Vec2(r.Right - screenRelRad.X, r.Bottom - screenRelRad.Y), debugColor, screenRelRad, 0f, (float)(Math.PI * 0.5f));
#else
				renderer.AddCircle(new Vec2(r.Right - screenRelRad.X, r.Bottom - screenRelRad.Y), mColor, screenRelRad, 0f, (float)(Math.PI * 0.5f));
#endif

				// Bottom-Left
#if DebugDraw
				renderer.AddCircle(new Vec2(r.Left + screenRelRad.X, r.Bottom - screenRelRad.Y), debugColor, screenRelRad, (float)(Math.PI * 0.5), (float)Math.PI);
#else
				renderer.AddCircle(new Vec2(r.Left + screenRelRad.X, r.Bottom - screenRelRad.Y), mColor, screenRelRad, (float)(Math.PI * 0.5), (float)Math.PI);
#endif

				// Middle-Middle
#if DebugDraw
				renderer.AddQuad(new Rect(r.Left, r.Top + screenRelRad.Y, r.Right, r.Bottom - screenRelRad.Y), debugColor2);
#else
				renderer.AddQuad(new Rect(r.Left, r.Top + screenRelRad.Y, r.Right, r.Bottom - screenRelRad.Y), mColor);
#endif
				// Middle-Top
				renderer.AddQuad(new Rect(r.Left + screenRelRad.X, r.Top, r.Right - screenRelRad.X, r.Top + screenRelRad.Y), mColor);
				// Middle-Bottom
				renderer.AddQuad(new Rect(r.Left + screenRelRad.X, r.Bottom - screenRelRad.Y, r.Right - screenRelRad.X, r.Bottom), mColor);


				if (mBorderWidth.Value != Vec2.Zero)
				{
					Vec2 screenRel = this.ScreenFromValue(mBorderWidth);

					float xHalfWidth = screenRel.X / 2;
					float yHalfWidth = screenRel.Y / 2;
					// Top
					renderer.AddQuad(new Rect(r.Left + screenRelRad.X, r.Top + yHalfWidth, r.Right - screenRelRad.X, r.Top - yHalfWidth), mBorderColor);
					// Right
					renderer.AddQuad(new Rect(r.Right - xHalfWidth, r.Top + screenRelRad.Y, r.Right + xHalfWidth, r.Bottom - screenRelRad.Y), mBorderColor);
					// Bottom
					renderer.AddQuad(new Rect(r.Left + screenRelRad.X, r.Bottom - yHalfWidth, r.Right - screenRelRad.X, r.Bottom + yHalfWidth), mBorderColor);
					// Left
					renderer.AddQuad(new Rect(r.Left - xHalfWidth, r.Top + screenRelRad.Y, r.Left + xHalfWidth, r.Bottom - screenRelRad.Y), mBorderColor);

					// Top-Left
					BezierCurve curve = new BezierCurve();
					curve.AddValue(0, new Vec3(r.Left, r.Top + screenRelRad.Y, 0f));
					curve.AddValue(1, new Vec3(r.LeftTop, 0f));
					curve.AddValue(2, new Vec3(r.Left + screenRelRad.X, r.Top, 0f));
					renderer.AddTriangles(LineRenderer.GenerateTrianglesFromCurve(renderer, curve, 0.1f, screenRel, mBorderColor));

					// Top-Right
					curve = new BezierCurve();
					curve.AddValue(0, new Vec3(r.Right - screenRelRad.X, r.Top, 0f));
					curve.AddValue(1, new Vec3(r.RightTop, 0f));
					curve.AddValue(2, new Vec3(r.Right, r.Top + screenRelRad.Y, 0f));
					renderer.AddTriangles(LineRenderer.GenerateTrianglesFromCurve(renderer, curve, 0.1f, screenRel, mBorderColor));

					// Bottom-Right
					curve = new BezierCurve();
					curve.AddValue(0, new Vec3(r.Right, r.Bottom - screenRelRad.Y, 0f));
					curve.AddValue(1, new Vec3(r.RightBottom, 0f));
					curve.AddValue(2, new Vec3(r.Right - screenRelRad.X, r.Bottom, 0f));
					renderer.AddTriangles(LineRenderer.GenerateTrianglesFromCurve(renderer, curve, 0.1f, screenRel, mBorderColor));

					// Bottom-Left
					curve = new BezierCurve();
					curve.AddValue(0, new Vec3(r.Left + screenRelRad.X, r.Bottom, 0f));
					curve.AddValue(1, new Vec3(r.LeftBottom, 0f));
					curve.AddValue(2, new Vec3(r.Left, r.Bottom - screenRelRad.Y, 0f));
					renderer.AddTriangles(LineRenderer.GenerateTrianglesFromCurve(renderer, curve, 0.1f, screenRel, mBorderColor));
				}
			}
			else
			{
				// Center
				renderer.AddQuad(r, Color);

				if (mBorderWidth.Value != Vec2.Zero)
				{
					Vec2 screenRel = this.ScreenFromValue(mBorderWidth);

					float xHalfWidth = screenRel.X / 2;
					float yHalfWidth = screenRel.Y / 2;
					// Top
					renderer.AddQuad(new Rect(r.Left, r.Top + yHalfWidth, r.Right + xHalfWidth, r.Top - yHalfWidth), mBorderColor);
					// Right
					renderer.AddQuad(new Rect(r.Right - xHalfWidth, r.Bottom + yHalfWidth, r.Right + xHalfWidth, r.Top), mBorderColor);
					// Bottom
					renderer.AddQuad(new Rect(r.Left - xHalfWidth, r.Bottom + yHalfWidth, r.Right, r.Bottom - yHalfWidth), mBorderColor);
					// Left
					renderer.AddQuad(new Rect(r.Left - xHalfWidth, r.Bottom, r.Left + xHalfWidth, r.Top - yHalfWidth), mBorderColor);
				}
			}
		}