public void RenderBorderBack(ISquare square) { IGLColor color = IsSelected ? _selectedColor : _color; IGLColor foldColor = IsSelected ? _selectedFoldColor : _foldColor; _glUtils.DrawQuad(0, square.BottomLeft.ToVector3(), square.BottomRight.ToVector3(), square.TopLeft.ToVector3(), square.TopRight.ToVector3(), color, color, color, color); float foldHeight = (square.MaxY - square.MinY) * (1f / 5f); PointF foldBottom = new PointF((square.TopLeft.X + square.TopRight.X) / 2f, square.TopLeft.Y - foldHeight); _glUtils.DrawTriangleFan(0, new GLVertex[] { new GLVertex(square.TopLeft.ToVector2(), _emptyVector, foldColor), new GLVertex(foldBottom.ToVector2(), _emptyVector, foldColor), new GLVertex(square.TopRight.ToVector2(), _emptyVector, foldColor)}); }
private void drawRoundCorner(PointF center, float radius, float angle, ISquare border, FourCorners<IGLColor> colors) { Vector2 tex = new Vector2 (); GLVertex centerVertex = new GLVertex (center.ToVector2(), tex, getColor(colors, border, center)); _roundCorner[0] = centerVertex; float step = (90f / (_roundCorner.Length - 2)); for (int i = 1; i < _roundCorner.Length; i++) { float anglerad = (float)Math.PI * angle / 180.0f; float x = (float)Math.Sin(anglerad) * radius; float y = (float)Math.Cos(anglerad) * radius; angle += step; PointF point = new PointF (x + center.X, y + center.Y); _roundCorner[i] = new GLVertex (point.ToVector2(), tex, getColor(colors, border, point)); } _glUtils.DrawTriangleFan(0, _roundCorner); }