Exemplo n.º 1
0
        private void RenderConnections()
        {
            // Render the connections between the edges
            foreach (Connection connection in _connections)
            {
                Point firstStart = connection.StartPoly.Vertices[connection.StartEdgeIndex.Start];
                Point firstEnd   = connection.StartPoly.Vertices[connection.StartEdgeIndex.End];
                float length1    = EdgeIndex.Length(firstStart, firstEnd);

                Point secondStart = connection.EndPoly.Vertices[connection.EndEdgeIndex.Start];
                Point secondEnd   = connection.EndPoly.Vertices[connection.EndEdgeIndex.End];
                float length2     = EdgeIndex.Length(secondStart, secondEnd);

                if (length1 <= length2)
                {
                    Point point = LineSegment.GetMiddle(firstStart, firstEnd);
                    PrimitiveDrawer.DrawFilledCircle(point, 15, new Color(0, 0, 1, 1));
                }
                else
                {
                    Point point = LineSegment.GetMiddle(secondStart, secondEnd);
                    PrimitiveDrawer.DrawFilledCircle(point, 15, new Color(0, 0, 1, 1));
                }
            }
        }
        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);
        }
Exemplo n.º 3
0
        private void RenderVerts(ConvexPolyForm poly)
        {
            for (int i = 0; i < poly.Vertices.Count; i++)
            {
                Point p = poly.Vertices[i];
                PrimitiveDrawer.DrawCircle(new Circle(p.X, p.Y, 16), new Color(0, 0, 0, 1));

                if (i == _selectedVert && _editState == EditState.VertexPressed)
                {
                    PrimitiveDrawer.DrawFilledCircle(p, 15, new Color(0, 1, 1, 1));
                }
                else
                {
                    PrimitiveDrawer.DrawFilledCircle(p, 15, new Color(1, 1, 1, 1));
                }
            }
        }
Exemplo n.º 4
0
 private void RenderCentroid(ConvexPolyForm poly)
 {
     PrimitiveDrawer.DrawFilledCircle(poly.GetCentroid(), 15, new Color(1, 1, 0, 1));
 }