public void Render()
        {
            Gl.glClearColor(1, 1, 1, 0);
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);

            _pathFinder.Polygons.ForEach(x => PolyDrawer.RenderPoly(x));



            if (_drawingPath)
            {
                PrimitiveDrawer.DrawFilledCircle(_pathStart, 15, new Color(0, 0, 0, 1));
            }


            GLUtil.SetColor(new Color(1, 0, 0, 1));
            Gl.glBegin(Gl.GL_LINE_STRIP);
            {
                foreach (Point p in _path)
                {
                    GLUtil.DrawPointVertex(p);
                }
            }
            Gl.glEnd();



            _renderer.DrawText(0, 0, "Path Drawing State", _font);
            Gl.glEnable(Gl.GL_TEXTURE_2D);
            Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA);
            _renderer.Render();
            Gl.glDisable(Gl.GL_TEXTURE_2D);
        }
 private void DrawPath(List <NavNode> list)
 {
     GLUtil.SetColor(new Color(0, 0, 0, 1));
     Gl.glBegin(Gl.GL_LINE_STRIP);
     {
         foreach (NavNode node in list)
         {
             GLUtil.DrawPointVertex(node.Position);
         }
     }
     Gl.glEnd();
 }
 internal static void RenderPoly(ConvexPolyForm poly)
 {
     Gl.glBegin(Gl.GL_LINE_STRIP);
     {
         foreach (Point p in poly.Vertices)
         {
             GLUtil.DrawPointVertex(p);
         }
         GLUtil.DrawPointVertex(poly.Vertices.First());
     }
     Gl.glEnd();
 }
Exemplo n.º 4
0
        private void RenderNormals(ConvexPolyForm poly)
        {
            GLUtil.SetColor(new Color(0, 1, 0, 1));

            foreach (EdgeIndex edge in poly.Edges)
            {
                Point start  = poly.Vertices[edge.Start];
                Point end    = poly.Vertices[edge.End];
                Point middle = LineSegment.GetMiddle(start, end);
                Point normal = EdgeIndex.GetLineNormal(start, end);
                Gl.glBegin(Gl.GL_LINES);
                {
                    GLUtil.DrawPointVertex(middle);
                    GLUtil.DrawPointVertex(new Point(middle.X + (normal.X * 50), middle.Y + (normal.Y * 50)));
                }
                Gl.glEnd();
            }
        }
Exemplo n.º 5
0
        private void RenderNearestEdge(ConvexPolyForm poly)
        {
            EdgeIndex edge = poly.GetClosestEdge(_input.Mouse.Position);

            GLUtil.SetColor(new Color(1, 0, 0, 1));
            Gl.glBegin(Gl.GL_LINE_STRIP);
            {
                GLUtil.DrawPointVertex(poly.Vertices[edge.Start]);
                GLUtil.DrawPointVertex(poly.Vertices[edge.End]);
            }
            Gl.glEnd();

            // Render closest point
            Point p = EdgeIndex.GetClosestPoint(poly.Vertices[edge.Start], poly.Vertices[edge.End], _input.Mouse.Position);

            Gl.glBegin(Gl.GL_POINTS);
            {
                GLUtil.DrawPointVertex(p);
            }
            Gl.glEnd();
        }