Ejemplo n.º 1
0
        private void Render(ConvexPolyForm poly)
        {
            if (poly == _selectedPoly)
            {
                GLUtil.SetColor(new Color(0, 0, 0, 1));
            }
            else
            {
                GLUtil.SetColor(new Color(0.1f, 0.1f, 0.1f, 0.5f));
            }
            PolyDrawer.RenderPoly(poly);

            RenderNormals(poly);
            RenderCentroid(poly);


            if (poly == _selectedPoly)
            {
                RenderNearestEdge(poly);
                RenderVerts(poly);
            }

            if (_editState == EditState.ConnectPressed)
            {
                GLUtil.SetColor(new Color(0, 0, 0, 1));
                PrimitiveDrawer.DrawLine2d(_connectStart, _input.Mouse.Position);
                RenderCrossedEdges();
            }
        }
        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);
        }