Пример #1
0
        public void RenderPicking(bool isLocalMap)
        {
            if (!Visible)
            {
                return;
            }

            VisualSettings Settings = (Application.OpenForms[0] as Form1).Settings;

            Gl.glPointSize(Settings.PointSize + 2f);

            Color pickingColor = SectionPicking.GetColor(isLocalMap ? Sections.LocalMap : Sections.GlobalMap, 0, 0, PointID.Left);

            Gl.glColor4f(pickingColor.R / 255f, pickingColor.G / 255f, pickingColor.B / 255f, 1f);
            Gl.glBegin(Gl.GL_POINTS);
            Gl.glVertex2f(BottomLeftX, BottomLeftZ);
            Gl.glEnd();

            pickingColor = SectionPicking.GetColor(isLocalMap ? Sections.LocalMap : Sections.GlobalMap, 0, 0, PointID.Right);
            Gl.glColor4f(pickingColor.R / 255f, pickingColor.G / 255f, pickingColor.B / 255f, 1f);
            Gl.glBegin(Gl.GL_POINTS);
            Gl.glVertex2f(TopRightX, TopRightZ);
            Gl.glEnd();
        }
Пример #2
0
        public void Render(bool isLocalMap)
        {
            if (!Visible)
            {
                return;
            }
            VisualSettings Settings = (Application.OpenForms[0] as Form1).Settings;
            Color          renderColor;

            if (isLocalMap)
            {
                renderColor = Color.FromArgb(0, 0, 0);
            }
            else
            {
                renderColor = Color.FromArgb(128, 128, 128);
            }

            Gl.glBindTexture(Gl.GL_TEXTURE_2D, 0);
            Gl.glColor4f(renderColor.R / 255f, renderColor.G / 255f, renderColor.B / 255f, 1f);
            Gl.glBegin(Gl.GL_POINTS);
            Gl.glVertex2f(BottomLeftX, BottomLeftZ);
            Gl.glEnd();
            Gl.glBegin(Gl.GL_POINTS);
            Gl.glVertex2f(TopRightX, TopRightZ);
            Gl.glEnd();

            Gl.glLineWidth(Settings.LineWidth);
            Gl.glColor4f(renderColor.R / 255f, renderColor.G / 255f, renderColor.B / 255f, 1f);
            Gl.glBegin(Gl.GL_LINES);

            Gl.glVertex2f(BottomLeftX, BottomLeftZ);
            Gl.glVertex2f(TopRightX, BottomLeftZ);
            Gl.glVertex2f(TopRightX, BottomLeftZ);
            Gl.glVertex2f(TopRightX, TopRightZ);
            Gl.glVertex2f(TopRightX, TopRightZ);
            Gl.glVertex2f(BottomLeftX, TopRightZ);
            Gl.glVertex2f(BottomLeftX, TopRightZ);
            Gl.glVertex2f(BottomLeftX, BottomLeftZ);

            Gl.glEnd();

            if (Image != null)
            {
                float botCoord  = isLocalMap ? 0 : 1f - (1 / 1.065f);
                float rightCoor = isLocalMap ? 1 : 1 / 1.295f;

                Gl.glBindTexture(Gl.GL_TEXTURE_2D, isLocalMap ? 1 : 2);
                Gl.glColor3f(1f, 1f, 1f);
                Gl.glBegin(Gl.GL_QUADS);
                Gl.glTexCoord2f(0, botCoord);
                Gl.glVertex2f(BottomLeftX, BottomLeftZ);
                Gl.glTexCoord2f(rightCoor, botCoord);
                Gl.glVertex2f(TopRightX, BottomLeftZ);
                Gl.glTexCoord2f(rightCoor, 1);
                Gl.glVertex2f(TopRightX, TopRightZ);
                Gl.glTexCoord2f(0, 1);
                Gl.glVertex2f(BottomLeftX, TopRightZ);
                Gl.glEnd();
            }
        }