コード例 #1
0
ファイル: AGSColoredBorder.cs プロジェクト: saizant/MonoAGS
        private void drawRoundCorner(Vector3 center, float radius, float angle, AGSBoundingBox border, FourCorners <IGLColor> colors)
        {
            Vector2  tex          = new Vector2();
            GLVertex centerVertex = new GLVertex(center.Xy, 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;
                Vector3 point = new Vector3(x + center.X, y + center.Y, 0f);
                _roundCorner[i] = new GLVertex(point.Xy, tex, getColor(colors, border, point));
            }

            _glUtils.DrawTriangleFan(0, _roundCorner);
        }