private void RenderNavMesh(NavMesh navMesh) { GLUtil.SetColor(new Color(0f, 0f, 1.0f, 0.5f)); navMesh.PolygonList.ForEach(x => GLUtil.RenderPolygonFilled(x)); GLUtil.SetColor(new Color(0.5f, 0.1f, 0.1f, 1f)); navMesh.PolygonList.ForEach(x => GLUtil.RenderPolygon(x)); }
public static void DrawCircle(Circle circle, Color color) { GLUtil.SetColor(color); Gl.glBegin(Gl.GL_LINE_LOOP); PlotCircleVertices(circle.X, circle.Y, circle.Radius); Gl.glEnd(); }
private void RenderIntersectEdges() { foreach (PolygonEdgePair pair in _intersectedEdges) { GLUtil.DrawLine2d(pair.Polygon.Vertices[pair.Edge.Start], pair.Polygon.Vertices[pair.Edge.End]); } }
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)); } }
public void Render() { if (_haveStartPoint) { GLUtil.SetColor(new Color(0.8f, 0.3f, 0.8f, 1)); GLUtil.DrawLine2d(_startPoint, _input.Mouse.Position); RenderIntersectEdges(); } RenderLinks(); }
internal static void DrawFilledCircle(Point point, double radius, Color color) { GLUtil.SetColor(color); Gl.glBegin(Gl.GL_TRIANGLE_FAN); { Gl.glVertex2d(point.X, point.Y); PlotCircleVertices(point.X, point.Y, radius); Gl.glVertex2d(point.X + radius * Math.Cos(0), point.Y + radius * Math.Sin(0)); } Gl.glEnd(); }
public void Render() { GLUtil.Clear(new Color(0.5f, 0.5f, 0.5f, 0)); Gl.glEnable(Gl.GL_TEXTURE_2D); { _scene.Render(); } Gl.glDisable(Gl.GL_TEXTURE_2D); RenderNavMesh(_scene.NavMesh); _editState.Render(); }
internal static void RenderPolygonFilled(Engine.PathFinding.ConvexPolygon polygon) { Gl.glBegin(Gl.GL_POLYGON); { foreach (Point p in polygon.Vertices) { GLUtil.DrawPointVertex(p); } GLUtil.DrawPointVertex(polygon.Vertices.First()); } Gl.glEnd(); }
private void RenderEditableVertices() { if (_selectedPolygon == null) { return; } for (int i = 0; i < _selectedPolygon.Vertices.Count; i++) { GLUtil.DrawCircle(_selectedPolygon.Vertices[i], 15, new Color(0, 0, 0, 1)); } }
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)); } } }