Beispiel #1
0
        protected void DrawWall(Graphics G, RooWall Wall, Pen Pen, bool Infinite, Pen PenInfinite)
        {
            V2 p1p2;

            // transform points to match world of pixeldrawing
            float transx1 = (float)(Wall.P1.X - boxMin.X) * ZoomInv;
            float transy1 = (float)(Wall.P1.Y - boxMin.Y) * ZoomInv;
            float transx2 = (float)(Wall.P2.X - boxMin.X) * ZoomInv;
            float transy2 = (float)(Wall.P2.Y - boxMin.Y) * ZoomInv;

            // draw extensions of line
            if (Infinite)
            {
                V2 p1 = new V2(transx1, transy1);
                V2 p2 = new V2(transx2, transy2);
                p1p2 = p2 - p1;

                p2 += 1000f * p1p2;
                p1 -= 1000f * p1p2;

                G.DrawLine(PenInfinite, (float)p1.X, (float)p1.Y, (float)p2.X, (float)p2.Y);
            }

            // check if this is an issue line (almost horizontal or vertical, but not fully)
            p1p2 = Wall.GetP1P2();
            if (chkVertHortLines.Checked && p1p2.X != 0.0f && p1p2.Y != 0.0f)
            {
                Real m = (Real)(p1p2.Y / p1p2.X);

                if ((m > -0.125f && m < 0.125f) ||
                    (m > 8.0f || m < -8.0f))
                {
                    Pen = penRed2;
                }
            }

            // draw line
            G.DrawLine(Pen, transx1, transy1, transx2, transy2);
        }
Beispiel #2
0
 /// <summary>
 /// Draw a wall
 /// </summary>
 /// <param name="Wall"></param>
 /// <param name="x1"></param>
 /// <param name="y1"></param>
 /// <param name="x2"></param>
 /// <param name="y2"></param>
 public abstract void DrawWall(RooWall Wall, Real x1, Real y1, Real x2, Real y2);
Beispiel #3
0
 public override void DrawWall(RooWall Wall, Real x1, Real y1, Real x2, Real y2)
 {
     // draw
     g.DrawLine(wallPen, (float)x1, (float)y1, (float)x2, (float)y2);
 }
Beispiel #4
0
        protected void DrawElements(Graphics G)
        {
            Point[] points;

            if (room == null || G == null)
            {
                return;
            }

            G.InterpolationMode = InterpolationMode.HighQualityBicubic;
            G.SmoothingMode     = SmoothingMode.HighQuality;

            /**********************************************************************************/

            // fill selected sector
            if (selectedSector != null)
            {
                foreach (RooSubSector obj in Room.BSPTreeLeaves)
                {
                    if (obj.Sector != selectedSector)
                    {
                        continue;
                    }

                    points = new Point[obj.Vertices.Count];

                    for (int i = 0; i < obj.Vertices.Count; i++)
                    {
                        points[i].X = (int)(((float)obj.Vertices[i].X - boxMin.X) * ZoomInv);
                        points[i].Y = (int)(((float)obj.Vertices[i].Y - boxMin.Y) * ZoomInv);
                    }

                    G.FillPolygon(brushSolidGreen, points);
                }
            }

            /**********************************************************************************/

            // fill selected subsector
            if (selectedSubSector != null)
            {
                points = new Point[selectedSubSector.Vertices.Count];

                for (int i = 0; i < selectedSubSector.Vertices.Count; i++)
                {
                    points[i].X = (int)(((float)selectedSubSector.Vertices[i].X - boxMin.X) * ZoomInv);
                    points[i].Y = (int)(((float)selectedSubSector.Vertices[i].Y - boxMin.Y) * ZoomInv);
                }

                G.FillPolygon(brushSolidPaleGreen, points);
            }

            // draw polys in non convex poly list from bspbuilder
            foreach (Polygon poly in bspBuilderNonConvexPolygons)
            {
                points = new Point[poly.Count];

                for (int i = 0; i < poly.Count; i++)
                {
                    points[i].X = (int)(((float)poly[i].X - boxMin.X) * ZoomInv);
                    points[i].Y = (int)(((float)poly[i].Y - boxMin.Y) * ZoomInv);

                    G.DrawRectangle(penWhite1, points[i].X - 1, points[i].Y - 1, 2, 2);
                }

                G.FillPolygon(brushSolidRed, points);
            }

            /**********************************************************************************/

            if (chkUseEditorWalls.Checked || selectedWallEditor != null)
            {
                // draw editor walls
                foreach (RooWallEditor rld in Room.WallsEditor)
                {
                    // convert to roowall
                    RooWall wall = rld.ToRooWall(RooFile.VERSIONHIGHRESGRID, Room);

                    // selected walleditor
                    if (selectedWallEditor == rld)
                    {
                        DrawWall(G, wall, penViolet3, false, penLightBlue1);
                    }

                    // normal wall only if not drawn by editorwall
                    else if (chkUseEditorWalls.Checked)
                    {
                        DrawWall(G, wall, penWhite1, false, penLightBlue1);
                    }
                }
            }

            // draw client walls
            foreach (RooWall rld in Room.Walls)
            {
                // selected wall
                if (selectedWall == rld)
                {
                    DrawWall(G, rld, penRed2, false, penLightBlue1);
                }

                // selected side
                else if (selectedSide != null && (rld.LeftSide == selectedSide || rld.RightSide == selectedSide))
                {
                    DrawWall(G, rld, penOrange2, false, penLightBlue1);
                }

                // selected partitionline
                else if (selectedPartitionLine != null && (rld == selectedPartitionLine.Wall))
                {
                    DrawWall(G, rld, penBlue2, true, penLightBlue1);
                }

                // default
                else if (!chkUseEditorWalls.Checked)
                {
                    DrawWall(G, rld, penWhite1, false, penLightBlue1);
                }
            }

            /**********************************************************************************/

            if (chkVertexMismatches.Checked)
            {
                List <Tuple <RooSubSector, V2, float> > vertexmismatch;
                foreach (RooSubSector subsect in Room.BSPTreeLeaves)
                {
                    foreach (V2 vertex in subsect.Vertices)
                    {
                        vertexmismatch = Program.FindVertexMismatches(vertex);

                        if (vertexmismatch.Count > 0)
                        {
                            float transx1 = ((float)vertex.X - (float)boxMin.X) * ZoomInv;
                            float transy1 = ((float)vertex.Y - (float)boxMin.Y) * ZoomInv;

                            Pen pen = (vertexmismatch[0].Item3 == 2) ? penRed1 : penOrange1;

                            G.DrawRectangle(pen, transx1 - 5, transy1 - 5, 10, 10);
                        }
                    }
                }
            }
        }