private void RenderLinks()
 {
     foreach (PolygonLink link in _navMesh.Links)
     {
         Point position = link.GetShortestEdge().GetMiddle();
         GLUtil.DrawFilledCircle(position, 10, new Color(0.8f, 0.3f, 0.8f, 1));
     }
 }
Beispiel #2
0
        public void Render()
        {
            GLUtil.Clear(new Color(0, 0, 0, 1));

            Gl.glEnable(Gl.GL_TEXTURE_2D);
            foreach (Layer layer in _scene.Layers)
            {
                layer.Render(_renderer);
            }



            _renderer.Render();
            Gl.glDisable(Gl.GL_TEXTURE_2D);

            if (_canWalkMousePosition)
            {
                GLUtil.DrawFilledCircle(_input.Mouse.Position, 10, new Color(0, 1, 0, 1));
            }
            else
            {
                GLUtil.DrawFilledCircle(_input.Mouse.Position, 10, new Color(1, 0, 0, 1));
            }

            // Draw the basic nav meshes
            GLUtil.SetColor(new Color(1, 0, 0, 1));
            _scene.NavMesh.PolygonList.ForEach(x => GLUtil.RenderPolygon(x));
            GLUtil.SetColor(new Color(1, 1, 1, 1));
            Gl.glLineWidth(4);
            Gl.glBegin(Gl.GL_LINE_STRIP);
            {
                foreach (Point point in _path)
                {
                    GLUtil.DrawPointVertex(point);
                }
            }
            Gl.glEnd();
            Gl.glLineWidth(1);

            Gl.glEnable(Gl.GL_TEXTURE_2D);
            _playerCharacter.Render(_renderer);
            _renderer.Render();
            Gl.glDisable(Gl.GL_TEXTURE_2D);
        }
        private void RenderEditableVertices()
        {
            if (_selectedPolygon == null)
            {
                return;
            }

            for (int i = 0; i < _selectedPolygon.Vertices.Count; i++)
            {
                if (i == _selectedVertexIndex)
                {
                    GLUtil.DrawFilledCircle(_selectedPolygon.Vertices[i], VertexEditRadius - 1, new Color(1, 1, 0, 1));
                    GLUtil.DrawCircle(_selectedPolygon.Vertices[i], VertexEditRadius, new Color(0, 0, 0, 1));
                }
                else
                {
                    GLUtil.DrawFilledCircle(_selectedPolygon.Vertices[i], VertexEditRadius - 1, new Color(1, 1, 1, 1));
                    GLUtil.DrawCircle(_selectedPolygon.Vertices[i], VertexEditRadius, new Color(0, 0, 0, 1));
                }
            }
        }