public override void Draw(PrimitiveBatch primitiveBatch) { double angleStep = 2f / this.Radius; float x = 0; float y = 0; for (double angle = 0; angle < Math.PI * 2; angle += angleStep) { x = (float)Math.Round(this.Center.X + this.Radius * Math.Cos(angle)); y = (float)Math.Round(this.Center.Y + this.Radius * Math.Sin(angle)); primitiveBatch.AddVertex(new Vector2(x, y), Color.Yellow); x = (float)Math.Round(this.Center.X + this.Radius * Math.Cos(angle + angleStep)); y = (float)Math.Round(this.Center.Y + this.Radius * Math.Sin(angle + angleStep)); primitiveBatch.AddVertex(new Vector2(x, y), Color.Yellow); } }
public void Draw(PrimitiveBatch primitiveBatch) { primitiveBatch.AddVertex(pointA, Color.Green); primitiveBatch.AddVertex(pointB, Color.Green); primitiveBatch.AddVertex(pointB, Color.Green); primitiveBatch.AddVertex(pointC, Color.Green); primitiveBatch.AddVertex(pointC, Color.Green); primitiveBatch.AddVertex(pointD, Color.Green); primitiveBatch.AddVertex(pointD, Color.Green); primitiveBatch.AddVertex(pointA, Color.Green); if (children != null) { for (int i = 0; i < 4; i++) { this.children[i].Draw(primitiveBatch); } } }
public override void Draw(PrimitiveBatch primitiveBatch) { for (int pointA = 0, pointB = 0; pointA < this.Vertices.Count; pointA++) { if (pointA + 1 == this.Vertices.Count) { pointB = 0; } else { pointB = pointA + 1; } primitiveBatch.AddVertex(this.Vertices[pointA], Color.Red); primitiveBatch.AddVertex(this.Vertices[pointB], Color.Red); } }
public abstract void Draw(PrimitiveBatch primitiveBatch);
public override void Draw(PrimitiveBatch primitiveBatch) { for (int pointA = 0, pointB = 0; pointA < 4; pointA++) { if (pointA + 1 == this.points.Length) { pointB = 0; } else { pointB = pointA + 1; } primitiveBatch.AddVertex(this.points[pointA], Color.Blue); primitiveBatch.AddVertex(this.points[pointB], Color.Blue); } }