Ejemplo n.º 1
0
    // Destruction 2D
    static public void DrawStrippedLine(List <Vector2D> pointsList, float minVertsDistance, float z = 0f, bool full = false, Vector2D offset = null)
    {
        if (offset == null)
        {
            offset = new Vector2D(0, 0);
        }

        Vector2D vA = null, vB = null;

        if (setBorder == true)
        {
            Color tmcColor = setColor;
            float tmpWidth = lineWidth;

            GL.PushMatrix();
            SetColor(Color.black);
            lineMaterial.SetPass(0);
            GL.Begin(GL.QUADS);

            lineWidth = 2f * tmpWidth;

            foreach (Pair2D id in Pair2D.GetList(pointsList, full))
            {
                vA = new Vector2D(id.A + offset);
                vB = new Vector2D(id.B + offset);

                vA.Push(Vector2D.Atan2(id.A, id.B), -minVertsDistance / 5 * setScale);
                vB.Push(Vector2D.Atan2(id.A, id.B), minVertsDistance / 5 * setScale);

                Max2DMatrix.DrawLineImage(new Pair2D(vA, vB), z);
            }

            GL.End();
            GL.PopMatrix();

            SetColor(tmcColor);
            lineWidth = tmpWidth;
        }

        GL.PushMatrix();
        lineMaterial.SetPass(0);
        GL.Begin(GL.QUADS);

        foreach (Pair2D id in Pair2D.GetList(pointsList, full))
        {
            vA = new Vector2D(id.A + offset);
            vB = new Vector2D(id.B + offset);

            vA.Push(Vector2D.Atan2(id.A, id.B), -minVertsDistance / 4 * setScale);
            vB.Push(Vector2D.Atan2(id.A, id.B), minVertsDistance / 4 * setScale);

            Max2DMatrix.DrawLineImage(new Pair2D(vA, vB), z);
        }

        GL.End();
        GL.PopMatrix();
    }
Ejemplo n.º 2
0
    static public void DrawSmoothLine(Pair2D pair, float z = 0f)
    {
        GL.PushMatrix();
        SetPass(lineMaterial);
        GL.Begin(GL.QUADS);

        Max2DMatrix.DrawLineImage(pair, z);

        GL.End();
        GL.PopMatrix();
    }
Ejemplo n.º 3
0
    static public void DrawLineRectf(float x, float y, float w, float h, float z = 0f)
    {
        if (lineMode == LineMode.Smooth)
        {
            GL.PushMatrix();
            SetPass(lineMaterial);
            GL.Begin(GL.QUADS);

            if (setBorder == true)
            {
                Color tmcColor = setColor;
                float tmpWidth = lineWidth;

                SetColor(Color.black);
                lineWidth = tmpWidth * 2f;

                Max2DMatrix.DrawLineImage(new Pair2D(new Vector2D(x, y), new Vector2D(x + w, y)), z);
                Max2DMatrix.DrawLineImage(new Pair2D(new Vector2D(x, y), new Vector2D(x, y + h)), z);
                Max2DMatrix.DrawLineImage(new Pair2D(new Vector2D(x + w, y), new Vector2D(x + w, y + h)), z);
                Max2DMatrix.DrawLineImage(new Pair2D(new Vector2D(x, y + h), new Vector2D(x + w, y + h)), z);

                SetColor(tmcColor);
                lineWidth = tmpWidth;
            }

            float tmpLine = lineWidth;
            lineWidth = tmpLine * 1f;

            SetColor(setColor);

            Max2DMatrix.DrawLineImage(new Pair2D(new Vector2D(x, y), new Vector2D(x + w, y)), z);
            Max2DMatrix.DrawLineImage(new Pair2D(new Vector2D(x, y), new Vector2D(x, y + h)), z);
            Max2DMatrix.DrawLineImage(new Pair2D(new Vector2D(x + w, y), new Vector2D(x + w, y + h)), z);
            Max2DMatrix.DrawLineImage(new Pair2D(new Vector2D(x, y + h), new Vector2D(x + w, y + h)), z);

            GL.End();
            GL.PopMatrix();

            lineWidth = tmpLine;
        }
        else
        {
            DrawLine(new Vector2D(x, y), new Vector2D(x + w, y), z);
            DrawLine(new Vector2D(x + w, y), new Vector2D(x + w, y + h), z);
            DrawLine(new Vector2D(x + w, y + h), new Vector2D(x, y + h), z);
            DrawLine(new Vector2D(x, y + h), new Vector2D(x, y), z);
        }
    }